@cat-factory/orchestration 0.6.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 (182) hide show
  1. package/LICENSE +21 -0
  2. package/dist/container.d.ts +460 -0
  3. package/dist/container.d.ts.map +1 -0
  4. package/dist/container.js +657 -0
  5. package/dist/container.js.map +1 -0
  6. package/dist/index.d.ts +29 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +31 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/modules/board/BoardService.d.ts +125 -0
  11. package/dist/modules/board/BoardService.d.ts.map +1 -0
  12. package/dist/modules/board/BoardService.js +496 -0
  13. package/dist/modules/board/BoardService.js.map +1 -0
  14. package/dist/modules/board/board.logic.d.ts +17 -0
  15. package/dist/modules/board/board.logic.d.ts.map +1 -0
  16. package/dist/modules/board/board.logic.js +51 -0
  17. package/dist/modules/board/board.logic.js.map +1 -0
  18. package/dist/modules/boardScan/BoardScanService.d.ts +35 -0
  19. package/dist/modules/boardScan/BoardScanService.d.ts.map +1 -0
  20. package/dist/modules/boardScan/BoardScanService.js +91 -0
  21. package/dist/modules/boardScan/BoardScanService.js.map +1 -0
  22. package/dist/modules/boardScan/board-scan.logic.d.ts +10 -0
  23. package/dist/modules/boardScan/board-scan.logic.d.ts.map +1 -0
  24. package/dist/modules/boardScan/board-scan.logic.js +26 -0
  25. package/dist/modules/boardScan/board-scan.logic.js.map +1 -0
  26. package/dist/modules/bootstrap/BootstrapService.d.ts +114 -0
  27. package/dist/modules/bootstrap/BootstrapService.d.ts.map +1 -0
  28. package/dist/modules/bootstrap/BootstrapService.js +516 -0
  29. package/dist/modules/bootstrap/BootstrapService.js.map +1 -0
  30. package/dist/modules/clarity/ClarityReviewService.d.ts +48 -0
  31. package/dist/modules/clarity/ClarityReviewService.d.ts.map +1 -0
  32. package/dist/modules/clarity/ClarityReviewService.js +63 -0
  33. package/dist/modules/clarity/ClarityReviewService.js.map +1 -0
  34. package/dist/modules/clarity/clarity.logic.d.ts +36 -0
  35. package/dist/modules/clarity/clarity.logic.d.ts.map +1 -0
  36. package/dist/modules/clarity/clarity.logic.js +98 -0
  37. package/dist/modules/clarity/clarity.logic.js.map +1 -0
  38. package/dist/modules/estimation/estimate.logic.d.ts +11 -0
  39. package/dist/modules/estimation/estimate.logic.d.ts.map +1 -0
  40. package/dist/modules/estimation/estimate.logic.js +37 -0
  41. package/dist/modules/estimation/estimate.logic.js.map +1 -0
  42. package/dist/modules/execution/AgentContextBuilder.d.ts +114 -0
  43. package/dist/modules/execution/AgentContextBuilder.d.ts.map +1 -0
  44. package/dist/modules/execution/AgentContextBuilder.js +316 -0
  45. package/dist/modules/execution/AgentContextBuilder.js.map +1 -0
  46. package/dist/modules/execution/CompanionController.d.ts +60 -0
  47. package/dist/modules/execution/CompanionController.d.ts.map +1 -0
  48. package/dist/modules/execution/CompanionController.js +216 -0
  49. package/dist/modules/execution/CompanionController.js.map +1 -0
  50. package/dist/modules/execution/ExecutionService.d.ts +874 -0
  51. package/dist/modules/execution/ExecutionService.d.ts.map +1 -0
  52. package/dist/modules/execution/ExecutionService.js +2921 -0
  53. package/dist/modules/execution/ExecutionService.js.map +1 -0
  54. package/dist/modules/execution/MergeResolver.d.ts +34 -0
  55. package/dist/modules/execution/MergeResolver.d.ts.map +1 -0
  56. package/dist/modules/execution/MergeResolver.js +81 -0
  57. package/dist/modules/execution/MergeResolver.js.map +1 -0
  58. package/dist/modules/execution/ReviewGateController.d.ts +163 -0
  59. package/dist/modules/execution/ReviewGateController.d.ts.map +1 -0
  60. package/dist/modules/execution/ReviewGateController.js +251 -0
  61. package/dist/modules/execution/ReviewGateController.js.map +1 -0
  62. package/dist/modules/execution/TesterController.d.ts +61 -0
  63. package/dist/modules/execution/TesterController.d.ts.map +1 -0
  64. package/dist/modules/execution/TesterController.js +215 -0
  65. package/dist/modules/execution/TesterController.js.map +1 -0
  66. package/dist/modules/execution/advance.d.ts +84 -0
  67. package/dist/modules/execution/advance.d.ts.map +1 -0
  68. package/dist/modules/execution/advance.js +2 -0
  69. package/dist/modules/execution/advance.js.map +1 -0
  70. package/dist/modules/execution/artifact-review.logic.d.ts +25 -0
  71. package/dist/modules/execution/artifact-review.logic.d.ts.map +1 -0
  72. package/dist/modules/execution/artifact-review.logic.js +39 -0
  73. package/dist/modules/execution/artifact-review.logic.js.map +1 -0
  74. package/dist/modules/execution/ci.logic.d.ts +101 -0
  75. package/dist/modules/execution/ci.logic.d.ts.map +1 -0
  76. package/dist/modules/execution/ci.logic.js +117 -0
  77. package/dist/modules/execution/ci.logic.js.map +1 -0
  78. package/dist/modules/execution/drive.d.ts +47 -0
  79. package/dist/modules/execution/drive.d.ts.map +1 -0
  80. package/dist/modules/execution/drive.js +112 -0
  81. package/dist/modules/execution/drive.js.map +1 -0
  82. package/dist/modules/execution/gates.d.ts +97 -0
  83. package/dist/modules/execution/gates.d.ts.map +1 -0
  84. package/dist/modules/execution/gates.js +2 -0
  85. package/dist/modules/execution/gates.js.map +1 -0
  86. package/dist/modules/execution/individualVendors.logic.d.ts +22 -0
  87. package/dist/modules/execution/individualVendors.logic.d.ts.map +1 -0
  88. package/dist/modules/execution/individualVendors.logic.js +33 -0
  89. package/dist/modules/execution/individualVendors.logic.js.map +1 -0
  90. package/dist/modules/execution/job.logic.d.ts +52 -0
  91. package/dist/modules/execution/job.logic.d.ts.map +1 -0
  92. package/dist/modules/execution/job.logic.js +56 -0
  93. package/dist/modules/execution/job.logic.js.map +1 -0
  94. package/dist/modules/execution/release.logic.d.ts +43 -0
  95. package/dist/modules/execution/release.logic.d.ts.map +1 -0
  96. package/dist/modules/execution/release.logic.js +49 -0
  97. package/dist/modules/execution/release.logic.js.map +1 -0
  98. package/dist/modules/execution/retry.logic.d.ts +40 -0
  99. package/dist/modules/execution/retry.logic.d.ts.map +1 -0
  100. package/dist/modules/execution/retry.logic.js +83 -0
  101. package/dist/modules/execution/retry.logic.js.map +1 -0
  102. package/dist/modules/execution/stepGating.logic.d.ts +15 -0
  103. package/dist/modules/execution/stepGating.logic.d.ts.map +1 -0
  104. package/dist/modules/execution/stepGating.logic.js +29 -0
  105. package/dist/modules/execution/stepGating.logic.js.map +1 -0
  106. package/dist/modules/execution/stepResolvers.d.ts +41 -0
  107. package/dist/modules/execution/stepResolvers.d.ts.map +1 -0
  108. package/dist/modules/execution/stepResolvers.js +2 -0
  109. package/dist/modules/execution/stepResolvers.js.map +1 -0
  110. package/dist/modules/execution/tester-infra.logic.d.ts +42 -0
  111. package/dist/modules/execution/tester-infra.logic.d.ts.map +1 -0
  112. package/dist/modules/execution/tester-infra.logic.js +46 -0
  113. package/dist/modules/execution/tester-infra.logic.js.map +1 -0
  114. package/dist/modules/merge/MergePresetService.d.ts +32 -0
  115. package/dist/modules/merge/MergePresetService.d.ts.map +1 -0
  116. package/dist/modules/merge/MergePresetService.js +109 -0
  117. package/dist/modules/merge/MergePresetService.js.map +1 -0
  118. package/dist/modules/modelDefaults/ModelDefaultsService.d.ts +22 -0
  119. package/dist/modules/modelDefaults/ModelDefaultsService.d.ts.map +1 -0
  120. package/dist/modules/modelDefaults/ModelDefaultsService.js +28 -0
  121. package/dist/modules/modelDefaults/ModelDefaultsService.js.map +1 -0
  122. package/dist/modules/notifications/NotificationService.d.ts +74 -0
  123. package/dist/modules/notifications/NotificationService.d.ts.map +1 -0
  124. package/dist/modules/notifications/NotificationService.js +131 -0
  125. package/dist/modules/notifications/NotificationService.js.map +1 -0
  126. package/dist/modules/observability/LlmObservabilityService.d.ts +121 -0
  127. package/dist/modules/observability/LlmObservabilityService.d.ts.map +1 -0
  128. package/dist/modules/observability/LlmObservabilityService.js +140 -0
  129. package/dist/modules/observability/LlmObservabilityService.js.map +1 -0
  130. package/dist/modules/observability/observability.logic.d.ts +57 -0
  131. package/dist/modules/observability/observability.logic.d.ts.map +1 -0
  132. package/dist/modules/observability/observability.logic.js +186 -0
  133. package/dist/modules/observability/observability.logic.js.map +1 -0
  134. package/dist/modules/pipelines/PipelineService.d.ts +54 -0
  135. package/dist/modules/pipelines/PipelineService.d.ts.map +1 -0
  136. package/dist/modules/pipelines/PipelineService.js +226 -0
  137. package/dist/modules/pipelines/PipelineService.js.map +1 -0
  138. package/dist/modules/pipelines/pipelineShape.d.ts +53 -0
  139. package/dist/modules/pipelines/pipelineShape.d.ts.map +1 -0
  140. package/dist/modules/pipelines/pipelineShape.js +74 -0
  141. package/dist/modules/pipelines/pipelineShape.js.map +1 -0
  142. package/dist/modules/recurring/RecurringPipelineService.d.ts +76 -0
  143. package/dist/modules/recurring/RecurringPipelineService.d.ts.map +1 -0
  144. package/dist/modules/recurring/RecurringPipelineService.js +295 -0
  145. package/dist/modules/recurring/RecurringPipelineService.js.map +1 -0
  146. package/dist/modules/recurring/TrackerSettingsService.d.ts +16 -0
  147. package/dist/modules/recurring/TrackerSettingsService.d.ts.map +1 -0
  148. package/dist/modules/recurring/TrackerSettingsService.js +30 -0
  149. package/dist/modules/recurring/TrackerSettingsService.js.map +1 -0
  150. package/dist/modules/recurring/schedule.logic.d.ts +14 -0
  151. package/dist/modules/recurring/schedule.logic.d.ts.map +1 -0
  152. package/dist/modules/recurring/schedule.logic.js +85 -0
  153. package/dist/modules/recurring/schedule.logic.js.map +1 -0
  154. package/dist/modules/releaseHealth/ReleaseHealthService.d.ts +38 -0
  155. package/dist/modules/releaseHealth/ReleaseHealthService.d.ts.map +1 -0
  156. package/dist/modules/releaseHealth/ReleaseHealthService.js +96 -0
  157. package/dist/modules/releaseHealth/ReleaseHealthService.js.map +1 -0
  158. package/dist/modules/requirements/RequirementReviewService.d.ts +48 -0
  159. package/dist/modules/requirements/RequirementReviewService.d.ts.map +1 -0
  160. package/dist/modules/requirements/RequirementReviewService.js +83 -0
  161. package/dist/modules/requirements/RequirementReviewService.js.map +1 -0
  162. package/dist/modules/requirements/requirements.logic.d.ts +93 -0
  163. package/dist/modules/requirements/requirements.logic.d.ts.map +1 -0
  164. package/dist/modules/requirements/requirements.logic.js +203 -0
  165. package/dist/modules/requirements/requirements.logic.js.map +1 -0
  166. package/dist/modules/review/IterativeReviewService.d.ts +175 -0
  167. package/dist/modules/review/IterativeReviewService.d.ts.map +1 -0
  168. package/dist/modules/review/IterativeReviewService.js +327 -0
  169. package/dist/modules/review/IterativeReviewService.js.map +1 -0
  170. package/dist/modules/serviceFragmentDefaults/ServiceFragmentDefaultsService.d.ts +20 -0
  171. package/dist/modules/serviceFragmentDefaults/ServiceFragmentDefaultsService.d.ts.map +1 -0
  172. package/dist/modules/serviceFragmentDefaults/ServiceFragmentDefaultsService.js +26 -0
  173. package/dist/modules/serviceFragmentDefaults/ServiceFragmentDefaultsService.js.map +1 -0
  174. package/dist/modules/services/ServiceMountService.d.ts +48 -0
  175. package/dist/modules/services/ServiceMountService.d.ts.map +1 -0
  176. package/dist/modules/services/ServiceMountService.js +90 -0
  177. package/dist/modules/services/ServiceMountService.js.map +1 -0
  178. package/dist/modules/settings/WorkspaceSettingsService.d.ts +22 -0
  179. package/dist/modules/settings/WorkspaceSettingsService.d.ts.map +1 -0
  180. package/dist/modules/settings/WorkspaceSettingsService.js +50 -0
  181. package/dist/modules/settings/WorkspaceSettingsService.js.map +1 -0
  182. package/package.json +41 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoardScanService.d.ts","sourceRoot":"","sources":["../../../src/modules/boardScan/BoardScanService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAgB5D,MAAM,WAAW,4BAA4B;IAC3C,YAAY,EAAE,YAAY,CAAA;IAC1B,mFAAmF;IACnF,eAAe,EAAE,eAAe,CAAA;CACjC;AAOD,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAjC,YAA6B,IAAI,EAAE,4BAA4B,EAAI;IAEnE;;;;;;OAMG;YACW,cAAc;IA6B5B;;;;;;;;;;OAUG;IACG,kBAAkB,CACtB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,oBAAoB,CAAC,CAiC/B;IAED,2EAA2E;IAC3E,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAEpD;CACF"}
