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:
YeonGyu-Kim 2026-01-05 13:52:11 +09:00
parent f8e1f79960
commit 324ecd872e
2 changed files with 6 additions and 4 deletions

View File

@ -1,12 +1,12 @@
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs"
import { join } from "node:path"
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 {
agent?: string
model?: { providerID?: string; modelID?: string }
tools?: Record<string, boolean>
tools?: Record<string, ToolPermission>
}
export function findNearestMessageWithFields(messageDir: string): StoredMessage | null {

View File

@ -1,3 +1,5 @@
export type ToolPermission = boolean | "allow" | "deny" | "ask"
export interface MessageMeta {
id: string
sessionID: string
@ -15,7 +17,7 @@ export interface MessageMeta {
cwd: string
root: string
}
tools?: Record<string, boolean>
tools?: Record<string, ToolPermission>
}
export interface OriginalMessageContext {
@ -28,7 +30,7 @@ export interface OriginalMessageContext {
cwd?: string
root?: string
}
tools?: Record<string, boolean>
tools?: Record<string, ToolPermission>
}
export interface TextPart {