agentic-orchestrator 0.1.2 → 0.1.4
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/.claude/settings.local.json +15 -0
- package/CLAUDE.md +126 -0
- package/README.md +166 -25
- package/agentic/orchestrator/adapters.yaml +3 -0
- package/agentic/orchestrator/gates.yaml +47 -0
- package/agentic/orchestrator/policy.yaml +89 -0
- package/agentic/orchestrator/schemas/adapters.schema.json +12 -0
- package/agentic/orchestrator/schemas/gates.schema.json +6 -1
- package/agentic/orchestrator/schemas/index.schema.json +14 -0
- package/agentic/orchestrator/schemas/multi-project.schema.json +41 -0
- package/agentic/orchestrator/schemas/policy.schema.json +449 -52
- package/agentic/orchestrator/schemas/state.schema.json +16 -0
- package/agentic/orchestrator/tools/catalog.json +68 -0
- package/agentic/orchestrator/tools/schemas/input/cost.get.input.schema.json +10 -0
- package/agentic/orchestrator/tools/schemas/input/cost.record.input.schema.json +13 -0
- package/agentic/orchestrator/tools/schemas/input/feature.send_message.input.schema.json +11 -0
- package/agentic/orchestrator/tools/schemas/input/performance.get_analytics.input.schema.json +10 -0
- package/agentic/orchestrator/tools/schemas/input/performance.record_outcome.input.schema.json +18 -0
- package/agentic/orchestrator/tools/schemas/output/cost.get.output.schema.json +13 -0
- package/agentic/orchestrator/tools/schemas/output/cost.record.output.schema.json +13 -0
- package/agentic/orchestrator/tools/schemas/output/feature.ready_to_merge.output.schema.json +7 -0
- package/agentic/orchestrator/tools/schemas/output/feature.send_message.output.schema.json +23 -0
- package/agentic/orchestrator/tools/schemas/output/performance.get_analytics.output.schema.json +46 -0
- package/agentic/orchestrator/tools/schemas/output/performance.record_outcome.output.schema.json +10 -0
- package/agentic/orchestrator/tools.md +5 -0
- package/apps/control-plane/scripts/validate-architecture-rules.mjs +28 -2
- package/apps/control-plane/scripts/validate-docker-mcp-contract.mjs +12 -0
- package/apps/control-plane/scripts/validate-mcp-contracts.ts +92 -0
- package/apps/control-plane/src/application/adapters/adapter-registry.ts +169 -0
- package/apps/control-plane/src/application/multi-project-loader.ts +119 -0
- package/apps/control-plane/src/application/services/activity-monitor-service.ts +199 -0
- package/apps/control-plane/src/application/services/cost-tracking-service.ts +82 -0
- package/apps/control-plane/src/application/services/dependency-scheduler-service.ts +86 -0
- package/apps/control-plane/src/application/services/feature-deletion-service.ts +8 -7
- package/apps/control-plane/src/application/services/gate-interpolation-service.ts +15 -0
- package/apps/control-plane/src/application/services/gate-service.ts +38 -2
- package/apps/control-plane/src/application/services/instance-isolation-service.ts +18 -0
- package/apps/control-plane/src/application/services/issue-tracker-service.ts +469 -0
- package/apps/control-plane/src/application/services/merge-service.ts +67 -3
- package/apps/control-plane/src/application/services/notifier-service.ts +295 -0
- package/apps/control-plane/src/application/services/performance-analytics-service.ts +122 -0
- package/apps/control-plane/src/application/services/plan-service.ts +51 -0
- package/apps/control-plane/src/application/services/pr-monitor-service.ts +262 -0
- package/apps/control-plane/src/application/services/reactions-service.ts +175 -0
- package/apps/control-plane/src/application/services/reporting-service.ts +17 -2
- package/apps/control-plane/src/application/services/run-lease-service.ts +16 -38
- package/apps/control-plane/src/application/tools/tool-metadata.ts +4 -1
- package/apps/control-plane/src/cli/aop.ts +1 -1
- package/apps/control-plane/src/cli/attach-command-handler.ts +120 -0
- package/apps/control-plane/src/cli/cleanup-command-handler.ts +190 -0
- package/apps/control-plane/src/cli/cli-argument-parser.ts +69 -3
- package/apps/control-plane/src/cli/dashboard-command-handler.ts +57 -0
- package/apps/control-plane/src/cli/help-command-handler.ts +163 -0
- package/apps/control-plane/src/cli/init-command-handler.ts +609 -0
- package/apps/control-plane/src/cli/resume-command-handler.ts +1 -0
- package/apps/control-plane/src/cli/retry-command-handler.ts +138 -0
- package/apps/control-plane/src/cli/run-command-handler.ts +115 -3
- package/apps/control-plane/src/cli/send-command-handler.ts +65 -0
- package/apps/control-plane/src/cli/status-command-handler.ts +102 -2
- package/apps/control-plane/src/cli/types.ts +26 -1
- package/apps/control-plane/src/core/constants.ts +8 -2
- package/apps/control-plane/src/core/error-codes.ts +3 -1
- package/apps/control-plane/src/core/gates.ts +170 -50
- package/apps/control-plane/src/core/kernel.ts +280 -5
- package/apps/control-plane/src/core/path-layout.ts +12 -0
- package/apps/control-plane/src/core/tool-caller.ts +36 -0
- package/apps/control-plane/src/core/workspace-hooks.ts +87 -0
- package/apps/control-plane/src/interfaces/cli/bootstrap.ts +258 -9
- package/apps/control-plane/src/providers/providers.ts +235 -14
- package/apps/control-plane/src/supervisor/build-wave-executor.ts +129 -8
- package/apps/control-plane/src/supervisor/qa-wave-executor.ts +123 -5
- package/apps/control-plane/src/supervisor/run-coordinator.ts +143 -6
- package/apps/control-plane/src/supervisor/runtime.ts +135 -6
- package/apps/control-plane/src/supervisor/types.ts +12 -21
- package/apps/control-plane/src/supervisor/worker-decision-loop.ts +8 -0
- package/apps/control-plane/test/activity-monitor.spec.ts +294 -0
- package/apps/control-plane/test/adapter-registry.spec.ts +132 -0
- package/apps/control-plane/test/batch-operations.spec.ts +112 -0
- package/apps/control-plane/test/bootstrap-attach.spec.ts +102 -0
- package/apps/control-plane/test/bootstrap-edge-cases.spec.ts +252 -0
- package/apps/control-plane/test/bootstrap.spec.ts +560 -0
- package/apps/control-plane/test/cleanup-command.spec.ts +301 -0
- package/apps/control-plane/test/cli-helpers.spec.ts +404 -1
- package/apps/control-plane/test/cli.unit.spec.ts +182 -1
- package/apps/control-plane/test/collision-queue.spec.ts +104 -1
- package/apps/control-plane/test/core-utils.spec.ts +175 -2
- package/apps/control-plane/test/cost-tracking.spec.ts +143 -0
- package/apps/control-plane/test/dashboard-api.integration.spec.ts +247 -0
- package/apps/control-plane/test/dashboard-client.spec.ts +116 -0
- package/apps/control-plane/test/dashboard-command.spec.ts +103 -0
- package/apps/control-plane/test/dependency-scheduler.spec.ts +189 -0
- package/apps/control-plane/test/epoch-tracking.spec.ts +4 -4
- package/apps/control-plane/test/feature-deletion-service.spec.ts +422 -0
- package/apps/control-plane/test/feature-lifecycle.spec.ts +202 -0
- package/apps/control-plane/test/git-spawn-error.spec.ts +24 -0
- package/apps/control-plane/test/incremental-gates.spec.ts +137 -0
- package/apps/control-plane/test/init-wizard.spec.ts +506 -0
- package/apps/control-plane/test/instance-isolation.spec.ts +83 -0
- package/apps/control-plane/test/issue-tracker.spec.ts +890 -0
- package/apps/control-plane/test/kernel.coverage.spec.ts +3 -5
- package/apps/control-plane/test/kernel.coverage2.spec.ts +871 -0
- package/apps/control-plane/test/kernel.spec.ts +13 -11
- package/apps/control-plane/test/lock-service.spec.ts +508 -0
- package/apps/control-plane/test/mcp-helpers.spec.ts +176 -0
- package/apps/control-plane/test/mcp.spec.ts +50 -15
- package/apps/control-plane/test/merge-service.spec.ts +67 -4
- package/apps/control-plane/test/multi-project.spec.ts +372 -0
- package/apps/control-plane/test/notifier-service.spec.ts +388 -0
- package/apps/control-plane/test/parallel-gates.spec.ts +312 -0
- package/apps/control-plane/test/patch-service.spec.ts +253 -0
- package/apps/control-plane/test/performance-analytics.spec.ts +338 -0
- package/apps/control-plane/test/planning-wave-executor.spec.ts +168 -0
- package/apps/control-plane/test/pr-monitor.spec.ts +385 -0
- package/apps/control-plane/test/providers.spec.ts +344 -1
- package/apps/control-plane/test/reactions.spec.ts +392 -0
- package/apps/control-plane/test/resume-command.spec.ts +390 -0
- package/apps/control-plane/test/run-coordinator.spec.ts +481 -2
- package/apps/control-plane/test/schema-date-time.spec.ts +46 -0
- package/apps/control-plane/test/service-retry-paths.spec.ts +30 -0
- package/apps/control-plane/test/services.spec.ts +95 -2
- package/apps/control-plane/test/session-management.spec.ts +450 -0
- package/apps/control-plane/test/spec-ingestion.spec.ts +190 -0
- package/apps/control-plane/test/supervisor-collaborators.spec.ts +699 -2
- package/apps/control-plane/test/supervisor.spec.ts +36 -30
- package/apps/control-plane/test/supervisor.unit.spec.ts +405 -0
- package/apps/control-plane/test/worker-decision-loop.spec.ts +57 -0
- package/apps/control-plane/test/workspace-hooks.spec.ts +177 -0
- package/apps/control-plane/vitest.config.ts +21 -5
- package/dist/apps/control-plane/application/adapters/adapter-registry.d.ts +44 -0
- package/dist/apps/control-plane/application/adapters/adapter-registry.js +76 -0
- package/dist/apps/control-plane/application/adapters/adapter-registry.js.map +1 -0
- package/dist/apps/control-plane/application/multi-project-loader.d.ts +31 -0
- package/dist/apps/control-plane/application/multi-project-loader.js +82 -0
- package/dist/apps/control-plane/application/multi-project-loader.js.map +1 -0
- package/dist/apps/control-plane/application/services/activity-monitor-service.d.ts +43 -0
- package/dist/apps/control-plane/application/services/activity-monitor-service.js +132 -0
- package/dist/apps/control-plane/application/services/activity-monitor-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/cost-tracking-service.d.ts +28 -0
- package/dist/apps/control-plane/application/services/cost-tracking-service.js +48 -0
- package/dist/apps/control-plane/application/services/cost-tracking-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/dependency-scheduler-service.d.ts +26 -0
- package/dist/apps/control-plane/application/services/dependency-scheduler-service.js +75 -0
- package/dist/apps/control-plane/application/services/dependency-scheduler-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/feature-deletion-service.d.ts +2 -0
- package/dist/apps/control-plane/application/services/feature-deletion-service.js +6 -7
- package/dist/apps/control-plane/application/services/feature-deletion-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/gate-interpolation-service.d.ts +7 -0
- package/dist/apps/control-plane/application/services/gate-interpolation-service.js +7 -0
- package/dist/apps/control-plane/application/services/gate-interpolation-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/gate-service.js +32 -2
- package/dist/apps/control-plane/application/services/gate-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/instance-isolation-service.d.ts +11 -0
- package/dist/apps/control-plane/application/services/instance-isolation-service.js +17 -0
- package/dist/apps/control-plane/application/services/instance-isolation-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/issue-tracker-service.d.ts +65 -0
- package/dist/apps/control-plane/application/services/issue-tracker-service.js +358 -0
- package/dist/apps/control-plane/application/services/issue-tracker-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/merge-service.d.ts +4 -0
- package/dist/apps/control-plane/application/services/merge-service.js +44 -2
- package/dist/apps/control-plane/application/services/merge-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/notifier-service.d.ts +74 -0
- package/dist/apps/control-plane/application/services/notifier-service.js +212 -0
- package/dist/apps/control-plane/application/services/notifier-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/performance-analytics-service.d.ts +39 -0
- package/dist/apps/control-plane/application/services/performance-analytics-service.js +75 -0
- package/dist/apps/control-plane/application/services/performance-analytics-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/plan-service.d.ts +1 -0
- package/dist/apps/control-plane/application/services/plan-service.js +53 -0
- package/dist/apps/control-plane/application/services/plan-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/pr-monitor-service.d.ts +44 -0
- package/dist/apps/control-plane/application/services/pr-monitor-service.js +192 -0
- package/dist/apps/control-plane/application/services/pr-monitor-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/reactions-service.d.ts +67 -0
- package/dist/apps/control-plane/application/services/reactions-service.js +114 -0
- package/dist/apps/control-plane/application/services/reactions-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/reporting-service.d.ts +1 -0
- package/dist/apps/control-plane/application/services/reporting-service.js +13 -2
- package/dist/apps/control-plane/application/services/reporting-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/run-lease-service.d.ts +2 -0
- package/dist/apps/control-plane/application/services/run-lease-service.js +14 -38
- package/dist/apps/control-plane/application/services/run-lease-service.js.map +1 -1
- package/dist/apps/control-plane/application/tools/tool-metadata.js +3 -1
- package/dist/apps/control-plane/application/tools/tool-metadata.js.map +1 -1
- package/dist/apps/control-plane/cli/aop.d.ts +1 -1
- package/dist/apps/control-plane/cli/aop.js +1 -1
- package/dist/apps/control-plane/cli/attach-command-handler.d.ts +12 -0
- package/dist/apps/control-plane/cli/attach-command-handler.js +98 -0
- package/dist/apps/control-plane/cli/attach-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/cleanup-command-handler.d.ts +12 -0
- package/dist/apps/control-plane/cli/cleanup-command-handler.js +162 -0
- package/dist/apps/control-plane/cli/cleanup-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.js +73 -3
- package/dist/apps/control-plane/cli/cli-argument-parser.js.map +1 -1
- package/dist/apps/control-plane/cli/dashboard-command-handler.d.ts +7 -0
- package/dist/apps/control-plane/cli/dashboard-command-handler.js +45 -0
- package/dist/apps/control-plane/cli/dashboard-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/help-command-handler.d.ts +8 -0
- package/dist/apps/control-plane/cli/help-command-handler.js +146 -0
- package/dist/apps/control-plane/cli/help-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/init-command-handler.d.ts +26 -0
- package/dist/apps/control-plane/cli/init-command-handler.js +517 -0
- package/dist/apps/control-plane/cli/init-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/resume-command-handler.js +1 -1
- package/dist/apps/control-plane/cli/resume-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/retry-command-handler.d.ts +8 -0
- package/dist/apps/control-plane/cli/retry-command-handler.js +111 -0
- package/dist/apps/control-plane/cli/retry-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/run-command-handler.d.ts +5 -0
- package/dist/apps/control-plane/cli/run-command-handler.js +82 -3
- package/dist/apps/control-plane/cli/run-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/send-command-handler.d.ts +8 -0
- package/dist/apps/control-plane/cli/send-command-handler.js +55 -0
- package/dist/apps/control-plane/cli/send-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/status-command-handler.d.ts +12 -1
- package/dist/apps/control-plane/cli/status-command-handler.js +55 -2
- package/dist/apps/control-plane/cli/status-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/types.d.ts +26 -1
- package/dist/apps/control-plane/cli/types.js +15 -1
- package/dist/apps/control-plane/cli/types.js.map +1 -1
- package/dist/apps/control-plane/core/constants.d.ts +6 -0
- package/dist/apps/control-plane/core/constants.js +8 -2
- package/dist/apps/control-plane/core/constants.js.map +1 -1
- package/dist/apps/control-plane/core/error-codes.d.ts +2 -0
- package/dist/apps/control-plane/core/error-codes.js +3 -1
- package/dist/apps/control-plane/core/error-codes.js.map +1 -1
- package/dist/apps/control-plane/core/gates.d.ts +4 -0
- package/dist/apps/control-plane/core/gates.js +140 -43
- package/dist/apps/control-plane/core/gates.js.map +1 -1
- package/dist/apps/control-plane/core/kernel.d.ts +50 -1
- package/dist/apps/control-plane/core/kernel.js +220 -7
- package/dist/apps/control-plane/core/kernel.js.map +1 -1
- package/dist/apps/control-plane/core/path-layout.d.ts +3 -0
- package/dist/apps/control-plane/core/path-layout.js +9 -0
- package/dist/apps/control-plane/core/path-layout.js.map +1 -1
- package/dist/apps/control-plane/core/tool-caller.d.ts +32 -0
- package/dist/apps/control-plane/core/tool-caller.js +2 -0
- package/dist/apps/control-plane/core/tool-caller.js.map +1 -0
- package/dist/apps/control-plane/core/workspace-hooks.d.ts +20 -0
- package/dist/apps/control-plane/core/workspace-hooks.js +69 -0
- package/dist/apps/control-plane/core/workspace-hooks.js.map +1 -0
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js +245 -9
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js.map +1 -1
- package/dist/apps/control-plane/providers/providers.d.ts +42 -3
- package/dist/apps/control-plane/providers/providers.js +216 -5
- package/dist/apps/control-plane/providers/providers.js.map +1 -1
- package/dist/apps/control-plane/supervisor/build-wave-executor.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/build-wave-executor.js +115 -6
- package/dist/apps/control-plane/supervisor/build-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/qa-wave-executor.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js +109 -5
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/run-coordinator.d.ts +15 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.js +132 -6
- package/dist/apps/control-plane/supervisor/run-coordinator.js.map +1 -1
- package/dist/apps/control-plane/supervisor/runtime.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/runtime.js +110 -6
- package/dist/apps/control-plane/supervisor/runtime.js.map +1 -1
- package/dist/apps/control-plane/supervisor/types.d.ts +9 -16
- package/dist/apps/control-plane/supervisor/types.js.map +1 -1
- package/dist/apps/control-plane/supervisor/worker-decision-loop.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js +5 -0
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js.map +1 -1
- package/eslint.config.mjs +2 -1
- package/package.json +12 -2
- package/packages/web-dashboard/next-env.d.ts +5 -0
- package/packages/web-dashboard/next.config.js +7 -0
- package/packages/web-dashboard/package.json +26 -0
- package/packages/web-dashboard/src/app/api/actions/route.ts +64 -0
- package/packages/web-dashboard/src/app/api/events/route.ts +51 -0
- package/packages/web-dashboard/src/app/api/features/[id]/checkout/route.ts +256 -0
- package/packages/web-dashboard/src/app/api/features/[id]/diff/route.ts +10 -0
- package/packages/web-dashboard/src/app/api/features/[id]/evidence/[artifact]/route.ts +25 -0
- package/packages/web-dashboard/src/app/api/features/[id]/review/route.ts +63 -0
- package/packages/web-dashboard/src/app/api/features/[id]/route.ts +16 -0
- package/packages/web-dashboard/src/app/api/projects/route.ts +31 -0
- package/packages/web-dashboard/src/app/api/status/route.ts +15 -0
- package/packages/web-dashboard/src/app/globals.css +2 -0
- package/packages/web-dashboard/src/app/layout.tsx +15 -0
- package/packages/web-dashboard/src/app/page.tsx +393 -0
- package/packages/web-dashboard/src/lib/aop-client.ts +244 -0
- package/packages/web-dashboard/src/lib/multi-project-config.ts +116 -0
- package/packages/web-dashboard/src/lib/orchestrator-tools.ts +284 -0
- package/packages/web-dashboard/src/lib/types.ts +58 -0
- package/packages/web-dashboard/tsconfig.json +40 -0
- package/packages/web-dashboard/vitest.config.ts +6 -0
- package/spec-files/completed/agentic_orchestrator_feature_gaps_closure_spec.md +1764 -0
- package/spec-files/outstanding/agentic_orchestrator_enterprise_governance_dashboard_spec.md +348 -0
- package/spec-files/outstanding/agentic_orchestrator_knowledge_canary_spec.md +344 -0
- package/spec-files/outstanding/agentic_orchestrator_observability_integrity_diagnostics_spec.md +374 -0
- package/spec-files/outstanding/agentic_orchestrator_performance_improvements_spec.md +1059 -0
- package/spec-files/outstanding/agentic_orchestrator_planning_review_quality_spec.md +466 -0
- package/spec-files/outstanding/agentic_orchestrator_quality_adoption_execution_spec.md +198 -0
- package/spec-files/outstanding/agentic_orchestrator_validator_hardening_spec.md +365 -0
- package/spec-files/progress.md +481 -52
- /package/spec-files/{agentic_orchestrator_cli_delete_command_spec.md → completed/agentic_orchestrator_cli_delete_command_spec.md} +0 -0
- /package/spec-files/{agentic_orchestrator_dot_aop_generated_artifacts_spec.md → completed/agentic_orchestrator_dot_aop_generated_artifacts_spec.md} +0 -0
- /package/spec-files/{agentic_orchestrator_mcp_formalization_spec.md → completed/agentic_orchestrator_mcp_formalization_spec.md} +0 -0
- /package/spec-files/{agentic_orchestrator_oop_refactor_spec.md → completed/agentic_orchestrator_oop_refactor_spec.md} +0 -0
- /package/spec-files/{agentic_orchestrator_single_global_orchestrator_spec.md → completed/agentic_orchestrator_single_global_orchestrator_spec.md} +0 -0
- /package/spec-files/{agentic_orchestrator_spec.md → completed/agentic_orchestrator_spec.md} +0 -0
|
@@ -394,6 +394,74 @@
|
|
|
394
394
|
"handler_id": "report.feature_summary",
|
|
395
395
|
"mutating": false,
|
|
396
396
|
"requires_operation_id": false
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"name": "feature.send_message",
|
|
400
|
+
"description": "Send a message to the active orchestrator session for a feature.",
|
|
401
|
+
"input_schema_ref": "schemas/input/feature.send_message.input.schema.json",
|
|
402
|
+
"output_schema_ref": "schemas/output/feature.send_message.output.schema.json",
|
|
403
|
+
"supported_roles": [
|
|
404
|
+
"orchestrator",
|
|
405
|
+
"system"
|
|
406
|
+
],
|
|
407
|
+
"handler_id": "feature.send_message",
|
|
408
|
+
"mutating": true,
|
|
409
|
+
"requires_operation_id": true
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"name": "cost.record",
|
|
413
|
+
"description": "Record token usage and estimated cost for a feature.",
|
|
414
|
+
"input_schema_ref": "schemas/input/cost.record.input.schema.json",
|
|
415
|
+
"output_schema_ref": "schemas/output/cost.record.output.schema.json",
|
|
416
|
+
"supported_roles": [
|
|
417
|
+
"orchestrator",
|
|
418
|
+
"system"
|
|
419
|
+
],
|
|
420
|
+
"handler_id": "cost.record",
|
|
421
|
+
"mutating": true,
|
|
422
|
+
"requires_operation_id": true
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"name": "cost.get",
|
|
426
|
+
"description": "Get current cost tracking data for a feature.",
|
|
427
|
+
"input_schema_ref": "schemas/input/cost.get.input.schema.json",
|
|
428
|
+
"output_schema_ref": "schemas/output/cost.get.output.schema.json",
|
|
429
|
+
"supported_roles": [
|
|
430
|
+
"orchestrator",
|
|
431
|
+
"system"
|
|
432
|
+
],
|
|
433
|
+
"handler_id": "cost.get",
|
|
434
|
+
"mutating": false,
|
|
435
|
+
"requires_operation_id": false
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"name": "performance.record_outcome",
|
|
439
|
+
"description": "Record per-feature outcome metrics for agent performance analytics.",
|
|
440
|
+
"input_schema_ref": "schemas/input/performance.record_outcome.input.schema.json",
|
|
441
|
+
"output_schema_ref": "schemas/output/performance.record_outcome.output.schema.json",
|
|
442
|
+
"supported_roles": [
|
|
443
|
+
"orchestrator",
|
|
444
|
+
"system"
|
|
445
|
+
],
|
|
446
|
+
"handler_id": "performance.record_outcome",
|
|
447
|
+
"mutating": true,
|
|
448
|
+
"requires_operation_id": true
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"name": "performance.get_analytics",
|
|
452
|
+
"description": "Get agent performance analytics with optional provider/model filters.",
|
|
453
|
+
"input_schema_ref": "schemas/input/performance.get_analytics.input.schema.json",
|
|
454
|
+
"output_schema_ref": "schemas/output/performance.get_analytics.output.schema.json",
|
|
455
|
+
"supported_roles": [
|
|
456
|
+
"orchestrator",
|
|
457
|
+
"planner",
|
|
458
|
+
"builder",
|
|
459
|
+
"qa",
|
|
460
|
+
"system"
|
|
461
|
+
],
|
|
462
|
+
"handler_id": "performance.get_analytics",
|
|
463
|
+
"mutating": false,
|
|
464
|
+
"requires_operation_id": false
|
|
397
465
|
}
|
|
398
466
|
]
|
|
399
467
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.local/agentic/tools/schemas/input/cost.get.input.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["feature_id"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"feature_id": { "type": "string", "minLength": 1 }
|
|
8
|
+
},
|
|
9
|
+
"additionalProperties": false
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.local/agentic/tools/schemas/input/cost.record.input.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["feature_id", "tokens_used", "estimated_cost_usd"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"feature_id": { "type": "string", "minLength": 1 },
|
|
8
|
+
"tokens_used": { "type": "integer", "minimum": 0 },
|
|
9
|
+
"estimated_cost_usd": { "type": "number", "minimum": 0 },
|
|
10
|
+
"operation_id": { "type": "string" }
|
|
11
|
+
},
|
|
12
|
+
"additionalProperties": false
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"required": ["feature_id", "message", "operation_id"],
|
|
5
|
+
"properties": {
|
|
6
|
+
"feature_id": { "type": "string" },
|
|
7
|
+
"message": { "type": "string", "minLength": 1 },
|
|
8
|
+
"operation_id": { "type": "string" }
|
|
9
|
+
},
|
|
10
|
+
"additionalProperties": false
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.local/agentic/tools/schemas/input/performance.get_analytics.input.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"provider": { "type": "string" },
|
|
7
|
+
"model": { "type": "string" }
|
|
8
|
+
},
|
|
9
|
+
"additionalProperties": false
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.local/agentic/tools/schemas/input/performance.record_outcome.input.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["feature_id", "provider", "model", "status", "gate_pass", "retry_count", "duration_ms", "cost_usd"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"feature_id": { "type": "string", "minLength": 1 },
|
|
8
|
+
"provider": { "type": "string", "minLength": 1 },
|
|
9
|
+
"model": { "type": "string", "minLength": 1 },
|
|
10
|
+
"status": { "type": "string", "minLength": 1 },
|
|
11
|
+
"gate_pass": { "type": "boolean" },
|
|
12
|
+
"retry_count": { "type": "integer", "minimum": 0 },
|
|
13
|
+
"duration_ms": { "type": "number", "minimum": 0 },
|
|
14
|
+
"cost_usd": { "type": "number", "minimum": 0 },
|
|
15
|
+
"operation_id": { "type": "string" }
|
|
16
|
+
},
|
|
17
|
+
"additionalProperties": false
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.local/agentic/tools/schemas/output/cost.get.output.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["feature_id", "tokens_used", "estimated_cost_usd"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"feature_id": { "type": "string", "minLength": 1 },
|
|
8
|
+
"tokens_used": { "type": "integer", "minimum": 0 },
|
|
9
|
+
"estimated_cost_usd": { "type": "number", "minimum": 0 },
|
|
10
|
+
"recorded_at": { "type": ["string", "null"] }
|
|
11
|
+
},
|
|
12
|
+
"additionalProperties": false
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.local/agentic/tools/schemas/output/cost.record.output.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["feature_id", "tokens_used", "estimated_cost_usd"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"feature_id": { "type": "string", "minLength": 1 },
|
|
8
|
+
"tokens_used": { "type": "integer", "minimum": 0 },
|
|
9
|
+
"estimated_cost_usd": { "type": "number", "minimum": 0 },
|
|
10
|
+
"recorded_at": { "type": "string" }
|
|
11
|
+
},
|
|
12
|
+
"additionalProperties": false
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"required": ["ok"],
|
|
5
|
+
"properties": {
|
|
6
|
+
"ok": { "type": "boolean" },
|
|
7
|
+
"data": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"feature_id": { "type": "string" },
|
|
11
|
+
"session_id": { "type": "string" },
|
|
12
|
+
"delivered": { "type": "boolean" }
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"error": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"code": { "type": "string" },
|
|
19
|
+
"message": { "type": "string" }
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/agentic/orchestrator/tools/schemas/output/performance.get_analytics.output.schema.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.local/agentic/tools/schemas/output/performance.get_analytics.output.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["outcomes", "aggregates", "generated_at"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"outcomes": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"required": ["feature_id", "provider", "model", "status", "gate_pass", "retry_count", "duration_ms", "cost_usd", "recorded_at"],
|
|
12
|
+
"properties": {
|
|
13
|
+
"feature_id": { "type": "string" },
|
|
14
|
+
"provider": { "type": "string" },
|
|
15
|
+
"model": { "type": "string" },
|
|
16
|
+
"status": { "type": "string" },
|
|
17
|
+
"gate_pass": { "type": "boolean" },
|
|
18
|
+
"retry_count": { "type": "integer" },
|
|
19
|
+
"duration_ms": { "type": "number" },
|
|
20
|
+
"cost_usd": { "type": "number" },
|
|
21
|
+
"recorded_at": { "type": "string" }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"aggregates": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"required": ["provider", "model", "total_features", "success_count", "success_rate", "avg_retry_count", "avg_duration_ms", "avg_cost_usd", "last_updated"],
|
|
30
|
+
"properties": {
|
|
31
|
+
"provider": { "type": "string" },
|
|
32
|
+
"model": { "type": "string" },
|
|
33
|
+
"total_features": { "type": "integer" },
|
|
34
|
+
"success_count": { "type": "integer" },
|
|
35
|
+
"success_rate": { "type": "number" },
|
|
36
|
+
"avg_retry_count": { "type": "number" },
|
|
37
|
+
"avg_duration_ms": { "type": "number" },
|
|
38
|
+
"avg_cost_usd": { "type": "number" },
|
|
39
|
+
"last_updated": { "type": "string" }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"generated_at": { "type": "string" }
|
|
44
|
+
},
|
|
45
|
+
"additionalProperties": false
|
|
46
|
+
}
|
package/agentic/orchestrator/tools/schemas/output/performance.record_outcome.output.schema.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.local/agentic/tools/schemas/output/performance.record_outcome.output.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["total_outcomes"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"total_outcomes": { "type": "integer", "minimum": 0 }
|
|
8
|
+
},
|
|
9
|
+
"additionalProperties": false
|
|
10
|
+
}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
Generated from `agentic/orchestrator/tools/catalog.json`.
|
|
4
4
|
|
|
5
5
|
- collisions.scan
|
|
6
|
+
- cost.get
|
|
7
|
+
- cost.record
|
|
6
8
|
- evidence.latest
|
|
7
9
|
- feature.delete
|
|
8
10
|
- feature.discover_specs
|
|
@@ -10,12 +12,15 @@ Generated from `agentic/orchestrator/tools/catalog.json`.
|
|
|
10
12
|
- feature.init
|
|
11
13
|
- feature.log_append
|
|
12
14
|
- feature.ready_to_merge
|
|
15
|
+
- feature.send_message
|
|
13
16
|
- feature.state_get
|
|
14
17
|
- feature.state_patch
|
|
15
18
|
- gates.list
|
|
16
19
|
- gates.run
|
|
17
20
|
- locks.acquire
|
|
18
21
|
- locks.release
|
|
22
|
+
- performance.get_analytics
|
|
23
|
+
- performance.record_outcome
|
|
19
24
|
- plan.get
|
|
20
25
|
- plan.submit
|
|
21
26
|
- plan.update
|
|
@@ -4,6 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
const ARCHITECTURE_RULES = {
|
|
5
5
|
'application-services': ['cli', 'interfaces', 'mcp', 'providers', 'supervisor'],
|
|
6
6
|
'application-tools': ['cli', 'interfaces', 'mcp', 'providers', 'supervisor'],
|
|
7
|
+
application: ['cli', 'interfaces', 'supervisor'],
|
|
7
8
|
cli: [],
|
|
8
9
|
core: ['cli', 'interfaces', 'supervisor'],
|
|
9
10
|
interfaces: [],
|
|
@@ -12,6 +13,8 @@ const ARCHITECTURE_RULES = {
|
|
|
12
13
|
supervisor: ['cli', 'interfaces']
|
|
13
14
|
};
|
|
14
15
|
|
|
16
|
+
const EXEMPT_FILES = new Set(['index.ts']);
|
|
17
|
+
|
|
15
18
|
const IMPORT_PATTERN = /(?:import|export)\s+[^'"]*?from\s+['"]([^'"]+)['"]/g;
|
|
16
19
|
const SRC_ROOT = path.resolve(process.cwd(), 'apps/control-plane/src');
|
|
17
20
|
|
|
@@ -39,6 +42,9 @@ function classifyLayer(filePath) {
|
|
|
39
42
|
if (relativePath.startsWith('application/tools/')) {
|
|
40
43
|
return 'application-tools';
|
|
41
44
|
}
|
|
45
|
+
if (relativePath.startsWith('application/')) {
|
|
46
|
+
return 'application';
|
|
47
|
+
}
|
|
42
48
|
if (relativePath.startsWith('cli/')) {
|
|
43
49
|
return 'cli';
|
|
44
50
|
}
|
|
@@ -106,10 +112,16 @@ function extractImports(content) {
|
|
|
106
112
|
async function collectViolations() {
|
|
107
113
|
const files = await collectFiles(SRC_ROOT);
|
|
108
114
|
const violations = [];
|
|
115
|
+
const errors = [];
|
|
109
116
|
|
|
110
117
|
for (const file of files) {
|
|
118
|
+
const relativePath = path.relative(SRC_ROOT, file).replaceAll('\\', '/');
|
|
119
|
+
if (EXEMPT_FILES.has(path.basename(file))) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
111
122
|
const sourceLayer = classifyLayer(file);
|
|
112
123
|
if (sourceLayer === 'unknown') {
|
|
124
|
+
errors.push(`Unclassified source file "${relativePath}" — add it to the layer map in validate-architecture-rules.mjs`);
|
|
113
125
|
continue;
|
|
114
126
|
}
|
|
115
127
|
const forbiddenTargets = ARCHITECTURE_RULES[sourceLayer];
|
|
@@ -142,7 +154,7 @@ async function collectViolations() {
|
|
|
142
154
|
}
|
|
143
155
|
}
|
|
144
156
|
|
|
145
|
-
return { filesChecked: files.length, violations };
|
|
157
|
+
return { filesChecked: files.length, violations, errors };
|
|
146
158
|
}
|
|
147
159
|
|
|
148
160
|
function printViolation(violation) {
|
|
@@ -153,7 +165,17 @@ function printViolation(violation) {
|
|
|
153
165
|
}
|
|
154
166
|
|
|
155
167
|
async function main() {
|
|
156
|
-
const { filesChecked, violations } = await collectViolations();
|
|
168
|
+
const { filesChecked, violations, errors } = await collectViolations();
|
|
169
|
+
let failed = false;
|
|
170
|
+
|
|
171
|
+
if (errors.length > 0) {
|
|
172
|
+
process.stderr.write('architecture_unclassified_files_detected\n');
|
|
173
|
+
for (const error of errors) {
|
|
174
|
+
process.stderr.write(`- ${error}\n`);
|
|
175
|
+
}
|
|
176
|
+
failed = true;
|
|
177
|
+
}
|
|
178
|
+
|
|
157
179
|
if (violations.length > 0) {
|
|
158
180
|
process.stderr.write('architecture_rule_violations_detected\n');
|
|
159
181
|
for (const violation of violations) {
|
|
@@ -161,6 +183,10 @@ async function main() {
|
|
|
161
183
|
}
|
|
162
184
|
process.stderr.write(`files_checked=${filesChecked}\n`);
|
|
163
185
|
process.stderr.write(`violation_count=${violations.length}\n`);
|
|
186
|
+
failed = true;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (failed) {
|
|
164
190
|
process.exit(1);
|
|
165
191
|
}
|
|
166
192
|
|
|
@@ -33,6 +33,17 @@ const compose = readText(composePath);
|
|
|
33
33
|
const entrypoint = readText(entrypointPath);
|
|
34
34
|
|
|
35
35
|
assertContains(dockerfile, /^FROM\s+node:/m, 'docker image must be Node-based');
|
|
36
|
+
|
|
37
|
+
const MIN_NODE_MAJOR = 22;
|
|
38
|
+
const fromMatch = dockerfile.match(/^FROM\s+node:(\d+)/m);
|
|
39
|
+
if (!fromMatch) {
|
|
40
|
+
fail('Dockerfile must use a pinned Node version (e.g. node:22-bookworm-slim)');
|
|
41
|
+
}
|
|
42
|
+
const nodeMajor = parseInt(fromMatch[1], 10);
|
|
43
|
+
if (nodeMajor < MIN_NODE_MAJOR) {
|
|
44
|
+
fail(`Dockerfile Node version ${nodeMajor} is below minimum required ${MIN_NODE_MAJOR}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
assertContains(dockerfile, /apt-get install[^]*\bgit\b/m, 'docker image must include git toolchain');
|
|
37
48
|
assertContains(dockerfile, /ENV\s+AOP_REPO_ROOT=\/repo/m, 'docker image must declare /repo root');
|
|
38
49
|
assertContains(
|
|
@@ -47,6 +58,7 @@ assertContains(compose, /working_dir:\s*\/repo/m, 'compose service must execute
|
|
|
47
58
|
|
|
48
59
|
assertContains(entrypoint, /if \[ ! -d "\/repo" ]/m, 'entrypoint must enforce /repo mount check');
|
|
49
60
|
assertContains(entrypoint, /for tool in node npm npx git;/m, 'entrypoint must verify required toolchains');
|
|
61
|
+
assertContains(entrypoint, /\bexec\s+"\$@"/, 'entrypoint must contain exec "$@" passthrough');
|
|
50
62
|
|
|
51
63
|
if (!runSmoke) {
|
|
52
64
|
console.log('validate:docker-mcp: contract checks passed');
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
|
+
import fsSync from 'node:fs';
|
|
2
3
|
import path from 'node:path';
|
|
4
|
+
import Ajv from 'ajv';
|
|
5
|
+
import Ajv2020 from 'ajv/dist/2020.js';
|
|
3
6
|
import { MCP_PROTOCOL_PIN, REQUIRED_MCP_TRANSPORTS } from '../src/mcp/protocol-contract.js';
|
|
4
7
|
import { ToolsMarkdownGenerator } from '../src/mcp/tools-markdown-generator.js';
|
|
5
8
|
import { ToolRegistryLoader } from '../src/mcp/tool-registry-loader.js';
|
|
9
|
+
import { TOOL_BEHAVIOR_METADATA } from '../src/index.js';
|
|
10
|
+
|
|
11
|
+
const KNOWN_ROLES = new Set(['orchestrator', 'planner', 'builder', 'qa', 'system']);
|
|
12
|
+
|
|
13
|
+
const KNOWN_SHARED_SCHEMAS = new Set([
|
|
14
|
+
'schemas/input/mutating.schema.json',
|
|
15
|
+
'schemas/input/read.schema.json',
|
|
16
|
+
'schemas/output/standard_success.schema.json'
|
|
17
|
+
]);
|
|
6
18
|
|
|
7
19
|
function fail(message: string): never {
|
|
8
20
|
throw new Error(message);
|
|
@@ -12,6 +24,14 @@ function normalizeMarkdown(content: string): string {
|
|
|
12
24
|
return `${content.replace(/\r\n/g, '\n').trimEnd()}\n`;
|
|
13
25
|
}
|
|
14
26
|
|
|
27
|
+
function globSchemaFiles(dir: string, prefix: string): string[] {
|
|
28
|
+
try {
|
|
29
|
+
return fsSync.readdirSync(dir).map((f) => `${prefix}/${f}`);
|
|
30
|
+
} catch {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
15
35
|
async function main(): Promise<void> {
|
|
16
36
|
const repoRoot = process.cwd();
|
|
17
37
|
const loader = new ToolRegistryLoader(repoRoot);
|
|
@@ -49,6 +69,78 @@ async function main(): Promise<void> {
|
|
|
49
69
|
fail('tools_markdown_drift_detected');
|
|
50
70
|
}
|
|
51
71
|
|
|
72
|
+
const toolsDir = path.join(repoRoot, 'agentic', 'orchestrator', 'tools');
|
|
73
|
+
const ajv7 = new Ajv({ strict: false });
|
|
74
|
+
const ajv2020 = new Ajv2020({ strict: false });
|
|
75
|
+
function compileSchema(schema: Record<string, unknown>): void {
|
|
76
|
+
const schemaVersion = schema['$schema'] as string | undefined;
|
|
77
|
+
if (schemaVersion?.includes('2020-12') === true) {
|
|
78
|
+
ajv2020.compile(schema);
|
|
79
|
+
} else {
|
|
80
|
+
ajv7.compile(schema);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const errors: string[] = [];
|
|
84
|
+
const warnings: string[] = [];
|
|
85
|
+
const referencedSchemas = new Set<string>();
|
|
86
|
+
|
|
87
|
+
for (const tool of registry.catalog.tools) {
|
|
88
|
+
// V1.1: mutating cross-check
|
|
89
|
+
const mutatingInCatalog = tool.mutating === true;
|
|
90
|
+
const mutatingInCode = TOOL_BEHAVIOR_METADATA[tool.handler_id]?.mutating === true;
|
|
91
|
+
if (mutatingInCatalog !== mutatingInCode) {
|
|
92
|
+
errors.push(
|
|
93
|
+
`Tool "${tool.handler_id}" mutating flag mismatch: catalog=${String(mutatingInCatalog)}, code=${String(mutatingInCode)}`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// V1.4: supported_roles validation
|
|
98
|
+
for (const role of tool.supported_roles ?? []) {
|
|
99
|
+
if (!KNOWN_ROLES.has(role)) {
|
|
100
|
+
errors.push(`Tool "${tool.name}" has unknown role "${role}" in supported_roles`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// V1.2: AJV schema compilation + V1.3: orphan tracking
|
|
105
|
+
for (const schemaRef of [tool.input_schema_ref, tool.output_schema_ref]) {
|
|
106
|
+
if (!schemaRef) { continue; }
|
|
107
|
+
referencedSchemas.add(schemaRef);
|
|
108
|
+
const schemaPath = path.resolve(toolsDir, schemaRef);
|
|
109
|
+
try {
|
|
110
|
+
const schema = JSON.parse(await fs.readFile(schemaPath, 'utf8'));
|
|
111
|
+
try {
|
|
112
|
+
compileSchema(schema as Record<string, unknown>);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
errors.push(`Schema "${schemaRef}" failed AJV compilation: ${(e as Error).message}`);
|
|
115
|
+
}
|
|
116
|
+
} catch {
|
|
117
|
+
errors.push(`Schema file not found: ${schemaRef}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// V1.3: orphan schema detection
|
|
123
|
+
const allSchemaFiles = [
|
|
124
|
+
...globSchemaFiles(path.join(toolsDir, 'schemas', 'input'), 'schemas/input'),
|
|
125
|
+
...globSchemaFiles(path.join(toolsDir, 'schemas', 'output'), 'schemas/output')
|
|
126
|
+
];
|
|
127
|
+
for (const file of allSchemaFiles) {
|
|
128
|
+
if (!referencedSchemas.has(file) && !KNOWN_SHARED_SCHEMAS.has(file)) {
|
|
129
|
+
warnings.push(`Orphan schema file not referenced by any catalog tool: ${file}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (errors.length > 0) {
|
|
134
|
+
for (const error of errors) {
|
|
135
|
+
process.stderr.write(`[validate:mcp-contracts] error: ${error}\n`);
|
|
136
|
+
}
|
|
137
|
+
fail(`${errors.length} contract error(s) detected`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
for (const warning of warnings) {
|
|
141
|
+
process.stdout.write(`[validate:mcp-contracts] warning: ${warning}\n`);
|
|
142
|
+
}
|
|
143
|
+
|
|
52
144
|
process.stdout.write(
|
|
53
145
|
`[validate:mcp-contracts] ok: tools=${registry.catalog.tools.length} protocol=${protocol.mcp_protocol_version} sdk=${protocol.sdk.package}@${protocol.sdk.version}\n`
|
|
54
146
|
);
|