@cat-factory/worker 0.128.2 → 0.130.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 (41) hide show
  1. package/dist/index.d.ts.map +1 -1
  2. package/dist/index.js +13 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/infrastructure/container-assembly.d.ts +3 -1
  5. package/dist/infrastructure/container-assembly.d.ts.map +1 -1
  6. package/dist/infrastructure/container-assembly.js +48 -28
  7. package/dist/infrastructure/container-assembly.js.map +1 -1
  8. package/dist/infrastructure/container-shared-services.d.ts +49 -0
  9. package/dist/infrastructure/container-shared-services.d.ts.map +1 -0
  10. package/dist/infrastructure/container-shared-services.js +130 -0
  11. package/dist/infrastructure/container-shared-services.js.map +1 -0
  12. package/dist/infrastructure/container.d.ts +60 -3
  13. package/dist/infrastructure/container.d.ts.map +1 -1
  14. package/dist/infrastructure/container.js +57 -117
  15. package/dist/infrastructure/container.js.map +1 -1
  16. package/dist/infrastructure/repositories/D1AgentContextSnapshotRepository.d.ts +2 -0
  17. package/dist/infrastructure/repositories/D1AgentContextSnapshotRepository.d.ts.map +1 -1
  18. package/dist/infrastructure/repositories/D1AgentContextSnapshotRepository.js +20 -4
  19. package/dist/infrastructure/repositories/D1AgentContextSnapshotRepository.js.map +1 -1
  20. package/dist/infrastructure/repositories/D1AgentSearchQueryRepository.d.ts +2 -0
  21. package/dist/infrastructure/repositories/D1AgentSearchQueryRepository.d.ts.map +1 -1
  22. package/dist/infrastructure/repositories/D1AgentSearchQueryRepository.js +22 -4
  23. package/dist/infrastructure/repositories/D1AgentSearchQueryRepository.js.map +1 -1
  24. package/dist/infrastructure/repositories/D1FoundationalServiceRepository.d.ts +38 -0
  25. package/dist/infrastructure/repositories/D1FoundationalServiceRepository.d.ts.map +1 -0
  26. package/dist/infrastructure/repositories/D1FoundationalServiceRepository.js +280 -0
  27. package/dist/infrastructure/repositories/D1FoundationalServiceRepository.js.map +1 -0
  28. package/dist/infrastructure/repositories/D1LlmCallMetricRepository.d.ts +2 -0
  29. package/dist/infrastructure/repositories/D1LlmCallMetricRepository.d.ts.map +1 -1
  30. package/dist/infrastructure/repositories/D1LlmCallMetricRepository.js +21 -3
  31. package/dist/infrastructure/repositories/D1LlmCallMetricRepository.js.map +1 -1
  32. package/dist/infrastructure/repositories/D1NotificationWebhookRepository.d.ts +5 -1
  33. package/dist/infrastructure/repositories/D1NotificationWebhookRepository.d.ts.map +1 -1
  34. package/dist/infrastructure/repositories/D1NotificationWebhookRepository.js +11 -5
  35. package/dist/infrastructure/repositories/D1NotificationWebhookRepository.js.map +1 -1
  36. package/dist/infrastructure/workflows/ExecutionWorkflow.d.ts.map +1 -1
  37. package/dist/infrastructure/workflows/ExecutionWorkflow.js +110 -84
  38. package/dist/infrastructure/workflows/ExecutionWorkflow.js.map +1 -1
  39. package/migrations/0072_webhook_run_events.sql +11 -0
  40. package/migrations/0073_foundational_services.sql +84 -0
  41. package/package.json +18 -18
