stageflow 0.2.0 → 0.8.0

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 (224) hide show
  1. package/README.md +179 -14
  2. package/dist/agent/activity.d.ts +12 -1
  3. package/dist/agent/activity.js +37 -2
  4. package/dist/agent/activityObserver.d.ts +5 -1
  5. package/dist/agent/activityObserver.js +174 -11
  6. package/dist/agent/cursorProvider.d.ts +1 -10
  7. package/dist/agent/cursorProvider.js +18 -10
  8. package/dist/agent/fakeAgent.js +15 -7
  9. package/dist/agent/piAdapter.d.ts +18 -1
  10. package/dist/agent/piAdapter.js +115 -45
  11. package/dist/agent/port.d.ts +7 -0
  12. package/dist/agent/port.js +3 -0
  13. package/dist/agent/providerAuth.js +12 -7
  14. package/dist/catalog/displayCatalogPath.d.ts +12 -0
  15. package/dist/catalog/displayCatalogPath.js +28 -0
  16. package/dist/cli/artifactCommand.d.ts +10 -0
  17. package/dist/cli/artifactCommand.js +120 -0
  18. package/dist/cli/envelopeCommand.d.ts +32 -0
  19. package/dist/cli/envelopeCommand.js +285 -0
  20. package/dist/cli/exportRunCommand.d.ts +10 -0
  21. package/dist/cli/exportRunCommand.js +150 -0
  22. package/dist/cli/handoffFormat.d.ts +22 -0
  23. package/dist/cli/handoffFormat.js +61 -0
  24. package/dist/cli/initCommand.d.ts +9 -0
  25. package/dist/cli/initCommand.js +71 -0
  26. package/dist/cli/initTemplates.d.ts +3 -0
  27. package/dist/cli/initTemplates.js +19 -0
  28. package/dist/cli/operatorCatalog.d.ts +10 -0
  29. package/dist/cli/operatorCatalog.js +16 -0
  30. package/dist/cli/runCommand.d.ts +7 -1
  31. package/dist/cli/runCommand.js +83 -11
  32. package/dist/cli/runOutput.d.ts +4 -1
  33. package/dist/cli/runOutput.js +36 -8
  34. package/dist/cli/skillsCommand.d.ts +16 -0
  35. package/dist/cli/skillsCommand.js +459 -0
  36. package/dist/cli/validateCommand.d.ts +1 -1
  37. package/dist/cli/validateCommand.js +20 -3
  38. package/dist/cli.d.ts +1 -0
  39. package/dist/cli.js +128 -22
  40. package/dist/config/browseCatalog.d.ts +45 -0
  41. package/dist/config/browseCatalog.js +170 -0
  42. package/dist/config/createPipeline.d.ts +12 -3
  43. package/dist/config/createPipeline.js +292 -100
  44. package/dist/config/createStage.d.ts +10 -4
  45. package/dist/config/createStage.js +44 -14
  46. package/dist/config/listConfig.d.ts +14 -19
  47. package/dist/config/listConfig.js +26 -191
  48. package/dist/config/listModelsFromManifest.d.ts +2 -0
  49. package/dist/config/listModelsFromManifest.js +4 -0
  50. package/dist/config/loadOutcome.d.ts +4 -0
  51. package/dist/config/loadPipeline.d.ts +1 -15
  52. package/dist/config/loadPipeline.js +88 -142
  53. package/dist/config/loadStage.d.ts +4 -0
  54. package/dist/config/loadStage.js +60 -32
  55. package/dist/config/loadStageflowManifest.d.ts +5 -0
  56. package/dist/config/loadStageflowManifest.js +157 -0
  57. package/dist/config/mergePipelineIncludes.d.ts +9 -0
  58. package/dist/config/mergePipelineIncludes.js +141 -0
  59. package/dist/config/normalizePipelineStageEntry.d.ts +18 -0
  60. package/dist/config/normalizePipelineStageEntry.js +210 -0
  61. package/dist/config/pipelineStageKeys.d.ts +4 -0
  62. package/dist/config/pipelineStageKeys.js +14 -0
  63. package/dist/config/resolveCatalogContext.d.ts +13 -0
  64. package/dist/config/resolveCatalogContext.js +13 -0
  65. package/dist/config/resolveForkEmitContext.d.ts +4 -0
  66. package/dist/config/resolveForkEmitContext.js +34 -0
  67. package/dist/config/resolvePipelineDag.d.ts +5 -1
  68. package/dist/config/resolvePipelineDag.js +86 -36
  69. package/dist/config/scanCatalogPaths.d.ts +4 -0
  70. package/dist/config/scanCatalogPaths.js +83 -0
  71. package/dist/config/validateCatalog.d.ts +22 -4
  72. package/dist/config/validateCatalog.js +169 -132
  73. package/dist/envelope/check.d.ts +2 -0
  74. package/dist/envelope/check.js +58 -0
  75. package/dist/envelope/cloneForks.d.ts +2 -0
  76. package/dist/envelope/cloneForks.js +62 -0
  77. package/dist/envelope/forkChoice.d.ts +3 -0
  78. package/dist/envelope/forkChoice.js +47 -0
  79. package/dist/index.d.ts +6 -0
  80. package/dist/index.js +6 -0
  81. package/dist/mcp/catalogTools.d.ts +3 -0
  82. package/dist/mcp/catalogTools.js +187 -0
  83. package/dist/mcp/controlTools.d.ts +3 -0
  84. package/dist/mcp/controlTools.js +147 -0
  85. package/dist/mcp/deps.d.ts +11 -0
  86. package/dist/mcp/deps.js +1 -0
  87. package/dist/mcp/projectRun.d.ts +1 -37
  88. package/dist/mcp/projectRun.js +1 -57
  89. package/dist/mcp/resources.d.ts +5 -0
  90. package/dist/mcp/resources.js +45 -0
  91. package/dist/mcp/server.d.ts +16 -3
  92. package/dist/mcp/server.js +159 -3
  93. package/dist/mcp/toolResults.d.ts +7 -0
  94. package/dist/mcp/toolResults.js +6 -0
  95. package/dist/mcp/tools.d.ts +2 -7
  96. package/dist/mcp/tools.js +52 -86
  97. package/dist/mcp/waitRun.d.ts +46 -0
  98. package/dist/mcp/waitRun.js +146 -0
  99. package/dist/mcp/waitingGates.d.ts +12 -0
  100. package/dist/mcp/waitingGates.js +83 -0
  101. package/dist/project/findProjectRoot.d.ts +2 -0
  102. package/dist/project/findProjectRoot.js +51 -0
  103. package/dist/project/globalHome.d.ts +2 -0
  104. package/dist/project/globalHome.js +19 -0
  105. package/dist/project/resolveProjectContext.d.ts +9 -0
  106. package/dist/project/resolveProjectContext.js +38 -0
  107. package/dist/project/resolveStageflowContext.d.ts +11 -0
  108. package/dist/project/resolveStageflowContext.js +66 -0
  109. package/dist/projection/projectRun.d.ts +44 -0
  110. package/dist/projection/projectRun.js +71 -0
  111. package/dist/prompt/priorEnvelope.d.ts +1 -1
  112. package/dist/prompt/priorEnvelope.js +4 -1
  113. package/dist/runstore/normalizeCatalogPath.d.ts +1 -0
  114. package/dist/runstore/normalizeCatalogPath.js +4 -0
  115. package/dist/runstore/paths.js +2 -0
  116. package/dist/runstore/pipelineDagSnapshot.d.ts +9 -0
  117. package/dist/runstore/pipelineDagSnapshot.js +90 -1
  118. package/dist/runstore/port.d.ts +22 -2
  119. package/dist/runstore/port.js +4 -1
  120. package/dist/runstore/runProjection.d.ts +1 -1
  121. package/dist/runstore/runProjection.js +25 -4
  122. package/dist/runstore/sqlite/SqliteRunStore.d.ts +3 -2
  123. package/dist/runstore/sqlite/SqliteRunStore.js +65 -7
  124. package/dist/runstore/sqlite/schema.d.ts +1 -1
  125. package/dist/runstore/sqlite/schema.js +4 -1
  126. package/dist/runstore/stageInstanceId.d.ts +4 -0
  127. package/dist/runstore/stageInstanceId.js +23 -0
  128. package/dist/runstore/syntheticStageSnapshot.d.ts +1 -1
  129. package/dist/runstore/syntheticStageSnapshot.js +2 -1
  130. package/dist/runstore/trackProjection.js +28 -12
  131. package/dist/runstore/workspaceLayout.d.ts +1 -0
  132. package/dist/runstore/workspaceLayout.js +1 -1
  133. package/dist/runtime/cloneSchedule.d.ts +18 -0
  134. package/dist/runtime/cloneSchedule.js +233 -0
  135. package/dist/runtime/credentialBinding.d.ts +8 -6
  136. package/dist/runtime/credentialBinding.js +18 -24
  137. package/dist/runtime/envelopeRouting.d.ts +2 -1
  138. package/dist/runtime/envelopeRouting.js +80 -13
  139. package/dist/runtime/pipelineRunner.d.ts +3 -0
  140. package/dist/runtime/pipelineRunner.js +15 -1
  141. package/dist/runtime/pipelineScheduler.d.ts +8 -2
  142. package/dist/runtime/pipelineScheduler.js +215 -39
  143. package/dist/runtime/reloadRunCatalog.d.ts +5 -0
  144. package/dist/runtime/reloadRunCatalog.js +44 -0
  145. package/dist/runtime/resumeReconstruct.d.ts +1 -0
  146. package/dist/runtime/resumeReconstruct.js +31 -10
  147. package/dist/runtime/runChangeBus.d.ts +18 -0
  148. package/dist/runtime/runChangeBus.js +83 -0
  149. package/dist/runtime/runManager.d.ts +4 -0
  150. package/dist/runtime/runManager.js +36 -16
  151. package/dist/runtime/settingsFile.d.ts +12 -0
  152. package/dist/runtime/settingsFile.js +87 -6
  153. package/dist/runtime/stageAttemptBootstrap.d.ts +1 -0
  154. package/dist/runtime/stageAttemptBootstrap.js +18 -7
  155. package/dist/runtime/stageProcessLauncher.js +3 -0
  156. package/dist/runtime/stageRecovery.js +3 -1
  157. package/dist/runtime/stageRunner.d.ts +1 -0
  158. package/dist/runtime/stageRunner.js +17 -15
  159. package/dist/runtime/stageWorker.js +13 -10
  160. package/dist/server/bootstrap.d.ts +32 -0
  161. package/dist/server/bootstrap.js +56 -0
  162. package/dist/server/createHttpHost.d.ts +34 -0
  163. package/dist/server/createHttpHost.js +70 -0
  164. package/dist/server/http.d.ts +6 -13
  165. package/dist/server/http.js +297 -352
  166. package/dist/server/mcpHost.d.ts +22 -0
  167. package/dist/server/mcpHost.js +21 -0
  168. package/dist/server/operatorResults.d.ts +13 -0
  169. package/dist/server/operatorResults.js +22 -0
  170. package/dist/tools/emitStageEnvelope.d.ts +12 -1
  171. package/dist/tools/emitStageEnvelope.js +27 -1
  172. package/dist/types/envelope.d.ts +3 -0
  173. package/dist/types/forkChoice.d.ts +30 -0
  174. package/dist/types/forkChoice.js +1 -0
  175. package/dist/types/pipeline.d.ts +59 -2
  176. package/dist/types/stageflowManifest.d.ts +23 -0
  177. package/dist/types/stageflowManifest.js +1 -0
  178. package/dist/ui/assets/{index-DCsDopak.css → index-C3N7MXAC.css} +1 -1
  179. package/dist/ui/assets/index-CSoGDA3A.js +118 -0
  180. package/dist/ui/index.html +3 -2
  181. package/dist/ui/stageflow-icon.svg +12 -0
  182. package/package.json +8 -5
  183. package/skills/install-suite.sh +107 -0
  184. package/skills/stageflow/SKILL.md +26 -0
  185. package/skills/stageflow/references/control-surface.md +26 -0
  186. package/skills/stageflow/scripts/detect-host.mjs +54 -0
  187. package/skills/stageflow/scripts/detect-host.test.mjs +97 -0
  188. package/skills/stageflow-author/SKILL.md +58 -0
  189. package/skills/stageflow-author/assets/examples/branch-decision/hotfix.yaml +10 -0
  190. package/skills/stageflow-author/assets/examples/branch-decision/release-gate.pipeline.yaml +12 -0
  191. package/skills/stageflow-author/assets/examples/branch-decision/run-tests.yaml +13 -0
  192. package/skills/stageflow-author/assets/examples/branch-decision/ship.yaml +10 -0
  193. package/skills/stageflow-author/assets/examples/linear-review/draft.yaml +9 -0
  194. package/skills/stageflow-author/assets/examples/linear-review/publish.yaml +10 -0
  195. package/skills/stageflow-author/assets/examples/linear-review/review-loop.pipeline.yaml +10 -0
  196. package/skills/stageflow-author/assets/examples/linear-review/review.yaml +15 -0
  197. package/skills/stageflow-author/assets/examples/non-sdlc-digest/gather.yaml +9 -0
  198. package/skills/stageflow-author/assets/examples/non-sdlc-digest/research-digest.pipeline.yaml +10 -0
  199. package/skills/stageflow-author/assets/examples/non-sdlc-digest/send.yaml +10 -0
  200. package/skills/stageflow-author/assets/examples/non-sdlc-digest/summarize.yaml +9 -0
  201. package/skills/stageflow-author/references/catalog-mapping.md +131 -0
  202. package/skills/stageflow-author/references/catalog-write-conventions.md +29 -0
  203. package/skills/stageflow-author/references/stage-prompt-template.md +55 -0
  204. package/skills/stageflow-author/references/validate-and-report.md +38 -0
  205. package/skills/stageflow-delegate/SKILL.md +18 -0
  206. package/skills/stageflow-delegate/references/authoring-or-run.md +15 -0
  207. package/skills/stageflow-delegate/references/example-walkthrough.md +30 -0
  208. package/skills/stageflow-delegate/references/pattern-detection.md +44 -0
  209. package/skills/stageflow-run/SKILL.md +151 -0
  210. package/skills/stageflow-run/references/mcp-call.md +17 -0
  211. package/skills/stageflow-run/references/task-and-pipeline-selection.md +52 -0
  212. package/skills/stageflow-run/scripts/mcp-call.mjs +299 -0
  213. package/skills/stageflow-run/scripts/mcp-call.test.mjs +271 -0
  214. package/skills/stageflow-session-capture/SKILL.md +94 -0
  215. package/skills/stageflow-session-capture/assets/example-pipeline/example.pipeline.yaml +7 -0
  216. package/skills/stageflow-session-capture/assets/example-pipeline/implement.yaml +8 -0
  217. package/skills/stageflow-session-capture/assets/example-pipeline/research.yaml +8 -0
  218. package/skills/stageflow-session-capture/references/catalog-authoring.md +40 -0
  219. package/skills/stageflow-session-capture/references/transcript-sources.md +25 -0
  220. package/skills/stageflow-session-capture/scripts/check-provider-gate.mjs +43 -0
  221. package/skills/stageflow-session-capture/scripts/locate-session-transcript.mjs +141 -0
  222. package/skills/stageflow-session-capture/scripts/resolve-catalog-id.mjs +119 -0
  223. package/skills/stageflow-setup/SKILL.md +110 -0
  224. package/dist/ui/assets/index-Cry0Tpfx.js +0 -118
