@caupulican/pi-adaptative 0.94.0 → 0.95.0
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 +55 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/README.md +32 -13
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +7 -4
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +173 -293
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +247 -392
- package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.d.ts +52 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.d.ts.map +1 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.js +118 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.js.map +1 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.ts +169 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/templates/builder-validator.json +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/templates/provider-prompt-smoke.json +1 -1
- package/dist/bundled-resources/skills/pi-harness-learning/SKILL.md +13 -7
- package/dist/bundled-resources/skills/worker-profile-writer/SKILL.md +11 -11
- package/dist/core/agent-paths.d.ts +2 -0
- package/dist/core/agent-paths.d.ts.map +1 -1
- package/dist/core/agent-paths.js +7 -0
- package/dist/core/agent-paths.js.map +1 -1
- package/dist/core/agent-session.d.ts +11 -41
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +98 -161
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/envelope-enforcement.d.ts +6 -1
- package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
- package/dist/core/autonomy/envelope-enforcement.js +26 -25
- package/dist/core/autonomy/envelope-enforcement.js.map +1 -1
- package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -1
- package/dist/core/autonomy/lane-private-paths.js +2 -1
- package/dist/core/autonomy/lane-private-paths.js.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.d.ts +8 -8
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +45 -30
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/autonomy/worker-session-private-scope.d.ts +12 -0
- package/dist/core/autonomy/worker-session-private-scope.d.ts.map +1 -0
- package/dist/core/autonomy/worker-session-private-scope.js +42 -0
- package/dist/core/autonomy/worker-session-private-scope.js.map +1 -0
- package/dist/core/autonomy/worker-tool-adapter-registry.d.ts +65 -0
- package/dist/core/autonomy/worker-tool-adapter-registry.d.ts.map +1 -0
- package/dist/core/autonomy/worker-tool-adapter-registry.js +145 -0
- package/dist/core/autonomy/worker-tool-adapter-registry.js.map +1 -0
- package/dist/core/background-lane-controller.d.ts +9 -1
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +76 -6
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/background-tool-task-controller.d.ts +23 -2
- package/dist/core/background-tool-task-controller.d.ts.map +1 -1
- package/dist/core/background-tool-task-controller.js +132 -17
- package/dist/core/background-tool-task-controller.js.map +1 -1
- package/dist/core/context/long-term-memory-trigger.d.ts +3 -1
- package/dist/core/context/long-term-memory-trigger.d.ts.map +1 -1
- package/dist/core/context/long-term-memory-trigger.js +1 -1
- package/dist/core/context/long-term-memory-trigger.js.map +1 -1
- package/dist/core/context/okf-memory-provider.d.ts +3 -0
- package/dist/core/context/okf-memory-provider.d.ts.map +1 -1
- package/dist/core/context/okf-memory-provider.js +66 -31
- package/dist/core/context/okf-memory-provider.js.map +1 -1
- package/dist/core/context/okf-memory.d.ts +18 -1
- package/dist/core/context/okf-memory.d.ts.map +1 -1
- package/dist/core/context/okf-memory.js +48 -0
- package/dist/core/context/okf-memory.js.map +1 -1
- package/dist/core/cost-guard-controller.d.ts +37 -0
- package/dist/core/cost-guard-controller.d.ts.map +1 -0
- package/dist/core/cost-guard-controller.js +71 -0
- package/dist/core/cost-guard-controller.js.map +1 -0
- package/dist/core/cost-guard.d.ts +9 -4
- package/dist/core/cost-guard.d.ts.map +1 -1
- package/dist/core/cost-guard.js +7 -3
- package/dist/core/cost-guard.js.map +1 -1
- package/dist/core/delegation/worker-agent-control.d.ts +4 -0
- package/dist/core/delegation/worker-agent-control.d.ts.map +1 -1
- package/dist/core/delegation/worker-agent-control.js.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.d.ts +1 -1
- package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.js +0 -1
- package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
- package/dist/core/delegation/worker-authority-resolver.d.ts +16 -3
- package/dist/core/delegation/worker-authority-resolver.d.ts.map +1 -1
- package/dist/core/delegation/worker-authority-resolver.js +114 -55
- package/dist/core/delegation/worker-authority-resolver.js.map +1 -1
- package/dist/core/delegation/worker-claim.d.ts +1 -2
- package/dist/core/delegation/worker-claim.d.ts.map +1 -1
- package/dist/core/delegation/worker-claim.js.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.d.ts +19 -6
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.js +125 -40
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
- package/dist/core/delegation/worker-delegation-request.d.ts +3 -3
- package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-request.js +13 -19
- package/dist/core/delegation/worker-delegation-request.js.map +1 -1
- package/dist/core/delegation/worker-execution-policy.d.ts +3 -2
- package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
- package/dist/core/delegation/worker-execution-policy.js +54 -39
- package/dist/core/delegation/worker-execution-policy.js.map +1 -1
- package/dist/core/delegation/worker-fleet-limits.d.ts +3 -3
- package/dist/core/delegation/worker-fleet-limits.d.ts.map +1 -1
- package/dist/core/delegation/worker-fleet-limits.js +7 -7
- package/dist/core/delegation/worker-fleet-limits.js.map +1 -1
- package/dist/core/delegation/worker-machine-scope.d.ts +12 -0
- package/dist/core/delegation/worker-machine-scope.d.ts.map +1 -0
- package/dist/core/delegation/worker-machine-scope.js +38 -0
- package/dist/core/delegation/worker-machine-scope.js.map +1 -0
- package/dist/core/delegation/worker-notification-coordinator.d.ts +10 -0
- package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-notification-coordinator.js +69 -3
- package/dist/core/delegation/worker-notification-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-recovery-coordinator.js +6 -1
- package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-runner.d.ts +5 -7
- package/dist/core/delegation/worker-runner.d.ts.map +1 -1
- package/dist/core/delegation/worker-runner.js +1 -4
- package/dist/core/delegation/worker-runner.js.map +1 -1
- package/dist/core/delegation/worker-write-reservation-coordinator.d.ts +3 -2
- package/dist/core/delegation/worker-write-reservation-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-write-reservation-coordinator.js +50 -25
- package/dist/core/delegation/worker-write-reservation-coordinator.js.map +1 -1
- package/dist/core/durable-custom-message-turn-controller.d.ts +6 -0
- package/dist/core/durable-custom-message-turn-controller.d.ts.map +1 -1
- package/dist/core/durable-custom-message-turn-controller.js +38 -15
- package/dist/core/durable-custom-message-turn-controller.js.map +1 -1
- package/dist/core/extension-binding-controller.d.ts +5 -1
- package/dist/core/extension-binding-controller.d.ts.map +1 -1
- package/dist/core/extension-binding-controller.js +15 -0
- package/dist/core/extension-binding-controller.js.map +1 -1
- package/dist/core/extensions/factory-runtime.d.ts.map +1 -1
- package/dist/core/extensions/factory-runtime.js +5 -0
- package/dist/core/extensions/factory-runtime.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +8 -4
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/foreground-terminal-handoff-controller.d.ts +31 -0
- package/dist/core/foreground-terminal-handoff-controller.d.ts.map +1 -1
- package/dist/core/foreground-terminal-handoff-controller.js +239 -55
- package/dist/core/foreground-terminal-handoff-controller.js.map +1 -1
- package/dist/core/goals/goal-session-controller.d.ts +2 -0
- package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-session-controller.js +8 -0
- package/dist/core/goals/goal-session-controller.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts +5 -4
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +23 -19
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/learning/auto-learn-settings.d.ts +84 -0
- package/dist/core/learning/auto-learn-settings.d.ts.map +1 -0
- package/dist/core/learning/auto-learn-settings.js +66 -0
- package/dist/core/learning/auto-learn-settings.js.map +1 -0
- package/dist/core/learning/learning-audit.d.ts +5 -1
- package/dist/core/learning/learning-audit.d.ts.map +1 -1
- package/dist/core/learning/learning-audit.js +32 -1
- package/dist/core/learning/learning-audit.js.map +1 -1
- package/dist/core/learning/reflection-engine.d.ts +24 -0
- package/dist/core/learning/reflection-engine.d.ts.map +1 -1
- package/dist/core/learning/reflection-engine.js +104 -8
- package/dist/core/learning/reflection-engine.js.map +1 -1
- package/dist/core/local-prefix-warm-controller.d.ts +24 -0
- package/dist/core/local-prefix-warm-controller.d.ts.map +1 -0
- package/dist/core/local-prefix-warm-controller.js +79 -0
- package/dist/core/local-prefix-warm-controller.js.map +1 -0
- package/dist/core/memory/okf-project-memory-store.d.ts +28 -0
- package/dist/core/memory/okf-project-memory-store.d.ts.map +1 -0
- package/dist/core/memory/okf-project-memory-store.js +111 -0
- package/dist/core/memory/okf-project-memory-store.js.map +1 -0
- package/dist/core/memory/providers/file-store.d.ts +44 -1
- package/dist/core/memory/providers/file-store.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.js +341 -24
- package/dist/core/memory/providers/file-store.js.map +1 -1
- package/dist/core/memory/worker-memory-tools.d.ts +5 -0
- package/dist/core/memory/worker-memory-tools.d.ts.map +1 -0
- package/dist/core/memory/worker-memory-tools.js +5 -0
- package/dist/core/memory/worker-memory-tools.js.map +1 -0
- package/dist/core/memory-controller.d.ts +10 -1
- package/dist/core/memory-controller.d.ts.map +1 -1
- package/dist/core/memory-controller.js +72 -8
- package/dist/core/memory-controller.js.map +1 -1
- package/dist/core/model-capability.d.ts +7 -0
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +12 -0
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +2 -10
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +3 -2
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +3 -2
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/orchestration/contracts.d.ts +16 -12
- package/dist/core/orchestration/contracts.d.ts.map +1 -1
- package/dist/core/orchestration/contracts.js +2 -2
- package/dist/core/orchestration/contracts.js.map +1 -1
- package/dist/core/orchestration/lane-tool-manifests.d.ts +2 -2
- package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -1
- package/dist/core/orchestration/lane-tool-manifests.js +6 -1
- package/dist/core/orchestration/lane-tool-manifests.js.map +1 -1
- package/dist/core/orchestration/profile-registry.d.ts.map +1 -1
- package/dist/core/orchestration/profile-registry.js +14 -0
- package/dist/core/orchestration/profile-registry.js.map +1 -1
- package/dist/core/orchestration/task-profile-writer.d.ts +7 -4
- package/dist/core/orchestration/task-profile-writer.d.ts.map +1 -1
- package/dist/core/orchestration/task-profile-writer.js +71 -59
- package/dist/core/orchestration/task-profile-writer.js.map +1 -1
- package/dist/core/orchestration/thinking-level-schema.d.ts +7 -0
- package/dist/core/orchestration/thinking-level-schema.d.ts.map +1 -0
- package/dist/core/orchestration/thinking-level-schema.js +19 -0
- package/dist/core/orchestration/thinking-level-schema.js.map +1 -0
- package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
- package/dist/core/orchestration/worker-execution-contract.js +12 -5
- package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
- package/dist/core/provider-prompt-contracts.d.ts +1 -4
- package/dist/core/provider-prompt-contracts.d.ts.map +1 -1
- package/dist/core/provider-prompt-contracts.js +13 -29
- package/dist/core/provider-prompt-contracts.js.map +1 -1
- package/dist/core/provider-request-context-controller.d.ts +2 -0
- package/dist/core/provider-request-context-controller.d.ts.map +1 -1
- package/dist/core/provider-request-context-controller.js +10 -3
- package/dist/core/provider-request-context-controller.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +63 -27
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +300 -132
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/runtime-builder.d.ts +1 -0
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +25 -14
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -1
- package/dist/core/secrets/credential-exposure-guard.js +55 -10
- package/dist/core/secrets/credential-exposure-guard.js.map +1 -1
- package/dist/core/session-role.d.ts +6 -8
- package/dist/core/session-role.d.ts.map +1 -1
- package/dist/core/session-role.js +8 -18
- package/dist/core/session-role.js.map +1 -1
- package/dist/core/settings-manager.d.ts +13 -16
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +53 -50
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skill-vault.d.ts +15 -0
- package/dist/core/skill-vault.d.ts.map +1 -1
- package/dist/core/skill-vault.js +79 -45
- package/dist/core/skill-vault.js.map +1 -1
- package/dist/core/skills.d.ts +3 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -6
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +2 -0
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.js +52 -12
- package/dist/core/system-prompt-builder.js.map +1 -1
- package/dist/core/system-prompt.js +1 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tool-capability-policy.d.ts +3 -0
- package/dist/core/tool-capability-policy.d.ts.map +1 -1
- package/dist/core/tool-capability-policy.js +13 -2
- package/dist/core/tool-capability-policy.js.map +1 -1
- package/dist/core/toolkit/script-runner.d.ts +2 -1
- package/dist/core/toolkit/script-runner.d.ts.map +1 -1
- package/dist/core/toolkit/script-runner.js +10 -2
- package/dist/core/toolkit/script-runner.js.map +1 -1
- package/dist/core/tools/delegate-status.d.ts +3 -1
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +5 -1
- package/dist/core/tools/delegate-status.js.map +1 -1
- package/dist/core/tools/delegate.d.ts +4 -13
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +173 -73
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/goal.d.ts +3 -4
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +24 -7
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/profile-writer.d.ts +2 -8
- package/dist/core/tools/profile-writer.d.ts.map +1 -1
- package/dist/core/tools/profile-writer.js +6 -18
- package/dist/core/tools/profile-writer.js.map +1 -1
- package/dist/core/tools/run-toolkit-script.d.ts +1 -1
- package/dist/core/tools/run-toolkit-script.d.ts.map +1 -1
- package/dist/core/tools/run-toolkit-script.js +2 -2
- package/dist/core/tools/run-toolkit-script.js.map +1 -1
- package/dist/core/tools/skill-audit.d.ts +28 -1
- package/dist/core/tools/skill-audit.d.ts.map +1 -1
- package/dist/core/tools/skill-audit.js +56 -12
- package/dist/core/tools/skill-audit.js.map +1 -1
- package/dist/core/tools/skill.d.ts +12 -1
- package/dist/core/tools/skill.d.ts.map +1 -1
- package/dist/core/tools/skill.js +52 -0
- package/dist/core/tools/skill.js.map +1 -1
- package/dist/core/tools/skillify.d.ts.map +1 -1
- package/dist/core/tools/skillify.js +16 -7
- package/dist/core/tools/skillify.js.map +1 -1
- package/dist/core/tools/task-steps.js +1 -1
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/tmux-dispatch.d.ts +4 -16
- package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
- package/dist/core/tools/tmux-dispatch.js +5 -20
- package/dist/core/tools/tmux-dispatch.js.map +1 -1
- package/dist/core/tools/tool-task.d.ts +1 -0
- package/dist/core/tools/tool-task.d.ts.map +1 -1
- package/dist/core/tools/tool-task.js +13 -8
- package/dist/core/tools/tool-task.js.map +1 -1
- package/dist/core/util/atomic-file.d.ts +2 -0
- package/dist/core/util/atomic-file.d.ts.map +1 -1
- package/dist/core/util/atomic-file.js +4 -0
- package/dist/core/util/atomic-file.js.map +1 -1
- package/dist/core/worktree-sync/codes.d.ts +1 -2
- package/dist/core/worktree-sync/codes.d.ts.map +1 -1
- package/dist/core/worktree-sync/codes.js +1 -2
- package/dist/core/worktree-sync/codes.js.map +1 -1
- package/dist/core/worktree-sync/lane-gate.d.ts +4 -8
- package/dist/core/worktree-sync/lane-gate.d.ts.map +1 -1
- package/dist/core/worktree-sync/lane-gate.js +5 -51
- package/dist/core/worktree-sync/lane-gate.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.d.ts +6 -7
- package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.js +32 -207
- package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
- package/dist/modes/interactive/autonomy-commands.js +2 -2
- package/dist/modes/interactive/autonomy-commands.js.map +1 -1
- package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -1
- package/dist/modes/interactive/components/activity-lane.js +12 -23
- package/dist/modes/interactive/components/activity-lane.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +142 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/fitness-role-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/fitness-role-selector.js +2 -2
- package/dist/modes/interactive/components/fitness-role-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +150 -73
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/report-commands.d.ts.map +1 -1
- package/dist/modes/interactive/report-commands.js +8 -4
- package/dist/modes/interactive/report-commands.js.map +1 -1
- package/dist/modes/interactive/settings-selector-flow.d.ts.map +1 -1
- package/dist/modes/interactive/settings-selector-flow.js +10 -0
- package/dist/modes/interactive/settings-selector-flow.js.map +1 -1
- package/docs/extensions.md +8 -0
- package/docs/harness-architecture.md +28 -32
- package/docs/index.md +1 -1
- package/docs/process-matrix.md +8 -6
- package/docs/resources.md +1 -1
- package/docs/settings.md +61 -51
- package/docs/tmux-agent-manager.md +47 -40
- package/docs/usage.md +1 -1
- package/docs/worker-profiles.md +8 -6
- package/docs/worktree-sync.md +26 -20
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +0 -133
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +0 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +0 -199
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +0 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +0 -312
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/core/orchestration/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAA0B,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAA0B,MAAM,2BAA2B,CAAC;AAEzF;;;;GAIG;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAU,CAAC;AAEvD,yGAAyG;AACzG,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAC;AACvD,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAG,CAAC;AAC3D,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAC;AACrD,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,GAAG,IAAI,CAAC;AAC7D,0FAA0F;AAC1F,MAAM,CAAC,MAAM,6CAA6C,GAAG,iBAAiB,CAAC;AAC/E,MAAM,CAAC,MAAM,mCAAmC,GAAG,EAAE,CAAC;AACtD,MAAM,CAAC,MAAM,8CAA8C,GAAG,EAAE,GAAG,IAAI,CAAC;AACxE;;;GAGG;AACH,MAA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AU,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;AACH,CAAC","sourcesContent":["import { DEFAULT_MAX_BYTES } from \"@caupulican/pi-agent-core/truncate\";\nimport type { JsonObject, JsonValue } from \"../autonomy/contracts.ts\";\nimport { HARNESS_CAPABILITIES, type HarnessCapability } from \"../capability-contract.ts\";\nimport { isPlainRecord } from \"../util/value-guards.ts\";\nimport type { WorkerContextForkReference } from \"./worker-context-fork-reference.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\n/** Shared durable-control bounds. Keep persisted orchestration records small enough to replay safely. */\nexport const MAX_ORCHESTRATION_IDENTIFIER_LENGTH = 512;\nexport const MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH = 128;\nexport const MAX_ORCHESTRATION_MODEL_ID_LENGTH = 512;\nexport const MAX_ORCHESTRATION_DESCRIPTION_LENGTH = 4 * 1024;\n/** Worker terminal summaries use the same inline byte ceiling as ordinary tool output. */\nexport const MAX_ORCHESTRATION_WORKER_RESULT_SUMMARY_BYTES = DEFAULT_MAX_BYTES;\nexport const MAX_ORCHESTRATION_COLLECTION_LENGTH = 64;\nexport const MAX_ORCHESTRATION_DISPATCH_INSTRUCTIONS_LENGTH = 16 * 1024;\n/**\n * Lifetime ceilings for the retained hot projection. Terminal records are intentionally retained,\n * so these limits match the durable worker-fleet ceiling rather than only counting active work.\n */\nexport const MAX_ORCHESTRATION_AGENT_BINDINGS = 256;\nexport const MAX_ORCHESTRATION_OBJECTIVES = 256;\nexport const MAX_ORCHESTRATION_TASKS = 256;\nexport const MAX_ORCHESTRATION_ATTEMPTS = 256;\nexport const MAX_ORCHESTRATION_CHECKPOINTS = 4_096;\nexport const MAX_ORCHESTRATION_APPROVALS = 256;\n/** Approval prompts and terminal handoffs may each retain one notification per attempt. */\nexport const MAX_ORCHESTRATION_NOTIFICATIONS = 512;\n/** Source goal state admits at most 512 evidence entries for one objective. */\nexport const MAX_ORCHESTRATION_OBJECTIVE_EVIDENCE = 512;\nexport const MAX_ORCHESTRATION_EVIDENCE = 4_096;\nexport const MAX_ORCHESTRATION_CHECKPOINT_SUMMARY_LENGTH = 4 * 1024;\n/** Absolute durable lineage bound enforced even when a profile requests broader recursion. */\nexport const MAX_ORCHESTRATION_AGENT_DEPTH = 8;\n/** Retained direct-child identity bound enforced even when a profile requests broader fan-out. */\nexport const MAX_ORCHESTRATION_DIRECT_CHILDREN = 64;\n/** One changed retained map value; aggregate projection accounting remains the authoritative ceiling. */\nexport const MAX_ORCHESTRATION_RETAINED_RECORD_BYTES = 1024 * 1024;\n/** Leaves room for bounded idempotency evidence and the snapshot envelope below the on-disk ceiling. */\nexport const MAX_ORCHESTRATION_PROJECTION_BYTES = 24 * 1024 * 1024;\nexport const MAX_ORCHESTRATION_SNAPSHOT_IDEMPOTENCY_BYTES = 4 * 1024 * 1024;\nexport const MAX_ORCHESTRATION_PROJECTION_SNAPSHOT_BYTES = 32 * 1024 * 1024;\n/** Matches the bounded worker/process result contract retained by the execution plane. */\nexport const MAX_ORCHESTRATION_PROCESS_OUTPUT_BYTES = 512 * 1024;\nexport const MAX_WORKER_AUTHORITY_PATHS = 64;\nexport const MAX_WORKER_AUTHORITY_PATH_LENGTH = 4 * 1024;\nexport const MAX_WORKER_SOUL_LENGTH = 16 * 1024;\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\n/** Outbound recursive delegation authority retained with an immutable worker profile snapshot. */\nexport interface OrchestrationDelegationLimits {\n\t/** Greatest absolute AgentBindingContract.depth that this worker may create. */\n\tmaxDepth: number;\n\t/** Greatest number of retained direct child identities that this worker may create. */\n\tmaxChildrenPerAgent: number;\n\t/** Greatest number of retained non-root identities across this durable session. */\n\tmaxNestedAgentsPerSession?: 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\t/** Direct creator in the durable orchestration tree. Root agents omit this field. */\n\tparentAgentId?: string;\n\t/** Stable root identity retained across bounded recursive delegation depth. */\n\trootAgentId: string;\n\t/** Durable lineage depth. Fleet admission enforces the host-configured depth ceiling. */\n\tdepth: number;\n\trole: WorkerRole;\n\tstatus: AgentBindingStatus;\n\tactiveAttemptId?: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface RiskBudget {\n\t/**\n\t * Budget-counted tokens, not raw provider totals: input/output/cache-write tokens charge at\n\t * face value, prompt-cache reads at CACHE_READ_BUDGET_WEIGHT (see capability-gateway.ts).\n\t * Charging cache reads fully would turn this into a request counter, since every request\n\t * re-reads the fixed system prompt.\n\t */\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/** Bounded metadata-only resources retained in one worker execution contract. */\nexport const MAX_WORKER_RESOURCE_POINTERS = 64;\nexport const MAX_WORKER_RESOURCE_PATH_LENGTH = 4096;\nexport const MAX_WORKER_RESOURCE_METADATA_NAME_LENGTH = 256;\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/** Optional preset-routing metadata retained for authored profiles; never an admission allowlist. */\n\tdispatchProfileIds: readonly string[];\n\texecutionPolicy?: OrchestrationExecutionPolicy;\n\t/** Omitted authored profiles use the host ceiling; adaptive profiles carry a lean explicit limit. */\n\tdelegationLimits?: OrchestrationDelegationLimits;\n\tbudget: RiskBudget;\n\t/** Authored scheduling hint retained in the snapshot; the global scheduler owns actual concurrency. */\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/** Metadata-only resources fixed at admission; their content remains lazy and non-durable. */\n\tresourcePointers: readonly ResourcePointer[];\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/** Durable dispatch metadata. Model/tool choices are retained in the runtime-owned executionContract. */\nexport interface OrchestrationDispatchRequest {\n\ttaskId: string;\n\tprofileId: string;\n\tinstructions: string;\n\tresourcePointerIds: readonly string[];\n\t/** Direct logical-agent creator for recursively delegated in-process work. */\n\tparentAgentId?: string;\n\t/** Runtime-owned goal/task correlation. Omitted by legacy records and normalized to an empty list. */\n\trequirementIds?: 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/** Durable mailbox message whose task-bearing intent owns this logical-agent turn. */\n\tcontrolMessageId?: string;\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/** Immutable sanitized parent context captured for this persistent logical worker at birth. */\n\tbirthContextForkReference?: WorkerContextForkReference;\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\n/** Restart-durable host retry ladder state for one resumable worker attempt. */\nexport interface AttemptRetryState {\n\t/** Scheduled retries already consumed; the initial execution is not included. */\n\tretriesUsed: number;\n\t/** Earliest instant at which the suspended attempt may receive a fresh lease. */\n\tnotBefore: string;\n}\n\n/** Complete cumulative active usage for one execution attempt. Restart downtime is never included. */\nexport interface AttemptUsageSnapshot {\n\ttoolCalls: number;\n\tinputTokens: number;\n\toutputTokens: number;\n\tcacheReadTokens: number;\n\tcacheWriteTokens: number;\n\t/** Provider-authoritative total; detail categories are not assumed to be additive. */\n\ttotalTokens: number;\n\tcostUsd: number;\n\tactiveWallClockMs: number;\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\t/** Omitted only by legacy checkpoints created before durable usage accounting existed. */\n\tusage?: AttemptUsageSnapshot;\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.attempt_prepared\",\n\t\"task.ready\",\n\t\"task.failed\",\n\t\"task.verification_finished\",\n\t\"agent.registered\",\n\t\"agent.retired\",\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.lease_renewed\",\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"]}
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/core/orchestration/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAA0B,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAA0B,MAAM,2BAA2B,CAAC;AAEzF;;;;GAIG;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAU,CAAC;AAEvD,yGAAyG;AACzG,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAC;AACvD,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAG,CAAC;AAC3D,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAC;AACrD,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,GAAG,IAAI,CAAC;AAC7D,0FAA0F;AAC1F,MAAM,CAAC,MAAM,6CAA6C,GAAG,iBAAiB,CAAC;AAC/E,MAAM,CAAC,MAAM,mCAAmC,GAAG,EAAE,CAAC;AACtD,MAAM,CAAC,MAAM,8CAA8C,GAAG,EAAE,GAAG,IAAI,CAAC;AACxE;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,CAAC;AACpD,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAChD,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAC3C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAC9C,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AACnD,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAC/C,2FAA2F;AAC3F,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,C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C9E,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;QAC5B,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAC1B,CAAC;AACH,CAAC","sourcesContent":["import { DEFAULT_MAX_BYTES } from \"@caupulican/pi-agent-core/truncate\";\nimport type { JsonObject, JsonValue } from \"../autonomy/contracts.ts\";\nimport { HARNESS_CAPABILITIES, type HarnessCapability } from \"../capability-contract.ts\";\nimport { isPlainRecord } from \"../util/value-guards.ts\";\nimport type { WorkerContextForkReference } from \"./worker-context-fork-reference.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\n/** Shared durable-control bounds. Keep persisted orchestration records small enough to replay safely. */\nexport const MAX_ORCHESTRATION_IDENTIFIER_LENGTH = 512;\nexport const MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH = 128;\nexport const MAX_ORCHESTRATION_MODEL_ID_LENGTH = 512;\nexport const MAX_ORCHESTRATION_DESCRIPTION_LENGTH = 4 * 1024;\n/** Worker terminal summaries use the same inline byte ceiling as ordinary tool output. */\nexport const MAX_ORCHESTRATION_WORKER_RESULT_SUMMARY_BYTES = DEFAULT_MAX_BYTES;\nexport const MAX_ORCHESTRATION_COLLECTION_LENGTH = 64;\nexport const MAX_ORCHESTRATION_DISPATCH_INSTRUCTIONS_LENGTH = 16 * 1024;\n/**\n * Lifetime ceilings for the retained hot projection. Terminal records are intentionally retained,\n * so these limits match the durable worker-fleet ceiling rather than only counting active work.\n */\nexport const MAX_ORCHESTRATION_AGENT_BINDINGS = 256;\nexport const MAX_ORCHESTRATION_OBJECTIVES = 256;\nexport const MAX_ORCHESTRATION_TASKS = 256;\nexport const MAX_ORCHESTRATION_ATTEMPTS = 256;\nexport const MAX_ORCHESTRATION_CHECKPOINTS = 4_096;\nexport const MAX_ORCHESTRATION_APPROVALS = 256;\n/** Approval prompts and terminal handoffs may each retain one notification per attempt. */\nexport const MAX_ORCHESTRATION_NOTIFICATIONS = 512;\n/** Source goal state admits at most 512 evidence entries for one objective. */\nexport const MAX_ORCHESTRATION_OBJECTIVE_EVIDENCE = 512;\nexport const MAX_ORCHESTRATION_EVIDENCE = 4_096;\nexport const MAX_ORCHESTRATION_CHECKPOINT_SUMMARY_LENGTH = 4 * 1024;\n/** Absolute lineage bound retained for legacy durable-record recovery. New native workers are leaves. */\nexport const MAX_ORCHESTRATION_AGENT_DEPTH = 8;\n/** Direct-child bound retained for legacy durable-record recovery. New native workers admit none. */\nexport const MAX_ORCHESTRATION_DIRECT_CHILDREN = 64;\n/** One changed retained map value; aggregate projection accounting remains the authoritative ceiling. */\nexport const MAX_ORCHESTRATION_RETAINED_RECORD_BYTES = 1024 * 1024;\n/** Leaves room for bounded idempotency evidence and the snapshot envelope below the on-disk ceiling. */\nexport const MAX_ORCHESTRATION_PROJECTION_BYTES = 24 * 1024 * 1024;\nexport const MAX_ORCHESTRATION_SNAPSHOT_IDEMPOTENCY_BYTES = 4 * 1024 * 1024;\nexport const MAX_ORCHESTRATION_PROJECTION_SNAPSHOT_BYTES = 32 * 1024 * 1024;\n/** Matches the bounded worker/process result contract retained by the execution plane. */\nexport const MAX_ORCHESTRATION_PROCESS_OUTPUT_BYTES = 512 * 1024;\nexport const MAX_WORKER_AUTHORITY_PATHS = 64;\nexport const MAX_WORKER_AUTHORITY_PATH_LENGTH = 4 * 1024;\nexport const MAX_WORKER_SOUL_LENGTH = 16 * 1024;\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\n/** Legacy lineage limits retained in immutable snapshots; newly compiled native profiles use zeros. */\nexport interface OrchestrationDelegationLimits {\n\t/** Greatest recovered AgentBindingContract.depth the durable host may retain. */\n\tmaxDepth: number;\n\t/** Greatest number of recovered direct-child identities the durable host may retain. */\n\tmaxChildrenPerAgent: number;\n\t/** Greatest number of recovered non-root identities across this durable session. */\n\tmaxNestedAgentsPerSession?: 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\t/** Legacy direct creator retained for recovery. Fresh leaf workers omit this field. */\n\tparentAgentId?: string;\n\t/** Stable root identity retained across legacy recovered lineage. */\n\trootAgentId: string;\n\t/** Durable legacy lineage depth. Fresh leaf workers are always depth zero. */\n\tdepth: number;\n\trole: WorkerRole;\n\tstatus: AgentBindingStatus;\n\tactiveAttemptId?: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface RiskBudget {\n\t/**\n\t * Budget-counted tokens, not raw provider totals: input/output/cache-write tokens charge at\n\t * face value, prompt-cache reads at CACHE_READ_BUDGET_WEIGHT (see capability-gateway.ts).\n\t * Charging cache reads fully would turn this into a request counter, since every request\n\t * re-reads the fixed system prompt.\n\t */\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/** Bounded metadata-only resources retained in one worker execution contract. */\nexport const MAX_WORKER_RESOURCE_POINTERS = 64;\nexport const MAX_WORKER_RESOURCE_PATH_LENGTH = 4096;\nexport const MAX_WORKER_RESOURCE_METADATA_NAME_LENGTH = 256;\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\t/** Optional worker cwd and symmetric filesystem focus. Omitted means host-level machine scope. */\n\tworkspacePath?: string;\n\tresourceProfileNames: readonly string[];\n\t/** Optional preset-routing metadata retained for authored profiles; never an admission allowlist. */\n\tdispatchProfileIds: readonly string[];\n\texecutionPolicy?: OrchestrationExecutionPolicy;\n\t/** Newly compiled native profiles carry the mandatory zero-child leaf limit. */\n\tdelegationLimits?: OrchestrationDelegationLimits;\n\tbudget: RiskBudget;\n\t/** Authored scheduling hint retained in the snapshot; the global scheduler owns actual concurrency. */\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/** Metadata-only resources fixed at admission; their content remains lazy and non-durable. */\n\tresourcePointers: readonly ResourcePointer[];\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\t/** Process cwd fixed at admission. Legacy contracts omit it and recover from the session cwd. */\n\tcwd?: string;\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/** Durable dispatch metadata. Model/tool choices are retained in the runtime-owned executionContract. */\nexport interface OrchestrationDispatchRequest {\n\ttaskId: string;\n\tprofileId: string;\n\tinstructions: string;\n\tresourcePointerIds: readonly string[];\n\t/** Legacy logical-agent creator retained only to recover previously persisted nested work. */\n\tparentAgentId?: string;\n\t/** Runtime-owned goal/task correlation. Omitted by legacy records and normalized to an empty list. */\n\trequirementIds?: 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/** Durable mailbox message whose task-bearing intent owns this logical-agent turn. */\n\tcontrolMessageId?: string;\n\t/** External provider identity retained for routing and diagnostics. */\n\tprovider?: string;\n\t/** Immutable profile identity used to audit the external launch authority. */\n\tauthorizationId?: string;\n\t/** Worktree-sync lane claimed by the external dispatcher. */\n\tworktreeLaneKey?: string;\n\t/** Immutable sanitized parent context captured for this persistent logical worker at birth. */\n\tbirthContextForkReference?: WorkerContextForkReference;\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\n/** Restart-durable host retry ladder state for one resumable worker attempt. */\nexport interface AttemptRetryState {\n\t/** Scheduled retries already consumed; the initial execution is not included. */\n\tretriesUsed: number;\n\t/** Earliest instant at which the suspended attempt may receive a fresh lease. */\n\tnotBefore: string;\n}\n\n/** Complete cumulative active usage for one execution attempt. Restart downtime is never included. */\nexport interface AttemptUsageSnapshot {\n\ttoolCalls: number;\n\tinputTokens: number;\n\toutputTokens: number;\n\tcacheReadTokens: number;\n\tcacheWriteTokens: number;\n\t/** Provider-authoritative total; detail categories are not assumed to be additive. */\n\ttotalTokens: number;\n\tcostUsd: number;\n\tactiveWallClockMs: number;\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\t/** Omitted only by legacy checkpoints created before durable usage accounting existed. */\n\tusage?: AttemptUsageSnapshot;\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.attempt_prepared\",\n\t\"task.ready\",\n\t\"task.failed\",\n\t\"task.verification_finished\",\n\t\"agent.registered\",\n\t\"agent.retired\",\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.lease_renewed\",\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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OrchestrationProfile, ToolCapabilityManifest } from "./contracts.ts";
|
|
2
|
-
export declare const CLASSIFIED_LANE_TOOL_NAMES: readonly ["read", "grep", "find", "ls", "write", "edit", "
|
|
3
|
-
export declare const ORCHESTRATION_PROFILE_TOOL_NAMES: readonly ["read", "grep", "find", "ls", "write", "edit", "
|
|
2
|
+
export declare const CLASSIFIED_LANE_TOOL_NAMES: readonly ["read", "grep", "find", "ls", "write", "edit", "memory_read", "python", "run_process", "bash", "artifact_retrieve", "run_toolkit_script", "skill", "skill_audit"];
|
|
3
|
+
export declare const ORCHESTRATION_PROFILE_TOOL_NAMES: readonly ["read", "grep", "find", "ls", "write", "edit", "memory_read", "python", "run_process", "bash", "artifact_retrieve", "run_toolkit_script", "skill", "skill_audit", "delegate"];
|
|
4
4
|
/**
|
|
5
5
|
* Manifest-only lane catalogue. It contains no tool factories, so policy compilation can omit
|
|
6
6
|
* denied tools before their executable implementations are constructed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lane-tool-manifests.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/lane-tool-manifests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lane-tool-manifests.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/lane-tool-manifests.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAEnF,eAAO,MAAM,0BAA0B,YACtC,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,MAAM,iBAEN,QAAQ,EACR,aAAa,EACb,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,OAAO,EACP,aAAa,CACJ,CAAC;AACX,eAAO,MAAM,gCAAgC,yLAAuD,CAAC;AAErG;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,oBAAoB,EAC7B,gBAAgB,EAAE,SAAS,MAAM,EAAE,GACjC,sBAAsB,EAAE,CAkB1B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { mapToolNamesForPlatform } from "../default-tool-surface.js";
|
|
2
|
+
import { WORKER_MEMORY_READ_TOOL_NAME } from "../memory/worker-memory-tools.js";
|
|
2
3
|
import { getToolCapabilityPolicy, resolveProfileToolCapabilities } from "../tool-capability-policy.js";
|
|
3
4
|
export const CLASSIFIED_LANE_TOOL_NAMES = [
|
|
4
5
|
"read",
|
|
@@ -7,10 +8,14 @@ export const CLASSIFIED_LANE_TOOL_NAMES = [
|
|
|
7
8
|
"ls",
|
|
8
9
|
"write",
|
|
9
10
|
"edit",
|
|
10
|
-
|
|
11
|
+
WORKER_MEMORY_READ_TOOL_NAME,
|
|
11
12
|
"python",
|
|
12
13
|
"run_process",
|
|
13
14
|
"bash",
|
|
15
|
+
"artifact_retrieve",
|
|
16
|
+
"run_toolkit_script",
|
|
17
|
+
"skill",
|
|
18
|
+
"skill_audit",
|
|
14
19
|
];
|
|
15
20
|
export const ORCHESTRATION_PROFILE_TOOL_NAMES = [...CLASSIFIED_LANE_TOOL_NAMES, "delegate"];
|
|
16
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lane-tool-manifests.js","sourceRoot":"","sources":["../../../src/core/orchestration/lane-tool-manifests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAGvG,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACzC,MAAM;IACN,MAAM;IACN,MAAM;IACN,IAAI;IACJ,OAAO;IACP,MAAM;IACN,
|
|
1
|
+
{"version":3,"file":"lane-tool-manifests.js","sourceRoot":"","sources":["../../../src/core/orchestration/lane-tool-manifests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAGvG,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACzC,MAAM;IACN,MAAM;IACN,MAAM;IACN,IAAI;IACJ,OAAO;IACP,MAAM;IACN,4BAA4B;IAC5B,QAAQ;IACR,aAAa;IACb,MAAM;IACN,mBAAmB;IACnB,oBAAoB;IACpB,OAAO;IACP,aAAa;CACJ,CAAC;AACX,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,GAAG,0BAA0B,EAAE,UAAU,CAAU,CAAC;AAErG;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACrC,OAA6B,EAC7B,gBAAmC;IAEnC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC1C,MAAM,SAAS,GAA6B,EAAE,CAAC;IAE/C,KAAK,MAAM,QAAQ,IAAI,IAAI,GAAG,CAAC,uBAAuB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QAC5E,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,SAAS;QACrC,MAAM,MAAM,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;QACjD,MAAM,YAAY,GAAG,8BAA8B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACvE,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM;YAAE,SAAS;QACvC,SAAS,CAAC,IAAI,CAAC;YACd,QAAQ;YACR,eAAe,EAAE,YAAY,QAAQ,KAAK;YAC1C,YAAY;YACZ,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;YACrB,YAAY,EAAE,MAAM,CAAC,YAAY;SACjC,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["import { mapToolNamesForPlatform } from \"../default-tool-surface.ts\";\nimport { WORKER_MEMORY_READ_TOOL_NAME } from \"../memory/worker-memory-tools.ts\";\nimport { getToolCapabilityPolicy, resolveProfileToolCapabilities } from \"../tool-capability-policy.ts\";\nimport type { OrchestrationProfile, ToolCapabilityManifest } from \"./contracts.ts\";\n\nexport const CLASSIFIED_LANE_TOOL_NAMES = [\n\t\"read\",\n\t\"grep\",\n\t\"find\",\n\t\"ls\",\n\t\"write\",\n\t\"edit\",\n\tWORKER_MEMORY_READ_TOOL_NAME,\n\t\"python\",\n\t\"run_process\",\n\t\"bash\",\n\t\"artifact_retrieve\",\n\t\"run_toolkit_script\",\n\t\"skill\",\n\t\"skill_audit\",\n] as const;\nexport const ORCHESTRATION_PROFILE_TOOL_NAMES = [...CLASSIFIED_LANE_TOOL_NAMES, \"delegate\"] as const;\n\n/**\n * Manifest-only lane catalogue. It contains no tool factories, so policy compilation can omit\n * denied tools before their executable implementations are constructed.\n */\nexport function buildLaneToolManifests(\n\tprofile: OrchestrationProfile,\n\tenabledToolNames: readonly string[],\n): ToolCapabilityManifest[] {\n\tconst enabled = new Set(enabledToolNames);\n\tconst manifests: ToolCapabilityManifest[] = [];\n\n\tfor (const toolName of new Set(mapToolNamesForPlatform(profile.toolNames))) {\n\t\tif (!enabled.has(toolName)) continue;\n\t\tconst policy = getToolCapabilityPolicy(toolName);\n\t\tconst capabilities = resolveProfileToolCapabilities(profile, toolName);\n\t\tif (!capabilities || !policy) continue;\n\t\tmanifests.push({\n\t\t\ttoolName,\n\t\t\tmoduleSpecifier: `../tools/${toolName}.ts`,\n\t\t\tcapabilities,\n\t\t\troles: [profile.role],\n\t\t\tenforcements: policy.enforcements,\n\t\t});\n\t}\n\treturn manifests;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-registry.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/profile-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profile-registry.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/profile-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,cAAc,EACd,4BAA4B,EAC5B,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EAEf,YAAY,E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G,oBAAoB,GAAG,SAAS,CAGvD;IAED,IAAI,IAAI,oBAAoB,EAAE,CAE7B;CACD;AAED,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,eAAe,GACrB,yBAAyB,GAAG,SAAS,CAOvC;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACzC,OAAO,EAAE,4BAA4B,CAAC;IACtC,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,4BAA4B,CAAC;IACvC,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,uBAAuB,CAAC;IACxC,aAAa,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACjD,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IACtC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;CACtB,GAAG,yBAAyB,CAoC5B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from "node:path";
|
|
1
2
|
import { describeToolCapabilityAuthority, resolveProfileToolCapabilities } from "../tool-capability-policy.js";
|
|
2
3
|
import { hasOnlyKeys, isPlainRecord } from "../util/value-guards.js";
|
|
3
4
|
import { HARNESS_CAPABILITIES, MAX_ORCHESTRATION_AGENT_BINDINGS, MAX_ORCHESTRATION_AGENT_DEPTH, MAX_ORCHESTRATION_COLLECTION_LENGTH, MAX_ORCHESTRATION_DESCRIPTION_LENGTH, MAX_ORCHESTRATION_DIRECT_CHILDREN, MAX_ORCHESTRATION_DISPATCH_INSTRUCTIONS_LENGTH, MAX_ORCHESTRATION_IDENTIFIER_LENGTH, MAX_ORCHESTRATION_MODEL_ID_LENGTH, MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH, MAX_ORCHESTRATION_PROCESS_OUTPUT_BYTES, MAX_WORKER_AUTHORITY_PATH_LENGTH, ORCHESTRATION_SCHEMA_VERSION, ORCHESTRATION_THINKING_LEVELS, toJsonObject, WORKER_ROLES, } from "./contracts.js";
|
|
@@ -84,6 +85,12 @@ export function validateOrchestrationProfile(profile) {
|
|
|
84
85
|
profile.updatedAt.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH) {
|
|
85
86
|
throw new OrchestrationProfileError(`Profile '${profile.profileId}' timestamps are invalid.`);
|
|
86
87
|
}
|
|
88
|
+
if (profile.workspacePath !== undefined &&
|
|
89
|
+
(!profile.workspacePath.trim() ||
|
|
90
|
+
profile.workspacePath.length > MAX_WORKER_AUTHORITY_PATH_LENGTH ||
|
|
91
|
+
(!path.isAbsolute(profile.workspacePath) && !path.win32.isAbsolute(profile.workspacePath)))) {
|
|
92
|
+
throw new OrchestrationProfileError(`Profile '${profile.profileId}' workspacePath must be an absolute path.`);
|
|
93
|
+
}
|
|
87
94
|
for (const [label, values] of [
|
|
88
95
|
["capabilityCeiling", profile.capabilityCeiling],
|
|
89
96
|
["toolNames", profile.toolNames],
|
|
@@ -202,6 +209,7 @@ export function parseOrchestrationProfile(value, sourcePath) {
|
|
|
202
209
|
"modelPolicy",
|
|
203
210
|
"capabilityCeiling",
|
|
204
211
|
"toolNames",
|
|
212
|
+
"workspacePath",
|
|
205
213
|
"resourceProfileNames",
|
|
206
214
|
"dispatchProfileIds",
|
|
207
215
|
"executionPolicy",
|
|
@@ -285,6 +293,11 @@ export function parseOrchestrationProfile(value, sourcePath) {
|
|
|
285
293
|
!value.capabilityCeiling.every((capability) => typeof capability === "string" &&
|
|
286
294
|
HARNESS_CAPABILITIES.includes(capability)) ||
|
|
287
295
|
!isStringArray(value.toolNames) ||
|
|
296
|
+
(value.workspacePath !== undefined &&
|
|
297
|
+
(typeof value.workspacePath !== "string" ||
|
|
298
|
+
!value.workspacePath.trim() ||
|
|
299
|
+
value.workspacePath.length > MAX_WORKER_AUTHORITY_PATH_LENGTH ||
|
|
300
|
+
(!path.isAbsolute(value.workspacePath) && !path.win32.isAbsolute(value.workspacePath)))) ||
|
|
288
301
|
!isStringArray(value.resourceProfileNames) ||
|
|
289
302
|
!isStringArray(value.dispatchProfileIds) ||
|
|
290
303
|
!Number.isSafeInteger(value.maxConcurrent) ||
|
|
@@ -310,6 +323,7 @@ export function parseOrchestrationProfile(value, sourcePath) {
|
|
|
310
323
|
modelPolicy: { mode: modelPolicy.mode, candidates },
|
|
311
324
|
capabilityCeiling: value.capabilityCeiling,
|
|
312
325
|
toolNames: value.toolNames,
|
|
326
|
+
...(typeof value.workspacePath === "string" ? { workspacePath: value.workspacePath } : {}),
|
|
313
327
|
resourceProfileNames: value.resourceProfileNames,
|
|
314
328
|
dispatchProfileIds: value.dispatchProfileIds,
|
|
315
329
|
...(executionPolicy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-registry.js","sourceRoot":"","sources":["../../../src/core/orchestration/profile-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC/G,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAWrE,OAAO,EACN,oBAAoB,EACpB,gCAAgC,EAChC,6BAA6B,EAC7B,mCAAmC,EACnC,oCAAoC,EACpC,iCAAiC,EACjC,8CAA8C,EAC9C,mCAAmC,EACnC,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,EACtC,gCAAgC,EAChC,4BAA4B,EAC5B,6BAA6B,EAC7B,YAAY,EACZ,YAAY,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAEN,gCAAgC,GAGhC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CA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AC,KAAK,EAAE,aAAa,EAAE,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC;AACrH,CAAC","sourcesContent":["import { describeToolCapabilityAuthority, resolveProfileToolCapabilities } from \"../tool-capability-policy.ts\";\nimport { hasOnlyKeys, isPlainRecord } from \"../util/value-guards.ts\";\nimport type {\n\tExecutionGrant,\n\tOrchestrationDispatchRequest,\n\tOrchestrationModelBinding,\n\tOrchestrationProfile,\n\tResourcePointer,\n\tRiskBudget,\n\tTaskContract,\n\tToolCapabilityManifest,\n} from \"./contracts.ts\";\nimport {\n\tHARNESS_CAPABILITIES,\n\tMAX_ORCHESTRATION_AGENT_BINDINGS,\n\tMAX_ORCHESTRATION_AGENT_DEPTH,\n\tMAX_ORCHESTRATION_COLLECTION_LENGTH,\n\tMAX_ORCHESTRATION_DESCRIPTION_LENGTH,\n\tMAX_ORCHESTRATION_DIRECT_CHILDREN,\n\tMAX_ORCHESTRATION_DISPATCH_INSTRUCTIONS_LENGTH,\n\tMAX_ORCHESTRATION_IDENTIFIER_LENGTH,\n\tMAX_ORCHESTRATION_MODEL_ID_LENGTH,\n\tMAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH,\n\tMAX_ORCHESTRATION_PROCESS_OUTPUT_BYTES,\n\tMAX_WORKER_AUTHORITY_PATH_LENGTH,\n\tORCHESTRATION_SCHEMA_VERSION,\n\tORCHESTRATION_THINKING_LEVELS,\n\ttoJsonObject,\n\tWORKER_ROLES,\n} from \"./contracts.ts\";\nimport { ORCHESTRATION_PROFILE_TOOL_NAMES } from \"./lane-tool-manifests.ts\";\nimport {\n\ttype CompileExecutionGrantInput,\n\tDEFAULT_ROLE_CAPABILITY_CEILINGS,\n\ttype ExecutionPolicyCompiler,\n\ttype PolicyCompilationResult,\n} from \"./policy-compiler.ts\";\nimport { parseRiskBudget, validateRiskBudget } from \"./risk-budget.ts\";\n\nexport interface ModelHealthView {\n\tisHealthy(binding: OrchestrationModelBinding): boolean;\n}\n\nexport interface ProfileDispatchPlan {\n\tprofile: OrchestrationProfile;\n\tmodel: OrchestrationModelBinding;\n\tgrant: ExecutionGrant;\n\ttoolManifests: readonly ToolCapabilityManifest[];\n}\n\nexport type ProfileDispatchPlanResult =\n\t| { outcome: \"allow\"; plan: ProfileDispatchPlan }\n\t| Exclude<PolicyCompilationResult, { outcome: \"allow\" }>\n\t| { outcome: \"deny\"; decisions: readonly []; reasonCodes: readonly [\"profile_model_unavailable\"] };\n\nexport class OrchestrationProfileError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"OrchestrationProfileError\";\n\t}\n}\n\nfunction duplicateStrings(values: readonly string[]): string[] {\n\tconst seen = new Set<string>();\n\tconst duplicates = new Set<string>();\n\tfor (const value of values) {\n\t\tif (seen.has(value)) duplicates.add(value);\n\t\tseen.add(value);\n\t}\n\treturn [...duplicates];\n}\n\nexport function parseOrchestrationDispatchRequest(value: unknown): OrchestrationDispatchRequest {\n\tif (!isPlainRecord(value)) throw new OrchestrationProfileError(\"Dispatch request must be an object.\");\n\tif (!hasOnlyKeys(value, [\"taskId\", \"profileId\", \"instructions\", \"resourcePointerIds\"])) {\n\t\tthrow new OrchestrationProfileError(\"Dispatch request contains an unsupported durable metadata field.\");\n\t}\n\tif (\n\t\ttypeof value.taskId !== \"string\" ||\n\t\t!value.taskId ||\n\t\tvalue.taskId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\ttypeof value.profileId !== \"string\" ||\n\t\t!value.profileId ||\n\t\tvalue.profileId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\ttypeof value.instructions !== \"string\" ||\n\t\tvalue.instructions.length > MAX_ORCHESTRATION_DISPATCH_INSTRUCTIONS_LENGTH ||\n\t\t!value.instructions.trim() ||\n\t\t!Array.isArray(value.resourcePointerIds) ||\n\t\tvalue.resourcePointerIds.length > MAX_ORCHESTRATION_COLLECTION_LENGTH ||\n\t\t!value.resourcePointerIds.every(\n\t\t\t(entry) =>\n\t\t\t\ttypeof entry === \"string\" && entry.length > 0 && entry.length <= MAX_ORCHESTRATION_IDENTIFIER_LENGTH,\n\t\t) ||\n\t\tnew Set(value.resourcePointerIds).size !== value.resourcePointerIds.length\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Dispatch request is invalid.\");\n\t}\n\treturn {\n\t\ttaskId: value.taskId,\n\t\tprofileId: value.profileId,\n\t\tinstructions: value.instructions.trim(),\n\t\tresourcePointerIds: [...value.resourcePointerIds],\n\t};\n}\n\nexport function validateOrchestrationProfile(profile: OrchestrationProfile): void {\n\tif (profile.schemaVersion !== ORCHESTRATION_SCHEMA_VERSION) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' has an unsupported schema version.`);\n\t}\n\tif (\n\t\tprofile.profileId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\t!profile.profileId.trim() ||\n\t\tprofile.description.length > MAX_ORCHESTRATION_DESCRIPTION_LENGTH ||\n\t\t!profile.description.trim()\n\t)\n\t\tthrow new OrchestrationProfileError(\"Profile id and description are required.\");\n\tif (profile.role !== \"orchestrator\" && profile.dispatchProfileIds.length > 0) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Only orchestrator profiles may declare dispatchProfileIds ('${profile.profileId}').`,\n\t\t);\n\t}\n\tif (profile.dispatchProfileIds.includes(profile.profileId)) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' cannot dispatch itself.`);\n\t}\n\tif (profile.requireIndependentVerification) {\n\t\tif (profile.role === \"verifier\") {\n\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t`Verifier profile '${profile.profileId}' cannot require another verifier.`,\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t!profile.verificationProfileId?.trim() ||\n\t\t\tprofile.verificationProfileId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH\n\t\t) {\n\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t`Profile '${profile.profileId}' requires independent verification but has no verificationProfileId.`,\n\t\t\t);\n\t\t}\n\t} else if (profile.verificationProfileId !== undefined) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' cannot declare verificationProfileId without requiring verification.`,\n\t\t);\n\t}\n\tif (profile.verificationProfileId === profile.profileId) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' cannot verify itself.`);\n\t}\n\tif (\n\t\t!profile.createdAt.trim() ||\n\t\tprofile.createdAt.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\t!profile.updatedAt.trim() ||\n\t\tprofile.updatedAt.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH\n\t) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' timestamps are invalid.`);\n\t}\n\tfor (const [label, values] of [\n\t\t[\"capabilityCeiling\", profile.capabilityCeiling],\n\t\t[\"toolNames\", profile.toolNames],\n\t\t[\"resourceProfileNames\", profile.resourceProfileNames],\n\t\t[\"dispatchProfileIds\", profile.dispatchProfileIds],\n\t] as const) {\n\t\tif (\n\t\t\tvalues.length > MAX_ORCHESTRATION_COLLECTION_LENGTH ||\n\t\t\tvalues.some((value) => !value.trim() || value.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH)\n\t\t) {\n\t\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' contains an invalid ${label}.`);\n\t\t}\n\t\tconst duplicates = duplicateStrings(values);\n\t\tif (duplicates.length > 0) {\n\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t`Profile '${profile.profileId}' contains duplicate ${label}: ${duplicates.join(\", \")}.`,\n\t\t\t);\n\t\t}\n\t}\n\tconst roleCeiling = new Set(DEFAULT_ROLE_CAPABILITY_CEILINGS[profile.role]);\n\tconst outOfRoleCapabilities = profile.capabilityCeiling.filter((capability) => !roleCeiling.has(capability));\n\tif (outOfRoleCapabilities.length > 0) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' exceeds the ${profile.role} role ceiling: ${outOfRoleCapabilities.join(\", \")}.`,\n\t\t);\n\t}\n\tif (\n\t\tprofile.modelPolicy.candidates.length === 0 ||\n\t\tprofile.modelPolicy.candidates.length > MAX_ORCHESTRATION_COLLECTION_LENGTH\n\t) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' must declare a model candidate.`);\n\t}\n\tif (profile.modelPolicy.mode === \"fixed\" && profile.modelPolicy.candidates.length !== 1) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Fixed profile '${profile.profileId}' must declare exactly one model candidate.`,\n\t\t);\n\t}\n\tfor (const candidate of profile.modelPolicy.candidates) {\n\t\tif (\n\t\t\tcandidate.provider.length > MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH ||\n\t\t\t!candidate.provider.trim() ||\n\t\t\tcandidate.modelId.length > MAX_ORCHESTRATION_MODEL_ID_LENGTH ||\n\t\t\t!candidate.modelId.trim()\n\t\t) {\n\t\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' contains an invalid model binding.`);\n\t\t}\n\t}\n\tconst duplicateModels = duplicateStrings(\n\t\tprofile.modelPolicy.candidates.map((candidate) => `${candidate.provider}/${candidate.modelId}`),\n\t);\n\tif (duplicateModels.length > 0) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' contains duplicate model candidates: ${duplicateModels.join(\", \")}.`,\n\t\t);\n\t}\n\tif (!Number.isSafeInteger(profile.maxConcurrent) || profile.maxConcurrent <= 0) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' maxConcurrent must be positive.`);\n\t}\n\tif (!Number.isSafeInteger(profile.leaseTtlMs) || profile.leaseTtlMs <= 0) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' leaseTtlMs must be positive.`);\n\t}\n\tif (\n\t\tprofile.delegationLimits &&\n\t\t(!Number.isSafeInteger(profile.delegationLimits.maxDepth) ||\n\t\t\tprofile.delegationLimits.maxDepth < 0 ||\n\t\t\tprofile.delegationLimits.maxDepth > MAX_ORCHESTRATION_AGENT_DEPTH ||\n\t\t\t!Number.isSafeInteger(profile.delegationLimits.maxChildrenPerAgent) ||\n\t\t\tprofile.delegationLimits.maxChildrenPerAgent < 0 ||\n\t\t\tprofile.delegationLimits.maxChildrenPerAgent > MAX_ORCHESTRATION_DIRECT_CHILDREN ||\n\t\t\t(profile.delegationLimits.maxNestedAgentsPerSession !== undefined &&\n\t\t\t\t(!Number.isSafeInteger(profile.delegationLimits.maxNestedAgentsPerSession) ||\n\t\t\t\t\tprofile.delegationLimits.maxNestedAgentsPerSession < 0 ||\n\t\t\t\t\tprofile.delegationLimits.maxNestedAgentsPerSession > MAX_ORCHESTRATION_AGENT_BINDINGS)))\n\t) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' delegationLimits are invalid.`);\n\t}\n\ttry {\n\t\tvalidateRiskBudget(profile.budget, `Profile '${profile.profileId}' budget`);\n\t} catch (error) {\n\t\tthrow new OrchestrationProfileError(error instanceof Error ? error.message : String(error));\n\t}\n\tif (profile.budget.maxWallClockMs !== undefined && profile.budget.maxWallClockMs <= 0) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' maxWallClockMs budget must be positive when specified.`,\n\t\t);\n\t}\n\tif (profile.budget.maxWallClockMs !== undefined && profile.leaseTtlMs < profile.budget.maxWallClockMs) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' leaseTtlMs must cover its maxWallClockMs budget.`,\n\t\t);\n\t}\n\tconst processCapable =\n\t\tprofile.capabilityCeiling.includes(\"process.exec\") || profile.capabilityCeiling.includes(\"tests.execute\");\n\tconst directProcessLauncher = profile.toolNames.includes(\"run_process\");\n\tif (directProcessLauncher && (!profile.executionPolicy || profile.executionPolicy.allowedExecutables.length === 0)) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' must declare executionPolicy.allowedExecutables for run_process.`,\n\t\t);\n\t}\n\tif (!processCapable && profile.executionPolicy) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' cannot declare executionPolicy without process capabilities.`,\n\t\t);\n\t}\n\tif (profile.executionPolicy) {\n\t\tif (\n\t\t\tprofile.executionPolicy.allowedExecutables.length > MAX_ORCHESTRATION_COLLECTION_LENGTH ||\n\t\t\tprofile.executionPolicy.allowedEnvironmentVariables.length > MAX_ORCHESTRATION_COLLECTION_LENGTH ||\n\t\t\tprofile.executionPolicy.allowedExecutables.some(\n\t\t\t\t(executable) =>\n\t\t\t\t\t!executable.trim() ||\n\t\t\t\t\texecutable.length > MAX_WORKER_AUTHORITY_PATH_LENGTH ||\n\t\t\t\t\t/[\\0\\r\\n]/.test(executable),\n\t\t\t) ||\n\t\t\tprofile.executionPolicy.allowedEnvironmentVariables.some(\n\t\t\t\t(name) => name.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name),\n\t\t\t) ||\n\t\t\t!Number.isSafeInteger(profile.executionPolicy.maxOutputBytes) ||\n\t\t\tprofile.executionPolicy.maxOutputBytes <= 0 ||\n\t\t\tprofile.executionPolicy.maxOutputBytes > MAX_ORCHESTRATION_PROCESS_OUTPUT_BYTES\n\t\t) {\n\t\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' executionPolicy is invalid.`);\n\t\t}\n\t}\n\tconst unknownTools = profile.toolNames.filter(\n\t\t(toolName) => !(ORCHESTRATION_PROFILE_TOOL_NAMES as readonly string[]).includes(toolName),\n\t);\n\tif (unknownTools.length > 0) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' contains unclassified orchestration tools: ${unknownTools.join(\", \")}.`,\n\t\t);\n\t}\n\tfor (const toolName of profile.toolNames) {\n\t\tif (!resolveProfileToolCapabilities(profile, toolName)) {\n\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t`Profile '${profile.profileId}' tool '${toolName}' lacks ${describeToolCapabilityAuthority(toolName)} authority.`,\n\t\t\t);\n\t\t}\n\t}\n\ttoJsonObject({ profile });\n}\n\nfunction isStringArray(value: unknown, maxLength = MAX_ORCHESTRATION_IDENTIFIER_LENGTH): value is string[] {\n\treturn (\n\t\tArray.isArray(value) &&\n\t\tvalue.length <= MAX_ORCHESTRATION_COLLECTION_LENGTH &&\n\t\tvalue.every((entry) => typeof entry === \"string\" && entry.length > 0 && entry.length <= maxLength)\n\t);\n}\n\nexport function parseOrchestrationProfile(value: unknown, sourcePath?: string): OrchestrationProfile {\n\tif (!isPlainRecord(value)) throw new OrchestrationProfileError(\"Orchestration profile must be an object.\");\n\tif (\n\t\t!hasOnlyKeys(value, [\n\t\t\t\"schemaVersion\",\n\t\t\t\"profileId\",\n\t\t\t\"description\",\n\t\t\t\"role\",\n\t\t\t\"modelPolicy\",\n\t\t\t\"capabilityCeiling\",\n\t\t\t\"toolNames\",\n\t\t\t\"resourceProfileNames\",\n\t\t\t\"dispatchProfileIds\",\n\t\t\t\"executionPolicy\",\n\t\t\t\"delegationLimits\",\n\t\t\t\"budget\",\n\t\t\t\"maxConcurrent\",\n\t\t\t\"leaseTtlMs\",\n\t\t\t\"requireIndependentVerification\",\n\t\t\t\"verificationProfileId\",\n\t\t\t\"createdAt\",\n\t\t\t\"updatedAt\",\n\t\t])\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Orchestration profile contains an unsupported field.\");\n\t}\n\tconst modelPolicy = value.modelPolicy;\n\tconst rawBudget = value.budget;\n\tlet budget: RiskBudget;\n\tconst executionPolicy = value.executionPolicy;\n\tconst delegationLimits = value.delegationLimits;\n\tif (\n\t\t!isPlainRecord(modelPolicy) ||\n\t\t!hasOnlyKeys(modelPolicy, [\"mode\", \"candidates\"]) ||\n\t\t!Array.isArray(modelPolicy.candidates) ||\n\t\tmodelPolicy.candidates.length > MAX_ORCHESTRATION_COLLECTION_LENGTH\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Orchestration profile modelPolicy is invalid.\");\n\t}\n\ttry {\n\t\tbudget = parseRiskBudget(rawBudget, \"Orchestration profile budget\");\n\t} catch (error) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\terror instanceof Error ? error.message : \"Orchestration profile budget is invalid.\",\n\t\t);\n\t}\n\tif (\n\t\texecutionPolicy !== undefined &&\n\t\t(!isPlainRecord(executionPolicy) ||\n\t\t\t!hasOnlyKeys(executionPolicy, [\"allowedExecutables\", \"allowedEnvironmentVariables\", \"maxOutputBytes\"]) ||\n\t\t\t!isStringArray(executionPolicy.allowedExecutables, MAX_WORKER_AUTHORITY_PATH_LENGTH) ||\n\t\t\t!isStringArray(executionPolicy.allowedEnvironmentVariables) ||\n\t\t\t!Number.isSafeInteger(executionPolicy.maxOutputBytes))\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Orchestration profile executionPolicy is invalid.\");\n\t}\n\tif (\n\t\tdelegationLimits !== undefined &&\n\t\t(!isPlainRecord(delegationLimits) ||\n\t\t\t!hasOnlyKeys(delegationLimits, [\"maxDepth\", \"maxChildrenPerAgent\", \"maxNestedAgentsPerSession\"]) ||\n\t\t\t!Number.isSafeInteger(delegationLimits.maxDepth) ||\n\t\t\t!Number.isSafeInteger(delegationLimits.maxChildrenPerAgent) ||\n\t\t\t(delegationLimits.maxNestedAgentsPerSession !== undefined &&\n\t\t\t\t!Number.isSafeInteger(delegationLimits.maxNestedAgentsPerSession)))\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Orchestration profile delegationLimits are invalid.\");\n\t}\n\tconst candidates = modelPolicy.candidates.map((candidate) => {\n\t\tif (!isPlainRecord(candidate) || !hasOnlyKeys(candidate, [\"provider\", \"modelId\", \"thinkingLevel\"])) {\n\t\t\tthrow new OrchestrationProfileError(\"Orchestration profile model candidate is invalid.\");\n\t\t}\n\t\tif (\n\t\t\ttypeof candidate.provider !== \"string\" ||\n\t\t\tcandidate.provider.length === 0 ||\n\t\t\tcandidate.provider.length > MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH ||\n\t\t\ttypeof candidate.modelId !== \"string\" ||\n\t\t\tcandidate.modelId.length === 0 ||\n\t\t\tcandidate.modelId.length > MAX_ORCHESTRATION_MODEL_ID_LENGTH ||\n\t\t\ttypeof candidate.thinkingLevel !== \"string\" ||\n\t\t\t!ORCHESTRATION_THINKING_LEVELS.includes(\n\t\t\t\tcandidate.thinkingLevel as (typeof ORCHESTRATION_THINKING_LEVELS)[number],\n\t\t\t)\n\t\t) {\n\t\t\tthrow new OrchestrationProfileError(\"Orchestration profile model candidate is invalid.\");\n\t\t}\n\t\treturn {\n\t\t\tprovider: candidate.provider,\n\t\t\tmodelId: candidate.modelId,\n\t\t\tthinkingLevel: candidate.thinkingLevel as (typeof ORCHESTRATION_THINKING_LEVELS)[number],\n\t\t};\n\t});\n\tif (\n\t\tvalue.schemaVersion !== ORCHESTRATION_SCHEMA_VERSION ||\n\t\ttypeof value.profileId !== \"string\" ||\n\t\tvalue.profileId.length === 0 ||\n\t\tvalue.profileId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\ttypeof value.description !== \"string\" ||\n\t\tvalue.description.length === 0 ||\n\t\tvalue.description.length > MAX_ORCHESTRATION_DESCRIPTION_LENGTH ||\n\t\ttypeof value.role !== \"string\" ||\n\t\t!WORKER_ROLES.includes(value.role as (typeof WORKER_ROLES)[number]) ||\n\t\t(modelPolicy.mode !== \"fixed\" && modelPolicy.mode !== \"ordered-fallback\") ||\n\t\t!Array.isArray(value.capabilityCeiling) ||\n\t\tvalue.capabilityCeiling.length > MAX_ORCHESTRATION_COLLECTION_LENGTH ||\n\t\t!value.capabilityCeiling.every(\n\t\t\t(capability) =>\n\t\t\t\ttypeof capability === \"string\" &&\n\t\t\t\tHARNESS_CAPABILITIES.includes(capability as (typeof HARNESS_CAPABILITIES)[number]),\n\t\t) ||\n\t\t!isStringArray(value.toolNames) ||\n\t\t!isStringArray(value.resourceProfileNames) ||\n\t\t!isStringArray(value.dispatchProfileIds) ||\n\t\t!Number.isSafeInteger(value.maxConcurrent) ||\n\t\t!Number.isSafeInteger(value.leaseTtlMs) ||\n\t\ttypeof value.requireIndependentVerification !== \"boolean\" ||\n\t\t(value.verificationProfileId !== undefined &&\n\t\t\t(typeof value.verificationProfileId !== \"string\" ||\n\t\t\t\tvalue.verificationProfileId.length === 0 ||\n\t\t\t\tvalue.verificationProfileId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH)) ||\n\t\ttypeof value.createdAt !== \"string\" ||\n\t\tvalue.createdAt.length === 0 ||\n\t\tvalue.createdAt.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\ttypeof value.updatedAt !== \"string\" ||\n\t\tvalue.updatedAt.length === 0 ||\n\t\tvalue.updatedAt.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Orchestration profile is invalid.\");\n\t}\n\tconst profile = structuredClone({\n\t\tschemaVersion: ORCHESTRATION_SCHEMA_VERSION,\n\t\tprofileId: value.profileId,\n\t\tdescription: value.description,\n\t\trole: value.role as OrchestrationProfile[\"role\"],\n\t\tmodelPolicy: { mode: modelPolicy.mode as OrchestrationProfile[\"modelPolicy\"][\"mode\"], candidates },\n\t\tcapabilityCeiling: value.capabilityCeiling as OrchestrationProfile[\"capabilityCeiling\"],\n\t\ttoolNames: value.toolNames,\n\t\tresourceProfileNames: value.resourceProfileNames,\n\t\tdispatchProfileIds: value.dispatchProfileIds,\n\t\t...(executionPolicy\n\t\t\t? {\n\t\t\t\t\texecutionPolicy: {\n\t\t\t\t\t\tallowedExecutables: executionPolicy.allowedExecutables as string[],\n\t\t\t\t\t\tallowedEnvironmentVariables: executionPolicy.allowedEnvironmentVariables as string[],\n\t\t\t\t\t\tmaxOutputBytes: Number(executionPolicy.maxOutputBytes),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(isPlainRecord(delegationLimits)\n\t\t\t? {\n\t\t\t\t\tdelegationLimits: {\n\t\t\t\t\t\tmaxDepth: Number(delegationLimits.maxDepth),\n\t\t\t\t\t\tmaxChildrenPerAgent: Number(delegationLimits.maxChildrenPerAgent),\n\t\t\t\t\t\t...(delegationLimits.maxNestedAgentsPerSession !== undefined\n\t\t\t\t\t\t\t? { maxNestedAgentsPerSession: Number(delegationLimits.maxNestedAgentsPerSession) }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\tbudget,\n\t\tmaxConcurrent: Number(value.maxConcurrent),\n\t\tleaseTtlMs: Number(value.leaseTtlMs),\n\t\trequireIndependentVerification: value.requireIndependentVerification,\n\t\t...(typeof value.verificationProfileId === \"string\"\n\t\t\t? { verificationProfileId: value.verificationProfileId }\n\t\t\t: {}),\n\t\t...(sourcePath ? { sourcePath } : {}),\n\t\tcreatedAt: value.createdAt,\n\t\tupdatedAt: value.updatedAt,\n\t}) as OrchestrationProfile;\n\tvalidateOrchestrationProfile(profile);\n\treturn profile;\n}\n\nfunction freezeProfile(profile: OrchestrationProfile): OrchestrationProfile {\n\tconst clone = structuredClone(profile);\n\tfor (const candidate of clone.modelPolicy.candidates) Object.freeze(candidate);\n\tObject.freeze(clone.modelPolicy.candidates);\n\tObject.freeze(clone.modelPolicy);\n\tObject.freeze(clone.capabilityCeiling);\n\tObject.freeze(clone.toolNames);\n\tObject.freeze(clone.resourceProfileNames);\n\tObject.freeze(clone.dispatchProfileIds);\n\tif (clone.executionPolicy) {\n\t\tObject.freeze(clone.executionPolicy.allowedExecutables);\n\t\tObject.freeze(clone.executionPolicy.allowedEnvironmentVariables);\n\t\tObject.freeze(clone.executionPolicy);\n\t}\n\tif (clone.delegationLimits) Object.freeze(clone.delegationLimits);\n\tObject.freeze(clone.budget);\n\treturn Object.freeze(clone);\n}\n\nexport class OrchestrationProfileRegistry {\n\tprivate readonly profiles = new Map<string, OrchestrationProfile>();\n\n\tconstructor(profiles: readonly OrchestrationProfile[] = []) {\n\t\tfor (const profile of profiles) this.register(profile);\n\t\tfor (const profile of this.profiles.values()) {\n\t\t\tfor (const dispatchedProfileId of profile.dispatchProfileIds) {\n\t\t\t\tconst target = this.profiles.get(dispatchedProfileId);\n\t\t\t\tif (!target) {\n\t\t\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t\t\t`Profile '${profile.profileId}' dispatches missing profile '${dispatchedProfileId}'.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (profile.verificationProfileId) {\n\t\t\t\tconst verifier = this.profiles.get(profile.verificationProfileId);\n\t\t\t\tif (!verifier) {\n\t\t\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t\t\t`Profile '${profile.profileId}' requires missing verifier profile '${profile.verificationProfileId}'.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (verifier.role !== \"verifier\") {\n\t\t\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t\t\t`Profile '${profile.profileId}' verificationProfileId '${profile.verificationProfileId}' is not a verifier.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (profile.role === \"orchestrator\") {\n\t\t\t\tfor (const dispatchedProfileId of profile.dispatchProfileIds) {\n\t\t\t\t\tconst worker = this.profiles.get(dispatchedProfileId);\n\t\t\t\t\tif (\n\t\t\t\t\t\tworker?.verificationProfileId &&\n\t\t\t\t\t\t!profile.dispatchProfileIds.includes(worker.verificationProfileId)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t\t\t\t`Orchestrator '${profile.profileId}' dispatches '${worker.profileId}' but not its verifier '${worker.verificationProfileId}'.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tregister(profile: OrchestrationProfile): void {\n\t\tvalidateOrchestrationProfile(profile);\n\t\tif (this.profiles.has(profile.profileId)) {\n\t\t\tthrow new OrchestrationProfileError(`Duplicate orchestration profile '${profile.profileId}'.`);\n\t\t}\n\t\tthis.profiles.set(profile.profileId, freezeProfile(profile));\n\t}\n\n\tget(profileId: string): OrchestrationProfile | undefined {\n\t\tconst profile = this.profiles.get(profileId);\n\t\treturn profile ? structuredClone(profile) : undefined;\n\t}\n\n\tlist(): OrchestrationProfile[] {\n\t\treturn [...this.profiles.values()].map((profile) => structuredClone(profile));\n\t}\n}\n\nexport function resolveProfileModel(\n\tprofile: OrchestrationProfile,\n\thealth: ModelHealthView,\n): OrchestrationModelBinding | undefined {\n\tif (profile.modelPolicy.mode === \"fixed\") {\n\t\tconst fixed = profile.modelPolicy.candidates[0];\n\t\treturn fixed && health.isHealthy(fixed) ? structuredClone(fixed) : undefined;\n\t}\n\tconst selected = profile.modelPolicy.candidates.find((candidate) => health.isHealthy(candidate));\n\treturn selected ? structuredClone(selected) : undefined;\n}\n\nexport function planProfileDispatch(args: {\n\trequest: OrchestrationDispatchRequest;\n\ttask: TaskContract;\n\tattemptId: string;\n\tsubjectId: string;\n\tregistry: OrchestrationProfileRegistry;\n\thealth: ModelHealthView;\n\tpolicyCompiler: ExecutionPolicyCompiler;\n\ttoolManifests: readonly ToolCapabilityManifest[];\n\tresources: readonly ResourcePointer[];\n\treadPaths: readonly string[];\n\twritePaths?: readonly string[];\n\tdeniedPaths?: readonly string[];\n\tpolicyVersion: string;\n}): ProfileDispatchPlanResult {\n\tconst profile = args.registry.get(args.request.profileId);\n\tif (!profile) return { outcome: \"deny\", decisions: [], reasonCodes: [\"profile_model_unavailable\"] };\n\tif (profile.role !== args.task.role) {\n\t\treturn { outcome: \"deny\", decisions: [], reasonCodes: [\"required_capability_exceeds_role_ceiling\"] };\n\t}\n\tconst model = resolveProfileModel(profile, args.health);\n\tif (!model) return { outcome: \"deny\", decisions: [], reasonCodes: [\"profile_model_unavailable\"] };\n\tconst selectedResources = args.resources.filter((resource) => args.request.resourcePointerIds.includes(resource.id));\n\tconst manifestsByName = new Map(args.toolManifests.map((manifest) => [manifest.toolName, manifest]));\n\tconst requestedTools = profile.toolNames.filter((toolName) => {\n\t\tconst manifest = manifestsByName.get(toolName);\n\t\treturn manifest?.capabilities.every((capability) => args.task.requiredCapabilities.includes(capability)) === true;\n\t});\n\tconst policyInput: CompileExecutionGrantInput = {\n\t\tobjectiveId: args.task.objectiveId,\n\t\ttaskId: args.task.taskId,\n\t\tattemptId: args.attemptId,\n\t\tsubjectId: args.subjectId,\n\t\trole: profile.role,\n\t\trequiredCapabilities: args.task.requiredCapabilities,\n\t\trequestedCapabilities: args.task.requiredCapabilities,\n\t\tauthorityCapabilities: profile.capabilityCeiling,\n\t\trequestedTools,\n\t\ttoolManifests: args.toolManifests,\n\t\tresources: selectedResources,\n\t\treadPaths: args.readPaths,\n\t\twritePaths: args.writePaths,\n\t\tdeniedPaths: args.deniedPaths,\n\t\trequestedBudget: profile.budget,\n\t\tauthorityBudget: profile.budget,\n\t\tpolicyVersion: args.policyVersion,\n\t};\n\tconst compiled = args.policyCompiler.compile(policyInput);\n\tif (compiled.outcome !== \"allow\") return compiled;\n\treturn { outcome: \"allow\", plan: { profile, model, grant: compiled.grant, toolManifests: compiled.toolManifests } };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"profile-registry.js","sourceRoot":"","sources":["../../../src/core/orchestration/profile-registry.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC/G,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAWrE,OAAO,EACN,oBAAoB,EACpB,gCAAgC,EAChC,6BAA6B,EAC7B,mCAAmC,EACnC,oCAAoC,EACpC,iCAAiC,EACjC,8CAA8C,EAC9C,mCAAmC,EACnC,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,EACtC,gCAAgC,EAChC,4BAA4B,EAC5B,6BAA6B,EAC7B,YAAY,EACZ,YAAY,GACZ,MAAM,gBAAgB,CAAC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C,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,IAAI,CAAC;IACnH,CAAC,CAAC,CAAC;IACH,MAAM,WAAW,GAA+B;QAC/C,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW;QAClC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;QACxB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,oBAAoB;QACpD,qBAAqB,EAAE,IAAI,CAAC,IAAI,CAAC,oBAAoB;QACrD,qBAAqB,EAAE,OAAO,CAAC,iBAAiB;QAChD,cAAc;QACd,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,SAAS,EAAE,iBAAiB;QAC5B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,eAAe,EAAE,OAAO,CAAC,MAAM;QAC/B,eAAe,EAAE,OAAO,CAAC,MAAM;QAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;KACjC,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1D,IAAI,QAAQ,CAAC,OAAO,KAAK,OAAO;QAAE,OAAO,QAAQ,CAAC;IAClD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC;AACrH,CAAC","sourcesContent":["import path from \"node:path\";\nimport { describeToolCapabilityAuthority, resolveProfileToolCapabilities } from \"../tool-capability-policy.ts\";\nimport { hasOnlyKeys, isPlainRecord } from \"../util/value-guards.ts\";\nimport type {\n\tExecutionGrant,\n\tOrchestrationDispatchRequest,\n\tOrchestrationModelBinding,\n\tOrchestrationProfile,\n\tResourcePointer,\n\tRiskBudget,\n\tTaskContract,\n\tToolCapabilityManifest,\n} from \"./contracts.ts\";\nimport {\n\tHARNESS_CAPABILITIES,\n\tMAX_ORCHESTRATION_AGENT_BINDINGS,\n\tMAX_ORCHESTRATION_AGENT_DEPTH,\n\tMAX_ORCHESTRATION_COLLECTION_LENGTH,\n\tMAX_ORCHESTRATION_DESCRIPTION_LENGTH,\n\tMAX_ORCHESTRATION_DIRECT_CHILDREN,\n\tMAX_ORCHESTRATION_DISPATCH_INSTRUCTIONS_LENGTH,\n\tMAX_ORCHESTRATION_IDENTIFIER_LENGTH,\n\tMAX_ORCHESTRATION_MODEL_ID_LENGTH,\n\tMAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH,\n\tMAX_ORCHESTRATION_PROCESS_OUTPUT_BYTES,\n\tMAX_WORKER_AUTHORITY_PATH_LENGTH,\n\tORCHESTRATION_SCHEMA_VERSION,\n\tORCHESTRATION_THINKING_LEVELS,\n\ttoJsonObject,\n\tWORKER_ROLES,\n} from \"./contracts.ts\";\nimport { ORCHESTRATION_PROFILE_TOOL_NAMES } from \"./lane-tool-manifests.ts\";\nimport {\n\ttype CompileExecutionGrantInput,\n\tDEFAULT_ROLE_CAPABILITY_CEILINGS,\n\ttype ExecutionPolicyCompiler,\n\ttype PolicyCompilationResult,\n} from \"./policy-compiler.ts\";\nimport { parseRiskBudget, validateRiskBudget } from \"./risk-budget.ts\";\n\nexport interface ModelHealthView {\n\tisHealthy(binding: OrchestrationModelBinding): boolean;\n}\n\nexport interface ProfileDispatchPlan {\n\tprofile: OrchestrationProfile;\n\tmodel: OrchestrationModelBinding;\n\tgrant: ExecutionGrant;\n\ttoolManifests: readonly ToolCapabilityManifest[];\n}\n\nexport type ProfileDispatchPlanResult =\n\t| { outcome: \"allow\"; plan: ProfileDispatchPlan }\n\t| Exclude<PolicyCompilationResult, { outcome: \"allow\" }>\n\t| { outcome: \"deny\"; decisions: readonly []; reasonCodes: readonly [\"profile_model_unavailable\"] };\n\nexport class OrchestrationProfileError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"OrchestrationProfileError\";\n\t}\n}\n\nfunction duplicateStrings(values: readonly string[]): string[] {\n\tconst seen = new Set<string>();\n\tconst duplicates = new Set<string>();\n\tfor (const value of values) {\n\t\tif (seen.has(value)) duplicates.add(value);\n\t\tseen.add(value);\n\t}\n\treturn [...duplicates];\n}\n\nexport function parseOrchestrationDispatchRequest(value: unknown): OrchestrationDispatchRequest {\n\tif (!isPlainRecord(value)) throw new OrchestrationProfileError(\"Dispatch request must be an object.\");\n\tif (!hasOnlyKeys(value, [\"taskId\", \"profileId\", \"instructions\", \"resourcePointerIds\"])) {\n\t\tthrow new OrchestrationProfileError(\"Dispatch request contains an unsupported durable metadata field.\");\n\t}\n\tif (\n\t\ttypeof value.taskId !== \"string\" ||\n\t\t!value.taskId ||\n\t\tvalue.taskId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\ttypeof value.profileId !== \"string\" ||\n\t\t!value.profileId ||\n\t\tvalue.profileId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\ttypeof value.instructions !== \"string\" ||\n\t\tvalue.instructions.length > MAX_ORCHESTRATION_DISPATCH_INSTRUCTIONS_LENGTH ||\n\t\t!value.instructions.trim() ||\n\t\t!Array.isArray(value.resourcePointerIds) ||\n\t\tvalue.resourcePointerIds.length > MAX_ORCHESTRATION_COLLECTION_LENGTH ||\n\t\t!value.resourcePointerIds.every(\n\t\t\t(entry) =>\n\t\t\t\ttypeof entry === \"string\" && entry.length > 0 && entry.length <= MAX_ORCHESTRATION_IDENTIFIER_LENGTH,\n\t\t) ||\n\t\tnew Set(value.resourcePointerIds).size !== value.resourcePointerIds.length\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Dispatch request is invalid.\");\n\t}\n\treturn {\n\t\ttaskId: value.taskId,\n\t\tprofileId: value.profileId,\n\t\tinstructions: value.instructions.trim(),\n\t\tresourcePointerIds: [...value.resourcePointerIds],\n\t};\n}\n\nexport function validateOrchestrationProfile(profile: OrchestrationProfile): void {\n\tif (profile.schemaVersion !== ORCHESTRATION_SCHEMA_VERSION) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' has an unsupported schema version.`);\n\t}\n\tif (\n\t\tprofile.profileId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\t!profile.profileId.trim() ||\n\t\tprofile.description.length > MAX_ORCHESTRATION_DESCRIPTION_LENGTH ||\n\t\t!profile.description.trim()\n\t)\n\t\tthrow new OrchestrationProfileError(\"Profile id and description are required.\");\n\tif (profile.role !== \"orchestrator\" && profile.dispatchProfileIds.length > 0) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Only orchestrator profiles may declare dispatchProfileIds ('${profile.profileId}').`,\n\t\t);\n\t}\n\tif (profile.dispatchProfileIds.includes(profile.profileId)) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' cannot dispatch itself.`);\n\t}\n\tif (profile.requireIndependentVerification) {\n\t\tif (profile.role === \"verifier\") {\n\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t`Verifier profile '${profile.profileId}' cannot require another verifier.`,\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t!profile.verificationProfileId?.trim() ||\n\t\t\tprofile.verificationProfileId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH\n\t\t) {\n\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t`Profile '${profile.profileId}' requires independent verification but has no verificationProfileId.`,\n\t\t\t);\n\t\t}\n\t} else if (profile.verificationProfileId !== undefined) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' cannot declare verificationProfileId without requiring verification.`,\n\t\t);\n\t}\n\tif (profile.verificationProfileId === profile.profileId) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' cannot verify itself.`);\n\t}\n\tif (\n\t\t!profile.createdAt.trim() ||\n\t\tprofile.createdAt.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\t!profile.updatedAt.trim() ||\n\t\tprofile.updatedAt.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH\n\t) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' timestamps are invalid.`);\n\t}\n\tif (\n\t\tprofile.workspacePath !== undefined &&\n\t\t(!profile.workspacePath.trim() ||\n\t\t\tprofile.workspacePath.length > MAX_WORKER_AUTHORITY_PATH_LENGTH ||\n\t\t\t(!path.isAbsolute(profile.workspacePath) && !path.win32.isAbsolute(profile.workspacePath)))\n\t) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' workspacePath must be an absolute path.`);\n\t}\n\tfor (const [label, values] of [\n\t\t[\"capabilityCeiling\", profile.capabilityCeiling],\n\t\t[\"toolNames\", profile.toolNames],\n\t\t[\"resourceProfileNames\", profile.resourceProfileNames],\n\t\t[\"dispatchProfileIds\", profile.dispatchProfileIds],\n\t] as const) {\n\t\tif (\n\t\t\tvalues.length > MAX_ORCHESTRATION_COLLECTION_LENGTH ||\n\t\t\tvalues.some((value) => !value.trim() || value.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH)\n\t\t) {\n\t\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' contains an invalid ${label}.`);\n\t\t}\n\t\tconst duplicates = duplicateStrings(values);\n\t\tif (duplicates.length > 0) {\n\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t`Profile '${profile.profileId}' contains duplicate ${label}: ${duplicates.join(\", \")}.`,\n\t\t\t);\n\t\t}\n\t}\n\tconst roleCeiling = new Set(DEFAULT_ROLE_CAPABILITY_CEILINGS[profile.role]);\n\tconst outOfRoleCapabilities = profile.capabilityCeiling.filter((capability) => !roleCeiling.has(capability));\n\tif (outOfRoleCapabilities.length > 0) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' exceeds the ${profile.role} role ceiling: ${outOfRoleCapabilities.join(\", \")}.`,\n\t\t);\n\t}\n\tif (\n\t\tprofile.modelPolicy.candidates.length === 0 ||\n\t\tprofile.modelPolicy.candidates.length > MAX_ORCHESTRATION_COLLECTION_LENGTH\n\t) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' must declare a model candidate.`);\n\t}\n\tif (profile.modelPolicy.mode === \"fixed\" && profile.modelPolicy.candidates.length !== 1) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Fixed profile '${profile.profileId}' must declare exactly one model candidate.`,\n\t\t);\n\t}\n\tfor (const candidate of profile.modelPolicy.candidates) {\n\t\tif (\n\t\t\tcandidate.provider.length > MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH ||\n\t\t\t!candidate.provider.trim() ||\n\t\t\tcandidate.modelId.length > MAX_ORCHESTRATION_MODEL_ID_LENGTH ||\n\t\t\t!candidate.modelId.trim()\n\t\t) {\n\t\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' contains an invalid model binding.`);\n\t\t}\n\t}\n\tconst duplicateModels = duplicateStrings(\n\t\tprofile.modelPolicy.candidates.map((candidate) => `${candidate.provider}/${candidate.modelId}`),\n\t);\n\tif (duplicateModels.length > 0) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' contains duplicate model candidates: ${duplicateModels.join(\", \")}.`,\n\t\t);\n\t}\n\tif (!Number.isSafeInteger(profile.maxConcurrent) || profile.maxConcurrent <= 0) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' maxConcurrent must be positive.`);\n\t}\n\tif (!Number.isSafeInteger(profile.leaseTtlMs) || profile.leaseTtlMs <= 0) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' leaseTtlMs must be positive.`);\n\t}\n\tif (\n\t\tprofile.delegationLimits &&\n\t\t(!Number.isSafeInteger(profile.delegationLimits.maxDepth) ||\n\t\t\tprofile.delegationLimits.maxDepth < 0 ||\n\t\t\tprofile.delegationLimits.maxDepth > MAX_ORCHESTRATION_AGENT_DEPTH ||\n\t\t\t!Number.isSafeInteger(profile.delegationLimits.maxChildrenPerAgent) ||\n\t\t\tprofile.delegationLimits.maxChildrenPerAgent < 0 ||\n\t\t\tprofile.delegationLimits.maxChildrenPerAgent > MAX_ORCHESTRATION_DIRECT_CHILDREN ||\n\t\t\t(profile.delegationLimits.maxNestedAgentsPerSession !== undefined &&\n\t\t\t\t(!Number.isSafeInteger(profile.delegationLimits.maxNestedAgentsPerSession) ||\n\t\t\t\t\tprofile.delegationLimits.maxNestedAgentsPerSession < 0 ||\n\t\t\t\t\tprofile.delegationLimits.maxNestedAgentsPerSession > MAX_ORCHESTRATION_AGENT_BINDINGS)))\n\t) {\n\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' delegationLimits are invalid.`);\n\t}\n\ttry {\n\t\tvalidateRiskBudget(profile.budget, `Profile '${profile.profileId}' budget`);\n\t} catch (error) {\n\t\tthrow new OrchestrationProfileError(error instanceof Error ? error.message : String(error));\n\t}\n\tif (profile.budget.maxWallClockMs !== undefined && profile.budget.maxWallClockMs <= 0) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' maxWallClockMs budget must be positive when specified.`,\n\t\t);\n\t}\n\tif (profile.budget.maxWallClockMs !== undefined && profile.leaseTtlMs < profile.budget.maxWallClockMs) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' leaseTtlMs must cover its maxWallClockMs budget.`,\n\t\t);\n\t}\n\tconst processCapable =\n\t\tprofile.capabilityCeiling.includes(\"process.exec\") || profile.capabilityCeiling.includes(\"tests.execute\");\n\tconst directProcessLauncher = profile.toolNames.includes(\"run_process\");\n\tif (directProcessLauncher && (!profile.executionPolicy || profile.executionPolicy.allowedExecutables.length === 0)) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' must declare executionPolicy.allowedExecutables for run_process.`,\n\t\t);\n\t}\n\tif (!processCapable && profile.executionPolicy) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' cannot declare executionPolicy without process capabilities.`,\n\t\t);\n\t}\n\tif (profile.executionPolicy) {\n\t\tif (\n\t\t\tprofile.executionPolicy.allowedExecutables.length > MAX_ORCHESTRATION_COLLECTION_LENGTH ||\n\t\t\tprofile.executionPolicy.allowedEnvironmentVariables.length > MAX_ORCHESTRATION_COLLECTION_LENGTH ||\n\t\t\tprofile.executionPolicy.allowedExecutables.some(\n\t\t\t\t(executable) =>\n\t\t\t\t\t!executable.trim() ||\n\t\t\t\t\texecutable.length > MAX_WORKER_AUTHORITY_PATH_LENGTH ||\n\t\t\t\t\t/[\\0\\r\\n]/.test(executable),\n\t\t\t) ||\n\t\t\tprofile.executionPolicy.allowedEnvironmentVariables.some(\n\t\t\t\t(name) => name.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name),\n\t\t\t) ||\n\t\t\t!Number.isSafeInteger(profile.executionPolicy.maxOutputBytes) ||\n\t\t\tprofile.executionPolicy.maxOutputBytes <= 0 ||\n\t\t\tprofile.executionPolicy.maxOutputBytes > MAX_ORCHESTRATION_PROCESS_OUTPUT_BYTES\n\t\t) {\n\t\t\tthrow new OrchestrationProfileError(`Profile '${profile.profileId}' executionPolicy is invalid.`);\n\t\t}\n\t}\n\tconst unknownTools = profile.toolNames.filter(\n\t\t(toolName) => !(ORCHESTRATION_PROFILE_TOOL_NAMES as readonly string[]).includes(toolName),\n\t);\n\tif (unknownTools.length > 0) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\t`Profile '${profile.profileId}' contains unclassified orchestration tools: ${unknownTools.join(\", \")}.`,\n\t\t);\n\t}\n\tfor (const toolName of profile.toolNames) {\n\t\tif (!resolveProfileToolCapabilities(profile, toolName)) {\n\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t`Profile '${profile.profileId}' tool '${toolName}' lacks ${describeToolCapabilityAuthority(toolName)} authority.`,\n\t\t\t);\n\t\t}\n\t}\n\ttoJsonObject({ profile });\n}\n\nfunction isStringArray(value: unknown, maxLength = MAX_ORCHESTRATION_IDENTIFIER_LENGTH): value is string[] {\n\treturn (\n\t\tArray.isArray(value) &&\n\t\tvalue.length <= MAX_ORCHESTRATION_COLLECTION_LENGTH &&\n\t\tvalue.every((entry) => typeof entry === \"string\" && entry.length > 0 && entry.length <= maxLength)\n\t);\n}\n\nexport function parseOrchestrationProfile(value: unknown, sourcePath?: string): OrchestrationProfile {\n\tif (!isPlainRecord(value)) throw new OrchestrationProfileError(\"Orchestration profile must be an object.\");\n\tif (\n\t\t!hasOnlyKeys(value, [\n\t\t\t\"schemaVersion\",\n\t\t\t\"profileId\",\n\t\t\t\"description\",\n\t\t\t\"role\",\n\t\t\t\"modelPolicy\",\n\t\t\t\"capabilityCeiling\",\n\t\t\t\"toolNames\",\n\t\t\t\"workspacePath\",\n\t\t\t\"resourceProfileNames\",\n\t\t\t\"dispatchProfileIds\",\n\t\t\t\"executionPolicy\",\n\t\t\t\"delegationLimits\",\n\t\t\t\"budget\",\n\t\t\t\"maxConcurrent\",\n\t\t\t\"leaseTtlMs\",\n\t\t\t\"requireIndependentVerification\",\n\t\t\t\"verificationProfileId\",\n\t\t\t\"createdAt\",\n\t\t\t\"updatedAt\",\n\t\t])\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Orchestration profile contains an unsupported field.\");\n\t}\n\tconst modelPolicy = value.modelPolicy;\n\tconst rawBudget = value.budget;\n\tlet budget: RiskBudget;\n\tconst executionPolicy = value.executionPolicy;\n\tconst delegationLimits = value.delegationLimits;\n\tif (\n\t\t!isPlainRecord(modelPolicy) ||\n\t\t!hasOnlyKeys(modelPolicy, [\"mode\", \"candidates\"]) ||\n\t\t!Array.isArray(modelPolicy.candidates) ||\n\t\tmodelPolicy.candidates.length > MAX_ORCHESTRATION_COLLECTION_LENGTH\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Orchestration profile modelPolicy is invalid.\");\n\t}\n\ttry {\n\t\tbudget = parseRiskBudget(rawBudget, \"Orchestration profile budget\");\n\t} catch (error) {\n\t\tthrow new OrchestrationProfileError(\n\t\t\terror instanceof Error ? error.message : \"Orchestration profile budget is invalid.\",\n\t\t);\n\t}\n\tif (\n\t\texecutionPolicy !== undefined &&\n\t\t(!isPlainRecord(executionPolicy) ||\n\t\t\t!hasOnlyKeys(executionPolicy, [\"allowedExecutables\", \"allowedEnvironmentVariables\", \"maxOutputBytes\"]) ||\n\t\t\t!isStringArray(executionPolicy.allowedExecutables, MAX_WORKER_AUTHORITY_PATH_LENGTH) ||\n\t\t\t!isStringArray(executionPolicy.allowedEnvironmentVariables) ||\n\t\t\t!Number.isSafeInteger(executionPolicy.maxOutputBytes))\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Orchestration profile executionPolicy is invalid.\");\n\t}\n\tif (\n\t\tdelegationLimits !== undefined &&\n\t\t(!isPlainRecord(delegationLimits) ||\n\t\t\t!hasOnlyKeys(delegationLimits, [\"maxDepth\", \"maxChildrenPerAgent\", \"maxNestedAgentsPerSession\"]) ||\n\t\t\t!Number.isSafeInteger(delegationLimits.maxDepth) ||\n\t\t\t!Number.isSafeInteger(delegationLimits.maxChildrenPerAgent) ||\n\t\t\t(delegationLimits.maxNestedAgentsPerSession !== undefined &&\n\t\t\t\t!Number.isSafeInteger(delegationLimits.maxNestedAgentsPerSession)))\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Orchestration profile delegationLimits are invalid.\");\n\t}\n\tconst candidates = modelPolicy.candidates.map((candidate) => {\n\t\tif (!isPlainRecord(candidate) || !hasOnlyKeys(candidate, [\"provider\", \"modelId\", \"thinkingLevel\"])) {\n\t\t\tthrow new OrchestrationProfileError(\"Orchestration profile model candidate is invalid.\");\n\t\t}\n\t\tif (\n\t\t\ttypeof candidate.provider !== \"string\" ||\n\t\t\tcandidate.provider.length === 0 ||\n\t\t\tcandidate.provider.length > MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH ||\n\t\t\ttypeof candidate.modelId !== \"string\" ||\n\t\t\tcandidate.modelId.length === 0 ||\n\t\t\tcandidate.modelId.length > MAX_ORCHESTRATION_MODEL_ID_LENGTH ||\n\t\t\ttypeof candidate.thinkingLevel !== \"string\" ||\n\t\t\t!ORCHESTRATION_THINKING_LEVELS.includes(\n\t\t\t\tcandidate.thinkingLevel as (typeof ORCHESTRATION_THINKING_LEVELS)[number],\n\t\t\t)\n\t\t) {\n\t\t\tthrow new OrchestrationProfileError(\"Orchestration profile model candidate is invalid.\");\n\t\t}\n\t\treturn {\n\t\t\tprovider: candidate.provider,\n\t\t\tmodelId: candidate.modelId,\n\t\t\tthinkingLevel: candidate.thinkingLevel as (typeof ORCHESTRATION_THINKING_LEVELS)[number],\n\t\t};\n\t});\n\tif (\n\t\tvalue.schemaVersion !== ORCHESTRATION_SCHEMA_VERSION ||\n\t\ttypeof value.profileId !== \"string\" ||\n\t\tvalue.profileId.length === 0 ||\n\t\tvalue.profileId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\ttypeof value.description !== \"string\" ||\n\t\tvalue.description.length === 0 ||\n\t\tvalue.description.length > MAX_ORCHESTRATION_DESCRIPTION_LENGTH ||\n\t\ttypeof value.role !== \"string\" ||\n\t\t!WORKER_ROLES.includes(value.role as (typeof WORKER_ROLES)[number]) ||\n\t\t(modelPolicy.mode !== \"fixed\" && modelPolicy.mode !== \"ordered-fallback\") ||\n\t\t!Array.isArray(value.capabilityCeiling) ||\n\t\tvalue.capabilityCeiling.length > MAX_ORCHESTRATION_COLLECTION_LENGTH ||\n\t\t!value.capabilityCeiling.every(\n\t\t\t(capability) =>\n\t\t\t\ttypeof capability === \"string\" &&\n\t\t\t\tHARNESS_CAPABILITIES.includes(capability as (typeof HARNESS_CAPABILITIES)[number]),\n\t\t) ||\n\t\t!isStringArray(value.toolNames) ||\n\t\t(value.workspacePath !== undefined &&\n\t\t\t(typeof value.workspacePath !== \"string\" ||\n\t\t\t\t!value.workspacePath.trim() ||\n\t\t\t\tvalue.workspacePath.length > MAX_WORKER_AUTHORITY_PATH_LENGTH ||\n\t\t\t\t(!path.isAbsolute(value.workspacePath) && !path.win32.isAbsolute(value.workspacePath)))) ||\n\t\t!isStringArray(value.resourceProfileNames) ||\n\t\t!isStringArray(value.dispatchProfileIds) ||\n\t\t!Number.isSafeInteger(value.maxConcurrent) ||\n\t\t!Number.isSafeInteger(value.leaseTtlMs) ||\n\t\ttypeof value.requireIndependentVerification !== \"boolean\" ||\n\t\t(value.verificationProfileId !== undefined &&\n\t\t\t(typeof value.verificationProfileId !== \"string\" ||\n\t\t\t\tvalue.verificationProfileId.length === 0 ||\n\t\t\t\tvalue.verificationProfileId.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH)) ||\n\t\ttypeof value.createdAt !== \"string\" ||\n\t\tvalue.createdAt.length === 0 ||\n\t\tvalue.createdAt.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH ||\n\t\ttypeof value.updatedAt !== \"string\" ||\n\t\tvalue.updatedAt.length === 0 ||\n\t\tvalue.updatedAt.length > MAX_ORCHESTRATION_IDENTIFIER_LENGTH\n\t) {\n\t\tthrow new OrchestrationProfileError(\"Orchestration profile is invalid.\");\n\t}\n\tconst profile = structuredClone({\n\t\tschemaVersion: ORCHESTRATION_SCHEMA_VERSION,\n\t\tprofileId: value.profileId,\n\t\tdescription: value.description,\n\t\trole: value.role as OrchestrationProfile[\"role\"],\n\t\tmodelPolicy: { mode: modelPolicy.mode as OrchestrationProfile[\"modelPolicy\"][\"mode\"], candidates },\n\t\tcapabilityCeiling: value.capabilityCeiling as OrchestrationProfile[\"capabilityCeiling\"],\n\t\ttoolNames: value.toolNames,\n\t\t...(typeof value.workspacePath === \"string\" ? { workspacePath: value.workspacePath } : {}),\n\t\tresourceProfileNames: value.resourceProfileNames,\n\t\tdispatchProfileIds: value.dispatchProfileIds,\n\t\t...(executionPolicy\n\t\t\t? {\n\t\t\t\t\texecutionPolicy: {\n\t\t\t\t\t\tallowedExecutables: executionPolicy.allowedExecutables as string[],\n\t\t\t\t\t\tallowedEnvironmentVariables: executionPolicy.allowedEnvironmentVariables as string[],\n\t\t\t\t\t\tmaxOutputBytes: Number(executionPolicy.maxOutputBytes),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(isPlainRecord(delegationLimits)\n\t\t\t? {\n\t\t\t\t\tdelegationLimits: {\n\t\t\t\t\t\tmaxDepth: Number(delegationLimits.maxDepth),\n\t\t\t\t\t\tmaxChildrenPerAgent: Number(delegationLimits.maxChildrenPerAgent),\n\t\t\t\t\t\t...(delegationLimits.maxNestedAgentsPerSession !== undefined\n\t\t\t\t\t\t\t? { maxNestedAgentsPerSession: Number(delegationLimits.maxNestedAgentsPerSession) }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\tbudget,\n\t\tmaxConcurrent: Number(value.maxConcurrent),\n\t\tleaseTtlMs: Number(value.leaseTtlMs),\n\t\trequireIndependentVerification: value.requireIndependentVerification,\n\t\t...(typeof value.verificationProfileId === \"string\"\n\t\t\t? { verificationProfileId: value.verificationProfileId }\n\t\t\t: {}),\n\t\t...(sourcePath ? { sourcePath } : {}),\n\t\tcreatedAt: value.createdAt,\n\t\tupdatedAt: value.updatedAt,\n\t}) as OrchestrationProfile;\n\tvalidateOrchestrationProfile(profile);\n\treturn profile;\n}\n\nfunction freezeProfile(profile: OrchestrationProfile): OrchestrationProfile {\n\tconst clone = structuredClone(profile);\n\tfor (const candidate of clone.modelPolicy.candidates) Object.freeze(candidate);\n\tObject.freeze(clone.modelPolicy.candidates);\n\tObject.freeze(clone.modelPolicy);\n\tObject.freeze(clone.capabilityCeiling);\n\tObject.freeze(clone.toolNames);\n\tObject.freeze(clone.resourceProfileNames);\n\tObject.freeze(clone.dispatchProfileIds);\n\tif (clone.executionPolicy) {\n\t\tObject.freeze(clone.executionPolicy.allowedExecutables);\n\t\tObject.freeze(clone.executionPolicy.allowedEnvironmentVariables);\n\t\tObject.freeze(clone.executionPolicy);\n\t}\n\tif (clone.delegationLimits) Object.freeze(clone.delegationLimits);\n\tObject.freeze(clone.budget);\n\treturn Object.freeze(clone);\n}\n\nexport class OrchestrationProfileRegistry {\n\tprivate readonly profiles = new Map<string, OrchestrationProfile>();\n\n\tconstructor(profiles: readonly OrchestrationProfile[] = []) {\n\t\tfor (const profile of profiles) this.register(profile);\n\t\tfor (const profile of this.profiles.values()) {\n\t\t\tfor (const dispatchedProfileId of profile.dispatchProfileIds) {\n\t\t\t\tconst target = this.profiles.get(dispatchedProfileId);\n\t\t\t\tif (!target) {\n\t\t\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t\t\t`Profile '${profile.profileId}' dispatches missing profile '${dispatchedProfileId}'.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (profile.verificationProfileId) {\n\t\t\t\tconst verifier = this.profiles.get(profile.verificationProfileId);\n\t\t\t\tif (!verifier) {\n\t\t\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t\t\t`Profile '${profile.profileId}' requires missing verifier profile '${profile.verificationProfileId}'.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (verifier.role !== \"verifier\") {\n\t\t\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t\t\t`Profile '${profile.profileId}' verificationProfileId '${profile.verificationProfileId}' is not a verifier.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (profile.role === \"orchestrator\") {\n\t\t\t\tfor (const dispatchedProfileId of profile.dispatchProfileIds) {\n\t\t\t\t\tconst worker = this.profiles.get(dispatchedProfileId);\n\t\t\t\t\tif (\n\t\t\t\t\t\tworker?.verificationProfileId &&\n\t\t\t\t\t\t!profile.dispatchProfileIds.includes(worker.verificationProfileId)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new OrchestrationProfileError(\n\t\t\t\t\t\t\t`Orchestrator '${profile.profileId}' dispatches '${worker.profileId}' but not its verifier '${worker.verificationProfileId}'.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tregister(profile: OrchestrationProfile): void {\n\t\tvalidateOrchestrationProfile(profile);\n\t\tif (this.profiles.has(profile.profileId)) {\n\t\t\tthrow new OrchestrationProfileError(`Duplicate orchestration profile '${profile.profileId}'.`);\n\t\t}\n\t\tthis.profiles.set(profile.profileId, freezeProfile(profile));\n\t}\n\n\tget(profileId: string): OrchestrationProfile | undefined {\n\t\tconst profile = this.profiles.get(profileId);\n\t\treturn profile ? structuredClone(profile) : undefined;\n\t}\n\n\tlist(): OrchestrationProfile[] {\n\t\treturn [...this.profiles.values()].map((profile) => structuredClone(profile));\n\t}\n}\n\nexport function resolveProfileModel(\n\tprofile: OrchestrationProfile,\n\thealth: ModelHealthView,\n): OrchestrationModelBinding | undefined {\n\tif (profile.modelPolicy.mode === \"fixed\") {\n\t\tconst fixed = profile.modelPolicy.candidates[0];\n\t\treturn fixed && health.isHealthy(fixed) ? structuredClone(fixed) : undefined;\n\t}\n\tconst selected = profile.modelPolicy.candidates.find((candidate) => health.isHealthy(candidate));\n\treturn selected ? structuredClone(selected) : undefined;\n}\n\nexport function planProfileDispatch(args: {\n\trequest: OrchestrationDispatchRequest;\n\ttask: TaskContract;\n\tattemptId: string;\n\tsubjectId: string;\n\tregistry: OrchestrationProfileRegistry;\n\thealth: ModelHealthView;\n\tpolicyCompiler: ExecutionPolicyCompiler;\n\ttoolManifests: readonly ToolCapabilityManifest[];\n\tresources: readonly ResourcePointer[];\n\treadPaths: readonly string[];\n\twritePaths?: readonly string[];\n\tdeniedPaths?: readonly string[];\n\tpolicyVersion: string;\n}): ProfileDispatchPlanResult {\n\tconst profile = args.registry.get(args.request.profileId);\n\tif (!profile) return { outcome: \"deny\", decisions: [], reasonCodes: [\"profile_model_unavailable\"] };\n\tif (profile.role !== args.task.role) {\n\t\treturn { outcome: \"deny\", decisions: [], reasonCodes: [\"required_capability_exceeds_role_ceiling\"] };\n\t}\n\tconst model = resolveProfileModel(profile, args.health);\n\tif (!model) return { outcome: \"deny\", decisions: [], reasonCodes: [\"profile_model_unavailable\"] };\n\tconst selectedResources = args.resources.filter((resource) => args.request.resourcePointerIds.includes(resource.id));\n\tconst manifestsByName = new Map(args.toolManifests.map((manifest) => [manifest.toolName, manifest]));\n\tconst requestedTools = profile.toolNames.filter((toolName) => {\n\t\tconst manifest = manifestsByName.get(toolName);\n\t\treturn manifest?.capabilities.every((capability) => args.task.requiredCapabilities.includes(capability)) === true;\n\t});\n\tconst policyInput: CompileExecutionGrantInput = {\n\t\tobjectiveId: args.task.objectiveId,\n\t\ttaskId: args.task.taskId,\n\t\tattemptId: args.attemptId,\n\t\tsubjectId: args.subjectId,\n\t\trole: profile.role,\n\t\trequiredCapabilities: args.task.requiredCapabilities,\n\t\trequestedCapabilities: args.task.requiredCapabilities,\n\t\tauthorityCapabilities: profile.capabilityCeiling,\n\t\trequestedTools,\n\t\ttoolManifests: args.toolManifests,\n\t\tresources: selectedResources,\n\t\treadPaths: args.readPaths,\n\t\twritePaths: args.writePaths,\n\t\tdeniedPaths: args.deniedPaths,\n\t\trequestedBudget: profile.budget,\n\t\tauthorityBudget: profile.budget,\n\t\tpolicyVersion: args.policyVersion,\n\t};\n\tconst compiled = args.policyCompiler.compile(policyInput);\n\tif (compiled.outcome !== \"allow\") return compiled;\n\treturn { outcome: \"allow\", plan: { profile, model, grant: compiled.grant, toolManifests: compiled.toolManifests } };\n}\n"]}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import type { ModelRegistry } from "../model-registry.ts";
|
|
2
2
|
import type { SettingsManager } from "../settings-manager.ts";
|
|
3
|
-
import type { OrchestrationProfile, OrchestrationThinkingLevel
|
|
3
|
+
import type { OrchestrationProfile, OrchestrationThinkingLevel } from "./contracts.ts";
|
|
4
4
|
import type { SessionTaskProfileStore } from "./session-task-profile-store.ts";
|
|
5
5
|
export interface TaskProfileModelSelection {
|
|
6
6
|
provider: string;
|
|
7
7
|
modelId: string;
|
|
8
|
-
thinkingLevel: OrchestrationThinkingLevel;
|
|
9
8
|
}
|
|
10
9
|
export interface TaskProfileCreateInput {
|
|
11
10
|
task: string;
|
|
12
11
|
baseProfileId?: string;
|
|
13
12
|
model?: TaskProfileModelSelection;
|
|
13
|
+
thinkingLevel?: OrchestrationThinkingLevel;
|
|
14
|
+
path?: string;
|
|
14
15
|
toolNames?: readonly string[];
|
|
15
|
-
resourceProfileNames?: readonly string[];
|
|
16
|
-
budget?: RiskBudget;
|
|
17
16
|
}
|
|
18
17
|
export interface TaskProfileInspection {
|
|
19
18
|
baseProfiles: Array<{
|
|
@@ -21,6 +20,8 @@ export interface TaskProfileInspection {
|
|
|
21
20
|
role: string;
|
|
22
21
|
description: string;
|
|
23
22
|
}>;
|
|
23
|
+
/** Exact native-lane surface a no-base profile inherits from the live foreground session. */
|
|
24
|
+
inheritedToolNames: readonly string[];
|
|
24
25
|
models: Array<{
|
|
25
26
|
provider: string;
|
|
26
27
|
modelId: string;
|
|
@@ -46,6 +47,8 @@ export interface TaskProfileWriterOptions {
|
|
|
46
47
|
getModelRegistry(): ModelRegistry;
|
|
47
48
|
isModelExhausted(provider: string, modelId: string): boolean;
|
|
48
49
|
getActiveOrchestrationProfile(): OrchestrationProfile | undefined;
|
|
50
|
+
/** Host-compiled foreground inheritance used when no owner-authored base is selected. */
|
|
51
|
+
getInheritedBaseProfile(): OrchestrationProfile | undefined;
|
|
49
52
|
}
|
|
50
53
|
export declare class TaskProfileWriter implements TaskProfileWriterPort {
|
|
51
54
|
private readonly options;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-profile-writer.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/task-profile-writer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task-profile-writer.d.ts","sourceRoot":"","sources":["../../../src/core/orchestration/task-profile-writer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAGX,oBAAoB,EACpB,0BAA0B,EAC1B,MAAM,gBAAgB,CAAC;AAKxB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE/E,MAAM,WAAW,yBAAyB;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,yBAAyB,CAAC;IAClC,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACrC,YAAY,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9E,6FAA6F;IAC7F,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,MAAM,EAAE,KAAK,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,SAAS,0BAA0B,EAAE,CAAC;KACtD,CAAC,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;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