@@ -1,5 +1,9 @@
1
- import { parseNotificationWebhookTypes } from '@cat-factory/server';
2
- /** A workspace's outbound notification webhook, one row per workspace (migration 0061). */
1
+ import { parseNotificationWebhookTypes, parseRunLifecycleEvents } from '@cat-factory/server';
2
+ /**
3
+ * A workspace's outbound webhook, one row per workspace (migration 0061; `run_events` added in
4
+ * 0072). Both JSON filter columns are decoded through the SHARED parsers the Drizzle repo uses,
5
+ * so the columns can't drift between runtimes.
6
+ */
3
7
  export class D1NotificationWebhookRepository {
4
8
  db;
5
9
  constructor({ db }) {
@@ -16,6 +20,7 @@ export class D1NotificationWebhookRepository {
16
20
  workspaceId: row.workspace_id,
17
21
  url: row.url,
18
22
  types: parseNotificationWebhookTypes(row.types),
23
+ runEvents: parseRunLifecycleEvents(row.run_events),
19
24
  enabled: row.enabled === 1,
20
25
  secretSealed: row.secret_sealed,
21
26
  updatedAt: row.updated_at,
@@ -24,15 +29,16 @@ export class D1NotificationWebhookRepository {
24
29
  async put(record) {
25
30
  await this.db
26
31
  .prepare(`INSERT INTO notification_webhooks
27
- (workspace_id, url, types, enabled, secret_sealed, updated_at)
28
- VALUES (?, ?, ?, ?, ?, ?)
32
+ (workspace_id, url, types, run_events, enabled, secret_sealed, updated_at)
33
+ VALUES (?, ?, ?, ?, ?, ?, ?)
29
34
  ON CONFLICT (workspace_id) DO UPDATE SET
30
35
  url = excluded.url,
31
36
  types = excluded.types,
37
+ run_events = excluded.run_events,
32
38
  enabled = excluded.enabled,
33
39
  secret_sealed = excluded.secret_sealed,
34
40
  updated_at = excluded.updated_at`)
35
- .bind(record.workspaceId, record.url, JSON.stringify(record.types), record.enabled ? 1 : 0, record.secretSealed, record.updatedAt)
41
+ .bind(record.workspaceId, record.url, JSON.stringify(record.types), JSON.stringify(record.runEvents), record.enabled ? 1 : 0, record.secretSealed, record.updatedAt)
36
42
  .run();
37
43
  }
38
44
  async delete(workspaceId) {
@@ -1 +1 @@
1
- {"version":3,"file":"D1NotificationWebhookRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1NotificationWebhookRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAA;AAWnE,2FAA2F;AAC3F,MAAM,OAAO,+BAA+B;IACzB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAmB;QAC3B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CAAC,4DAA4D,CAAC;aACrE,IAAI,CAAC,WAAW,CAAC;aACjB,KAAK,EAA0B,CAAA;QAClC,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAA;QACrB,OAAO;YACL,WAAW,EAAE,GAAG,CAAC,YAAY;YAC7B,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,KAAK,EAAE,6BAA6B,CAAC,GAAG,CAAC,KAAK,CAAC;YAC/C,OAAO,EAAE,GAAG,CAAC,OAAO,KAAK,CAAC;YAC1B,YAAY,EAAE,GAAG,CAAC,aAAa;YAC/B,SAAS,EAAE,GAAG,CAAC,UAAU;SAC1B,CAAA;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAAiC;QACzC,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;;;;;;;;4CAQoC,CACrC;aACA,IAAI,CACH,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,GAAG,EACV,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5B,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACtB,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,SAAS,CACjB;aACA,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,WAAmB;QAC9B,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CAAC,0DAA0D,CAAC;aACnE,IAAI,CAAC,WAAW,CAAC;aACjB,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
1
+ {"version":3,"file":"D1NotificationWebhookRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1NotificationWebhookRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAY5F;;;;GAIG;AACH,MAAM,OAAO,+BAA+B;IACzB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAmB;QAC3B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CAAC,4DAA4D,CAAC;aACrE,IAAI,CAAC,WAAW,CAAC;aACjB,KAAK,EAA0B,CAAA;QAClC,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAA;QACrB,OAAO;YACL,WAAW,EAAE,GAAG,CAAC,YAAY;YAC7B,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,KAAK,EAAE,6BAA6B,CAAC,GAAG,CAAC,KAAK,CAAC;YAC/C,SAAS,EAAE,uBAAuB,CAAC,GAAG,CAAC,UAAU,CAAC;YAClD,OAAO,EAAE,GAAG,CAAC,OAAO,KAAK,CAAC;YAC1B,YAAY,EAAE,GAAG,CAAC,aAAa;YAC/B,SAAS,EAAE,GAAG,CAAC,UAAU;SAC1B,CAAA;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAAiC;QACzC,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;;;;;;;;;4CASoC,CACrC;aACA,IAAI,CACH,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,GAAG,EACV,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,EAChC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACtB,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,SAAS,CACjB;aACA,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,WAAmB;QAC9B,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CAAC,0DAA0D,CAAC;aACnE,IAAI,CAAC,WAAW,CAAC;aACjB,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExecutionWorkflow.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/workflows/ExecutionWorkflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,aAAa,EAElB,KAAK,YAAY,EAElB,MAAM,oBAAoB,CAAA;AAQ3B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAKjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAWpE;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,kBAAkB,CAAC,GAAG,EAAE,uBAAuB,CAAC;IACtE,GAAG,CAChB,KAAK,EAAE,aAAa,CAAC,uBAAuB,CAAC,EAC7C,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,IAAI,CAAC,CAsSf;CACF"}
1
+ {"version":3,"file":"ExecutionWorkflow.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/workflows/ExecutionWorkflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,aAAa,EAElB,KAAK,YAAY,EAElB,MAAM,oBAAoB,CAAA;AAQ3B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAKjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAoJpE;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,kBAAkB,CAAC,GAAG,EAAE,uBAAuB,CAAC;IACtE,GAAG,CAChB,KAAK,EAAE,aAAa,CAAC,uBAAuB,CAAC,EAC7C,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,IAAI,CAAC,CAwMf;CACF"}
@@ -10,6 +10,96 @@ const STEP_CONFIG = {
10
10
  retries: { limit: 3, delay: '5 seconds', backoff: 'exponential' },
11
11
  timeout: '5 minutes',
12
12
  };
13
+ /**
14
+ * Poll a dispatched async job (a container coding step) for step `i` between durable
15
+ * sleeps until it finishes. A thrown poll error is always transient, so tolerate a
16
+ * bounded run of them (reset on any good poll) and only fail the run once the tolerance
17
+ * is spent or the budget runs out. Returns the settled result, or `null` once it has
18
+ * already failed the run (the caller returns).
19
+ */
20
+ async function drivePollLoop(deps, i, initial) {
21
+ const { step, log, maxPolls, failureTolerance, pollInterval, pollOnce, failRun, poll } = deps;
22
+ let result = initial;
23
+ let polled = false;
24
+ let pollReadFailures = 0;
25
+ for (let p = 0; p < maxPolls; p++) {
26
+ // Poll-first: the job was dispatched instants ago by `advance-${i}`, so the first
27
+ // status read runs immediately — a leading sleep would be a full poll interval of
28
+ // dead air. Later iterations sleep between polls.
29
+ if (p > 0)
30
+ await step.sleep(`poll-wait-${i}-${p}`, pollInterval);
31
+ const attempt = await pollOnce(`poll-${i}-${p}`, poll);
32
+ if (attempt.kind === 'read_failed') {
33
+ pollReadFailures += 1;
34
+ log.warn('poll could not read job status; treating as still running and retrying', {
35
+ step: i,
36
+ poll: p,
37
+ pollReadFailures,
38
+ err: attempt.message,
39
+ });
40
+ if (pollReadFailures < failureTolerance)
41
+ continue;
42
+ await failRun(i, failureFromDriver(`Job status was unreadable for ${pollReadFailures} consecutive polls; ` +
43
+ `the container appears unreachable (last error: ${attempt.message})`, 'timeout'));
44
+ return null;
45
+ }
46
+ pollReadFailures = 0;
47
+ result = attempt.result;
48
+ if (result.kind !== 'awaiting_job') {
49
+ polled = true;
50
+ break;
51
+ }
52
+ }
53
+ if (!polled && result.kind === 'awaiting_job') {
54
+ await failRun(i, failureFromDriver('Implementation job did not finish within its polling budget', 'timeout'));
55
+ return null;
56
+ }
57
+ return result;
58
+ }
59
+ /**
60
+ * Drive a polling gate (`ci` / `conflicts` / post-release-health) for step `i` between
61
+ * durable sleeps until its precheck yields something terminal. A passing precheck
62
+ * returns `continue`, a dispatched helper agent returns `awaiting_job`, and a spent
63
+ * budget resolves through the gate's own exhaustion policy. Read failures are tolerated
64
+ * exactly like the job loop. Returns the updated result, or `null` once it failed the run.
65
+ */
66
+ async function driveGatePollLoop(deps, i, initial) {
67
+ const { step, log, maxPolls, failureTolerance, pollInterval, pollOnce, failRun, poll } = deps;
68
+ let result = initial;
69
+ let settled = false;
70
+ let pollReadFailures = 0;
71
+ for (let p = 0; p < maxPolls; p++) {
72
+ await step.sleep(`gate-wait-${i}-${p}`, pollInterval);
73
+ const attempt = await pollOnce(`gate-poll-${i}-${p}`, poll);
74
+ if (attempt.kind === 'read_failed') {
75
+ pollReadFailures += 1;
76
+ log.warn('gate poll could not read its precheck; treating as still pending and retrying', {
77
+ step: i,
78
+ poll: p,
79
+ pollReadFailures,
80
+ err: attempt.message,
81
+ });
82
+ if (pollReadFailures < failureTolerance)
83
+ continue;
84
+ await failRun(i, failureFromDriver(`Gate precheck was unreadable for ${pollReadFailures} consecutive polls ` +
85
+ `(last error: ${attempt.message})`, 'timeout'));
86
+ return null;
87
+ }
88
+ pollReadFailures = 0;
89
+ result = attempt.result;
90
+ if (result.kind !== 'awaiting_gate') {
91
+ settled = true;
92
+ break;
93
+ }
94
+ }
95
+ if (!settled && result.kind === 'awaiting_gate') {
96
+ // Poll budget spent. Let the gate decide: a time-windowed watch gate
97
+ // (post-release-health) PASSES, while CI/conflicts resolve to a `job_failed`
98
+ // timeout the checks below funnel through `failRun`. One policy, both runtimes.
99
+ result = (await step.do(`gate-exhausted-${i}`, STEP_CONFIG, deps.resolveExhaustion));
100
+ }
101
+ return result;
102
+ }
13
103
  /**
14
104
  * Durable driver for one pipeline run. It contains NO business logic — every
15
105
  * decision lives in core's ExecutionService. Each loop iteration advances the
@@ -72,89 +162,25 @@ export class ExecutionWorkflow extends WorkflowEntrypoint {
72
162
  return { kind: 'read_failed', message: redactSecrets(raw) ?? '' };
73
163
  }
74
164
  };
75
- // Poll a dispatched async job (a container coding step) for step `i` between durable
76
- // sleeps until it finishes. A thrown poll error is always transient, so tolerate a
77
- // bounded run of them (reset on any good poll) and only fail the run once the tolerance
78
- // is spent or the budget runs out. Returns the settled result, or `null` once it has
79
- // already failed the run (the caller returns).
80
- const drivePollLoop = async (i, initial) => {
81
- let result = initial;
82
- let polled = false;
83
- let pollReadFailures = 0;
84
- for (let p = 0; p < execConfig.jobMaxPolls; p++) {
85
- // Poll-first: the job was dispatched instants ago by `advance-${i}`, so the first
86
- // status read runs immediately — a leading sleep would be a full poll interval of
87
- // dead air. Later iterations sleep between polls.
88
- if (p > 0)
89
- await step.sleep(`poll-wait-${i}-${p}`, jobPollInterval);
90
- const attempt = await pollOnce(`poll-${i}-${p}`, () => container.executionService.pollAgentJob(workspaceId, executionId));
91
- if (attempt.kind === 'read_failed') {
92
- pollReadFailures += 1;
93
- log.warn('poll could not read job status; treating as still running and retrying', {
94
- step: i,
95
- poll: p,
96
- pollReadFailures,
97
- err: attempt.message,
98
- });
99
- if (pollReadFailures < execConfig.jobPollFailureTolerance)
100
- continue;
101
- await failRun(i, failureFromDriver(`Job status was unreadable for ${pollReadFailures} consecutive polls; ` +
102
- `the container appears unreachable (last error: ${attempt.message})`, 'timeout'));
103
- return null;
104
- }
105
- pollReadFailures = 0;
106
- result = attempt.result;
107
- if (result.kind !== 'awaiting_job') {
108
- polled = true;
109
- break;
110
- }
111
- }
112
- if (!polled && result.kind === 'awaiting_job') {
113
- await failRun(i, failureFromDriver('Implementation job did not finish within its polling budget', 'timeout'));
114
- return null;
115
- }
116
- return result;
165
+ // The two durable poll loops are module-level (see `drivePollLoop` / `driveGatePollLoop`),
166
+ // taking the run-scoped closures above as bound deps so this driver stays within the
167
+ // per-function line budget.
168
+ const jobPollDeps = {
169
+ step,
170
+ log,
171
+ maxPolls: execConfig.jobMaxPolls,
172
+ failureTolerance: execConfig.jobPollFailureTolerance,
173
+ pollInterval: jobPollInterval,
174
+ pollOnce,
175
+ failRun,
176
+ poll: () => container.executionService.pollAgentJob(workspaceId, executionId),
117
177
  };
118
- // Drive a polling gate (`ci` / `conflicts` / post-release-health) for step `i` between
119
- // durable sleeps until its precheck yields something terminal. A passing precheck
120
- // returns `continue`, a dispatched helper agent returns `awaiting_job`, and a spent
121
- // budget resolves through the gate's own exhaustion policy. Read failures are tolerated
122
- // exactly like the job loop. Returns the updated result, or `null` once it failed the run.
123
- const driveGatePollLoop = async (i, initial) => {
124
- let result = initial;
125
- let settled = false;
126
- let pollReadFailures = 0;
127
- for (let p = 0; p < execConfig.ciMaxPolls; p++) {
128
- await step.sleep(`gate-wait-${i}-${p}`, ciPollInterval);
129
- const attempt = await pollOnce(`gate-poll-${i}-${p}`, () => container.executionService.pollGate(workspaceId, executionId));
130
- if (attempt.kind === 'read_failed') {
131
- pollReadFailures += 1;
132
- log.warn('gate poll could not read its precheck; treating as still pending and retrying', {
133
- step: i,
134
- poll: p,
135
- pollReadFailures,
136
- err: attempt.message,
137
- });
138
- if (pollReadFailures < execConfig.jobPollFailureTolerance)
139
- continue;
140
- await failRun(i, failureFromDriver(`Gate precheck was unreadable for ${pollReadFailures} consecutive polls ` +
141
- `(last error: ${attempt.message})`, 'timeout'));
142
- return null;
143
- }
144
- pollReadFailures = 0;
145
- result = attempt.result;
146
- if (result.kind !== 'awaiting_gate') {
147
- settled = true;
148
- break;
149
- }
150
- }
151
- if (!settled && result.kind === 'awaiting_gate') {
152
- // Poll budget spent. Let the gate decide: a time-windowed watch gate
153
- // (post-release-health) PASSES, while CI/conflicts resolve to a `job_failed`
154
- // timeout the checks below funnel through `failRun`. One policy, both runtimes.
155
- result = (await step.do(`gate-exhausted-${i}`, STEP_CONFIG, () => container.executionService.resolveGatePollExhaustion(workspaceId, executionId)));
156
- }
157
- return result;
178
+ const gatePollDeps = {
179
+ ...jobPollDeps,
180
+ maxPolls: execConfig.ciMaxPolls,
181
+ pollInterval: ciPollInterval,
182
+ poll: () => container.executionService.pollGate(workspaceId, executionId),
183
+ resolveExhaustion: () => container.executionService.resolveGatePollExhaustion(workspaceId, executionId),
158
184
  };
159
185
  for (let i = 0;; i++) {
160
186
  let result;
@@ -179,7 +205,7 @@ export class ExecutionWorkflow extends WorkflowEntrypoint {
179
205
  // max-duration watchdogs); `jobMaxPolls` is only a backstop. `null` means the loop
180
206
  // already failed the run.
181
207
  if (result.kind === 'awaiting_job') {
182
- const polledResult = await drivePollLoop(i, result);
208
+ const polledResult = await drivePollLoop(jobPollDeps, i, result);
183
209
  if (polledResult === null)
184
210
  return;
185
211
  result = polledResult;
@@ -189,7 +215,7 @@ export class ExecutionWorkflow extends WorkflowEntrypoint {
189
215
  // something terminal (see `driveGatePollLoop`). One loop drives every gate kind, since
190
216
  // which gate is resolved inside `pollGate` from the current step.
191
217
  if (result.kind === 'awaiting_gate') {
192
- const gatedResult = await driveGatePollLoop(i, result);
218
+ const gatedResult = await driveGatePollLoop(gatePollDeps, i, result);
193
219
  if (gatedResult === null)
194
220
  return;
195
221
  result = gatedResult;
@@ -1 +1 @@
1
- {"version":3,"file":"ExecutionWorkflow.js","sourceRoot":"","sources":["../../../src/infrastructure/workflows/ExecutionWorkflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,GAKnB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGhD,kFAAkF;AAClF,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE;IACjE,OAAO,EAAE,WAAW;CACQ,CAAA;AAK9B;;;;;;;GAOG;AACH,MAAM,OAAO,iBAAkB,SAAQ,kBAAgD;IAC5E,KAAK,CAAC,GAAG,CAChB,KAA6C,EAC7C,IAAkB;QAElB,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,OAAO,CAAA;QAClD,yFAAyF;QACzF,0FAA0F;QAC1F,mFAAmF;QACnF,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAA;QAC7E,iFAAiF;QACjF,kFAAkF;QA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AAC;YAED,IAAI,MAAM,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;gBACxC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAA;gBACpC,gFAAgF;gBAChF,gFAAgF;gBAChF,0EAA0E;gBAC1E,iFAAiF;gBACjF,6EAA6E;gBAC7E,iFAAiF;gBACjF,6EAA6E;gBAC7E,iFAAiF;gBACjF,IAAI,CAAC;oBACH,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,UAAU,IAAI,CAAC,EAAE,EAAE;wBAClD,IAAI,EAAE,YAAY,UAAU,EAAE;wBAC9B,OAAO,EAAE,eAAe;qBACzB,CAAC,CAAA;gBACJ,CAAC;gBAAC,MAAM,CAAC;oBACP,+EAA+E;gBACjF,CAAC;YACH,CAAC;YACD,+EAA+E;QACjF,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"ExecutionWorkflow.js","sourceRoot":"","sources":["../../../src/infrastructure/workflows/ExecutionWorkflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,GAKnB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEhE,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGhD,kFAAkF;AAClF,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE;IACjE,OAAO,EAAE,WAAW;CACQ,CAAA;AA0B9B;;;;;;GAMG;AACH,KAAK,UAAU,aAAa,CAC1B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E,eAAe;qBACzB,CAAC,CAAA;gBACJ,CAAC;gBAAC,MAAM,CAAC;oBACP,+EAA+E;gBACjF,CAAC;YACH,CAAC;YACD,+EAA+E;QACjF,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ -- Run-lifecycle events on the workspace's outbound webhook (migration 0061). The endpoint that
2
+ -- already receives notification cards can now also receive the lifecycle of the work itself —
3
+ -- `run.started` / `run.completed` / `run.failed` — which raises no notification at all on the
4
+ -- happy path (a pipeline with a `merger` merges its own PR and settles with an empty inbox), so
5
+ -- a headless integration could previously only learn that its task finished by polling.
6
+ --
7
+ -- `run_events` is a JSON array, and EMPTY means NONE — the opposite of the sibling `types`
8
+ -- column, deliberately: every existing row defaults to '[]' and therefore keeps byte-for-byte its
9
+ -- current behaviour, rather than an endpoint registered for parked decisions suddenly receiving
10
+ -- an event per run.
11
+ ALTER TABLE notification_webhooks ADD COLUMN run_events TEXT NOT NULL DEFAULT '[]';
@@ -0,0 +1,84 @@
1
+ -- Foundational services (docs/initiatives/foundational-services.md).
2
+ -- A tiered catalog of shared capabilities (file storage, notifications, audit …) that a
3
+ -- designed system is expected to CONSUME rather than rebuild. Rows are scoped by an
4
+ -- (owner_kind, owner_id) pair — an account id or a workspace id — exactly like the
5
+ -- prompt-fragment library, so one table backs both tenancy tiers and a workspace tombstone
6
+ -- can suppress an inherited account service.
7
+ --
8
+ -- Identity and DOCUMENTS are deliberately separate tables. The Architect's catalog read runs
9
+ -- on every design dispatch and must never load a contract body (an OpenAPI document routinely
10
+ -- runs to hundreds of kilobytes, one per service); only the consumer steps, for only the
11
+ -- services the design declared, read `api_contracts.body`. Keeping them apart makes that a
12
+ -- property of the schema rather than a discipline every caller has to remember.
13
+
14
+ CREATE TABLE foundational_services (
15
+ service_id TEXT NOT NULL, -- the slug an Architect names in its design
16
+ owner_kind TEXT NOT NULL, -- 'account' | 'workspace'
17
+ owner_id TEXT NOT NULL,
18
+ name TEXT NOT NULL,
19
+ summary TEXT NOT NULL, -- one line; the catalog's relevance signal
20
+ description TEXT NOT NULL DEFAULT '', -- what it does, when to use it, what it does NOT cover
21
+ capabilities TEXT NOT NULL DEFAULT '[]', -- JSON string[] of capability tags
22
+ source_id TEXT, -- → foundational_service_sources.id (repo-sourced)
23
+ source_path TEXT,
24
+ pinned_commit TEXT, -- head commit the service dir was synced at
25
+ created_at INTEGER NOT NULL,
26
+ updated_at INTEGER NOT NULL,
27
+ deleted_at INTEGER, -- tombstone (removed upstream / suppressed by tier)
28
+ PRIMARY KEY (owner_kind, owner_id, service_id)
29
+ );
30
+ CREATE INDEX idx_foundational_services_owner
31
+ ON foundational_services (owner_kind, owner_id) WHERE deleted_at IS NULL;
32
+ CREATE INDEX idx_foundational_services_source
33
+ ON foundational_services (source_id) WHERE deleted_at IS NULL;
34
+
35
+ CREATE TABLE api_contracts (
36
+ owner_kind TEXT NOT NULL,
37
+ owner_id TEXT NOT NULL,
38
+ service_id TEXT NOT NULL,
39
+ contract_id TEXT NOT NULL, -- slug within the service (the file basename)
40
+ format TEXT NOT NULL, -- 'openapi' | 'toad-contract' | 'lokalise-api-contract'
41
+ title TEXT NOT NULL,
42
+ body TEXT NOT NULL, -- the document verbatim (never read by the catalog)
43
+ -- Operations indexed ONCE at write time, so the catalog can show an agent what the interface
44
+ -- offers without loading a body. JSON string[]; empty for the TypeScript formats.
45
+ operations TEXT NOT NULL DEFAULT '[]',
46
+ omitted_operations INTEGER NOT NULL DEFAULT 0,
47
+ source_path TEXT, -- repo provenance; null for a direct upload
48
+ source_sha TEXT,
49
+ created_at INTEGER NOT NULL,
50
+ updated_at INTEGER NOT NULL,
51
+ PRIMARY KEY (owner_kind, owner_id, service_id, contract_id)
52
+ );
53
+ -- The catalog's manifest read (whole tier, no bodies) and the lazy read (a set of service ids)
54
+ -- both ride this index.
55
+ CREATE INDEX idx_api_contracts_owner
56
+ ON api_contracts (owner_kind, owner_id, service_id);
57
+
58
+ CREATE TABLE foundational_service_sources (
59
+ id TEXT NOT NULL PRIMARY KEY,
60
+ owner_kind TEXT NOT NULL,
61
+ owner_id TEXT NOT NULL,
62
+ repo_owner TEXT NOT NULL,
63
+ repo_name TEXT NOT NULL,
64
+ git_ref TEXT NOT NULL DEFAULT 'HEAD',
65
+ -- 'directory' scans <dir_path>/<service>/; 'files' reads an explicit path list for ONE service.
66
+ mode TEXT NOT NULL DEFAULT 'directory',
67
+ -- The scanned subtree ('directory'), or the linked files' deepest common directory ('files').
68
+ -- Either way it is what the single head-commit staleness probe anchors on.
69
+ dir_path TEXT NOT NULL DEFAULT '',
70
+ file_paths TEXT NOT NULL DEFAULT '[]', -- JSON string[]; 'files' mode only
71
+ service_id TEXT, -- 'files' mode only: the service they describe
72
+ service_name TEXT,
73
+ service_summary TEXT,
74
+ last_synced_commit TEXT,
75
+ last_synced_at INTEGER,
76
+ created_at INTEGER NOT NULL,
77
+ deleted_at INTEGER,
78
+ UNIQUE (owner_kind, owner_id, repo_owner, repo_name, git_ref, dir_path)
79
+ );
80
+ CREATE INDEX idx_foundational_sources_owner
81
+ ON foundational_service_sources (owner_kind, owner_id) WHERE deleted_at IS NULL;
82
+ -- The autorefresh sweep drains the oldest-synced live sources in bounded batches.
83
+ CREATE INDEX idx_foundational_sources_stale
84
+ ON foundational_service_sources (last_synced_at) WHERE deleted_at IS NULL;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/worker",
3
- "version": "0.128.2",
3
+ "version": "0.130.0",
4
4
  "description": "Reusable Cloudflare Worker library (Hono + D1) exposing the Agent Architecture Board core: the `createApp()` Hono factory, the default fetch/scheduled/queue handler, and the Durable Object + Workflow classes. Deployments (see deploy/backend) supply the wrangler.toml + config and re-export these.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,22 +42,22 @@
42
42
  "pino": "^10.3.1",
43
43
  "valibot": "^1.4.2",
44
44
  "workers-ai-provider": "^4.0.0",
45
- "@cat-factory/agents": "0.94.0",
46
- "@cat-factory/caching": "0.11.30",
47
- "@cat-factory/consensus": "0.13.10",
48
- "@cat-factory/contracts": "0.202.0",
49
- "@cat-factory/eks": "0.1.184",
50
- "@cat-factory/gates": "0.8.30",
51
- "@cat-factory/gitlab": "0.14.13",
52
- "@cat-factory/integrations": "0.113.5",
53
- "@cat-factory/kernel": "0.201.0",
54
- "@cat-factory/observability-langfuse": "0.9.27",
55
- "@cat-factory/observability-otel": "0.4.27",
56
- "@cat-factory/orchestration": "0.177.1",
57
- "@cat-factory/prompt-fragments": "0.15.25",
58
- "@cat-factory/provider-cloudflare": "0.7.336",
59
- "@cat-factory/server": "0.185.2",
60
- "@cat-factory/spend": "0.12.131"
45
+ "@cat-factory/agents": "0.96.0",
46
+ "@cat-factory/caching": "0.12.0",
47
+ "@cat-factory/consensus": "0.13.13",
48
+ "@cat-factory/contracts": "0.204.0",
49
+ "@cat-factory/eks": "0.1.187",
50
+ "@cat-factory/gates": "0.8.33",
51
+ "@cat-factory/integrations": "0.113.8",
52
+ "@cat-factory/gitlab": "0.14.16",
53
+ "@cat-factory/observability-langfuse": "0.9.30",
54
+ "@cat-factory/kernel": "0.203.0",
55
+ "@cat-factory/prompt-fragments": "0.15.27",
56
+ "@cat-factory/observability-otel": "0.4.30",
57
+ "@cat-factory/provider-cloudflare": "0.7.339",
58
+ "@cat-factory/server": "0.188.0",
59
+ "@cat-factory/spend": "0.12.134",
60
+ "@cat-factory/orchestration": "0.179.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@cloudflare/vitest-pool-workers": "^0.18.8",
@@ -65,7 +65,7 @@
65
65
  "typescript": "7.0.2",
66
66
  "vitest": "^4.1.10",
67
67
  "wrangler": "^4.114.0",
68
- "@cat-factory/conformance": "0.16.11"
68
+ "@cat-factory/conformance": "0.17.0"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "tsc -b tsconfig.build.json",