agentic-orchestrator 0.1.6 → 0.1.7
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/.prettierignore +10 -0
- package/.prettierrc.json +24 -0
- package/CLAUDE.md +3 -2
- package/README.md +47 -46
- package/agentic/orchestrator/defaults/policy.defaults.yaml +1 -1
- package/agentic/orchestrator/prompts/planner.system.md +1 -0
- package/agentic/orchestrator/schemas/agents.schema.json +4 -21
- package/agentic/orchestrator/schemas/gates.schema.json +4 -19
- package/agentic/orchestrator/schemas/index.schema.json +3 -14
- package/agentic/orchestrator/schemas/multi-project.schema.json +2 -8
- package/agentic/orchestrator/schemas/plan.schema.json +6 -26
- package/agentic/orchestrator/schemas/policy.schema.json +19 -81
- package/agentic/orchestrator/schemas/policy.user.schema.json +1 -5
- package/agentic/orchestrator/schemas/qa_test_index.schema.json +5 -29
- package/agentic/orchestrator/schemas/state.schema.json +11 -61
- package/agentic/orchestrator/tools/catalog.json +33 -164
- package/agentic/orchestrator/tools/schemas/input/evidence.latest.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/feature.delete.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/feature.get_context.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/feature.init.input.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/input/feature.log_append.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/feature.ready_to_merge.input.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/input/feature.state_get.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/feature.state_patch.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/gates.run.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/locks.acquire.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/locks.release.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/performance.record_outcome.input.schema.json +10 -1
- package/agentic/orchestrator/tools/schemas/input/plan.get.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/plan.submit.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/plan.update.input.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/input/qa.test_index_get.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/qa.test_index_update.input.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/input/repo.apply_patch.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/repo.diff.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/repo.diff_bundle.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/repo.ensure_worktree.input.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/input/repo.read_file.input.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/input/repo.search.input.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/input/repo.status.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/report.feature_summary.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/output/collisions.scan.output.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/output/evidence.latest.output.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/output/feature.delete.output.schema.json +4 -20
- package/agentic/orchestrator/tools/schemas/output/feature.discover_specs.output.schema.json +2 -7
- package/agentic/orchestrator/tools/schemas/output/feature.get_context.output.schema.json +1 -8
- package/agentic/orchestrator/tools/schemas/output/feature.init.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/feature.log_append.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/feature.ready_to_merge.output.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/output/feature.state_get.output.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/output/feature.state_patch.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/gates.list.output.schema.json +2 -7
- package/agentic/orchestrator/tools/schemas/output/gates.run.output.schema.json +1 -8
- package/agentic/orchestrator/tools/schemas/output/locks.acquire.output.schema.json +1 -7
- package/agentic/orchestrator/tools/schemas/output/locks.release.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/performance.get_analytics.output.schema.json +22 -2
- package/agentic/orchestrator/tools/schemas/output/plan.get.output.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/output/plan.submit.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/plan.update.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/qa.test_index_get.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/qa.test_index_update.output.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/output/repo.apply_patch.output.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/output/repo.diff.output.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/output/repo.diff_bundle.output.schema.json +1 -7
- package/agentic/orchestrator/tools/schemas/output/repo.ensure_worktree.output.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/output/repo.read_file.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/repo.search.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/repo.status.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/report.dashboard.output.schema.json +1 -4
- package/apps/control-plane/scripts/validate-architecture-rules.mjs +16 -5
- package/apps/control-plane/scripts/validate-docker-mcp-contract.mjs +30 -8
- package/apps/control-plane/scripts/validate-mcp-contracts.ts +13 -7
- package/apps/control-plane/src/application/adapters/adapter-registry.ts +35 -15
- package/apps/control-plane/src/application/multi-project-loader.ts +27 -10
- package/apps/control-plane/src/application/services/activity-monitor-service.ts +26 -14
- package/apps/control-plane/src/application/services/collision-queue-service.ts +31 -17
- package/apps/control-plane/src/application/services/cost-tracking-service.ts +23 -16
- package/apps/control-plane/src/application/services/dependency-scheduler-service.ts +12 -4
- package/apps/control-plane/src/application/services/feature-deletion-service.ts +94 -58
- package/apps/control-plane/src/application/services/feature-lifecycle-service.ts +19 -13
- package/apps/control-plane/src/application/services/feature-state-service.ts +29 -19
- package/apps/control-plane/src/application/services/gate-interpolation-service.ts +7 -2
- package/apps/control-plane/src/application/services/gate-service.ts +64 -41
- package/apps/control-plane/src/application/services/instance-isolation-service.ts +1 -1
- package/apps/control-plane/src/application/services/issue-tracker-service.ts +49 -38
- package/apps/control-plane/src/application/services/lock-service.ts +75 -49
- package/apps/control-plane/src/application/services/merge-service.ts +91 -50
- package/apps/control-plane/src/application/services/notifier-service.ts +42 -20
- package/apps/control-plane/src/application/services/patch-service.ts +73 -44
- package/apps/control-plane/src/application/services/performance-analytics-service.ts +8 -6
- package/apps/control-plane/src/application/services/plan-service.ts +148 -89
- package/apps/control-plane/src/application/services/policy-loader-service.ts +10 -4
- package/apps/control-plane/src/application/services/pr-monitor-service.ts +33 -14
- package/apps/control-plane/src/application/services/qa-index-service.ts +20 -16
- package/apps/control-plane/src/application/services/reactions-service.ts +30 -15
- package/apps/control-plane/src/application/services/reporting-service.ts +16 -12
- package/apps/control-plane/src/application/services/run-lease-service.ts +138 -81
- package/apps/control-plane/src/application/tools/tool-metadata.ts +5 -5
- package/apps/control-plane/src/application/tools/tool-router.ts +6 -3
- package/apps/control-plane/src/cli/aop.ts +2 -2
- package/apps/control-plane/src/cli/attach-command-handler.ts +9 -9
- package/apps/control-plane/src/cli/cleanup-command-handler.ts +16 -11
- package/apps/control-plane/src/cli/cli-argument-parser.ts +6 -3
- package/apps/control-plane/src/cli/dashboard-command-handler.ts +28 -8
- package/apps/control-plane/src/cli/delete-command-handler.ts +7 -7
- package/apps/control-plane/src/cli/help-command-handler.ts +61 -32
- package/apps/control-plane/src/cli/init-command-handler.ts +110 -54
- package/apps/control-plane/src/cli/io.ts +7 -3
- package/apps/control-plane/src/cli/resume-command-handler.ts +21 -13
- package/apps/control-plane/src/cli/retry-command-handler.ts +12 -11
- package/apps/control-plane/src/cli/run-command-handler.ts +12 -8
- package/apps/control-plane/src/cli/send-command-handler.ts +6 -6
- package/apps/control-plane/src/cli/spec-ingestion-service.ts +14 -8
- package/apps/control-plane/src/cli/spec-input-resolver.ts +6 -1
- package/apps/control-plane/src/cli/spec-utils.ts +2 -2
- package/apps/control-plane/src/cli/status-command-handler.ts +13 -12
- package/apps/control-plane/src/cli/tooling.ts +3 -3
- package/apps/control-plane/src/cli/types.ts +1 -1
- package/apps/control-plane/src/core/collisions.ts +27 -10
- package/apps/control-plane/src/core/constants.ts +13 -7
- package/apps/control-plane/src/core/error-codes.ts +1 -1
- package/apps/control-plane/src/core/fs.ts +11 -5
- package/apps/control-plane/src/core/gates.ts +53 -27
- package/apps/control-plane/src/core/git.ts +18 -6
- package/apps/control-plane/src/core/kernel.ts +515 -227
- package/apps/control-plane/src/core/patch.ts +7 -3
- package/apps/control-plane/src/core/path-layout.ts +5 -1
- package/apps/control-plane/src/core/path-rules.ts +19 -5
- package/apps/control-plane/src/core/qa-index.ts +26 -12
- package/apps/control-plane/src/core/response.ts +9 -6
- package/apps/control-plane/src/core/schemas.ts +29 -10
- package/apps/control-plane/src/core/tool-caller.ts +1 -1
- package/apps/control-plane/src/core/workspace-hooks.ts +5 -5
- package/apps/control-plane/src/index.ts +3 -9
- package/apps/control-plane/src/interfaces/cli/bootstrap.ts +69 -32
- package/apps/control-plane/src/mcp/kernel-tool-executor.ts +7 -3
- package/apps/control-plane/src/mcp/mcp-server-adapter.ts +12 -10
- package/apps/control-plane/src/mcp/operation-ledger.ts +18 -8
- package/apps/control-plane/src/mcp/protocol-contract.ts +2 -2
- package/apps/control-plane/src/mcp/runtime-factory.ts +15 -6
- package/apps/control-plane/src/mcp/token-auth-verifier.ts +3 -2
- package/apps/control-plane/src/mcp/token-claims-validator.ts +11 -7
- package/apps/control-plane/src/mcp/tool-authorizer.ts +1 -3
- package/apps/control-plane/src/mcp/tool-client.ts +17 -5
- package/apps/control-plane/src/mcp/tool-contract-validator.ts +17 -8
- package/apps/control-plane/src/mcp/tool-registry-loader.ts +7 -3
- package/apps/control-plane/src/mcp/tool-runtime.ts +66 -39
- package/apps/control-plane/src/mcp/tools-markdown-generator.ts +6 -1
- package/apps/control-plane/src/providers/providers.ts +72 -48
- package/apps/control-plane/src/supervisor/build-wave-executor.ts +44 -25
- package/apps/control-plane/src/supervisor/planning-wave-executor.ts +46 -33
- package/apps/control-plane/src/supervisor/prompt-bundle-loader.ts +1 -1
- package/apps/control-plane/src/supervisor/qa-wave-executor.ts +38 -23
- package/apps/control-plane/src/supervisor/run-coordinator.ts +71 -36
- package/apps/control-plane/src/supervisor/runtime.ts +59 -35
- package/apps/control-plane/src/supervisor/session-orchestrator.ts +48 -31
- package/apps/control-plane/src/supervisor/types.ts +22 -7
- package/apps/control-plane/src/supervisor/worker-decision-loop.ts +30 -20
- package/apps/control-plane/test/activity-monitor.spec.ts +54 -30
- package/apps/control-plane/test/adapter-registry.spec.ts +5 -5
- package/apps/control-plane/test/aop.spec.ts +4 -4
- package/apps/control-plane/test/batch-operations.spec.ts +20 -18
- package/apps/control-plane/test/bootstrap-attach.spec.ts +52 -19
- package/apps/control-plane/test/bootstrap-edge-cases.spec.ts +58 -27
- package/apps/control-plane/test/bootstrap.spec.ts +72 -40
- package/apps/control-plane/test/cleanup-command.spec.ts +86 -32
- package/apps/control-plane/test/cli-helpers.spec.ts +119 -66
- package/apps/control-plane/test/cli.spec.ts +1 -1
- package/apps/control-plane/test/cli.unit.spec.ts +226 -167
- package/apps/control-plane/test/collision-queue.spec.ts +49 -40
- package/apps/control-plane/test/collisions.spec.ts +30 -30
- package/apps/control-plane/test/core-utils.spec.ts +29 -15
- package/apps/control-plane/test/cost-tracking.spec.ts +38 -22
- package/apps/control-plane/test/dashboard-api.integration.spec.ts +68 -36
- package/apps/control-plane/test/dashboard-client.spec.ts +18 -12
- package/apps/control-plane/test/dashboard-command.spec.ts +11 -7
- package/apps/control-plane/test/delete-command-handler.spec.ts +49 -41
- package/apps/control-plane/test/dependency-scheduler.spec.ts +47 -20
- package/apps/control-plane/test/epoch-tracking.spec.ts +9 -9
- package/apps/control-plane/test/feature-deletion-service.spec.ts +60 -52
- package/apps/control-plane/test/feature-lifecycle.spec.ts +36 -17
- package/apps/control-plane/test/gates.spec.ts +101 -81
- package/apps/control-plane/test/git-spawn-error.spec.ts +1 -1
- package/apps/control-plane/test/helpers.ts +10 -6
- package/apps/control-plane/test/incremental-gates.spec.ts +59 -20
- package/apps/control-plane/test/init-wizard.spec.ts +162 -67
- package/apps/control-plane/test/instance-isolation.spec.ts +43 -10
- package/apps/control-plane/test/issue-tracker.spec.ts +368 -128
- package/apps/control-plane/test/kernel-collision-replay.spec.ts +50 -29
- package/apps/control-plane/test/kernel.branches.spec.ts +64 -40
- package/apps/control-plane/test/kernel.coverage.spec.ts +85 -49
- package/apps/control-plane/test/kernel.coverage2.spec.ts +109 -65
- package/apps/control-plane/test/kernel.spec.ts +134 -51
- package/apps/control-plane/test/lock-service.spec.ts +92 -68
- package/apps/control-plane/test/mcp-helpers.spec.ts +53 -39
- package/apps/control-plane/test/mcp.spec.ts +231 -115
- package/apps/control-plane/test/merge-service.spec.ts +142 -94
- package/apps/control-plane/test/multi-project.spec.ts +28 -22
- package/apps/control-plane/test/notifier-service.spec.ts +136 -92
- package/apps/control-plane/test/parallel-gates.spec.ts +51 -35
- package/apps/control-plane/test/patch-service.spec.ts +128 -48
- package/apps/control-plane/test/performance-analytics.spec.ts +99 -63
- package/apps/control-plane/test/plan-service.spec.ts +50 -39
- package/apps/control-plane/test/planning-wave-executor.spec.ts +95 -71
- package/apps/control-plane/test/policy-loader-service.spec.ts +41 -19
- package/apps/control-plane/test/pr-monitor.spec.ts +113 -64
- package/apps/control-plane/test/providers.spec.ts +133 -102
- package/apps/control-plane/test/qa-index-service.spec.ts +31 -33
- package/apps/control-plane/test/qa-index.spec.ts +58 -61
- package/apps/control-plane/test/reactions.spec.ts +88 -45
- package/apps/control-plane/test/response.spec.ts +5 -5
- package/apps/control-plane/test/resume-command.spec.ts +121 -80
- package/apps/control-plane/test/run-coordinator.spec.ts +205 -136
- package/apps/control-plane/test/schema-date-time.spec.ts +49 -41
- package/apps/control-plane/test/service-retry-paths.spec.ts +77 -57
- package/apps/control-plane/test/services.spec.ts +147 -129
- package/apps/control-plane/test/session-management.spec.ts +136 -74
- package/apps/control-plane/test/spec-ingestion.spec.ts +23 -21
- package/apps/control-plane/test/spec-input-resolver.spec.ts +11 -10
- package/apps/control-plane/test/supervisor-collaborators.spec.ts +168 -121
- package/apps/control-plane/test/supervisor.calltool.spec.ts +21 -18
- package/apps/control-plane/test/supervisor.spec.ts +67 -43
- package/apps/control-plane/test/supervisor.unit.spec.ts +195 -126
- package/apps/control-plane/test/token-auth-verifier.spec.ts +29 -14
- package/apps/control-plane/test/tool-registry-loader.spec.ts +51 -27
- package/apps/control-plane/test/tool-runtime.spec.ts +63 -46
- package/apps/control-plane/test/worker-decision-loop.spec.ts +143 -122
- package/apps/control-plane/test/workspace-hooks.spec.ts +61 -23
- package/apps/control-plane/tsconfig.build.json +2 -7
- package/apps/control-plane/tsconfig.json +1 -5
- package/apps/control-plane/vitest.config.ts +7 -7
- package/dist/apps/control-plane/application/adapters/adapter-registry.js +12 -5
- package/dist/apps/control-plane/application/adapters/adapter-registry.js.map +1 -1
- package/dist/apps/control-plane/application/multi-project-loader.js +26 -9
- package/dist/apps/control-plane/application/multi-project-loader.js.map +1 -1
- package/dist/apps/control-plane/application/services/activity-monitor-service.js +7 -7
- package/dist/apps/control-plane/application/services/activity-monitor-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/collision-queue-service.js +7 -7
- package/dist/apps/control-plane/application/services/collision-queue-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/cost-tracking-service.js +6 -8
- package/dist/apps/control-plane/application/services/cost-tracking-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/dependency-scheduler-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/feature-deletion-service.js +37 -29
- package/dist/apps/control-plane/application/services/feature-deletion-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.js +10 -10
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/feature-state-service.js +11 -11
- package/dist/apps/control-plane/application/services/feature-state-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/gate-interpolation-service.js +3 -1
- package/dist/apps/control-plane/application/services/gate-interpolation-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/gate-service.js +26 -26
- package/dist/apps/control-plane/application/services/gate-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/instance-isolation-service.js +1 -1
- package/dist/apps/control-plane/application/services/instance-isolation-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/issue-tracker-service.js +25 -15
- package/dist/apps/control-plane/application/services/issue-tracker-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/lock-service.js +32 -32
- package/dist/apps/control-plane/application/services/lock-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/merge-service.js +41 -27
- package/dist/apps/control-plane/application/services/merge-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/notifier-service.js +29 -15
- package/dist/apps/control-plane/application/services/notifier-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/patch-service.js +21 -19
- package/dist/apps/control-plane/application/services/patch-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/performance-analytics-service.js +4 -4
- package/dist/apps/control-plane/application/services/performance-analytics-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/plan-service.js +33 -33
- package/dist/apps/control-plane/application/services/plan-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/policy-loader-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/pr-monitor-service.js +23 -11
- package/dist/apps/control-plane/application/services/pr-monitor-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/qa-index-service.js +11 -11
- package/dist/apps/control-plane/application/services/qa-index-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/reactions-service.js +13 -9
- package/dist/apps/control-plane/application/services/reactions-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/reporting-service.js +11 -9
- package/dist/apps/control-plane/application/services/reporting-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/run-lease-service.js +34 -33
- package/dist/apps/control-plane/application/services/run-lease-service.js.map +1 -1
- package/dist/apps/control-plane/application/tools/tool-metadata.js +2 -2
- package/dist/apps/control-plane/application/tools/tool-router.js.map +1 -1
- package/dist/apps/control-plane/cli/attach-command-handler.js +9 -9
- package/dist/apps/control-plane/cli/cleanup-command-handler.js +11 -9
- package/dist/apps/control-plane/cli/cleanup-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/cli-argument-parser.js +4 -3
- package/dist/apps/control-plane/cli/cli-argument-parser.js.map +1 -1
- package/dist/apps/control-plane/cli/dashboard-command-handler.js +23 -7
- package/dist/apps/control-plane/cli/dashboard-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/delete-command-handler.js +7 -7
- package/dist/apps/control-plane/cli/help-command-handler.js +58 -30
- package/dist/apps/control-plane/cli/help-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/init-command-handler.js +44 -33
- package/dist/apps/control-plane/cli/init-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/io.js +2 -2
- package/dist/apps/control-plane/cli/io.js.map +1 -1
- package/dist/apps/control-plane/cli/resume-command-handler.js +9 -9
- package/dist/apps/control-plane/cli/resume-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/retry-command-handler.js +12 -11
- package/dist/apps/control-plane/cli/retry-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/run-command-handler.js +12 -8
- package/dist/apps/control-plane/cli/run-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/send-command-handler.js +6 -6
- package/dist/apps/control-plane/cli/spec-ingestion-service.js +10 -8
- package/dist/apps/control-plane/cli/spec-ingestion-service.js.map +1 -1
- package/dist/apps/control-plane/cli/spec-input-resolver.js.map +1 -1
- package/dist/apps/control-plane/cli/spec-utils.js.map +1 -1
- package/dist/apps/control-plane/cli/status-command-handler.js +8 -8
- package/dist/apps/control-plane/cli/status-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/tooling.js +1 -1
- package/dist/apps/control-plane/core/collisions.js +11 -8
- package/dist/apps/control-plane/core/collisions.js.map +1 -1
- package/dist/apps/control-plane/core/constants.js +13 -7
- package/dist/apps/control-plane/core/constants.js.map +1 -1
- package/dist/apps/control-plane/core/error-codes.js +1 -1
- package/dist/apps/control-plane/core/fs.js.map +1 -1
- package/dist/apps/control-plane/core/gates.d.ts +2 -2
- package/dist/apps/control-plane/core/gates.js +26 -19
- package/dist/apps/control-plane/core/gates.js.map +1 -1
- package/dist/apps/control-plane/core/git.js +3 -3
- package/dist/apps/control-plane/core/git.js.map +1 -1
- package/dist/apps/control-plane/core/kernel.d.ts +1 -0
- package/dist/apps/control-plane/core/kernel.js +134 -81
- package/dist/apps/control-plane/core/kernel.js.map +1 -1
- package/dist/apps/control-plane/core/patch.js +7 -3
- package/dist/apps/control-plane/core/patch.js.map +1 -1
- package/dist/apps/control-plane/core/path-layout.d.ts +1 -0
- package/dist/apps/control-plane/core/path-layout.js +4 -1
- package/dist/apps/control-plane/core/path-layout.js.map +1 -1
- package/dist/apps/control-plane/core/path-rules.js +3 -1
- package/dist/apps/control-plane/core/path-rules.js.map +1 -1
- package/dist/apps/control-plane/core/qa-index.js +5 -5
- package/dist/apps/control-plane/core/qa-index.js.map +1 -1
- package/dist/apps/control-plane/core/response.js +3 -3
- package/dist/apps/control-plane/core/response.js.map +1 -1
- package/dist/apps/control-plane/core/schemas.js +10 -6
- package/dist/apps/control-plane/core/schemas.js.map +1 -1
- package/dist/apps/control-plane/core/workspace-hooks.js +3 -3
- package/dist/apps/control-plane/index.d.ts +1 -1
- package/dist/apps/control-plane/index.js +1 -1
- package/dist/apps/control-plane/index.js.map +1 -1
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js +31 -20
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js.map +1 -1
- package/dist/apps/control-plane/mcp/kernel-tool-executor.js +1 -1
- package/dist/apps/control-plane/mcp/kernel-tool-executor.js.map +1 -1
- package/dist/apps/control-plane/mcp/mcp-server-adapter.js +6 -7
- package/dist/apps/control-plane/mcp/mcp-server-adapter.js.map +1 -1
- package/dist/apps/control-plane/mcp/operation-ledger.js +5 -5
- package/dist/apps/control-plane/mcp/operation-ledger.js.map +1 -1
- package/dist/apps/control-plane/mcp/protocol-contract.js +2 -2
- package/dist/apps/control-plane/mcp/runtime-factory.js +2 -2
- package/dist/apps/control-plane/mcp/runtime-factory.js.map +1 -1
- package/dist/apps/control-plane/mcp/token-auth-verifier.js +1 -1
- package/dist/apps/control-plane/mcp/token-auth-verifier.js.map +1 -1
- package/dist/apps/control-plane/mcp/token-claims-validator.js +5 -5
- package/dist/apps/control-plane/mcp/token-claims-validator.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-authorizer.js +1 -3
- package/dist/apps/control-plane/mcp/tool-authorizer.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-client.js +2 -2
- package/dist/apps/control-plane/mcp/tool-client.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-contract-validator.js +3 -3
- package/dist/apps/control-plane/mcp/tool-contract-validator.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-registry-loader.js +1 -1
- package/dist/apps/control-plane/mcp/tool-registry-loader.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-runtime.js +17 -17
- package/dist/apps/control-plane/mcp/tool-runtime.js.map +1 -1
- package/dist/apps/control-plane/mcp/tools-markdown-generator.js +6 -1
- package/dist/apps/control-plane/mcp/tools-markdown-generator.js.map +1 -1
- package/dist/apps/control-plane/providers/providers.d.ts +1 -1
- package/dist/apps/control-plane/providers/providers.js +31 -34
- package/dist/apps/control-plane/providers/providers.js.map +1 -1
- package/dist/apps/control-plane/supervisor/build-wave-executor.js +12 -12
- package/dist/apps/control-plane/supervisor/build-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/planning-wave-executor.js +19 -16
- package/dist/apps/control-plane/supervisor/planning-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/prompt-bundle-loader.js +1 -1
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js +13 -13
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/run-coordinator.js +37 -20
- package/dist/apps/control-plane/supervisor/run-coordinator.js.map +1 -1
- package/dist/apps/control-plane/supervisor/runtime.js +25 -21
- package/dist/apps/control-plane/supervisor/runtime.js.map +1 -1
- package/dist/apps/control-plane/supervisor/session-orchestrator.js +29 -23
- package/dist/apps/control-plane/supervisor/session-orchestrator.js.map +1 -1
- package/dist/apps/control-plane/supervisor/types.d.ts +3 -3
- package/dist/apps/control-plane/supervisor/types.js.map +1 -1
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js +14 -16
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js.map +1 -1
- package/eslint.config.mjs +20 -20
- package/example-configurations/README.md +1 -1
- package/example-configurations/java/agents.yaml +3 -3
- package/example-configurations/java/policy.yaml +1 -1
- package/example-configurations/node/agents.yaml +3 -3
- package/example-configurations/node/policy.yaml +1 -1
- package/package.json +10 -5
- package/packages/web-dashboard/next.config.js +2 -2
- package/packages/web-dashboard/src/app/api/actions/route.ts +25 -9
- package/packages/web-dashboard/src/app/api/events/route.ts +20 -6
- package/packages/web-dashboard/src/app/api/features/[id]/checkout/route.ts +88 -37
- package/packages/web-dashboard/src/app/api/features/[id]/evidence/[artifact]/route.ts +8 -5
- package/packages/web-dashboard/src/app/api/features/[id]/review/route.ts +27 -9
- package/packages/web-dashboard/src/app/api/features/[id]/route.ts +5 -2
- package/packages/web-dashboard/src/app/api/projects/route.ts +5 -5
- package/packages/web-dashboard/src/app/globals.css +10 -2
- package/packages/web-dashboard/src/app/page.tsx +100 -37
- package/packages/web-dashboard/src/lib/aop-client.ts +68 -37
- package/packages/web-dashboard/src/lib/multi-project-config.ts +28 -7
- package/packages/web-dashboard/src/lib/orchestrator-tools.ts +59 -36
- package/packages/web-dashboard/tsconfig.json +3 -11
- package/scripts/nx-safe.mjs +10 -10
- package/spec-files/completed/agentic_orchestrator_cli_delete_command_spec.md +5 -0
- package/spec-files/completed/agentic_orchestrator_feature_gaps_closure_spec.md +187 -90
- package/spec-files/completed/agentic_orchestrator_init_policy_ux_simplification_spec.md +49 -16
- package/spec-files/completed/agentic_orchestrator_mcp_formalization_spec.md +24 -1
- package/spec-files/completed/agentic_orchestrator_single_global_orchestrator_spec.md +9 -0
- package/spec-files/completed/agentic_orchestrator_spec.md +171 -75
- package/spec-files/completed/agentic_orchestrator_validator_hardening_spec.md +25 -17
- package/spec-files/outstanding/agentic_orchestrator_artifact_database_publishing_spec.md +40 -5
- package/spec-files/outstanding/agentic_orchestrator_enterprise_governance_dashboard_spec.md +23 -12
- package/spec-files/outstanding/agentic_orchestrator_knowledge_canary_spec.md +16 -4
- package/spec-files/outstanding/agentic_orchestrator_observability_integrity_diagnostics_spec.md +42 -2
- package/spec-files/outstanding/agentic_orchestrator_performance_improvements_spec.md +209 -130
- package/spec-files/outstanding/agentic_orchestrator_planning_review_quality_spec.md +56 -3
- package/spec-files/outstanding/agentic_orchestrator_productization_commercial_spec.md +77 -10
- package/spec-files/outstanding/agentic_orchestrator_quality_adoption_execution_spec.md +29 -14
- package/spec-files/progress.md +186 -175
- package/tsconfig.json +2 -8
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { TOOLS } from '../../core/constants.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
FeatureStatePayload,
|
|
4
|
+
ToolCaller as SupervisorToolCaller,
|
|
5
|
+
} from '../../core/tool-caller.js';
|
|
3
6
|
import type { NotifierService } from './notifier-service.js';
|
|
4
7
|
|
|
5
8
|
export interface GateFailedReaction {
|
|
@@ -12,7 +15,12 @@ export interface GateFailedReaction {
|
|
|
12
15
|
|
|
13
16
|
export interface ReactionsPolicy {
|
|
14
17
|
gate_failed?: GateFailedReaction;
|
|
15
|
-
agent_stuck?: {
|
|
18
|
+
agent_stuck?: {
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
action: string;
|
|
21
|
+
idle_threshold_ms: number;
|
|
22
|
+
escalate_after: number;
|
|
23
|
+
};
|
|
16
24
|
collision_detected?: { enabled: boolean; action: string };
|
|
17
25
|
ready_to_merge?: { enabled: boolean; action: string };
|
|
18
26
|
changes_requested?: { enabled: boolean; action: string; escalate_after: number };
|
|
@@ -47,7 +55,7 @@ const DEFAULT_GATE_FAILED_REACTION: GateFailedReaction = {
|
|
|
47
55
|
max_retries: 2,
|
|
48
56
|
action: 'notify_only',
|
|
49
57
|
escalate_after: 2,
|
|
50
|
-
retry_delay_ms: 30000
|
|
58
|
+
retry_delay_ms: 30000,
|
|
51
59
|
};
|
|
52
60
|
|
|
53
61
|
export class ReactionsService {
|
|
@@ -74,7 +82,11 @@ export class ReactionsService {
|
|
|
74
82
|
|
|
75
83
|
retryDelayMs(): number {
|
|
76
84
|
const reaction = this.policy.gate_failed ?? DEFAULT_GATE_FAILED_REACTION;
|
|
77
|
-
if (
|
|
85
|
+
if (
|
|
86
|
+
typeof reaction.retry_delay_ms === 'number' &&
|
|
87
|
+
Number.isFinite(reaction.retry_delay_ms) &&
|
|
88
|
+
reaction.retry_delay_ms >= 0
|
|
89
|
+
) {
|
|
78
90
|
return Math.floor(reaction.retry_delay_ms);
|
|
79
91
|
}
|
|
80
92
|
return DEFAULT_GATE_FAILED_REACTION.retry_delay_ms;
|
|
@@ -82,7 +94,11 @@ export class ReactionsService {
|
|
|
82
94
|
|
|
83
95
|
maxRetries(): number {
|
|
84
96
|
const reaction = this.policy.gate_failed ?? DEFAULT_GATE_FAILED_REACTION;
|
|
85
|
-
if (
|
|
97
|
+
if (
|
|
98
|
+
typeof reaction.max_retries === 'number' &&
|
|
99
|
+
Number.isFinite(reaction.max_retries) &&
|
|
100
|
+
reaction.max_retries >= 0
|
|
101
|
+
) {
|
|
86
102
|
return Math.floor(reaction.max_retries);
|
|
87
103
|
}
|
|
88
104
|
return DEFAULT_GATE_FAILED_REACTION.max_retries;
|
|
@@ -105,7 +121,7 @@ export class ReactionsService {
|
|
|
105
121
|
.slice(-3)
|
|
106
122
|
.map(
|
|
107
123
|
(item) =>
|
|
108
|
-
`- attempt=${item.attempt}; gate=${item.gate_name}; exit=${item.exit_code}; at=${item.failed_at}; evidence=${item.evidence_summary || 'n/a'}
|
|
124
|
+
`- attempt=${item.attempt}; gate=${item.gate_name}; exit=${item.exit_code}; at=${item.failed_at}; evidence=${item.evidence_summary || 'n/a'}`,
|
|
109
125
|
)
|
|
110
126
|
.join('\n')
|
|
111
127
|
: '(none)';
|
|
@@ -121,12 +137,11 @@ export class ReactionsService {
|
|
|
121
137
|
'Evidence:',
|
|
122
138
|
ctx.evidenceSummary,
|
|
123
139
|
'',
|
|
124
|
-
`Retry: ${ctx.retryCount + 1} of ${maxRetries}
|
|
125
|
-
,
|
|
140
|
+
`Retry: ${ctx.retryCount + 1} of ${maxRetries}`,
|
|
126
141
|
`Retry delay (ms): ${delayMs}`,
|
|
127
142
|
'',
|
|
128
143
|
'Failure history (most recent first):',
|
|
129
|
-
failureSummary
|
|
144
|
+
failureSummary,
|
|
130
145
|
].join('\n');
|
|
131
146
|
}
|
|
132
147
|
|
|
@@ -134,7 +149,7 @@ export class ReactionsService {
|
|
|
134
149
|
const current = await this.toolCaller.callTool<FeatureStatePayload>(
|
|
135
150
|
'orchestrator',
|
|
136
151
|
TOOLS.FEATURE_STATE_GET,
|
|
137
|
-
{ feature_id: featureId }
|
|
152
|
+
{ feature_id: featureId },
|
|
138
153
|
);
|
|
139
154
|
await this.toolCaller.callTool('orchestrator', TOOLS.FEATURE_STATE_PATCH, {
|
|
140
155
|
feature_id: featureId,
|
|
@@ -142,9 +157,9 @@ export class ReactionsService {
|
|
|
142
157
|
patch: {
|
|
143
158
|
front_matter: {
|
|
144
159
|
gate_retry_count: retryCount,
|
|
145
|
-
last_retry_at: new Date().toISOString()
|
|
146
|
-
}
|
|
147
|
-
}
|
|
160
|
+
last_retry_at: new Date().toISOString(),
|
|
161
|
+
},
|
|
162
|
+
},
|
|
148
163
|
});
|
|
149
164
|
}
|
|
150
165
|
|
|
@@ -168,8 +183,8 @@ export class ReactionsService {
|
|
|
168
183
|
max_retries: this.maxRetries(),
|
|
169
184
|
escalate_after: (this.policy.gate_failed ?? DEFAULT_GATE_FAILED_REACTION).escalate_after,
|
|
170
185
|
last_failure: ctx.failureHistory?.at(-1) ?? null,
|
|
171
|
-
failure_history: ctx.failureHistory ?? []
|
|
172
|
-
}
|
|
186
|
+
failure_history: ctx.failureHistory ?? [],
|
|
187
|
+
},
|
|
173
188
|
});
|
|
174
189
|
}
|
|
175
190
|
}
|
|
@@ -9,7 +9,8 @@ function normalizeSet(array: string[]): string[] {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function readHeldLocks(frontMatter: AnyRecord): string[] {
|
|
12
|
-
const locks =
|
|
12
|
+
const locks =
|
|
13
|
+
frontMatter?.locks && typeof frontMatter.locks === 'object' ? frontMatter.locks : {};
|
|
13
14
|
const held = Array.isArray(locks.held) ? locks.held : [];
|
|
14
15
|
return held.filter((item: unknown): item is string => typeof item === 'string');
|
|
15
16
|
}
|
|
@@ -48,14 +49,14 @@ export class ReportingService {
|
|
|
48
49
|
const result = detectPlanCollisions(
|
|
49
50
|
candidatePlan,
|
|
50
51
|
[comparisonPlan],
|
|
51
|
-
this.port.getPolicySnapshot() as Parameters<typeof detectPlanCollisions>[2]
|
|
52
|
+
this.port.getPolicySnapshot() as Parameters<typeof detectPlanCollisions>[2],
|
|
52
53
|
);
|
|
53
54
|
if (result.hasCollisions) {
|
|
54
55
|
matrix.push({
|
|
55
56
|
feature_id: candidatePlan.feature_id,
|
|
56
57
|
with_feature_id: comparisonPlan.feature_id,
|
|
57
58
|
collisions: result.collisions,
|
|
58
|
-
fingerprint: createCollisionFingerprint(result.collisions)
|
|
59
|
+
fingerprint: createCollisionFingerprint(result.collisions),
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
}
|
|
@@ -63,8 +64,8 @@ export class ReportingService {
|
|
|
63
64
|
|
|
64
65
|
return {
|
|
65
66
|
data: {
|
|
66
|
-
collisions: matrix
|
|
67
|
-
}
|
|
67
|
+
collisions: matrix,
|
|
68
|
+
},
|
|
68
69
|
};
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -74,7 +75,7 @@ export class ReportingService {
|
|
|
74
75
|
...index.active,
|
|
75
76
|
...index.blocked,
|
|
76
77
|
...index.merged,
|
|
77
|
-
...Object.values(index.locks).filter(Boolean)
|
|
78
|
+
...Object.values(index.locks).filter(Boolean),
|
|
78
79
|
]);
|
|
79
80
|
|
|
80
81
|
const features = [];
|
|
@@ -85,7 +86,8 @@ export class ReportingService {
|
|
|
85
86
|
}
|
|
86
87
|
const state = await this.port.readState(featureId);
|
|
87
88
|
const costData = await readJson<{ estimated_cost_usd: number; tokens_used: number }>(
|
|
88
|
-
this.port.featureCostPath(featureId),
|
|
89
|
+
this.port.featureCostPath(featureId),
|
|
90
|
+
null,
|
|
89
91
|
);
|
|
90
92
|
features.push({
|
|
91
93
|
feature_id: featureId,
|
|
@@ -104,15 +106,17 @@ export class ReportingService {
|
|
|
104
106
|
activity_state: state.frontMatter.activity_state,
|
|
105
107
|
activity_last_event_at: state.frontMatter.activity_last_event_at,
|
|
106
108
|
activity_detected_via: state.frontMatter.activity_detected_via,
|
|
107
|
-
cost: costData
|
|
109
|
+
cost: costData
|
|
110
|
+
? { estimated_cost_usd: costData.estimated_cost_usd, tokens_used: costData.tokens_used }
|
|
111
|
+
: null,
|
|
108
112
|
});
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
return {
|
|
112
116
|
data: {
|
|
113
117
|
index,
|
|
114
|
-
features
|
|
115
|
-
}
|
|
118
|
+
features,
|
|
119
|
+
},
|
|
116
120
|
};
|
|
117
121
|
}
|
|
118
122
|
|
|
@@ -128,8 +132,8 @@ export class ReportingService {
|
|
|
128
132
|
diff_stat: bundle.data.diff_stat,
|
|
129
133
|
touched_files: bundle.data.touched_files,
|
|
130
134
|
last_gate_summary: bundle.data.last_gate_summary,
|
|
131
|
-
qa_summary: qa.data.summary
|
|
132
|
-
}
|
|
135
|
+
qa_summary: qa.data.summary,
|
|
136
|
+
},
|
|
133
137
|
};
|
|
134
138
|
}
|
|
135
139
|
}
|
|
@@ -59,10 +59,14 @@ export class RunLeaseService {
|
|
|
59
59
|
}> {
|
|
60
60
|
if (!input.run_id || !input.owner_instance_id) {
|
|
61
61
|
throw {
|
|
62
|
-
normalizedResponse: fail(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
normalizedResponse: fail(
|
|
63
|
+
ERROR_CODES.INVALID_ARGUMENT,
|
|
64
|
+
'run_id and owner_instance_id are required',
|
|
65
|
+
{
|
|
66
|
+
retryable: false,
|
|
67
|
+
requires_human: true,
|
|
68
|
+
},
|
|
69
|
+
),
|
|
66
70
|
};
|
|
67
71
|
}
|
|
68
72
|
|
|
@@ -76,33 +80,42 @@ export class RunLeaseService {
|
|
|
76
80
|
const current = this.port.normalizeRuntimeSessions(await this.port.readRunLease());
|
|
77
81
|
const hasLease = current.run_id !== 'none' && current.owner_instance_id !== 'none';
|
|
78
82
|
const fresh = hasLease && this.port.isRunLeaseFresh(current);
|
|
79
|
-
const sameOwner =
|
|
83
|
+
const sameOwner =
|
|
84
|
+
current.run_id === input.run_id && current.owner_instance_id === input.owner_instance_id;
|
|
80
85
|
|
|
81
86
|
if (fresh && !sameOwner) {
|
|
82
87
|
throw {
|
|
83
|
-
normalizedResponse: fail(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
normalizedResponse: fail(
|
|
89
|
+
ERROR_CODES.RUN_ALREADY_ACTIVE,
|
|
90
|
+
'Another active run already owns this repository',
|
|
91
|
+
{
|
|
92
|
+
active_run_id: current.run_id,
|
|
93
|
+
owner_instance_id: current.owner_instance_id,
|
|
94
|
+
lease_expires_at: current.lease_expires_at,
|
|
95
|
+
stale: false,
|
|
96
|
+
retryable: false,
|
|
97
|
+
requires_human: true,
|
|
98
|
+
},
|
|
99
|
+
),
|
|
91
100
|
};
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
const staleOwnedByOther = hasLease && !fresh && !sameOwner;
|
|
95
104
|
if (staleOwnedByOther && !input.takeover_stale_run) {
|
|
96
105
|
throw {
|
|
97
|
-
normalizedResponse: fail(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
normalizedResponse: fail(
|
|
107
|
+
ERROR_CODES.RUN_ALREADY_ACTIVE,
|
|
108
|
+
'A stale run lease exists; explicit takeover is required',
|
|
109
|
+
{
|
|
110
|
+
active_run_id: current.run_id,
|
|
111
|
+
owner_instance_id: current.owner_instance_id,
|
|
112
|
+
lease_expires_at: current.lease_expires_at,
|
|
113
|
+
stale: true,
|
|
114
|
+
requires_takeover: true,
|
|
115
|
+
retryable: false,
|
|
116
|
+
requires_human: true,
|
|
117
|
+
},
|
|
118
|
+
),
|
|
106
119
|
};
|
|
107
120
|
}
|
|
108
121
|
|
|
@@ -119,7 +132,7 @@ export class RunLeaseService {
|
|
|
119
132
|
started_at: sameOwner && current.started_at ? current.started_at : now,
|
|
120
133
|
last_heartbeat_at: now,
|
|
121
134
|
lease_expires_at: new Date(Date.now() + ttlMs).toISOString(),
|
|
122
|
-
orchestrator_epoch: isInitialRun ? 0 : Number(current.orchestrator_epoch ?? 0)
|
|
135
|
+
orchestrator_epoch: isInitialRun ? 0 : Number(current.orchestrator_epoch ?? 0),
|
|
123
136
|
};
|
|
124
137
|
|
|
125
138
|
if (!sameOwner) {
|
|
@@ -133,19 +146,26 @@ export class RunLeaseService {
|
|
|
133
146
|
data: {
|
|
134
147
|
runtime_sessions: claimed,
|
|
135
148
|
took_over_stale: staleOwnedByOther,
|
|
136
|
-
reused_existing_owner: sameOwner
|
|
137
|
-
}
|
|
149
|
+
reused_existing_owner: sameOwner,
|
|
150
|
+
},
|
|
138
151
|
};
|
|
139
152
|
});
|
|
140
153
|
}
|
|
141
154
|
|
|
142
|
-
async renewRunLease(
|
|
155
|
+
async renewRunLease(
|
|
156
|
+
runId: string,
|
|
157
|
+
ownerInstanceId: string,
|
|
158
|
+
): Promise<{ data: { lease_expires_at: string } }> {
|
|
143
159
|
if (!runId || !ownerInstanceId) {
|
|
144
160
|
throw {
|
|
145
|
-
normalizedResponse: fail(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
161
|
+
normalizedResponse: fail(
|
|
162
|
+
ERROR_CODES.INVALID_ARGUMENT,
|
|
163
|
+
'runId and ownerInstanceId are required',
|
|
164
|
+
{
|
|
165
|
+
retryable: false,
|
|
166
|
+
requires_human: true,
|
|
167
|
+
},
|
|
168
|
+
),
|
|
149
169
|
};
|
|
150
170
|
}
|
|
151
171
|
|
|
@@ -154,33 +174,40 @@ export class RunLeaseService {
|
|
|
154
174
|
const current = this.port.normalizeRuntimeSessions(await this.port.readRunLease());
|
|
155
175
|
if (current.run_id !== runId || current.owner_instance_id !== ownerInstanceId) {
|
|
156
176
|
throw {
|
|
157
|
-
normalizedResponse: fail(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
177
|
+
normalizedResponse: fail(
|
|
178
|
+
ERROR_CODES.RUN_LEASE_NOT_OWNED,
|
|
179
|
+
'Cannot renew a run lease not owned by this instance',
|
|
180
|
+
{
|
|
181
|
+
run_id: runId,
|
|
182
|
+
owner_instance_id: ownerInstanceId,
|
|
183
|
+
active_run_id: current.run_id,
|
|
184
|
+
active_owner_instance_id: current.owner_instance_id,
|
|
185
|
+
retryable: false,
|
|
186
|
+
requires_human: true,
|
|
187
|
+
},
|
|
188
|
+
),
|
|
165
189
|
};
|
|
166
190
|
}
|
|
167
191
|
|
|
168
192
|
const updated: RuntimeSessionsSnapshot = {
|
|
169
193
|
...current,
|
|
170
194
|
last_heartbeat_at: nowIso(),
|
|
171
|
-
lease_expires_at: new Date(Date.now() + ttlMs).toISOString()
|
|
195
|
+
lease_expires_at: new Date(Date.now() + ttlMs).toISOString(),
|
|
172
196
|
};
|
|
173
197
|
await this.port.writeRunLease(updated);
|
|
174
198
|
|
|
175
199
|
return {
|
|
176
200
|
data: {
|
|
177
|
-
lease_expires_at: updated.lease_expires_at
|
|
178
|
-
}
|
|
201
|
+
lease_expires_at: updated.lease_expires_at,
|
|
202
|
+
},
|
|
179
203
|
};
|
|
180
204
|
});
|
|
181
205
|
}
|
|
182
206
|
|
|
183
|
-
async releaseRunLease(
|
|
207
|
+
async releaseRunLease(
|
|
208
|
+
runId: string,
|
|
209
|
+
ownerInstanceId: string,
|
|
210
|
+
): Promise<{ data: { released: boolean } }> {
|
|
184
211
|
return await this.port.withIndexLock(async () => {
|
|
185
212
|
const current = this.port.normalizeRuntimeSessions(await this.port.readRunLease());
|
|
186
213
|
if (current.run_id !== runId || current.owner_instance_id !== ownerInstanceId) {
|
|
@@ -201,10 +228,14 @@ export class RunLeaseService {
|
|
|
201
228
|
const { run_id, owner_instance_id, orchestrator_session_id, increment_epoch = false } = params;
|
|
202
229
|
if (!run_id || !owner_instance_id || !orchestrator_session_id) {
|
|
203
230
|
throw {
|
|
204
|
-
normalizedResponse: fail(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
231
|
+
normalizedResponse: fail(
|
|
232
|
+
ERROR_CODES.INVALID_ARGUMENT,
|
|
233
|
+
'run_id, owner_instance_id, and orchestrator_session_id are required',
|
|
234
|
+
{
|
|
235
|
+
retryable: false,
|
|
236
|
+
requires_human: true,
|
|
237
|
+
},
|
|
238
|
+
),
|
|
208
239
|
};
|
|
209
240
|
}
|
|
210
241
|
|
|
@@ -212,14 +243,18 @@ export class RunLeaseService {
|
|
|
212
243
|
const current = this.port.normalizeRuntimeSessions(await this.port.readRunLease());
|
|
213
244
|
if (current.run_id !== run_id || current.owner_instance_id !== owner_instance_id) {
|
|
214
245
|
throw {
|
|
215
|
-
normalizedResponse: fail(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
246
|
+
normalizedResponse: fail(
|
|
247
|
+
ERROR_CODES.RUN_LEASE_NOT_OWNED,
|
|
248
|
+
'Cannot update orchestrator session without run ownership',
|
|
249
|
+
{
|
|
250
|
+
run_id,
|
|
251
|
+
owner_instance_id,
|
|
252
|
+
active_run_id: current.run_id,
|
|
253
|
+
active_owner_instance_id: current.owner_instance_id,
|
|
254
|
+
retryable: false,
|
|
255
|
+
requires_human: true,
|
|
256
|
+
},
|
|
257
|
+
),
|
|
223
258
|
};
|
|
224
259
|
}
|
|
225
260
|
|
|
@@ -229,33 +264,46 @@ export class RunLeaseService {
|
|
|
229
264
|
const updated: RuntimeSessionsSnapshot = {
|
|
230
265
|
...current,
|
|
231
266
|
orchestrator_session_id,
|
|
232
|
-
orchestrator_epoch: nextEpoch
|
|
267
|
+
orchestrator_epoch: nextEpoch,
|
|
233
268
|
};
|
|
234
269
|
await this.port.writeRunLease(updated);
|
|
235
270
|
|
|
236
271
|
return {
|
|
237
272
|
data: {
|
|
238
|
-
runtime_sessions: updated
|
|
239
|
-
}
|
|
273
|
+
runtime_sessions: updated,
|
|
274
|
+
},
|
|
240
275
|
};
|
|
241
276
|
});
|
|
242
277
|
}
|
|
243
278
|
|
|
244
|
-
async updateFeatureSessionAssignment(
|
|
245
|
-
|
|
279
|
+
async updateFeatureSessionAssignment(
|
|
280
|
+
params: RuntimeFeatureSessionUpdateParams,
|
|
281
|
+
): Promise<{ data: { updated: boolean } }> {
|
|
282
|
+
const {
|
|
283
|
+
run_id,
|
|
284
|
+
owner_instance_id,
|
|
285
|
+
feature_id,
|
|
286
|
+
planner_session_id,
|
|
287
|
+
builder_session_id,
|
|
288
|
+
qa_session_id,
|
|
289
|
+
} = params;
|
|
246
290
|
|
|
247
291
|
return await this.port.withIndexLock(async () => {
|
|
248
292
|
const current = this.port.normalizeRuntimeSessions(await this.port.readRunLease());
|
|
249
293
|
if (current.run_id !== run_id || current.owner_instance_id !== owner_instance_id) {
|
|
250
294
|
throw {
|
|
251
|
-
normalizedResponse: fail(
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
295
|
+
normalizedResponse: fail(
|
|
296
|
+
ERROR_CODES.RUN_LEASE_NOT_OWNED,
|
|
297
|
+
'Cannot update feature sessions without run ownership',
|
|
298
|
+
{
|
|
299
|
+
run_id,
|
|
300
|
+
owner_instance_id,
|
|
301
|
+
active_run_id: current.run_id,
|
|
302
|
+
active_owner_instance_id: current.owner_instance_id,
|
|
303
|
+
retryable: false,
|
|
304
|
+
requires_human: true,
|
|
305
|
+
},
|
|
306
|
+
),
|
|
259
307
|
};
|
|
260
308
|
}
|
|
261
309
|
|
|
@@ -264,32 +312,41 @@ export class RunLeaseService {
|
|
|
264
312
|
[feature_id]: {
|
|
265
313
|
planner_session_id,
|
|
266
314
|
builder_session_id,
|
|
267
|
-
qa_session_id
|
|
268
|
-
}
|
|
315
|
+
qa_session_id,
|
|
316
|
+
},
|
|
269
317
|
};
|
|
270
318
|
|
|
271
319
|
await this.port.writeRunLease({
|
|
272
320
|
...current,
|
|
273
|
-
feature_sessions: nextFeatureSessions
|
|
321
|
+
feature_sessions: nextFeatureSessions,
|
|
274
322
|
});
|
|
275
323
|
return { data: { updated: true } };
|
|
276
324
|
});
|
|
277
325
|
}
|
|
278
326
|
|
|
279
|
-
async pruneFeatureSessionAssignments(
|
|
327
|
+
async pruneFeatureSessionAssignments(
|
|
328
|
+
params: PruneFeatureSessionParams,
|
|
329
|
+
): Promise<{ data: { removed: string[] } }> {
|
|
280
330
|
const active = new Set(params.active_feature_ids);
|
|
281
331
|
return await this.port.withIndexLock(async () => {
|
|
282
332
|
const current = this.port.normalizeRuntimeSessions(await this.port.readRunLease());
|
|
283
|
-
if (
|
|
333
|
+
if (
|
|
334
|
+
current.run_id !== params.run_id ||
|
|
335
|
+
current.owner_instance_id !== params.owner_instance_id
|
|
336
|
+
) {
|
|
284
337
|
throw {
|
|
285
|
-
normalizedResponse: fail(
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
338
|
+
normalizedResponse: fail(
|
|
339
|
+
ERROR_CODES.RUN_LEASE_NOT_OWNED,
|
|
340
|
+
'Cannot prune feature sessions without run ownership',
|
|
341
|
+
{
|
|
342
|
+
run_id: params.run_id,
|
|
343
|
+
owner_instance_id: params.owner_instance_id,
|
|
344
|
+
active_run_id: current.run_id,
|
|
345
|
+
active_owner_instance_id: current.owner_instance_id,
|
|
346
|
+
retryable: false,
|
|
347
|
+
requires_human: true,
|
|
348
|
+
},
|
|
349
|
+
),
|
|
293
350
|
};
|
|
294
351
|
}
|
|
295
352
|
|
|
@@ -307,7 +364,7 @@ export class RunLeaseService {
|
|
|
307
364
|
if (removed.length > 0) {
|
|
308
365
|
await this.port.writeRunLease({
|
|
309
366
|
...current,
|
|
310
|
-
feature_sessions: kept
|
|
367
|
+
feature_sessions: kept,
|
|
311
368
|
});
|
|
312
369
|
}
|
|
313
370
|
|
|
@@ -21,13 +21,13 @@ const MUTATING_TOOLS = [
|
|
|
21
21
|
TOOLS.FEATURE_DELETE,
|
|
22
22
|
TOOLS.FEATURE_SEND_MESSAGE,
|
|
23
23
|
TOOLS.COST_RECORD,
|
|
24
|
-
TOOLS.PERFORMANCE_RECORD_OUTCOME
|
|
24
|
+
TOOLS.PERFORMANCE_RECORD_OUTCOME,
|
|
25
25
|
] as const;
|
|
26
26
|
|
|
27
27
|
export const TOOL_BEHAVIOR_METADATA: Readonly<Record<string, ToolBehaviorMetadata>> = Object.freeze(
|
|
28
28
|
Object.fromEntries(
|
|
29
|
-
MUTATING_TOOLS.map((name) => [name, { mutating: true, requires_operation_id: true }])
|
|
30
|
-
)
|
|
29
|
+
MUTATING_TOOLS.map((name) => [name, { mutating: true, requires_operation_id: true }]),
|
|
30
|
+
),
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
export function isMutatingTool(toolName: string): boolean {
|
|
@@ -41,7 +41,7 @@ export function toolRequiresOperationId(toolName: string): boolean {
|
|
|
41
41
|
export function withOperationIdIfRequired(
|
|
42
42
|
toolName: string,
|
|
43
43
|
args: Record<string, unknown>,
|
|
44
|
-
createOperationId: (toolName: string, featureId?: string) => string
|
|
44
|
+
createOperationId: (toolName: string, featureId?: string) => string,
|
|
45
45
|
): Record<string, unknown> {
|
|
46
46
|
if (!toolRequiresOperationId(toolName)) {
|
|
47
47
|
return { ...args };
|
|
@@ -54,6 +54,6 @@ export function withOperationIdIfRequired(
|
|
|
54
54
|
const featureId = typeof args.feature_id === 'string' ? args.feature_id : undefined;
|
|
55
55
|
return {
|
|
56
56
|
...args,
|
|
57
|
-
operation_id: createOperationId(toolName, featureId)
|
|
57
|
+
operation_id: createOperationId(toolName, featureId),
|
|
58
58
|
};
|
|
59
59
|
}
|
|
@@ -5,7 +5,7 @@ export interface ToolHandlerContext {
|
|
|
5
5
|
|
|
6
6
|
export type ToolHandler = (
|
|
7
7
|
args: Record<string, unknown>,
|
|
8
|
-
context: ToolHandlerContext
|
|
8
|
+
context: ToolHandlerContext,
|
|
9
9
|
) => Promise<unknown>;
|
|
10
10
|
|
|
11
11
|
export class ToolHandlerRegistry {
|
|
@@ -24,7 +24,10 @@ export class ToolRouter {
|
|
|
24
24
|
private readonly registry: ToolHandlerRegistry;
|
|
25
25
|
private readonly unknownToolHandler: (toolName: string) => Promise<unknown>;
|
|
26
26
|
|
|
27
|
-
constructor(
|
|
27
|
+
constructor(
|
|
28
|
+
registry: ToolHandlerRegistry,
|
|
29
|
+
unknownToolHandler: (toolName: string) => Promise<unknown>,
|
|
30
|
+
) {
|
|
28
31
|
this.registry = registry;
|
|
29
32
|
this.unknownToolHandler = unknownToolHandler;
|
|
30
33
|
}
|
|
@@ -32,7 +35,7 @@ export class ToolRouter {
|
|
|
32
35
|
async route(
|
|
33
36
|
toolName: string,
|
|
34
37
|
args: Record<string, unknown>,
|
|
35
|
-
context: ToolHandlerContext
|
|
38
|
+
context: ToolHandlerContext,
|
|
36
39
|
): Promise<unknown> {
|
|
37
40
|
const handler = this.registry.lookup(toolName);
|
|
38
41
|
if (!handler) {
|
|
@@ -7,7 +7,7 @@ import type { RuntimeContext } from './types.js';
|
|
|
7
7
|
|
|
8
8
|
export async function main(
|
|
9
9
|
argv: string[] = process.argv.slice(2),
|
|
10
|
-
runtime: RuntimeContext = { cwd: process.cwd(), env: process.env }
|
|
10
|
+
runtime: RuntimeContext = { cwd: process.cwd(), env: process.env },
|
|
11
11
|
): Promise<number> {
|
|
12
12
|
return await runCli(argv, runtime);
|
|
13
13
|
}
|
|
@@ -50,7 +50,7 @@ export function isDirectExecution(importMetaUrl: string, argv1: string | undefin
|
|
|
50
50
|
export function runAsEntrypoint(
|
|
51
51
|
importMetaUrl: string,
|
|
52
52
|
argv1: string | undefined,
|
|
53
|
-
executeMain: () => Promise<number> = () => main()
|
|
53
|
+
executeMain: () => Promise<number> = () => main(),
|
|
54
54
|
): boolean {
|
|
55
55
|
if (!isDirectExecution(importMetaUrl, argv1)) {
|
|
56
56
|
return false;
|