@bastani/atomic 0.7.17 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4200 -0
- package/README.md +655 -0
- package/dist/builtin/intercom/CHANGELOG.md +195 -0
- package/dist/builtin/intercom/LICENSE +21 -0
- package/dist/builtin/intercom/README.md +484 -0
- package/dist/builtin/intercom/broker/broker.ts +346 -0
- package/dist/builtin/intercom/broker/client.ts +535 -0
- package/dist/builtin/intercom/broker/framing.ts +57 -0
- package/dist/builtin/intercom/broker/paths.ts +21 -0
- package/dist/builtin/intercom/broker/spawn.ts +308 -0
- package/dist/builtin/intercom/config.ts +109 -0
- package/dist/builtin/intercom/index.ts +1780 -0
- package/dist/builtin/intercom/package.json +59 -0
- package/dist/builtin/intercom/reply-tracker.ts +102 -0
- package/dist/builtin/intercom/skills/intercom/SKILL.md +513 -0
- package/dist/builtin/intercom/types.ts +46 -0
- package/dist/builtin/intercom/ui/compose.ts +139 -0
- package/dist/builtin/intercom/ui/inline-message.ts +76 -0
- package/dist/builtin/intercom/ui/session-list.ts +162 -0
- package/dist/builtin/mcp/CHANGELOG.md +346 -0
- package/dist/builtin/mcp/LICENSE +21 -0
- package/dist/builtin/mcp/OAUTH.md +324 -0
- package/dist/builtin/mcp/README.md +373 -0
- package/dist/builtin/mcp/agent-dir.ts +21 -0
- package/dist/builtin/mcp/app-bridge.bundle.js +67 -0
- package/dist/builtin/mcp/cli.js +186 -0
- package/dist/builtin/mcp/commands.ts +420 -0
- package/dist/builtin/mcp/config.ts +667 -0
- package/dist/builtin/mcp/consent-manager.ts +64 -0
- package/dist/builtin/mcp/direct-tools.ts +427 -0
- package/dist/builtin/mcp/errors.ts +219 -0
- package/dist/builtin/mcp/glimpse-ui.ts +80 -0
- package/dist/builtin/mcp/host-html-template.ts +427 -0
- package/dist/builtin/mcp/index.ts +334 -0
- package/dist/builtin/mcp/init.ts +336 -0
- package/dist/builtin/mcp/lifecycle.ts +93 -0
- package/dist/builtin/mcp/logger.ts +169 -0
- package/dist/builtin/mcp/mcp-auth-flow.ts +362 -0
- package/dist/builtin/mcp/mcp-auth.ts +297 -0
- package/dist/builtin/mcp/mcp-callback-server.ts +284 -0
- package/dist/builtin/mcp/mcp-oauth-provider.ts +302 -0
- package/dist/builtin/mcp/mcp-panel.ts +826 -0
- package/dist/builtin/mcp/mcp-setup-panel.ts +577 -0
- package/dist/builtin/mcp/metadata-cache.ts +201 -0
- package/dist/builtin/mcp/npx-resolver.ts +424 -0
- package/dist/builtin/mcp/oauth-handler.ts +60 -0
- package/dist/builtin/mcp/onboarding-state.ts +68 -0
- package/dist/builtin/mcp/package.json +61 -0
- package/dist/builtin/mcp/proxy-modes.ts +803 -0
- package/dist/builtin/mcp/resource-tools.ts +17 -0
- package/dist/builtin/mcp/sampling-handler.ts +268 -0
- package/dist/builtin/mcp/server-manager.ts +375 -0
- package/dist/builtin/mcp/state.ts +41 -0
- package/dist/builtin/mcp/tool-metadata.ts +152 -0
- package/dist/builtin/mcp/tool-registrar.ts +46 -0
- package/dist/builtin/mcp/tool-result-renderer.ts +65 -0
- package/dist/builtin/mcp/types.ts +441 -0
- package/dist/builtin/mcp/ui-resource-handler.ts +145 -0
- package/dist/builtin/mcp/ui-server.ts +623 -0
- package/dist/builtin/mcp/ui-session.ts +384 -0
- package/dist/builtin/mcp/ui-stream-types.ts +89 -0
- package/dist/builtin/mcp/utils.ts +129 -0
- package/dist/builtin/subagents/CHANGELOG.md +1019 -0
- package/dist/builtin/subagents/README.md +991 -0
- package/dist/builtin/subagents/agents/code-simplifier.md +84 -0
- package/dist/builtin/subagents/agents/codebase-analyzer.md +158 -0
- package/dist/builtin/subagents/agents/codebase-locator.md +113 -0
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +317 -0
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +236 -0
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +181 -0
- package/dist/builtin/subagents/agents/codebase-research-locator.md +146 -0
- package/dist/builtin/subagents/agents/debugger.md +92 -0
- package/dist/builtin/subagents/package.json +67 -0
- package/dist/builtin/subagents/prompts/gather-context-and-clarify.md +20 -0
- package/dist/builtin/subagents/prompts/parallel-cleanup.md +60 -0
- package/dist/builtin/subagents/prompts/parallel-context-build.md +55 -0
- package/dist/builtin/subagents/prompts/parallel-handoff-plan.md +77 -0
- package/dist/builtin/subagents/prompts/parallel-research.md +58 -0
- package/dist/builtin/subagents/prompts/parallel-review.md +52 -0
- package/dist/builtin/subagents/prompts/review-loop.md +48 -0
- package/dist/builtin/subagents/skills/subagent/SKILL.md +734 -0
- package/dist/builtin/subagents/src/agents/agent-management.ts +644 -0
- package/dist/builtin/subagents/src/agents/agent-scope.ts +6 -0
- package/dist/builtin/subagents/src/agents/agent-selection.ts +23 -0
- package/dist/builtin/subagents/src/agents/agent-serializer.ts +84 -0
- package/dist/builtin/subagents/src/agents/agents.ts +809 -0
- package/dist/builtin/subagents/src/agents/chain-serializer.ts +137 -0
- package/dist/builtin/subagents/src/agents/frontmatter.ts +29 -0
- package/dist/builtin/subagents/src/agents/identity.ts +30 -0
- package/dist/builtin/subagents/src/agents/skills.ts +630 -0
- package/dist/builtin/subagents/src/extension/control-notices.ts +92 -0
- package/dist/builtin/subagents/src/extension/doctor.ts +199 -0
- package/dist/builtin/subagents/src/extension/index.ts +586 -0
- package/dist/builtin/subagents/src/extension/schemas.ts +168 -0
- package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +378 -0
- package/dist/builtin/subagents/src/intercom/result-intercom.ts +269 -0
- package/dist/builtin/subagents/src/runs/background/async-execution.ts +612 -0
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +267 -0
- package/dist/builtin/subagents/src/runs/background/async-resume.ts +332 -0
- package/dist/builtin/subagents/src/runs/background/async-status.ts +295 -0
- package/dist/builtin/subagents/src/runs/background/completion-dedupe.ts +63 -0
- package/dist/builtin/subagents/src/runs/background/notify.ts +108 -0
- package/dist/builtin/subagents/src/runs/background/parallel-groups.ts +45 -0
- package/dist/builtin/subagents/src/runs/background/result-watcher.ts +250 -0
- package/dist/builtin/subagents/src/runs/background/run-status.ts +193 -0
- package/dist/builtin/subagents/src/runs/background/stale-run-reconciler.ts +291 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +1760 -0
- package/dist/builtin/subagents/src/runs/background/top-level-async.ts +13 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +1333 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +932 -0
- package/dist/builtin/subagents/src/runs/foreground/execution.ts +902 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +2231 -0
- package/dist/builtin/subagents/src/runs/shared/completion-guard.ts +125 -0
- package/dist/builtin/subagents/src/runs/shared/long-running-guard.ts +175 -0
- package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +103 -0
- package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +108 -0
- package/dist/builtin/subagents/src/runs/shared/pi-args.ts +163 -0
- package/dist/builtin/subagents/src/runs/shared/pi-spawn.ts +115 -0
- package/dist/builtin/subagents/src/runs/shared/run-history.ts +56 -0
- package/dist/builtin/subagents/src/runs/shared/single-output.ts +154 -0
- package/dist/builtin/subagents/src/runs/shared/subagent-control.ts +226 -0
- package/dist/builtin/subagents/src/runs/shared/subagent-prompt-runtime.ts +152 -0
- package/dist/builtin/subagents/src/runs/shared/worktree.ts +577 -0
- package/dist/builtin/subagents/src/shared/artifacts.ts +99 -0
- package/dist/builtin/subagents/src/shared/atomic-json.ts +16 -0
- package/dist/builtin/subagents/src/shared/file-coalescer.ts +40 -0
- package/dist/builtin/subagents/src/shared/fork-context.ts +76 -0
- package/dist/builtin/subagents/src/shared/formatters.ts +133 -0
- package/dist/builtin/subagents/src/shared/jsonl-writer.ts +81 -0
- package/dist/builtin/subagents/src/shared/model-info.ts +78 -0
- package/dist/builtin/subagents/src/shared/post-exit-stdio-guard.ts +85 -0
- package/dist/builtin/subagents/src/shared/session-identity.ts +10 -0
- package/dist/builtin/subagents/src/shared/session-tokens.ts +44 -0
- package/dist/builtin/subagents/src/shared/settings.ts +397 -0
- package/dist/builtin/subagents/src/shared/status-format.ts +49 -0
- package/dist/builtin/subagents/src/shared/types.ts +732 -0
- package/dist/builtin/subagents/src/shared/utils.ts +440 -0
- package/dist/builtin/subagents/src/slash/prompt-template-bridge.ts +397 -0
- package/dist/builtin/subagents/src/slash/slash-bridge.ts +174 -0
- package/dist/builtin/subagents/src/slash/slash-commands.ts +528 -0
- package/dist/builtin/subagents/src/slash/slash-live-state.ts +292 -0
- package/dist/builtin/subagents/src/tui/render-helpers.ts +80 -0
- package/dist/builtin/subagents/src/tui/render.ts +1257 -0
- package/dist/builtin/web-access/CHANGELOG.md +387 -0
- package/dist/builtin/web-access/LICENSE +21 -0
- package/dist/builtin/web-access/README.md +346 -0
- package/dist/builtin/web-access/activity.ts +101 -0
- package/dist/builtin/web-access/chrome-cookies.ts +322 -0
- package/dist/builtin/web-access/code-search.ts +107 -0
- package/dist/builtin/web-access/curator-page.ts +3359 -0
- package/dist/builtin/web-access/curator-server.ts +605 -0
- package/dist/builtin/web-access/exa.ts +521 -0
- package/dist/builtin/web-access/extract.ts +701 -0
- package/dist/builtin/web-access/gemini-api.ts +113 -0
- package/dist/builtin/web-access/gemini-search.ts +362 -0
- package/dist/builtin/web-access/gemini-url-context.ts +126 -0
- package/dist/builtin/web-access/gemini-web-config.ts +54 -0
- package/dist/builtin/web-access/gemini-web.ts +396 -0
- package/dist/builtin/web-access/github-api.ts +196 -0
- package/dist/builtin/web-access/github-extract.ts +635 -0
- package/dist/builtin/web-access/index.ts +2347 -0
- package/dist/builtin/web-access/package.json +54 -0
- package/dist/builtin/web-access/pdf-extract.ts +192 -0
- package/dist/builtin/web-access/perplexity.ts +196 -0
- package/dist/builtin/web-access/rsc-extract.ts +338 -0
- package/dist/builtin/web-access/storage.ts +72 -0
- package/dist/builtin/web-access/summary-review.ts +276 -0
- package/dist/builtin/web-access/utils.ts +44 -0
- package/dist/builtin/web-access/video-extract.ts +379 -0
- package/dist/builtin/web-access/youtube-extract.ts +311 -0
- package/dist/builtin/workflows/CHANGELOG.md +20 -0
- package/dist/builtin/workflows/README.md +323 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +567 -0
- package/dist/builtin/workflows/builtin/index.ts +10 -0
- package/dist/builtin/workflows/builtin/open-claude-design.ts +985 -0
- package/dist/builtin/workflows/builtin/ralph.ts +613 -0
- package/dist/builtin/workflows/package.json +89 -0
- package/dist/builtin/workflows/skills/create-spec/SKILL.md +247 -0
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +173 -0
- package/dist/builtin/workflows/skills/impeccable/reference/adapt.md +190 -0
- package/dist/builtin/workflows/skills/impeccable/reference/animate.md +175 -0
- package/dist/builtin/workflows/skills/impeccable/reference/audit.md +133 -0
- package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +113 -0
- package/dist/builtin/workflows/skills/impeccable/reference/brand.md +118 -0
- package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +174 -0
- package/dist/builtin/workflows/skills/impeccable/reference/codex.md +105 -0
- package/dist/builtin/workflows/skills/impeccable/reference/cognitive-load.md +106 -0
- package/dist/builtin/workflows/skills/impeccable/reference/color-and-contrast.md +105 -0
- package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +154 -0
- package/dist/builtin/workflows/skills/impeccable/reference/craft.md +123 -0
- package/dist/builtin/workflows/skills/impeccable/reference/critique.md +261 -0
- package/dist/builtin/workflows/skills/impeccable/reference/delight.md +302 -0
- package/dist/builtin/workflows/skills/impeccable/reference/distill.md +111 -0
- package/dist/builtin/workflows/skills/impeccable/reference/document.md +427 -0
- package/dist/builtin/workflows/skills/impeccable/reference/extract.md +69 -0
- package/dist/builtin/workflows/skills/impeccable/reference/harden.md +347 -0
- package/dist/builtin/workflows/skills/impeccable/reference/heuristics-scoring.md +234 -0
- package/dist/builtin/workflows/skills/impeccable/reference/interaction-design.md +195 -0
- package/dist/builtin/workflows/skills/impeccable/reference/layout.md +141 -0
- package/dist/builtin/workflows/skills/impeccable/reference/live.md +622 -0
- package/dist/builtin/workflows/skills/impeccable/reference/motion-design.md +109 -0
- package/dist/builtin/workflows/skills/impeccable/reference/onboard.md +234 -0
- package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +258 -0
- package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +130 -0
- package/dist/builtin/workflows/skills/impeccable/reference/personas.md +179 -0
- package/dist/builtin/workflows/skills/impeccable/reference/polish.md +242 -0
- package/dist/builtin/workflows/skills/impeccable/reference/product.md +62 -0
- package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +99 -0
- package/dist/builtin/workflows/skills/impeccable/reference/responsive-design.md +114 -0
- package/dist/builtin/workflows/skills/impeccable/reference/shape.md +165 -0
- package/dist/builtin/workflows/skills/impeccable/reference/spatial-design.md +100 -0
- package/dist/builtin/workflows/skills/impeccable/reference/teach.md +156 -0
- package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +124 -0
- package/dist/builtin/workflows/skills/impeccable/reference/typography.md +159 -0
- package/dist/builtin/workflows/skills/impeccable/reference/ux-writing.md +107 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/cleanup-deprecated.mjs +284 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +94 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +226 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/design-parser.mjs +820 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detect-csp.mjs +198 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/impeccable-paths.mjs +110 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/is-generated.mjs +69 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +646 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-session.js +123 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +4865 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-complete.mjs +75 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-completion.mjs +18 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +446 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +200 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +48 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +847 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-session-store.mjs +254 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +47 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +632 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +247 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/load-context.mjs +141 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +214 -0
- package/dist/builtin/workflows/skills/playwright-cli/SKILL.md +392 -0
- package/dist/builtin/workflows/skills/playwright-cli/references/element-attributes.md +23 -0
- package/dist/builtin/workflows/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/dist/builtin/workflows/skills/playwright-cli/references/request-mocking.md +87 -0
- package/dist/builtin/workflows/skills/playwright-cli/references/running-code.md +241 -0
- package/dist/builtin/workflows/skills/playwright-cli/references/session-management.md +225 -0
- package/dist/builtin/workflows/skills/playwright-cli/references/spec-driven-testing.md +305 -0
- package/dist/builtin/workflows/skills/playwright-cli/references/storage-state.md +275 -0
- package/dist/builtin/workflows/skills/playwright-cli/references/test-generation.md +134 -0
- package/dist/builtin/workflows/skills/playwright-cli/references/tracing.md +139 -0
- package/dist/builtin/workflows/skills/playwright-cli/references/video-recording.md +143 -0
- package/dist/builtin/workflows/skills/prompt-engineer/SKILL.md +263 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/advanced_patterns.md +271 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/core_prompting.md +137 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/quality_improvement.md +193 -0
- package/dist/builtin/workflows/skills/research-codebase/SKILL.md +226 -0
- package/dist/builtin/workflows/skills/tdd/SKILL.md +109 -0
- package/dist/builtin/workflows/skills/tdd/deep-modules.md +33 -0
- package/dist/builtin/workflows/skills/tdd/interface-design.md +31 -0
- package/dist/builtin/workflows/skills/tdd/mocking.md +59 -0
- package/dist/builtin/workflows/skills/tdd/refactoring.md +10 -0
- package/dist/builtin/workflows/skills/tdd/tests.md +61 -0
- package/dist/builtin/workflows/skills/workflow/SKILL.md +255 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/advanced-evaluation.md +404 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/bdi-mental-states.md +313 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/context-compression.md +274 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/context-degradation.md +208 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/context-fundamentals.md +203 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/context-optimization.md +197 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/evaluation.md +253 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/filesystem-context.md +289 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/hosted-agents.md +262 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/memory-systems.md +221 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/multi-agent-patterns.md +259 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/project-development.md +293 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering/tool-design.md +273 -0
- package/dist/builtin/workflows/skills/workflow/references/context-engineering.md +23 -0
- package/dist/builtin/workflows/skills/workflow/references/design-checklist.md +79 -0
- package/dist/builtin/workflows/skills/workflow/references/running-workflows.md +107 -0
- package/dist/builtin/workflows/skills/workflow/references/sdk-authoring.md +140 -0
- package/dist/builtin/workflows/src/extension/background-ui-adapter.ts +168 -0
- package/dist/builtin/workflows/src/extension/companions.ts +210 -0
- package/dist/builtin/workflows/src/extension/config-loader.ts +493 -0
- package/dist/builtin/workflows/src/extension/discovery.ts +501 -0
- package/dist/builtin/workflows/src/extension/dispatcher.ts +173 -0
- package/dist/builtin/workflows/src/extension/index.ts +2143 -0
- package/dist/builtin/workflows/src/extension/mcp.ts +110 -0
- package/dist/builtin/workflows/src/extension/render-call.ts +39 -0
- package/dist/builtin/workflows/src/extension/render-result.ts +214 -0
- package/dist/builtin/workflows/src/extension/renderers.ts +87 -0
- package/dist/builtin/workflows/src/extension/runtime.ts +360 -0
- package/dist/builtin/workflows/src/extension/status-writer.ts +167 -0
- package/dist/builtin/workflows/src/extension/wiring.ts +555 -0
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +102 -0
- package/dist/builtin/workflows/src/index.ts +25 -0
- package/dist/builtin/workflows/src/intercom/intercom-bridge.ts +93 -0
- package/dist/builtin/workflows/src/intercom/intercom-routing.ts +125 -0
- package/dist/builtin/workflows/src/intercom/result-intercom.ts +240 -0
- package/dist/builtin/workflows/src/runs/background/cancellation-registry.ts +113 -0
- package/dist/builtin/workflows/src/runs/background/job-tracker.ts +81 -0
- package/dist/builtin/workflows/src/runs/background/runner.ts +152 -0
- package/dist/builtin/workflows/src/runs/background/status.ts +354 -0
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +1522 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +233 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +712 -0
- package/dist/builtin/workflows/src/runs/shared/concurrency.ts +76 -0
- package/dist/builtin/workflows/src/runs/shared/graph-inference.ts +69 -0
- package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +293 -0
- package/dist/builtin/workflows/src/runs/shared/validate-inputs.ts +83 -0
- package/dist/builtin/workflows/src/runs/shared/workflow-runner.ts +170 -0
- package/dist/builtin/workflows/src/runs/shared/worktree.ts +577 -0
- package/dist/builtin/workflows/src/shared/persistence-compaction-policy.ts +72 -0
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +257 -0
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +145 -0
- package/dist/builtin/workflows/src/shared/render-inputs-schema.ts +196 -0
- package/dist/builtin/workflows/src/shared/store-types.ts +160 -0
- package/dist/builtin/workflows/src/shared/store.ts +579 -0
- package/dist/builtin/workflows/src/shared/types.ts +566 -0
- package/dist/builtin/workflows/src/tui/chat-surface-message.ts +224 -0
- package/dist/builtin/workflows/src/tui/chat-surface.ts +511 -0
- package/dist/builtin/workflows/src/tui/color-utils.ts +64 -0
- package/dist/builtin/workflows/src/tui/connectors.ts +88 -0
- package/dist/builtin/workflows/src/tui/dispatch-confirm.ts +307 -0
- package/dist/builtin/workflows/src/tui/edge.ts +24 -0
- package/dist/builtin/workflows/src/tui/graph-canvas.ts +108 -0
- package/dist/builtin/workflows/src/tui/graph-theme.ts +283 -0
- package/dist/builtin/workflows/src/tui/graph-view.ts +1217 -0
- package/dist/builtin/workflows/src/tui/header.ts +172 -0
- package/dist/builtin/workflows/src/tui/inline-form-card.ts +421 -0
- package/dist/builtin/workflows/src/tui/inline-form-editor.ts +638 -0
- package/dist/builtin/workflows/src/tui/inline-form-overlay.ts +326 -0
- package/dist/builtin/workflows/src/tui/inline-form-store.ts +78 -0
- package/dist/builtin/workflows/src/tui/inputs-overlay.ts +163 -0
- package/dist/builtin/workflows/src/tui/inputs-picker.ts +888 -0
- package/dist/builtin/workflows/src/tui/keybindings-adapter.ts +154 -0
- package/dist/builtin/workflows/src/tui/layout.ts +153 -0
- package/dist/builtin/workflows/src/tui/node-card.ts +274 -0
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +277 -0
- package/dist/builtin/workflows/src/tui/prompt-card.ts +501 -0
- package/dist/builtin/workflows/src/tui/renderers.ts +15 -0
- package/dist/builtin/workflows/src/tui/run-detail.ts +339 -0
- package/dist/builtin/workflows/src/tui/session-confirm.ts +202 -0
- package/dist/builtin/workflows/src/tui/session-list.ts +32 -0
- package/dist/builtin/workflows/src/tui/session-overlays.ts +239 -0
- package/dist/builtin/workflows/src/tui/session-picker.ts +399 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +1873 -0
- package/dist/builtin/workflows/src/tui/status-helpers.ts +73 -0
- package/dist/builtin/workflows/src/tui/status-list.ts +361 -0
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +206 -0
- package/dist/builtin/workflows/src/tui/switcher.ts +121 -0
- package/dist/builtin/workflows/src/tui/text-helpers.ts +31 -0
- package/dist/builtin/workflows/src/tui/toast.ts +106 -0
- package/dist/builtin/workflows/src/tui/widget.ts +348 -0
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +285 -0
- package/dist/builtin/workflows/src/tui/workflow-list.ts +224 -0
- package/dist/builtin/workflows/src/workflows/define-workflow.ts +150 -0
- package/dist/builtin/workflows/src/workflows/identity.ts +39 -0
- package/dist/builtin/workflows/src/workflows/registry.ts +113 -0
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +9 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +13 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +32 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +53 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +341 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +14 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +83 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/session-picker.d.ts +9 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +35 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +20 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +102 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +411 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +117 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +292 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +86 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +117 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +595 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +2518 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +141 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +437 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +32 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +111 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/builtin-packages.d.ts +14 -0
- package/dist/core/builtin-packages.d.ts.map +1 -0
- package/dist/core/builtin-packages.js +113 -0
- package/dist/core/builtin-packages.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +88 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +243 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +121 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +615 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +38 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +153 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +2 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +75 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +224 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1834 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +108 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +6 -0
- package/dist/core/extensions/index.d.ts +12 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +24 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +501 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +159 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +817 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1173 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +45 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +22 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +52 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +309 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keybindings.d.ts +353 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +294 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/messages.d.ts +77 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +123 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-registry.d.ts +150 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +726 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +110 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +493 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/output-guard.d.ts +6 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +59 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +198 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +1970 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +52 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +250 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-display-names.d.ts +2 -0
- package/dist/core/provider-display-names.d.ts.map +1 -0
- package/dist/core/provider-display-names.js +33 -0
- package/dist/core/provider-display-names.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +23 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +126 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +196 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +698 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/sdk.d.ts +107 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +291 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +37 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-manager.d.ts +333 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1118 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +261 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +773 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +60 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +404 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +14 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +25 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +18 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +19 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts +28 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +120 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/telemetry.d.ts +3 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +10 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/timings.d.ts +8 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +32 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/ask-user-question/ask-user-question.d.ts +10 -0
- package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/ask-user-question.js +82 -0
- package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -0
- package/dist/core/tools/ask-user-question/config.d.ts +11 -0
- package/dist/core/tools/ask-user-question/config.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/config.js +34 -0
- package/dist/core/tools/ask-user-question/config.js.map +1 -0
- package/dist/core/tools/ask-user-question/index.d.ts +19 -0
- package/dist/core/tools/ask-user-question/index.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/index.js +19 -0
- package/dist/core/tools/ask-user-question/index.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/build-questionnaire.d.ts +36 -0
- package/dist/core/tools/ask-user-question/state/build-questionnaire.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/build-questionnaire.js +213 -0
- package/dist/core/tools/ask-user-question/state/build-questionnaire.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/key-router.d.ts +53 -0
- package/dist/core/tools/ask-user-question/state/key-router.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/key-router.js +240 -0
- package/dist/core/tools/ask-user-question/state/key-router.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts +61 -0
- package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/questionnaire-session.js +147 -0
- package/dist/core/tools/ask-user-question/state/questionnaire-session.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/row-intent.d.ts +91 -0
- package/dist/core/tools/ask-user-question/state/row-intent.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/row-intent.js +91 -0
- package/dist/core/tools/ask-user-question/state/row-intent.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts +21 -0
- package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/selectors/contract.js +2 -0
- package/dist/core/tools/ask-user-question/state/selectors/contract.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/selectors/derivations.d.ts +44 -0
- package/dist/core/tools/ask-user-question/state/selectors/derivations.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/selectors/derivations.js +76 -0
- package/dist/core/tools/ask-user-question/state/selectors/derivations.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/selectors/focus.d.ts +15 -0
- package/dist/core/tools/ask-user-question/state/selectors/focus.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/selectors/focus.js +18 -0
- package/dist/core/tools/ask-user-question/state/selectors/focus.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/selectors/projections.d.ts +16 -0
- package/dist/core/tools/ask-user-question/state/selectors/projections.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/selectors/projections.js +71 -0
- package/dist/core/tools/ask-user-question/state/selectors/projections.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/state-reducer.d.ts +44 -0
- package/dist/core/tools/ask-user-question/state/state-reducer.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/state-reducer.js +239 -0
- package/dist/core/tools/ask-user-question/state/state-reducer.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/state.d.ts +42 -0
- package/dist/core/tools/ask-user-question/state/state.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/state.js +2 -0
- package/dist/core/tools/ask-user-question/state/state.js.map +1 -0
- package/dist/core/tools/ask-user-question/tool/format-answer.d.ts +30 -0
- package/dist/core/tools/ask-user-question/tool/format-answer.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/tool/format-answer.js +39 -0
- package/dist/core/tools/ask-user-question/tool/format-answer.js.map +1 -0
- package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts +29 -0
- package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/tool/response-envelope.js +46 -0
- package/dist/core/tools/ask-user-question/tool/response-envelope.js.map +1 -0
- package/dist/core/tools/ask-user-question/tool/types.d.ts +113 -0
- package/dist/core/tools/ask-user-question/tool/types.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/tool/types.js +81 -0
- package/dist/core/tools/ask-user-question/tool/types.js.map +1 -0
- package/dist/core/tools/ask-user-question/tool/validate-questionnaire.d.ts +21 -0
- package/dist/core/tools/ask-user-question/tool/validate-questionnaire.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/tool/validate-questionnaire.js +49 -0
- package/dist/core/tools/ask-user-question/tool/validate-questionnaire.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/body-residual-spacer.d.ts +18 -0
- package/dist/core/tools/ask-user-question/view/body-residual-spacer.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/body-residual-spacer.js +21 -0
- package/dist/core/tools/ask-user-question/view/body-residual-spacer.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/component-binding.d.ts +23 -0
- package/dist/core/tools/ask-user-question/view/component-binding.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/component-binding.js +16 -0
- package/dist/core/tools/ask-user-question/view/component-binding.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/chat-row-view.d.ts +40 -0
- package/dist/core/tools/ask-user-question/view/components/chat-row-view.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/chat-row-view.js +31 -0
- package/dist/core/tools/ask-user-question/view/components/chat-row-view.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts +35 -0
- package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/multi-select-view.js +91 -0
- package/dist/core/tools/ask-user-question/view/components/multi-select-view.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/option-list-view.d.ts +43 -0
- package/dist/core/tools/ask-user-question/view/components/option-list-view.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/option-list-view.js +37 -0
- package/dist/core/tools/ask-user-question/view/components/option-list-view.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.d.ts +36 -0
- package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.js +66 -0
- package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts +46 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.js +69 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-box-renderer.d.ts +39 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-box-renderer.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-box-renderer.js +76 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-box-renderer.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.d.ts +116 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.js +173 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.d.ts +66 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.js +124 -0
- package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/submit-picker.d.ts +37 -0
- package/dist/core/tools/ask-user-question/view/components/submit-picker.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/submit-picker.js +44 -0
- package/dist/core/tools/ask-user-question/view/components/submit-picker.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/tab-bar.d.ts +32 -0
- package/dist/core/tools/ask-user-question/view/components/tab-bar.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/tab-bar.js +33 -0
- package/dist/core/tools/ask-user-question/view/components/tab-bar.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts +122 -0
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.js +161 -0
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts +66 -0
- package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/dialog-builder.js +85 -0
- package/dist/core/tools/ask-user-question/view/dialog-builder.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/props-adapter.d.ts +58 -0
- package/dist/core/tools/ask-user-question/view/props-adapter.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/props-adapter.js +67 -0
- package/dist/core/tools/ask-user-question/view/props-adapter.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/stateful-view.d.ts +24 -0
- package/dist/core/tools/ask-user-question/view/stateful-view.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/stateful-view.js +2 -0
- package/dist/core/tools/ask-user-question/view/stateful-view.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/tab-components.d.ts +15 -0
- package/dist/core/tools/ask-user-question/view/tab-components.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/tab-components.js +2 -0
- package/dist/core/tools/ask-user-question/view/tab-components.js.map +1 -0
- package/dist/core/tools/ask-user-question/view/tab-content-strategy.d.ts +71 -0
- package/dist/core/tools/ask-user-question/view/tab-content-strategy.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/view/tab-content-strategy.js +129 -0
- package/dist/core/tools/ask-user-question/view/tab-content-strategy.js.map +1 -0
- package/dist/core/tools/bash.d.ts +68 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +338 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +85 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +338 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +49 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +324 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +37 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +35 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +298 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +37 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +304 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +42 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +139 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +37 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +169 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +50 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +172 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +8 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +81 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +289 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +21 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +49 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/todos.d.ts +35 -0
- package/dist/core/tools/todos.d.ts.map +1 -0
- package/dist/core/tools/todos.js +906 -0
- package/dist/core/tools/todos.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +34 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +70 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +205 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/write.d.ts +26 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +212 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +13 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +586 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +33 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +281 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/index.d.ts +9 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/interactive/assets/clankolas.png +3 -0
- package/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/dist/modes/interactive/components/armin.js +329 -0
- package/dist/modes/interactive/components/armin.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +20 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +116 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +170 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +51 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +42 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +43 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +71 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +496 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +28 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +29 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +113 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +74 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/dist/modes/interactive/components/daxnuts.js +138 -0
- package/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +151 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +20 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.js +40 -0
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +20 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +106 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +55 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +75 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +27 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +199 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +32 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +33 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +46 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +158 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +47 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +266 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +31 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +156 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +286 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +155 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +96 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +836 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +67 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +371 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +38 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +45 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +48 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +50 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +63 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +280 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +89 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1079 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +111 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +10 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +28 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +369 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +4709 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/theme/catppuccin-frappe.json +90 -0
- package/dist/modes/interactive/theme/catppuccin-latte.json +90 -0
- package/dist/modes/interactive/theme/catppuccin-macchiato.json +90 -0
- package/dist/modes/interactive/theme/catppuccin-mocha.json +90 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +84 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +81 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +970 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/interactive/whimsical-messages.d.ts +5 -0
- package/dist/modes/interactive/whimsical-messages.d.ts.map +1 -0
- package/dist/modes/interactive/whimsical-messages.js +464 -0
- package/dist/modes/interactive/whimsical-messages.js.map +1 -0
- package/dist/modes/print-mode.d.ts +28 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +131 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +224 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +409 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +601 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +419 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +4 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +460 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +52 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/changelog.d.ts +21 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +87 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +12 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +86 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +245 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +8 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +14 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +117 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +158 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +163 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/image-convert.d.ts +9 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +39 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-resize.d.ts +36 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +137 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/mime.d.ts +3 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +69 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/paths.d.ts +16 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +50 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/photon.d.ts +21 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +121 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -0
- package/dist/utils/pi-user-agent.js +5 -0
- package/dist/utils/pi-user-agent.js.map +1 -0
- package/dist/utils/shell.d.ts +30 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +190 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +118 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +325 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +14 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +76 -0
- package/dist/utils/version-check.js.map +1 -0
- package/docs/compaction.md +394 -0
- package/docs/custom-provider.md +646 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +148 -0
- package/docs/extensions.md +2596 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +3 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +70 -0
- package/docs/json.md +82 -0
- package/docs/keybindings.md +197 -0
- package/docs/models.md +474 -0
- package/docs/packages.md +223 -0
- package/docs/prompt-templates.md +88 -0
- package/docs/providers.md +243 -0
- package/docs/quickstart.md +142 -0
- package/docs/rpc.md +1407 -0
- package/docs/sdk.md +1129 -0
- package/docs/session-format.md +412 -0
- package/docs/sessions.md +137 -0
- package/docs/settings.md +279 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +232 -0
- package/docs/terminal-setup.md +106 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +299 -0
- package/docs/tmux.md +61 -0
- package/docs/tui.md +918 -0
- package/docs/usage.md +277 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +208 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +150 -0
- package/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +127 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +349 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/handoff.ts +191 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +426 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +1348 -0
- package/examples/extensions/overlay-test.ts +150 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +65 -0
- package/examples/extensions/plan-mode/index.ts +340 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +430 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +122 -0
- package/examples/extensions/question.ts +264 -0
- package/examples/extensions/questionnaire.ts +427 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +321 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +172 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +126 -0
- package/examples/extensions/subagent/index.ts +987 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +206 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +297 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +141 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-extension-ui.ts +632 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +53 -0
- package/examples/sdk/03-custom-prompt.ts +75 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +99 -0
- package/examples/sdk/07-context-files.ts +47 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +52 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +77 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +144 -0
- package/package.json +94 -19
- package/bin/atomic +0 -82
- /package/{LICENSE → dist/builtin/workflows/LICENSE} +0 -0
package/docs/rpc.md
ADDED
|
@@ -0,0 +1,1407 @@
|
|
|
1
|
+
# RPC Mode
|
|
2
|
+
|
|
3
|
+
RPC mode enables headless operation of the coding agent via a JSON protocol over stdin/stdout. This is useful for embedding the agent in other applications, IDEs, or custom UIs.
|
|
4
|
+
|
|
5
|
+
**Note for Node.js/TypeScript users**: If you're building a Node.js application, consider using `AgentSession` directly from `@earendil-works/pi-coding-agent` instead of spawning a subprocess. See [`src/core/agent-session.ts`](../src/core/agent-session.ts) for the API. For a subprocess-based TypeScript client, see [`src/modes/rpc/rpc-client.ts`](../src/modes/rpc/rpc-client.ts).
|
|
6
|
+
|
|
7
|
+
## Starting RPC Mode
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pi --mode rpc [options]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Common options:
|
|
14
|
+
- `--provider <name>`: Set the LLM provider (anthropic, openai, google, etc.)
|
|
15
|
+
- `--model <pattern>`: Model pattern or ID (supports `provider/id` and optional `:<thinking>`)
|
|
16
|
+
- `--no-session`: Disable session persistence
|
|
17
|
+
- `--session-dir <path>`: Custom session storage directory
|
|
18
|
+
|
|
19
|
+
## Protocol Overview
|
|
20
|
+
|
|
21
|
+
- **Commands**: JSON objects sent to stdin, one per line
|
|
22
|
+
- **Responses**: JSON objects with `type: "response"` indicating command success/failure
|
|
23
|
+
- **Events**: Agent events streamed to stdout as JSON lines
|
|
24
|
+
|
|
25
|
+
All commands support an optional `id` field for request/response correlation. If provided, the corresponding response will include the same `id`.
|
|
26
|
+
|
|
27
|
+
### Framing
|
|
28
|
+
|
|
29
|
+
RPC mode uses strict JSONL semantics with LF (`\n`) as the only record delimiter.
|
|
30
|
+
|
|
31
|
+
This matters for clients:
|
|
32
|
+
- Split records on `\n` only
|
|
33
|
+
- Accept optional `\r\n` input by stripping a trailing `\r`
|
|
34
|
+
- Do not use generic line readers that treat Unicode separators as newlines
|
|
35
|
+
|
|
36
|
+
In particular, Node `readline` is not protocol-compliant for RPC mode because it also splits on `U+2028` and `U+2029`, which are valid inside JSON strings.
|
|
37
|
+
|
|
38
|
+
## Commands
|
|
39
|
+
|
|
40
|
+
### Prompting
|
|
41
|
+
|
|
42
|
+
#### prompt
|
|
43
|
+
|
|
44
|
+
Send a user prompt to the agent. The command response is emitted after the prompt is accepted, queued, or handled. Events continue streaming asynchronously after acceptance.
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{"id": "req-1", "type": "prompt", "message": "Hello, world!"}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
With images:
|
|
51
|
+
```json
|
|
52
|
+
{"type": "prompt", "message": "What's in this image?", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**During streaming**: If the agent is already streaming, you must specify `streamingBehavior` to queue the message:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{"type": "prompt", "message": "New instruction", "streamingBehavior": "steer"}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- `"steer"`: Queue the message while the agent is running. It is delivered after the current assistant turn finishes executing its tool calls, before the next LLM call.
|
|
62
|
+
- `"followUp"`: Wait until the agent finishes. Message is delivered only when agent stops.
|
|
63
|
+
|
|
64
|
+
If the agent is streaming and no `streamingBehavior` is specified, the command returns an error.
|
|
65
|
+
|
|
66
|
+
**Extension commands**: If the message is an extension command (e.g., `/mycommand`), it executes immediately even during streaming. Extension commands manage their own LLM interaction via `pi.sendMessage()`.
|
|
67
|
+
|
|
68
|
+
**Input expansion**: Skill commands (`/skill:name`) and prompt templates (`/template`) are expanded before sending/queueing.
|
|
69
|
+
|
|
70
|
+
Response:
|
|
71
|
+
```json
|
|
72
|
+
{"id": "req-1", "type": "response", "command": "prompt", "success": true}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`success: true` means the prompt was accepted, queued, or handled immediately. `success: false` means the prompt was rejected before acceptance. Failures after acceptance are reported through the normal event and message stream, not as a second `response` for the same request id.
|
|
76
|
+
|
|
77
|
+
The `images` field is optional. Each image uses `ImageContent` format: `{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}`.
|
|
78
|
+
|
|
79
|
+
#### steer
|
|
80
|
+
|
|
81
|
+
Queue a steering message while the agent is running. It is delivered after the current assistant turn finishes executing its tool calls, before the next LLM call. Skill commands and prompt templates are expanded. Extension commands are not allowed (use `prompt` instead).
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{"type": "steer", "message": "Stop and do this instead"}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
With images:
|
|
88
|
+
```json
|
|
89
|
+
{"type": "steer", "message": "Look at this instead", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The `images` field is optional. Each image uses `ImageContent` format (same as `prompt`).
|
|
93
|
+
|
|
94
|
+
Response:
|
|
95
|
+
```json
|
|
96
|
+
{"type": "response", "command": "steer", "success": true}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
See [set_steering_mode](#set_steering_mode) for controlling how steering messages are processed.
|
|
100
|
+
|
|
101
|
+
#### follow_up
|
|
102
|
+
|
|
103
|
+
Queue a follow-up message to be processed after the agent finishes. Delivered only when agent has no more tool calls or steering messages. Skill commands and prompt templates are expanded. Extension commands are not allowed (use `prompt` instead).
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{"type": "follow_up", "message": "After you're done, also do this"}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
With images:
|
|
110
|
+
```json
|
|
111
|
+
{"type": "follow_up", "message": "Also check this image", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The `images` field is optional. Each image uses `ImageContent` format (same as `prompt`).
|
|
115
|
+
|
|
116
|
+
Response:
|
|
117
|
+
```json
|
|
118
|
+
{"type": "response", "command": "follow_up", "success": true}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
See [set_follow_up_mode](#set_follow_up_mode) for controlling how follow-up messages are processed.
|
|
122
|
+
|
|
123
|
+
#### abort
|
|
124
|
+
|
|
125
|
+
Abort the current agent operation.
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{"type": "abort"}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Response:
|
|
132
|
+
```json
|
|
133
|
+
{"type": "response", "command": "abort", "success": true}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### new_session
|
|
137
|
+
|
|
138
|
+
Start a fresh session. Can be cancelled by a `session_before_switch` extension event handler.
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{"type": "new_session"}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
With optional parent session tracking:
|
|
145
|
+
```json
|
|
146
|
+
{"type": "new_session", "parentSession": "/path/to/parent-session.jsonl"}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Response:
|
|
150
|
+
```json
|
|
151
|
+
{"type": "response", "command": "new_session", "success": true, "data": {"cancelled": false}}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
If an extension cancelled:
|
|
155
|
+
```json
|
|
156
|
+
{"type": "response", "command": "new_session", "success": true, "data": {"cancelled": true}}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### State
|
|
160
|
+
|
|
161
|
+
#### get_state
|
|
162
|
+
|
|
163
|
+
Get current session state.
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{"type": "get_state"}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Response:
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"type": "response",
|
|
173
|
+
"command": "get_state",
|
|
174
|
+
"success": true,
|
|
175
|
+
"data": {
|
|
176
|
+
"model": {...},
|
|
177
|
+
"thinkingLevel": "medium",
|
|
178
|
+
"isStreaming": false,
|
|
179
|
+
"isCompacting": false,
|
|
180
|
+
"steeringMode": "all",
|
|
181
|
+
"followUpMode": "one-at-a-time",
|
|
182
|
+
"sessionFile": "/path/to/session.jsonl",
|
|
183
|
+
"sessionId": "abc123",
|
|
184
|
+
"sessionName": "my-feature-work",
|
|
185
|
+
"autoCompactionEnabled": true,
|
|
186
|
+
"messageCount": 5,
|
|
187
|
+
"pendingMessageCount": 0
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The `model` field is a full [Model](#model) object or `null`. The `sessionName` field is the display name set via `set_session_name`, or omitted if not set.
|
|
193
|
+
|
|
194
|
+
#### get_messages
|
|
195
|
+
|
|
196
|
+
Get all messages in the conversation.
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{"type": "get_messages"}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Response:
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"type": "response",
|
|
206
|
+
"command": "get_messages",
|
|
207
|
+
"success": true,
|
|
208
|
+
"data": {"messages": [...]}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Messages are `AgentMessage` objects (see [Message Types](#message-types)).
|
|
213
|
+
|
|
214
|
+
### Model
|
|
215
|
+
|
|
216
|
+
#### set_model
|
|
217
|
+
|
|
218
|
+
Switch to a specific model.
|
|
219
|
+
|
|
220
|
+
```json
|
|
221
|
+
{"type": "set_model", "provider": "anthropic", "modelId": "claude-sonnet-4-20250514"}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Response contains the full [Model](#model) object:
|
|
225
|
+
```json
|
|
226
|
+
{
|
|
227
|
+
"type": "response",
|
|
228
|
+
"command": "set_model",
|
|
229
|
+
"success": true,
|
|
230
|
+
"data": {...}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### cycle_model
|
|
235
|
+
|
|
236
|
+
Cycle to the next available model. Returns `null` data if only one model available.
|
|
237
|
+
|
|
238
|
+
```json
|
|
239
|
+
{"type": "cycle_model"}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Response:
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"type": "response",
|
|
246
|
+
"command": "cycle_model",
|
|
247
|
+
"success": true,
|
|
248
|
+
"data": {
|
|
249
|
+
"model": {...},
|
|
250
|
+
"thinkingLevel": "medium",
|
|
251
|
+
"isScoped": false
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
The `model` field is a full [Model](#model) object.
|
|
257
|
+
|
|
258
|
+
#### get_available_models
|
|
259
|
+
|
|
260
|
+
List all configured models.
|
|
261
|
+
|
|
262
|
+
```json
|
|
263
|
+
{"type": "get_available_models"}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Response contains an array of full [Model](#model) objects:
|
|
267
|
+
```json
|
|
268
|
+
{
|
|
269
|
+
"type": "response",
|
|
270
|
+
"command": "get_available_models",
|
|
271
|
+
"success": true,
|
|
272
|
+
"data": {
|
|
273
|
+
"models": [...]
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Thinking
|
|
279
|
+
|
|
280
|
+
#### set_thinking_level
|
|
281
|
+
|
|
282
|
+
Set the reasoning/thinking level for models that support it.
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{"type": "set_thinking_level", "level": "high"}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Levels: `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`
|
|
289
|
+
|
|
290
|
+
Note: `"xhigh"` is only supported by OpenAI codex-max models.
|
|
291
|
+
|
|
292
|
+
Response:
|
|
293
|
+
```json
|
|
294
|
+
{"type": "response", "command": "set_thinking_level", "success": true}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
#### cycle_thinking_level
|
|
298
|
+
|
|
299
|
+
Cycle through available thinking levels. Returns `null` data if model doesn't support thinking.
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{"type": "cycle_thinking_level"}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Response:
|
|
306
|
+
```json
|
|
307
|
+
{
|
|
308
|
+
"type": "response",
|
|
309
|
+
"command": "cycle_thinking_level",
|
|
310
|
+
"success": true,
|
|
311
|
+
"data": {"level": "high"}
|
|
312
|
+
}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Queue Modes
|
|
316
|
+
|
|
317
|
+
#### set_steering_mode
|
|
318
|
+
|
|
319
|
+
Control how steering messages (from `steer`) are delivered.
|
|
320
|
+
|
|
321
|
+
```json
|
|
322
|
+
{"type": "set_steering_mode", "mode": "one-at-a-time"}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Modes:
|
|
326
|
+
- `"all"`: Deliver all steering messages after the current assistant turn finishes executing its tool calls
|
|
327
|
+
- `"one-at-a-time"`: Deliver one steering message per completed assistant turn (default)
|
|
328
|
+
|
|
329
|
+
Response:
|
|
330
|
+
```json
|
|
331
|
+
{"type": "response", "command": "set_steering_mode", "success": true}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### set_follow_up_mode
|
|
335
|
+
|
|
336
|
+
Control how follow-up messages (from `follow_up`) are delivered.
|
|
337
|
+
|
|
338
|
+
```json
|
|
339
|
+
{"type": "set_follow_up_mode", "mode": "one-at-a-time"}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Modes:
|
|
343
|
+
- `"all"`: Deliver all follow-up messages when agent finishes
|
|
344
|
+
- `"one-at-a-time"`: Deliver one follow-up message per agent completion (default)
|
|
345
|
+
|
|
346
|
+
Response:
|
|
347
|
+
```json
|
|
348
|
+
{"type": "response", "command": "set_follow_up_mode", "success": true}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Compaction
|
|
352
|
+
|
|
353
|
+
#### compact
|
|
354
|
+
|
|
355
|
+
Manually compact conversation context to reduce token usage.
|
|
356
|
+
|
|
357
|
+
```json
|
|
358
|
+
{"type": "compact"}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
With custom instructions:
|
|
362
|
+
```json
|
|
363
|
+
{"type": "compact", "customInstructions": "Focus on code changes"}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Response:
|
|
367
|
+
```json
|
|
368
|
+
{
|
|
369
|
+
"type": "response",
|
|
370
|
+
"command": "compact",
|
|
371
|
+
"success": true,
|
|
372
|
+
"data": {
|
|
373
|
+
"summary": "Summary of conversation...",
|
|
374
|
+
"firstKeptEntryId": "abc123",
|
|
375
|
+
"tokensBefore": 150000,
|
|
376
|
+
"details": {}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
#### set_auto_compaction
|
|
382
|
+
|
|
383
|
+
Enable or disable automatic compaction when context is nearly full.
|
|
384
|
+
|
|
385
|
+
```json
|
|
386
|
+
{"type": "set_auto_compaction", "enabled": true}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Response:
|
|
390
|
+
```json
|
|
391
|
+
{"type": "response", "command": "set_auto_compaction", "success": true}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Retry
|
|
395
|
+
|
|
396
|
+
#### set_auto_retry
|
|
397
|
+
|
|
398
|
+
Enable or disable automatic retry on transient errors (overloaded, rate limit, 5xx).
|
|
399
|
+
|
|
400
|
+
```json
|
|
401
|
+
{"type": "set_auto_retry", "enabled": true}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Response:
|
|
405
|
+
```json
|
|
406
|
+
{"type": "response", "command": "set_auto_retry", "success": true}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
#### abort_retry
|
|
410
|
+
|
|
411
|
+
Abort an in-progress retry (cancel the delay and stop retrying).
|
|
412
|
+
|
|
413
|
+
```json
|
|
414
|
+
{"type": "abort_retry"}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Response:
|
|
418
|
+
```json
|
|
419
|
+
{"type": "response", "command": "abort_retry", "success": true}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Bash
|
|
423
|
+
|
|
424
|
+
#### bash
|
|
425
|
+
|
|
426
|
+
Execute a shell command and add output to conversation context.
|
|
427
|
+
|
|
428
|
+
```json
|
|
429
|
+
{"type": "bash", "command": "ls -la"}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
Response:
|
|
433
|
+
```json
|
|
434
|
+
{
|
|
435
|
+
"type": "response",
|
|
436
|
+
"command": "bash",
|
|
437
|
+
"success": true,
|
|
438
|
+
"data": {
|
|
439
|
+
"output": "total 48\ndrwxr-xr-x ...",
|
|
440
|
+
"exitCode": 0,
|
|
441
|
+
"cancelled": false,
|
|
442
|
+
"truncated": false
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
If output was truncated, includes `fullOutputPath`:
|
|
448
|
+
```json
|
|
449
|
+
{
|
|
450
|
+
"type": "response",
|
|
451
|
+
"command": "bash",
|
|
452
|
+
"success": true,
|
|
453
|
+
"data": {
|
|
454
|
+
"output": "truncated output...",
|
|
455
|
+
"exitCode": 0,
|
|
456
|
+
"cancelled": false,
|
|
457
|
+
"truncated": true,
|
|
458
|
+
"fullOutputPath": "/tmp/pi-bash-abc123.log"
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
**How bash results reach the LLM:**
|
|
464
|
+
|
|
465
|
+
The `bash` command executes immediately and returns a `BashResult`. Internally, a `BashExecutionMessage` is created and stored in the agent's message state. This message does NOT emit an event.
|
|
466
|
+
|
|
467
|
+
When the next `prompt` command is sent, all messages (including `BashExecutionMessage`) are transformed before being sent to the LLM. The `BashExecutionMessage` is converted to a `UserMessage` with this format:
|
|
468
|
+
|
|
469
|
+
````
|
|
470
|
+
Ran `ls -la`
|
|
471
|
+
```
|
|
472
|
+
total 48
|
|
473
|
+
drwxr-xr-x ...
|
|
474
|
+
```
|
|
475
|
+
````
|
|
476
|
+
|
|
477
|
+
This means:
|
|
478
|
+
1. Bash output is included in the LLM context on the **next prompt**, not immediately
|
|
479
|
+
2. Multiple bash commands can be executed before a prompt; all outputs will be included
|
|
480
|
+
3. No event is emitted for the `BashExecutionMessage` itself
|
|
481
|
+
|
|
482
|
+
#### abort_bash
|
|
483
|
+
|
|
484
|
+
Abort a running bash command.
|
|
485
|
+
|
|
486
|
+
```json
|
|
487
|
+
{"type": "abort_bash"}
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
Response:
|
|
491
|
+
```json
|
|
492
|
+
{"type": "response", "command": "abort_bash", "success": true}
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Session
|
|
496
|
+
|
|
497
|
+
#### get_session_stats
|
|
498
|
+
|
|
499
|
+
Get token usage, cost statistics, and current context window usage.
|
|
500
|
+
|
|
501
|
+
```json
|
|
502
|
+
{"type": "get_session_stats"}
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
Response:
|
|
506
|
+
```json
|
|
507
|
+
{
|
|
508
|
+
"type": "response",
|
|
509
|
+
"command": "get_session_stats",
|
|
510
|
+
"success": true,
|
|
511
|
+
"data": {
|
|
512
|
+
"sessionFile": "/path/to/session.jsonl",
|
|
513
|
+
"sessionId": "abc123",
|
|
514
|
+
"userMessages": 5,
|
|
515
|
+
"assistantMessages": 5,
|
|
516
|
+
"toolCalls": 12,
|
|
517
|
+
"toolResults": 12,
|
|
518
|
+
"totalMessages": 22,
|
|
519
|
+
"tokens": {
|
|
520
|
+
"input": 50000,
|
|
521
|
+
"output": 10000,
|
|
522
|
+
"cacheRead": 40000,
|
|
523
|
+
"cacheWrite": 5000,
|
|
524
|
+
"total": 105000
|
|
525
|
+
},
|
|
526
|
+
"cost": 0.45,
|
|
527
|
+
"contextUsage": {
|
|
528
|
+
"tokens": 60000,
|
|
529
|
+
"contextWindow": 200000,
|
|
530
|
+
"percent": 30
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
`tokens` contains assistant usage totals for the current session state. `contextUsage` contains the actual current context-window estimate used for compaction and footer display.
|
|
537
|
+
|
|
538
|
+
`contextUsage` is omitted when no model or context window is available. `contextUsage.tokens` and `contextUsage.percent` are `null` immediately after compaction until a fresh post-compaction assistant response provides valid usage data.
|
|
539
|
+
|
|
540
|
+
#### export_html
|
|
541
|
+
|
|
542
|
+
Export session to an HTML file.
|
|
543
|
+
|
|
544
|
+
```json
|
|
545
|
+
{"type": "export_html"}
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
With custom path:
|
|
549
|
+
```json
|
|
550
|
+
{"type": "export_html", "outputPath": "/tmp/session.html"}
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
Response:
|
|
554
|
+
```json
|
|
555
|
+
{
|
|
556
|
+
"type": "response",
|
|
557
|
+
"command": "export_html",
|
|
558
|
+
"success": true,
|
|
559
|
+
"data": {"path": "/tmp/session.html"}
|
|
560
|
+
}
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
#### switch_session
|
|
564
|
+
|
|
565
|
+
Load a different session file. Can be cancelled by a `session_before_switch` extension event handler.
|
|
566
|
+
|
|
567
|
+
```json
|
|
568
|
+
{"type": "switch_session", "sessionPath": "/path/to/session.jsonl"}
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
Response:
|
|
572
|
+
```json
|
|
573
|
+
{"type": "response", "command": "switch_session", "success": true, "data": {"cancelled": false}}
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
If an extension cancelled the switch:
|
|
577
|
+
```json
|
|
578
|
+
{"type": "response", "command": "switch_session", "success": true, "data": {"cancelled": true}}
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
#### fork
|
|
582
|
+
|
|
583
|
+
Create a new fork from a previous user message on the active branch. Can be cancelled by a `session_before_fork` extension event handler. Returns the text of the message being forked from.
|
|
584
|
+
|
|
585
|
+
```json
|
|
586
|
+
{"type": "fork", "entryId": "abc123"}
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
Response:
|
|
590
|
+
```json
|
|
591
|
+
{
|
|
592
|
+
"type": "response",
|
|
593
|
+
"command": "fork",
|
|
594
|
+
"success": true,
|
|
595
|
+
"data": {"text": "The original prompt text...", "cancelled": false}
|
|
596
|
+
}
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
If an extension cancelled the fork:
|
|
600
|
+
```json
|
|
601
|
+
{
|
|
602
|
+
"type": "response",
|
|
603
|
+
"command": "fork",
|
|
604
|
+
"success": true,
|
|
605
|
+
"data": {"text": "The original prompt text...", "cancelled": true}
|
|
606
|
+
}
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
#### clone
|
|
610
|
+
|
|
611
|
+
Duplicate the current active branch into a new session at the current position. Can be cancelled by a `session_before_fork` extension event handler.
|
|
612
|
+
|
|
613
|
+
```json
|
|
614
|
+
{"type": "clone"}
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
Response:
|
|
618
|
+
```json
|
|
619
|
+
{
|
|
620
|
+
"type": "response",
|
|
621
|
+
"command": "clone",
|
|
622
|
+
"success": true,
|
|
623
|
+
"data": {"cancelled": false}
|
|
624
|
+
}
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
If an extension cancelled the clone:
|
|
628
|
+
```json
|
|
629
|
+
{
|
|
630
|
+
"type": "response",
|
|
631
|
+
"command": "clone",
|
|
632
|
+
"success": true,
|
|
633
|
+
"data": {"cancelled": true}
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
#### get_fork_messages
|
|
638
|
+
|
|
639
|
+
Get user messages available for forking.
|
|
640
|
+
|
|
641
|
+
```json
|
|
642
|
+
{"type": "get_fork_messages"}
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
Response:
|
|
646
|
+
```json
|
|
647
|
+
{
|
|
648
|
+
"type": "response",
|
|
649
|
+
"command": "get_fork_messages",
|
|
650
|
+
"success": true,
|
|
651
|
+
"data": {
|
|
652
|
+
"messages": [
|
|
653
|
+
{"entryId": "abc123", "text": "First prompt..."},
|
|
654
|
+
{"entryId": "def456", "text": "Second prompt..."}
|
|
655
|
+
]
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
#### get_last_assistant_text
|
|
661
|
+
|
|
662
|
+
Get the text content of the last assistant message.
|
|
663
|
+
|
|
664
|
+
```json
|
|
665
|
+
{"type": "get_last_assistant_text"}
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
Response:
|
|
669
|
+
```json
|
|
670
|
+
{
|
|
671
|
+
"type": "response",
|
|
672
|
+
"command": "get_last_assistant_text",
|
|
673
|
+
"success": true,
|
|
674
|
+
"data": {"text": "The assistant's response..."}
|
|
675
|
+
}
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
Returns `{"text": null}` if no assistant messages exist.
|
|
679
|
+
|
|
680
|
+
#### set_session_name
|
|
681
|
+
|
|
682
|
+
Set a display name for the current session. The name appears in session listings and helps identify sessions.
|
|
683
|
+
|
|
684
|
+
```json
|
|
685
|
+
{"type": "set_session_name", "name": "my-feature-work"}
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
Response:
|
|
689
|
+
```json
|
|
690
|
+
{
|
|
691
|
+
"type": "response",
|
|
692
|
+
"command": "set_session_name",
|
|
693
|
+
"success": true
|
|
694
|
+
}
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
The current session name is available via `get_state` in the `sessionName` field.
|
|
698
|
+
|
|
699
|
+
### Commands
|
|
700
|
+
|
|
701
|
+
#### get_commands
|
|
702
|
+
|
|
703
|
+
Get available commands (extension commands, prompt templates, and skills). These can be invoked via the `prompt` command by prefixing with `/`.
|
|
704
|
+
|
|
705
|
+
```json
|
|
706
|
+
{"type": "get_commands"}
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
Response:
|
|
710
|
+
```json
|
|
711
|
+
{
|
|
712
|
+
"type": "response",
|
|
713
|
+
"command": "get_commands",
|
|
714
|
+
"success": true,
|
|
715
|
+
"data": {
|
|
716
|
+
"commands": [
|
|
717
|
+
{"name": "session-name", "description": "Set or clear session name", "source": "extension", "path": "/home/user/.pi/agent/extensions/session.ts"},
|
|
718
|
+
{"name": "fix-tests", "description": "Fix failing tests", "source": "prompt", "location": "project", "path": "/home/user/myproject/.pi/agent/prompts/fix-tests.md"},
|
|
719
|
+
{"name": "skill:brave-search", "description": "Web search via Brave API", "source": "skill", "location": "user", "path": "/home/user/.pi/agent/skills/brave-search/SKILL.md"}
|
|
720
|
+
]
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
Each command has:
|
|
726
|
+
- `name`: Command name (invoke with `/name`)
|
|
727
|
+
- `description`: Human-readable description (optional for extension commands)
|
|
728
|
+
- `source`: What kind of command:
|
|
729
|
+
- `"extension"`: Registered via `pi.registerCommand()` in an extension
|
|
730
|
+
- `"prompt"`: Loaded from a prompt template `.md` file
|
|
731
|
+
- `"skill"`: Loaded from a skill directory (name is prefixed with `skill:`)
|
|
732
|
+
- `location`: Where it was loaded from (optional, not present for extensions):
|
|
733
|
+
- `"user"`: User-level (`~/.pi/agent/`)
|
|
734
|
+
- `"project"`: Project-level (`./.pi/agent/`)
|
|
735
|
+
- `"path"`: Explicit path via CLI or settings
|
|
736
|
+
- `path`: Absolute file path to the command source (optional)
|
|
737
|
+
|
|
738
|
+
**Note**: Built-in TUI commands (`/settings`, `/hotkeys`, etc.) are not included. They are handled only in interactive mode and would not execute if sent via `prompt`.
|
|
739
|
+
|
|
740
|
+
## Events
|
|
741
|
+
|
|
742
|
+
Events are streamed to stdout as JSON lines during agent operation. Events do NOT include an `id` field (only responses do).
|
|
743
|
+
|
|
744
|
+
### Event Types
|
|
745
|
+
|
|
746
|
+
| Event | Description |
|
|
747
|
+
|-------|-------------|
|
|
748
|
+
| `agent_start` | Agent begins processing |
|
|
749
|
+
| `agent_end` | Agent completes (includes all generated messages) |
|
|
750
|
+
| `turn_start` | New turn begins |
|
|
751
|
+
| `turn_end` | Turn completes (includes assistant message and tool results) |
|
|
752
|
+
| `message_start` | Message begins |
|
|
753
|
+
| `message_update` | Streaming update (text/thinking/toolcall deltas) |
|
|
754
|
+
| `message_end` | Message completes |
|
|
755
|
+
| `tool_execution_start` | Tool begins execution |
|
|
756
|
+
| `tool_execution_update` | Tool execution progress (streaming output) |
|
|
757
|
+
| `tool_execution_end` | Tool completes |
|
|
758
|
+
| `queue_update` | Pending steering/follow-up queue changed |
|
|
759
|
+
| `compaction_start` | Compaction begins |
|
|
760
|
+
| `compaction_end` | Compaction completes |
|
|
761
|
+
| `auto_retry_start` | Auto-retry begins (after transient error) |
|
|
762
|
+
| `auto_retry_end` | Auto-retry completes (success or final failure) |
|
|
763
|
+
| `extension_error` | Extension threw an error |
|
|
764
|
+
|
|
765
|
+
### agent_start
|
|
766
|
+
|
|
767
|
+
Emitted when the agent begins processing a prompt.
|
|
768
|
+
|
|
769
|
+
```json
|
|
770
|
+
{"type": "agent_start"}
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
### agent_end
|
|
774
|
+
|
|
775
|
+
Emitted when the agent completes. Contains all messages generated during this run.
|
|
776
|
+
|
|
777
|
+
```json
|
|
778
|
+
{
|
|
779
|
+
"type": "agent_end",
|
|
780
|
+
"messages": [...]
|
|
781
|
+
}
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
### turn_start / turn_end
|
|
785
|
+
|
|
786
|
+
A turn consists of one assistant response plus any resulting tool calls and results.
|
|
787
|
+
|
|
788
|
+
```json
|
|
789
|
+
{"type": "turn_start"}
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
```json
|
|
793
|
+
{
|
|
794
|
+
"type": "turn_end",
|
|
795
|
+
"message": {...},
|
|
796
|
+
"toolResults": [...]
|
|
797
|
+
}
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
### message_start / message_end
|
|
801
|
+
|
|
802
|
+
Emitted when a message begins and completes. The `message` field contains an `AgentMessage`.
|
|
803
|
+
|
|
804
|
+
```json
|
|
805
|
+
{"type": "message_start", "message": {...}}
|
|
806
|
+
{"type": "message_end", "message": {...}}
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
### message_update (Streaming)
|
|
810
|
+
|
|
811
|
+
Emitted during streaming of assistant messages. Contains both the partial message and a streaming delta event.
|
|
812
|
+
|
|
813
|
+
```json
|
|
814
|
+
{
|
|
815
|
+
"type": "message_update",
|
|
816
|
+
"message": {...},
|
|
817
|
+
"assistantMessageEvent": {
|
|
818
|
+
"type": "text_delta",
|
|
819
|
+
"contentIndex": 0,
|
|
820
|
+
"delta": "Hello ",
|
|
821
|
+
"partial": {...}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
The `assistantMessageEvent` field contains one of these delta types:
|
|
827
|
+
|
|
828
|
+
| Type | Description |
|
|
829
|
+
|------|-------------|
|
|
830
|
+
| `start` | Message generation started |
|
|
831
|
+
| `text_start` | Text content block started |
|
|
832
|
+
| `text_delta` | Text content chunk |
|
|
833
|
+
| `text_end` | Text content block ended |
|
|
834
|
+
| `thinking_start` | Thinking block started |
|
|
835
|
+
| `thinking_delta` | Thinking content chunk |
|
|
836
|
+
| `thinking_end` | Thinking block ended |
|
|
837
|
+
| `toolcall_start` | Tool call started |
|
|
838
|
+
| `toolcall_delta` | Tool call arguments chunk |
|
|
839
|
+
| `toolcall_end` | Tool call ended (includes full `toolCall` object) |
|
|
840
|
+
| `done` | Message complete (reason: `"stop"`, `"length"`, `"toolUse"`) |
|
|
841
|
+
| `error` | Error occurred (reason: `"aborted"`, `"error"`) |
|
|
842
|
+
|
|
843
|
+
Example streaming a text response:
|
|
844
|
+
```json
|
|
845
|
+
{"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_start","contentIndex":0,"partial":{...}}}
|
|
846
|
+
{"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello","partial":{...}}}
|
|
847
|
+
{"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":" world","partial":{...}}}
|
|
848
|
+
{"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_end","contentIndex":0,"content":"Hello world","partial":{...}}}
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
### tool_execution_start / tool_execution_update / tool_execution_end
|
|
852
|
+
|
|
853
|
+
Emitted when a tool begins, streams progress, and completes execution.
|
|
854
|
+
|
|
855
|
+
```json
|
|
856
|
+
{
|
|
857
|
+
"type": "tool_execution_start",
|
|
858
|
+
"toolCallId": "call_abc123",
|
|
859
|
+
"toolName": "bash",
|
|
860
|
+
"args": {"command": "ls -la"}
|
|
861
|
+
}
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
During execution, `tool_execution_update` events stream partial results (e.g., bash output as it arrives):
|
|
865
|
+
|
|
866
|
+
```json
|
|
867
|
+
{
|
|
868
|
+
"type": "tool_execution_update",
|
|
869
|
+
"toolCallId": "call_abc123",
|
|
870
|
+
"toolName": "bash",
|
|
871
|
+
"args": {"command": "ls -la"},
|
|
872
|
+
"partialResult": {
|
|
873
|
+
"content": [{"type": "text", "text": "partial output so far..."}],
|
|
874
|
+
"details": {"truncation": null, "fullOutputPath": null}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
When complete:
|
|
880
|
+
|
|
881
|
+
```json
|
|
882
|
+
{
|
|
883
|
+
"type": "tool_execution_end",
|
|
884
|
+
"toolCallId": "call_abc123",
|
|
885
|
+
"toolName": "bash",
|
|
886
|
+
"result": {
|
|
887
|
+
"content": [{"type": "text", "text": "total 48\n..."}],
|
|
888
|
+
"details": {...}
|
|
889
|
+
},
|
|
890
|
+
"isError": false
|
|
891
|
+
}
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
Use `toolCallId` to correlate events. The `partialResult` in `tool_execution_update` contains the accumulated output so far (not just the delta), allowing clients to simply replace their display on each update.
|
|
895
|
+
|
|
896
|
+
### queue_update
|
|
897
|
+
|
|
898
|
+
Emitted whenever the pending steering or follow-up queue changes.
|
|
899
|
+
|
|
900
|
+
```json
|
|
901
|
+
{
|
|
902
|
+
"type": "queue_update",
|
|
903
|
+
"steering": ["Focus on error handling"],
|
|
904
|
+
"followUp": ["After that, summarize the result"]
|
|
905
|
+
}
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
### compaction_start / compaction_end
|
|
909
|
+
|
|
910
|
+
Emitted when compaction runs, whether manual or automatic.
|
|
911
|
+
|
|
912
|
+
```json
|
|
913
|
+
{"type": "compaction_start", "reason": "threshold"}
|
|
914
|
+
```
|
|
915
|
+
|
|
916
|
+
The `reason` field is `"manual"`, `"threshold"`, or `"overflow"`.
|
|
917
|
+
|
|
918
|
+
```json
|
|
919
|
+
{
|
|
920
|
+
"type": "compaction_end",
|
|
921
|
+
"reason": "threshold",
|
|
922
|
+
"result": {
|
|
923
|
+
"summary": "Summary of conversation...",
|
|
924
|
+
"firstKeptEntryId": "abc123",
|
|
925
|
+
"tokensBefore": 150000,
|
|
926
|
+
"details": {}
|
|
927
|
+
},
|
|
928
|
+
"aborted": false,
|
|
929
|
+
"willRetry": false
|
|
930
|
+
}
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
If `reason` was `"overflow"` and compaction succeeds, `willRetry` is `true` and the agent will automatically retry the prompt.
|
|
934
|
+
|
|
935
|
+
If compaction was aborted, `result` is `null` and `aborted` is `true`.
|
|
936
|
+
|
|
937
|
+
If compaction failed (e.g., API quota exceeded), `result` is `null`, `aborted` is `false`, and `errorMessage` contains the error description.
|
|
938
|
+
|
|
939
|
+
### auto_retry_start / auto_retry_end
|
|
940
|
+
|
|
941
|
+
Emitted when automatic retry is triggered after a transient error (overloaded, rate limit, 5xx).
|
|
942
|
+
|
|
943
|
+
```json
|
|
944
|
+
{
|
|
945
|
+
"type": "auto_retry_start",
|
|
946
|
+
"attempt": 1,
|
|
947
|
+
"maxAttempts": 3,
|
|
948
|
+
"delayMs": 2000,
|
|
949
|
+
"errorMessage": "529 {\"type\":\"error\",\"error\":{\"type\":\"overloaded_error\",\"message\":\"Overloaded\"}}"
|
|
950
|
+
}
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
```json
|
|
954
|
+
{
|
|
955
|
+
"type": "auto_retry_end",
|
|
956
|
+
"success": true,
|
|
957
|
+
"attempt": 2
|
|
958
|
+
}
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
On final failure (max retries exceeded):
|
|
962
|
+
```json
|
|
963
|
+
{
|
|
964
|
+
"type": "auto_retry_end",
|
|
965
|
+
"success": false,
|
|
966
|
+
"attempt": 3,
|
|
967
|
+
"finalError": "529 overloaded_error: Overloaded"
|
|
968
|
+
}
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
### extension_error
|
|
972
|
+
|
|
973
|
+
Emitted when an extension throws an error.
|
|
974
|
+
|
|
975
|
+
```json
|
|
976
|
+
{
|
|
977
|
+
"type": "extension_error",
|
|
978
|
+
"extensionPath": "/path/to/extension.ts",
|
|
979
|
+
"event": "tool_call",
|
|
980
|
+
"error": "Error message..."
|
|
981
|
+
}
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
## Extension UI Protocol
|
|
985
|
+
|
|
986
|
+
Extensions can request user interaction via `ctx.ui.select()`, `ctx.ui.confirm()`, etc. In RPC mode, these are translated into a request/response sub-protocol on top of the base command/event flow.
|
|
987
|
+
|
|
988
|
+
There are two categories of extension UI methods:
|
|
989
|
+
|
|
990
|
+
- **Dialog methods** (`select`, `confirm`, `input`, `editor`): emit an `extension_ui_request` on stdout and block until the client sends back an `extension_ui_response` on stdin with the matching `id`.
|
|
991
|
+
- **Fire-and-forget methods** (`notify`, `setStatus`, `setWidget`, `setTitle`, `set_editor_text`): emit an `extension_ui_request` on stdout but do not expect a response. The client can display the information or ignore it.
|
|
992
|
+
|
|
993
|
+
If a dialog method includes a `timeout` field, the agent-side will auto-resolve with a default value when the timeout expires. The client does not need to track timeouts.
|
|
994
|
+
|
|
995
|
+
Some `ExtensionUIContext` methods are not supported or degraded in RPC mode because they require direct TUI access:
|
|
996
|
+
- `custom()` returns `undefined`
|
|
997
|
+
- `setWorkingMessage()`, `setWorkingIndicator()`, `setFooter()`, `setHeader()`, `setEditorComponent()`, `setToolsExpanded()` are no-ops
|
|
998
|
+
- `getEditorText()` returns `""`
|
|
999
|
+
- `getToolsExpanded()` returns `false`
|
|
1000
|
+
- `pasteToEditor()` delegates to `setEditorText()` (no paste/collapse handling)
|
|
1001
|
+
- `getAllThemes()` returns `[]`
|
|
1002
|
+
- `getTheme()` returns `undefined`
|
|
1003
|
+
- `setTheme()` returns `{ success: false, error: "..." }`
|
|
1004
|
+
|
|
1005
|
+
Note: `ctx.hasUI` is `true` in RPC mode because the dialog and fire-and-forget methods are functional via the extension UI sub-protocol.
|
|
1006
|
+
|
|
1007
|
+
### Extension UI Requests (stdout)
|
|
1008
|
+
|
|
1009
|
+
All requests have `type: "extension_ui_request"`, a unique `id`, and a `method` field.
|
|
1010
|
+
|
|
1011
|
+
#### select
|
|
1012
|
+
|
|
1013
|
+
Prompt the user to choose from a list. Dialog methods with a `timeout` field include the timeout in milliseconds; the agent auto-resolves with `undefined` if the client doesn't respond in time.
|
|
1014
|
+
|
|
1015
|
+
```json
|
|
1016
|
+
{
|
|
1017
|
+
"type": "extension_ui_request",
|
|
1018
|
+
"id": "uuid-1",
|
|
1019
|
+
"method": "select",
|
|
1020
|
+
"title": "Allow dangerous command?",
|
|
1021
|
+
"options": ["Allow", "Block"],
|
|
1022
|
+
"timeout": 10000
|
|
1023
|
+
}
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
Expected response: `extension_ui_response` with `value` (the selected option string) or `cancelled: true`.
|
|
1027
|
+
|
|
1028
|
+
#### confirm
|
|
1029
|
+
|
|
1030
|
+
Prompt the user for yes/no confirmation.
|
|
1031
|
+
|
|
1032
|
+
```json
|
|
1033
|
+
{
|
|
1034
|
+
"type": "extension_ui_request",
|
|
1035
|
+
"id": "uuid-2",
|
|
1036
|
+
"method": "confirm",
|
|
1037
|
+
"title": "Clear session?",
|
|
1038
|
+
"message": "All messages will be lost.",
|
|
1039
|
+
"timeout": 5000
|
|
1040
|
+
}
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
Expected response: `extension_ui_response` with `confirmed: true/false` or `cancelled: true`.
|
|
1044
|
+
|
|
1045
|
+
#### input
|
|
1046
|
+
|
|
1047
|
+
Prompt the user for free-form text.
|
|
1048
|
+
|
|
1049
|
+
```json
|
|
1050
|
+
{
|
|
1051
|
+
"type": "extension_ui_request",
|
|
1052
|
+
"id": "uuid-3",
|
|
1053
|
+
"method": "input",
|
|
1054
|
+
"title": "Enter a value",
|
|
1055
|
+
"placeholder": "type something..."
|
|
1056
|
+
}
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
Expected response: `extension_ui_response` with `value` (the entered text) or `cancelled: true`.
|
|
1060
|
+
|
|
1061
|
+
#### editor
|
|
1062
|
+
|
|
1063
|
+
Open a multi-line text editor with optional prefilled content.
|
|
1064
|
+
|
|
1065
|
+
```json
|
|
1066
|
+
{
|
|
1067
|
+
"type": "extension_ui_request",
|
|
1068
|
+
"id": "uuid-4",
|
|
1069
|
+
"method": "editor",
|
|
1070
|
+
"title": "Edit some text",
|
|
1071
|
+
"prefill": "Line 1\nLine 2\nLine 3"
|
|
1072
|
+
}
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
Expected response: `extension_ui_response` with `value` (the edited text) or `cancelled: true`.
|
|
1076
|
+
|
|
1077
|
+
#### notify
|
|
1078
|
+
|
|
1079
|
+
Display a notification. Fire-and-forget, no response expected.
|
|
1080
|
+
|
|
1081
|
+
```json
|
|
1082
|
+
{
|
|
1083
|
+
"type": "extension_ui_request",
|
|
1084
|
+
"id": "uuid-5",
|
|
1085
|
+
"method": "notify",
|
|
1086
|
+
"message": "Command blocked by user",
|
|
1087
|
+
"notifyType": "warning"
|
|
1088
|
+
}
|
|
1089
|
+
```
|
|
1090
|
+
|
|
1091
|
+
The `notifyType` field is `"info"`, `"warning"`, or `"error"`. Defaults to `"info"` if omitted.
|
|
1092
|
+
|
|
1093
|
+
#### setStatus
|
|
1094
|
+
|
|
1095
|
+
Set or clear a status entry in the footer/status bar. Fire-and-forget.
|
|
1096
|
+
|
|
1097
|
+
```json
|
|
1098
|
+
{
|
|
1099
|
+
"type": "extension_ui_request",
|
|
1100
|
+
"id": "uuid-6",
|
|
1101
|
+
"method": "setStatus",
|
|
1102
|
+
"statusKey": "my-ext",
|
|
1103
|
+
"statusText": "Turn 3 running..."
|
|
1104
|
+
}
|
|
1105
|
+
```
|
|
1106
|
+
|
|
1107
|
+
Send `statusText: undefined` (or omit it) to clear the status entry for that key.
|
|
1108
|
+
|
|
1109
|
+
#### setWidget
|
|
1110
|
+
|
|
1111
|
+
Set or clear a widget (block of text lines) displayed above or below the editor. Fire-and-forget.
|
|
1112
|
+
|
|
1113
|
+
```json
|
|
1114
|
+
{
|
|
1115
|
+
"type": "extension_ui_request",
|
|
1116
|
+
"id": "uuid-7",
|
|
1117
|
+
"method": "setWidget",
|
|
1118
|
+
"widgetKey": "my-ext",
|
|
1119
|
+
"widgetLines": ["--- My Widget ---", "Line 1", "Line 2"],
|
|
1120
|
+
"widgetPlacement": "aboveEditor"
|
|
1121
|
+
}
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1124
|
+
Send `widgetLines: undefined` (or omit it) to clear the widget. The `widgetPlacement` field is `"aboveEditor"` (default) or `"belowEditor"`. Only string arrays are supported in RPC mode; component factories are ignored.
|
|
1125
|
+
|
|
1126
|
+
#### setTitle
|
|
1127
|
+
|
|
1128
|
+
Set the terminal window/tab title. Fire-and-forget.
|
|
1129
|
+
|
|
1130
|
+
```json
|
|
1131
|
+
{
|
|
1132
|
+
"type": "extension_ui_request",
|
|
1133
|
+
"id": "uuid-8",
|
|
1134
|
+
"method": "setTitle",
|
|
1135
|
+
"title": "pi - my project"
|
|
1136
|
+
}
|
|
1137
|
+
```
|
|
1138
|
+
|
|
1139
|
+
#### set_editor_text
|
|
1140
|
+
|
|
1141
|
+
Set the text in the input editor. Fire-and-forget.
|
|
1142
|
+
|
|
1143
|
+
```json
|
|
1144
|
+
{
|
|
1145
|
+
"type": "extension_ui_request",
|
|
1146
|
+
"id": "uuid-9",
|
|
1147
|
+
"method": "set_editor_text",
|
|
1148
|
+
"text": "prefilled text for the user"
|
|
1149
|
+
}
|
|
1150
|
+
```
|
|
1151
|
+
|
|
1152
|
+
### Extension UI Responses (stdin)
|
|
1153
|
+
|
|
1154
|
+
Responses are sent for dialog methods only (`select`, `confirm`, `input`, `editor`). The `id` must match the request.
|
|
1155
|
+
|
|
1156
|
+
#### Value response (select, input, editor)
|
|
1157
|
+
|
|
1158
|
+
```json
|
|
1159
|
+
{"type": "extension_ui_response", "id": "uuid-1", "value": "Allow"}
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
#### Confirmation response (confirm)
|
|
1163
|
+
|
|
1164
|
+
```json
|
|
1165
|
+
{"type": "extension_ui_response", "id": "uuid-2", "confirmed": true}
|
|
1166
|
+
```
|
|
1167
|
+
|
|
1168
|
+
#### Cancellation response (any dialog)
|
|
1169
|
+
|
|
1170
|
+
Dismiss any dialog method. The extension receives `undefined` (for select/input/editor) or `false` (for confirm).
|
|
1171
|
+
|
|
1172
|
+
```json
|
|
1173
|
+
{"type": "extension_ui_response", "id": "uuid-3", "cancelled": true}
|
|
1174
|
+
```
|
|
1175
|
+
|
|
1176
|
+
## Error Handling
|
|
1177
|
+
|
|
1178
|
+
Failed commands return a response with `success: false`:
|
|
1179
|
+
|
|
1180
|
+
```json
|
|
1181
|
+
{
|
|
1182
|
+
"type": "response",
|
|
1183
|
+
"command": "set_model",
|
|
1184
|
+
"success": false,
|
|
1185
|
+
"error": "Model not found: invalid/model"
|
|
1186
|
+
}
|
|
1187
|
+
```
|
|
1188
|
+
|
|
1189
|
+
Parse errors:
|
|
1190
|
+
|
|
1191
|
+
```json
|
|
1192
|
+
{
|
|
1193
|
+
"type": "response",
|
|
1194
|
+
"command": "parse",
|
|
1195
|
+
"success": false,
|
|
1196
|
+
"error": "Failed to parse command: Unexpected token..."
|
|
1197
|
+
}
|
|
1198
|
+
```
|
|
1199
|
+
|
|
1200
|
+
## Types
|
|
1201
|
+
|
|
1202
|
+
Source files:
|
|
1203
|
+
- [`packages/ai/src/types.ts`](../../ai/src/types.ts) - `Model`, `UserMessage`, `AssistantMessage`, `ToolResultMessage`
|
|
1204
|
+
- [`packages/agent/src/types.ts`](../../agent/src/types.ts) - `AgentMessage`, `AgentEvent`
|
|
1205
|
+
- [`src/core/messages.ts`](../src/core/messages.ts) - `BashExecutionMessage`
|
|
1206
|
+
- [`src/modes/rpc/rpc-types.ts`](../src/modes/rpc/rpc-types.ts) - RPC command/response types, extension UI request/response types
|
|
1207
|
+
|
|
1208
|
+
### Model
|
|
1209
|
+
|
|
1210
|
+
```json
|
|
1211
|
+
{
|
|
1212
|
+
"id": "claude-sonnet-4-20250514",
|
|
1213
|
+
"name": "Claude Sonnet 4",
|
|
1214
|
+
"api": "anthropic-messages",
|
|
1215
|
+
"provider": "anthropic",
|
|
1216
|
+
"baseUrl": "https://api.anthropic.com",
|
|
1217
|
+
"reasoning": true,
|
|
1218
|
+
"input": ["text", "image"],
|
|
1219
|
+
"contextWindow": 200000,
|
|
1220
|
+
"maxTokens": 16384,
|
|
1221
|
+
"cost": {
|
|
1222
|
+
"input": 3.0,
|
|
1223
|
+
"output": 15.0,
|
|
1224
|
+
"cacheRead": 0.3,
|
|
1225
|
+
"cacheWrite": 3.75
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
### UserMessage
|
|
1231
|
+
|
|
1232
|
+
```json
|
|
1233
|
+
{
|
|
1234
|
+
"role": "user",
|
|
1235
|
+
"content": "Hello!",
|
|
1236
|
+
"timestamp": 1733234567890,
|
|
1237
|
+
"attachments": []
|
|
1238
|
+
}
|
|
1239
|
+
```
|
|
1240
|
+
|
|
1241
|
+
The `content` field can be a string or an array of `TextContent`/`ImageContent` blocks.
|
|
1242
|
+
|
|
1243
|
+
### AssistantMessage
|
|
1244
|
+
|
|
1245
|
+
```json
|
|
1246
|
+
{
|
|
1247
|
+
"role": "assistant",
|
|
1248
|
+
"content": [
|
|
1249
|
+
{"type": "text", "text": "Hello! How can I help?"},
|
|
1250
|
+
{"type": "thinking", "thinking": "User is greeting me..."},
|
|
1251
|
+
{"type": "toolCall", "id": "call_123", "name": "bash", "arguments": {"command": "ls"}}
|
|
1252
|
+
],
|
|
1253
|
+
"api": "anthropic-messages",
|
|
1254
|
+
"provider": "anthropic",
|
|
1255
|
+
"model": "claude-sonnet-4-20250514",
|
|
1256
|
+
"usage": {
|
|
1257
|
+
"input": 100,
|
|
1258
|
+
"output": 50,
|
|
1259
|
+
"cacheRead": 0,
|
|
1260
|
+
"cacheWrite": 0,
|
|
1261
|
+
"cost": {"input": 0.0003, "output": 0.00075, "cacheRead": 0, "cacheWrite": 0, "total": 0.00105}
|
|
1262
|
+
},
|
|
1263
|
+
"stopReason": "stop",
|
|
1264
|
+
"timestamp": 1733234567890
|
|
1265
|
+
}
|
|
1266
|
+
```
|
|
1267
|
+
|
|
1268
|
+
Stop reasons: `"stop"`, `"length"`, `"toolUse"`, `"error"`, `"aborted"`
|
|
1269
|
+
|
|
1270
|
+
### ToolResultMessage
|
|
1271
|
+
|
|
1272
|
+
```json
|
|
1273
|
+
{
|
|
1274
|
+
"role": "toolResult",
|
|
1275
|
+
"toolCallId": "call_123",
|
|
1276
|
+
"toolName": "bash",
|
|
1277
|
+
"content": [{"type": "text", "text": "total 48\ndrwxr-xr-x ..."}],
|
|
1278
|
+
"isError": false,
|
|
1279
|
+
"timestamp": 1733234567890
|
|
1280
|
+
}
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1283
|
+
### BashExecutionMessage
|
|
1284
|
+
|
|
1285
|
+
Created by the `bash` RPC command (not by LLM tool calls):
|
|
1286
|
+
|
|
1287
|
+
```json
|
|
1288
|
+
{
|
|
1289
|
+
"role": "bashExecution",
|
|
1290
|
+
"command": "ls -la",
|
|
1291
|
+
"output": "total 48\ndrwxr-xr-x ...",
|
|
1292
|
+
"exitCode": 0,
|
|
1293
|
+
"cancelled": false,
|
|
1294
|
+
"truncated": false,
|
|
1295
|
+
"fullOutputPath": null,
|
|
1296
|
+
"timestamp": 1733234567890
|
|
1297
|
+
}
|
|
1298
|
+
```
|
|
1299
|
+
|
|
1300
|
+
### Attachment
|
|
1301
|
+
|
|
1302
|
+
```json
|
|
1303
|
+
{
|
|
1304
|
+
"id": "img1",
|
|
1305
|
+
"type": "image",
|
|
1306
|
+
"fileName": "photo.jpg",
|
|
1307
|
+
"mimeType": "image/jpeg",
|
|
1308
|
+
"size": 102400,
|
|
1309
|
+
"content": "base64-encoded-data...",
|
|
1310
|
+
"extractedText": null,
|
|
1311
|
+
"preview": null
|
|
1312
|
+
}
|
|
1313
|
+
```
|
|
1314
|
+
|
|
1315
|
+
## Example: Basic Client (Python)
|
|
1316
|
+
|
|
1317
|
+
```python
|
|
1318
|
+
import subprocess
|
|
1319
|
+
import json
|
|
1320
|
+
|
|
1321
|
+
proc = subprocess.Popen(
|
|
1322
|
+
["pi", "--mode", "rpc", "--no-session"],
|
|
1323
|
+
stdin=subprocess.PIPE,
|
|
1324
|
+
stdout=subprocess.PIPE,
|
|
1325
|
+
text=True
|
|
1326
|
+
)
|
|
1327
|
+
|
|
1328
|
+
def send(cmd):
|
|
1329
|
+
proc.stdin.write(json.dumps(cmd) + "\n")
|
|
1330
|
+
proc.stdin.flush()
|
|
1331
|
+
|
|
1332
|
+
def read_events():
|
|
1333
|
+
for line in proc.stdout:
|
|
1334
|
+
yield json.loads(line)
|
|
1335
|
+
|
|
1336
|
+
# Send prompt
|
|
1337
|
+
send({"type": "prompt", "message": "Hello!"})
|
|
1338
|
+
|
|
1339
|
+
# Process events
|
|
1340
|
+
for event in read_events():
|
|
1341
|
+
if event.get("type") == "message_update":
|
|
1342
|
+
delta = event.get("assistantMessageEvent", {})
|
|
1343
|
+
if delta.get("type") == "text_delta":
|
|
1344
|
+
print(delta["delta"], end="", flush=True)
|
|
1345
|
+
|
|
1346
|
+
if event.get("type") == "agent_end":
|
|
1347
|
+
print()
|
|
1348
|
+
break
|
|
1349
|
+
```
|
|
1350
|
+
|
|
1351
|
+
## Example: Interactive Client (Node.js)
|
|
1352
|
+
|
|
1353
|
+
See [`test/rpc-example.ts`](../test/rpc-example.ts) for a complete interactive example, or [`src/modes/rpc/rpc-client.ts`](../src/modes/rpc/rpc-client.ts) for a typed client implementation.
|
|
1354
|
+
|
|
1355
|
+
For a complete example of handling the extension UI protocol, see [`examples/rpc-extension-ui.ts`](../examples/rpc-extension-ui.ts) which pairs with the [`examples/extensions/rpc-demo.ts`](../examples/extensions/rpc-demo.ts) extension.
|
|
1356
|
+
|
|
1357
|
+
```javascript
|
|
1358
|
+
const { spawn } = require("child_process");
|
|
1359
|
+
const { StringDecoder } = require("string_decoder");
|
|
1360
|
+
|
|
1361
|
+
const agent = spawn("pi", ["--mode", "rpc", "--no-session"]);
|
|
1362
|
+
|
|
1363
|
+
function attachJsonlReader(stream, onLine) {
|
|
1364
|
+
const decoder = new StringDecoder("utf8");
|
|
1365
|
+
let buffer = "";
|
|
1366
|
+
|
|
1367
|
+
stream.on("data", (chunk) => {
|
|
1368
|
+
buffer += typeof chunk === "string" ? chunk : decoder.write(chunk);
|
|
1369
|
+
|
|
1370
|
+
while (true) {
|
|
1371
|
+
const newlineIndex = buffer.indexOf("\n");
|
|
1372
|
+
if (newlineIndex === -1) break;
|
|
1373
|
+
|
|
1374
|
+
let line = buffer.slice(0, newlineIndex);
|
|
1375
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
1376
|
+
if (line.endsWith("\r")) line = line.slice(0, -1);
|
|
1377
|
+
onLine(line);
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
|
|
1381
|
+
stream.on("end", () => {
|
|
1382
|
+
buffer += decoder.end();
|
|
1383
|
+
if (buffer.length > 0) {
|
|
1384
|
+
onLine(buffer.endsWith("\r") ? buffer.slice(0, -1) : buffer);
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
attachJsonlReader(agent.stdout, (line) => {
|
|
1390
|
+
const event = JSON.parse(line);
|
|
1391
|
+
|
|
1392
|
+
if (event.type === "message_update") {
|
|
1393
|
+
const { assistantMessageEvent } = event;
|
|
1394
|
+
if (assistantMessageEvent.type === "text_delta") {
|
|
1395
|
+
process.stdout.write(assistantMessageEvent.delta);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
|
|
1400
|
+
// Send prompt
|
|
1401
|
+
agent.stdin.write(JSON.stringify({ type: "prompt", message: "Hello" }) + "\n");
|
|
1402
|
+
|
|
1403
|
+
// Abort on Ctrl+C
|
|
1404
|
+
process.on("SIGINT", () => {
|
|
1405
|
+
agent.stdin.write(JSON.stringify({ type: "abort" }) + "\n");
|
|
1406
|
+
});
|
|
1407
|
+
```
|