mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 17:01:02 +00:00
refactor(hooks): address PR feedback
- Rename getTools/setTools to getActiveTools/setActiveTools - Add getAllTools to enumerate all configured tools - Remove text_delta event (use turn_end/agent_end instead) - Add shortcut conflict detection: - Skip shortcuts that conflict with built-in shortcuts (with warning) - Log warnings when hooks register same shortcut (last wins) - Add note about prompt cache invalidation in setActiveTools - Update plan-mode hook to use agent_end for [DONE:id] parsing
This commit is contained in:
parent
5b634ddf75
commit
4ecf3f9422
13 changed files with 175 additions and 153 deletions
|
|
@ -447,8 +447,9 @@ export class InteractiveMode {
|
|||
appendEntryHandler: (customType, data) => {
|
||||
this.sessionManager.appendCustomEntry(customType, data);
|
||||
},
|
||||
getToolsHandler: () => this.session.getActiveToolNames(),
|
||||
setToolsHandler: (toolNames) => this.session.setActiveToolsByName(toolNames),
|
||||
getActiveToolsHandler: () => this.session.getActiveToolNames(),
|
||||
getAllToolsHandler: () => this.session.getAllToolNames(),
|
||||
setActiveToolsHandler: (toolNames) => this.session.setActiveToolsByName(toolNames),
|
||||
newSessionHandler: async (options) => {
|
||||
// Stop any loading animation
|
||||
if (this.loadingAnimation) {
|
||||
|
|
|
|||
|
|
@ -40,8 +40,9 @@ export async function runPrintMode(
|
|||
appendEntryHandler: (customType, data) => {
|
||||
session.sessionManager.appendCustomEntry(customType, data);
|
||||
},
|
||||
getToolsHandler: () => session.getActiveToolNames(),
|
||||
setToolsHandler: (toolNames) => session.setActiveToolsByName(toolNames),
|
||||
getActiveToolsHandler: () => session.getActiveToolNames(),
|
||||
getAllToolsHandler: () => session.getAllToolNames(),
|
||||
setActiveToolsHandler: (toolNames: string[]) => session.setActiveToolsByName(toolNames),
|
||||
});
|
||||
hookRunner.onError((err) => {
|
||||
console.error(`Hook error (${err.hookPath}): ${err.error}`);
|
||||
|
|
|
|||
|
|
@ -200,8 +200,9 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
|||
appendEntryHandler: (customType, data) => {
|
||||
session.sessionManager.appendCustomEntry(customType, data);
|
||||
},
|
||||
getToolsHandler: () => session.getActiveToolNames(),
|
||||
setToolsHandler: (toolNames) => session.setActiveToolsByName(toolNames),
|
||||
getActiveToolsHandler: () => session.getActiveToolNames(),
|
||||
getAllToolsHandler: () => session.getAllToolNames(),
|
||||
setActiveToolsHandler: (toolNames: string[]) => session.setActiveToolsByName(toolNames),
|
||||
uiContext: createHookUIContext(),
|
||||
hasUI: false,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue