mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 21:03:19 +00:00
Compaction API: - prepareCompaction() now takes (pathEntries, settings) only - CompactionPreparation restructured: removed cutPoint/messagesToKeep/boundaryStart, added turnPrefixMessages/isSplitTurn/previousSummary/fileOps/settings - compact() now takes (preparation, model, apiKey, customInstructions?, signal?) - Fixed token overflow by using getPath() instead of getEntries() Hook types: - HookEventContext renamed to HookContext - HookCommandContext removed, RegisteredCommand.handler takes (args, ctx) - HookContext now includes model field - SessionBeforeCompactEvent: removed previousCompactions/model, added branchEntries - SessionBeforeTreeEvent: removed model (use ctx.model) - HookRunner.initialize() added for modes to set up callbacks |
||
|---|---|---|
| .. | ||
| custom-tools | ||
| hooks | ||
| sdk | ||
| README.md | ||
Examples
Example code for pi-coding-agent.
Directories
sdk/
Programmatic usage via createAgentSession(). Shows how to customize models, prompts, tools, hooks, and session management.
hooks/
Example hooks for intercepting tool calls, adding safety gates, and integrating with external systems.
custom-tools/
Example custom tools that extend the agent's capabilities.
Running Examples
cd packages/coding-agent
npx tsx examples/sdk/01-minimal.ts
npx tsx examples/hooks/permission-gate.ts