Update plan: HookCommandContext without sendMessage (use pi closure)

This commit is contained in:
Mario Zechner 2025-12-27 02:16:25 +01:00
parent 60130a4c53
commit 09e7e9196c
5 changed files with 22 additions and 27 deletions

View file

@ -28,9 +28,9 @@ import {
import type { LoadedCustomTool, SessionEvent as ToolSessionEvent } from "./custom-tools/index.js";
import { exportSessionToHtml } from "./export-html.js";
import {
type CommandContext,
type ExecOptions,
execCommand,
type HookCommandContext,
type HookMessage,
type HookRunner,
type SessionEventResult,
@ -512,18 +512,13 @@ export class AgentSession {
// Build command context
const cwd = process.cwd();
const ctx: CommandContext = {
const ctx: HookCommandContext = {
args,
ui: uiContext,
hasUI: this._hookRunner.getHasUI(),
cwd,
sessionManager: this.sessionManager,
modelRegistry: this._modelRegistry,
sendMessage: (message, triggerTurn) => {
this.sendHookMessage(message, triggerTurn).catch(() => {
// Error handling is done in sendHookMessage
});
},
exec: (cmd: string, cmdArgs: string[], options?: ExecOptions) => execCommand(cmd, cmdArgs, cwd, options),
};