mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 10:01:21 +00:00
Move exec to HookAPI, sessionManager/modelRegistry to HookEventContext
Breaking changes: - HookEventContext now has sessionManager and modelRegistry (moved from SessionEventBase) - HookAPI now has exec() method (moved from HookEventContext/HookCommandContext) - HookRunner constructor takes sessionManager and modelRegistry as required params - Session events no longer include sessionManager/modelRegistry fields Hook code migration: - event.sessionManager -> ctx.sessionManager - event.modelRegistry -> ctx.modelRegistry - ctx.exec() -> pi.exec() Updated: - src/core/hooks/types.ts - type changes - src/core/hooks/runner.ts - constructor, createContext - src/core/hooks/loader.ts - add exec to HookAPI - src/core/sdk.ts - pass sessionManager/modelRegistry to HookRunner - src/core/agent-session.ts - remove sessionManager/modelRegistry from events - src/modes/* - remove setSessionFile calls, update events - examples/hooks/* - update to new API
This commit is contained in:
parent
7ed8e2e9fc
commit
29fec7848e
14 changed files with 78 additions and 90 deletions
|
|
@ -22,7 +22,10 @@
|
|||
- `CompactionEntry.firstKeptEntryIndex` replaced with `firstKeptEntryId`
|
||||
- `prepareCompaction()` now returns `firstKeptEntryId` in its result
|
||||
- **Hook types**:
|
||||
- `SessionEventBase` now passes `sessionManager` and `modelRegistry` instead of `entries`, `sessionFile`, `previousSessionFile`
|
||||
- `SessionEventBase` no longer has `sessionManager`/`modelRegistry` - access them via `HookEventContext` instead
|
||||
- `HookEventContext` now has `sessionManager` and `modelRegistry` (moved from events)
|
||||
- `HookEventContext` no longer has `exec()` - use `pi.exec()` instead
|
||||
- `HookCommandContext` no longer has `exec()` - use `pi.exec()` instead
|
||||
- `before_compact` event passes `preparation: CompactionPreparation` and `previousCompactions: CompactionEntry[]` (newest first)
|
||||
- `before_switch` event now has `targetSessionFile`, `switch` event has `previousSessionFile`
|
||||
- Removed `resolveApiKey` (use `modelRegistry.getApiKey(model)`)
|
||||
|
|
@ -32,6 +35,7 @@
|
|||
- New `pi.appendEntry(customType, data?)` to persist hook state (does NOT participate in LLM context)
|
||||
- New `pi.registerCommand(name, options)` to register custom slash commands
|
||||
- New `pi.registerCustomMessageRenderer(customType, renderer)` to register custom renderers for `CustomMessageEntry`
|
||||
- New `pi.exec(command, args, options?)` to execute shell commands (moved from `HookEventContext`/`HookCommandContext`)
|
||||
- `CustomMessageRenderer` type: `(entry, options, theme) => Component | null`
|
||||
- Renderers return inner content; the TUI wraps it in a styled Box
|
||||
- New types: `HookMessage<T>`, `RegisteredCommand`, `HookCommandContext`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue