@caupulican/pi-adaptative 0.81.39 → 0.81.41
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 +77 -0
- package/README.md +2 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +2 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +3 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +4 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +9 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +290 -107
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +357 -122
- package/dist/bundled-resources/skills/tool-call-repair/references/repair-catalogue.md +2 -2
- package/dist/cli/args.d.ts +4 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +31 -1
- 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 +25 -2
- package/dist/core/agent-paths.d.ts.map +1 -1
- package/dist/core/agent-paths.js +79 -4
- package/dist/core/agent-paths.js.map +1 -1
- package/dist/core/agent-session-contracts.d.ts +293 -0
- package/dist/core/agent-session-contracts.d.ts.map +1 -0
- package/dist/core/agent-session-contracts.js +26 -0
- package/dist/core/agent-session-contracts.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 +400 -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 +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +74 -518
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +370 -1432
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -1
- package/dist/core/auth-storage.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 +20 -12
- 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 +48 -9
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/autonomy/lane-tracker.d.ts +14 -0
- package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tracker.js +38 -0
- 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 +56 -236
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +141 -1273
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/bedrock-sso-login.d.ts +16 -0
- package/dist/core/bedrock-sso-login.d.ts.map +1 -0
- package/dist/core/bedrock-sso-login.js +98 -0
- package/dist/core/bedrock-sso-login.js.map +1 -0
- 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 +13 -17
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js +3 -3
- 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-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 +10 -5
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +1 -1
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +16 -37
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/cost/cost-summary.d.ts.map +1 -1
- package/dist/core/cost/cost-summary.js +5 -3
- package/dist/core/cost/cost-summary.js.map +1 -1
- package/dist/core/cost/daily-usage.d.ts.map +1 -1
- package/dist/core/cost/daily-usage.js +4 -5
- package/dist/core/cost/daily-usage.js.map +1 -1
- package/dist/core/default-tool-surface.d.ts.map +1 -1
- package/dist/core/default-tool-surface.js +2 -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-result.d.ts → worker-claim.d.ts} +13 -13
- package/dist/core/delegation/worker-claim.d.ts.map +1 -0
- package/dist/core/delegation/{worker-result.js → worker-claim.js} +61 -51
- 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/extension-import-authority.d.ts +6 -0
- package/dist/core/extension-import-authority.d.ts.map +1 -0
- package/dist/core/extension-import-authority.js +10 -0
- package/dist/core/extension-import-authority.js.map +1 -0
- 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 +52 -18
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +20 -5
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/stale-context.d.ts +2 -0
- package/dist/core/extensions/stale-context.d.ts.map +1 -0
- package/dist/core/extensions/stale-context.js +2 -0
- package/dist/core/extensions/stale-context.js.map +1 -0
- 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 +78 -21
- 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 +53 -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 +14 -9
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +47 -75
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/compact-goal-context.d.ts +11 -0
- package/dist/core/goals/compact-goal-context.d.ts.map +1 -0
- package/dist/core/goals/compact-goal-context.js +59 -0
- package/dist/core/goals/compact-goal-context.js.map +1 -0
- 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 +27 -0
- package/dist/core/goals/goal-acceptance.js.map +1 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts +28 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -0
- package/dist/core/goals/goal-auto-continue-controller.js +90 -0
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -0
- package/dist/core/goals/goal-continuation-controller.d.ts +2 -2
- package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-controller.js +52 -11
- package/dist/core/goals/goal-continuation-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.d.ts +4 -29
- package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.js +4 -32
- package/dist/core/goals/goal-continuation-defaults.js.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.d.ts +8 -18
- package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.js +9 -179
- package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
- package/dist/core/goals/goal-lifecycle.d.ts +43 -0
- package/dist/core/goals/goal-lifecycle.d.ts.map +1 -0
- package/dist/core/goals/goal-lifecycle.js +102 -0
- package/dist/core/goals/goal-lifecycle.js.map +1 -0
- package/dist/core/goals/goal-record.d.ts +17 -0
- package/dist/core/goals/goal-record.d.ts.map +1 -0
- package/dist/core/goals/goal-record.js +31 -0
- package/dist/core/goals/goal-record.js.map +1 -0
- package/dist/core/goals/goal-runtime-snapshot.d.ts +11 -9
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.js +10 -8
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
- package/dist/core/goals/goal-session-controller.d.ts +42 -0
- package/dist/core/goals/goal-session-controller.d.ts.map +1 -0
- package/dist/core/goals/goal-session-controller.js +128 -0
- package/dist/core/goals/goal-session-controller.js.map +1 -0
- package/dist/core/goals/goal-state.d.ts +46 -25
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +91 -24
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts +9 -10
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +60 -75
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/goals/session-goal-state.d.ts +20 -12
- package/dist/core/goals/session-goal-state.d.ts.map +1 -1
- package/dist/core/goals/session-goal-state.js +133 -33
- package/dist/core/goals/session-goal-state.js.map +1 -1
- package/dist/core/human-input-controller.d.ts +47 -0
- package/dist/core/human-input-controller.d.ts.map +1 -0
- package/dist/core/human-input-controller.js +181 -0
- package/dist/core/human-input-controller.js.map +1 -0
- 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 +17 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +24 -6
- 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/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/local-runtime-controller.d.ts +1 -1
- package/dist/core/local-runtime-controller.d.ts.map +1 -1
- package/dist/core/local-runtime-controller.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 +0 -19
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +1 -19
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-registry.d.ts +6 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +13 -5
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +17 -2
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +38 -25
- 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-controller.d.ts +1 -1
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +2 -2
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/model-selection-controller.d.ts +5 -5
- 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 +4 -6
- package/dist/core/models/adaptation-store.d.ts.map +1 -1
- package/dist/core/models/adaptation-store.js +95 -83
- package/dist/core/models/adaptation-store.js.map +1 -1
- package/dist/core/models/fitness-store.d.ts +2 -12
- package/dist/core/models/fitness-store.d.ts.map +1 -1
- package/dist/core/models/fitness-store.js +84 -57
- 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/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 +200 -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 +20 -3
- 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 +14 -3
- package/dist/core/process-matrix/codes.d.ts.map +1 -1
- package/dist/core/process-matrix/codes.js.map +1 -1
- 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 +37 -22
- package/dist/core/process-matrix/runtime.d.ts.map +1 -1
- package/dist/core/process-matrix/runtime.js +399 -76
- package/dist/core/process-matrix/runtime.js.map +1 -1
- package/dist/core/process-matrix/store.d.ts +5 -2
- package/dist/core/process-matrix/store.d.ts.map +1 -1
- package/dist/core/process-matrix/store.js +123 -14
- package/dist/core/process-matrix/store.js.map +1 -1
- package/dist/core/process-matrix/supervisor.d.ts +10 -7
- package/dist/core/process-matrix/supervisor.d.ts.map +1 -1
- package/dist/core/process-matrix/supervisor.js +45 -14
- package/dist/core/process-matrix/supervisor.js.map +1 -1
- package/dist/core/profile-filter-controller.d.ts +8 -1
- package/dist/core/profile-filter-controller.d.ts.map +1 -1
- package/dist/core/profile-filter-controller.js +23 -5
- package/dist/core/profile-filter-controller.js.map +1 -1
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +6 -8
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +1 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +18 -29
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +5 -5
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +5 -2
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/reload-blockers.d.ts.map +1 -1
- package/dist/core/reload-blockers.js +6 -8
- package/dist/core/reload-blockers.js.map +1 -1
- package/dist/core/request-auth.d.ts +7 -0
- package/dist/core/request-auth.d.ts.map +1 -0
- package/dist/core/request-auth.js +8 -0
- package/dist/core/request-auth.js.map +1 -0
- 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 +23 -8
- 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 +233 -0
- package/dist/core/risk-classifier.js.map +1 -0
- package/dist/core/runtime-builder.d.ts +41 -23
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +365 -253
- package/dist/core/runtime-builder.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 +68 -25
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/secrets/credential-exposure-guard.d.ts +9 -0
- package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -0
- package/dist/core/secrets/credential-exposure-guard.js +241 -0
- package/dist/core/secrets/credential-exposure-guard.js.map +1 -0
- package/dist/core/secrets/secret-dotenv.d.ts +27 -0
- package/dist/core/secrets/secret-dotenv.d.ts.map +1 -0
- package/dist/core/secrets/secret-dotenv.js +183 -0
- package/dist/core/secrets/secret-dotenv.js.map +1 -0
- package/dist/core/secrets/secret-vault-format.d.ts +112 -0
- package/dist/core/secrets/secret-vault-format.d.ts.map +1 -0
- package/dist/core/secrets/secret-vault-format.js +397 -0
- package/dist/core/secrets/secret-vault-format.js.map +1 -0
- package/dist/core/secrets/secret-vault.d.ts +72 -0
- package/dist/core/secrets/secret-vault.d.ts.map +1 -0
- package/dist/core/secrets/secret-vault.js +671 -0
- package/dist/core/secrets/secret-vault.js.map +1 -0
- package/dist/core/session-analytics.d.ts +4 -23
- package/dist/core/session-analytics.d.ts.map +1 -1
- package/dist/core/session-analytics.js +67 -70
- 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 +11 -4
- package/dist/core/session-role.d.ts.map +1 -1
- package/dist/core/session-role.js +24 -5
- package/dist/core/session-role.js.map +1 -1
- 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/session-tree-navigator.d.ts +4 -6
- package/dist/core/session-tree-navigator.d.ts.map +1 -1
- package/dist/core/session-tree-navigator.js +4 -1
- package/dist/core/session-tree-navigator.js.map +1 -1
- package/dist/core/settings-manager.d.ts +10 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +81 -29
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +2 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tasks/session-task-state.d.ts +2 -4
- package/dist/core/tasks/session-task-state.d.ts.map +1 -1
- package/dist/core/tasks/session-task-state.js +10 -28
- package/dist/core/tasks/session-task-state.js.map +1 -1
- 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 +4 -0
- package/dist/core/tasks/task-state.d.ts.map +1 -1
- package/dist/core/tasks/task-state.js +28 -11
- 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 +86 -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 +8 -2
- package/dist/core/tool-gate-controller.js.map +1 -1
- package/dist/core/tool-protocol-controller.d.ts +89 -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 +2 -3
- package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
- package/dist/core/tool-recovery-log-records.js +9 -35
- package/dist/core/tool-recovery-log-records.js.map +1 -1
- package/dist/core/tool-recovery-stats.d.ts +21 -1
- package/dist/core/tool-recovery-stats.d.ts.map +1 -1
- package/dist/core/tool-recovery-stats.js.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.d.ts +3 -7
- package/dist/core/tool-selection/tool-performance-store.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.js +97 -138
- package/dist/core/tool-selection/tool-performance-store.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 +5 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +59 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/delegate-status.d.ts +31 -3
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +148 -29
- 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 +106 -23
- 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/git-filter.d.ts +1 -8
- package/dist/core/tools/git-filter.d.ts.map +1 -1
- package/dist/core/tools/git-filter.js +2 -63
- package/dist/core/tools/git-filter.js.map +1 -1
- package/dist/core/tools/goal.d.ts +10 -8
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +106 -28
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +1 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/model-fitness.d.ts.map +1 -1
- package/dist/core/tools/model-fitness.js +2 -2
- package/dist/core/tools/model-fitness.js.map +1 -1
- package/dist/core/tools/orchestration-panel.d.ts +40 -0
- package/dist/core/tools/orchestration-panel.d.ts.map +1 -0
- package/dist/core/tools/orchestration-panel.js +124 -0
- package/dist/core/tools/orchestration-panel.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +11 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +36 -3
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/python.d.ts +2 -0
- package/dist/core/tools/python.d.ts.map +1 -1
- package/dist/core/tools/python.js +3 -1
- package/dist/core/tools/python.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -1
- package/dist/core/tools/read.js.map +1 -1
- 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/search-command-guard.d.ts +14 -0
- package/dist/core/tools/search-command-guard.d.ts.map +1 -0
- package/dist/core/tools/search-command-guard.js +333 -0
- package/dist/core/tools/search-command-guard.js.map +1 -0
- package/dist/core/tools/secret-store.d.ts +38 -0
- package/dist/core/tools/secret-store.d.ts.map +1 -0
- package/dist/core/tools/secret-store.js +412 -0
- package/dist/core/tools/secret-store.js.map +1 -0
- package/dist/core/tools/shell-command-parser.d.ts +16 -0
- package/dist/core/tools/shell-command-parser.d.ts.map +1 -0
- package/dist/core/tools/shell-command-parser.js +113 -0
- package/dist/core/tools/shell-command-parser.js.map +1 -0
- package/dist/core/tools/task-steps.d.ts +2 -0
- package/dist/core/tools/task-steps.d.ts.map +1 -1
- package/dist/core/tools/task-steps.js +99 -0
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/tmux-dispatch.d.ts +3 -5
- package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
- package/dist/core/tools/tmux-dispatch.js +4 -4
- package/dist/core/tools/tmux-dispatch.js.map +1 -1
- package/dist/core/tools/windows-shell-engine.d.ts.map +1 -1
- package/dist/core/tools/windows-shell-engine.js +4 -6
- package/dist/core/tools/windows-shell-engine.js.map +1 -1
- package/dist/core/util/atomic-file.d.ts +6 -2
- package/dist/core/util/atomic-file.d.ts.map +1 -1
- package/dist/core/util/atomic-file.js +4 -4
- package/dist/core/util/atomic-file.js.map +1 -1
- 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/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/store.d.ts +3 -3
- package/dist/core/worktree-sync/store.d.ts.map +1 -1
- package/dist/core/worktree-sync/store.js +10 -5
- package/dist/core/worktree-sync/store.js.map +1 -1
- package/dist/index.d.ts +15 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +149 -51
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +4 -6
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +186 -28
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.d.ts +4 -0
- package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.js +60 -1
- package/dist/modes/interactive/auth-dialogs-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/activity-lane.d.ts +55 -0
- package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -0
- package/dist/modes/interactive/components/activity-lane.js +304 -0
- package/dist/modes/interactive/components/activity-lane.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +19 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/expandable-text.d.ts +12 -0
- package/dist/modes/interactive/components/expandable-text.d.ts.map +1 -0
- package/dist/modes/interactive/components/expandable-text.js +17 -0
- package/dist/modes/interactive/components/expandable-text.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +15 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +30 -21
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +6 -1
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +23 -14
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +6 -6
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +19 -11
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +53 -20
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-group.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-group.js +3 -0
- package/dist/modes/interactive/components/tool-group.js.map +1 -1
- package/dist/modes/interactive/components/usage-action-selector.d.ts +16 -0
- package/dist/modes/interactive/components/usage-action-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/usage-action-selector.js +46 -0
- package/dist/modes/interactive/components/usage-action-selector.js.map +1 -0
- 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 +77 -15
- package/dist/modes/interactive/extension-ui-host.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts +15 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +27 -19
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/history-reload-math.d.ts +6 -2
- package/dist/modes/interactive/history-reload-math.d.ts.map +1 -1
- package/dist/modes/interactive/history-reload-math.js +10 -5
- package/dist/modes/interactive/history-reload-math.js.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.d.ts +74 -0
- package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-event-controller.js +328 -0
- package/dist/modes/interactive/interactive-event-controller.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +22 -24
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +245 -595
- 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/loaded-resources-view.d.ts +20 -0
- package/dist/modes/interactive/loaded-resources-view.d.ts.map +1 -0
- package/dist/modes/interactive/loaded-resources-view.js +147 -0
- package/dist/modes/interactive/loaded-resources-view.js.map +1 -0
- 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/resource-display.d.ts.map +1 -1
- package/dist/modes/interactive/resource-display.js +8 -2
- package/dist/modes/interactive/resource-display.js.map +1 -1
- package/dist/modes/interactive/resource-shell-commands.d.ts +1 -5
- package/dist/modes/interactive/resource-shell-commands.d.ts.map +1 -1
- package/dist/modes/interactive/resource-shell-commands.js +0 -5
- package/dist/modes/interactive/resource-shell-commands.js.map +1 -1
- package/dist/modes/interactive/session-flow-commands.d.ts +27 -8
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-flow-commands.js +150 -64
- 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/interactive/usage-commands.d.ts +34 -0
- package/dist/modes/interactive/usage-commands.d.ts.map +1 -0
- package/dist/modes/interactive/usage-commands.js +225 -0
- package/dist/modes/interactive/usage-commands.js.map +1 -0
- 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/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.map +1 -1
- package/dist/utils/shell.js +5 -3
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +3 -1
- package/dist/utils/version-check.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 +38 -0
- package/docs/UI_QUALITY_ORCHESTRATION.md +28 -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 +59 -26
- package/docs/providers.md +9 -1
- package/docs/rpc.md +45 -2
- package/docs/sessions.md +15 -0
- package/docs/settings.md +125 -11
- package/docs/task-steps.md +8 -0
- package/docs/telemetry.md +19 -0
- package/docs/tmux-agent-manager.md +10 -3
- package/docs/ui-reference/README.md +9 -0
- package/docs/ui-reference/orchestration-after.txt +14 -0
- package/docs/ui-reference/orchestration-before.txt +13 -0
- package/docs/ui-reference/orchestration-reference.txt +16 -0
- package/docs/usage.md +22 -2
- package/docs/work-directory.md +19 -8
- 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 +13 -13
- package/package.json +4 -4
- package/dist/core/delegation/session-worker-result.d.ts +0 -46
- package/dist/core/delegation/session-worker-result.d.ts.map +0 -1
- package/dist/core/delegation/session-worker-result.js +0 -113
- package/dist/core/delegation/session-worker-result.js.map +0 -1
- package/dist/core/delegation/worker-result.d.ts.map +0 -1
- 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
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import type { JsonObject } from "../autonomy/contracts.ts";
|
|
2
|
+
import { type HarnessCapability } from "../capability-contract.ts";
|
|
3
|
+
export { HARNESS_CAPABILITIES, type HarnessCapability } from "../capability-contract.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Versioned control-plane contracts. These records are the durable truth exchanged between the
|
|
6
|
+
* deterministic kernel/runtime and replaceable execution-plane workers. They deliberately do not
|
|
7
|
+
* contain callbacks, provider objects, tool implementations, or transcript messages.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ORCHESTRATION_SCHEMA_VERSION: 1;
|
|
10
|
+
export declare const WORKER_ROLES: readonly ["orchestrator", "planner", "explorer", "implementer", "operator", "verifier", "database"];
|
|
11
|
+
export type WorkerRole = (typeof WORKER_ROLES)[number];
|
|
12
|
+
export declare const ORCHESTRATION_THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"];
|
|
13
|
+
export type OrchestrationThinkingLevel = (typeof ORCHESTRATION_THINKING_LEVELS)[number];
|
|
14
|
+
export interface OrchestrationModelBinding {
|
|
15
|
+
provider: string;
|
|
16
|
+
modelId: string;
|
|
17
|
+
thinkingLevel: OrchestrationThinkingLevel;
|
|
18
|
+
}
|
|
19
|
+
export interface OrchestrationModelPolicy {
|
|
20
|
+
mode: "fixed" | "ordered-fallback";
|
|
21
|
+
candidates: readonly OrchestrationModelBinding[];
|
|
22
|
+
}
|
|
23
|
+
/** Constrained direct-argv launcher policy. This is allowlisting, not OS/container isolation. */
|
|
24
|
+
export interface OrchestrationExecutionPolicy {
|
|
25
|
+
allowedExecutables: readonly string[];
|
|
26
|
+
allowedEnvironmentVariables: readonly string[];
|
|
27
|
+
maxOutputBytes: number;
|
|
28
|
+
}
|
|
29
|
+
export declare const OBJECTIVE_STATUSES: readonly ["active", "paused", "completed", "cancelled"];
|
|
30
|
+
export type ObjectiveStatus = (typeof OBJECTIVE_STATUSES)[number];
|
|
31
|
+
export declare const TASK_STATUSES: readonly ["pending", "ready", "running", "blocked", "completed", "failed", "cancelled"];
|
|
32
|
+
export type OrchestrationTaskStatus = (typeof TASK_STATUSES)[number];
|
|
33
|
+
export declare const ATTEMPT_STATUSES: readonly ["queued", "leased", "running", "suspended", "completed", "partial", "blocked", "failed", "cancelled", "expired"];
|
|
34
|
+
export type AttemptStatus = (typeof ATTEMPT_STATUSES)[number];
|
|
35
|
+
export declare const WORKER_RESULT_STATUSES: readonly ["completed", "partial", "blocked", "failed", "cancelled"];
|
|
36
|
+
export type WorkerResultContractStatus = (typeof WORKER_RESULT_STATUSES)[number];
|
|
37
|
+
export type AgentBindingStatus = "registered" | "active" | "suspended" | "resuming" | "retired";
|
|
38
|
+
export interface AgentResumeContext {
|
|
39
|
+
provider: "pi" | "external";
|
|
40
|
+
sessionId: string;
|
|
41
|
+
sessionDir?: string;
|
|
42
|
+
sessionFile?: string;
|
|
43
|
+
cwd: string;
|
|
44
|
+
worktreeLaneKey?: string;
|
|
45
|
+
orchestrationProfileId?: string;
|
|
46
|
+
resourceProfileNames: readonly string[];
|
|
47
|
+
modelRef?: string;
|
|
48
|
+
contextPointers: readonly ResourcePointer[];
|
|
49
|
+
latestCheckpointId?: string;
|
|
50
|
+
}
|
|
51
|
+
/** Provider-neutral logical identity shared by durable orchestration and process supervision. */
|
|
52
|
+
export interface AgentIdentityContract {
|
|
53
|
+
agentId: string;
|
|
54
|
+
resumeContext: AgentResumeContext;
|
|
55
|
+
}
|
|
56
|
+
/** Durable logical identity. A replacement OS process resumes this same binding after interruption. */
|
|
57
|
+
export interface AgentBindingContract extends AgentIdentityContract {
|
|
58
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
59
|
+
role: WorkerRole;
|
|
60
|
+
status: AgentBindingStatus;
|
|
61
|
+
activeAttemptId?: string;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
}
|
|
65
|
+
export interface RiskBudget {
|
|
66
|
+
maxTokens?: number;
|
|
67
|
+
maxWallClockMs?: number;
|
|
68
|
+
maxCostUsd?: number;
|
|
69
|
+
maxAttempts?: number;
|
|
70
|
+
maxToolCalls?: number;
|
|
71
|
+
requireApprovalAboveCostUsd?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface AcceptanceCriterion {
|
|
74
|
+
id: string;
|
|
75
|
+
description: string;
|
|
76
|
+
required: boolean;
|
|
77
|
+
evaluator?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface ObjectiveContract {
|
|
80
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
81
|
+
objectiveId: string;
|
|
82
|
+
title: string;
|
|
83
|
+
description: string;
|
|
84
|
+
status: ObjectiveStatus;
|
|
85
|
+
constraints: readonly string[];
|
|
86
|
+
acceptanceCriteria: readonly AcceptanceCriterion[];
|
|
87
|
+
riskBudget: RiskBudget;
|
|
88
|
+
createdAt: string;
|
|
89
|
+
updatedAt: string;
|
|
90
|
+
}
|
|
91
|
+
export interface TaskContract {
|
|
92
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
93
|
+
taskId: string;
|
|
94
|
+
objectiveId: string;
|
|
95
|
+
title: string;
|
|
96
|
+
description: string;
|
|
97
|
+
role: WorkerRole;
|
|
98
|
+
status: OrchestrationTaskStatus;
|
|
99
|
+
dependsOn: readonly string[];
|
|
100
|
+
requiredCapabilities: readonly HarnessCapability[];
|
|
101
|
+
acceptanceCriterionIds: readonly string[];
|
|
102
|
+
/** Implementer task this verifier task must independently reconcile. */
|
|
103
|
+
verificationOfTaskId?: string;
|
|
104
|
+
riskBudget: RiskBudget;
|
|
105
|
+
createdAt: string;
|
|
106
|
+
updatedAt: string;
|
|
107
|
+
}
|
|
108
|
+
export declare const RESOURCE_POINTER_KINDS: readonly ["repository", "worktree", "artifact", "evidence", "memory-query", "skill", "prompt", "service"];
|
|
109
|
+
export type ResourcePointerKind = (typeof RESOURCE_POINTER_KINDS)[number];
|
|
110
|
+
export declare function isResourcePointerKind(value: unknown): value is ResourcePointerKind;
|
|
111
|
+
export interface ResourcePointer {
|
|
112
|
+
id: string;
|
|
113
|
+
kind: ResourcePointerKind;
|
|
114
|
+
uri: string;
|
|
115
|
+
readOnly: boolean;
|
|
116
|
+
digest?: string;
|
|
117
|
+
metadata?: JsonObject;
|
|
118
|
+
}
|
|
119
|
+
/** Lightweight metadata catalogued without importing the executable tool module. */
|
|
120
|
+
export interface ToolCapabilityManifest {
|
|
121
|
+
toolName: string;
|
|
122
|
+
moduleSpecifier: string;
|
|
123
|
+
capabilities: readonly HarnessCapability[];
|
|
124
|
+
roles: readonly WorkerRole[];
|
|
125
|
+
enforcements: readonly CapabilityEnforcementKind[];
|
|
126
|
+
sourcePath?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface OrchestrationProfile {
|
|
129
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
130
|
+
profileId: string;
|
|
131
|
+
description: string;
|
|
132
|
+
role: WorkerRole;
|
|
133
|
+
modelPolicy: OrchestrationModelPolicy;
|
|
134
|
+
capabilityCeiling: readonly HarnessCapability[];
|
|
135
|
+
toolNames: readonly string[];
|
|
136
|
+
resourceProfileNames: readonly string[];
|
|
137
|
+
/** Worker profiles this orchestrator may dispatch. Empty for non-orchestrator profiles. */
|
|
138
|
+
dispatchProfileIds: readonly string[];
|
|
139
|
+
executionPolicy?: OrchestrationExecutionPolicy;
|
|
140
|
+
budget: RiskBudget;
|
|
141
|
+
maxConcurrent: number;
|
|
142
|
+
leaseTtlMs: number;
|
|
143
|
+
requireIndependentVerification: boolean;
|
|
144
|
+
/** Owner-pinned verifier profile. Required when independent verification is enabled. */
|
|
145
|
+
verificationProfileId?: string;
|
|
146
|
+
/** Resolved origin retained for controlled improvements; omitted from authored JSON. */
|
|
147
|
+
sourcePath?: string;
|
|
148
|
+
createdAt: string;
|
|
149
|
+
updatedAt: string;
|
|
150
|
+
}
|
|
151
|
+
/** Admission-time worker profile materialization. Profile files are never consulted after this is persisted. */
|
|
152
|
+
export interface WorkerProfileExecutionContract {
|
|
153
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
154
|
+
profile: OrchestrationProfile;
|
|
155
|
+
modelBinding: OrchestrationModelBinding;
|
|
156
|
+
authority: WorkerExecutionAuthorityContract;
|
|
157
|
+
/** Resolved resource-profile identity text. Other worker resources are represented by profile tools. */
|
|
158
|
+
soul?: string;
|
|
159
|
+
}
|
|
160
|
+
/** Effective authority admitted for one materialized worker profile. */
|
|
161
|
+
export interface WorkerExecutionAuthorityContract {
|
|
162
|
+
capabilities: readonly HarnessCapability[];
|
|
163
|
+
toolNames: readonly string[];
|
|
164
|
+
readPaths: readonly string[];
|
|
165
|
+
writePaths: readonly string[];
|
|
166
|
+
deniedPaths: readonly string[];
|
|
167
|
+
budget: RiskBudget;
|
|
168
|
+
}
|
|
169
|
+
/** Immutable execution contract owned by the runtime, including any mandatory verifier. */
|
|
170
|
+
export interface WorkerExecutionContract {
|
|
171
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
172
|
+
worker: WorkerProfileExecutionContract;
|
|
173
|
+
verifier?: WorkerProfileExecutionContract;
|
|
174
|
+
}
|
|
175
|
+
/** The orchestrator may select only a profile and task; model/thinking fields are intentionally absent. */
|
|
176
|
+
export interface OrchestrationDispatchRequest {
|
|
177
|
+
taskId: string;
|
|
178
|
+
profileId: string;
|
|
179
|
+
instructions: string;
|
|
180
|
+
resourcePointerIds: readonly string[];
|
|
181
|
+
/** Execution owner. Omitted on legacy records and normalized to in-process. */
|
|
182
|
+
executionKind?: "in-process" | "managed-process";
|
|
183
|
+
/** Stable external lane identity shared by successive managed-process turns. */
|
|
184
|
+
logicalLaneId?: string;
|
|
185
|
+
/** Monotonic dispatch sequence within a managed-process logical lane. */
|
|
186
|
+
dispatchSequence?: number;
|
|
187
|
+
/** External provider identity retained for routing and diagnostics. */
|
|
188
|
+
provider?: string;
|
|
189
|
+
/** Owner approval or standing-grant record that authorized an external launch. */
|
|
190
|
+
authorizationId?: string;
|
|
191
|
+
/** Worktree-sync lane claimed by the external dispatcher. */
|
|
192
|
+
worktreeLaneKey?: string;
|
|
193
|
+
/** Runtime-owned immutable worker materialization. Never accepted from a model tool call. */
|
|
194
|
+
executionContract?: WorkerExecutionContract;
|
|
195
|
+
}
|
|
196
|
+
export type CapabilityEnforcementKind = "path-scope" | "process-launcher" | "service-proxy" | "memory-broker" | "control-plane";
|
|
197
|
+
export interface CapabilityDecision {
|
|
198
|
+
capability: HarnessCapability;
|
|
199
|
+
outcome: "allow" | "deny";
|
|
200
|
+
reasonCode: string;
|
|
201
|
+
source: string;
|
|
202
|
+
}
|
|
203
|
+
export interface ExecutionGrant {
|
|
204
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
205
|
+
grantId: string;
|
|
206
|
+
objectiveId: string;
|
|
207
|
+
taskId: string;
|
|
208
|
+
attemptId: string;
|
|
209
|
+
subjectId: string;
|
|
210
|
+
role: WorkerRole;
|
|
211
|
+
capabilities: readonly HarnessCapability[];
|
|
212
|
+
allowedTools: readonly string[];
|
|
213
|
+
resources: readonly ResourcePointer[];
|
|
214
|
+
readPaths: readonly string[];
|
|
215
|
+
writePaths: readonly string[];
|
|
216
|
+
deniedPaths: readonly string[];
|
|
217
|
+
budget: RiskBudget;
|
|
218
|
+
policyVersion: string;
|
|
219
|
+
decisionTrace: readonly CapabilityDecision[];
|
|
220
|
+
issuedAt: string;
|
|
221
|
+
expiresAt?: string;
|
|
222
|
+
}
|
|
223
|
+
export interface AttemptLease {
|
|
224
|
+
leaseId: string;
|
|
225
|
+
attemptId: string;
|
|
226
|
+
ownerId: string;
|
|
227
|
+
fencingToken: number;
|
|
228
|
+
issuedAt: string;
|
|
229
|
+
expiresAt: string;
|
|
230
|
+
}
|
|
231
|
+
export interface AttemptCheckpoint {
|
|
232
|
+
checkpointId: string;
|
|
233
|
+
attemptId: string;
|
|
234
|
+
fencingToken: number;
|
|
235
|
+
summary: string;
|
|
236
|
+
artifactIds: readonly string[];
|
|
237
|
+
evidenceIds: readonly string[];
|
|
238
|
+
createdAt: string;
|
|
239
|
+
}
|
|
240
|
+
export interface ArtifactContract {
|
|
241
|
+
artifactId: string;
|
|
242
|
+
kind: "diff" | "file" | "report" | "test-result" | "log" | "structured-data";
|
|
243
|
+
uri: string;
|
|
244
|
+
digest?: string;
|
|
245
|
+
sizeBytes?: number;
|
|
246
|
+
createdAt: string;
|
|
247
|
+
metadata?: JsonObject;
|
|
248
|
+
}
|
|
249
|
+
export interface EvidenceContract {
|
|
250
|
+
evidenceId: string;
|
|
251
|
+
criterionId?: string;
|
|
252
|
+
kind: "observation" | "command" | "test" | "review" | "external";
|
|
253
|
+
summary: string;
|
|
254
|
+
artifactIds: readonly string[];
|
|
255
|
+
trusted: boolean;
|
|
256
|
+
createdAt: string;
|
|
257
|
+
metadata?: JsonObject;
|
|
258
|
+
}
|
|
259
|
+
export interface WorkerErrorContract {
|
|
260
|
+
code: string;
|
|
261
|
+
message: string;
|
|
262
|
+
retryable: boolean;
|
|
263
|
+
details?: JsonObject;
|
|
264
|
+
}
|
|
265
|
+
export interface WorkerUsageContract {
|
|
266
|
+
inputTokens?: number;
|
|
267
|
+
outputTokens?: number;
|
|
268
|
+
totalTokens?: number;
|
|
269
|
+
costUsd?: number;
|
|
270
|
+
wallClockMs: number;
|
|
271
|
+
toolCalls: number;
|
|
272
|
+
}
|
|
273
|
+
export interface WorkerResultContract {
|
|
274
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
275
|
+
resultId: string;
|
|
276
|
+
objectiveId: string;
|
|
277
|
+
taskId: string;
|
|
278
|
+
attemptId: string;
|
|
279
|
+
leaseId: string;
|
|
280
|
+
fencingToken: number;
|
|
281
|
+
status: WorkerResultContractStatus;
|
|
282
|
+
reasonCode: string;
|
|
283
|
+
summary: string;
|
|
284
|
+
artifacts: readonly ArtifactContract[];
|
|
285
|
+
evidence: readonly EvidenceContract[];
|
|
286
|
+
errors: readonly WorkerErrorContract[];
|
|
287
|
+
nextAction?: string;
|
|
288
|
+
usage: WorkerUsageContract;
|
|
289
|
+
createdAt: string;
|
|
290
|
+
}
|
|
291
|
+
export interface ApprovalRequestContract {
|
|
292
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
293
|
+
approvalId: string;
|
|
294
|
+
objectiveId: string;
|
|
295
|
+
taskId?: string;
|
|
296
|
+
attemptId?: string;
|
|
297
|
+
reasonCode: string;
|
|
298
|
+
summary: string;
|
|
299
|
+
requestedCapabilities: readonly HarnessCapability[];
|
|
300
|
+
requestedBudget?: RiskBudget;
|
|
301
|
+
reversible: boolean;
|
|
302
|
+
createdAt: string;
|
|
303
|
+
}
|
|
304
|
+
export declare const APPROVAL_OUTCOMES: readonly ["approved", "rejected"];
|
|
305
|
+
export type ApprovalOutcome = (typeof APPROVAL_OUTCOMES)[number];
|
|
306
|
+
/** Human decision only. Approval is not an execution grant; policy must compile a new grant afterward. */
|
|
307
|
+
export interface ApprovalResolutionContract {
|
|
308
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
309
|
+
approvalId: string;
|
|
310
|
+
outcome: ApprovalOutcome;
|
|
311
|
+
reasonCode: string;
|
|
312
|
+
resolvedAt: string;
|
|
313
|
+
}
|
|
314
|
+
export declare const ORCHESTRATION_EVENT_TYPES: readonly ["objective.created", "objective.updated", "objective.evidence_recorded", "objective.paused", "objective.resumed", "objective.completed", "objective.cancelled", "task.created", "task.ready", "task.failed", "task.verification_finished", "agent.registered", "agent.suspended", "agent.resume_requested", "agent.resumed", "attempt.queued", "attempt.grant_bound", "attempt.leased", "attempt.started", "attempt.checkpointed", "attempt.suspended", "attempt.resumed", "attempt.cancelled", "attempt.finished", "attempt.lease_expired", "approval.requested", "approval.resolved", "notification.enqueued", "notification.delivered"];
|
|
315
|
+
export type OrchestrationEventType = (typeof ORCHESTRATION_EVENT_TYPES)[number];
|
|
316
|
+
export type OrchestrationActorKind = "human" | "kernel" | "runtime" | "policy" | "router" | "worker";
|
|
317
|
+
export interface OrchestrationEvent {
|
|
318
|
+
schemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;
|
|
319
|
+
ordinal: number;
|
|
320
|
+
eventId: string;
|
|
321
|
+
type: OrchestrationEventType;
|
|
322
|
+
aggregateId: string;
|
|
323
|
+
actor: OrchestrationActorKind;
|
|
324
|
+
occurredAt: string;
|
|
325
|
+
correlationId?: string;
|
|
326
|
+
causationId?: string;
|
|
327
|
+
idempotencyKey?: string;
|
|
328
|
+
payload: JsonObject;
|
|
329
|
+
}
|
|
330
|
+
export interface AppendOrchestrationEventInput {
|
|
331
|
+
type: OrchestrationEventType;
|
|
332
|
+
aggregateId: string;
|
|
333
|
+
actor: OrchestrationActorKind;
|
|
334
|
+
correlationId?: string;
|
|
335
|
+
causationId?: string;
|
|
336
|
+
idempotencyKey?: string;
|
|
337
|
+
payload: JsonObject;
|
|
338
|
+
}
|
|
339
|
+
export declare function isHarnessCapability(value: unknown): value is HarnessCapability;
|
|
340
|
+
/** Clone a runtime value into the persisted JSON domain, rejecting unsupported or over-deep data. */
|
|
341
|
+
export declare function toJsonObject(value: unknown): JsonObject;
|
|
342
|
+
export declare function isOrchestrationEvent(value: unknown): value is OrchestrationEvent;
|
|
343
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGzF,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEzF;;;;GAIG;AAEH,eAAO,MAAM,4BAA4B,GAAa,CAAC;AAEvD,eAAO,MAAM,YAAY,qGAQf,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,6BAA6B,+EAShC,CAAC;AACX,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAExF,MAAM,WAAW,yBAAyB;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,0BAA0B,CAAC;CAC1C;AAED,MAAM,WAAW,wBAAwB;IACxC,IAAI,EAAE,OAAO,GAAG,kBAAkB,CAAC;IACnC,UAAU,EAAE,SAAS,yBAAyB,EAAE,CAAC;CACjD;AAED,iGAAiG;AACjG,MAAM,WAAW,4BAA4B;IAC5C,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,2BAA2B,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,cAAc,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MA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IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,sBAAsB,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,UAAU,CAAC;CACpB;AAmBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAE9E;AAED,qGAAqG;AACrG,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAKvD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAiBhF","sourcesContent":["import type { JsonObject, JsonValue } from \"../autonomy/contracts.ts\";\nimport { HARNESS_CAPABILITIES, type HarnessCapability } from \"../capability-contract.ts\";\nimport { isPlainRecord } from \"../util/value-guards.ts\";\n\nexport { HARNESS_CAPABILITIES, type HarnessCapability } from \"../capability-contract.ts\";\n\n/**\n * Versioned control-plane contracts. These records are the durable truth exchanged between the\n * deterministic kernel/runtime and replaceable execution-plane workers. They deliberately do not\n * contain callbacks, provider objects, tool implementations, or transcript messages.\n */\n\nexport const ORCHESTRATION_SCHEMA_VERSION = 1 as const;\n\nexport const WORKER_ROLES = [\n\t\"orchestrator\",\n\t\"planner\",\n\t\"explorer\",\n\t\"implementer\",\n\t\"operator\",\n\t\"verifier\",\n\t\"database\",\n] as const;\nexport type WorkerRole = (typeof WORKER_ROLES)[number];\n\nexport const ORCHESTRATION_THINKING_LEVELS = [\n\t\"off\",\n\t\"minimal\",\n\t\"low\",\n\t\"medium\",\n\t\"high\",\n\t\"xhigh\",\n\t\"max\",\n\t\"ultra\",\n] as const;\nexport type OrchestrationThinkingLevel = (typeof ORCHESTRATION_THINKING_LEVELS)[number];\n\nexport interface OrchestrationModelBinding {\n\tprovider: string;\n\tmodelId: string;\n\tthinkingLevel: OrchestrationThinkingLevel;\n}\n\nexport interface OrchestrationModelPolicy {\n\tmode: \"fixed\" | \"ordered-fallback\";\n\tcandidates: readonly OrchestrationModelBinding[];\n}\n\n/** Constrained direct-argv launcher policy. This is allowlisting, not OS/container isolation. */\nexport interface OrchestrationExecutionPolicy {\n\tallowedExecutables: readonly string[];\n\tallowedEnvironmentVariables: readonly string[];\n\tmaxOutputBytes: number;\n}\n\nexport const OBJECTIVE_STATUSES = [\"active\", \"paused\", \"completed\", \"cancelled\"] as const;\nexport type ObjectiveStatus = (typeof OBJECTIVE_STATUSES)[number];\n\nexport const TASK_STATUSES = [\"pending\", \"ready\", \"running\", \"blocked\", \"completed\", \"failed\", \"cancelled\"] as const;\nexport type OrchestrationTaskStatus = (typeof TASK_STATUSES)[number];\n\nexport const ATTEMPT_STATUSES = [\n\t\"queued\",\n\t\"leased\",\n\t\"running\",\n\t\"suspended\",\n\t\"completed\",\n\t\"partial\",\n\t\"blocked\",\n\t\"failed\",\n\t\"cancelled\",\n\t\"expired\",\n] as const;\nexport type AttemptStatus = (typeof ATTEMPT_STATUSES)[number];\n\nexport const WORKER_RESULT_STATUSES = [\"completed\", \"partial\", \"blocked\", \"failed\", \"cancelled\"] as const;\nexport type WorkerResultContractStatus = (typeof WORKER_RESULT_STATUSES)[number];\n\nexport type AgentBindingStatus = \"registered\" | \"active\" | \"suspended\" | \"resuming\" | \"retired\";\n\nexport interface AgentResumeContext {\n\tprovider: \"pi\" | \"external\";\n\tsessionId: string;\n\tsessionDir?: string;\n\tsessionFile?: string;\n\tcwd: string;\n\tworktreeLaneKey?: string;\n\torchestrationProfileId?: string;\n\tresourceProfileNames: readonly string[];\n\tmodelRef?: string;\n\tcontextPointers: readonly ResourcePointer[];\n\tlatestCheckpointId?: string;\n}\n\n/** Provider-neutral logical identity shared by durable orchestration and process supervision. */\nexport interface AgentIdentityContract {\n\tagentId: string;\n\tresumeContext: AgentResumeContext;\n}\n\n/** Durable logical identity. A replacement OS process resumes this same binding after interruption. */\nexport interface AgentBindingContract extends AgentIdentityContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\trole: WorkerRole;\n\tstatus: AgentBindingStatus;\n\tactiveAttemptId?: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface RiskBudget {\n\tmaxTokens?: number;\n\tmaxWallClockMs?: number;\n\tmaxCostUsd?: number;\n\tmaxAttempts?: number;\n\tmaxToolCalls?: number;\n\trequireApprovalAboveCostUsd?: number;\n}\n\nexport interface AcceptanceCriterion {\n\tid: string;\n\tdescription: string;\n\trequired: boolean;\n\tevaluator?: string;\n}\n\nexport interface ObjectiveContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tobjectiveId: string;\n\ttitle: string;\n\tdescription: string;\n\tstatus: ObjectiveStatus;\n\tconstraints: readonly string[];\n\tacceptanceCriteria: readonly AcceptanceCriterion[];\n\triskBudget: RiskBudget;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface TaskContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\ttaskId: string;\n\tobjectiveId: string;\n\ttitle: string;\n\tdescription: string;\n\trole: WorkerRole;\n\tstatus: OrchestrationTaskStatus;\n\tdependsOn: readonly string[];\n\trequiredCapabilities: readonly HarnessCapability[];\n\tacceptanceCriterionIds: readonly string[];\n\t/** Implementer task this verifier task must independently reconcile. */\n\tverificationOfTaskId?: string;\n\triskBudget: RiskBudget;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport const RESOURCE_POINTER_KINDS = [\n\t\"repository\",\n\t\"worktree\",\n\t\"artifact\",\n\t\"evidence\",\n\t\"memory-query\",\n\t\"skill\",\n\t\"prompt\",\n\t\"service\",\n] as const;\nexport type ResourcePointerKind = (typeof RESOURCE_POINTER_KINDS)[number];\n\nexport function isResourcePointerKind(value: unknown): value is ResourcePointerKind {\n\treturn RESOURCE_POINTER_KINDS.some((kind) => kind === value);\n}\n\nexport interface ResourcePointer {\n\tid: string;\n\tkind: ResourcePointerKind;\n\turi: string;\n\treadOnly: boolean;\n\tdigest?: string;\n\tmetadata?: JsonObject;\n}\n\n/** Lightweight metadata catalogued without importing the executable tool module. */\nexport interface ToolCapabilityManifest {\n\ttoolName: string;\n\tmoduleSpecifier: string;\n\tcapabilities: readonly HarnessCapability[];\n\troles: readonly WorkerRole[];\n\tenforcements: readonly CapabilityEnforcementKind[];\n\tsourcePath?: string;\n}\n\nexport interface OrchestrationProfile {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tprofileId: string;\n\tdescription: string;\n\trole: WorkerRole;\n\tmodelPolicy: OrchestrationModelPolicy;\n\tcapabilityCeiling: readonly HarnessCapability[];\n\ttoolNames: readonly string[];\n\tresourceProfileNames: readonly string[];\n\t/** Worker profiles this orchestrator may dispatch. Empty for non-orchestrator profiles. */\n\tdispatchProfileIds: readonly string[];\n\texecutionPolicy?: OrchestrationExecutionPolicy;\n\tbudget: RiskBudget;\n\tmaxConcurrent: number;\n\tleaseTtlMs: number;\n\trequireIndependentVerification: boolean;\n\t/** Owner-pinned verifier profile. Required when independent verification is enabled. */\n\tverificationProfileId?: string;\n\t/** Resolved origin retained for controlled improvements; omitted from authored JSON. */\n\tsourcePath?: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\n/** Admission-time worker profile materialization. Profile files are never consulted after this is persisted. */\nexport interface WorkerProfileExecutionContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tprofile: OrchestrationProfile;\n\tmodelBinding: OrchestrationModelBinding;\n\tauthority: WorkerExecutionAuthorityContract;\n\t/** Resolved resource-profile identity text. Other worker resources are represented by profile tools. */\n\tsoul?: string;\n}\n\n/** Effective authority admitted for one materialized worker profile. */\nexport interface WorkerExecutionAuthorityContract {\n\tcapabilities: readonly HarnessCapability[];\n\ttoolNames: readonly string[];\n\treadPaths: readonly string[];\n\twritePaths: readonly string[];\n\tdeniedPaths: readonly string[];\n\tbudget: RiskBudget;\n}\n\n/** Immutable execution contract owned by the runtime, including any mandatory verifier. */\nexport interface WorkerExecutionContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tworker: WorkerProfileExecutionContract;\n\tverifier?: WorkerProfileExecutionContract;\n}\n\n/** The orchestrator may select only a profile and task; model/thinking fields are intentionally absent. */\nexport interface OrchestrationDispatchRequest {\n\ttaskId: string;\n\tprofileId: string;\n\tinstructions: string;\n\tresourcePointerIds: readonly string[];\n\t/** Execution owner. Omitted on legacy records and normalized to in-process. */\n\texecutionKind?: \"in-process\" | \"managed-process\";\n\t/** Stable external lane identity shared by successive managed-process turns. */\n\tlogicalLaneId?: string;\n\t/** Monotonic dispatch sequence within a managed-process logical lane. */\n\tdispatchSequence?: number;\n\t/** External provider identity retained for routing and diagnostics. */\n\tprovider?: string;\n\t/** Owner approval or standing-grant record that authorized an external launch. */\n\tauthorizationId?: string;\n\t/** Worktree-sync lane claimed by the external dispatcher. */\n\tworktreeLaneKey?: string;\n\t/** Runtime-owned immutable worker materialization. Never accepted from a model tool call. */\n\texecutionContract?: WorkerExecutionContract;\n}\n\nexport type CapabilityEnforcementKind =\n\t| \"path-scope\"\n\t| \"process-launcher\"\n\t| \"service-proxy\"\n\t| \"memory-broker\"\n\t| \"control-plane\";\n\nexport interface CapabilityDecision {\n\tcapability: HarnessCapability;\n\toutcome: \"allow\" | \"deny\";\n\treasonCode: string;\n\tsource: string;\n}\n\nexport interface ExecutionGrant {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tgrantId: string;\n\tobjectiveId: string;\n\ttaskId: string;\n\tattemptId: string;\n\tsubjectId: string;\n\trole: WorkerRole;\n\tcapabilities: readonly HarnessCapability[];\n\tallowedTools: readonly string[];\n\tresources: readonly ResourcePointer[];\n\treadPaths: readonly string[];\n\twritePaths: readonly string[];\n\tdeniedPaths: readonly string[];\n\tbudget: RiskBudget;\n\tpolicyVersion: string;\n\tdecisionTrace: readonly CapabilityDecision[];\n\tissuedAt: string;\n\texpiresAt?: string;\n}\n\nexport interface AttemptLease {\n\tleaseId: string;\n\tattemptId: string;\n\townerId: string;\n\tfencingToken: number;\n\tissuedAt: string;\n\texpiresAt: string;\n}\n\nexport interface AttemptCheckpoint {\n\tcheckpointId: string;\n\tattemptId: string;\n\tfencingToken: number;\n\tsummary: string;\n\tartifactIds: readonly string[];\n\tevidenceIds: readonly string[];\n\tcreatedAt: string;\n}\n\nexport interface ArtifactContract {\n\tartifactId: string;\n\tkind: \"diff\" | \"file\" | \"report\" | \"test-result\" | \"log\" | \"structured-data\";\n\turi: string;\n\tdigest?: string;\n\tsizeBytes?: number;\n\tcreatedAt: string;\n\tmetadata?: JsonObject;\n}\n\nexport interface EvidenceContract {\n\tevidenceId: string;\n\tcriterionId?: string;\n\tkind: \"observation\" | \"command\" | \"test\" | \"review\" | \"external\";\n\tsummary: string;\n\tartifactIds: readonly string[];\n\ttrusted: boolean;\n\tcreatedAt: string;\n\tmetadata?: JsonObject;\n}\n\nexport interface WorkerErrorContract {\n\tcode: string;\n\tmessage: string;\n\tretryable: boolean;\n\tdetails?: JsonObject;\n}\n\nexport interface WorkerUsageContract {\n\tinputTokens?: number;\n\toutputTokens?: number;\n\ttotalTokens?: number;\n\tcostUsd?: number;\n\twallClockMs: number;\n\ttoolCalls: number;\n}\n\nexport interface WorkerResultContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tresultId: string;\n\tobjectiveId: string;\n\ttaskId: string;\n\tattemptId: string;\n\tleaseId: string;\n\tfencingToken: number;\n\tstatus: WorkerResultContractStatus;\n\treasonCode: string;\n\tsummary: string;\n\tartifacts: readonly ArtifactContract[];\n\tevidence: readonly EvidenceContract[];\n\terrors: readonly WorkerErrorContract[];\n\tnextAction?: string;\n\tusage: WorkerUsageContract;\n\tcreatedAt: string;\n}\n\nexport interface ApprovalRequestContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tapprovalId: string;\n\tobjectiveId: string;\n\ttaskId?: string;\n\tattemptId?: string;\n\treasonCode: string;\n\tsummary: string;\n\trequestedCapabilities: readonly HarnessCapability[];\n\trequestedBudget?: RiskBudget;\n\treversible: boolean;\n\tcreatedAt: string;\n}\n\nexport const APPROVAL_OUTCOMES = [\"approved\", \"rejected\"] as const;\nexport type ApprovalOutcome = (typeof APPROVAL_OUTCOMES)[number];\n\n/** Human decision only. Approval is not an execution grant; policy must compile a new grant afterward. */\nexport interface ApprovalResolutionContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tapprovalId: string;\n\toutcome: ApprovalOutcome;\n\treasonCode: string;\n\tresolvedAt: string;\n}\n\nexport const ORCHESTRATION_EVENT_TYPES = [\n\t\"objective.created\",\n\t\"objective.updated\",\n\t\"objective.evidence_recorded\",\n\t\"objective.paused\",\n\t\"objective.resumed\",\n\t\"objective.completed\",\n\t\"objective.cancelled\",\n\t\"task.created\",\n\t\"task.ready\",\n\t\"task.failed\",\n\t\"task.verification_finished\",\n\t\"agent.registered\",\n\t\"agent.suspended\",\n\t\"agent.resume_requested\",\n\t\"agent.resumed\",\n\t\"attempt.queued\",\n\t\"attempt.grant_bound\",\n\t\"attempt.leased\",\n\t\"attempt.started\",\n\t\"attempt.checkpointed\",\n\t\"attempt.suspended\",\n\t\"attempt.resumed\",\n\t\"attempt.cancelled\",\n\t\"attempt.finished\",\n\t\"attempt.lease_expired\",\n\t\"approval.requested\",\n\t\"approval.resolved\",\n\t\"notification.enqueued\",\n\t\"notification.delivered\",\n] as const;\n\nexport type OrchestrationEventType = (typeof ORCHESTRATION_EVENT_TYPES)[number];\nexport type OrchestrationActorKind = \"human\" | \"kernel\" | \"runtime\" | \"policy\" | \"router\" | \"worker\";\n\nexport interface OrchestrationEvent {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tordinal: number;\n\teventId: string;\n\ttype: OrchestrationEventType;\n\taggregateId: string;\n\tactor: OrchestrationActorKind;\n\toccurredAt: string;\n\tcorrelationId?: string;\n\tcausationId?: string;\n\tidempotencyKey?: string;\n\tpayload: JsonObject;\n}\n\nexport interface AppendOrchestrationEventInput {\n\ttype: OrchestrationEventType;\n\taggregateId: string;\n\tactor: OrchestrationActorKind;\n\tcorrelationId?: string;\n\tcausationId?: string;\n\tidempotencyKey?: string;\n\tpayload: JsonObject;\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n\treturn typeof value === \"string\" && value.length > 0;\n}\n\nfunction isJsonValue(value: unknown, depth = 0): value is JsonValue {\n\tif (depth > 30) return false;\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return true;\n\tif (typeof value === \"number\") return Number.isFinite(value);\n\tif (Array.isArray(value)) return value.every((entry) => isJsonValue(entry, depth + 1));\n\tif (!isPlainRecord(value)) return false;\n\treturn Object.values(value).every((entry) => isJsonValue(entry, depth + 1));\n}\n\nfunction includesString<const T extends readonly string[]>(values: T, value: unknown): value is T[number] {\n\treturn typeof value === \"string\" && values.includes(value);\n}\n\nexport function isHarnessCapability(value: unknown): value is HarnessCapability {\n\treturn includesString(HARNESS_CAPABILITIES, value);\n}\n\n/** Clone a runtime value into the persisted JSON domain, rejecting unsupported or over-deep data. */\nexport function toJsonObject(value: unknown): JsonObject {\n\tif (!isPlainRecord(value) || !isJsonValue(value)) {\n\t\tthrow new TypeError(\"Value is not a valid orchestration JSON object.\");\n\t}\n\treturn structuredClone(value);\n}\n\nexport function isOrchestrationEvent(value: unknown): value is OrchestrationEvent {\n\tif (!isPlainRecord(value)) return false;\n\treturn (\n\t\tvalue.schemaVersion === ORCHESTRATION_SCHEMA_VERSION &&\n\t\tNumber.isSafeInteger(value.ordinal) &&\n\t\tNumber(value.ordinal) > 0 &&\n\t\tisNonEmptyString(value.eventId) &&\n\t\tincludesString(ORCHESTRATION_EVENT_TYPES, value.type) &&\n\t\tisNonEmptyString(value.aggregateId) &&\n\t\tincludesString([\"human\", \"kernel\", \"runtime\", \"policy\", \"router\", \"worker\"] as const, value.actor) &&\n\t\tisNonEmptyString(value.occurredAt) &&\n\t\t(value.correlationId === undefined || isNonEmptyString(value.correlationId)) &&\n\t\t(value.causationId === undefined || isNonEmptyString(value.causationId)) &&\n\t\t(value.idempotencyKey === undefined || isNonEmptyString(value.idempotencyKey)) &&\n\t\tisPlainRecord(value.payload) &&\n\t\tisJsonValue(value.payload)\n\t);\n}\n"]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { HARNESS_CAPABILITIES } from "../capability-contract.js";
|
|
2
|
+
import { isPlainRecord } from "../util/value-guards.js";
|
|
3
|
+
export { HARNESS_CAPABILITIES } from "../capability-contract.js";
|
|
4
|
+
/**
|
|
5
|
+
* Versioned control-plane contracts. These records are the durable truth exchanged between the
|
|
6
|
+
* deterministic kernel/runtime and replaceable execution-plane workers. They deliberately do not
|
|
7
|
+
* contain callbacks, provider objects, tool implementations, or transcript messages.
|
|
8
|
+
*/
|
|
9
|
+
export const ORCHESTRATION_SCHEMA_VERSION = 1;
|
|
10
|
+
export const WORKER_ROLES = [
|
|
11
|
+
"orchestrator",
|
|
12
|
+
"planner",
|
|
13
|
+
"explorer",
|
|
14
|
+
"implementer",
|
|
15
|
+
"operator",
|
|
16
|
+
"verifier",
|
|
17
|
+
"database",
|
|
18
|
+
];
|
|
19
|
+
export const ORCHESTRATION_THINKING_LEVELS = [
|
|
20
|
+
"off",
|
|
21
|
+
"minimal",
|
|
22
|
+
"low",
|
|
23
|
+
"medium",
|
|
24
|
+
"high",
|
|
25
|
+
"xhigh",
|
|
26
|
+
"max",
|
|
27
|
+
"ultra",
|
|
28
|
+
];
|
|
29
|
+
export const OBJECTIVE_STATUSES = ["active", "paused", "completed", "cancelled"];
|
|
30
|
+
export const TASK_STATUSES = ["pending", "ready", "running", "blocked", "completed", "failed", "cancelled"];
|
|
31
|
+
export const ATTEMPT_STATUSES = [
|
|
32
|
+
"queued",
|
|
33
|
+
"leased",
|
|
34
|
+
"running",
|
|
35
|
+
"suspended",
|
|
36
|
+
"completed",
|
|
37
|
+
"partial",
|
|
38
|
+
"blocked",
|
|
39
|
+
"failed",
|
|
40
|
+
"cancelled",
|
|
41
|
+
"expired",
|
|
42
|
+
];
|
|
43
|
+
export const WORKER_RESULT_STATUSES = ["completed", "partial", "blocked", "failed", "cancelled"];
|
|
44
|
+
export const RESOURCE_POINTER_KINDS = [
|
|
45
|
+
"repository",
|
|
46
|
+
"worktree",
|
|
47
|
+
"artifact",
|
|
48
|
+
"evidence",
|
|
49
|
+
"memory-query",
|
|
50
|
+
"skill",
|
|
51
|
+
"prompt",
|
|
52
|
+
"service",
|
|
53
|
+
];
|
|
54
|
+
export function isResourcePointerKind(value) {
|
|
55
|
+
return RESOURCE_POINTER_KINDS.some((kind) => kind === value);
|
|
56
|
+
}
|
|
57
|
+
export const APPROVAL_OUTCOMES = ["approved", "rejected"];
|
|
58
|
+
export const ORCHESTRATION_EVENT_TYPES = [
|
|
59
|
+
"objective.created",
|
|
60
|
+
"objective.updated",
|
|
61
|
+
"objective.evidence_recorded",
|
|
62
|
+
"objective.paused",
|
|
63
|
+
"objective.resumed",
|
|
64
|
+
"objective.completed",
|
|
65
|
+
"objective.cancelled",
|
|
66
|
+
"task.created",
|
|
67
|
+
"task.ready",
|
|
68
|
+
"task.failed",
|
|
69
|
+
"task.verification_finished",
|
|
70
|
+
"agent.registered",
|
|
71
|
+
"agent.suspended",
|
|
72
|
+
"agent.resume_requested",
|
|
73
|
+
"agent.resumed",
|
|
74
|
+
"attempt.queued",
|
|
75
|
+
"attempt.grant_bound",
|
|
76
|
+
"attempt.leased",
|
|
77
|
+
"attempt.started",
|
|
78
|
+
"attempt.checkpointed",
|
|
79
|
+
"attempt.suspended",
|
|
80
|
+
"attempt.resumed",
|
|
81
|
+
"attempt.cancelled",
|
|
82
|
+
"attempt.finished",
|
|
83
|
+
"attempt.lease_expired",
|
|
84
|
+
"approval.requested",
|
|
85
|
+
"approval.resolved",
|
|
86
|
+
"notification.enqueued",
|
|
87
|
+
"notification.delivered",
|
|
88
|
+
];
|
|
89
|
+
function isNonEmptyString(value) {
|
|
90
|
+
return typeof value === "string" && value.length > 0;
|
|
91
|
+
}
|
|
92
|
+
function isJsonValue(value, depth = 0) {
|
|
93
|
+
if (depth > 30)
|
|
94
|
+
return false;
|
|
95
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
96
|
+
return true;
|
|
97
|
+
if (typeof value === "number")
|
|
98
|
+
return Number.isFinite(value);
|
|
99
|
+
if (Array.isArray(value))
|
|
100
|
+
return value.every((entry) => isJsonValue(entry, depth + 1));
|
|
101
|
+
if (!isPlainRecord(value))
|
|
102
|
+
return false;
|
|
103
|
+
return Object.values(value).every((entry) => isJsonValue(entry, depth + 1));
|
|
104
|
+
}
|
|
105
|
+
function includesString(values, value) {
|
|
106
|
+
return typeof value === "string" && values.includes(value);
|
|
107
|
+
}
|
|
108
|
+
export function isHarnessCapability(value) {
|
|
109
|
+
return includesString(HARNESS_CAPABILITIES, value);
|
|
110
|
+
}
|
|
111
|
+
/** Clone a runtime value into the persisted JSON domain, rejecting unsupported or over-deep data. */
|
|
112
|
+
export function toJsonObject(value) {
|
|
113
|
+
if (!isPlainRecord(value) || !isJsonValue(value)) {
|
|
114
|
+
throw new TypeError("Value is not a valid orchestration JSON object.");
|
|
115
|
+
}
|
|
116
|
+
return structuredClone(value);
|
|
117
|
+
}
|
|
118
|
+
export function isOrchestrationEvent(value) {
|
|
119
|
+
if (!isPlainRecord(value))
|
|
120
|
+
return false;
|
|
121
|
+
return (value.schemaVersion === ORCHESTRATION_SCHEMA_VERSION &&
|
|
122
|
+
Number.isSafeInteger(value.ordinal) &&
|
|
123
|
+
Number(value.ordinal) > 0 &&
|
|
124
|
+
isNonEmptyString(value.eventId) &&
|
|
125
|
+
includesString(ORCHESTRATION_EVENT_TYPES, value.type) &&
|
|
126
|
+
isNonEmptyString(value.aggregateId) &&
|
|
127
|
+
includesString(["human", "kernel", "runtime", "policy", "router", "worker"], value.actor) &&
|
|
128
|
+
isNonEmptyString(value.occurredAt) &&
|
|
129
|
+
(value.correlationId === undefined || isNonEmptyString(value.correlationId)) &&
|
|
130
|
+
(value.causationId === undefined || isNonEmptyString(value.causationId)) &&
|
|
131
|
+
(value.idempotencyKey === undefined || isNonEmptyString(value.idempotencyKey)) &&
|
|
132
|
+
isPlainRecord(value.payload) &&
|
|
133
|
+
isJsonValue(value.payload));
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/core/orchestration/contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAA0B,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,oBAAoB,EAA0B,MAAM,2BAA2B,CAAC;AAEzF;;;;GAIG;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAU,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,cAAc;IACd,SAAS;IACT,UAAU;IACV,aAAa;IACb,UAAU;IACV,UAAU;IACV,UAAU;CACD,CAAC;AAGX,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC5C,KAAK;IACL,SAAS;IACT,KAAK;IACL,QAAQ;IACR,MAAM;IACN,OAAO;IACP,KAAK;IACL,OAAO;CACE,CAAC;AAqBX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAU,CAAC;AAG1F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAGrH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,WAAW;IACX,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,aAAa,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,CACN,KAAK,CAAC,aAAa,KAAK,4BAA4B;QACpD,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;QACnC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACzB,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC;QAC/B,cAAc,CAAC,yBAAyB,EAAE,KAAK,CAAC,IAAI,CAAC;QACrD,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC;QACnC,cAAc,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAU,EAAE,KAAK,CAAC,KAAK,CAAC;QAClG,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;QAClC,CAAC,KAAK,CAAC,aAAa,KAAK,SAAS,IAAI,gBAAgB,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAC5E,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACxE,CAAC,KAAK,CAAC,cAAc,KAAK,SAAS,IAAI,gBAAgB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC9E,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;QAC5B,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAC1B,CAAC;AAAA,CACF","sourcesContent":["import type { JsonObject, JsonValue } from \"../autonomy/contracts.ts\";\nimport { HARNESS_CAPABILITIES, type HarnessCapability } from \"../capability-contract.ts\";\nimport { isPlainRecord } from \"../util/value-guards.ts\";\n\nexport { HARNESS_CAPABILITIES, type HarnessCapability } from \"../capability-contract.ts\";\n\n/**\n * Versioned control-plane contracts. These records are the durable truth exchanged between the\n * deterministic kernel/runtime and replaceable execution-plane workers. They deliberately do not\n * contain callbacks, provider objects, tool implementations, or transcript messages.\n */\n\nexport const ORCHESTRATION_SCHEMA_VERSION = 1 as const;\n\nexport const WORKER_ROLES = [\n\t\"orchestrator\",\n\t\"planner\",\n\t\"explorer\",\n\t\"implementer\",\n\t\"operator\",\n\t\"verifier\",\n\t\"database\",\n] as const;\nexport type WorkerRole = (typeof WORKER_ROLES)[number];\n\nexport const ORCHESTRATION_THINKING_LEVELS = [\n\t\"off\",\n\t\"minimal\",\n\t\"low\",\n\t\"medium\",\n\t\"high\",\n\t\"xhigh\",\n\t\"max\",\n\t\"ultra\",\n] as const;\nexport type OrchestrationThinkingLevel = (typeof ORCHESTRATION_THINKING_LEVELS)[number];\n\nexport interface OrchestrationModelBinding {\n\tprovider: string;\n\tmodelId: string;\n\tthinkingLevel: OrchestrationThinkingLevel;\n}\n\nexport interface OrchestrationModelPolicy {\n\tmode: \"fixed\" | \"ordered-fallback\";\n\tcandidates: readonly OrchestrationModelBinding[];\n}\n\n/** Constrained direct-argv launcher policy. This is allowlisting, not OS/container isolation. */\nexport interface OrchestrationExecutionPolicy {\n\tallowedExecutables: readonly string[];\n\tallowedEnvironmentVariables: readonly string[];\n\tmaxOutputBytes: number;\n}\n\nexport const OBJECTIVE_STATUSES = [\"active\", \"paused\", \"completed\", \"cancelled\"] as const;\nexport type ObjectiveStatus = (typeof OBJECTIVE_STATUSES)[number];\n\nexport const TASK_STATUSES = [\"pending\", \"ready\", \"running\", \"blocked\", \"completed\", \"failed\", \"cancelled\"] as const;\nexport type OrchestrationTaskStatus = (typeof TASK_STATUSES)[number];\n\nexport const ATTEMPT_STATUSES = [\n\t\"queued\",\n\t\"leased\",\n\t\"running\",\n\t\"suspended\",\n\t\"completed\",\n\t\"partial\",\n\t\"blocked\",\n\t\"failed\",\n\t\"cancelled\",\n\t\"expired\",\n] as const;\nexport type AttemptStatus = (typeof ATTEMPT_STATUSES)[number];\n\nexport const WORKER_RESULT_STATUSES = [\"completed\", \"partial\", \"blocked\", \"failed\", \"cancelled\"] as const;\nexport type WorkerResultContractStatus = (typeof WORKER_RESULT_STATUSES)[number];\n\nexport type AgentBindingStatus = \"registered\" | \"active\" | \"suspended\" | \"resuming\" | \"retired\";\n\nexport interface AgentResumeContext {\n\tprovider: \"pi\" | \"external\";\n\tsessionId: string;\n\tsessionDir?: string;\n\tsessionFile?: string;\n\tcwd: string;\n\tworktreeLaneKey?: string;\n\torchestrationProfileId?: string;\n\tresourceProfileNames: readonly string[];\n\tmodelRef?: string;\n\tcontextPointers: readonly ResourcePointer[];\n\tlatestCheckpointId?: string;\n}\n\n/** Provider-neutral logical identity shared by durable orchestration and process supervision. */\nexport interface AgentIdentityContract {\n\tagentId: string;\n\tresumeContext: AgentResumeContext;\n}\n\n/** Durable logical identity. A replacement OS process resumes this same binding after interruption. */\nexport interface AgentBindingContract extends AgentIdentityContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\trole: WorkerRole;\n\tstatus: AgentBindingStatus;\n\tactiveAttemptId?: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface RiskBudget {\n\tmaxTokens?: number;\n\tmaxWallClockMs?: number;\n\tmaxCostUsd?: number;\n\tmaxAttempts?: number;\n\tmaxToolCalls?: number;\n\trequireApprovalAboveCostUsd?: number;\n}\n\nexport interface AcceptanceCriterion {\n\tid: string;\n\tdescription: string;\n\trequired: boolean;\n\tevaluator?: string;\n}\n\nexport interface ObjectiveContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tobjectiveId: string;\n\ttitle: string;\n\tdescription: string;\n\tstatus: ObjectiveStatus;\n\tconstraints: readonly string[];\n\tacceptanceCriteria: readonly AcceptanceCriterion[];\n\triskBudget: RiskBudget;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface TaskContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\ttaskId: string;\n\tobjectiveId: string;\n\ttitle: string;\n\tdescription: string;\n\trole: WorkerRole;\n\tstatus: OrchestrationTaskStatus;\n\tdependsOn: readonly string[];\n\trequiredCapabilities: readonly HarnessCapability[];\n\tacceptanceCriterionIds: readonly string[];\n\t/** Implementer task this verifier task must independently reconcile. */\n\tverificationOfTaskId?: string;\n\triskBudget: RiskBudget;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport const RESOURCE_POINTER_KINDS = [\n\t\"repository\",\n\t\"worktree\",\n\t\"artifact\",\n\t\"evidence\",\n\t\"memory-query\",\n\t\"skill\",\n\t\"prompt\",\n\t\"service\",\n] as const;\nexport type ResourcePointerKind = (typeof RESOURCE_POINTER_KINDS)[number];\n\nexport function isResourcePointerKind(value: unknown): value is ResourcePointerKind {\n\treturn RESOURCE_POINTER_KINDS.some((kind) => kind === value);\n}\n\nexport interface ResourcePointer {\n\tid: string;\n\tkind: ResourcePointerKind;\n\turi: string;\n\treadOnly: boolean;\n\tdigest?: string;\n\tmetadata?: JsonObject;\n}\n\n/** Lightweight metadata catalogued without importing the executable tool module. */\nexport interface ToolCapabilityManifest {\n\ttoolName: string;\n\tmoduleSpecifier: string;\n\tcapabilities: readonly HarnessCapability[];\n\troles: readonly WorkerRole[];\n\tenforcements: readonly CapabilityEnforcementKind[];\n\tsourcePath?: string;\n}\n\nexport interface OrchestrationProfile {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tprofileId: string;\n\tdescription: string;\n\trole: WorkerRole;\n\tmodelPolicy: OrchestrationModelPolicy;\n\tcapabilityCeiling: readonly HarnessCapability[];\n\ttoolNames: readonly string[];\n\tresourceProfileNames: readonly string[];\n\t/** Worker profiles this orchestrator may dispatch. Empty for non-orchestrator profiles. */\n\tdispatchProfileIds: readonly string[];\n\texecutionPolicy?: OrchestrationExecutionPolicy;\n\tbudget: RiskBudget;\n\tmaxConcurrent: number;\n\tleaseTtlMs: number;\n\trequireIndependentVerification: boolean;\n\t/** Owner-pinned verifier profile. Required when independent verification is enabled. */\n\tverificationProfileId?: string;\n\t/** Resolved origin retained for controlled improvements; omitted from authored JSON. */\n\tsourcePath?: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\n/** Admission-time worker profile materialization. Profile files are never consulted after this is persisted. */\nexport interface WorkerProfileExecutionContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tprofile: OrchestrationProfile;\n\tmodelBinding: OrchestrationModelBinding;\n\tauthority: WorkerExecutionAuthorityContract;\n\t/** Resolved resource-profile identity text. Other worker resources are represented by profile tools. */\n\tsoul?: string;\n}\n\n/** Effective authority admitted for one materialized worker profile. */\nexport interface WorkerExecutionAuthorityContract {\n\tcapabilities: readonly HarnessCapability[];\n\ttoolNames: readonly string[];\n\treadPaths: readonly string[];\n\twritePaths: readonly string[];\n\tdeniedPaths: readonly string[];\n\tbudget: RiskBudget;\n}\n\n/** Immutable execution contract owned by the runtime, including any mandatory verifier. */\nexport interface WorkerExecutionContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tworker: WorkerProfileExecutionContract;\n\tverifier?: WorkerProfileExecutionContract;\n}\n\n/** The orchestrator may select only a profile and task; model/thinking fields are intentionally absent. */\nexport interface OrchestrationDispatchRequest {\n\ttaskId: string;\n\tprofileId: string;\n\tinstructions: string;\n\tresourcePointerIds: readonly string[];\n\t/** Execution owner. Omitted on legacy records and normalized to in-process. */\n\texecutionKind?: \"in-process\" | \"managed-process\";\n\t/** Stable external lane identity shared by successive managed-process turns. */\n\tlogicalLaneId?: string;\n\t/** Monotonic dispatch sequence within a managed-process logical lane. */\n\tdispatchSequence?: number;\n\t/** External provider identity retained for routing and diagnostics. */\n\tprovider?: string;\n\t/** Owner approval or standing-grant record that authorized an external launch. */\n\tauthorizationId?: string;\n\t/** Worktree-sync lane claimed by the external dispatcher. */\n\tworktreeLaneKey?: string;\n\t/** Runtime-owned immutable worker materialization. Never accepted from a model tool call. */\n\texecutionContract?: WorkerExecutionContract;\n}\n\nexport type CapabilityEnforcementKind =\n\t| \"path-scope\"\n\t| \"process-launcher\"\n\t| \"service-proxy\"\n\t| \"memory-broker\"\n\t| \"control-plane\";\n\nexport interface CapabilityDecision {\n\tcapability: HarnessCapability;\n\toutcome: \"allow\" | \"deny\";\n\treasonCode: string;\n\tsource: string;\n}\n\nexport interface ExecutionGrant {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tgrantId: string;\n\tobjectiveId: string;\n\ttaskId: string;\n\tattemptId: string;\n\tsubjectId: string;\n\trole: WorkerRole;\n\tcapabilities: readonly HarnessCapability[];\n\tallowedTools: readonly string[];\n\tresources: readonly ResourcePointer[];\n\treadPaths: readonly string[];\n\twritePaths: readonly string[];\n\tdeniedPaths: readonly string[];\n\tbudget: RiskBudget;\n\tpolicyVersion: string;\n\tdecisionTrace: readonly CapabilityDecision[];\n\tissuedAt: string;\n\texpiresAt?: string;\n}\n\nexport interface AttemptLease {\n\tleaseId: string;\n\tattemptId: string;\n\townerId: string;\n\tfencingToken: number;\n\tissuedAt: string;\n\texpiresAt: string;\n}\n\nexport interface AttemptCheckpoint {\n\tcheckpointId: string;\n\tattemptId: string;\n\tfencingToken: number;\n\tsummary: string;\n\tartifactIds: readonly string[];\n\tevidenceIds: readonly string[];\n\tcreatedAt: string;\n}\n\nexport interface ArtifactContract {\n\tartifactId: string;\n\tkind: \"diff\" | \"file\" | \"report\" | \"test-result\" | \"log\" | \"structured-data\";\n\turi: string;\n\tdigest?: string;\n\tsizeBytes?: number;\n\tcreatedAt: string;\n\tmetadata?: JsonObject;\n}\n\nexport interface EvidenceContract {\n\tevidenceId: string;\n\tcriterionId?: string;\n\tkind: \"observation\" | \"command\" | \"test\" | \"review\" | \"external\";\n\tsummary: string;\n\tartifactIds: readonly string[];\n\ttrusted: boolean;\n\tcreatedAt: string;\n\tmetadata?: JsonObject;\n}\n\nexport interface WorkerErrorContract {\n\tcode: string;\n\tmessage: string;\n\tretryable: boolean;\n\tdetails?: JsonObject;\n}\n\nexport interface WorkerUsageContract {\n\tinputTokens?: number;\n\toutputTokens?: number;\n\ttotalTokens?: number;\n\tcostUsd?: number;\n\twallClockMs: number;\n\ttoolCalls: number;\n}\n\nexport interface WorkerResultContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tresultId: string;\n\tobjectiveId: string;\n\ttaskId: string;\n\tattemptId: string;\n\tleaseId: string;\n\tfencingToken: number;\n\tstatus: WorkerResultContractStatus;\n\treasonCode: string;\n\tsummary: string;\n\tartifacts: readonly ArtifactContract[];\n\tevidence: readonly EvidenceContract[];\n\terrors: readonly WorkerErrorContract[];\n\tnextAction?: string;\n\tusage: WorkerUsageContract;\n\tcreatedAt: string;\n}\n\nexport interface ApprovalRequestContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tapprovalId: string;\n\tobjectiveId: string;\n\ttaskId?: string;\n\tattemptId?: string;\n\treasonCode: string;\n\tsummary: string;\n\trequestedCapabilities: readonly HarnessCapability[];\n\trequestedBudget?: RiskBudget;\n\treversible: boolean;\n\tcreatedAt: string;\n}\n\nexport const APPROVAL_OUTCOMES = [\"approved\", \"rejected\"] as const;\nexport type ApprovalOutcome = (typeof APPROVAL_OUTCOMES)[number];\n\n/** Human decision only. Approval is not an execution grant; policy must compile a new grant afterward. */\nexport interface ApprovalResolutionContract {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tapprovalId: string;\n\toutcome: ApprovalOutcome;\n\treasonCode: string;\n\tresolvedAt: string;\n}\n\nexport const ORCHESTRATION_EVENT_TYPES = [\n\t\"objective.created\",\n\t\"objective.updated\",\n\t\"objective.evidence_recorded\",\n\t\"objective.paused\",\n\t\"objective.resumed\",\n\t\"objective.completed\",\n\t\"objective.cancelled\",\n\t\"task.created\",\n\t\"task.ready\",\n\t\"task.failed\",\n\t\"task.verification_finished\",\n\t\"agent.registered\",\n\t\"agent.suspended\",\n\t\"agent.resume_requested\",\n\t\"agent.resumed\",\n\t\"attempt.queued\",\n\t\"attempt.grant_bound\",\n\t\"attempt.leased\",\n\t\"attempt.started\",\n\t\"attempt.checkpointed\",\n\t\"attempt.suspended\",\n\t\"attempt.resumed\",\n\t\"attempt.cancelled\",\n\t\"attempt.finished\",\n\t\"attempt.lease_expired\",\n\t\"approval.requested\",\n\t\"approval.resolved\",\n\t\"notification.enqueued\",\n\t\"notification.delivered\",\n] as const;\n\nexport type OrchestrationEventType = (typeof ORCHESTRATION_EVENT_TYPES)[number];\nexport type OrchestrationActorKind = \"human\" | \"kernel\" | \"runtime\" | \"policy\" | \"router\" | \"worker\";\n\nexport interface OrchestrationEvent {\n\tschemaVersion: typeof ORCHESTRATION_SCHEMA_VERSION;\n\tordinal: number;\n\teventId: string;\n\ttype: OrchestrationEventType;\n\taggregateId: string;\n\tactor: OrchestrationActorKind;\n\toccurredAt: string;\n\tcorrelationId?: string;\n\tcausationId?: string;\n\tidempotencyKey?: string;\n\tpayload: JsonObject;\n}\n\nexport interface AppendOrchestrationEventInput {\n\ttype: OrchestrationEventType;\n\taggregateId: string;\n\tactor: OrchestrationActorKind;\n\tcorrelationId?: string;\n\tcausationId?: string;\n\tidempotencyKey?: string;\n\tpayload: JsonObject;\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n\treturn typeof value === \"string\" && value.length > 0;\n}\n\nfunction isJsonValue(value: unknown, depth = 0): value is JsonValue {\n\tif (depth > 30) return false;\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return true;\n\tif (typeof value === \"number\") return Number.isFinite(value);\n\tif (Array.isArray(value)) return value.every((entry) => isJsonValue(entry, depth + 1));\n\tif (!isPlainRecord(value)) return false;\n\treturn Object.values(value).every((entry) => isJsonValue(entry, depth + 1));\n}\n\nfunction includesString<const T extends readonly string[]>(values: T, value: unknown): value is T[number] {\n\treturn typeof value === \"string\" && values.includes(value);\n}\n\nexport function isHarnessCapability(value: unknown): value is HarnessCapability {\n\treturn includesString(HARNESS_CAPABILITIES, value);\n}\n\n/** Clone a runtime value into the persisted JSON domain, rejecting unsupported or over-deep data. */\nexport function toJsonObject(value: unknown): JsonObject {\n\tif (!isPlainRecord(value) || !isJsonValue(value)) {\n\t\tthrow new TypeError(\"Value is not a valid orchestration JSON object.\");\n\t}\n\treturn structuredClone(value);\n}\n\nexport function isOrchestrationEvent(value: unknown): value is OrchestrationEvent {\n\tif (!isPlainRecord(value)) return false;\n\treturn (\n\t\tvalue.schemaVersion === ORCHESTRATION_SCHEMA_VERSION &&\n\t\tNumber.isSafeInteger(value.ordinal) &&\n\t\tNumber(value.ordinal) > 0 &&\n\t\tisNonEmptyString(value.eventId) &&\n\t\tincludesString(ORCHESTRATION_EVENT_TYPES, value.type) &&\n\t\tisNonEmptyString(value.aggregateId) &&\n\t\tincludesString([\"human\", \"kernel\", \"runtime\", \"policy\", \"router\", \"worker\"] as const, value.actor) &&\n\t\tisNonEmptyString(value.occurredAt) &&\n\t\t(value.correlationId === undefined || isNonEmptyString(value.correlationId)) &&\n\t\t(value.causationId === undefined || isNonEmptyString(value.causationId)) &&\n\t\t(value.idempotencyKey === undefined || isNonEmptyString(value.idempotencyKey)) &&\n\t\tisPlainRecord(value.payload) &&\n\t\tisJsonValue(value.payload)\n\t);\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { GoalState } from "../goals/goal-state.ts";
|
|
2
|
+
import type { HarnessCapability, RiskBudget, WorkerExecutionContract, WorkerRole } from "./contracts.ts";
|
|
3
|
+
import { type AttemptRuntimeState, DurableTaskRuntime } from "./task-runtime.ts";
|
|
4
|
+
export interface DelegationLedgerOptions {
|
|
5
|
+
agentDir: string;
|
|
6
|
+
sessionId: string;
|
|
7
|
+
now?: () => number;
|
|
8
|
+
}
|
|
9
|
+
export interface PrepareDelegationInput {
|
|
10
|
+
laneId: string;
|
|
11
|
+
instructions: string;
|
|
12
|
+
executionContract: WorkerExecutionContract;
|
|
13
|
+
requiredCapabilities: readonly HarnessCapability[];
|
|
14
|
+
goal?: GoalState;
|
|
15
|
+
verificationOfTaskId?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PrepareManagedDelegationInput {
|
|
18
|
+
laneId: string;
|
|
19
|
+
dispatchSequence: number;
|
|
20
|
+
instructions: string;
|
|
21
|
+
profileId: string;
|
|
22
|
+
provider: string;
|
|
23
|
+
authorizationId: string;
|
|
24
|
+
role: WorkerRole;
|
|
25
|
+
riskBudget: RiskBudget;
|
|
26
|
+
goal?: GoalState;
|
|
27
|
+
goalId?: string;
|
|
28
|
+
worktreeLaneKey?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface StartedDelegationAttempt {
|
|
31
|
+
objectiveId: string;
|
|
32
|
+
taskId: string;
|
|
33
|
+
attemptId: string;
|
|
34
|
+
leaseId: string;
|
|
35
|
+
fencingToken: number;
|
|
36
|
+
expiresAt: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Durable adapter for in-process delegated completions. It records the dispatch before execution,
|
|
40
|
+
* fences interrupted completions on restart, and returns queued work for event-driven re-dispatch.
|
|
41
|
+
* It deliberately does not pretend an isolated completion has a resumable model transcript.
|
|
42
|
+
*/
|
|
43
|
+
export declare class DelegationOrchestrationLedger {
|
|
44
|
+
readonly runtime: DurableTaskRuntime;
|
|
45
|
+
private readonly sessionId;
|
|
46
|
+
constructor(options: DelegationLedgerOptions);
|
|
47
|
+
prepare(input: PrepareDelegationInput): AttemptRuntimeState;
|
|
48
|
+
prepareManaged(input: PrepareManagedDelegationInput): AttemptRuntimeState;
|
|
49
|
+
private prepareNormalized;
|
|
50
|
+
synchronizeGoalState(goal: GoalState): void;
|
|
51
|
+
start(attemptId: string, leaseTtlMs: number, ownerId?: string): StartedDelegationAttempt;
|
|
52
|
+
cancel(attemptId: string, reasonCode: string): void;
|
|
53
|
+
/** Fence interrupted isolated completions and queue one replacement attempt per task. */
|
|
54
|
+
recoverQueuedDispatches(): AttemptRuntimeState[];
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=delegation-ledger.d.ts.map
|