@revisium/orchestrator 0.0.0 → 0.1.0-alpha.10
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/README.md +202 -1
- package/control-plane/bootstrap.config.json +104 -2
- package/control-plane/default-playbook/catalog/pipelines.json +657 -0
- package/control-plane/default-playbook/catalog/roles.json +65 -0
- package/control-plane/default-playbook/package.json +5 -0
- package/control-plane/default-playbook/playbook.json +13 -0
- package/control-plane/default-playbook/prompts/analyst.md +29 -0
- package/control-plane/default-playbook/prompts/developer.md +26 -0
- package/control-plane/default-playbook/prompts/integrator.md +20 -0
- package/control-plane/default-playbook/prompts/orchestrator.md +23 -0
- package/control-plane/default-playbook/prompts/reviewer.md +28 -0
- package/control-plane/default-playbook/prompts/triager.md +51 -0
- package/control-plane/default-playbook/prompts/watcher.md +24 -0
- package/dist/api/graphql-api/filters/agent-observability-exception.filter.js +24 -0
- package/dist/api/graphql-api/filters/agent-observability-exception.filter.js.map +1 -0
- package/dist/api/graphql-api/filters/graphql-validation-exception.filter.js +36 -0
- package/dist/api/graphql-api/filters/graphql-validation-exception.filter.js.map +1 -0
- package/dist/api/graphql-api/graphql-api.module.js +77 -0
- package/dist/api/graphql-api/graphql-api.module.js.map +1 -0
- package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-bridge.service.js +296 -0
- package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-bridge.service.js.map +1 -0
- package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-mappers.js +64 -0
- package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-mappers.js.map +1 -0
- package/dist/api/graphql-api/graphql-ws/constants.js +11 -0
- package/dist/api/graphql-api/graphql-ws/constants.js.map +1 -0
- package/dist/api/graphql-api/graphql-ws/pubsub.module.js +32 -0
- package/dist/api/graphql-api/graphql-ws/pubsub.module.js.map +1 -0
- package/dist/api/graphql-api/graphql-ws/run-progress-subscription-poller.service.js +101 -0
- package/dist/api/graphql-api/graphql-ws/run-progress-subscription-poller.service.js.map +1 -0
- package/dist/api/graphql-api/graphql-ws/subscription-bridge.service.js +115 -0
- package/dist/api/graphql-api/graphql-ws/subscription-bridge.service.js.map +1 -0
- package/dist/api/graphql-api/graphql-ws/subscription-mappers.js +85 -0
- package/dist/api/graphql-api/graphql-ws/subscription-mappers.js.map +1 -0
- package/dist/api/graphql-api/graphql-ws/ws.js +22 -0
- package/dist/api/graphql-api/graphql-ws/ws.js.map +1 -0
- package/dist/api/graphql-api/inbox/inbox-subscription.resolver.js +56 -0
- package/dist/api/graphql-api/inbox/inbox-subscription.resolver.js.map +1 -0
- package/dist/api/graphql-api/inbox/inbox.resolver.js +125 -0
- package/dist/api/graphql-api/inbox/inbox.resolver.js.map +1 -0
- package/dist/api/graphql-api/inbox/inputs/answer-question.input.js +33 -0
- package/dist/api/graphql-api/inbox/inputs/answer-question.input.js.map +1 -0
- package/dist/api/graphql-api/inbox/inputs/gate-decision.input.js +27 -0
- package/dist/api/graphql-api/inbox/inputs/gate-decision.input.js.map +1 -0
- package/dist/api/graphql-api/inbox/inputs/list-inbox.input.js +28 -0
- package/dist/api/graphql-api/inbox/inputs/list-inbox.input.js.map +1 -0
- package/dist/api/graphql-api/inbox/inputs/resolve-inbox-item.input.js +38 -0
- package/dist/api/graphql-api/inbox/inputs/resolve-inbox-item.input.js.map +1 -0
- package/dist/api/graphql-api/inbox/model/gate-risk.model.js +53 -0
- package/dist/api/graphql-api/inbox/model/gate-risk.model.js.map +1 -0
- package/dist/api/graphql-api/inbox/model/inbox-connection.model.js +16 -0
- package/dist/api/graphql-api/inbox/model/inbox-connection.model.js.map +1 -0
- package/dist/api/graphql-api/inbox/model/inbox-item.model.js +88 -0
- package/dist/api/graphql-api/inbox/model/inbox-item.model.js.map +1 -0
- package/dist/api/graphql-api/inbox/model/inbox-resolution.model.js +48 -0
- package/dist/api/graphql-api/inbox/model/inbox-resolution.model.js.map +1 -0
- package/dist/api/graphql-api/method/inputs/list-method.input.js +15 -0
- package/dist/api/graphql-api/method/inputs/list-method.input.js.map +1 -0
- package/dist/api/graphql-api/method/method.resolver.js +90 -0
- package/dist/api/graphql-api/method/method.resolver.js.map +1 -0
- package/dist/api/graphql-api/method/model/alternative-role-group.model.js +32 -0
- package/dist/api/graphql-api/method/model/alternative-role-group.model.js.map +1 -0
- package/dist/api/graphql-api/method/model/pipeline-connection.model.js +16 -0
- package/dist/api/graphql-api/method/model/pipeline-connection.model.js.map +1 -0
- package/dist/api/graphql-api/method/model/pipeline.model.js +69 -0
- package/dist/api/graphql-api/method/model/pipeline.model.js.map +1 -0
- package/dist/api/graphql-api/method/model/playbook-connection.model.js +16 -0
- package/dist/api/graphql-api/method/model/playbook-connection.model.js.map +1 -0
- package/dist/api/graphql-api/method/model/playbook.model.js +47 -0
- package/dist/api/graphql-api/method/model/playbook.model.js.map +1 -0
- package/dist/api/graphql-api/method/model/role-connection.model.js +16 -0
- package/dist/api/graphql-api/method/model/role-connection.model.js.map +1 -0
- package/dist/api/graphql-api/method/model/role.model.js +98 -0
- package/dist/api/graphql-api/method/model/role.model.js.map +1 -0
- package/dist/api/graphql-api/pr/inputs/pr-readiness.input.js +52 -0
- package/dist/api/graphql-api/pr/inputs/pr-readiness.input.js.map +1 -0
- package/dist/api/graphql-api/pr/model/pr-readiness.model.js +403 -0
- package/dist/api/graphql-api/pr/model/pr-readiness.model.js.map +1 -0
- package/dist/api/graphql-api/pr/pr.resolver.js +76 -0
- package/dist/api/graphql-api/pr/pr.resolver.js.map +1 -0
- package/dist/api/graphql-api/registerGraphqlEnums.js +9 -0
- package/dist/api/graphql-api/registerGraphqlEnums.js.map +1 -0
- package/dist/api/graphql-api/runs/inputs/create-run.input.js +63 -0
- package/dist/api/graphql-api/runs/inputs/create-run.input.js.map +1 -0
- package/dist/api/graphql-api/runs/inputs/get-agent-log.input.js +48 -0
- package/dist/api/graphql-api/runs/inputs/get-agent-log.input.js.map +1 -0
- package/dist/api/graphql-api/runs/inputs/get-run-attempts.input.js +32 -0
- package/dist/api/graphql-api/runs/inputs/get-run-attempts.input.js.map +1 -0
- package/dist/api/graphql-api/runs/inputs/get-run-events.input.js +28 -0
- package/dist/api/graphql-api/runs/inputs/get-run-events.input.js.map +1 -0
- package/dist/api/graphql-api/runs/inputs/list-runs.input.js +23 -0
- package/dist/api/graphql-api/runs/inputs/list-runs.input.js.map +1 -0
- package/dist/api/graphql-api/runs/inputs/simulate-route.input.js +43 -0
- package/dist/api/graphql-api/runs/inputs/simulate-route.input.js.map +1 -0
- package/dist/api/graphql-api/runs/model/agent-activity.model.js +367 -0
- package/dist/api/graphql-api/runs/model/agent-activity.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/create-run-result.model.js +53 -0
- package/dist/api/graphql-api/runs/model/create-run-result.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/run-attempt.model.js +114 -0
- package/dist/api/graphql-api/runs/model/run-attempt.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/run-connection.model.js +16 -0
- package/dist/api/graphql-api/runs/model/run-connection.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/run-cost.model.js +67 -0
- package/dist/api/graphql-api/runs/model/run-cost.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/run-digest.model.js +41 -0
- package/dist/api/graphql-api/runs/model/run-digest.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/run-event-connection.model.js +16 -0
- package/dist/api/graphql-api/runs/model/run-event-connection.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/run-event.model.js +58 -0
- package/dist/api/graphql-api/runs/model/run-event.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/run-progress.model.js +33 -0
- package/dist/api/graphql-api/runs/model/run-progress.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/run-workflow.model.js +287 -0
- package/dist/api/graphql-api/runs/model/run-workflow.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/run.model.js +57 -0
- package/dist/api/graphql-api/runs/model/run.model.js.map +1 -0
- package/dist/api/graphql-api/runs/model/usage.model.js +32 -0
- package/dist/api/graphql-api/runs/model/usage.model.js.map +1 -0
- package/dist/api/graphql-api/runs/run-digest.resolver.js +40 -0
- package/dist/api/graphql-api/runs/run-digest.resolver.js.map +1 -0
- package/dist/api/graphql-api/runs/run-events.resolver.js +45 -0
- package/dist/api/graphql-api/runs/run-events.resolver.js.map +1 -0
- package/dist/api/graphql-api/runs/run-progress.resolver.js +53 -0
- package/dist/api/graphql-api/runs/run-progress.resolver.js.map +1 -0
- package/dist/api/graphql-api/runs/runs-subscription.resolver.js +124 -0
- package/dist/api/graphql-api/runs/runs-subscription.resolver.js.map +1 -0
- package/dist/api/graphql-api/runs/runs.resolver.js +165 -0
- package/dist/api/graphql-api/runs/runs.resolver.js.map +1 -0
- package/dist/api/graphql-api/share/graphql-param-types.js +6 -0
- package/dist/api/graphql-api/share/graphql-param-types.js.map +1 -0
- package/dist/api/graphql-api/share/inputs/connection.input.js +27 -0
- package/dist/api/graphql-api/share/inputs/connection.input.js.map +1 -0
- package/dist/api/graphql-api/share/inputs/run-subscription.input.js +22 -0
- package/dist/api/graphql-api/share/inputs/run-subscription.input.js.map +1 -0
- package/dist/api/graphql-api/share/model/paginated.model.js +75 -0
- package/dist/api/graphql-api/share/model/paginated.model.js.map +1 -0
- package/dist/api/graphql-api/system/model/daemon-status.model.js +47 -0
- package/dist/api/graphql-api/system/model/daemon-status.model.js.map +1 -0
- package/dist/api/graphql-api/system/model/doctor-result.model.js +33 -0
- package/dist/api/graphql-api/system/model/doctor-result.model.js.map +1 -0
- package/dist/api/graphql-api/system/model/project.model.js +37 -0
- package/dist/api/graphql-api/system/model/project.model.js.map +1 -0
- package/dist/api/graphql-api/system/model/repository-context.model.js +70 -0
- package/dist/api/graphql-api/system/model/repository-context.model.js.map +1 -0
- package/dist/api/graphql-api/system/model/repository-validation.model.js +62 -0
- package/dist/api/graphql-api/system/model/repository-validation.model.js.map +1 -0
- package/dist/api/graphql-api/system/model/system-status.model.js +29 -0
- package/dist/api/graphql-api/system/model/system-status.model.js.map +1 -0
- package/dist/api/graphql-api/system/system.resolver.js +83 -0
- package/dist/api/graphql-api/system/system.resolver.js.map +1 -0
- package/dist/cli/commands/doctor-report.js +70 -0
- package/dist/cli/commands/doctor-report.js.map +1 -0
- package/dist/cli/commands/lifecycle.js +463 -0
- package/dist/cli/commands/lifecycle.js.map +1 -0
- package/dist/cli/commands/mcp.js +53 -8
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/process-tree.js +87 -0
- package/dist/cli/commands/process-tree.js.map +1 -0
- package/dist/cli/commands/revisium-helpers.js +2 -2
- package/dist/cli/commands/rogue-reaper.js +63 -0
- package/dist/cli/commands/rogue-reaper.js.map +1 -0
- package/dist/cli/index.js +5 -29
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/program.js +7 -23
- package/dist/cli/program.js.map +1 -1
- package/dist/config.js +79 -1
- package/dist/config.js.map +1 -1
- package/dist/control-plane/bootstrap.js +101 -0
- package/dist/control-plane/bootstrap.js.map +1 -0
- package/dist/control-plane/change-notifications.js +35 -0
- package/dist/control-plane/change-notifications.js.map +1 -0
- package/dist/control-plane/client-transport.js +74 -41
- package/dist/control-plane/client-transport.js.map +1 -1
- package/dist/control-plane/data-access.js +13 -5
- package/dist/control-plane/data-access.js.map +1 -1
- package/dist/control-plane/definitions.js +1 -1
- package/dist/control-plane/definitions.js.map +1 -1
- package/dist/control-plane/inbox.js +5 -31
- package/dist/control-plane/inbox.js.map +1 -1
- package/dist/control-plane/index.js +1 -1
- package/dist/control-plane/index.js.map +1 -1
- package/dist/control-plane/json-fields.js +2 -0
- package/dist/control-plane/json-fields.js.map +1 -1
- package/dist/control-plane/resolve-cwd.js +76 -8
- package/dist/control-plane/resolve-cwd.js.map +1 -1
- package/dist/control-plane/schema-migration.js +82 -0
- package/dist/control-plane/schema-migration.js.map +1 -0
- package/dist/control-plane/seed-default-playbook.js +141 -0
- package/dist/control-plane/seed-default-playbook.js.map +1 -0
- package/dist/control-plane/steps.js +15 -349
- package/dist/control-plane/steps.js.map +1 -1
- package/dist/control-plane/tables.js +1 -0
- package/dist/control-plane/tables.js.map +1 -1
- package/dist/e2e/kit/agents.js +148 -0
- package/dist/e2e/kit/agents.js.map +1 -0
- package/dist/e2e/kit/assertions.js +163 -0
- package/dist/e2e/kit/assertions.js.map +1 -0
- package/dist/e2e/kit/crash.js +44 -0
- package/dist/e2e/kit/crash.js.map +1 -0
- package/dist/e2e/kit/drive.js +45 -0
- package/dist/e2e/kit/drive.js.map +1 -0
- package/dist/e2e/kit/env.js +16 -0
- package/dist/e2e/kit/env.js.map +1 -0
- package/dist/e2e/kit/fake-integrator.js +57 -0
- package/dist/e2e/kit/fake-integrator.js.map +1 -0
- package/dist/e2e/kit/gh-emulator.js +213 -0
- package/dist/e2e/kit/gh-emulator.js.map +1 -0
- package/dist/e2e/kit/git-target-repo.js +115 -0
- package/dist/e2e/kit/git-target-repo.js.map +1 -0
- package/dist/e2e/kit/harness.js +72 -0
- package/dist/e2e/kit/harness.js.map +1 -0
- package/dist/e2e/kit/index.js +14 -0
- package/dist/e2e/kit/index.js.map +1 -0
- package/dist/e2e/kit/mcp.js +32 -0
- package/dist/e2e/kit/mcp.js.map +1 -0
- package/dist/e2e/kit/scenarios.js +196 -0
- package/dist/e2e/kit/scenarios.js.map +1 -0
- package/dist/e2e/recovery-crash-child.js +29 -0
- package/dist/e2e/recovery-crash-child.js.map +1 -0
- package/dist/e2e/recovery-dd-crash-child.js +43 -0
- package/dist/e2e/recovery-dd-crash-child.js.map +1 -0
- package/dist/engine/dbos.module.js +2 -1
- package/dist/engine/dbos.module.js.map +1 -1
- package/dist/engine/dbos.service.js +89 -18
- package/dist/engine/dbos.service.js.map +1 -1
- package/dist/engine/ensure-postgres.js +18 -4
- package/dist/engine/ensure-postgres.js.map +1 -1
- package/dist/features/inbox/commands/handlers/inbox-command.handlers.js +80 -0
- package/dist/features/inbox/commands/handlers/inbox-command.handlers.js.map +1 -0
- package/dist/features/inbox/commands/impl/answer-question.command.js +7 -0
- package/dist/features/inbox/commands/impl/answer-question.command.js.map +1 -0
- package/dist/features/inbox/commands/impl/approve-gate.command.js +7 -0
- package/dist/features/inbox/commands/impl/approve-gate.command.js.map +1 -0
- package/dist/features/inbox/commands/impl/reject-gate.command.js +7 -0
- package/dist/features/inbox/commands/impl/reject-gate.command.js.map +1 -0
- package/dist/features/inbox/commands/impl/resolve-inbox-item.command.js +7 -0
- package/dist/features/inbox/commands/impl/resolve-inbox-item.command.js.map +1 -0
- package/dist/features/inbox/commands/index.js +8 -0
- package/dist/features/inbox/commands/index.js.map +1 -0
- package/dist/features/inbox/inbox-api.module.js +23 -0
- package/dist/features/inbox/inbox-api.module.js.map +1 -0
- package/dist/features/inbox/inbox-api.service.js +63 -0
- package/dist/features/inbox/inbox-api.service.js.map +1 -0
- package/dist/features/inbox/queries/handlers/inbox-query.handlers.js +111 -0
- package/dist/features/inbox/queries/handlers/inbox-query.handlers.js.map +1 -0
- package/dist/features/inbox/queries/impl/get-inbox-item.query.js +7 -0
- package/dist/features/inbox/queries/impl/get-inbox-item.query.js.map +1 -0
- package/dist/features/inbox/queries/impl/get-pending-decisions.query.js +7 -0
- package/dist/features/inbox/queries/impl/get-pending-decisions.query.js.map +1 -0
- package/dist/features/inbox/queries/impl/list-inbox.query.js +7 -0
- package/dist/features/inbox/queries/impl/list-inbox.query.js.map +1 -0
- package/dist/features/inbox/queries/impl/summarize-gate-risk.query.js +7 -0
- package/dist/features/inbox/queries/impl/summarize-gate-risk.query.js.map +1 -0
- package/dist/features/inbox/queries/index.js +8 -0
- package/dist/features/inbox/queries/index.js.map +1 -0
- package/dist/features/method/commands/index.js +2 -0
- package/dist/features/method/commands/index.js.map +1 -0
- package/dist/features/method/method-api.module.js +23 -0
- package/dist/features/method/method-api.module.js.map +1 -0
- package/dist/features/method/method-api.service.js +47 -0
- package/dist/features/method/method-api.service.js.map +1 -0
- package/dist/features/method/queries/handlers/method-query.handlers.js +115 -0
- package/dist/features/method/queries/handlers/method-query.handlers.js.map +1 -0
- package/dist/features/method/queries/impl/get-pipeline.query.js +7 -0
- package/dist/features/method/queries/impl/get-pipeline.query.js.map +1 -0
- package/dist/features/method/queries/impl/get-role.query.js +7 -0
- package/dist/features/method/queries/impl/get-role.query.js.map +1 -0
- package/dist/features/method/queries/impl/list-pipelines.query.js +7 -0
- package/dist/features/method/queries/impl/list-pipelines.query.js.map +1 -0
- package/dist/features/method/queries/impl/list-playbooks.query.js +7 -0
- package/dist/features/method/queries/impl/list-playbooks.query.js.map +1 -0
- package/dist/features/method/queries/impl/list-roles.query.js +7 -0
- package/dist/features/method/queries/impl/list-roles.query.js.map +1 -0
- package/dist/features/method/queries/index.js +9 -0
- package/dist/features/method/queries/index.js.map +1 -0
- package/dist/features/pr/commands/index.js +2 -0
- package/dist/features/pr/commands/index.js.map +1 -0
- package/dist/features/pr/pr-api.module.js +23 -0
- package/dist/features/pr/pr-api.module.js.map +1 -0
- package/dist/features/pr/pr-api.service.js +35 -0
- package/dist/features/pr/pr-api.service.js.map +1 -0
- package/dist/features/pr/queries/handlers/pr-query.handlers.js +48 -0
- package/dist/features/pr/queries/handlers/pr-query.handlers.js.map +1 -0
- package/dist/features/pr/queries/impl/get-pr-readiness.query.js +7 -0
- package/dist/features/pr/queries/impl/get-pr-readiness.query.js.map +1 -0
- package/dist/features/pr/queries/impl/list-pr-feedback.query.js +7 -0
- package/dist/features/pr/queries/impl/list-pr-feedback.query.js.map +1 -0
- package/dist/features/pr/queries/index.js +3 -0
- package/dist/features/pr/queries/index.js.map +1 -0
- package/dist/features/runs/commands/handlers/runs-command.handlers.js +32 -0
- package/dist/features/runs/commands/handlers/runs-command.handlers.js.map +1 -0
- package/dist/features/runs/commands/impl/create-run.command.js +7 -0
- package/dist/features/runs/commands/impl/create-run.command.js.map +1 -0
- package/dist/features/runs/commands/index.js +3 -0
- package/dist/features/runs/commands/index.js.map +1 -0
- package/dist/features/runs/queries/handlers/runs-query.handlers.js +359 -0
- package/dist/features/runs/queries/handlers/runs-query.handlers.js.map +1 -0
- package/dist/features/runs/queries/impl/get-agent-activity.query.js +7 -0
- package/dist/features/runs/queries/impl/get-agent-activity.query.js.map +1 -0
- package/dist/features/runs/queries/impl/get-agent-attempts.query.js +7 -0
- package/dist/features/runs/queries/impl/get-agent-attempts.query.js.map +1 -0
- package/dist/features/runs/queries/impl/get-agent-log.query.js +7 -0
- package/dist/features/runs/queries/impl/get-agent-log.query.js.map +1 -0
- package/dist/features/runs/queries/impl/get-run-attempts.query.js +7 -0
- package/dist/features/runs/queries/impl/get-run-attempts.query.js.map +1 -0
- package/dist/features/runs/queries/impl/get-run-digest.query.js +7 -0
- package/dist/features/runs/queries/impl/get-run-digest.query.js.map +1 -0
- package/dist/features/runs/queries/impl/get-run-events.query.js +7 -0
- package/dist/features/runs/queries/impl/get-run-events.query.js.map +1 -0
- package/dist/features/runs/queries/impl/get-run-progress.query.js +7 -0
- package/dist/features/runs/queries/impl/get-run-progress.query.js.map +1 -0
- package/dist/features/runs/queries/impl/get-run-workflow.query.js +7 -0
- package/dist/features/runs/queries/impl/get-run-workflow.query.js.map +1 -0
- package/dist/features/runs/queries/impl/get-run.query.js +7 -0
- package/dist/features/runs/queries/impl/get-run.query.js.map +1 -0
- package/dist/features/runs/queries/impl/list-runs.query.js +7 -0
- package/dist/features/runs/queries/impl/list-runs.query.js.map +1 -0
- package/dist/features/runs/queries/impl/simulate-route.query.js +7 -0
- package/dist/features/runs/queries/impl/simulate-route.query.js.map +1 -0
- package/dist/features/runs/queries/index.js +15 -0
- package/dist/features/runs/queries/index.js.map +1 -0
- package/dist/features/runs/runs-api.module.js +23 -0
- package/dist/features/runs/runs-api.module.js.map +1 -0
- package/dist/features/runs/runs-api.service.js +79 -0
- package/dist/features/runs/runs-api.service.js.map +1 -0
- package/dist/features/shared/connection.js +39 -0
- package/dist/features/shared/connection.js.map +1 -0
- package/dist/features/system/commands/index.js +2 -0
- package/dist/features/system/commands/index.js.map +1 -0
- package/dist/features/system/queries/handlers/system-query.handlers.js +96 -0
- package/dist/features/system/queries/handlers/system-query.handlers.js.map +1 -0
- package/dist/features/system/queries/impl/doctor.query.js +4 -0
- package/dist/features/system/queries/impl/doctor.query.js.map +1 -0
- package/dist/features/system/queries/impl/get-project.query.js +4 -0
- package/dist/features/system/queries/impl/get-project.query.js.map +1 -0
- package/dist/features/system/queries/impl/get-repository-context.query.js +7 -0
- package/dist/features/system/queries/impl/get-repository-context.query.js.map +1 -0
- package/dist/features/system/queries/impl/get-status.query.js +4 -0
- package/dist/features/system/queries/impl/get-status.query.js.map +1 -0
- package/dist/features/system/queries/impl/validate-repository.query.js +7 -0
- package/dist/features/system/queries/impl/validate-repository.query.js.map +1 -0
- package/dist/features/system/queries/index.js +9 -0
- package/dist/features/system/queries/index.js.map +1 -0
- package/dist/features/system/system-api.module.js +23 -0
- package/dist/features/system/system-api.module.js.map +1 -0
- package/dist/features/system/system-api.service.js +47 -0
- package/dist/features/system/system-api.service.js.map +1 -0
- package/dist/host/daemon.js +99 -0
- package/dist/host/daemon.js.map +1 -0
- package/dist/host/dbos-identity.js +42 -0
- package/dist/host/dbos-identity.js.map +1 -0
- package/dist/host/ensure-host.js +120 -0
- package/dist/host/ensure-host.js.map +1 -0
- package/dist/host/host-runtime.js +90 -0
- package/dist/host/host-runtime.js.map +1 -0
- package/dist/host/host.lifecycle.js +16 -3
- package/dist/host/host.lifecycle.js.map +1 -1
- package/dist/host/queue-ownership.js +70 -0
- package/dist/host/queue-ownership.js.map +1 -0
- package/dist/host/queue-poller-census.js +47 -0
- package/dist/host/queue-poller-census.js.map +1 -0
- package/dist/http/graphql-host.js +56 -0
- package/dist/http/graphql-host.js.map +1 -0
- package/dist/{mcp/mcp.module.js → http/graphql-host.module.js} +12 -10
- package/dist/http/graphql-host.module.js.map +1 -0
- package/dist/infrastructure/metrics/graphql/graphql-metrics.js +91 -0
- package/dist/infrastructure/metrics/graphql/graphql-metrics.js.map +1 -0
- package/dist/mcp/mcp-capabilities.js +9 -1
- package/dist/mcp/mcp-capabilities.js.map +1 -1
- package/dist/mcp/mcp-facade.service.js +68 -5
- package/dist/mcp/mcp-facade.service.js.map +1 -1
- package/dist/mcp/mcp-http.service.js +95 -0
- package/dist/mcp/mcp-http.service.js.map +1 -0
- package/dist/mcp/mcp-tools.js +93 -7
- package/dist/mcp/mcp-tools.js.map +1 -1
- package/dist/observability/agent-activity-reporter.js +185 -0
- package/dist/observability/agent-activity-reporter.js.map +1 -0
- package/dist/observability/agent-observability.service.js +1142 -0
- package/dist/observability/agent-observability.service.js.map +1 -0
- package/dist/observability/index.js +4 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/types.js +11 -0
- package/dist/observability/types.js.map +1 -0
- package/dist/pipeline/await-human.js +8 -4
- package/dist/pipeline/await-human.js.map +1 -1
- package/dist/pipeline/data-driven-task.workflow.js +667 -0
- package/dist/pipeline/data-driven-task.workflow.js.map +1 -0
- package/dist/pipeline/data-driven-template.js +57 -0
- package/dist/pipeline/data-driven-template.js.map +1 -0
- package/dist/pipeline/pipeline.module.js +2 -2
- package/dist/pipeline/pipeline.module.js.map +1 -1
- package/dist/pipeline/pipeline.service.js +412 -0
- package/dist/pipeline/pipeline.service.js.map +1 -0
- package/dist/pipeline/route-contract.js +82 -0
- package/dist/pipeline/route-contract.js.map +1 -0
- package/dist/pipeline-core/index.js +16 -0
- package/dist/pipeline-core/index.js.map +1 -0
- package/dist/pipeline-core/interpret.js +353 -0
- package/dist/pipeline-core/interpret.js.map +1 -0
- package/dist/pipeline-core/kit/assertions.js +61 -0
- package/dist/pipeline-core/kit/assertions.js.map +1 -0
- package/dist/pipeline-core/kit/builders.js +138 -0
- package/dist/pipeline-core/kit/builders.js.map +1 -0
- package/dist/pipeline-core/kit/drive.js +96 -0
- package/dist/pipeline-core/kit/drive.js.map +1 -0
- package/dist/pipeline-core/kit/fixtures.js +342 -0
- package/dist/pipeline-core/kit/fixtures.js.map +1 -0
- package/dist/pipeline-core/kit/index.js +13 -0
- package/dist/pipeline-core/kit/index.js.map +1 -0
- package/dist/pipeline-core/types.js +134 -0
- package/dist/pipeline-core/types.js.map +1 -0
- package/dist/pipeline-core/validate-capability.js +23 -0
- package/dist/pipeline-core/validate-capability.js.map +1 -0
- package/dist/pipeline-core/validate-conflicts.js +37 -0
- package/dist/pipeline-core/validate-conflicts.js.map +1 -0
- package/dist/pipeline-core/validate-dataflow.js +212 -0
- package/dist/pipeline-core/validate-dataflow.js.map +1 -0
- package/dist/pipeline-core/validate-diff.js +158 -0
- package/dist/pipeline-core/validate-diff.js.map +1 -0
- package/dist/pipeline-core/validate-edges.js +44 -0
- package/dist/pipeline-core/validate-edges.js.map +1 -0
- package/dist/pipeline-core/validate-graph.js +123 -0
- package/dist/pipeline-core/validate-graph.js.map +1 -0
- package/dist/pipeline-core/validate-loops.js +226 -0
- package/dist/pipeline-core/validate-loops.js.map +1 -0
- package/dist/pipeline-core/validate-parallel.js +132 -0
- package/dist/pipeline-core/validate-parallel.js.map +1 -0
- package/dist/pipeline-core/validate-sink.js +27 -0
- package/dist/pipeline-core/validate-sink.js.map +1 -0
- package/dist/pipeline-core/validate-topology.js +140 -0
- package/dist/pipeline-core/validate-topology.js.map +1 -0
- package/dist/pipeline-core/validate-verdict.js +72 -0
- package/dist/pipeline-core/validate-verdict.js.map +1 -0
- package/dist/pipeline-core/validate.js +119 -0
- package/dist/pipeline-core/validate.js.map +1 -0
- package/dist/playbook/catalog-loader.js +14 -1
- package/dist/playbook/catalog-loader.js.map +1 -1
- package/dist/playbook/import-mapper.js +14 -38
- package/dist/playbook/import-mapper.js.map +1 -1
- package/dist/playbook/manifest.js +1 -1
- package/dist/revisium/playbooks.service.js +107 -19
- package/dist/revisium/playbooks.service.js.map +1 -1
- package/dist/revisium/roles.service.js +1 -1
- package/dist/revisium/roles.service.js.map +1 -1
- package/dist/revisium/run.service.js +55 -8
- package/dist/revisium/run.service.js.map +1 -1
- package/dist/run/append-event.js +24 -1
- package/dist/run/append-event.js.map +1 -1
- package/dist/run/block-run.js +17 -0
- package/dist/run/block-run.js.map +1 -0
- package/dist/run/complete-run.js +18 -0
- package/dist/run/complete-run.js.map +1 -0
- package/dist/run/create-run.js +33 -36
- package/dist/run/create-run.js.map +1 -1
- package/dist/run/inspect-run.js +31 -30
- package/dist/run/inspect-run.js.map +1 -1
- package/dist/run/run-outputs.js +88 -0
- package/dist/run/run-outputs.js.map +1 -0
- package/dist/run/terminal-run-status.js +66 -7
- package/dist/run/terminal-run-status.js.map +1 -1
- package/dist/runners/claude-code.service.js +5 -0
- package/dist/runners/claude-code.service.js.map +1 -1
- package/dist/runners/codex.service.js +51 -0
- package/dist/runners/codex.service.js.map +1 -0
- package/dist/runners/integrator-branch-naming.js +39 -0
- package/dist/runners/integrator-branch-naming.js.map +1 -0
- package/dist/runners/integrator-git.js +84 -0
- package/dist/runners/integrator-git.js.map +1 -0
- package/dist/runners/integrator-remote.js +34 -0
- package/dist/runners/integrator-remote.js.map +1 -0
- package/dist/runners/integrator-types.js +9 -0
- package/dist/runners/integrator-types.js.map +1 -0
- package/dist/runners/integrator.js +327 -147
- package/dist/runners/integrator.js.map +1 -1
- package/dist/runners/runner.module.js +7 -3
- package/dist/runners/runner.module.js.map +1 -1
- package/dist/runners/worktree.service.js +63 -0
- package/dist/runners/worktree.service.js.map +1 -0
- package/dist/smoke/cli.js +47 -0
- package/dist/smoke/cli.js.map +1 -0
- package/dist/smoke/isolation.js +113 -0
- package/dist/smoke/isolation.js.map +1 -0
- package/dist/task-control-plane/run-watch.service.js +281 -0
- package/dist/task-control-plane/run-watch.service.js.map +1 -0
- package/dist/task-control-plane/task-control-plane-api.service.js +569 -23
- package/dist/task-control-plane/task-control-plane-api.service.js.map +1 -1
- package/dist/task-control-plane/task-control-plane.module.js +22 -3
- package/dist/task-control-plane/task-control-plane.module.js.map +1 -1
- package/dist/worker/artifact-store.js +116 -0
- package/dist/worker/artifact-store.js.map +1 -0
- package/dist/worker/build-context.js +169 -2
- package/dist/worker/build-context.js.map +1 -1
- package/dist/worker/claude-code-runner.js +159 -68
- package/dist/worker/claude-code-runner.js.map +1 -1
- package/dist/worker/codex-runner.js +474 -0
- package/dist/worker/codex-runner.js.map +1 -0
- package/dist/worker/git-worktree-manager.js +129 -65
- package/dist/worker/git-worktree-manager.js.map +1 -1
- package/dist/worker/process-executor.js +23 -2
- package/dist/worker/process-executor.js.map +1 -1
- package/dist/worker/result-envelope.js +115 -57
- package/dist/worker/result-envelope.js.map +1 -1
- package/dist/worker/runner-common.js +106 -0
- package/dist/worker/runner-common.js.map +1 -0
- package/dist/worker/runner-dispatch.js +4 -1
- package/dist/worker/runner-dispatch.js.map +1 -1
- package/dist/worker/runner.js +11 -1
- package/dist/worker/runner.js.map +1 -1
- package/dist/worker/stub-runner.js +7 -45
- package/dist/worker/stub-runner.js.map +1 -1
- package/package.json +32 -7
- package/dist/app.module.js +0 -28
- package/dist/app.module.js.map +0 -1
- package/dist/cli/commands/bootstrap.js +0 -39
- package/dist/cli/commands/bootstrap.js.map +0 -1
- package/dist/cli/commands/dev.js +0 -143
- package/dist/cli/commands/dev.js.map +0 -1
- package/dist/cli/commands/inbox.js +0 -288
- package/dist/cli/commands/inbox.js.map +0 -1
- package/dist/cli/commands/playbook.js +0 -74
- package/dist/cli/commands/playbook.js.map +0 -1
- package/dist/cli/commands/poll-workflow-state.js +0 -144
- package/dist/cli/commands/poll-workflow-state.js.map +0 -1
- package/dist/cli/commands/revisium-context.js +0 -23
- package/dist/cli/commands/revisium-context.js.map +0 -1
- package/dist/cli/commands/revisium.js +0 -89
- package/dist/cli/commands/revisium.js.map +0 -1
- package/dist/cli/commands/run.js +0 -426
- package/dist/cli/commands/run.js.map +0 -1
- package/dist/cli/commands/work.js +0 -149
- package/dist/cli/commands/work.js.map +0 -1
- package/dist/cli/live-guard.js +0 -49
- package/dist/cli/live-guard.js.map +0 -1
- package/dist/cli/needs-host.js +0 -78
- package/dist/cli/needs-host.js.map +0 -1
- package/dist/mcp/mcp-stdio.service.js +0 -48
- package/dist/mcp/mcp-stdio.service.js.map +0 -1
- package/dist/mcp/mcp.module.js.map +0 -1
- package/dist/pipeline/develop-task.workflow.js +0 -497
- package/dist/pipeline/develop-task.workflow.js.map +0 -1
- package/dist/worker/loop.js +0 -122
- package/dist/worker/loop.js.map +0 -1
- package/dist/worker/script-runner.js +0 -28
- package/dist/worker/script-runner.js.map +0 -1
- package/dist/worker/worker-id.js +0 -18
- package/dist/worker/worker-id.js.map +0 -1
- package/dist/worker/worktree-manager.js +0 -7
- package/dist/worker/worktree-manager.js.map +0 -1
|
@@ -7,22 +7,32 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
10
13
|
import { execFile } from 'node:child_process';
|
|
11
14
|
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
12
15
|
import { basename, join, resolve } from 'node:path';
|
|
13
16
|
import { promisify } from 'node:util';
|
|
14
|
-
import { Injectable } from '@nestjs/common';
|
|
17
|
+
import { Inject, Injectable } from '@nestjs/common';
|
|
15
18
|
import { baseUrl, getConfig, isAlive, isHealthy, readRuntime } from '../cli/config.js';
|
|
19
|
+
import { AgentObservabilityService } from '../observability/agent-observability.service.js';
|
|
16
20
|
import { ControlPlaneError } from '../control-plane/errors.js';
|
|
17
21
|
import { DbosService } from '../engine/dbos.service.js';
|
|
18
|
-
import { PipelineService } from '../pipeline/
|
|
22
|
+
import { PipelineService } from '../pipeline/pipeline.service.js';
|
|
23
|
+
import { RUN_PROGRESS_EVENT_KEY } from '../pipeline/data-driven-task.workflow.js';
|
|
24
|
+
import { templateFromExecutionPolicy } from '../pipeline/data-driven-template.js';
|
|
25
|
+
import { normalizeExecutionProfile, normalizeParams, normalizeRouteGates, resolveRunnerForProfile, } from '../pipeline/route-contract.js';
|
|
19
26
|
import { InboxService } from '../revisium/inbox.service.js';
|
|
20
27
|
import { PlaybooksService } from '../revisium/playbooks.service.js';
|
|
21
28
|
import { RolesService } from '../revisium/roles.service.js';
|
|
22
29
|
import { RunService } from '../revisium/run.service.js';
|
|
23
30
|
import { PrReadinessService } from './pr-readiness.service.js';
|
|
24
31
|
const execFileAsync = promisify(execFile);
|
|
25
|
-
const GATE_TOPICS = new Set(['plan', 'merge']);
|
|
32
|
+
const GATE_TOPICS = new Set(['plan', 'merge', 'question']);
|
|
33
|
+
const WORKFLOW_SUCCESS_EVENT_TYPES = new Set(['step_succeeded', 'gate_signaled']);
|
|
34
|
+
const WORKFLOW_FAILURE_EVENT_TYPES = new Set(['step_failed', 'attempt_failed']);
|
|
35
|
+
const BUILTIN_RUNNERS = new Set(['claude-code', 'codex', 'script', 'stub-agent', 'revo-integrator', 'revo-merger', 'revo-deterministic']);
|
|
26
36
|
function asErrorMessage(error) {
|
|
27
37
|
if (error instanceof Error)
|
|
28
38
|
return error.message;
|
|
@@ -33,6 +43,14 @@ function asRecord(value) {
|
|
|
33
43
|
return null;
|
|
34
44
|
return value;
|
|
35
45
|
}
|
|
46
|
+
function dateOrEpoch(value) {
|
|
47
|
+
if (value instanceof Date)
|
|
48
|
+
return Number.isNaN(value.getTime()) ? new Date(0) : value;
|
|
49
|
+
if (value === undefined || value === '')
|
|
50
|
+
return new Date(0);
|
|
51
|
+
const parsed = new Date(value);
|
|
52
|
+
return Number.isNaN(parsed.getTime()) ? new Date(0) : parsed;
|
|
53
|
+
}
|
|
36
54
|
function gateTopic(item) {
|
|
37
55
|
if (item.kind !== 'approval' || !item.runId)
|
|
38
56
|
return null;
|
|
@@ -99,6 +117,171 @@ function summarizeAttempts(attempts) {
|
|
|
99
117
|
costAmount: acc.costAmount + attempt.costAmount,
|
|
100
118
|
}), { inputTokens: 0, outputTokens: 0, costAmount: 0 });
|
|
101
119
|
}
|
|
120
|
+
function normalizedRunStatus(status) {
|
|
121
|
+
return status === 'paused' ? 'blocked' : status;
|
|
122
|
+
}
|
|
123
|
+
function payloadRecord(event) {
|
|
124
|
+
return asRecord(event.payload);
|
|
125
|
+
}
|
|
126
|
+
function eventStepKey(event) {
|
|
127
|
+
const payload = payloadRecord(event);
|
|
128
|
+
const stepKey = payload?.stepKey;
|
|
129
|
+
return typeof stepKey === 'string' ? stepKey : '';
|
|
130
|
+
}
|
|
131
|
+
function eventSummary(event) {
|
|
132
|
+
const payload = payloadRecord(event);
|
|
133
|
+
const reason = payload?.reason;
|
|
134
|
+
const output = payload?.output;
|
|
135
|
+
if (typeof reason === 'string' && reason)
|
|
136
|
+
return reason;
|
|
137
|
+
if (typeof output === 'string' && output)
|
|
138
|
+
return output.slice(0, 180);
|
|
139
|
+
return event.type;
|
|
140
|
+
}
|
|
141
|
+
function stepKeyBase(stepKey) {
|
|
142
|
+
return stepKey.split('#')[0] ?? stepKey;
|
|
143
|
+
}
|
|
144
|
+
function activeNodeIds(progress) {
|
|
145
|
+
const cursor = asRecord(progress.graphCursor);
|
|
146
|
+
const value = cursor?.activeNodeIds;
|
|
147
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === 'string') : [];
|
|
148
|
+
}
|
|
149
|
+
function cursorStatus(progress) {
|
|
150
|
+
const cursor = asRecord(progress.graphCursor);
|
|
151
|
+
const status = cursor?.status;
|
|
152
|
+
return typeof status === 'string' ? status : progress.workflowStatus;
|
|
153
|
+
}
|
|
154
|
+
function templateNodeLabel(node) {
|
|
155
|
+
return node.displayName ?? node.id.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/[-_]/g, ' ');
|
|
156
|
+
}
|
|
157
|
+
function roleFromRef(roleRef) {
|
|
158
|
+
if (!roleRef)
|
|
159
|
+
return null;
|
|
160
|
+
return roleRef.startsWith('role:') ? roleRef.slice('role:'.length) : roleRef;
|
|
161
|
+
}
|
|
162
|
+
function scriptFromRef(scriptRef) {
|
|
163
|
+
if (!scriptRef)
|
|
164
|
+
return null;
|
|
165
|
+
return scriptRef.startsWith('script:') ? scriptRef.slice('script:'.length) : scriptRef;
|
|
166
|
+
}
|
|
167
|
+
function mapAttemptForWorkflow(runId, attempt) {
|
|
168
|
+
return {
|
|
169
|
+
id: attempt.attemptId,
|
|
170
|
+
runId,
|
|
171
|
+
stepId: attempt.stepId,
|
|
172
|
+
stepKey: attempt.stepId,
|
|
173
|
+
iteration: attempt.iteration,
|
|
174
|
+
status: attempt.status,
|
|
175
|
+
verdict: attempt.verdict,
|
|
176
|
+
modelProfile: attempt.modelProfile,
|
|
177
|
+
inputTokens: attempt.inputTokens,
|
|
178
|
+
outputTokens: attempt.outputTokens,
|
|
179
|
+
costAmount: attempt.costAmount,
|
|
180
|
+
currency: attempt.currency,
|
|
181
|
+
durationMs: attempt.durationMs,
|
|
182
|
+
outputSummary: attempt.outputSummary,
|
|
183
|
+
artifactRef: attempt.artifactRef,
|
|
184
|
+
lesson: attempt.lesson,
|
|
185
|
+
error: attempt.error,
|
|
186
|
+
startedAt: dateOrEpoch(attempt.startedAt),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function mapInboxForWorkflow(item) {
|
|
190
|
+
return {
|
|
191
|
+
...item,
|
|
192
|
+
runId: item.runId || null,
|
|
193
|
+
taskId: item.taskId || null,
|
|
194
|
+
stepId: item.stepId || null,
|
|
195
|
+
projectId: item.projectId || null,
|
|
196
|
+
resolvedBy: item.resolvedBy || null,
|
|
197
|
+
createdAt: dateOrEpoch(item.createdAt),
|
|
198
|
+
resolvedAt: item.resolvedAt ? dateOrEpoch(item.resolvedAt) : null,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function mapRunForWorkflow(run) {
|
|
202
|
+
return {
|
|
203
|
+
id: run.runId ?? run.id ?? '',
|
|
204
|
+
title: run.title ?? '',
|
|
205
|
+
status: normalizedRunStatus(run.status ?? ''),
|
|
206
|
+
priority: run.priority ?? 0,
|
|
207
|
+
description: run.description,
|
|
208
|
+
scope: run.scope,
|
|
209
|
+
repos: run.repos ?? [],
|
|
210
|
+
createdAt: dateOrEpoch(run.createdAt),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function workflowNodeStatus(input) {
|
|
214
|
+
if (input.gate)
|
|
215
|
+
return 'awaiting_approval';
|
|
216
|
+
if (input.failed)
|
|
217
|
+
return 'failed';
|
|
218
|
+
if (input.active)
|
|
219
|
+
return 'running';
|
|
220
|
+
if (input.succeeded)
|
|
221
|
+
return 'succeeded';
|
|
222
|
+
return 'pending';
|
|
223
|
+
}
|
|
224
|
+
function workflowGateTopic(node) {
|
|
225
|
+
const metadata = asRecord(node.metadata);
|
|
226
|
+
const reason = metadata?.reason;
|
|
227
|
+
return typeof reason === 'string' && reason ? reason : node.id;
|
|
228
|
+
}
|
|
229
|
+
function addAttemptForWorkflowNode(attemptsByBase, seenAttemptIdsByBase, base, attempt) {
|
|
230
|
+
const seen = seenAttemptIdsByBase.get(base) ?? new Set();
|
|
231
|
+
if (seen.has(attempt.attemptId))
|
|
232
|
+
return;
|
|
233
|
+
seen.add(attempt.attemptId);
|
|
234
|
+
seenAttemptIdsByBase.set(base, seen);
|
|
235
|
+
attemptsByBase.set(base, [...(attemptsByBase.get(base) ?? []), attempt]);
|
|
236
|
+
}
|
|
237
|
+
function workflowEdges(node) {
|
|
238
|
+
const record = node;
|
|
239
|
+
const edges = [];
|
|
240
|
+
const add = (to, label = '', kind = 'next') => {
|
|
241
|
+
if (typeof to === 'string' && to)
|
|
242
|
+
edges.push({ from: node.id, to, label, kind });
|
|
243
|
+
};
|
|
244
|
+
add(record.next);
|
|
245
|
+
add(record.join, 'join', 'join');
|
|
246
|
+
const branches = Array.isArray(record.branches) ? record.branches : [];
|
|
247
|
+
for (const branch of branches) {
|
|
248
|
+
const item = asRecord(branch);
|
|
249
|
+
add(item?.goto ?? item?.entry, typeof item?.id === 'string' ? item.id : '', node.kind === 'humanGate' ? 'gate' : 'branch');
|
|
250
|
+
}
|
|
251
|
+
return edges;
|
|
252
|
+
}
|
|
253
|
+
function words(value) {
|
|
254
|
+
return new Set(value.toLowerCase().split(/[^a-z0-9]+/).filter((part) => part.length > 2));
|
|
255
|
+
}
|
|
256
|
+
function routeScore(pipeline, text) {
|
|
257
|
+
const input = words(text);
|
|
258
|
+
let score = 0;
|
|
259
|
+
for (const trigger of pipeline.triggers) {
|
|
260
|
+
for (const word of words(trigger)) {
|
|
261
|
+
if (input.has(word))
|
|
262
|
+
score += 1;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return score;
|
|
266
|
+
}
|
|
267
|
+
function isRouteDecision(value) {
|
|
268
|
+
const record = asRecord(value);
|
|
269
|
+
return Boolean(record?.playbookId && record?.pipelineRowId && Array.isArray(record.roleBindings));
|
|
270
|
+
}
|
|
271
|
+
function assertRunnerAvailable(runnerId, profile, roleId) {
|
|
272
|
+
const available = profile.availableRunners;
|
|
273
|
+
if (available && !available.includes(runnerId)) {
|
|
274
|
+
throw new ControlPlaneError('VALIDATION_FAILURE', `runner unavailable for role ${roleId}: ${runnerId}`);
|
|
275
|
+
}
|
|
276
|
+
if (!available && !BUILTIN_RUNNERS.has(runnerId)) {
|
|
277
|
+
throw new ControlPlaneError('VALIDATION_FAILURE', `runner implementation is not registered for role ${roleId}: ${runnerId}`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function assertProductionRunnerBinding(runnerId, runnerSource, roleId) {
|
|
281
|
+
if (runnerId !== 'stub-agent' || runnerSource === 'execution-profile')
|
|
282
|
+
return;
|
|
283
|
+
throw new ControlPlaneError('VALIDATION_FAILURE', `role ${roleId} binds production runner stub-agent; use an execution profile override for test stubs`);
|
|
284
|
+
}
|
|
102
285
|
let TaskControlPlaneApiService = class TaskControlPlaneApiService {
|
|
103
286
|
runs;
|
|
104
287
|
inbox;
|
|
@@ -106,14 +289,16 @@ let TaskControlPlaneApiService = class TaskControlPlaneApiService {
|
|
|
106
289
|
playbooks;
|
|
107
290
|
pipeline;
|
|
108
291
|
dbos;
|
|
292
|
+
observability;
|
|
109
293
|
prReadiness;
|
|
110
|
-
constructor(runs, inbox, roles, playbooks, pipeline, dbos, prReadiness = new PrReadinessService()) {
|
|
294
|
+
constructor(runs, inbox, roles, playbooks, pipeline, dbos, observability, prReadiness = new PrReadinessService()) {
|
|
111
295
|
this.runs = runs;
|
|
112
296
|
this.inbox = inbox;
|
|
113
297
|
this.roles = roles;
|
|
114
298
|
this.playbooks = playbooks;
|
|
115
299
|
this.pipeline = pipeline;
|
|
116
300
|
this.dbos = dbos;
|
|
301
|
+
this.observability = observability;
|
|
117
302
|
this.prReadiness = prReadiness;
|
|
118
303
|
}
|
|
119
304
|
async getStatus() {
|
|
@@ -214,19 +399,36 @@ let TaskControlPlaneApiService = class TaskControlPlaneApiService {
|
|
|
214
399
|
return { ...validation, files, ...packageContext };
|
|
215
400
|
}
|
|
216
401
|
async createRun(input) {
|
|
402
|
+
const route = await this.resolveRouteDecision({
|
|
403
|
+
title: input.title,
|
|
404
|
+
repo: input.repo,
|
|
405
|
+
description: input.description,
|
|
406
|
+
scope: input.scope,
|
|
407
|
+
playbookId: input.playbookId,
|
|
408
|
+
pipelineId: input.pipelineId,
|
|
409
|
+
params: input.params,
|
|
410
|
+
executionProfile: input.executionProfile,
|
|
411
|
+
source: input.pipelineId ? 'explicit' : 'deterministic-installed-playbook',
|
|
412
|
+
});
|
|
217
413
|
const result = await this.runs.createRun({
|
|
218
414
|
title: input.title,
|
|
219
415
|
repo: input.repo,
|
|
220
416
|
description: input.description,
|
|
221
417
|
scope: input.scope,
|
|
222
418
|
priority: input.priority ?? 0,
|
|
223
|
-
role: input.role ?? 'architect',
|
|
419
|
+
role: route.roleBindings[0]?.rowId ?? input.role ?? 'architect',
|
|
420
|
+
playbookId: route.playbookId,
|
|
421
|
+
pipelineId: route.pipelineId,
|
|
422
|
+
params: route.params,
|
|
423
|
+
routeDecision: route,
|
|
424
|
+
executionProfile: route.executionProfile,
|
|
224
425
|
});
|
|
225
426
|
if (!input.start)
|
|
226
|
-
return { ...result, started: false };
|
|
427
|
+
return { ...result, started: false, route };
|
|
227
428
|
const started = await this.startRun({
|
|
228
429
|
runId: result.runId,
|
|
229
|
-
runnerMode: input.runnerMode
|
|
430
|
+
runnerMode: input.runnerMode,
|
|
431
|
+
route,
|
|
230
432
|
});
|
|
231
433
|
return { ...result, started: true, workflow: started };
|
|
232
434
|
}
|
|
@@ -234,15 +436,25 @@ let TaskControlPlaneApiService = class TaskControlPlaneApiService {
|
|
|
234
436
|
const run = await this.runs.getRun(input.runId);
|
|
235
437
|
if (!run)
|
|
236
438
|
throw new ControlPlaneError('ROW_NOT_FOUND', `run not found: ${input.runId}`);
|
|
439
|
+
const route = input.route ?? await this.routeForRun(run);
|
|
237
440
|
const existingStatus = await this.dbos.getWorkflowStatus(input.runId);
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
441
|
+
// CUTOVER (plan 0015 slice 3): the data-driven engine is the SOLE pipeline engine. EVERY pipeline
|
|
442
|
+
// routes to the data-driven workflow, executing the state-machine template carried in its
|
|
443
|
+
// execution_policy (template_json). A pipeline lacking a valid template FAILS LOUD here
|
|
444
|
+
// (PIPELINE_NOT_DATA_DRIVEN) rather than silently no-op-ing — there is no hardcoded fallback engine.
|
|
445
|
+
// A present-but-malformed/invalid template likewise throws (templateFromExecutionPolicy).
|
|
446
|
+
const template = templateFromExecutionPolicy(route.executionPolicy);
|
|
447
|
+
if (!template) {
|
|
448
|
+
throw new ControlPlaneError('VALIDATION_FAILURE', `PIPELINE_NOT_DATA_DRIVEN: pipeline ${route.pipelineId} carries no state-machine template ` +
|
|
449
|
+
`(execution_policy.template_json); the data-driven engine is the only engine`);
|
|
450
|
+
}
|
|
451
|
+
const handle = await this.pipeline.startDataDrivenTask(input.runId, { route, template });
|
|
241
452
|
return {
|
|
242
453
|
runId: input.runId,
|
|
243
454
|
workflowID: handle.workflowID,
|
|
244
455
|
alreadyStarted: existingStatus !== null,
|
|
245
|
-
|
|
456
|
+
route,
|
|
457
|
+
engine: 'data-driven',
|
|
246
458
|
};
|
|
247
459
|
}
|
|
248
460
|
resumeRun(input) {
|
|
@@ -270,9 +482,146 @@ let TaskControlPlaneApiService = class TaskControlPlaneApiService {
|
|
|
270
482
|
getRunEvents(input) {
|
|
271
483
|
return this.runs.listRunEvents(input.runId, { type: input.type, limit: input.limit });
|
|
272
484
|
}
|
|
485
|
+
async getRunProgress(runId) {
|
|
486
|
+
const detail = await this.runs.showRun(runId);
|
|
487
|
+
if (!detail)
|
|
488
|
+
throw new ControlPlaneError('ROW_NOT_FOUND', `run not found: ${runId}`);
|
|
489
|
+
const workflow = await this.dbos.getWorkflowStatus(runId);
|
|
490
|
+
if (!workflow) {
|
|
491
|
+
return {
|
|
492
|
+
workflowStatus: 'NOT_STARTED',
|
|
493
|
+
graphCursor: null,
|
|
494
|
+
updatedAt: dateOrEpoch(detail.run.createdAt),
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
const graphCursor = await this.dbos.getEvent(workflow.workflowID, RUN_PROGRESS_EVENT_KEY, { timeoutSeconds: 0 });
|
|
498
|
+
return {
|
|
499
|
+
workflowStatus: workflow.status,
|
|
500
|
+
graphCursor,
|
|
501
|
+
updatedAt: dateOrEpoch(workflow.updatedAt ?? workflow.createdAt),
|
|
502
|
+
};
|
|
503
|
+
}
|
|
273
504
|
getRunLog(input) {
|
|
274
505
|
return this.runs.listRunAttempts(input.runId, { limit: input.limit });
|
|
275
506
|
}
|
|
507
|
+
async getRunWorkflow(runId) {
|
|
508
|
+
const [detail, runRow, events, attempts, pendingInbox, progress] = await Promise.all([
|
|
509
|
+
this.getRun({ runId }),
|
|
510
|
+
this.runs.getRun(runId),
|
|
511
|
+
this.runs.listRunEvents(runId, { limit: 500 }),
|
|
512
|
+
this.runs.listRunAttempts(runId, { limit: 500 }),
|
|
513
|
+
this.inbox.listInbox({ runId, status: 'pending', limit: 100 }),
|
|
514
|
+
this.getRunProgress(runId),
|
|
515
|
+
]);
|
|
516
|
+
if (!runRow)
|
|
517
|
+
throw new ControlPlaneError('ROW_NOT_FOUND', `run not found: ${runId}`);
|
|
518
|
+
const route = await this.routeForRun(runRow);
|
|
519
|
+
const template = templateFromExecutionPolicy(route.executionPolicy);
|
|
520
|
+
const activeIds = activeNodeIds(progress);
|
|
521
|
+
const active = new Set(activeIds);
|
|
522
|
+
const succeeded = new Set(events
|
|
523
|
+
.filter((event) => WORKFLOW_SUCCESS_EVENT_TYPES.has(event.type))
|
|
524
|
+
.map(eventStepKey)
|
|
525
|
+
.filter(Boolean)
|
|
526
|
+
.map(stepKeyBase));
|
|
527
|
+
const failed = new Set(events
|
|
528
|
+
.filter((event) => WORKFLOW_FAILURE_EVENT_TYPES.has(event.type))
|
|
529
|
+
.map(eventStepKey)
|
|
530
|
+
.filter(Boolean)
|
|
531
|
+
.map(stepKeyBase));
|
|
532
|
+
const inboxByNode = new Map();
|
|
533
|
+
for (const item of pendingInbox) {
|
|
534
|
+
const context = asRecord(item.context);
|
|
535
|
+
const summary = asRecord(context?.summary);
|
|
536
|
+
const nodeId = typeof summary?.nodeId === 'string' ? summary.nodeId : '';
|
|
537
|
+
if (nodeId)
|
|
538
|
+
inboxByNode.set(nodeId, item);
|
|
539
|
+
}
|
|
540
|
+
const attemptsByBase = new Map();
|
|
541
|
+
const seenAttemptIdsByBase = new Map();
|
|
542
|
+
for (const event of events) {
|
|
543
|
+
const key = eventStepKey(event);
|
|
544
|
+
if (!key)
|
|
545
|
+
continue;
|
|
546
|
+
const base = stepKeyBase(key);
|
|
547
|
+
const eventAttempts = attempts.filter((attempt) => attempt.attemptId === asRecord(event.payload)?.attemptId);
|
|
548
|
+
for (const attempt of eventAttempts) {
|
|
549
|
+
addAttemptForWorkflowNode(attemptsByBase, seenAttemptIdsByBase, base, attempt);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
const nodes = Object.values(template?.nodes ?? {}).map((node) => {
|
|
553
|
+
const record = node;
|
|
554
|
+
const nodeAttempts = attemptsByBase.get(node.id) ?? [];
|
|
555
|
+
const roleId = roleFromRef(record.roleRef);
|
|
556
|
+
const binding = roleId ? route.roleBindings.find((item) => item.roleId === roleId) : undefined;
|
|
557
|
+
const isActive = active.has(node.id);
|
|
558
|
+
const gate = inboxByNode.get(node.id);
|
|
559
|
+
const status = workflowNodeStatus({
|
|
560
|
+
gate,
|
|
561
|
+
failed: failed.has(node.id),
|
|
562
|
+
active: isActive,
|
|
563
|
+
succeeded: succeeded.has(node.id),
|
|
564
|
+
});
|
|
565
|
+
return {
|
|
566
|
+
id: node.id,
|
|
567
|
+
label: templateNodeLabel(node),
|
|
568
|
+
kind: node.kind,
|
|
569
|
+
roleId,
|
|
570
|
+
scriptId: scriptFromRef(record.scriptRef),
|
|
571
|
+
modelLevel: binding?.modelLevel ?? null,
|
|
572
|
+
runner: binding?.resolvedRunnerId ?? null,
|
|
573
|
+
status,
|
|
574
|
+
attemptCount: nodeAttempts.length,
|
|
575
|
+
inputTokens: nodeAttempts.reduce((sum, attempt) => sum + attempt.inputTokens, 0),
|
|
576
|
+
outputTokens: nodeAttempts.reduce((sum, attempt) => sum + attempt.outputTokens, 0),
|
|
577
|
+
costAmount: nodeAttempts.reduce((sum, attempt) => sum + attempt.costAmount, 0),
|
|
578
|
+
verdict: nodeAttempts.at(-1)?.verdict ?? null,
|
|
579
|
+
inboxId: gate?.id ?? null,
|
|
580
|
+
metadata: node,
|
|
581
|
+
};
|
|
582
|
+
});
|
|
583
|
+
const edges = Object.values(template?.nodes ?? {}).flatMap((node) => workflowEdges(node));
|
|
584
|
+
return {
|
|
585
|
+
run: {
|
|
586
|
+
...mapRunForWorkflow(detail.run),
|
|
587
|
+
},
|
|
588
|
+
pipeline: {
|
|
589
|
+
id: route.pipelineRowId,
|
|
590
|
+
pipelineId: route.pipelineId,
|
|
591
|
+
playbookId: route.playbookId,
|
|
592
|
+
title: template?.title ?? route.pipelineId,
|
|
593
|
+
routeGates: route.routeGates,
|
|
594
|
+
activeNodeIds: activeIds,
|
|
595
|
+
status: cursorStatus(progress),
|
|
596
|
+
},
|
|
597
|
+
nodes,
|
|
598
|
+
edges,
|
|
599
|
+
currentNodeIds: activeIds,
|
|
600
|
+
gates: nodes
|
|
601
|
+
.filter((node) => node.kind === 'humanGate')
|
|
602
|
+
.map((node) => {
|
|
603
|
+
const inbox = inboxByNode.get(node.id);
|
|
604
|
+
return {
|
|
605
|
+
nodeId: node.id,
|
|
606
|
+
topic: workflowGateTopic(node),
|
|
607
|
+
status: inbox ? 'pending' : node.status,
|
|
608
|
+
inboxId: inbox?.id ?? null,
|
|
609
|
+
answer: inbox?.answer ?? null,
|
|
610
|
+
};
|
|
611
|
+
}),
|
|
612
|
+
attempts: attempts.map((attempt) => mapAttemptForWorkflow(runId, attempt)),
|
|
613
|
+
pendingInbox: pendingInbox.map(mapInboxForWorkflow),
|
|
614
|
+
usage: summarizeAttempts(attempts),
|
|
615
|
+
activity: events.slice(-50).reverse().map((event) => ({
|
|
616
|
+
id: event.eventId,
|
|
617
|
+
type: event.type,
|
|
618
|
+
actor: event.actor,
|
|
619
|
+
createdAt: dateOrEpoch(event.createdAt),
|
|
620
|
+
summary: eventSummary(event),
|
|
621
|
+
payload: event.payload,
|
|
622
|
+
})),
|
|
623
|
+
};
|
|
624
|
+
}
|
|
276
625
|
async getRunDigest(runId) {
|
|
277
626
|
const detail = await this.runs.showRun(runId);
|
|
278
627
|
if (!detail)
|
|
@@ -290,6 +639,90 @@ let TaskControlPlaneApiService = class TaskControlPlaneApiService {
|
|
|
290
639
|
usage: summarizeAttempts(attempts),
|
|
291
640
|
};
|
|
292
641
|
}
|
|
642
|
+
async waitForRun(input) {
|
|
643
|
+
const timeoutMs = input.timeoutMs ?? 0;
|
|
644
|
+
const intervalMs = input.intervalMs ?? 1000;
|
|
645
|
+
const deadline = Date.now() + timeoutMs;
|
|
646
|
+
for (;;) {
|
|
647
|
+
const state = await this.resolveRunState(input.runId);
|
|
648
|
+
if (state.state !== 'running' || Date.now() >= deadline)
|
|
649
|
+
return state;
|
|
650
|
+
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Resolve a single run to its actionable state. Public so `RunWatchService` (slice 141 D2) can
|
|
655
|
+
* fan it out across many runs; it is a point-in-time level read (gate = `inbox.find(approval)`),
|
|
656
|
+
* not an event cursor — the watch primitive layers at-least-once + idempotent delivery on top.
|
|
657
|
+
*/
|
|
658
|
+
async resolveRunState(runId) {
|
|
659
|
+
const detail = await this.runs.showRun(runId);
|
|
660
|
+
if (!detail)
|
|
661
|
+
throw new ControlPlaneError('ROW_NOT_FOUND', `run not found: ${runId}`);
|
|
662
|
+
const [inbox, events, workflow] = await Promise.all([
|
|
663
|
+
this.inbox.listInbox({ runId, status: 'pending', limit: 20 }),
|
|
664
|
+
this.runs.listRunEvents(runId, { limit: 20 }),
|
|
665
|
+
this.dbos.getWorkflowStatus(runId),
|
|
666
|
+
]);
|
|
667
|
+
const gate = inbox.find((item) => item.kind === 'approval');
|
|
668
|
+
if (gate) {
|
|
669
|
+
return {
|
|
670
|
+
runId,
|
|
671
|
+
state: 'pending_gate',
|
|
672
|
+
nextAction: 'resolve approval with approve_gate or reject_gate',
|
|
673
|
+
runStatus: detail.run.status,
|
|
674
|
+
workflowStatus: workflow?.status ?? '',
|
|
675
|
+
inbox: gate,
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
const question = inbox.find((item) => item.kind === 'question');
|
|
679
|
+
if (question) {
|
|
680
|
+
return {
|
|
681
|
+
runId,
|
|
682
|
+
state: 'question',
|
|
683
|
+
nextAction: 'answer question with answer_question',
|
|
684
|
+
runStatus: detail.run.status,
|
|
685
|
+
workflowStatus: workflow?.status ?? '',
|
|
686
|
+
inbox: question,
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
if (detail.run.status === 'completed') {
|
|
690
|
+
return { runId, state: 'completed', nextAction: 'none', runStatus: detail.run.status, workflowStatus: workflow?.status ?? '' };
|
|
691
|
+
}
|
|
692
|
+
if (detail.run.status === 'failed') {
|
|
693
|
+
return { runId, state: 'failed', nextAction: 'inspect get_run_events/get_run_log', runStatus: detail.run.status, workflowStatus: workflow?.status ?? '' };
|
|
694
|
+
}
|
|
695
|
+
if (detail.run.status === 'cancelled') {
|
|
696
|
+
return { runId, state: 'blocked', nextAction: 'run was cancelled; create or resume a different run', runStatus: detail.run.status, workflowStatus: workflow?.status ?? '' };
|
|
697
|
+
}
|
|
698
|
+
if (detail.run.status === 'paused') {
|
|
699
|
+
return { runId, state: 'blocked', nextAction: 'inspect blocking event and decide whether to create a follow-up run', runStatus: detail.run.status, workflowStatus: workflow?.status ?? '' };
|
|
700
|
+
}
|
|
701
|
+
const blocked = [...events].reverse().find((event) => event.type === 'pipeline_blocked');
|
|
702
|
+
if (blocked) {
|
|
703
|
+
return {
|
|
704
|
+
runId,
|
|
705
|
+
state: 'blocked',
|
|
706
|
+
nextAction: 'inspect blocking event and decide whether to create a follow-up run',
|
|
707
|
+
runStatus: detail.run.status,
|
|
708
|
+
workflowStatus: workflow?.status ?? '',
|
|
709
|
+
latestBlockingEvent: blocked,
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
if (workflow?.status === 'ERROR') {
|
|
713
|
+
return { runId, state: 'failed', nextAction: 'inspect get_run_events/get_run_log', runStatus: detail.run.status, workflowStatus: workflow.status };
|
|
714
|
+
}
|
|
715
|
+
if (workflow?.status === 'SUCCESS') {
|
|
716
|
+
return { runId, state: 'completed', nextAction: 'none', runStatus: detail.run.status, workflowStatus: workflow.status };
|
|
717
|
+
}
|
|
718
|
+
return {
|
|
719
|
+
runId,
|
|
720
|
+
state: 'running',
|
|
721
|
+
nextAction: 'wait_for_run again or inspect get_run_digest',
|
|
722
|
+
runStatus: detail.run.status,
|
|
723
|
+
workflowStatus: workflow?.status ?? '',
|
|
724
|
+
};
|
|
725
|
+
}
|
|
293
726
|
listInbox(filter) {
|
|
294
727
|
return this.inbox.listInbox(filter);
|
|
295
728
|
}
|
|
@@ -403,37 +836,150 @@ let TaskControlPlaneApiService = class TaskControlPlaneApiService {
|
|
|
403
836
|
return result;
|
|
404
837
|
}
|
|
405
838
|
simulateRoute(input) {
|
|
406
|
-
|
|
407
|
-
return {
|
|
839
|
+
return this.resolveRouteDecision({
|
|
408
840
|
title: input.title,
|
|
409
841
|
repo: input.repo ?? '',
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
842
|
+
playbookId: input.playbookId,
|
|
843
|
+
pipelineId: input.pipeline,
|
|
844
|
+
params: input.params,
|
|
845
|
+
source: input.pipeline ? 'explicit' : 'deterministic-installed-playbook',
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
async routeForRun(run) {
|
|
849
|
+
if (isRouteDecision(run.data.route_decision))
|
|
850
|
+
return run.data.route_decision;
|
|
851
|
+
return this.resolveRouteDecision({
|
|
852
|
+
title: typeof run.data.title === 'string' ? run.data.title : 'Run',
|
|
853
|
+
repo: Array.isArray(run.data.repos) && typeof run.data.repos[0] === 'string' ? run.data.repos[0] : '',
|
|
854
|
+
description: typeof run.data.description === 'string' ? run.data.description : '',
|
|
855
|
+
scope: typeof run.data.scope === 'string' ? run.data.scope : '',
|
|
856
|
+
playbookId: typeof run.data.playbook_id === 'string' ? run.data.playbook_id : undefined,
|
|
857
|
+
pipelineId: typeof run.data.pipeline_id === 'string' ? run.data.pipeline_id : undefined,
|
|
858
|
+
params: run.data.params,
|
|
859
|
+
source: run.data.pipeline_id ? 'explicit' : 'deterministic-installed-playbook',
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
async resolveRouteDecision(input) {
|
|
863
|
+
const params = normalizeParams(input.params);
|
|
864
|
+
const executionProfile = normalizeExecutionProfile(input.executionProfile);
|
|
865
|
+
const playbook = await this.playbooks.resolvePlaybook(input.playbookId);
|
|
866
|
+
const pipeline = input.pipelineId
|
|
867
|
+
? await this.playbooks.resolvePipeline({ playbookId: playbook.id, pipelineId: input.pipelineId })
|
|
868
|
+
: await this.resolveAutoPipeline(playbook.id, [input.title, input.description, input.scope].join(' '));
|
|
869
|
+
const roleBindings = await this.resolveRouteRoles(playbook.id, pipeline, executionProfile);
|
|
870
|
+
return {
|
|
871
|
+
playbookId: playbook.id,
|
|
872
|
+
pipelineId: pipeline.pipelineId,
|
|
873
|
+
pipelineRowId: pipeline.id,
|
|
874
|
+
source: input.source,
|
|
875
|
+
roles: roleBindings.map((binding) => binding.roleId),
|
|
876
|
+
requiredRoles: pipeline.requiredRoles,
|
|
877
|
+
optionalRoles: pipeline.optionalRoles,
|
|
878
|
+
routeGates: normalizeRouteGates(pipeline.routeGates),
|
|
879
|
+
executionPolicy: pipeline.executionPolicy,
|
|
880
|
+
executionProfile,
|
|
881
|
+
roleBindings,
|
|
882
|
+
params,
|
|
420
883
|
};
|
|
421
884
|
}
|
|
885
|
+
async resolveAutoPipeline(playbookId, text) {
|
|
886
|
+
const pipelines = (await this.playbooks.listPipelines())
|
|
887
|
+
.filter((pipeline) => pipeline.playbookId === playbookId)
|
|
888
|
+
.sort((left, right) => left.id.localeCompare(right.id));
|
|
889
|
+
if (pipelines.length === 0) {
|
|
890
|
+
throw new ControlPlaneError('ROW_NOT_FOUND', `no installed pipelines found for playbook ${playbookId}`);
|
|
891
|
+
}
|
|
892
|
+
const scored = pipelines
|
|
893
|
+
.map((pipeline) => ({ pipeline, score: routeScore(pipeline, text) }))
|
|
894
|
+
.sort((left, right) => right.score - left.score || left.pipeline.id.localeCompare(right.pipeline.id));
|
|
895
|
+
const best = scored[0];
|
|
896
|
+
const second = scored[1];
|
|
897
|
+
if (!best || best.score <= 0) {
|
|
898
|
+
throw new ControlPlaneError('VALIDATION_FAILURE', `unable to choose a pipeline confidently; provide pipelineId`);
|
|
899
|
+
}
|
|
900
|
+
if (second?.score === best.score) {
|
|
901
|
+
throw new ControlPlaneError('VALIDATION_FAILURE', `ambiguous pipeline route; provide pipelineId`);
|
|
902
|
+
}
|
|
903
|
+
return best.pipeline;
|
|
904
|
+
}
|
|
905
|
+
async resolveRouteRoles(playbookId, pipeline, executionProfile) {
|
|
906
|
+
const roles = (await this.roles.listRoles()).filter((role) => role.playbookId === playbookId);
|
|
907
|
+
const byPlaybookRole = new Map(roles.map((role) => [role.playbookRoleId || role.name, role]));
|
|
908
|
+
// The route selects WHICH roles a pipeline binds (capability handles the data-driven engine
|
|
909
|
+
// resolves). Order is no longer load-bearing — the data-driven template owns node sequencing — so
|
|
910
|
+
// alternative-group selections simply append (the old `insertBeforeFirstDeveloperRole` phase-order
|
|
911
|
+
// hardcode is removed with the rest of the hardcoded engine, plan 0015 slice 3).
|
|
912
|
+
const selected = [...pipeline.requiredRoles];
|
|
913
|
+
for (const group of pipeline.alternativeRoles) {
|
|
914
|
+
const match = group.roles.find((roleId) => byPlaybookRole.has(roleId));
|
|
915
|
+
if (!match) {
|
|
916
|
+
throw new ControlPlaneError('VALIDATION_FAILURE', `pipeline ${pipeline.pipelineId} alternative group ${group.group_id} has no installed role`);
|
|
917
|
+
}
|
|
918
|
+
if (!selected.includes(match))
|
|
919
|
+
selected.push(match);
|
|
920
|
+
}
|
|
921
|
+
for (const roleId of selected) {
|
|
922
|
+
if (!byPlaybookRole.has(roleId)) {
|
|
923
|
+
throw new ControlPlaneError('VALIDATION_FAILURE', `pipeline ${pipeline.pipelineId} references missing installed role: ${roleId}`);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
return selected.map((roleId) => {
|
|
927
|
+
const role = byPlaybookRole.get(roleId);
|
|
928
|
+
assertProductionRunnerBinding(role.runner, 'playbook', roleId);
|
|
929
|
+
const resolved = resolveRunnerForProfile(role.runner, executionProfile);
|
|
930
|
+
assertProductionRunnerBinding(resolved.runnerId, resolved.source, roleId);
|
|
931
|
+
assertRunnerAvailable(resolved.runnerId, executionProfile, roleId);
|
|
932
|
+
return {
|
|
933
|
+
roleId,
|
|
934
|
+
rowId: role.id,
|
|
935
|
+
modelLevel: role.modelLevel,
|
|
936
|
+
runnerId: role.runner,
|
|
937
|
+
resolvedRunnerId: resolved.runnerId,
|
|
938
|
+
runnerSource: resolved.source,
|
|
939
|
+
};
|
|
940
|
+
});
|
|
941
|
+
}
|
|
422
942
|
getPrReadiness(input) {
|
|
423
943
|
return this.prReadiness.getPrReadiness(input);
|
|
424
944
|
}
|
|
425
945
|
listPrFeedback(input) {
|
|
426
946
|
return this.prReadiness.listPrFeedback(input);
|
|
427
947
|
}
|
|
948
|
+
getAgentActivity(runId) {
|
|
949
|
+
return this.observability.getAgentActivity(runId);
|
|
950
|
+
}
|
|
951
|
+
getAgentAttempts(runId) {
|
|
952
|
+
return this.observability.listAgentAttempts(runId);
|
|
953
|
+
}
|
|
954
|
+
getAgentLog(input) {
|
|
955
|
+
return this.observability.getAgentLog(input);
|
|
956
|
+
}
|
|
957
|
+
readAgentOutputEvents(input) {
|
|
958
|
+
return this.observability.readAgentOutputEvents(input);
|
|
959
|
+
}
|
|
960
|
+
watchAgentActivity(input) {
|
|
961
|
+
return this.observability.watchAgentActivity(input);
|
|
962
|
+
}
|
|
963
|
+
watchAgentOutput(input) {
|
|
964
|
+
return this.observability.watchAgentOutput(input);
|
|
965
|
+
}
|
|
428
966
|
};
|
|
429
967
|
TaskControlPlaneApiService = __decorate([
|
|
430
968
|
Injectable(),
|
|
969
|
+
__param(0, Inject(RunService)),
|
|
970
|
+
__param(1, Inject(InboxService)),
|
|
971
|
+
__param(2, Inject(RolesService)),
|
|
972
|
+
__param(3, Inject(PlaybooksService)),
|
|
973
|
+
__param(4, Inject(PipelineService)),
|
|
974
|
+
__param(5, Inject(DbosService)),
|
|
975
|
+
__param(6, Inject(AgentObservabilityService)),
|
|
431
976
|
__metadata("design:paramtypes", [RunService,
|
|
432
977
|
InboxService,
|
|
433
978
|
RolesService,
|
|
434
979
|
PlaybooksService,
|
|
435
980
|
PipelineService,
|
|
436
981
|
DbosService,
|
|
982
|
+
AgentObservabilityService,
|
|
437
983
|
PrReadinessService])
|
|
438
984
|
], TaskControlPlaneApiService);
|
|
439
985
|
export { TaskControlPlaneApiService };
|