feat(hook-message-injector): add ToolPermission type support
Add ToolPermission type union: boolean | 'allow' | 'deny' | 'ask' Update StoredMessage and related interfaces for new permission format. 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
parent
f8e1f79960
commit
324ecd872e
@ -1,12 +1,12 @@
|
|||||||
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs"
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs"
|
||||||
import { join } from "node:path"
|
import { join } from "node:path"
|
||||||
import { MESSAGE_STORAGE, PART_STORAGE } from "./constants"
|
import { MESSAGE_STORAGE, PART_STORAGE } from "./constants"
|
||||||
import type { MessageMeta, OriginalMessageContext, TextPart } from "./types"
|
import type { MessageMeta, OriginalMessageContext, TextPart, ToolPermission } from "./types"
|
||||||
|
|
||||||
export interface StoredMessage {
|
export interface StoredMessage {
|
||||||
agent?: string
|
agent?: string
|
||||||
model?: { providerID?: string; modelID?: string }
|
model?: { providerID?: string; modelID?: string }
|
||||||
tools?: Record<string, boolean>
|
tools?: Record<string, ToolPermission>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function findNearestMessageWithFields(messageDir: string): StoredMessage | null {
|
export function findNearestMessageWithFields(messageDir: string): StoredMessage | null {
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
export type ToolPermission = boolean | "allow" | "deny" | "ask"
|
||||||
|
|
||||||
export interface MessageMeta {
|
export interface MessageMeta {
|
||||||
id: string
|
id: string
|
||||||
sessionID: string
|
sessionID: string
|
||||||
@ -15,7 +17,7 @@ export interface MessageMeta {
|
|||||||
cwd: string
|
cwd: string
|
||||||
root: string
|
root: string
|
||||||
}
|
}
|
||||||
tools?: Record<string, boolean>
|
tools?: Record<string, ToolPermission>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OriginalMessageContext {
|
export interface OriginalMessageContext {
|
||||||
@ -28,7 +30,7 @@ export interface OriginalMessageContext {
|
|||||||
cwd?: string
|
cwd?: string
|
||||||
root?: string
|
root?: string
|
||||||
}
|
}
|
||||||
tools?: Record<string, boolean>
|
tools?: Record<string, ToolPermission>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TextPart {
|
export interface TextPart {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user