agentic-orchestrator 0.1.6 → 0.1.8
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 +71 -48
- 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 +5 -22
- 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/env-file.ts +115 -0
- package/apps/control-plane/src/cli/help-command-handler.ts +61 -32
- package/apps/control-plane/src/cli/init-command-handler.ts +182 -56
- 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 +513 -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 +79 -35
- 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 +137 -54
- 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 +328 -68
- 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 +208 -104
- 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/config/agentic/orchestrator/adapters.yaml +3 -0
- package/config/agentic/orchestrator/agents.yaml +14 -0
- package/config/agentic/orchestrator/gates.yaml +28 -0
- package/config/agentic/orchestrator/policy.yaml +22 -0
- package/config/agentic/orchestrator/prompts/builder.system.md +1 -0
- package/config/agentic/orchestrator/prompts/planner.system.md +16 -0
- package/config/agentic/orchestrator/prompts/qa.system.md +1 -0
- 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/env-file.d.ts +4 -0
- package/dist/apps/control-plane/cli/env-file.js +89 -0
- package/dist/apps/control-plane/cli/env-file.js.map +1 -0
- 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 +97 -37
- 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 +40 -23
- 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 +3 -2
- package/dist/apps/control-plane/providers/providers.js +81 -39
- 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 +189 -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_provider_auth_bootstrap_spec.md +384 -0
- 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
|
@@ -24,7 +24,7 @@ async function boot() {
|
|
|
24
24
|
await kernel.ensureLoaded();
|
|
25
25
|
return {
|
|
26
26
|
kernel,
|
|
27
|
-
tooling: await createToolingRuntime(repoRoot, kernel)
|
|
27
|
+
tooling: await createToolingRuntime(repoRoot, kernel),
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -33,13 +33,13 @@ function identity(runId: string, actorType: string, actorId: string, sessionId:
|
|
|
33
33
|
run_id: runId,
|
|
34
34
|
session_id: sessionId,
|
|
35
35
|
actor_type: actorType,
|
|
36
|
-
actor_id: actorId
|
|
36
|
+
actor_id: actorId,
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function selectClient(
|
|
41
41
|
tooling: Awaited<ReturnType<typeof createToolingRuntime>>,
|
|
42
|
-
transport: 'inprocess' | 'mcp'
|
|
42
|
+
transport: 'inprocess' | 'mcp',
|
|
43
43
|
): ToolClient {
|
|
44
44
|
return transport === 'mcp' ? tooling.mcpClient : tooling.inProcessClient;
|
|
45
45
|
}
|
|
@@ -61,7 +61,11 @@ async function writeRunLease(data: Record<string, unknown>) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
async function writeIndex(index: Record<string, unknown>) {
|
|
64
|
-
await fs.writeFile(
|
|
64
|
+
await fs.writeFile(
|
|
65
|
+
path.join(repoRoot, '.aop', 'features', 'index.json'),
|
|
66
|
+
`${JSON.stringify(index, null, 2)}\n`,
|
|
67
|
+
'utf8',
|
|
68
|
+
);
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
async function setReattachTimeoutMs(timeoutMs: number) {
|
|
@@ -69,7 +73,7 @@ async function setReattachTimeoutMs(timeoutMs: number) {
|
|
|
69
73
|
const policy = await fs.readFile(policyPath, 'utf8');
|
|
70
74
|
const updated = policy.replace(
|
|
71
75
|
/orchestrator_session_reattach_timeout_ms:\s*\d+/,
|
|
72
|
-
`orchestrator_session_reattach_timeout_ms: ${timeoutMs}
|
|
76
|
+
`orchestrator_session_reattach_timeout_ms: ${timeoutMs}`,
|
|
73
77
|
);
|
|
74
78
|
await fs.writeFile(policyPath, updated, 'utf8');
|
|
75
79
|
}
|
|
@@ -110,13 +114,18 @@ async function writeFastTestGates(root: string): Promise<void> {
|
|
|
110
114
|
' coverage:',
|
|
111
115
|
' type: none',
|
|
112
116
|
'capabilities:',
|
|
113
|
-
' - none'
|
|
117
|
+
' - none',
|
|
114
118
|
].join('\n'),
|
|
115
|
-
'utf8'
|
|
119
|
+
'utf8',
|
|
116
120
|
);
|
|
117
121
|
}
|
|
118
122
|
|
|
119
|
-
function buildPlan(
|
|
123
|
+
function buildPlan(
|
|
124
|
+
featureId: string,
|
|
125
|
+
modifyPath: string,
|
|
126
|
+
planVersion = 1,
|
|
127
|
+
revisionOf: number | null = null,
|
|
128
|
+
) {
|
|
120
129
|
const plan = {
|
|
121
130
|
feature_id: featureId,
|
|
122
131
|
plan_version: planVersion,
|
|
@@ -127,15 +136,15 @@ function buildPlan(featureId: string, modifyPath: string, planVersion = 1, revis
|
|
|
127
136
|
files: {
|
|
128
137
|
create: [],
|
|
129
138
|
modify: [modifyPath],
|
|
130
|
-
delete: []
|
|
139
|
+
delete: [],
|
|
131
140
|
},
|
|
132
141
|
contracts: {
|
|
133
142
|
openapi: 'none',
|
|
134
143
|
events: 'none',
|
|
135
|
-
db: 'none'
|
|
144
|
+
db: 'none',
|
|
136
145
|
},
|
|
137
146
|
acceptance_criteria: ['Deterministic transport parity is preserved'],
|
|
138
|
-
gate_profile: 'parity'
|
|
147
|
+
gate_profile: 'parity',
|
|
139
148
|
};
|
|
140
149
|
|
|
141
150
|
if (revisionOf != null) {
|
|
@@ -145,7 +154,11 @@ function buildPlan(featureId: string, modifyPath: string, planVersion = 1, revis
|
|
|
145
154
|
return plan;
|
|
146
155
|
}
|
|
147
156
|
|
|
148
|
-
async function buildUnifiedDiff(
|
|
157
|
+
async function buildUnifiedDiff(
|
|
158
|
+
featureId: string,
|
|
159
|
+
relativeFilePath: string,
|
|
160
|
+
nextContent: string,
|
|
161
|
+
): Promise<string> {
|
|
149
162
|
const worktreePath = path.join(repoRoot, '.worktrees', featureId);
|
|
150
163
|
const samplePath = path.join(worktreePath, relativeFilePath);
|
|
151
164
|
const original = await fs.readFile(samplePath, 'utf8');
|
|
@@ -161,13 +174,13 @@ function normalizeEnvelope(response: any): Record<string, unknown> {
|
|
|
161
174
|
if (response?.ok) {
|
|
162
175
|
return {
|
|
163
176
|
ok: true,
|
|
164
|
-
data_keys: Object.keys(response.data ?? {}).sort((a, b) => a.localeCompare(b))
|
|
177
|
+
data_keys: Object.keys(response.data ?? {}).sort((a, b) => a.localeCompare(b)),
|
|
165
178
|
};
|
|
166
179
|
}
|
|
167
180
|
return {
|
|
168
181
|
ok: false,
|
|
169
182
|
error_code: response?.error?.code ?? 'unknown_error',
|
|
170
|
-
detail_keys: Object.keys(response?.error?.details ?? {}).sort((a, b) => a.localeCompare(b))
|
|
183
|
+
detail_keys: Object.keys(response?.error?.details ?? {}).sort((a, b) => a.localeCompare(b)),
|
|
171
184
|
};
|
|
172
185
|
}
|
|
173
186
|
|
|
@@ -179,7 +192,7 @@ class TimeoutReattachProvider extends NullWorkerProvider {
|
|
|
179
192
|
provider: 'custom',
|
|
180
193
|
model: 'test-model',
|
|
181
194
|
provider_config_env: null,
|
|
182
|
-
provider_config_ref: null
|
|
195
|
+
provider_config_ref: null,
|
|
183
196
|
});
|
|
184
197
|
this.orchestratorSessionIds = [];
|
|
185
198
|
}
|
|
@@ -192,7 +205,9 @@ class TimeoutReattachProvider extends NullWorkerProvider {
|
|
|
192
205
|
return created;
|
|
193
206
|
}
|
|
194
207
|
|
|
195
|
-
async reattachSession(
|
|
208
|
+
async reattachSession(
|
|
209
|
+
_sessionId: string,
|
|
210
|
+
): Promise<Awaited<ReturnType<NullWorkerProvider['reattachSession']>>> {
|
|
196
211
|
return await new Promise<Awaited<ReturnType<NullWorkerProvider['reattachSession']>>>(() => {
|
|
197
212
|
// Intentional unresolved promise to force timeout fallback.
|
|
198
213
|
});
|
|
@@ -203,16 +218,23 @@ describe('MCP formalization', () => {
|
|
|
203
218
|
it('lists tools from registry and keeps tools.md generated from catalog', async () => {
|
|
204
219
|
const { tooling } = await boot();
|
|
205
220
|
const listed = await tooling.mcpAdapter.toolsList();
|
|
206
|
-
const catalogNames = [...tooling.registry.toolsByName.keys()].sort((a, b) =>
|
|
221
|
+
const catalogNames = [...tooling.registry.toolsByName.keys()].sort((a, b) =>
|
|
222
|
+
a.localeCompare(b),
|
|
223
|
+
);
|
|
207
224
|
const listedNames = listed.tools.map((tool) => tool.name).sort((a, b) => a.localeCompare(b));
|
|
208
225
|
|
|
209
226
|
expect(listedNames).toEqual(catalogNames);
|
|
210
227
|
|
|
211
|
-
const toolsMd = await fs.readFile(
|
|
228
|
+
const toolsMd = await fs.readFile(
|
|
229
|
+
path.join(repoRoot, 'agentic', 'orchestrator', 'tools.md'),
|
|
230
|
+
'utf8',
|
|
231
|
+
);
|
|
212
232
|
expect(toolsMd).toContain('Generated from `agentic/orchestrator/tools/catalog.json`.');
|
|
213
233
|
expect(toolsMd).toContain('- feature.delete');
|
|
214
234
|
expect(toolsMd).toContain('- feature.init');
|
|
215
|
-
expect(tooling.registry.protocol.mcp_protocol_version).toBe(
|
|
235
|
+
expect(tooling.registry.protocol.mcp_protocol_version).toBe(
|
|
236
|
+
MCP_PROTOCOL_PIN.mcp_protocol_version,
|
|
237
|
+
);
|
|
216
238
|
expect(tooling.registry.protocol.sdk.package).toBe(MCP_PROTOCOL_PIN.sdk.package);
|
|
217
239
|
expect(tooling.registry.protocol.sdk.version).toBe(MCP_PROTOCOL_PIN.sdk.version);
|
|
218
240
|
for (const transport of REQUIRED_MCP_TRANSPORTS) {
|
|
@@ -225,7 +247,7 @@ describe('MCP formalization', () => {
|
|
|
225
247
|
|
|
226
248
|
const invalid = await tooling.mcpAdapter.toolsCall({
|
|
227
249
|
name: 'report.dashboard',
|
|
228
|
-
arguments: {}
|
|
250
|
+
arguments: {},
|
|
229
251
|
});
|
|
230
252
|
expect(invalid.ok).toBe(false);
|
|
231
253
|
expect((invalid as any).error.code).toBe('unauthenticated');
|
|
@@ -235,12 +257,12 @@ describe('MCP formalization', () => {
|
|
|
235
257
|
session_id: 'session-expired',
|
|
236
258
|
actor_type: 'orchestrator',
|
|
237
259
|
actor_id: 'actor-expired',
|
|
238
|
-
expires_at: new Date(Date.now() - 60_000).toISOString()
|
|
260
|
+
expires_at: new Date(Date.now() - 60_000).toISOString(),
|
|
239
261
|
});
|
|
240
262
|
const expired = await tooling.mcpAdapter.toolsCall({
|
|
241
263
|
name: 'report.dashboard',
|
|
242
264
|
arguments: {},
|
|
243
|
-
session_token: expiredToken
|
|
265
|
+
session_token: expiredToken,
|
|
244
266
|
});
|
|
245
267
|
expect(expired.ok).toBe(false);
|
|
246
268
|
expect((expired as any).error.code).toBe('unauthenticated');
|
|
@@ -249,15 +271,15 @@ describe('MCP formalization', () => {
|
|
|
249
271
|
run_id: 'run-valid',
|
|
250
272
|
session_id: 'session-valid',
|
|
251
273
|
actor_type: 'orchestrator',
|
|
252
|
-
actor_id: 'actor-valid'
|
|
274
|
+
actor_id: 'actor-valid',
|
|
253
275
|
});
|
|
254
276
|
const mismatch = await tooling.mcpAdapter.toolsCall({
|
|
255
277
|
name: 'report.dashboard',
|
|
256
278
|
arguments: {
|
|
257
279
|
actor_type: 'qa',
|
|
258
|
-
actor_id: 'qa-user'
|
|
280
|
+
actor_id: 'qa-user',
|
|
259
281
|
},
|
|
260
|
-
session_token: valid
|
|
282
|
+
session_token: valid,
|
|
261
283
|
});
|
|
262
284
|
expect(mismatch.ok).toBe(false);
|
|
263
285
|
expect((mismatch as any).error.code).toBe('invalid_actor_claim');
|
|
@@ -267,8 +289,8 @@ describe('MCP formalization', () => {
|
|
|
267
289
|
run_id: 'run-system',
|
|
268
290
|
session_id: 'worker:system',
|
|
269
291
|
actor_type: 'system',
|
|
270
|
-
actor_id: 'system:worker'
|
|
271
|
-
})
|
|
292
|
+
actor_id: 'system:worker',
|
|
293
|
+
}),
|
|
272
294
|
).toThrow();
|
|
273
295
|
});
|
|
274
296
|
|
|
@@ -280,22 +302,34 @@ describe('MCP formalization', () => {
|
|
|
280
302
|
const claims = identity(runId, 'orchestrator', 'orch:idem', 'session-idem');
|
|
281
303
|
const operationId = 'op-idempotent-0001';
|
|
282
304
|
|
|
283
|
-
const first = await tooling.inProcessClient.call(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
305
|
+
const first = await tooling.inProcessClient.call(
|
|
306
|
+
'feature.init',
|
|
307
|
+
{
|
|
308
|
+
feature_id: 'idem_feature',
|
|
309
|
+
operation_id: operationId,
|
|
310
|
+
},
|
|
311
|
+
claims,
|
|
312
|
+
);
|
|
287
313
|
expect(first.ok).toBe(true);
|
|
288
314
|
|
|
289
|
-
const second = await tooling.inProcessClient.call(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
315
|
+
const second = await tooling.inProcessClient.call(
|
|
316
|
+
'feature.init',
|
|
317
|
+
{
|
|
318
|
+
feature_id: 'idem_feature',
|
|
319
|
+
operation_id: operationId,
|
|
320
|
+
},
|
|
321
|
+
claims,
|
|
322
|
+
);
|
|
293
323
|
expect(second.ok).toBe(true);
|
|
294
324
|
|
|
295
|
-
const mismatch = await tooling.inProcessClient.call(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
325
|
+
const mismatch = await tooling.inProcessClient.call(
|
|
326
|
+
'feature.init',
|
|
327
|
+
{
|
|
328
|
+
feature_id: 'different_feature',
|
|
329
|
+
operation_id: operationId,
|
|
330
|
+
},
|
|
331
|
+
claims,
|
|
332
|
+
);
|
|
299
333
|
expect(mismatch.ok).toBe(false);
|
|
300
334
|
expect((mismatch as any).error.code).toBe('operation_id_reuse_mismatch');
|
|
301
335
|
|
|
@@ -314,7 +348,9 @@ describe('MCP formalization', () => {
|
|
|
314
348
|
const kernel = new AopKernel(repoRoot);
|
|
315
349
|
await kernel.ensureLoaded();
|
|
316
350
|
|
|
317
|
-
await expect(createToolingRuntime(repoRoot, kernel)).rejects.toThrow(
|
|
351
|
+
await expect(createToolingRuntime(repoRoot, kernel)).rejects.toThrow(
|
|
352
|
+
'policy_role_outside_supported_roles',
|
|
353
|
+
);
|
|
318
354
|
});
|
|
319
355
|
|
|
320
356
|
it('preserves transport parity for full critical path envelopes and deterministic state transitions', async () => {
|
|
@@ -322,7 +358,11 @@ describe('MCP formalization', () => {
|
|
|
322
358
|
|
|
323
359
|
await writeFeatureSpec(repoRoot, 'parity_inprocess');
|
|
324
360
|
await writeFeatureSpec(repoRoot, 'parity_mcp');
|
|
325
|
-
await fs.writeFile(
|
|
361
|
+
await fs.writeFile(
|
|
362
|
+
path.join(repoRoot, 'src', 'parity_inprocess.txt'),
|
|
363
|
+
'hello parity inprocess\n',
|
|
364
|
+
'utf8',
|
|
365
|
+
);
|
|
326
366
|
await fs.writeFile(path.join(repoRoot, 'src', 'parity_mcp.txt'), 'hello parity mcp\n', 'utf8');
|
|
327
367
|
await runGit(repoRoot, ['add', '.']);
|
|
328
368
|
await runGit(repoRoot, ['commit', '-m', 'add parity transport fixtures']);
|
|
@@ -332,7 +372,7 @@ describe('MCP formalization', () => {
|
|
|
332
372
|
featureId: 'parity_inprocess',
|
|
333
373
|
actorType: 'orchestrator',
|
|
334
374
|
actorId: 'orchestrator:in',
|
|
335
|
-
sessionId: 'session:in'
|
|
375
|
+
sessionId: 'session:in',
|
|
336
376
|
});
|
|
337
377
|
|
|
338
378
|
const mcpResult = await runCriticalFlow(tooling.mcpClient, {
|
|
@@ -340,10 +380,17 @@ describe('MCP formalization', () => {
|
|
|
340
380
|
featureId: 'parity_mcp',
|
|
341
381
|
actorType: 'orchestrator',
|
|
342
382
|
actorId: 'orchestrator:mcp',
|
|
343
|
-
sessionId: 'session:mcp'
|
|
383
|
+
sessionId: 'session:mcp',
|
|
344
384
|
});
|
|
345
385
|
|
|
346
|
-
expect(inprocessResult.statusTimeline).toEqual([
|
|
386
|
+
expect(inprocessResult.statusTimeline).toEqual([
|
|
387
|
+
'planning',
|
|
388
|
+
'building',
|
|
389
|
+
'qa',
|
|
390
|
+
'ready_to_merge',
|
|
391
|
+
'ready_to_merge',
|
|
392
|
+
'merged',
|
|
393
|
+
]);
|
|
347
394
|
expect(mcpResult.statusTimeline).toEqual(inprocessResult.statusTimeline);
|
|
348
395
|
expect(mcpResult.envelopes).toEqual(inprocessResult.envelopes);
|
|
349
396
|
expect(mcpResult.gateProfile).toBe('parity');
|
|
@@ -355,7 +402,10 @@ describe('MCP formalization', () => {
|
|
|
355
402
|
kernel.policy.collision_policy = 'block';
|
|
356
403
|
kernel.policy.locks.acquire_behavior = 'fail';
|
|
357
404
|
|
|
358
|
-
const inprocessResult = await runLockAndCollisionFlow(
|
|
405
|
+
const inprocessResult = await runLockAndCollisionFlow(
|
|
406
|
+
selectClient(tooling, 'inprocess'),
|
|
407
|
+
'inprocess',
|
|
408
|
+
);
|
|
359
409
|
const mcpResult = await runLockAndCollisionFlow(selectClient(tooling, 'mcp'), 'mcp');
|
|
360
410
|
|
|
361
411
|
expect(inprocessResult).toEqual({
|
|
@@ -364,13 +414,13 @@ describe('MCP formalization', () => {
|
|
|
364
414
|
queueCounts: {
|
|
365
415
|
afterQueue: 2,
|
|
366
416
|
afterFirstReplay: 1,
|
|
367
|
-
afterSecondReplay: 0
|
|
417
|
+
afterSecondReplay: 0,
|
|
368
418
|
},
|
|
369
419
|
replayOrder: ['second_feature', 'third_feature'],
|
|
370
420
|
acceptedVersions: {
|
|
371
421
|
second: 1,
|
|
372
|
-
third: 1
|
|
373
|
-
}
|
|
422
|
+
third: 1,
|
|
423
|
+
},
|
|
374
424
|
});
|
|
375
425
|
expect(mcpResult).toEqual(inprocessResult);
|
|
376
426
|
});
|
|
@@ -380,14 +430,18 @@ describe('MCP formalization', () => {
|
|
|
380
430
|
const { kernel, tooling } = await boot();
|
|
381
431
|
await kernel.ensureFeatureLayout('global');
|
|
382
432
|
|
|
383
|
-
const inprocessResult = await runTakeoverAndRecoveryFlow(
|
|
433
|
+
const inprocessResult = await runTakeoverAndRecoveryFlow(
|
|
434
|
+
kernel,
|
|
435
|
+
selectClient(tooling, 'inprocess'),
|
|
436
|
+
'inprocess',
|
|
437
|
+
);
|
|
384
438
|
const mcpResult = await runTakeoverAndRecoveryFlow(kernel, selectClient(tooling, 'mcp'), 'mcp');
|
|
385
439
|
|
|
386
440
|
expect(inprocessResult).toEqual({
|
|
387
441
|
noTakeoverCode: 'run_already_active',
|
|
388
442
|
takeoverSucceeded: true,
|
|
389
443
|
epochIncrementedOnRecovery: true,
|
|
390
|
-
orchestratorSessionRotated: true
|
|
444
|
+
orchestratorSessionRotated: true,
|
|
391
445
|
});
|
|
392
446
|
expect(mcpResult).toEqual(inprocessResult);
|
|
393
447
|
});
|
|
@@ -409,7 +463,8 @@ describe('MCP utility functions', () => {
|
|
|
409
463
|
it('GIVEN_generateToolsMarkdown_false_WHEN_createToolingRuntime_called_THEN_succeeds', async () => {
|
|
410
464
|
const kernel = new AopKernel(repoRoot);
|
|
411
465
|
await kernel.ensureLoaded();
|
|
412
|
-
const { createToolingRuntime: ctRt, resolveToolClient: rtc } =
|
|
466
|
+
const { createToolingRuntime: ctRt, resolveToolClient: rtc } =
|
|
467
|
+
await import('../src/mcp/runtime-factory.js');
|
|
413
468
|
const tooling = await ctRt(repoRoot, kernel, { generateToolsMarkdown: false });
|
|
414
469
|
expect(tooling.inProcessClient).toBeDefined();
|
|
415
470
|
const mcpClient = rtc('mcp', tooling);
|
|
@@ -427,26 +482,35 @@ async function runCriticalFlow(
|
|
|
427
482
|
actorType: string;
|
|
428
483
|
actorId: string;
|
|
429
484
|
sessionId: string;
|
|
430
|
-
}
|
|
485
|
+
},
|
|
431
486
|
): Promise<{
|
|
432
487
|
statusTimeline: string[];
|
|
433
488
|
gateProfile: string;
|
|
434
489
|
envelopes: Record<string, Record<string, unknown>>;
|
|
435
490
|
}> {
|
|
436
491
|
const orchestratorClaims = identity(input.runId, input.actorType, input.actorId, input.sessionId);
|
|
437
|
-
const builderClaims = identity(
|
|
492
|
+
const builderClaims = identity(
|
|
493
|
+
input.runId,
|
|
494
|
+
'builder',
|
|
495
|
+
`${input.actorId}:builder`,
|
|
496
|
+
`${input.sessionId}:builder`,
|
|
497
|
+
);
|
|
438
498
|
|
|
439
499
|
const init = await client.call(
|
|
440
500
|
'feature.init',
|
|
441
501
|
{
|
|
442
502
|
feature_id: input.featureId,
|
|
443
|
-
operation_id: createOperationId('feature.init', input.featureId)
|
|
503
|
+
operation_id: createOperationId('feature.init', input.featureId),
|
|
444
504
|
},
|
|
445
|
-
orchestratorClaims
|
|
505
|
+
orchestratorClaims,
|
|
446
506
|
);
|
|
447
507
|
expect(init.ok).toBe(true);
|
|
448
508
|
|
|
449
|
-
const planningState = await client.call(
|
|
509
|
+
const planningState = await client.call(
|
|
510
|
+
'feature.state_get',
|
|
511
|
+
{ feature_id: input.featureId },
|
|
512
|
+
orchestratorClaims,
|
|
513
|
+
);
|
|
450
514
|
expect(planningState.ok).toBe(true);
|
|
451
515
|
|
|
452
516
|
const plannedFilePath = `src/${input.featureId}.txt`;
|
|
@@ -456,24 +520,32 @@ async function runCriticalFlow(
|
|
|
456
520
|
{
|
|
457
521
|
feature_id: input.featureId,
|
|
458
522
|
plan_json: initialPlan,
|
|
459
|
-
operation_id: createOperationId('plan.submit', input.featureId)
|
|
523
|
+
operation_id: createOperationId('plan.submit', input.featureId),
|
|
460
524
|
},
|
|
461
|
-
orchestratorClaims
|
|
525
|
+
orchestratorClaims,
|
|
462
526
|
);
|
|
463
527
|
expect(planSubmit.ok).toBe(true);
|
|
464
528
|
|
|
465
|
-
const buildingState = await client.call(
|
|
529
|
+
const buildingState = await client.call(
|
|
530
|
+
'feature.state_get',
|
|
531
|
+
{ feature_id: input.featureId },
|
|
532
|
+
orchestratorClaims,
|
|
533
|
+
);
|
|
466
534
|
expect(buildingState.ok).toBe(true);
|
|
467
535
|
|
|
468
|
-
const diff = await buildUnifiedDiff(
|
|
536
|
+
const diff = await buildUnifiedDiff(
|
|
537
|
+
input.featureId,
|
|
538
|
+
plannedFilePath,
|
|
539
|
+
`hello parity ${input.featureId}\n`,
|
|
540
|
+
);
|
|
469
541
|
const applyPatch = await client.call(
|
|
470
542
|
'repo.apply_patch',
|
|
471
543
|
{
|
|
472
544
|
feature_id: input.featureId,
|
|
473
545
|
unified_diff: diff,
|
|
474
|
-
operation_id: createOperationId('repo.apply_patch', input.featureId)
|
|
546
|
+
operation_id: createOperationId('repo.apply_patch', input.featureId),
|
|
475
547
|
},
|
|
476
|
-
builderClaims
|
|
548
|
+
builderClaims,
|
|
477
549
|
);
|
|
478
550
|
expect(applyPatch.ok).toBe(true);
|
|
479
551
|
|
|
@@ -483,13 +555,17 @@ async function runCriticalFlow(
|
|
|
483
555
|
feature_id: input.featureId,
|
|
484
556
|
profile: 'parity',
|
|
485
557
|
mode: 'fast',
|
|
486
|
-
operation_id: createOperationId('gates.run.fast', input.featureId)
|
|
558
|
+
operation_id: createOperationId('gates.run.fast', input.featureId),
|
|
487
559
|
},
|
|
488
|
-
builderClaims
|
|
560
|
+
builderClaims,
|
|
489
561
|
);
|
|
490
562
|
expect(gateFast.ok).toBe(true);
|
|
491
563
|
|
|
492
|
-
const qaState = await client.call(
|
|
564
|
+
const qaState = await client.call(
|
|
565
|
+
'feature.state_get',
|
|
566
|
+
{ feature_id: input.featureId },
|
|
567
|
+
orchestratorClaims,
|
|
568
|
+
);
|
|
493
569
|
expect(qaState.ok).toBe(true);
|
|
494
570
|
|
|
495
571
|
const gateFull = await client.call(
|
|
@@ -498,13 +574,17 @@ async function runCriticalFlow(
|
|
|
498
574
|
feature_id: input.featureId,
|
|
499
575
|
profile: 'parity',
|
|
500
576
|
mode: 'full',
|
|
501
|
-
operation_id: createOperationId('gates.run.full', input.featureId)
|
|
577
|
+
operation_id: createOperationId('gates.run.full', input.featureId),
|
|
502
578
|
},
|
|
503
|
-
builderClaims
|
|
579
|
+
builderClaims,
|
|
504
580
|
);
|
|
505
581
|
expect(gateFull.ok).toBe(true);
|
|
506
582
|
|
|
507
|
-
const readyState = await client.call(
|
|
583
|
+
const readyState = await client.call(
|
|
584
|
+
'feature.state_get',
|
|
585
|
+
{ feature_id: input.featureId },
|
|
586
|
+
orchestratorClaims,
|
|
587
|
+
);
|
|
508
588
|
expect(readyState.ok).toBe(true);
|
|
509
589
|
|
|
510
590
|
const gateMerge = await client.call(
|
|
@@ -513,13 +593,17 @@ async function runCriticalFlow(
|
|
|
513
593
|
feature_id: input.featureId,
|
|
514
594
|
profile: 'parity',
|
|
515
595
|
mode: 'merge',
|
|
516
|
-
operation_id: createOperationId('gates.run.merge', input.featureId)
|
|
596
|
+
operation_id: createOperationId('gates.run.merge', input.featureId),
|
|
517
597
|
},
|
|
518
|
-
builderClaims
|
|
598
|
+
builderClaims,
|
|
519
599
|
);
|
|
520
600
|
expect(gateMerge.ok).toBe(true);
|
|
521
601
|
|
|
522
|
-
const stillReadyState = await client.call(
|
|
602
|
+
const stillReadyState = await client.call(
|
|
603
|
+
'feature.state_get',
|
|
604
|
+
{ feature_id: input.featureId },
|
|
605
|
+
orchestratorClaims,
|
|
606
|
+
);
|
|
523
607
|
expect(stillReadyState.ok).toBe(true);
|
|
524
608
|
|
|
525
609
|
const missingApproval = await client.call(
|
|
@@ -528,9 +612,9 @@ async function runCriticalFlow(
|
|
|
528
612
|
feature_id: input.featureId,
|
|
529
613
|
commit_message: `feat: merge ${input.featureId}`,
|
|
530
614
|
merge_strategy: 'merge_commit',
|
|
531
|
-
operation_id: createOperationId('feature.ready_to_merge.reject', input.featureId)
|
|
615
|
+
operation_id: createOperationId('feature.ready_to_merge.reject', input.featureId),
|
|
532
616
|
},
|
|
533
|
-
orchestratorClaims
|
|
617
|
+
orchestratorClaims,
|
|
534
618
|
);
|
|
535
619
|
expect(missingApproval.ok).toBe(false);
|
|
536
620
|
|
|
@@ -541,13 +625,15 @@ async function runCriticalFlow(
|
|
|
541
625
|
commit_message: `feat: merge ${input.featureId}`,
|
|
542
626
|
merge_strategy: 'merge_commit',
|
|
543
627
|
user_approval_token: 'approved',
|
|
544
|
-
operation_id: createOperationId('feature.ready_to_merge.pass', input.featureId)
|
|
628
|
+
operation_id: createOperationId('feature.ready_to_merge.pass', input.featureId),
|
|
545
629
|
},
|
|
546
|
-
orchestratorClaims
|
|
630
|
+
orchestratorClaims,
|
|
547
631
|
);
|
|
548
632
|
expect(merged.ok).toBe(true);
|
|
549
633
|
|
|
550
|
-
await expect(
|
|
634
|
+
await expect(
|
|
635
|
+
fs.stat(path.join(repoRoot, '.aop', 'features', input.featureId)),
|
|
636
|
+
).resolves.toBeDefined();
|
|
551
637
|
|
|
552
638
|
return {
|
|
553
639
|
statusTimeline: [
|
|
@@ -556,7 +642,7 @@ async function runCriticalFlow(
|
|
|
556
642
|
(qaState as any).data.front_matter.status,
|
|
557
643
|
(readyState as any).data.front_matter.status,
|
|
558
644
|
(stillReadyState as any).data.front_matter.status,
|
|
559
|
-
(merged as any).data.status
|
|
645
|
+
(merged as any).data.status,
|
|
560
646
|
],
|
|
561
647
|
gateProfile: (stillReadyState as any).data.front_matter.gate_profile,
|
|
562
648
|
envelopes: {
|
|
@@ -567,14 +653,14 @@ async function runCriticalFlow(
|
|
|
567
653
|
gateFull: normalizeEnvelope(gateFull),
|
|
568
654
|
gateMerge: normalizeEnvelope(gateMerge),
|
|
569
655
|
readyWithoutApproval: normalizeEnvelope(missingApproval),
|
|
570
|
-
readyWithApproval: normalizeEnvelope(merged)
|
|
571
|
-
}
|
|
656
|
+
readyWithApproval: normalizeEnvelope(merged),
|
|
657
|
+
},
|
|
572
658
|
};
|
|
573
659
|
}
|
|
574
660
|
|
|
575
661
|
async function runLockAndCollisionFlow(
|
|
576
662
|
client: ToolClient,
|
|
577
|
-
label: string
|
|
663
|
+
label: string,
|
|
578
664
|
): Promise<{
|
|
579
665
|
lockConflictCode: string;
|
|
580
666
|
queuedCodes: string[];
|
|
@@ -592,27 +678,40 @@ async function runLockAndCollisionFlow(
|
|
|
592
678
|
await writeFeatureSpec(repoRoot, featureId);
|
|
593
679
|
}
|
|
594
680
|
|
|
595
|
-
const orchestrator = identity(
|
|
681
|
+
const orchestrator = identity(
|
|
682
|
+
`run:${label}:collision`,
|
|
683
|
+
'orchestrator',
|
|
684
|
+
`orch:${label}`,
|
|
685
|
+
`session:${label}:orch`,
|
|
686
|
+
);
|
|
596
687
|
for (const featureId of [firstFeature, secondFeature, thirdFeature]) {
|
|
597
688
|
const init = await client.call(
|
|
598
689
|
'feature.init',
|
|
599
690
|
{ feature_id: featureId, operation_id: createOperationId('feature.init', featureId) },
|
|
600
|
-
orchestrator
|
|
691
|
+
orchestrator,
|
|
601
692
|
);
|
|
602
693
|
expect(init.ok).toBe(true);
|
|
603
694
|
}
|
|
604
695
|
|
|
605
696
|
const acquireFirst = await client.call(
|
|
606
697
|
'locks.acquire',
|
|
607
|
-
{
|
|
608
|
-
|
|
698
|
+
{
|
|
699
|
+
resource: 'openapi',
|
|
700
|
+
feature_id: firstFeature,
|
|
701
|
+
operation_id: createOperationId('locks.acquire', firstFeature),
|
|
702
|
+
},
|
|
703
|
+
orchestrator,
|
|
609
704
|
);
|
|
610
705
|
expect(acquireFirst.ok).toBe(true);
|
|
611
706
|
|
|
612
707
|
const acquireConflict = await client.call(
|
|
613
708
|
'locks.acquire',
|
|
614
|
-
{
|
|
615
|
-
|
|
709
|
+
{
|
|
710
|
+
resource: 'openapi',
|
|
711
|
+
feature_id: secondFeature,
|
|
712
|
+
operation_id: createOperationId('locks.acquire', secondFeature),
|
|
713
|
+
},
|
|
714
|
+
orchestrator,
|
|
616
715
|
);
|
|
617
716
|
expect(acquireConflict.ok).toBe(false);
|
|
618
717
|
|
|
@@ -621,9 +720,9 @@ async function runLockAndCollisionFlow(
|
|
|
621
720
|
{
|
|
622
721
|
feature_id: firstFeature,
|
|
623
722
|
plan_json: buildPlan(firstFeature, sharedPath, 1),
|
|
624
|
-
operation_id: createOperationId('plan.submit', firstFeature)
|
|
723
|
+
operation_id: createOperationId('plan.submit', firstFeature),
|
|
625
724
|
},
|
|
626
|
-
orchestrator
|
|
725
|
+
orchestrator,
|
|
627
726
|
);
|
|
628
727
|
expect(acceptedFirst.ok).toBe(true);
|
|
629
728
|
|
|
@@ -632,18 +731,18 @@ async function runLockAndCollisionFlow(
|
|
|
632
731
|
{
|
|
633
732
|
feature_id: secondFeature,
|
|
634
733
|
plan_json: buildPlan(secondFeature, sharedPath, 1),
|
|
635
|
-
operation_id: createOperationId('plan.submit', secondFeature)
|
|
734
|
+
operation_id: createOperationId('plan.submit', secondFeature),
|
|
636
735
|
},
|
|
637
|
-
orchestrator
|
|
736
|
+
orchestrator,
|
|
638
737
|
);
|
|
639
738
|
const queuedThird = await client.call(
|
|
640
739
|
'plan.submit',
|
|
641
740
|
{
|
|
642
741
|
feature_id: thirdFeature,
|
|
643
742
|
plan_json: buildPlan(thirdFeature, sharedPath, 1),
|
|
644
|
-
operation_id: createOperationId('plan.submit', thirdFeature)
|
|
743
|
+
operation_id: createOperationId('plan.submit', thirdFeature),
|
|
645
744
|
},
|
|
646
|
-
orchestrator
|
|
745
|
+
orchestrator,
|
|
647
746
|
);
|
|
648
747
|
expect(queuedSecond.ok).toBe(false);
|
|
649
748
|
expect(queuedThird.ok).toBe(false);
|
|
@@ -654,8 +753,8 @@ async function runLockAndCollisionFlow(
|
|
|
654
753
|
...queuedIndex,
|
|
655
754
|
blocked_queue: queuedIndex.blocked_queue.map((entry: any) => ({
|
|
656
755
|
...entry,
|
|
657
|
-
detected_at: '2026-02-28T12:00:00Z'
|
|
658
|
-
}))
|
|
756
|
+
detected_at: '2026-02-28T12:00:00Z',
|
|
757
|
+
})),
|
|
659
758
|
});
|
|
660
759
|
|
|
661
760
|
const revisedFirst = await client.call(
|
|
@@ -664,23 +763,27 @@ async function runLockAndCollisionFlow(
|
|
|
664
763
|
feature_id: firstFeature,
|
|
665
764
|
expected_plan_version: 1,
|
|
666
765
|
plan_json: buildPlan(firstFeature, leaderPath, 2, 1),
|
|
667
|
-
operation_id: createOperationId('plan.update', firstFeature)
|
|
766
|
+
operation_id: createOperationId('plan.update', firstFeature),
|
|
668
767
|
},
|
|
669
|
-
orchestrator
|
|
768
|
+
orchestrator,
|
|
670
769
|
);
|
|
671
770
|
expect(revisedFirst.ok).toBe(true);
|
|
672
771
|
|
|
673
772
|
const firstRelease = await client.call(
|
|
674
773
|
'locks.release',
|
|
675
|
-
{
|
|
676
|
-
|
|
774
|
+
{
|
|
775
|
+
resource: 'openapi',
|
|
776
|
+
feature_id: firstFeature,
|
|
777
|
+
operation_id: createOperationId('locks.release.1', firstFeature),
|
|
778
|
+
},
|
|
779
|
+
orchestrator,
|
|
677
780
|
);
|
|
678
781
|
expect(firstRelease.ok).toBe(true);
|
|
679
782
|
|
|
680
783
|
const indexAfterFirstReplay = await readIndex();
|
|
681
784
|
expect(indexAfterFirstReplay.blocked_queue).toHaveLength(1);
|
|
682
785
|
const remainingAfterFirstReplay = indexAfterFirstReplay.blocked_queue.map((entry: any) =>
|
|
683
|
-
String(entry.feature_id).replace(`${label}_`, '')
|
|
786
|
+
String(entry.feature_id).replace(`${label}_`, ''),
|
|
684
787
|
);
|
|
685
788
|
expect(remainingAfterFirstReplay).toEqual(['third_feature']);
|
|
686
789
|
|
|
@@ -693,23 +796,31 @@ async function runLockAndCollisionFlow(
|
|
|
693
796
|
feature_id: secondFeature,
|
|
694
797
|
expected_plan_version: 1,
|
|
695
798
|
plan_json: buildPlan(secondFeature, secondUniquePath, 2, 1),
|
|
696
|
-
operation_id: createOperationId('plan.update', secondFeature)
|
|
799
|
+
operation_id: createOperationId('plan.update', secondFeature),
|
|
697
800
|
},
|
|
698
|
-
orchestrator
|
|
801
|
+
orchestrator,
|
|
699
802
|
);
|
|
700
803
|
expect(revisedSecond.ok).toBe(true);
|
|
701
804
|
|
|
702
805
|
const reacquireFirst = await client.call(
|
|
703
806
|
'locks.acquire',
|
|
704
|
-
{
|
|
705
|
-
|
|
807
|
+
{
|
|
808
|
+
resource: 'openapi',
|
|
809
|
+
feature_id: firstFeature,
|
|
810
|
+
operation_id: createOperationId('locks.acquire.re', firstFeature),
|
|
811
|
+
},
|
|
812
|
+
orchestrator,
|
|
706
813
|
);
|
|
707
814
|
expect(reacquireFirst.ok).toBe(true);
|
|
708
815
|
|
|
709
816
|
const secondRelease = await client.call(
|
|
710
817
|
'locks.release',
|
|
711
|
-
{
|
|
712
|
-
|
|
818
|
+
{
|
|
819
|
+
resource: 'openapi',
|
|
820
|
+
feature_id: firstFeature,
|
|
821
|
+
operation_id: createOperationId('locks.release.2', firstFeature),
|
|
822
|
+
},
|
|
823
|
+
orchestrator,
|
|
713
824
|
);
|
|
714
825
|
expect(secondRelease.ok).toBe(true);
|
|
715
826
|
|
|
@@ -727,20 +838,20 @@ async function runLockAndCollisionFlow(
|
|
|
727
838
|
queueCounts: {
|
|
728
839
|
afterQueue: queuedIndex.blocked_queue.length,
|
|
729
840
|
afterFirstReplay: indexAfterFirstReplay.blocked_queue.length,
|
|
730
|
-
afterSecondReplay: indexAfterSecondReplay.blocked_queue.length
|
|
841
|
+
afterSecondReplay: indexAfterSecondReplay.blocked_queue.length,
|
|
731
842
|
},
|
|
732
843
|
replayOrder,
|
|
733
844
|
acceptedVersions: {
|
|
734
845
|
second: (secondPlan as any).data.plan.plan_version,
|
|
735
|
-
third: (thirdPlan as any).data.plan.plan_version
|
|
736
|
-
}
|
|
846
|
+
third: (thirdPlan as any).data.plan.plan_version,
|
|
847
|
+
},
|
|
737
848
|
};
|
|
738
849
|
}
|
|
739
850
|
|
|
740
851
|
async function runTakeoverAndRecoveryFlow(
|
|
741
852
|
kernel: AopKernel,
|
|
742
853
|
client: ToolClient,
|
|
743
|
-
label: string
|
|
854
|
+
label: string,
|
|
744
855
|
): Promise<{
|
|
745
856
|
noTakeoverCode: string;
|
|
746
857
|
takeoverSucceeded: boolean;
|
|
@@ -755,18 +866,23 @@ async function runTakeoverAndRecoveryFlow(
|
|
|
755
866
|
const provider = new TimeoutReattachProvider();
|
|
756
867
|
const featureId = `${label}_recovery_feature`;
|
|
757
868
|
await writeFeatureSpec(repoRoot, featureId, '# Spec\n\nRecover stale run.\n');
|
|
758
|
-
const orchestrator = identity(
|
|
869
|
+
const orchestrator = identity(
|
|
870
|
+
`run:${label}:recovery`,
|
|
871
|
+
'orchestrator',
|
|
872
|
+
`orch:${label}:recovery`,
|
|
873
|
+
`session:${label}:recovery`,
|
|
874
|
+
);
|
|
759
875
|
|
|
760
876
|
const init = await client.call(
|
|
761
877
|
'feature.init',
|
|
762
878
|
{ feature_id: featureId, operation_id: createOperationId('feature.init', featureId) },
|
|
763
|
-
orchestrator
|
|
879
|
+
orchestrator,
|
|
764
880
|
);
|
|
765
881
|
expect(init.ok).toBe(true);
|
|
766
882
|
|
|
767
883
|
const sourceRuntime = new SupervisorRuntime(kernel, provider, client, {
|
|
768
884
|
run_id: `run:${label}:source`,
|
|
769
|
-
max_iterations_per_phase: 0
|
|
885
|
+
max_iterations_per_phase: 0,
|
|
770
886
|
});
|
|
771
887
|
await sourceRuntime.start([{ feature_id: featureId }]);
|
|
772
888
|
|
|
@@ -777,7 +893,7 @@ async function runTakeoverAndRecoveryFlow(
|
|
|
777
893
|
const noTakeoverRuntime = new SupervisorRuntime(kernel, provider, client, {
|
|
778
894
|
run_id: `run:${label}:target:no-takeover`,
|
|
779
895
|
max_iterations_per_phase: 0,
|
|
780
|
-
takeover_stale_run: false
|
|
896
|
+
takeover_stale_run: false,
|
|
781
897
|
});
|
|
782
898
|
|
|
783
899
|
let noTakeoverCode = 'unknown';
|
|
@@ -788,7 +904,7 @@ async function runTakeoverAndRecoveryFlow(
|
|
|
788
904
|
const takeoverRuntime = new SupervisorRuntime(kernel, provider, client, {
|
|
789
905
|
run_id: `run:${label}:target:takeover`,
|
|
790
906
|
max_iterations_per_phase: 0,
|
|
791
|
-
takeover_stale_run: true
|
|
907
|
+
takeover_stale_run: true,
|
|
792
908
|
});
|
|
793
909
|
await takeoverRuntime.start([{ feature_id: featureId }]);
|
|
794
910
|
|
|
@@ -806,6 +922,6 @@ async function runTakeoverAndRecoveryFlow(
|
|
|
806
922
|
noTakeoverCode,
|
|
807
923
|
takeoverSucceeded: postTakeover.run_id === `run:${label}:target:takeover`,
|
|
808
924
|
epochIncrementedOnRecovery: Number(postRecovery.orchestrator_epoch ?? 0) === takeoverEpoch + 1,
|
|
809
|
-
orchestratorSessionRotated: postRecovery.orchestrator_session_id !== takeoverSessionId
|
|
925
|
+
orchestratorSessionRotated: postRecovery.orchestrator_session_id !== takeoverSessionId,
|
|
810
926
|
};
|
|
811
927
|
}
|