@@ -0,0 +1,91 @@
1
+ import { countModules, describeNode } from './board-scan.logic.js';
2
+ /** Case-insensitive, whitespace-tolerant name match used to pair board ↔ blueprint nodes. */
3
+ function sameName(a, b) {
4
+ return a.trim().toLowerCase() === b.trim().toLowerCase();
5
+ }
6
+ export class BoardScanService {
7
+ deps;
8
+ constructor(deps) {
9
+ this.deps = deps;
10
+ }
11
+ /**
12
+ * Materialise a blueprint onto the board: one service frame and a module per
13
+ * blueprint module — each carrying the node's summary and codebase references in
14
+ * its description, so the board mirrors the map. Tasks are authored by people, so
15
+ * the spawn never creates them. Used as the fallback when a reconcile target frame
16
+ * can't be resolved.
17
+ */
18
+ async spawnBlueprint(workspaceId, service) {
19
+ const frame = await this.deps.boardService.addFrame(workspaceId, {
20
+ type: service.type,
21
+ position: { x: 80, y: 80 },
22
+ });
23
+ await this.deps.boardService.updateBlock(workspaceId, frame.id, {
24
+ title: service.name,
25
+ description: describeNode(service.summary, service.references),
26
+ });
27
+ let modules = 0;
28
+ for (const planModule of service.modules ?? []) {
29
+ const module = await this.deps.boardService.addModule(workspaceId, frame.id, {
30
+ name: planModule.name,
31
+ });
32
+ modules += 1;
33
+ const moduleDescription = describeNode(planModule.summary, planModule.references);
34
+ if (moduleDescription) {
35
+ await this.deps.boardService.updateBlock(workspaceId, module.id, {
36
+ description: moduleDescription,
37
+ });
38
+ }
39
+ }
40
+ return { frameId: frame.id, modules };
41
+ }
42
+ /**
43
+ * Reconcile a blueprint onto an **existing** service frame, in place and without
44
+ * deleting anything: the frame's modules are matched to the blueprint by name
45
+ * (case-insensitive), missing modules are added, and matched modules have their
46
+ * summary/code-reference description refreshed. Human-added blocks and the tasks
47
+ * inside modules are left untouched — so re-running the Blueprinter after each
48
+ * implementation keeps the map current without clobbering authored work.
49
+ *
50
+ * When `frameId` does not resolve to a frame (e.g. the repo isn't on the board
51
+ * yet) it falls back to {@link spawnBlueprint}, creating a fresh structure.
52
+ */
53
+ async reconcileBlueprint(workspaceId, frameId, service) {
54
+ const blocks = await this.deps.blockRepository.listByWorkspace(workspaceId);
55
+ const frame = frameId ? blocks.find((b) => b.id === frameId && b.level === 'frame') : undefined;
56
+ if (!frame)
57
+ return this.spawnBlueprint(workspaceId, service);
58
+ // Refresh the frame's description (its summary/entrypoints) but keep the title,
59
+ // which a human may have renamed.
60
+ const frameDescription = describeNode(service.summary, service.references);
61
+ if (frameDescription && frameDescription !== frame.description) {
62
+ await this.deps.boardService.updateBlock(workspaceId, frame.id, {
63
+ description: frameDescription,
64
+ });
65
+ }
66
+ const moduleBlocks = blocks.filter((b) => b.parentId === frame.id && b.level === 'module');
67
+ let modules = 0;
68
+ for (const planModule of service.modules ?? []) {
69
+ let moduleBlock = moduleBlocks.find((b) => sameName(b.title, planModule.name));
70
+ if (!moduleBlock) {
71
+ moduleBlock = await this.deps.boardService.addModule(workspaceId, frame.id, {
72
+ name: planModule.name,
73
+ });
74
+ moduleBlocks.push(moduleBlock);
75
+ }
76
+ modules += 1;
77
+ const moduleDescription = describeNode(planModule.summary, planModule.references);
78
+ if (moduleDescription && moduleDescription !== moduleBlock.description) {
79
+ await this.deps.boardService.updateBlock(workspaceId, moduleBlock.id, {
80
+ description: moduleDescription,
81
+ });
82
+ }
83
+ }
84
+ return { frameId: frame.id, modules };
85
+ }
86
+ /** Convenience for callers/tests: the module count a blueprint implies. */
87
+ static moduleCount(service) {
88
+ return countModules(service);
89
+ }
90
+ }
91
+ //# sourceMappingURL=BoardScanService.js.map
@@ -0,0 +1 @@
1
+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AAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import type { BlueprintService } from '@cat-factory/kernel';
2
+ /** Module count for a service — the structural size of the map. */
3
+ export declare function countModules(service: BlueprintService): number;
4
+ /**
5
+ * Render a node's summary and codebase references into a board block description.
6
+ * The references are emitted under a stable `Code references:` marker so an agent
7
+ * scoping later work can parse exactly which files a frame/module/task maps to.
8
+ */
9
+ export declare function describeNode(summary: string | undefined, references: string[] | undefined): string;
10
+ //# sourceMappingURL=board-scan.logic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-scan.logic.d.ts","sourceRoot":"","sources":["../../../src/modules/boardScan/board-scan.logic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAS3D,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,GAC/B,MAAM,CAQR"}
@@ -0,0 +1,26 @@
1
+ // Pure helpers for reconciling a service blueprint onto the board — no IO, no
2
+ // ports. They render a node's codebase references into the parseable form the board
3
+ // embeds in block descriptions and count a tree's modules. Keeping them pure makes
4
+ // reconciliation deterministic and trivially testable without a repo or an LLM.
5
+ // (Coercion of the agent's raw JSON lives in the executor harness, which validates
6
+ // and renders the tree before it ever reaches the engine.)
7
+ /** Module count for a service — the structural size of the map. */
8
+ export function countModules(service) {
9
+ return (service.modules ?? []).length;
10
+ }
11
+ /**
12
+ * Render a node's summary and codebase references into a board block description.
13
+ * The references are emitted under a stable `Code references:` marker so an agent
14
+ * scoping later work can parse exactly which files a frame/module/task maps to.
15
+ */
16
+ export function describeNode(summary, references) {
17
+ const parts = [];
18
+ const trimmed = summary?.trim();
19
+ if (trimmed)
20
+ parts.push(trimmed);
21
+ if (references && references.length > 0) {
22
+ parts.push(['Code references:', ...references.map((r) => `- ${r}`)].join('\n'));
23
+ }
24
+ return parts.join('\n\n');
25
+ }
26
+ //# sourceMappingURL=board-scan.logic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-scan.logic.js","sourceRoot":"","sources":["../../../src/modules/boardScan/board-scan.logic.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,oFAAoF;AACpF,mFAAmF;AACnF,gFAAgF;AAChF,mFAAmF;AACnF,2DAA2D;AAE3D,mEAAmE;AACnE,MAAM,UAAU,YAAY,CAAC,OAAyB;IACpD,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAA;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,OAA2B,EAC3B,UAAgC;IAEhC,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,MAAM,OAAO,GAAG,OAAO,EAAE,IAAI,EAAE,CAAA;IAC/B,IAAI,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAChC,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,CAAC,kBAAkB,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACjF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC"}
@@ -0,0 +1,114 @@
1
+ import type { BootstrapFailureKind, BootstrapJob, BootstrapRepoInput, CreateReferenceArchitectureInput, ReferenceArchitecture, UpdateReferenceArchitectureInput } from '@cat-factory/kernel';
2
+ import type { Clock, IdGenerator } from '@cat-factory/kernel';
3
+ import type { BlockRepository, ServiceFragmentDefaultsRepository, ServiceRepository, WorkspaceMountRepository, WorkspaceRepository } from '@cat-factory/kernel';
4
+ import type { BootstrapJobRepository, ReferenceArchitectureRepository } from '@cat-factory/kernel';
5
+ import type { RepoBootstrapper } from '@cat-factory/kernel';
6
+ import type { BootstrapRunner } from '@cat-factory/kernel';
7
+ import type { ExecutionEventPublisher } from '@cat-factory/kernel';
8
+ /** The poll's terminal-ness, returned to the durable driver so it knows when to stop. */
9
+ export interface BootstrapPollResult {
10
+ state: 'running' | 'done' | 'failed';
11
+ /** Present when `state === 'failed'`. */
12
+ error?: string;
13
+ }
14
+ export interface BootstrapServiceDependencies {
15
+ referenceArchitectureRepository: ReferenceArchitectureRepository;
16
+ bootstrapJobRepository: BootstrapJobRepository;
17
+ workspaceRepository: WorkspaceRepository;
18
+ /** Board blocks: a bootstrap materialises a provisional service frame up front. */
19
+ blockRepository: BlockRepository;
20
+ /**
21
+ * In-org shared services. When wired, the provisional service frame is registered as an
22
+ * account-owned service + mount (so a bootstrapped service is shareable like any other), and
23
+ * `listJobs` surfaces a shared service's in-flight bootstrap on every board that mounts it.
24
+ */
25
+ serviceRepository?: ServiceRepository;
26
+ workspaceMountRepository?: WorkspaceMountRepository;
27
+ /**
28
+ * The workspace's default service-fragment selection. When wired, the provisional
29
+ * service frame inherits the workspace default onto its `serviceFragmentIds`, so a
30
+ * bootstrapped service starts with the org's standards like any other new service.
31
+ */
32
+ serviceFragmentDefaultsRepository?: ServiceFragmentDefaultsRepository;
33
+ idGenerator: IdGenerator;
34
+ clock: Clock;
35
+ /** Performs the side-effecting pre-flight + container bootstrap; optional. */
36
+ repoBootstrapper?: RepoBootstrapper;
37
+ /** Durably drives the run's poll loop; optional (tests poll directly). */
38
+ bootstrapRunner?: BootstrapRunner;
39
+ /** Pushes live bootstrap progress / board changes to subscribed clients. */
40
+ eventPublisher?: ExecutionEventPublisher;
41
+ /**
42
+ * Optional: invoked (best-effort) after a bootstrap succeeds and its repo is
43
+ * linked to the service frame, to kick off the initial blueprint run that maps
44
+ * the freshly bootstrapped repo and populates the board. Wired to start the
45
+ * blueprint-only pipeline; absent in tests / when blueprints aren't configured.
46
+ */
47
+ onBootstrapSucceeded?: (workspaceId: string, blockId: string) => Promise<void>;
48
+ }
49
+ export declare class BootstrapService {
50
+ private readonly deps;
51
+ constructor(deps: BootstrapServiceDependencies);
52
+ /** True when a bootstrap run can actually be performed (the bootstrapper is wired). */
53
+ get canBootstrap(): boolean;
54
+ listReferenceArchitectures(workspaceId: string): Promise<ReferenceArchitecture[]>;
55
+ createReferenceArchitecture(workspaceId: string, input: CreateReferenceArchitectureInput): Promise<ReferenceArchitecture>;
56
+ updateReferenceArchitecture(workspaceId: string, id: string, input: UpdateReferenceArchitectureInput): Promise<ReferenceArchitecture>;
57
+ deleteReferenceArchitecture(workspaceId: string, id: string): Promise<void>;
58
+ listJobs(workspaceId: string): Promise<BootstrapJob[]>;
59
+ getJob(workspaceId: string, id: string): Promise<BootstrapJob>;
60
+ /**
61
+ * Kick off a "bootstrap repo" run and return immediately with the `running`
62
+ * job. The run is asynchronous and observable: it pre-flights GitHub + the
63
+ * target repo, dispatches the bootstrapper container, materialises a provisional
64
+ * **service frame** on the board (so the user sees a "bootstrapping…" card right
65
+ * away), then asks the durable runner to drive the poll loop — which streams
66
+ * live subtask progress and, on success, links the new repo to the frame so it
67
+ * becomes a real, droppable service. On a dispatch/pre-flight failure the job is
68
+ * returned already `failed` (no frame is left behind). Requires {@link canBootstrap}.
69
+ */
70
+ bootstrap(workspaceId: string, input: BootstrapRepoInput): Promise<BootstrapJob>;
71
+ /**
72
+ * Retry a failed "bootstrap repo" run. Spins a **fresh** container (and a new
73
+ * durable driver instance) for the same target, reusing the original job's
74
+ * service frame so the board card stays put — it flips from the failed badge
75
+ * back to "bootstrapping…". A new job record is created (the prior one is kept as
76
+ * history and so the durable driver, keyed by job id, gets a clean instance).
77
+ * Only a `failed` job can be retried. Returns the new running job.
78
+ */
79
+ retry(workspaceId: string, jobId: string): Promise<BootstrapJob>;
80
+ /**
81
+ * Advance one running bootstrap job by polling its container once: stream the
82
+ * latest subtask counts while it runs, and on a terminal outcome finalise the
83
+ * job and its board frame (link the repo + flip to a ready service on success,
84
+ * mark blocked on failure). Idempotent — a job already in a terminal state is
85
+ * returned as-is, so the durable driver's retries/replays are safe. Returns the
86
+ * poll's terminal-ness so the driver knows when to stop.
87
+ */
88
+ pollBootstrapJob(workspaceId: string, jobId: string): Promise<BootstrapPollResult>;
89
+ /**
90
+ * Explicitly stop a *running* bootstrap (the unified `POST /agent-runs/:id/stop`
91
+ * surface): kill its per-run container, tear down the durable driver, then mark
92
+ * the job `failed` (kind `cancelled`) and its service frame `blocked` so the board
93
+ * shows it stopped — with retry — instead of "bootstrapping…" forever. Idempotent:
94
+ * a job already in a terminal state is returned unchanged. `opts.reason`/`opts.kind`
95
+ * let the orphan sweep reuse this with its own wording.
96
+ */
97
+ stop(workspaceId: string, jobId: string, opts?: {
98
+ reason?: string;
99
+ kind?: BootstrapFailureKind;
100
+ }): Promise<BootstrapJob>;
101
+ /** The workspace default fragment ids a new service inherits; empty / never throws. */
102
+ private defaultServiceFragmentIds;
103
+ /** Create the provisional, in-progress service frame a bootstrap run materialises. */
104
+ private createServiceFrame;
105
+ /** Flip a bootstrap's frame to a terminal status + description; null-safe. */
106
+ private markFrame;
107
+ /** Assemble the structured failure diagnostics stored on a faulted job. */
108
+ private buildFailure;
109
+ /** Best-effort: reclaim a job's per-run container (never throws). */
110
+ private stopContainer;
111
+ /** Best-effort push of a bootstrap transition to subscribed clients. */
112
+ private emitBootstrap;
113
+ }
114
+ //# sourceMappingURL=BootstrapService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BootstrapService.d.ts","sourceRoot":"","sources":["../../../src/modules/bootstrap/BootstrapService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,gCAAgC,EAChC,qBAAqB,EAErB,gCAAgC,EACjC,MAAM,qBAAqB,CAAA;AAC5B,OAAO,K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