@caupulican/pi-adaptative 0.81.38 → 0.81.40
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 +131 -0
- package/README.md +2 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/README.md +18 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +133 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +198 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +311 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +31 -2
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +823 -79
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +1043 -86
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/__init__.py +43 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/fs.py +270 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/search.py +252 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/strings.py +399 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/text.py +575 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/context.py +52 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/errors.py +49 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/exec.py +734 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/expand.py +238 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/main.py +132 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/nodes.py +116 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/parser.py +287 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/proc.py +137 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/state.py +100 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/tokens.py +579 -0
- package/dist/bundled-resources/skills/tool-call-repair/SKILL.md +19 -9
- package/dist/bundled-resources/skills/tool-call-repair/references/failure-grammar.md +22 -5
- package/dist/bundled-resources/skills/tool-call-repair/references/repair-catalogue.md +7 -7
- package/dist/bundled-resources/skills/tool-call-repair/references/text-protocol-grammar.md +28 -7
- package/dist/cli/args.d.ts +5 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +24 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-directory-layout.d.ts +15 -0
- package/dist/core/agent-directory-layout.d.ts.map +1 -0
- package/dist/core/agent-directory-layout.js +72 -0
- package/dist/core/agent-directory-layout.js.map +1 -0
- package/dist/core/agent-paths.d.ts +66 -0
- package/dist/core/agent-paths.d.ts.map +1 -0
- package/dist/core/agent-paths.js +170 -0
- package/dist/core/agent-paths.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +52 -8
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +397 -79
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +4 -3
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +255 -103
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +754 -1173
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/approval-gate.d.ts +3 -2
- package/dist/core/autonomy/approval-gate.d.ts.map +1 -1
- package/dist/core/autonomy/approval-gate.js +6 -28
- package/dist/core/autonomy/approval-gate.js.map +1 -1
- package/dist/core/autonomy/bounded-completion.d.ts +1 -1
- package/dist/core/autonomy/bounded-completion.d.ts.map +1 -1
- package/dist/core/autonomy/bounded-completion.js +1 -1
- package/dist/core/autonomy/bounded-completion.js.map +1 -1
- package/dist/core/autonomy/contracts.d.ts +26 -9
- package/dist/core/autonomy/contracts.d.ts.map +1 -1
- package/dist/core/autonomy/contracts.js.map +1 -1
- package/dist/core/autonomy/foreground-envelope.d.ts +8 -2
- package/dist/core/autonomy/foreground-envelope.d.ts.map +1 -1
- package/dist/core/autonomy/foreground-envelope.js +8 -25
- 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 +8 -10
- package/dist/core/autonomy/gates.js.map +1 -1
- package/dist/core/autonomy/lane-private-paths.d.ts +2 -0
- package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -0
- package/dist/core/autonomy/lane-private-paths.js +16 -0
- package/dist/core/autonomy/lane-private-paths.js.map +1 -0
- package/dist/core/autonomy/lane-tool-surface.d.ts +10 -0
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +46 -8
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/autonomy/lane-tracker.d.ts +24 -1
- package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tracker.js +43 -1
- package/dist/core/autonomy/lane-tracker.js.map +1 -1
- package/dist/core/autonomy/risk-assessment.d.ts +1 -2
- package/dist/core/autonomy/risk-assessment.d.ts.map +1 -1
- package/dist/core/autonomy/risk-assessment.js +1 -123
- package/dist/core/autonomy/risk-assessment.js.map +1 -1
- package/dist/core/autonomy/session-lane-record.d.ts +4 -4
- package/dist/core/autonomy/session-lane-record.d.ts.map +1 -1
- package/dist/core/autonomy/session-lane-record.js +16 -29
- package/dist/core/autonomy/session-lane-record.js.map +1 -1
- package/dist/core/autonomy/telemetry-events.d.ts +1 -1
- package/dist/core/autonomy/telemetry-events.d.ts.map +1 -1
- package/dist/core/autonomy/telemetry-events.js +1 -1
- package/dist/core/autonomy/telemetry-events.js.map +1 -1
- package/dist/core/autonomy-telemetry.d.ts +7 -7
- package/dist/core/autonomy-telemetry.d.ts.map +1 -1
- package/dist/core/autonomy-telemetry.js +9 -9
- package/dist/core/autonomy-telemetry.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts +90 -156
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +192 -968
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/bash-execution-controller.d.ts +4 -0
- package/dist/core/bash-execution-controller.d.ts.map +1 -1
- package/dist/core/bash-execution-controller.js +7 -1
- package/dist/core/bash-execution-controller.js.map +1 -1
- package/dist/core/capability-contract.d.ts +4 -0
- package/dist/core/capability-contract.d.ts.map +1 -0
- package/dist/core/capability-contract.js +28 -0
- package/dist/core/capability-contract.js.map +1 -0
- package/dist/core/compaction-controller.d.ts +90 -0
- package/dist/core/compaction-controller.d.ts.map +1 -0
- package/dist/core/compaction-controller.js +452 -0
- package/dist/core/compaction-controller.js.map +1 -0
- package/dist/core/compaction-support.d.ts +24 -13
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js +43 -7
- package/dist/core/compaction-support.js.map +1 -1
- package/dist/core/context/context-artifacts.d.ts +6 -2
- package/dist/core/context/context-artifacts.d.ts.map +1 -1
- package/dist/core/context/context-artifacts.js +34 -2
- package/dist/core/context/context-artifacts.js.map +1 -1
- package/dist/core/context/context-audit.d.ts +33 -1
- package/dist/core/context/context-audit.d.ts.map +1 -1
- package/dist/core/context/context-audit.js +31 -5
- package/dist/core/context/context-audit.js.map +1 -1
- package/dist/core/context/context-store-retention.d.ts +8 -2
- package/dist/core/context/context-store-retention.d.ts.map +1 -1
- package/dist/core/context/context-store-retention.js +158 -35
- package/dist/core/context/context-store-retention.js.map +1 -1
- package/dist/core/context/okf-memory.d.ts.map +1 -1
- package/dist/core/context/okf-memory.js +9 -11
- package/dist/core/context/okf-memory.js.map +1 -1
- package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -1
- package/dist/core/context/sqlite-runtime-index.js +6 -8
- package/dist/core/context/sqlite-runtime-index.js.map +1 -1
- package/dist/core/context-gc.d.ts +3 -0
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +26 -6
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +26 -4
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +146 -18
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/cost-guard.d.ts +19 -3
- package/dist/core/cost-guard.d.ts.map +1 -1
- package/dist/core/cost-guard.js +18 -3
- 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/delegation/managed-lane-controller.d.ts +34 -0
- package/dist/core/delegation/managed-lane-controller.d.ts.map +1 -0
- package/dist/core/delegation/managed-lane-controller.js +217 -0
- package/dist/core/delegation/managed-lane-controller.js.map +1 -0
- package/dist/core/delegation/session-worker-claim.d.ts +44 -0
- package/dist/core/delegation/session-worker-claim.d.ts.map +1 -0
- package/dist/core/delegation/session-worker-claim.js +98 -0
- package/dist/core/delegation/session-worker-claim.js.map +1 -0
- package/dist/core/delegation/worker-actions.d.ts +7 -5
- package/dist/core/delegation/worker-actions.d.ts.map +1 -1
- package/dist/core/delegation/worker-actions.js +20 -4
- package/dist/core/delegation/worker-actions.js.map +1 -1
- package/dist/core/delegation/worker-claim.d.ts +56 -0
- package/dist/core/delegation/worker-claim.d.ts.map +1 -0
- package/dist/core/delegation/worker-claim.js +239 -0
- package/dist/core/delegation/worker-claim.js.map +1 -0
- package/dist/core/delegation/worker-delegation-controller.d.ts +110 -0
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -0
- package/dist/core/delegation/worker-delegation-controller.js +861 -0
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -0
- package/dist/core/delegation/worker-delegation-request.d.ts +11 -0
- package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -0
- package/dist/core/delegation/worker-delegation-request.js +2 -0
- package/dist/core/delegation/worker-delegation-request.js.map +1 -0
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts +40 -0
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts.map +1 -0
- package/dist/core/delegation/worker-dispatch-scheduler.js +93 -0
- package/dist/core/delegation/worker-dispatch-scheduler.js.map +1 -0
- package/dist/core/delegation/worker-execution-policy.d.ts +62 -0
- package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -0
- package/dist/core/delegation/worker-execution-policy.js +160 -0
- package/dist/core/delegation/worker-execution-policy.js.map +1 -0
- package/dist/core/delegation/worker-lane-projection.d.ts +14 -0
- package/dist/core/delegation/worker-lane-projection.d.ts.map +1 -0
- package/dist/core/delegation/worker-lane-projection.js +100 -0
- package/dist/core/delegation/worker-lane-projection.js.map +1 -0
- package/dist/core/delegation/worker-lifecycle.d.ts +97 -0
- package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -0
- package/dist/core/delegation/worker-lifecycle.js +339 -0
- package/dist/core/delegation/worker-lifecycle.js.map +1 -0
- package/dist/core/delegation/worker-notification-coordinator.d.ts +36 -0
- package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -0
- package/dist/core/delegation/worker-notification-coordinator.js +90 -0
- package/dist/core/delegation/worker-notification-coordinator.js.map +1 -0
- package/dist/core/delegation/worker-profile-resolver.d.ts +55 -0
- package/dist/core/delegation/worker-profile-resolver.d.ts.map +1 -0
- package/dist/core/delegation/worker-profile-resolver.js +113 -0
- package/dist/core/delegation/worker-profile-resolver.js.map +1 -0
- package/dist/core/delegation/worker-runner.d.ts +25 -14
- package/dist/core/delegation/worker-runner.d.ts.map +1 -1
- package/dist/core/delegation/worker-runner.js +122 -53
- package/dist/core/delegation/worker-runner.js.map +1 -1
- package/dist/core/delegation/worker-task-label.d.ts +3 -0
- package/dist/core/delegation/worker-task-label.d.ts.map +1 -0
- package/dist/core/delegation/worker-task-label.js +11 -0
- package/dist/core/delegation/worker-task-label.js.map +1 -0
- package/dist/core/doctor.d.ts +8 -0
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +32 -1
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +5 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +68 -13
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +7 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/storage.d.ts +8 -0
- package/dist/core/extensions/storage.d.ts.map +1 -0
- package/dist/core/extensions/storage.js +28 -0
- package/dist/core/extensions/storage.js.map +1 -0
- package/dist/core/extensions/types.d.ts +101 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/failure-corpus.d.ts +1 -15
- package/dist/core/failure-corpus.d.ts.map +1 -1
- package/dist/core/failure-corpus.js +9 -37
- package/dist/core/failure-corpus.js.map +1 -1
- package/dist/core/foreground-recovery-controller.d.ts +52 -0
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -0
- package/dist/core/foreground-recovery-controller.js +111 -0
- package/dist/core/foreground-recovery-controller.js.map +1 -0
- package/dist/core/gateways/channel-provider.d.ts +3 -0
- package/dist/core/gateways/channel-provider.d.ts.map +1 -1
- package/dist/core/gateways/channel-provider.js +31 -6
- package/dist/core/gateways/channel-provider.js.map +1 -1
- package/dist/core/goal-loop-controller.d.ts +17 -1
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +79 -11
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/goal-acceptance.d.ts +11 -0
- package/dist/core/goals/goal-acceptance.d.ts.map +1 -0
- package/dist/core/goals/goal-acceptance.js +25 -0
- package/dist/core/goals/goal-acceptance.js.map +1 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts +27 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -0
- package/dist/core/goals/goal-auto-continue-controller.js +93 -0
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -0
- package/dist/core/goals/goal-continuation-controller.d.ts +48 -2
- package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-controller.js +87 -0
- package/dist/core/goals/goal-continuation-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.d.ts +39 -0
- package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.js +42 -0
- package/dist/core/goals/goal-continuation-defaults.js.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.d.ts +5 -1
- package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.js +56 -15
- package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
- package/dist/core/goals/goal-lifecycle.d.ts +20 -0
- package/dist/core/goals/goal-lifecycle.d.ts.map +1 -0
- package/dist/core/goals/goal-lifecycle.js +17 -0
- package/dist/core/goals/goal-lifecycle.js.map +1 -0
- package/dist/core/goals/goal-runtime-snapshot.d.ts +105 -4
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.js +91 -6
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
- package/dist/core/goals/goal-state.d.ts +90 -1
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +78 -15
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts +58 -2
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +82 -6
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/goals/session-goal-state.d.ts +13 -6
- package/dist/core/goals/session-goal-state.d.ts.map +1 -1
- package/dist/core/goals/session-goal-state.js +20 -28
- package/dist/core/goals/session-goal-state.js.map +1 -1
- package/dist/core/human-input.d.ts +100 -0
- package/dist/core/human-input.d.ts.map +1 -0
- package/dist/core/human-input.js +362 -0
- package/dist/core/human-input.js.map +1 -0
- package/dist/core/index.d.ts +9 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +9 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/{telemetry.d.ts → install-telemetry.d.ts} +1 -1
- package/dist/core/install-telemetry.d.ts.map +1 -0
- package/dist/core/{telemetry.js → install-telemetry.js} +1 -1
- package/dist/core/install-telemetry.js.map +1 -0
- package/dist/core/keybindings.d.ts +27 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +34 -8
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/learning/learning-audit.d.ts +2 -4
- package/dist/core/learning/learning-audit.d.ts.map +1 -1
- package/dist/core/learning/learning-audit.js +9 -29
- 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 +1 -6
- package/dist/core/learning/learning-gate.js.map +1 -1
- package/dist/core/learning/observation-store.d.ts +12 -3
- package/dist/core/learning/observation-store.d.ts.map +1 -1
- package/dist/core/learning/observation-store.js +30 -15
- package/dist/core/learning/observation-store.js.map +1 -1
- package/dist/core/learning/session-learning-decision.d.ts +2 -4
- package/dist/core/learning/session-learning-decision.d.ts.map +1 -1
- package/dist/core/learning/session-learning-decision.js +9 -29
- package/dist/core/learning/session-learning-decision.js.map +1 -1
- package/dist/core/learning/skill-curator.d.ts +5 -1
- package/dist/core/learning/skill-curator.d.ts.map +1 -1
- package/dist/core/learning/skill-curator.js +21 -19
- package/dist/core/learning/skill-curator.js.map +1 -1
- package/dist/core/local-runtime-controller.d.ts +65 -3
- package/dist/core/local-runtime-controller.d.ts.map +1 -1
- package/dist/core/local-runtime-controller.js +186 -26
- package/dist/core/local-runtime-controller.js.map +1 -1
- package/dist/core/memory/providers/file-store.d.ts +1 -1
- package/dist/core/memory/providers/file-store.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.js +6 -6
- package/dist/core/memory/providers/file-store.js.map +1 -1
- package/dist/core/memory-controller.d.ts.map +1 -1
- package/dist/core/memory-controller.js +4 -4
- package/dist/core/memory-controller.js.map +1 -1
- package/dist/core/model-capability.d.ts +34 -0
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +43 -1
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +6 -9
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-router/intent-classifier.d.ts +1 -4
- package/dist/core/model-router/intent-classifier.d.ts.map +1 -1
- package/dist/core/model-router/intent-classifier.js +1 -156
- package/dist/core/model-router/intent-classifier.js.map +1 -1
- package/dist/core/model-router/tool-escalation.d.ts +15 -0
- package/dist/core/model-router/tool-escalation.d.ts.map +1 -1
- package/dist/core/model-router/tool-escalation.js +23 -1
- package/dist/core/model-router/tool-escalation.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +34 -7
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +95 -16
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/model-selection-controller.d.ts +4 -4
- package/dist/core/model-selection-controller.d.ts.map +1 -1
- package/dist/core/model-selection-controller.js.map +1 -1
- package/dist/core/model-tool-protocol.d.ts +23 -0
- package/dist/core/model-tool-protocol.d.ts.map +1 -0
- package/dist/core/model-tool-protocol.js +43 -0
- package/dist/core/model-tool-protocol.js.map +1 -0
- package/dist/core/models/adaptation-store.d.ts +10 -5
- package/dist/core/models/adaptation-store.d.ts.map +1 -1
- package/dist/core/models/adaptation-store.js +129 -81
- package/dist/core/models/adaptation-store.js.map +1 -1
- package/dist/core/models/default-model-suggestions.d.ts.map +1 -1
- package/dist/core/models/default-model-suggestions.js +17 -0
- package/dist/core/models/default-model-suggestions.js.map +1 -1
- package/dist/core/models/fitness-store.d.ts +4 -11
- package/dist/core/models/fitness-store.d.ts.map +1 -1
- package/dist/core/models/fitness-store.js +87 -51
- package/dist/core/models/fitness-store.js.map +1 -1
- package/dist/core/models/host-state-store.d.ts +34 -0
- package/dist/core/models/host-state-store.d.ts.map +1 -0
- package/dist/core/models/host-state-store.js +86 -0
- package/dist/core/models/host-state-store.js.map +1 -0
- package/dist/core/models/llamacpp-runtime.d.ts +180 -0
- package/dist/core/models/llamacpp-runtime.d.ts.map +1 -0
- package/dist/core/models/llamacpp-runtime.js +475 -0
- package/dist/core/models/llamacpp-runtime.js.map +1 -0
- package/dist/core/models/local-registration.d.ts +40 -0
- package/dist/core/models/local-registration.d.ts.map +1 -1
- package/dist/core/models/local-registration.js +94 -5
- package/dist/core/models/local-registration.js.map +1 -1
- package/dist/core/models/local-runtime.d.ts.map +1 -1
- package/dist/core/models/local-runtime.js +6 -5
- package/dist/core/models/local-runtime.js.map +1 -1
- package/dist/core/models/model-ref.d.ts +7 -0
- package/dist/core/models/model-ref.d.ts.map +1 -1
- package/dist/core/models/model-ref.js +26 -0
- package/dist/core/models/model-ref.js.map +1 -1
- package/dist/core/models/needle-runtime.d.ts +257 -0
- package/dist/core/models/needle-runtime.d.ts.map +1 -0
- package/dist/core/models/needle-runtime.js +519 -0
- package/dist/core/models/needle-runtime.js.map +1 -0
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts +89 -0
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts.map +1 -0
- package/dist/core/models/prism-llamacpp-lifecycle.js +121 -0
- package/dist/core/models/prism-llamacpp-lifecycle.js.map +1 -0
- package/dist/core/orchestration/agent-resume.d.ts +24 -0
- package/dist/core/orchestration/agent-resume.d.ts.map +1 -0
- package/dist/core/orchestration/agent-resume.js +90 -0
- package/dist/core/orchestration/agent-resume.js.map +1 -0
- package/dist/core/orchestration/capability-gateway.d.ts +61 -0
- package/dist/core/orchestration/capability-gateway.d.ts.map +1 -0
- package/dist/core/orchestration/capability-gateway.js +152 -0
- package/dist/core/orchestration/capability-gateway.js.map +1 -0
- package/dist/core/orchestration/contracts.d.ts +343 -0
- package/dist/core/orchestration/contracts.d.ts.map +1 -0
- package/dist/core/orchestration/contracts.js +135 -0
- package/dist/core/orchestration/contracts.js.map +1 -0
- package/dist/core/orchestration/delegation-ledger.d.ts +56 -0
- package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -0
- package/dist/core/orchestration/delegation-ledger.js +197 -0
- package/dist/core/orchestration/delegation-ledger.js.map +1 -0
- package/dist/core/orchestration/event-store.d.ts +83 -0
- package/dist/core/orchestration/event-store.d.ts.map +1 -0
- package/dist/core/orchestration/event-store.js +560 -0
- package/dist/core/orchestration/event-store.js.map +1 -0
- package/dist/core/orchestration/lane-tool-manifests.d.ts +9 -0
- package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -0
- package/dist/core/orchestration/lane-tool-manifests.js +37 -0
- package/dist/core/orchestration/lane-tool-manifests.js.map +1 -0
- package/dist/core/orchestration/model-binding.d.ts +15 -0
- package/dist/core/orchestration/model-binding.d.ts.map +1 -0
- package/dist/core/orchestration/model-binding.js +29 -0
- package/dist/core/orchestration/model-binding.js.map +1 -0
- package/dist/core/orchestration/policy-compiler.d.ts +49 -0
- package/dist/core/orchestration/policy-compiler.d.ts.map +1 -0
- package/dist/core/orchestration/policy-compiler.js +191 -0
- package/dist/core/orchestration/policy-compiler.js.map +1 -0
- package/dist/core/orchestration/policy-gate.d.ts +18 -0
- package/dist/core/orchestration/policy-gate.d.ts.map +1 -0
- package/dist/core/orchestration/policy-gate.js +24 -0
- package/dist/core/orchestration/policy-gate.js.map +1 -0
- package/dist/core/orchestration/profile-registry.d.ts +51 -0
- package/dist/core/orchestration/profile-registry.d.ts.map +1 -0
- package/dist/core/orchestration/profile-registry.js +393 -0
- package/dist/core/orchestration/profile-registry.js.map +1 -0
- package/dist/core/orchestration/profile-store.d.ts +31 -0
- package/dist/core/orchestration/profile-store.d.ts.map +1 -0
- package/dist/core/orchestration/profile-store.js +136 -0
- package/dist/core/orchestration/profile-store.js.map +1 -0
- package/dist/core/orchestration/risk-budget.d.ts +9 -0
- package/dist/core/orchestration/risk-budget.d.ts.map +1 -0
- package/dist/core/orchestration/risk-budget.js +48 -0
- package/dist/core/orchestration/risk-budget.js.map +1 -0
- package/dist/core/orchestration/task-runtime.d.ts +168 -0
- package/dist/core/orchestration/task-runtime.d.ts.map +1 -0
- package/dist/core/orchestration/task-runtime.js +1600 -0
- package/dist/core/orchestration/task-runtime.js.map +1 -0
- package/dist/core/orchestration/work-state-projection.d.ts +32 -0
- package/dist/core/orchestration/work-state-projection.d.ts.map +1 -0
- package/dist/core/orchestration/work-state-projection.js +116 -0
- package/dist/core/orchestration/work-state-projection.js.map +1 -0
- package/dist/core/orchestration/worker-execution-contract.d.ts +21 -0
- package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -0
- package/dist/core/orchestration/worker-execution-contract.js +179 -0
- package/dist/core/orchestration/worker-execution-contract.js.map +1 -0
- package/dist/core/orchestration/worker-result-adapter.d.ts +21 -0
- package/dist/core/orchestration/worker-result-adapter.d.ts.map +1 -0
- package/dist/core/orchestration/worker-result-adapter.js +109 -0
- package/dist/core/orchestration/worker-result-adapter.js.map +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +11 -10
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/process-identity.d.ts +11 -0
- package/dist/core/process-identity.d.ts.map +1 -0
- package/dist/core/process-identity.js +26 -0
- package/dist/core/process-identity.js.map +1 -0
- package/dist/core/process-matrix/codes.d.ts +83 -0
- package/dist/core/process-matrix/codes.d.ts.map +1 -0
- package/dist/core/process-matrix/codes.js +15 -0
- package/dist/core/process-matrix/codes.js.map +1 -0
- package/dist/core/process-matrix/resume-launcher.d.ts +26 -0
- package/dist/core/process-matrix/resume-launcher.d.ts.map +1 -0
- package/dist/core/process-matrix/resume-launcher.js +62 -0
- package/dist/core/process-matrix/resume-launcher.js.map +1 -0
- package/dist/core/process-matrix/runtime.d.ts +78 -0
- package/dist/core/process-matrix/runtime.d.ts.map +1 -0
- package/dist/core/process-matrix/runtime.js +633 -0
- package/dist/core/process-matrix/runtime.js.map +1 -0
- package/dist/core/process-matrix/store.d.ts +25 -0
- package/dist/core/process-matrix/store.d.ts.map +1 -0
- package/dist/core/process-matrix/store.js +189 -0
- package/dist/core/process-matrix/store.js.map +1 -0
- package/dist/core/process-matrix/supervisor.d.ts +75 -0
- package/dist/core/process-matrix/supervisor.d.ts.map +1 -0
- package/dist/core/process-matrix/supervisor.js +161 -0
- package/dist/core/process-matrix/supervisor.js.map +1 -0
- package/dist/core/profile-registry.d.ts +7 -0
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +25 -7
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/python-runtime.d.ts.map +1 -1
- package/dist/core/python-runtime.js +3 -3
- package/dist/core/python-runtime.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +33 -9
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +217 -127
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/reload-blockers.d.ts +36 -0
- package/dist/core/reload-blockers.d.ts.map +1 -1
- package/dist/core/reload-blockers.js +50 -8
- package/dist/core/reload-blockers.js.map +1 -1
- package/dist/core/research/evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/evidence-bundle.js +1 -6
- package/dist/core/research/evidence-bundle.js.map +1 -1
- package/dist/core/research/lane-model-resolver.d.ts +33 -0
- package/dist/core/research/lane-model-resolver.d.ts.map +1 -0
- package/dist/core/research/lane-model-resolver.js +65 -0
- package/dist/core/research/lane-model-resolver.js.map +1 -0
- package/dist/core/research/model-fitness-controller.d.ts +38 -0
- package/dist/core/research/model-fitness-controller.d.ts.map +1 -0
- package/dist/core/research/model-fitness-controller.js +106 -0
- package/dist/core/research/model-fitness-controller.js.map +1 -0
- package/dist/core/research/model-fitness.d.ts +1 -1
- package/dist/core/research/model-fitness.d.ts.map +1 -1
- package/dist/core/research/model-fitness.js +4 -4
- 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 +7 -7
- package/dist/core/research/research-gate.js.map +1 -1
- package/dist/core/research/research-lane-controller.d.ts +62 -0
- package/dist/core/research/research-lane-controller.d.ts.map +1 -0
- package/dist/core/research/research-lane-controller.js +292 -0
- package/dist/core/research/research-lane-controller.js.map +1 -0
- package/dist/core/research/session-evidence-bundle.d.ts +2 -4
- package/dist/core/research/session-evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/session-evidence-bundle.js +10 -46
- package/dist/core/research/session-evidence-bundle.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +15 -9
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/risk-classifier.d.ts +6 -0
- package/dist/core/risk-classifier.d.ts.map +1 -0
- package/dist/core/risk-classifier.js +225 -0
- package/dist/core/risk-classifier.js.map +1 -0
- package/dist/core/runtime-builder.d.ts +76 -17
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +367 -124
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/scout-controller.d.ts +6 -0
- package/dist/core/scout-controller.d.ts.map +1 -1
- package/dist/core/scout-controller.js +66 -52
- package/dist/core/scout-controller.js.map +1 -1
- package/dist/core/sdk.d.ts +6 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +64 -27
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-analytics.d.ts.map +1 -1
- package/dist/core/session-analytics.js +28 -1
- package/dist/core/session-analytics.js.map +1 -1
- package/dist/core/session-image-store.d.ts +33 -0
- package/dist/core/session-image-store.d.ts.map +1 -0
- package/dist/core/session-image-store.js +283 -0
- package/dist/core/session-image-store.js.map +1 -0
- package/dist/core/session-role.d.ts +33 -0
- package/dist/core/session-role.d.ts.map +1 -0
- package/dist/core/session-role.js +58 -0
- package/dist/core/session-role.js.map +1 -0
- package/dist/core/session-snapshot.d.ts +34 -0
- package/dist/core/session-snapshot.d.ts.map +1 -0
- package/dist/core/session-snapshot.js +68 -0
- package/dist/core/session-snapshot.js.map +1 -0
- package/dist/core/session-supervision-runtime.d.ts +31 -0
- package/dist/core/session-supervision-runtime.d.ts.map +1 -0
- package/dist/core/session-supervision-runtime.js +97 -0
- package/dist/core/session-supervision-runtime.js.map +1 -0
- package/dist/core/settings-manager.d.ts +51 -7
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +168 -82
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +12 -0
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.js +6 -0
- package/dist/core/system-prompt-builder.js.map +1 -1
- package/dist/core/system-prompt.d.ts +14 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +20 -3
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/session-task-state.d.ts +13 -6
- package/dist/core/tasks/session-task-state.d.ts.map +1 -1
- package/dist/core/tasks/session-task-state.js +20 -22
- package/dist/core/tasks/session-task-state.js.map +1 -1
- package/dist/core/tasks/task-contract-monitor.d.ts +45 -0
- package/dist/core/tasks/task-contract-monitor.d.ts.map +1 -0
- package/dist/core/tasks/task-contract-monitor.js +56 -0
- package/dist/core/tasks/task-contract-monitor.js.map +1 -0
- package/dist/core/tasks/task-projection.d.ts +20 -0
- package/dist/core/tasks/task-projection.d.ts.map +1 -0
- package/dist/core/tasks/task-projection.js +47 -0
- package/dist/core/tasks/task-projection.js.map +1 -0
- package/dist/core/tasks/task-state.d.ts +12 -0
- package/dist/core/tasks/task-state.d.ts.map +1 -1
- package/dist/core/tasks/task-state.js +56 -12
- package/dist/core/tasks/task-state.js.map +1 -1
- package/dist/core/tool-capability-policy.d.ts +13 -0
- package/dist/core/tool-capability-policy.d.ts.map +1 -0
- package/dist/core/tool-capability-policy.js +85 -0
- package/dist/core/tool-capability-policy.js.map +1 -0
- package/dist/core/tool-gate-controller.d.ts.map +1 -1
- package/dist/core/tool-gate-controller.js +5 -0
- package/dist/core/tool-gate-controller.js.map +1 -1
- package/dist/core/tool-protocol-controller.d.ts +91 -0
- package/dist/core/tool-protocol-controller.d.ts.map +1 -0
- package/dist/core/tool-protocol-controller.js +512 -0
- package/dist/core/tool-protocol-controller.js.map +1 -0
- package/dist/core/tool-recovery-log-records.d.ts +6 -0
- package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
- package/dist/core/tool-recovery-log-records.js +13 -31
- package/dist/core/tool-recovery-log-records.js.map +1 -1
- package/dist/core/tool-selection/promotion.d.ts +54 -0
- package/dist/core/tool-selection/promotion.d.ts.map +1 -0
- package/dist/core/tool-selection/promotion.js +81 -0
- package/dist/core/tool-selection/promotion.js.map +1 -0
- package/dist/core/tool-selection/tool-performance-store.d.ts +39 -6
- package/dist/core/tool-selection/tool-performance-store.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.js +153 -110
- package/dist/core/tool-selection/tool-performance-store.js.map +1 -1
- package/dist/core/tool-selection/tool-selection-controller.d.ts +45 -0
- package/dist/core/tool-selection/tool-selection-controller.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-selection-controller.js +96 -0
- package/dist/core/tool-selection/tool-selection-controller.js.map +1 -1
- package/dist/core/tools/ask-question.d.ts +124 -0
- package/dist/core/tools/ask-question.d.ts.map +1 -0
- package/dist/core/tools/ask-question.js +693 -0
- package/dist/core/tools/ask-question.js.map +1 -0
- package/dist/core/tools/bash.d.ts +18 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +95 -16
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/delegate-status.d.ts +44 -2
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +214 -19
- package/dist/core/tools/delegate-status.js.map +1 -1
- package/dist/core/tools/delegate.d.ts +15 -13
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +124 -22
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/extensionify.d.ts.map +1 -1
- package/dist/core/tools/extensionify.js +1 -0
- package/dist/core/tools/extensionify.js.map +1 -1
- package/dist/core/tools/goal.d.ts +94 -3
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +165 -15
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/model-fitness.d.ts +7 -0
- package/dist/core/tools/model-fitness.d.ts.map +1 -1
- package/dist/core/tools/model-fitness.js +4 -4
- package/dist/core/tools/model-fitness.js.map +1 -1
- package/dist/core/tools/orchestration-panel.d.ts +43 -0
- package/dist/core/tools/orchestration-panel.d.ts.map +1 -0
- package/dist/core/tools/orchestration-panel.js +168 -0
- package/dist/core/tools/orchestration-panel.js.map +1 -0
- package/dist/core/tools/run-process.d.ts +26 -0
- package/dist/core/tools/run-process.d.ts.map +1 -0
- package/dist/core/tools/run-process.js +138 -0
- package/dist/core/tools/run-process.js.map +1 -0
- package/dist/core/tools/shell-contract-router.d.ts +6 -1
- package/dist/core/tools/shell-contract-router.d.ts.map +1 -1
- package/dist/core/tools/shell-contract-router.js +23 -2
- package/dist/core/tools/shell-contract-router.js.map +1 -1
- package/dist/core/tools/shell-session.d.ts +89 -0
- package/dist/core/tools/shell-session.d.ts.map +1 -0
- package/dist/core/tools/shell-session.js +432 -0
- package/dist/core/tools/shell-session.js.map +1 -0
- package/dist/core/tools/task-steps.d.ts +6 -0
- package/dist/core/tools/task-steps.d.ts.map +1 -1
- package/dist/core/tools/task-steps.js +165 -8
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/tmux-dispatch.d.ts +84 -0
- package/dist/core/tools/tmux-dispatch.d.ts.map +1 -0
- package/dist/core/tools/tmux-dispatch.js +91 -0
- package/dist/core/tools/tmux-dispatch.js.map +1 -0
- package/dist/core/tools/windows-shell-engine.d.ts +42 -0
- package/dist/core/tools/windows-shell-engine.d.ts.map +1 -0
- package/dist/core/tools/windows-shell-engine.js +151 -0
- package/dist/core/tools/windows-shell-engine.js.map +1 -0
- package/dist/core/tools/windows-shell-state.d.ts +40 -0
- package/dist/core/tools/windows-shell-state.d.ts.map +1 -0
- package/dist/core/tools/windows-shell-state.js +59 -0
- package/dist/core/tools/windows-shell-state.js.map +1 -0
- package/dist/core/tools/worktree-sync.d.ts +24 -0
- package/dist/core/tools/worktree-sync.d.ts.map +1 -0
- package/dist/core/tools/worktree-sync.js +338 -0
- package/dist/core/tools/worktree-sync.js.map +1 -0
- package/dist/core/trust-manager.d.ts +4 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +20 -2
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/util/atomic-file.d.ts +55 -0
- package/dist/core/util/atomic-file.d.ts.map +1 -0
- package/dist/core/util/atomic-file.js +255 -0
- package/dist/core/util/atomic-file.js.map +1 -0
- package/dist/core/util/bounded-jsonl.d.ts +10 -0
- package/dist/core/util/bounded-jsonl.d.ts.map +1 -0
- package/dist/core/util/bounded-jsonl.js +75 -0
- package/dist/core/util/bounded-jsonl.js.map +1 -0
- package/dist/core/util/minimatch-cache.d.ts +33 -0
- package/dist/core/util/minimatch-cache.d.ts.map +1 -0
- package/dist/core/util/minimatch-cache.js +0 -0
- package/dist/core/util/minimatch-cache.js.map +1 -0
- package/dist/core/util/value-guards.d.ts +5 -0
- package/dist/core/util/value-guards.d.ts.map +1 -0
- package/dist/core/util/value-guards.js +12 -0
- package/dist/core/util/value-guards.js.map +1 -0
- package/dist/core/worktree-sync/codes.d.ts +227 -0
- package/dist/core/worktree-sync/codes.d.ts.map +1 -0
- package/dist/core/worktree-sync/codes.js +14 -0
- package/dist/core/worktree-sync/codes.js.map +1 -0
- package/dist/core/worktree-sync/git-engine.d.ts +156 -0
- package/dist/core/worktree-sync/git-engine.d.ts.map +1 -0
- package/dist/core/worktree-sync/git-engine.js +1191 -0
- package/dist/core/worktree-sync/git-engine.js.map +1 -0
- package/dist/core/worktree-sync/lane-gate.d.ts +75 -0
- package/dist/core/worktree-sync/lane-gate.d.ts.map +1 -0
- package/dist/core/worktree-sync/lane-gate.js +360 -0
- package/dist/core/worktree-sync/lane-gate.js.map +1 -0
- package/dist/core/worktree-sync/runtime.d.ts +47 -0
- package/dist/core/worktree-sync/runtime.d.ts.map +1 -0
- package/dist/core/worktree-sync/runtime.js +96 -0
- package/dist/core/worktree-sync/runtime.js.map +1 -0
- package/dist/core/worktree-sync/store.d.ts +69 -0
- package/dist/core/worktree-sync/store.d.ts.map +1 -0
- package/dist/core/worktree-sync/store.js +252 -0
- package/dist/core/worktree-sync/store.js.map +1 -0
- package/dist/core/worktree-sync/watcher.d.ts +29 -0
- package/dist/core/worktree-sync/watcher.d.ts.map +1 -0
- package/dist/core/worktree-sync/watcher.js +93 -0
- package/dist/core/worktree-sync/watcher.js.map +1 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +179 -1
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +7 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +197 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.d.ts +16 -1
- package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.js +50 -8
- package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
- package/dist/modes/interactive/clipboard-input.d.ts +7 -1
- package/dist/modes/interactive/clipboard-input.d.ts.map +1 -1
- package/dist/modes/interactive/clipboard-input.js +44 -6
- package/dist/modes/interactive/clipboard-input.js.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.js +23 -1
- package/dist/modes/interactive/components/profile-resource-editor.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +2 -2
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/config-backup.d.ts.map +1 -1
- package/dist/modes/interactive/config-backup.js +5 -4
- package/dist/modes/interactive/config-backup.js.map +1 -1
- package/dist/modes/interactive/extension-ui-host.d.ts +14 -0
- package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -1
- package/dist/modes/interactive/extension-ui-host.js +76 -15
- package/dist/modes/interactive/extension-ui-host.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +67 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/key-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/key-handlers.js +1 -1
- package/dist/modes/interactive/key-handlers.js.map +1 -1
- package/dist/modes/interactive/local-model-commands.d.ts +43 -0
- package/dist/modes/interactive/local-model-commands.d.ts.map +1 -1
- package/dist/modes/interactive/local-model-commands.js +290 -3
- package/dist/modes/interactive/local-model-commands.js.map +1 -1
- package/dist/modes/interactive/profile-menu-controller.d.ts.map +1 -1
- package/dist/modes/interactive/profile-menu-controller.js +7 -7
- package/dist/modes/interactive/profile-menu-controller.js.map +1 -1
- package/dist/modes/interactive/report-commands.d.ts.map +1 -1
- package/dist/modes/interactive/report-commands.js +21 -0
- package/dist/modes/interactive/report-commands.js.map +1 -1
- package/dist/modes/interactive/session-flow-commands.d.ts +17 -2
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-flow-commands.js +74 -21
- 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 +16 -6
- package/dist/modes/interactive/session-io-commands.js.map +1 -1
- package/dist/modes/interactive/session-replacement-errors.d.ts +7 -0
- package/dist/modes/interactive/session-replacement-errors.d.ts.map +1 -0
- package/dist/modes/interactive/session-replacement-errors.js +15 -0
- package/dist/modes/interactive/session-replacement-errors.js.map +1 -0
- package/dist/modes/interactive/startup-checks.d.ts.map +1 -1
- package/dist/modes/interactive/startup-checks.js +1 -1
- package/dist/modes/interactive/startup-checks.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +82 -23
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +15 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +138 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -13
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts +1 -0
- 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 +1 -0
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +52 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/fs-watch.d.ts +11 -0
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js +20 -2
- package/dist/utils/fs-watch.js.map +1 -1
- package/dist/utils/highlight-js-languages.d.ts +4 -0
- package/dist/utils/highlight-js-languages.d.ts.map +1 -0
- package/dist/utils/highlight-js-languages.js +573 -0
- package/dist/utils/highlight-js-languages.js.map +1 -0
- package/dist/utils/platform.d.ts +3 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +8 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/shell.d.ts +7 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +21 -6
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +53 -5
- 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 +112 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/work-directory.d.ts +11 -0
- package/dist/utils/work-directory.d.ts.map +1 -1
- package/dist/utils/work-directory.js +30 -9
- package/dist/utils/work-directory.js.map +1 -1
- package/docs/UI_POLISH_ORCHESTRATION.md +44 -0
- package/docs/UI_QUALITY_ORCHESTRATION.md +30 -0
- package/docs/docs.json +4 -0
- package/docs/extensions.md +62 -2
- package/docs/harness-architecture.md +156 -0
- package/docs/keybindings.md +11 -1
- package/docs/process-matrix.md +153 -0
- package/docs/rpc.md +45 -2
- package/docs/sessions.md +15 -0
- package/docs/settings.md +128 -11
- package/docs/task-steps.md +8 -0
- package/docs/telemetry.md +19 -0
- package/docs/tmux-agent-manager.md +92 -2
- package/docs/ui-reference/README.md +9 -0
- package/docs/ui-reference/orchestration-after.txt +7 -0
- package/docs/ui-reference/orchestration-before.txt +7 -0
- package/docs/ui-reference/orchestration-reference.txt +6 -0
- package/docs/usage.md +14 -2
- package/docs/windows.md +52 -3
- package/docs/work-directory.md +42 -2
- package/docs/worktree-sync.md +250 -0
- 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/question.ts +34 -245
- package/examples/extensions/questionnaire.ts +41 -407
- 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 +12 -12
- package/package.json +10 -4
- package/dist/core/delegation/session-worker-result.d.ts +0 -16
- package/dist/core/delegation/session-worker-result.d.ts.map +0 -1
- package/dist/core/delegation/session-worker-result.js +0 -53
- package/dist/core/delegation/session-worker-result.js.map +0 -1
- package/dist/core/delegation/worker-result.d.ts +0 -15
- package/dist/core/delegation/worker-result.d.ts.map +0 -1
- package/dist/core/delegation/worker-result.js +0 -161
- package/dist/core/delegation/worker-result.js.map +0 -1
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js.map +0 -1
- package/docs/integration-sweep-builder-blueprint-2026-07-09.md +0 -365
- package/docs/integration-sweep-resume-2026-07-09.md +0 -407
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"risk-classifier.d.ts","sourceRoot":"","sources":["../../src/core/risk-classifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEjH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAiFtD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAyFtE;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAE3E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,CAuE9E","sourcesContent":["import type { OperationRisk, RiskAssessment, RiskAssessmentInput, RouteDecision } from \"./autonomy/contracts.ts\";\n\nexport type ModelRouterIntent = \"research\" | \"modify\";\n\nconst EXPLICIT_MODIFY_REQUEST_RE =\n\t/^(?:can you|could you|please|pls|go ahead and|let'?s|i need you to|we need to|you should)\\s+.*\\b(add|apply|build|change|commit|create|delete|edit|fix|generate|implement|install|modify|patch|remove|rename|replace|run|test|update|write|publish|release|push|deploy|tag|reset|clean|rewrite)\\b/i;\nconst READ_ONLY_QUESTION_RE =\n\t/^(?:(?:can you|could you|please|pls|go ahead and|let'?s|i need you to|we need to|you should)\\s+)?(?:how|what|why|when|where|which|who|explain|summarize|compare|describe|list|show|search|find|view|read|locate)\\b/i;\nconst RELEASE_PUBLISH_RE = /\\b(publish|release|push|deploy|tag)\\b/i;\nconst SECURITY_AUTH_RE = /\\b(auth|token|credential|credentials|secret|api[-_]key)\\b/i;\nconst DESTRUCTIVE_RE = /\\b(delete|reset|rm\\s+-rf|clean)\\b/i;\nconst SELF_MOD_MUTATE_RE =\n\t/\\b(modify|change|write|update|edit|delete|add|remove|set)\\s+.*\\b(skills|prompts|settings|tools|behavior)\\b|self[-_]modification/i;\nconst ARCHITECTURE_MUTATE_RE = /\\b(rewrite|redesign|change|modify|rearchitect)\\s+.*\\b(architecture|architect)\\b/i;\nconst PLANNING_CORE_RE = /\\b(plan|planning|roadmap|strategy)\\b/i;\nconst PLANNING_DESIGN_WORD_RE = /\\b(design|architect\\w*|structure|approach)\\b/i;\nconst PLANNING_PROSPECTIVE_RE =\n\t/\\b(how (?:should|would|do we|can we)|what(?:'s| is) the (?:best|cleanest|right)|propose|draft|come up with|figure out|decide (?:on|how))\\b/i;\nconst REFACTOR_RE = /\\b(refactor|refactoring)\\b/i;\nconst TEST_VALIDATION_RE = /\\b(test|testing|validation|lint|vitest|jest|run)\\b/i;\nconst IMPLEMENT_RE = /\\b(implement|fix|apply|change|update|create|write|generate|modify|edit|patch|add)\\b/i;\nconst DESTRUCTIVE_CMD_RE =\n\t/\\b(rm(\\s+-r|\\s+-f|\\s+-rf|\\s+-fr)?|mv|cp|chmod|chown|install)\\b|>\\s*\\/dev\\/(sda|hda|vda)|\\b(dd\\s+if=)/i;\nconst GIT_MUTATE_CMD_RE = /\\bgit\\s+(commit|push|reset|clean|stash|rebase)\\b/i;\nconst PKG_MUTATE_CMD_RE = /\\b(npm|pnpm|yarn|bun)\\s+(install|i|update|up|publish|run|remove|rm|uninstall)\\b/i;\nconst RELEASE_DEPLOY_CMD_RE = /\\b(release|deploy)\\b/i;\nconst PYTHON_HIGH_IMPACT_RE =\n\t/\\b(?:shutil\\.(?:rmtree|move|copy|copy2|copytree)|os\\.(?:remove|unlink|rmdir|removedirs|system)|subprocess\\.(?:run|call|check_call|check_output|Popen)|Path\\([^)]*\\)\\.(?:unlink|rmdir))\\b/i;\nconst REDIRECTION_RE = /[<>]/;\n\ninterface RiskSignal {\n\trisk: OperationRisk;\n\tkind: \"release\" | \"security\" | \"destructive\" | \"self-modification\" | \"architecture\";\n\treason: string;\n}\n\nfunction isPlanningPrompt(text: string): boolean {\n\treturn PLANNING_CORE_RE.test(text) || (PLANNING_DESIGN_WORD_RE.test(text) && PLANNING_PROSPECTIVE_RE.test(text));\n}\n\nfunction highRiskSignal(text: string): RiskSignal | undefined {\n\tif (RELEASE_PUBLISH_RE.test(text)) {\n\t\treturn {\n\t\t\trisk: \"approval-required\",\n\t\t\tkind: \"release\",\n\t\t\treason: \"Operation mentions releasing, publishing, or deploying\",\n\t\t};\n\t}\n\tif (SECURITY_AUTH_RE.test(text)) {\n\t\treturn {\n\t\t\trisk: \"approval-required\",\n\t\t\tkind: \"security\",\n\t\t\treason: \"Operation mentions authentication or credentials\",\n\t\t};\n\t}\n\tif (DESTRUCTIVE_RE.test(text)) {\n\t\treturn {\n\t\t\trisk: \"approval-required\",\n\t\t\tkind: \"destructive\",\n\t\t\treason: \"Operation involves deleting, resetting, or cleaning\",\n\t\t};\n\t}\n\tif (SELF_MOD_MUTATE_RE.test(text)) {\n\t\treturn {\n\t\t\trisk: \"approval-required\",\n\t\t\tkind: \"self-modification\",\n\t\t\treason: \"Operation modifies settings, tools, skills, or prompts\",\n\t\t};\n\t}\n\tif (ARCHITECTURE_MUTATE_RE.test(text)) {\n\t\treturn {\n\t\t\trisk: \"high-impact\",\n\t\t\tkind: \"architecture\",\n\t\t\treason: \"Operation mentions rewriting or rearchitecting core parts\",\n\t\t};\n\t}\n\treturn undefined;\n}\n\nfunction stripSingleQuotes(command: string): string {\n\treturn command.replace(/'[^']*'/g, \"''\");\n}\n\nexport function classifyModelRouterRoute(prompt: string): RouteDecision {\n\tconst text = prompt.trim();\n\tif (!text) {\n\t\treturn {\n\t\t\ttier: \"cheap\",\n\t\t\trisk: \"read-only\",\n\t\t\tconfidence: 0.1,\n\t\t\treasonCode: \"empty_prompt\",\n\t\t\treasons: [\"Empty or whitespace prompt\"],\n\t\t};\n\t}\n\tif (READ_ONLY_QUESTION_RE.test(text) && !EXPLICIT_MODIFY_REQUEST_RE.test(text)) {\n\t\tif (isPlanningPrompt(text)) {\n\t\t\treturn {\n\t\t\t\ttier: \"medium\",\n\t\t\t\trisk: \"read-only\",\n\t\t\t\tconfidence: 0.75,\n\t\t\t\treasonCode: \"planning_min_medium\",\n\t\t\t\treasons: [\"Planning/design prompts never route cheap by default; a judge may deem them trivial\"],\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\ttier: \"cheap\",\n\t\t\trisk: \"read-only\",\n\t\t\tconfidence: 0.9,\n\t\t\treasonCode: \"read_only_question\",\n\t\t\treasons: [\"Prompt asks a question or requests an explanation, search, or lookup\"],\n\t\t};\n\t}\n\tconst highRisk = highRiskSignal(text);\n\tif (highRisk) {\n\t\tconst reasonCode: Record<RiskSignal[\"kind\"], string> = {\n\t\t\trelease: \"release_or_publish\",\n\t\t\tsecurity: \"security_or_auth\",\n\t\t\tdestructive: \"destructive_or_git_history\",\n\t\t\t\"self-modification\": \"settings_or_self_modification\",\n\t\t\tarchitecture: \"architecture_or_ambiguous\",\n\t\t};\n\t\treturn {\n\t\t\ttier: \"expensive\",\n\t\t\trisk: highRisk.kind === \"security\" ? \"high-impact\" : highRisk.risk,\n\t\t\tconfidence: highRisk.kind === \"security\" ? 0.95 : highRisk.kind === \"destructive\" ? 0.85 : 0.9,\n\t\t\treasonCode: reasonCode[highRisk.kind],\n\t\t\treasons: [highRisk.reason],\n\t\t};\n\t}\n\tif (isPlanningPrompt(text)) {\n\t\treturn {\n\t\t\ttier: \"medium\",\n\t\t\trisk: \"read-only\",\n\t\t\tconfidence: 0.75,\n\t\t\treasonCode: \"planning_min_medium\",\n\t\t\treasons: [\"Planning/design prompts never route cheap by default; a judge may deem them trivial\"],\n\t\t};\n\t}\n\tif (REFACTOR_RE.test(text)) {\n\t\treturn {\n\t\t\ttier: \"medium\",\n\t\t\trisk: \"scoped-write\",\n\t\t\tconfidence: 0.8,\n\t\t\treasonCode: \"mechanical_refactor\",\n\t\t\treasons: [\"Prompt mentions refactoring code structure\"],\n\t\t};\n\t}\n\tif (TEST_VALIDATION_RE.test(text)) {\n\t\treturn {\n\t\t\ttier: \"medium\",\n\t\t\trisk: \"scoped-write\",\n\t\t\tconfidence: 0.8,\n\t\t\treasonCode: \"test_or_validation\",\n\t\t\treasons: [\"Prompt mentions testing, validation, or linting\"],\n\t\t};\n\t}\n\tif (IMPLEMENT_RE.test(text)) {\n\t\treturn {\n\t\t\ttier: \"medium\",\n\t\t\trisk: \"scoped-write\",\n\t\t\tconfidence: 0.85,\n\t\t\treasonCode: \"normal_implementation\",\n\t\t\treasons: [\"Prompt mentions implementing, updating, creating, or modifying code\"],\n\t\t};\n\t}\n\treturn {\n\t\ttier: \"cheap\",\n\t\trisk: \"read-only\",\n\t\tconfidence: 0.5,\n\t\treasonCode: \"default_read_only\",\n\t\treasons: [\"No explicit implementation, destructive, or release patterns detected\"],\n\t};\n}\n\nexport function classifyModelRouterIntent(prompt: string): ModelRouterIntent {\n\treturn classifyModelRouterRoute(prompt).tier === \"cheap\" ? \"research\" : \"modify\";\n}\n\nexport function assessOperationRisk(input: RiskAssessmentInput): RiskAssessment {\n\tconst operation = input.operation.trim();\n\tconst command = input.command?.trim() ?? \"\";\n\tconst cleanCommand = stripSingleQuotes(command);\n\tconst fullText = `${operation} ${command}`.trim();\n\tconst cleanFullText = `${operation} ${cleanCommand}`.trim();\n\tif (!fullText) {\n\t\treturn {\n\t\t\trisk: \"read-only\",\n\t\t\treasonCode: \"empty_operation\",\n\t\t\treasons: [\"Empty operation\"],\n\t\t\trequiresApproval: false,\n\t\t};\n\t}\n\tif (READ_ONLY_QUESTION_RE.test(operation) && !EXPLICIT_MODIFY_REQUEST_RE.test(operation)) {\n\t\treturn {\n\t\t\trisk: \"read-only\",\n\t\t\treasonCode: \"read_only_operation\",\n\t\t\treasons: [\"Operation is explicitly read-only (list/show/read/search)\"],\n\t\t\trequiresApproval: false,\n\t\t};\n\t}\n\tconst highRisk = highRiskSignal(cleanFullText);\n\tif (highRisk) {\n\t\tconst reasonCode: Record<RiskSignal[\"kind\"], string> = {\n\t\t\trelease: \"release_publish_operation\",\n\t\t\tsecurity: \"security_auth_operation\",\n\t\t\tdestructive: \"destructive_operation\",\n\t\t\t\"self-modification\": \"self_modification_operation\",\n\t\t\tarchitecture: \"architecture_mutation_operation\",\n\t\t};\n\t\treturn {\n\t\t\trisk: highRisk.risk,\n\t\t\treasonCode: reasonCode[highRisk.kind],\n\t\t\treasons: [highRisk.reason],\n\t\t\trequiresApproval: highRisk.risk === \"approval-required\",\n\t\t};\n\t}\n\tif (\n\t\tcommand &&\n\t\t(DESTRUCTIVE_CMD_RE.test(cleanCommand) ||\n\t\t\tGIT_MUTATE_CMD_RE.test(cleanCommand) ||\n\t\t\tPKG_MUTATE_CMD_RE.test(cleanCommand) ||\n\t\t\tRELEASE_DEPLOY_CMD_RE.test(cleanCommand) ||\n\t\t\tPYTHON_HIGH_IMPACT_RE.test(cleanCommand) ||\n\t\t\tREDIRECTION_RE.test(cleanCommand))\n\t) {\n\t\treturn {\n\t\t\trisk: \"approval-required\",\n\t\t\treasonCode: \"mutating_command\",\n\t\t\treasons: [\"Command executes a destructive, mutating, or publish operation\"],\n\t\t\trequiresApproval: true,\n\t\t};\n\t}\n\tif (\n\t\tinput.toolName &&\n\t\t![\"read_file\", \"search_web\", \"list_dir\", \"grep_search\", \"view_file\", \"memory\"].includes(input.toolName)\n\t) {\n\t\treturn {\n\t\t\trisk: \"scoped-write\",\n\t\t\treasonCode: \"generic_mutation\",\n\t\t\treasons: [\"Generic mutating operation or command\"],\n\t\t\trequiresApproval: false,\n\t\t};\n\t}\n\treturn {\n\t\trisk: \"read-only\",\n\t\treasonCode: \"default_read_only\",\n\t\treasons: [\"No mutating or high-risk patterns detected\"],\n\t\trequiresApproval: false,\n\t};\n}\n"]}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
const EXPLICIT_MODIFY_REQUEST_RE = /^(?:can you|could you|please|pls|go ahead and|let'?s|i need you to|we need to|you should)\s+.*\b(add|apply|build|change|commit|create|delete|edit|fix|generate|implement|install|modify|patch|remove|rename|replace|run|test|update|write|publish|release|push|deploy|tag|reset|clean|rewrite)\b/i;
|
|
2
|
+
const READ_ONLY_QUESTION_RE = /^(?:(?:can you|could you|please|pls|go ahead and|let'?s|i need you to|we need to|you should)\s+)?(?:how|what|why|when|where|which|who|explain|summarize|compare|describe|list|show|search|find|view|read|locate)\b/i;
|
|
3
|
+
const RELEASE_PUBLISH_RE = /\b(publish|release|push|deploy|tag)\b/i;
|
|
4
|
+
const SECURITY_AUTH_RE = /\b(auth|token|credential|credentials|secret|api[-_]key)\b/i;
|
|
5
|
+
const DESTRUCTIVE_RE = /\b(delete|reset|rm\s+-rf|clean)\b/i;
|
|
6
|
+
const SELF_MOD_MUTATE_RE = /\b(modify|change|write|update|edit|delete|add|remove|set)\s+.*\b(skills|prompts|settings|tools|behavior)\b|self[-_]modification/i;
|
|
7
|
+
const ARCHITECTURE_MUTATE_RE = /\b(rewrite|redesign|change|modify|rearchitect)\s+.*\b(architecture|architect)\b/i;
|
|
8
|
+
const PLANNING_CORE_RE = /\b(plan|planning|roadmap|strategy)\b/i;
|
|
9
|
+
const PLANNING_DESIGN_WORD_RE = /\b(design|architect\w*|structure|approach)\b/i;
|
|
10
|
+
const PLANNING_PROSPECTIVE_RE = /\b(how (?:should|would|do we|can we)|what(?:'s| is) the (?:best|cleanest|right)|propose|draft|come up with|figure out|decide (?:on|how))\b/i;
|
|
11
|
+
const REFACTOR_RE = /\b(refactor|refactoring)\b/i;
|
|
12
|
+
const TEST_VALIDATION_RE = /\b(test|testing|validation|lint|vitest|jest|run)\b/i;
|
|
13
|
+
const IMPLEMENT_RE = /\b(implement|fix|apply|change|update|create|write|generate|modify|edit|patch|add)\b/i;
|
|
14
|
+
const DESTRUCTIVE_CMD_RE = /\b(rm(\s+-r|\s+-f|\s+-rf|\s+-fr)?|mv|cp|chmod|chown|install)\b|>\s*\/dev\/(sda|hda|vda)|\b(dd\s+if=)/i;
|
|
15
|
+
const GIT_MUTATE_CMD_RE = /\bgit\s+(commit|push|reset|clean|stash|rebase)\b/i;
|
|
16
|
+
const PKG_MUTATE_CMD_RE = /\b(npm|pnpm|yarn|bun)\s+(install|i|update|up|publish|run|remove|rm|uninstall)\b/i;
|
|
17
|
+
const RELEASE_DEPLOY_CMD_RE = /\b(release|deploy)\b/i;
|
|
18
|
+
const PYTHON_HIGH_IMPACT_RE = /\b(?:shutil\.(?:rmtree|move|copy|copy2|copytree)|os\.(?:remove|unlink|rmdir|removedirs|system)|subprocess\.(?:run|call|check_call|check_output|Popen)|Path\([^)]*\)\.(?:unlink|rmdir))\b/i;
|
|
19
|
+
const REDIRECTION_RE = /[<>]/;
|
|
20
|
+
function isPlanningPrompt(text) {
|
|
21
|
+
return PLANNING_CORE_RE.test(text) || (PLANNING_DESIGN_WORD_RE.test(text) && PLANNING_PROSPECTIVE_RE.test(text));
|
|
22
|
+
}
|
|
23
|
+
function highRiskSignal(text) {
|
|
24
|
+
if (RELEASE_PUBLISH_RE.test(text)) {
|
|
25
|
+
return {
|
|
26
|
+
risk: "approval-required",
|
|
27
|
+
kind: "release",
|
|
28
|
+
reason: "Operation mentions releasing, publishing, or deploying",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (SECURITY_AUTH_RE.test(text)) {
|
|
32
|
+
return {
|
|
33
|
+
risk: "approval-required",
|
|
34
|
+
kind: "security",
|
|
35
|
+
reason: "Operation mentions authentication or credentials",
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (DESTRUCTIVE_RE.test(text)) {
|
|
39
|
+
return {
|
|
40
|
+
risk: "approval-required",
|
|
41
|
+
kind: "destructive",
|
|
42
|
+
reason: "Operation involves deleting, resetting, or cleaning",
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (SELF_MOD_MUTATE_RE.test(text)) {
|
|
46
|
+
return {
|
|
47
|
+
risk: "approval-required",
|
|
48
|
+
kind: "self-modification",
|
|
49
|
+
reason: "Operation modifies settings, tools, skills, or prompts",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (ARCHITECTURE_MUTATE_RE.test(text)) {
|
|
53
|
+
return {
|
|
54
|
+
risk: "high-impact",
|
|
55
|
+
kind: "architecture",
|
|
56
|
+
reason: "Operation mentions rewriting or rearchitecting core parts",
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
function stripSingleQuotes(command) {
|
|
62
|
+
return command.replace(/'[^']*'/g, "''");
|
|
63
|
+
}
|
|
64
|
+
export function classifyModelRouterRoute(prompt) {
|
|
65
|
+
const text = prompt.trim();
|
|
66
|
+
if (!text) {
|
|
67
|
+
return {
|
|
68
|
+
tier: "cheap",
|
|
69
|
+
risk: "read-only",
|
|
70
|
+
confidence: 0.1,
|
|
71
|
+
reasonCode: "empty_prompt",
|
|
72
|
+
reasons: ["Empty or whitespace prompt"],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (READ_ONLY_QUESTION_RE.test(text) && !EXPLICIT_MODIFY_REQUEST_RE.test(text)) {
|
|
76
|
+
if (isPlanningPrompt(text)) {
|
|
77
|
+
return {
|
|
78
|
+
tier: "medium",
|
|
79
|
+
risk: "read-only",
|
|
80
|
+
confidence: 0.75,
|
|
81
|
+
reasonCode: "planning_min_medium",
|
|
82
|
+
reasons: ["Planning/design prompts never route cheap by default; a judge may deem them trivial"],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
tier: "cheap",
|
|
87
|
+
risk: "read-only",
|
|
88
|
+
confidence: 0.9,
|
|
89
|
+
reasonCode: "read_only_question",
|
|
90
|
+
reasons: ["Prompt asks a question or requests an explanation, search, or lookup"],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const highRisk = highRiskSignal(text);
|
|
94
|
+
if (highRisk) {
|
|
95
|
+
const reasonCode = {
|
|
96
|
+
release: "release_or_publish",
|
|
97
|
+
security: "security_or_auth",
|
|
98
|
+
destructive: "destructive_or_git_history",
|
|
99
|
+
"self-modification": "settings_or_self_modification",
|
|
100
|
+
architecture: "architecture_or_ambiguous",
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
tier: "expensive",
|
|
104
|
+
risk: highRisk.kind === "security" ? "high-impact" : highRisk.risk,
|
|
105
|
+
confidence: highRisk.kind === "security" ? 0.95 : highRisk.kind === "destructive" ? 0.85 : 0.9,
|
|
106
|
+
reasonCode: reasonCode[highRisk.kind],
|
|
107
|
+
reasons: [highRisk.reason],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
if (isPlanningPrompt(text)) {
|
|
111
|
+
return {
|
|
112
|
+
tier: "medium",
|
|
113
|
+
risk: "read-only",
|
|
114
|
+
confidence: 0.75,
|
|
115
|
+
reasonCode: "planning_min_medium",
|
|
116
|
+
reasons: ["Planning/design prompts never route cheap by default; a judge may deem them trivial"],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (REFACTOR_RE.test(text)) {
|
|
120
|
+
return {
|
|
121
|
+
tier: "medium",
|
|
122
|
+
risk: "scoped-write",
|
|
123
|
+
confidence: 0.8,
|
|
124
|
+
reasonCode: "mechanical_refactor",
|
|
125
|
+
reasons: ["Prompt mentions refactoring code structure"],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (TEST_VALIDATION_RE.test(text)) {
|
|
129
|
+
return {
|
|
130
|
+
tier: "medium",
|
|
131
|
+
risk: "scoped-write",
|
|
132
|
+
confidence: 0.8,
|
|
133
|
+
reasonCode: "test_or_validation",
|
|
134
|
+
reasons: ["Prompt mentions testing, validation, or linting"],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (IMPLEMENT_RE.test(text)) {
|
|
138
|
+
return {
|
|
139
|
+
tier: "medium",
|
|
140
|
+
risk: "scoped-write",
|
|
141
|
+
confidence: 0.85,
|
|
142
|
+
reasonCode: "normal_implementation",
|
|
143
|
+
reasons: ["Prompt mentions implementing, updating, creating, or modifying code"],
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
tier: "cheap",
|
|
148
|
+
risk: "read-only",
|
|
149
|
+
confidence: 0.5,
|
|
150
|
+
reasonCode: "default_read_only",
|
|
151
|
+
reasons: ["No explicit implementation, destructive, or release patterns detected"],
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
export function classifyModelRouterIntent(prompt) {
|
|
155
|
+
return classifyModelRouterRoute(prompt).tier === "cheap" ? "research" : "modify";
|
|
156
|
+
}
|
|
157
|
+
export function assessOperationRisk(input) {
|
|
158
|
+
const operation = input.operation.trim();
|
|
159
|
+
const command = input.command?.trim() ?? "";
|
|
160
|
+
const cleanCommand = stripSingleQuotes(command);
|
|
161
|
+
const fullText = `${operation} ${command}`.trim();
|
|
162
|
+
const cleanFullText = `${operation} ${cleanCommand}`.trim();
|
|
163
|
+
if (!fullText) {
|
|
164
|
+
return {
|
|
165
|
+
risk: "read-only",
|
|
166
|
+
reasonCode: "empty_operation",
|
|
167
|
+
reasons: ["Empty operation"],
|
|
168
|
+
requiresApproval: false,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
if (READ_ONLY_QUESTION_RE.test(operation) && !EXPLICIT_MODIFY_REQUEST_RE.test(operation)) {
|
|
172
|
+
return {
|
|
173
|
+
risk: "read-only",
|
|
174
|
+
reasonCode: "read_only_operation",
|
|
175
|
+
reasons: ["Operation is explicitly read-only (list/show/read/search)"],
|
|
176
|
+
requiresApproval: false,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
const highRisk = highRiskSignal(cleanFullText);
|
|
180
|
+
if (highRisk) {
|
|
181
|
+
const reasonCode = {
|
|
182
|
+
release: "release_publish_operation",
|
|
183
|
+
security: "security_auth_operation",
|
|
184
|
+
destructive: "destructive_operation",
|
|
185
|
+
"self-modification": "self_modification_operation",
|
|
186
|
+
architecture: "architecture_mutation_operation",
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
risk: highRisk.risk,
|
|
190
|
+
reasonCode: reasonCode[highRisk.kind],
|
|
191
|
+
reasons: [highRisk.reason],
|
|
192
|
+
requiresApproval: highRisk.risk === "approval-required",
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
if (command &&
|
|
196
|
+
(DESTRUCTIVE_CMD_RE.test(cleanCommand) ||
|
|
197
|
+
GIT_MUTATE_CMD_RE.test(cleanCommand) ||
|
|
198
|
+
PKG_MUTATE_CMD_RE.test(cleanCommand) ||
|
|
199
|
+
RELEASE_DEPLOY_CMD_RE.test(cleanCommand) ||
|
|
200
|
+
PYTHON_HIGH_IMPACT_RE.test(cleanCommand) ||
|
|
201
|
+
REDIRECTION_RE.test(cleanCommand))) {
|
|
202
|
+
return {
|
|
203
|
+
risk: "approval-required",
|
|
204
|
+
reasonCode: "mutating_command",
|
|
205
|
+
reasons: ["Command executes a destructive, mutating, or publish operation"],
|
|
206
|
+
requiresApproval: true,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if (input.toolName &&
|
|
210
|
+
!["read_file", "search_web", "list_dir", "grep_search", "view_file", "memory"].includes(input.toolName)) {
|
|
211
|
+
return {
|
|
212
|
+
risk: "scoped-write",
|
|
213
|
+
reasonCode: "generic_mutation",
|
|
214
|
+
reasons: ["Generic mutating operation or command"],
|
|
215
|
+
requiresApproval: false,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
risk: "read-only",
|
|
220
|
+
reasonCode: "default_read_only",
|
|
221
|
+
reasons: ["No mutating or high-risk patterns detected"],
|
|
222
|
+
requiresApproval: false,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=risk-classifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"risk-classifier.js","sourceRoot":"","sources":["../../src/core/risk-classifier.ts"],"names":[],"mappings":"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","sourcesContent":["import type { OperationRisk, RiskAssessment, RiskAssessmentInput, RouteDecision } from \"./autonomy/contracts.ts\";\n\nexport type ModelRouterIntent = \"research\" | \"modify\";\n\nconst EXPLICIT_MODIFY_REQUEST_RE =\n\t/^(?:can you|could you|please|pls|go ahead and|let'?s|i need you to|we need to|you should)\\s+.*\\b(add|apply|build|change|commit|create|delete|edit|fix|generate|implement|install|modify|patch|remove|rename|replace|run|test|update|write|publish|release|push|deploy|tag|reset|clean|rewrite)\\b/i;\nconst READ_ONLY_QUESTION_RE =\n\t/^(?:(?:can you|could you|please|pls|go ahead and|let'?s|i need you to|we need to|you should)\\s+)?(?:how|what|why|when|where|which|who|explain|summarize|compare|describe|list|show|search|find|view|read|locate)\\b/i;\nconst RELEASE_PUBLISH_RE = /\\b(publish|release|push|deploy|tag)\\b/i;\nconst SECURITY_AUTH_RE = /\\b(auth|token|credential|credentials|secret|api[-_]key)\\b/i;\nconst DESTRUCTIVE_RE = /\\b(delete|reset|rm\\s+-rf|clean)\\b/i;\nconst SELF_MOD_MUTATE_RE =\n\t/\\b(modify|change|write|update|edit|delete|add|remove|set)\\s+.*\\b(skills|prompts|settings|tools|behavior)\\b|self[-_]modification/i;\nconst ARCHITECTURE_MUTATE_RE = /\\b(rewrite|redesign|change|modify|rearchitect)\\s+.*\\b(architecture|architect)\\b/i;\nconst PLANNING_CORE_RE = /\\b(plan|planning|roadmap|strategy)\\b/i;\nconst PLANNING_DESIGN_WORD_RE = /\\b(design|architect\\w*|structure|approach)\\b/i;\nconst PLANNING_PROSPECTIVE_RE =\n\t/\\b(how (?:should|would|do we|can we)|what(?:'s| is) the (?:best|cleanest|right)|propose|draft|come up with|figure out|decide (?:on|how))\\b/i;\nconst REFACTOR_RE = /\\b(refactor|refactoring)\\b/i;\nconst TEST_VALIDATION_RE = /\\b(test|testing|validation|lint|vitest|jest|run)\\b/i;\nconst IMPLEMENT_RE = /\\b(implement|fix|apply|change|update|create|write|generate|modify|edit|patch|add)\\b/i;\nconst DESTRUCTIVE_CMD_RE =\n\t/\\b(rm(\\s+-r|\\s+-f|\\s+-rf|\\s+-fr)?|mv|cp|chmod|chown|install)\\b|>\\s*\\/dev\\/(sda|hda|vda)|\\b(dd\\s+if=)/i;\nconst GIT_MUTATE_CMD_RE = /\\bgit\\s+(commit|push|reset|clean|stash|rebase)\\b/i;\nconst PKG_MUTATE_CMD_RE = /\\b(npm|pnpm|yarn|bun)\\s+(install|i|update|up|publish|run|remove|rm|uninstall)\\b/i;\nconst RELEASE_DEPLOY_CMD_RE = /\\b(release|deploy)\\b/i;\nconst PYTHON_HIGH_IMPACT_RE =\n\t/\\b(?:shutil\\.(?:rmtree|move|copy|copy2|copytree)|os\\.(?:remove|unlink|rmdir|removedirs|system)|subprocess\\.(?:run|call|check_call|check_output|Popen)|Path\\([^)]*\\)\\.(?:unlink|rmdir))\\b/i;\nconst REDIRECTION_RE = /[<>]/;\n\ninterface RiskSignal {\n\trisk: OperationRisk;\n\tkind: \"release\" | \"security\" | \"destructive\" | \"self-modification\" | \"architecture\";\n\treason: string;\n}\n\nfunction isPlanningPrompt(text: string): boolean {\n\treturn PLANNING_CORE_RE.test(text) || (PLANNING_DESIGN_WORD_RE.test(text) && PLANNING_PROSPECTIVE_RE.test(text));\n}\n\nfunction highRiskSignal(text: string): RiskSignal | undefined {\n\tif (RELEASE_PUBLISH_RE.test(text)) {\n\t\treturn {\n\t\t\trisk: \"approval-required\",\n\t\t\tkind: \"release\",\n\t\t\treason: \"Operation mentions releasing, publishing, or deploying\",\n\t\t};\n\t}\n\tif (SECURITY_AUTH_RE.test(text)) {\n\t\treturn {\n\t\t\trisk: \"approval-required\",\n\t\t\tkind: \"security\",\n\t\t\treason: \"Operation mentions authentication or credentials\",\n\t\t};\n\t}\n\tif (DESTRUCTIVE_RE.test(text)) {\n\t\treturn {\n\t\t\trisk: \"approval-required\",\n\t\t\tkind: \"destructive\",\n\t\t\treason: \"Operation involves deleting, resetting, or cleaning\",\n\t\t};\n\t}\n\tif (SELF_MOD_MUTATE_RE.test(text)) {\n\t\treturn {\n\t\t\trisk: \"approval-required\",\n\t\t\tkind: \"self-modification\",\n\t\t\treason: \"Operation modifies settings, tools, skills, or prompts\",\n\t\t};\n\t}\n\tif (ARCHITECTURE_MUTATE_RE.test(text)) {\n\t\treturn {\n\t\t\trisk: \"high-impact\",\n\t\t\tkind: \"architecture\",\n\t\t\treason: \"Operation mentions rewriting or rearchitecting core parts\",\n\t\t};\n\t}\n\treturn undefined;\n}\n\nfunction stripSingleQuotes(command: string): string {\n\treturn command.replace(/'[^']*'/g, \"''\");\n}\n\nexport function classifyModelRouterRoute(prompt: string): RouteDecision {\n\tconst text = prompt.trim();\n\tif (!text) {\n\t\treturn {\n\t\t\ttier: \"cheap\",\n\t\t\trisk: \"read-only\",\n\t\t\tconfidence: 0.1,\n\t\t\treasonCode: \"empty_prompt\",\n\t\t\treasons: [\"Empty or whitespace prompt\"],\n\t\t};\n\t}\n\tif (READ_ONLY_QUESTION_RE.test(text) && !EXPLICIT_MODIFY_REQUEST_RE.test(text)) {\n\t\tif (isPlanningPrompt(text)) {\n\t\t\treturn {\n\t\t\t\ttier: \"medium\",\n\t\t\t\trisk: \"read-only\",\n\t\t\t\tconfidence: 0.75,\n\t\t\t\treasonCode: \"planning_min_medium\",\n\t\t\t\treasons: [\"Planning/design prompts never route cheap by default; a judge may deem them trivial\"],\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\ttier: \"cheap\",\n\t\t\trisk: \"read-only\",\n\t\t\tconfidence: 0.9,\n\t\t\treasonCode: \"read_only_question\",\n\t\t\treasons: [\"Prompt asks a question or requests an explanation, search, or lookup\"],\n\t\t};\n\t}\n\tconst highRisk = highRiskSignal(text);\n\tif (highRisk) {\n\t\tconst reasonCode: Record<RiskSignal[\"kind\"], string> = {\n\t\t\trelease: \"release_or_publish\",\n\t\t\tsecurity: \"security_or_auth\",\n\t\t\tdestructive: \"destructive_or_git_history\",\n\t\t\t\"self-modification\": \"settings_or_self_modification\",\n\t\t\tarchitecture: \"architecture_or_ambiguous\",\n\t\t};\n\t\treturn {\n\t\t\ttier: \"expensive\",\n\t\t\trisk: highRisk.kind === \"security\" ? \"high-impact\" : highRisk.risk,\n\t\t\tconfidence: highRisk.kind === \"security\" ? 0.95 : highRisk.kind === \"destructive\" ? 0.85 : 0.9,\n\t\t\treasonCode: reasonCode[highRisk.kind],\n\t\t\treasons: [highRisk.reason],\n\t\t};\n\t}\n\tif (isPlanningPrompt(text)) {\n\t\treturn {\n\t\t\ttier: \"medium\",\n\t\t\trisk: \"read-only\",\n\t\t\tconfidence: 0.75,\n\t\t\treasonCode: \"planning_min_medium\",\n\t\t\treasons: [\"Planning/design prompts never route cheap by default; a judge may deem them trivial\"],\n\t\t};\n\t}\n\tif (REFACTOR_RE.test(text)) {\n\t\treturn {\n\t\t\ttier: \"medium\",\n\t\t\trisk: \"scoped-write\",\n\t\t\tconfidence: 0.8,\n\t\t\treasonCode: \"mechanical_refactor\",\n\t\t\treasons: [\"Prompt mentions refactoring code structure\"],\n\t\t};\n\t}\n\tif (TEST_VALIDATION_RE.test(text)) {\n\t\treturn {\n\t\t\ttier: \"medium\",\n\t\t\trisk: \"scoped-write\",\n\t\t\tconfidence: 0.8,\n\t\t\treasonCode: \"test_or_validation\",\n\t\t\treasons: [\"Prompt mentions testing, validation, or linting\"],\n\t\t};\n\t}\n\tif (IMPLEMENT_RE.test(text)) {\n\t\treturn {\n\t\t\ttier: \"medium\",\n\t\t\trisk: \"scoped-write\",\n\t\t\tconfidence: 0.85,\n\t\t\treasonCode: \"normal_implementation\",\n\t\t\treasons: [\"Prompt mentions implementing, updating, creating, or modifying code\"],\n\t\t};\n\t}\n\treturn {\n\t\ttier: \"cheap\",\n\t\trisk: \"read-only\",\n\t\tconfidence: 0.5,\n\t\treasonCode: \"default_read_only\",\n\t\treasons: [\"No explicit implementation, destructive, or release patterns detected\"],\n\t};\n}\n\nexport function classifyModelRouterIntent(prompt: string): ModelRouterIntent {\n\treturn classifyModelRouterRoute(prompt).tier === \"cheap\" ? \"research\" : \"modify\";\n}\n\nexport function assessOperationRisk(input: RiskAssessmentInput): RiskAssessment {\n\tconst operation = input.operation.trim();\n\tconst command = input.command?.trim() ?? \"\";\n\tconst cleanCommand = stripSingleQuotes(command);\n\tconst fullText = `${operation} ${command}`.trim();\n\tconst cleanFullText = `${operation} ${cleanCommand}`.trim();\n\tif (!fullText) {\n\t\treturn {\n\t\t\trisk: \"read-only\",\n\t\t\treasonCode: \"empty_operation\",\n\t\t\treasons: [\"Empty operation\"],\n\t\t\trequiresApproval: false,\n\t\t};\n\t}\n\tif (READ_ONLY_QUESTION_RE.test(operation) && !EXPLICIT_MODIFY_REQUEST_RE.test(operation)) {\n\t\treturn {\n\t\t\trisk: \"read-only\",\n\t\t\treasonCode: \"read_only_operation\",\n\t\t\treasons: [\"Operation is explicitly read-only (list/show/read/search)\"],\n\t\t\trequiresApproval: false,\n\t\t};\n\t}\n\tconst highRisk = highRiskSignal(cleanFullText);\n\tif (highRisk) {\n\t\tconst reasonCode: Record<RiskSignal[\"kind\"], string> = {\n\t\t\trelease: \"release_publish_operation\",\n\t\t\tsecurity: \"security_auth_operation\",\n\t\t\tdestructive: \"destructive_operation\",\n\t\t\t\"self-modification\": \"self_modification_operation\",\n\t\t\tarchitecture: \"architecture_mutation_operation\",\n\t\t};\n\t\treturn {\n\t\t\trisk: highRisk.risk,\n\t\t\treasonCode: reasonCode[highRisk.kind],\n\t\t\treasons: [highRisk.reason],\n\t\t\trequiresApproval: highRisk.risk === \"approval-required\",\n\t\t};\n\t}\n\tif (\n\t\tcommand &&\n\t\t(DESTRUCTIVE_CMD_RE.test(cleanCommand) ||\n\t\t\tGIT_MUTATE_CMD_RE.test(cleanCommand) ||\n\t\t\tPKG_MUTATE_CMD_RE.test(cleanCommand) ||\n\t\t\tRELEASE_DEPLOY_CMD_RE.test(cleanCommand) ||\n\t\t\tPYTHON_HIGH_IMPACT_RE.test(cleanCommand) ||\n\t\t\tREDIRECTION_RE.test(cleanCommand))\n\t) {\n\t\treturn {\n\t\t\trisk: \"approval-required\",\n\t\t\treasonCode: \"mutating_command\",\n\t\t\treasons: [\"Command executes a destructive, mutating, or publish operation\"],\n\t\t\trequiresApproval: true,\n\t\t};\n\t}\n\tif (\n\t\tinput.toolName &&\n\t\t![\"read_file\", \"search_web\", \"list_dir\", \"grep_search\", \"view_file\", \"memory\"].includes(input.toolName)\n\t) {\n\t\treturn {\n\t\t\trisk: \"scoped-write\",\n\t\t\treasonCode: \"generic_mutation\",\n\t\t\treasons: [\"Generic mutating operation or command\"],\n\t\t\trequiresApproval: false,\n\t\t};\n\t}\n\treturn {\n\t\trisk: \"read-only\",\n\t\treasonCode: \"default_read_only\",\n\t\treasons: [\"No mutating or high-risk patterns detected\"],\n\t\trequiresApproval: false,\n\t};\n}\n"]}
|
|
@@ -36,26 +36,47 @@ import type { Agent, AgentContext, AgentMessage, AgentTool } from "@caupulican/p
|
|
|
36
36
|
import type { SessionManager } from "@caupulican/pi-agent-core/node";
|
|
37
37
|
import type { Api, Model, Usage } from "@caupulican/pi-ai";
|
|
38
38
|
import type { IsolatedCompletionOptions, IsolatedCompletionResult, WorkerDelegationRunOutcome } from "./agent-session.ts";
|
|
39
|
-
import type {
|
|
39
|
+
import type { WorkerClaim } from "./autonomy/contracts.ts";
|
|
40
40
|
import type { LaneRecord } from "./autonomy/lane-tracker.ts";
|
|
41
41
|
import type { ArtifactStore } from "./context/context-artifacts.ts";
|
|
42
42
|
import type { MemoryPromptInclusionReport, MemoryRetrievalDiagnostics } from "./context/memory-diagnostics.ts";
|
|
43
43
|
import type { ContextGcReport } from "./context-gc.ts";
|
|
44
|
+
import type { WorkerDelegationRequest } from "./delegation/worker-delegation-request.ts";
|
|
44
45
|
import { type ContextUsage, type Extension, type ExtensionCommandContextActions, type ExtensionErrorListener, ExtensionRunner, type ExtensionUIContext, type ShutdownHandler, type ToolDefinition, type ToolInfo } from "./extensions/index.ts";
|
|
45
46
|
import type { GoalState } from "./goals/goal-state.ts";
|
|
47
|
+
import type { OpenTaskStepRef } from "./goals/goal-tool-core.ts";
|
|
46
48
|
import type { MemoryManager } from "./memory/memory-manager.ts";
|
|
47
49
|
import type { MemoryControllerReloadSnapshot } from "./memory-controller.ts";
|
|
50
|
+
import type { LaneWorkerRefusal } from "./model-capability.ts";
|
|
48
51
|
import type { ModelRegistry } from "./model-registry.ts";
|
|
52
|
+
import type { OrchestrationProfile } from "./orchestration/contracts.ts";
|
|
49
53
|
import type { ProfileFilterReloadSnapshot } from "./profile-filter-controller.ts";
|
|
50
54
|
import type { ModelFitnessReport } from "./research/model-fitness.ts";
|
|
51
55
|
import type { ResourceLoader } from "./resource-loader.ts";
|
|
56
|
+
import type { SessionImageStore } from "./session-image-store.ts";
|
|
52
57
|
import { type ResourceProfileFilterSettings, type SettingsManager } from "./settings-manager.ts";
|
|
53
58
|
import type { TaskStepsState } from "./tasks/task-state.ts";
|
|
59
|
+
/**
|
|
60
|
+
* Is `toolCallId` a real, answered tool call on `sessionManager`'s active branch? A
|
|
61
|
+
* toolCallId is "real" iff a toolResult message on that branch responded to it -- the same
|
|
62
|
+
* toolResult/toolCallId match `context-pipeline.ts`'s `_buildSessionEntryIdLookup` uses, and
|
|
63
|
+
* branch-scoped (via `getBranch()`) so a sibling branch's tool calls never count. Exported (pure,
|
|
64
|
+
* no `this`) so the goal tool's `hasToolCallId` wiring below is directly testable against a real
|
|
65
|
+
* `SessionManager` without constructing the whole `RuntimeBuilder`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function hasAnsweredToolCallOnBranch(sessionManager: SessionManager, toolCallId: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Goal-tool adapter over the canonical open-task projection. Exported (pure, no `this`) so the
|
|
70
|
+
* production `getOpenTaskSteps` wiring below remains directly testable without another filter.
|
|
71
|
+
*/
|
|
72
|
+
export declare function deriveOpenTaskStepRefs(taskStepsState: TaskStepsState | undefined): OpenTaskStepRef[];
|
|
54
73
|
export interface RuntimeBuilderDeps {
|
|
55
74
|
/** Live agent — the snapshot/doctor read and restore its `state.tools` / `state.systemPrompt`. */
|
|
56
75
|
getAgent(): Agent;
|
|
57
76
|
/** Workspace root, passed to the tool-definition factory and the extension runner. */
|
|
58
77
|
getCwd(): string;
|
|
78
|
+
/** Per-agent persistent shell session key; stable across reloads so the shell survives them. */
|
|
79
|
+
getShellSessionKey(): string;
|
|
59
80
|
/** Agent state root, including the host-keyed fitness store. */
|
|
60
81
|
getAgentDir(): string;
|
|
61
82
|
/** Session log, passed to the extension runner. */
|
|
@@ -86,6 +107,8 @@ export interface RuntimeBuilderDeps {
|
|
|
86
107
|
getToolProfileFilter(): Required<ResourceProfileFilterSettings> | undefined;
|
|
87
108
|
setToolProfileFilter(filter: Required<ResourceProfileFilterSettings> | undefined): void;
|
|
88
109
|
getAllowedToolNames(): Set<string> | undefined;
|
|
110
|
+
/** Immutable active orchestration profile; absent sessions never construct run_process. */
|
|
111
|
+
getOrchestrationProfile?(): OrchestrationProfile | undefined;
|
|
89
112
|
getExcludedToolNames(): Set<string> | undefined;
|
|
90
113
|
/** Re-derive the profile tool filter from freshly reloaded settings (reload only). */
|
|
91
114
|
deriveToolProfileFilter(): Required<ResourceProfileFilterSettings>;
|
|
@@ -93,7 +116,7 @@ export interface RuntimeBuilderDeps {
|
|
|
93
116
|
isToolOrCommandAllowedByProfile(name: string): boolean;
|
|
94
117
|
/** Filter the loaded extensions through the active resource profile (records inert/denied warnings host-side). */
|
|
95
118
|
filterExtensionsForRuntime(extensions: Extension[]): Extension[];
|
|
96
|
-
/** Sink for the
|
|
119
|
+
/** Sink for the unbound-profile-tool-grant warnings surfaced in /context. */
|
|
97
120
|
setUnboundToolGrantWarnings(warnings: string[]): void;
|
|
98
121
|
getUnboundToolGrantWarnings(): string[];
|
|
99
122
|
createProfileFilterReloadSnapshot(): ProfileFilterReloadSnapshot;
|
|
@@ -117,6 +140,8 @@ export interface RuntimeBuilderDeps {
|
|
|
117
140
|
notifyExtensionsChanged(): void;
|
|
118
141
|
/** Session-scoped tool-output artifact store for artifact-producing tools and artifact_retrieve (gated on the profile). */
|
|
119
142
|
getToolArtifactStore(): ArtifactStore;
|
|
143
|
+
/** Lazily resolve durable image storage only for a persisted/configured session. */
|
|
144
|
+
getSessionImageStore(): Pick<SessionImageStore, "retainContent"> | undefined;
|
|
120
145
|
/** Live memory manager — its provider tools join the registry. */
|
|
121
146
|
getMemoryManager(): MemoryManager;
|
|
122
147
|
/** Memory retrieval + prompt-inclusion diagnostics for the core diagnostics tool. */
|
|
@@ -139,29 +164,31 @@ export interface RuntimeBuilderDeps {
|
|
|
139
164
|
/** Context-gc report for the core diagnostics tool. */
|
|
140
165
|
getContextGcReport(messages: AgentMessage[]): ContextGcReport;
|
|
141
166
|
/** Non-blocking worker-delegation starter for the delegate tool. */
|
|
142
|
-
startWorkerDelegation(request: {
|
|
143
|
-
instructions: string;
|
|
144
|
-
systemPrompt?: string;
|
|
145
|
-
memoryRead?: boolean;
|
|
146
|
-
}): {
|
|
167
|
+
startWorkerDelegation(request: WorkerDelegationRequest): {
|
|
147
168
|
started: false;
|
|
148
169
|
skipReason: string;
|
|
149
170
|
} | {
|
|
150
171
|
started: true;
|
|
151
172
|
record: LaneRecord;
|
|
152
173
|
};
|
|
174
|
+
getOrchestrationProfileCatalog(): Array<{
|
|
175
|
+
profileId: string;
|
|
176
|
+
role: string;
|
|
177
|
+
description: string;
|
|
178
|
+
}>;
|
|
153
179
|
getWorkerLaneRecords(): LaneRecord[];
|
|
154
|
-
|
|
180
|
+
getWorkerClaimSnapshots(): WorkerClaim[];
|
|
181
|
+
/** Confirm a managed dispatch's caller-stable canonical lane id was registered durably before the
|
|
182
|
+
* goal binds it (`BackgroundLaneController.resolveManagedLaneId`). */
|
|
183
|
+
resolveManagedLaneId(callerLaneId: string): string | undefined;
|
|
155
184
|
/** Worker-delegation runner for SDK/test through-completion calls. */
|
|
156
|
-
runWorkerDelegationOnce(request:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
memoryRead?: boolean;
|
|
160
|
-
}): Promise<WorkerDelegationRunOutcome>;
|
|
161
|
-
/** Model-fitness probe for the model_fitness tool. */
|
|
185
|
+
runWorkerDelegationOnce(request: WorkerDelegationRequest): Promise<WorkerDelegationRunOutcome>;
|
|
186
|
+
/** Model-fitness probe for the model_fitness tool. `toolCallId` is the idempotency token
|
|
187
|
+
* for spawned-usage reportId — present only for the LLM tool-call path (see model-fitness.ts). */
|
|
162
188
|
runModelFitness(args: {
|
|
163
189
|
model: string;
|
|
164
190
|
trials?: number;
|
|
191
|
+
toolCallId?: string;
|
|
165
192
|
}): Promise<{
|
|
166
193
|
started: true;
|
|
167
194
|
model: string;
|
|
@@ -174,12 +201,18 @@ export interface RuntimeBuilderDeps {
|
|
|
174
201
|
resolveCurationModelIfFit(): Model<Api> | undefined;
|
|
175
202
|
/** One-shot, tool-less LLM call — the reflex-brain interpreter rides this. */
|
|
176
203
|
runIsolatedCompletion(opts: IsolatedCompletionOptions): Promise<IsolatedCompletionResult>;
|
|
177
|
-
/** Roll reflex-brain spend into spawned-usage accounting.
|
|
178
|
-
|
|
204
|
+
/** Roll reflex-brain spend into spawned-usage accounting. `reportId` is REQUIRED: every
|
|
205
|
+
* caller derives a stable id from the work unit's identity so a retry cannot double-count. */
|
|
206
|
+
addSpawnedUsage(usage: Usage, opts: {
|
|
179
207
|
label?: string;
|
|
180
208
|
sourceSessionId?: string;
|
|
181
|
-
reportId
|
|
209
|
+
reportId: string;
|
|
182
210
|
}): string | undefined;
|
|
211
|
+
/** Whether the CURRENT session model may drive a worktree-sync lane worker (`AgentSession.
|
|
212
|
+
* getLaneWorkerRefusal`) -- consulted BEFORE a goal→tmux dispatch so an ineligible model's
|
|
213
|
+
* dispatch is refused before any lane/pane side effect (`tools/tmux-dispatch.ts`'s
|
|
214
|
+
* `evaluateWorkerLaneRefusal`). `undefined` means eligible. */
|
|
215
|
+
getLaneWorkerRefusal(): LaneWorkerRefusal | undefined;
|
|
183
216
|
/** Post-rebuild doctor helpers (validate the rebuilt runtime can render a context). */
|
|
184
217
|
createAgentContextSnapshot(): AgentContext;
|
|
185
218
|
getContextUsage(): ContextUsage | undefined;
|
|
@@ -191,6 +224,17 @@ export interface RuntimeBuilderDeps {
|
|
|
191
224
|
getExtensionCommandContextActions(): ExtensionCommandContextActions | undefined;
|
|
192
225
|
getExtensionShutdownHandler(): ShutdownHandler | undefined;
|
|
193
226
|
getExtensionErrorListener(): ExtensionErrorListener | undefined;
|
|
227
|
+
/**
|
|
228
|
+
* Stop any pi-spawned local (Ollama/Transformers/prism llama.cpp) runtime the host's
|
|
229
|
+
* LocalRuntimeController is holding open that no longer applies under the just-reloaded
|
|
230
|
+
* configuration — e.g. `LocalRuntimeController.reconcile(eligibleModels)`, with `eligibleModels`
|
|
231
|
+
* derived from whatever the host still routes to post-reload (foreground model + any configured
|
|
232
|
+
* router tier). Called ONLY after `_reloadOnce()` commits successfully — never on a rolled-back
|
|
233
|
+
* reload, since a rollback restores the PREVIOUS configuration and nothing became ineligible.
|
|
234
|
+
* Optional: a host that hasn't wired a LocalRuntimeController through here yet sees no behavior
|
|
235
|
+
* change — a local runtime this builder doesn't know about is simply left alone, never guessed at.
|
|
236
|
+
*/
|
|
237
|
+
reconcileLocalRuntimes?(): void;
|
|
194
238
|
}
|
|
195
239
|
/**
|
|
196
240
|
* Owns the tool-registry build and the self-modification-safe extension reload extracted from
|
|
@@ -206,6 +250,12 @@ export declare class RuntimeBuilder {
|
|
|
206
250
|
private _reloadRequested;
|
|
207
251
|
private readonly deps;
|
|
208
252
|
constructor(deps: RuntimeBuilderDeps);
|
|
253
|
+
/**
|
|
254
|
+
* Resolve the construction and activation policy once for a runtime generation. This is the
|
|
255
|
+
* UAC choke point: callers must consult it before invoking a tool factory, not merely before
|
|
256
|
+
* placing an already-created definition in the live registry.
|
|
257
|
+
*/
|
|
258
|
+
private _createToolAccessPolicy;
|
|
209
259
|
private _runContextScout;
|
|
210
260
|
/** Whether a tool name is present in the live wrapped registry. */
|
|
211
261
|
hasTool(name: string): boolean;
|
|
@@ -235,6 +285,15 @@ export declare class RuntimeBuilder {
|
|
|
235
285
|
}): (() => void) | undefined;
|
|
236
286
|
reload(): Promise<void>;
|
|
237
287
|
private _drainReloadRequests;
|
|
288
|
+
/**
|
|
289
|
+
* Unified reload-gate quiescence check: refuses the caller's action (message-prefixed by
|
|
290
|
+
* `action`) while the agent is streaming, is compacting, or ANY background work unit is still
|
|
291
|
+
* registered in the in-process quiesce registry — background lanes (research/worker/
|
|
292
|
+
* model-fitness), a context-scout run, or an isolated completion (see reload-blockers.ts). Every
|
|
293
|
+
* live-op entry point below calls this so they refuse identically; this is a synchronous refusal
|
|
294
|
+
* (not a wait/poll) — callers retry via the same coalescing `reload()` already provides.
|
|
295
|
+
*/
|
|
296
|
+
private _assertReloadQuiescent;
|
|
238
297
|
private _reloadOnce;
|
|
239
298
|
/**
|
|
240
299
|
* Unload a single extension without full reload.
|