agentic-orchestrator 0.1.26 → 0.1.28
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/AGENTS.md +2 -2
- package/CLAUDE.md +2 -2
- package/README.md +47 -14
- package/agentic/orchestrator/agents.yaml +13 -0
- package/agentic/orchestrator/policy.yaml +3 -0
- package/agentic/orchestrator/schemas/agents.schema.json +76 -0
- package/agentic/orchestrator/schemas/policy.schema.json +16 -0
- package/agentic/orchestrator/schemas/policy.user.schema.json +16 -0
- package/agentic/orchestrator/schemas/state.schema.json +53 -0
- package/apps/control-plane/src/application/configuration-service.ts +181 -0
- package/apps/control-plane/src/application/kernel-tool-wiring.ts +292 -0
- package/apps/control-plane/src/application/services/checkpoint-service.ts +523 -0
- package/apps/control-plane/src/application/services/feature-send-message-service.ts +132 -0
- package/apps/control-plane/src/application/services/patch-service.ts +29 -5
- package/apps/control-plane/src/application/services/repo-operations-service.ts +276 -0
- package/apps/control-plane/src/application/services/worktree-watchdog-service.ts +156 -0
- package/apps/control-plane/src/cli/cli-argument-parser.ts +12 -0
- package/apps/control-plane/src/cli/help-command-handler.ts +17 -0
- package/apps/control-plane/src/cli/init-command-handler.ts +31 -0
- package/apps/control-plane/src/cli/resume-command-handler.ts +31 -4
- package/apps/control-plane/src/cli/rollback-command-handler.ts +217 -0
- package/apps/control-plane/src/cli/run-command-handler.ts +8 -0
- package/apps/control-plane/src/cli/types.ts +3 -0
- package/apps/control-plane/src/core/kernel-types.ts +55 -0
- package/apps/control-plane/src/core/kernel.ts +61 -878
- package/apps/control-plane/src/core/tool-caller.ts +10 -0
- package/apps/control-plane/src/core/utils/field-readers.ts +38 -0
- package/apps/control-plane/src/core/utils/index-normalizer.ts +119 -0
- package/apps/control-plane/src/core/utils/path-normalizers.ts +22 -0
- package/apps/control-plane/src/interfaces/cli/bootstrap.ts +15 -0
- package/apps/control-plane/src/providers/api-worker-provider.ts +14 -12
- package/apps/control-plane/src/providers/cli-worker-provider.ts +82 -12
- package/apps/control-plane/src/providers/providers.ts +45 -24
- package/apps/control-plane/src/providers/worker-provider-factory.ts +36 -1
- package/apps/control-plane/src/supervisor/run-coordinator.ts +91 -36
- package/apps/control-plane/src/supervisor/runtime.ts +107 -1
- package/apps/control-plane/src/supervisor/types.ts +9 -0
- package/apps/control-plane/src/supervisor/worker-decision-loop.ts +253 -14
- package/apps/control-plane/test/checkpoint-service.spec.ts +537 -0
- package/apps/control-plane/test/cli-helpers.spec.ts +28 -0
- package/apps/control-plane/test/cli.unit.spec.ts +52 -0
- package/apps/control-plane/test/configuration-service.spec.ts +466 -0
- package/apps/control-plane/test/dashboard-api.integration.spec.ts +537 -0
- package/apps/control-plane/test/dashboard-client.spec.ts +233 -0
- package/apps/control-plane/test/feature-send-message-service.spec.ts +314 -0
- package/apps/control-plane/test/init-wizard.spec.ts +35 -0
- package/apps/control-plane/test/path-normalizers.spec.ts +41 -0
- package/apps/control-plane/test/repo-operations-service.spec.ts +339 -0
- package/apps/control-plane/test/resume-command.spec.ts +33 -0
- package/apps/control-plane/test/review-workspace-logic.spec.ts +130 -0
- package/apps/control-plane/test/rollback-command.spec.ts +208 -0
- package/apps/control-plane/test/run-coordinator.spec.ts +119 -0
- package/apps/control-plane/test/worker-decision-loop.spec.ts +209 -0
- package/apps/control-plane/test/worker-provider-adapters.spec.ts +102 -0
- package/apps/control-plane/test/worker-provider-factory.spec.ts +14 -0
- package/apps/control-plane/test/worktree-watchdog-service.spec.ts +147 -0
- package/config/agentic/orchestrator/agents.yaml +13 -0
- package/dist/apps/control-plane/application/configuration-service.d.ts +19 -0
- package/dist/apps/control-plane/application/configuration-service.js +123 -0
- package/dist/apps/control-plane/application/configuration-service.js.map +1 -0
- package/dist/apps/control-plane/application/kernel-tool-wiring.d.ts +39 -0
- package/dist/apps/control-plane/application/kernel-tool-wiring.js +38 -0
- package/dist/apps/control-plane/application/kernel-tool-wiring.js.map +1 -0
- package/dist/apps/control-plane/application/services/checkpoint-service.d.ts +84 -0
- package/dist/apps/control-plane/application/services/checkpoint-service.js +367 -0
- package/dist/apps/control-plane/application/services/checkpoint-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/feature-send-message-service.d.ts +25 -0
- package/dist/apps/control-plane/application/services/feature-send-message-service.js +105 -0
- package/dist/apps/control-plane/application/services/feature-send-message-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/patch-service.d.ts +6 -0
- package/dist/apps/control-plane/application/services/patch-service.js +11 -2
- package/dist/apps/control-plane/application/services/patch-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/repo-operations-service.d.ts +70 -0
- package/dist/apps/control-plane/application/services/repo-operations-service.js +213 -0
- package/dist/apps/control-plane/application/services/repo-operations-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/worktree-watchdog-service.d.ts +23 -0
- package/dist/apps/control-plane/application/services/worktree-watchdog-service.js +119 -0
- package/dist/apps/control-plane/application/services/worktree-watchdog-service.js.map +1 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.js +12 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.js.map +1 -1
- package/dist/apps/control-plane/cli/help-command-handler.js +17 -0
- package/dist/apps/control-plane/cli/help-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/init-command-handler.js +23 -0
- package/dist/apps/control-plane/cli/init-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/resume-command-handler.js +25 -5
- package/dist/apps/control-plane/cli/resume-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/rollback-command-handler.d.ts +6 -0
- package/dist/apps/control-plane/cli/rollback-command-handler.js +177 -0
- package/dist/apps/control-plane/cli/rollback-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/run-command-handler.js +7 -1
- package/dist/apps/control-plane/cli/run-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/types.d.ts +3 -0
- package/dist/apps/control-plane/cli/types.js +1 -0
- package/dist/apps/control-plane/cli/types.js.map +1 -1
- package/dist/apps/control-plane/core/configuration-service.d.ts +25 -0
- package/dist/apps/control-plane/core/configuration-service.js +130 -0
- package/dist/apps/control-plane/core/configuration-service.js.map +1 -0
- package/dist/apps/control-plane/core/kernel-tool-wiring.d.ts +50 -0
- package/dist/apps/control-plane/core/kernel-tool-wiring.js +44 -0
- package/dist/apps/control-plane/core/kernel-tool-wiring.js.map +1 -0
- package/dist/apps/control-plane/core/kernel-types.d.ts +48 -0
- package/dist/apps/control-plane/core/kernel-types.js +2 -0
- package/dist/apps/control-plane/core/kernel-types.js.map +1 -0
- package/dist/apps/control-plane/core/kernel.d.ts +17 -48
- package/dist/apps/control-plane/core/kernel.js +44 -539
- package/dist/apps/control-plane/core/kernel.js.map +1 -1
- package/dist/apps/control-plane/core/tool-caller.d.ts +10 -0
- package/dist/apps/control-plane/core/utils/error-normalizer.d.ts +2 -0
- package/dist/apps/control-plane/core/utils/error-normalizer.js +51 -0
- package/dist/apps/control-plane/core/utils/error-normalizer.js.map +1 -0
- package/dist/apps/control-plane/core/utils/field-readers.d.ts +9 -0
- package/dist/apps/control-plane/core/utils/field-readers.js +30 -0
- package/dist/apps/control-plane/core/utils/field-readers.js.map +1 -0
- package/dist/apps/control-plane/core/utils/index-normalizer.d.ts +7 -0
- package/dist/apps/control-plane/core/utils/index-normalizer.js +92 -0
- package/dist/apps/control-plane/core/utils/index-normalizer.js.map +1 -0
- package/dist/apps/control-plane/core/utils/path-normalizers.d.ts +2 -0
- package/dist/apps/control-plane/core/utils/path-normalizers.js +17 -0
- package/dist/apps/control-plane/core/utils/path-normalizers.js.map +1 -0
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js +13 -1
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js.map +1 -1
- package/dist/apps/control-plane/providers/api-worker-provider.d.ts +4 -13
- package/dist/apps/control-plane/providers/api-worker-provider.js +10 -0
- package/dist/apps/control-plane/providers/api-worker-provider.js.map +1 -1
- package/dist/apps/control-plane/providers/cli-worker-provider.d.ts +11 -13
- package/dist/apps/control-plane/providers/cli-worker-provider.js +64 -0
- package/dist/apps/control-plane/providers/cli-worker-provider.js.map +1 -1
- package/dist/apps/control-plane/providers/providers.d.ts +31 -24
- package/dist/apps/control-plane/providers/providers.js +10 -0
- package/dist/apps/control-plane/providers/providers.js.map +1 -1
- package/dist/apps/control-plane/providers/worker-provider-factory.d.ts +11 -0
- package/dist/apps/control-plane/providers/worker-provider-factory.js +20 -1
- package/dist/apps/control-plane/providers/worker-provider-factory.js.map +1 -1
- package/dist/apps/control-plane/supervisor/run-coordinator.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.js +81 -33
- package/dist/apps/control-plane/supervisor/run-coordinator.js.map +1 -1
- package/dist/apps/control-plane/supervisor/runtime.d.ts +8 -1
- package/dist/apps/control-plane/supervisor/runtime.js +90 -0
- package/dist/apps/control-plane/supervisor/runtime.js.map +1 -1
- package/dist/apps/control-plane/supervisor/types.d.ts +11 -0
- package/dist/apps/control-plane/supervisor/types.js.map +1 -1
- package/dist/apps/control-plane/supervisor/worker-decision-loop.d.ts +21 -1
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js +207 -13
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js.map +1 -1
- package/package.json +1 -1
- package/packages/web-dashboard/package.json +2 -0
- package/packages/web-dashboard/src/app/analytics/page.tsx +83 -2
- package/packages/web-dashboard/src/app/api/actions/route.ts +92 -1
- package/packages/web-dashboard/src/app/api/analytics/route.ts +5 -2
- package/packages/web-dashboard/src/app/api/features/[id]/checkpoints/[checkpointId]/diff/route.ts +43 -0
- package/packages/web-dashboard/src/app/api/features/[id]/checkpoints/compare/route.ts +45 -0
- package/packages/web-dashboard/src/app/api/features/[id]/checkpoints/stream/route.ts +170 -0
- package/packages/web-dashboard/src/app/api/features/[id]/file-diff/route.ts +144 -0
- package/packages/web-dashboard/src/app/api/features/[id]/log-stream/route.ts +167 -0
- package/packages/web-dashboard/src/app/api/features/[id]/raw-logs/[filename]/route.ts +65 -0
- package/packages/web-dashboard/src/app/api/features/[id]/raw-logs/route.ts +63 -0
- package/packages/web-dashboard/src/app/api/features/[id]/timeline/route.ts +60 -0
- package/packages/web-dashboard/src/app/feature/[id]/page.tsx +32 -11
- package/packages/web-dashboard/src/app/globals.css +2 -0
- package/packages/web-dashboard/src/components/detail-panel.tsx +483 -0
- package/packages/web-dashboard/src/components/review-workspace.tsx +1162 -0
- package/packages/web-dashboard/src/lib/aop-client.ts +725 -0
- package/packages/web-dashboard/src/lib/review-contracts.ts +182 -0
- package/packages/web-dashboard/src/lib/review-workspace-logic.ts +64 -0
- package/packages/web-dashboard/src/lib/types.ts +131 -0
- package/packages/web-dashboard/src/styles/dashboard.module.css +333 -0
- package/spec-files/completed/agentic_orchestrator_execution_mode_spec.md +1905 -0
- package/spec-files/outstanding/agentic_orchestrator_runtime_inspection_spec.md +940 -0
- package/spec-files/outstanding/execution_mode_critical_review.md +355 -0
- package/spec-files/outstanding/shadow_workspace_implementation_spec.md +1271 -0
- package/spec-files/outstanding/shadow_workspace_spec_summary.md +222 -0
- package/spec-files/progress.md +269 -1
package/AGENTS.md
CHANGED
|
@@ -32,7 +32,7 @@ This is an MCP-first, multi-agent orchestrator control plane. The codebase lives
|
|
|
32
32
|
|
|
33
33
|
**CLI** (`apps/control-plane/src/cli/`) -> **Supervisor** (`supervisor/`) -> **Kernel** (`core/kernel.ts`) -> **Services** (`application/services/`)
|
|
34
34
|
|
|
35
|
-
- **CLI**: Entry point at `cli/aop.ts` -> delegates to `interfaces/cli/bootstrap.ts`. Commands: `run`, `status`, `resume`, `stop`, `delete`, `cleanup`, `init`, `dashboard`, `retry`, `send`, `attach`, `help`. All responses are structured JSON with `{ ok, data/error }`. Run `aop --help` or `aop help <command>` for usage details.
|
|
35
|
+
- **CLI**: Entry point at `cli/aop.ts` -> delegates to `interfaces/cli/bootstrap.ts`. Commands: `run`, `status`, `resume`, `stop`, `delete`, `cleanup`, `rollback`, `init`, `dashboard`, `retry`, `send`, `attach`, `help`. `run`/`resume` support `--execution-mode <deterministic|interactive>` overrides. All responses are structured JSON with `{ ok, data/error }`. Run `aop --help` or `aop help <command>` for usage details.
|
|
36
36
|
- **Kernel** (`core/kernel.ts`, ~900 lines): Deterministic orchestration engine. Manages schema validation, state, locks, plans, patches, gates, merges, and reporting. Delegates to 12+ domain services via port interfaces.
|
|
37
37
|
- **Supervisor** (`supervisor/runtime.ts`): Multi-agent runtime. Resolves providers (codex, claude, gemini, etc.), loads role-specific prompts, orchestrates planning/build/QA waves, and manages lease heartbeats.
|
|
38
38
|
- **MCP Tool Runtime** (`mcp/tool-runtime.ts`): Tool execution pipeline with registry-based dispatch, input/output schema validation, role-based authorization, and idempotency tracking via `operation_id`.
|
|
@@ -42,7 +42,7 @@ This is an MCP-first, multi-agent orchestrator control plane. The codebase lives
|
|
|
42
42
|
|
|
43
43
|
- `policy.yaml` - Commit/patch/merge policies, lock TTL, RBAC, supervisor iteration limits
|
|
44
44
|
- `gates.yaml` - Gate profiles (fast/full/merge) with commands and coverage thresholds
|
|
45
|
-
- `agents.yaml` - Agent roles (planner/builder/qa), provider defaults, prompt paths
|
|
45
|
+
- `agents.yaml` - Agent roles (planner/builder/qa), provider defaults, execution mode defaults (`deterministic|interactive`), prompt paths
|
|
46
46
|
- `prompts/` - Role-specific system prompts
|
|
47
47
|
- `tools/` - MCP tool contracts: `catalog.json` (33 tools), per-tool `schemas/input/` and `schemas/output/`
|
|
48
48
|
- `schemas/` - JSON schemas for policy, state, plan, index, gates, agents, qa_test_index
|
package/CLAUDE.md
CHANGED
|
@@ -32,7 +32,7 @@ This is an MCP-first, multi-agent orchestrator control plane. The codebase lives
|
|
|
32
32
|
|
|
33
33
|
**CLI** (`apps/control-plane/src/cli/`) → **Supervisor** (`supervisor/`) → **Kernel** (`core/kernel.ts`) → **Services** (`application/services/`)
|
|
34
34
|
|
|
35
|
-
- **CLI**: Entry point at `cli/aop.ts` → delegates to `interfaces/cli/bootstrap.ts`. Commands: `run`, `status`, `resume`, `stop`, `delete`, `cleanup`, `init`, `dashboard`, `retry`, `send`, `attach`, `help`. All responses are structured JSON with `{ ok, data/error }`. Run `aop --help` or `aop help <command>` for usage details.
|
|
35
|
+
- **CLI**: Entry point at `cli/aop.ts` → delegates to `interfaces/cli/bootstrap.ts`. Commands: `run`, `status`, `resume`, `stop`, `delete`, `cleanup`, `rollback`, `init`, `dashboard`, `retry`, `send`, `attach`, `help`. `run`/`resume` support `--execution-mode <deterministic|interactive>` overrides. All responses are structured JSON with `{ ok, data/error }`. Run `aop --help` or `aop help <command>` for usage details.
|
|
36
36
|
- **Kernel** (`core/kernel.ts`, ~900 lines): Deterministic orchestration engine. Manages schema validation, state, locks, plans, patches, gates, merges, and reporting. Delegates to 12+ domain services via port interfaces.
|
|
37
37
|
- **Supervisor** (`supervisor/runtime.ts`): Multi-agent runtime. Resolves providers (codex, claude, gemini, etc.), loads role-specific prompts, orchestrates planning/build/QA waves, manages lease heartbeats.
|
|
38
38
|
- **MCP Tool Runtime** (`mcp/tool-runtime.ts`): Tool execution pipeline with registry-based dispatch, input/output schema validation, role-based authorization, and idempotency tracking via `operation_id`.
|
|
@@ -42,7 +42,7 @@ This is an MCP-first, multi-agent orchestrator control plane. The codebase lives
|
|
|
42
42
|
|
|
43
43
|
- `policy.yaml` — Commit/patch/merge policies, lock TTL, RBAC, supervisor iteration limits
|
|
44
44
|
- `gates.yaml` — Gate profiles (fast/full/merge) with commands and coverage thresholds
|
|
45
|
-
- `agents.yaml` — Agent roles (planner/builder/qa), provider defaults, prompt paths
|
|
45
|
+
- `agents.yaml` — Agent roles (planner/builder/qa), provider defaults, execution mode defaults (`deterministic|interactive`), prompt paths
|
|
46
46
|
- `prompts/` — Role-specific system prompts
|
|
47
47
|
- `tools/` — MCP tool contracts: `catalog.json` (33 tools), per-tool `schemas/input/` and `schemas/output/`
|
|
48
48
|
- `schemas/` — JSON schemas for policy, state, plan, index, gates, agents, qa_test_index
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Agentic-Orchestrator
|
|
1
|
+
# Agentic-Orchestrator Project
|
|
2
2
|
|
|
3
3
|
[](https://www.typescriptlang.org/)
|
|
4
4
|
[](https://nx.dev/)
|
|
@@ -10,7 +10,7 @@ It combines:
|
|
|
10
10
|
|
|
11
11
|
- a **deterministic kernel** (state, locks, collisions, gates, evidence)
|
|
12
12
|
- a **supervisor runtime** (orchestrator/planner/builder/qa session coordination)
|
|
13
|
-
- a **CLI contract** (`aop <run|status|resume|stop|delete|cleanup|init|dashboard|retry|send|attach>`) with deterministic spec ingestion, runtime control, monitoring, and cleanup
|
|
13
|
+
- a **CLI contract** (`aop <run|status|resume|stop|delete|cleanup|rollback|init|dashboard|retry|send|attach>`) with deterministic spec ingestion, runtime control, monitoring, and cleanup
|
|
14
14
|
|
|
15
15
|
> For complete normative requirements, see [agentic_orchestrator_spec.md](spec-files/agentic_orchestrator_spec.md).
|
|
16
16
|
> For implementation continuity and the latest status, see [progress.md](spec-files/progress.md).
|
|
@@ -216,7 +216,7 @@ All commands print JSON to stdout. Errors use:
|
|
|
216
216
|
{ "ok": false, "error": { "code": "...", "message": "...", "details": { ... } } }
|
|
217
217
|
```
|
|
218
218
|
|
|
219
|
-
Available commands: `run`, `status`, `resume`, `stop`, `delete`, `cleanup`, `init`, `dashboard`, `retry`, `send`, `attach`, `help`.
|
|
219
|
+
Available commands: `run`, `status`, `resume`, `stop`, `delete`, `cleanup`, `rollback`, `init`, `dashboard`, `retry`, `send`, `attach`, `help`.
|
|
220
220
|
|
|
221
221
|
### `run`
|
|
222
222
|
|
|
@@ -257,6 +257,9 @@ Behavior:
|
|
|
257
257
|
- starts `SupervisorRuntime` with `max_active_features=5`, `max_parallel_gate_runs=3`.
|
|
258
258
|
- `max_iterations_per_phase` resolves from `policy.yaml` (`supervisor.max_iterations_per_phase`, default `6`).
|
|
259
259
|
- `--takeover-stale-run` enables stale run-lease takeover when another run is stale.
|
|
260
|
+
- `--execution-mode <deterministic|interactive>` overrides worker execution mode for the run:
|
|
261
|
+
- `deterministic` (default): PATCH outputs are validated/applied through `repo.apply_patch`.
|
|
262
|
+
- `interactive`: builder/qa workers get direct `working_directory` access and checkpoint validation snapshots are written under `.aop/features/<feature_id>/checkpoints/`.
|
|
260
263
|
|
|
261
264
|
### `status`
|
|
262
265
|
|
|
@@ -288,6 +291,7 @@ Runs recovery (`kernel.recoverFromState`), reconstructs resumable non-terminal f
|
|
|
288
291
|
- runtime restart:
|
|
289
292
|
- reuses persisted `runtime_sessions.run_id` and `owner_instance_id` when present
|
|
290
293
|
- starts supervisor loop with reconstructed feature set
|
|
294
|
+
- supports `--execution-mode <deterministic|interactive>` override for resumed worker waves
|
|
291
295
|
|
|
292
296
|
If no resumable features are found, `resume` returns recovery metadata only and does not start a new loop.
|
|
293
297
|
|
|
@@ -377,6 +381,18 @@ aop cleanup --yes
|
|
|
377
381
|
|
|
378
382
|
When `cleanup.auto_after_merge` is enabled in `policy.yaml`, the runtime automatically triggers cleanup after a successful merge.
|
|
379
383
|
|
|
384
|
+
### `rollback`
|
|
385
|
+
|
|
386
|
+
Reverses a checkpoint snapshot in the feature worktree using `git apply -R`.
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
# Preview rollback inputs
|
|
390
|
+
aop rollback --feature-id my_feature --checkpoint checkpoint-123 --dry-run
|
|
391
|
+
|
|
392
|
+
# Apply rollback
|
|
393
|
+
aop rollback --feature-id my_feature --checkpoint checkpoint-123
|
|
394
|
+
```
|
|
395
|
+
|
|
380
396
|
### `init`
|
|
381
397
|
|
|
382
398
|
Initialises agentic orchestrator configuration in the current directory. Generates `policy.yaml`, `gates.yaml`, `agents.yaml`, `adapters.yaml`, and system prompt templates. The wizard also captures default agent `provider`/`model`, `scm-provider`, and provider-auth mode.
|
|
@@ -499,8 +515,9 @@ Supported options:
|
|
|
499
515
|
| `--transport <mcp\\ | inprocess>` | Tool transport selection (default `mcp`) |
|
|
500
516
|
| `--takeover-stale-run` | Allow stale run-lease takeover during `run` |
|
|
501
517
|
| `--project <name>` | Select project from `multi-project.yaml` (run, status, resume, retry) |
|
|
502
|
-
| `--feature-id <id>` | Target feature for `delete`, `cleanup`, `retry`, `send`, `attach`
|
|
503
|
-
| `--
|
|
518
|
+
| `--feature-id <id>` | Target feature for `delete`, `cleanup`, `rollback`, `retry`, `send`, `attach` |
|
|
519
|
+
| `--checkpoint <id>` | Target checkpoint id for `rollback` |
|
|
520
|
+
| `--dry-run [true\\ | false]` | Preview-only mode for `delete`, `cleanup`, and `rollback` |
|
|
504
521
|
| `--yes` | Confirm destructive `delete` or `cleanup` execution |
|
|
505
522
|
| `--remove-worktree [true\\ | false]` | Whether to remove `.worktrees/<feature_id>` (default `true`) |
|
|
506
523
|
| `--remove-branch <none\\ | safe\\ | force>` | Local branch cleanup mode (default `none`) |
|
|
@@ -592,9 +609,24 @@ Coverage parser:
|
|
|
592
609
|
- role-specific system prompt paths
|
|
593
610
|
- default provider/model values with optional `runtime.provider_config_env` for API-backed providers
|
|
594
611
|
- optional `runtime.provider_configs.<provider>` objects for provider-specific payloads (for example `kiro-cli chat --agent dev`)
|
|
612
|
+
- `runtime.execution_mode` default (`deterministic|interactive`) plus `runtime.interactive.*` checkpoint/watchdog controls (`checkpoint_interval_ms`, `watchdog_poll_interval_ms`, `max_uncommitted_changes`, `validation_on_checkpoint`, `revert_on_violation`, `violation_severity`)
|
|
595
613
|
- `worktree.post_create` commands and `worktree.symlinks` for workspace hook automation
|
|
596
614
|
- stack-specific examples: [`example-configurations/node/`](example-configurations/node) and [`example-configurations/java/`](example-configurations/java)
|
|
597
615
|
|
|
616
|
+
Interactive mode example:
|
|
617
|
+
|
|
618
|
+
```yaml
|
|
619
|
+
runtime:
|
|
620
|
+
execution_mode: interactive
|
|
621
|
+
interactive:
|
|
622
|
+
checkpoint_interval_ms: 30000
|
|
623
|
+
watchdog_poll_interval_ms: 2000
|
|
624
|
+
max_uncommitted_changes: 50
|
|
625
|
+
validation_on_checkpoint: true
|
|
626
|
+
revert_on_violation: false
|
|
627
|
+
violation_severity: warning
|
|
628
|
+
```
|
|
629
|
+
|
|
598
630
|
### Multi-Project (`config/agentic/orchestrator/multi-project.yaml`)
|
|
599
631
|
|
|
600
632
|
Optional. Defines multiple independent projects in one repository. Pass `--project <name>` on the CLI to scope commands to a project. `aop status --all` aggregates across all projects. Each project can override `policy` and `gates` paths.
|
|
@@ -631,20 +663,21 @@ Files the runtime creates/maintains:
|
|
|
631
663
|
- `.aop/features/<feature_id>/state.md`
|
|
632
664
|
- `.aop/features/<feature_id>/plan.json`
|
|
633
665
|
- `.aop/features/<feature_id>/qa_test_index.json`
|
|
666
|
+
- `.aop/features/<feature_id>/checkpoints/*.diff` (interactive-mode checkpoint audit snapshots)
|
|
634
667
|
- `.aop/features/<feature_id>/logs/*`
|
|
635
668
|
- `.aop/features/<feature_id>/evidence/*`
|
|
636
669
|
|
|
637
670
|
### Schema mapping
|
|
638
671
|
|
|
639
|
-
| Runtime file | Schema file | Required/expected essentials
|
|
640
|
-
| -------------------------------------------------- | -------------------------------------------------------- |
|
|
641
|
-
| `.aop/features/<feature_id>/plan.json` | `agentic/orchestrator/schemas/plan.schema.json` | `feature_id`, `plan_version`, `summary`, `allowed_areas`, `forbidden_areas`, `base_ref`, `files.{create,modify,delete}`, `contracts.{openapi,events,db}`, `acceptance_criteria`, optional `gate_targets` (planner intent)
|
|
642
|
-
| `.aop/features/<feature_id>/state.md` front matter | `agentic/orchestrator/schemas/state.schema.json` | `feature_id`, `version`, `branch`, `worktree_path`, `status`, `gate_profile`, `gates`, `locks.held`, `collisions`, `cluster`, `role_status`, `last_updated`
|
|
643
|
-
| `.aop/features/index.json` | `agentic/orchestrator/schemas/index.schema.json` | `version`, `active`, `blocked`, `merged`, `locks`, `lock_leases`, `blocked_queue`, `runtime_sessions.{run_id,orchestrator_session_id,owner_instance_id,lease_expires_at,feature_sessions}`
|
|
644
|
-
| `config/agentic/orchestrator/gates.yaml` | `agentic/orchestrator/schemas/gates.schema.json` | `version`, `profiles.<profile>.modes.<mode>[{name,cmd,...}]`, optional parser/threshold metadata
|
|
645
|
-
| `config/agentic/orchestrator/policy.yaml` | `agentic/orchestrator/schemas/policy.schema.json` | commit/merge policy, patch policy, lock config, collision policy, gate selection defaults/healing toggles, path rules, execution policy, RBAC, Nx/Vitest implementation constraints
|
|
646
|
-
| `config/agentic/orchestrator/agents.yaml` | `agentic/orchestrator/schemas/agents.schema.json` | `version`, `roles`, `missing_prompt_behavior`, optional runtime defaults
|
|
647
|
-
| `.aop/features/<feature_id>/qa_test_index.json` | `agentic/orchestrator/schemas/qa_test_index.schema.json` | `feature_id`, `version`, `source_diff_ref`, `items[]` with path/hunks/required_tests/status
|
|
672
|
+
| Runtime file | Schema file | Required/expected essentials |
|
|
673
|
+
| -------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
674
|
+
| `.aop/features/<feature_id>/plan.json` | `agentic/orchestrator/schemas/plan.schema.json` | `feature_id`, `plan_version`, `summary`, `allowed_areas`, `forbidden_areas`, `base_ref`, `files.{create,modify,delete}`, `contracts.{openapi,events,db}`, `acceptance_criteria`, optional `gate_targets` (planner intent) |
|
|
675
|
+
| `.aop/features/<feature_id>/state.md` front matter | `agentic/orchestrator/schemas/state.schema.json` | `feature_id`, `version`, `branch`, `worktree_path`, `status`, `gate_profile`, `gates`, `locks.held`, `collisions`, `cluster`, `role_status`, `last_updated`, optional `execution_mode` override and `checkpoints[]` audit metadata |
|
|
676
|
+
| `.aop/features/index.json` | `agentic/orchestrator/schemas/index.schema.json` | `version`, `active`, `blocked`, `merged`, `locks`, `lock_leases`, `blocked_queue`, `runtime_sessions.{run_id,orchestrator_session_id,owner_instance_id,lease_expires_at,feature_sessions}` |
|
|
677
|
+
| `config/agentic/orchestrator/gates.yaml` | `agentic/orchestrator/schemas/gates.schema.json` | `version`, `profiles.<profile>.modes.<mode>[{name,cmd,...}]`, optional parser/threshold metadata |
|
|
678
|
+
| `config/agentic/orchestrator/policy.yaml` | `agentic/orchestrator/schemas/policy.schema.json` | commit/merge policy, patch policy, lock config, collision policy, gate selection defaults/healing toggles, path rules, execution policy, RBAC, Nx/Vitest implementation constraints |
|
|
679
|
+
| `config/agentic/orchestrator/agents.yaml` | `agentic/orchestrator/schemas/agents.schema.json` | `version`, `roles`, `missing_prompt_behavior`, optional runtime defaults |
|
|
680
|
+
| `.aop/features/<feature_id>/qa_test_index.json` | `agentic/orchestrator/schemas/qa_test_index.schema.json` | `feature_id`, `version`, `source_diff_ref`, `items[]` with path/hunks/required_tests/status |
|
|
648
681
|
|
|
649
682
|
### Important operational notes
|
|
650
683
|
|
|
@@ -10,6 +10,19 @@ missing_prompt_behavior: ignore
|
|
|
10
10
|
runtime:
|
|
11
11
|
default_provider: custom
|
|
12
12
|
default_model: local-default
|
|
13
|
+
execution_mode: deterministic
|
|
14
|
+
interactive:
|
|
15
|
+
watchdog_poll_interval_ms: 2000
|
|
16
|
+
checkpoint_interval_ms: 30000
|
|
17
|
+
max_uncommitted_changes: 50
|
|
18
|
+
validation_on_checkpoint: true
|
|
19
|
+
revert_on_violation: false
|
|
20
|
+
violation_severity: warning
|
|
21
|
+
shadow_workspace:
|
|
22
|
+
enabled: false
|
|
23
|
+
promotion_strategy: atomic
|
|
24
|
+
cleanup_on_failure: true
|
|
25
|
+
max_shadow_size_mb: 2048
|
|
13
26
|
worker_provider_mode: live
|
|
14
27
|
worker_response_timeout_ms: 600000
|
|
15
28
|
worker_spawn_timeout_ms: 15000
|
|
@@ -48,6 +48,82 @@
|
|
|
48
48
|
"type": "string",
|
|
49
49
|
"description": "Default model string passed to the provider SDK. Overridden by --agent-model CLI flag or AOP_AGENT_MODEL env var."
|
|
50
50
|
},
|
|
51
|
+
"execution_mode": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"enum": ["deterministic", "interactive"],
|
|
54
|
+
"default": "deterministic",
|
|
55
|
+
"description": "Execution mode used by worker roles. deterministic routes PATCH outputs through repo.apply_patch; interactive allows direct worktree edits with checkpoint validation."
|
|
56
|
+
},
|
|
57
|
+
"interactive": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"description": "Interactive execution mode settings used by the worker decision loop checkpoint/watchdog runtime.",
|
|
60
|
+
"additionalProperties": false,
|
|
61
|
+
"properties": {
|
|
62
|
+
"watchdog_poll_interval_ms": {
|
|
63
|
+
"type": "integer",
|
|
64
|
+
"minimum": 1,
|
|
65
|
+
"default": 2000,
|
|
66
|
+
"description": "Polling interval in milliseconds for worktree watchdog status scans."
|
|
67
|
+
},
|
|
68
|
+
"checkpoint_interval_ms": {
|
|
69
|
+
"type": "integer",
|
|
70
|
+
"minimum": 1,
|
|
71
|
+
"default": 30000,
|
|
72
|
+
"description": "Time-based checkpoint cadence in milliseconds."
|
|
73
|
+
},
|
|
74
|
+
"max_uncommitted_changes": {
|
|
75
|
+
"type": "integer",
|
|
76
|
+
"minimum": 1,
|
|
77
|
+
"default": 50,
|
|
78
|
+
"description": "Change-count threshold that triggers a checkpoint before the time-based interval."
|
|
79
|
+
},
|
|
80
|
+
"validation_on_checkpoint": {
|
|
81
|
+
"type": "boolean",
|
|
82
|
+
"default": true,
|
|
83
|
+
"description": "When true, each checkpoint validates diff changes against plan/policy/lock constraints."
|
|
84
|
+
},
|
|
85
|
+
"revert_on_violation": {
|
|
86
|
+
"type": "boolean",
|
|
87
|
+
"default": false,
|
|
88
|
+
"description": "When true, invalid checkpoint files are reverted automatically after validation failure."
|
|
89
|
+
},
|
|
90
|
+
"violation_severity": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"enum": ["info", "warning", "error", "critical"],
|
|
93
|
+
"default": "warning",
|
|
94
|
+
"description": "Severity assigned to checkpoint validation violations for notification and enforcement."
|
|
95
|
+
},
|
|
96
|
+
"shadow_workspace": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"description": "Reserved shadow-workspace strategy controls for future validation-before-promotion runtime.",
|
|
99
|
+
"additionalProperties": false,
|
|
100
|
+
"properties": {
|
|
101
|
+
"enabled": {
|
|
102
|
+
"type": "boolean",
|
|
103
|
+
"default": false,
|
|
104
|
+
"description": "Enable the shadow workspace interactive strategy."
|
|
105
|
+
},
|
|
106
|
+
"promotion_strategy": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"enum": ["atomic", "incremental"],
|
|
109
|
+
"default": "atomic",
|
|
110
|
+
"description": "How validated shadow changes are promoted into the feature worktree."
|
|
111
|
+
},
|
|
112
|
+
"cleanup_on_failure": {
|
|
113
|
+
"type": "boolean",
|
|
114
|
+
"default": true,
|
|
115
|
+
"description": "Delete the shadow workspace on validation failure."
|
|
116
|
+
},
|
|
117
|
+
"max_shadow_size_mb": {
|
|
118
|
+
"type": "integer",
|
|
119
|
+
"minimum": 1,
|
|
120
|
+
"default": 2048,
|
|
121
|
+
"description": "Maximum allowed shadow workspace size in megabytes."
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
51
127
|
"worker_provider_mode": {
|
|
52
128
|
"type": "string",
|
|
53
129
|
"description": "Execution mode for worker providers. 'live' uses provider-backed execution, 'stub' uses NullWorkerProvider.",
|
|
@@ -483,6 +483,22 @@
|
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
},
|
|
486
|
+
"observability": {
|
|
487
|
+
"type": "object",
|
|
488
|
+
"description": "Controls persistence and retention of sensitive raw worker provider output logs.",
|
|
489
|
+
"additionalProperties": false,
|
|
490
|
+
"properties": {
|
|
491
|
+
"raw_agent_logs_enabled": {
|
|
492
|
+
"type": "boolean",
|
|
493
|
+
"description": "When true, provider stdout from planner/builder/qa invocations is persisted under `.aop/features/<feature_id>/logs/`."
|
|
494
|
+
},
|
|
495
|
+
"raw_agent_logs_retention_days": {
|
|
496
|
+
"type": "integer",
|
|
497
|
+
"minimum": 1,
|
|
498
|
+
"description": "Maximum age in days for persisted raw provider log files before best-effort cleanup removes them."
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
},
|
|
486
502
|
"dashboard": {
|
|
487
503
|
"type": "object",
|
|
488
504
|
"description": "Real-time status dashboard HTTP server settings.",
|
|
@@ -78,6 +78,22 @@
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
|
+
"observability": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"description": "Raw worker output observability controls.",
|
|
84
|
+
"additionalProperties": false,
|
|
85
|
+
"properties": {
|
|
86
|
+
"raw_agent_logs_enabled": {
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"description": "When true, planner/builder/qa raw stdout is persisted in feature log artifacts."
|
|
89
|
+
},
|
|
90
|
+
"raw_agent_logs_retention_days": {
|
|
91
|
+
"type": "integer",
|
|
92
|
+
"minimum": 1,
|
|
93
|
+
"description": "Number of days raw agent log files are retained before cleanup."
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
81
97
|
"merge_policy": {
|
|
82
98
|
"type": "object",
|
|
83
99
|
"description": "Merge controls.",
|
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
"description": "Current lifecycle phase. planning \u2192 building \u2192 qa \u2192 ready_to_merge \u2192 merged. 'blocked' is a cross-cutting pause state; 'failed' is terminal.",
|
|
42
42
|
"enum": ["planning", "building", "qa", "blocked", "ready_to_merge", "merged", "failed"]
|
|
43
43
|
},
|
|
44
|
+
"execution_mode": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"enum": ["deterministic", "interactive"],
|
|
47
|
+
"description": "Optional per-feature execution mode override used by the supervisor mode resolver."
|
|
48
|
+
},
|
|
44
49
|
"gate_profile": {
|
|
45
50
|
"type": "string",
|
|
46
51
|
"description": "System-resolved gates profile for this feature. Runtime resolves and heals this from policy/gates config; planner plan input is not authoritative."
|
|
@@ -145,6 +150,54 @@
|
|
|
145
150
|
}
|
|
146
151
|
}
|
|
147
152
|
},
|
|
153
|
+
"checkpoints": {
|
|
154
|
+
"type": "array",
|
|
155
|
+
"description": "Checkpoint history captured during interactive execution mode. Each item records the diff snapshot, validation status, and any violations.",
|
|
156
|
+
"items": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"required": ["checkpoint_id", "timestamp", "files_changed", "validation_status"],
|
|
159
|
+
"additionalProperties": false,
|
|
160
|
+
"properties": {
|
|
161
|
+
"checkpoint_id": {
|
|
162
|
+
"type": "string",
|
|
163
|
+
"description": "Stable checkpoint identifier used for audit and rollback references."
|
|
164
|
+
},
|
|
165
|
+
"timestamp": {
|
|
166
|
+
"type": "string",
|
|
167
|
+
"format": "date-time",
|
|
168
|
+
"description": "Checkpoint creation timestamp in RFC3339 format."
|
|
169
|
+
},
|
|
170
|
+
"files_changed": {
|
|
171
|
+
"type": "array",
|
|
172
|
+
"description": "Set of worktree-relative file paths changed when the checkpoint snapshot was captured.",
|
|
173
|
+
"items": {
|
|
174
|
+
"type": "string"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"validation_status": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"enum": ["valid", "invalid", "skipped"],
|
|
180
|
+
"description": "Constraint-validation outcome for the checkpoint snapshot."
|
|
181
|
+
},
|
|
182
|
+
"violations": {
|
|
183
|
+
"type": "array",
|
|
184
|
+
"description": "Human-readable validation violation details collected at checkpoint time.",
|
|
185
|
+
"items": {
|
|
186
|
+
"type": "string"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"severity": {
|
|
190
|
+
"type": "string",
|
|
191
|
+
"enum": ["info", "warning", "error", "critical"],
|
|
192
|
+
"description": "Normalized severity assigned to checkpoint validation violations."
|
|
193
|
+
},
|
|
194
|
+
"diff_snapshot": {
|
|
195
|
+
"type": "string",
|
|
196
|
+
"description": "Repository-relative path to the stored checkpoint diff artifact."
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
148
201
|
"pr": {
|
|
149
202
|
"type": "object",
|
|
150
203
|
"description": "Pull request metadata populated by the PR monitor service when a PR exists for this feature.",
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { pathExists } from '../core/fs.js';
|
|
3
|
+
import type { SchemaRegistry } from '../core/schemas.js';
|
|
4
|
+
import { loadAndValidateYaml } from '../core/schemas.js';
|
|
5
|
+
import type { AopPathLayout } from '../core/path-layout.js';
|
|
6
|
+
import { ensureAopRuntimeLayout } from '../core/path-layout.js';
|
|
7
|
+
import { loadComposedPolicy } from './services/policy-loader-service.js';
|
|
8
|
+
import {
|
|
9
|
+
ACTIVITY_DETECTOR_SLOT,
|
|
10
|
+
NOTIFICATION_CHANNEL_SLOT,
|
|
11
|
+
SCM_PROVIDER_SLOT,
|
|
12
|
+
globalAdapterRegistry,
|
|
13
|
+
} from './adapters/adapter-registry.js';
|
|
14
|
+
import { ToolRegistryLoader } from '../mcp/tool-registry-loader.js';
|
|
15
|
+
import { ERROR_CODES } from '../core/error-codes.js';
|
|
16
|
+
import type {
|
|
17
|
+
AnyRecord,
|
|
18
|
+
KernelConfigOverrides,
|
|
19
|
+
AgentsConfigSnapshot,
|
|
20
|
+
PolicyConfigSnapshot,
|
|
21
|
+
} from '../core/kernel-types.js';
|
|
22
|
+
import {
|
|
23
|
+
readStringField,
|
|
24
|
+
readObjectField,
|
|
25
|
+
readPositiveIntegerField,
|
|
26
|
+
} from '../core/utils/field-readers.js';
|
|
27
|
+
|
|
28
|
+
export interface LoadedConfiguration {
|
|
29
|
+
gatesConfig: AnyRecord;
|
|
30
|
+
policy: PolicyConfigSnapshot;
|
|
31
|
+
agentsConfig: AgentsConfigSnapshot;
|
|
32
|
+
adaptersConfig: Record<string, unknown>;
|
|
33
|
+
toolRegistry: AnyRecord | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function validateAgentRuntimeTimeoutRelationships(agentsConfig: AnyRecord): void {
|
|
37
|
+
const runtime = readObjectField(agentsConfig, 'runtime');
|
|
38
|
+
if (Object.keys(runtime).length === 0) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const responseTimeoutMs = readPositiveIntegerField(runtime, 'worker_response_timeout_ms');
|
|
42
|
+
const spawnTimeoutMs = readPositiveIntegerField(runtime, 'worker_spawn_timeout_ms');
|
|
43
|
+
const idleTimeoutMs = readPositiveIntegerField(runtime, 'worker_idle_timeout_ms');
|
|
44
|
+
|
|
45
|
+
if (responseTimeoutMs != null && spawnTimeoutMs != null && spawnTimeoutMs >= responseTimeoutMs) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
'invalid_agents_yaml:runtime.worker_spawn_timeout_ms must be less than runtime.worker_response_timeout_ms',
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
if (responseTimeoutMs != null && idleTimeoutMs != null && idleTimeoutMs > responseTimeoutMs) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
'invalid_agents_yaml:runtime.worker_idle_timeout_ms must be less than or equal to runtime.worker_response_timeout_ms',
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class ConfigurationService {
|
|
58
|
+
private readonly repoRoot: string;
|
|
59
|
+
private readonly pathLayout: AopPathLayout;
|
|
60
|
+
private readonly schemaRegistry: SchemaRegistry;
|
|
61
|
+
private readonly configOverrides: KernelConfigOverrides;
|
|
62
|
+
|
|
63
|
+
constructor(
|
|
64
|
+
repoRoot: string,
|
|
65
|
+
pathLayout: AopPathLayout,
|
|
66
|
+
schemaRegistry: SchemaRegistry,
|
|
67
|
+
configOverrides: KernelConfigOverrides,
|
|
68
|
+
) {
|
|
69
|
+
this.repoRoot = repoRoot;
|
|
70
|
+
this.pathLayout = pathLayout;
|
|
71
|
+
this.schemaRegistry = schemaRegistry;
|
|
72
|
+
this.configOverrides = configOverrides;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private async resolveDefaultConfigPath(fileName: string): Promise<string> {
|
|
76
|
+
const primary = path.join(this.pathLayout.orchestratorRoot, fileName);
|
|
77
|
+
if (await pathExists(primary)) {
|
|
78
|
+
return primary;
|
|
79
|
+
}
|
|
80
|
+
const legacy = path.join(this.pathLayout.legacyOrchestratorRoot, fileName);
|
|
81
|
+
if (await pathExists(legacy)) {
|
|
82
|
+
return legacy;
|
|
83
|
+
}
|
|
84
|
+
return primary;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async loadAll(): Promise<LoadedConfiguration> {
|
|
88
|
+
await ensureAopRuntimeLayout(this.pathLayout);
|
|
89
|
+
|
|
90
|
+
const gatesPath =
|
|
91
|
+
this.configOverrides.gatesPath ?? (await this.resolveDefaultConfigPath('gates.yaml'));
|
|
92
|
+
const policyPath =
|
|
93
|
+
this.configOverrides.policyPath ?? (await this.resolveDefaultConfigPath('policy.yaml'));
|
|
94
|
+
const agentsPath =
|
|
95
|
+
this.configOverrides.agentsPath ?? (await this.resolveDefaultConfigPath('agents.yaml'));
|
|
96
|
+
const adaptersPath =
|
|
97
|
+
this.configOverrides.adaptersPath ?? (await this.resolveDefaultConfigPath('adapters.yaml'));
|
|
98
|
+
|
|
99
|
+
const gates = await loadAndValidateYaml(this.schemaRegistry, 'gates.schema.json', gatesPath);
|
|
100
|
+
if (!gates.validation.valid) {
|
|
101
|
+
throw new Error(`invalid_gates_yaml:${JSON.stringify(gates.validation.errors)}`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const { mergedPolicy } = await loadComposedPolicy(
|
|
105
|
+
this.repoRoot,
|
|
106
|
+
policyPath,
|
|
107
|
+
this.schemaRegistry,
|
|
108
|
+
);
|
|
109
|
+
const parsedPolicy = mergedPolicy as PolicyConfigSnapshot;
|
|
110
|
+
const implementation = readObjectField(parsedPolicy, 'implementation');
|
|
111
|
+
const testing = readObjectField(parsedPolicy, 'testing');
|
|
112
|
+
|
|
113
|
+
if (readStringField(implementation, 'workspace') !== 'nx') {
|
|
114
|
+
throw new Error(ERROR_CODES.INVALID_WORKSPACE_IMPLEMENTATION);
|
|
115
|
+
}
|
|
116
|
+
if (readStringField(testing, 'framework') !== 'vitest') {
|
|
117
|
+
throw new Error(ERROR_CODES.INVALID_WORKSPACE_IMPLEMENTATION);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const agentsExists = await pathExists(agentsPath);
|
|
121
|
+
let agents = { parsed: { version: 1, roles: {} }, validation: { valid: true, errors: [] } };
|
|
122
|
+
if (agentsExists) {
|
|
123
|
+
agents = await loadAndValidateYaml(this.schemaRegistry, 'agents.schema.json', agentsPath);
|
|
124
|
+
if (!agents.validation.valid) {
|
|
125
|
+
throw new Error(`invalid_agents_yaml:${JSON.stringify(agents.validation.errors)}`);
|
|
126
|
+
}
|
|
127
|
+
validateAgentRuntimeTimeoutRelationships(agents.parsed as AnyRecord);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const adaptersExists = await pathExists(adaptersPath);
|
|
131
|
+
let adapters = { parsed: {}, validation: { valid: true, errors: [] as unknown[] } };
|
|
132
|
+
if (adaptersExists) {
|
|
133
|
+
adapters = await loadAndValidateYaml(
|
|
134
|
+
this.schemaRegistry,
|
|
135
|
+
'adapters.schema.json',
|
|
136
|
+
adaptersPath,
|
|
137
|
+
);
|
|
138
|
+
if (!adapters.validation.valid) {
|
|
139
|
+
throw new Error(`invalid_adapters_yaml:${JSON.stringify(adapters.validation.errors)}`);
|
|
140
|
+
}
|
|
141
|
+
const parsedAdapters = readObjectField(adapters, 'parsed');
|
|
142
|
+
const notificationChannel = readStringField(parsedAdapters, NOTIFICATION_CHANNEL_SLOT.name);
|
|
143
|
+
if (notificationChannel) {
|
|
144
|
+
try {
|
|
145
|
+
globalAdapterRegistry.resolve(NOTIFICATION_CHANNEL_SLOT, notificationChannel, {});
|
|
146
|
+
} catch {
|
|
147
|
+
throw new Error(
|
|
148
|
+
`adapter_not_found:${NOTIFICATION_CHANNEL_SLOT.name}:${notificationChannel}`,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const activityDetector = readStringField(parsedAdapters, ACTIVITY_DETECTOR_SLOT.name);
|
|
153
|
+
if (activityDetector) {
|
|
154
|
+
try {
|
|
155
|
+
globalAdapterRegistry.resolve(ACTIVITY_DETECTOR_SLOT, activityDetector, {});
|
|
156
|
+
} catch {
|
|
157
|
+
throw new Error(`adapter_not_found:${ACTIVITY_DETECTOR_SLOT.name}:${activityDetector}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const scmProvider = readStringField(parsedAdapters, SCM_PROVIDER_SLOT.name);
|
|
161
|
+
if (scmProvider) {
|
|
162
|
+
try {
|
|
163
|
+
globalAdapterRegistry.resolve(SCM_PROVIDER_SLOT, scmProvider, {});
|
|
164
|
+
} catch {
|
|
165
|
+
throw new Error(`adapter_not_found:${SCM_PROVIDER_SLOT.name}:${scmProvider}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const registryLoader = new ToolRegistryLoader(this.repoRoot);
|
|
171
|
+
const toolRegistry = await registryLoader.load();
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
gatesConfig: gates.parsed,
|
|
175
|
+
policy: parsedPolicy,
|
|
176
|
+
agentsConfig: agents.parsed as AgentsConfigSnapshot,
|
|
177
|
+
adaptersConfig: readObjectField(adapters, 'parsed'),
|
|
178
|
+
toolRegistry,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|