@@ -0,0 +1,22 @@
1
+ import type { AgentPort } from "../agent/port.js";
2
+ import type { ProviderAuthContext } from "../agent/providerAuth.js";
3
+ import type { RunStoreKind } from "../runstore/createStore.js";
4
+ import type { RunStore } from "../runstore/port.js";
5
+ import type { RunChangeBus } from "../runtime/runChangeBus.js";
6
+ import { DEFAULT_PORT, type HttpHostEnvelope } from "./createHttpHost.js";
7
+ export type McpServerOptions = {
8
+ agent: AgentPort;
9
+ cwd?: string;
10
+ agentDir?: string;
11
+ rootDir?: string;
12
+ store?: RunStore;
13
+ storeKind?: RunStoreKind;
14
+ port?: number;
15
+ host?: string;
16
+ maxConcurrent?: number;
17
+ providerAuthContext?: ProviderAuthContext;
18
+ mcpStateless?: boolean;
19
+ runChangeBus?: RunChangeBus;
20
+ };
21
+ export declare function startMcpServer(options: McpServerOptions): Promise<HttpHostEnvelope>;
22
+ export { DEFAULT_PORT };
@@ -0,0 +1,21 @@
1
+ import { bootstrapStageflowHost, } from "./bootstrap.js";
2
+ import { createHttpHost, DEFAULT_PORT, } from "./createHttpHost.js";
3
+ export async function startMcpServer(options) {
4
+ const host = options.host ?? "127.0.0.1";
5
+ const port = options.port ?? DEFAULT_PORT;
6
+ const boot = await bootstrapStageflowHost(options);
7
+ return createHttpHost({
8
+ boot,
9
+ host,
10
+ port,
11
+ routes: async ({ method, pathname, res, json, boot: b }) => {
12
+ if (method === "GET" && pathname === "/api/health") {
13
+ json(res, 200, b.manager.getHealth());
14
+ return true;
15
+ }
16
+ json(res, 404, { error: "Not found" });
17
+ return true;
18
+ },
19
+ });
20
+ }
21
+ export { DEFAULT_PORT };
@@ -0,0 +1,13 @@
1
+ import type { RetryStageResult, StartRunResult } from "../runtime/runManager.js";
2
+ export declare function inferRetryStageErrorCode(reason: string): string | undefined;
3
+ export declare function mapRetryStageFailure(result: Extract<RetryStageResult, {
4
+ ok: false;
5
+ }>): {
6
+ error: string;
7
+ code?: string;
8
+ } & Record<string, unknown>;
9
+ export declare function mapStartFailure(result: Extract<StartRunResult, {
10
+ ok: false;
11
+ }>): {
12
+ error: string;
13
+ } & Record<string, unknown>;
@@ -0,0 +1,22 @@
1
+ export function inferRetryStageErrorCode(reason) {
2
+ if (/retry already in progress/i.test(reason))
3
+ return "retry_in_progress";
4
+ if (/waiting for input/i.test(reason))
5
+ return "hitl_not_retriable";
6
+ if (/already has active orchestration/i.test(reason))
7
+ return "run_not_retryable";
8
+ if (/run is not failed/i.test(reason))
9
+ return "run_not_retryable";
10
+ if (/stage is not failed/i.test(reason))
11
+ return "stage_not_failed";
12
+ return undefined;
13
+ }
14
+ export function mapRetryStageFailure(result) {
15
+ const { ok: _ok, status: _status, reason, ...rest } = result;
16
+ const code = inferRetryStageErrorCode(reason);
17
+ return { error: reason, ...(code ? { code } : {}), ...rest };
18
+ }
19
+ export function mapStartFailure(result) {
20
+ const { ok: _ok, status: _status, reason, ...rest } = result;
21
+ return { error: reason, ...rest };
22
+ }
@@ -11,11 +11,12 @@
11
11
  */
