@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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host daemon runtime file (`host.json`) — the tracked identity of the long-lived Revo/NestJS
|
|
3
|
+
* host daemon, the single DBOS owner (ADR 0006). It lives beside the standalone `runtime.json`
|
|
4
|
+
* in the profile data dir but is a SEPARATE file: the standalone daemon and the host daemon have
|
|
5
|
+
* independent lifecycles, so conflating them would let one's stale pid mask the other's state.
|
|
6
|
+
*
|
|
7
|
+
* Shape is intentionally minimal — only what `ensureHost`/`status`/clients need: the pid to prove
|
|
8
|
+
* liveness, the GraphQL port that is the client transport, and the profile/startedAt for display
|
|
9
|
+
* and compare-and-delete identity. Standalone HTTP/pg ports stay in `runtime.json` (readRuntime).
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
import { getConfig, isAlive, profileDataDir, PROFILES } from '../config.js';
|
|
15
|
+
let cachedCodeVersion;
|
|
16
|
+
/**
|
|
17
|
+
* This build's package version (e.g. `0.1.0-alpha.7`). Recorded in host.json so `ensureHost`/`doctor`
|
|
18
|
+
* can detect a stale daemon running a DIFFERENT build than the current install (slice 139). A `0.0.0`
|
|
19
|
+
* dev checkout does not change across rebuilds, so dev relies on `revo restart`; released builds differ.
|
|
20
|
+
*/
|
|
21
|
+
export function hostCodeVersion() {
|
|
22
|
+
if (cachedCodeVersion === undefined) {
|
|
23
|
+
try {
|
|
24
|
+
const pkgPath = fileURLToPath(new URL('../../package.json', import.meta.url));
|
|
25
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
26
|
+
cachedCodeVersion = typeof pkg.version === 'string' ? pkg.version : 'unknown';
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
cachedCodeVersion = 'unknown';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return cachedCodeVersion;
|
|
33
|
+
}
|
|
34
|
+
export function hostRuntimeFile() {
|
|
35
|
+
return join(getConfig().dataDir, 'host.json');
|
|
36
|
+
}
|
|
37
|
+
export function readHostRuntime() {
|
|
38
|
+
return readHostRuntimeAt(hostRuntimeFile());
|
|
39
|
+
}
|
|
40
|
+
/** Read+parse a host.json at an ARBITRARY path (a sibling profile's). Null when absent/corrupt. */
|
|
41
|
+
export function readHostRuntimeAt(file) {
|
|
42
|
+
if (!existsSync(file))
|
|
43
|
+
return null;
|
|
44
|
+
try {
|
|
45
|
+
return JSON.parse(readFileSync(file, 'utf8'));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Live tracked daemon pids across ALL profiles (slice 140 Phase 2). The rogue reaper must protect
|
|
53
|
+
* EVERY profile's daemon tree, not just the active one — else `revo stop --all --profile default`
|
|
54
|
+
* would SIGKILL a live `dev` daemon (and its bridges), aborting that profile's in-flight DBOS work.
|
|
55
|
+
* Band-default dirs only (a custom REVO_DATA_DIR layout isn't enumerable; documented in profileDataDir).
|
|
56
|
+
*/
|
|
57
|
+
export function allTrackedHostPids() {
|
|
58
|
+
const pids = [];
|
|
59
|
+
for (const profile of Object.keys(PROFILES)) {
|
|
60
|
+
const runtime = readHostRuntimeAt(join(profileDataDir(profile), 'host.json'));
|
|
61
|
+
if (runtime && isAlive(runtime.pid))
|
|
62
|
+
pids.push(runtime.pid);
|
|
63
|
+
}
|
|
64
|
+
return pids;
|
|
65
|
+
}
|
|
66
|
+
export function writeHostRuntime(state) {
|
|
67
|
+
writeFileSync(hostRuntimeFile(), JSON.stringify(state, null, 2));
|
|
68
|
+
}
|
|
69
|
+
export function removeHostRuntime() {
|
|
70
|
+
const file = hostRuntimeFile();
|
|
71
|
+
if (existsSync(file))
|
|
72
|
+
rmSync(file);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Remove `host.json` ONLY if the file on disk still matches the snapshot (same pid AND startedAt).
|
|
76
|
+
* A replaced file (a concurrently-started daemon) or an already-removed file is a safe no-op — so
|
|
77
|
+
* cleanup can never delete a runtime that belongs to another daemon (compare-and-delete).
|
|
78
|
+
*/
|
|
79
|
+
export function removeHostRuntimeIfMatches(snapshot) {
|
|
80
|
+
const current = readHostRuntime();
|
|
81
|
+
if (current?.pid === snapshot.pid && current?.startedAt === snapshot.startedAt) {
|
|
82
|
+
removeHostRuntime();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** True when `host.json` records a daemon whose pid is still alive (liveness, not health). */
|
|
86
|
+
export function isHostRunning() {
|
|
87
|
+
const runtime = readHostRuntime();
|
|
88
|
+
return runtime !== null && isAlive(runtime.pid);
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=host-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-runtime.js","sourceRoot":"","sources":["../../src/host/host-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,QA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AAC,IAAI,CAAC,QAAQ,CAAkB,EAAE,CAAC;QAC7D,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;QAC9E,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAuB;IACtD,aAAa,CAAC,eAAe,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;IAC/B,IAAI,UAAU,CAAC,IAAI,CAAC;QAAE,MAAM,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,QAA6B;IACtE,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,IAAI,OAAO,EAAE,GAAG,KAAK,QAAQ,CAAC,GAAG,IAAI,OAAO,EAAE,SAAS,KAAK,QAAQ,CAAC,SAAS,EAAE,CAAC;QAC/E,iBAAiB,EAAE,CAAC;IACtB,CAAC;AACH,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,OAAO,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -7,6 +7,9 @@ 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
|
/**
|
|
11
14
|
* HostLifecycle — OnApplicationBootstrap / OnApplicationShutdown.
|
|
12
15
|
*
|
|
@@ -23,17 +26,23 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
23
26
|
* the daemon is detached+unref'd and is a shared, long-lived process; subsequent
|
|
24
27
|
* `revo dev:status <id>` invocations must find the same daemon + embedded Postgres.
|
|
25
28
|
*/
|
|
26
|
-
import { Injectable } from '@nestjs/common';
|
|
29
|
+
import { Inject, Injectable, Optional } from '@nestjs/common';
|
|
27
30
|
import { DbosService } from '../engine/dbos.service.js';
|
|
28
31
|
import { ensureRevisium, readPostmasterPgPort } from './ensure-revisium.js';
|
|
29
32
|
import { dbosSystemDatabaseUrl, ensurePostgres } from '../engine/ensure-postgres.js';
|
|
33
|
+
import { TaskControlPlaneApiService } from '../task-control-plane/task-control-plane-api.service.js';
|
|
30
34
|
function isMcpStdioHost() {
|
|
31
35
|
return process.env.REVO_MCP_STDIO === '1';
|
|
32
36
|
}
|
|
37
|
+
function keepControlPlaneBootstrapDependency(_api) {
|
|
38
|
+
// The constructor dependency forces the control-plane provider graph to instantiate
|
|
39
|
+
// before DBOS.launch(); pipeline registration must precede launch.
|
|
40
|
+
}
|
|
33
41
|
let HostLifecycle = class HostLifecycle {
|
|
34
42
|
dbosService;
|
|
35
|
-
constructor(dbosService) {
|
|
43
|
+
constructor(dbosService, taskControlPlaneApi) {
|
|
36
44
|
this.dbosService = dbosService;
|
|
45
|
+
keepControlPlaneBootstrapDependency(taskControlPlaneApi);
|
|
37
46
|
}
|
|
38
47
|
async onApplicationBootstrap() {
|
|
39
48
|
// Step 1: Ensure Revisium daemon is running (auto-start if absent).
|
|
@@ -69,7 +78,11 @@ let HostLifecycle = class HostLifecycle {
|
|
|
69
78
|
};
|
|
70
79
|
HostLifecycle = __decorate([
|
|
71
80
|
Injectable(),
|
|
72
|
-
|
|
81
|
+
__param(0, Inject(DbosService)),
|
|
82
|
+
__param(1, Optional()),
|
|
83
|
+
__param(1, Inject(TaskControlPlaneApiService)),
|
|
84
|
+
__metadata("design:paramtypes", [DbosService,
|
|
85
|
+
TaskControlPlaneApiService])
|
|
73
86
|
], HostLifecycle);
|
|
74
87
|
export { HostLifecycle };
|
|
75
88
|
//# sourceMappingURL=host.lifecycle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.lifecycle.js","sourceRoot":"","sources":["../../src/host/host.lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host.lifecycle.js","sourceRoot":"","sources":["../../src/host/host.lifecycle.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAiD,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yDAAyD,CAAC;AAErG,SAAS,cAAc;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,GAAG,CAAC;AAC5C,CAAC;AAED,SAAS,mCAAmC,CAAC,IAA4C;IACvF,oFAAoF;IACpF,mEAAmE;AACrE,CAAC;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAa;IAEgB;IADxC,YACwC,WAAwB,EAG9D,mBAAgD;QAHV,gBAAW,GAAX,WAAW,CAAa;QAK9D,mCAAmC,CAAC,mBAAmB,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,sBAAsB;QAC1B,oEAAoE;QACpE,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
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemon singleton gate (slice 139, hardened slice 140). Exactly ONE host daemon per profile may own —
|
|
3
|
+
* and therefore poll — the `dev-tasks` WorkflowQueue. Ownership is a connection-scoped Postgres
|
|
4
|
+
* ADVISORY LOCK:
|
|
5
|
+
*
|
|
6
|
+
* - Advisory locks are DATABASE-scoped, NOT cluster-global (PG: "Advisory locks are local to each
|
|
7
|
+
* database"). The gate works only because every contending daemon connects to the SAME fixed
|
|
8
|
+
* maintenance `postgres` database, so they all contend in one shared per-database lock namespace.
|
|
9
|
+
* We use `postgres` because it exists right after `ensureRevisium` — before the per-profile `dbos`
|
|
10
|
+
* database is created — letting the daemon decide "am I the owner?" BEFORE DBOS.launch() and before
|
|
11
|
+
* the queue worker starts polling. INVARIANT: all contenders MUST take this lock on the identical
|
|
12
|
+
* database. NEVER probe this lock key from another database (e.g. `dbos`) expecting a conflict — it
|
|
13
|
+
* would silently NOT conflict and could mint a second owner.
|
|
14
|
+
* - The key is a FULL 64-bit value derived from the lock name via md5 (`('x'||substr(md5(name),1,16))
|
|
15
|
+
* ::bit(64)::bigint`), not `hashtext(...)::bigint` — `hashtext` is only 32 bits, so distinct
|
|
16
|
+
* profile names could hash-collide and wrongly block a different profile's daemon. md5's 64 bits
|
|
17
|
+
* make a cross-profile collision negligible.
|
|
18
|
+
* - The lock is held on a DEDICATED, long-lived connection for the daemon's whole life. It
|
|
19
|
+
* auto-releases when that connection ends — on graceful shutdown OR on a hard crash — so a dead
|
|
20
|
+
* owner never blocks a successor. (Verified by experiment: a second connection's
|
|
21
|
+
* `pg_try_advisory_lock` returns false while held, and true again once the holder disconnects.)
|
|
22
|
+
*
|
|
23
|
+
* A daemon that does NOT win the lock lost a concurrent cold-start race (e.g. several `revo mcp`
|
|
24
|
+
* bridges spawning at once) and exits; ensureHost then attaches to the winner via host.json. This
|
|
25
|
+
* closes the "concurrent cold-start spawns multiple daemons" hole that let stale daemons accumulate.
|
|
26
|
+
* It does NOT, however, coordinate LEGACY hosts that predate the lock — those are detected by the
|
|
27
|
+
* `pg_stat_activity` census (queue-poller-census.ts) and evicted by `revo doctor`/`stop` (slice 140).
|
|
28
|
+
*/
|
|
29
|
+
import pg from 'pg';
|
|
30
|
+
/**
|
|
31
|
+
* SQL expression that turns the text lock name (bound as `$1`) into a full 64-bit advisory-lock key.
|
|
32
|
+
* `md5` yields 128 bits of hex; the first 16 hex chars are reinterpreted as a signed bigint. Shared by
|
|
33
|
+
* lock + unlock so they always target the identical key.
|
|
34
|
+
*/
|
|
35
|
+
const LOCK_KEY_EXPR = `('x' || substr(md5($1), 1, 16))::bit(64)::bigint`;
|
|
36
|
+
/** Stable advisory-lock identity for a profile's dev-tasks queue ownership. */
|
|
37
|
+
export function ownershipLockName(profile) {
|
|
38
|
+
return `revo:dev-tasks:${profile}`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Try to become the sole dev-tasks owner for `profile`. Returns `{owned:false}` (and closes its probe
|
|
42
|
+
* connection) when another live daemon already holds it. When `{owned:true}`, the returned connection
|
|
43
|
+
* stays open holding the lock until `release()` (or process death) frees it.
|
|
44
|
+
*/
|
|
45
|
+
export async function acquireQueueOwnership(profile, pgPort, deps = {}) {
|
|
46
|
+
const url = `postgresql://revisium:password@localhost:${pgPort}/postgres`;
|
|
47
|
+
const name = ownershipLockName(profile);
|
|
48
|
+
const createClient = deps.createClient ?? ((u) => new pg.Client(u));
|
|
49
|
+
const client = createClient(url);
|
|
50
|
+
await client.connect();
|
|
51
|
+
const res = await client.query(`SELECT pg_try_advisory_lock(${LOCK_KEY_EXPR}) AS owned`, [name]);
|
|
52
|
+
const owned = res.rows[0]?.owned === true;
|
|
53
|
+
if (!owned) {
|
|
54
|
+
await client.end().catch(() => undefined);
|
|
55
|
+
return { owned: false, release: async () => undefined };
|
|
56
|
+
}
|
|
57
|
+
// Keep `client` reachable (via this closure) so its socket — and the lock — is held for the daemon's
|
|
58
|
+
// life. The OS frees the connection (and thus the lock) on crash; release() does it gracefully.
|
|
59
|
+
const release = async () => {
|
|
60
|
+
try {
|
|
61
|
+
await client.query(`SELECT pg_advisory_unlock(${LOCK_KEY_EXPR})`, [name]);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// best-effort; ending the connection releases the lock regardless
|
|
65
|
+
}
|
|
66
|
+
await client.end().catch(() => undefined);
|
|
67
|
+
};
|
|
68
|
+
return { owned: true, release };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=queue-ownership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-ownership.js","sourceRoot":"","sources":["../../src/host/queue-ownership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB;;;;GAIG;AACH,MAAM,aAAa,GAAG,kDAAkD,CAAC;AAqBzE,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,kBAAkB,OAAO,EAAE,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAe,EACf,MAAc,EACd,OAA6B,EAAE;IAE/B,MAAM,GAAG,GAAG,4CAA4C,MAAM,WAAW,CAAC;IAC1E,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAA+B,CAAC,CAAC;IAC1G,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IAEvB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,+BAA+B,aAAa,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACjG,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAE1C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC1C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;IAC1D,CAAC;IAED,qGAAqG;IACrG,gGAAgG;IAChG,MAAM,OAAO,GAAG,KAAK,IAAmB,EAAE;QACxC,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,KAAK,CAAC,6BAA6B,aAAa,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5E,CAAC;QAAC,MAAM,CAAC;YACP,kEAAkE;QACpE,CAAC;QACD,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue-poller census (slice 140, Part A Layer 3 — detection half, pure).
|
|
3
|
+
*
|
|
4
|
+
* The advisory lock (queue-ownership.ts) only coordinates daemons that CALL it. A legacy/old-version
|
|
5
|
+
* host that predates the lock — or a `revo mcp` from before the thin-bridge era that is itself a full
|
|
6
|
+
* DBOS host — still connects to the `dbos` database and polls the `dev-tasks` queue, ignoring the lock.
|
|
7
|
+
* It has no inbound listening port, so the port-based `revo stop`/`doctor` cannot see it. The ONE
|
|
8
|
+
* control plane shared with code we do not control is the database itself: every DBOS system-DB
|
|
9
|
+
* connection is stamped `application_name = dbos_transact_<executorID>_<appVersion>` (visible in
|
|
10
|
+
* `pg_stat_activity`). A connection whose executor id is NOT this profile's pinned owner is a rogue.
|
|
11
|
+
*
|
|
12
|
+
* This module is the pure classifier (unit-tested); the live `pg_stat_activity` query lives in the IO
|
|
13
|
+
* layer (lifecycle.ts). Classification keys on the executor-id segment ONLY: `application_name` is
|
|
14
|
+
* capped at 63 bytes by Postgres, so a long suffix can truncate the appVersion — we therefore never
|
|
15
|
+
* trust the parsed version for identity (the owner's true version comes from host.json elsewhere).
|
|
16
|
+
*/
|
|
17
|
+
const STAMP_PREFIX = 'dbos_transact_';
|
|
18
|
+
/**
|
|
19
|
+
* Parse the executor id out of `dbos_transact_<executorID>_<appVersion>` — the segment between the
|
|
20
|
+
* fixed prefix and the LAST underscore (the appVersion separator). Returns null when the string is not
|
|
21
|
+
* a DBOS stamp. Robust to a truncated/empty appVersion segment (we only need the executor id); pinned
|
|
22
|
+
* revo executor ids (`revo-<profile>`) and `local` contain no underscore, so the last-underscore split
|
|
23
|
+
* is unambiguous for the identities we classify.
|
|
24
|
+
*/
|
|
25
|
+
export function parseExecutorId(applicationName) {
|
|
26
|
+
if (!applicationName.startsWith(STAMP_PREFIX))
|
|
27
|
+
return null;
|
|
28
|
+
const rest = applicationName.slice(STAMP_PREFIX.length); // <executorID>_<appVersion>
|
|
29
|
+
const sep = rest.lastIndexOf('_');
|
|
30
|
+
const executorId = sep < 0 ? rest : rest.slice(0, sep);
|
|
31
|
+
return executorId.length > 0 ? executorId : null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Foreign DBOS pollers among `backends` — any connection whose parsed executor id differs from the
|
|
35
|
+
* profile's pinned owner. Report-only data; the caller decides how to surface or evict it.
|
|
36
|
+
*/
|
|
37
|
+
export function classifyQueuePollerRogues(backends, ownerExecutorId) {
|
|
38
|
+
const rogues = [];
|
|
39
|
+
for (const b of backends) {
|
|
40
|
+
const executorId = parseExecutorId(b.applicationName);
|
|
41
|
+
if (executorId === null || executorId === ownerExecutorId)
|
|
42
|
+
continue;
|
|
43
|
+
rogues.push({ pid: b.pid, executorId, applicationName: b.applicationName, backendStart: b.backendStart });
|
|
44
|
+
}
|
|
45
|
+
return rogues;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=queue-poller-census.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-poller-census.js","sourceRoot":"","sources":["../../src/host/queue-poller-census.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAmBtC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,eAAuB;IACrD,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3D,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,4BAA4B;IACrF,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAsC,EACtC,eAAuB;IAEvB,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QACtD,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,eAAe;YAAE,SAAS;QACpE,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC,eAAe,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;IAC5G,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ValidationPipe } from '@nestjs/common';
|
|
2
|
+
import { NestFactory } from '@nestjs/core';
|
|
3
|
+
import { addWsServer } from '../api/graphql-api/graphql-ws/ws.js';
|
|
4
|
+
import { isPortFree, resolveDefaultGraphqlPort } from '../config.js';
|
|
5
|
+
import { GraphqlHostModule } from './graphql-host.module.js';
|
|
6
|
+
export const DEFAULT_GRAPHQL_HOST = '127.0.0.1';
|
|
7
|
+
const defaultDeps = {
|
|
8
|
+
isPortFree,
|
|
9
|
+
};
|
|
10
|
+
function parsePort(raw) {
|
|
11
|
+
if (!raw)
|
|
12
|
+
return resolveDefaultGraphqlPort();
|
|
13
|
+
const candidate = raw.trim();
|
|
14
|
+
if (!/^\d+$/.test(candidate)) {
|
|
15
|
+
throw new TypeError(`Invalid GraphQL port: ${raw}`);
|
|
16
|
+
}
|
|
17
|
+
const port = Number(candidate);
|
|
18
|
+
if (!Number.isInteger(port) || port <= 0 || port > 65_535) {
|
|
19
|
+
throw new TypeError(`Invalid GraphQL port: ${raw}`);
|
|
20
|
+
}
|
|
21
|
+
return port;
|
|
22
|
+
}
|
|
23
|
+
export function resolveGraphqlHostOptions(options = {}) {
|
|
24
|
+
const host = options.host ?? process.env.REVO_GRAPHQL_HOST ?? DEFAULT_GRAPHQL_HOST;
|
|
25
|
+
if (host !== DEFAULT_GRAPHQL_HOST) {
|
|
26
|
+
throw new TypeError(`GraphQL host must bind ${DEFAULT_GRAPHQL_HOST} in v1; received ${host}`);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
host,
|
|
30
|
+
port: options.port ?? parsePort(process.env.REVO_GRAPHQL_PORT),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export async function startGraphqlHost(options = {}, deps = defaultDeps) {
|
|
34
|
+
const resolved = resolveGraphqlHostOptions(options);
|
|
35
|
+
if (resolved.host !== DEFAULT_GRAPHQL_HOST) {
|
|
36
|
+
throw new Error(`GraphQL host must bind ${DEFAULT_GRAPHQL_HOST} in v1; received ${resolved.host}`);
|
|
37
|
+
}
|
|
38
|
+
if (!(await deps.isPortFree(resolved.port))) {
|
|
39
|
+
throw new Error(`GraphQL port ${resolved.port} is already in use; set REVO_GRAPHQL_PORT or --port to a free isolated port.`);
|
|
40
|
+
}
|
|
41
|
+
const app = await NestFactory.create(GraphqlHostModule, { logger: ['error', 'warn'] });
|
|
42
|
+
app.useGlobalPipes(new ValidationPipe({ transform: true }));
|
|
43
|
+
await app.listen(resolved.port, resolved.host);
|
|
44
|
+
const ws = addWsServer(app);
|
|
45
|
+
const close = app.close.bind(app);
|
|
46
|
+
app.close = async () => {
|
|
47
|
+
await ws.dispose();
|
|
48
|
+
await close();
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
app,
|
|
52
|
+
...resolved,
|
|
53
|
+
url: `http://${resolved.host}:${resolved.port}/graphql`,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=graphql-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-host.js","sourceRoot":"","sources":["../../src/http/graphql-host.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAkBhD,MAAM,WAAW,GAAoB;IACnC,UAAU;CACX,CAAC;AAEF,SAAS,SAAS,CAAC,GAA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CAAC,CAAC;IACrG,CAAC;IACD,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACb,gBAAgB,QAAQ,CAAC,IAAI,8EAA8E,CAC5G,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IACvF,GAAG,CAAC,cAAc,CAAC,IAAI,cAAc,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5D,MAAM,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,GAAG,CAAC,KAAK,GAAG,KAAK,IAAI,EAAE;QACrB,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,KAAK,EAAE,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO;QACL,GAAG;QACH,GAAG,QAAQ;QACX,GAAG,EAAE,UAAU,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,UAAU;KACxD,CAAC;AACJ,CAAC"}
|
|
@@ -5,17 +5,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { Module } from '@nestjs/common';
|
|
8
|
+
import { GraphqlApiModule } from '../api/graphql-api/graphql-api.module.js';
|
|
9
|
+
import { HostLifecycle } from '../host/host.lifecycle.js';
|
|
8
10
|
import { TaskControlPlaneModule } from '../task-control-plane/task-control-plane.module.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
// The daemon serves BOTH front doors (ADR 0006): GraphQL (frontend) + MCP (agents), over one host
|
|
12
|
+
// process that is the single DBOS owner. The MCP server is built directly from TaskControlPlaneApi-
|
|
13
|
+
// Service (see daemon.ts) — no separate McpModule in the graph.
|
|
14
|
+
let GraphqlHostModule = class GraphqlHostModule {
|
|
12
15
|
};
|
|
13
|
-
|
|
16
|
+
GraphqlHostModule = __decorate([
|
|
14
17
|
Module({
|
|
15
|
-
imports: [TaskControlPlaneModule],
|
|
16
|
-
providers: [
|
|
17
|
-
exports: [McpFacadeService, McpStdioService],
|
|
18
|
+
imports: [TaskControlPlaneModule, GraphqlApiModule],
|
|
19
|
+
providers: [HostLifecycle],
|
|
18
20
|
})
|
|
19
|
-
],
|
|
20
|
-
export {
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
], GraphqlHostModule);
|
|
22
|
+
export { GraphqlHostModule };
|
|
23
|
+
//# sourceMappingURL=graphql-host.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-host.module.js","sourceRoot":"","sources":["../../src/http/graphql-host.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAE5F,kGAAkG;AAClG,oGAAoG;AACpG,gEAAgE;AAKzD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,iBAAiB;IAJ7B,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,sBAAsB,EAAE,gBAAgB,CAAC;QACnD,SAAS,EAAE,CAAC,aAAa,CAAC;KAC3B,CAAC;GACW,iBAAiB,CAAG"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { getOperationAST, parse } from 'graphql';
|
|
2
|
+
const ANONYMOUS_OPERATION = 'anonymous';
|
|
3
|
+
const OVERFLOW_OPERATION_LABEL = { operationName: 'other', operationType: 'unknown' };
|
|
4
|
+
export const MAX_GRAPHQL_OPERATION_LABELS = 256;
|
|
5
|
+
function key(label) {
|
|
6
|
+
return `${label.operationType}:${label.operationName}`;
|
|
7
|
+
}
|
|
8
|
+
function isExecutionResult(value) {
|
|
9
|
+
return typeof value === 'object' && value !== null && ('data' in value || 'errors' in value);
|
|
10
|
+
}
|
|
11
|
+
function resultHasErrors(result) {
|
|
12
|
+
return isExecutionResult(result) && Array.isArray(result.errors) && result.errors.length > 0;
|
|
13
|
+
}
|
|
14
|
+
export function identifyGraphqlOperation(params) {
|
|
15
|
+
const query = params.query;
|
|
16
|
+
if (!query) {
|
|
17
|
+
return { operationName: params.operationName ?? ANONYMOUS_OPERATION, operationType: 'unknown' };
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const document = parse(query);
|
|
21
|
+
const operation = getOperationAST(document, params.operationName);
|
|
22
|
+
return {
|
|
23
|
+
operationName: params.operationName ?? operation?.name?.value ?? ANONYMOUS_OPERATION,
|
|
24
|
+
operationType: operation?.operation ?? 'unknown',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return { operationName: params.operationName ?? ANONYMOUS_OPERATION, operationType: 'unknown' };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class GraphqlOperationMetrics {
|
|
32
|
+
records = new Map();
|
|
33
|
+
record(input) {
|
|
34
|
+
let label = { operationName: input.operationName, operationType: input.operationType };
|
|
35
|
+
const labelKey = key(label);
|
|
36
|
+
const overflowKey = key(OVERFLOW_OPERATION_LABEL);
|
|
37
|
+
const leavesRoomForOverflow = this.records.size < MAX_GRAPHQL_OPERATION_LABELS - (this.records.has(overflowKey) ? 0 : 1);
|
|
38
|
+
if (!this.records.has(labelKey) && !leavesRoomForOverflow) {
|
|
39
|
+
label = OVERFLOW_OPERATION_LABEL;
|
|
40
|
+
}
|
|
41
|
+
const current = this.records.get(key(label)) ?? {
|
|
42
|
+
...label,
|
|
43
|
+
count: 0,
|
|
44
|
+
errorCount: 0,
|
|
45
|
+
totalDurationMs: 0,
|
|
46
|
+
maxDurationMs: 0,
|
|
47
|
+
};
|
|
48
|
+
current.count += 1;
|
|
49
|
+
current.errorCount += input.errored ? 1 : 0;
|
|
50
|
+
current.totalDurationMs += input.durationMs;
|
|
51
|
+
current.maxDurationMs = Math.max(current.maxDurationMs, input.durationMs);
|
|
52
|
+
this.records.set(key(label), current);
|
|
53
|
+
}
|
|
54
|
+
snapshot() {
|
|
55
|
+
return [...this.records.values()]
|
|
56
|
+
.map((record) => ({ ...record }))
|
|
57
|
+
.sort((a, b) => `${a.operationType}:${a.operationName}`.localeCompare(`${b.operationType}:${b.operationName}`));
|
|
58
|
+
}
|
|
59
|
+
reset() {
|
|
60
|
+
this.records.clear();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export const graphqlOperationMetrics = new GraphqlOperationMetrics();
|
|
64
|
+
export function createGraphqlMetricsPlugin(metrics = graphqlOperationMetrics, now = () => performance.now()) {
|
|
65
|
+
return {
|
|
66
|
+
onParams({ params, paramsHandler, setParamsHandler }) {
|
|
67
|
+
const operation = identifyGraphqlOperation(params);
|
|
68
|
+
setParamsHandler(async (payload) => {
|
|
69
|
+
const startedAt = now();
|
|
70
|
+
try {
|
|
71
|
+
const result = await paramsHandler(payload);
|
|
72
|
+
metrics.record({
|
|
73
|
+
...operation,
|
|
74
|
+
durationMs: Math.max(0, now() - startedAt),
|
|
75
|
+
errored: resultHasErrors(result),
|
|
76
|
+
});
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
metrics.record({
|
|
81
|
+
...operation,
|
|
82
|
+
durationMs: Math.max(0, now() - startedAt),
|
|
83
|
+
errored: true,
|
|
84
|
+
});
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=graphql-metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-metrics.js","sourceRoot":"","sources":["../../../../src/infrastructure/metrics/graphql/graphql-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,EAAgD,MAAM,SAAS,CAAC;AA0B/F,MAAM,mBAAmB,GAAG,WAAW,CAAC;AACxC,MAAM,wBAAwB,GAAmB,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;AACtG,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEhD,SAAS,GAAG,CAAC,KAAqB;IAChC,OAAO,GAAG,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;AACzD,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC,CAAC;AAC/F,CAAC;AAED,SAAS,eAAe,CAAC,MAAe;IACtC,OAAO,iBAAiB,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;AAC/F,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,MAAqB;IAC5D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,mBAAmB,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC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YAClD,MAAM,SAAS,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;YACnD,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;gBACjC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC;gBACxB,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC;oBAC5C,OAAO,CAAC,MAAM,CAAC;wBACb,GAAG,SAAS;wBACZ,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;wBAC1C,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC;qBACjC,CAAC,CAAC;oBACH,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,MAAM,CAAC;wBACb,GAAG,SAAS;wBACZ,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;wBAC1C,OAAO,EAAE,IAAI;qBACd,CAAC,CAAC;oBACH,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -13,7 +13,15 @@ export const MCP_TOOL_NAMES = [
|
|
|
13
13
|
'get_run',
|
|
14
14
|
'get_run_events',
|
|
15
15
|
'get_run_log',
|
|
16
|
+
'get_agent_activity',
|
|
17
|
+
'get_agent_attempts',
|
|
18
|
+
'get_agent_log',
|
|
19
|
+
'tail_agent_log',
|
|
20
|
+
'read_agent_output_events',
|
|
16
21
|
'get_run_digest',
|
|
22
|
+
'wait_for_run',
|
|
23
|
+
'wait_for_any_gate',
|
|
24
|
+
'watch_runs',
|
|
17
25
|
'list_inbox',
|
|
18
26
|
'get_inbox_item',
|
|
19
27
|
'get_pending_decisions',
|
|
@@ -36,7 +44,7 @@ export const MCP_INSTRUCTIONS = `Revo is a local-first software-development task
|
|
|
36
44
|
|
|
37
45
|
Use these tools to manage tasks end-to-end from your coding agent:
|
|
38
46
|
- create and start runs;
|
|
39
|
-
- inspect run status, events, attempts, and digests;
|
|
47
|
+
- inspect run status, events, attempts, agent activity, bounded logs, and digests;
|
|
40
48
|
- resolve human inbox gates and questions;
|
|
41
49
|
- inspect installed playbooks, roles, and pipelines;
|
|
42
50
|
- inspect PR readiness and actionable review feedback before resuming work;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-capabilities.js","sourceRoot":"","sources":["../../src/mcp/mcp-capabilities.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,YAAY;IACZ,QAAQ;IACR,kBAAkB;IAClB,qBAAqB;IACrB,wBAAwB;IACxB,aAAa;IACb,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,aAAa;IACb,gBAAgB;IAChB,YAAY;IACZ,gBAAgB;IAChB,uBAAuB;IACvB,cAAc;IACd,aAAa;IACb,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,kBAAkB;IAClB,gBAAgB;IAChB,YAAY;IACZ,UAAU;IACV,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;CACV,CAAC;AAIX,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;qDAWqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"mcp-capabilities.js","sourceRoot":"","sources":["../../src/mcp/mcp-capabilities.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,YAAY;IACZ,QAAQ;IACR,kBAAkB;IAClB,qBAAqB;IACrB,wBAAwB;IACxB,aAAa;IACb,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,aAAa;IACb,oBAAoB;IACpB,oBAAoB;IACpB,eAAe;IACf,gBAAgB;IAChB,0BAA0B;IAC1B,gBAAgB;IAChB,cAAc;IACd,mBAAmB;IACnB,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,uBAAuB;IACvB,cAAc;IACd,aAAa;IACb,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,kBAAkB;IAClB,gBAAgB;IAChB,YAAY;IACZ,UAAU;IACV,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;CACV,CAAC;AAIX,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;qDAWqB,CAAC"}
|
|
@@ -9,22 +9,52 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Injectable } from '@nestjs/common';
|
|
11
11
|
import { TaskControlPlaneApiService, } from '../task-control-plane/task-control-plane-api.service.js';
|
|
12
|
+
import { ControlPlaneError } from '../control-plane/errors.js';
|
|
13
|
+
import { AgentObservabilityError } from '../observability/types.js';
|
|
14
|
+
import { CreateRunWorkflowError } from '../run/create-run.js';
|
|
15
|
+
import { RunWatchService } from '../task-control-plane/run-watch.service.js';
|
|
12
16
|
import { MCP_TOOL_NAMES } from './mcp-capabilities.js';
|
|
17
|
+
function formatCause(error) {
|
|
18
|
+
if (error instanceof ControlPlaneError) {
|
|
19
|
+
const status = error.status === undefined ? '' : ` status=${error.status}`;
|
|
20
|
+
return `${error.code}${status}: ${error.message}`;
|
|
21
|
+
}
|
|
22
|
+
if (error instanceof Error)
|
|
23
|
+
return error.message;
|
|
24
|
+
return String(error);
|
|
25
|
+
}
|
|
26
|
+
function exposeApplicationError(promise) {
|
|
27
|
+
return promise.catch((error) => {
|
|
28
|
+
if (error instanceof AgentObservabilityError) {
|
|
29
|
+
throw new Error(`${error.code}: ${error.message}`);
|
|
30
|
+
}
|
|
31
|
+
throw error;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
13
34
|
let McpFacadeService = class McpFacadeService {
|
|
14
35
|
api;
|
|
15
|
-
|
|
36
|
+
/**
|
|
37
|
+
* `runWatch` is injected by the daemon with a pubSub-backed instance (slice 141 D2, option A). When
|
|
38
|
+
* absent (e2e/stdio/tests construct the facade with only the api), we lazily build a poll-fallback
|
|
39
|
+
* watch (option B) — equivalent correctness, slightly higher latency.
|
|
40
|
+
*/
|
|
41
|
+
runWatchInstance;
|
|
42
|
+
constructor(api, runWatch) {
|
|
16
43
|
this.api = api;
|
|
44
|
+
this.runWatchInstance = runWatch;
|
|
45
|
+
}
|
|
46
|
+
get runWatch() {
|
|
47
|
+
return (this.runWatchInstance ??= new RunWatchService(this.api));
|
|
17
48
|
}
|
|
18
49
|
getCapabilities() {
|
|
19
50
|
return {
|
|
20
51
|
transport: 'stdio',
|
|
21
52
|
auth: 'none',
|
|
22
53
|
tools: [...MCP_TOOL_NAMES],
|
|
23
|
-
runnerModes: ['script', 'live'],
|
|
24
54
|
notes: [
|
|
25
55
|
'Local stdio MCP server; no remote HTTP listener.',
|
|
26
56
|
'Tools expose product operations, not generic Revisium row CRUD.',
|
|
27
|
-
'
|
|
57
|
+
'Runs are driven by installed playbooks, pipeline catalogs, and execution profiles.',
|
|
28
58
|
],
|
|
29
59
|
};
|
|
30
60
|
}
|
|
@@ -44,7 +74,15 @@ let McpFacadeService = class McpFacadeService {
|
|
|
44
74
|
return this.api.getRepositoryContext(input);
|
|
45
75
|
}
|
|
46
76
|
createRun(input) {
|
|
47
|
-
return this.api.createRun(input)
|
|
77
|
+
return this.api.createRun(input).catch((error) => {
|
|
78
|
+
if (error instanceof CreateRunWorkflowError) {
|
|
79
|
+
const created = Object.keys(error.createdIds).length > 0
|
|
80
|
+
? `; createdBeforeFailure=${JSON.stringify(error.createdIds)}`
|
|
81
|
+
: '';
|
|
82
|
+
throw new Error(`${error.message}: ${formatCause(error.cause)}${created}`);
|
|
83
|
+
}
|
|
84
|
+
throw error;
|
|
85
|
+
});
|
|
48
86
|
}
|
|
49
87
|
startRun(input) {
|
|
50
88
|
return this.api.startRun(input);
|
|
@@ -67,9 +105,33 @@ let McpFacadeService = class McpFacadeService {
|
|
|
67
105
|
getRunLog(input) {
|
|
68
106
|
return this.api.getRunLog(input);
|
|
69
107
|
}
|
|
108
|
+
getAgentActivity(runId) {
|
|
109
|
+
return exposeApplicationError(this.api.getAgentActivity(runId));
|
|
110
|
+
}
|
|
111
|
+
getAgentAttempts(runId) {
|
|
112
|
+
return exposeApplicationError(this.api.getAgentAttempts(runId));
|
|
113
|
+
}
|
|
114
|
+
getAgentLog(input) {
|
|
115
|
+
return exposeApplicationError(this.api.getAgentLog(input));
|
|
116
|
+
}
|
|
117
|
+
tailAgentLog(input) {
|
|
118
|
+
return exposeApplicationError(this.api.readAgentOutputEvents(input));
|
|
119
|
+
}
|
|
120
|
+
readAgentOutputEvents(input) {
|
|
121
|
+
return exposeApplicationError(this.api.readAgentOutputEvents(input));
|
|
122
|
+
}
|
|
70
123
|
getRunDigest(runId) {
|
|
71
124
|
return this.api.getRunDigest(runId);
|
|
72
125
|
}
|
|
126
|
+
waitForRun(input) {
|
|
127
|
+
return this.api.waitForRun(input);
|
|
128
|
+
}
|
|
129
|
+
waitForAnyGate(input) {
|
|
130
|
+
return this.runWatch.waitForAnyGate(input);
|
|
131
|
+
}
|
|
132
|
+
watchRuns(input) {
|
|
133
|
+
return this.runWatch.watchRuns(input);
|
|
134
|
+
}
|
|
73
135
|
listInbox(filter) {
|
|
74
136
|
return this.api.listInbox(filter);
|
|
75
137
|
}
|
|
@@ -124,7 +186,8 @@ let McpFacadeService = class McpFacadeService {
|
|
|
124
186
|
};
|
|
125
187
|
McpFacadeService = __decorate([
|
|
126
188
|
Injectable(),
|
|
127
|
-
__metadata("design:paramtypes", [TaskControlPlaneApiService
|
|
189
|
+
__metadata("design:paramtypes", [TaskControlPlaneApiService,
|
|
190
|
+
RunWatchService])
|
|
128
191
|
], McpFacadeService);
|
|
129
192
|
export { McpFacadeService };
|
|
130
193
|
//# sourceMappingURL=mcp-facade.service.js.map
|