@revisium/orchestrator 0.1.0-alpha.5 → 0.1.0-alpha.7

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.
Files changed (193) hide show
  1. package/README.md +149 -1
  2. package/dist/api/graphql-api/filters/agent-observability-exception.filter.js +24 -0
  3. package/dist/api/graphql-api/filters/agent-observability-exception.filter.js.map +1 -0
  4. package/dist/api/graphql-api/graphql-api.module.js +2 -0
  5. package/dist/api/graphql-api/graphql-api.module.js.map +1 -1
  6. package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-bridge.service.js +296 -0
  7. package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-bridge.service.js.map +1 -0
  8. package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-mappers.js +64 -0
  9. package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-mappers.js.map +1 -0
  10. package/dist/api/graphql-api/graphql-ws/constants.js +2 -0
  11. package/dist/api/graphql-api/graphql-ws/constants.js.map +1 -1
  12. package/dist/api/graphql-api/graphql-ws/pubsub.module.js +5 -2
  13. package/dist/api/graphql-api/graphql-ws/pubsub.module.js.map +1 -1
  14. package/dist/api/graphql-api/registerGraphqlEnums.js +6 -1
  15. package/dist/api/graphql-api/registerGraphqlEnums.js.map +1 -1
  16. package/dist/api/graphql-api/runs/inputs/get-agent-log.input.js +48 -0
  17. package/dist/api/graphql-api/runs/inputs/get-agent-log.input.js.map +1 -0
  18. package/dist/api/graphql-api/runs/model/agent-activity.model.js +367 -0
  19. package/dist/api/graphql-api/runs/model/agent-activity.model.js.map +1 -0
  20. package/dist/api/graphql-api/runs/runs-subscription.resolver.js +35 -4
  21. package/dist/api/graphql-api/runs/runs-subscription.resolver.js.map +1 -1
  22. package/dist/api/graphql-api/runs/runs.resolver.js +35 -0
  23. package/dist/api/graphql-api/runs/runs.resolver.js.map +1 -1
  24. package/dist/cli/commands/doctor-report.js +52 -0
  25. package/dist/cli/commands/doctor-report.js.map +1 -0
  26. package/dist/cli/commands/lifecycle.js +304 -0
  27. package/dist/cli/commands/lifecycle.js.map +1 -0
  28. package/dist/cli/commands/mcp.js +46 -8
  29. package/dist/cli/commands/mcp.js.map +1 -1
  30. package/dist/cli/commands/revisium-helpers.js +2 -2
  31. package/dist/cli/index.js +5 -29
  32. package/dist/cli/index.js.map +1 -1
  33. package/dist/cli/program.js +7 -23
  34. package/dist/cli/program.js.map +1 -1
  35. package/dist/config.js +42 -5
  36. package/dist/config.js.map +1 -1
  37. package/dist/control-plane/bootstrap.js +93 -0
  38. package/dist/control-plane/bootstrap.js.map +1 -0
  39. package/dist/control-plane/schema-migration.js +7 -11
  40. package/dist/control-plane/schema-migration.js.map +1 -1
  41. package/dist/control-plane/seed-default-playbook.js +23 -0
  42. package/dist/control-plane/seed-default-playbook.js.map +1 -1
  43. package/dist/e2e/kit/agents.js +17 -5
  44. package/dist/e2e/kit/agents.js.map +1 -1
  45. package/dist/e2e/kit/assertions.js +20 -0
  46. package/dist/e2e/kit/assertions.js.map +1 -1
  47. package/dist/e2e/kit/harness.js +12 -1
  48. package/dist/e2e/kit/harness.js.map +1 -1
  49. package/dist/e2e/kit/scenarios.js +1 -1
  50. package/dist/e2e/recovery-dd-crash-child.js +3 -2
  51. package/dist/e2e/recovery-dd-crash-child.js.map +1 -1
  52. package/dist/engine/dbos.service.js +20 -0
  53. package/dist/engine/dbos.service.js.map +1 -1
  54. package/dist/engine/ensure-postgres.js +11 -9
  55. package/dist/engine/ensure-postgres.js.map +1 -1
  56. package/dist/features/runs/queries/handlers/runs-query.handlers.js +135 -0
  57. package/dist/features/runs/queries/handlers/runs-query.handlers.js.map +1 -1
  58. package/dist/features/runs/queries/impl/get-agent-activity.query.js +7 -0
  59. package/dist/features/runs/queries/impl/get-agent-activity.query.js.map +1 -0
  60. package/dist/features/runs/queries/impl/get-agent-attempts.query.js +7 -0
  61. package/dist/features/runs/queries/impl/get-agent-attempts.query.js.map +1 -0
  62. package/dist/features/runs/queries/impl/get-agent-log.query.js +7 -0
  63. package/dist/features/runs/queries/impl/get-agent-log.query.js.map +1 -0
  64. package/dist/features/runs/queries/index.js +4 -1
  65. package/dist/features/runs/queries/index.js.map +1 -1
  66. package/dist/features/runs/runs-api.service.js +12 -0
  67. package/dist/features/runs/runs-api.service.js.map +1 -1
  68. package/dist/host/daemon.js +86 -0
  69. package/dist/host/daemon.js.map +1 -0
  70. package/dist/host/ensure-host.js +116 -0
  71. package/dist/host/ensure-host.js.map +1 -0
  72. package/dist/host/host-runtime.js +72 -0
  73. package/dist/host/host-runtime.js.map +1 -0
  74. package/dist/host/queue-ownership.js +53 -0
  75. package/dist/host/queue-ownership.js.map +1 -0
  76. package/dist/http/graphql-host.js +8 -2
  77. package/dist/http/graphql-host.js.map +1 -1
  78. package/dist/http/graphql-host.module.js +3 -0
  79. package/dist/http/graphql-host.module.js.map +1 -1
  80. package/dist/mcp/mcp-capabilities.js +6 -1
  81. package/dist/mcp/mcp-capabilities.js.map +1 -1
  82. package/dist/mcp/mcp-facade.service.js +24 -0
  83. package/dist/mcp/mcp-facade.service.js.map +1 -1
  84. package/dist/mcp/mcp-http.service.js +95 -0
  85. package/dist/mcp/mcp-http.service.js.map +1 -0
  86. package/dist/mcp/mcp-tools.js +58 -0
  87. package/dist/mcp/mcp-tools.js.map +1 -1
  88. package/dist/observability/agent-activity-reporter.js +185 -0
  89. package/dist/observability/agent-activity-reporter.js.map +1 -0
  90. package/dist/observability/agent-observability.service.js +1142 -0
  91. package/dist/observability/agent-observability.service.js.map +1 -0
  92. package/dist/observability/index.js +4 -0
  93. package/dist/observability/index.js.map +1 -0
  94. package/dist/observability/types.js +11 -0
  95. package/dist/observability/types.js.map +1 -0
  96. package/dist/pipeline/data-driven-task.workflow.js +37 -75
  97. package/dist/pipeline/data-driven-task.workflow.js.map +1 -1
  98. package/dist/pipeline/pipeline.service.js +54 -15
  99. package/dist/pipeline/pipeline.service.js.map +1 -1
  100. package/dist/pipeline-core/validate-capability.js +23 -0
  101. package/dist/pipeline-core/validate-capability.js.map +1 -0
  102. package/dist/pipeline-core/validate-conflicts.js +37 -0
  103. package/dist/pipeline-core/validate-conflicts.js.map +1 -0
  104. package/dist/pipeline-core/validate-dataflow.js +180 -0
  105. package/dist/pipeline-core/validate-dataflow.js.map +1 -0
  106. package/dist/pipeline-core/validate-diff.js +158 -0
  107. package/dist/pipeline-core/validate-diff.js.map +1 -0
  108. package/dist/pipeline-core/validate-edges.js +44 -0
  109. package/dist/pipeline-core/validate-edges.js.map +1 -0
  110. package/dist/pipeline-core/validate-graph.js +123 -0
  111. package/dist/pipeline-core/validate-graph.js.map +1 -0
  112. package/dist/pipeline-core/validate-loops.js +226 -0
  113. package/dist/pipeline-core/validate-loops.js.map +1 -0
  114. package/dist/pipeline-core/validate-parallel.js +132 -0
  115. package/dist/pipeline-core/validate-parallel.js.map +1 -0
  116. package/dist/pipeline-core/validate-sink.js +27 -0
  117. package/dist/pipeline-core/validate-sink.js.map +1 -0
  118. package/dist/pipeline-core/validate-topology.js +140 -0
  119. package/dist/pipeline-core/validate-topology.js.map +1 -0
  120. package/dist/pipeline-core/validate-verdict.js +72 -0
  121. package/dist/pipeline-core/validate-verdict.js.map +1 -0
  122. package/dist/pipeline-core/validate.js +34 -1107
  123. package/dist/pipeline-core/validate.js.map +1 -1
  124. package/dist/revisium/run.service.js +15 -1
  125. package/dist/revisium/run.service.js.map +1 -1
  126. package/dist/runners/codex.service.js +51 -0
  127. package/dist/runners/codex.service.js.map +1 -0
  128. package/dist/runners/integrator-branch-naming.js +24 -0
  129. package/dist/runners/integrator-branch-naming.js.map +1 -0
  130. package/dist/runners/integrator-git.js +84 -0
  131. package/dist/runners/integrator-git.js.map +1 -0
  132. package/dist/runners/integrator-remote.js +34 -0
  133. package/dist/runners/integrator-remote.js.map +1 -0
  134. package/dist/runners/integrator-types.js +9 -0
  135. package/dist/runners/integrator-types.js.map +1 -0
  136. package/dist/runners/integrator.js +12 -132
  137. package/dist/runners/integrator.js.map +1 -1
  138. package/dist/runners/runner.module.js +4 -2
  139. package/dist/runners/runner.module.js.map +1 -1
  140. package/dist/smoke/cli.js +47 -0
  141. package/dist/smoke/cli.js.map +1 -0
  142. package/dist/smoke/isolation.js +113 -0
  143. package/dist/smoke/isolation.js.map +1 -0
  144. package/dist/task-control-plane/task-control-plane-api.service.js +24 -1
  145. package/dist/task-control-plane/task-control-plane-api.service.js.map +1 -1
  146. package/dist/task-control-plane/task-control-plane.module.js +21 -1
  147. package/dist/task-control-plane/task-control-plane.module.js.map +1 -1
  148. package/dist/worker/artifact-store.js +6 -1
  149. package/dist/worker/artifact-store.js.map +1 -1
  150. package/dist/worker/build-context.js +135 -1
  151. package/dist/worker/build-context.js.map +1 -1
  152. package/dist/worker/claude-code-runner.js +132 -78
  153. package/dist/worker/claude-code-runner.js.map +1 -1
  154. package/dist/worker/codex-runner.js +474 -0
  155. package/dist/worker/codex-runner.js.map +1 -0
  156. package/dist/worker/result-envelope.js +91 -73
  157. package/dist/worker/result-envelope.js.map +1 -1
  158. package/dist/worker/runner-common.js +106 -0
  159. package/dist/worker/runner-common.js.map +1 -0
  160. package/dist/worker/runner-dispatch.js +3 -1
  161. package/dist/worker/runner-dispatch.js.map +1 -1
  162. package/dist/worker/runner.js.map +1 -1
  163. package/dist/worker/stub-runner.js +3 -3
  164. package/dist/worker/stub-runner.js.map +1 -1
  165. package/package.json +1 -1
  166. package/dist/app.module.js +0 -28
  167. package/dist/app.module.js.map +0 -1
  168. package/dist/cli/commands/bootstrap.js +0 -100
  169. package/dist/cli/commands/bootstrap.js.map +0 -1
  170. package/dist/cli/commands/dev.js +0 -143
  171. package/dist/cli/commands/dev.js.map +0 -1
  172. package/dist/cli/commands/inbox.js +0 -288
  173. package/dist/cli/commands/inbox.js.map +0 -1
  174. package/dist/cli/commands/playbook.js +0 -74
  175. package/dist/cli/commands/playbook.js.map +0 -1
  176. package/dist/cli/commands/poll-workflow-state.js +0 -144
  177. package/dist/cli/commands/poll-workflow-state.js.map +0 -1
  178. package/dist/cli/commands/revisium-context.js +0 -23
  179. package/dist/cli/commands/revisium-context.js.map +0 -1
  180. package/dist/cli/commands/revisium.js +0 -89
  181. package/dist/cli/commands/revisium.js.map +0 -1
  182. package/dist/cli/commands/run.js +0 -451
  183. package/dist/cli/commands/run.js.map +0 -1
  184. package/dist/cli/commands/serve.js +0 -26
  185. package/dist/cli/commands/serve.js.map +0 -1
  186. package/dist/cli/live-guard.js +0 -49
  187. package/dist/cli/live-guard.js.map +0 -1
  188. package/dist/cli/needs-host.js +0 -77
  189. package/dist/cli/needs-host.js.map +0 -1
  190. package/dist/mcp/mcp-stdio.service.js +0 -48
  191. package/dist/mcp/mcp-stdio.service.js.map +0 -1
  192. package/dist/mcp/mcp.module.js +0 -21
  193. package/dist/mcp/mcp.module.js.map +0 -1