12
12
  import { Type } from "typebox";
13
13
  import type { StageEnvelope } from "../types/envelope.js";
14
+ import type { CloneEmitContext, ForkEmitContext } from "../types/forkChoice.js";
14
15
  export type EmitCapture = {
15
16
  envelope?: StageEnvelope;
16
17
  error?: string;
17
18
  };
18
- export declare function createEmitStageEnvelopeTool(capture: EmitCapture, payloadSchema?: unknown): {
19
+ export declare function createEmitStageEnvelopeTool(capture: EmitCapture, payloadSchema?: unknown, forkEmitContext?: ForkEmitContext, cloneEmitContext?: CloneEmitContext): {
19
20
  name: string;
20
21
  label: string;
21
22
  description: string;
@@ -24,6 +25,16 @@ export declare function createEmitStageEnvelopeTool(capture: EmitCapture, payloa
24
25
  summary: Type.TString;
25
26
  artifacts: Type.TArray<Type.TString>;
26
27
  payload: Type.TSchema;
28
+ fork_choice: Type.TArray<Type.TString>;
29
+ clone_forks?: Type.TArray<Type.TObject<{
30
+ successor_id: Type.TString;
31
+ action: Type.TUnion<[Type.TLiteral<"skip">, Type.TLiteral<"once">, Type.TLiteral<"fanout">]>;
32
+ envelope: Type.TOptional<Type.TUnknown>;
33
+ mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"parallel">, Type.TLiteral<"sequential">]>>;
34
+ clones: Type.TOptional<Type.TArray<Type.TObject<{
35
+ envelope: Type.TUnknown;
36
+ }>>>;
37
+ }>> | undefined;
27
38
  stage_id: Type.TOptional<Type.TString>;
28
39
  notes: Type.TOptional<Type.TString>;
29
40
  }>;
@@ -11,6 +11,8 @@
11
11
  */
12
12
  import { Type } from "typebox";
13
13
  import { assertRequiredEnvelope, isAdvancingEnvelope, } from "../envelope/check.js";
14
+ import { assertCloneForks } from "../envelope/cloneForks.js";
15
+ import { normalizeForkChoice } from "../envelope/forkChoice.js";
14
16
  import { assertEnvelopePayload, compilePayloadSchema, } from "../envelope/payloadSchema.js";
15
17
  function toolResult(text, details, options) {
16
18
  return {
@@ -20,10 +22,23 @@ function toolResult(text, details, options) {
20
22
  ...(options?.terminate ? { terminate: true } : {}),
21
23
  };
22
24
  }
23
- export function createEmitStageEnvelopeTool(capture, payloadSchema) {
25
+ export function createEmitStageEnvelopeTool(capture, payloadSchema, forkEmitContext, cloneEmitContext) {
24
26
  const compiledPayload = payloadSchema !== undefined
25
27
  ? compilePayloadSchema(payloadSchema)
26
28
  : undefined;
29
+ const cloneForksSchema = Type.Array(Type.Object({
30
+ successor_id: Type.String(),
31
+ action: Type.Union([
32
+ Type.Literal("skip"),
33
+ Type.Literal("once"),
34
+ Type.Literal("fanout"),
35
+ ]),
36
+ envelope: Type.Optional(Type.Unknown()),
37
+ mode: Type.Optional(Type.Union([Type.Literal("parallel"), Type.Literal("sequential")])),
38
+ clones: Type.Optional(Type.Array(Type.Object({
39
+ envelope: Type.Unknown(),
40
+ }))),
41
+ }));
27
42
  return {
28
43
  name: "emit_stage_envelope",
29
44
  label: "Emit stage envelope",
@@ -35,6 +50,10 @@ export function createEmitStageEnvelopeTool(capture, payloadSchema) {
35
50
  payload: compiledPayload !== undefined
36
51
  ? compiledPayload
37
52
  : Type.Optional(Type.Record(Type.String(), Type.Unknown())),
53
+ fork_choice: forkEmitContext !== undefined
54
+ ? Type.Array(Type.String())
55
+ : Type.Optional(Type.Array(Type.String())),
56
+ ...(cloneEmitContext !== undefined ? { clone_forks: cloneForksSchema } : {}),
38
57
  stage_id: Type.Optional(Type.String()),
39
58
  notes: Type.Optional(Type.String()),
40
59
  }),
@@ -43,6 +62,13 @@ export function createEmitStageEnvelopeTool(capture, payloadSchema) {
43
62
  return toolResult("Envelope already accepted; later emits are ignored.", { advancing: isAdvancingEnvelope(capture.envelope), error: "" }, { terminate: true });
44
63
  }
45
64
  try {
65
+ const record = params;
66
+ if (record.status !== "failure" && forkEmitContext !== undefined) {
67
+ normalizeForkChoice(record.fork_choice, "emit", forkEmitContext);
68
+ }
69
+ if (record.status !== "failure" && cloneEmitContext !== undefined) {
70
+ assertCloneForks(params, cloneEmitContext);
71
+ }
46
72
  const envelope = assertRequiredEnvelope(params);
47
73
  assertEnvelopePayload(envelope, payloadSchema);
48
74
  capture.envelope = envelope;
@@ -1,9 +1,12 @@
1
+ import type { CloneForkItem } from "./forkChoice.js";
1
2
  export type EnvelopeStatus = "success" | "failure";
2
3
  export type StageEnvelope = {
3
4
  status: EnvelopeStatus;
4
5
  summary: string;
5
6
  artifacts: string[];
6
7
  payload?: Record<string, unknown>;
8
+ fork_choice?: string[];
9
+ clone_forks?: CloneForkItem[];
7
10
  stage_id?: string;
8
11
  notes?: string;
9
12
  };
@@ -0,0 +1,30 @@
1
+ import type { StageEnvelope } from "./envelope.js";
2
+ export type ForkChoiceShape = {
3
+ cardinality: "one" | "subset";
4
+ allowNone: boolean;
5
+ };
6
+ export type ForkEmitContext = {
7
+ immediateSuccessorIds: string[];
8
+ forkShape: ForkChoiceShape | null;
9
+ };
10
+ export type CloneForkItem = {
11
+ successor_id: string;
12
+ action: "skip";
13
+ } | {
14
+ successor_id: string;
15
+ action: "once";
16
+ envelope: StageEnvelope;
17
+ } | {
18
+ successor_id: string;
19
+ action: "fanout";
20
+ mode: "parallel" | "sequential";
21
+ clones: Array<{
22
+ envelope: StageEnvelope;
23
+ }>;
24
+ };
25
+ export type CloneEmitContext = {
26
+ clonableSuccessors: Array<{
27
+ successorId: string;
28
+ cloneCap: number;
29
+ }>;
30
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,17 +1,72 @@
1
+ import type { StageConfig, StageGateKind } from "./stage.js";
1
2
  export type PipelineConfig = {
2
3
  id: string;
3
4
  stages: string[];
4
5
  };
6
+ export type PipelineForkConfig = {
7
+ select: "one" | "subset";
8
+ allow_none: boolean;
9
+ };
5
10
  export type PipelineStageRef = {
6
11
  id: string;
7
12
  needs?: string;
13
+ fork?: {
14
+ select: "one" | "subset";
15
+ allow_none?: boolean;
16
+ };
17
+ clonable?: boolean;
18
+ clone_cap?: number;
19
+ };
20
+ export type PipelineStageYamlEntry = PipelineStageRef & {
21
+ uses?: string;
22
+ system_prompt?: string;
23
+ model?: string;
24
+ payload_schema?: unknown;
25
+ gate_kinds?: StageGateKind[];
26
+ skill?: string;
27
+ };
28
+ export type PipelineIncludeEntry = {
29
+ local: string;
30
+ };
31
+ export type PipelineFragmentConfig = {
32
+ include?: PipelineIncludeEntry[];
33
+ stages?: PipelineStageYamlEntry[];
34
+ };
35
+ export type NormalizedPipelineStageEntry = {
36
+ id: string;
37
+ needs?: string;
38
+ fork?: {
39
+ select: "one" | "subset";
40
+ allow_none?: boolean;
41
+ };
42
+ clonable?: boolean;
43
+ clone_cap?: number;
44
+ skill?: string;
45
+ body: {
46
+ kind: "inline";
47
+ raw: Record<string, unknown>;
48
+ } | {
49
+ kind: "uses";
50
+ path: string;
51
+ absolutePath: string;
52
+ };
53
+ declaringPath: string;
54
+ };
55
+ export type PipelineStageSource = {
56
+ kind: "inline";
57
+ } | {
58
+ kind: "file";
59
+ path: string;
8
60
  };
9
- export type PipelineStageYamlEntry = string | PipelineStageRef;
10
61
  export type ResolvedPipelineStageNode = {
11
62
  id: string;
12
63
  needs: string | null;
13
64
  ancestors: string[];
14
65
  stageIndex: number;
66
+ fork?: PipelineForkConfig;
67
+ clonable?: boolean;
68
+ clone_cap?: number;
69
+ definition_id?: string;
15
70
  };
16
71
  export type ResolvedPipelineDag = {
17
72
  nodes: ResolvedPipelineStageNode[];
@@ -20,6 +75,8 @@ export type ResolvedPipelineDag = {
20
75
  };
21
76
  export type LoadedPipeline = {
22
77
  pipeline: PipelineConfig;
23
- stages: import("./stage.js").StageConfig[];
78
+ stages: StageConfig[];
24
79
  dag: ResolvedPipelineDag;
80
+ pipelinePath: string;
81
+ stageSources?: Record<string, PipelineStageSource>;
25
82
  };
@@ -0,0 +1,23 @@
1
+ export type StageflowManifestVersion = 1;
2
+ export type StageflowManifestCatalog = {
3
+ pipelines: string[];
4
+ tasks: string[];
5
+ patterns?: {
6
+ pipeline?: string;
7
+ task?: string;
8
+ };
9
+ exclude?: string[];
10
+ };
11
+ export type StageflowManifest = {
12
+ version: StageflowManifestVersion;
13
+ catalog: StageflowManifestCatalog;
14
+ };
15
+ export type LoadedManifest = {
16
+ path: string;
17
+ projectRoot: string;
18
+ manifest: StageflowManifest;
19
+ patterns: {
20
+ pipeline: string;
21
+ task: string;
22
+ };
23
+ };
@@ -0,0 +1 @@
1
+ export {};