@caupulican/pi-adaptative 0.81.42 → 0.81.43
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 +37 -0
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/register-bedrock.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +52 -49
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +62 -57
- package/dist/bundled-resources/prompts/skillify.md +1 -1
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/fs.py +16 -19
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/search.py +12 -26
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/strings.py +15 -121
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/text.py +52 -79
- package/dist/bundled-resources/runtimes/pi-shell-engine/escapes.py +70 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/exec.py +110 -61
- package/dist/bundled-resources/runtimes/pi-shell-engine/main.py +106 -23
- package/dist/bundled-resources/runtimes/pi-shell-engine/paths.py +10 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/proc.py +12 -4
- package/dist/bundled-resources/runtimes/pi-shell-engine/shell_args.py +22 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/state.py +9 -2
- package/dist/bundled-resources/runtimes/pi-shell-engine/tokens.py +129 -259
- package/dist/bundled-resources/skills/authorized-web-security-audit/SKILL.md +187 -0
- package/dist/bundled-resources/skills/authorized-web-security-audit/references/assessment-contract.md +92 -0
- package/dist/bundled-resources/skills/deduplicate-by-evidence/SKILL.md +134 -0
- package/dist/bundled-resources/skills/evidence-gated-tdd/SKILL.md +93 -0
- package/dist/bundled-resources/skills/evidence-gated-tdd/references/evidence-model.md +27 -0
- package/dist/bundled-resources/skills/evidence-gated-tdd/references/security-scanners.md +24 -0
- package/dist/bundled-resources/skills/harness-self-adaptation/SKILL.md +4 -2
- package/dist/bundled-resources/skills/secure-agent-tool-surfaces/SKILL.md +217 -0
- package/dist/bundled-resources/skills/secure-agent-tool-surfaces/references/defensive-exploit-catalogue.md +175 -0
- package/dist/bundled-resources/skills/secure-agent-tool-surfaces/references/tool-boundary-checklist.md +87 -0
- package/dist/bundled-resources/skills/skill-architect/SKILL.md +2 -2
- package/dist/bundled-resources/skills/skill-creator/SKILL.md +188 -0
- package/dist/bundled-resources/skills/skill-creator/references/pi-skill-contract.md +73 -0
- package/dist/bundled-resources/skills/skill-creator/scripts/init-skill.mjs +142 -0
- package/dist/bundled-resources/skills/skill-creator/scripts/validate-skill.mjs +122 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +8 -8
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/initial-message.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/piped-stdin.d.ts +4 -0
- package/dist/cli/piped-stdin.d.ts.map +1 -0
- package/dist/cli/piped-stdin.js +13 -0
- package/dist/cli/piped-stdin.js.map +1 -0
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -14
- package/dist/config.js.map +1 -1
- package/dist/core/agent-directory-layout.d.ts.map +1 -1
- package/dist/core/agent-directory-layout.js.map +1 -1
- package/dist/core/agent-paths.d.ts.map +1 -1
- package/dist/core/agent-paths.js.map +1 -1
- package/dist/core/agent-session-contracts.d.ts +5 -9
- package/dist/core/agent-session-contracts.d.ts.map +1 -1
- package/dist/core/agent-session-contracts.js +1 -12
- package/dist/core/agent-session-contracts.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +10 -25
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +24 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +210 -237
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +13 -39
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/autonomy/approval-gate.d.ts.map +1 -1
- package/dist/core/autonomy/approval-gate.js.map +1 -1
- package/dist/core/autonomy/bounded-completion.d.ts.map +1 -1
- package/dist/core/autonomy/bounded-completion.js.map +1 -1
- package/dist/core/autonomy/contracts.d.ts.map +1 -1
- package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
- package/dist/core/autonomy/envelope-enforcement.js.map +1 -1
- package/dist/core/autonomy/evidence-finding-projection.d.ts +11 -0
- package/dist/core/autonomy/evidence-finding-projection.d.ts.map +1 -0
- package/dist/core/autonomy/evidence-finding-projection.js +37 -0
- package/dist/core/autonomy/evidence-finding-projection.js.map +1 -0
- package/dist/core/autonomy/foreground-envelope.d.ts.map +1 -1
- package/dist/core/autonomy/foreground-envelope.js.map +1 -1
- package/dist/core/autonomy/gates.d.ts.map +1 -1
- package/dist/core/autonomy/gates.js.map +1 -1
- package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -1
- package/dist/core/autonomy/lane-private-paths.js.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tracker.js +2 -3
- package/dist/core/autonomy/lane-tracker.js.map +1 -1
- package/dist/core/autonomy/path-scope.d.ts.map +1 -1
- package/dist/core/autonomy/path-scope.js.map +1 -1
- package/dist/core/autonomy/risk-assessment.d.ts.map +1 -1
- package/dist/core/autonomy/session-lane-record.d.ts.map +1 -1
- package/dist/core/autonomy/session-lane-record.js.map +1 -1
- package/dist/core/autonomy/status.d.ts.map +1 -1
- package/dist/core/autonomy/status.js.map +1 -1
- package/dist/core/autonomy/subagent-prompt.d.ts.map +1 -1
- package/dist/core/autonomy/subagent-prompt.js.map +1 -1
- package/dist/core/autonomy/telemetry-events.d.ts.map +1 -1
- package/dist/core/autonomy/telemetry-events.js.map +1 -1
- package/dist/core/autonomy-telemetry.d.ts.map +1 -1
- package/dist/core/autonomy-telemetry.js +2 -4
- package/dist/core/autonomy-telemetry.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +2 -15
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/background-tool-task-controller.d.ts +88 -0
- package/dist/core/background-tool-task-controller.d.ts.map +1 -0
- package/dist/core/background-tool-task-controller.js +470 -0
- package/dist/core/background-tool-task-controller.js.map +1 -0
- package/dist/core/bash-execution-controller.d.ts +1 -0
- package/dist/core/bash-execution-controller.d.ts.map +1 -1
- package/dist/core/bash-execution-controller.js +5 -4
- package/dist/core/bash-execution-controller.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/bedrock-sso-login.d.ts.map +1 -1
- package/dist/core/bedrock-sso-login.js.map +1 -1
- package/dist/core/billing-failover-controller.d.ts.map +1 -1
- package/dist/core/billing-failover-controller.js +3 -3
- package/dist/core/billing-failover-controller.js.map +1 -1
- package/dist/core/billing-failover.d.ts.map +1 -1
- package/dist/core/billing-failover.js.map +1 -1
- package/dist/core/capability-contract.d.ts.map +1 -1
- package/dist/core/catalog-manager.d.ts.map +1 -1
- package/dist/core/catalog-manager.js +0 -0
- package/dist/core/catalog-manager.js.map +1 -1
- package/dist/core/compaction-controller.d.ts +2 -0
- package/dist/core/compaction-controller.d.ts.map +1 -1
- package/dist/core/compaction-controller.js +21 -8
- package/dist/core/compaction-controller.js.map +1 -1
- package/dist/core/compaction-support.d.ts +8 -0
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js +0 -2
- package/dist/core/compaction-support.js.map +1 -1
- package/dist/core/context/artifact-retrieval.d.ts.map +1 -1
- package/dist/core/context/artifact-retrieval.js.map +1 -1
- package/dist/core/context/brain-curator.d.ts.map +1 -1
- package/dist/core/context/brain-curator.js +14 -33
- package/dist/core/context/brain-curator.js.map +1 -1
- package/dist/core/context/context-artifacts.d.ts.map +1 -1
- package/dist/core/context/context-artifacts.js +16 -24
- package/dist/core/context/context-artifacts.js.map +1 -1
- package/dist/core/context/context-audit.d.ts.map +1 -1
- package/dist/core/context/context-audit.js +3 -17
- package/dist/core/context/context-audit.js.map +1 -1
- package/dist/core/context/context-composition.d.ts.map +1 -1
- package/dist/core/context/context-composition.js.map +1 -1
- package/dist/core/context/context-item.d.ts.map +1 -1
- package/dist/core/context/context-item.js.map +1 -1
- package/dist/core/context/context-prompt-enforcement.d.ts.map +1 -1
- package/dist/core/context/context-prompt-enforcement.js +3 -16
- package/dist/core/context/context-prompt-enforcement.js.map +1 -1
- package/dist/core/context/context-prompt-policy.d.ts.map +1 -1
- package/dist/core/context/context-prompt-policy.js.map +1 -1
- package/dist/core/context/context-retention.d.ts.map +1 -1
- package/dist/core/context/context-retention.js.map +1 -1
- package/dist/core/context/context-store-retention.d.ts.map +1 -1
- package/dist/core/context/context-store-retention.js.map +1 -1
- package/dist/core/context/context-store.d.ts.map +1 -1
- package/dist/core/context/context-store.js.map +1 -1
- package/dist/core/context/context-tool-result.d.ts +4 -0
- package/dist/core/context/context-tool-result.d.ts.map +1 -0
- package/dist/core/context/context-tool-result.js +15 -0
- package/dist/core/context/context-tool-result.js.map +1 -0
- package/dist/core/context/current-work-memory.d.ts.map +1 -1
- package/dist/core/context/current-work-memory.js.map +1 -1
- package/dist/core/context/file-store-memory-provider.d.ts.map +1 -1
- package/dist/core/context/file-store-memory-provider.js +7 -28
- package/dist/core/context/file-store-memory-provider.js.map +1 -1
- package/dist/core/context/local-memory-search.d.ts +11 -0
- package/dist/core/context/local-memory-search.d.ts.map +1 -0
- package/dist/core/context/local-memory-search.js +37 -0
- package/dist/core/context/local-memory-search.js.map +1 -0
- package/dist/core/context/long-term-memory-trigger.d.ts.map +1 -1
- package/dist/core/context/long-term-memory-trigger.js.map +1 -1
- package/dist/core/context/memory-diagnostics.d.ts.map +1 -1
- package/dist/core/context/memory-diagnostics.js.map +1 -1
- package/dist/core/context/memory-index-store.d.ts.map +1 -1
- package/dist/core/context/memory-index-store.js.map +1 -1
- package/dist/core/context/memory-prompt-block.d.ts.map +1 -1
- package/dist/core/context/memory-prompt-block.js.map +1 -1
- package/dist/core/context/memory-prompt-budget.d.ts.map +1 -1
- package/dist/core/context/memory-prompt-budget.js.map +1 -1
- package/dist/core/context/memory-provider-contract.d.ts.map +1 -1
- package/dist/core/context/memory-provider-contract.js.map +1 -1
- package/dist/core/context/memory-retrieval.d.ts.map +1 -1
- package/dist/core/context/memory-retrieval.js.map +1 -1
- package/dist/core/context/memory-tier-composer.d.ts.map +1 -1
- package/dist/core/context/memory-tier-composer.js.map +1 -1
- package/dist/core/context/message-text.d.ts +7 -0
- package/dist/core/context/message-text.d.ts.map +1 -0
- package/dist/core/context/message-text.js +68 -0
- package/dist/core/context/message-text.js.map +1 -0
- package/dist/core/context/okf-memory-provider.d.ts.map +1 -1
- package/dist/core/context/okf-memory-provider.js +4 -30
- package/dist/core/context/okf-memory-provider.js.map +1 -1
- package/dist/core/context/okf-memory.d.ts.map +1 -1
- package/dist/core/context/okf-memory.js.map +1 -1
- package/dist/core/context/policy-engine.d.ts.map +1 -1
- package/dist/core/context/policy-engine.js.map +1 -1
- package/dist/core/context/policy-types.d.ts.map +1 -1
- package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -1
- package/dist/core/context/sqlite-runtime-index.js.map +1 -1
- package/dist/core/context/storage-authority.d.ts.map +1 -1
- package/dist/core/context/tool-output-packer.d.ts.map +1 -1
- package/dist/core/context/tool-output-packer.js.map +1 -1
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +14 -21
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +1 -3
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +64 -145
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/cost/cost-summary.d.ts.map +1 -1
- package/dist/core/cost/cost-summary.js.map +1 -1
- package/dist/core/cost/daily-usage.d.ts.map +1 -1
- package/dist/core/cost/daily-usage.js.map +1 -1
- package/dist/core/cost/session-usage.d.ts.map +1 -1
- package/dist/core/cost/session-usage.js.map +1 -1
- package/dist/core/cost-guard.d.ts.map +1 -1
- package/dist/core/cost-guard.js.map +1 -1
- package/dist/core/default-tool-surface.d.ts.map +1 -1
- package/dist/core/default-tool-surface.js +1 -0
- package/dist/core/default-tool-surface.js.map +1 -1
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/delegation/managed-lane-controller.d.ts.map +1 -1
- package/dist/core/delegation/managed-lane-controller.js +2 -6
- package/dist/core/delegation/managed-lane-controller.js.map +1 -1
- package/dist/core/delegation/session-worker-claim.d.ts.map +1 -1
- package/dist/core/delegation/session-worker-claim.js.map +1 -1
- package/dist/core/delegation/worker-action-journal.d.ts.map +1 -1
- package/dist/core/delegation/worker-action-journal.js +0 -4
- package/dist/core/delegation/worker-action-journal.js.map +1 -1
- package/dist/core/delegation/worker-actions.d.ts.map +1 -1
- package/dist/core/delegation/worker-actions.js.map +1 -1
- package/dist/core/delegation/worker-agent-control-coordinator.d.ts +1 -0
- package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-agent-control-coordinator.js +13 -15
- package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-agent-control.d.ts.map +1 -1
- package/dist/core/delegation/worker-agent-control.js +1 -4
- package/dist/core/delegation/worker-agent-control.js.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
- package/dist/core/delegation/worker-claim.d.ts.map +1 -1
- package/dist/core/delegation/worker-claim.js.map +1 -1
- package/dist/core/delegation/worker-conversation-store.d.ts.map +1 -1
- package/dist/core/delegation/worker-conversation-store.js +0 -2
- package/dist/core/delegation/worker-conversation-store.js.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.js +5 -14
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
- package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts.map +1 -1
- package/dist/core/delegation/worker-dispatch-scheduler.js +5 -6
- package/dist/core/delegation/worker-dispatch-scheduler.js.map +1 -1
- package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
- package/dist/core/delegation/worker-execution-policy.js.map +1 -1
- package/dist/core/delegation/worker-lane-projection.d.ts.map +1 -1
- package/dist/core/delegation/worker-lane-projection.js.map +1 -1
- package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -1
- package/dist/core/delegation/worker-lifecycle.js +0 -3
- package/dist/core/delegation/worker-lifecycle.js.map +1 -1
- package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-notification-coordinator.js +4 -5
- package/dist/core/delegation/worker-notification-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-process-owner.d.ts.map +1 -1
- package/dist/core/delegation/worker-process-owner.js.map +1 -1
- package/dist/core/delegation/worker-profile-resolver.d.ts.map +1 -1
- package/dist/core/delegation/worker-profile-resolver.js +1 -2
- package/dist/core/delegation/worker-profile-resolver.js.map +1 -1
- package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-recovery-coordinator.js +3 -4
- package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-resource-catalog.d.ts.map +1 -1
- package/dist/core/delegation/worker-resource-catalog.js.map +1 -1
- package/dist/core/delegation/worker-resource-materializer.d.ts.map +1 -1
- package/dist/core/delegation/worker-resource-materializer.js +1 -4
- package/dist/core/delegation/worker-resource-materializer.js.map +1 -1
- package/dist/core/delegation/worker-runner.d.ts +2 -4
- package/dist/core/delegation/worker-runner.d.ts.map +1 -1
- package/dist/core/delegation/worker-runner.js +6 -18
- package/dist/core/delegation/worker-runner.js.map +1 -1
- package/dist/core/delegation/worker-task-label.d.ts.map +1 -1
- package/dist/core/delegation/worker-task-label.js.map +1 -1
- package/dist/core/delegation/worker-terminal-finalizer.d.ts.map +1 -1
- package/dist/core/delegation/worker-terminal-finalizer.js.map +1 -1
- package/dist/core/delegation/worker-write-reservation-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-write-reservation-coordinator.js +1 -4
- package/dist/core/delegation/worker-write-reservation-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-write-reservation.d.ts.map +1 -1
- package/dist/core/delegation/worker-write-reservation.js +0 -2
- package/dist/core/delegation/worker-write-reservation.js.map +1 -1
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +26 -7
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js +21 -74
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +4 -0
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/session-tree-foundations.d.mts +67 -0
- package/dist/core/export-html/session-tree-foundations.mjs +313 -0
- package/dist/core/export-html/template.css +14 -41
- package/dist/core/export-html/template.html +3 -1
- package/dist/core/export-html/template.js +26 -435
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extension-import-authority.d.ts.map +1 -1
- package/dist/core/extension-import-authority.js.map +1 -1
- package/dist/core/extension-metadata.d.ts.map +1 -1
- package/dist/core/extension-metadata.js.map +1 -1
- package/dist/core/extensions/builtin.d.ts +17 -0
- package/dist/core/extensions/builtin.d.ts.map +1 -1
- package/dist/core/extensions/builtin.js +18 -54
- package/dist/core/extensions/builtin.js.map +1 -1
- package/dist/core/extensions/entry-resolution.d.ts +3 -0
- package/dist/core/extensions/entry-resolution.d.ts.map +1 -0
- package/dist/core/extensions/entry-resolution.js +17 -0
- package/dist/core/extensions/entry-resolution.js.map +1 -0
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +76 -21
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +41 -112
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/stale-context.d.ts.map +1 -1
- package/dist/core/extensions/storage.d.ts.map +1 -1
- package/dist/core/extensions/storage.js.map +1 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/failure-corpus.d.ts.map +1 -1
- package/dist/core/failure-corpus.js +2 -5
- package/dist/core/failure-corpus.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +27 -33
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
- package/dist/core/foreground-recovery-controller.js +0 -4
- package/dist/core/foreground-recovery-controller.js.map +1 -1
- package/dist/core/gateways/channel-provider.d.ts.map +1 -1
- package/dist/core/gateways/channel-provider.js +7 -5
- package/dist/core/gateways/channel-provider.js.map +1 -1
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +0 -1
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/compact-goal-context.d.ts.map +1 -1
- package/dist/core/goals/compact-goal-context.js +2 -4
- package/dist/core/goals/compact-goal-context.js.map +1 -1
- package/dist/core/goals/goal-acceptance.d.ts.map +1 -1
- package/dist/core/goals/goal-acceptance.js.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.js +1 -3
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
- package/dist/core/goals/goal-lifecycle.d.ts.map +1 -1
- package/dist/core/goals/goal-lifecycle.js.map +1 -1
- package/dist/core/goals/goal-record.d.ts.map +1 -1
- package/dist/core/goals/goal-record.js.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
- package/dist/core/goals/goal-session-controller.d.ts +15 -0
- package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-session-controller.js +27 -3
- package/dist/core/goals/goal-session-controller.js.map +1 -1
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +35 -51
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/goals/natural-language-goal.d.ts +9 -0
- package/dist/core/goals/natural-language-goal.d.ts.map +1 -0
- package/dist/core/goals/natural-language-goal.js +23 -0
- package/dist/core/goals/natural-language-goal.js.map +1 -0
- package/dist/core/goals/session-goal-state.d.ts.map +1 -1
- package/dist/core/goals/session-goal-state.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/human-input-controller.d.ts.map +1 -1
- package/dist/core/human-input-controller.js +2 -3
- package/dist/core/human-input-controller.js.map +1 -1
- package/dist/core/human-input.d.ts.map +1 -1
- package/dist/core/human-input.js.map +1 -1
- package/dist/core/improvement-loop.d.ts.map +1 -1
- package/dist/core/improvement-loop.js +11 -11
- package/dist/core/improvement-loop.js.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/install-telemetry.d.ts.map +1 -1
- package/dist/core/install-telemetry.js.map +1 -1
- package/dist/core/isolated-text-completion.d.ts +17 -0
- package/dist/core/isolated-text-completion.d.ts.map +1 -0
- package/dist/core/isolated-text-completion.js +15 -0
- package/dist/core/isolated-text-completion.js.map +1 -0
- package/dist/core/keybindings.d.ts +47 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +12 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/learning/learning-audit.d.ts.map +1 -1
- package/dist/core/learning/learning-audit.js.map +1 -1
- package/dist/core/learning/learning-gate.d.ts.map +1 -1
- package/dist/core/learning/learning-gate.js.map +1 -1
- package/dist/core/learning/observation-store.d.ts.map +1 -1
- package/dist/core/learning/observation-store.js +0 -2
- package/dist/core/learning/observation-store.js.map +1 -1
- package/dist/core/learning/reflection-engine.d.ts +1 -1
- package/dist/core/learning/reflection-engine.d.ts.map +1 -1
- package/dist/core/learning/reflection-engine.js +3 -0
- package/dist/core/learning/reflection-engine.js.map +1 -1
- package/dist/core/learning/reflection-turn-analysis.d.ts +20 -0
- package/dist/core/learning/reflection-turn-analysis.d.ts.map +1 -0
- package/dist/core/learning/reflection-turn-analysis.js +136 -0
- package/dist/core/learning/reflection-turn-analysis.js.map +1 -0
- package/dist/core/learning/session-learning-decision.d.ts.map +1 -1
- package/dist/core/learning/session-learning-decision.js.map +1 -1
- package/dist/core/learning/skill-curator.d.ts.map +1 -1
- package/dist/core/learning/skill-curator.js +0 -3
- package/dist/core/learning/skill-curator.js.map +1 -1
- package/dist/core/local-runtime-controller.d.ts +39 -0
- package/dist/core/local-runtime-controller.d.ts.map +1 -1
- package/dist/core/local-runtime-controller.js +41 -62
- package/dist/core/local-runtime-controller.js.map +1 -1
- package/dist/core/memory/effectiveness-tracker.d.ts.map +1 -1
- package/dist/core/memory/effectiveness-tracker.js +4 -2
- package/dist/core/memory/effectiveness-tracker.js.map +1 -1
- package/dist/core/memory/memory-manager.d.ts.map +1 -1
- package/dist/core/memory/memory-manager.js +7 -7
- package/dist/core/memory/memory-manager.js.map +1 -1
- package/dist/core/memory/memory-provider.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.d.ts +7 -0
- package/dist/core/memory/providers/file-store.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.js +48 -13
- package/dist/core/memory/providers/file-store.js.map +1 -1
- package/dist/core/memory/providers/transcript-recall-worker-protocol.d.ts +47 -0
- package/dist/core/memory/providers/transcript-recall-worker-protocol.d.ts.map +1 -0
- package/dist/core/memory/providers/transcript-recall-worker-protocol.js +50 -0
- package/dist/core/memory/providers/transcript-recall-worker-protocol.js.map +1 -0
- package/dist/core/memory/providers/transcript-recall-worker.d.ts +2 -0
- package/dist/core/memory/providers/transcript-recall-worker.d.ts.map +1 -0
- package/dist/core/memory/providers/transcript-recall-worker.js +143 -0
- package/dist/core/memory/providers/transcript-recall-worker.js.map +1 -0
- package/dist/core/memory/providers/transcript-recall.d.ts +24 -13
- package/dist/core/memory/providers/transcript-recall.d.ts.map +1 -1
- package/dist/core/memory/providers/transcript-recall.js +143 -141
- package/dist/core/memory/providers/transcript-recall.js.map +1 -1
- package/dist/core/memory/providers/user-memory-archive.d.ts +39 -0
- package/dist/core/memory/providers/user-memory-archive.d.ts.map +1 -0
- package/dist/core/memory/providers/user-memory-archive.js +258 -0
- package/dist/core/memory/providers/user-memory-archive.js.map +1 -0
- package/dist/core/memory/transcript-index.d.ts.map +1 -1
- package/dist/core/memory/transcript-index.js +1 -1
- package/dist/core/memory/transcript-index.js.map +1 -1
- package/dist/core/memory-controller.d.ts +9 -0
- package/dist/core/memory-controller.d.ts.map +1 -1
- package/dist/core/memory-controller.js +57 -16
- package/dist/core/memory-controller.js.map +1 -1
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-output-json.d.ts +10 -0
- package/dist/core/model-output-json.d.ts.map +1 -0
- package/dist/core/model-output-json.js +43 -0
- package/dist/core/model-output-json.js.map +1 -0
- package/dist/core/model-registry.d.ts +8 -8
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +29 -52
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-router/config-diagnostics.d.ts.map +1 -1
- package/dist/core/model-router/config-diagnostics.js.map +1 -1
- package/dist/core/model-router/executor-route.d.ts.map +1 -1
- package/dist/core/model-router/executor-route.js.map +1 -1
- package/dist/core/model-router/fitness-gate.d.ts.map +1 -1
- package/dist/core/model-router/fitness-gate.js.map +1 -1
- package/dist/core/model-router/intent-classifier.d.ts.map +1 -1
- package/dist/core/model-router/route-judge.d.ts.map +1 -1
- package/dist/core/model-router/route-judge.js +18 -36
- package/dist/core/model-router/route-judge.js.map +1 -1
- package/dist/core/model-router/session-buffer.d.ts.map +1 -1
- package/dist/core/model-router/session-buffer.js.map +1 -1
- package/dist/core/model-router/status.d.ts.map +1 -1
- package/dist/core/model-router/status.js.map +1 -1
- package/dist/core/model-router/tool-escalation.d.ts.map +1 -1
- package/dist/core/model-router/tool-escalation.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +1 -0
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +25 -56
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/model-selection-controller.d.ts +10 -0
- package/dist/core/model-selection-controller.d.ts.map +1 -1
- package/dist/core/model-selection-controller.js +0 -1
- package/dist/core/model-selection-controller.js.map +1 -1
- package/dist/core/model-tool-protocol.d.ts.map +1 -1
- package/dist/core/model-tool-protocol.js.map +1 -1
- package/dist/core/models/adaptation-store.d.ts.map +1 -1
- package/dist/core/models/adaptation-store.js +0 -1
- package/dist/core/models/adaptation-store.js.map +1 -1
- package/dist/core/models/context-sizing.d.ts.map +1 -1
- package/dist/core/models/context-sizing.js.map +1 -1
- package/dist/core/models/default-model-suggestions.d.ts.map +1 -1
- package/dist/core/models/default-model-suggestions.js.map +1 -1
- package/dist/core/models/fitness-store.d.ts.map +1 -1
- package/dist/core/models/fitness-store.js +0 -1
- package/dist/core/models/fitness-store.js.map +1 -1
- package/dist/core/models/host-state-store.d.ts.map +1 -1
- package/dist/core/models/host-state-store.js +1 -6
- package/dist/core/models/host-state-store.js.map +1 -1
- package/dist/core/models/llamacpp-runtime.d.ts +4 -19
- package/dist/core/models/llamacpp-runtime.d.ts.map +1 -1
- package/dist/core/models/llamacpp-runtime.js +32 -136
- package/dist/core/models/llamacpp-runtime.js.map +1 -1
- package/dist/core/models/local-registration.d.ts.map +1 -1
- package/dist/core/models/local-registration.js +82 -115
- package/dist/core/models/local-registration.js.map +1 -1
- package/dist/core/models/local-runtime.d.ts +12 -18
- package/dist/core/models/local-runtime.d.ts.map +1 -1
- package/dist/core/models/local-runtime.js +60 -204
- package/dist/core/models/local-runtime.js.map +1 -1
- package/dist/core/models/model-endpoint.d.ts.map +1 -1
- package/dist/core/models/model-endpoint.js.map +1 -1
- package/dist/core/models/model-ref.d.ts.map +1 -1
- package/dist/core/models/model-ref.js.map +1 -1
- package/dist/core/models/needle-runtime.d.ts +7 -3
- package/dist/core/models/needle-runtime.d.ts.map +1 -1
- package/dist/core/models/needle-runtime.js +16 -92
- package/dist/core/models/needle-runtime.js.map +1 -1
- package/dist/core/models/perf-profile.d.ts +1 -1
- package/dist/core/models/perf-profile.d.ts.map +1 -1
- package/dist/core/models/perf-profile.js +6 -13
- package/dist/core/models/perf-profile.js.map +1 -1
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts.map +1 -1
- package/dist/core/models/prism-llamacpp-lifecycle.js.map +1 -1
- package/dist/core/models/runtime-arbiter.d.ts.map +1 -1
- package/dist/core/models/runtime-arbiter.js +3 -15
- package/dist/core/models/runtime-arbiter.js.map +1 -1
- package/dist/core/models/runtime-process.d.ts +100 -0
- package/dist/core/models/runtime-process.d.ts.map +1 -0
- package/dist/core/models/runtime-process.js +183 -0
- package/dist/core/models/runtime-process.js.map +1 -0
- package/dist/core/orchestration/agent-resume.d.ts.map +1 -1
- package/dist/core/orchestration/agent-resume.js.map +1 -1
- package/dist/core/orchestration/attempt-usage.d.ts.map +1 -1
- package/dist/core/orchestration/attempt-usage.js.map +1 -1
- package/dist/core/orchestration/capability-gateway.d.ts.map +1 -1
- package/dist/core/orchestration/capability-gateway.js +0 -14
- package/dist/core/orchestration/capability-gateway.js.map +1 -1
- package/dist/core/orchestration/contracts.d.ts.map +1 -1
- package/dist/core/orchestration/contracts.js.map +1 -1
- package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -1
- package/dist/core/orchestration/delegation-ledger.js +0 -2
- package/dist/core/orchestration/delegation-ledger.js.map +1 -1
- package/dist/core/orchestration/event-store.d.ts.map +1 -1
- package/dist/core/orchestration/event-store.js +1 -14
- package/dist/core/orchestration/event-store.js.map +1 -1
- package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -1
- package/dist/core/orchestration/lane-tool-manifests.js.map +1 -1
- package/dist/core/orchestration/model-binding.d.ts.map +1 -1
- package/dist/core/orchestration/model-binding.js.map +1 -1
- package/dist/core/orchestration/policy-compiler.d.ts.map +1 -1
- package/dist/core/orchestration/policy-compiler.js +0 -3
- package/dist/core/orchestration/policy-compiler.js.map +1 -1
- package/dist/core/orchestration/policy-gate.d.ts.map +1 -1
- package/dist/core/orchestration/policy-gate.js +0 -2
- package/dist/core/orchestration/policy-gate.js.map +1 -1
- package/dist/core/orchestration/profile-registry.d.ts.map +1 -1
- package/dist/core/orchestration/profile-registry.js +1 -1
- package/dist/core/orchestration/profile-registry.js.map +1 -1
- package/dist/core/orchestration/profile-store.d.ts.map +1 -1
- package/dist/core/orchestration/profile-store.js +0 -3
- package/dist/core/orchestration/profile-store.js.map +1 -1
- package/dist/core/orchestration/risk-budget.d.ts.map +1 -1
- package/dist/core/orchestration/risk-budget.js.map +1 -1
- package/dist/core/orchestration/task-runtime.d.ts +1 -0
- package/dist/core/orchestration/task-runtime.d.ts.map +1 -1
- package/dist/core/orchestration/task-runtime.js +27 -42
- package/dist/core/orchestration/task-runtime.js.map +1 -1
- package/dist/core/orchestration/work-state-projection.d.ts.map +1 -1
- package/dist/core/orchestration/work-state-projection.js.map +1 -1
- package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
- package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
- package/dist/core/orchestration/worker-result-adapter.d.ts.map +1 -1
- package/dist/core/orchestration/worker-result-adapter.js.map +1 -1
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/package-manager.d.ts +3 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +88 -353
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/process-identity.d.ts.map +1 -1
- package/dist/core/process-identity.js.map +1 -1
- package/dist/core/process-liveness.d.ts +3 -0
- package/dist/core/process-liveness.d.ts.map +1 -0
- package/dist/core/process-liveness.js +17 -0
- package/dist/core/process-liveness.js.map +1 -0
- package/dist/core/process-matrix/codes.d.ts.map +1 -1
- package/dist/core/process-matrix/resume-launcher.d.ts.map +1 -1
- package/dist/core/process-matrix/resume-launcher.js.map +1 -1
- package/dist/core/process-matrix/runtime.d.ts.map +1 -1
- package/dist/core/process-matrix/runtime.js.map +1 -1
- package/dist/core/process-matrix/store.d.ts.map +1 -1
- package/dist/core/process-matrix/store.js.map +1 -1
- package/dist/core/process-matrix/supervisor.d.ts.map +1 -1
- package/dist/core/process-matrix/supervisor.js.map +1 -1
- package/dist/core/profile-filter-controller.d.ts.map +1 -1
- package/dist/core/profile-filter-controller.js +7 -8
- package/dist/core/profile-filter-controller.js.map +1 -1
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +1 -2
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/profile-resource-selection.d.ts.map +1 -1
- package/dist/core/profile-resource-selection.js +18 -59
- package/dist/core/profile-resource-selection.js.map +1 -1
- package/dist/core/prompt-markup.d.ts +3 -0
- package/dist/core/prompt-markup.d.ts.map +1 -0
- package/dist/core/prompt-markup.js +7 -0
- package/dist/core/prompt-markup.js.map +1 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +13 -39
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/python-runtime.d.ts.map +1 -1
- package/dist/core/python-runtime.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +22 -1
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +143 -25
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/reload-blockers.d.ts +2 -1
- package/dist/core/reload-blockers.d.ts.map +1 -1
- package/dist/core/reload-blockers.js +4 -14
- package/dist/core/reload-blockers.js.map +1 -1
- package/dist/core/request-auth.d.ts.map +1 -1
- package/dist/core/request-auth.js.map +1 -1
- package/dist/core/research/automata-provider.d.ts.map +1 -1
- package/dist/core/research/automata-provider.js.map +1 -1
- package/dist/core/research/evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/evidence-bundle.js.map +1 -1
- package/dist/core/research/lane-model-resolver.d.ts.map +1 -1
- package/dist/core/research/lane-model-resolver.js +0 -1
- package/dist/core/research/lane-model-resolver.js.map +1 -1
- package/dist/core/research/model-fitness-controller.d.ts.map +1 -1
- package/dist/core/research/model-fitness-controller.js +17 -33
- package/dist/core/research/model-fitness-controller.js.map +1 -1
- package/dist/core/research/model-fitness.d.ts.map +1 -1
- package/dist/core/research/model-fitness.js +4 -25
- package/dist/core/research/model-fitness.js.map +1 -1
- package/dist/core/research/research-gate.d.ts.map +1 -1
- package/dist/core/research/research-gate.js.map +1 -1
- package/dist/core/research/research-lane-controller.d.ts.map +1 -1
- package/dist/core/research/research-lane-controller.js +5 -10
- package/dist/core/research/research-lane-controller.js.map +1 -1
- package/dist/core/research/research-runner.d.ts +2 -4
- package/dist/core/research/research-runner.d.ts.map +1 -1
- package/dist/core/research/research-runner.js +17 -48
- package/dist/core/research/research-runner.js.map +1 -1
- package/dist/core/research/session-evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/session-evidence-bundle.js.map +1 -1
- package/dist/core/research/workspace-collector.d.ts.map +1 -1
- package/dist/core/research/workspace-collector.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-ignore.d.ts +6 -0
- package/dist/core/resource-ignore.d.ts.map +1 -0
- package/dist/core/resource-ignore.js +44 -0
- package/dist/core/resource-ignore.js.map +1 -0
- package/dist/core/resource-loader.d.ts +0 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +52 -187
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/resource-profile-blocks.d.ts +3 -1
- package/dist/core/resource-profile-blocks.d.ts.map +1 -1
- package/dist/core/resource-profile-blocks.js +8 -5
- package/dist/core/resource-profile-blocks.js.map +1 -1
- package/dist/core/resource-profile-equality.d.ts.map +1 -1
- package/dist/core/resource-profile-equality.js.map +1 -1
- package/dist/core/resource-traversal.d.ts +43 -0
- package/dist/core/resource-traversal.d.ts.map +1 -0
- package/dist/core/resource-traversal.js +84 -0
- package/dist/core/resource-traversal.js.map +1 -0
- package/dist/core/risk-classifier.d.ts.map +1 -1
- package/dist/core/risk-classifier.js.map +1 -1
- package/dist/core/runtime-builder.d.ts +4 -1
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +25 -50
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/scout-controller.d.ts.map +1 -1
- package/dist/core/scout-controller.js +0 -1
- package/dist/core/scout-controller.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -1
- package/dist/core/secrets/credential-exposure-guard.js +70 -44
- package/dist/core/secrets/credential-exposure-guard.js.map +1 -1
- package/dist/core/secrets/secret-dotenv.d.ts.map +1 -1
- package/dist/core/secrets/secret-dotenv.js +0 -1
- package/dist/core/secrets/secret-dotenv.js.map +1 -1
- package/dist/core/secrets/secret-vault-format.d.ts.map +1 -1
- package/dist/core/secrets/secret-vault-format.js +0 -1
- package/dist/core/secrets/secret-vault-format.js.map +1 -1
- package/dist/core/secrets/secret-vault.d.ts.map +1 -1
- package/dist/core/secrets/secret-vault.js +2 -10
- package/dist/core/secrets/secret-vault.js.map +1 -1
- package/dist/core/security/secret-text.d.ts.map +1 -1
- package/dist/core/security/secret-text.js.map +1 -1
- package/dist/core/security/untrusted-boundary.d.ts.map +1 -1
- package/dist/core/security/untrusted-boundary.js.map +1 -1
- package/dist/core/session-analytics.d.ts.map +1 -1
- package/dist/core/session-analytics.js +18 -50
- package/dist/core/session-analytics.js.map +1 -1
- package/dist/core/session-artifact-bundle.d.ts.map +1 -1
- package/dist/core/session-artifact-bundle.js.map +1 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +0 -1
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-entry-index.d.ts +8 -0
- package/dist/core/session-entry-index.d.ts.map +1 -0
- package/dist/core/session-entry-index.js +16 -0
- package/dist/core/session-entry-index.js.map +1 -0
- package/dist/core/session-image-store.d.ts.map +1 -1
- package/dist/core/session-image-store.js +0 -3
- package/dist/core/session-image-store.js.map +1 -1
- package/dist/core/session-jsonl-writer.d.ts +3 -0
- package/dist/core/session-jsonl-writer.d.ts.map +1 -0
- package/dist/core/session-jsonl-writer.js +38 -0
- package/dist/core/session-jsonl-writer.js.map +1 -0
- package/dist/core/session-manager-factory.d.ts.map +1 -1
- package/dist/core/session-manager-factory.js.map +1 -1
- package/dist/core/session-role.d.ts.map +1 -1
- package/dist/core/session-role.js.map +1 -1
- package/dist/core/session-snapshot.d.ts.map +1 -1
- package/dist/core/session-snapshot.js.map +1 -1
- package/dist/core/session-supervision-runtime.d.ts.map +1 -1
- package/dist/core/session-supervision-runtime.js +1 -4
- package/dist/core/session-supervision-runtime.js.map +1 -1
- package/dist/core/session-tree-navigator.d.ts.map +1 -1
- package/dist/core/session-tree-navigator.js +0 -1
- package/dist/core/session-tree-navigator.js.map +1 -1
- package/dist/core/settings-manager.d.ts +2 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +64 -162
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skill-block.d.mts +8 -0
- package/dist/core/skill-block.mjs +52 -0
- package/dist/core/skill-discovery.d.ts +5 -0
- package/dist/core/skill-discovery.d.ts.map +1 -0
- package/dist/core/skill-discovery.js +34 -0
- package/dist/core/skill-discovery.js.map +1 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +23 -159
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/spawned-usage.d.ts +21 -0
- package/dist/core/spawned-usage.d.ts.map +1 -0
- package/dist/core/spawned-usage.js +29 -0
- package/dist/core/spawned-usage.js.map +1 -0
- package/dist/core/system-prompt-builder.d.ts +4 -0
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.js +15 -8
- package/dist/core/system-prompt-builder.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +52 -35
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/session-task-state.d.ts.map +1 -1
- package/dist/core/tasks/session-task-state.js.map +1 -1
- package/dist/core/tasks/task-command.d.ts.map +1 -1
- package/dist/core/tasks/task-command.js.map +1 -1
- package/dist/core/tasks/task-contract-monitor.d.ts.map +1 -1
- package/dist/core/tasks/task-contract-monitor.js.map +1 -1
- package/dist/core/tasks/task-projection.d.ts.map +1 -1
- package/dist/core/tasks/task-projection.js.map +1 -1
- package/dist/core/tasks/task-state.d.ts.map +1 -1
- package/dist/core/tasks/task-state.js.map +1 -1
- package/dist/core/text-preview.d.ts +4 -0
- package/dist/core/text-preview.d.ts.map +1 -0
- package/dist/core/text-preview.js +33 -0
- package/dist/core/text-preview.js.map +1 -0
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tool-capability-policy.d.ts.map +1 -1
- package/dist/core/tool-capability-policy.js.map +1 -1
- package/dist/core/tool-gate-controller.d.ts.map +1 -1
- package/dist/core/tool-gate-controller.js +86 -87
- package/dist/core/tool-gate-controller.js.map +1 -1
- package/dist/core/tool-protocol-controller.d.ts +4 -1
- package/dist/core/tool-protocol-controller.d.ts.map +1 -1
- package/dist/core/tool-protocol-controller.js +19 -23
- package/dist/core/tool-protocol-controller.js.map +1 -1
- package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
- package/dist/core/tool-recovery-log-records.js.map +1 -1
- package/dist/core/tool-recovery-log-worker.d.ts.map +1 -1
- package/dist/core/tool-recovery-log-worker.js.map +1 -1
- package/dist/core/tool-recovery-logger.d.ts.map +1 -1
- package/dist/core/tool-recovery-logger.js +12 -24
- package/dist/core/tool-recovery-logger.js.map +1 -1
- package/dist/core/tool-recovery-stats.d.ts.map +1 -1
- package/dist/core/tool-recovery-stats.js +16 -22
- package/dist/core/tool-recovery-stats.js.map +1 -1
- package/dist/core/tool-repair-health.d.ts.map +1 -1
- package/dist/core/tool-repair-health.js.map +1 -1
- package/dist/core/tool-repair-settings.d.ts.map +1 -1
- package/dist/core/tool-repair-settings.js.map +1 -1
- package/dist/core/tool-selection/expected-utility.d.ts.map +1 -1
- package/dist/core/tool-selection/expected-utility.js.map +1 -1
- package/dist/core/tool-selection/promotion.d.ts.map +1 -1
- package/dist/core/tool-selection/promotion.js.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.d.ts +2 -0
- package/dist/core/tool-selection/tool-performance-store.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.js +49 -7
- package/dist/core/tool-selection/tool-performance-store.js.map +1 -1
- package/dist/core/tool-selection/tool-phase-timing.d.ts +19 -0
- package/dist/core/tool-selection/tool-phase-timing.d.ts.map +1 -0
- package/dist/core/tool-selection/tool-phase-timing.js +63 -0
- package/dist/core/tool-selection/tool-phase-timing.js.map +1 -0
- package/dist/core/tool-selection/tool-selection-controller.d.ts +2 -5
- package/dist/core/tool-selection/tool-selection-controller.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-selection-controller.js +50 -30
- package/dist/core/tool-selection/tool-selection-controller.js.map +1 -1
- package/dist/core/toolkit/reflex-interpreter.d.ts +16 -0
- package/dist/core/toolkit/reflex-interpreter.d.ts.map +1 -1
- package/dist/core/toolkit/reflex-interpreter.js +21 -0
- package/dist/core/toolkit/reflex-interpreter.js.map +1 -1
- package/dist/core/toolkit/script-registry.d.ts.map +1 -1
- package/dist/core/toolkit/script-registry.js.map +1 -1
- package/dist/core/toolkit/script-runner.d.ts.map +1 -1
- package/dist/core/toolkit/script-runner.js.map +1 -1
- package/dist/core/tools/artifact-retrieve.d.ts.map +1 -1
- package/dist/core/tools/artifact-retrieve.js.map +1 -1
- package/dist/core/tools/ask-question.d.ts +2 -3
- package/dist/core/tools/ask-question.d.ts.map +1 -1
- package/dist/core/tools/ask-question.js +14 -40
- package/dist/core/tools/ask-question.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +83 -30
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/context-scout.d.ts.map +1 -1
- package/dist/core/tools/context-scout.js.map +1 -1
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +9 -7
- package/dist/core/tools/delegate-status.js.map +1 -1
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +6 -6
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/extensionify.d.ts.map +1 -1
- package/dist/core/tools/extensionify.js.map +1 -1
- package/dist/core/tools/fff-search-backend.d.ts +19 -0
- package/dist/core/tools/fff-search-backend.d.ts.map +1 -1
- package/dist/core/tools/fff-search-backend.js +28 -2
- package/dist/core/tools/fff-search-backend.js.map +1 -1
- package/dist/core/tools/file-encoding-policy.d.ts.map +1 -1
- package/dist/core/tools/file-encoding-policy.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.d.ts +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +44 -108
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/git-filter.d.ts.map +1 -1
- package/dist/core/tools/git-filter.js.map +1 -1
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +7 -7
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/grep.d.ts +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +42 -102
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +20 -36
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/model-fitness.d.ts.map +1 -1
- package/dist/core/tools/model-fitness.js.map +1 -1
- package/dist/core/tools/orchestration-panel.d.ts +5 -0
- package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
- package/dist/core/tools/orchestration-panel.js +5 -5
- package/dist/core/tools/orchestration-panel.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +2 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +24 -36
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/persistent-process-coordinator.d.ts +31 -0
- package/dist/core/tools/persistent-process-coordinator.d.ts.map +1 -0
- package/dist/core/tools/persistent-process-coordinator.js +123 -0
- package/dist/core/tools/persistent-process-coordinator.js.map +1 -0
- package/dist/core/tools/python.d.ts.map +1 -1
- package/dist/core/tools/python.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +14 -13
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +29 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +31 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/run-process.d.ts.map +1 -1
- package/dist/core/tools/run-process.js.map +1 -1
- package/dist/core/tools/run-toolkit-script.d.ts.map +1 -1
- package/dist/core/tools/run-toolkit-script.js.map +1 -1
- package/dist/core/tools/search-command-guard.d.ts +10 -0
- package/dist/core/tools/search-command-guard.d.ts.map +1 -1
- package/dist/core/tools/search-command-guard.js +118 -31
- package/dist/core/tools/search-command-guard.js.map +1 -1
- package/dist/core/tools/search-router.d.ts.map +1 -1
- package/dist/core/tools/search-router.js.map +1 -1
- package/dist/core/tools/search-tool-runtime.d.ts +19 -0
- package/dist/core/tools/search-tool-runtime.d.ts.map +1 -0
- package/dist/core/tools/search-tool-runtime.js +12 -0
- package/dist/core/tools/search-tool-runtime.js.map +1 -0
- package/dist/core/tools/secret-store.d.ts.map +1 -1
- package/dist/core/tools/secret-store.js.map +1 -1
- package/dist/core/tools/shell-command-parser.d.ts.map +1 -1
- package/dist/core/tools/shell-command-parser.js.map +1 -1
- package/dist/core/tools/shell-contract-router.d.ts.map +1 -1
- package/dist/core/tools/shell-contract-router.js +4 -1
- package/dist/core/tools/shell-contract-router.js.map +1 -1
- package/dist/core/tools/shell-execution-session.d.ts +4 -0
- package/dist/core/tools/shell-execution-session.d.ts.map +1 -0
- package/dist/core/tools/shell-execution-session.js +11 -0
- package/dist/core/tools/shell-execution-session.js.map +1 -0
- package/dist/core/tools/shell-output-projection.d.ts +49 -0
- package/dist/core/tools/shell-output-projection.d.ts.map +1 -0
- package/dist/core/tools/shell-output-projection.js +381 -0
- package/dist/core/tools/shell-output-projection.js.map +1 -0
- package/dist/core/tools/shell-session.d.ts +2 -13
- package/dist/core/tools/shell-session.d.ts.map +1 -1
- package/dist/core/tools/shell-session.js +36 -136
- package/dist/core/tools/shell-session.js.map +1 -1
- package/dist/core/tools/skill-audit.d.ts.map +1 -1
- package/dist/core/tools/skill-audit.js.map +1 -1
- package/dist/core/tools/skillify.d.ts.map +1 -1
- package/dist/core/tools/skillify.js.map +1 -1
- package/dist/core/tools/task-steps.d.ts +8 -8
- package/dist/core/tools/task-steps.d.ts.map +1 -1
- package/dist/core/tools/task-steps.js +17 -18
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
- package/dist/core/tools/tmux-dispatch.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/tool-task.d.ts +23 -0
- package/dist/core/tools/tool-task.d.ts.map +1 -0
- package/dist/core/tools/tool-task.js +93 -0
- package/dist/core/tools/tool-task.js.map +1 -0
- package/dist/core/tools/windows-shell-engine.d.ts +17 -11
- package/dist/core/tools/windows-shell-engine.d.ts.map +1 -1
- package/dist/core/tools/windows-shell-engine.js +339 -117
- package/dist/core/tools/windows-shell-engine.js.map +1 -1
- package/dist/core/tools/windows-shell-state.d.ts.map +1 -1
- package/dist/core/tools/windows-shell-state.js.map +1 -1
- package/dist/core/tools/worktree-sync.d.ts.map +1 -1
- package/dist/core/tools/worktree-sync.js +8 -12
- package/dist/core/tools/worktree-sync.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +0 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +7 -40
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/util/atomic-file.d.ts +19 -0
- package/dist/core/util/atomic-file.d.ts.map +1 -1
- package/dist/core/util/atomic-file.js +50 -15
- package/dist/core/util/atomic-file.js.map +1 -1
- package/dist/core/util/bounded-file.d.ts.map +1 -1
- package/dist/core/util/bounded-file.js.map +1 -1
- package/dist/core/util/bounded-jsonl.d.ts.map +1 -1
- package/dist/core/util/bounded-jsonl.js +2 -9
- package/dist/core/util/bounded-jsonl.js.map +1 -1
- package/dist/core/util/bounded-value.d.ts.map +1 -1
- package/dist/core/util/bounded-value.js.map +1 -1
- package/dist/core/util/json-size.d.ts +3 -0
- package/dist/core/util/json-size.d.ts.map +1 -0
- package/dist/core/util/json-size.js +95 -0
- package/dist/core/util/json-size.js.map +1 -0
- package/dist/core/util/minimatch-cache.d.ts.map +1 -1
- package/dist/core/util/minimatch-cache.js.map +1 -1
- package/dist/core/util/value-guards.d.ts.map +1 -1
- package/dist/core/util/value-guards.js.map +1 -1
- package/dist/core/worktree-sync/codes.d.ts.map +1 -1
- package/dist/core/worktree-sync/git-engine.d.ts.map +1 -1
- package/dist/core/worktree-sync/git-engine.js +20 -36
- package/dist/core/worktree-sync/git-engine.js.map +1 -1
- package/dist/core/worktree-sync/lane-gate.d.ts.map +1 -1
- package/dist/core/worktree-sync/lane-gate.js +1 -4
- package/dist/core/worktree-sync/lane-gate.js.map +1 -1
- package/dist/core/worktree-sync/runtime.d.ts.map +1 -1
- package/dist/core/worktree-sync/runtime.js.map +1 -1
- package/dist/core/worktree-sync/store.d.ts.map +1 -1
- package/dist/core/worktree-sync/store.js.map +1 -1
- package/dist/core/worktree-sync/watcher.d.ts.map +1 -1
- package/dist/core/worktree-sync/watcher.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +10 -32
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +6 -19
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.d.ts +3 -0
- package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.js +96 -132
- package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.d.ts +1 -31
- package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.js +86 -307
- package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
- package/dist/modes/interactive/autocomplete-provider.d.ts.map +1 -1
- package/dist/modes/interactive/autocomplete-provider.js.map +1 -1
- package/dist/modes/interactive/autonomy-commands.d.ts.map +1 -1
- package/dist/modes/interactive/autonomy-commands.js +2 -8
- package/dist/modes/interactive/autonomy-commands.js.map +1 -1
- package/dist/modes/interactive/clipboard-input.d.ts +5 -1
- package/dist/modes/interactive/clipboard-input.d.ts.map +1 -1
- package/dist/modes/interactive/clipboard-input.js +17 -0
- package/dist/modes/interactive/clipboard-input.js.map +1 -1
- package/dist/modes/interactive/compaction-queue.d.ts.map +1 -1
- package/dist/modes/interactive/compaction-queue.js +13 -18
- package/dist/modes/interactive/compaction-queue.js.map +1 -1
- package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -1
- package/dist/modes/interactive/components/activity-lane.js +6 -10
- package/dist/modes/interactive/components/activity-lane.js.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts +1 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js +10 -21
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +1 -6
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +4 -9
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +0 -3
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +3 -8
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +13 -35
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +3 -8
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +14 -36
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +20 -43
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +0 -5
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +2 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +4 -8
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -6
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js +6 -8
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +0 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
- package/dist/modes/interactive/components/expandable-markdown-message.d.ts +21 -0
- package/dist/modes/interactive/components/expandable-markdown-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/expandable-markdown-message.js +48 -0
- package/dist/modes/interactive/components/expandable-markdown-message.js.map +1 -0
- package/dist/modes/interactive/components/expandable-text.d.ts.map +1 -1
- package/dist/modes/interactive/components/expandable-text.js +0 -2
- package/dist/modes/interactive/components/expandable-text.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +1 -9
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +2 -8
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +5 -20
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/fitness-role-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/fitness-role-selector.js +0 -1
- package/dist/modes/interactive/components/fitness-role-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -5
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +4 -10
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +2 -2
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +21 -44
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/model-suggestion-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-suggestion-selector.js +0 -1
- package/dist/modes/interactive/components/model-suggestion-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +16 -32
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.d.ts +3 -4
- package/dist/modes/interactive/components/profile-resource-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.js +34 -93
- package/dist/modes/interactive/components/profile-resource-editor.js.map +1 -1
- package/dist/modes/interactive/components/profile-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/profile-selector.js +0 -1
- package/dist/modes/interactive/components/profile-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +3 -4
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +34 -79
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/selector-list.d.ts +63 -0
- package/dist/modes/interactive/components/selector-list.d.ts.map +1 -0
- package/dist/modes/interactive/components/selector-list.js +186 -0
- package/dist/modes/interactive/components/selector-list.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +34 -59
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +40 -138
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts +2 -4
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +9 -28
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +3 -8
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +12 -40
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +2 -5
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +11 -37
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +2 -4
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +9 -31
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -28
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-group.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-group.js +2 -3
- package/dist/modes/interactive/components/tool-group.js.map +1 -1
- package/dist/modes/interactive/components/tool-panel-registry.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-panel-registry.js +5 -3
- package/dist/modes/interactive/components/tool-panel-registry.js.map +1 -1
- package/dist/modes/interactive/components/tool-title.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-title.js +0 -4
- package/dist/modes/interactive/components/tool-title.js.map +1 -1
- package/dist/modes/interactive/components/transcript-pager.d.ts +26 -0
- package/dist/modes/interactive/components/transcript-pager.d.ts.map +1 -0
- package/dist/modes/interactive/components/transcript-pager.js +81 -0
- package/dist/modes/interactive/components/transcript-pager.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +1 -12
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +42 -402
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +4 -16
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/components/usage-action-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/usage-action-selector.js +2 -10
- package/dist/modes/interactive/components/usage-action-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +3 -6
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +0 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/config-backup.d.ts.map +1 -1
- package/dist/modes/interactive/config-backup.js.map +1 -1
- package/dist/modes/interactive/editor-overlay-host.d.ts.map +1 -1
- package/dist/modes/interactive/editor-overlay-host.js +0 -3
- package/dist/modes/interactive/editor-overlay-host.js.map +1 -1
- package/dist/modes/interactive/extension-ui-host.d.ts +2 -0
- package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -1
- package/dist/modes/interactive/extension-ui-host.js +51 -72
- package/dist/modes/interactive/extension-ui-host.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -15
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/history-reload-math.d.ts.map +1 -1
- package/dist/modes/interactive/history-reload-math.js.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.js +23 -16
- package/dist/modes/interactive/interactive-event-controller.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +13 -4
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +123 -204
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-selection-prompts.d.ts +20 -0
- package/dist/modes/interactive/interactive-selection-prompts.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-selection-prompts.js +43 -0
- package/dist/modes/interactive/interactive-selection-prompts.js.map +1 -0
- package/dist/modes/interactive/key-handlers.d.ts +2 -1
- package/dist/modes/interactive/key-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/key-handlers.js +4 -2
- package/dist/modes/interactive/key-handlers.js.map +1 -1
- package/dist/modes/interactive/loaded-resources-view.d.ts.map +1 -1
- package/dist/modes/interactive/loaded-resources-view.js.map +1 -1
- package/dist/modes/interactive/local-model-commands.d.ts.map +1 -1
- package/dist/modes/interactive/local-model-commands.js +4 -9
- package/dist/modes/interactive/local-model-commands.js.map +1 -1
- package/dist/modes/interactive/model-fitness-presentation.d.ts +21 -0
- package/dist/modes/interactive/model-fitness-presentation.d.ts.map +1 -0
- package/dist/modes/interactive/model-fitness-presentation.js +13 -0
- package/dist/modes/interactive/model-fitness-presentation.js.map +1 -0
- package/dist/modes/interactive/profile-menu-controller.d.ts +2 -0
- package/dist/modes/interactive/profile-menu-controller.d.ts.map +1 -1
- package/dist/modes/interactive/profile-menu-controller.js +79 -171
- package/dist/modes/interactive/profile-menu-controller.js.map +1 -1
- package/dist/modes/interactive/report-commands.d.ts +2 -0
- package/dist/modes/interactive/report-commands.d.ts.map +1 -1
- package/dist/modes/interactive/report-commands.js +12 -6
- package/dist/modes/interactive/report-commands.js.map +1 -1
- package/dist/modes/interactive/resource-display.d.ts.map +1 -1
- package/dist/modes/interactive/resource-display.js.map +1 -1
- package/dist/modes/interactive/resource-shell-commands.d.ts.map +1 -1
- package/dist/modes/interactive/resource-shell-commands.js +6 -23
- package/dist/modes/interactive/resource-shell-commands.js.map +1 -1
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-flow-commands.js +21 -25
- package/dist/modes/interactive/session-flow-commands.js.map +1 -1
- package/dist/modes/interactive/session-io-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-io-commands.js.map +1 -1
- package/dist/modes/interactive/session-replacement-errors.d.ts.map +1 -1
- package/dist/modes/interactive/session-replacement-errors.js.map +1 -1
- package/dist/modes/interactive/settings-selector-flow.d.ts.map +1 -1
- package/dist/modes/interactive/settings-selector-flow.js.map +1 -1
- package/dist/modes/interactive/signal-lifecycle.d.ts.map +1 -1
- package/dist/modes/interactive/signal-lifecycle.js.map +1 -1
- package/dist/modes/interactive/startup-checks.d.ts.map +1 -1
- package/dist/modes/interactive/startup-checks.js +12 -8
- package/dist/modes/interactive/startup-checks.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +10 -76
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/usage-commands.d.ts.map +1 -1
- package/dist/modes/interactive/usage-commands.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +5 -22
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js +1 -1
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +7 -8
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +5 -20
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/termination-signals.d.ts +4 -0
- package/dist/modes/termination-signals.d.ts.map +1 -0
- package/dist/modes/termination-signals.js +21 -0
- package/dist/modes/termination-signals.js.map +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/ansi-colors.d.ts +5 -0
- package/dist/utils/ansi-colors.d.ts.map +1 -0
- package/dist/utils/ansi-colors.js +38 -0
- package/dist/utils/ansi-colors.js.map +1 -0
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/deprecation.d.ts.map +1 -1
- package/dist/utils/deprecation.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/external-editor-command.d.ts.map +1 -1
- package/dist/utils/external-editor-command.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js.map +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +20 -28
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/highlight-js-languages.d.ts.map +1 -1
- package/dist/utils/html.d.ts.map +1 -1
- package/dist/utils/html.js.map +1 -1
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/image-resize-worker.d.ts.map +1 -1
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts.map +1 -1
- package/dist/utils/pi-user-agent.js.map +1 -1
- package/dist/utils/platform.d.ts.map +1 -1
- package/dist/utils/platform.js.map +1 -1
- package/dist/utils/process-memory.d.ts.map +1 -1
- package/dist/utils/process-memory.js.map +1 -1
- package/dist/utils/safe-write-stream.d.ts.map +1 -1
- package/dist/utils/safe-write-stream.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/sleep.js +2 -15
- package/dist/utils/sleep.js.map +1 -1
- package/dist/utils/stdin-events.d.ts +8 -0
- package/dist/utils/stdin-events.d.ts.map +1 -0
- package/dist/utils/stdin-events.js +19 -0
- package/dist/utils/stdin-events.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +20 -13
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/dist/utils/work-directory.d.ts.map +1 -1
- package/dist/utils/work-directory.js.map +1 -1
- package/docs/compaction.md +11 -3
- package/docs/sessions.md +6 -0
- package/docs/settings.md +1 -1
- package/docs/windows.md +26 -1
- package/docs/work-directory.md +9 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +16 -16
- package/package.json +10 -10
- package/dist/utils/streaming-lines.d.ts +0 -20
- package/dist/utils/streaming-lines.d.ts.map +0 -1
- package/dist/utils/streaming-lines.js +0 -79
- package/dist/utils/streaming-lines.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CURSOR_MARKER, Input, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "@caupulican/pi-tui";
|
|
2
2
|
import { Type } from "typebox";
|
|
3
|
+
import { bindClipboardQueue, } from "../../modes/interactive/clipboard-input.js";
|
|
3
4
|
import { formatKeyText } from "../../modes/interactive/components/keybinding-hints.js";
|
|
4
5
|
import { defineTool } from "../extensions/types.js";
|
|
5
6
|
import { beginHumanInputRequest, createHumanInputRequest, formatHumanInputAnswerText, resolveHumanInput, } from "../human-input.js";
|
|
@@ -37,9 +38,8 @@ const askQuestionSchema = Type.Object({
|
|
|
37
38
|
const ANSWER_PREVIEW_CHARS = 240;
|
|
38
39
|
const ANSWER_EDITOR_VIEWPORT_LINES = 8;
|
|
39
40
|
class SingleLineAnswerEditor {
|
|
40
|
-
input = new Input();
|
|
41
|
-
onSubmit;
|
|
42
41
|
constructor() {
|
|
42
|
+
this.input = new Input();
|
|
43
43
|
this.input.onSubmit = (value) => this.onSubmit?.(value);
|
|
44
44
|
}
|
|
45
45
|
get focused() {
|
|
@@ -139,28 +139,15 @@ function isResolved(selection) {
|
|
|
139
139
|
}
|
|
140
140
|
/** Native focused question interaction shared by every provider-facing ask_question call. */
|
|
141
141
|
export class AskQuestionDialog {
|
|
142
|
-
questions;
|
|
143
|
-
theme;
|
|
144
|
-
keybindings;
|
|
145
|
-
requestRender;
|
|
146
|
-
finish;
|
|
147
|
-
clipboard;
|
|
148
|
-
pasteClipboardImage;
|
|
149
|
-
createAnswerEditor;
|
|
150
|
-
selections;
|
|
151
|
-
cursors;
|
|
152
|
-
pendingClipboardImages = [];
|
|
153
|
-
clipboardImageCounter = 0;
|
|
154
|
-
currentIndex = 0;
|
|
155
|
-
input;
|
|
156
|
-
inputError;
|
|
157
|
-
inputStatus;
|
|
158
|
-
pasteInFlight = false;
|
|
159
|
-
submitAfterPaste = false;
|
|
160
|
-
cachedWidth;
|
|
161
|
-
cachedLines;
|
|
162
|
-
settled = false;
|
|
163
142
|
constructor(options) {
|
|
143
|
+
this.clipboardQueue = {
|
|
144
|
+
pendingClipboardImages: [],
|
|
145
|
+
clipboardImageCounter: 0,
|
|
146
|
+
};
|
|
147
|
+
this.currentIndex = 0;
|
|
148
|
+
this.pasteInFlight = false;
|
|
149
|
+
this.submitAfterPaste = false;
|
|
150
|
+
this.settled = false;
|
|
164
151
|
this.questions = options.questions;
|
|
165
152
|
this.theme = options.theme;
|
|
166
153
|
this.keybindings = options.keybindings;
|
|
@@ -181,14 +168,14 @@ export class AskQuestionDialog {
|
|
|
181
168
|
this.requestRender();
|
|
182
169
|
}
|
|
183
170
|
result(cancelled, reason) {
|
|
184
|
-
const answers = this.questions.map((question, index) => answerFor(question, this.selections[index], this.pendingClipboardImages));
|
|
171
|
+
const answers = this.questions.map((question, index) => answerFor(question, this.selections[index], this.clipboardQueue.pendingClipboardImages));
|
|
185
172
|
const referencedLabels = new Set(answers.flatMap((answer) => answer.images?.map((image) => image.label) ?? []));
|
|
186
173
|
return {
|
|
187
174
|
answers,
|
|
188
175
|
cancelled,
|
|
189
176
|
imageContents: cancelled
|
|
190
177
|
? []
|
|
191
|
-
: this.pendingClipboardImages
|
|
178
|
+
: this.clipboardQueue.pendingClipboardImages
|
|
192
179
|
.filter((attachment) => referencedLabels.has(attachment.label))
|
|
193
180
|
.map((attachment) => attachment.content),
|
|
194
181
|
...(reason ? { reason } : {}),
|
|
@@ -255,20 +242,7 @@ export class AskQuestionDialog {
|
|
|
255
242
|
this.inputStatus = "Reading clipboard…";
|
|
256
243
|
this.refresh();
|
|
257
244
|
let reported = false;
|
|
258
|
-
const
|
|
259
|
-
const host = {
|
|
260
|
-
get pendingClipboardImages() {
|
|
261
|
-
return self.pendingClipboardImages;
|
|
262
|
-
},
|
|
263
|
-
set pendingClipboardImages(value) {
|
|
264
|
-
self.pendingClipboardImages = value;
|
|
265
|
-
},
|
|
266
|
-
get clipboardImageCounter() {
|
|
267
|
-
return self.clipboardImageCounter;
|
|
268
|
-
},
|
|
269
|
-
set clipboardImageCounter(value) {
|
|
270
|
-
self.clipboardImageCounter = value;
|
|
271
|
-
},
|
|
245
|
+
const host = bindClipboardQueue(this.clipboardQueue, {
|
|
272
246
|
editor: {
|
|
273
247
|
handleInput: (data) => input.handleInput(data),
|
|
274
248
|
insertTextAtCursor: (text) => input.insertTextAtCursor(text),
|
|
@@ -289,7 +263,7 @@ export class AskQuestionDialog {
|
|
|
289
263
|
this.inputError = message;
|
|
290
264
|
this.refresh();
|
|
291
265
|
},
|
|
292
|
-
};
|
|
266
|
+
});
|
|
293
267
|
try {
|
|
294
268
|
await this.pasteClipboardImage(host);
|
|
295
269
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask-question.js","sourceRoot":"","sources":["../../../src/core/tools/ask-question.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,aAAa,EACb,KAAK,EAEL,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AAGvF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAO1B,iBAAiB,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAA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E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;4BACnD,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;yBACnC;wBACD,aAAa,EAAE,MAAM,CAAC,aAAa;qBACnC,CAAC;gBAAA,CACF,CAAC,EAAE,CAAC;YAEP,MAAM,OAAO,GAA2B;gBACvC,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO;gBAClC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,WAAW;gBACnD,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACzE,CAAC;YACF,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;gBACvB,OAAO;oBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,0BAA0B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACzF,OAAO;iBACP,CAAC;YACH,CAAC;YAED,OAAO;gBACN,OAAO,EAAE;oBACR,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,0BAA0B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;oBAC9E,GAAG,QAAQ,CAAC,aAAa;iBACzB;gBACD,OAAO;aACP,CAAC;QAAA,CACF;KACD,CAAC,CAAC;AAAA,CACH","sourcesContent":["import type { SessionManager } from \"@caupulican/pi-agent-core/node\";\nimport {\n\ttype Component,\n\tCURSOR_MARKER,\n\tInput,\n\ttype Keybinding,\n\ttruncateToWidth,\n\tvisibleWidth,\n\twrapTextWithAnsi,\n} from \"@caupulican/pi-tui\";\nimport { type Static, Type } from \"typebox\";\nimport type { ClipboardInputHost, PendingClipboardImage } from \"../../modes/interactive/clipboard-input.ts\";\nimport { formatKeyText } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { ArtifactStore } from \"../context/context-artifacts.ts\";\nimport { defineTool } from \"../extensions/types.ts\";\nimport {\n\tbeginHumanInputRequest,\n\tcreateHumanInputRequest,\n\tformatHumanInputAnswerText,\n\ttype HumanInputAnswer,\n\ttype HumanInputAnswerImage,\n\ttype HumanInputPresentationResult,\n\ttype HumanInputQuestion,\n\ttype HumanInputSnapshot,\n\ttype HumanInputStopReason,\n\tresolveHumanInput,\n} from \"../human-input.ts\";\nimport type { KeybindingsManager } from \"../keybindings.ts\";\nimport type { SessionImageStore } from \"../session-image-store.ts\";\nimport {\n\temptyOrchestrationCall,\n\tOrchestrationPanelComponent,\n\ttype OrchestrationPanelModel,\n} from \"./orchestration-panel.ts\";\n\nconst optionSchema = Type.Object(\n\t{\n\t\tlabel: Type.String({ minLength: 1, maxLength: 120, description: \"Concise option label.\" }),\n\t\tdescription: Type.String({\n\t\t\tminLength: 1,\n\t\t\tmaxLength: 500,\n\t\t\tdescription: \"Concrete consequence or tradeoff of choosing this option.\",\n\t\t}),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst questionSchema = Type.Object(\n\t{\n\t\tid: Type.String({ minLength: 1, maxLength: 80, description: \"Stable unique answer identifier.\" }),\n\t\theader: Type.String({\n\t\t\tminLength: 1,\n\t\t\tmaxLength: 32,\n\t\t\tdescription: \"Short topic label used in question navigation.\",\n\t\t}),\n\t\tquestion: Type.String({ minLength: 1, maxLength: 1_000, description: \"The specific user-facing question.\" }),\n\t\toptions: Type.Array(optionSchema, {\n\t\t\tminItems: 2,\n\t\t\tmaxItems: 4,\n\t\t\tdescription: \"Two to four genuine choices. Other and Skip are supplied by the harness.\",\n\t\t}),\n\t\tmultiSelect: Type.Optional(Type.Boolean({ description: \"Allow more than one listed option to be selected.\" })),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst askQuestionSchema = Type.Object(\n\t{\n\t\tquestions: Type.Array(questionSchema, {\n\t\t\tminItems: 1,\n\t\t\tmaxItems: 4,\n\t\t\tdescription: \"One to four independent questions presented in one interaction.\",\n\t\t}),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst ANSWER_PREVIEW_CHARS = 240;\nconst ANSWER_EDITOR_VIEWPORT_LINES = 8;\n\nexport type AskQuestionToolInput = Static<typeof askQuestionSchema>;\nexport type AskQuestion = HumanInputQuestion;\nexport type AskQuestionAnswer = HumanInputAnswer;\nexport type AskQuestionAnswerImage = HumanInputAnswerImage;\nexport type AskQuestionStopReason = HumanInputStopReason;\n\nexport interface AskQuestionToolDetails {\n\tquestions: readonly AskQuestion[];\n\tanswers: readonly AskQuestionAnswer[];\n\tcancelled: boolean;\n\treason?: AskQuestionStopReason;\n\terror?: string;\n}\n\nexport interface AskQuestionToolOptions {\n\tname?: string;\n\tlabel?: string;\n\t/** Production session sink. When present, requests and answers are checkpointed before continuation. */\n\tsessionManager?: Pick<SessionManager, \"appendCustomEntry\">;\n\tartifactStore?: ArtifactStore;\n\tgetImageStore?: () => Pick<SessionImageStore, \"retainContent\"> | undefined;\n}\n\nexport interface AskQuestionClipboardOptions {\n\tautoResizeImages: boolean;\n\tblockImages: boolean;\n\tblockImagesReason?: string;\n\timageStore?: Pick<SessionImageStore, \"write\">;\n}\n\nexport type PasteClipboardImage = (host: ClipboardInputHost) => Promise<void>;\n\nexport interface AskQuestionAnswerEditor extends Component {\n\tfocused: boolean;\n\tonSubmit?: (text: string) => void;\n\thandleInput(data: string): void;\n\tgetText(): string;\n\tsetText(text: string): void;\n\tinsertTextAtCursor(text: string): void;\n}\n\nexport type CreateAskQuestionAnswerEditor = () => AskQuestionAnswerEditor;\n\nclass SingleLineAnswerEditor implements AskQuestionAnswerEditor {\n\tprivate readonly input = new Input();\n\tonSubmit?: (text: string) => void;\n\n\tconstructor() {\n\t\tthis.input.onSubmit = (value) => this.onSubmit?.(value);\n\t}\n\n\tget focused(): boolean {\n\t\treturn this.input.focused;\n\t}\n\n\tset focused(value: boolean) {\n\t\tthis.input.focused = value;\n\t}\n\n\tgetText(): string {\n\t\treturn this.input.getValue();\n\t}\n\n\tsetText(text: string): void {\n\t\tthis.input.setValue(\"\");\n\t\tthis.insertTextAtCursor(text);\n\t}\n\n\tinsertTextAtCursor(text: string): void {\n\t\tthis.input.handleInput(`\\x1b[200~${text}\\x1b[201~`);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.input.handleInput(data);\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.input.render(width);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.input.invalidate();\n\t}\n}\n\ninterface QuestionSelection {\n\toptionIndexes: Set<number>;\n\tcustom?: string;\n\tskipped: boolean;\n}\n\ntype AskQuestionDialogResult = HumanInputPresentationResult;\n\nfunction normalizedIdentity(value: string): string {\n\treturn value.trim().toLowerCase();\n}\n\nfunction validateQuestions(questions: readonly AskQuestion[]): string | undefined {\n\tif (questions.length < 1 || questions.length > 4) return \"Provide between one and four questions.\";\n\tconst ids = new Set<string>();\n\tconst prompts = new Set<string>();\n\tfor (const question of questions) {\n\t\tif (!question.id.trim() || !question.header.trim() || !question.question.trim()) {\n\t\t\treturn \"Question ids, headers, and prompts must not be blank.\";\n\t\t}\n\t\tconst id = normalizedIdentity(question.id);\n\t\tconst prompt = normalizedIdentity(question.question);\n\t\tif (ids.has(id)) return `Question id '${question.id}' is duplicated.`;\n\t\tif (prompts.has(prompt)) return `Question '${question.question}' is duplicated.`;\n\t\tids.add(id);\n\t\tprompts.add(prompt);\n\t\tif (question.options.length < 2 || question.options.length > 4) {\n\t\t\treturn `Question '${question.header}' requires between two and four options.`;\n\t\t}\n\t\tconst labels = new Set<string>();\n\t\tfor (const option of question.options) {\n\t\t\tconst label = normalizedIdentity(option.label);\n\t\t\tif (!label || !option.description.trim()) {\n\t\t\t\treturn `Question '${question.header}' has a blank option label or description.`;\n\t\t\t}\n\t\t\tif (label === \"other\" || label === \"skip\") {\n\t\t\t\treturn `Question '${question.header}' must not define the reserved '${option.label}' option.`;\n\t\t\t}\n\t\t\tif (labels.has(label)) return `Question '${question.header}' has duplicate option '${option.label}'.`;\n\t\t\tlabels.add(label);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction displayKeys(keybindings: KeybindingsManager, keybinding: Keybinding, limit = 2): string {\n\treturn formatKeyText(keybindings.getKeys(keybinding).slice(0, limit).join(\"/\"), { capitalize: true });\n}\n\nfunction answerFor(\n\tquestion: AskQuestion,\n\tselection: QuestionSelection,\n\tattachments: readonly PendingClipboardImage[] = [],\n): AskQuestionAnswer {\n\tconst images = selection.custom\n\t\t? attachments\n\t\t\t\t.filter((attachment) => selection.custom?.includes(attachment.label))\n\t\t\t\t.map((attachment) => ({ label: attachment.label, mimeType: attachment.content.mimeType }))\n\t\t: [];\n\treturn {\n\t\tid: question.id,\n\t\theader: question.header,\n\t\tquestion: question.question,\n\t\tselected: [...selection.optionIndexes]\n\t\t\t.sort((left, right) => left - right)\n\t\t\t.map((index) => question.options[index]?.label)\n\t\t\t.filter((label): label is string => label !== undefined),\n\t\t...(selection.custom ? { custom: selection.custom } : {}),\n\t\t...(images.length > 0 ? { images } : {}),\n\t\tskipped: selection.skipped,\n\t};\n}\n\nfunction previewAnswer(value: string): string {\n\tif (value.length <= ANSWER_PREVIEW_CHARS) return value;\n\treturn `${value.slice(0, ANSWER_PREVIEW_CHARS)}… (${value.length} characters)`;\n}\n\nfunction isResolved(selection: QuestionSelection): boolean {\n\treturn selection.skipped || selection.optionIndexes.size > 0 || selection.custom !== undefined;\n}\n\n/** Native focused question interaction shared by every provider-facing ask_question call. */\nexport class AskQuestionDialog implements Component {\n\tprivate readonly questions: readonly AskQuestion[];\n\tprivate readonly theme: Theme;\n\tprivate readonly keybindings: KeybindingsManager;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly finish: (result: AskQuestionDialogResult) => void;\n\tprivate readonly clipboard: AskQuestionClipboardOptions;\n\tprivate readonly pasteClipboardImage: PasteClipboardImage;\n\tprivate readonly createAnswerEditor: CreateAskQuestionAnswerEditor;\n\tprivate readonly selections: QuestionSelection[];\n\tprivate readonly cursors: number[];\n\tprivate pendingClipboardImages: PendingClipboardImage[] = [];\n\tprivate clipboardImageCounter = 0;\n\tprivate currentIndex = 0;\n\tprivate input: AskQuestionAnswerEditor | undefined;\n\tprivate inputError: string | undefined;\n\tprivate inputStatus: string | undefined;\n\tprivate pasteInFlight = false;\n\tprivate submitAfterPaste = false;\n\tprivate cachedWidth: number | undefined;\n\tprivate cachedLines: string[] | undefined;\n\tprivate settled = false;\n\n\tconstructor(options: {\n\t\tquestions: readonly AskQuestion[];\n\t\ttheme: Theme;\n\t\tkeybindings: KeybindingsManager;\n\t\trequestRender: () => void;\n\t\tfinish: (result: AskQuestionDialogResult) => void;\n\t\tclipboard?: AskQuestionClipboardOptions;\n\t\tpasteClipboardImage?: PasteClipboardImage;\n\t\tcreateAnswerEditor?: CreateAskQuestionAnswerEditor;\n\t}) {\n\t\tthis.questions = options.questions;\n\t\tthis.theme = options.theme;\n\t\tthis.keybindings = options.keybindings;\n\t\tthis.requestRender = options.requestRender;\n\t\tthis.finish = options.finish;\n\t\tthis.clipboard = options.clipboard ?? { autoResizeImages: true, blockImages: false };\n\t\tthis.pasteClipboardImage =\n\t\t\toptions.pasteClipboardImage ??\n\t\t\t(async (host) => {\n\t\t\t\thost.showWarning(\"Clipboard paste is unavailable in this UI host.\");\n\t\t\t});\n\t\tthis.createAnswerEditor = options.createAnswerEditor ?? (() => new SingleLineAnswerEditor());\n\t\tthis.selections = options.questions.map(() => ({ optionIndexes: new Set(), skipped: false }));\n\t\tthis.cursors = options.questions.map(() => 0);\n\t}\n\n\tprivate refresh(): void {\n\t\tthis.invalidate();\n\t\tthis.requestRender();\n\t}\n\n\tprivate result(cancelled: boolean, reason?: AskQuestionStopReason): AskQuestionDialogResult {\n\t\tconst answers = this.questions.map((question, index) =>\n\t\t\tanswerFor(question, this.selections[index]!, this.pendingClipboardImages),\n\t\t);\n\t\tconst referencedLabels = new Set(answers.flatMap((answer) => answer.images?.map((image) => image.label) ?? []));\n\t\treturn {\n\t\t\tanswers,\n\t\t\tcancelled,\n\t\t\timageContents: cancelled\n\t\t\t\t? []\n\t\t\t\t: this.pendingClipboardImages\n\t\t\t\t\t\t.filter((attachment) => referencedLabels.has(attachment.label))\n\t\t\t\t\t\t.map((attachment) => attachment.content),\n\t\t\t...(reason ? { reason } : {}),\n\t\t};\n\t}\n\n\tprivate complete(result: AskQuestionDialogResult): void {\n\t\tif (this.settled) return;\n\t\tthis.settled = true;\n\t\tif (this.input) this.input.focused = false;\n\t\tthis.finish(result);\n\t}\n\n\tcancel(reason: Extract<AskQuestionStopReason, \"user_cancelled\" | \"interrupted\">): void {\n\t\tthis.complete(this.result(true, reason));\n\t}\n\n\tprivate move(delta: -1 | 1): void {\n\t\tconst lastIndex = this.questions.length;\n\t\tthis.currentIndex = Math.max(0, Math.min(lastIndex, this.currentIndex + delta));\n\t\tthis.refresh();\n\t}\n\n\tprivate advanceAfterSingleSelection(): void {\n\t\tif (this.questions.length === 1) {\n\t\t\tthis.complete(this.result(false));\n\t\t\treturn;\n\t\t}\n\t\tthis.currentIndex = Math.min(this.questions.length, this.currentIndex + 1);\n\t\tthis.refresh();\n\t}\n\n\tprivate beginCustomAnswer(): void {\n\t\tconst questionIndex = this.currentIndex;\n\t\tconst question = this.questions[questionIndex];\n\t\tconst selection = this.selections[questionIndex];\n\t\tif (!question || !selection) return;\n\t\tconst input = this.createAnswerEditor();\n\t\tthis.inputError = undefined;\n\t\tthis.inputStatus = undefined;\n\t\tinput.focused = true;\n\t\tif (selection.custom) input.setText(selection.custom);\n\t\tinput.onSubmit = (value) => {\n\t\t\tconst answer = value.trim();\n\t\t\tif (!answer) return;\n\t\t\tselection.custom = answer;\n\t\t\tselection.skipped = false;\n\t\t\tinput.focused = false;\n\t\t\tthis.input = undefined;\n\t\t\tif (question.multiSelect) this.refresh();\n\t\t\telse this.advanceAfterSingleSelection();\n\t\t};\n\t\tthis.input = input;\n\t\tthis.refresh();\n\t}\n\n\tprivate async pasteIntoCustomAnswer(): Promise<void> {\n\t\tconst input = this.input;\n\t\tif (!input || this.pasteInFlight) return;\n\t\tthis.pasteInFlight = true;\n\t\tthis.inputError = undefined;\n\t\tthis.inputStatus = \"Reading clipboard…\";\n\t\tthis.refresh();\n\t\tlet reported = false;\n\t\tconst self = this;\n\t\tconst host: ClipboardInputHost = {\n\t\t\tget pendingClipboardImages() {\n\t\t\t\treturn self.pendingClipboardImages;\n\t\t\t},\n\t\t\tset pendingClipboardImages(value) {\n\t\t\t\tself.pendingClipboardImages = value;\n\t\t\t},\n\t\t\tget clipboardImageCounter() {\n\t\t\t\treturn self.clipboardImageCounter;\n\t\t\t},\n\t\t\tset clipboardImageCounter(value) {\n\t\t\t\tself.clipboardImageCounter = value;\n\t\t\t},\n\t\t\teditor: {\n\t\t\t\thandleInput: (data) => input.handleInput(data),\n\t\t\t\tinsertTextAtCursor: (text) => input.insertTextAtCursor(text),\n\t\t\t},\n\t\t\tui: { requestRender: () => this.refresh() },\n\t\t\tautoResizeImages: this.clipboard.autoResizeImages,\n\t\t\tblockImages: this.clipboard.blockImages,\n\t\t\tblockImagesReason: this.clipboard.blockImagesReason,\n\t\t\timageStore: this.clipboard.imageStore,\n\t\t\tshowStatus: (message) => {\n\t\t\t\treported = true;\n\t\t\t\tthis.inputStatus = message;\n\t\t\t\tthis.inputError = undefined;\n\t\t\t},\n\t\t\tshowWarning: (message) => {\n\t\t\t\treported = true;\n\t\t\t\tthis.inputStatus = undefined;\n\t\t\t\tthis.inputError = message;\n\t\t\t\tthis.refresh();\n\t\t\t},\n\t\t};\n\t\ttry {\n\t\t\tawait this.pasteClipboardImage(host);\n\t\t} finally {\n\t\t\tthis.pasteInFlight = false;\n\t\t\tconst shouldSubmit = this.submitAfterPaste && this.input === input && !this.settled;\n\t\t\tthis.submitAfterPaste = false;\n\t\t\tif (!reported) this.inputStatus = undefined;\n\t\t\tif (shouldSubmit) input.onSubmit?.(input.getText());\n\t\t\tif (this.input === input && !this.settled) this.refresh();\n\t\t}\n\t}\n\n\tprivate selectCurrent(): void {\n\t\tconst question = this.questions[this.currentIndex];\n\t\tconst selection = this.selections[this.currentIndex];\n\t\tif (!question || !selection) return;\n\t\tconst cursor = this.cursors[this.currentIndex] ?? 0;\n\t\tif (cursor === question.options.length) {\n\t\t\tthis.beginCustomAnswer();\n\t\t\treturn;\n\t\t}\n\t\tif (cursor === question.options.length + 1) {\n\t\t\tselection.optionIndexes.clear();\n\t\t\tselection.custom = undefined;\n\t\t\tselection.skipped = true;\n\t\t\tthis.advanceAfterSingleSelection();\n\t\t\treturn;\n\t\t}\n\t\tselection.skipped = false;\n\t\tif (question.multiSelect) {\n\t\t\tif (selection.optionIndexes.has(cursor)) selection.optionIndexes.delete(cursor);\n\t\t\telse selection.optionIndexes.add(cursor);\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tselection.optionIndexes.clear();\n\t\tselection.optionIndexes.add(cursor);\n\t\tselection.custom = undefined;\n\t\tthis.advanceAfterSingleSelection();\n\t}\n\n\tprivate submitReview(): void {\n\t\tconst unresolved = this.selections.findIndex((selection) => !isResolved(selection));\n\t\tif (unresolved >= 0) {\n\t\t\tthis.currentIndex = unresolved;\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tthis.complete(this.result(false));\n\t}\n\n\thandleInput(data: string): void {\n\t\tif (this.settled) return;\n\t\tif (this.input) {\n\t\t\tif (this.keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\t\tthis.submitAfterPaste = false;\n\t\t\t\tthis.input.focused = false;\n\t\t\t\tthis.input = undefined;\n\t\t\t\tthis.refresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this.keybindings.matches(data, \"app.clipboard.pasteImage\")) {\n\t\t\t\tvoid this.pasteIntoCustomAnswer();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this.pasteInFlight && this.keybindings.matches(data, \"tui.input.submit\")) {\n\t\t\t\tthis.submitAfterPaste = true;\n\t\t\t\tthis.inputStatus = \"Finishing clipboard paste…\";\n\t\t\t\tthis.refresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst input = this.input;\n\t\t\tthis.inputError = undefined;\n\t\t\tthis.inputStatus = undefined;\n\t\t\tinput.handleInput(data);\n\t\t\tif (this.input === input) this.refresh();\n\t\t\treturn;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.cancel(\"user_cancelled\");\n\t\t\treturn;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"app.question.previous\")) {\n\t\t\tthis.move(-1);\n\t\t\treturn;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"app.question.next\")) {\n\t\t\tthis.move(1);\n\t\t\treturn;\n\t\t}\n\t\tif (this.currentIndex === this.questions.length) {\n\t\t\tif (this.keybindings.matches(data, \"tui.select.confirm\")) this.submitReview();\n\t\t\treturn;\n\t\t}\n\t\tconst question = this.questions[this.currentIndex];\n\t\tif (!question) return;\n\t\tif (this.keybindings.matches(data, \"tui.select.up\")) {\n\t\t\tthis.cursors[this.currentIndex] = Math.max(0, (this.cursors[this.currentIndex] ?? 0) - 1);\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"tui.select.down\")) {\n\t\t\tthis.cursors[this.currentIndex] = Math.min(\n\t\t\t\tquestion.options.length + 1,\n\t\t\t\t(this.cursors[this.currentIndex] ?? 0) + 1,\n\t\t\t);\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tif (\n\t\t\tthis.keybindings.matches(data, \"tui.select.confirm\") ||\n\t\t\t(question.multiSelect && this.keybindings.matches(data, \"app.question.toggle\"))\n\t\t) {\n\t\t\tthis.selectCurrent();\n\t\t}\n\t}\n\n\tprivate addWrapped(lines: string[], text: string, width: number, indent = \"\"): void {\n\t\tconst contentWidth = Math.max(1, width - visibleWidth(indent));\n\t\tfor (const line of wrapTextWithAnsi(text, contentWidth)) {\n\t\t\tlines.push(truncateToWidth(`${indent}${line}`, width, \"\"));\n\t\t}\n\t}\n\n\tprivate renderProgress(lines: string[], width: number): void {\n\t\tif (this.questions.length === 1 && !this.questions[0]?.multiSelect) return;\n\t\tconst chips = this.questions.map((question, index) => {\n\t\t\tconst resolved = isResolved(this.selections[index]!);\n\t\t\tconst text = ` ${resolved ? \"●\" : \"○\"} ${question.header} `;\n\t\t\treturn index === this.currentIndex\n\t\t\t\t? this.theme.bg(\"selectedBg\", this.theme.fg(\"text\", text))\n\t\t\t\t: this.theme.fg(resolved ? \"success\" : \"muted\", text);\n\t\t});\n\t\tconst review = \" Review \";\n\t\tchips.push(\n\t\t\tthis.currentIndex === this.questions.length\n\t\t\t\t? this.theme.bg(\"selectedBg\", this.theme.fg(\"text\", review))\n\t\t\t\t: this.theme.fg(\"dim\", review),\n\t\t);\n\t\tlines.push(truncateToWidth(chips.join(\" \"), width, \"\"));\n\t\tlines.push(\"\");\n\t}\n\n\tprivate renderQuestion(lines: string[], width: number, question: AskQuestion): void {\n\t\tconst questionIndex = this.currentIndex;\n\t\tconst selection = this.selections[questionIndex]!;\n\t\tconst cursor = this.cursors[questionIndex] ?? 0;\n\t\tthis.addWrapped(lines, this.theme.bold(question.question), width);\n\t\tif (question.multiSelect) {\n\t\t\tlines.push(this.theme.fg(\"muted\", \"Choose one or more, then continue to review.\"));\n\t\t}\n\t\tlines.push(\"\");\n\n\t\tquestion.options.forEach((option, index) => {\n\t\t\tconst active = index === cursor;\n\t\t\tconst chosen = selection.optionIndexes.has(index);\n\t\t\tconst prefix = `${active ? \"›\" : \" \"} ${chosen ? \"●\" : \"○\"} `;\n\t\t\tconst label = `${prefix}${option.label}`;\n\t\t\tlines.push(\n\t\t\t\ttruncateToWidth(\n\t\t\t\t\tactive ? this.theme.bg(\"selectedBg\", this.theme.fg(\"text\", ` ${label} `)) : this.theme.fg(\"text\", label),\n\t\t\t\t\twidth,\n\t\t\t\t\t\"\",\n\t\t\t\t),\n\t\t\t);\n\t\t\tthis.addWrapped(lines, this.theme.fg(\"muted\", option.description), width, \" \");\n\t\t});\n\n\t\tconst otherIndex = question.options.length;\n\t\tconst otherActive = cursor === otherIndex;\n\t\tconst otherLabel = selection.custom ? `Other: ${previewAnswer(selection.custom)}` : \"Other\";\n\t\tconst otherText = `${otherActive ? \"›\" : \" \"} ${selection.custom ? \"●\" : \"+\"} ${otherLabel}`;\n\t\tlines.push(\n\t\t\ttruncateToWidth(\n\t\t\t\totherActive\n\t\t\t\t\t? this.theme.bg(\"selectedBg\", this.theme.fg(\"text\", ` ${otherText} `))\n\t\t\t\t\t: this.theme.fg(\"muted\", otherText),\n\t\t\t\twidth,\n\t\t\t\t\"\",\n\t\t\t),\n\t\t);\n\t\tconst skipActive = cursor === otherIndex + 1;\n\t\tconst skipText = `${skipActive ? \"›\" : \" \"} ${selection.skipped ? \"●\" : \"–\"} Skip`;\n\t\tlines.push(\n\t\t\ttruncateToWidth(\n\t\t\t\tskipActive\n\t\t\t\t\t? this.theme.bg(\"selectedBg\", this.theme.fg(\"text\", ` ${skipText} `))\n\t\t\t\t\t: this.theme.fg(\"dim\", skipText),\n\t\t\t\twidth,\n\t\t\t\t\"\",\n\t\t\t),\n\t\t);\n\n\t\tif (this.input) {\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(this.theme.fg(\"muted\", \"Your answer\"));\n\t\t\tconst renderedInput = this.input.render(Math.max(4, width - 2));\n\t\t\tconst cursorLine = Math.max(\n\t\t\t\t0,\n\t\t\t\trenderedInput.findIndex((line) => line.includes(CURSOR_MARKER)),\n\t\t\t);\n\t\t\tconst viewportStart = Math.max(\n\t\t\t\t0,\n\t\t\t\tMath.min(\n\t\t\t\t\tcursorLine - Math.floor(ANSWER_EDITOR_VIEWPORT_LINES / 2),\n\t\t\t\t\trenderedInput.length - ANSWER_EDITOR_VIEWPORT_LINES,\n\t\t\t\t),\n\t\t\t);\n\t\t\tconst visibleInput = renderedInput.slice(viewportStart, viewportStart + ANSWER_EDITOR_VIEWPORT_LINES);\n\t\t\tif (viewportStart > 0) {\n\t\t\t\tlines.push(this.theme.fg(\"dim\", ` ↑ ${viewportStart} earlier line${viewportStart === 1 ? \"\" : \"s\"}`));\n\t\t\t}\n\t\t\tfor (const inputLine of visibleInput) {\n\t\t\t\tlines.push(truncateToWidth(` ${inputLine}`, width, \"\"));\n\t\t\t}\n\t\t\tconst remainingLines = renderedInput.length - viewportStart - visibleInput.length;\n\t\t\tif (remainingLines > 0) {\n\t\t\t\tlines.push(this.theme.fg(\"dim\", ` ↓ ${remainingLines} later line${remainingLines === 1 ? \"\" : \"s\"}`));\n\t\t\t}\n\t\t\tif (this.inputError) this.addWrapped(lines, this.theme.fg(\"warning\", this.inputError), width, \" \");\n\t\t\tif (this.inputStatus) this.addWrapped(lines, this.theme.fg(\"success\", this.inputStatus), width, \" \");\n\t\t}\n\t}\n\n\tprivate renderReview(lines: string[], width: number): void {\n\t\tlines.push(this.theme.bold(\"Review your answers\"));\n\t\tlines.push(\"\");\n\t\tlet unresolved = 0;\n\t\tthis.questions.forEach((question, index) => {\n\t\t\tconst answer = answerFor(question, this.selections[index]!);\n\t\t\tconst values = [...answer.selected, ...(answer.custom ? [previewAnswer(answer.custom)] : [])];\n\t\t\tconst value = answer.skipped ? \"Skipped\" : values.length > 0 ? values.join(\", \") : \"Unanswered\";\n\t\t\tif (!isResolved(this.selections[index]!)) unresolved++;\n\t\t\tthis.addWrapped(\n\t\t\t\tlines,\n\t\t\t\t`${this.theme.fg(\"muted\", `${question.header}:`)} ${this.theme.fg(value === \"Unanswered\" ? \"warning\" : \"text\", value)}`,\n\t\t\t\twidth,\n\t\t\t);\n\t\t});\n\t\tif (unresolved > 0) {\n\t\t\tlines.push(\"\");\n\t\t\tthis.addWrapped(\n\t\t\t\tlines,\n\t\t\t\tthis.theme.fg(\n\t\t\t\t\t\"warning\",\n\t\t\t\t\t`${unresolved} unanswered. Answer or explicitly skip each question before submitting.`,\n\t\t\t\t),\n\t\t\t\twidth,\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate renderHelp(lines: string[], width: number): void {\n\t\tconst cancel = displayKeys(this.keybindings, \"tui.select.cancel\", 1);\n\t\tlet help: string;\n\t\tif (this.input) {\n\t\t\thelp = `${displayKeys(this.keybindings, \"tui.input.submit\", 1)} save · ${displayKeys(this.keybindings, \"tui.input.newLine\", 1)} newline · ${displayKeys(this.keybindings, \"app.clipboard.pasteImage\", 1)} paste · ${cancel} back`;\n\t\t} else if (this.currentIndex === this.questions.length) {\n\t\t\thelp = `${displayKeys(this.keybindings, \"tui.select.confirm\", 1)} submit · ${displayKeys(this.keybindings, \"app.question.previous\")} back · ${cancel} cancel`;\n\t\t} else if (this.questions[this.currentIndex]?.multiSelect) {\n\t\t\thelp = `${displayKeys(this.keybindings, \"tui.select.up\")}/${displayKeys(this.keybindings, \"tui.select.down\")} move · ${displayKeys(this.keybindings, \"app.question.toggle\", 1)}/${displayKeys(this.keybindings, \"tui.select.confirm\", 1)} toggle · ${displayKeys(this.keybindings, \"app.question.next\")} next · ${cancel} cancel`;\n\t\t} else {\n\t\t\thelp = `${displayKeys(this.keybindings, \"tui.select.up\")}/${displayKeys(this.keybindings, \"tui.select.down\")} move · ${displayKeys(this.keybindings, \"tui.select.confirm\", 1)} select · ${cancel} cancel`;\n\t\t}\n\t\tthis.addWrapped(lines, this.theme.fg(\"dim\", help), width);\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.cachedWidth === width && this.cachedLines) return this.cachedLines;\n\t\tconst safeWidth = Math.max(1, width);\n\t\tconst lines: string[] = [];\n\t\tconst header = this.currentIndex === this.questions.length ? \"review\" : this.questions[this.currentIndex]?.header;\n\t\tlines.push(\n\t\t\ttruncateToWidth(\n\t\t\t\t`${this.theme.fg(\"accent\", \"?\")} ${this.theme.bold(header ?? \"question\")} ${this.theme.fg(\"dim\", `${Math.min(this.currentIndex + 1, this.questions.length)}/${this.questions.length}`)}`,\n\t\t\t\tsafeWidth,\n\t\t\t\t\"\",\n\t\t\t),\n\t\t);\n\t\tlines.push(\"\");\n\t\tthis.renderProgress(lines, safeWidth);\n\t\tconst question = this.questions[this.currentIndex];\n\t\tif (question) this.renderQuestion(lines, safeWidth, question);\n\t\telse this.renderReview(lines, safeWidth);\n\t\tlines.push(\"\");\n\t\tthis.renderHelp(lines, safeWidth);\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedLines = lines.map((line) => truncateToWidth(line, safeWidth, \"\"));\n\t\treturn this.cachedLines;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n}\n\nfunction questionPanelModel(details: AskQuestionToolDetails | undefined): OrchestrationPanelModel {\n\tif (!details) {\n\t\treturn { label: \"question\", status: \"error\", emptyText: \"No structured answer was retained.\" };\n\t}\n\tif (details.reason === \"ui_unavailable\" || details.reason === \"invalid_questions\") {\n\t\treturn {\n\t\t\tlabel: \"question\",\n\t\t\taction: \"unavailable\",\n\t\t\tstatus: \"error\",\n\t\t\temptyText: details.error ?? \"User input is unavailable.\",\n\t\t};\n\t}\n\tconst rows = details.questions.map((question) => {\n\t\tconst answer = details.answers.find((candidate) => candidate.id === question.id);\n\t\tconst values = answer ? [...answer.selected, ...(answer.custom ? [previewAnswer(answer.custom)] : [])] : [];\n\t\tconst imageCount = answer?.images?.length ?? 0;\n\t\treturn {\n\t\t\tstatus: details.cancelled\n\t\t\t\t? (\"cancelled\" as const)\n\t\t\t\t: answer?.skipped\n\t\t\t\t\t? (\"cancelled\" as const)\n\t\t\t\t\t: (\"completed\" as const),\n\t\t\tlabel: question.header,\n\t\t\tmeta: details.cancelled\n\t\t\t\t? [details.reason === \"interrupted\" ? \"interrupted\" : \"cancelled\"]\n\t\t\t\t: answer?.skipped\n\t\t\t\t\t? [\"skipped\"]\n\t\t\t\t\t: [\n\t\t\t\t\t\t\tvalues.length > 1 ? `${values.length} selected` : undefined,\n\t\t\t\t\t\t\timageCount > 0 ? `${imageCount} image${imageCount === 1 ? \"\" : \"s\"}` : undefined,\n\t\t\t\t\t\t].filter((value): value is string => value !== undefined),\n\t\t\tdetails: values.length > 0 ? [`answer: ${values.join(\", \")}`] : undefined,\n\t\t};\n\t});\n\tconst skipped = details.answers.filter((answer) => answer.skipped).length;\n\treturn {\n\t\tlabel: \"question\",\n\t\taction: details.cancelled ? \"cancelled\" : \"answered\",\n\t\tstatus: details.cancelled ? \"warning\" : \"success\",\n\t\tsummary: details.cancelled\n\t\t\t? undefined\n\t\t\t: [`${details.answers.length - skipped} answered`, skipped ? `${skipped} skipped` : undefined].filter(\n\t\t\t\t\t(value): value is string => value !== undefined,\n\t\t\t\t),\n\t\trows,\n\t};\n}\n\nfunction stoppedResult(\n\tquestions: readonly AskQuestion[],\n\treason: AskQuestionStopReason,\n\terror?: string,\n): { content: Array<{ type: \"text\"; text: string }>; details: AskQuestionToolDetails } {\n\treturn {\n\t\tcontent: [{ type: \"text\", text: error ?? `ask_question stopped: ${reason}` }],\n\t\tdetails: { questions, answers: [], cancelled: true, reason, ...(error ? { error } : {}) },\n\t};\n}\n\nexport function createAskQuestionToolDefinition(options: AskQuestionToolOptions = {}) {\n\tconst name = options.name ?? \"ask_question\";\n\treturn defineTool<typeof askQuestionSchema, AskQuestionToolDetails>({\n\t\tname,\n\t\tlabel: options.label ?? \"Ask Question\",\n\t\tdescription:\n\t\t\t\"Ask the human owner one to four concise questions when a missing choice materially changes the work. The harness supplies Other and Skip choices, supports single- and multi-select answers, and returns a typed answer set.\",\n\t\tpromptSnippet: \"Ask the human owner for a consequential missing choice through the native interactive UI.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use this tool only when a missing owner choice materially changes the result, authority, risk, or acceptance criteria; otherwise proceed with a safe stated assumption.\",\n\t\t\t\"Batch independent questions into one call, with at most four questions and two to four genuine options each.\",\n\t\t\t\"Make every option label concise and describe its concrete consequence or tradeoff. Do not add Other, Skip, None, or filler options; the harness supplies Other and Skip.\",\n\t\t\t\"Set multiSelect only when choices are genuinely independent. Never use a question to delegate a decision already fixed by an owner-authored profile or policy.\",\n\t\t\t\"Respect skipped or cancelled input as owner intent. Do not immediately repeat the same question; proceed safely or report the unresolved boundary.\",\n\t\t],\n\t\tparameters: askQuestionSchema,\n\t\texecutionMode: \"sequential\",\n\t\trenderShell: \"self\",\n\t\trenderCall() {\n\t\t\treturn emptyOrchestrationCall();\n\t\t},\n\t\trenderResult(result, { expanded, isPartial }, theme) {\n\t\t\tif (isPartial) {\n\t\t\t\treturn new OrchestrationPanelComponent(theme, {\n\t\t\t\t\tlabel: \"question\",\n\t\t\t\t\taction: \"waiting for you\",\n\t\t\t\t\tstatus: \"running\",\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn new OrchestrationPanelComponent(theme, questionPanelModel(result.details), expanded);\n\t\t},\n\t\tasync execute(_toolCallId, input, signal, _onUpdate, ctx) {\n\t\t\tconst validationError = validateQuestions(input.questions);\n\t\t\tif (validationError) return stoppedResult(input.questions, \"invalid_questions\", validationError);\n\t\t\tif (!ctx.hasUI) {\n\t\t\t\treturn stoppedResult(input.questions, \"ui_unavailable\", \"ask_question requires interactive UI.\");\n\t\t\t}\n\t\t\tif (signal?.aborted) return stoppedResult(input.questions, \"interrupted\");\n\n\t\t\tconst request = createHumanInputRequest({\n\t\t\t\tsource: \"tool\",\n\t\t\t\ttoolCallId: _toolCallId,\n\t\t\t\ttoolName: name,\n\t\t\t\tquestions: input.questions,\n\t\t\t\tacceptsImages: ctx.model?.input.includes(\"image\") ?? false,\n\t\t\t});\n\t\t\tif (options.sessionManager) beginHumanInputRequest(options.sessionManager, request);\n\t\t\tconst resolved = options.sessionManager\n\t\t\t\t? await resolveHumanInput({\n\t\t\t\t\t\tsessionManager: options.sessionManager,\n\t\t\t\t\t\trequest,\n\t\t\t\t\t\tpresent: (presentation, dialogOptions) => ctx.ui.askQuestions(presentation, dialogOptions),\n\t\t\t\t\t\tartifactStore: options.artifactStore,\n\t\t\t\t\t\tgetImageStore: options.getImageStore,\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t})\n\t\t\t\t: await (async (): Promise<{\n\t\t\t\t\t\tsnapshot: HumanInputSnapshot;\n\t\t\t\t\t\timageContents: AskQuestionDialogResult[\"imageContents\"];\n\t\t\t\t\t}> => {\n\t\t\t\t\t\tconst result = await ctx.ui.askQuestions(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trequestId: request.requestId,\n\t\t\t\t\t\t\t\tquestions: request.questions,\n\t\t\t\t\t\t\t\tacceptsImages: request.acceptsImages,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ signal },\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tsnapshot: {\n\t\t\t\t\t\t\t\trequest,\n\t\t\t\t\t\t\t\tstatus: result.cancelled ? \"cancelled\" : \"answered\",\n\t\t\t\t\t\t\t\tanswers: result.answers,\n\t\t\t\t\t\t\t\t...(result.reason ? { reason: result.reason } : {}),\n\t\t\t\t\t\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\timageContents: result.imageContents,\n\t\t\t\t\t\t};\n\t\t\t\t\t})();\n\n\t\t\tconst details: AskQuestionToolDetails = {\n\t\t\t\tquestions: input.questions,\n\t\t\t\tanswers: resolved.snapshot.answers,\n\t\t\t\tcancelled: resolved.snapshot.status === \"cancelled\",\n\t\t\t\t...(resolved.snapshot.reason ? { reason: resolved.snapshot.reason } : {}),\n\t\t\t};\n\t\t\tif (details.cancelled) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: formatHumanInputAnswerText(resolved.snapshot) }],\n\t\t\t\t\tdetails,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{ type: \"text\" as const, text: formatHumanInputAnswerText(resolved.snapshot) },\n\t\t\t\t\t...resolved.imageContents,\n\t\t\t\t],\n\t\t\t\tdetails,\n\t\t\t};\n\t\t},\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ask-question.js","sourceRoot":"","sources":["../../../src/core/tools/ask-question.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,aAAa,EACb,KAAK,EAEL,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACN,kBAAkB,GAIlB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AAGvF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAO1B,iBAAiB,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACN,sBAAsB,EACtB,2BAA2B,GAE3B,MAAM,0BAA0B,CAAC;AAElC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAC/B;IACC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;IAC1F,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC;QACxB,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,2DAA2D;KACxE,CAAC;CACF,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAEF,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CACjC;IACC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IACjG,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QACnB,SAAS,EAA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E,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,WAAW;gBACnD,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACzE,CAAC;YACF,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;gBACvB,OAAO;oBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,0BAA0B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACzF,OAAO;iBACP,CAAC;YACH,CAAC;YAED,OAAO;gBACN,OAAO,EAAE;oBACR,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,0BAA0B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;oBAC9E,GAAG,QAAQ,CAAC,aAAa;iBACzB;gBACD,OAAO;aACP,CAAC;QACH,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { SessionManager } from \"@caupulican/pi-agent-core/node\";\nimport {\n\ttype Component,\n\tCURSOR_MARKER,\n\tInput,\n\ttype Keybinding,\n\ttruncateToWidth,\n\tvisibleWidth,\n\twrapTextWithAnsi,\n} from \"@caupulican/pi-tui\";\nimport { type Static, Type } from \"typebox\";\nimport {\n\tbindClipboardQueue,\n\ttype ClipboardInputHost,\n\ttype ClipboardQueueState,\n\ttype PendingClipboardImage,\n} from \"../../modes/interactive/clipboard-input.ts\";\nimport { formatKeyText } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { ArtifactStore } from \"../context/context-artifacts.ts\";\nimport { defineTool } from \"../extensions/types.ts\";\nimport {\n\tbeginHumanInputRequest,\n\tcreateHumanInputRequest,\n\tformatHumanInputAnswerText,\n\ttype HumanInputAnswer,\n\ttype HumanInputAnswerImage,\n\ttype HumanInputPresentationResult,\n\ttype HumanInputQuestion,\n\ttype HumanInputSnapshot,\n\ttype HumanInputStopReason,\n\tresolveHumanInput,\n} from \"../human-input.ts\";\nimport type { KeybindingsManager } from \"../keybindings.ts\";\nimport type { SessionImageStore } from \"../session-image-store.ts\";\nimport {\n\temptyOrchestrationCall,\n\tOrchestrationPanelComponent,\n\ttype OrchestrationPanelModel,\n} from \"./orchestration-panel.ts\";\n\nconst optionSchema = Type.Object(\n\t{\n\t\tlabel: Type.String({ minLength: 1, maxLength: 120, description: \"Concise option label.\" }),\n\t\tdescription: Type.String({\n\t\t\tminLength: 1,\n\t\t\tmaxLength: 500,\n\t\t\tdescription: \"Concrete consequence or tradeoff of choosing this option.\",\n\t\t}),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst questionSchema = Type.Object(\n\t{\n\t\tid: Type.String({ minLength: 1, maxLength: 80, description: \"Stable unique answer identifier.\" }),\n\t\theader: Type.String({\n\t\t\tminLength: 1,\n\t\t\tmaxLength: 32,\n\t\t\tdescription: \"Short topic label used in question navigation.\",\n\t\t}),\n\t\tquestion: Type.String({ minLength: 1, maxLength: 1_000, description: \"The specific user-facing question.\" }),\n\t\toptions: Type.Array(optionSchema, {\n\t\t\tminItems: 2,\n\t\t\tmaxItems: 4,\n\t\t\tdescription: \"Two to four genuine choices. Other and Skip are supplied by the harness.\",\n\t\t}),\n\t\tmultiSelect: Type.Optional(Type.Boolean({ description: \"Allow more than one listed option to be selected.\" })),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst askQuestionSchema = Type.Object(\n\t{\n\t\tquestions: Type.Array(questionSchema, {\n\t\t\tminItems: 1,\n\t\t\tmaxItems: 4,\n\t\t\tdescription: \"One to four independent questions presented in one interaction.\",\n\t\t}),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst ANSWER_PREVIEW_CHARS = 240;\nconst ANSWER_EDITOR_VIEWPORT_LINES = 8;\n\nexport type AskQuestionToolInput = Static<typeof askQuestionSchema>;\nexport type AskQuestion = HumanInputQuestion;\nexport type AskQuestionAnswer = HumanInputAnswer;\nexport type AskQuestionAnswerImage = HumanInputAnswerImage;\nexport type AskQuestionStopReason = HumanInputStopReason;\n\nexport interface AskQuestionToolDetails {\n\tquestions: readonly AskQuestion[];\n\tanswers: readonly AskQuestionAnswer[];\n\tcancelled: boolean;\n\treason?: AskQuestionStopReason;\n\terror?: string;\n}\n\nexport interface AskQuestionToolOptions {\n\tname?: string;\n\tlabel?: string;\n\t/** Production session sink. When present, requests and answers are checkpointed before continuation. */\n\tsessionManager?: Pick<SessionManager, \"appendCustomEntry\">;\n\tartifactStore?: ArtifactStore;\n\tgetImageStore?: () => Pick<SessionImageStore, \"retainContent\"> | undefined;\n}\n\nexport interface AskQuestionClipboardOptions {\n\tautoResizeImages: boolean;\n\tblockImages: boolean;\n\tblockImagesReason?: string;\n\timageStore?: Pick<SessionImageStore, \"write\">;\n}\n\nexport type PasteClipboardImage = (host: ClipboardInputHost) => Promise<void>;\n\nexport interface AskQuestionAnswerEditor extends Component {\n\tfocused: boolean;\n\tonSubmit?: (text: string) => void;\n\thandleInput(data: string): void;\n\tgetText(): string;\n\tsetText(text: string): void;\n\tinsertTextAtCursor(text: string): void;\n}\n\nexport type CreateAskQuestionAnswerEditor = () => AskQuestionAnswerEditor;\n\nclass SingleLineAnswerEditor implements AskQuestionAnswerEditor {\n\tprivate readonly input = new Input();\n\tonSubmit?: (text: string) => void;\n\n\tconstructor() {\n\t\tthis.input.onSubmit = (value) => this.onSubmit?.(value);\n\t}\n\n\tget focused(): boolean {\n\t\treturn this.input.focused;\n\t}\n\n\tset focused(value: boolean) {\n\t\tthis.input.focused = value;\n\t}\n\n\tgetText(): string {\n\t\treturn this.input.getValue();\n\t}\n\n\tsetText(text: string): void {\n\t\tthis.input.setValue(\"\");\n\t\tthis.insertTextAtCursor(text);\n\t}\n\n\tinsertTextAtCursor(text: string): void {\n\t\tthis.input.handleInput(`\\x1b[200~${text}\\x1b[201~`);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.input.handleInput(data);\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.input.render(width);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.input.invalidate();\n\t}\n}\n\ninterface QuestionSelection {\n\toptionIndexes: Set<number>;\n\tcustom?: string;\n\tskipped: boolean;\n}\n\ntype AskQuestionDialogResult = HumanInputPresentationResult;\n\nfunction normalizedIdentity(value: string): string {\n\treturn value.trim().toLowerCase();\n}\n\nfunction validateQuestions(questions: readonly AskQuestion[]): string | undefined {\n\tif (questions.length < 1 || questions.length > 4) return \"Provide between one and four questions.\";\n\tconst ids = new Set<string>();\n\tconst prompts = new Set<string>();\n\tfor (const question of questions) {\n\t\tif (!question.id.trim() || !question.header.trim() || !question.question.trim()) {\n\t\t\treturn \"Question ids, headers, and prompts must not be blank.\";\n\t\t}\n\t\tconst id = normalizedIdentity(question.id);\n\t\tconst prompt = normalizedIdentity(question.question);\n\t\tif (ids.has(id)) return `Question id '${question.id}' is duplicated.`;\n\t\tif (prompts.has(prompt)) return `Question '${question.question}' is duplicated.`;\n\t\tids.add(id);\n\t\tprompts.add(prompt);\n\t\tif (question.options.length < 2 || question.options.length > 4) {\n\t\t\treturn `Question '${question.header}' requires between two and four options.`;\n\t\t}\n\t\tconst labels = new Set<string>();\n\t\tfor (const option of question.options) {\n\t\t\tconst label = normalizedIdentity(option.label);\n\t\t\tif (!label || !option.description.trim()) {\n\t\t\t\treturn `Question '${question.header}' has a blank option label or description.`;\n\t\t\t}\n\t\t\tif (label === \"other\" || label === \"skip\") {\n\t\t\t\treturn `Question '${question.header}' must not define the reserved '${option.label}' option.`;\n\t\t\t}\n\t\t\tif (labels.has(label)) return `Question '${question.header}' has duplicate option '${option.label}'.`;\n\t\t\tlabels.add(label);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction displayKeys(keybindings: KeybindingsManager, keybinding: Keybinding, limit = 2): string {\n\treturn formatKeyText(keybindings.getKeys(keybinding).slice(0, limit).join(\"/\"), { capitalize: true });\n}\n\nfunction answerFor(\n\tquestion: AskQuestion,\n\tselection: QuestionSelection,\n\tattachments: readonly PendingClipboardImage[] = [],\n): AskQuestionAnswer {\n\tconst images = selection.custom\n\t\t? attachments\n\t\t\t\t.filter((attachment) => selection.custom?.includes(attachment.label))\n\t\t\t\t.map((attachment) => ({ label: attachment.label, mimeType: attachment.content.mimeType }))\n\t\t: [];\n\treturn {\n\t\tid: question.id,\n\t\theader: question.header,\n\t\tquestion: question.question,\n\t\tselected: [...selection.optionIndexes]\n\t\t\t.sort((left, right) => left - right)\n\t\t\t.map((index) => question.options[index]?.label)\n\t\t\t.filter((label): label is string => label !== undefined),\n\t\t...(selection.custom ? { custom: selection.custom } : {}),\n\t\t...(images.length > 0 ? { images } : {}),\n\t\tskipped: selection.skipped,\n\t};\n}\n\nfunction previewAnswer(value: string): string {\n\tif (value.length <= ANSWER_PREVIEW_CHARS) return value;\n\treturn `${value.slice(0, ANSWER_PREVIEW_CHARS)}… (${value.length} characters)`;\n}\n\nfunction isResolved(selection: QuestionSelection): boolean {\n\treturn selection.skipped || selection.optionIndexes.size > 0 || selection.custom !== undefined;\n}\n\n/** Native focused question interaction shared by every provider-facing ask_question call. */\nexport class AskQuestionDialog implements Component {\n\tprivate readonly questions: readonly AskQuestion[];\n\tprivate readonly theme: Theme;\n\tprivate readonly keybindings: KeybindingsManager;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly finish: (result: AskQuestionDialogResult) => void;\n\tprivate readonly clipboard: AskQuestionClipboardOptions;\n\tprivate readonly pasteClipboardImage: PasteClipboardImage;\n\tprivate readonly createAnswerEditor: CreateAskQuestionAnswerEditor;\n\tprivate readonly selections: QuestionSelection[];\n\tprivate readonly cursors: number[];\n\tprivate readonly clipboardQueue: ClipboardQueueState = {\n\t\tpendingClipboardImages: [],\n\t\tclipboardImageCounter: 0,\n\t};\n\tprivate currentIndex = 0;\n\tprivate input: AskQuestionAnswerEditor | undefined;\n\tprivate inputError: string | undefined;\n\tprivate inputStatus: string | undefined;\n\tprivate pasteInFlight = false;\n\tprivate submitAfterPaste = false;\n\tprivate cachedWidth: number | undefined;\n\tprivate cachedLines: string[] | undefined;\n\tprivate settled = false;\n\n\tconstructor(options: {\n\t\tquestions: readonly AskQuestion[];\n\t\ttheme: Theme;\n\t\tkeybindings: KeybindingsManager;\n\t\trequestRender: () => void;\n\t\tfinish: (result: AskQuestionDialogResult) => void;\n\t\tclipboard?: AskQuestionClipboardOptions;\n\t\tpasteClipboardImage?: PasteClipboardImage;\n\t\tcreateAnswerEditor?: CreateAskQuestionAnswerEditor;\n\t}) {\n\t\tthis.questions = options.questions;\n\t\tthis.theme = options.theme;\n\t\tthis.keybindings = options.keybindings;\n\t\tthis.requestRender = options.requestRender;\n\t\tthis.finish = options.finish;\n\t\tthis.clipboard = options.clipboard ?? { autoResizeImages: true, blockImages: false };\n\t\tthis.pasteClipboardImage =\n\t\t\toptions.pasteClipboardImage ??\n\t\t\t(async (host) => {\n\t\t\t\thost.showWarning(\"Clipboard paste is unavailable in this UI host.\");\n\t\t\t});\n\t\tthis.createAnswerEditor = options.createAnswerEditor ?? (() => new SingleLineAnswerEditor());\n\t\tthis.selections = options.questions.map(() => ({ optionIndexes: new Set(), skipped: false }));\n\t\tthis.cursors = options.questions.map(() => 0);\n\t}\n\n\tprivate refresh(): void {\n\t\tthis.invalidate();\n\t\tthis.requestRender();\n\t}\n\n\tprivate result(cancelled: boolean, reason?: AskQuestionStopReason): AskQuestionDialogResult {\n\t\tconst answers = this.questions.map((question, index) =>\n\t\t\tanswerFor(question, this.selections[index]!, this.clipboardQueue.pendingClipboardImages),\n\t\t);\n\t\tconst referencedLabels = new Set(answers.flatMap((answer) => answer.images?.map((image) => image.label) ?? []));\n\t\treturn {\n\t\t\tanswers,\n\t\t\tcancelled,\n\t\t\timageContents: cancelled\n\t\t\t\t? []\n\t\t\t\t: this.clipboardQueue.pendingClipboardImages\n\t\t\t\t\t\t.filter((attachment) => referencedLabels.has(attachment.label))\n\t\t\t\t\t\t.map((attachment) => attachment.content),\n\t\t\t...(reason ? { reason } : {}),\n\t\t};\n\t}\n\n\tprivate complete(result: AskQuestionDialogResult): void {\n\t\tif (this.settled) return;\n\t\tthis.settled = true;\n\t\tif (this.input) this.input.focused = false;\n\t\tthis.finish(result);\n\t}\n\n\tcancel(reason: Extract<AskQuestionStopReason, \"user_cancelled\" | \"interrupted\">): void {\n\t\tthis.complete(this.result(true, reason));\n\t}\n\n\tprivate move(delta: -1 | 1): void {\n\t\tconst lastIndex = this.questions.length;\n\t\tthis.currentIndex = Math.max(0, Math.min(lastIndex, this.currentIndex + delta));\n\t\tthis.refresh();\n\t}\n\n\tprivate advanceAfterSingleSelection(): void {\n\t\tif (this.questions.length === 1) {\n\t\t\tthis.complete(this.result(false));\n\t\t\treturn;\n\t\t}\n\t\tthis.currentIndex = Math.min(this.questions.length, this.currentIndex + 1);\n\t\tthis.refresh();\n\t}\n\n\tprivate beginCustomAnswer(): void {\n\t\tconst questionIndex = this.currentIndex;\n\t\tconst question = this.questions[questionIndex];\n\t\tconst selection = this.selections[questionIndex];\n\t\tif (!question || !selection) return;\n\t\tconst input = this.createAnswerEditor();\n\t\tthis.inputError = undefined;\n\t\tthis.inputStatus = undefined;\n\t\tinput.focused = true;\n\t\tif (selection.custom) input.setText(selection.custom);\n\t\tinput.onSubmit = (value) => {\n\t\t\tconst answer = value.trim();\n\t\t\tif (!answer) return;\n\t\t\tselection.custom = answer;\n\t\t\tselection.skipped = false;\n\t\t\tinput.focused = false;\n\t\t\tthis.input = undefined;\n\t\t\tif (question.multiSelect) this.refresh();\n\t\t\telse this.advanceAfterSingleSelection();\n\t\t};\n\t\tthis.input = input;\n\t\tthis.refresh();\n\t}\n\n\tprivate async pasteIntoCustomAnswer(): Promise<void> {\n\t\tconst input = this.input;\n\t\tif (!input || this.pasteInFlight) return;\n\t\tthis.pasteInFlight = true;\n\t\tthis.inputError = undefined;\n\t\tthis.inputStatus = \"Reading clipboard…\";\n\t\tthis.refresh();\n\t\tlet reported = false;\n\t\tconst host: ClipboardInputHost = bindClipboardQueue(this.clipboardQueue, {\n\t\t\teditor: {\n\t\t\t\thandleInput: (data) => input.handleInput(data),\n\t\t\t\tinsertTextAtCursor: (text) => input.insertTextAtCursor(text),\n\t\t\t},\n\t\t\tui: { requestRender: () => this.refresh() },\n\t\t\tautoResizeImages: this.clipboard.autoResizeImages,\n\t\t\tblockImages: this.clipboard.blockImages,\n\t\t\tblockImagesReason: this.clipboard.blockImagesReason,\n\t\t\timageStore: this.clipboard.imageStore,\n\t\t\tshowStatus: (message) => {\n\t\t\t\treported = true;\n\t\t\t\tthis.inputStatus = message;\n\t\t\t\tthis.inputError = undefined;\n\t\t\t},\n\t\t\tshowWarning: (message) => {\n\t\t\t\treported = true;\n\t\t\t\tthis.inputStatus = undefined;\n\t\t\t\tthis.inputError = message;\n\t\t\t\tthis.refresh();\n\t\t\t},\n\t\t});\n\t\ttry {\n\t\t\tawait this.pasteClipboardImage(host);\n\t\t} finally {\n\t\t\tthis.pasteInFlight = false;\n\t\t\tconst shouldSubmit = this.submitAfterPaste && this.input === input && !this.settled;\n\t\t\tthis.submitAfterPaste = false;\n\t\t\tif (!reported) this.inputStatus = undefined;\n\t\t\tif (shouldSubmit) input.onSubmit?.(input.getText());\n\t\t\tif (this.input === input && !this.settled) this.refresh();\n\t\t}\n\t}\n\n\tprivate selectCurrent(): void {\n\t\tconst question = this.questions[this.currentIndex];\n\t\tconst selection = this.selections[this.currentIndex];\n\t\tif (!question || !selection) return;\n\t\tconst cursor = this.cursors[this.currentIndex] ?? 0;\n\t\tif (cursor === question.options.length) {\n\t\t\tthis.beginCustomAnswer();\n\t\t\treturn;\n\t\t}\n\t\tif (cursor === question.options.length + 1) {\n\t\t\tselection.optionIndexes.clear();\n\t\t\tselection.custom = undefined;\n\t\t\tselection.skipped = true;\n\t\t\tthis.advanceAfterSingleSelection();\n\t\t\treturn;\n\t\t}\n\t\tselection.skipped = false;\n\t\tif (question.multiSelect) {\n\t\t\tif (selection.optionIndexes.has(cursor)) selection.optionIndexes.delete(cursor);\n\t\t\telse selection.optionIndexes.add(cursor);\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tselection.optionIndexes.clear();\n\t\tselection.optionIndexes.add(cursor);\n\t\tselection.custom = undefined;\n\t\tthis.advanceAfterSingleSelection();\n\t}\n\n\tprivate submitReview(): void {\n\t\tconst unresolved = this.selections.findIndex((selection) => !isResolved(selection));\n\t\tif (unresolved >= 0) {\n\t\t\tthis.currentIndex = unresolved;\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tthis.complete(this.result(false));\n\t}\n\n\thandleInput(data: string): void {\n\t\tif (this.settled) return;\n\t\tif (this.input) {\n\t\t\tif (this.keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\t\tthis.submitAfterPaste = false;\n\t\t\t\tthis.input.focused = false;\n\t\t\t\tthis.input = undefined;\n\t\t\t\tthis.refresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this.keybindings.matches(data, \"app.clipboard.pasteImage\")) {\n\t\t\t\tvoid this.pasteIntoCustomAnswer();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this.pasteInFlight && this.keybindings.matches(data, \"tui.input.submit\")) {\n\t\t\t\tthis.submitAfterPaste = true;\n\t\t\t\tthis.inputStatus = \"Finishing clipboard paste…\";\n\t\t\t\tthis.refresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst input = this.input;\n\t\t\tthis.inputError = undefined;\n\t\t\tthis.inputStatus = undefined;\n\t\t\tinput.handleInput(data);\n\t\t\tif (this.input === input) this.refresh();\n\t\t\treturn;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.cancel(\"user_cancelled\");\n\t\t\treturn;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"app.question.previous\")) {\n\t\t\tthis.move(-1);\n\t\t\treturn;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"app.question.next\")) {\n\t\t\tthis.move(1);\n\t\t\treturn;\n\t\t}\n\t\tif (this.currentIndex === this.questions.length) {\n\t\t\tif (this.keybindings.matches(data, \"tui.select.confirm\")) this.submitReview();\n\t\t\treturn;\n\t\t}\n\t\tconst question = this.questions[this.currentIndex];\n\t\tif (!question) return;\n\t\tif (this.keybindings.matches(data, \"tui.select.up\")) {\n\t\t\tthis.cursors[this.currentIndex] = Math.max(0, (this.cursors[this.currentIndex] ?? 0) - 1);\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"tui.select.down\")) {\n\t\t\tthis.cursors[this.currentIndex] = Math.min(\n\t\t\t\tquestion.options.length + 1,\n\t\t\t\t(this.cursors[this.currentIndex] ?? 0) + 1,\n\t\t\t);\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tif (\n\t\t\tthis.keybindings.matches(data, \"tui.select.confirm\") ||\n\t\t\t(question.multiSelect && this.keybindings.matches(data, \"app.question.toggle\"))\n\t\t) {\n\t\t\tthis.selectCurrent();\n\t\t}\n\t}\n\n\tprivate addWrapped(lines: string[], text: string, width: number, indent = \"\"): void {\n\t\tconst contentWidth = Math.max(1, width - visibleWidth(indent));\n\t\tfor (const line of wrapTextWithAnsi(text, contentWidth)) {\n\t\t\tlines.push(truncateToWidth(`${indent}${line}`, width, \"\"));\n\t\t}\n\t}\n\n\tprivate renderProgress(lines: string[], width: number): void {\n\t\tif (this.questions.length === 1 && !this.questions[0]?.multiSelect) return;\n\t\tconst chips = this.questions.map((question, index) => {\n\t\t\tconst resolved = isResolved(this.selections[index]!);\n\t\t\tconst text = ` ${resolved ? \"●\" : \"○\"} ${question.header} `;\n\t\t\treturn index === this.currentIndex\n\t\t\t\t? this.theme.bg(\"selectedBg\", this.theme.fg(\"text\", text))\n\t\t\t\t: this.theme.fg(resolved ? \"success\" : \"muted\", text);\n\t\t});\n\t\tconst review = \" Review \";\n\t\tchips.push(\n\t\t\tthis.currentIndex === this.questions.length\n\t\t\t\t? this.theme.bg(\"selectedBg\", this.theme.fg(\"text\", review))\n\t\t\t\t: this.theme.fg(\"dim\", review),\n\t\t);\n\t\tlines.push(truncateToWidth(chips.join(\" \"), width, \"\"));\n\t\tlines.push(\"\");\n\t}\n\n\tprivate renderQuestion(lines: string[], width: number, question: AskQuestion): void {\n\t\tconst questionIndex = this.currentIndex;\n\t\tconst selection = this.selections[questionIndex]!;\n\t\tconst cursor = this.cursors[questionIndex] ?? 0;\n\t\tthis.addWrapped(lines, this.theme.bold(question.question), width);\n\t\tif (question.multiSelect) {\n\t\t\tlines.push(this.theme.fg(\"muted\", \"Choose one or more, then continue to review.\"));\n\t\t}\n\t\tlines.push(\"\");\n\n\t\tquestion.options.forEach((option, index) => {\n\t\t\tconst active = index === cursor;\n\t\t\tconst chosen = selection.optionIndexes.has(index);\n\t\t\tconst prefix = `${active ? \"›\" : \" \"} ${chosen ? \"●\" : \"○\"} `;\n\t\t\tconst label = `${prefix}${option.label}`;\n\t\t\tlines.push(\n\t\t\t\ttruncateToWidth(\n\t\t\t\t\tactive ? this.theme.bg(\"selectedBg\", this.theme.fg(\"text\", ` ${label} `)) : this.theme.fg(\"text\", label),\n\t\t\t\t\twidth,\n\t\t\t\t\t\"\",\n\t\t\t\t),\n\t\t\t);\n\t\t\tthis.addWrapped(lines, this.theme.fg(\"muted\", option.description), width, \" \");\n\t\t});\n\n\t\tconst otherIndex = question.options.length;\n\t\tconst otherActive = cursor === otherIndex;\n\t\tconst otherLabel = selection.custom ? `Other: ${previewAnswer(selection.custom)}` : \"Other\";\n\t\tconst otherText = `${otherActive ? \"›\" : \" \"} ${selection.custom ? \"●\" : \"+\"} ${otherLabel}`;\n\t\tlines.push(\n\t\t\ttruncateToWidth(\n\t\t\t\totherActive\n\t\t\t\t\t? this.theme.bg(\"selectedBg\", this.theme.fg(\"text\", ` ${otherText} `))\n\t\t\t\t\t: this.theme.fg(\"muted\", otherText),\n\t\t\t\twidth,\n\t\t\t\t\"\",\n\t\t\t),\n\t\t);\n\t\tconst skipActive = cursor === otherIndex + 1;\n\t\tconst skipText = `${skipActive ? \"›\" : \" \"} ${selection.skipped ? \"●\" : \"–\"} Skip`;\n\t\tlines.push(\n\t\t\ttruncateToWidth(\n\t\t\t\tskipActive\n\t\t\t\t\t? this.theme.bg(\"selectedBg\", this.theme.fg(\"text\", ` ${skipText} `))\n\t\t\t\t\t: this.theme.fg(\"dim\", skipText),\n\t\t\t\twidth,\n\t\t\t\t\"\",\n\t\t\t),\n\t\t);\n\n\t\tif (this.input) {\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(this.theme.fg(\"muted\", \"Your answer\"));\n\t\t\tconst renderedInput = this.input.render(Math.max(4, width - 2));\n\t\t\tconst cursorLine = Math.max(\n\t\t\t\t0,\n\t\t\t\trenderedInput.findIndex((line) => line.includes(CURSOR_MARKER)),\n\t\t\t);\n\t\t\tconst viewportStart = Math.max(\n\t\t\t\t0,\n\t\t\t\tMath.min(\n\t\t\t\t\tcursorLine - Math.floor(ANSWER_EDITOR_VIEWPORT_LINES / 2),\n\t\t\t\t\trenderedInput.length - ANSWER_EDITOR_VIEWPORT_LINES,\n\t\t\t\t),\n\t\t\t);\n\t\t\tconst visibleInput = renderedInput.slice(viewportStart, viewportStart + ANSWER_EDITOR_VIEWPORT_LINES);\n\t\t\tif (viewportStart > 0) {\n\t\t\t\tlines.push(this.theme.fg(\"dim\", ` ↑ ${viewportStart} earlier line${viewportStart === 1 ? \"\" : \"s\"}`));\n\t\t\t}\n\t\t\tfor (const inputLine of visibleInput) {\n\t\t\t\tlines.push(truncateToWidth(` ${inputLine}`, width, \"\"));\n\t\t\t}\n\t\t\tconst remainingLines = renderedInput.length - viewportStart - visibleInput.length;\n\t\t\tif (remainingLines > 0) {\n\t\t\t\tlines.push(this.theme.fg(\"dim\", ` ↓ ${remainingLines} later line${remainingLines === 1 ? \"\" : \"s\"}`));\n\t\t\t}\n\t\t\tif (this.inputError) this.addWrapped(lines, this.theme.fg(\"warning\", this.inputError), width, \" \");\n\t\t\tif (this.inputStatus) this.addWrapped(lines, this.theme.fg(\"success\", this.inputStatus), width, \" \");\n\t\t}\n\t}\n\n\tprivate renderReview(lines: string[], width: number): void {\n\t\tlines.push(this.theme.bold(\"Review your answers\"));\n\t\tlines.push(\"\");\n\t\tlet unresolved = 0;\n\t\tthis.questions.forEach((question, index) => {\n\t\t\tconst answer = answerFor(question, this.selections[index]!);\n\t\t\tconst values = [...answer.selected, ...(answer.custom ? [previewAnswer(answer.custom)] : [])];\n\t\t\tconst value = answer.skipped ? \"Skipped\" : values.length > 0 ? values.join(\", \") : \"Unanswered\";\n\t\t\tif (!isResolved(this.selections[index]!)) unresolved++;\n\t\t\tthis.addWrapped(\n\t\t\t\tlines,\n\t\t\t\t`${this.theme.fg(\"muted\", `${question.header}:`)} ${this.theme.fg(value === \"Unanswered\" ? \"warning\" : \"text\", value)}`,\n\t\t\t\twidth,\n\t\t\t);\n\t\t});\n\t\tif (unresolved > 0) {\n\t\t\tlines.push(\"\");\n\t\t\tthis.addWrapped(\n\t\t\t\tlines,\n\t\t\t\tthis.theme.fg(\n\t\t\t\t\t\"warning\",\n\t\t\t\t\t`${unresolved} unanswered. Answer or explicitly skip each question before submitting.`,\n\t\t\t\t),\n\t\t\t\twidth,\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate renderHelp(lines: string[], width: number): void {\n\t\tconst cancel = displayKeys(this.keybindings, \"tui.select.cancel\", 1);\n\t\tlet help: string;\n\t\tif (this.input) {\n\t\t\thelp = `${displayKeys(this.keybindings, \"tui.input.submit\", 1)} save · ${displayKeys(this.keybindings, \"tui.input.newLine\", 1)} newline · ${displayKeys(this.keybindings, \"app.clipboard.pasteImage\", 1)} paste · ${cancel} back`;\n\t\t} else if (this.currentIndex === this.questions.length) {\n\t\t\thelp = `${displayKeys(this.keybindings, \"tui.select.confirm\", 1)} submit · ${displayKeys(this.keybindings, \"app.question.previous\")} back · ${cancel} cancel`;\n\t\t} else if (this.questions[this.currentIndex]?.multiSelect) {\n\t\t\thelp = `${displayKeys(this.keybindings, \"tui.select.up\")}/${displayKeys(this.keybindings, \"tui.select.down\")} move · ${displayKeys(this.keybindings, \"app.question.toggle\", 1)}/${displayKeys(this.keybindings, \"tui.select.confirm\", 1)} toggle · ${displayKeys(this.keybindings, \"app.question.next\")} next · ${cancel} cancel`;\n\t\t} else {\n\t\t\thelp = `${displayKeys(this.keybindings, \"tui.select.up\")}/${displayKeys(this.keybindings, \"tui.select.down\")} move · ${displayKeys(this.keybindings, \"tui.select.confirm\", 1)} select · ${cancel} cancel`;\n\t\t}\n\t\tthis.addWrapped(lines, this.theme.fg(\"dim\", help), width);\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.cachedWidth === width && this.cachedLines) return this.cachedLines;\n\t\tconst safeWidth = Math.max(1, width);\n\t\tconst lines: string[] = [];\n\t\tconst header = this.currentIndex === this.questions.length ? \"review\" : this.questions[this.currentIndex]?.header;\n\t\tlines.push(\n\t\t\ttruncateToWidth(\n\t\t\t\t`${this.theme.fg(\"accent\", \"?\")} ${this.theme.bold(header ?? \"question\")} ${this.theme.fg(\"dim\", `${Math.min(this.currentIndex + 1, this.questions.length)}/${this.questions.length}`)}`,\n\t\t\t\tsafeWidth,\n\t\t\t\t\"\",\n\t\t\t),\n\t\t);\n\t\tlines.push(\"\");\n\t\tthis.renderProgress(lines, safeWidth);\n\t\tconst question = this.questions[this.currentIndex];\n\t\tif (question) this.renderQuestion(lines, safeWidth, question);\n\t\telse this.renderReview(lines, safeWidth);\n\t\tlines.push(\"\");\n\t\tthis.renderHelp(lines, safeWidth);\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedLines = lines.map((line) => truncateToWidth(line, safeWidth, \"\"));\n\t\treturn this.cachedLines;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n}\n\nfunction questionPanelModel(details: AskQuestionToolDetails | undefined): OrchestrationPanelModel {\n\tif (!details) {\n\t\treturn { label: \"question\", status: \"error\", emptyText: \"No structured answer was retained.\" };\n\t}\n\tif (details.reason === \"ui_unavailable\" || details.reason === \"invalid_questions\") {\n\t\treturn {\n\t\t\tlabel: \"question\",\n\t\t\taction: \"unavailable\",\n\t\t\tstatus: \"error\",\n\t\t\temptyText: details.error ?? \"User input is unavailable.\",\n\t\t};\n\t}\n\tconst rows = details.questions.map((question) => {\n\t\tconst answer = details.answers.find((candidate) => candidate.id === question.id);\n\t\tconst values = answer ? [...answer.selected, ...(answer.custom ? [previewAnswer(answer.custom)] : [])] : [];\n\t\tconst imageCount = answer?.images?.length ?? 0;\n\t\treturn {\n\t\t\tstatus: details.cancelled\n\t\t\t\t? (\"cancelled\" as const)\n\t\t\t\t: answer?.skipped\n\t\t\t\t\t? (\"cancelled\" as const)\n\t\t\t\t\t: (\"completed\" as const),\n\t\t\tlabel: question.header,\n\t\t\tmeta: details.cancelled\n\t\t\t\t? [details.reason === \"interrupted\" ? \"interrupted\" : \"cancelled\"]\n\t\t\t\t: answer?.skipped\n\t\t\t\t\t? [\"skipped\"]\n\t\t\t\t\t: [\n\t\t\t\t\t\t\tvalues.length > 1 ? `${values.length} selected` : undefined,\n\t\t\t\t\t\t\timageCount > 0 ? `${imageCount} image${imageCount === 1 ? \"\" : \"s\"}` : undefined,\n\t\t\t\t\t\t].filter((value): value is string => value !== undefined),\n\t\t\tdetails: values.length > 0 ? [`answer: ${values.join(\", \")}`] : undefined,\n\t\t};\n\t});\n\tconst skipped = details.answers.filter((answer) => answer.skipped).length;\n\treturn {\n\t\tlabel: \"question\",\n\t\taction: details.cancelled ? \"cancelled\" : \"answered\",\n\t\tstatus: details.cancelled ? \"warning\" : \"success\",\n\t\tsummary: details.cancelled\n\t\t\t? undefined\n\t\t\t: [`${details.answers.length - skipped} answered`, skipped ? `${skipped} skipped` : undefined].filter(\n\t\t\t\t\t(value): value is string => value !== undefined,\n\t\t\t\t),\n\t\trows,\n\t};\n}\n\nfunction stoppedResult(\n\tquestions: readonly AskQuestion[],\n\treason: AskQuestionStopReason,\n\terror?: string,\n): { content: Array<{ type: \"text\"; text: string }>; details: AskQuestionToolDetails } {\n\treturn {\n\t\tcontent: [{ type: \"text\", text: error ?? `ask_question stopped: ${reason}` }],\n\t\tdetails: { questions, answers: [], cancelled: true, reason, ...(error ? { error } : {}) },\n\t};\n}\n\nexport function createAskQuestionToolDefinition(options: AskQuestionToolOptions = {}) {\n\tconst name = options.name ?? \"ask_question\";\n\treturn defineTool<typeof askQuestionSchema, AskQuestionToolDetails>({\n\t\tname,\n\t\tlabel: options.label ?? \"Ask Question\",\n\t\tdescription:\n\t\t\t\"Ask the human owner one to four concise questions when a missing choice materially changes the work. The harness supplies Other and Skip choices, supports single- and multi-select answers, and returns a typed answer set.\",\n\t\tpromptSnippet: \"Ask the human owner for a consequential missing choice through the native interactive UI.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use this tool only when a missing owner choice materially changes the result, authority, risk, or acceptance criteria; otherwise proceed with a safe stated assumption.\",\n\t\t\t\"Batch independent questions into one call, with at most four questions and two to four genuine options each.\",\n\t\t\t\"Make every option label concise and describe its concrete consequence or tradeoff. Do not add Other, Skip, None, or filler options; the harness supplies Other and Skip.\",\n\t\t\t\"Set multiSelect only when choices are genuinely independent. Never use a question to delegate a decision already fixed by an owner-authored profile or policy.\",\n\t\t\t\"Respect skipped or cancelled input as owner intent. Do not immediately repeat the same question; proceed safely or report the unresolved boundary.\",\n\t\t],\n\t\tparameters: askQuestionSchema,\n\t\texecutionMode: \"sequential\",\n\t\trenderShell: \"self\",\n\t\trenderCall() {\n\t\t\treturn emptyOrchestrationCall();\n\t\t},\n\t\trenderResult(result, { expanded, isPartial }, theme) {\n\t\t\tif (isPartial) {\n\t\t\t\treturn new OrchestrationPanelComponent(theme, {\n\t\t\t\t\tlabel: \"question\",\n\t\t\t\t\taction: \"waiting for you\",\n\t\t\t\t\tstatus: \"running\",\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn new OrchestrationPanelComponent(theme, questionPanelModel(result.details), expanded);\n\t\t},\n\t\tasync execute(_toolCallId, input, signal, _onUpdate, ctx) {\n\t\t\tconst validationError = validateQuestions(input.questions);\n\t\t\tif (validationError) return stoppedResult(input.questions, \"invalid_questions\", validationError);\n\t\t\tif (!ctx.hasUI) {\n\t\t\t\treturn stoppedResult(input.questions, \"ui_unavailable\", \"ask_question requires interactive UI.\");\n\t\t\t}\n\t\t\tif (signal?.aborted) return stoppedResult(input.questions, \"interrupted\");\n\n\t\t\tconst request = createHumanInputRequest({\n\t\t\t\tsource: \"tool\",\n\t\t\t\ttoolCallId: _toolCallId,\n\t\t\t\ttoolName: name,\n\t\t\t\tquestions: input.questions,\n\t\t\t\tacceptsImages: ctx.model?.input.includes(\"image\") ?? false,\n\t\t\t});\n\t\t\tif (options.sessionManager) beginHumanInputRequest(options.sessionManager, request);\n\t\t\tconst resolved = options.sessionManager\n\t\t\t\t? await resolveHumanInput({\n\t\t\t\t\t\tsessionManager: options.sessionManager,\n\t\t\t\t\t\trequest,\n\t\t\t\t\t\tpresent: (presentation, dialogOptions) => ctx.ui.askQuestions(presentation, dialogOptions),\n\t\t\t\t\t\tartifactStore: options.artifactStore,\n\t\t\t\t\t\tgetImageStore: options.getImageStore,\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t})\n\t\t\t\t: await (async (): Promise<{\n\t\t\t\t\t\tsnapshot: HumanInputSnapshot;\n\t\t\t\t\t\timageContents: AskQuestionDialogResult[\"imageContents\"];\n\t\t\t\t\t}> => {\n\t\t\t\t\t\tconst result = await ctx.ui.askQuestions(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trequestId: request.requestId,\n\t\t\t\t\t\t\t\tquestions: request.questions,\n\t\t\t\t\t\t\t\tacceptsImages: request.acceptsImages,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ signal },\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tsnapshot: {\n\t\t\t\t\t\t\t\trequest,\n\t\t\t\t\t\t\t\tstatus: result.cancelled ? \"cancelled\" : \"answered\",\n\t\t\t\t\t\t\t\tanswers: result.answers,\n\t\t\t\t\t\t\t\t...(result.reason ? { reason: result.reason } : {}),\n\t\t\t\t\t\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\timageContents: result.imageContents,\n\t\t\t\t\t\t};\n\t\t\t\t\t})();\n\n\t\t\tconst details: AskQuestionToolDetails = {\n\t\t\t\tquestions: input.questions,\n\t\t\t\tanswers: resolved.snapshot.answers,\n\t\t\t\tcancelled: resolved.snapshot.status === \"cancelled\",\n\t\t\t\t...(resolved.snapshot.reason ? { reason: resolved.snapshot.reason } : {}),\n\t\t\t};\n\t\t\tif (details.cancelled) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: formatHumanInputAnswerText(resolved.snapshot) }],\n\t\t\t\t\tdetails,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{ type: \"text\" as const, text: formatHumanInputAnswerText(resolved.snapshot) },\n\t\t\t\t\t...resolved.imageContents,\n\t\t\t\t],\n\t\t\t\tdetails,\n\t\t\t};\n\t\t},\n\t});\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import { type AgentTool } from "@caupulican/pi-agent-core";
|
|
|
2
2
|
import { type TruncationResult } from "@caupulican/pi-agent-core/node";
|
|
3
3
|
import { type Static, Type } from "typebox";
|
|
4
4
|
import type { ToolDefinition } from "../extensions/types.ts";
|
|
5
|
+
import { type ShellOutputProjectionDetails } from "./shell-output-projection.ts";
|
|
5
6
|
import { type WindowsShellEngineOptions } from "./windows-shell-engine.ts";
|
|
6
7
|
/** Agent-facing wall-clock bound: continuously producing output must not make a command immortal. */
|
|
7
8
|
export declare const DEFAULT_COMMAND_TIMEOUT_SECONDS = 120;
|
|
@@ -27,6 +28,7 @@ export interface BashToolDetails {
|
|
|
27
28
|
content: string;
|
|
28
29
|
skippedLines: number;
|
|
29
30
|
};
|
|
31
|
+
outputProjection?: ShellOutputProjectionDetails;
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
32
34
|
* Pluggable operations for the bash tool.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../src/core/tools/bash.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAyB,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAc5C,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAStF,OAAO,EAAsC,KAAK,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAU/G,qGAAqG;AACrG,eAAO,MAAM,+BAA+B,MAAM,CAAC;AACnD,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAKhD,kGAAkG;AAClG,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAExE;AAED,mGAAmG;AACnG,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAExE;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAKhF;AAED,QAAA,MAAM,UAAU;;;;EAad,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC/B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,oBAAoB,CAAC,E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;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACvB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;AAO5E,MAAM,WAAW,eAAe;IAC/B,qGAAqG;IACrG,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,6EAA6E;IAC7E,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mGAAmG;IACnG,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,uFAAuF;IACvF,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;IACtD,4FAA4F;IAC5F,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAOD,KAAK,eAAe,GAAG;IACtB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;CACrC,CAAC;AAueF,wBAAgB,wBAAwB,CACvC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,eAAe,GACvB,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,GAAG,SAAS,EAAE,eAAe,CAAC,CAGjF;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,OAAO,UAAU,CAAC,CAEnG","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { constants } from \"node:fs\";\nimport { access as fsAccess } from \"node:fs/promises\";\nimport { type AgentTool, createSilenceWatchdog } from \"@caupulican/pi-agent-core\";\nimport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationResult,\n} from \"@caupulican/pi-agent-core/node\";\nimport { Container, Text, truncateToWidth } from \"@caupulican/pi-tui\";\nimport { spawn } from \"child_process\";\nimport { type Static, Type } from \"typebox\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport { truncateToVisualLines } from \"../../modes/interactive/components/visual-truncate.ts\";\nimport { theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { waitForChildProcessWithTermination } from \"../../utils/child-process.ts\";\nimport {\n\tgetPlatformShellToolName,\n\tgetShellConfig,\n\tgetShellEnv,\n\ttype PlatformShellToolName,\n\tprefixPowerShellCommand,\n\ttrackDetachedChildPid,\n\tuntrackDetachedChildPid,\n} from \"../../utils/shell.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport { withExclusiveMutationBarrier } from \"./file-mutation-queue.ts\";\nimport { classifyGitCommand, executeFilteredGit } from \"./git-filter.ts\";\nimport { OutputAccumulator } from \"./output-accumulator.ts\";\nimport { getTextOutput, invalidArgText, str } from \"./render-utils.ts\";\nimport { assessShellSearchScope, BROAD_SEARCH_OUTPUT_ROUTE } from \"./search-command-guard.ts\";\nimport { routeShellContract } from \"./shell-contract-router.ts\";\nimport { acquirePersistentShellSession } from \"./shell-session.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\nimport { createWindowsShellEngineOperations, type WindowsShellEngineOptions } from \"./windows-shell-engine.ts\";\nimport { getOrCreateWindowsShellState, mergeEffectiveEnv, resolveEffectiveCwd } from \"./windows-shell-state.ts\";\n\n/** Default per-session key for the engine tier when a caller does not pass an explicit sessionKey\n * (e.g. the RPC `createLocalPlatformShellOperations` path); a stable key keeps `cd`/`export` state\n * persisting across calls even without an agent-scoped session key. */\nconst DEFAULT_WINDOWS_SHELL_ENGINE_SESSION_KEY = \"platform-shell-operations\";\n\n/** Low-level silence bound retained for direct shell-operation consumers. Agent tool calls always pass a wall-clock bound. */\nconst DEFAULT_COMMAND_SILENCE_MS = 600_000;\n/** Agent-facing wall-clock bound: continuously producing output must not make a command immortal. */\nexport const DEFAULT_COMMAND_TIMEOUT_SECONDS = 120;\nexport const MAX_COMMAND_TIMEOUT_SECONDS = 3600;\nconst MIN_COMMAND_TIMEOUT_SECONDS = 0.1;\nlet commandSilenceMsOverride: number | undefined;\nlet commandTimeoutMsOverride: number | undefined;\n\n/** Test hook: override the low-level silence threshold. Pass undefined to restore the default. */\nexport function setCommandSilenceMsForTests(ms: number | undefined): void {\n\tcommandSilenceMsOverride = ms;\n}\n\n/** Test hook: override the agent tool's default wall-clock bound. Pass undefined to restore it. */\nexport function setCommandTimeoutMsForTests(ms: number | undefined): void {\n\tcommandTimeoutMsOverride = ms;\n}\n\nexport function resolveCommandTimeoutSeconds(timeout: number | undefined): number {\n\tif (typeof timeout !== \"number\" || !Number.isFinite(timeout) || timeout <= 0) {\n\t\treturn DEFAULT_COMMAND_TIMEOUT_SECONDS;\n\t}\n\treturn Math.max(MIN_COMMAND_TIMEOUT_SECONDS, Math.min(timeout, MAX_COMMAND_TIMEOUT_SECONDS));\n}\n\nconst bashSchema = Type.Object({\n\tcommand: Type.String({ description: \"Shell command to execute\" }),\n\ttimeout: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: `Wall-clock timeout in seconds. Defaults to ${DEFAULT_COMMAND_TIMEOUT_SECONDS}; positive overrides are capped at ${MAX_COMMAND_TIMEOUT_SECONDS}. Zero or negative values use the default.`,\n\t\t}),\n\t),\n\tbroadSearch: Type.Optional(\n\t\tType.Literal(BROAD_SEARCH_OUTPUT_ROUTE, {\n\t\t\tdescription:\n\t\t\t\t\"Explicit override for a broad rg/grep/find/fd scan that cannot be narrowed. The command runs, but its complete output is routed to a file and excluded from model context.\",\n\t\t}),\n\t),\n});\n\nexport type BashToolInput = Static<typeof bashSchema>;\n\nexport interface BashToolDetails {\n\ttruncation?: TruncationResult;\n\tfullOutputPath?: string;\n\tfullOutputError?: string;\n\tpersistedOutputTruncated?: boolean;\n\tpersistedOutputBytes?: number;\n\tpreview?: {\n\t\tcontent: string;\n\t\tskippedLines: number;\n\t};\n}\n\n/**\n * Pluggable operations for the bash tool.\n * Override these to delegate command execution to remote systems (for example SSH).\n */\nexport interface BashOperations {\n\t/**\n\t * Execute a command and stream output.\n\t * @param command The command to execute\n\t * @param cwd Working directory\n\t * @param options Execution options\n\t * @returns Promise resolving to exit code (null if killed)\n\t */\n\texec: (\n\t\tcommand: string,\n\t\tcwd: string,\n\t\toptions: {\n\t\t\tonData: (data: Buffer) => void;\n\t\t\tsignal?: AbortSignal;\n\t\t\ttimeout?: number;\n\t\t\tenv?: NodeJS.ProcessEnv;\n\t\t},\n\t) => Promise<{ exitCode: number | null }>;\n}\n\nfunction createLocalShellOperations(\n\tshellName: PlatformShellToolName,\n\toptions?: { shellPath?: string; sessionKey?: string },\n): BashOperations {\n\t// A session key selects the persistent per-agent backend. An explicit custom shell path keeps\n\t// per-command spawning: persistent sessions assume the resolved platform shell's flag set.\n\tconst sessionKey = options?.sessionKey;\n\tif (sessionKey !== undefined && !options?.shellPath) {\n\t\treturn {\n\t\t\texec: async (command, cwd, { onData, signal, timeout, env }) => {\n\t\t\t\ttry {\n\t\t\t\t\tawait fsAccess(cwd, constants.F_OK);\n\t\t\t\t} catch {\n\t\t\t\t\tthrow new Error(`Working directory does not exist: ${cwd}\\nCannot execute ${shellName} commands.`);\n\t\t\t\t}\n\t\t\t\tif (signal?.aborted) throw new Error(\"aborted\");\n\t\t\t\tconst session = acquirePersistentShellSession(sessionKey, shellName);\n\t\t\t\tconst silenceMs = commandSilenceMsOverride ?? DEFAULT_COMMAND_SILENCE_MS;\n\t\t\t\tconst hasWallClock = timeout !== undefined && timeout > 0;\n\t\t\t\treturn session.exec(command, cwd, {\n\t\t\t\t\tonData,\n\t\t\t\t\tsignal,\n\t\t\t\t\tenv,\n\t\t\t\t\ttimeoutSeconds: hasWallClock ? timeout : undefined,\n\t\t\t\t\tsilenceMs: !hasWallClock && silenceMs > 0 ? silenceMs : undefined,\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t}\n\treturn {\n\t\texec: async (command, cwd, { onData, signal, timeout, env }) => {\n\t\t\tconst { shell, args } = getShellConfig(options?.shellPath, shellName);\n\t\t\ttry {\n\t\t\t\tawait fsAccess(cwd, constants.F_OK);\n\t\t\t} catch {\n\t\t\t\tthrow new Error(`Working directory does not exist: ${cwd}\\nCannot execute ${shellName} commands.`);\n\t\t\t}\n\t\t\tif (signal?.aborted) throw new Error(\"aborted\");\n\n\t\t\tconst child = spawn(shell, [...args, command], {\n\t\t\t\tcwd,\n\t\t\t\tdetached: process.platform !== \"win32\",\n\t\t\t\tenv: env ?? getShellEnv(),\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t\tif (child.pid) trackDetachedChildPid(child.pid);\n\t\t\tconst terminationController = new AbortController();\n\t\t\tconst onAbort = () => terminationController.abort();\n\t\t\tlet silenceKilled = false;\n\t\t\tconst silenceMs = commandSilenceMsOverride ?? DEFAULT_COMMAND_SILENCE_MS;\n\t\t\tconst silenceWatchdog =\n\t\t\t\t(timeout === undefined || timeout <= 0) && silenceMs > 0\n\t\t\t\t\t? createSilenceWatchdog({\n\t\t\t\t\t\t\tsilenceMs,\n\t\t\t\t\t\t\tonSilence: () => {\n\t\t\t\t\t\t\t\tsilenceKilled = true;\n\t\t\t\t\t\t\t\tterminationController.abort();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\t\t\t\t\t: undefined;\n\t\t\tconst onChunk = (data: Buffer) => {\n\t\t\t\tsilenceWatchdog?.touch();\n\t\t\t\tonData(data);\n\t\t\t};\n\n\t\t\ttry {\n\t\t\t\tchild.stdout?.on(\"data\", onChunk);\n\t\t\t\tchild.stderr?.on(\"data\", onChunk);\n\t\t\t\tif (signal) {\n\t\t\t\t\tif (signal.aborted) onAbort();\n\t\t\t\t\telse signal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t}\n\t\t\t\tconst terminal = await waitForChildProcessWithTermination(child, {\n\t\t\t\t\tsignal: terminationController.signal,\n\t\t\t\t\ttimeoutMs: timeout !== undefined && timeout > 0 ? timeout * 1000 : undefined,\n\t\t\t\t\tkillGraceMs: 2_000,\n\t\t\t\t});\n\t\t\t\tif (signal?.aborted) throw new Error(\"aborted\");\n\t\t\t\tif (terminal.reason === \"timeout\") throw new Error(`timeout:${timeout}`);\n\t\t\t\tif (silenceKilled) throw new Error(`silence:${silenceMs / 1000}`);\n\t\t\t\treturn { exitCode: terminal.code };\n\t\t\t} finally {\n\t\t\t\tsilenceWatchdog?.disarm();\n\t\t\t\tif (child.pid) untrackDetachedChildPid(child.pid);\n\t\t\t\tif (signal) signal.removeEventListener(\"abort\", onAbort);\n\t\t\t}\n\t\t},\n\t};\n}\n\n/**\n * Create bash operations using pi's built-in local shell execution backend.\n *\n * This is useful for extensions that intercept user_bash and still want pi's\n * standard local shell behavior while wrapping or rewriting commands.\n */\nexport function createLocalBashOperations(options?: { shellPath?: string; sessionKey?: string }): BashOperations {\n\treturn createLocalShellOperations(\"bash\", options);\n}\n\n/** Create PowerShell operations using pi's built-in local execution backend. */\nexport function createLocalPowerShellOperations(options?: { shellPath?: string; sessionKey?: string }): BashOperations {\n\treturn createLocalShellOperations(\"powershell\", options);\n}\n\n/** Create the platform shell backend without requiring callers or the model to choose a shell. */\nexport function createLocalPlatformShellOperations(\n\toptions: {\n\t\tshellPath?: string;\n\t\tcommandPrefix?: string;\n\t\toperations?: BashOperations;\n\t\tsessionKey?: string;\n\t\t/** Route complex/state-mutating Bash constructs to the Python engine on Windows. Default: true. */\n\t\tpythonEngine?: boolean;\n\t\t/** Test/embedding hook: overrides the engine tier's runtime/spawn/state resolution. */\n\t\tengineOptions?: WindowsShellEngineOptions;\n\t} = {},\n\tplatform: NodeJS.Platform = process.platform,\n): BashOperations {\n\tconst operations =\n\t\toptions.operations ??\n\t\tcreateLocalShellOperations(getPlatformShellToolName(platform), {\n\t\t\tshellPath: options.shellPath,\n\t\t\tsessionKey: options.sessionKey,\n\t\t});\n\tconst pythonEngineEnabled = options.pythonEngine !== false;\n\tconst engineSessionKey = options.sessionKey ?? DEFAULT_WINDOWS_SHELL_ENGINE_SESSION_KEY;\n\tconst engineOperations = createWindowsShellEngineOperations(engineSessionKey, options.engineOptions);\n\treturn {\n\t\tasync exec(command, cwd, execOptions) {\n\t\t\tlet resolvedCommand = command;\n\t\t\tlet resolvedCwd = cwd;\n\t\t\tlet resolvedExecOptions = execOptions;\n\t\t\tif (platform === \"win32\") {\n\t\t\t\tconst route = routeShellContract(command, platform, { pythonEngine: pythonEngineEnabled });\n\t\t\t\tif (route.kind === \"unsupported\") throw new Error(route.error);\n\t\t\t\t// The engine is the sole state mutator (D4); every Windows call — engine or PS\n\t\t\t\t// tier — reads the SAME session state so a `cd`/`export` in one call is observed\n\t\t\t\t// by the very next call regardless of which tier runs it.\n\t\t\t\tconst state = getOrCreateWindowsShellState(engineSessionKey);\n\t\t\t\tresolvedCwd = resolveEffectiveCwd(state, cwd);\n\t\t\t\tresolvedExecOptions = { ...execOptions, env: mergeEffectiveEnv(state, execOptions.env ?? getShellEnv()) };\n\t\t\t\tif (route.kind === \"python-engine\") {\n\t\t\t\t\t// The engine owns the state transition and resolves the original host cwd\n\t\t\t\t\t// exactly once. Passing the already state-adjusted cwd here would make the\n\t\t\t\t\t// engine mistake its own `cd` result for a host cwd change on the next call.\n\t\t\t\t\treturn engineOperations.exec(route.command, cwd, execOptions);\n\t\t\t\t}\n\t\t\t\tif (route.kind === \"powershell\") resolvedCommand = route.command;\n\t\t\t}\n\t\t\tif (options.commandPrefix) resolvedCommand = `${options.commandPrefix}\\n${resolvedCommand}`;\n\t\t\tif (platform === \"win32\") resolvedCommand = prefixPowerShellCommand(resolvedCommand);\n\t\t\treturn operations.exec(resolvedCommand, resolvedCwd, resolvedExecOptions);\n\t\t},\n\t};\n}\n\nexport interface BashSpawnContext {\n\tcommand: string;\n\tcwd: string;\n\tenv: NodeJS.ProcessEnv;\n}\n\nexport type BashSpawnHook = (context: BashSpawnContext) => BashSpawnContext;\n\nfunction resolveSpawnContext(command: string, cwd: string, spawnHook?: BashSpawnHook): BashSpawnContext {\n\tconst baseContext: BashSpawnContext = { command, cwd, env: { ...getShellEnv() } };\n\treturn spawnHook ? spawnHook(baseContext) : baseContext;\n}\n\nexport interface BashToolOptions {\n\t/** Platform used to choose the default backend and contract router. Defaults to process.platform. */\n\tplatform?: NodeJS.Platform;\n\t/** Custom operations for command execution. Default: local platform shell */\n\toperations?: BashOperations;\n\t/** Command prefix prepended to every command (for example shell setup commands) */\n\tcommandPrefix?: string;\n\t/** Optional explicit shell path from settings */\n\tshellPath?: string;\n\t/** Hook to adjust command, cwd, or env before execution */\n\tspawnHook?: BashSpawnHook;\n\t/**\n\t * Stable key for this agent's persistent shell session. The host passes its per-agent key so\n\t * the session survives runtime reloads and user `!` commands share it; separately created\n\t * tool instances (subagents) auto-generate their own key and stay isolated.\n\t */\n\tsessionKey?: string;\n\t/** Route complex/state-mutating Bash constructs to the Python engine on Windows. Default: true. */\n\twindowsShellPythonEngine?: boolean;\n\t/** Test/embedding hook: overrides the engine tier's runtime/spawn/state resolution. */\n\twindowsShellEngineOptions?: WindowsShellEngineOptions;\n\t/** Test/embedding hook: override the managed directory used for complete command output. */\n\toutputDirectory?: string;\n}\n\nconst BASH_PREVIEW_LINES = 5;\nconst BASH_PREVIEW_BYTES = 8 * 1024;\nconst BASH_UPDATE_THROTTLE_MS = 100;\nconst BROAD_SEARCH_MAX_PERSISTED_BYTES = 8 * 1024 * 1024;\n\ntype BashRenderState = {\n\tstartedAt: number | undefined;\n\tendedAt: number | undefined;\n\tinterval: NodeJS.Timeout | undefined;\n};\n\ntype BashResultRenderState = {\n\tcachedWidth: number | undefined;\n\tcachedLines: string[] | undefined;\n\tcachedSkipped: number | undefined;\n};\n\nclass BashResultRenderComponent extends Container {\n\tstate: BashResultRenderState = {\n\t\tcachedWidth: undefined,\n\t\tcachedLines: undefined,\n\t\tcachedSkipped: undefined,\n\t};\n}\n\nfunction formatDuration(ms: number): string {\n\treturn `${(ms / 1000).toFixed(1)}s`;\n}\n\nfunction formatBashCall(\n\targs: { command?: string; timeout?: number } | undefined,\n\tshellName: PlatformShellToolName,\n): string {\n\tconst command = str(args?.command);\n\tconst timeout = args?.timeout as number | undefined;\n\tconst timeoutSuffix = timeout ? theme.fg(\"muted\", ` (timeout ${timeout}s)`) : \"\";\n\tconst commandDisplay = command === null ? invalidArgText(theme) : command ? command : theme.fg(\"toolOutput\", \"...\");\n\tconst prompt = shellName === \"powershell\" ? \"PS>\" : \"$\";\n\treturn theme.fg(\"toolTitle\", theme.bold(`${prompt} ${commandDisplay}`)) + timeoutSuffix;\n}\n\nfunction rebuildBashResultRenderComponent(\n\tcomponent: BashResultRenderComponent,\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: BashToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\tshowImages: boolean,\n\tstartedAt: number | undefined,\n\tendedAt: number | undefined,\n): void {\n\tconst state = component.state;\n\tcomponent.clear();\n\n\tconst renderPreview = !options.expanded ? result.details?.preview : undefined;\n\tlet output = (renderPreview ? renderPreview.content : getTextOutput(result as any, showImages)).trim();\n\tconst truncation = result.details?.truncation;\n\tconst fullOutputPath = result.details?.fullOutputPath;\n\tconst fullOutputError = result.details?.fullOutputError;\n\tif (!options.isPartial && truncation?.truncated && fullOutputPath && output.endsWith(\"]\")) {\n\t\tconst footerStart = output.lastIndexOf(\"\\n\\n[\");\n\t\tif (footerStart !== -1 && output.slice(footerStart).includes(fullOutputPath)) {\n\t\t\toutput = output.slice(0, footerStart).trimEnd();\n\t\t}\n\t}\n\n\tif (output) {\n\t\tif (options.expanded) {\n\t\t\tconst styledOutput = output\n\t\t\t\t.split(\"\\n\")\n\t\t\t\t.map((line) => theme.fg(\"toolOutput\", line))\n\t\t\t\t.join(\"\\n\");\n\t\t\tcomponent.addChild(new Text(`\\n${styledOutput}`, 0, 0));\n\t\t} else {\n\t\t\tcomponent.addChild({\n\t\t\t\trender: (width: number) => {\n\t\t\t\t\tif (state.cachedLines === undefined || state.cachedWidth !== width) {\n\t\t\t\t\t\tconst preview = truncateToVisualLines(output, BASH_PREVIEW_LINES, width);\n\t\t\t\t\t\tstate.cachedLines = preview.visualLines.map((line) => theme.fg(\"toolOutput\", line));\n\t\t\t\t\t\tstate.cachedSkipped = (result.details?.preview?.skippedLines ?? 0) + preview.skippedCount;\n\t\t\t\t\t\tstate.cachedWidth = width;\n\t\t\t\t\t}\n\t\t\t\t\tif (state.cachedSkipped && state.cachedSkipped > 0) {\n\t\t\t\t\t\tconst hint =\n\t\t\t\t\t\t\ttheme.fg(\"muted\", `... (${state.cachedSkipped} earlier lines,`) +\n\t\t\t\t\t\t\t` ${keyHint(\"app.tools.expand\", \"to expand\")})`;\n\t\t\t\t\t\treturn [\"\", truncateToWidth(hint, width, \"...\"), ...(state.cachedLines ?? [])];\n\t\t\t\t\t}\n\t\t\t\t\treturn [\"\", ...(state.cachedLines ?? [])];\n\t\t\t\t},\n\t\t\t\tinvalidate: () => {\n\t\t\t\t\tstate.cachedWidth = undefined;\n\t\t\t\t\tstate.cachedLines = undefined;\n\t\t\t\t\tstate.cachedSkipped = undefined;\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\tif (truncation?.truncated || fullOutputPath || fullOutputError) {\n\t\tconst warnings: string[] = [];\n\t\tif (fullOutputPath) {\n\t\t\twarnings.push(`Full output: ${fullOutputPath}`);\n\t\t} else if (fullOutputError) {\n\t\t\twarnings.push(`Full output unavailable: ${fullOutputError}`);\n\t\t}\n\t\tif (truncation?.truncated) {\n\t\t\tif (truncation.truncatedBy === \"lines\") {\n\t\t\t\twarnings.push(`Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines`);\n\t\t\t} else {\n\t\t\t\twarnings.push(\n\t\t\t\t\t`Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tcomponent.addChild(new Text(`\\n${theme.fg(\"warning\", `[${warnings.join(\". \")}]`)}`, 0, 0));\n\t}\n\n\tif (startedAt !== undefined) {\n\t\tconst label = options.isPartial ? \"Elapsed\" : \"Took\";\n\t\tconst endTime = endedAt ?? Date.now();\n\t\tcomponent.addChild(new Text(`\\n${theme.fg(\"muted\", `${label} ${formatDuration(endTime - startedAt)}`)}`, 0, 0));\n\t}\n}\n\nfunction createShellToolDefinition(\n\tcwd: string,\n\tbackendShell: PlatformShellToolName,\n\tcontractPlatform: NodeJS.Platform,\n\toptions?: BashToolOptions,\n): ToolDefinition<typeof bashSchema, BashToolDetails | undefined, BashRenderState> {\n\tconst toolName = \"bash\";\n\tconst sessionKey = options?.sessionKey ?? `bash-tool:${randomUUID()}`;\n\tconst ops =\n\t\toptions?.operations ??\n\t\t(backendShell === \"powershell\"\n\t\t\t? createLocalPowerShellOperations({ shellPath: options?.shellPath, sessionKey })\n\t\t\t: createLocalBashOperations({ shellPath: options?.shellPath, sessionKey }));\n\tconst commandPrefix = options?.commandPrefix;\n\tconst spawnHook = options?.spawnHook;\n\tconst hasExecutionOverrides = Boolean(options?.operations || options?.shellPath || commandPrefix || spawnHook);\n\tconst canFilterCommand = !hasExecutionOverrides;\n\tconst routesWindowsContract = contractPlatform === \"win32\";\n\tconst pythonEngineEnabled = options?.windowsShellPythonEngine !== false;\n\tconst engineOperations = routesWindowsContract\n\t\t? createWindowsShellEngineOperations(sessionKey, options?.windowsShellEngineOptions)\n\t\t: undefined;\n\tconst contractDescription = routesWindowsContract\n\t\t? \"Execute Pi's stable Bash-like command contract in a persistent per-agent shell session (current directory and environment variables persist across calls, including across the PowerShell and Python engine tiers). On Windows, a deterministic router converts simple commands directly to PowerShell and routes pipelines, redirection, expansion, chaining, and state-mutating commands (cd/export/unset) through a bundled Python engine that implements the supported Bash grammar; named unsupported constructs (job control, process substitution, heredocs, nested shells, and similar) fail closed instead of being guessed.\"\n\t\t: \"Execute a Bash command in a persistent per-agent shell session: the current directory and environment variables persist across calls, and a timed-out or aborted command resets the session.\";\n\treturn {\n\t\tname: toolName,\n\t\tlabel: toolName,\n\t\tdescription: `${contractDescription} Returns stdout and stderr. Output is truncated to last ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). If truncated, full output is saved to a managed file. Broad rg/grep/find/fd scans are rejected before execution; when an exhaustive scan is unavoidable, set broadSearch=\"${BROAD_SEARCH_OUTPUT_ROUTE}\" to route all output to a managed file instead of model context. Commands have a ${DEFAULT_COMMAND_TIMEOUT_SECONDS}-second wall-clock default, including commands that keep producing output; use a positive timeout only when a scoped operation justifies a larger bound (maximum ${MAX_COMMAND_TIMEOUT_SECONDS} seconds).`,\n\t\tpromptSnippet: routesWindowsContract\n\t\t\t? \"Execute Bash-like commands; Pi routes them deterministically to PowerShell or a bundled Python engine on Windows\"\n\t\t\t: \"Execute Bash commands (ls, grep, find, etc.)\",\n\t\tpromptGuidelines: routesWindowsContract\n\t\t\t? [\n\t\t\t\t\t\"Use ordinary Bash-like commands on Windows; do not write PowerShell or ask the user to choose a shell.\",\n\t\t\t\t\t\"Pipelines, redirection, expansion (variables, command substitution, globs), chaining (&&/||/;), and cd/export/unset are supported and routed to a bundled Python engine; a fixed set of named constructs (job control, process substitution, heredocs, arithmetic expansion, nested shells, and similar) fail closed with an actionable message instead of being guessed.\",\n\t\t\t\t\t\"Working directory and environment changes from cd/export/unset persist across subsequent bash calls, including calls that route to the PowerShell tier.\",\n\t\t\t\t\t\"Supported Bash-like file commands are converted with literal-path operations; verify targets before recursive rm, cp, or mv calls.\",\n\t\t\t\t\t`Keep searches scoped and purpose-driven: discover paths first, pass an explicit root and filters, and prefer the bounded grep/find tools. Broad shell searches are rejected; use broadSearch=\"${BROAD_SEARCH_OUTPUT_ROUTE}\" only for an unavoidable exhaustive scan, then inspect the returned file with bounded reads or narrower searches.`,\n\t\t\t\t]\n\t\t\t: [\n\t\t\t\t\t`Keep searches scoped and purpose-driven: discover paths first, pass an explicit root and filters, and prefer the bounded grep/find tools. Broad shell searches are rejected; use broadSearch=\"${BROAD_SEARCH_OUTPUT_ROUTE}\" only for an unavoidable exhaustive scan, then inspect the returned file with bounded reads or narrower searches.`,\n\t\t\t\t],\n\t\tparameters: bashSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{\n\t\t\t\tcommand,\n\t\t\t\ttimeout,\n\t\t\t\tbroadSearch,\n\t\t\t}: { command: string; timeout?: number; broadSearch?: typeof BROAD_SEARCH_OUTPUT_ROUTE },\n\t\t\tsignal?: AbortSignal,\n\t\t\tonUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\tconst searchScope = assessShellSearchScope(command, cwd);\n\t\t\tif (searchScope.kind === \"broad\" && broadSearch !== BROAD_SEARCH_OUTPUT_ROUTE) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Broad search blocked before execution: ${searchScope.reason}. Narrow the path, glob, type, or pattern; prefer the grep/find tool with explicit path/glob/limit. If an exhaustive scan is required, retry with broadSearch=\"${BROAD_SEARCH_OUTPUT_ROUTE}\"; Pi will keep its output out of context and return a managed file path for bounded read or search follow-up.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst routeBroadSearchOutput = searchScope.kind === \"broad\";\n\t\t\tconst output = new OutputAccumulator({\n\t\t\t\ttempFilePrefix: `pi-${toolName}`,\n\t\t\t\ttempDirectory: options?.outputDirectory,\n\t\t\t\tpersistAllOutput: routeBroadSearchOutput,\n\t\t\t\tmaxPersistedBytes: routeBroadSearchOutput ? BROAD_SEARCH_MAX_PERSISTED_BYTES : undefined,\n\t\t\t});\n\t\t\tlet updateTimer: NodeJS.Timeout | undefined;\n\t\t\tlet updateDirty = false;\n\t\t\tlet lastUpdateAt = 0;\n\n\t\t\tconst emitOutputUpdate = () => {\n\t\t\t\tif (!onUpdate || !updateDirty) return;\n\t\t\t\tupdateDirty = false;\n\t\t\t\tlastUpdateAt = Date.now();\n\t\t\t\tconst snapshot = output.previewSnapshot(BASH_PREVIEW_LINES, BASH_PREVIEW_BYTES, {\n\t\t\t\t\tpersistIfFullTruncated: true,\n\t\t\t\t});\n\t\t\t\tif (routeBroadSearchOutput) {\n\t\t\t\t\tconst notice = snapshot.fullOutputPath\n\t\t\t\t\t\t? `Broad search running. Output is being routed to ${snapshot.fullOutputPath}`\n\t\t\t\t\t\t: \"Broad search running. Output is being routed to a managed file\";\n\t\t\t\t\tonUpdate({\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: notice }],\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tfullOutputPath: snapshot.fullOutputPath,\n\t\t\t\t\t\t\tfullOutputError: snapshot.fullOutputError,\n\t\t\t\t\t\t\tpersistedOutputTruncated: snapshot.persistedOutputTruncated,\n\t\t\t\t\t\t\tpersistedOutputBytes: snapshot.persistedOutputBytes,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst preview = {\n\t\t\t\t\tcontent: snapshot.content.replace(/\\r/g, \"\"),\n\t\t\t\t\tskippedLines: Math.max(0, snapshot.truncation.totalLines - snapshot.truncation.outputLines),\n\t\t\t\t};\n\t\t\t\tonUpdate({\n\t\t\t\t\tcontent: [{ type: \"text\", text: preview.content || \"\" }],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\ttruncation: snapshot.truncation.truncated ? snapshot.truncation : undefined,\n\t\t\t\t\t\tfullOutputPath: snapshot.fullOutputPath,\n\t\t\t\t\t\tfullOutputError: snapshot.fullOutputError,\n\t\t\t\t\t\tpreview,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tconst clearUpdateTimer = () => {\n\t\t\t\tif (updateTimer) {\n\t\t\t\t\tclearTimeout(updateTimer);\n\t\t\t\t\tupdateTimer = undefined;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst scheduleOutputUpdate = () => {\n\t\t\t\tif (!onUpdate) return;\n\t\t\t\tupdateDirty = true;\n\t\t\t\tconst delay = BASH_UPDATE_THROTTLE_MS - (Date.now() - lastUpdateAt);\n\t\t\t\tif (delay <= 0) {\n\t\t\t\t\tclearUpdateTimer();\n\t\t\t\t\temitOutputUpdate();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tupdateTimer ??= setTimeout(() => {\n\t\t\t\t\tupdateTimer = undefined;\n\t\t\t\t\temitOutputUpdate();\n\t\t\t\t}, delay);\n\t\t\t};\n\n\t\t\tif (onUpdate) {\n\t\t\t\tonUpdate({ content: [], details: undefined });\n\t\t\t}\n\n\t\t\tconst handleData = (data: Buffer) => {\n\t\t\t\toutput.append(data);\n\t\t\t\tscheduleOutputUpdate();\n\t\t\t};\n\n\t\t\tconst finishOutput = async () => {\n\t\t\t\toutput.finish();\n\t\t\t\tclearUpdateTimer();\n\t\t\t\temitOutputUpdate();\n\t\t\t\treturn output.snapshot({ persistIfTruncated: true });\n\t\t\t};\n\n\t\t\tconst formatOutput = (snapshot: Awaited<ReturnType<typeof finishOutput>>, emptyText = \"(no output)\") => {\n\t\t\t\tconst truncation = snapshot.truncation;\n\t\t\t\tif (routeBroadSearchOutput) {\n\t\t\t\t\tif (snapshot.fullOutputPath) {\n\t\t\t\t\t\tconst persistenceNotice = snapshot.persistedOutputTruncated\n\t\t\t\t\t\t\t? `The managed ${formatSize(BROAD_SEARCH_MAX_PERSISTED_BYTES)} file limit was reached; later output was discarded.`\n\t\t\t\t\t\t\t: \"\";\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttext: `Broad search output routed to ${snapshot.fullOutputPath}. ${persistenceNotice} Inspect it with bounded read offsets or a narrower search.`,\n\t\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\t\t...(truncation.truncated ? { truncation } : {}),\n\t\t\t\t\t\t\t\tfullOutputPath: snapshot.fullOutputPath,\n\t\t\t\t\t\t\t\tpersistedOutputTruncated: snapshot.persistedOutputTruncated,\n\t\t\t\t\t\t\t\tpersistedOutputBytes: snapshot.persistedOutputBytes,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tconst boundedTail = snapshot.content.replace(/\\r/g, \"\") || emptyText;\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttext: `Broad search output could not be routed to a managed file${snapshot.fullOutputError ? `: ${snapshot.fullOutputError}` : \"\"}. Bounded tail:\\n${boundedTail}`,\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\t...(truncation.truncated ? { truncation } : {}),\n\t\t\t\t\t\t\tfullOutputError: snapshot.fullOutputError ?? \"managed output file unavailable\",\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tlet text = snapshot.content.replace(/\\r/g, \"\") || emptyText;\n\t\t\t\tlet details: BashToolDetails | undefined;\n\t\t\t\tconst preview = output.preview(BASH_PREVIEW_LINES, BASH_PREVIEW_BYTES);\n\t\t\t\tconst fullOutputNotice = snapshot.fullOutputPath\n\t\t\t\t\t? `Full output: ${snapshot.fullOutputPath}`\n\t\t\t\t\t: snapshot.fullOutputError\n\t\t\t\t\t\t? `Full output unavailable: ${snapshot.fullOutputError}`\n\t\t\t\t\t\t: \"Full output unavailable\";\n\t\t\t\tif (truncation.truncated || preview.skippedLines > 0) {\n\t\t\t\t\tdetails = { preview };\n\t\t\t\t}\n\t\t\t\tif (snapshot.fullOutputPath || snapshot.fullOutputError) {\n\t\t\t\t\tdetails = {\n\t\t\t\t\t\t...(details ?? {}),\n\t\t\t\t\t\tfullOutputPath: snapshot.fullOutputPath,\n\t\t\t\t\t\tfullOutputError: snapshot.fullOutputError,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\tdetails = {\n\t\t\t\t\t\t...(details ?? {}),\n\t\t\t\t\t\ttruncation,\n\t\t\t\t\t\tfullOutputPath: snapshot.fullOutputPath,\n\t\t\t\t\t\tfullOutputError: snapshot.fullOutputError,\n\t\t\t\t\t};\n\t\t\t\t\tconst startLine = truncation.totalLines - truncation.outputLines + 1;\n\t\t\t\t\tconst endLine = truncation.totalLines;\n\t\t\t\t\tif (truncation.lastLinePartial) {\n\t\t\t\t\t\tconst lastLineSize = formatSize(output.getLastLineBytes());\n\t\t\t\t\t\ttext += `\\n\\n[Showing last ${formatSize(truncation.outputBytes)} of line ${endLine} (line is ${lastLineSize}). ${fullOutputNotice}]`;\n\t\t\t\t\t} else if (truncation.truncatedBy === \"lines\") {\n\t\t\t\t\t\ttext += `\\n\\n[Showing lines ${startLine}-${endLine} of ${truncation.totalLines}. ${fullOutputNotice}]`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttext += `\\n\\n[Showing lines ${startLine}-${endLine} of ${truncation.totalLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). ${fullOutputNotice}]`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn { text, details };\n\t\t\t};\n\n\t\t\tconst appendStatus = (text: string, status: string) => `${text ? `${text}\\n\\n` : \"\"}${status}`;\n\t\t\tconst effectiveTimeoutSeconds =\n\t\t\t\ttypeof timeout === \"number\" && Number.isFinite(timeout) && timeout > 0\n\t\t\t\t\t? resolveCommandTimeoutSeconds(timeout)\n\t\t\t\t\t: (commandTimeoutMsOverride ?? DEFAULT_COMMAND_TIMEOUT_SECONDS * 1000) / 1000;\n\n\t\t\ttry {\n\t\t\t\tif (canFilterCommand) {\n\t\t\t\t\tconst classification = classifyGitCommand(command, getShellEnv());\n\t\t\t\t\tif (classification.eligible && classification.subcommand) {\n\t\t\t\t\t\tconst res = await executeFilteredGit(\n\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\tclassification.subcommand,\n\t\t\t\t\t\t\tclassification.globalOptions || [],\n\t\t\t\t\t\t\tclassification.subcommandArgs || [],\n\t\t\t\t\t\t\t{ signal, timeout: effectiveTimeoutSeconds },\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (res.exitCode !== -100) {\n\t\t\t\t\t\t\toutput.append(res.rawBytes ?? Buffer.from(res.rawOut, \"utf-8\"));\n\t\t\t\t\t\t\tconst snapshot = await finishOutput();\n\t\t\t\t\t\t\tif (res.exitCode !== 0) {\n\t\t\t\t\t\t\t\tconst { text: rawOutputText } = formatOutput(snapshot);\n\t\t\t\t\t\t\t\tthrow new Error(appendStatus(rawOutputText, `Command exited with code ${res.exitCode}`));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst details = snapshot.truncation.truncated\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\ttruncation: snapshot.truncation,\n\t\t\t\t\t\t\t\t\t\tfullOutputPath: snapshot.fullOutputPath,\n\t\t\t\t\t\t\t\t\t\tfullOutputError: snapshot.fullOutputError,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: snapshot.fullOutputPath || snapshot.fullOutputError\n\t\t\t\t\t\t\t\t\t? { fullOutputPath: snapshot.fullOutputPath, fullOutputError: snapshot.fullOutputError }\n\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\treturn { content: [{ type: \"text\", text: res.output }], details };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet backendCommand = command;\n\t\t\t\tlet engineRoute = false;\n\t\t\t\tlet effectiveCwd = cwd;\n\t\t\t\tif (routesWindowsContract) {\n\t\t\t\t\tconst route = routeShellContract(command, contractPlatform, { pythonEngine: pythonEngineEnabled });\n\t\t\t\t\tif (route.kind === \"unsupported\") throw new Error(route.error);\n\t\t\t\t\tif (route.kind === \"python-engine\") engineRoute = true;\n\t\t\t\t\tbackendCommand = route.command;\n\t\t\t\t\t// The engine is the sole state mutator (D4); every Windows call — engine or PS\n\t\t\t\t\t// tier — reads the SAME session state so a `cd`/`export` in one call is observed\n\t\t\t\t\t// by the very next call regardless of which tier runs it.\n\t\t\t\t\teffectiveCwd = resolveEffectiveCwd(getOrCreateWindowsShellState(sessionKey), cwd);\n\t\t\t\t}\n\t\t\t\t// The engine executes the RAW Bash source unchanged: no commandPrefix (arbitrary\n\t\t\t\t// PowerShell setup would not parse as Bash grammar) and no PowerShell UTF-8 prefix.\n\t\t\t\tconst resolvedCommand = engineRoute\n\t\t\t\t\t? backendCommand\n\t\t\t\t\t: backendShell === \"powershell\"\n\t\t\t\t\t\t? prefixPowerShellCommand(commandPrefix ? `${commandPrefix}\\n${backendCommand}` : backendCommand)\n\t\t\t\t\t\t: commandPrefix\n\t\t\t\t\t\t\t? `${commandPrefix}\\n${backendCommand}`\n\t\t\t\t\t\t\t: backendCommand;\n\t\t\t\tconst spawnContext = resolveSpawnContext(resolvedCommand, effectiveCwd, spawnHook);\n\t\t\t\tif (routesWindowsContract) {\n\t\t\t\t\tspawnContext.env = mergeEffectiveEnv(getOrCreateWindowsShellState(sessionKey), spawnContext.env);\n\t\t\t\t}\n\n\t\t\t\tlet exitCode: number | null;\n\t\t\t\ttry {\n\t\t\t\t\t// Shell commands cannot statically declare which files they mutate, so the\n\t\t\t\t\t// actual execution takes the coarse exclusive barrier: it waits for\n\t\t\t\t\t// in-flight edit/write mutations to drain and blocks new ones meanwhile.\n\t\t\t\t\tconst result = await withExclusiveMutationBarrier(() =>\n\t\t\t\t\t\t(engineRoute && engineOperations ? engineOperations : ops).exec(\n\t\t\t\t\t\t\tspawnContext.command,\n\t\t\t\t\t\t\tspawnContext.cwd,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tonData: handleData,\n\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t\ttimeout: effectiveTimeoutSeconds,\n\t\t\t\t\t\t\t\tenv: spawnContext.env,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\texitCode = result.exitCode;\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst snapshot = await finishOutput();\n\t\t\t\t\tconst { text } = formatOutput(snapshot, \"\");\n\t\t\t\t\tif (err instanceof Error && err.message === \"aborted\") {\n\t\t\t\t\t\tthrow new Error(appendStatus(text, \"Command aborted\"));\n\t\t\t\t\t}\n\t\t\t\t\tif (err instanceof Error && err.message.startsWith(\"timeout:\")) {\n\t\t\t\t\t\tconst timeoutSecs = err.message.split(\":\")[1];\n\t\t\t\t\t\tthrow new Error(appendStatus(text, `Command timed out after ${timeoutSecs} seconds`));\n\t\t\t\t\t}\n\t\t\t\t\tif (err instanceof Error && err.message.startsWith(\"silence:\")) {\n\t\t\t\t\t\tconst secs = err.message.split(\":\")[1];\n\t\t\t\t\t\tconst recovery =\n\t\t\t\t\t\t\tbackendShell === \"bash\"\n\t\t\t\t\t\t\t\t? \"re-run it with an explicit timeout, or run it in the background with '&'.\"\n\t\t\t\t\t\t\t\t: \"re-run it with an explicit timeout.\";\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\tappendStatus(\n\t\t\t\t\t\t\t\ttext,\n\t\t\t\t\t\t\t\t`Command killed after ${secs}s of silence (no output). If the command is legitimately quiet for long stretches, ${recovery}`,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\n\t\t\t\tconst snapshot = await finishOutput();\n\t\t\t\tconst { text: outputText, details } = formatOutput(snapshot);\n\t\t\t\tif (exitCode !== 0 && exitCode !== null) {\n\t\t\t\t\tthrow new Error(appendStatus(outputText, `Command exited with code ${exitCode}`));\n\t\t\t\t}\n\t\t\t\treturn { content: [{ type: \"text\", text: outputText }], details };\n\t\t\t} finally {\n\t\t\t\tclearUpdateTimer();\n\t\t\t\tawait output.closeTempFile();\n\t\t\t}\n\t\t},\n\t\trenderCall(args, _theme, context) {\n\t\t\tconst state = context.state;\n\t\t\tif (context.executionStarted && state.startedAt === undefined) {\n\t\t\t\tstate.startedAt = Date.now();\n\t\t\t\tstate.endedAt = undefined;\n\t\t\t}\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatBashCall(args, toolName));\n\t\t\treturn text;\n\t\t},\n\t\trenderResult(result, options, _theme, context) {\n\t\t\tconst state = context.state;\n\t\t\tif (state.startedAt !== undefined && options.isPartial && !state.interval) {\n\t\t\t\tstate.interval = setInterval(() => context.invalidate(), 1000);\n\t\t\t}\n\t\t\tif (!options.isPartial || context.isError) {\n\t\t\t\tstate.endedAt ??= Date.now();\n\t\t\t\tif (state.interval) {\n\t\t\t\t\tclearInterval(state.interval);\n\t\t\t\t\tstate.interval = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst component =\n\t\t\t\t(context.lastComponent as BashResultRenderComponent | undefined) ?? new BashResultRenderComponent();\n\t\t\trebuildBashResultRenderComponent(\n\t\t\t\tcomponent,\n\t\t\t\tresult as any,\n\t\t\t\toptions,\n\t\t\t\tcontext.showImages,\n\t\t\t\tstate.startedAt,\n\t\t\t\tstate.endedAt,\n\t\t\t);\n\t\t\tcomponent.invalidate();\n\t\t\treturn component;\n\t\t},\n\t};\n}\n\nexport function createBashToolDefinition(\n\tcwd: string,\n\toptions?: BashToolOptions,\n): ToolDefinition<typeof bashSchema, BashToolDetails | undefined, BashRenderState> {\n\tconst platform = options?.platform ?? process.platform;\n\treturn createShellToolDefinition(cwd, getPlatformShellToolName(platform), platform, options);\n}\n\nexport function createBashTool(cwd: string, options?: BashToolOptions): AgentTool<typeof bashSchema> {\n\treturn wrapToolDefinition(createBashToolDefinition(cwd, options));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../src/core/tools/bash.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAA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