mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 18:01:22 +00:00
Custom tools with session lifecycle, examples for hooks and tools
- Custom tools: TypeScript modules that extend pi with new tools - Custom TUI rendering via renderCall/renderResult - User interaction via pi.ui (select, confirm, input, notify) - Session lifecycle via onSession callback for state reconstruction - Examples: todo.ts, question.ts, hello.ts - Hook examples: permission-gate, git-checkpoint, protected-paths - Session lifecycle centralized in AgentSession - Works across all modes (interactive, print, RPC) - Unified session event for hooks (replaces session_start/session_switch) - Box component added to pi-tui - Examples bundled in npm and binary releases Fixes #190
This commit is contained in:
parent
295f51b53f
commit
e7097d911a
33 changed files with 1926 additions and 117 deletions
|
|
@ -26,6 +26,7 @@ export interface Args {
|
|||
models?: string[];
|
||||
tools?: ToolName[];
|
||||
hooks?: string[];
|
||||
customTools?: string[];
|
||||
print?: boolean;
|
||||
export?: string;
|
||||
noSkills?: boolean;
|
||||
|
|
@ -109,6 +110,9 @@ export function parseArgs(args: string[]): Args {
|
|||
} else if (arg === "--hook" && i + 1 < args.length) {
|
||||
result.hooks = result.hooks ?? [];
|
||||
result.hooks.push(args[++i]);
|
||||
} else if (arg === "--tool" && i + 1 < args.length) {
|
||||
result.customTools = result.customTools ?? [];
|
||||
result.customTools.push(args[++i]);
|
||||
} else if (arg === "--no-skills") {
|
||||
result.noSkills = true;
|
||||
} else if (arg === "--list-models") {
|
||||
|
|
@ -151,6 +155,7 @@ ${chalk.bold("Options:")}
|
|||
Available: read, bash, edit, write, grep, find, ls
|
||||
--thinking <level> Set thinking level: off, minimal, low, medium, high, xhigh
|
||||
--hook <path> Load a hook file (can be used multiple times)
|
||||
--tool <path> Load a custom tool file (can be used multiple times)
|
||||
--no-skills Disable skills discovery and loading
|
||||
--export <file> Export session file to HTML and exit
|
||||
--list-models [search] List available models (with optional fuzzy search)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue