@bastani/atomic 0.8.31-alpha.5 → 0.9.0-alpha.1
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 +5 -1
- package/dist/builtin/cursor/CHANGELOG.md +4 -1
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/cursor/src/proto/protobuf-codec-json.ts +44 -0
- package/dist/builtin/cursor/src/proto/protobuf-codec-request.ts +271 -0
- package/dist/builtin/cursor/src/proto/protobuf-codec-wire.ts +231 -0
- package/dist/builtin/cursor/src/proto/protobuf-codec.ts +5 -523
- package/dist/builtin/cursor/src/stream.ts +6 -70
- package/dist/builtin/cursor/src/transport-errors.ts +74 -0
- package/dist/builtin/cursor/src/transport-frame.ts +56 -0
- package/dist/builtin/cursor/src/transport-http2.ts +122 -0
- package/dist/builtin/cursor/src/transport-native-client.ts +161 -0
- package/dist/builtin/cursor/src/transport-run-stream.ts +188 -0
- package/dist/builtin/cursor/src/transport-timeouts.ts +87 -0
- package/dist/builtin/cursor/src/transport-types.ts +140 -0
- package/dist/builtin/cursor/src/transport.ts +24 -790
- package/dist/builtin/intercom/CHANGELOG.md +3 -0
- package/dist/builtin/intercom/broker/client.ts +0 -35
- package/dist/builtin/intercom/contact-supervisor-tool.ts +289 -0
- package/dist/builtin/intercom/index-heavy.ts +77 -1336
- package/dist/builtin/intercom/intercom-tool.ts +409 -0
- package/dist/builtin/intercom/intercom-utils.ts +401 -0
- package/dist/builtin/intercom/lifecycle.ts +133 -0
- package/dist/builtin/intercom/overlay.ts +96 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/subagent-relay.ts +137 -0
- package/dist/builtin/mcp/CHANGELOG.md +3 -0
- package/dist/builtin/mcp/config-write-utils.ts +104 -0
- package/dist/builtin/mcp/config.ts +4 -180
- package/dist/builtin/mcp/mcp-panel-renderer.ts +243 -0
- package/dist/builtin/mcp/mcp-panel-state.ts +227 -0
- package/dist/builtin/mcp/mcp-panel-types.ts +86 -0
- package/dist/builtin/mcp/mcp-panel.ts +145 -579
- package/dist/builtin/mcp/mcp-setup-panel.ts +4 -81
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/mcp/proxy-auth.ts +61 -0
- package/dist/builtin/mcp/proxy-call.ts +373 -0
- package/dist/builtin/mcp/proxy-connect.ts +58 -0
- package/dist/builtin/mcp/proxy-info-modes.ts +326 -0
- package/dist/builtin/mcp/proxy-modes.ts +3 -805
- package/dist/builtin/mcp/proxy-types.ts +3 -0
- package/dist/builtin/mcp/ui-server-http.ts +81 -0
- package/dist/builtin/mcp/ui-server.ts +2 -127
- package/dist/builtin/subagents/CHANGELOG.md +3 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/agents/agent-discovery.ts +127 -0
- package/dist/builtin/subagents/src/agents/agent-loaders.ts +175 -0
- package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +310 -0
- package/dist/builtin/subagents/src/agents/agent-management.ts +3 -309
- package/dist/builtin/subagents/src/agents/agent-overrides.ts +397 -0
- package/dist/builtin/subagents/src/agents/agent-paths.ts +88 -0
- package/dist/builtin/subagents/src/agents/agent-types.ts +136 -0
- package/dist/builtin/subagents/src/agents/agents.ts +22 -895
- package/dist/builtin/subagents/src/agents/skills-paths.ts +333 -0
- package/dist/builtin/subagents/src/agents/skills.ts +3 -326
- package/dist/builtin/subagents/src/extension/index.ts +4 -118
- package/dist/builtin/subagents/src/extension/prompt-guidance.ts +13 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-chain.ts +401 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-common.ts +131 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +213 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +84 -0
- package/dist/builtin/subagents/src/runs/background/async-execution.ts +13 -795
- package/dist/builtin/subagents/src/runs/background/subagent-runner-dynamic.ts +215 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-finalize.ts +136 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-output.ts +105 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-parallel-helpers.ts +112 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-parallel.ts +159 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-sequential.ts +127 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-state.ts +427 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-step.ts +273 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-streaming.ts +269 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-types.ts +196 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-utils.ts +70 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +44 -2233
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-behavior.ts +75 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-component.ts +202 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-edit.ts +97 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-editor.ts +160 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-frame.ts +72 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-render-modes.ts +161 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-render-selectors.ts +203 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-selectors.ts +234 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-state.ts +103 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-types.ts +29 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +4 -1328
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-clarify.ts +117 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-details.ts +35 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-dynamic-step.ts +194 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +183 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +185 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-sequential-step.ts +229 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-types.ts +194 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +94 -1043
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-control.ts +135 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-finalize.ts +107 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-types.ts +17 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +454 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-run-sync.ts +219 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-structured-retries.ts +77 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-updates.ts +34 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-utils.ts +56 -0
- package/dist/builtin/subagents/src/runs/foreground/execution.ts +6 -1082
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +207 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-chain.ts +140 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +266 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-input.ts +270 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +157 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +375 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-resume.ts +463 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-runtime.ts +17 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +320 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +207 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +121 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-worktree.ts +113 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +150 -2522
- package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +0 -16
- package/dist/builtin/subagents/src/runs/shared/nested-events-control.ts +167 -0
- package/dist/builtin/subagents/src/runs/shared/nested-events-core.ts +219 -0
- package/dist/builtin/subagents/src/runs/shared/nested-events-projection.ts +121 -0
- package/dist/builtin/subagents/src/runs/shared/nested-events-registry.ts +289 -0
- package/dist/builtin/subagents/src/runs/shared/nested-events-sanitize.ts +201 -0
- package/dist/builtin/subagents/src/runs/shared/nested-events.ts +50 -935
- package/dist/builtin/subagents/src/runs/shared/worktree.ts +0 -78
- package/dist/builtin/subagents/src/shared/types-async.ts +265 -0
- package/dist/builtin/subagents/src/shared/types-config.ts +125 -0
- package/dist/builtin/subagents/src/shared/types-depth.ts +121 -0
- package/dist/builtin/subagents/src/shared/types-output.ts +63 -0
- package/dist/builtin/subagents/src/shared/types-results.ts +318 -0
- package/dist/builtin/subagents/src/shared/types-runtime.ts +136 -0
- package/dist/builtin/subagents/src/shared/types.ts +10 -975
- package/dist/builtin/subagents/src/slash/slash-commands.ts +0 -12
- package/dist/builtin/subagents/src/tui/render-chain-graph.ts +247 -0
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +259 -0
- package/dist/builtin/subagents/src/tui/render-layout.ts +120 -0
- package/dist/builtin/subagents/src/tui/render-result-animation.ts +56 -0
- package/dist/builtin/subagents/src/tui/render-result-compact.ts +154 -0
- package/dist/builtin/subagents/src/tui/render-result.ts +390 -0
- package/dist/builtin/subagents/src/tui/render-stable-output.ts +83 -0
- package/dist/builtin/subagents/src/tui/render-status-progress.ts +133 -0
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +166 -0
- package/dist/builtin/subagents/src/tui/render-widget.ts +273 -0
- package/dist/builtin/subagents/src/tui/render.ts +14 -1801
- package/dist/builtin/web-access/CHANGELOG.md +3 -0
- package/dist/builtin/web-access/content-tools.ts +348 -0
- package/dist/builtin/web-access/curator-page-assets/script-1.ts +400 -0
- package/dist/builtin/web-access/curator-page-assets/script-2.ts +400 -0
- package/dist/builtin/web-access/curator-page-assets/script-3.ts +400 -0
- package/dist/builtin/web-access/curator-page-assets/script-4.ts +400 -0
- package/dist/builtin/web-access/curator-page-assets/script-5.ts +398 -0
- package/dist/builtin/web-access/curator-page-assets/styles-1.ts +394 -0
- package/dist/builtin/web-access/curator-page-assets/styles-2.ts +394 -0
- package/dist/builtin/web-access/curator-page-assets/styles-3.ts +393 -0
- package/dist/builtin/web-access/curator-page.ts +17 -3180
- package/dist/builtin/web-access/curator-server-helpers.ts +115 -0
- package/dist/builtin/web-access/curator-server.ts +2 -113
- package/dist/builtin/web-access/exa-mcp.ts +218 -0
- package/dist/builtin/web-access/exa.ts +2 -207
- package/dist/builtin/web-access/extract-frames.ts +228 -0
- package/dist/builtin/web-access/extract.ts +13 -214
- package/dist/builtin/web-access/github-config.ts +156 -0
- package/dist/builtin/web-access/github-extract.ts +3 -154
- package/dist/builtin/web-access/index-heavy.ts +8 -1904
- package/dist/builtin/web-access/package.json +2 -1
- package/dist/builtin/web-access/web-search-activity.ts +102 -0
- package/dist/builtin/web-access/web-search-browser.ts +116 -0
- package/dist/builtin/web-access/web-search-command.ts +242 -0
- package/dist/builtin/web-access/web-search-config.ts +163 -0
- package/dist/builtin/web-access/web-search-curator.ts +214 -0
- package/dist/builtin/web-access/web-search-features.ts +165 -0
- package/dist/builtin/web-access/web-search-formatting.ts +117 -0
- package/dist/builtin/web-access/web-search-return.ts +136 -0
- package/dist/builtin/web-access/web-search-summary.ts +170 -0
- package/dist/builtin/web-access/web-search-tool.ts +290 -0
- package/dist/builtin/web-access/web-search-types.ts +50 -0
- package/dist/builtin/workflows/CHANGELOG.md +4 -1
- package/dist/builtin/workflows/builtin/deep-research-codebase-runner.ts +492 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase-utils.ts +346 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +6 -822
- package/dist/builtin/workflows/builtin/goal-artifacts.ts +43 -0
- package/dist/builtin/workflows/builtin/goal-ledger.ts +54 -0
- package/dist/builtin/workflows/builtin/goal-prompts.ts +360 -0
- package/dist/builtin/workflows/builtin/goal-reducer.ts +141 -0
- package/dist/builtin/workflows/builtin/goal-reports.ts +56 -0
- package/dist/builtin/workflows/builtin/goal-review.ts +84 -0
- package/dist/builtin/workflows/builtin/goal-runner.ts +343 -0
- package/dist/builtin/workflows/builtin/goal-schemas.ts +60 -0
- package/dist/builtin/workflows/builtin/goal-types.ts +132 -0
- package/dist/builtin/workflows/builtin/goal.ts +4 -1160
- package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +432 -0
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +477 -0
- package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +312 -0
- package/dist/builtin/workflows/builtin/open-claude-design.ts +7 -1083
- package/dist/builtin/workflows/builtin/ralph-core.ts +408 -0
- package/dist/builtin/workflows/builtin/ralph-models.ts +123 -0
- package/dist/builtin/workflows/builtin/ralph-runner.ts +499 -0
- package/dist/builtin/workflows/builtin/ralph.ts +7 -979
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +8 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +13 -15
- package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +9 -0
- package/dist/builtin/workflows/src/extension/atomic-stage-session.ts +186 -0
- package/dist/builtin/workflows/src/extension/config-file-loader.ts +152 -0
- package/dist/builtin/workflows/src/extension/config-loader.ts +2 -167
- package/dist/builtin/workflows/src/extension/discovery-loaders.ts +115 -0
- package/dist/builtin/workflows/src/extension/discovery.ts +3 -117
- package/dist/builtin/workflows/src/extension/extension-factory.ts +120 -0
- package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +109 -0
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +270 -0
- package/dist/builtin/workflows/src/extension/index.ts +42 -4166
- package/dist/builtin/workflows/src/extension/public-types.ts +295 -0
- package/dist/builtin/workflows/src/extension/render-component.ts +14 -0
- package/dist/builtin/workflows/src/extension/runtime-direct.ts +96 -0
- package/dist/builtin/workflows/src/extension/runtime.ts +1 -92
- package/dist/builtin/workflows/src/extension/ui-surface.ts +286 -0
- package/dist/builtin/workflows/src/extension/wiring.ts +6 -475
- package/dist/builtin/workflows/src/extension/workflow-command-completions.ts +111 -0
- package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +213 -0
- package/dist/builtin/workflows/src/extension/workflow-command-surfaces.ts +81 -0
- package/dist/builtin/workflows/src/extension/workflow-command-utils.ts +181 -0
- package/dist/builtin/workflows/src/extension/workflow-policy.ts +15 -0
- package/dist/builtin/workflows/src/extension/workflow-ports.ts +41 -0
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +23 -0
- package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +286 -0
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +1 -1
- package/dist/builtin/workflows/src/extension/workflow-stage-results.ts +264 -0
- package/dist/builtin/workflows/src/extension/workflow-targets.ts +181 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-content.ts +175 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +205 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-helpers.ts +66 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-inspection.ts +164 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-registration.ts +54 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +164 -0
- package/dist/builtin/workflows/src/extension/workflow-tool.ts +102 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-abort.ts +431 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-child-boundary.ts +232 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-child-helpers.ts +74 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-child-workflow.ts +158 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-continuation.ts +167 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +450 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-direct.ts +233 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-exit-manager.ts +195 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-hil.ts +368 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-inputs.ts +83 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-lifecycle.ts +441 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-outputs.ts +160 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +274 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-run-finalizers.ts +122 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-run.ts +359 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-scheduler.ts +204 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +197 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-context.ts +120 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +126 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +351 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +134 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +54 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-task-context.ts +132 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-task-prompts.ts +293 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +109 -0
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +19 -5354
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +219 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +500 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-messages.ts +129 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-options.ts +53 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-output.ts +146 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-session.ts +55 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-structured-output.ts +82 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +141 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +13 -1355
- package/dist/builtin/workflows/src/runs/shared/model-fallback-candidates.ts +453 -0
- package/dist/builtin/workflows/src/runs/shared/model-fallback-failures.ts +442 -0
- package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +2 -836
- package/dist/builtin/workflows/src/runs/shared/worktree-diff.ts +165 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-git.ts +220 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-setup.ts +335 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-types.ts +92 -0
- package/dist/builtin/workflows/src/runs/shared/worktree.ts +18 -791
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +365 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +425 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +236 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +354 -0
- package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +5 -598
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +428 -0
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +9 -431
- package/dist/builtin/workflows/src/shared/store-factory.ts +16 -0
- package/dist/builtin/workflows/src/shared/store-internal.ts +219 -0
- package/dist/builtin/workflows/src/shared/store-prompt-methods.ts +219 -0
- package/dist/builtin/workflows/src/shared/store-public-types.ts +215 -0
- package/dist/builtin/workflows/src/shared/store-run-methods.ts +223 -0
- package/dist/builtin/workflows/src/shared/store-stage-methods.ts +305 -0
- package/dist/builtin/workflows/src/shared/store.ts +11 -1138
- package/dist/builtin/workflows/src/shared/workflow-failures-classifier.ts +266 -0
- package/dist/builtin/workflows/src/shared/workflow-failures-contract.ts +75 -0
- package/dist/builtin/workflows/src/shared/workflow-failures-decisions.ts +477 -0
- package/dist/builtin/workflows/src/shared/workflow-failures-signals.ts +248 -0
- package/dist/builtin/workflows/src/shared/workflow-failures.ts +13 -1001
- package/dist/builtin/workflows/src/tui/chat-surface.ts +0 -66
- package/dist/builtin/workflows/src/tui/graph-view-constants.ts +45 -0
- package/dist/builtin/workflows/src/tui/graph-view-graph-render.ts +161 -0
- package/dist/builtin/workflows/src/tui/graph-view-input.ts +333 -0
- package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +336 -0
- package/dist/builtin/workflows/src/tui/graph-view-render.ts +194 -0
- package/dist/builtin/workflows/src/tui/graph-view-state.ts +306 -0
- package/dist/builtin/workflows/src/tui/graph-view-types.ts +70 -0
- package/dist/builtin/workflows/src/tui/graph-view.ts +4 -1386
- package/dist/builtin/workflows/src/tui/inline-form-editor-text.ts +121 -0
- package/dist/builtin/workflows/src/tui/inline-form-editor.ts +11 -223
- package/dist/builtin/workflows/src/tui/inputs-picker-editing.ts +151 -0
- package/dist/builtin/workflows/src/tui/inputs-picker-input.ts +305 -0
- package/dist/builtin/workflows/src/tui/inputs-picker-render.ts +300 -0
- package/dist/builtin/workflows/src/tui/inputs-picker-types.ts +190 -0
- package/dist/builtin/workflows/src/tui/inputs-picker.ts +19 -997
- package/dist/builtin/workflows/src/tui/prompt-card-input.ts +226 -0
- package/dist/builtin/workflows/src/tui/prompt-card-render.ts +373 -0
- package/dist/builtin/workflows/src/tui/prompt-card-select.ts +116 -0
- package/dist/builtin/workflows/src/tui/prompt-card-state.ts +61 -0
- package/dist/builtin/workflows/src/tui/prompt-card-text.ts +129 -0
- package/dist/builtin/workflows/src/tui/prompt-card.ts +8 -910
- package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +315 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-custom-ui.ts +127 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +187 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +222 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-render-helpers.ts +152 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +464 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-transcript.ts +242 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +151 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +141 -1777
- package/dist/builtin/workflows/src/tui/workflow-attach-pane-types.ts +85 -0
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +1 -129
- package/dist/config-self-update.d.ts +21 -0
- package/dist/config-self-update.d.ts.map +1 -0
- package/dist/config-self-update.js +265 -0
- package/dist/config-self-update.js.map +1 -0
- package/dist/config.d.ts +3 -12
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -252
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-accessors.d.ts +3 -0
- package/dist/core/agent-session-accessors.d.ts.map +1 -0
- package/dist/core/agent-session-accessors.js +36 -0
- package/dist/core/agent-session-accessors.js.map +1 -0
- package/dist/core/agent-session-auto-compaction.d.ts +32 -0
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -0
- package/dist/core/agent-session-auto-compaction.js +214 -0
- package/dist/core/agent-session-auto-compaction.js.map +1 -0
- package/dist/core/agent-session-bash.d.ts +30 -0
- package/dist/core/agent-session-bash.d.ts.map +1 -0
- package/dist/core/agent-session-bash.js +84 -0
- package/dist/core/agent-session-bash.js.map +1 -0
- package/dist/core/agent-session-compaction.d.ts +44 -0
- package/dist/core/agent-session-compaction.d.ts.map +1 -0
- package/dist/core/agent-session-compaction.js +282 -0
- package/dist/core/agent-session-compaction.js.map +1 -0
- package/dist/core/agent-session-events.d.ts +65 -0
- package/dist/core/agent-session-events.d.ts.map +1 -0
- package/dist/core/agent-session-events.js +373 -0
- package/dist/core/agent-session-events.js.map +1 -0
- package/dist/core/agent-session-export.d.ts +42 -0
- package/dist/core/agent-session-export.d.ts.map +1 -0
- package/dist/core/agent-session-export.js +199 -0
- package/dist/core/agent-session-export.js.map +1 -0
- package/dist/core/agent-session-extension-bindings.d.ts +37 -0
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -0
- package/dist/core/agent-session-extension-bindings.js +231 -0
- package/dist/core/agent-session-extension-bindings.js.map +1 -0
- package/dist/core/agent-session-message-queue.d.ts +85 -0
- package/dist/core/agent-session-message-queue.d.ts.map +1 -0
- package/dist/core/agent-session-message-queue.js +264 -0
- package/dist/core/agent-session-message-queue.js.map +1 -0
- package/dist/core/agent-session-methods.d.ts +302 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -0
- package/dist/core/agent-session-methods.js +2 -0
- package/dist/core/agent-session-methods.js.map +1 -0
- package/dist/core/agent-session-models.d.ts +111 -0
- package/dist/core/agent-session-models.d.ts.map +1 -0
- package/dist/core/agent-session-models.js +368 -0
- package/dist/core/agent-session-models.js.map +1 -0
- package/dist/core/agent-session-prompt.d.ts +61 -0
- package/dist/core/agent-session-prompt.d.ts.map +1 -0
- package/dist/core/agent-session-prompt.js +330 -0
- package/dist/core/agent-session-prompt.js.map +1 -0
- package/dist/core/agent-session-retry.d.ts +62 -0
- package/dist/core/agent-session-retry.d.ts.map +1 -0
- package/dist/core/agent-session-retry.js +202 -0
- package/dist/core/agent-session-retry.js.map +1 -0
- package/dist/core/agent-session-skill-block.d.ts +13 -0
- package/dist/core/agent-session-skill-block.d.ts.map +1 -0
- package/dist/core/agent-session-skill-block.js +37 -0
- package/dist/core/agent-session-skill-block.js.map +1 -0
- package/dist/core/agent-session-state.d.ts +48 -0
- package/dist/core/agent-session-state.d.ts.map +1 -0
- package/dist/core/agent-session-state.js +129 -0
- package/dist/core/agent-session-state.js.map +1 -0
- package/dist/core/agent-session-tool-hooks.d.ts +7 -0
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -0
- package/dist/core/agent-session-tool-hooks.js +72 -0
- package/dist/core/agent-session-tool-hooks.js.map +1 -0
- package/dist/core/agent-session-tool-registry.d.ts +15 -0
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -0
- package/dist/core/agent-session-tool-registry.js +151 -0
- package/dist/core/agent-session-tool-registry.js.map +1 -0
- package/dist/core/agent-session-tree.d.ts +46 -0
- package/dist/core/agent-session-tree.d.ts.map +1 -0
- package/dist/core/agent-session-tree.js +217 -0
- package/dist/core/agent-session-tree.js.map +1 -0
- package/dist/core/agent-session-types.d.ts +159 -0
- package/dist/core/agent-session-types.d.ts.map +1 -0
- package/dist/core/agent-session-types.js +41 -0
- package/dist/core/agent-session-types.js.map +1 -0
- package/dist/core/agent-session.d.ts +68 -688
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +26 -3152
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage-backends.d.ts +49 -0
- package/dist/core/auth-storage-backends.d.ts.map +1 -0
- package/dist/core/auth-storage-backends.js +185 -0
- package/dist/core/auth-storage-backends.js.map +1 -0
- package/dist/core/auth-storage.d.ts +2 -49
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -183
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/context-compaction-metrics.d.ts +16 -0
- package/dist/core/compaction/context-compaction-metrics.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-metrics.js +58 -0
- package/dist/core/compaction/context-compaction-metrics.js.map +1 -0
- package/dist/core/compaction/context-compaction-prompt.d.ts +9 -0
- package/dist/core/compaction/context-compaction-prompt.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-prompt.js +161 -0
- package/dist/core/compaction/context-compaction-prompt.js.map +1 -0
- package/dist/core/compaction/context-compaction-runner.d.ts +5 -0
- package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-runner.js +181 -0
- package/dist/core/compaction/context-compaction-runner.js.map +1 -0
- package/dist/core/compaction/context-compaction-strategy.d.ts +5 -0
- package/dist/core/compaction/context-compaction-strategy.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-strategy.js +27 -0
- package/dist/core/compaction/context-compaction-strategy.js.map +1 -0
- package/dist/core/compaction/context-compaction-types.d.ts +73 -0
- package/dist/core/compaction/context-compaction-types.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-types.js +6 -0
- package/dist/core/compaction/context-compaction-types.js.map +1 -0
- package/dist/core/compaction/context-compaction.d.ts +9 -200
- package/dist/core/compaction/context-compaction.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction.js +7 -1943
- package/dist/core/compaction/context-compaction.js.map +1 -1
- package/dist/core/compaction/context-deletion-application.d.ts +13 -0
- package/dist/core/compaction/context-deletion-application.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-application.js +259 -0
- package/dist/core/compaction/context-deletion-application.js.map +1 -0
- package/dist/core/compaction/context-deletion-store.d.ts +78 -0
- package/dist/core/compaction/context-deletion-store.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-store.js +162 -0
- package/dist/core/compaction/context-deletion-store.js.map +1 -0
- package/dist/core/compaction/context-deletion-targets.d.ts +40 -0
- package/dist/core/compaction/context-deletion-targets.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-targets.js +267 -0
- package/dist/core/compaction/context-deletion-targets.js.map +1 -0
- package/dist/core/compaction/context-deletion-tool-definitions.d.ts +187 -0
- package/dist/core/compaction/context-deletion-tool-definitions.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-tool-definitions.js +98 -0
- package/dist/core/compaction/context-deletion-tool-definitions.js.map +1 -0
- package/dist/core/compaction/context-deletion-tool-helpers.d.ts +19 -0
- package/dist/core/compaction/context-deletion-tool-helpers.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-tool-helpers.js +137 -0
- package/dist/core/compaction/context-deletion-tool-helpers.js.map +1 -0
- package/dist/core/compaction/context-deletion-tools.d.ts +4 -0
- package/dist/core/compaction/context-deletion-tools.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-tools.js +395 -0
- package/dist/core/compaction/context-deletion-tools.js.map +1 -0
- package/dist/core/compaction/context-transcript-analysis.d.ts +9 -0
- package/dist/core/compaction/context-transcript-analysis.d.ts.map +1 -0
- package/dist/core/compaction/context-transcript-analysis.js +234 -0
- package/dist/core/compaction/context-transcript-analysis.js.map +1 -0
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +2 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template-js/data-tree.js +287 -0
- package/dist/core/export-html/template-js/entries-navigation.js +424 -0
- package/dist/core/export-html/template-js/initialization.js +312 -0
- package/dist/core/export-html/template-js/message-tools.js +415 -0
- package/dist/core/export-html/template-js/tree-filter-render.js +421 -0
- package/dist/core/export-html/template-script.d.ts +3 -0
- package/dist/core/export-html/template-script.d.ts.map +1 -0
- package/dist/core/export-html/template-script.js +13 -0
- package/dist/core/export-html/template-script.js.map +1 -0
- package/dist/core/export-html/template.js +3 -1
- package/dist/core/extensions/agent-events.d.ts +159 -0
- package/dist/core/extensions/agent-events.d.ts.map +1 -0
- package/dist/core/extensions/agent-events.js +2 -0
- package/dist/core/extensions/agent-events.js.map +1 -0
- package/dist/core/extensions/api-types.d.ts +189 -0
- package/dist/core/extensions/api-types.d.ts.map +1 -0
- package/dist/core/extensions/api-types.js +2 -0
- package/dist/core/extensions/api-types.js.map +1 -0
- package/dist/core/extensions/command-types.d.ts +14 -0
- package/dist/core/extensions/command-types.d.ts.map +1 -0
- package/dist/core/extensions/command-types.js +2 -0
- package/dist/core/extensions/command-types.js.map +1 -0
- package/dist/core/extensions/context-types.d.ts +130 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -0
- package/dist/core/extensions/context-types.js +2 -0
- package/dist/core/extensions/context-types.js.map +1 -0
- package/dist/core/extensions/event-results.d.ts +61 -0
- package/dist/core/extensions/event-results.d.ts.map +1 -0
- package/dist/core/extensions/event-results.js +2 -0
- package/dist/core/extensions/event-results.js.map +1 -0
- package/dist/core/extensions/event-types.d.ts +6 -0
- package/dist/core/extensions/event-types.d.ts.map +1 -0
- package/dist/core/extensions/event-types.js +2 -0
- package/dist/core/extensions/event-types.js.map +1 -0
- package/dist/core/extensions/loader-api.d.ts +10 -0
- package/dist/core/extensions/loader-api.d.ts.map +1 -0
- package/dist/core/extensions/loader-api.js +143 -0
- package/dist/core/extensions/loader-api.js.map +1 -0
- package/dist/core/extensions/loader-core.d.ts +12 -0
- package/dist/core/extensions/loader-core.d.ts.map +1 -0
- package/dist/core/extensions/loader-core.js +91 -0
- package/dist/core/extensions/loader-core.js.map +1 -0
- package/dist/core/extensions/loader-discovery.d.ts +7 -0
- package/dist/core/extensions/loader-discovery.d.ts.map +1 -0
- package/dist/core/extensions/loader-discovery.js +139 -0
- package/dist/core/extensions/loader-discovery.js.map +1 -0
- package/dist/core/extensions/loader-resources.d.ts +11 -0
- package/dist/core/extensions/loader-resources.d.ts.map +1 -0
- package/dist/core/extensions/loader-resources.js +10 -0
- package/dist/core/extensions/loader-resources.js.map +1 -0
- package/dist/core/extensions/loader-runtime.d.ts +7 -0
- package/dist/core/extensions/loader-runtime.d.ts.map +1 -0
- package/dist/core/extensions/loader-runtime.js +51 -0
- package/dist/core/extensions/loader-runtime.js.map +1 -0
- package/dist/core/extensions/loader-virtual-modules.d.ts +3 -0
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/loader-virtual-modules.js +92 -0
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +4 -28
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +3 -542
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/message-types.d.ts +34 -0
- package/dist/core/extensions/message-types.d.ts.map +1 -0
- package/dist/core/extensions/message-types.js +2 -0
- package/dist/core/extensions/message-types.js.map +1 -0
- package/dist/core/extensions/provider-types.d.ts +71 -0
- package/dist/core/extensions/provider-types.d.ts.map +1 -0
- package/dist/core/extensions/provider-types.js +2 -0
- package/dist/core/extensions/provider-types.js.map +1 -0
- package/dist/core/extensions/runner-context.d.ts +42 -0
- package/dist/core/extensions/runner-context.d.ts.map +1 -0
- package/dist/core/extensions/runner-context.js +112 -0
- package/dist/core/extensions/runner-context.js.map +1 -0
- package/dist/core/extensions/runner-events.d.ts +47 -0
- package/dist/core/extensions/runner-events.d.ts.map +1 -0
- package/dist/core/extensions/runner-events.js +280 -0
- package/dist/core/extensions/runner-events.js.map +1 -0
- package/dist/core/extensions/runner-handlers.d.ts +32 -0
- package/dist/core/extensions/runner-handlers.d.ts.map +1 -0
- package/dist/core/extensions/runner-handlers.js +2 -0
- package/dist/core/extensions/runner-handlers.js.map +1 -0
- package/dist/core/extensions/runner-project-trust.d.ts +6 -0
- package/dist/core/extensions/runner-project-trust.d.ts.map +1 -0
- package/dist/core/extensions/runner-project-trust.js +27 -0
- package/dist/core/extensions/runner-project-trust.js.map +1 -0
- package/dist/core/extensions/runner-registries.d.ts +8 -0
- package/dist/core/extensions/runner-registries.d.ts.map +1 -0
- package/dist/core/extensions/runner-registries.js +76 -0
- package/dist/core/extensions/runner-registries.js.map +1 -0
- package/dist/core/extensions/runner-shortcuts.d.ts +10 -0
- package/dist/core/extensions/runner-shortcuts.d.ts.map +1 -0
- package/dist/core/extensions/runner-shortcuts.js +71 -0
- package/dist/core/extensions/runner-shortcuts.js.map +1 -0
- package/dist/core/extensions/runner-ui.d.ts +3 -0
- package/dist/core/extensions/runner-ui.d.ts.map +1 -0
- package/dist/core/extensions/runner-ui.js +50 -0
- package/dist/core/extensions/runner-ui.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +7 -74
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +67 -673
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +179 -0
- package/dist/core/extensions/runtime-types.d.ts.map +1 -0
- package/dist/core/extensions/runtime-types.js +2 -0
- package/dist/core/extensions/runtime-types.js.map +1 -0
- package/dist/core/extensions/session-events.d.ts +89 -0
- package/dist/core/extensions/session-events.d.ts.map +1 -0
- package/dist/core/extensions/session-events.js +2 -0
- package/dist/core/extensions/session-events.js.map +1 -0
- package/dist/core/extensions/tool-events.d.ts +127 -0
- package/dist/core/extensions/tool-events.d.ts.map +1 -0
- package/dist/core/extensions/tool-events.js +26 -0
- package/dist/core/extensions/tool-events.js.map +1 -0
- package/dist/core/extensions/tool-types.d.ts +100 -0
- package/dist/core/extensions/tool-types.d.ts.map +1 -0
- package/dist/core/extensions/tool-types.js +11 -0
- package/dist/core/extensions/tool-types.js.map +1 -0
- package/dist/core/extensions/types.d.ts +20 -1288
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +4 -34
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +200 -0
- package/dist/core/extensions/ui-types.d.ts.map +1 -0
- package/dist/core/extensions/ui-types.js +2 -0
- package/dist/core/extensions/ui-types.js.map +1 -0
- package/dist/core/model-registry-auth.d.ts +7 -0
- package/dist/core/model-registry-auth.d.ts.map +1 -0
- package/dist/core/model-registry-auth.js +64 -0
- package/dist/core/model-registry-auth.js.map +1 -0
- package/dist/core/model-registry-builtins.d.ts +9 -0
- package/dist/core/model-registry-builtins.d.ts.map +1 -0
- package/dist/core/model-registry-builtins.js +120 -0
- package/dist/core/model-registry-builtins.js.map +1 -0
- package/dist/core/model-registry-custom-loader.d.ts +3 -0
- package/dist/core/model-registry-custom-loader.d.ts.map +1 -0
- package/dist/core/model-registry-custom-loader.js +213 -0
- package/dist/core/model-registry-custom-loader.js.map +1 -0
- package/dist/core/model-registry-dynamic.d.ts +6 -0
- package/dist/core/model-registry-dynamic.d.ts.map +1 -0
- package/dist/core/model-registry-dynamic.js +155 -0
- package/dist/core/model-registry-dynamic.js.map +1 -0
- package/dist/core/model-registry-loader.d.ts +4 -0
- package/dist/core/model-registry-loader.d.ts.map +1 -0
- package/dist/core/model-registry-loader.js +20 -0
- package/dist/core/model-registry-loader.js.map +1 -0
- package/dist/core/model-registry-schemas.d.ts +1084 -0
- package/dist/core/model-registry-schemas.d.ts.map +1 -0
- package/dist/core/model-registry-schemas.js +161 -0
- package/dist/core/model-registry-schemas.js.map +1 -0
- package/dist/core/model-registry-types.d.ts +74 -0
- package/dist/core/model-registry-types.d.ts.map +1 -0
- package/dist/core/model-registry-types.js +2 -0
- package/dist/core/model-registry-types.js.map +1 -0
- package/dist/core/model-registry.d.ts +3 -76
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +24 -733
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver-cli.d.ts +19 -0
- package/dist/core/model-resolver-cli.d.ts.map +1 -0
- package/dist/core/model-resolver-cli.js +118 -0
- package/dist/core/model-resolver-cli.js.map +1 -0
- package/dist/core/model-resolver-defaults.d.ts +5 -0
- package/dist/core/model-resolver-defaults.d.ts.map +1 -0
- package/dist/core/model-resolver-defaults.js +47 -0
- package/dist/core/model-resolver-defaults.js.map +1 -0
- package/dist/core/model-resolver-initial.d.ts +31 -0
- package/dist/core/model-resolver-initial.d.ts.map +1 -0
- package/dist/core/model-resolver-initial.js +116 -0
- package/dist/core/model-resolver-initial.js.map +1 -0
- package/dist/core/model-resolver-patterns.d.ts +26 -0
- package/dist/core/model-resolver-patterns.d.ts.map +1 -0
- package/dist/core/model-resolver-patterns.js +139 -0
- package/dist/core/model-resolver-patterns.js.map +1 -0
- package/dist/core/model-resolver-scope.d.ts +15 -0
- package/dist/core/model-resolver-scope.d.ts.map +1 -0
- package/dist/core/model-resolver-scope.js +66 -0
- package/dist/core/model-resolver-scope.js.map +1 -0
- package/dist/core/model-resolver-types.d.ts +29 -0
- package/dist/core/model-resolver-types.d.ts.map +1 -0
- package/dist/core/model-resolver-types.js +2 -0
- package/dist/core/model-resolver-types.js.map +1 -0
- package/dist/core/model-resolver.d.ts +6 -107
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +5 -549
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-manager-auto-resources.d.ts +5 -0
- package/dist/core/package-manager-auto-resources.d.ts.map +1 -0
- package/dist/core/package-manager-auto-resources.js +109 -0
- package/dist/core/package-manager-auto-resources.js.map +1 -0
- package/dist/core/package-manager-command.d.ts +11 -0
- package/dist/core/package-manager-command.d.ts.map +1 -0
- package/dist/core/package-manager-command.js +102 -0
- package/dist/core/package-manager-command.js.map +1 -0
- package/dist/core/package-manager-constants.d.ts +4 -0
- package/dist/core/package-manager-constants.d.ts.map +1 -0
- package/dist/core/package-manager-constants.js +4 -0
- package/dist/core/package-manager-constants.js.map +1 -0
- package/dist/core/package-manager-env.d.ts +4 -0
- package/dist/core/package-manager-env.d.ts.map +1 -0
- package/dist/core/package-manager-env.js +40 -0
- package/dist/core/package-manager-env.js.map +1 -0
- package/dist/core/package-manager-git.d.ts +10 -0
- package/dist/core/package-manager-git.d.ts.map +1 -0
- package/dist/core/package-manager-git.js +271 -0
- package/dist/core/package-manager-git.js.map +1 -0
- package/dist/core/package-manager-manifest.d.ts +7 -0
- package/dist/core/package-manager-manifest.d.ts.map +1 -0
- package/dist/core/package-manager-manifest.js +45 -0
- package/dist/core/package-manager-manifest.js.map +1 -0
- package/dist/core/package-manager-npm.d.ts +25 -0
- package/dist/core/package-manager-npm.d.ts.map +1 -0
- package/dist/core/package-manager-npm.js +252 -0
- package/dist/core/package-manager-npm.js.map +1 -0
- package/dist/core/package-manager-operations.d.ts +11 -0
- package/dist/core/package-manager-operations.d.ts.map +1 -0
- package/dist/core/package-manager-operations.js +196 -0
- package/dist/core/package-manager-operations.js.map +1 -0
- package/dist/core/package-manager-paths.d.ts +14 -0
- package/dist/core/package-manager-paths.d.ts.map +1 -0
- package/dist/core/package-manager-paths.js +61 -0
- package/dist/core/package-manager-paths.js.map +1 -0
- package/dist/core/package-manager-progress.d.ts +4 -0
- package/dist/core/package-manager-progress.d.ts.map +1 -0
- package/dist/core/package-manager-progress.js +16 -0
- package/dist/core/package-manager-progress.js.map +1 -0
- package/dist/core/package-manager-resolver.d.ts +5 -0
- package/dist/core/package-manager-resolver.d.ts.map +1 -0
- package/dist/core/package-manager-resolver.js +149 -0
- package/dist/core/package-manager-resolver.js.map +1 -0
- package/dist/core/package-manager-resource-accumulator.d.ts +6 -0
- package/dist/core/package-manager-resource-accumulator.d.ts.map +1 -0
- package/dist/core/package-manager-resource-accumulator.js +67 -0
- package/dist/core/package-manager-resource-accumulator.js.map +1 -0
- package/dist/core/package-manager-resource-collector.d.ts +5 -0
- package/dist/core/package-manager-resource-collector.d.ts.map +1 -0
- package/dist/core/package-manager-resource-collector.js +148 -0
- package/dist/core/package-manager-resource-collector.js.map +1 -0
- package/dist/core/package-manager-resource-files.d.ts +14 -0
- package/dist/core/package-manager-resource-files.d.ts.map +1 -0
- package/dist/core/package-manager-resource-files.js +265 -0
- package/dist/core/package-manager-resource-files.js.map +1 -0
- package/dist/core/package-manager-resource-patterns.d.ts +12 -0
- package/dist/core/package-manager-resource-patterns.d.ts.map +1 -0
- package/dist/core/package-manager-resource-patterns.js +136 -0
- package/dist/core/package-manager-resource-patterns.js.map +1 -0
- package/dist/core/package-manager-settings.d.ts +10 -0
- package/dist/core/package-manager-settings.d.ts.map +1 -0
- package/dist/core/package-manager-settings.js +91 -0
- package/dist/core/package-manager-settings.js.map +1 -0
- package/dist/core/package-manager-source.d.ts +21 -0
- package/dist/core/package-manager-source.d.ts.map +1 -0
- package/dist/core/package-manager-source.js +146 -0
- package/dist/core/package-manager-source.js.map +1 -0
- package/dist/core/package-manager-types.d.ts +169 -0
- package/dist/core/package-manager-types.d.ts.map +1 -0
- package/dist/core/package-manager-types.js +9 -0
- package/dist/core/package-manager-types.js.map +1 -0
- package/dist/core/package-manager.d.ts +9 -174
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +56 -2100
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/resource-loader-assets.d.ts +6 -0
- package/dist/core/resource-loader-assets.d.ts.map +1 -0
- package/dist/core/resource-loader-assets.js +209 -0
- package/dist/core/resource-loader-assets.js.map +1 -0
- package/dist/core/resource-loader-context-files.d.ts +10 -0
- package/dist/core/resource-loader-context-files.d.ts.map +1 -0
- package/dist/core/resource-loader-context-files.js +74 -0
- package/dist/core/resource-loader-context-files.js.map +1 -0
- package/dist/core/resource-loader-core.d.ts +82 -0
- package/dist/core/resource-loader-core.d.ts.map +1 -0
- package/dist/core/resource-loader-core.js +168 -0
- package/dist/core/resource-loader-core.js.map +1 -0
- package/dist/core/resource-loader-discovery.d.ts +4 -0
- package/dist/core/resource-loader-discovery.d.ts.map +1 -0
- package/dist/core/resource-loader-discovery.js +28 -0
- package/dist/core/resource-loader-discovery.js.map +1 -0
- package/dist/core/resource-loader-extensions.d.ts +13 -0
- package/dist/core/resource-loader-extensions.d.ts.map +1 -0
- package/dist/core/resource-loader-extensions.js +110 -0
- package/dist/core/resource-loader-extensions.js.map +1 -0
- package/dist/core/resource-loader-helpers.d.ts +4 -0
- package/dist/core/resource-loader-helpers.d.ts.map +1 -0
- package/dist/core/resource-loader-helpers.js +23 -0
- package/dist/core/resource-loader-helpers.js.map +1 -0
- package/dist/core/resource-loader-internals.d.ts +96 -0
- package/dist/core/resource-loader-internals.d.ts.map +1 -0
- package/dist/core/resource-loader-internals.js +4 -0
- package/dist/core/resource-loader-internals.js.map +1 -0
- package/dist/core/resource-loader-package-resources.d.ts +31 -0
- package/dist/core/resource-loader-package-resources.d.ts.map +1 -0
- package/dist/core/resource-loader-package-resources.js +112 -0
- package/dist/core/resource-loader-package-resources.js.map +1 -0
- package/dist/core/resource-loader-paths.d.ts +4 -0
- package/dist/core/resource-loader-paths.d.ts.map +1 -0
- package/dist/core/resource-loader-paths.js +22 -0
- package/dist/core/resource-loader-paths.js.map +1 -0
- package/dist/core/resource-loader-reload.d.ts +6 -0
- package/dist/core/resource-loader-reload.d.ts.map +1 -0
- package/dist/core/resource-loader-reload.js +226 -0
- package/dist/core/resource-loader-reload.js.map +1 -0
- package/dist/core/resource-loader-source-info.d.ts +9 -0
- package/dist/core/resource-loader-source-info.d.ts.map +1 -0
- package/dist/core/resource-loader-source-info.js +101 -0
- package/dist/core/resource-loader-source-info.js.map +1 -0
- package/dist/core/resource-loader-types.d.ts +130 -0
- package/dist/core/resource-loader-types.d.ts.map +1 -0
- package/dist/core/resource-loader-types.js +2 -0
- package/dist/core/resource-loader-types.js.map +1 -0
- package/dist/core/resource-loader.d.ts +3 -242
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +2 -976
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk-exports.d.ts +7 -0
- package/dist/core/sdk-exports.d.ts.map +1 -0
- package/dist/core/sdk-exports.js +5 -0
- package/dist/core/sdk-exports.js.map +1 -0
- package/dist/core/sdk-types.d.ts +86 -0
- package/dist/core/sdk-types.d.ts.map +1 -0
- package/dist/core/sdk-types.js +2 -0
- package/dist/core/sdk-types.js.map +1 -0
- package/dist/core/sdk.d.ts +3 -91
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +2 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-archive.d.ts +27 -0
- package/dist/core/session-manager-archive.d.ts.map +1 -0
- package/dist/core/session-manager-archive.js +114 -0
- package/dist/core/session-manager-archive.js.map +1 -0
- package/dist/core/session-manager-core.d.ts +104 -0
- package/dist/core/session-manager-core.d.ts.map +1 -0
- package/dist/core/session-manager-core.js +346 -0
- package/dist/core/session-manager-core.js.map +1 -0
- package/dist/core/session-manager-entries.d.ts +38 -0
- package/dist/core/session-manager-entries.d.ts.map +1 -0
- package/dist/core/session-manager-entries.js +124 -0
- package/dist/core/session-manager-entries.js.map +1 -0
- package/dist/core/session-manager-history.d.ts +38 -0
- package/dist/core/session-manager-history.d.ts.map +1 -0
- package/dist/core/session-manager-history.js +378 -0
- package/dist/core/session-manager-history.js.map +1 -0
- package/dist/core/session-manager-list.d.ts +5 -0
- package/dist/core/session-manager-list.d.ts.map +1 -0
- package/dist/core/session-manager-list.js +196 -0
- package/dist/core/session-manager-list.js.map +1 -0
- package/dist/core/session-manager-migrations.d.ts +11 -0
- package/dist/core/session-manager-migrations.d.ts.map +1 -0
- package/dist/core/session-manager-migrations.js +80 -0
- package/dist/core/session-manager-migrations.js.map +1 -0
- package/dist/core/session-manager-paths.d.ts +7 -0
- package/dist/core/session-manager-paths.d.ts.map +1 -0
- package/dist/core/session-manager-paths.js +22 -0
- package/dist/core/session-manager-paths.js.map +1 -0
- package/dist/core/session-manager-storage.d.ts +15 -0
- package/dist/core/session-manager-storage.d.ts.map +1 -0
- package/dist/core/session-manager-storage.js +127 -0
- package/dist/core/session-manager-storage.js.map +1 -0
- package/dist/core/session-manager-types.d.ts +172 -0
- package/dist/core/session-manager-types.d.ts.map +1 -0
- package/dist/core/session-manager-types.js +2 -0
- package/dist/core/session-manager-types.js.map +1 -0
- package/dist/core/session-manager-validation.d.ts +7 -0
- package/dist/core/session-manager-validation.d.ts.map +1 -0
- package/dist/core/session-manager-validation.js +34 -0
- package/dist/core/session-manager-validation.js.map +1 -0
- package/dist/core/session-manager.d.ts +8 -390
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +7 -1418
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +65 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -0
- package/dist/core/settings-manager-basic-accessors.js +253 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -0
- package/dist/core/settings-manager-core.d.ts +57 -0
- package/dist/core/settings-manager-core.d.ts.map +1 -0
- package/dist/core/settings-manager-core.js +387 -0
- package/dist/core/settings-manager-core.js.map +1 -0
- package/dist/core/settings-manager-internals.d.ts +13 -0
- package/dist/core/settings-manager-internals.d.ts.map +1 -0
- package/dist/core/settings-manager-internals.js +4 -0
- package/dist/core/settings-manager-internals.js.map +1 -0
- package/dist/core/settings-manager-resource-accessors.d.ts +43 -0
- package/dist/core/settings-manager-resource-accessors.d.ts.map +1 -0
- package/dist/core/settings-manager-resource-accessors.js +172 -0
- package/dist/core/settings-manager-resource-accessors.js.map +1 -0
- package/dist/core/settings-manager-ui-accessors.d.ts +44 -0
- package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -0
- package/dist/core/settings-manager-ui-accessors.js +208 -0
- package/dist/core/settings-manager-ui-accessors.js.map +1 -0
- package/dist/core/settings-manager.d.ts +6 -321
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +5 -1060
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-merge.d.ts +4 -0
- package/dist/core/settings-merge.d.ts.map +1 -0
- package/dist/core/settings-merge.js +26 -0
- package/dist/core/settings-merge.js.map +1 -0
- package/dist/core/settings-storage.d.ts +20 -0
- package/dist/core/settings-storage.d.ts.map +1 -0
- package/dist/core/settings-storage.js +100 -0
- package/dist/core/settings-storage.js.map +1 -0
- package/dist/core/settings-types.d.ts +123 -0
- package/dist/core/settings-types.d.ts.map +1 -0
- package/dist/core/settings-types.js +2 -0
- package/dist/core/settings-types.js.map +1 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +7 -0
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash-policy-compile.d.ts +5 -0
- package/dist/core/tools/bash-policy-compile.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-compile.js +241 -0
- package/dist/core/tools/bash-policy-compile.js.map +1 -0
- package/dist/core/tools/bash-policy-evaluate.d.ts +3 -0
- package/dist/core/tools/bash-policy-evaluate.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-evaluate.js +92 -0
- package/dist/core/tools/bash-policy-evaluate.js.map +1 -0
- package/dist/core/tools/bash-policy-format.d.ts +5 -0
- package/dist/core/tools/bash-policy-format.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-format.js +49 -0
- package/dist/core/tools/bash-policy-format.js.map +1 -0
- package/dist/core/tools/bash-policy-parser.d.ts +4 -0
- package/dist/core/tools/bash-policy-parser.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-parser.js +155 -0
- package/dist/core/tools/bash-policy-parser.js.map +1 -0
- package/dist/core/tools/bash-policy-segment.d.ts +3 -0
- package/dist/core/tools/bash-policy-segment.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-segment.js +275 -0
- package/dist/core/tools/bash-policy-segment.js.map +1 -0
- package/dist/core/tools/bash-policy-shell.d.ts +11 -0
- package/dist/core/tools/bash-policy-shell.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-shell.js +267 -0
- package/dist/core/tools/bash-policy-shell.js.map +1 -0
- package/dist/core/tools/bash-policy-types.d.ts +146 -0
- package/dist/core/tools/bash-policy-types.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-types.js +2 -0
- package/dist/core/tools/bash-policy-types.js.map +1 -0
- package/dist/core/tools/bash-policy.d.ts +5 -61
- package/dist/core/tools/bash-policy.d.ts.map +1 -1
- package/dist/core/tools/bash-policy.js +4 -1068
- package/dist/core/tools/bash-policy.js.map +1 -1
- package/dist/core/tools/todos-execute.d.ts +5 -0
- package/dist/core/tools/todos-execute.d.ts.map +1 -0
- package/dist/core/tools/todos-execute.js +200 -0
- package/dist/core/tools/todos-execute.js.map +1 -0
- package/dist/core/tools/todos-locks.d.ts +4 -0
- package/dist/core/tools/todos-locks.d.ts.map +1 -0
- package/dist/core/tools/todos-locks.js +80 -0
- package/dist/core/tools/todos-locks.js.map +1 -0
- package/dist/core/tools/todos-model.d.ts +21 -0
- package/dist/core/tools/todos-model.d.ts.map +1 -0
- package/dist/core/tools/todos-model.js +71 -0
- package/dist/core/tools/todos-model.js.map +1 -0
- package/dist/core/tools/todos-mutations.d.ts +6 -0
- package/dist/core/tools/todos-mutations.d.ts.map +1 -0
- package/dist/core/tools/todos-mutations.js +85 -0
- package/dist/core/tools/todos-mutations.js.map +1 -0
- package/dist/core/tools/todos-paths.d.ts +5 -0
- package/dist/core/tools/todos-paths.d.ts.map +1 -0
- package/dist/core/tools/todos-paths.js +25 -0
- package/dist/core/tools/todos-paths.js.map +1 -0
- package/dist/core/tools/todos-render.d.ts +10 -0
- package/dist/core/tools/todos-render.d.ts.map +1 -0
- package/dist/core/tools/todos-render.js +159 -0
- package/dist/core/tools/todos-render.js.map +1 -0
- package/dist/core/tools/todos-storage.d.ts +9 -0
- package/dist/core/tools/todos-storage.d.ts.map +1 -0
- package/dist/core/tools/todos-storage.js +183 -0
- package/dist/core/tools/todos-storage.js.map +1 -0
- package/dist/core/tools/todos-types.d.ts +46 -0
- package/dist/core/tools/todos-types.d.ts.map +1 -0
- package/dist/core/tools/todos-types.js +27 -0
- package/dist/core/tools/todos-types.js.map +1 -0
- package/dist/core/tools/todos.d.ts +12 -32
- package/dist/core/tools/todos.d.ts.map +1 -1
- package/dist/core/tools/todos.js +7 -893
- package/dist/core/tools/todos.js.map +1 -1
- package/dist/index-extensions.d.ts +3 -0
- package/dist/index-extensions.d.ts.map +1 -0
- package/dist/index-extensions.js +2 -0
- package/dist/index-extensions.js.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main-app-mode.d.ts +15 -0
- package/dist/main-app-mode.d.ts.map +1 -0
- package/dist/main-app-mode.js +51 -0
- package/dist/main-app-mode.js.map +1 -0
- package/dist/main-session-options.d.ts +12 -0
- package/dist/main-session-options.d.ts.map +1 -0
- package/dist/main-session-options.js +87 -0
- package/dist/main-session-options.js.map +1 -0
- package/dist/main-session.d.ts +9 -0
- package/dist/main-session.d.ts.map +1 -0
- package/dist/main-session.js +188 -0
- package/dist/main-session.js.map +1 -0
- package/dist/main-stdio.d.ts +12 -0
- package/dist/main-stdio.d.ts.map +1 -0
- package/dist/main-stdio.js +68 -0
- package/dist/main-stdio.js.map +1 -0
- package/dist/main.d.ts +2 -3
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +11 -388
- package/dist/main.js.map +1 -1
- package/dist/migrations-config-values.d.ts +9 -0
- package/dist/migrations-config-values.d.ts.map +1 -0
- package/dist/migrations-config-values.js +298 -0
- package/dist/migrations-config-values.js.map +1 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +2 -296
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +0 -7
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts +9 -0
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-actions.js +244 -0
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-editor.d.ts +18 -0
- package/dist/modes/interactive/components/chat-session-host-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-editor.js +165 -0
- package/dist/modes/interactive/components/chat-session-host-editor.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-events.d.ts +5 -0
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-events.js +200 -0
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts +13 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.js +185 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +13 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.js +101 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +53 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-state.js +42 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-types.d.ts +63 -0
- package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-types.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts +28 -0
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-utils.js +103 -0
- package/dist/modes/interactive/components/chat-session-host-utils.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host.d.ts +6 -129
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +50 -1022
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/config-selector-list.d.ts +65 -0
- package/dist/modes/interactive/components/config-selector-list.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector-list.js +458 -0
- package/dist/modes/interactive/components/config-selector-list.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +3 -58
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +2 -457
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.d.ts +10 -0
- package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-delete.js +40 -0
- package/dist/modes/interactive/components/session-selector-delete.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-header.d.ts +33 -0
- package/dist/modes/interactive/components/session-selector-header.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-header.js +117 -0
- package/dist/modes/interactive/components/session-selector-header.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-list.d.ts +49 -0
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-list.js +307 -0
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-tree.d.ts +25 -0
- package/dist/modes/interactive/components/session-selector-tree.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-tree.js +53 -0
- package/dist/modes/interactive/components/session-selector-tree.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-types.d.ts +4 -0
- package/dist/modes/interactive/components/session-selector-types.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-types.js +2 -0
- package/dist/modes/interactive/components/session-selector-types.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-utils.d.ts +4 -0
- package/dist/modes/interactive/components/session-selector-utils.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-utils.js +37 -0
- package/dist/modes/interactive/components/session-selector-utils.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +3 -49
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +5 -542
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.d.ts +3 -0
- package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector-handlers.js +84 -0
- package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector-items.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector-items.js +211 -0
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector-options.d.ts +6 -0
- package/dist/modes/interactive/components/settings-selector-options.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector-options.js +14 -0
- package/dist/modes/interactive/components/settings-selector-options.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts +44 -0
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector-submenus.js +228 -0
- package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector-types.d.ts +67 -0
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector-types.js +2 -0
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -63
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +5 -538
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-component.d.ts +21 -0
- package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-component.js +80 -0
- package/dist/modes/interactive/components/tree-selector-component.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-content.d.ts +8 -0
- package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-content.js +263 -0
- package/dist/modes/interactive/components/tree-selector-content.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-help.d.ts +16 -0
- package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-help.js +103 -0
- package/dist/modes/interactive/components/tree-selector-help.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-label-input.d.ts +16 -0
- package/dist/modes/interactive/components/tree-selector-label-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-label-input.js +46 -0
- package/dist/modes/interactive/components/tree-selector-label-input.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-list.d.ts +33 -0
- package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-list.js +336 -0
- package/dist/modes/interactive/components/tree-selector-list.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-model.d.ts +7 -0
- package/dist/modes/interactive/components/tree-selector-model.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-model.js +358 -0
- package/dist/modes/interactive/components/tree-selector-model.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-types.d.ts +57 -0
- package/dist/modes/interactive/components/tree-selector-types.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-types.js +6 -0
- package/dist/modes/interactive/components/tree-selector-types.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-viewport.d.ts +10 -0
- package/dist/modes/interactive/components/tree-selector-viewport.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-viewport.js +32 -0
- package/dist/modes/interactive/components/tree-selector-viewport.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +2 -88
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +1 -1200
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.d.ts +2 -0
- package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-agent-events.js +370 -0
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -0
- package/dist/modes/interactive/interactive-auth-login.d.ts +2 -0
- package/dist/modes/interactive/interactive-auth-login.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-auth-login.js +214 -0
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -0
- package/dist/modes/interactive/interactive-auth-routing.d.ts +2 -0
- package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-auth-routing.js +128 -0
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -0
- package/dist/modes/interactive/interactive-autocomplete.d.ts +2 -0
- package/dist/modes/interactive/interactive-autocomplete.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-autocomplete.js +140 -0
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -0
- package/dist/modes/interactive/interactive-bash-compact.d.ts +2 -0
- package/dist/modes/interactive/interactive-bash-compact.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-bash-compact.js +112 -0
- package/dist/modes/interactive/interactive-bash-compact.js.map +1 -0
- package/dist/modes/interactive/interactive-editor-actions.d.ts +2 -0
- package/dist/modes/interactive/interactive-editor-actions.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-editor-actions.js +131 -0
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -0
- package/dist/modes/interactive/interactive-extension-context.d.ts +2 -0
- package/dist/modes/interactive/interactive-extension-context.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-extension-context.js +159 -0
- package/dist/modes/interactive/interactive-extension-context.js.map +1 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.d.ts +2 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.js +208 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -0
- package/dist/modes/interactive/interactive-extension-dialogs.d.ts +2 -0
- package/dist/modes/interactive/interactive-extension-dialogs.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-extension-dialogs.js +162 -0
- package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -0
- package/dist/modes/interactive/interactive-extension-runtime.d.ts +2 -0
- package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-extension-runtime.js +179 -0
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -0
- package/dist/modes/interactive/interactive-extension-widgets.d.ts +2 -0
- package/dist/modes/interactive/interactive-extension-widgets.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-extension-widgets.js +113 -0
- package/dist/modes/interactive/interactive-extension-widgets.js.map +1 -0
- package/dist/modes/interactive/interactive-hotkeys-debug.d.ts +2 -0
- package/dist/modes/interactive/interactive-hotkeys-debug.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-hotkeys-debug.js +186 -0
- package/dist/modes/interactive/interactive-hotkeys-debug.js.map +1 -0
- package/dist/modes/interactive/interactive-input-handling.d.ts +2 -0
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-input-handling.js +275 -0
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts +103 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode-base.js +130 -0
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -0
- package/dist/modes/interactive/interactive-mode-deps.d.ts +81 -0
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode-deps.js +74 -0
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -0
- package/dist/modes/interactive/interactive-mode-helpers.d.ts +21 -0
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode-helpers.js +77 -0
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -0
- package/dist/modes/interactive/interactive-mode-surface.d.ts +313 -0
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode-surface.js +2 -0
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -0
- package/dist/modes/interactive/interactive-mode-types.d.ts +29 -0
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode-types.js +2 -0
- package/dist/modes/interactive/interactive-mode-types.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +30 -404
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +29 -5260
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.d.ts +2 -0
- package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-model-routing.js +269 -0
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -0
- package/dist/modes/interactive/interactive-process-lifecycle.d.ts +2 -0
- package/dist/modes/interactive/interactive-process-lifecycle.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-process-lifecycle.js +189 -0
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -0
- package/dist/modes/interactive/interactive-queueing.d.ts +2 -0
- package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-queueing.js +163 -0
- package/dist/modes/interactive/interactive-queueing.js.map +1 -0
- package/dist/modes/interactive/interactive-render-chat.d.ts +2 -0
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-render-chat.js +170 -0
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -0
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts +2 -0
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-resource-disclosure.js +101 -0
- package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -0
- package/dist/modes/interactive/interactive-resource-paths.d.ts +2 -0
- package/dist/modes/interactive/interactive-resource-paths.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-resource-paths.js +228 -0
- package/dist/modes/interactive/interactive-resource-paths.js.map +1 -0
- package/dist/modes/interactive/interactive-resource-rendering.d.ts +2 -0
- package/dist/modes/interactive/interactive-resource-rendering.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-resource-rendering.js +181 -0
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -0
- package/dist/modes/interactive/interactive-selectors.d.ts +2 -0
- package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-selectors.js +198 -0
- package/dist/modes/interactive/interactive-selectors.js.map +1 -0
- package/dist/modes/interactive/interactive-session-routing.d.ts +2 -0
- package/dist/modes/interactive/interactive-session-routing.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-session-routing.js +232 -0
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -0
- package/dist/modes/interactive/interactive-session-runtime.d.ts +2 -0
- package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-session-runtime.js +131 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -0
- package/dist/modes/interactive/interactive-slash-commands.d.ts +2 -0
- package/dist/modes/interactive/interactive-slash-commands.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-slash-commands.js +338 -0
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -0
- package/dist/modes/interactive/interactive-startup.d.ts +2 -0
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-startup.js +348 -0
- package/dist/modes/interactive/interactive-startup.js.map +1 -0
- package/dist/modes/interactive/theme/color-utils.d.ts +20 -0
- package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -0
- package/dist/modes/interactive/theme/color-utils.js +204 -0
- package/dist/modes/interactive/theme/color-utils.js.map +1 -0
- package/dist/modes/interactive/theme/export-colors.d.ts +19 -0
- package/dist/modes/interactive/theme/export-colors.d.ts.map +1 -0
- package/dist/modes/interactive/theme/export-colors.js +69 -0
- package/dist/modes/interactive/theme/export-colors.js.map +1 -0
- package/dist/modes/interactive/theme/global-theme.d.ts +12 -0
- package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/global-theme.js +150 -0
- package/dist/modes/interactive/theme/global-theme.js.map +1 -0
- package/dist/modes/interactive/theme/terminal-detection.d.ts +30 -0
- package/dist/modes/interactive/theme/terminal-detection.d.ts.map +1 -0
- package/dist/modes/interactive/theme/terminal-detection.js +89 -0
- package/dist/modes/interactive/theme/terminal-detection.js.map +1 -0
- package/dist/modes/interactive/theme/theme-class.d.ts +30 -0
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-class.js +83 -0
- package/dist/modes/interactive/theme/theme-class.js.map +1 -0
- package/dist/modes/interactive/theme/theme-loading.d.ts +17 -0
- package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-loading.js +155 -0
- package/dist/modes/interactive/theme/theme-loading.js.map +1 -0
- package/dist/modes/interactive/theme/theme-parse.d.ts +5 -0
- package/dist/modes/interactive/theme/theme-parse.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-parse.js +52 -0
- package/dist/modes/interactive/theme/theme-parse.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts +255 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +78 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +6 -108
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +6 -1065
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/theme/tui-theme.d.ts +15 -0
- package/dist/modes/interactive/theme/tui-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/tui-theme.js +199 -0
- package/dist/modes/interactive/theme/tui-theme.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +1 -61
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +1 -72
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts +14 -0
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-command-handler.js +226 -0
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -0
- package/dist/modes/rpc/rpc-extension-ui.d.ts +15 -0
- package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-extension-ui.js +196 -0
- package/dist/modes/rpc/rpc-extension-ui.js.map +1 -0
- package/dist/modes/rpc/rpc-input.d.ts +12 -0
- package/dist/modes/rpc/rpc-input.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-input.js +54 -0
- package/dist/modes/rpc/rpc-input.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +43 -607
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-responses.d.ts +8 -0
- package/dist/modes/rpc/rpc-responses.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-responses.js +27 -0
- package/dist/modes/rpc/rpc-responses.js.map +1 -0
- package/dist/modes/rpc/rpc-session-binding.d.ts +25 -0
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-session-binding.js +70 -0
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -0
- package/dist/package-manager-cli-parser.d.ts +28 -0
- package/dist/package-manager-cli-parser.d.ts.map +1 -0
- package/dist/package-manager-cli-parser.js +269 -0
- package/dist/package-manager-cli-parser.js.map +1 -0
- package/dist/package-manager-cli.d.ts +0 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +2 -267
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +10 -0
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/version-check.d.ts +1 -0
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +17 -0
- package/dist/utils/version-check.js.map +1 -1
- package/docs/development.md +4 -0
- package/docs/workflows.md +8 -6
- package/examples/extensions/custom-provider-anthropic/index.ts +1 -106
- package/examples/extensions/gondolin/index.ts +0 -23
- package/examples/extensions/overlay-qa-animation-components.ts +255 -0
- package/examples/extensions/overlay-qa-focus-components.ts +222 -0
- package/examples/extensions/overlay-qa-position-components.ts +433 -0
- package/examples/extensions/overlay-qa-shared.ts +37 -0
- package/examples/extensions/overlay-qa-streaming-input-components.ts +205 -0
- package/examples/extensions/overlay-qa-tests.ts +17 -1156
- package/examples/extensions/overlay-qa-toggle-passive-components.ts +169 -0
- package/examples/extensions/space-invaders.ts +0 -60
- package/examples/extensions/subagent/display.ts +148 -0
- package/examples/extensions/subagent/index.ts +11 -858
- package/examples/extensions/subagent/render.ts +383 -0
- package/examples/extensions/subagent/runner.ts +252 -0
- package/examples/extensions/subagent/schemas.ts +59 -0
- package/examples/extensions/subagent/types.ts +36 -0
- package/examples/extensions/tic-tac-toe-instructions.ts +65 -0
- package/examples/extensions/tic-tac-toe-rendering.ts +414 -0
- package/examples/extensions/tic-tac-toe-state.ts +158 -0
- package/examples/extensions/tic-tac-toe.ts +92 -754
- package/examples/rpc-extension-ui-components.ts +189 -0
- package/examples/rpc-extension-ui.ts +2 -179
- package/package.json +4 -4
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { isContextOverflow } from "@earendil-works/pi-ai";
|
|
2
|
+
import { sleep } from "../utils/sleep.js";
|
|
3
|
+
import { isCopilotGeminiModel } from "./copilot-gemini-payload-sanitizer.js";
|
|
4
|
+
import { normalizeToolArgumentsForModel } from "./copilot-gemini-tool-arguments.js";
|
|
5
|
+
export function _isRetryableError(message) {
|
|
6
|
+
if (message.stopReason !== "error" || !message.errorMessage)
|
|
7
|
+
return false;
|
|
8
|
+
// Context overflow is handled by compaction, not retry
|
|
9
|
+
const contextWindow = this.model?.contextWindow ?? 0;
|
|
10
|
+
if (isContextOverflow(message, contextWindow))
|
|
11
|
+
return false;
|
|
12
|
+
const err = message.errorMessage;
|
|
13
|
+
// A genuine `content_filter` stop is a deliberate safety block: retrying it
|
|
14
|
+
// re-issues the same blocked request up to maxRetries times for no benefit.
|
|
15
|
+
// GitHub Copilot Gemini is the exception — CAPI maps spurious Gemini blocks
|
|
16
|
+
// (RECITATION/safety on MALFORMED_FUNCTION_CALL etc.) to `content_filter`, so
|
|
17
|
+
// only treat `content_filter` as retryable for those models.
|
|
18
|
+
if (isCopilotGeminiModel({ provider: message.provider, api: message.api, id: message.model }) &&
|
|
19
|
+
/finish.?reason:?\s*content.?filter/i.test(err)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
// Match: overloaded_error, provider returned error, rate limit, 429, 500, 502, 503, 504, service unavailable, network/connection errors (including connection lost), WebSocket transport closes/errors, fetch failed, premature stream endings, HTTP/2 closed before response, terminated, retry delay exceeded, and a bare/transient provider finish_reason "error" (e.g. github-copilot Gemini's CAPI mapping of MALFORMED_FUNCTION_CALL/OTHER/UNEXPECTED_TOOL_CALL). These are provider-agnostic transient failures.
|
|
23
|
+
return /overloaded|provider.?returned.?error|rate.?limit|too many requests|429|500|502|503|504|service.?unavailable|server.?error|internal.?error|network.?error|connection.?error|connection.?refused|connection.?lost|websocket.?closed|websocket.?error|other side closed|fetch failed|upstream.?connect|reset before headers|socket hang up|ended without|stream ended before message_stop|http2 request did not get a response|timed? out|timeout|terminated|retry delay|finish.?reason:?\s*error/i.test(err);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* For GitHub Copilot Gemini, reconstruct flattened tool-call arguments
|
|
27
|
+
* (for example `edits[0].newText`) into the nested arrays/objects Gemini
|
|
28
|
+
* produced before the assistant message is persisted, so saved transcripts
|
|
29
|
+
* never carry the flattened CAPI wire shape and replays loaded from disk match
|
|
30
|
+
* the structure Gemini signed. In-place, gated to Copilot Gemini, and a no-op
|
|
31
|
+
* for well-formed arguments or any other provider/model. The outbound replay
|
|
32
|
+
* normalizer still heals already-persisted (legacy) sessions on the wire.
|
|
33
|
+
*/
|
|
34
|
+
export function _normalizePersistedGeminiToolArgs(message) {
|
|
35
|
+
const model = this.model;
|
|
36
|
+
if (!model || !isCopilotGeminiModel(model))
|
|
37
|
+
return;
|
|
38
|
+
for (const block of message.content) {
|
|
39
|
+
if (block.type !== "toolCall")
|
|
40
|
+
continue;
|
|
41
|
+
const tool = this._toolRegistry.get(block.name);
|
|
42
|
+
const normalized = normalizeToolArgumentsForModel(block.arguments, model, tool?.parameters);
|
|
43
|
+
if (normalized !== block.arguments && normalized !== null && typeof normalized === "object") {
|
|
44
|
+
block.arguments = normalized;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Detect a degenerate empty completion: the provider ended the stream with no
|
|
50
|
+
* usable content and zero output tokens. Seen with github-copilot Gemini models
|
|
51
|
+
* that emit finish_reason "stop" (or a tool-use stop) with an empty content array
|
|
52
|
+
* and 0 output tokens, leaving the turn dead instead of producing the next step.
|
|
53
|
+
*
|
|
54
|
+
* These are treated as retryable so the harness re-issues the request rather than
|
|
55
|
+
* silently stopping mid-task. Guarded tightly (no text, no tool call, no thinking,
|
|
56
|
+
* and output === 0) so legitimate non-empty turns are never matched.
|
|
57
|
+
*
|
|
58
|
+
* Intentionally provider-agnostic (not gated to Copilot Gemini): a degenerate
|
|
59
|
+
* empty turn is a transient failure for any provider. It is bounded by
|
|
60
|
+
* `maxRetries` and falls through to normal handling on exhaustion.
|
|
61
|
+
*/
|
|
62
|
+
export function _isEmptyCompletion(message) {
|
|
63
|
+
// Only "completed" stop reasons can be deceptively empty. Real errors are handled
|
|
64
|
+
// by _isRetryableError; aborted/length turns are intentional outcomes.
|
|
65
|
+
if (message.stopReason !== "stop" && message.stopReason !== "toolUse")
|
|
66
|
+
return false;
|
|
67
|
+
const content = message.content;
|
|
68
|
+
if (Array.isArray(content)) {
|
|
69
|
+
const hasContent = content.some((part) => {
|
|
70
|
+
if (part.type === "text")
|
|
71
|
+
return part.text.trim().length > 0;
|
|
72
|
+
if (part.type === "toolCall")
|
|
73
|
+
return true;
|
|
74
|
+
if (part.type === "thinking")
|
|
75
|
+
return part.redacted === true || part.thinking.trim().length > 0;
|
|
76
|
+
return true; // unknown part types count as content
|
|
77
|
+
});
|
|
78
|
+
if (hasContent)
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
// A turn that produced output tokens but no surfaced content is not "empty"
|
|
82
|
+
// (e.g. reasoning-only responses); leave those alone. Note: a provider that
|
|
83
|
+
// fails to report `usage` (output defaults to 0) would make every
|
|
84
|
+
// content-less turn match here; the dual requirement (empty content AND zero
|
|
85
|
+
// output) keeps that false-positive risk low in practice.
|
|
86
|
+
return (message.usage?.output ?? 0) === 0;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Handle retryable errors with exponential backoff.
|
|
90
|
+
* @returns true if retry was initiated, false if max retries exceeded or disabled
|
|
91
|
+
*/
|
|
92
|
+
export async function _handleRetryableError(message) {
|
|
93
|
+
const settings = this.settingsManager.getRetrySettings();
|
|
94
|
+
if (!settings.enabled) {
|
|
95
|
+
this._resolveRetry();
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
// Retry promise is created synchronously in _handleAgentEvent for agent_end.
|
|
99
|
+
// Keep a defensive fallback here in case a future refactor bypasses that path.
|
|
100
|
+
if (!this._retryPromise) {
|
|
101
|
+
this._retryPromise = new Promise((resolve) => {
|
|
102
|
+
this._retryResolve = resolve;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
this._retryAttempt++;
|
|
106
|
+
if (this._retryAttempt > settings.maxRetries) {
|
|
107
|
+
// Max retries exceeded, emit final failure and reset
|
|
108
|
+
this._emit({
|
|
109
|
+
type: "auto_retry_end",
|
|
110
|
+
success: false,
|
|
111
|
+
attempt: this._retryAttempt - 1,
|
|
112
|
+
finalError: message.errorMessage,
|
|
113
|
+
});
|
|
114
|
+
this._retryAttempt = 0;
|
|
115
|
+
this._resolveRetry(); // Resolve so waitForRetry() completes
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
const delayMs = settings.baseDelayMs * 2 ** (this._retryAttempt - 1);
|
|
119
|
+
this._emit({
|
|
120
|
+
type: "auto_retry_start",
|
|
121
|
+
attempt: this._retryAttempt,
|
|
122
|
+
maxAttempts: settings.maxRetries,
|
|
123
|
+
delayMs,
|
|
124
|
+
errorMessage: message.errorMessage || "Unknown error",
|
|
125
|
+
});
|
|
126
|
+
// Remove error message from agent state (keep in session for history)
|
|
127
|
+
const messages = this.agent.state.messages;
|
|
128
|
+
if (messages.length > 0 && messages[messages.length - 1].role === "assistant") {
|
|
129
|
+
this.agent.state.messages = messages.slice(0, -1);
|
|
130
|
+
}
|
|
131
|
+
// Wait with exponential backoff (abortable)
|
|
132
|
+
this._retryAbortController = new AbortController();
|
|
133
|
+
try {
|
|
134
|
+
await sleep(delayMs, this._retryAbortController.signal);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// Aborted during sleep - emit end event so UI can clean up
|
|
138
|
+
const attempt = this._retryAttempt;
|
|
139
|
+
this._retryAttempt = 0;
|
|
140
|
+
this._retryAbortController = undefined;
|
|
141
|
+
this._emit({
|
|
142
|
+
type: "auto_retry_end",
|
|
143
|
+
success: false,
|
|
144
|
+
attempt,
|
|
145
|
+
finalError: "Retry cancelled",
|
|
146
|
+
});
|
|
147
|
+
this._resolveRetry();
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
this._retryAbortController = undefined;
|
|
151
|
+
// Retry via continue() - use setTimeout to break out of event handler chain
|
|
152
|
+
setTimeout(() => {
|
|
153
|
+
this.agent.continue().catch(() => {
|
|
154
|
+
// Retry failed - will be caught by next agent_end
|
|
155
|
+
});
|
|
156
|
+
}, 0);
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Cancel in-progress retry.
|
|
161
|
+
*/
|
|
162
|
+
export function abortRetry() {
|
|
163
|
+
this._retryAbortController?.abort();
|
|
164
|
+
// Note: _retryAttempt is reset in the catch block of _autoRetry
|
|
165
|
+
this._resolveRetry();
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Wait for any in-progress retry to complete.
|
|
169
|
+
* Returns immediately if no retry is in progress.
|
|
170
|
+
*/
|
|
171
|
+
export async function waitForRetry() {
|
|
172
|
+
if (!this._retryPromise) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
await this._retryPromise;
|
|
176
|
+
await this.agent.waitForIdle();
|
|
177
|
+
}
|
|
178
|
+
/** Whether auto-retry is currently in progress */
|
|
179
|
+
export function setAutoRetryEnabled(enabled) {
|
|
180
|
+
this.settingsManager.setRetryEnabled(enabled);
|
|
181
|
+
}
|
|
182
|
+
// =========================================================================
|
|
183
|
+
// Bash Execution
|
|
184
|
+
// =========================================================================
|
|
185
|
+
/**
|
|
186
|
+
* Execute a bash command.
|
|
187
|
+
* Adds result to agent context and session.
|
|
188
|
+
* @param command The bash command to execute
|
|
189
|
+
* @param onChunk Optional streaming callback for output
|
|
190
|
+
* @param options.excludeFromContext If true, command output won't be sent to LLM (!! prefix)
|
|
191
|
+
* @param options.operations Custom BashOperations for remote execution
|
|
192
|
+
*/
|
|
193
|
+
export const agentSessionRetryMethods = {
|
|
194
|
+
_isRetryableError,
|
|
195
|
+
_normalizePersistedGeminiToolArgs,
|
|
196
|
+
_isEmptyCompletion,
|
|
197
|
+
_handleRetryableError,
|
|
198
|
+
abortRetry,
|
|
199
|
+
waitForRetry,
|
|
200
|
+
setAutoRetryEnabled,
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=agent-session-retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-retry.js","sourceRoot":"","sources":["../../src/core/agent-session-retry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,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AM,UAAU,UAAU;IACzB,IAAI,CAAC,qBAAqB,EAAE,KAAK,EAAE,CAAC;IACpC,gEAAgE;IAChE,IAAI,CAAC,aAAa,EAAE,CAAC;AACtB,CAAC;AAED;;;GAGG;AAEH,MAAM,CAAC,KAAK,UAAU,YAAY;IACjC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QACzB,OAAO;IACR,CAAC;IAED,MAAM,IAAI,CAAC,aAAa,CAAC;IACzB,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC;AAED,kDAAkD;AAElD,MAAM,UAAU,mBAAmB,CAAqB,OAAgB;IACvE,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED,4EAA4E;AAC5E,iBAAiB;AACjB,4EAA4E;AAE5E;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACvC,iBAAiB;IACjB,iCAAiC;IACjC,kBAAkB;IAClB,qBAAqB;IACrB,UAAU;IACV,YAAY;IACZ,mBAAmB;CACnB,CAAC","sourcesContent":["import type { AssistantMessage } from \"@earendil-works/pi-ai\";\nimport { isContextOverflow } from \"@earendil-works/pi-ai\";\nimport { sleep } from \"../utils/sleep.ts\";\nimport { isCopilotGeminiModel } from \"./copilot-gemini-payload-sanitizer.ts\";\nimport { normalizeToolArgumentsForModel } from \"./copilot-gemini-tool-arguments.ts\";\nimport type { AgentSessionInternalSurface as AgentSession } from \"./agent-session-methods.ts\";\n\nexport function _isRetryableError(this: AgentSession, message: AssistantMessage): boolean {\n\tif (message.stopReason !== \"error\" || !message.errorMessage) return false;\n\n\t// Context overflow is handled by compaction, not retry\n\tconst contextWindow = this.model?.contextWindow ?? 0;\n\tif (isContextOverflow(message, contextWindow)) return false;\n\n\tconst err = message.errorMessage;\n\n\t// A genuine `content_filter` stop is a deliberate safety block: retrying it\n\t// re-issues the same blocked request up to maxRetries times for no benefit.\n\t// GitHub Copilot Gemini is the exception — CAPI maps spurious Gemini blocks\n\t// (RECITATION/safety on MALFORMED_FUNCTION_CALL etc.) to `content_filter`, so\n\t// only treat `content_filter` as retryable for those models.\n\tif (\n\t\tisCopilotGeminiModel({ provider: message.provider, api: message.api, id: message.model }) &&\n\t\t/finish.?reason:?\\s*content.?filter/i.test(err)\n\t) {\n\t\treturn true;\n\t}\n\n\t// Match: overloaded_error, provider returned error, rate limit, 429, 500, 502, 503, 504, service unavailable, network/connection errors (including connection lost), WebSocket transport closes/errors, fetch failed, premature stream endings, HTTP/2 closed before response, terminated, retry delay exceeded, and a bare/transient provider finish_reason \"error\" (e.g. github-copilot Gemini's CAPI mapping of MALFORMED_FUNCTION_CALL/OTHER/UNEXPECTED_TOOL_CALL). These are provider-agnostic transient failures.\n\treturn /overloaded|provider.?returned.?error|rate.?limit|too many requests|429|500|502|503|504|service.?unavailable|server.?error|internal.?error|network.?error|connection.?error|connection.?refused|connection.?lost|websocket.?closed|websocket.?error|other side closed|fetch failed|upstream.?connect|reset before headers|socket hang up|ended without|stream ended before message_stop|http2 request did not get a response|timed? out|timeout|terminated|retry delay|finish.?reason:?\\s*error/i.test(\n\t\terr,\n\t);\n}\n\n/**\n * For GitHub Copilot Gemini, reconstruct flattened tool-call arguments\n * (for example `edits[0].newText`) into the nested arrays/objects Gemini\n * produced before the assistant message is persisted, so saved transcripts\n * never carry the flattened CAPI wire shape and replays loaded from disk match\n * the structure Gemini signed. In-place, gated to Copilot Gemini, and a no-op\n * for well-formed arguments or any other provider/model. The outbound replay\n * normalizer still heals already-persisted (legacy) sessions on the wire.\n */\n\nexport function _normalizePersistedGeminiToolArgs(this: AgentSession, message: AssistantMessage): void {\n\tconst model = this.model;\n\tif (!model || !isCopilotGeminiModel(model)) return;\n\tfor (const block of message.content) {\n\t\tif (block.type !== \"toolCall\") continue;\n\t\tconst tool = this._toolRegistry.get(block.name);\n\t\tconst normalized = normalizeToolArgumentsForModel(block.arguments, model, tool?.parameters);\n\t\tif (normalized !== block.arguments && normalized !== null && typeof normalized === \"object\") {\n\t\t\tblock.arguments = normalized as Record<string, unknown>;\n\t\t}\n\t}\n}\n\n/**\n * Detect a degenerate empty completion: the provider ended the stream with no\n * usable content and zero output tokens. Seen with github-copilot Gemini models\n * that emit finish_reason \"stop\" (or a tool-use stop) with an empty content array\n * and 0 output tokens, leaving the turn dead instead of producing the next step.\n *\n * These are treated as retryable so the harness re-issues the request rather than\n * silently stopping mid-task. Guarded tightly (no text, no tool call, no thinking,\n * and output === 0) so legitimate non-empty turns are never matched.\n *\n * Intentionally provider-agnostic (not gated to Copilot Gemini): a degenerate\n * empty turn is a transient failure for any provider. It is bounded by\n * `maxRetries` and falls through to normal handling on exhaustion.\n */\n\nexport function _isEmptyCompletion(this: AgentSession, message: AssistantMessage): boolean {\n\t// Only \"completed\" stop reasons can be deceptively empty. Real errors are handled\n\t// by _isRetryableError; aborted/length turns are intentional outcomes.\n\tif (message.stopReason !== \"stop\" && message.stopReason !== \"toolUse\") return false;\n\n\tconst content = message.content;\n\tif (Array.isArray(content)) {\n\t\tconst hasContent = content.some((part) => {\n\t\t\tif (part.type === \"text\") return part.text.trim().length > 0;\n\t\t\tif (part.type === \"toolCall\") return true;\n\t\t\tif (part.type === \"thinking\") return part.redacted === true || part.thinking.trim().length > 0;\n\t\t\treturn true; // unknown part types count as content\n\t\t});\n\t\tif (hasContent) return false;\n\t}\n\n\t// A turn that produced output tokens but no surfaced content is not \"empty\"\n\t// (e.g. reasoning-only responses); leave those alone. Note: a provider that\n\t// fails to report `usage` (output defaults to 0) would make every\n\t// content-less turn match here; the dual requirement (empty content AND zero\n\t// output) keeps that false-positive risk low in practice.\n\treturn (message.usage?.output ?? 0) === 0;\n}\n\n/**\n * Handle retryable errors with exponential backoff.\n * @returns true if retry was initiated, false if max retries exceeded or disabled\n */\n\nexport async function _handleRetryableError(this: AgentSession, message: AssistantMessage): Promise<boolean> {\n\tconst settings = this.settingsManager.getRetrySettings();\n\tif (!settings.enabled) {\n\t\tthis._resolveRetry();\n\t\treturn false;\n\t}\n\n\t// Retry promise is created synchronously in _handleAgentEvent for agent_end.\n\t// Keep a defensive fallback here in case a future refactor bypasses that path.\n\tif (!this._retryPromise) {\n\t\tthis._retryPromise = new Promise((resolve) => {\n\t\t\tthis._retryResolve = resolve;\n\t\t});\n\t}\n\n\tthis._retryAttempt++;\n\n\tif (this._retryAttempt > settings.maxRetries) {\n\t\t// Max retries exceeded, emit final failure and reset\n\t\tthis._emit({\n\t\t\ttype: \"auto_retry_end\",\n\t\t\tsuccess: false,\n\t\t\tattempt: this._retryAttempt - 1,\n\t\t\tfinalError: message.errorMessage,\n\t\t});\n\t\tthis._retryAttempt = 0;\n\t\tthis._resolveRetry(); // Resolve so waitForRetry() completes\n\t\treturn false;\n\t}\n\n\tconst delayMs = settings.baseDelayMs * 2 ** (this._retryAttempt - 1);\n\n\tthis._emit({\n\t\ttype: \"auto_retry_start\",\n\t\tattempt: this._retryAttempt,\n\t\tmaxAttempts: settings.maxRetries,\n\t\tdelayMs,\n\t\terrorMessage: message.errorMessage || \"Unknown error\",\n\t});\n\n\t// Remove error message from agent state (keep in session for history)\n\tconst messages = this.agent.state.messages;\n\tif (messages.length > 0 && messages[messages.length - 1].role === \"assistant\") {\n\t\tthis.agent.state.messages = messages.slice(0, -1);\n\t}\n\n\t// Wait with exponential backoff (abortable)\n\tthis._retryAbortController = new AbortController();\n\ttry {\n\t\tawait sleep(delayMs, this._retryAbortController.signal);\n\t} catch {\n\t\t// Aborted during sleep - emit end event so UI can clean up\n\t\tconst attempt = this._retryAttempt;\n\t\tthis._retryAttempt = 0;\n\t\tthis._retryAbortController = undefined;\n\t\tthis._emit({\n\t\t\ttype: \"auto_retry_end\",\n\t\t\tsuccess: false,\n\t\t\tattempt,\n\t\t\tfinalError: \"Retry cancelled\",\n\t\t});\n\t\tthis._resolveRetry();\n\t\treturn false;\n\t}\n\tthis._retryAbortController = undefined;\n\n\t// Retry via continue() - use setTimeout to break out of event handler chain\n\tsetTimeout(() => {\n\t\tthis.agent.continue().catch(() => {\n\t\t\t// Retry failed - will be caught by next agent_end\n\t\t});\n\t}, 0);\n\n\treturn true;\n}\n\n/**\n * Cancel in-progress retry.\n */\n\nexport function abortRetry(this: AgentSession): void {\n\tthis._retryAbortController?.abort();\n\t// Note: _retryAttempt is reset in the catch block of _autoRetry\n\tthis._resolveRetry();\n}\n\n/**\n * Wait for any in-progress retry to complete.\n * Returns immediately if no retry is in progress.\n */\n\nexport async function waitForRetry(this: AgentSession): Promise<void> {\n\tif (!this._retryPromise) {\n\t\treturn;\n\t}\n\n\tawait this._retryPromise;\n\tawait this.agent.waitForIdle();\n}\n\n/** Whether auto-retry is currently in progress */\n\nexport function setAutoRetryEnabled(this: AgentSession, enabled: boolean): void {\n\tthis.settingsManager.setRetryEnabled(enabled);\n}\n\n// =========================================================================\n// Bash Execution\n// =========================================================================\n\n/**\n * Execute a bash command.\n * Adds result to agent context and session.\n * @param command The bash command to execute\n * @param onChunk Optional streaming callback for output\n * @param options.excludeFromContext If true, command output won't be sent to LLM (!! prefix)\n * @param options.operations Custom BashOperations for remote execution\n */\n\nexport const agentSessionRetryMethods = {\n\t_isRetryableError,\n\t_normalizePersistedGeminiToolArgs,\n\t_isEmptyCompletion,\n\t_handleRetryableError,\n\tabortRetry,\n\twaitForRetry,\n\tsetAutoRetryEnabled,\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Parsed skill block from a user message */
|
|
2
|
+
export interface ParsedSkillBlock {
|
|
3
|
+
name: string;
|
|
4
|
+
location: string;
|
|
5
|
+
content: string;
|
|
6
|
+
userMessage: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Parse a skill block from message text.
|
|
10
|
+
* Returns null if the text doesn't contain a skill block.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseSkillBlock(text: string): ParsedSkillBlock | null;
|
|
13
|
+
//# sourceMappingURL=agent-session-skill-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-skill-block.d.ts","sourceRoot":"","sources":["../../src/core/agent-session-skill-block.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CA6BrE","sourcesContent":["/** Parsed skill block from a user message */\nexport interface ParsedSkillBlock {\n\tname: string;\n\tlocation: string;\n\tcontent: string;\n\tuserMessage: string | undefined;\n}\n\n/**\n * Parse a skill block from message text.\n * Returns null if the text doesn't contain a skill block.\n */\nexport function parseSkillBlock(text: string): ParsedSkillBlock | null {\n\tconst prefix = '<skill name=\"';\n\tif (!text.startsWith(prefix)) return null;\n\n\tconst nameEnd = text.indexOf('\" location=\"', prefix.length);\n\tif (nameEnd === -1) return null;\n\tconst name = text.slice(prefix.length, nameEnd);\n\tif (!name) return null;\n\n\tconst locationStart = nameEnd + '\" location=\"'.length;\n\tconst locationEnd = text.indexOf('\">\\n', locationStart);\n\tif (locationEnd === -1) return null;\n\tconst location = text.slice(locationStart, locationEnd);\n\tif (!location) return null;\n\n\tconst contentStart = locationEnd + '\">\\n'.length;\n\tconst closing = \"\\n</skill>\";\n\tconst contentEnd = text.indexOf(closing, contentStart);\n\tif (contentEnd === -1) return null;\n\n\tconst afterClosing = text.slice(contentEnd + closing.length);\n\tif (afterClosing !== \"\" && !afterClosing.startsWith(\"\\n\\n\")) return null;\n\n\treturn {\n\t\tname,\n\t\tlocation,\n\t\tcontent: text.slice(contentStart, contentEnd),\n\t\tuserMessage: afterClosing ? afterClosing.slice(2).trim() || undefined : undefined,\n\t};\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a skill block from message text.
|
|
3
|
+
* Returns null if the text doesn't contain a skill block.
|
|
4
|
+
*/
|
|
5
|
+
export function parseSkillBlock(text) {
|
|
6
|
+
const prefix = '<skill name="';
|
|
7
|
+
if (!text.startsWith(prefix))
|
|
8
|
+
return null;
|
|
9
|
+
const nameEnd = text.indexOf('" location="', prefix.length);
|
|
10
|
+
if (nameEnd === -1)
|
|
11
|
+
return null;
|
|
12
|
+
const name = text.slice(prefix.length, nameEnd);
|
|
13
|
+
if (!name)
|
|
14
|
+
return null;
|
|
15
|
+
const locationStart = nameEnd + '" location="'.length;
|
|
16
|
+
const locationEnd = text.indexOf('">\n', locationStart);
|
|
17
|
+
if (locationEnd === -1)
|
|
18
|
+
return null;
|
|
19
|
+
const location = text.slice(locationStart, locationEnd);
|
|
20
|
+
if (!location)
|
|
21
|
+
return null;
|
|
22
|
+
const contentStart = locationEnd + '">\n'.length;
|
|
23
|
+
const closing = "\n</skill>";
|
|
24
|
+
const contentEnd = text.indexOf(closing, contentStart);
|
|
25
|
+
if (contentEnd === -1)
|
|
26
|
+
return null;
|
|
27
|
+
const afterClosing = text.slice(contentEnd + closing.length);
|
|
28
|
+
if (afterClosing !== "" && !afterClosing.startsWith("\n\n"))
|
|
29
|
+
return null;
|
|
30
|
+
return {
|
|
31
|
+
name,
|
|
32
|
+
location,
|
|
33
|
+
content: text.slice(contentStart, contentEnd),
|
|
34
|
+
userMessage: afterClosing ? afterClosing.slice(2).trim() || undefined : undefined,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=agent-session-skill-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-skill-block.js","sourceRoot":"","sources":["../../src/core/agent-session-skill-block.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC3C,MAAM,MAAM,GAAG,eAAe,CAAC;IAC/B,IAAI,CAA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AE,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS;KACjF,CAAC;AACH,CAAC","sourcesContent":["/** Parsed skill block from a user message */\nexport interface ParsedSkillBlock {\n\tname: string;\n\tlocation: string;\n\tcontent: string;\n\tuserMessage: string | undefined;\n}\n\n/**\n * Parse a skill block from message text.\n * Returns null if the text doesn't contain a skill block.\n */\nexport function parseSkillBlock(text: string): ParsedSkillBlock | null {\n\tconst prefix = '<skill name=\"';\n\tif (!text.startsWith(prefix)) return null;\n\n\tconst nameEnd = text.indexOf('\" location=\"', prefix.length);\n\tif (nameEnd === -1) return null;\n\tconst name = text.slice(prefix.length, nameEnd);\n\tif (!name) return null;\n\n\tconst locationStart = nameEnd + '\" location=\"'.length;\n\tconst locationEnd = text.indexOf('\">\\n', locationStart);\n\tif (locationEnd === -1) return null;\n\tconst location = text.slice(locationStart, locationEnd);\n\tif (!location) return null;\n\n\tconst contentStart = locationEnd + '\">\\n'.length;\n\tconst closing = \"\\n</skill>\";\n\tconst contentEnd = text.indexOf(closing, contentStart);\n\tif (contentEnd === -1) return null;\n\n\tconst afterClosing = text.slice(contentEnd + closing.length);\n\tif (afterClosing !== \"\" && !afterClosing.startsWith(\"\\n\\n\")) return null;\n\n\treturn {\n\t\tname,\n\t\tlocation,\n\t\tcontent: text.slice(contentStart, contentEnd),\n\t\tuserMessage: afterClosing ? afterClosing.slice(2).trim() || undefined : undefined,\n\t};\n}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
3
|
+
import type { ToolDefinition, ToolInfo } from "./extensions/index.ts";
|
|
4
|
+
import type { AgentSessionInternalSurface as AgentSession } from "./agent-session-methods.ts";
|
|
5
|
+
export declare function getActiveToolNames(this: AgentSession): string[];
|
|
6
|
+
/**
|
|
7
|
+
* Get all configured tools with name, description, parameter schema, and source metadata.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getAllTools(this: AgentSession): ToolInfo[];
|
|
10
|
+
export declare function getToolDefinition(this: AgentSession, name: string): ToolDefinition | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Set active tools by name.
|
|
13
|
+
* Only tools in the registry can be enabled. Unknown tool names are ignored.
|
|
14
|
+
* Also rebuilds the system prompt to reflect the new tool set.
|
|
15
|
+
* Changes take effect on the next agent turn.
|
|
16
|
+
*/
|
|
17
|
+
export declare function setActiveToolsByName(this: AgentSession, toolNames: string[]): void;
|
|
18
|
+
/** Whether compaction or branch summarization is currently running */
|
|
19
|
+
export declare function setScopedModels(this: AgentSession, scopedModels: Array<{
|
|
20
|
+
model: Model<Api>;
|
|
21
|
+
thinkingLevel?: ThinkingLevel;
|
|
22
|
+
}>): void;
|
|
23
|
+
/** File-based prompt templates */
|
|
24
|
+
export declare function _normalizePromptSnippet(this: AgentSession, text: string | undefined): string | undefined;
|
|
25
|
+
export declare function _normalizePromptGuidelines(this: AgentSession, guidelines: string[] | undefined): string[];
|
|
26
|
+
export declare function _rebuildSystemPrompt(this: AgentSession, toolNames: string[]): string;
|
|
27
|
+
export declare function _refreshBaseSystemPromptFromActiveTools(this: AgentSession): void;
|
|
28
|
+
/**
|
|
29
|
+
* Send a prompt to the agent.
|
|
30
|
+
* - Handles extension commands (registered via pi.registerCommand) immediately, even during streaming
|
|
31
|
+
* - Expands file-based prompt templates by default
|
|
32
|
+
* - During streaming, queues via steer() or followUp() based on streamingBehavior option
|
|
33
|
+
* - Validates model and API key before sending (when not streaming)
|
|
34
|
+
* @throws Error if streaming and no streamingBehavior specified
|
|
35
|
+
* @throws Error if no model selected or no API key available (when not streaming)
|
|
36
|
+
*/
|
|
37
|
+
export declare const agentSessionStateMethods: {
|
|
38
|
+
getActiveToolNames: typeof getActiveToolNames;
|
|
39
|
+
getAllTools: typeof getAllTools;
|
|
40
|
+
getToolDefinition: typeof getToolDefinition;
|
|
41
|
+
setActiveToolsByName: typeof setActiveToolsByName;
|
|
42
|
+
setScopedModels: typeof setScopedModels;
|
|
43
|
+
_normalizePromptSnippet: typeof _normalizePromptSnippet;
|
|
44
|
+
_normalizePromptGuidelines: typeof _normalizePromptGuidelines;
|
|
45
|
+
_rebuildSystemPrompt: typeof _rebuildSystemPrompt;
|
|
46
|
+
_refreshBaseSystemPromptFromActiveTools: typeof _refreshBaseSystemPromptFromActiveTools;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=agent-session-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-state.d.ts","sourceRoot":"","sources":["../../src/core/agent-session-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,2BAA2B,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG9F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,EAAE,CAE/D;AAED;;GAEG;AAEH,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,EAAE,CAQ1D;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAE9F;AAED;;;;;GAKG;AAEH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAelF;AAED,sEAAsE;AAEtE,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAAC,aAAa,CAAC,EAAE,aAAa,CAAA;CAAE,CAAC,GAAG,IAAI,CAEnI;AAED,kCAAkC;AAElC,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOxG;AAGD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAazG;AAGD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAqCpF;AAGD,wBAAgB,uCAAuC,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAGhF;AAMD;;;;;;;;GAQG;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;CAUpC,CAAC","sourcesContent":["import type { AgentTool, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { ToolDefinition, ToolInfo } from \"./extensions/index.ts\";\nimport type { AgentSessionInternalSurface as AgentSession } from \"./agent-session-methods.ts\";\nimport { buildSystemPrompt } from \"./system-prompt.ts\";\n\nexport function getActiveToolNames(this: AgentSession): string[] {\n\treturn this.agent.state.tools.map((t) => t.name);\n}\n\n/**\n * Get all configured tools with name, description, parameter schema, and source metadata.\n */\n\nexport function getAllTools(this: AgentSession): ToolInfo[] {\n\treturn Array.from(this._toolDefinitions.values()).map(({ definition, sourceInfo }) => ({\n\t\tname: definition.name,\n\t\tdescription: definition.description,\n\t\tparameters: definition.parameters,\n\t\tpromptGuidelines: definition.promptGuidelines,\n\t\tsourceInfo,\n\t}));\n}\n\n\nexport function getToolDefinition(this: AgentSession, name: string): ToolDefinition | undefined {\n\treturn this._toolDefinitions.get(name)?.definition;\n}\n\n/**\n * Set active tools by name.\n * Only tools in the registry can be enabled. Unknown tool names are ignored.\n * Also rebuilds the system prompt to reflect the new tool set.\n * Changes take effect on the next agent turn.\n */\n\nexport function setActiveToolsByName(this: AgentSession, toolNames: string[]): void {\n\tconst tools: AgentTool[] = [];\n\tconst validToolNames: string[] = [];\n\tfor (const name of toolNames) {\n\t\tconst tool = this._toolRegistry.get(name);\n\t\tif (tool) {\n\t\t\ttools.push(tool);\n\t\t\tvalidToolNames.push(name);\n\t\t}\n\t}\n\tthis.agent.state.tools = tools;\n\n\t// Rebuild base system prompt with new tool set\n\tthis._baseSystemPrompt = this._rebuildSystemPrompt(validToolNames);\n\tthis.agent.state.systemPrompt = this._baseSystemPrompt;\n}\n\n/** Whether compaction or branch summarization is currently running */\n\nexport function setScopedModels(this: AgentSession, scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>): void {\n\tthis._scopedModels = scopedModels;\n}\n\n/** File-based prompt templates */\n\nexport function _normalizePromptSnippet(this: AgentSession, text: string | undefined): string | undefined {\n\tif (!text) return undefined;\n\tconst oneLine = text\n\t\t.replace(/[\\r\\n]+/g, \" \")\n\t\t.replace(/\\s+/g, \" \")\n\t\t.trim();\n\treturn oneLine.length > 0 ? oneLine : undefined;\n}\n\n\nexport function _normalizePromptGuidelines(this: AgentSession, guidelines: string[] | undefined): string[] {\n\tif (!guidelines || guidelines.length === 0) {\n\t\treturn [];\n\t}\n\n\tconst unique = new Set<string>();\n\tfor (const guideline of guidelines) {\n\t\tconst normalized = guideline.trim();\n\t\tif (normalized.length > 0) {\n\t\t\tunique.add(normalized);\n\t\t}\n\t}\n\treturn Array.from(unique);\n}\n\n\nexport function _rebuildSystemPrompt(this: AgentSession, toolNames: string[]): string {\n\tconst validToolNames = toolNames.filter((name) => this._toolRegistry.has(name));\n\tconst toolSnippets: Record<string, string> = {};\n\tconst promptGuidelines: string[] = [];\n\tfor (const name of validToolNames) {\n\t\tconst snippet = this._toolPromptSnippets.get(name);\n\t\tif (snippet) {\n\t\t\ttoolSnippets[name] = snippet;\n\t\t}\n\n\t\tconst toolGuidelines = this._toolPromptGuidelines.get(name);\n\t\tif (toolGuidelines) {\n\t\t\tpromptGuidelines.push(...toolGuidelines);\n\t\t}\n\t}\n\n\tconst loaderSystemPrompt = this._resourceLoader.getSystemPrompt();\n\tconst loaderAppendSystemPrompt = this._resourceLoader.getAppendSystemPrompt();\n\tconst appendSystemPrompt =\n\t\tloaderAppendSystemPrompt.length > 0 ? loaderAppendSystemPrompt.join(\"\\n\\n\") : undefined;\n\tconst loadedSkills = this._resourceLoader.getSkills().skills;\n\tconst loadedContextFiles = this._resourceLoader.getAgentsFiles().agentsFiles;\n\n\tthis._baseSystemPromptOptions = {\n\t\tcwd: this._cwd,\n\t\tselectedModel: this.model,\n\t\tselectedThinkingLevel: this.thinkingLevel,\n\t\tskills: loadedSkills,\n\t\tcontextFiles: loadedContextFiles,\n\t\tcustomPrompt: loaderSystemPrompt,\n\t\tappendSystemPrompt,\n\t\tselectedTools: validToolNames,\n\t\texcludedTools: this._excludedToolNames ? Array.from(this._excludedToolNames) : undefined,\n\t\ttoolSnippets,\n\t\tpromptGuidelines,\n\t};\n\treturn buildSystemPrompt(this._baseSystemPromptOptions);\n}\n\n\nexport function _refreshBaseSystemPromptFromActiveTools(this: AgentSession): void {\n\tthis._baseSystemPrompt = this._rebuildSystemPrompt(this.getActiveToolNames());\n\tthis.agent.state.systemPrompt = this._baseSystemPrompt;\n}\n\n// =========================================================================\n// Prompting\n// =========================================================================\n\n/**\n * Send a prompt to the agent.\n * - Handles extension commands (registered via pi.registerCommand) immediately, even during streaming\n * - Expands file-based prompt templates by default\n * - During streaming, queues via steer() or followUp() based on streamingBehavior option\n * - Validates model and API key before sending (when not streaming)\n * @throws Error if streaming and no streamingBehavior specified\n * @throws Error if no model selected or no API key available (when not streaming)\n */\n\nexport const agentSessionStateMethods = {\n\tgetActiveToolNames,\n\tgetAllTools,\n\tgetToolDefinition,\n\tsetActiveToolsByName,\n\tsetScopedModels,\n\t_normalizePromptSnippet,\n\t_normalizePromptGuidelines,\n\t_rebuildSystemPrompt,\n\t_refreshBaseSystemPromptFromActiveTools,\n};\n"]}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { buildSystemPrompt } from "./system-prompt.js";
|
|
2
|
+
export function getActiveToolNames() {
|
|
3
|
+
return this.agent.state.tools.map((t) => t.name);
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Get all configured tools with name, description, parameter schema, and source metadata.
|
|
7
|
+
*/
|
|
8
|
+
export function getAllTools() {
|
|
9
|
+
return Array.from(this._toolDefinitions.values()).map(({ definition, sourceInfo }) => ({
|
|
10
|
+
name: definition.name,
|
|
11
|
+
description: definition.description,
|
|
12
|
+
parameters: definition.parameters,
|
|
13
|
+
promptGuidelines: definition.promptGuidelines,
|
|
14
|
+
sourceInfo,
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
export function getToolDefinition(name) {
|
|
18
|
+
return this._toolDefinitions.get(name)?.definition;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Set active tools by name.
|
|
22
|
+
* Only tools in the registry can be enabled. Unknown tool names are ignored.
|
|
23
|
+
* Also rebuilds the system prompt to reflect the new tool set.
|
|
24
|
+
* Changes take effect on the next agent turn.
|
|
25
|
+
*/
|
|
26
|
+
export function setActiveToolsByName(toolNames) {
|
|
27
|
+
const tools = [];
|
|
28
|
+
const validToolNames = [];
|
|
29
|
+
for (const name of toolNames) {
|
|
30
|
+
const tool = this._toolRegistry.get(name);
|
|
31
|
+
if (tool) {
|
|
32
|
+
tools.push(tool);
|
|
33
|
+
validToolNames.push(name);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
this.agent.state.tools = tools;
|
|
37
|
+
// Rebuild base system prompt with new tool set
|
|
38
|
+
this._baseSystemPrompt = this._rebuildSystemPrompt(validToolNames);
|
|
39
|
+
this.agent.state.systemPrompt = this._baseSystemPrompt;
|
|
40
|
+
}
|
|
41
|
+
/** Whether compaction or branch summarization is currently running */
|
|
42
|
+
export function setScopedModels(scopedModels) {
|
|
43
|
+
this._scopedModels = scopedModels;
|
|
44
|
+
}
|
|
45
|
+
/** File-based prompt templates */
|
|
46
|
+
export function _normalizePromptSnippet(text) {
|
|
47
|
+
if (!text)
|
|
48
|
+
return undefined;
|
|
49
|
+
const oneLine = text
|
|
50
|
+
.replace(/[\r\n]+/g, " ")
|
|
51
|
+
.replace(/\s+/g, " ")
|
|
52
|
+
.trim();
|
|
53
|
+
return oneLine.length > 0 ? oneLine : undefined;
|
|
54
|
+
}
|
|
55
|
+
export function _normalizePromptGuidelines(guidelines) {
|
|
56
|
+
if (!guidelines || guidelines.length === 0) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
const unique = new Set();
|
|
60
|
+
for (const guideline of guidelines) {
|
|
61
|
+
const normalized = guideline.trim();
|
|
62
|
+
if (normalized.length > 0) {
|
|
63
|
+
unique.add(normalized);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return Array.from(unique);
|
|
67
|
+
}
|
|
68
|
+
export function _rebuildSystemPrompt(toolNames) {
|
|
69
|
+
const validToolNames = toolNames.filter((name) => this._toolRegistry.has(name));
|
|
70
|
+
const toolSnippets = {};
|
|
71
|
+
const promptGuidelines = [];
|
|
72
|
+
for (const name of validToolNames) {
|
|
73
|
+
const snippet = this._toolPromptSnippets.get(name);
|
|
74
|
+
if (snippet) {
|
|
75
|
+
toolSnippets[name] = snippet;
|
|
76
|
+
}
|
|
77
|
+
const toolGuidelines = this._toolPromptGuidelines.get(name);
|
|
78
|
+
if (toolGuidelines) {
|
|
79
|
+
promptGuidelines.push(...toolGuidelines);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const loaderSystemPrompt = this._resourceLoader.getSystemPrompt();
|
|
83
|
+
const loaderAppendSystemPrompt = this._resourceLoader.getAppendSystemPrompt();
|
|
84
|
+
const appendSystemPrompt = loaderAppendSystemPrompt.length > 0 ? loaderAppendSystemPrompt.join("\n\n") : undefined;
|
|
85
|
+
const loadedSkills = this._resourceLoader.getSkills().skills;
|
|
86
|
+
const loadedContextFiles = this._resourceLoader.getAgentsFiles().agentsFiles;
|
|
87
|
+
this._baseSystemPromptOptions = {
|
|
88
|
+
cwd: this._cwd,
|
|
89
|
+
selectedModel: this.model,
|
|
90
|
+
selectedThinkingLevel: this.thinkingLevel,
|
|
91
|
+
skills: loadedSkills,
|
|
92
|
+
contextFiles: loadedContextFiles,
|
|
93
|
+
customPrompt: loaderSystemPrompt,
|
|
94
|
+
appendSystemPrompt,
|
|
95
|
+
selectedTools: validToolNames,
|
|
96
|
+
excludedTools: this._excludedToolNames ? Array.from(this._excludedToolNames) : undefined,
|
|
97
|
+
toolSnippets,
|
|
98
|
+
promptGuidelines,
|
|
99
|
+
};
|
|
100
|
+
return buildSystemPrompt(this._baseSystemPromptOptions);
|
|
101
|
+
}
|
|
102
|
+
export function _refreshBaseSystemPromptFromActiveTools() {
|
|
103
|
+
this._baseSystemPrompt = this._rebuildSystemPrompt(this.getActiveToolNames());
|
|
104
|
+
this.agent.state.systemPrompt = this._baseSystemPrompt;
|
|
105
|
+
}
|
|
106
|
+
// =========================================================================
|
|
107
|
+
// Prompting
|
|
108
|
+
// =========================================================================
|
|
109
|
+
/**
|
|
110
|
+
* Send a prompt to the agent.
|
|
111
|
+
* - Handles extension commands (registered via pi.registerCommand) immediately, even during streaming
|
|
112
|
+
* - Expands file-based prompt templates by default
|
|
113
|
+
* - During streaming, queues via steer() or followUp() based on streamingBehavior option
|
|
114
|
+
* - Validates model and API key before sending (when not streaming)
|
|
115
|
+
* @throws Error if streaming and no streamingBehavior specified
|
|
116
|
+
* @throws Error if no model selected or no API key available (when not streaming)
|
|
117
|
+
*/
|
|
118
|
+
export const agentSessionStateMethods = {
|
|
119
|
+
getActiveToolNames,
|
|
120
|
+
getAllTools,
|
|
121
|
+
getToolDefinition,
|
|
122
|
+
setActiveToolsByName,
|
|
123
|
+
setScopedModels,
|
|
124
|
+
_normalizePromptSnippet,
|
|
125
|
+
_normalizePromptGuidelines,
|
|
126
|
+
_rebuildSystemPrompt,
|
|
127
|
+
_refreshBaseSystemPromptFromActiveTools,
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=agent-session-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-state.js","sourceRoot":"","sources":["../../src/core/agent-session-state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,UAAU,kBAAkB;IACjC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AAEH,MAAM,UAAU,WAAW;IAC1B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;QACtF,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;QAC7C,UAAU;KACV,CAAC,CAAC,CAAC;AACL,CAAC;AAGD,MAAM,UAAU,iBAAiB,CAAqB,IAAY;IACjE,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AAEH,MAAM,UAAU,oBAAoB,CAAqB,SAAmB;IAC3E,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,MAAM,cAAc,GAAa,EAAE,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,C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AC,cAAc,EAAE,CAAC,WAAW,CAAC;IAE7E,IAAI,CAAC,wBAAwB,GAAG;QAC/B,GAAG,EAAE,IAAI,CAAC,IAAI;QACd,aAAa,EAAE,IAAI,CAAC,KAAK;QACzB,qBAAqB,EAAE,IAAI,CAAC,aAAa;QACzC,MAAM,EAAE,YAAY;QACpB,YAAY,EAAE,kBAAkB;QAChC,YAAY,EAAE,kBAAkB;QAChC,kBAAkB;QAClB,aAAa,EAAE,cAAc;QAC7B,aAAa,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;QACxF,YAAY;QACZ,gBAAgB;KAChB,CAAC;IACF,OAAO,iBAAiB,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AACzD,CAAC;AAGD,MAAM,UAAU,uCAAuC;IACtD,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC9E,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC;AACxD,CAAC;AAED,4EAA4E;AAC5E,YAAY;AACZ,4EAA4E;AAE5E;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACvC,kBAAkB;IAClB,WAAW;IACX,iBAAiB;IACjB,oBAAoB;IACpB,eAAe;IACf,uBAAuB;IACvB,0BAA0B;IAC1B,oBAAoB;IACpB,uCAAuC;CACvC,CAAC","sourcesContent":["import type { AgentTool, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { ToolDefinition, ToolInfo } from \"./extensions/index.ts\";\nimport type { AgentSessionInternalSurface as AgentSession } from \"./agent-session-methods.ts\";\nimport { buildSystemPrompt } from \"./system-prompt.ts\";\n\nexport function getActiveToolNames(this: AgentSession): string[] {\n\treturn this.agent.state.tools.map((t) => t.name);\n}\n\n/**\n * Get all configured tools with name, description, parameter schema, and source metadata.\n */\n\nexport function getAllTools(this: AgentSession): ToolInfo[] {\n\treturn Array.from(this._toolDefinitions.values()).map(({ definition, sourceInfo }) => ({\n\t\tname: definition.name,\n\t\tdescription: definition.description,\n\t\tparameters: definition.parameters,\n\t\tpromptGuidelines: definition.promptGuidelines,\n\t\tsourceInfo,\n\t}));\n}\n\n\nexport function getToolDefinition(this: AgentSession, name: string): ToolDefinition | undefined {\n\treturn this._toolDefinitions.get(name)?.definition;\n}\n\n/**\n * Set active tools by name.\n * Only tools in the registry can be enabled. Unknown tool names are ignored.\n * Also rebuilds the system prompt to reflect the new tool set.\n * Changes take effect on the next agent turn.\n */\n\nexport function setActiveToolsByName(this: AgentSession, toolNames: string[]): void {\n\tconst tools: AgentTool[] = [];\n\tconst validToolNames: string[] = [];\n\tfor (const name of toolNames) {\n\t\tconst tool = this._toolRegistry.get(name);\n\t\tif (tool) {\n\t\t\ttools.push(tool);\n\t\t\tvalidToolNames.push(name);\n\t\t}\n\t}\n\tthis.agent.state.tools = tools;\n\n\t// Rebuild base system prompt with new tool set\n\tthis._baseSystemPrompt = this._rebuildSystemPrompt(validToolNames);\n\tthis.agent.state.systemPrompt = this._baseSystemPrompt;\n}\n\n/** Whether compaction or branch summarization is currently running */\n\nexport function setScopedModels(this: AgentSession, scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>): void {\n\tthis._scopedModels = scopedModels;\n}\n\n/** File-based prompt templates */\n\nexport function _normalizePromptSnippet(this: AgentSession, text: string | undefined): string | undefined {\n\tif (!text) return undefined;\n\tconst oneLine = text\n\t\t.replace(/[\\r\\n]+/g, \" \")\n\t\t.replace(/\\s+/g, \" \")\n\t\t.trim();\n\treturn oneLine.length > 0 ? oneLine : undefined;\n}\n\n\nexport function _normalizePromptGuidelines(this: AgentSession, guidelines: string[] | undefined): string[] {\n\tif (!guidelines || guidelines.length === 0) {\n\t\treturn [];\n\t}\n\n\tconst unique = new Set<string>();\n\tfor (const guideline of guidelines) {\n\t\tconst normalized = guideline.trim();\n\t\tif (normalized.length > 0) {\n\t\t\tunique.add(normalized);\n\t\t}\n\t}\n\treturn Array.from(unique);\n}\n\n\nexport function _rebuildSystemPrompt(this: AgentSession, toolNames: string[]): string {\n\tconst validToolNames = toolNames.filter((name) => this._toolRegistry.has(name));\n\tconst toolSnippets: Record<string, string> = {};\n\tconst promptGuidelines: string[] = [];\n\tfor (const name of validToolNames) {\n\t\tconst snippet = this._toolPromptSnippets.get(name);\n\t\tif (snippet) {\n\t\t\ttoolSnippets[name] = snippet;\n\t\t}\n\n\t\tconst toolGuidelines = this._toolPromptGuidelines.get(name);\n\t\tif (toolGuidelines) {\n\t\t\tpromptGuidelines.push(...toolGuidelines);\n\t\t}\n\t}\n\n\tconst loaderSystemPrompt = this._resourceLoader.getSystemPrompt();\n\tconst loaderAppendSystemPrompt = this._resourceLoader.getAppendSystemPrompt();\n\tconst appendSystemPrompt =\n\t\tloaderAppendSystemPrompt.length > 0 ? loaderAppendSystemPrompt.join(\"\\n\\n\") : undefined;\n\tconst loadedSkills = this._resourceLoader.getSkills().skills;\n\tconst loadedContextFiles = this._resourceLoader.getAgentsFiles().agentsFiles;\n\n\tthis._baseSystemPromptOptions = {\n\t\tcwd: this._cwd,\n\t\tselectedModel: this.model,\n\t\tselectedThinkingLevel: this.thinkingLevel,\n\t\tskills: loadedSkills,\n\t\tcontextFiles: loadedContextFiles,\n\t\tcustomPrompt: loaderSystemPrompt,\n\t\tappendSystemPrompt,\n\t\tselectedTools: validToolNames,\n\t\texcludedTools: this._excludedToolNames ? Array.from(this._excludedToolNames) : undefined,\n\t\ttoolSnippets,\n\t\tpromptGuidelines,\n\t};\n\treturn buildSystemPrompt(this._baseSystemPromptOptions);\n}\n\n\nexport function _refreshBaseSystemPromptFromActiveTools(this: AgentSession): void {\n\tthis._baseSystemPrompt = this._rebuildSystemPrompt(this.getActiveToolNames());\n\tthis.agent.state.systemPrompt = this._baseSystemPrompt;\n}\n\n// =========================================================================\n// Prompting\n// =========================================================================\n\n/**\n * Send a prompt to the agent.\n * - Handles extension commands (registered via pi.registerCommand) immediately, even during streaming\n * - Expands file-based prompt templates by default\n * - During streaming, queues via steer() or followUp() based on streamingBehavior option\n * - Validates model and API key before sending (when not streaming)\n * @throws Error if streaming and no streamingBehavior specified\n * @throws Error if no model selected or no API key available (when not streaming)\n */\n\nexport const agentSessionStateMethods = {\n\tgetActiveToolNames,\n\tgetAllTools,\n\tgetToolDefinition,\n\tsetActiveToolsByName,\n\tsetScopedModels,\n\t_normalizePromptSnippet,\n\t_normalizePromptGuidelines,\n\t_rebuildSystemPrompt,\n\t_refreshBaseSystemPromptFromActiveTools,\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AgentSessionInternalSurface as AgentSession } from "./agent-session-methods.ts";
|
|
2
|
+
export declare function _installAgentToolHooks(this: AgentSession): void;
|
|
3
|
+
/** Emit an event to all listeners */
|
|
4
|
+
export declare const agentSessionToolHooksMethods: {
|
|
5
|
+
_installAgentToolHooks: typeof _installAgentToolHooks;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=agent-session-tool-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-tool-hooks.d.ts","sourceRoot":"","sources":["../../src/core/agent-session-tool-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG9F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAkE/D;AAMD,qCAAqC;AAErC,eAAO,MAAM,4BAA4B;;CAExC,CAAC","sourcesContent":["import type { AgentSessionInternalSurface as AgentSession } from \"./agent-session-methods.ts\";\nimport { redirectOversizedToolResult } from \"./tools/oversized-tool-result.js\";\n\nexport function _installAgentToolHooks(this: AgentSession): void {\n\tthis.agent.beforeToolCall = async ({ toolCall, args }) => {\n\t\tconst runner = this._extensionRunner;\n\t\tif (!runner.hasHandlers(\"tool_call\")) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tawait this._agentEventQueue;\n\n\t\ttry {\n\t\t\treturn await runner.emitToolCall({\n\t\t\t\ttype: \"tool_call\",\n\t\t\t\ttoolName: toolCall.name,\n\t\t\t\ttoolCallId: toolCall.id,\n\t\t\t\tinput: args as Record<string, unknown>,\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tif (err instanceof Error) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tthrow new Error(`Extension failed, blocking execution: ${String(err)}`);\n\t\t}\n\t};\n\n\tthis.agent.afterToolCall = async ({ toolCall, args, result, isError }) => {\n\t\tconst runner = this._extensionRunner;\n\t\tconst hookResult = runner.hasHandlers(\"tool_result\")\n\t\t\t? await runner.emitToolResult({\n\t\t\t\t\ttype: \"tool_result\",\n\t\t\t\t\ttoolName: toolCall.name,\n\t\t\t\t\ttoolCallId: toolCall.id,\n\t\t\t\t\tinput: args as Record<string, unknown>,\n\t\t\t\t\tcontent: result.content,\n\t\t\t\t\tdetails: result.details,\n\t\t\t\t\tisError,\n\t\t\t\t})\n\t\t\t: undefined;\n\n\t\tconst extensionReplacement = hookResult\n\t\t\t? {\n\t\t\t\t\tcontent: hookResult.content,\n\t\t\t\t\tdetails: hookResult.details,\n\t\t\t\t\tisError: hookResult.isError ?? isError,\n\t\t\t\t}\n\t\t\t: undefined;\n\t\tconst finalResult = hookResult\n\t\t\t? {\n\t\t\t\t\tcontent: hookResult.content ?? result.content,\n\t\t\t\t\t// Preserve original details when an extension hook rewrites only content;\n\t\t\t\t\t// the redirect check only replaces model-visible content blocks.\n\t\t\t\t\tdetails: hookResult.details ?? result.details,\n\t\t\t\t}\n\t\t\t: result;\n\t\tconst finalIsError = hookResult?.isError ?? isError;\n\t\tconst redirectReplacement = await redirectOversizedToolResult({\n\t\t\ttoolName: toolCall.name,\n\t\t\ttoolCallId: toolCall.id,\n\t\t\tresult: finalResult,\n\t\t\tisError: finalIsError,\n\t\t\tsessionId: this.sessionManager.getSessionId(),\n\t\t\tsessionDir: this.sessionManager.getSessionDir() || undefined,\n\t\t\tmaxResultSizeChars: this.getToolDefinition(toolCall.name)?.maxResultSizeChars,\n\t\t});\n\n\t\treturn redirectReplacement ?? extensionReplacement;\n\t};\n}\n\n// =========================================================================\n// Event Subscription\n// =========================================================================\n\n/** Emit an event to all listeners */\n\nexport const agentSessionToolHooksMethods = {\n\t_installAgentToolHooks,\n};\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { redirectOversizedToolResult } from "./tools/oversized-tool-result.js";
|
|
2
|
+
export function _installAgentToolHooks() {
|
|
3
|
+
this.agent.beforeToolCall = async ({ toolCall, args }) => {
|
|
4
|
+
const runner = this._extensionRunner;
|
|
5
|
+
if (!runner.hasHandlers("tool_call")) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
await this._agentEventQueue;
|
|
9
|
+
try {
|
|
10
|
+
return await runner.emitToolCall({
|
|
11
|
+
type: "tool_call",
|
|
12
|
+
toolName: toolCall.name,
|
|
13
|
+
toolCallId: toolCall.id,
|
|
14
|
+
input: args,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
if (err instanceof Error) {
|
|
19
|
+
throw err;
|
|
20
|
+
}
|
|
21
|
+
throw new Error(`Extension failed, blocking execution: ${String(err)}`);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
this.agent.afterToolCall = async ({ toolCall, args, result, isError }) => {
|
|
25
|
+
const runner = this._extensionRunner;
|
|
26
|
+
const hookResult = runner.hasHandlers("tool_result")
|
|
27
|
+
? await runner.emitToolResult({
|
|
28
|
+
type: "tool_result",
|
|
29
|
+
toolName: toolCall.name,
|
|
30
|
+
toolCallId: toolCall.id,
|
|
31
|
+
input: args,
|
|
32
|
+
content: result.content,
|
|
33
|
+
details: result.details,
|
|
34
|
+
isError,
|
|
35
|
+
})
|
|
36
|
+
: undefined;
|
|
37
|
+
const extensionReplacement = hookResult
|
|
38
|
+
? {
|
|
39
|
+
content: hookResult.content,
|
|
40
|
+
details: hookResult.details,
|
|
41
|
+
isError: hookResult.isError ?? isError,
|
|
42
|
+
}
|
|
43
|
+
: undefined;
|
|
44
|
+
const finalResult = hookResult
|
|
45
|
+
? {
|
|
46
|
+
content: hookResult.content ?? result.content,
|
|
47
|
+
// Preserve original details when an extension hook rewrites only content;
|
|
48
|
+
// the redirect check only replaces model-visible content blocks.
|
|
49
|
+
details: hookResult.details ?? result.details,
|
|
50
|
+
}
|
|
51
|
+
: result;
|
|
52
|
+
const finalIsError = hookResult?.isError ?? isError;
|
|
53
|
+
const redirectReplacement = await redirectOversizedToolResult({
|
|
54
|
+
toolName: toolCall.name,
|
|
55
|
+
toolCallId: toolCall.id,
|
|
56
|
+
result: finalResult,
|
|
57
|
+
isError: finalIsError,
|
|
58
|
+
sessionId: this.sessionManager.getSessionId(),
|
|
59
|
+
sessionDir: this.sessionManager.getSessionDir() || undefined,
|
|
60
|
+
maxResultSizeChars: this.getToolDefinition(toolCall.name)?.maxResultSizeChars,
|
|
61
|
+
});
|
|
62
|
+
return redirectReplacement ?? extensionReplacement;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// =========================================================================
|
|
66
|
+
// Event Subscription
|
|
67
|
+
// =========================================================================
|
|
68
|
+
/** Emit an event to all listeners */
|
|
69
|
+
export const agentSessionToolHooksMethods = {
|
|
70
|
+
_installAgentToolHooks,
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=agent-session-tool-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-tool-hooks.js","sourceRoot":"","sources":["../../src/core/agent-session-tool-hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,M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BACvB,OAAO;aACP,CAAC;YACH,CAAC,CAAC,SAAS,CAAC;QAEb,MAAM,oBAAoB,GAAG,UAAU;YACtC,CAAC,CAAC;gBACA,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,OAAO;aACtC;YACF,CAAC,CAAC,SAAS,CAAC;QACb,MAAM,WAAW,GAAG,UAAU;YAC7B,CAAC,CAAC;gBACA,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO;gBAC7C,0EAA0E;gBAC1E,iEAAiE;gBACjE,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO;aAC7C;YACF,CAAC,CAAC,MAAM,CAAC;QACV,MAAM,YAAY,GAAG,UAAU,EAAE,OAAO,IAAI,OAAO,CAAC;QACpD,MAAM,mBAAmB,GAAG,MAAM,2BAA2B,CAAC;YAC7D,QAAQ,EAAE,QAAQ,CAAC,IAAI;YACvB,UAAU,EAAE,QAAQ,CAAC,EAAE;YACvB,MAAM,EAAE,WAAW;YACnB,OAAO,EAAE,YAAY;YACrB,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE;YAC7C,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,SAAS;YAC5D,kBAAkB,EAAE,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,kBAAkB;SAC7E,CAAC,CAAC;QAEH,OAAO,mBAAmB,IAAI,oBAAoB,CAAC;IACpD,CAAC,CAAC;AACH,CAAC;AAED,4EAA4E;AAC5E,qBAAqB;AACrB,4EAA4E;AAE5E,qCAAqC;AAErC,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC3C,sBAAsB;CACtB,CAAC","sourcesContent":["import type { AgentSessionInternalSurface as AgentSession } from \"./agent-session-methods.ts\";\nimport { redirectOversizedToolResult } from \"./tools/oversized-tool-result.js\";\n\nexport function _installAgentToolHooks(this: AgentSession): void {\n\tthis.agent.beforeToolCall = async ({ toolCall, args }) => {\n\t\tconst runner = this._extensionRunner;\n\t\tif (!runner.hasHandlers(\"tool_call\")) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tawait this._agentEventQueue;\n\n\t\ttry {\n\t\t\treturn await runner.emitToolCall({\n\t\t\t\ttype: \"tool_call\",\n\t\t\t\ttoolName: toolCall.name,\n\t\t\t\ttoolCallId: toolCall.id,\n\t\t\t\tinput: args as Record<string, unknown>,\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tif (err instanceof Error) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tthrow new Error(`Extension failed, blocking execution: ${String(err)}`);\n\t\t}\n\t};\n\n\tthis.agent.afterToolCall = async ({ toolCall, args, result, isError }) => {\n\t\tconst runner = this._extensionRunner;\n\t\tconst hookResult = runner.hasHandlers(\"tool_result\")\n\t\t\t? await runner.emitToolResult({\n\t\t\t\t\ttype: \"tool_result\",\n\t\t\t\t\ttoolName: toolCall.name,\n\t\t\t\t\ttoolCallId: toolCall.id,\n\t\t\t\t\tinput: args as Record<string, unknown>,\n\t\t\t\t\tcontent: result.content,\n\t\t\t\t\tdetails: result.details,\n\t\t\t\t\tisError,\n\t\t\t\t})\n\t\t\t: undefined;\n\n\t\tconst extensionReplacement = hookResult\n\t\t\t? {\n\t\t\t\t\tcontent: hookResult.content,\n\t\t\t\t\tdetails: hookResult.details,\n\t\t\t\t\tisError: hookResult.isError ?? isError,\n\t\t\t\t}\n\t\t\t: undefined;\n\t\tconst finalResult = hookResult\n\t\t\t? {\n\t\t\t\t\tcontent: hookResult.content ?? result.content,\n\t\t\t\t\t// Preserve original details when an extension hook rewrites only content;\n\t\t\t\t\t// the redirect check only replaces model-visible content blocks.\n\t\t\t\t\tdetails: hookResult.details ?? result.details,\n\t\t\t\t}\n\t\t\t: result;\n\t\tconst finalIsError = hookResult?.isError ?? isError;\n\t\tconst redirectReplacement = await redirectOversizedToolResult({\n\t\t\ttoolName: toolCall.name,\n\t\t\ttoolCallId: toolCall.id,\n\t\t\tresult: finalResult,\n\t\t\tisError: finalIsError,\n\t\t\tsessionId: this.sessionManager.getSessionId(),\n\t\t\tsessionDir: this.sessionManager.getSessionDir() || undefined,\n\t\t\tmaxResultSizeChars: this.getToolDefinition(toolCall.name)?.maxResultSizeChars,\n\t\t});\n\n\t\treturn redirectReplacement ?? extensionReplacement;\n\t};\n}\n\n// =========================================================================\n// Event Subscription\n// =========================================================================\n\n/** Emit an event to all listeners */\n\nexport const agentSessionToolHooksMethods = {\n\t_installAgentToolHooks,\n};\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AgentSessionInternalSurface as AgentSession } from "./agent-session-methods.ts";
|
|
2
|
+
export declare function _refreshToolRegistry(this: AgentSession, options?: {
|
|
3
|
+
activeToolNames?: string[];
|
|
4
|
+
includeAllExtensionTools?: boolean;
|
|
5
|
+
}): void;
|
|
6
|
+
export declare function _buildRuntime(this: AgentSession, options: {
|
|
7
|
+
activeToolNames?: string[];
|
|
8
|
+
flagValues?: Map<string, boolean | string>;
|
|
9
|
+
includeAllExtensionTools?: boolean;
|
|
10
|
+
}): void;
|
|
11
|
+
export declare const agentSessionToolRegistryMethods: {
|
|
12
|
+
_refreshToolRegistry: typeof _refreshToolRegistry;
|
|
13
|
+
_buildRuntime: typeof _buildRuntime;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=agent-session-tool-registry.d.ts.map
|