@@ -1,70 +1,65 @@
1
- // The EXACT contract between the agent and the runner. Two layers:
2
- // A. transport envelope `claude -p --output-format json` stdout (final text + cost/usage)
3
- // B. agent result envelope a sentineled REVO_RESULT block the agent emits inside that final text
4
- //
5
- // The instruction below is the SINGLE SOURCE OF TRUTH. The runner (claude-code-runner.ts) appends it
6
- // to EVERY prompt so the agent is always told how to emit; the parser here keys on the same markers.
7
- // It lives next to the parser — not in build-context.ts (the stub shares that), not in role prompts.
8
- export const REVO_RESULT_CONTRACT = `
9
- You MUST end your reply with a single result block in EXACTLY this form — the markers on their own lines,
10
- valid JSON between them, and NOTHING after the closing marker:
11
-
12
- <<<REVO_RESULT
13
- {
14
- "verdict": <REQUIRED if your role emits one — EXACTLY one routing token, lowercase, no prose, e.g. "approved" | "changes_requested" | "blocker" | "clean" | "dirty"; the pipeline routes on this. Use null if your role emits no verdict>,
15
- "output": <any JSON — a short human-readable summary or structured result the next step consumes>,
16
- "artifacts": <any JSON, optional — e.g. { "planPath": "docs/plans/00xx.md" }; omit if none>,
17
- "nextSteps": [
18
- { "role": "developer", "kind": "implement", "input": { "from": "<this step>" },
19
- "modelProfile"?: "standard", "taskId"?: "<defaults to the current step's task>",
20
- "priority"?: 0, "maxAttempts"?: 3, "dependsOn"?: [], "runAfter"?: "" }
21
- ],
22
- "needsHuman": false,
23
- "lesson": null
24
- }
25
- REVO_RESULT>>>
26
-
27
- If you have no follow-up work, return "nextSteps": []. If you are blocked and need a human, set
28
- "needsHuman": true and "nextSteps": []. Emit the block exactly once.
29
- `;
30
- // Markers the parser keys on — must stay identical to those embedded in REVO_RESULT_CONTRACT.
31
- // The marker-sync unit test guards that invariant.
32
- const OPEN_MARKER = '<<<REVO_RESULT';
33
- const CLOSE_MARKER = 'REVO_RESULT>>>';
34
- // PRIMARY result channel (0016 follow-up): the claude CLI `--json-schema` constrains the agent's final
35
- // message to this schema and returns it as the transport `structured_output` field — a RELIABLE
36
- // `verdict` (the pipeline routes on it), unlike mining a free-text REVO_RESULT block (which the agent
37
- // shaped as prose, leaving no routable verdict). `output` is the summary/plan the next step consumes.
1
+ // The only supported agent result channel: the Claude CLI `--json-schema` constrains the final
2
+ // message and returns it as the transport `structured_output` field. The engine routes only on the
3
+ // top-level `verdict` from that structured object; prose output is never parsed for routing.
38
4
  export const AGENT_RESULT_SCHEMA = JSON.stringify({
39
5
  type: 'object',
40
6
  additionalProperties: false,
41
7
  properties: {
42
- verdict: { type: 'string', description: 'the single routing token, lowercase, e.g. approved | changes_requested | blocker | clean | dirty' },
8
+ verdict: {
9
+ type: 'string',
10
+ minLength: 1,
11
+ description: 'the single routing token, lowercase, e.g. approved | changes_requested | blocker | clean | dirty',
12
+ },
43
13
  output: { type: 'string', description: 'a short summary, or the artifact (e.g. the plan) the next step consumes' },
14
+ artifacts: { description: 'optional JSON artifacts, e.g. { "planPath": "docs/plans/00xx.md" }' },
15
+ nextSteps: {
16
+ type: 'array',
17
+ description: 'optional follow-up work items; use [] when there is no follow-up work',
18
+ items: { type: 'object' },
19
+ },
44
20
  needsHuman: { type: 'boolean', description: 'true only if you are blocked and a human must intervene' },
45
21
  lesson: { type: 'string', description: 'optional one-line note for a future attempt' },
46
22
  },
47
23
  required: ['verdict', 'output'],
48
24
  });
