mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 20:03:05 +00:00
feat(coding-agent): implement hooks system
- Add hooks infrastructure in core/hooks/ (loader, runner, types)
- HookUIContext interface with mode-specific implementations
- Interactive mode: TUI-based selector/input/confirm dialogs
- RPC mode: JSON protocol for hook UI requests/responses
- Print mode: no-op UI context (hooks run but can't prompt)
- AgentSession.branch() now async, returns { selectedText, skipped }
- Settings: hooks[] and hookTimeout configuration
- Export hook types from package for hook authors
Based on PR #147 proposal, adapted for new architecture.
This commit is contained in:
parent
195760d8ee
commit
04d59f31ea
17 changed files with 1264 additions and 126 deletions
|
|
@ -19,6 +19,8 @@ export interface Settings {
|
|||
hideThinkingBlock?: boolean;
|
||||
shellPath?: string; // Custom shell path (e.g., for Cygwin users on Windows)
|
||||
collapseChangelog?: boolean; // Show condensed changelog after update (use /changelog for full)
|
||||
hooks?: string[]; // Array of hook file paths
|
||||
hookTimeout?: number; // Timeout for hook execution in ms (default: 30000)
|
||||
}
|
||||
|
||||
export class SettingsManager {
|
||||
|
|
@ -173,4 +175,22 @@ export class SettingsManager {
|
|||
this.settings.collapseChangelog = collapse;
|
||||
this.save();
|
||||
}
|
||||
|
||||
getHookPaths(): string[] {
|
||||
return this.settings.hooks ?? [];
|
||||
}
|
||||
|
||||
setHookPaths(paths: string[]): void {
|
||||
this.settings.hooks = paths;
|
||||
this.save();
|
||||
}
|
||||
|
||||
getHookTimeout(): number {
|
||||
return this.settings.hookTimeout ?? 30000;
|
||||
}
|
||||
|
||||
setHookTimeout(timeout: number): void {
|
||||
this.settings.hookTimeout = timeout;
|
||||
this.save();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue