@caupulican/pi-adaptative 0.81.41 → 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 +53 -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 +57 -80
- package/dist/bundled-resources/runtimes/pi-shell-engine/context.py +3 -3
- package/dist/bundled-resources/runtimes/pi-shell-engine/errors.py +8 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/escapes.py +70 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/exec.py +135 -63
- package/dist/bundled-resources/runtimes/pi-shell-engine/expand.py +3 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/main.py +108 -22
- 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 +10 -2
- package/dist/bundled-resources/runtimes/pi-shell-engine/tokens.py +131 -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 +32 -0
- package/dist/core/agent-paths.d.ts.map +1 -1
- package/dist/core/agent-paths.js +65 -0
- package/dist/core/agent-paths.js.map +1 -1
- package/dist/core/agent-session-contracts.d.ts +24 -10
- 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 +214 -246
- 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 +2 -0
- package/dist/core/autonomy/contracts.d.ts.map +1 -1
- package/dist/core/autonomy/contracts.js.map +1 -1
- package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
- package/dist/core/autonomy/envelope-enforcement.js +4 -9
- 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 +3 -1
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +17 -4
- 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 +14 -0
- package/dist/core/autonomy/path-scope.d.ts.map +1 -1
- package/dist/core/autonomy/path-scope.js +37 -6
- 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 +27 -1
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +34 -16
- 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 +11 -1
- package/dist/core/delegation/managed-lane-controller.d.ts.map +1 -1
- package/dist/core/delegation/managed-lane-controller.js +85 -46
- 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 +4 -3
- package/dist/core/delegation/session-worker-claim.js.map +1 -1
- package/dist/core/delegation/worker-action-journal.d.ts +73 -0
- package/dist/core/delegation/worker-action-journal.d.ts.map +1 -0
- package/dist/core/delegation/worker-action-journal.js +293 -0
- package/dist/core/delegation/worker-action-journal.js.map +1 -0
- package/dist/core/delegation/worker-actions.d.ts +36 -1
- package/dist/core/delegation/worker-actions.d.ts.map +1 -1
- package/dist/core/delegation/worker-actions.js +171 -46
- package/dist/core/delegation/worker-actions.js.map +1 -1
- package/dist/core/delegation/worker-agent-control-coordinator.d.ts +76 -0
- package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -0
- package/dist/core/delegation/worker-agent-control-coordinator.js +216 -0
- package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -0
- package/dist/core/delegation/worker-agent-control.d.ts +66 -0
- package/dist/core/delegation/worker-agent-control.d.ts.map +1 -0
- package/dist/core/delegation/worker-agent-control.js +160 -0
- package/dist/core/delegation/worker-agent-control.js.map +1 -0
- package/dist/core/delegation/worker-attempt-executor.d.ts +80 -0
- package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -0
- package/dist/core/delegation/worker-attempt-executor.js +343 -0
- package/dist/core/delegation/worker-attempt-executor.js.map +1 -0
- package/dist/core/delegation/worker-claim.d.ts +30 -0
- package/dist/core/delegation/worker-claim.d.ts.map +1 -1
- package/dist/core/delegation/worker-claim.js +205 -53
- package/dist/core/delegation/worker-claim.js.map +1 -1
- package/dist/core/delegation/worker-conversation-store.d.ts +116 -0
- package/dist/core/delegation/worker-conversation-store.d.ts.map +1 -0
- package/dist/core/delegation/worker-conversation-store.js +440 -0
- package/dist/core/delegation/worker-conversation-store.js.map +1 -0
- package/dist/core/delegation/worker-delegation-controller.d.ts +21 -5
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.js +386 -260
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
- package/dist/core/delegation/worker-delegation-request.d.ts +14 -0
- package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-request.js.map +1 -1
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts +4 -2
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts.map +1 -1
- package/dist/core/delegation/worker-dispatch-scheduler.js +20 -11
- package/dist/core/delegation/worker-dispatch-scheduler.js.map +1 -1
- package/dist/core/delegation/worker-execution-policy.d.ts +2 -1
- package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
- package/dist/core/delegation/worker-execution-policy.js +5 -7
- 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 +44 -1
- package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -1
- package/dist/core/delegation/worker-lifecycle.js +119 -2
- 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 +18 -0
- package/dist/core/delegation/worker-process-owner.d.ts.map +1 -0
- package/dist/core/delegation/worker-process-owner.js +54 -0
- package/dist/core/delegation/worker-process-owner.js.map +1 -0
- package/dist/core/delegation/worker-profile-resolver.d.ts +5 -1
- package/dist/core/delegation/worker-profile-resolver.d.ts.map +1 -1
- package/dist/core/delegation/worker-profile-resolver.js +9 -2
- package/dist/core/delegation/worker-profile-resolver.js.map +1 -1
- package/dist/core/delegation/worker-recovery-coordinator.d.ts +54 -0
- package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -0
- package/dist/core/delegation/worker-recovery-coordinator.js +180 -0
- package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -0
- package/dist/core/delegation/worker-resource-catalog.d.ts +32 -0
- package/dist/core/delegation/worker-resource-catalog.d.ts.map +1 -0
- package/dist/core/delegation/worker-resource-catalog.js +116 -0
- package/dist/core/delegation/worker-resource-catalog.js.map +1 -0
- package/dist/core/delegation/worker-resource-materializer.d.ts +47 -0
- package/dist/core/delegation/worker-resource-materializer.d.ts.map +1 -0
- package/dist/core/delegation/worker-resource-materializer.js +134 -0
- package/dist/core/delegation/worker-resource-materializer.js.map +1 -0
- package/dist/core/delegation/worker-runner.d.ts +5 -5
- package/dist/core/delegation/worker-runner.d.ts.map +1 -1
- package/dist/core/delegation/worker-runner.js +193 -70
- 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 +23 -0
- package/dist/core/delegation/worker-terminal-finalizer.d.ts.map +1 -0
- package/dist/core/delegation/worker-terminal-finalizer.js +12 -0
- package/dist/core/delegation/worker-terminal-finalizer.js.map +1 -0
- package/dist/core/delegation/worker-write-reservation-coordinator.d.ts +38 -0
- package/dist/core/delegation/worker-write-reservation-coordinator.d.ts.map +1 -0
- package/dist/core/delegation/worker-write-reservation-coordinator.js +104 -0
- package/dist/core/delegation/worker-write-reservation-coordinator.js.map +1 -0
- package/dist/core/delegation/worker-write-reservation.d.ts +90 -0
- package/dist/core/delegation/worker-write-reservation.d.ts.map +1 -0
- package/dist/core/delegation/worker-write-reservation.js +346 -0
- package/dist/core/delegation/worker-write-reservation.js.map +1 -0
- 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 +3 -0
- package/dist/core/models/model-endpoint.d.ts.map +1 -0
- package/dist/core/models/model-endpoint.js +11 -0
- package/dist/core/models/model-endpoint.js.map +1 -0
- 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 +2 -0
- package/dist/core/orchestration/agent-resume.d.ts.map +1 -1
- package/dist/core/orchestration/agent-resume.js +7 -0
- package/dist/core/orchestration/agent-resume.js.map +1 -1
- package/dist/core/orchestration/attempt-usage.d.ts +28 -0
- package/dist/core/orchestration/attempt-usage.d.ts.map +1 -0
- package/dist/core/orchestration/attempt-usage.js +168 -0
- package/dist/core/orchestration/attempt-usage.js.map +1 -0
- package/dist/core/orchestration/capability-gateway.d.ts +19 -1
- package/dist/core/orchestration/capability-gateway.d.ts.map +1 -1
- package/dist/core/orchestration/capability-gateway.js +120 -34
- package/dist/core/orchestration/capability-gateway.js.map +1 -1
- package/dist/core/orchestration/contracts.d.ts +35 -0
- package/dist/core/orchestration/contracts.d.ts.map +1 -1
- package/dist/core/orchestration/contracts.js +17 -0
- package/dist/core/orchestration/contracts.js.map +1 -1
- package/dist/core/orchestration/delegation-ledger.d.ts +17 -2
- package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -1
- package/dist/core/orchestration/delegation-ledger.js +78 -5
- package/dist/core/orchestration/delegation-ledger.js.map +1 -1
- package/dist/core/orchestration/event-store.d.ts +1 -0
- package/dist/core/orchestration/event-store.d.ts.map +1 -1
- package/dist/core/orchestration/event-store.js +79 -52
- 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 +82 -42
- 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 +18 -7
- package/dist/core/orchestration/profile-store.js.map +1 -1
- package/dist/core/orchestration/risk-budget.d.ts +2 -0
- package/dist/core/orchestration/risk-budget.d.ts.map +1 -1
- package/dist/core/orchestration/risk-budget.js +26 -0
- package/dist/core/orchestration/risk-budget.js.map +1 -1
- package/dist/core/orchestration/task-runtime.d.ts +14 -1
- package/dist/core/orchestration/task-runtime.d.ts.map +1 -1
- package/dist/core/orchestration/task-runtime.js +153 -57
- 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 +3 -1
- package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
- package/dist/core/orchestration/worker-execution-contract.js +75 -23
- package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
- package/dist/core/orchestration/worker-result-adapter.d.ts +9 -3
- package/dist/core/orchestration/worker-result-adapter.d.ts.map +1 -1
- package/dist/core/orchestration/worker-result-adapter.js +167 -14
- 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 +23 -2
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +233 -79
- 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 +20 -0
- package/dist/core/research/evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/evidence-bundle.js +173 -69
- 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 +11 -1
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +40 -51
- 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 +35 -0
- package/dist/core/session-artifact-bundle.d.ts.map +1 -0
- package/dist/core/session-artifact-bundle.js +61 -0
- package/dist/core/session-artifact-bundle.js.map +1 -0
- 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 +6 -1
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +109 -25
- package/dist/core/tools/delegate-status.js.map +1 -1
- package/dist/core/tools/delegate.d.ts +9 -1
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +329 -67
- 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 +1 -1
- package/dist/core/tools/run-process.d.ts.map +1 -1
- package/dist/core/tools/run-process.js +69 -9
- 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 +16 -6
- 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 +15 -0
- package/dist/core/util/bounded-file.d.ts.map +1 -0
- package/dist/core/util/bounded-file.js +120 -0
- package/dist/core/util/bounded-file.js.map +1 -0
- package/dist/core/util/bounded-jsonl.d.ts.map +1 -1
- package/dist/core/util/bounded-jsonl.js +112 -9
- package/dist/core/util/bounded-jsonl.js.map +1 -1
- package/dist/core/util/bounded-value.d.ts +3 -0
- package/dist/core/util/bounded-value.d.ts.map +1 -0
- package/dist/core/util/bounded-value.js +12 -0
- package/dist/core/util/bounded-value.js.map +1 -0
- 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 +2 -0
- package/dist/core/util/value-guards.d.ts.map +1 -1
- package/dist/core/util/value-guards.js +5 -0
- 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 +61 -103
- 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/tool-repair.md +3 -0
- package/docs/windows.md +29 -2
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-selection-controller.js","sourceRoot":"","sources":["../../../src/core/tool-selection/tool-selection-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,qBAAqB,GAGrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAA0B,MAAM,gBAAgB,CAAC;AAwD/E,MAAM,cAAc,GAAwC;IAC3D,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,UAAU;IACV,SAAS;IACT,OAAO;CACP,CAAC;AAEF,MAAM,YAAY,GAAwD;IACzE,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAC3D,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC;IAC9D,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC;IACjG,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EA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AK,SAAS;gBACpC,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,GAAG,GAAG,CAAC,QAAQ,KAAK,CAAC,eAAe,GAAG,CAAC;YACjF,KAAK,CAAC,IAAI,CAAC,6BAA6B,KAAK,CAAC,QAAQ,iCAA+B,iBAAiB,EAAE,CAAC,CAAC;QAC3G,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAA,CACxB;AAED,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import {\n\tdecideExpectedUtility,\n\ttype ExpectedUtilityCandidate,\n\ttype ToolSelectionDecision,\n} from \"./expected-utility.ts\";\nimport { evaluateToolPromotion, type ToolSelectionHint } from \"./promotion.ts\";\nimport type {\n\tToolExecutionObservation,\n\tToolPerformanceKey,\n\tToolPerformanceStore,\n\tToolSelectionIntentClass,\n\tToolSelectionObservation,\n} from \"./tool-performance-store.ts\";\n\nexport interface ToolSelectionTool {\n\tname: string;\n\tdescription?: string;\n\tparameters?: unknown;\n\tprofileAllowed?: boolean;\n\tcapabilityAllowed?: boolean;\n\tpathValidated?: boolean;\n\triskCost?: number;\n\tcontextCost?: number;\n}\n\nexport interface ToolSelectionControllerDeps {\n\tstore: ToolPerformanceStore;\n\tgetModelRef: () => string;\n\tgetActiveTools: () => readonly ToolSelectionTool[];\n\tisCandidateAllowed?: (toolName: string) => boolean;\n\t/**\n\t * Env-var source for the kill switches, injected for hermetic testing; defaults to\n\t * `process.env`. `PI_TOOL_SELECTION_OBSERVE=0` disables recording (the observe/stats layer,\n\t * default ON); `PI_TOOL_SELECTION_HINTS=0` disables surfacing the evidence-gated prompt hint\n\t * (default ON, but the hint itself only ever activates once evidence thresholds are met).\n\t */\n\tenv?: Record<string, string | undefined>;\n}\n\nexport interface ToolSelectionPendingObservation {\n\tid: string;\n\tkey: ToolPerformanceKey;\n\tfirstTool: boolean;\n\tstartedAt: number;\n\tinputTokenEstimate?: number;\n\tselection: Omit<ToolSelectionObservation, \"at\" | \"modelRef\" | \"intentClass\" | \"actualTool\" | \"succeeded\">;\n\t/** Was a promotion hint already active for this (model,intent) bucket before this call? */\n\thintActiveAtCallTime: boolean;\n}\n\n/** Report row for the observe/agreement/promotion loop — see {@link ToolSelectionController.getReport}. */\nexport interface ToolSelectionReportEntry {\n\tmodelRef: string;\n\tintentClass: ToolSelectionIntentClass;\n\tsampleCount: number;\n\tagreementRate?: number;\n\thintTool?: string;\n\thintSampleCount: number;\n\thintAgreementRate?: number;\n}\n\nconst INTENT_CLASSES: readonly ToolSelectionIntentClass[] = [\n\t\"read\",\n\t\"search\",\n\t\"execute\",\n\t\"write\",\n\t\"retrieve\",\n\t\"explain\",\n\t\"other\",\n];\n\nconst INTENT_WORDS: Record<ToolSelectionIntentClass, readonly string[]> = {\n\tread: [\"read\", \"cat\", \"ls\", \"list\", \"stat\", \"head\", \"tail\"],\n\tsearch: [\"search\", \"grep\", \"find\", \"glob\", \"ripgrep\", \"query\"],\n\texecute: [\"bash\", \"python\", \"powershell\", \"shell\", \"exec\", \"run\", \"process\", \"command\", \"script\"],\n\twrite: [\"write\", \"edit\", \"patch\", \"apply\", \"delete\", \"mkdir\", \"move\", \"rename\"],\n\tretrieve: [\"retrieve\", \"artifact\", \"recall\", \"memory\", \"fetch\", \"download\"],\n\texplain: [\"explain\", \"help\", \"describe\", \"inspect\", \"context\"],\n\tother: [],\n};\n\nfunction tokenize(value: string): string[] {\n\treturn value\n\t\t.toLowerCase()\n\t\t.split(/[^a-z0-9]+/u)\n\t\t.filter(Boolean);\n}\n\nfunction classifyToolIntent(tool: ToolSelectionTool): ToolSelectionIntentClass {\n\tconst tokens = tokenize(`${tool.name} ${tool.description ?? \"\"}`);\n\tlet best: ToolSelectionIntentClass = \"other\";\n\tlet bestScore = 0;\n\tfor (const intent of INTENT_CLASSES) {\n\t\tif (intent === \"other\") continue;\n\t\tconst score = INTENT_WORDS[intent].reduce((total, word) => total + (tokens.includes(word) ? 1 : 0), 0);\n\t\tif (score > bestScore) {\n\t\t\tbest = intent;\n\t\t\tbestScore = score;\n\t\t}\n\t}\n\treturn best;\n}\n\nfunction intentValue(intent: ToolSelectionIntentClass, toolIntent: ToolSelectionIntentClass): number {\n\tif (toolIntent === intent) return 0.85;\n\tif (intent === \"other\") return 0.35;\n\tif (toolIntent === \"other\") return 0.2;\n\treturn 0.12;\n}\n\nfunction noToolValue(intent: ToolSelectionIntentClass): number {\n\tswitch (intent) {\n\t\tcase \"explain\":\n\t\t\treturn 0.35;\n\t\tcase \"read\":\n\t\tcase \"search\":\n\t\tcase \"retrieve\":\n\t\t\treturn 0.12;\n\t\tcase \"write\":\n\t\tcase \"execute\":\n\t\t\treturn 0.05;\n\t\tdefault:\n\t\t\treturn 0.2;\n\t}\n}\n\nfunction estimateTokens(value: unknown): number | undefined {\n\ttry {\n\t\tconst serialized = typeof value === \"string\" ? value : JSON.stringify(value);\n\t\tif (!serialized) return undefined;\n\t\treturn Math.max(1, Math.ceil(serialized.length / 4));\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction estimateContentTokens(content: readonly unknown[]): number | undefined {\n\tconst text = content\n\t\t.map((block) => {\n\t\t\tif (!block || typeof block !== \"object\") return \"\";\n\t\t\tconst candidate = block as { type?: unknown; text?: unknown };\n\t\t\treturn candidate.type === \"text\" && typeof candidate.text === \"string\" ? candidate.text : \"\";\n\t\t})\n\t\t.join(\"\\n\");\n\treturn estimateTokens(text);\n}\n\nfunction modelToolKey(modelRef: string, intentClass: ToolSelectionIntentClass, tool: string): ToolPerformanceKey {\n\treturn { modelRef, intentClass, tool };\n}\n\nfunction candidateFor(\n\tstore: ToolPerformanceStore,\n\tmodelRef: string,\n\tintentClass: ToolSelectionIntentClass,\n\ttool: ToolSelectionTool,\n\tactualTool: string,\n): ExpectedUtilityCandidate {\n\tconst key = modelToolKey(modelRef, intentClass, tool.name);\n\tconst stats = store.get(key);\n\treturn {\n\t\ttool: tool.name,\n\t\tvalue: intentValue(intentClass, classifyToolIntent(tool)),\n\t\talpha: stats.alpha,\n\t\tbeta: stats.beta,\n\t\tsampleCount: stats.sampleCount,\n\t\tlatencyMs: stats.latencyEwmaMs,\n\t\ttokenEstimate:\n\t\t\tstats.inputTokenEstimateEwma === undefined && stats.outputTokenEstimateEwma === undefined\n\t\t\t\t? undefined\n\t\t\t\t: (stats.inputTokenEstimateEwma ?? 0) + (stats.outputTokenEstimateEwma ?? 0),\n\t\triskCost: tool.riskCost,\n\t\tcontextCost: tool.contextCost,\n\t\tdeterministicMatch: tool.name === actualTool && tool.pathValidated !== false,\n\t\tautomaticEligible: tool.pathValidated !== false,\n\t};\n}\n\nexport class ToolSelectionController {\n\tprivate readonly deps: ToolSelectionControllerDeps;\n\tprivate readonly pending = new Map<string, ToolSelectionPendingObservation>();\n\tprivate firstToolInTurn = true;\n\t/** Kill switch: observe/stats recording, default ON. `PI_TOOL_SELECTION_OBSERVE=0` disables it. */\n\tprivate readonly observeEnabled: boolean;\n\n\tconstructor(deps: ToolSelectionControllerDeps) {\n\t\tthis.deps = deps;\n\t\tthis.observeEnabled = (deps.env ?? process.env).PI_TOOL_SELECTION_OBSERVE !== \"0\";\n\t}\n\n\tstartTurn(): void {\n\t\tthis.firstToolInTurn = true;\n\t}\n\n\tbegin(toolCallId: string, toolName: string, args: unknown): ToolSelectionPendingObservation {\n\t\tconst modelRef = this.deps.getModelRef();\n\t\tconst activeTools = this.deps\n\t\t\t.getActiveTools()\n\t\t\t.filter(\n\t\t\t\t(tool) =>\n\t\t\t\t\ttool.profileAllowed !== false &&\n\t\t\t\t\ttool.capabilityAllowed !== false &&\n\t\t\t\t\t(this.deps.isCandidateAllowed?.(tool.name) ?? true),\n\t\t\t);\n\t\tconst actualTool = activeTools.find((tool) => tool.name === toolName) ?? {\n\t\t\tname: toolName,\n\t\t\tpathValidated: true,\n\t\t};\n\t\tconst intentClass = classifyToolIntent(actualTool);\n\t\tconst candidates = activeTools.map((tool) =>\n\t\t\tcandidateFor(\n\t\t\t\tthis.deps.store,\n\t\t\t\tmodelRef,\n\t\t\t\tintentClass,\n\t\t\t\ttool.name === toolName ? tool : { ...tool, pathValidated: false },\n\t\t\t\ttoolName,\n\t\t\t),\n\t\t);\n\t\tif (!candidates.some((candidate) => candidate.tool === toolName)) {\n\t\t\tcandidates.push(candidateFor(this.deps.store, modelRef, intentClass, actualTool, toolName));\n\t\t}\n\t\tcandidates.push({\n\t\t\ttool: \"no_tool\",\n\t\t\tvalue: noToolValue(intentClass),\n\t\t\talpha: 1,\n\t\t\tbeta: 1,\n\t\t\tsampleCount: 0,\n\t\t\tsuccessProbability: 1,\n\t\t\tlatencyMs: 0,\n\t\t\ttokenEstimate: 0,\n\t\t\triskCost: 0,\n\t\t\tcontextCost: 0,\n\t\t});\n\t\tconst decision = decideExpectedUtility(candidates);\n\t\tconst firstTool = this.firstToolInTurn;\n\t\tconst selection = this.selectionSnapshot(decision, firstTool);\n\t\t// Evaluated BEFORE this call is recorded, so it reflects evidence up to (not including) this\n\t\t// observation — captured now because complete() (later, async) can no longer distinguish\n\t\t// \"before\" from \"after\" once the store has been written.\n\t\tconst hintActiveAtCallTime = this.observeEnabled\n\t\t\t? this.evaluatePromotion(modelRef, intentClass).tool !== undefined\n\t\t\t: false;\n\t\tconst pending: ToolSelectionPendingObservation = {\n\t\t\tid: toolCallId,\n\t\t\tkey: modelToolKey(modelRef, intentClass, toolName),\n\t\t\tfirstTool: this.firstToolInTurn,\n\t\t\tstartedAt: Date.now(),\n\t\t\tinputTokenEstimate: estimateTokens(args),\n\t\t\tselection,\n\t\t\thintActiveAtCallTime,\n\t\t};\n\t\tthis.firstToolInTurn = false;\n\t\tthis.pending.set(toolCallId, pending);\n\t\treturn pending;\n\t}\n\n\tcomplete(toolCallId: string, succeeded: boolean, content: readonly unknown[] = []): void {\n\t\tconst pending = this.pending.get(toolCallId);\n\t\tif (!pending) return;\n\t\tthis.pending.delete(toolCallId);\n\t\tif (!this.observeEnabled) return;\n\t\tconst execution: ToolExecutionObservation = {\n\t\t\tkey: pending.key,\n\t\t\tsuccess: succeeded,\n\t\t\tlatencyMs: Math.max(0, Date.now() - pending.startedAt),\n\t\t\tinputTokenEstimate: pending.inputTokenEstimate,\n\t\t\toutputTokenEstimate: estimateContentTokens(content),\n\t\t\tselection: pending.selection,\n\t\t\thintActiveAtCallTime: pending.hintActiveAtCallTime,\n\t\t};\n\t\tthis.deps.store.recordExecution(execution);\n\t}\n\n\trecordValidation(toolName: string, outcome: \"repaired\" | \"bounced\"): void {\n\t\tif (!this.observeEnabled) return;\n\t\tconst modelRef = this.deps.getModelRef();\n\t\tconst tool = this.deps.getActiveTools().find((candidate) => candidate.name === toolName) ?? { name: toolName };\n\t\tthis.deps.store.recordValidation(modelToolKey(modelRef, classifyToolIntent(tool), toolName), outcome);\n\t}\n\n\t/**\n\t * Evidence-gated promotion for one (model,intent) bucket — see promotion.ts. Pure read, no\n\t * mutation; used both to stamp `hintActiveAtCallTime` and to build the live hint list below.\n\t */\n\tprivate evaluatePromotion(modelRef: string, intentClass: ToolSelectionIntentClass) {\n\t\treturn evaluateToolPromotion(this.deps.store.getStatsForIntent(modelRef, intentClass));\n\t}\n\n\t/**\n\t * The currently active evidence-gated hints for the session's current model — one per\n\t * (intentClass) at most, only where accumulated evidence clears the promotion gate. Consumed by\n\t * `system-prompt-builder.ts` to render a compact, cache-stable prompt block. Empty when the\n\t * hint kill switch (`PI_TOOL_SELECTION_HINTS=0`) is set, observing is disabled, or no bucket has\n\t * cleared the gate yet.\n\t */\n\tgetActiveHints(modelRef: string = this.deps.getModelRef()): ToolSelectionHint[] {\n\t\tif ((this.deps.env ?? process.env).PI_TOOL_SELECTION_HINTS === \"0\") return [];\n\t\tif (!this.observeEnabled) return [];\n\t\tconst hints: ToolSelectionHint[] = [];\n\t\tfor (const intentClass of INTENT_CLASSES) {\n\t\t\tconst promotion = this.evaluatePromotion(modelRef, intentClass);\n\t\t\tif (!promotion.tool) continue;\n\t\t\thints.push({\n\t\t\t\tmodelRef,\n\t\t\t\tintentClass,\n\t\t\t\ttool: promotion.tool,\n\t\t\t\tsampleCount: promotion.sampleCount,\n\t\t\t\tmargin: promotion.margin,\n\t\t\t\tentropy: promotion.entropy,\n\t\t\t});\n\t\t}\n\t\treturn hints;\n\t}\n\n\t/**\n\t * Report surface for the observe/agreement/promotion loop: per (model,intent), the durable\n\t * agreement rate (did the raw ranking's top pick match what was actually called), plus the\n\t * currently active hint (if any) and its own efficacy (agreement rate while it has been active).\n\t * A read-only diagnostic — never used to gate behavior. Render with\n\t * {@link formatToolSelectionReport}.\n\t */\n\tgetReport(modelRef: string = this.deps.getModelRef()): ToolSelectionReportEntry[] {\n\t\tconst activeHints = new Map(this.getActiveHints(modelRef).map((hint) => [hint.intentClass, hint]));\n\t\treturn this.deps.store\n\t\t\t.getAllIntentAgreements(modelRef)\n\t\t\t.filter((agreement) => agreement.sampleCount > 0)\n\t\t\t.map((agreement) => ({\n\t\t\t\tmodelRef: agreement.modelRef,\n\t\t\t\tintentClass: agreement.intentClass,\n\t\t\t\tsampleCount: agreement.sampleCount,\n\t\t\t\tagreementRate: agreement.agreementCount / agreement.sampleCount,\n\t\t\t\thintTool: activeHints.get(agreement.intentClass)?.tool,\n\t\t\t\thintSampleCount: agreement.hintActiveSampleCount,\n\t\t\t\thintAgreementRate:\n\t\t\t\t\tagreement.hintActiveSampleCount > 0\n\t\t\t\t\t\t? agreement.hintActiveAgreementCount / agreement.hintActiveSampleCount\n\t\t\t\t\t\t: undefined,\n\t\t\t}));\n\t}\n\n\tprivate selectionSnapshot(\n\t\tdecision: ToolSelectionDecision,\n\t\tfirstTool: boolean,\n\t): ToolSelectionPendingObservation[\"selection\"] {\n\t\treturn {\n\t\t\tfirstTool,\n\t\t\tdisposition: decision.disposition,\n\t\t\trecommendation: decision.recommendation,\n\t\t\tshortlist: decision.shortlist,\n\t\t\tentropy: decision.entropy,\n\t\t\tmargin: decision.margin,\n\t\t\tranked: decision.ranked.map((candidate) => ({\n\t\t\t\ttool: candidate.tool,\n\t\t\t\tutility: candidate.utility,\n\t\t\t\tprobability: candidate.probability,\n\t\t\t})),\n\t\t};\n\t}\n}\n\n/** Renders {@link ToolSelectionController.getReport} rows into the /toolhealth-style diagnostic text. */\nexport function formatToolSelectionReport(entries: readonly ToolSelectionReportEntry[]): string {\n\tif (entries.length === 0) {\n\t\treturn \"Tool-selection loop: no observations recorded yet for this host.\";\n\t}\n\tconst sorted = [...entries].sort(\n\t\t(left, right) => left.modelRef.localeCompare(right.modelRef) || left.intentClass.localeCompare(right.intentClass),\n\t);\n\tconst lines = [\"Tool-selection loop (observe -> agreement -> evidence-gated hint)\"];\n\tfor (const entry of sorted) {\n\t\tconst agreementText =\n\t\t\tentry.agreementRate === undefined\n\t\t\t\t? \"n/a\"\n\t\t\t\t: `${Math.round(entry.agreementRate * 100)}% (n=${entry.sampleCount})`;\n\t\tlines.push(` ${entry.modelRef} / ${entry.intentClass}: agreement ${agreementText}`);\n\t\tif (entry.hintTool) {\n\t\t\tconst hintAgreementText =\n\t\t\t\tentry.hintAgreementRate === undefined\n\t\t\t\t\t? \"n/a\"\n\t\t\t\t\t: `${Math.round(entry.hintAgreementRate * 100)}% (n=${entry.hintSampleCount})`;\n\t\t\tlines.push(` hint active: prefer \\`${entry.hintTool}\\` — agreement while active ${hintAgreementText}`);\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nexport { classifyToolIntent, estimateContentTokens, estimateTokens };\n"]}
|
|
1
|
+
{"version":3,"file":"tool-selection-controller.js","sourceRoot":"","sources":["../../../src/core/tool-selection/tool-selection-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,qBAAqB,GAGrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAA0B,MAAM,gBAAgB,CAAC;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QAAQ,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,CACjH,CAAC;IACF,MAAM,KAAK,GAAG,CAAC,mEAAmE,CAAC,CAAC;IACpF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,MAAM,aAAa,GAClB,KAAK,CAAC,aAAa,KAAK,SAAS;YAChC,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,GAAG,GAAG,CAAC,QAAQ,KAAK,CAAC,WAAW,GAAG,CAAC;QACzE,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,QAAQ,MAAM,KAAK,CAAC,WAAW,eAAe,aAAa,EAAE,CAAC,CAAC;QACrF,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,MAAM,iBAAiB,GACtB,KAAK,CAAC,iBAAiB,KAAK,SAAS;gBACpC,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,GAAG,GAAG,CAAC,QAAQ,KAAK,CAAC,eAAe,GAAG,CAAC;YACjF,KAAK,CAAC,IAAI,CAAC,6BAA6B,KAAK,CAAC,QAAQ,+BAA+B,iBAAiB,EAAE,CAAC,CAAC;QAC3G,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { performance } from \"node:perf_hooks\";\nimport {\n\tdecideExpectedUtility,\n\ttype ExpectedUtilityCandidate,\n\ttype ToolSelectionDecision,\n} from \"./expected-utility.ts\";\nimport { evaluateToolPromotion, type ToolSelectionHint } from \"./promotion.ts\";\nimport type {\n\tToolExecutionObservation,\n\tToolPerformanceKey,\n\tToolPerformanceStats,\n\tToolPerformanceStore,\n\tToolSelectionIntentClass,\n\tToolSelectionObservation,\n} from \"./tool-performance-store.ts\";\nimport { ToolPhaseTimings } from \"./tool-phase-timing.ts\";\n\nexport interface ToolSelectionTool {\n\tname: string;\n\tdescription?: string;\n\tparameters?: unknown;\n\tprofileAllowed?: boolean;\n\tcapabilityAllowed?: boolean;\n\tpathValidated?: boolean;\n\triskCost?: number;\n\tcontextCost?: number;\n}\n\nexport interface ToolSelectionControllerDeps {\n\tstore: ToolPerformanceStore;\n\tgetModelRef: () => string;\n\tgetActiveTools: () => readonly ToolSelectionTool[];\n\tisCandidateAllowed?: (toolName: string) => boolean;\n\t/**\n\t * Env-var source for the kill switches, injected for hermetic testing; defaults to\n\t * `process.env`. `PI_TOOL_SELECTION_OBSERVE=0` disables recording (the observe/stats layer,\n\t * default ON); `PI_TOOL_SELECTION_HINTS=0` disables surfacing the evidence-gated prompt hint\n\t * (default ON, but the hint itself only ever activates once evidence thresholds are met).\n\t */\n\tenv?: Record<string, string | undefined>;\n}\n\nexport interface ToolSelectionPendingObservation {\n\tid: string;\n\tkey: ToolPerformanceKey;\n\tfirstTool: boolean;\n\tstartedAt: number;\n\tinputTokenEstimate?: number;\n\tselection: Omit<ToolSelectionObservation, \"at\" | \"modelRef\" | \"intentClass\" | \"actualTool\" | \"succeeded\">;\n\t/** Was a promotion hint already active for this (model,intent) bucket before this call? */\n\thintActiveAtCallTime: boolean;\n}\n\n/** Report row for the observe/agreement/promotion loop — see {@link ToolSelectionController.getReport}. */\nexport interface ToolSelectionReportEntry {\n\tmodelRef: string;\n\tintentClass: ToolSelectionIntentClass;\n\tsampleCount: number;\n\tagreementRate?: number;\n\thintTool?: string;\n\thintSampleCount: number;\n\thintAgreementRate?: number;\n}\n\nconst INTENT_CLASSES: readonly ToolSelectionIntentClass[] = [\n\t\"read\",\n\t\"search\",\n\t\"execute\",\n\t\"write\",\n\t\"retrieve\",\n\t\"explain\",\n\t\"other\",\n];\n\nconst INTENT_WORDS: Record<ToolSelectionIntentClass, readonly string[]> = {\n\tread: [\"read\", \"cat\", \"ls\", \"list\", \"stat\", \"head\", \"tail\"],\n\tsearch: [\"search\", \"grep\", \"find\", \"glob\", \"ripgrep\", \"query\"],\n\texecute: [\"bash\", \"python\", \"powershell\", \"shell\", \"exec\", \"run\", \"process\", \"command\", \"script\"],\n\twrite: [\"write\", \"edit\", \"patch\", \"apply\", \"delete\", \"mkdir\", \"move\", \"rename\"],\n\tretrieve: [\"retrieve\", \"artifact\", \"recall\", \"memory\", \"fetch\", \"download\"],\n\texplain: [\"explain\", \"help\", \"describe\", \"inspect\", \"context\"],\n\tother: [],\n};\n\nfunction tokenize(value: string): string[] {\n\treturn value\n\t\t.toLowerCase()\n\t\t.split(/[^a-z0-9]+/u)\n\t\t.filter(Boolean);\n}\n\nfunction classifyToolIntent(tool: ToolSelectionTool): ToolSelectionIntentClass {\n\tconst tokens = tokenize(`${tool.name} ${tool.description ?? \"\"}`);\n\tlet best: ToolSelectionIntentClass = \"other\";\n\tlet bestScore = 0;\n\tfor (const intent of INTENT_CLASSES) {\n\t\tif (intent === \"other\") continue;\n\t\tconst score = INTENT_WORDS[intent].reduce((total, word) => total + (tokens.includes(word) ? 1 : 0), 0);\n\t\tif (score > bestScore) {\n\t\t\tbest = intent;\n\t\t\tbestScore = score;\n\t\t}\n\t}\n\treturn best;\n}\n\nfunction intentValue(intent: ToolSelectionIntentClass, toolIntent: ToolSelectionIntentClass): number {\n\tif (toolIntent === intent) return 0.85;\n\tif (intent === \"other\") return 0.35;\n\tif (toolIntent === \"other\") return 0.2;\n\treturn 0.12;\n}\n\nfunction noToolValue(intent: ToolSelectionIntentClass): number {\n\tswitch (intent) {\n\t\tcase \"explain\":\n\t\t\treturn 0.35;\n\t\tcase \"read\":\n\t\tcase \"search\":\n\t\tcase \"retrieve\":\n\t\t\treturn 0.12;\n\t\tcase \"write\":\n\t\tcase \"execute\":\n\t\t\treturn 0.05;\n\t\tdefault:\n\t\t\treturn 0.2;\n\t}\n}\n\nfunction estimateTokens(value: unknown): number | undefined {\n\ttry {\n\t\tconst serialized = typeof value === \"string\" ? value : JSON.stringify(value);\n\t\tif (!serialized) return undefined;\n\t\treturn Math.max(1, Math.ceil(serialized.length / 4));\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction estimateContentTokens(content: readonly unknown[]): number | undefined {\n\tconst text = content\n\t\t.map((block) => {\n\t\t\tif (!block || typeof block !== \"object\") return \"\";\n\t\t\tconst candidate = block as { type?: unknown; text?: unknown };\n\t\t\treturn candidate.type === \"text\" && typeof candidate.text === \"string\" ? candidate.text : \"\";\n\t\t})\n\t\t.join(\"\\n\");\n\treturn estimateTokens(text);\n}\n\nfunction modelToolKey(modelRef: string, intentClass: ToolSelectionIntentClass, tool: string): ToolPerformanceKey {\n\treturn { modelRef, intentClass, tool };\n}\n\nfunction candidateFor(\n\tintentClass: ToolSelectionIntentClass,\n\ttool: ToolSelectionTool,\n\tactualTool: string,\n\tstats?: ToolPerformanceStats,\n): ExpectedUtilityCandidate {\n\treturn {\n\t\ttool: tool.name,\n\t\tvalue: intentValue(intentClass, classifyToolIntent(tool)),\n\t\talpha: stats?.alpha ?? 1,\n\t\tbeta: stats?.beta ?? 1,\n\t\tsampleCount: stats?.sampleCount ?? 0,\n\t\tlatencyMs: stats?.latencyEwmaMs,\n\t\ttokenEstimate:\n\t\t\tstats?.inputTokenEstimateEwma === undefined && stats?.outputTokenEstimateEwma === undefined\n\t\t\t\t? undefined\n\t\t\t\t: (stats.inputTokenEstimateEwma ?? 0) + (stats.outputTokenEstimateEwma ?? 0),\n\t\triskCost: tool.riskCost,\n\t\tcontextCost: tool.contextCost,\n\t\tdeterministicMatch: tool.name === actualTool && tool.pathValidated !== false,\n\t\tautomaticEligible: tool.pathValidated !== false,\n\t};\n}\n\nexport class ToolSelectionController {\n\tprivate readonly deps: ToolSelectionControllerDeps;\n\tprivate readonly pending = new Map<string, ToolSelectionPendingObservation>();\n\tprivate readonly timings = new ToolPhaseTimings();\n\tprivate firstToolInTurn = true;\n\t/** Kill switch: observe/stats recording, default ON. `PI_TOOL_SELECTION_OBSERVE=0` disables it. */\n\tprivate readonly observeEnabled: boolean;\n\n\tconstructor(deps: ToolSelectionControllerDeps) {\n\t\tthis.deps = deps;\n\t\tthis.observeEnabled = (deps.env ?? process.env).PI_TOOL_SELECTION_OBSERVE !== \"0\";\n\t}\n\n\tstartTurn(): void {\n\t\tthis.firstToolInTurn = true;\n\t}\n\n\tbegin(toolCallId: string, toolName: string, args: unknown): ToolSelectionPendingObservation {\n\t\tconst selectionStartedAt = performance.now();\n\t\tconst modelRef = this.deps.getModelRef();\n\t\tconst activeTools = this.deps\n\t\t\t.getActiveTools()\n\t\t\t.filter(\n\t\t\t\t(tool) =>\n\t\t\t\t\ttool.profileAllowed !== false &&\n\t\t\t\t\ttool.capabilityAllowed !== false &&\n\t\t\t\t\t(this.deps.isCandidateAllowed?.(tool.name) ?? true),\n\t\t\t);\n\t\tconst actualTool = activeTools.find((tool) => tool.name === toolName) ?? {\n\t\t\tname: toolName,\n\t\t\tpathValidated: true,\n\t\t};\n\t\tconst intentClass = classifyToolIntent(actualTool);\n\t\tconst intentStats = this.deps.store.getStatsForIntent(modelRef, intentClass);\n\t\tconst statsByTool = new Map(intentStats.map((stats) => [stats.tool, stats]));\n\t\tconst candidates = activeTools.map((tool) =>\n\t\t\tcandidateFor(\n\t\t\t\tintentClass,\n\t\t\t\ttool.name === toolName ? tool : { ...tool, pathValidated: false },\n\t\t\t\ttoolName,\n\t\t\t\tstatsByTool.get(tool.name),\n\t\t\t),\n\t\t);\n\t\tif (!candidates.some((candidate) => candidate.tool === toolName)) {\n\t\t\tcandidates.push(candidateFor(intentClass, actualTool, toolName, statsByTool.get(toolName)));\n\t\t}\n\t\tcandidates.push({\n\t\t\ttool: \"no_tool\",\n\t\t\tvalue: noToolValue(intentClass),\n\t\t\talpha: 1,\n\t\t\tbeta: 1,\n\t\t\tsampleCount: 0,\n\t\t\tsuccessProbability: 1,\n\t\t\tlatencyMs: 0,\n\t\t\ttokenEstimate: 0,\n\t\t\triskCost: 0,\n\t\t\tcontextCost: 0,\n\t\t});\n\t\tconst decision = decideExpectedUtility(candidates);\n\t\tconst firstTool = this.firstToolInTurn;\n\t\tconst selection = this.selectionSnapshot(decision, firstTool);\n\t\t// Evaluated BEFORE this call is recorded, so it reflects evidence up to (not including) this\n\t\t// observation — captured now because complete() (later, async) can no longer distinguish\n\t\t// \"before\" from \"after\" once the store has been written.\n\t\tconst hintActiveAtCallTime = this.observeEnabled ? evaluateToolPromotion(intentStats).tool !== undefined : false;\n\t\tconst selectionCompletedAt = performance.now();\n\t\tthis.timings.record(\"selection\", selectionCompletedAt - selectionStartedAt);\n\t\tconst pending: ToolSelectionPendingObservation = {\n\t\t\tid: toolCallId,\n\t\t\tkey: modelToolKey(modelRef, intentClass, toolName),\n\t\t\tfirstTool: this.firstToolInTurn,\n\t\t\tstartedAt: selectionCompletedAt,\n\t\t\tinputTokenEstimate: estimateTokens(args),\n\t\t\tselection,\n\t\t\thintActiveAtCallTime,\n\t\t};\n\t\tthis.firstToolInTurn = false;\n\t\tthis.pending.set(toolCallId, pending);\n\t\treturn pending;\n\t}\n\n\tcomplete(toolCallId: string, succeeded: boolean, content: readonly unknown[] = []): void {\n\t\tconst pending = this.pending.get(toolCallId);\n\t\tif (!pending) return;\n\t\tthis.pending.delete(toolCallId);\n\t\tconst completedAt = performance.now();\n\t\tconst latencyMs = Math.max(0, completedAt - pending.startedAt);\n\t\tthis.timings.record(\"execution\", latencyMs);\n\t\tif (!this.observeEnabled) return;\n\t\tconst execution: ToolExecutionObservation = {\n\t\t\tkey: pending.key,\n\t\t\tsuccess: succeeded,\n\t\t\tlatencyMs,\n\t\t\tinputTokenEstimate: pending.inputTokenEstimate,\n\t\t\toutputTokenEstimate: estimateContentTokens(content),\n\t\t\tselection: pending.selection,\n\t\t\thintActiveAtCallTime: pending.hintActiveAtCallTime,\n\t\t};\n\t\tconst writeStartedAt = performance.now();\n\t\ttry {\n\t\t\tthis.deps.store.recordExecution(execution);\n\t\t} finally {\n\t\t\tthis.timings.record(\"observation_write\", performance.now() - writeStartedAt);\n\t\t}\n\t}\n\n\trecordValidation(toolName: string, outcome: \"repaired\" | \"bounced\"): void {\n\t\tif (!this.observeEnabled) return;\n\t\tconst modelRef = this.deps.getModelRef();\n\t\tconst tool = this.deps.getActiveTools().find((candidate) => candidate.name === toolName) ?? { name: toolName };\n\t\tconst writeStartedAt = performance.now();\n\t\ttry {\n\t\t\tthis.deps.store.recordValidation(modelToolKey(modelRef, classifyToolIntent(tool), toolName), outcome);\n\t\t} finally {\n\t\t\tthis.timings.record(\"validation_write\", performance.now() - writeStartedAt);\n\t\t}\n\t}\n\n\t/**\n\t * The currently active evidence-gated hints for the session's current model — one per\n\t * (intentClass) at most, only where accumulated evidence clears the promotion gate. Consumed by\n\t * `system-prompt-builder.ts` to render a compact, cache-stable prompt block. Empty when the\n\t * hint kill switch (`PI_TOOL_SELECTION_HINTS=0`) is set, observing is disabled, or no bucket has\n\t * cleared the gate yet.\n\t */\n\tgetActiveHints(modelRef: string = this.deps.getModelRef()): ToolSelectionHint[] {\n\t\tif ((this.deps.env ?? process.env).PI_TOOL_SELECTION_HINTS === \"0\") return [];\n\t\tif (!this.observeEnabled) return [];\n\t\tconst snapshotStartedAt = performance.now();\n\t\tconst statsByIntent = new Map<ToolSelectionIntentClass, ToolPerformanceStats[]>();\n\t\tfor (const stats of this.deps.store.getStatsForModel(modelRef)) {\n\t\t\tconst entries = statsByIntent.get(stats.intentClass) ?? [];\n\t\t\tentries.push(stats);\n\t\t\tstatsByIntent.set(stats.intentClass, entries);\n\t\t}\n\t\tconst hints: ToolSelectionHint[] = [];\n\t\tfor (const intentClass of INTENT_CLASSES) {\n\t\t\tconst promotion = evaluateToolPromotion(statsByIntent.get(intentClass) ?? []);\n\t\t\tif (!promotion.tool) continue;\n\t\t\thints.push({\n\t\t\t\tmodelRef,\n\t\t\t\tintentClass,\n\t\t\t\ttool: promotion.tool,\n\t\t\t\tsampleCount: promotion.sampleCount,\n\t\t\t\tmargin: promotion.margin,\n\t\t\t\tentropy: promotion.entropy,\n\t\t\t});\n\t\t}\n\t\tthis.timings.record(\"hint_snapshot\", performance.now() - snapshotStartedAt);\n\t\treturn hints;\n\t}\n\n\tformatTimingReport(): string {\n\t\treturn this.timings.formatReport();\n\t}\n\n\t/**\n\t * Report surface for the observe/agreement/promotion loop: per (model,intent), the durable\n\t * agreement rate (did the raw ranking's top pick match what was actually called), plus the\n\t * currently active hint (if any) and its own efficacy (agreement rate while it has been active).\n\t * A read-only diagnostic — never used to gate behavior. Render with\n\t * {@link formatToolSelectionReport}.\n\t */\n\tgetReport(modelRef: string = this.deps.getModelRef()): ToolSelectionReportEntry[] {\n\t\tconst activeHints = new Map(this.getActiveHints(modelRef).map((hint) => [hint.intentClass, hint]));\n\t\treturn this.deps.store\n\t\t\t.getAllIntentAgreements(modelRef)\n\t\t\t.filter((agreement) => agreement.sampleCount > 0)\n\t\t\t.map((agreement) => ({\n\t\t\t\tmodelRef: agreement.modelRef,\n\t\t\t\tintentClass: agreement.intentClass,\n\t\t\t\tsampleCount: agreement.sampleCount,\n\t\t\t\tagreementRate: agreement.agreementCount / agreement.sampleCount,\n\t\t\t\thintTool: activeHints.get(agreement.intentClass)?.tool,\n\t\t\t\thintSampleCount: agreement.hintActiveSampleCount,\n\t\t\t\thintAgreementRate:\n\t\t\t\t\tagreement.hintActiveSampleCount > 0\n\t\t\t\t\t\t? agreement.hintActiveAgreementCount / agreement.hintActiveSampleCount\n\t\t\t\t\t\t: undefined,\n\t\t\t}));\n\t}\n\n\tprivate selectionSnapshot(\n\t\tdecision: ToolSelectionDecision,\n\t\tfirstTool: boolean,\n\t): ToolSelectionPendingObservation[\"selection\"] {\n\t\treturn {\n\t\t\tfirstTool,\n\t\t\tdisposition: decision.disposition,\n\t\t\trecommendation: decision.recommendation,\n\t\t\tshortlist: decision.shortlist,\n\t\t\tentropy: decision.entropy,\n\t\t\tmargin: decision.margin,\n\t\t\tranked: decision.ranked.map((candidate) => ({\n\t\t\t\ttool: candidate.tool,\n\t\t\t\tutility: candidate.utility,\n\t\t\t\tprobability: candidate.probability,\n\t\t\t})),\n\t\t};\n\t}\n}\n\n/** Renders {@link ToolSelectionController.getReport} rows into the /toolhealth-style diagnostic text. */\nexport function formatToolSelectionReport(entries: readonly ToolSelectionReportEntry[]): string {\n\tif (entries.length === 0) {\n\t\treturn \"Tool-selection loop: no observations recorded yet for this host.\";\n\t}\n\tconst sorted = [...entries].sort(\n\t\t(left, right) => left.modelRef.localeCompare(right.modelRef) || left.intentClass.localeCompare(right.intentClass),\n\t);\n\tconst lines = [\"Tool-selection loop (observe -> agreement -> evidence-gated hint)\"];\n\tfor (const entry of sorted) {\n\t\tconst agreementText =\n\t\t\tentry.agreementRate === undefined\n\t\t\t\t? \"n/a\"\n\t\t\t\t: `${Math.round(entry.agreementRate * 100)}% (n=${entry.sampleCount})`;\n\t\tlines.push(` ${entry.modelRef} / ${entry.intentClass}: agreement ${agreementText}`);\n\t\tif (entry.hintTool) {\n\t\t\tconst hintAgreementText =\n\t\t\t\tentry.hintAgreementRate === undefined\n\t\t\t\t\t? \"n/a\"\n\t\t\t\t\t: `${Math.round(entry.hintAgreementRate * 100)}% (n=${entry.hintSampleCount})`;\n\t\t\tlines.push(` hint active: prefer \\`${entry.hintTool}\\` — agreement while active ${hintAgreementText}`);\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nexport { classifyToolIntent, estimateContentTokens, estimateTokens };\n"]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { Api, Model } from "@caupulican/pi-ai";
|
|
2
|
+
import { type IsolatedCompletionRunner } from "../isolated-text-completion.ts";
|
|
3
|
+
import { type SpawnedUsageReporter } from "../spawned-usage.ts";
|
|
1
4
|
import type { ToolkitScript } from "./script-registry.ts";
|
|
2
5
|
/**
|
|
3
6
|
* Reflex interpreter (the BRAIN half of the user-ratified brain->muscle pipeline, statistically
|
|
@@ -14,6 +17,19 @@ export interface ReflexPlan {
|
|
|
14
17
|
confidence: number;
|
|
15
18
|
}
|
|
16
19
|
export declare const REFLEX_MIN_CONFIDENCE = 0.75;
|
|
20
|
+
export interface ReflexInterpreterCompletionOptions {
|
|
21
|
+
request: string;
|
|
22
|
+
scripts: readonly ToolkitScript[];
|
|
23
|
+
model: Model<Api>;
|
|
24
|
+
laneKind: string;
|
|
25
|
+
usageKind: string;
|
|
26
|
+
usageLabel: string;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
completionRunner: IsolatedCompletionRunner;
|
|
29
|
+
usageReporter: SpawnedUsageReporter;
|
|
30
|
+
}
|
|
31
|
+
/** Execute the shared reflex interpreter call and account for it under the caller's lane identity. */
|
|
32
|
+
export declare function runReflexInterpreterCompletion(options: ReflexInterpreterCompletionOptions): Promise<ReflexPlan | undefined>;
|
|
17
33
|
export declare function buildReflexUserPrompt(request: string, scripts: readonly ToolkitScript[]): string;
|
|
18
34
|
export declare function parseReflexPlan(text: string): ReflexPlan | undefined;
|
|
19
35
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflex-interpreter.d.ts","sourceRoot":"","sources":["../../../src/core/toolkit/reflex-interpreter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;GAMG;AAEH,eAAO,MAAM,gCAAgC,QAMjC,CAAC;AAEb,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAKhG;AAED,wBAAgB,eAAe,CAAC,IA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A8B,CACnD,OAAO,EAAE,kCAAkC,GACzC,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAiBjC;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAKhG;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CA6BpE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,OAAO,EAAE,SAAS,aAAa,EAAE,GAC/B;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,CAKvD"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { runIsolatedTextCompletion } from "../isolated-text-completion.js";
|
|
2
|
+
import { reportSpawnedUsage } from "../spawned-usage.js";
|
|
1
3
|
/**
|
|
2
4
|
* Reflex interpreter (the BRAIN half of the user-ratified brain->muscle pipeline, statistically
|
|
3
5
|
* validated at 10/10 correct interpretations on the hard registry): a strict instruction
|
|
@@ -13,6 +15,25 @@ export const REFLEX_INTERPRETER_SYSTEM_PROMPT = [
|
|
|
13
15
|
'If no script fits, output {"script":"none","args":[],"danger":false,"confidence":0}.',
|
|
14
16
|
].join("\n");
|
|
15
17
|
export const REFLEX_MIN_CONFIDENCE = 0.75;
|
|
18
|
+
/** Execute the shared reflex interpreter call and account for it under the caller's lane identity. */
|
|
19
|
+
export async function runReflexInterpreterCompletion(options) {
|
|
20
|
+
const completion = await runIsolatedTextCompletion(options.completionRunner, {
|
|
21
|
+
systemPrompt: REFLEX_INTERPRETER_SYSTEM_PROMPT,
|
|
22
|
+
userPrompt: buildReflexUserPrompt(options.request, options.scripts),
|
|
23
|
+
model: options.model,
|
|
24
|
+
thinkingLevel: "off",
|
|
25
|
+
maxTokens: 256,
|
|
26
|
+
cacheRetention: "short",
|
|
27
|
+
laneKind: options.laneKind,
|
|
28
|
+
});
|
|
29
|
+
reportSpawnedUsage(options.usageReporter, completion.usage, {
|
|
30
|
+
kind: options.usageKind,
|
|
31
|
+
label: options.usageLabel,
|
|
32
|
+
sessionId: options.sessionId,
|
|
33
|
+
identity: options.request,
|
|
34
|
+
});
|
|
35
|
+
return parseReflexPlan(completion.text);
|
|
36
|
+
}
|
|
16
37
|
export function buildReflexUserPrompt(request, scripts) {
|
|
17
38
|
const registry = scripts
|
|
18
39
|
.map((script) => `${script.name}: ${script.description}${script.danger ? " [DANGEROUS]" : ""}`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflex-interpreter.js","sourceRoot":"","sources":["../../../src/core/toolkit/reflex-interpreter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reflex-interpreter.js","sourceRoot":"","sources":["../../../src/core/toolkit/reflex-interpreter.ts"],"names":[],"mappings":"AACA,OAAO,EAAiC,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC1G,OAAO,EAAE,kBAAkB,EAA6B,MAAM,qBAAqB,CAAC;AAGpF;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC/C,6FAA6F;IAC7F,wEAAwE;IACxE,2FAA2F;IAC3F,8GAA8G;IAC9G,sFAAsF;CACtF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AASb,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAc1C,sGAAsG;AACtG,MAAM,CAAC,KAAK,UAAU,8BAA8B,CACnD,OAA2C;IAE3C,MAAM,UAAU,GAAG,MAAM,yBAAyB,CAAC,OAAO,CAAC,gBAAgB,EAAE;QAC5E,YAAY,EAAE,gCAAgC;QAC9C,UAAU,EAAE,qBAAqB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;QACnE,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,aAAa,EAAE,KAAK;QACpB,SAA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KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC;IACnE,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC","sourcesContent":["import type { Api, Model } from \"@caupulican/pi-ai\";\nimport { type IsolatedCompletionRunner, runIsolatedTextCompletion } from \"../isolated-text-completion.ts\";\nimport { reportSpawnedUsage, type SpawnedUsageReporter } from \"../spawned-usage.ts\";\nimport type { ToolkitScript } from \"./script-registry.ts\";\n\n/**\n * Reflex interpreter (the BRAIN half of the user-ratified brain->muscle pipeline, statistically\n * validated at 10/10 correct interpretations on the hard registry): a strict instruction\n * interpreter that maps a fuzzy user request onto the toolkit registry. It NEVER executes\n * anything — it only proposes `{script, args, danger, confidence}` for the deterministic\n * executor path, which still enforces every safety rule (danger confirmation included).\n */\n\nexport const REFLEX_INTERPRETER_SYSTEM_PROMPT = [\n\t\"You are a strict instruction interpreter for a script executor. You NEVER execute anything.\",\n\t\"Given a user request and the script registry, output STRICT JSON only:\",\n\t'{\"script\":\"<exact registry name>\",\"args\":[\"...\"],\"danger\":true|false,\"confidence\":<0..1>}',\n\t\"Pick the single best script. Extract arguments exactly as the script expects. Mark danger from the registry.\",\n\t'If no script fits, output {\"script\":\"none\",\"args\":[],\"danger\":false,\"confidence\":0}.',\n].join(\"\\n\");\n\nexport interface ReflexPlan {\n\tscript: string;\n\targs: string[];\n\tdanger: boolean;\n\tconfidence: number;\n}\n\nexport const REFLEX_MIN_CONFIDENCE = 0.75;\n\nexport interface ReflexInterpreterCompletionOptions {\n\trequest: string;\n\tscripts: readonly ToolkitScript[];\n\tmodel: Model<Api>;\n\tlaneKind: string;\n\tusageKind: string;\n\tusageLabel: string;\n\tsessionId: string;\n\tcompletionRunner: IsolatedCompletionRunner;\n\tusageReporter: SpawnedUsageReporter;\n}\n\n/** Execute the shared reflex interpreter call and account for it under the caller's lane identity. */\nexport async function runReflexInterpreterCompletion(\n\toptions: ReflexInterpreterCompletionOptions,\n): Promise<ReflexPlan | undefined> {\n\tconst completion = await runIsolatedTextCompletion(options.completionRunner, {\n\t\tsystemPrompt: REFLEX_INTERPRETER_SYSTEM_PROMPT,\n\t\tuserPrompt: buildReflexUserPrompt(options.request, options.scripts),\n\t\tmodel: options.model,\n\t\tthinkingLevel: \"off\",\n\t\tmaxTokens: 256,\n\t\tcacheRetention: \"short\",\n\t\tlaneKind: options.laneKind,\n\t});\n\treportSpawnedUsage(options.usageReporter, completion.usage, {\n\t\tkind: options.usageKind,\n\t\tlabel: options.usageLabel,\n\t\tsessionId: options.sessionId,\n\t\tidentity: options.request,\n\t});\n\treturn parseReflexPlan(completion.text);\n}\n\nexport function buildReflexUserPrompt(request: string, scripts: readonly ToolkitScript[]): string {\n\tconst registry = scripts\n\t\t.map((script) => `${script.name}: ${script.description}${script.danger ? \" [DANGEROUS]\" : \"\"}`)\n\t\t.join(\"\\n\");\n\treturn `Registry:\\n${registry}\\n\\nRequest: ${request.slice(0, 2000)}`;\n}\n\nexport function parseReflexPlan(text: string): ReflexPlan | undefined {\n\tconst trimmed = text.trim();\n\t// Strip a leading think block some local models emit even with thinking off.\n\tconst thinkEnd = trimmed.indexOf(\"</think>\");\n\tconst body = thinkEnd >= 0 ? trimmed.slice(thinkEnd + 8) : trimmed;\n\tconst start = body.indexOf(\"{\");\n\tconst end = body.lastIndexOf(\"}\");\n\tif (start < 0 || end <= start) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(body.slice(start, end + 1)) as {\n\t\t\tscript?: unknown;\n\t\t\targs?: unknown;\n\t\t\tdanger?: unknown;\n\t\t\tconfidence?: unknown;\n\t\t};\n\t\tif (typeof parsed.script !== \"string\" || parsed.script.length === 0) return undefined;\n\t\tconst confidence =\n\t\t\ttypeof parsed.confidence === \"number\" && Number.isFinite(parsed.confidence)\n\t\t\t\t? Math.max(0, Math.min(1, parsed.confidence))\n\t\t\t\t: 0;\n\t\treturn {\n\t\t\tscript: parsed.script,\n\t\t\targs: Array.isArray(parsed.args) ? parsed.args.filter((arg): arg is string => typeof arg === \"string\") : [],\n\t\t\tdanger: parsed.danger === true,\n\t\t\tconfidence,\n\t\t};\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Accept a plan only when it is confident AND names a real registry script (\"none\" and unknown\n * names are honest refusals). The DANGER flag is never trusted from the plan — the registry's\n * own flag governs confirmation, exactly as for a direct match.\n */\nexport function acceptReflexPlan(\n\tplan: ReflexPlan | undefined,\n\tscripts: readonly ToolkitScript[],\n): { script: ToolkitScript; args: string[] } | undefined {\n\tif (!plan || plan.confidence < REFLEX_MIN_CONFIDENCE) return undefined;\n\tconst script = scripts.find((entry) => entry.name === plan.script);\n\tif (!script) return undefined;\n\treturn { script, args: plan.args };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-registry.d.ts","sourceRoot":"","sources":["../../../src/core/toolkit/script-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,YAAY,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC7B,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;IACtB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,YAAY,GACrB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,aAAa,EAAE,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAA;CAAE,CAAC;AAkC9C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,YAAY,CAkCnG"
|
|
1
|
+
{"version":3,"file":"script-registry.d.ts","sourceRoot":"","sources":["../../../src/core/toolkit/script-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,YAAY,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC7B,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;IACtB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,YAAY,GACrB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,aAAa,EAAE,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAA;CAAE,CAAC;AAkC9C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,YAAY,CAkCnG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-registry.js","sourceRoot":"","sources":["../../../src/core/toolkit/script-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsBH,SAAS,SAAS,CAAC,IAAY
|
|
1
|
+
{"version":3,"file":"script-registry.js","sourceRoot":"","sources":["../../../src/core/toolkit/script-registry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EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAEpC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACvD,CAAC;IACD,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC;IAChC,IACC,IAAI,CAAC,KAAK,IAAI,SAAS;QACvB,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,GAAG,aAAa,IAAI,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAC7G,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAC/C,CAAC;IAED,+DAA+D;IAC/D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;AAC1F,CAAC","sourcesContent":["/**\n * Toolkit script registry + the Level-0 conservative matcher.\n *\n * The registry is the user's blessed daily-ops toolkit: named scripts with fixed runners. The\n * matcher maps a natural-language request to a script WITHOUT guessing: exact name/alias hits\n * match directly; scored matches win only with a clear margin over the runner-up; anything else\n * is a shortlist (disambiguate) or none. Ambiguity never executes — \"prepare db\" must never\n * silently run update-db.\n */\n\nexport type ToolkitRunner = \"uv\" | \"powershell\" | \"bash\";\n\nexport interface ToolkitScript {\n\t/** Registry key, kebab-case (e.g. \"restore-db\"). */\n\tname: string;\n\tdescription: string;\n\t/** User-taught phrases that map directly to this script. */\n\taliases?: string[];\n\trunner: ToolkitRunner;\n\t/** Script path, relative to cwd or absolute. */\n\tpath: string;\n\t/** Dangerous scripts require explicit confirmation at every level. */\n\tdanger?: boolean;\n}\n\nexport type ToolkitMatch =\n\t| { kind: \"exact\"; script: ToolkitScript }\n\t| { kind: \"ambiguous\"; shortlist: ToolkitScript[] }\n\t| { kind: \"none\"; closest: ToolkitScript[] };\n\nfunction normalize(text: string): string {\n\treturn text\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9]+/g, \" \")\n\t\t.trim();\n}\n\nfunction tokens(text: string): string[] {\n\treturn normalize(text).split(\" \").filter(Boolean);\n}\n\nconst STOP_WORDS = new Set([\"the\", \"a\", \"an\", \"my\", \"run\", \"execute\", \"please\", \"now\", \"thing\", \"for\", \"me\", \"to\"]);\n\n/** Score a request against one script: shared meaningful tokens with name/alias/description. */\nfunction scoreScript(requestTokens: string[], script: ToolkitScript): number {\n\tconst nameTokens = new Set([...tokens(script.name), ...(script.aliases ?? []).flatMap((alias) => tokens(alias))]);\n\tconst descriptionTokens = new Set(tokens(script.description));\n\tlet score = 0;\n\t// Deduplicate: repeating a word (\"backup backup backup\") must not multiply the score past\n\t// MIN_SCORE/margin and turn an ambiguous request into a confident match.\n\tfor (const token of new Set(requestTokens)) {\n\t\tif (STOP_WORDS.has(token)) continue;\n\t\tif (nameTokens.has(token)) score += 3;\n\t\telse if (descriptionTokens.has(token)) score += 1;\n\t}\n\treturn score;\n}\n\n/** Margin rule: the winner must beat the runner-up by at least this factor AND absolute gap. */\nconst MARGIN_FACTOR = 1.5;\nconst MIN_SCORE = 3;\n\nexport function matchToolkitScript(request: string, scripts: readonly ToolkitScript[]): ToolkitMatch {\n\tconst normalizedRequest = normalize(request);\n\tif (normalizedRequest.length === 0 || scripts.length === 0) {\n\t\treturn { kind: \"none\", closest: [] };\n\t}\n\n\t// 1. Exact name or alias (normalized) matches directly.\n\tfor (const script of scripts) {\n\t\tif (normalize(script.name) === normalizedRequest) return { kind: \"exact\", script };\n\t\tfor (const alias of script.aliases ?? []) {\n\t\t\tif (normalize(alias) === normalizedRequest) return { kind: \"exact\", script };\n\t\t}\n\t}\n\n\t// 2. Scored matching with the margin rule.\n\tconst requestTokens = tokens(request);\n\tconst scored = scripts\n\t\t.map((script) => ({ script, score: scoreScript(requestTokens, script) }))\n\t\t.filter((entry) => entry.score > 0)\n\t\t.sort((a, b) => b.score - a.score);\n\n\tif (scored.length === 0) {\n\t\treturn { kind: \"none\", closest: scripts.slice(0, 3) };\n\t}\n\tconst [best, runnerUp] = scored;\n\tif (\n\t\tbest.score >= MIN_SCORE &&\n\t\t(runnerUp === undefined || (best.score >= runnerUp.score * MARGIN_FACTOR && best.score - runnerUp.score >= 2))\n\t) {\n\t\treturn { kind: \"exact\", script: best.script };\n\t}\n\n\t// No clear winner: shortlist for disambiguation — never guess.\n\treturn { kind: \"ambiguous\", shortlist: scored.slice(0, 4).map((entry) => entry.script) };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-runner.d.ts","sourceRoot":"","sources":["../../../src/core/toolkit/script-runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AAEH,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,CAC5B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,KACb,OAAO,CAAC,eAAe,CAAC,CAAC;AAE9B,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE,OAAO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,SAAS,MAAM,EAAE,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC1B,GAAG,OAAO,CAAC,eAAe,CAAC,CAI3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-runner.js","sourceRoot":"","sources":["../../../src/core/toolkit/script-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kCAAkC,EAAE,MAAM,8BAA8B,CAAC;AAwBhG,MAAM,UAAU,eAAe,CAAC,MAAqB,EAAE,IAAuB
|
|
1
|
+
{"version":3,"file":"script-runner.js","sourceRoot":"","sources":["../../../src/core/toolkit/script-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kCAAkC,EAAE,MAAM,8BAA8B,CAAC;AAwBhG,MAAM,UAAU,eAAe,CAAC,MAAqB,EAAE,IAAuB;IAC7E,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACvB,KAAK,IAAI;YACR,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAC/D,KAAK,YAAY;YAChB,OAAO;gBACN,OAAO,EAAE,gBAAgB;gBACzB,IAAI,EAAE,CAAC,YAAY,EAAE,kBAAkB,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;aACjF,CAAC;QACH,KAAK,MAAM;YACV,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;IAC3D,CAAC;AACF,CAAC;AAED,MAAM,gBAAgB,GAAG,GAAG,GAAG,IAAI,CAAC;AACpC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAEnC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C,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9D,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO;YAChC,QAAQ,EAAE,KAAK;SACf,CAAC;IACH,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAM1C;IACA,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,mBAAmB,CAAC;IACtD,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import { spawnProcess, waitForChildProcessWithTermination } from \"../../utils/child-process.ts\";\nimport type { ToolkitScript } from \"./script-registry.ts\";\n\n/**\n * Toolkit script invocation: the harness owns execution. Fixed argv per runner (never a shell\n * string), captured exit/stdout/stderr ALWAYS — the structural error contract that makes\n * false-success impossible regardless of what the model narrates.\n */\n\nexport interface ScriptExecution {\n\texitCode: number | null;\n\tstdout: string;\n\tstderr: string;\n\tdurationMs: number;\n\ttimedOut: boolean;\n}\n\nexport type ScriptExecutor = (\n\tcommand: string,\n\targv: string[],\n\tcwd: string,\n\ttimeoutMs: number,\n) => Promise<ScriptExecution>;\n\nexport function buildScriptArgv(script: ToolkitScript, args: readonly string[]): { command: string; argv: string[] } {\n\tswitch (script.runner) {\n\t\tcase \"uv\":\n\t\t\treturn { command: \"uv\", argv: [\"run\", script.path, ...args] };\n\t\tcase \"powershell\":\n\t\t\treturn {\n\t\t\t\tcommand: \"powershell.exe\",\n\t\t\t\targv: [\"-NoProfile\", \"-ExecutionPolicy\", \"Bypass\", \"-File\", script.path, ...args],\n\t\t\t};\n\t\tcase \"bash\":\n\t\t\treturn { command: \"bash\", argv: [script.path, ...args] };\n\t}\n}\n\nconst MAX_OUTPUT_BYTES = 512 * 1024;\nconst SCRIPT_KILL_GRACE_MS = 2_000;\n\n/** Default executor: real process spawn, no shell interpolation, bounded output and time. */\nexport const spawnScriptExecutor: ScriptExecutor = async (command, argv, cwd, timeoutMs) => {\n\tconst started = Date.now();\n\tconst terminationController = new AbortController();\n\tconst stdoutChunks: Buffer[] = [];\n\tconst stderrChunks: Buffer[] = [];\n\tlet stdoutBytes = 0;\n\tlet stderrBytes = 0;\n\tlet outputExceeded = false;\n\tconst appendChunk = (chunks: Buffer[], chunk: Buffer, streamBytes: number): number => {\n\t\tconst remaining = Math.max(0, MAX_OUTPUT_BYTES - streamBytes);\n\t\tif (remaining > 0) chunks.push(chunk.subarray(0, remaining));\n\t\tconst nextBytes = streamBytes + chunk.length;\n\t\tif (nextBytes > MAX_OUTPUT_BYTES) {\n\t\t\toutputExceeded = true;\n\t\t\tterminationController.abort();\n\t\t}\n\t\treturn nextBytes;\n\t};\n\n\ttry {\n\t\tconst child = spawnProcess(command, argv, {\n\t\t\tcwd,\n\t\t\tdetached: process.platform !== \"win32\",\n\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t});\n\t\tchild.stdout?.on(\"data\", (chunk: Buffer) => {\n\t\t\tstdoutBytes = appendChunk(stdoutChunks, chunk, stdoutBytes);\n\t\t});\n\t\tchild.stderr?.on(\"data\", (chunk: Buffer) => {\n\t\t\tstderrBytes = appendChunk(stderrChunks, chunk, stderrBytes);\n\t\t});\n\t\tconst terminal = await waitForChildProcessWithTermination(child, {\n\t\t\tsignal: terminationController.signal,\n\t\t\ttimeoutMs,\n\t\t\tkillGraceMs: SCRIPT_KILL_GRACE_MS,\n\t\t});\n\t\tconst stdout = Buffer.concat(stdoutChunks).toString(\"utf8\");\n\t\tlet stderr = Buffer.concat(stderrChunks).toString(\"utf8\");\n\t\tif (outputExceeded) {\n\t\t\tstderr = `${stderr}${stderr ? \"\\n\" : \"\"}Command output exceeded maxBuffer (${MAX_OUTPUT_BYTES} bytes)`;\n\t\t}\n\t\treturn {\n\t\t\texitCode: outputExceeded ? null : terminal.code,\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\tdurationMs: Date.now() - started,\n\t\t\ttimedOut: terminal.reason === \"timeout\",\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\texitCode: null,\n\t\t\tstdout: Buffer.concat(stdoutChunks).toString(\"utf8\"),\n\t\t\tstderr: error instanceof Error ? error.message : String(error),\n\t\t\tdurationMs: Date.now() - started,\n\t\t\ttimedOut: false,\n\t\t};\n\t}\n};\n\nexport async function executeToolkitScript(args: {\n\tscript: ToolkitScript;\n\tscriptArgs: readonly string[];\n\tcwd: string;\n\ttimeoutMs?: number;\n\texecutor?: ScriptExecutor;\n}): Promise<ScriptExecution> {\n\tconst { command, argv } = buildScriptArgv(args.script, args.scriptArgs);\n\tconst executor = args.executor ?? spawnScriptExecutor;\n\treturn executor(command, argv, args.cwd, args.timeoutMs ?? 120_000);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-retrieve.d.ts","sourceRoot":"","sources":["../../../src/core/tools/artifact-retrieve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EACN,KAAK,qBAAqB,EAG1B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAM7D,QAAA,MAAM,sBAAsB;;;;EAc1B,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE9E,MAAM,WAAW,2BAA2B;IAC3C,KAAK,EAAE,OAAO,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} from \"@caupulican/pi-tui\";\nimport { type Static, Type } from \"typebox\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport {\n\ttype ArtifactRetrievalMode,\n\tDEFAULT_RETRIEVAL_MAX_LINES,\n\tretrieveArtifactSlice,\n} from \"../context/artifact-retrieval.ts\";\nimport type { ArtifactStore } from \"../context/context-artifacts.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { invalidArgText, str } from \"./render-utils.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst ARTIFACT_ID_PREFIX = \"tool-output:\";\n\nconst artifactRetrieveSchema = Type.Object({\n\tartifactId: Type.String({\n\t\tdescription:\n\t\t\t\"Artifact id from a 'Full output: artifact tool-output:<id>' reference in a prior tool result. The 'tool-output:' prefix is optional.\",\n\t}),\n\tmode: Type.Optional(\n\t\tType.Union([Type.Literal(\"metadata\"), Type.Literal(\"head\"), Type.Literal(\"tail\")], {\n\t\t\tdescription:\n\t\t\t\t\"'metadata' for tool/path/size info only (no content); 'head' (default) for the first lines; 'tail' for the last lines.\",\n\t\t}),\n\t),\n\tmaxLines: Type.Optional(\n\t\tType.Number({ description: `Maximum lines to return for head/tail (default: ${DEFAULT_RETRIEVAL_MAX_LINES})` }),\n\t),\n});\n\nexport type ArtifactRetrieveToolInput = Static<typeof artifactRetrieveSchema>;\n\nexport interface ArtifactRetrieveToolDetails {\n\tfound: boolean;\n\tmode: ArtifactRetrievalMode;\n}\n\nexport interface ArtifactRetrieveToolOptions {\n\t/** Session-scoped artifact store to resolve ids against. Omitted: the tool reports unavailable. */\n\tartifactStore?: ArtifactStore;\n}\n\nfunction normalizeArtifactId(input: string): string {\n\treturn input.startsWith(ARTIFACT_ID_PREFIX) ? input.slice(ARTIFACT_ID_PREFIX.length) : input;\n}\n\nfunction formatMetadataText(ref: {\n\tkind: string;\n\ttoolName?: string;\n\tcommand?: string;\n\tpath?: string;\n\tbyteLength: number;\n\tlineCount?: number;\n\treproducible: boolean;\n}): string {\n\tconst lines = [\n\t\t`kind: ${ref.kind}`,\n\t\tref.toolName ? `tool: ${ref.toolName}` : undefined,\n\t\tref.command ? `command: ${ref.command}` : undefined,\n\t\tref.path ? `path: ${ref.path}` : undefined,\n\t\t`size: ${formatSize(ref.byteLength)}`,\n\t\tref.lineCount !== undefined ? `lines: ${ref.lineCount}` : undefined,\n\t\t`reproducible: ${ref.reproducible}`,\n\t];\n\treturn lines.filter((line): line is string => line !== undefined).join(\"\\n\");\n}\n\nfunction formatCall(args: { artifactId: string; mode?: string } | undefined, theme: Theme): string {\n\tconst artifactId = str(args?.artifactId);\n\tconst mode = args?.mode ?? \"head\";\n\tconst idText = artifactId === null ? invalidArgText(theme) : theme.fg(\"accent\", artifactId);\n\treturn `${theme.fg(\"toolTitle\", theme.bold(\"artifact_retrieve\"))} ${idText}${theme.fg(\"toolOutput\", ` (${mode})`)}`;\n}\n\nexport function createArtifactRetrieveToolDefinition(\n\t_cwd: string,\n\toptions?: ArtifactRetrieveToolOptions,\n): ToolDefinition<typeof artifactRetrieveSchema, ArtifactRetrieveToolDetails | undefined> {\n\tconst artifactStore = options?.artifactStore;\n\treturn {\n\t\tname: \"artifact_retrieve\",\n\t\tlabel: \"artifact_retrieve\",\n\t\tdescription:\n\t\t\t\"Retrieve a bounded slice of a packed tool-output artifact by id, from a 'Full output: artifact tool-output:<id>' reference in a prior tool result. Returns metadata, or a bounded head/tail slice -- never the full raw payload in one call.\",\n\t\tpromptSnippet: \"Retrieve a bounded slice of a packed tool-output artifact\",\n\t\tparameters: artifactRetrieveSchema,\n\t\ttoolGroup: \"explore\",\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ artifactId, mode, maxLines }: { artifactId: string; mode?: ArtifactRetrievalMode; maxLines?: number },\n\t\t) {\n\t\t\tconst effectiveMode = mode ?? \"head\";\n\t\t\tif (!artifactStore) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: \"No artifact store is configured for this session.\" }],\n\t\t\t\t\tdetails: { found: false, mode: effectiveMode },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst result = retrieveArtifactSlice(artifactStore, {\n\t\t\t\tartifactId: normalizeArtifactId(artifactId),\n\t\t\t\tmode,\n\t\t\t\tmaxLines,\n\t\t\t});\n\n\t\t\tif (!result.found) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: `Artifact not found: ${artifactId} (${result.missingReason}). It may have been cleaned up, or the id may be incorrect.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { found: false, mode: effectiveMode },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (result.mode === \"metadata\") {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: formatMetadataText(result.ref) }],\n\t\t\t\t\tdetails: { found: true, mode: \"metadata\" },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet text = result.slice;\n\t\t\tif (result.truncation.truncated) {\n\t\t\t\ttext += `\\n\\n[Showing ${result.mode} ${result.truncation.outputLines} of ${result.truncation.totalLines} lines. Full artifact: ${formatSize(result.ref.byteLength)}. Retrieve again with a different mode/maxLines for another slice.]`;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text }],\n\t\t\t\tdetails: { found: true, mode: result.mode },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatCall(args, theme));\n\t\t\treturn text;\n\t\t},\n\t\trenderResult(result, options, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\tconst content = result.content.find((part) => part.type === \"text\");\n\t\t\tconst body = content && \"text\" in content ? content.text : \"\";\n\t\t\tconst lines = body.split(\"\\n\");\n\t\t\tconst maxLines = options.expanded ? lines.length : 20;\n\t\t\tconst displayLines = lines.slice(0, maxLines);\n\t\t\tconst remaining = lines.length - maxLines;\n\t\t\tlet rendered = displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\");\n\t\t\tif (remaining > 0) rendered += `\\n${theme.fg(\"muted\", `... (${remaining} more lines)`)}`;\n\t\t\ttext.setText(rendered);\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createArtifactRetrieveTool(\n\tcwd: string,\n\toptions?: ArtifactRetrieveToolOptions,\n): AgentTool<typeof artifactRetrieveSchema> {\n\treturn wrapToolDefinition(createArtifactRetrieveToolDefinition(cwd, options));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"artifact-retrieve.js","sourceRoot":"","sources":["../../../src/core/tools/artifact-retrieve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAEN,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAE1C,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1C,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;QACvB,WAAW,EACV,sIAAsI;KACvI,CAAC;IACF,IAAI,EAAE,IAAI,CAAC,QAAQ,CAClB,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE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U,0BAA0B,CACzC,GAAW,EACX,OAAqC;IAErC,OAAO,kBAAkB,CAAC,oCAAoC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["import type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport { formatSize } from \"@caupulican/pi-agent-core/node\";\nimport { Text } from \"@caupulican/pi-tui\";\nimport { type Static, Type } from \"typebox\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport {\n\ttype ArtifactRetrievalMode,\n\tDEFAULT_RETRIEVAL_MAX_LINES,\n\tretrieveArtifactSlice,\n} from \"../context/artifact-retrieval.ts\";\nimport type { ArtifactStore } from \"../context/context-artifacts.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { invalidArgText, str } from \"./render-utils.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst ARTIFACT_ID_PREFIX = \"tool-output:\";\n\nconst artifactRetrieveSchema = Type.Object({\n\tartifactId: Type.String({\n\t\tdescription:\n\t\t\t\"Artifact id from a 'Full output: artifact tool-output:<id>' reference in a prior tool result. The 'tool-output:' prefix is optional.\",\n\t}),\n\tmode: Type.Optional(\n\t\tType.Union([Type.Literal(\"metadata\"), Type.Literal(\"head\"), Type.Literal(\"tail\")], {\n\t\t\tdescription:\n\t\t\t\t\"'metadata' for tool/path/size info only (no content); 'head' (default) for the first lines; 'tail' for the last lines.\",\n\t\t}),\n\t),\n\tmaxLines: Type.Optional(\n\t\tType.Number({ description: `Maximum lines to return for head/tail (default: ${DEFAULT_RETRIEVAL_MAX_LINES})` }),\n\t),\n});\n\nexport type ArtifactRetrieveToolInput = Static<typeof artifactRetrieveSchema>;\n\nexport interface ArtifactRetrieveToolDetails {\n\tfound: boolean;\n\tmode: ArtifactRetrievalMode;\n}\n\nexport interface ArtifactRetrieveToolOptions {\n\t/** Session-scoped artifact store to resolve ids against. Omitted: the tool reports unavailable. */\n\tartifactStore?: ArtifactStore;\n}\n\nfunction normalizeArtifactId(input: string): string {\n\treturn input.startsWith(ARTIFACT_ID_PREFIX) ? input.slice(ARTIFACT_ID_PREFIX.length) : input;\n}\n\nfunction formatMetadataText(ref: {\n\tkind: string;\n\ttoolName?: string;\n\tcommand?: string;\n\tpath?: string;\n\tbyteLength: number;\n\tlineCount?: number;\n\treproducible: boolean;\n}): string {\n\tconst lines = [\n\t\t`kind: ${ref.kind}`,\n\t\tref.toolName ? `tool: ${ref.toolName}` : undefined,\n\t\tref.command ? `command: ${ref.command}` : undefined,\n\t\tref.path ? `path: ${ref.path}` : undefined,\n\t\t`size: ${formatSize(ref.byteLength)}`,\n\t\tref.lineCount !== undefined ? `lines: ${ref.lineCount}` : undefined,\n\t\t`reproducible: ${ref.reproducible}`,\n\t];\n\treturn lines.filter((line): line is string => line !== undefined).join(\"\\n\");\n}\n\nfunction formatCall(args: { artifactId: string; mode?: string } | undefined, theme: Theme): string {\n\tconst artifactId = str(args?.artifactId);\n\tconst mode = args?.mode ?? \"head\";\n\tconst idText = artifactId === null ? invalidArgText(theme) : theme.fg(\"accent\", artifactId);\n\treturn `${theme.fg(\"toolTitle\", theme.bold(\"artifact_retrieve\"))} ${idText}${theme.fg(\"toolOutput\", ` (${mode})`)}`;\n}\n\nexport function createArtifactRetrieveToolDefinition(\n\t_cwd: string,\n\toptions?: ArtifactRetrieveToolOptions,\n): ToolDefinition<typeof artifactRetrieveSchema, ArtifactRetrieveToolDetails | undefined> {\n\tconst artifactStore = options?.artifactStore;\n\treturn {\n\t\tname: \"artifact_retrieve\",\n\t\tlabel: \"artifact_retrieve\",\n\t\tdescription:\n\t\t\t\"Retrieve a bounded slice of a packed tool-output artifact by id, from a 'Full output: artifact tool-output:<id>' reference in a prior tool result. Returns metadata, or a bounded head/tail slice -- never the full raw payload in one call.\",\n\t\tpromptSnippet: \"Retrieve a bounded slice of a packed tool-output artifact\",\n\t\tparameters: artifactRetrieveSchema,\n\t\ttoolGroup: \"explore\",\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ artifactId, mode, maxLines }: { artifactId: string; mode?: ArtifactRetrievalMode; maxLines?: number },\n\t\t) {\n\t\t\tconst effectiveMode = mode ?? \"head\";\n\t\t\tif (!artifactStore) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: \"No artifact store is configured for this session.\" }],\n\t\t\t\t\tdetails: { found: false, mode: effectiveMode },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst result = retrieveArtifactSlice(artifactStore, {\n\t\t\t\tartifactId: normalizeArtifactId(artifactId),\n\t\t\t\tmode,\n\t\t\t\tmaxLines,\n\t\t\t});\n\n\t\t\tif (!result.found) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: `Artifact not found: ${artifactId} (${result.missingReason}). It may have been cleaned up, or the id may be incorrect.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { found: false, mode: effectiveMode },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (result.mode === \"metadata\") {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: formatMetadataText(result.ref) }],\n\t\t\t\t\tdetails: { found: true, mode: \"metadata\" },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet text = result.slice;\n\t\t\tif (result.truncation.truncated) {\n\t\t\t\ttext += `\\n\\n[Showing ${result.mode} ${result.truncation.outputLines} of ${result.truncation.totalLines} lines. Full artifact: ${formatSize(result.ref.byteLength)}. Retrieve again with a different mode/maxLines for another slice.]`;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text }],\n\t\t\t\tdetails: { found: true, mode: result.mode },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatCall(args, theme));\n\t\t\treturn text;\n\t\t},\n\t\trenderResult(result, options, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\tconst content = result.content.find((part) => part.type === \"text\");\n\t\t\tconst body = content && \"text\" in content ? content.text : \"\";\n\t\t\tconst lines = body.split(\"\\n\");\n\t\t\tconst maxLines = options.expanded ? lines.length : 20;\n\t\t\tconst displayLines = lines.slice(0, maxLines);\n\t\t\tconst remaining = lines.length - maxLines;\n\t\t\tlet rendered = displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\");\n\t\t\tif (remaining > 0) rendered += `\\n${theme.fg(\"muted\", `... (${remaining} more lines)`)}`;\n\t\t\ttext.setText(rendered);\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createArtifactRetrieveTool(\n\tcwd: string,\n\toptions?: ArtifactRetrieveToolOptions,\n): AgentTool<typeof artifactRetrieveSchema> {\n\treturn wrapToolDefinition(createArtifactRetrieveToolDefinition(cwd, options));\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SessionManager } from "@caupulican/pi-agent-core/node";
|
|
2
2
|
import { type Component } from "@caupulican/pi-tui";
|
|
3
3
|
import { type Static, Type } from "typebox";
|
|
4
|
-
import type
|
|
4
|
+
import { type ClipboardInputHost } from "../../modes/interactive/clipboard-input.ts";
|
|
5
5
|
import type { Theme } from "../../modes/interactive/theme/theme.ts";
|
|
6
6
|
import type { ArtifactStore } from "../context/context-artifacts.ts";
|
|
7
7
|
import { type HumanInputAnswer, type HumanInputAnswerImage, type HumanInputPresentationResult, type HumanInputQuestion, type HumanInputStopReason } from "../human-input.ts";
|
|
@@ -68,8 +68,7 @@ export declare class AskQuestionDialog implements Component {
|
|
|
68
68
|
private readonly createAnswerEditor;
|
|
69
69
|
private readonly selections;
|
|
70
70
|
private readonly cursors;
|
|
71
|
-
private
|
|
72
|
-
private clipboardImageCounter;
|
|
71
|
+
private readonly clipboardQueue;
|
|
73
72
|
private currentIndex;
|
|
74
73
|
private input;
|
|
75
74
|
private inputError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask-question.d.ts","sourceRoot":"","sources":["../../../src/core/tools/ask-question.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACN,KAAK,SAAS,EAOd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAyB,MAAM,4CAA4C,CAAC;AAE5G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAIN,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EAEvB,KAAK,oBAAoB,EAEzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAsCnE,QAAA,MAAM,iBAAiB;;;;;;;;;;;EAStB,CAAC;AAKF,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACpE,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAC7C,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AACjD,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAC3D,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,SAAS,WAAW,EAAE,CAAC;IAClC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACtC,SAAS,EAAE,OAA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qBAAqB,EAAE,gBAAgB,GAAG,aAAa,CAAC,GAAG,IAAI,CAErF;IAED,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,iBAAiB;YAwBX,qBAAqB;IAuDnC,OAAO,CAAC,aAAa;IA6BrB,OAAO,CAAC,YAAY;IAUpB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAgE9B;IAED,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,cAAc;IAiFtB,OAAO,CAAC,YAAY;IA4BpB,OAAO,CAAC,UAAU;IAelB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAsB9B;IAED,UAAU,IAAI,IAAI,CAGjB;CACD;AA6DD,wBAAgB,+BAA+B,CAAC,OAAO,GAAE,sBAA2B;;;;;;;;;;;kGAsGnF","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.d.ts","sourceRoot":"","sources":["../../../src/core/tools/ask-question.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACN,KAAK,SAAS,EAOd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAEN,KAAK,kBAAkB,EAGvB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,KAAK,E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