49
- /** Short prompt note paired with `--json-schema` (replaces the prose REVO_RESULT block the two output
50
- * instructions conflict; with --json-schema the CLI returns `structured_output`). */
25
+ /** Short prompt note paired with `--json-schema`; the CLI returns the result as `structured_output`. */
51
26
  export const STRUCTURED_RESULT_NOTE = `
52
27
  Return your final answer as JSON matching the provided output schema:
53
28
  - "verdict": the single routing token for your role (lowercase; e.g. approved | changes_requested | blocker | clean | dirty).
54
29
  - "output": a short summary, or — if you produce an artifact for a later step (e.g. an implementation plan) — that artifact.
30
+ - "nextSteps": [] unless you are explicitly creating legacy follow-up steps.
55
31
  Set "needsHuman": true only if you are blocked and a human must intervene.
56
32
  `;
57
- /** Build the AgentResult from a validated structured_output object (the --json-schema path). */
33
+ /** Build the AgentResult from the required structured_output object (the --json-schema path). */
58
34
  export function agentResultFromStructured(structured) {
59
- if (structured === null || typeof structured !== 'object')
60
- return null;
35
+ if (structured === undefined) {
36
+ throw new TypeError('agent structured result missing structured_output');
37
+ }
38
+ if (structured === null || typeof structured !== 'object' || Array.isArray(structured)) {
39
+ throw new TypeError('agent structured result must be an object');
40
+ }
61
41
  const o = structured;
42
+ if (typeof o.verdict !== 'string' || o.verdict.trim().length === 0) {
43
+ throw new TypeError('agent structured result missing required top-level verdict');
44
+ }
45
+ if (typeof o.output !== 'string') {
46
+ throw new TypeError('agent structured result missing required string output');
47
+ }
48
+ if ('needsHuman' in o && typeof o.needsHuman !== 'boolean') {
49
+ throw new TypeError('agent structured result needsHuman must be a boolean when present');
50
+ }
51
+ if ('lesson' in o && o.lesson !== null && typeof o.lesson !== 'string') {
52
+ throw new TypeError('agent structured result lesson must be a string when present');
53
+ }
54
+ if ('nextSteps' in o && !Array.isArray(o.nextSteps)) {
55
+ throw new TypeError('agent structured result nextSteps must be an array when present');
56
+ }
62
57
  return {
63
- output: typeof o.output === 'string' ? o.output : (o.output ?? ''),
64
- verdict: typeof o.verdict === 'string' && o.verdict.length > 0 ? o.verdict : undefined,
58
+ output: o.output,
59
+ verdict: o.verdict,
65
60
  artifacts: o.artifacts,
66
61
  nextSteps: Array.isArray(o.nextSteps) ? o.nextSteps : [],
67
- needsHuman: Boolean(o.needsHuman),
62
+ needsHuman: o.needsHuman === true,
68
63
  lesson: typeof o.lesson === 'string' ? o.lesson : undefined,
69
64
  };
70
65
  }
