@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":"IterativeReviewService.d.ts","sourceRoot":"","sources":["../../../src/modules/review/IterativeReviewService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,KAAK,EACL,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAQ5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAuBlF,2FAA2F;AAC3F,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,uBAA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@
1
+ import { generateText } from 'ai';
2
+ import { assertFound, DEFAULT_MAX_REQUIREMENT_ITERATIONS, inlineModelRef, ValidationError, } from '@cat-factory/kernel';
3
+ import { catFactoryObservability } from '@cat-factory/agents';
4
+ import { coerceReviewItems, disposeReview, extractJson, } from '../requirements/requirements.logic.js';
5
+ /** Output budget for the rework generation (a full standard-format document). */
6
+ const REWORK_MAX_OUTPUT_TOKENS = 16_000;
7
+ /** An item still needs a human while `open`. */
8
+ const isOpen = (i) => i.status === 'open';
9
+ /** Map a reviewer pass's disposition to the review status it parks (or advances) at. */
10
+ function statusForDisposition(d) {
11
+ if (d === 'auto-pass')
12
+ return 'incorporated';
13
+ if (d === 'exceeded')
14
+ return 'exceeded';
15
+ return 'ready';
16
+ }
17
+ /**
18
+ * Stateless, synchronous iterative reviewer (no container, no durable driver). The LLM is
19
+ * reached through the provider-agnostic {@link ModelProvider} port — the same one the
20
+ * document planner uses — so this service never imports a provider SDK or an API key. The
21
+ * model is resolved exactly like an agent step: a model pinned on the block wins, else the
22
+ * workspace's per-kind default, else the routing default (which falls back to Cloudflare
23
+ * Workers AI when no direct provider key is set). Reads of an existing review work
24
+ * regardless.
25
+ *
26
+ * @typeParam TReview The persisted review type (adds a kind-specific document field).
27
+ * @typeParam TContext The reviewer's per-kind context (the subject under review).
28
+ * @typeParam TContextInput Extra per-call inputs threaded into context gathering (e.g. an
29
+ * investigation report for clarity); `{}` when a kind needs none.
30
+ */
31
+ export class IterativeReviewService {
32
+ deps;
33
+ constructor(deps) {
34
+ this.deps = deps;
35
+ }
36
+ // ---- public surface (shared by every kind) ------------------------------
37
+ /** Whether the LLM-backed review path is available. */
38
+ get enabled() {
39
+ return (!!this.deps.modelProviderResolver || !!this.deps.modelProvider) && !!this.deps.modelRef;
40
+ }
41
+ /** The current review for a block, or null if none has been run. */
42
+ async getForBlock(workspaceId, blockId) {
43
+ return this.repository.getByBlock(workspaceId, blockId);
44
+ }
45
+ /**
46
+ * Run a fresh review of a block (iteration 1). Replaces any prior review for the block
47
+ * (answers from a stale run don't carry over). The returned review's `status` encodes the
48
+ * disposition: `incorporated` (auto-pass — advance), `ready` (findings to answer) or
49
+ * `exceeded` (findings but the iteration budget is already 1).
50
+ */
51
+ async review(workspaceId, blockId, opts = {}) {
52
+ const block = assertFound(await this.deps.blockRepository.get(workspaceId, blockId), 'Block', blockId);
53
+ const maxIterations = opts.maxIterations ?? DEFAULT_MAX_REQUIREMENT_ITERATIONS;
54
+ const concernThreshold = opts.concernThreshold ?? 'none';
55
+ const context = await this.gatherContext(workspaceId, block, opts);
56
+ const { ref, items } = await this.runReviewer(workspaceId, block, context);
57
+ const now = this.deps.clock.now();
58
+ const disposition = disposeReview(items, { iteration: 1, maxIterations, concernThreshold });
59
+ const review = this.newReview({
60
+ id: this.deps.idGenerator.next(this.reviewIdPrefix),
61
+ blockId,
62
+ status: statusForDisposition(disposition),
63
+ items,
64
+ model: `${ref.provider}:${ref.model}`,
65
+ iteration: 1,
66
+ maxIterations,
67
+ createdAt: now,
68
+ updatedAt: now,
69
+ });
70
+ await this.repository.deleteByBlock(workspaceId, blockId);
71
+ await this.repository.upsert(workspaceId, review);
72
+ if (disposition !== 'auto-pass')
73
+ await this.notifyFindings(workspaceId, block, items.length);
74
+ return review;
75
+ }
76
+ /**
77
+ * Re-review the block against its current incorporated document (one more reviewer pass;
78
+ * `iteration` increments). Keeps the review id + the document; replaces the items with the
79
+ * fresh findings and re-encodes the disposition into `status`. Called after an
80
+ * incorporation so the loop can converge (`incorporated`), continue (`ready`) or stop for a
81
+ * human (`exceeded`).
82
+ */
83
+ async reReview(workspaceId, reviewId, opts = {}) {
84
+ const review = await this.load(workspaceId, reviewId);
85
+ const block = assertFound(await this.deps.blockRepository.get(workspaceId, review.blockId), 'Block', review.blockId);
86
+ const concernThreshold = opts.concernThreshold ?? 'none';
87
+ const context = await this.gatherContext(workspaceId, block, {});
88
+ const doc = this.readDoc(review);
89
+ if (doc)
90
+ this.applyIncorporatedDoc(context, doc);
91
+ const { ref, items } = await this.runReviewer(workspaceId, block, context);
92
+ const now = this.deps.clock.now();
93
+ const iteration = (review.iteration ?? 1) + 1;
94
+ const maxIterations = review.maxIterations ?? DEFAULT_MAX_REQUIREMENT_ITERATIONS;
95
+ const disposition = disposeReview(items, { iteration, maxIterations, concernThreshold });
96
+ const updated = {
97
+ ...review,
98
+ status: statusForDisposition(disposition),
99
+ items,
100
+ model: `${ref.provider}:${ref.model}`,
101
+ iteration,
102
+ maxIterations,
103
+ updatedAt: now,
104
+ };
105
+ await this.repository.upsert(workspaceId, updated);
106
+ if (disposition !== 'auto-pass')
107
+ await this.notifyFindings(workspaceId, block, items.length);
108
+ return updated;
109
+ }
110
+ /** Record a human's answer to one item (and flip it to `answered`). */
111
+ async replyToItem(workspaceId, reviewId, itemId, reply) {
112
+ return this.mutateItem(workspaceId, reviewId, itemId, (item, now) => {
113
+ item.reply = reply;
114
+ if (item.status === 'open')
115
+ item.status = 'answered';
116
+ item.updatedAt = now;
117
+ });
118
+ }
119
+ /** Set an item's status (resolve / dismiss / reopen). */
120
+ async setItemStatus(workspaceId, reviewId, itemId, status) {
121
+ return this.mutateItem(workspaceId, reviewId, itemId, (item, now) => {
122
+ item.status = status;
123
+ item.updatedAt = now;
124
+ });
125
+ }
126
+ /**
127
+ * Incorporate the human's answers (and dismissals) into one self-contained, standard-format
128
+ * document. Requires every finding to be answered or dismissed (no `open` items). The
129
+ * optional `feedback` is the human's "do it differently" direction when redoing a merge they
130
+ * were unhappy with, folded into the prompt alongside the prior document. Stores the document
131
+ * on the review and parks it `merged` for the human to re-review or redo.
132
+ */
133
+ async incorporate(workspaceId, reviewId, opts = {}) {
134
+ const review = await this.load(workspaceId, reviewId);
135
+ const block = assertFound(await this.deps.blockRepository.get(workspaceId, review.blockId), 'Block', review.blockId);
136
+ const open = review.items.filter(isOpen);
137
+ if (open.length > 0) {
138
+ throw new ValidationError(`Answer or dismiss all ${open.length} remaining item(s) before incorporating`);
139
+ }
140
+ const { modelProvider, ref } = await this.resolveModel(workspaceId, block);
141
+ const context = await this.gatherContext(workspaceId, block, opts);
142
+ // A redo carries the prior document forward (so the rework refines it, not the raw
143
+ // description) plus the human's freeform correction.
144
+ const prior = this.readDoc(review);
145
+ if (prior)
146
+ this.applyIncorporatedDoc(context, prior);
147
+ if (opts.feedback?.trim())
148
+ this.applyFeedback(context, opts.feedback.trim());
149
+ let revised;
150
+ let finishReason;
151
+ try {
152
+ const model = modelProvider.resolve(ref);
153
+ const result = await generateText({
154
+ model,
155
+ system: this.reworkSystemPrompt,
156
+ prompt: this.buildReworkPrompt(context, review.items),
157
+ temperature: 0.2,
158
+ // The reworked doc is a full standard-format document that becomes the SOLE source of
159
+ // truth fed to every downstream agent step; a generous budget keeps a real spec from
160
+ // being cut off mid-document.
161
+ maxOutputTokens: REWORK_MAX_OUTPUT_TOKENS,
162
+ providerOptions: catFactoryObservability({ agentKind: this.reworkAgentKind, workspaceId }),
163
+ });
164
+ revised = result.text.trim();
165
+ finishReason = result.finishReason;
166
+ }
167
+ catch (e) {
168
+ throw new ValidationError(this.reviewerFailed(ref, e));
169
+ }
170
+ if (!revised) {
171
+ throw new ValidationError(`The reviewer produced no ${this.revisedNoun}`);
172
+ }
173
+ // A length-truncated document would become a silently-incomplete spec that every
174
+ // downstream agent then treats as authoritative. Reject it loudly instead.
175
+ if (finishReason === 'length') {
176
+ throw new ValidationError(this.truncationMessage);
177
+ }
178
+ const now = this.deps.clock.now();
179
+ // `merged`: the document is produced and awaits the human's re-review / redo. It is NOT
180
+ // yet the final accepted document (that is `incorporated`, set on converge).
181
+ const updated = { ...this.withDoc(review, revised), status: 'merged', updatedAt: now };
182
+ await this.repository.upsert(workspaceId, updated);
183
+ return { review: updated };
184
+ }
185
+ /**
186
+ * Mark the review settled (`incorporated`) — the phase is done and the last incorporated
187
+ * document (if any) becomes what downstream agents consume.
188
+ */
189
+ async markIncorporated(workspaceId, reviewId) {
190
+ return this.patchReview(workspaceId, reviewId, (review) => ({
191
+ ...review,
192
+ status: 'incorporated',
193
+ }));
194
+ }
195
+ /** Grant one more reviewer pass after the cap was hit, reopening the loop (`ready`). */
196
+ async grantExtraRound(workspaceId, reviewId) {
197
+ return this.patchReview(workspaceId, reviewId, (review) => ({
198
+ ...review,
199
+ status: 'ready',
200
+ maxIterations: (review.maxIterations ?? DEFAULT_MAX_REQUIREMENT_ITERATIONS) + 1,
201
+ }));
202
+ }
203
+ /** Flag a review as `incorporating` (the durable driver is about to fold + re-review). */
204
+ async markIncorporating(workspaceId, reviewId) {
205
+ return this.patchReview(workspaceId, reviewId, (review) => ({
206
+ ...review,
207
+ status: 'incorporating',
208
+ }));
209
+ }
210
+ /** Flag a review as `reviewing` (the second async stage — re-reviewing the folded document). */
211
+ async markReReviewing(workspaceId, reviewId) {
212
+ return this.patchReview(workspaceId, reviewId, (review) => ({ ...review, status: 'reviewing' }));
213
+ }
214
+ // ---- internals ----------------------------------------------------------
215
+ /** The model provider for a workspace's scope (per-scope DB pool, else the static one). */
216
+ async providerFor(workspaceId) {
217
+ if (this.deps.modelProviderResolver) {
218
+ return this.deps.modelProviderResolver.forScope({ workspaceId });
219
+ }
220
+ return this.deps.modelProvider;
221
+ }
222
+ /**
223
+ * The model to run for a block, with the same precedence as a pipeline step: the block's
224
+ * pinned selection wins, else the workspace's per-kind default, else the routing default.
225
+ * A pinned subscription model (Claude Code / Codex) is degraded to the routing default
226
+ * because the reviewer is an INLINE LLM call with no provider key for the container harness
227
+ * — the same seam the inline agent executor uses, so the two can't drift.
228
+ */
229
+ async modelFor(workspaceId, block) {
230
+ const fallback = this.deps.modelRef;
231
+ const resolve = (ref) => inlineModelRef(ref, fallback ?? ref);
232
+ const fromBlock = this.deps.resolveBlockModel?.(block.modelId);
233
+ if (fromBlock)
234
+ return resolve(fromBlock);
235
+ const defaultId = await this.deps.resolveWorkspaceModelDefault?.(workspaceId, this.reviewAgentKind);
236
+ const fromDefault = this.deps.resolveBlockModel?.(defaultId);
237
+ if (fromDefault)
238
+ return resolve(fromDefault);
239
+ return fallback;
240
+ }
241
+ /** Resolve the provider + ref, throwing the kind's "no model configured" error if unavailable. */
242
+ async resolveModel(workspaceId, block) {
243
+ const modelProvider = await this.providerFor(workspaceId);
244
+ const ref = await this.modelFor(workspaceId, block);
245
+ if (!modelProvider || !ref) {
246
+ throw new ValidationError(`No model is configured for the ${this.reviewerLabel}`);
247
+ }
248
+ return { modelProvider, ref };
249
+ }
250
+ reviewerFailed(ref, e) {
251
+ // Surface the real cause (binding missing, rate limit, provider error) rather than
252
+ // masking every failure behind one vague message.
253
+ return `The ${this.reviewerLabel} (${ref.provider}:${ref.model}) failed: ${e instanceof Error ? e.message : String(e)}`;
254
+ }
255
+ /** Run the reviewer LLM over the prepared context and coerce the JSON into review items. */
256
+ async runReviewer(workspaceId, block, context) {
257
+ const { modelProvider, ref } = await this.resolveModel(workspaceId, block);
258
+ let text;
259
+ try {
260
+ const model = modelProvider.resolve(ref);
261
+ const result = await generateText({
262
+ model,
263
+ system: this.reviewSystemPrompt,
264
+ prompt: this.buildReviewPrompt(context),
265
+ temperature: 0.2,
266
+ maxOutputTokens: 5000,
267
+ providerOptions: catFactoryObservability({ agentKind: this.reviewAgentKind, workspaceId }),
268
+ });
269
+ text = result.text;
270
+ }
271
+ catch (e) {
272
+ throw new ValidationError(this.reviewerFailed(ref, e));
273
+ }
274
+ const now = this.deps.clock.now();
275
+ const items = coerceReviewItems(extractJson(text), () => this.deps.idGenerator.next(this.itemIdPrefix), now);
276
+ return { ref, items };
277
+ }
278
+ /**
279
+ * Tell people to react to a review's findings. Best-effort and only when there ARE findings
280
+ * — a clean review pings no one. Never lets a notification failure break the awaited review.
281
+ */
282
+ async notifyFindings(workspaceId, block, findingCount) {
283
+ if (findingCount <= 0 || !this.deps.notificationService)
284
+ return;
285
+ try {
286
+ await this.deps.notificationService.raise(workspaceId, {
287
+ type: this.notificationType,
288
+ blockId: block.id,
289
+ executionId: null,
290
+ title: this.notificationTitle(block),
291
+ body: `${this.notificationSubject} raised ${findingCount} finding${findingCount === 1 ? '' : 's'} to react to.`,
292
+ // Direct it at the task's responsible product person when one is assigned, so the
293
+ // inbox can highlight it for them (it stays visible to the whole workspace).
294
+ payload: {
295
+ findingCount,
296
+ ...(block.responsibleProductUserId
297
+ ? { targetUserId: block.responsibleProductUserId }
298
+ : {}),
299
+ },
300
+ });
301
+ }
302
+ catch {
303
+ // Best-effort: the review is already persisted and returned to the caller.
304
+ }
305
+ }
306
+ async load(workspaceId, reviewId) {
307
+ return assertFound(await this.repository.get(workspaceId, reviewId), this.entityName, reviewId);
308
+ }
309
+ async patchReview(workspaceId, reviewId, patch) {
310
+ const review = await this.load(workspaceId, reviewId);
311
+ const updated = { ...patch(review), updatedAt: this.deps.clock.now() };
312
+ await this.repository.upsert(workspaceId, updated);
313
+ return updated;
314
+ }
315
+ async mutateItem(workspaceId, reviewId, itemId, mutate) {
316
+ const review = await this.load(workspaceId, reviewId);
317
+ const item = review.items.find((i) => i.id === itemId);
318
+ if (!item)
319
+ throw new ValidationError(`Review item '${itemId}' not found`);
320
+ const now = this.deps.clock.now();
321
+ mutate(item, now);
322
+ review.updatedAt = now;
323
+ await this.repository.upsert(workspaceId, review);
324
+ return review;
325
+ }
326
+ }
327
+ //# sourceMappingURL=IterativeReviewService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IterativeReviewService.js","sourceRoot":"","sources":["../../../src/modules/review/IterativeReviewService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AAejC,OAAO,EACL,WAAW,EACX,kCAAkC,EAClC,cAAc,EACd,eAAe,GAChB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAE7D,OAAO,EAEL,iBAAiB,EACjB,aAAa,EACb,WAAW,GACZ,MAAM,uCAAuC,CAAA;AA4D9C,iFAAiF;AACjF,MAAM,wBAAwB,GAAG,MAAM,CAAA;AAEvC,gDAAg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AAA;QAClD,OAAO,OAAO,CAAA;IAChB,CAAC;IAEO,KAAK,CAAC,UAAU,CACtB,WAAmB,EACnB,QAAgB,EAChB,MAAc,EACd,MAA0D;QAE1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;QACrD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAA;QACtD,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,eAAe,CAAC,gBAAgB,MAAM,aAAa,CAAC,CAAA;QACzE,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAA;QACjC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QACjB,MAAM,CAAC,SAAS,GAAG,GAAG,CAAA;QACtB,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;QACjD,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ import type { ServiceFragmentDefaults, ServiceFragmentDefaultsRepository, SetServiceFragmentDefaultsInput, WorkspaceRepository } from '@cat-factory/kernel';
2
+ export interface ServiceFragmentDefaultsServiceDependencies {
3
+ serviceFragmentDefaultsRepository: ServiceFragmentDefaultsRepository;
4
+ workspaceRepository: WorkspaceRepository;
5
+ }
6
+ /**
7
+ * Read/replace a workspace's default service-fragment selection — the best-practice
8
+ * prompt fragment ids new services inherit (seeded onto a frame's `serviceFragmentIds`
9
+ * at creation). Sending the full list replaces it wholesale.
10
+ */
11
+ export declare class ServiceFragmentDefaultsService {
12
+ private readonly defaults;
13
+ private readonly workspaceRepository;
14
+ constructor(deps: ServiceFragmentDefaultsServiceDependencies);
15
+ /** The workspace's default fragment-id list (empty when none set). */
16
+ get(workspaceId: string): Promise<ServiceFragmentDefaults>;
17
+ /** Replace the workspace's default fragment-id list and return the stored result. */
18
+ set(workspaceId: string, input: SetServiceFragmentDefaultsInput): Promise<ServiceFragmentDefaults>;
19
+ }
20
+ //# sourceMappingURL=ServiceFragmentDefaultsService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceFragmentDefaultsService.d.ts","sourceRoot":"","sources":["../../../src/modules/serviceFragmentDefaults/ServiceFragmentDefaultsService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,iCAAiC,EACjC,+BAA+B,EAC/B,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAG5B,MAAM,WAAW,0CAA0C;IACzD,iCAAiC,EAAE,iCAAiC,CAAA;IACpE,mBAAmB,EAAE,mBAAmB,CAAA;CACzC;AAED;;;;GAIG;AACH,qBAAa,8BAA8B;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmC;IAC5D,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IAEzD,YAAY,IAAI,EAAE,0CAA0C,EAG3D;IAED,sEAAsE;IAChE,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAG/D;IAED,qFAAqF;IAC/E,GAAG,CACP,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAAC,uBAAuB,CAAC,CAIlC;CACF"}
@@ -0,0 +1,26 @@
1
+ import { requireWorkspace } from '@cat-factory/kernel';
2
+ /**
3
+ * Read/replace a workspace's default service-fragment selection — the best-practice
4
+ * prompt fragment ids new services inherit (seeded onto a frame's `serviceFragmentIds`
5
+ * at creation). Sending the full list replaces it wholesale.
6
+ */
7
+ export class ServiceFragmentDefaultsService {
8
+ defaults;
9
+ workspaceRepository;
10
+ constructor(deps) {
11
+ this.defaults = deps.serviceFragmentDefaultsRepository;
12
+ this.workspaceRepository = deps.workspaceRepository;
13
+ }
14
+ /** The workspace's default fragment-id list (empty when none set). */
15
+ async get(workspaceId) {
16
+ await requireWorkspace(this.workspaceRepository, workspaceId);
17
+ return { fragmentIds: await this.defaults.get(workspaceId) };
18
+ }
19
+ /** Replace the workspace's default fragment-id list and return the stored result. */
20
+ async set(workspaceId, input) {
21
+ await requireWorkspace(this.workspaceRepository, workspaceId);
22
+ await this.defaults.set(workspaceId, input.fragmentIds);
23
+ return { fragmentIds: input.fragmentIds };
24
+ }
25
+ }
26
+ //# sourceMappingURL=ServiceFragmentDefaultsService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceFragmentDefaultsService.js","sourceRoot":"","sources":["../../../src/modules/serviceFragmentDefaults/ServiceFragmentDefaultsService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAOtD;;;;GAIG;AACH,MAAM,OAAO,8BAA8B;IACxB,QAAQ,CAAmC;IAC3C,mBAAmB,CAAqB;IAEzD,YAAY,IAAgD;QAC1D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,iCAAiC,CAAA;QACtD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAA;IACrD,CAAC;IAED,sEAAsE;IACtE,KAAK,CAAC,GAAG,CAAC,WAAmB;QAC3B,MAAM,gBAAgB,CAAC,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA;QAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAA;IAC9D,CAAC;IAED,qFAAqF;IACrF,KAAK,CAAC,GAAG,CACP,WAAmB,EACnB,KAAsC;QAEtC,MAAM,gBAAgB,CAAC,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA;QAC7D,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;QACvD,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAA;IAC3C,CAAC;CACF"}
@@ -0,0 +1,48 @@
1
+ import type { MountServiceInput, Service, UpdateMountInput, WorkspaceMount } from '@cat-factory/kernel';
2
+ import { type Clock, type IdGenerator, type ServiceRepository, type WorkspaceMountRepository, type WorkspaceRepository } from '@cat-factory/kernel';
3
+ export interface ServiceMountServiceDependencies {
4
+ serviceRepository: ServiceRepository;
5
+ workspaceMountRepository: WorkspaceMountRepository;
6
+ workspaceRepository: WorkspaceRepository;
7
+ idGenerator: IdGenerator;
8
+ clock: Clock;
9
+ }
10
+ /**
11
+ * In-org service sharing: list an account's services (the catalog a workspace mounts
12
+ * from) and mount / unmount / re-layout them on a workspace board. A *mount* places a
13
+ * shared service onto a board with a per-workspace layout override; the service itself —
14
+ * its subtree, state and sync — stays canonical and account-owned. Unmounting only
15
+ * removes the service from that board; it never deletes the service.
16
+ *
17
+ * Sharing is strictly within one account: a workspace may only mount services owned by
18
+ * the same account it belongs to (enforced here), so a shared service can never leak
19
+ * across org boundaries.
20
+ */
21
+ export declare class ServiceMountService {
22
+ private readonly serviceRepository;
23
+ private readonly workspaceMountRepository;
24
+ private readonly workspaceRepository;
25
+ private readonly idGenerator;
26
+ private readonly clock;
27
+ constructor(deps: ServiceMountServiceDependencies);
28
+ /**
29
+ * The org catalog: every service owned by an account (or the legacy/unscoped org when
30
+ * `accountId` is null) — the set a workspace in that org can mount from. Each service is
31
+ * annotated with `mountCount` (how many boards mount it) so the UI can badge a shared one.
32
+ */
33
+ listForAccount(accountId: string | null): Promise<Service[]>;
34
+ /** Services currently mounted onto a workspace board (with their layout overrides). */
35
+ listMounts(workspaceId: string): Promise<WorkspaceMount[]>;
36
+ /**
37
+ * Mount an existing org service onto a workspace board. The service must belong to
38
+ * the same account as the workspace (no cross-org sharing). Idempotent: re-mounting
39
+ * an already-mounted service just returns the existing mount.
40
+ */
41
+ mount(workspaceId: string, serviceId: string, input?: MountServiceInput): Promise<WorkspaceMount>;
42
+ /** Remove a service from a workspace board (does NOT delete the shared service). */
43
+ unmount(workspaceId: string, serviceId: string): Promise<void>;
44
+ /** Update a mount's per-workspace layout override (frame position/size). */
45
+ updateLayout(workspaceId: string, serviceId: string, patch: UpdateMountInput): Promise<WorkspaceMount>;
46
+ private defaultPosition;
47
+ }
48
+ //# sourceMappingURL=ServiceMountService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceMountService.d.ts","sourceRoot":"","sources":["../../../src/modules/services/ServiceMountService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,OAAO,EACP,gBAAgB,EAChB,cAAc,EACf,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EAIzB,MAAM,qBAAqB,CAAA;AAE5B,MAAM,WAAW,+BAA+B;IAC9C,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,wBAAwB,EAAE,wBAAwB,CAAA;IAClD,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,WAAW,EAAE,WAAW,CAAA;IACxB,KAAK,EAAE,KAAK,CAAA;CACb;AAED;;;;;;;;;;GAUG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IACrD,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA0B;IACnE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IACzD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;IAE7B,YAAY,IAAI,EAAE,+BAA+B,EAMhD;IAED;;;;OAIG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAKjE;IAED,uFAAuF;IACjF,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAG/D;IAED;;;;OAIG;IACG,KAAK,CACT,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,iBAAsB,GAC5B,OAAO,CAAC,cAAc,CAAC,CAoBzB;IAED,oFAAoF;IAC9E,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnE;IAED,4EAA4E;IACtE,YAAY,CAChB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,cAAc,CAAC,CAazB;IAED,OAAO,CAAC,eAAe;CAQxB"}
@@ -0,0 +1,90 @@
1
+ import { ValidationError, assertFound, requireWorkspace, } from '@cat-factory/kernel';
2
+ /**
3
+ * In-org service sharing: list an account's services (the catalog a workspace mounts
4
+ * from) and mount / unmount / re-layout them on a workspace board. A *mount* places a
5
+ * shared service onto a board with a per-workspace layout override; the service itself —
6
+ * its subtree, state and sync — stays canonical and account-owned. Unmounting only
7
+ * removes the service from that board; it never deletes the service.
8
+ *
9
+ * Sharing is strictly within one account: a workspace may only mount services owned by
10
+ * the same account it belongs to (enforced here), so a shared service can never leak
11
+ * across org boundaries.
12
+ */
13
+ export class ServiceMountService {
14
+ serviceRepository;
15
+ workspaceMountRepository;
16
+ workspaceRepository;
17
+ idGenerator;
18
+ clock;
19
+ constructor(deps) {
20
+ this.serviceRepository = deps.serviceRepository;
21
+ this.workspaceMountRepository = deps.workspaceMountRepository;
22
+ this.workspaceRepository = deps.workspaceRepository;
23
+ this.idGenerator = deps.idGenerator;
24
+ this.clock = deps.clock;
25
+ }
26
+ /**
27
+ * The org catalog: every service owned by an account (or the legacy/unscoped org when
28
+ * `accountId` is null) — the set a workspace in that org can mount from. Each service is
29
+ * annotated with `mountCount` (how many boards mount it) so the UI can badge a shared one.
30
+ */
31
+ async listForAccount(accountId) {
32
+ const services = await this.serviceRepository.listByAccount(accountId);
33
+ // One grouped count for the whole catalog (not an N+1 listByService per service).
34
+ const counts = await this.workspaceMountRepository.countByServiceIds(services.map((s) => s.id));
35
+ return services.map((service) => ({ ...service, mountCount: counts[service.id] ?? 0 }));
36
+ }
37
+ /** Services currently mounted onto a workspace board (with their layout overrides). */
38
+ async listMounts(workspaceId) {
39
+ await requireWorkspace(this.workspaceRepository, workspaceId);
40
+ return this.workspaceMountRepository.listByWorkspace(workspaceId);
41
+ }
42
+ /**
43
+ * Mount an existing org service onto a workspace board. The service must belong to
44
+ * the same account as the workspace (no cross-org sharing). Idempotent: re-mounting
45
+ * an already-mounted service just returns the existing mount.
46
+ */
47
+ async mount(workspaceId, serviceId, input = {}) {
48
+ await requireWorkspace(this.workspaceRepository, workspaceId);
49
+ const service = assertFound(await this.serviceRepository.get(serviceId), 'Service', serviceId);
50
+ const account = await this.workspaceRepository.accountOf(workspaceId);
51
+ // Both account-scoped and both the same account; the legacy/unscoped (NULL) path
52
+ // only ever sees its own services, which also share the NULL account.
53
+ if ((account ?? null) !== (service.accountId ?? null)) {
54
+ throw new ValidationError('A service can only be mounted within its own organization');
55
+ }
56
+ const existing = await this.workspaceMountRepository.get(workspaceId, serviceId);
57
+ if (existing)
58
+ return existing;
59
+ const mount = {
60
+ workspaceId,
61
+ serviceId,
62
+ position: input.position ?? this.defaultPosition(await this.listMounts(workspaceId)),
63
+ size: null,
64
+ createdAt: this.clock.now(),
65
+ };
66
+ await this.workspaceMountRepository.upsert(mount);
67
+ return mount;
68
+ }
69
+ /** Remove a service from a workspace board (does NOT delete the shared service). */
70
+ async unmount(workspaceId, serviceId) {
71
+ await requireWorkspace(this.workspaceRepository, workspaceId);
72
+ await this.workspaceMountRepository.remove(workspaceId, serviceId);
73
+ }
74
+ /** Update a mount's per-workspace layout override (frame position/size). */
75
+ async updateLayout(workspaceId, serviceId, patch) {
76
+ await requireWorkspace(this.workspaceRepository, workspaceId);
77
+ assertFound(await this.workspaceMountRepository.get(workspaceId, serviceId), 'WorkspaceMount', serviceId);
78
+ await this.workspaceMountRepository.update(workspaceId, serviceId, patch);
79
+ return assertFound(await this.workspaceMountRepository.get(workspaceId, serviceId), 'WorkspaceMount', serviceId);
80
+ }
81
+ defaultPosition(existing) {
82
+ // Lay new mounts out on a 5-wide grid so they don't pile onto the same point: the column
83
+ // cycles every 5 (x), the row advances every 5 (y). (The old `(n % 5)` on both axes put
84
+ // every 5th mount back at the origin and kept them all on the diagonal.)
85
+ const n = existing.length;
86
+ const columns = 5;
87
+ return { x: 80 + (n % columns) * 48, y: 80 + Math.floor(n / columns) * 48 };
88
+ }
89
+ }
90
+ //# sourceMappingURL=ServiceMountService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceMountService.js","sourceRoot":"","sources":["../../../src/modules/services/ServiceMountService.ts"],"names":[],"mappings":"AAMA,OAAO,EAML,eAAe,EACf,WAAW,EACX,gBAAgB,GACjB,MAAM,qBAAqB,CAAA;AAU5B;;;;;;;;;;GAUG;AACH,MAAM,OAAO,mBAAmB;IACb,iBAAiB,CAAmB;IACpC,wBAAwB,CAA0B;IAClD,mBAAmB,CAAqB;IACxC,WAAW,CAAa;IACxB,KAAK,CAAO;IAE7B,YAAY,IAAqC;QAC/C,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAA;QAC/C,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAA;QAC7D,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAA;QACnD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;QACnC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IACzB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,SAAwB;QAC3C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;QACtE,kFAAkF;Q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AAQ,CAAC,MAAM,CAAA;QACzB,MAAM,OAAO,GAAG,CAAC,CAAA;QACjB,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,CAAA;IAC7E,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import type { UpdateWorkspaceSettingsInput, WorkspaceRepository, WorkspaceSettings, WorkspaceSettingsRepository } from '@cat-factory/kernel';
2
+ export interface WorkspaceSettingsServiceDependencies {
3
+ workspaceSettingsRepository: WorkspaceSettingsRepository;
4
+ workspaceRepository: WorkspaceRepository;
5
+ }
6
+ /**
7
+ * Get/update a workspace's runtime settings (the human-wait escalation threshold +
8
+ * the per-service running-task limit policy). {@link get} lazily falls back to
9
+ * {@link DEFAULT_WORKSPACE_SETTINGS} when no row has been persisted yet, so callers
10
+ * always see a complete settings object. {@link update} patches the supplied fields
11
+ * and keeps the limit fields internally consistent with the chosen mode.
12
+ */
13
+ export declare class WorkspaceSettingsService {
14
+ private readonly settings;
15
+ private readonly workspaceRepository;
16
+ constructor(deps: WorkspaceSettingsServiceDependencies);
17
+ /** A workspace's settings, falling back to the built-in defaults when none are stored. */
18
+ get(workspaceId: string): Promise<WorkspaceSettings>;
19
+ /** Patch a workspace's settings, persisting the merged result. */
20
+ update(workspaceId: string, patch: UpdateWorkspaceSettingsInput): Promise<WorkspaceSettings>;
21
+ }
22
+ //# sourceMappingURL=WorkspaceSettingsService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceSettingsService.d.ts","sourceRoot":"","sources":["../../../src/modules/settings/WorkspaceSettingsService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,EAC5B,MAAM,qBAAqB,CAAA;AAG5B,MAAM,WAAW,oCAAoC;IACnD,2BAA2B,EAAE,2BAA2B,CAAA;IACxD,mBAAmB,EAAE,mBAAmB,CAAA;CACzC;AAED;;;;;;GAMG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IACtD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IAEzD,YAAY,IAAI,EAAE,oCAAoC,EAGrD;IAED,0FAA0F;IACpF,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAEzD;IAED,kEAAkE;IAC5D,MAAM,CACV,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,iBAAiB,CAAC,CAyB5B;CACF"}