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:
@@ -22,6 +22,19 @@ export {
|
||||
getLastAssistantUsage,
|
||||
shouldCompact,
|
||||
} from "./core/compaction.js";
|
||||
// Custom tools
|
||||
export type {
|
||||
CustomAgentTool,
|
||||
CustomToolFactory,
|
||||
CustomToolsLoadResult,
|
||||
ExecResult,
|
||||
LoadedCustomTool,
|
||||
RenderResultOptions,
|
||||
SessionEvent as ToolSessionEvent,
|
||||
ToolAPI,
|
||||
ToolUIContext,
|
||||
} from "./core/custom-tools/index.js";
|
||||
export { discoverAndLoadCustomTools, loadCustomTools } from "./core/custom-tools/index.js";
|
||||
// Hook system types
|
||||
export type {
|
||||
AgentEndEvent,
|
||||
@@ -33,8 +46,7 @@ export type {
|
||||
HookEventContext,
|
||||
HookFactory,
|
||||
HookUIContext,
|
||||
SessionStartEvent,
|
||||
SessionSwitchEvent,
|
||||
SessionEvent,
|
||||
ToolCallEvent,
|
||||
ToolCallEventResult,
|
||||
ToolResultEvent,
|
||||
|
||||
Reference in New Issue
Block a user