@@ -78,6 +73,9 @@ function readFinalText(obj) {
78
73
  return obj.text;
79
74
  return '';
80
75
  }
76
+ function readNonEmptyString(value) {
77
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
78
+ }
81
79
  // Layer A. Parse defensively; field names are read only inside this module, so a CLI drift is a
82
80
  // one-file change. Throws only when stdout is not parseable JSON.
83
81
  export function parseTransportEnvelope(stdout) {
@@ -98,40 +96,60 @@ export function parseTransportEnvelope(stdout) {
98
96
  return {
99
97
  text: readFinalText(obj),
100
98
  isError: Boolean(obj.is_error),
99
+ permissionDenials: obj.permission_denials,
100
+ terminalReason: readNonEmptyString(obj.terminal_reason),
101
+ sessionId: readNonEmptyString(obj.session_id),
101
102
  costUsd: readNumber(obj.total_cost_usd) ?? readNumber(obj.cost_usd),
102
103
  inputTokens: readNumber(usage?.input_tokens),
103
104
  outputTokens: readNumber(usage?.output_tokens),
104
105
  structuredOutput: obj.structured_output,
105
106
  };
106
107
  }
107
- // Layer B. Extract the substring between the markers and JSON.parse it. Absent or unparseable →
108
- // the documented lesson-bearing error (the corrective is the contract the runner re-appends, not this).
109
- export function extractAgentResult(text) {
110
- const start = text.indexOf(OPEN_MARKER);
111
- const end = start === -1 ? -1 : text.indexOf(CLOSE_MARKER, start + OPEN_MARKER.length);
112
- if (start === -1 || end === -1) {
113
- throw new Error('agent did not emit a parseable REVO_RESULT envelope');
114
- }
115
- const jsonSlice = text.slice(start + OPEN_MARKER.length, end);
116
- let parsed;
108
+ /**
109
+ * Reduce the runner's stdout to the single terminal `result` JSON object, then hand it to
110
+ * parseTransportEnvelope. Handles BOTH shapes:
111
+ * - legacy `--output-format json` → the whole stdout is one `{...}` object;
112
+ * - `--output-format stream-json` → a JSONL stream (system/assistant/user/… lines) whose LAST
113
+ * line is `{"type":"result",...}`.
114
+ * Confirmed by experiment (2026-06-23): under stream-json the terminal result still carries
115
+ * `structured_output`, `usage`, and `total_cost_usd`, so verdict/cost extraction is unchanged.
116
+ * Throws when no result object is present (the runner maps that to a lesson-bearing failure).
117
+ */
118
+ export function extractTerminalResult(stdout) {
119
+ const trimmed = stdout.trim();
120
+ if (trimmed === '')
121
+ throw new Error('claude -p produced no output (no result envelope)');
122
+ // Legacy single-object form: the whole stdout parses as one object. Accept only a terminal
123
+ // result (`type` 'result' or absent — the legacy `--output-format json` blob is `type:'result'`);
124
+ // a lone non-result stream event (e.g. `{"type":"assistant",…}`) must fall through so the JSONL
125
+ // scan reports the clear "no result event" error rather than failing later on a missing result.
117
126
  try {
118
- parsed = JSON.parse(jsonSlice);
127
+ const whole = JSON.parse(trimmed);
128
+ if (whole !== null && typeof whole === 'object' && !Array.isArray(whole)) {
129
+ const type = whole.type;
130
+ if (type === undefined || type === 'result')
131
+ return trimmed;
132
+ }
119
133
  }
120
134
  catch {
121
- throw new Error('agent did not emit a parseable REVO_RESULT envelope');
135
+ // Not a single object fall through to the JSONL scan.
122
136
  }
123
- if (parsed === null || typeof parsed !== 'object') {
124
- throw new Error('agent did not emit a parseable REVO_RESULT envelope');
137
+ // stream-json: the terminal result is the LAST line with `"type":"result"`.
138
+ const lines = trimmed.split(/\r?\n/);
139
+ for (let i = lines.length - 1; i >= 0; i--) {
140
+ const line = lines[i].trim();
141
+ if (line === '')
142
+ continue;
143
+ try {
144
+ const obj = JSON.parse(line);
145
+ if (obj !== null && typeof obj === 'object' && obj.type === 'result')
146
+ return line;
147
+ }
148
+ catch {
149
+ // skip a partial/non-JSON line
150
+ }
125
151
  }
126
- const obj = parsed;
127
- return {
128
- output: obj.output,
129
- verdict: typeof obj.verdict === 'string' && obj.verdict.length > 0 ? obj.verdict : undefined,
130
- artifacts: obj.artifacts,
131
- nextSteps: Array.isArray(obj.nextSteps) ? obj.nextSteps : [],
132
- needsHuman: Boolean(obj.needsHuman),
133
- lesson: typeof obj.lesson === 'string' ? obj.lesson : undefined,
134
- };
152
+ throw new Error('claude -p stream contained no result event (transport envelope)');
135
153
  }
136
154
  // Map each raw nextSteps entry to NewStepSpec. Require role/kind/input; default taskId and
137
155
  // modelProfile from the current step so the agent never needs to know IDs. Throw a lesson-bearing
@@ -139,17 +157,17 @@ export function extractAgentResult(text) {
139
157
  export function normalizeNextSteps(raw, step) {
140
158
  return raw.map((entry, i) => {
141
159
  if (entry === null || typeof entry !== 'object') {
142
- throw new Error(`REVO_RESULT nextSteps[${i}] is not an object`);
160
+ throw new Error(`agent result nextSteps[${i}] is not an object`);
143
161
  }
144
162
  const e = entry;
145
163
  if (typeof e.role !== 'string' || e.role.length === 0) {
146
- throw new Error(`REVO_RESULT nextSteps[${i}] missing required "role"`);
164
+ throw new Error(`agent result nextSteps[${i}] missing required "role"`);
147
165
  }
148
166
  if (typeof e.kind !== 'string' || e.kind.length === 0) {
149
- throw new Error(`REVO_RESULT nextSteps[${i}] missing required "kind"`);
167
+ throw new Error(`agent result nextSteps[${i}] missing required "kind"`);
150
168
  }
151
169
  if (!('input' in e)) {
152
- throw new Error(`REVO_RESULT nextSteps[${i}] missing required "input"`);
170
+ throw new Error(`agent result nextSteps[${i}] missing required "input"`);
153
171
  }
154
172
  const spec = {
155
173
  taskId: typeof e.taskId === 'string' && e.taskId.length > 0 ? e.taskId : step.taskId,
@@ -1 +1 @@
1
- {"version":3,"file":"result-envelope.js","sourceRoot":"","sources":["../../src/worker/result-envelope.ts"],"names":[],"mappings":"AAGA,mEAAmE;AACnE,8FAA8F;AAC9F,qGAAqG;AACrG,EAAE;AACF,qGAAqG;AACrG,qGAAqG;AACrG,qGAAqG;AAErG,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBnC,CAAC;AAEF,8FAA8F;AAC9F,mDAA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,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACzE,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { RunAgentError } from './runner.js';
2
+ import { normalizeNextSteps } from './result-envelope.js';
3
+ const ERROR_TAIL = 2_000;
4
+ const OBSERVABILITY_PREVIEW_MAX_CHARS = 1_000;
5
+ const OBSERVABILITY_ARRAY_MAX_ITEMS = 5;
6
+ const OBSERVABILITY_OBJECT_MAX_KEYS = 12;
7
+ const OBSERVABILITY_STRING_MAX_CHARS = 120;
8
+ export function tail(text) {
9
+ const trimmed = text.trim();
10
+ return trimmed.length > ERROR_TAIL ? trimmed.slice(-ERROR_TAIL) : trimmed;
11
+ }
12
+ function boundedString(value, maxChars = OBSERVABILITY_STRING_MAX_CHARS) {
13
+ return value.length > maxChars ? `${value.slice(0, maxChars)}...` : value;
14
+ }
15
+ export function boundedPreviewValue(value, depth = 0) {
16
+ if (value === null || value === undefined)
17
+ return value;
18
+ if (typeof value === 'string')
19
+ return boundedString(value);
20
+ if (typeof value === 'number' || typeof value === 'boolean')
21
+ return value;
22
+ if (depth >= 3)
23
+ return '[object]';
24
+ if (Array.isArray(value)) {
25
+ const limited = value.slice(0, OBSERVABILITY_ARRAY_MAX_ITEMS).map((entry) => boundedPreviewValue(entry, depth + 1));
26
+ if (value.length > OBSERVABILITY_ARRAY_MAX_ITEMS) {
27
+ limited.push(`[${value.length - OBSERVABILITY_ARRAY_MAX_ITEMS} more]`);
28
+ }
29
+ return limited;
30
+ }
31
+ if (typeof value === 'object') {
32
+ const out = {};
33
+ const entries = Object.entries(value).slice(0, OBSERVABILITY_OBJECT_MAX_KEYS);
34
+ for (const [key, entry] of entries)
35
+ out[key] = boundedPreviewValue(entry, depth + 1);
36
+ const keyCount = Object.keys(value).length;
37
+ if (keyCount > OBSERVABILITY_OBJECT_MAX_KEYS)
38
+ out._truncatedKeys = keyCount - OBSERVABILITY_OBJECT_MAX_KEYS;
39
+ return out;
40
+ }
41
+ return `[${typeof value}]`;
42
+ }
43
+ export function boundedPreview(value) {
44
+ const bounded = boundedPreviewValue(value);
45
+ const preview = JSON.stringify(bounded) ?? String(bounded);
46
+ return preview.length > OBSERVABILITY_PREVIEW_MAX_CHARS
47
+ ? `${preview.slice(0, OBSERVABILITY_PREVIEW_MAX_CHARS)}...`
48
+ : preview;
49
+ }
50
+ export function withProcessArtifact(agentArtifacts, process) {
51
+ if (!process)
52
+ return agentArtifacts;
53
+ const processEntry = {
54
+ ref: process.ref,
55
+ stdoutTail: process.stdoutTail,
56
+ stderrTail: process.stderrTail,
57
+ };
58
+ if (agentArtifacts && typeof agentArtifacts === 'object' && !Array.isArray(agentArtifacts)) {
59
+ return { ...agentArtifacts, process: processEntry };
60
+ }
61
+ return { agent: agentArtifacts ?? null, process: processEntry };
62
+ }
63
+ export function runnerError(message, process) {
64
+ return new RunAgentError(message, withProcessArtifact(undefined, process));
65
+ }
66
+ export function buildUsageCosts(step, profile, usage) {
67
+ const inputTokens = usage.inputTokens ?? 0;
68
+ const outputTokens = usage.outputTokens ?? 0;
69
+ const reportedUsd = typeof usage.costUsd === 'number' && Number.isFinite(usage.costUsd) ? usage.costUsd : undefined;
70
+ if (inputTokens === 0 && outputTokens === 0 && reportedUsd === undefined)
71
+ return [];
72
+ const computed = (inputTokens / 1_000_000) * profile.costPerInput +
73
+ (outputTokens / 1_000_000) * profile.costPerOutput;
74
+ return [
75
+ {
76
+ modelProfile: step.modelProfile,
77
+ inputTokens,
78
+ outputTokens,
79
+ costAmount: reportedUsd ?? computed,
80
+ currency: 'USD',
81
+ },
82
+ ];
83
+ }
84
+ export function buildAttemptResult(agent, step, costs, processSnapshot) {
85
+ if (agent.needsHuman) {
86
+ return {
87
+ output: agent.output,
88
+ verdict: agent.verdict,
89
+ artifacts: withProcessArtifact(agent.artifacts, processSnapshot),
90
+ nextSteps: [],
91
+ costs,
92
+ needsHuman: true,
93
+ lesson: agent.lesson,
94
+ };
95
+ }
96
+ return {
97
+ output: agent.output,
98
+ verdict: agent.verdict,
99
+ artifacts: withProcessArtifact(agent.artifacts, processSnapshot),
100
+ nextSteps: normalizeNextSteps(agent.nextSteps, step),
101
+ costs,
102
+ needsHuman: false,
103
+ lesson: agent.lesson,
104
+ };
105
+ }
106
+ //# sourceMappingURL=runner-common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner-common.js","sourceRoot":"","sources":["../../src/worker/runner-common.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,UAAU,GAAG,KAAK,CAAC;AACzB,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAC9C,MAAM,6BAA6B,GAAG,CAAC,CAAC;AACxC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AACzC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAiB3C,MAAM,UAAU,IAAI,CAAC,IAAY;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,OAAO,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC5E,CAAC;AAED,SAAS,aAAa,CAAC,KAAa,EAAE,QAAQ,GAAG,8BAA8B;IAC7E,OAAO,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc,EAAE,KAAK,GA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AK,CAAC,SAAS,EAAE,eAAe,CAAC;QAChE,SAAS,EAAE,kBAAkB,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC;QACpD,KAAK;QACL,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC;AACJ,CAAC"}
@@ -7,7 +7,9 @@ export function createRunAgent(deps) {
7
7
  case 'claude-code':
8
8
  return deps.claudeCode(args);
9
9
  case 'codex':
10
- throw new Error('RUNNER_NOT_IMPLEMENTED: codex runner is a later plan');
10
+ if (!deps.codex)
11
+ throw new Error('RUNNER_NOT_IMPLEMENTED: codex runner not wired');
12
+ return deps.codex(args);
11
13
  case 'script':
12
14
  case 'stub-agent':
13
15
  if (!deps.script)
@@ -1 +1 @@
1
- {"version":3,"file":"runner-dispatch.js","sourceRoot":"","sources":["../../src/worker/runner-dispatch.ts"],"names":[],"mappings":"AAEA,kGAAkG;AAClG,6FAA6F;AAC7F,yDAAyD;AACzD,MAAM,UAAU,cAAc,CAAC,IAAiD;IAC9E,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACzB,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC/B,KAAK,OAAO;gBACV,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAC1E,KAAK,QAAQ,CAAC;YACd,KAAK,YAAY;gBACf,IAAI,CAAC,IAAI,CAAC,MAAM;oBAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;gBACrF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3B;gBACE,MAAM,IAAI,KAAK,CAAC,2CAA2C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"runner-dispatch.js","sourceRoot":"","sources":["../../src/worker/runner-dispatch.ts"],"names":[],"mappings":"AAEA,kGAAkG;AAClG,6FAA6F;AAC7F,yDAAyD;AACzD,MAAM,UAAU,cAAc,CAAC,IAAmE;IAChG,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACzB,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC/B,KAAK,OAAO;gBACV,IAAI,CAAC,IAAI,CAAC,KAAK;oBAAE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;gBACnF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC1B,KAAK,QAAQ,CAAC;YACd,KAAK,YAAY;gBACf,IAAI,CAAC,IAAI,CAAC,MAAM;oBAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;gBACrF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3B;gBACE,MAAM,IAAI,KAAK,CAAC,2CAA2C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/worker/runner.ts"],"names":[],"mappings":"AA0BA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,SAAS,CAAW;IAE7B,YAAY,OAAe,EAAE,SAAmB;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,UAAU,0BAA0B,CAAC,GAAY;IACrD,OAAO,GAAG,YAAY,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC"}
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/worker/runner.ts"],"names":[],"mappings":"AA2BA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,SAAS,CAAW;IAE7B,YAAY,OAAe,EAAE,SAAmB;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,UAAU,0BAA0B,CAAC,GAAY;IACrD,OAAO,GAAG,YAAY,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC"}
@@ -1,17 +1,17 @@
1
1
  // Zero-cost stub runner for integration testing and smoke verification.
2
2
  //
3
- // GENERIC (plan 0015 slice 4): the stub is role-AGNOSTIC. It emits a passing result
4
- // (`output.verdict:'PASS'`) regardless of role so e2e happy paths complete end-to-end at zero cost.
3
+ // GENERIC (plan 0015 slice 4): the stub is role-AGNOSTIC. It emits a top-level passing result
4
+ // (`verdict:'approved'`) regardless of role so smoke paths complete end-to-end at zero cost.
5
5
  // Real, scenario-specific verdicts are scripted by the e2e kit's agent; the stub no longer encodes any
6
6
  // pipeline-role knowledge (no role-name branching, no `nextSteps` — the data-driven engine sequences
7
7
  // nodes from the template, never from a runner-returned chain).
8
8
  export const stubRunAgent = async ({ role, step, context }) => {
9
9
  const output = {
10
10
  echo: `[stub] role=${role.name} step=${step.id} contextSize=${context.length}`,
11
- verdict: 'PASS',
12
11
  };
13
12
  const result = {
14
13
  output,
14
+ verdict: 'approved',
15
15
  nextSteps: [],
16
16
  costs: [],
17
17
  needsHuman: false,
@@ -1 +1 @@
1
- {"version":3,"file":"stub-runner.js","sourceRoot":"","sources":["../../src/worker/stub-runner.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,EAAE;AACF,oFAAoF;AACpF,oGAAoG;AACpG,uGAAuG;AACvG,qGAAqG;AACrG,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAa,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IACtE,MAAM,MAAM,GAA4B;QACtC,IAAI,EAAE,eAAe,IAAI,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE,gBAAgB,OAAO,CAAC,MAAM,EAAE;QAC9E,OAAO,EAAE,MAAM;KAChB,CAAC;IAEF,MAAM,MAAM,GAAkB;QAC5B,MAAM;QACN,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,KAAK;KAClB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
1
+ {"version":3,"file":"stub-runner.js","sourceRoot":"","sources":["../../src/worker/stub-runner.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,EAAE;AACF,8FAA8F;AAC9F,6FAA6F;AAC7F,uGAAuG;AACvG,qGAAqG;AACrG,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAa,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IACtE,MAAM,MAAM,GAA4B;QACtC,IAAI,EAAE,eAAe,IAAI,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE,gBAAgB,OAAO,CAAC,MAAM,EAAE;KAC/E,CAAC;IAEF,MAAM,MAAM,GAAkB;QAC5B,MAAM;QACN,OAAO,EAAE,UAAU;QACnB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,KAAK;KAClB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revisium/orchestrator",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.7",
4
4
  "description": "Local orchestrator for software-development tasks driven by short-lived AI agents",
5
5
  "keywords": [
6
6
  "agents",
@@ -1,28 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Module } from '@nestjs/common';
8
- import { EngineModule } from './engine/dbos.module.js';
9
- import { McpModule } from './mcp/mcp.module.js';
10
- import { PipelineModule } from './pipeline/pipeline.module.js';
11
- import { HostLifecycle } from './host/host.lifecycle.js';
12
- /**
13
- * Root NestJS module for the agent-orchestrator host.
14
- *
15
- * PipelineModule is imported so PipelineService is constructed (and registers
16
- * its DBOS workflow/step/queue) BEFORE HostLifecycle.onApplicationBootstrap()
17
- * calls dbosService.launch() — required by DBOS recovery (OQ-4).
18
- */
19
- let AppModule = class AppModule {
20
- };
21
- AppModule = __decorate([
22
- Module({
23
- imports: [EngineModule, PipelineModule, McpModule],
24
- providers: [HostLifecycle],
25
- })
26
- ], AppModule);
27
- export { AppModule };
28
- //# sourceMappingURL=app.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;;;;;GAMG;AAKI,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,SAAS;IAJrB,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,SAAS,CAAC;QAClD,SAAS,EAAE,CAAC,aAAa,CAAC;KAC3B,CAAC;GACW,SAAS,CAAG"}
@@ -1,100 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import { join } from 'node:path';
3
- import { isHealthy, repoRoot, resolvePorts, revisiumUri } from '../config.js';
4
- import { applyAdditiveSchemaMigration } from '../../control-plane/schema-migration.js';
5
- import { seedDefaultPlaybook, } from '../../control-plane/seed-default-playbook.js';
6
- import { withRevisiumService } from './revisium-context.js';
7
- /** Run the default-playbook seed against the live draft scope (needs a running daemon). */
8
- async function runDefaultPlaybookSeed() {
9
- return withRevisiumService((await import('../../revisium/playbooks.service.js')).PlaybooksService, (service) => seedDefaultPlaybook(service));
10
- }
11
- /**
12
- * Install the BUILT-IN DEFAULT playbook (slice 5, plan 0015) so a fresh control-plane has a working
13
- * `feature-development` + `local-change` pipeline out-of-the-box (the default is DATA — a committed
14
- * playbook source, NOT engine code). Idempotent + best-effort: a fresh bootstrap installs it once;
15
- * re-running is a no-op. A seed failure must NOT fail the schema bootstrap (the schema is the
16
- * critical artifact) — it is reported so the operator can re-run `revo playbook install`.
17
- *
18
- * `runSeed`/`log` are injected (defaulting to the live daemon seed + stderr) so the logging policy is
19
- * unit-testable without a daemon — the codebase's CLI-helper pattern (see `pollWorkflowState`).
20
- */
21
- export async function seedDefaultPlaybookBestEffort(runSeed = runDefaultPlaybookSeed, log = (message) => console.error(message)) {
22
- try {
23
- const outcome = await runSeed();
24
- if (outcome.status === 'installed') {
25
- const { result } = outcome;
26
- log(`Seeded default playbook ${result.playbookId} ` +
27
- `(${result.roles} roles, ${result.pipelines} pipelines).`);
28
- }
29
- else if (outcome.status === 'already-installed') {
30
- log('Default playbook already installed — skipping seed.');
31
- }
32
- }
33
- catch (err) {
34
- log(`Default playbook seed failed (schema bootstrap still applied): ${String(err)}. ` +
35
- 'Re-run with `revo playbook install control-plane/default-playbook --commit`.');
36
- }
37
- }
38
- async function runBootstrap(options) {
39
- const { httpPort } = await resolvePorts();
40
- if (!(await isHealthy(httpPort))) {
41
- console.error('Revisium is not running. Run: revo revisium start');
42
- process.exitCode = 1;
43
- return;
44
- }
45
- const configPath = join(repoRoot, 'control-plane', 'bootstrap.config.json');
46
- const args = [
47
- '-y',
48
- 'revisium@2.5.0-alpha.6',
49
- 'example',
50
- 'bootstrap',
51
- '--config',
52
- configPath,
53
- '--url',
54
- revisiumUri(httpPort),
55
- '--skip-auth',
56
- ];
57
- if (options.commit !== false)
58
- args.push('--commit');
59
- const runExternalBootstrap = async () => {
60
- const child = spawn('npx', args, { stdio: 'inherit' });
61
- const exitCode = await new Promise((resolve) => {
62
- child.on('error', () => resolve(1));
63
- child.on('exit', resolve);
64
- });
65
- return exitCode ?? 1;
66
- };
67
- let exitCode = await runExternalBootstrap();
68
- if (exitCode !== 0) {
69
- const migration = await applyAdditiveSchemaMigration({
70
- configPath,
71
- httpPort,
72
- commit: options.commit,
73
- });
74
- if (migration.patches > 0) {
75
- console.error(`Applied additive schema migration (${migration.patches} patch${migration.patches === 1 ? '' : 'es'}): ` +
76
- migration.updatedTables.join(', '));
77
- exitCode = await runExternalBootstrap();
78
- if (exitCode !== 0) {
79
- console.error('External bootstrap still reports a schema conflict after additive migration; ' +
80
- 'continuing because runtime-compatible schema patches were applied.');
81
- exitCode = 0;
82
- }
83
- }
84
- }
85
- // Seed the built-in default playbook (slice 5) once the schema is in place. Only when committing —
86
- // a non-committed bootstrap leaves a draft, so installing a non-live playbook would be misleading.
87
- if (exitCode === 0 && options.commit !== false) {
88
- await seedDefaultPlaybookBestEffort();
89
- }
90
- process.exitCode = exitCode;
91
- }
92
- export function registerBootstrap(program) {
93
- program
94
- .command('bootstrap')
95
- .description('Bootstrap the control-plane schema')
96
- .option('--commit', 'Commit schema changes', true)
97
- .option('--no-commit', 'Run without committing schema changes')
98
- .action(runBootstrap);
99
- }
100
- //# sourceMappingURL=bootstrap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../src/cli/commands/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EACL,mBAAmB,GAEpB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAM5D,2FAA2F;AAC3F,KAAK,UAAU,sBAAsB;IACnC,OAAO,mBAAmB,CACxB,CAAC,MAAM,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAAC,gBAAgB,EACtE,CAAC,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,UAAoD,sBAAsB,EAC1E,MAAiC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;IAEpE,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,OAAO,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YACnC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;YAC3B,GAAG,CACD,2BAA2B,MAAM,CAAC,UAAU,GAAG;gBAC7C,IAAI,MAAM,CAAC,KAAK,WAAW,MAAM,CAAC,SAAS,cAAc,CAC5D,CAAC;QACJ,CAAC;aAAM,IAAI,OAAO,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