@cat-factory/worker 0.201.5 → 0.201.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -117,7 +117,7 @@ export class CloudflareContainerTransport {
117
117
  backend = 'cloudflare-container';
118
118
  constructor(
119
119
  // Which per-run container class serves a given image variant. Every class (executor, UI
120
- // tester, deploy harness) exposes the same `/jobs` HTTP contract on 8080 plus
120
+ // tester, deploy harness) exposes the same `/jobs` HTTP contract on the harness port plus
121
121
  // `recentStopObservation`/`shutdown`, so this transport drives any of them unchanged: a
122
122
  // deploy-dedicated instance is simply built over a resolver pinned to that one namespace.
123
123
  resolveNamespace,
@@ -1 +1 @@
1
- {"version":3,"file":"CloudflareContainerTransport.js","sourceRoot":"","sources":["../../../src/infrastructure/containers/CloudflareContainerTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EAOrB,kBAAkB,GACnB,MAAM,qBAAqB,CAAA;AAI5B,OAAO,EAEL,qBAAqB,EACrB,eAAe,GAEhB,MAAM,aAAa,CAAA;AAGpB,+FAA+F;AAC/F,yFAAyF;AACzF,gGAAgG;AAChG,gGAAgG;AAChG,gGAAgG;AAChG,iEAAiE;AACjE,MAAM,cAAc,GAAG,wBAAwB,CAAA;AAC/C,MAAM,sBAAsB,GAAG,GAAG,cAAc,sCAAsC,CAAA;AACtF,6FAA6F;AAC7F,6FAA6F;AAC7F,8FAA8F;AAC9F,2FAA2F;AAC3F,yDAAyD;AACzD,MAAM,mBAAmB,GAAG,GAAG,cAAc,2CAA2C,CAAA;AAExF;;;;GAIG;AACH,MAAM,wBAAwB,GAAuC;IACnE,OAAO,EAAE,sBAAsB;IAC/B,IAAI,EAAE,mBAAmB;CAC1B,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,YAAY,CAAC,QAAyB;IAC7C,MAAM,MAAM,GAAG,iBAAi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CAAA;gBACrE,IAAI,IAAI,EAAE,KAAK,KAAK,SAAS;oBAAE,OAAO,SAAS,CAAA;YACjD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,2FAA2F;YAC3F,sEAAsE;YACtE,IAAI,eAAe,CAAC,KAAK,CAAC;gBAAE,OAAO,SAAS,CAAA;QAC9C,CAAC;QACD,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACvB,OAAO,SAAS,CAAA;IAClB,CAAC;CACF;AAED;;;;GAIG;AACH,KAAK,UAAU,QAAQ,CAAC,GAAa;IACnC,IAAI,CAAC;QACH,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,GAAa;IACnC,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,WAAW,CAAA;IACpB,CAAC;AACH,CAAC"}
@@ -5,7 +5,7 @@ import { RunContainer } from './RunContainer';
5
5
  // class, so the `image: 'deploy'` dispatch variant needs its own class. This one is bound as
6
6
  // `DEPLOY_CONTAINER`, so the k8s CLIs never bloat an agent run's cold start.
7
7
  //
8
- // The deploy harness serves the SAME `POST /jobs` + `GET /jobs/{id}` contract on 8080, so the
8
+ // The deploy harness serves the SAME `POST /jobs` + `GET /jobs/{id}` contract on the same port, so the
9
9
  // generic `CloudflareContainerTransport` drives it unchanged (it just gets this namespace), and
10
10
  // its lifecycle behaviour is {@link RunContainer}'s, shared byte-for-byte with the agent one.
11
11
  export class DeployContainer extends RunContainer {
@@ -1 +1 @@
1
- {"version":3,"file":"DeployContainer.js","sourceRoot":"","sources":["../../../src/infrastructure/containers/DeployContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,+FAA+F;AAC/F,gGAAgG;AAChG,0FAA0F;AAC1F,6FAA6F;AAC7F,6EAA6E;AAC7E,EAAE;AACF,8FAA8F;AAC9F,gGAAgG;AAChG,8FAA8F;AAC9F,MAAM,OAAO,eAAgB,SAAQ,YAAY;CAAG"}
1
+ {"version":3,"file":"DeployContainer.js","sourceRoot":"","sources":["../../../src/infrastructure/containers/DeployContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,+FAA+F;AAC/F,gGAAgG;AAChG,0FAA0F;AAC1F,6FAA6F;AAC7F,6EAA6E;AAC7E,EAAE;AACF,uGAAuG;AACvG,gGAAgG;AAChG,8FAA8F;AAC9F,MAAM,OAAO,eAAgB,SAAQ,YAAY;CAAG"}
@@ -4,7 +4,7 @@ import type { Env } from '../env';
4
4
  import { type StopObservation } from './stopCause';
5
5
  /**
6
6
  * The behaviour every per-run Cloudflare Container shares: one Durable Object instance per run
7
- * id hosts that run's sequence of jobs, the harness listens on 8080, and the base
7
+ * id hosts that run's sequence of jobs, the harness listens on {@link HARNESS_JOB_PORT}, and the base
8
8
  * `Container.fetch` proxies inbound requests there once it has booted.
9
9
  *
10
10
  * The two concrete classes ({@link import('./ExecutionContainer').ExecutionContainer} and
@@ -147,4 +147,31 @@ export declare abstract class RunContainer extends Container<Env> {
147
147
  /** The DO storage, narrowed to what the stop-cause bookkeeping uses. */
148
148
  private get storage();
149
149
  }
150
+ /**
151
+ * The container env every per-run Cloudflare Container is started with.
152
+ *
153
+ * A free function rather than an inline initializer because it is the only place the Worker states
154
+ * what the job container's environment IS, and an initializer reading `this.env` can only be
155
+ * evaluated by standing up a Durable Object.
156
+ *
157
+ * Two values are omitted when unset, so the harness keeps its own defaults:
158
+ *
159
+ * - `HARNESS_SHARED_SECRET`: inbound auth, so the harness rejects any /jobs call that does not
160
+ * present the matching `x-harness-secret` header (which the transport sends).
161
+ * - `GITHUB_ALLOWED_HOSTS`: the harness will only send a clone/push credential to a host on its
162
+ * allow-list, which defaults to github.com. A GitLab deployment's clone URL is therefore
163
+ * refused at checkout unless its instance is named here. It is the sibling of
164
+ * `deploymentRepoOrigin`, derived from the same `GITLAB_API_BASE` inversion so the host
165
+ * dispatched to and the host allowed cannot disagree. (Local mode's `harnessAllowedHosts` is
166
+ * the same widening on the transport it owns.)
167
+ *
168
+ * `PORT` is the exception: always stated, and last, so nothing above can disagree with the
169
+ * {@link RunContainer.defaultPort} the class addresses. Left unset, the two are joined only by the
170
+ * image happening to default to the same number, and a deployment pins its OWN mirrored image tag
171
+ * in the wrangler `[[containers]]` block. One left on a tag from before the harness port moved
172
+ * would bind its own default, answer nothing on `defaultPort`, and surface as a container that
173
+ * never became ready. The Kubernetes pod spec and the local container adapters state it the same
174
+ * way, so no facade leaves the served port to the image.
175
+ */
176
+ export declare function runContainerEnv(env: Env): Record<string, string>;
150
177
  //# sourceMappingURL=RunContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RunContainer.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/containers/RunContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAGxD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAGjC,OAAO,EAML,KAAK,eAAe,EAErB,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;;;;;;;GAeG;AACH,8BAAsB,YAAa,SAAQ,SAAS,CAAC,GAAG,CAAC;IACvD,wFAAwF;IAC/E,WAAW,SAAO;IAYlB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKvC;IAMQ,UAAU,SAAQ;IAE3B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,iBAAiB,CAAQ;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OAAO,CAAC,iBAAiB,CAAQ;IAEjC;;;;;OAKG;IACY,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAGtC;IAED;;;;;;;OAOG;IACY,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAIvD;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACY,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvD;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACY,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAShD;IAED;;;;;;;;;;;;;;OAcG;IACY,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAWxD;IAED;;;;;;;;OAQG;IACG,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAEnE;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAc9B;IAED,OAAO,CAAC,MAAM;IAId,wEAAwE;IACxE,OAAO,KAAK,OAAO,GAElB;CACF;AAiCD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMhE"}
@@ -1,4 +1,5 @@
1
1
  import { Container } from '@cloudflare/containers';
2
+ import { HARNESS_JOB_PORT } from '@cat-factory/contracts';
2
3
  import { runBestEffort } from '@cat-factory/kernel';
3
4
  import { harnessGitLabHost } from '@cat-factory/server';
4
5
  import { loadGitLabConfig } from '../config/gitlab';
@@ -6,7 +7,7 @@ import { logger } from '../observability/logger';
6
7
  import { clearStopCause, isRolloutSignal, observationForStop, recordStopCause, takeStopCause, } from './stopCause';
7
8
  /**
8
9
  * The behaviour every per-run Cloudflare Container shares: one Durable Object instance per run
9
- * id hosts that run's sequence of jobs, the harness listens on 8080, and the base
10
+ * id hosts that run's sequence of jobs, the harness listens on {@link HARNESS_JOB_PORT}, and the base
10
11
  * `Container.fetch` proxies inbound requests there once it has booted.
11
12
  *
12
13
  * The two concrete classes ({@link import('./ExecutionContainer').ExecutionContainer} and
@@ -22,23 +23,8 @@ import { clearStopCause, isRolloutSignal, observationForStop, recordStopCause, t
22
23
  */
23
24
  export class RunContainer extends Container {
24
25
  /** The harness HTTP server port (matches each image's Dockerfile ENTRYPOINT/EXPOSE). */
25
- defaultPort = 8080;
26
- // Two env values, both omitted when unset so the harness keeps its own defaults:
27
- //
28
- // - `HARNESS_SHARED_SECRET`: inbound auth, so the harness rejects any /jobs call that does
29
- // not present the matching `x-harness-secret` header (which the transport sends).
30
- // - `GITHUB_ALLOWED_HOSTS`: the harness will only send a clone/push credential to a host on
31
- // its allow-list, which defaults to github.com. A GitLab deployment's clone URL is
32
- // therefore refused at checkout unless its instance is named here. It is the sibling of
33
- // `deploymentRepoOrigin`, derived from the same `GITLAB_API_BASE` inversion so the host
34
- // dispatched to and the host allowed cannot disagree. (Local mode's `harnessAllowedHosts`
35
- // is the same widening on the transport it owns.)
36
- envVars = {
37
- ...(this.env.HARNESS_SHARED_SECRET
38
- ? { HARNESS_SHARED_SECRET: this.env.HARNESS_SHARED_SECRET }
39
- : {}),
40
- ...harnessHostEnv(this.env),
41
- };
26
+ defaultPort = HARNESS_JOB_PORT;
27
+ envVars = runContainerEnv(this.env);
42
28
  // A job is dispatched, then polled every ~15s while it runs, so the instance stays warm for
43
29
  // the job's duration without holding a single request open. Polling is the ONLY thing that
44
30
  // keeps it warm, which is why an elapsed window is recorded as a reclaim cause rather than
@@ -248,4 +234,37 @@ function harnessHostEnv(env) {
248
234
  const host = harnessGitLabHost(loadGitLabConfig(env));
249
235
  return host ? { GITHUB_ALLOWED_HOSTS: host } : {};
250
236
  }
237
+ /**
238
+ * The container env every per-run Cloudflare Container is started with.
239
+ *
240
+ * A free function rather than an inline initializer because it is the only place the Worker states
241
+ * what the job container's environment IS, and an initializer reading `this.env` can only be
242
+ * evaluated by standing up a Durable Object.
243
+ *
244
+ * Two values are omitted when unset, so the harness keeps its own defaults:
245
+ *
246
+ * - `HARNESS_SHARED_SECRET`: inbound auth, so the harness rejects any /jobs call that does not
247
+ * present the matching `x-harness-secret` header (which the transport sends).
248
+ * - `GITHUB_ALLOWED_HOSTS`: the harness will only send a clone/push credential to a host on its
249
+ * allow-list, which defaults to github.com. A GitLab deployment's clone URL is therefore
250
+ * refused at checkout unless its instance is named here. It is the sibling of
251
+ * `deploymentRepoOrigin`, derived from the same `GITLAB_API_BASE` inversion so the host
252
+ * dispatched to and the host allowed cannot disagree. (Local mode's `harnessAllowedHosts` is
253
+ * the same widening on the transport it owns.)
254
+ *
255
+ * `PORT` is the exception: always stated, and last, so nothing above can disagree with the
256
+ * {@link RunContainer.defaultPort} the class addresses. Left unset, the two are joined only by the
257
+ * image happening to default to the same number, and a deployment pins its OWN mirrored image tag
258
+ * in the wrangler `[[containers]]` block. One left on a tag from before the harness port moved
259
+ * would bind its own default, answer nothing on `defaultPort`, and surface as a container that
260
+ * never became ready. The Kubernetes pod spec and the local container adapters state it the same
261
+ * way, so no facade leaves the served port to the image.
262
+ */
263
+ export function runContainerEnv(env) {
264
+ return {
265
+ ...(env.HARNESS_SHARED_SECRET ? { HARNESS_SHARED_SECRET: env.HARNESS_SHARED_SECRET } : {}),
266
+ ...harnessHostEnv(env),
267
+ PORT: String(HARNESS_JOB_PORT),
268
+ };
269
+ }
251
270
  //# sourceMappingURL=RunContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RunContainer.js","sourceRoot":"","sources":["../../../src/infrastructure/containers/RunContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,g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AAE,qBAAqB,EAAE,GAAG,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1F,GAAG,cAAc,CAAC,GAAG,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC,gBAAgB,CAAC;KAC/B,CAAA;AACH,CAAC"}
@@ -10,7 +10,7 @@ import { RunContainer } from './RunContainer';
10
10
  // agent steps with a `tester-ui` step, and a per-run container cannot change image mid-run. The
11
11
  // two are addressed by `containerKeyForRef`, which qualifies the run id with the variant.
12
12
  //
13
- // The UI image serves the SAME `POST /jobs` + `GET /jobs/{id}` contract on 8080 (it layers onto
13
+ // The UI image serves the SAME `POST /jobs` + `GET /jobs/{id}` contract on the same port (it layers onto
14
14
  // the same harness), so the generic `CloudflareContainerTransport` drives it unchanged, and its
15
15
  // lifecycle behaviour is {@link RunContainer}'s, shared byte-for-byte with the agent one.
16
16
  export class UiTesterContainer extends RunContainer {
@@ -1 +1 @@
1
- {"version":3,"file":"UiTesterContainer.js","sourceRoot":"","sources":["../../../src/infrastructure/containers/UiTesterContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,gGAAgG;AAChG,6FAA6F;AAC7F,8FAA8F;AAC9F,4FAA4F;AAC5F,+FAA+F;AAC/F,iEAAiE;AACjE,EAAE;AACF,4FAA4F;AAC5F,gGAAgG;AAChG,0FAA0F;AAC1F,EAAE;AACF,gGAAgG;AAChG,gGAAgG;AAChG,0FAA0F;AAC1F,MAAM,OAAO,iBAAkB,SAAQ,YAAY;CAAG"}
1
+ {"version":3,"file":"UiTesterContainer.js","sourceRoot":"","sources":["../../../src/infrastructure/containers/UiTesterContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,gGAAgG;AAChG,6FAA6F;AAC7F,8FAA8F;AAC9F,4FAA4F;AAC5F,+FAA+F;AAC/F,iEAAiE;AACjE,EAAE;AACF,4FAA4F;AAC5F,gGAAgG;AAChG,0FAA0F;AAC1F,EAAE;AACF,yGAAyG;AACzG,gGAAgG;AAChG,0FAA0F;AAC1F,MAAM,OAAO,iBAAkB,SAAQ,YAAY;CAAG"}
@@ -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;AAMjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AA6JpE;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,kBAAkB,CAAC,GAAG,EAAE,uBAAuB,CAAC;IAC5E,GAAG,CAAC,KAAK,EAAE,aAAa,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7F;YAEa,KAAK;CA2MpB"}
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;AAI3B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAMjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAqBpE;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,kBAAkB,CAAC,GAAG,EAAE,uBAAuB,CAAC;IAC5E,GAAG,CAAC,KAAK,EAAE,aAAa,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7F;YAEa,KAAK;CAwLpB"}
@@ -1,11 +1,12 @@
1
1
  import { WorkflowEntrypoint, } from 'cloudflare:workers';
2
2
  import { getErrorMessage, redactSecrets } from '@cat-factory/kernel';
3
- import { failureFromAdvanceError, failureFromDriver, failureFromResult, } from '@cat-factory/orchestration';
3
+ import { failureFromAdvanceError, failureFromResult } from '@cat-factory/orchestration';
4
4
  import { buildContainer } from '../container';
5
5
  import { loadConfig } from '../config';
6
6
  import { logger } from '../observability/logger';
7
7
  import { withWorkflowLogExport } from './logExport';
8
8
  import { buildWorkflowRuntime } from './runtime';
9
+ import { drainParks, } from './parkDraining';
9
10
  /**
10
11
  * Per-step retry policy: failures retry a few times before the run is failed. The timeout is the
11
12
  * engine's hang bound on one advance (`ExecutionConfig.advanceTimeout`) rather than a constant,
@@ -18,96 +19,6 @@ function buildStepConfig(timeout) {
18
19
  timeout: timeout,
19
20
  };
20
21
  }
21
- /**
22
- * Poll a dispatched async job (a container coding step) for step `i` between durable
23
- * sleeps until it finishes. A thrown poll error is always transient, so tolerate a
24
- * bounded run of them (reset on any good poll) and only fail the run once the tolerance
25
- * is spent or the budget runs out. Returns the settled result, or `null` once it has
26
- * already failed the run (the caller returns).
27
- */
28
- async function drivePollLoop(deps, i, initial) {
29
- const { step, log, maxPolls, failureTolerance, pollInterval, pollOnce, failRun, poll } = deps;
30
- let result = initial;
31
- let polled = false;
32
- let pollReadFailures = 0;
33
- for (let p = 0; p < maxPolls; p++) {
34
- // Poll-first: the job was dispatched instants ago by `advance-${i}`, so the first
35
- // status read runs immediately — a leading sleep would be a full poll interval of
36
- // dead air. Later iterations sleep between polls.
37
- if (p > 0)
38
- await step.sleep(`poll-wait-${i}-${p}`, pollInterval);
39
- const attempt = await pollOnce(`poll-${i}-${p}`, poll);
40
- if (attempt.kind === 'read_failed') {
41
- pollReadFailures += 1;
42
- log.warn('poll could not read job status; treating as still running and retrying', {
43
- step: i,
44
- poll: p,
45
- pollReadFailures,
46
- err: attempt.message,
47
- });
48
- if (pollReadFailures < failureTolerance)
49
- continue;
50
- await failRun(i, failureFromDriver(`Job status was unreadable for ${pollReadFailures} consecutive polls; ` +
51
- `the container appears unreachable (last error: ${attempt.message})`, 'timeout'));
52
- return null;
53
- }
54
- pollReadFailures = 0;
55
- result = attempt.result;
56
- if (result.kind !== 'awaiting_job') {
57
- polled = true;
58
- break;
59
- }
60
- }
61
- if (!polled && result.kind === 'awaiting_job') {
62
- await failRun(i, failureFromDriver('Implementation job did not finish within its polling budget', 'timeout'));
63
- return null;
64
- }
65
- return result;
66
- }
67
- /**
68
- * Drive a polling gate (`ci` / `conflicts` / post-release-health) for step `i` between
69
- * durable sleeps until its precheck yields something terminal. A passing precheck
70
- * returns `continue`, a dispatched helper agent returns `awaiting_job`, and a spent
71
- * budget resolves through the gate's own exhaustion policy. Read failures are tolerated
72
- * exactly like the job loop. Returns the updated result, or `null` once it failed the run.
73
- */
74
- async function driveGatePollLoop(deps, i, initial) {
75
- const { step, log, maxPolls, failureTolerance, pollInterval, pollOnce, failRun, poll } = deps;
76
- let result = initial;
77
- let settled = false;
78
- let pollReadFailures = 0;
79
- for (let p = 0; p < maxPolls; p++) {
80
- await step.sleep(`gate-wait-${i}-${p}`, pollInterval);
81
- const attempt = await pollOnce(`gate-poll-${i}-${p}`, poll);
82
- if (attempt.kind === 'read_failed') {
83
- pollReadFailures += 1;
84
- log.warn('gate poll could not read its precheck; treating as still pending and retrying', {
85
- step: i,
86
- poll: p,
87
- pollReadFailures,
88
- err: attempt.message,
89
- });
90
- if (pollReadFailures < failureTolerance)
91
- continue;
92
- await failRun(i, failureFromDriver(`Gate precheck was unreadable for ${pollReadFailures} consecutive polls ` +
93
- `(last error: ${attempt.message})`, 'timeout'));
94
- return null;
95
- }
96
- pollReadFailures = 0;
97
- result = attempt.result;
98
- if (result.kind !== 'awaiting_gate') {
99
- settled = true;
100
- break;
101
- }
102
- }
103
- if (!settled && result.kind === 'awaiting_gate') {
104
- // Poll budget spent. Let the gate decide: a time-windowed watch gate
105
- // (post-release-health) PASSES, while CI/conflicts resolve to a `job_failed`
106
- // timeout the checks below funnel through `failRun`. One policy, both runtimes.
107
- result = (await step.do(`gate-exhausted-${i}`, deps.stepConfig, deps.resolveExhaustion));
108
- }
109
- return result;
110
- }
111
22
  /**
112
23
  * Durable driver for one pipeline run. It contains NO business logic — every
113
24
  * decision lives in core's ExecutionService. Each loop iteration advances the
@@ -215,30 +126,11 @@ export class ExecutionWorkflow extends WorkflowEntrypoint {
215
126
  await failRun(i, failureFromAdvanceError(error));
216
127
  return;
217
128
  }
218
- // An async step (a container coding job) dispatched and parked. Poll it between
219
- // durable sleeps until it finishes each poll is its own short, retriable step, so
220
- // the job can run far longer than one step's timeout while the driver stays cheap and
221
- // survives eviction. The job's bound is enforced container-side (inactivity +
222
- // max-duration watchdogs); `jobMaxPolls` is only a backstop. `null` means the loop
223
- // already failed the run.
224
- if (result.kind === 'awaiting_job') {
225
- const polledResult = await drivePollLoop(jobPollDeps, i, result);
226
- if (polledResult === null)
227
- return;
228
- result = polledResult;
229
- }
230
- // A polling gate step (`ci` / `conflicts` / post-release-health) is gating the PR on
231
- // its precheck. Re-run the precheck between durable sleeps until the gate yields
232
- // something terminal (see `driveGatePollLoop`). One loop drives every gate kind, since
233
- // which gate is resolved inside `pollGate` from the current step.
234
- if (result.kind === 'awaiting_gate') {
235
- const gatedResult = await driveGatePollLoop(gatePollDeps, i, result);
236
- if (gatedResult === null)
237
- return;
238
- result = gatedResult;
239
- // Fall through: the now-updated `result` (continue / done / awaiting_job /
240
- // job_failed) is handled by the checks below and the next outer-loop iteration.
241
- }
129
+ const drained = await drainParks({ job: jobPollDeps, gate: gatePollDeps }, i, result);
130
+ // `null` means one of the loops already recorded the run's failure; nothing left to drive.
131
+ if (drained === null)
132
+ return;
133
+ result = drained;
242
134
  if (result.kind === 'job_failed') {
243
135
  // An inline gate may carry the precise classification + diagnostic (e.g. an
244
136
  // unparseable companion verdict → `companion_rejected` with its raw reply as
@@ -1 +1 @@
1
- {"version":3,"file":"ExecutionW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BACzB,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,94 @@
1
+ import type { WorkflowSleepDuration, WorkflowStep, WorkflowStepConfig } from 'cloudflare:workers';
2
+ import type { Logger } from '@cat-factory/kernel';
3
+ import type { AdvanceResult, RunFailure } from '@cat-factory/orchestration';
4
+ /** Outcome of one durable status read: a settled result, or a tolerated transient read error. */
5
+ export type PollAttempt = {
6
+ kind: 'ok';
7
+ result: AdvanceResult;
8
+ } | {
9
+ kind: 'read_failed';
10
+ message: string;
11
+ };
12
+ /**
13
+ * The bound callbacks and knobs one durable poll loop needs. The two loops below are lifted out of
14
+ * {@link ExecutionWorkflow.run} — which owns the run-scoped closures they call — so that driver
15
+ * stays within the per-function line budget; they take those closures as deps rather than
16
+ * re-deriving anything, so the loops remain pure control flow with no business logic of their own.
17
+ */
18
+ export interface PollLoopDeps {
19
+ step: WorkflowStep;
20
+ log: Pick<Logger, 'warn'>;
21
+ /** `execConfig.jobMaxPolls` / `ciMaxPolls` — the backstop bound on this loop's iterations. */
22
+ maxPolls: number;
23
+ /** `execConfig.jobPollFailureTolerance` — consecutive unreadable polls before failing the run. */
24
+ failureTolerance: number;
25
+ /** The durable sleep between polls. */
26
+ pollInterval: WorkflowSleepDuration;
27
+ /** The per-durable-step retry/timeout policy (see {@link buildStepConfig}). */
28
+ stepConfig: WorkflowStepConfig;
29
+ pollOnce: (label: string, read: () => Promise<AdvanceResult>) => Promise<PollAttempt>;
30
+ failRun: (i: number, failure: RunFailure) => Promise<void>;
31
+ /** One status read (`pollAgentJob` / `pollGate`), already bound to the run. */
32
+ poll: () => Promise<AdvanceResult>;
33
+ }
34
+ /**
35
+ * WHERE one poll loop is running: the step index it reports against, and the durable step-name
36
+ * scope its own `step.do` / `step.sleep` names are built from.
37
+ *
38
+ * The two are separate because ONE step index drives SEVERAL loops — a `deployer` whose deploy job
39
+ * finishes into an environment that is still building parks twice on the same index, and both
40
+ * parks are drained by {@link drivePollLoop}. Workflows memoises a durable step by NAME, so two
41
+ * loops sharing a scope do not merely collide: the second replays the FIRST's cached answers and
42
+ * never issues a poll of its own, leaving the run to hop on a stale result. Scoping by hop is what
43
+ * keeps every name distinct; {@link driveGatePollLoop} additionally has its own `gate-` prefix, so
44
+ * it can never collide with the job/environment loop within one hop.
45
+ */
46
+ export interface PollLoopSite {
47
+ /** The pipeline step index: `log.warn` fields and the step a failure is recorded against. */
48
+ index: number;
49
+ /** The unique-per-loop durable name scope, `<step>-<hop>`. */
50
+ scope: string;
51
+ }
52
+ /** {@link PollLoopDeps} plus the gate's own budget-exhaustion policy (see `driveGatePollLoop`). */
53
+ export type GatePollLoopDeps = PollLoopDeps & {
54
+ resolveExhaustion: () => Promise<AdvanceResult>;
55
+ };
56
+ /**
57
+ * Poll a dispatched async job (a container coding step) for step `i` between durable
58
+ * sleeps until it finishes. A thrown poll error is always transient, so tolerate a
59
+ * bounded run of them (reset on any good poll) and only fail the run once the tolerance
60
+ * is spent or the budget runs out. Returns the settled result, or `null` once it has
61
+ * already failed the run (the caller returns).
62
+ */
63
+ export declare function drivePollLoop(deps: PollLoopDeps & {
64
+ /** The park kind this loop drains; anything else settles it. Defaults to `awaiting_job`. */
65
+ awaiting?: AdvanceResult['kind'];
66
+ /** What a spent budget FAILED at, e.g. "Implementation job". Defaults to that. */
67
+ label?: string;
68
+ /**
69
+ * Whether the FIRST read runs before any sleep. True for a just-dispatched job (a leading
70
+ * interval would be dead air between "accepted" and the first progress reaching the board);
71
+ * false where the advance that parked the step already made the same read moments ago.
72
+ */
73
+ pollFirst?: boolean;
74
+ }, site: PollLoopSite, initial: AdvanceResult): Promise<AdvanceResult | null>;
75
+ /**
76
+ * Drive a polling gate (`ci` / `conflicts` / post-release-health) for step `i` between
77
+ * durable sleeps until its precheck yields something terminal. A passing precheck
78
+ * returns `continue`, a dispatched helper agent returns `awaiting_job`, and a spent
79
+ * budget resolves through the gate's own exhaustion policy. Read failures are tolerated
80
+ * exactly like the job loop. Returns the updated result, or `null` once it failed the run.
81
+ */
82
+ export declare function driveGatePollLoop(deps: GatePollLoopDeps, site: PollLoopSite, initial: AdvanceResult): Promise<AdvanceResult | null>;
83
+ /**
84
+ * Drain every park step `i` lands on, until the result is something the driver can act on.
85
+ *
86
+ * Lifted out of {@link ExecutionWorkflow.drive} for the same reason the two poll loops above were:
87
+ * it is pure control flow over run-scoped closures, and it keeps that driver within its statement
88
+ * budget. Returns the drained result, or `null` once a loop has already failed the run.
89
+ */
90
+ export declare function drainParks(deps: {
91
+ job: PollLoopDeps;
92
+ gate: GatePollLoopDeps;
93
+ }, i: number, initial: AdvanceResult): Promise<AdvanceResult | null>;
94
+ //# sourceMappingURL=parkDraining.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parkDraining.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/workflows/parkDraining.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAgB3E,iGAAiG;AACjG,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAA;IAClB,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzB,8FAA8F;IAC9F,QAAQ,EAAE,MAAM,CAAA;IAChB,kGAAkG;IAClG,gBAA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AU,CAC9B,IAAI,EAAE;IAAE,GAAG,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAA;CAAE,EACnD,CAAC,EAAE,MAAM,EACT,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAsE/B"}
@@ -0,0 +1,174 @@
1
+ import { failureFromDriver, MAX_PARK_HOPS } from '@cat-factory/orchestration';
2
+ /**
3
+ * Poll a dispatched async job (a container coding step) for step `i` between durable
4
+ * sleeps until it finishes. A thrown poll error is always transient, so tolerate a
5
+ * bounded run of them (reset on any good poll) and only fail the run once the tolerance
6
+ * is spent or the budget runs out. Returns the settled result, or `null` once it has
7
+ * already failed the run (the caller returns).
8
+ */
9
+ export async function drivePollLoop(deps, site, initial) {
10
+ const { step, log, maxPolls, failureTolerance, pollInterval, pollOnce, failRun, poll } = deps;
11
+ const { index, scope } = site;
12
+ const awaiting = deps.awaiting ?? 'awaiting_job';
13
+ const label = deps.label ?? 'Implementation job';
14
+ let result = initial;
15
+ let polled = false;
16
+ let pollReadFailures = 0;
17
+ for (let p = 0; p < maxPolls; p++) {
18
+ // Poll-first: the job was dispatched instants ago by `advance-${index}`, so the first
19
+ // status read runs immediately — a leading sleep would be a full poll interval of
20
+ // dead air. Later iterations sleep between polls.
21
+ if (p > 0 || deps.pollFirst === false)
22
+ await step.sleep(`poll-wait-${scope}-${p}`, pollInterval);
23
+ const attempt = await pollOnce(`poll-${scope}-${p}`, poll);
24
+ if (attempt.kind === 'read_failed') {
25
+ pollReadFailures += 1;
26
+ log.warn('poll could not read job status; treating as still running and retrying', {
27
+ step: index,
28
+ poll: p,
29
+ pollReadFailures,
30
+ err: attempt.message,
31
+ });
32
+ if (pollReadFailures < failureTolerance)
33
+ continue;
34
+ await failRun(index, failureFromDriver(`Job status was unreadable for ${pollReadFailures} consecutive polls; ` +
35
+ `the container appears unreachable (last error: ${attempt.message})`, 'timeout'));
36
+ return null;
37
+ }
38
+ pollReadFailures = 0;
39
+ result = attempt.result;
40
+ if (result.kind !== awaiting) {
41
+ polled = true;
42
+ break;
43
+ }
44
+ }
45
+ if (!polled && result.kind === awaiting) {
46
+ await failRun(index, failureFromDriver(`${label} did not finish within its polling budget`, 'timeout'));
47
+ return null;
48
+ }
49
+ return result;
50
+ }
51
+ /**
52
+ * Drive a polling gate (`ci` / `conflicts` / post-release-health) for step `i` between
53
+ * durable sleeps until its precheck yields something terminal. A passing precheck
54
+ * returns `continue`, a dispatched helper agent returns `awaiting_job`, and a spent
55
+ * budget resolves through the gate's own exhaustion policy. Read failures are tolerated
56
+ * exactly like the job loop. Returns the updated result, or `null` once it failed the run.
57
+ */
58
+ export async function driveGatePollLoop(deps, site, initial) {
59
+ const { step, log, maxPolls, failureTolerance, pollInterval, pollOnce, failRun, poll } = deps;
60
+ const { index, scope } = site;
61
+ let result = initial;
62
+ let settled = false;
63
+ let pollReadFailures = 0;
64
+ for (let p = 0; p < maxPolls; p++) {
65
+ await step.sleep(`gate-wait-${scope}-${p}`, pollInterval);
66
+ const attempt = await pollOnce(`gate-poll-${scope}-${p}`, poll);
67
+ if (attempt.kind === 'read_failed') {
68
+ pollReadFailures += 1;
69
+ log.warn('gate poll could not read its precheck; treating as still pending and retrying', {
70
+ step: index,
71
+ poll: p,
72
+ pollReadFailures,
73
+ err: attempt.message,
74
+ });
75
+ if (pollReadFailures < failureTolerance)
76
+ continue;
77
+ await failRun(index, failureFromDriver(`Gate precheck was unreadable for ${pollReadFailures} consecutive polls ` +
78
+ `(last error: ${attempt.message})`, 'timeout'));
79
+ return null;
80
+ }
81
+ pollReadFailures = 0;
82
+ result = attempt.result;
83
+ if (result.kind !== 'awaiting_gate') {
84
+ settled = true;
85
+ break;
86
+ }
87
+ }
88
+ if (!settled && result.kind === 'awaiting_gate') {
89
+ // Poll budget spent. Let the gate decide: a time-windowed watch gate
90
+ // (post-release-health) PASSES, while CI/conflicts resolve to a `job_failed`
91
+ // timeout the checks below funnel through `failRun`. One policy, both runtimes.
92
+ result = (await step.do(`gate-exhausted-${scope}`, deps.stepConfig, deps.resolveExhaustion));
93
+ }
94
+ return result;
95
+ }
96
+ /**
97
+ * Drain every park step `i` lands on, until the result is something the driver can act on.
98
+ *
99
+ * Lifted out of {@link ExecutionWorkflow.drive} for the same reason the two poll loops above were:
100
+ * it is pure control flow over run-scoped closures, and it keeps that driver within its statement
101
+ * budget. Returns the drained result, or `null` once a loop has already failed the run.
102
+ */
103
+ export async function drainParks(deps, i, initial) {
104
+ let result = initial;
105
+ // Keep draining: a poll routinely resolves into a DIFFERENT park rather than into a terminal
106
+ // result. A `ci` gate that finds CI red dispatches a `ci-fixer` and returns `awaiting_job`; a
107
+ // deploy job whose provider is still building returns `awaiting_environment`. So loop until the
108
+ // result is no longer a park, rather than letting an un-drained one fall through to the next
109
+ // `advanceInstance` to re-establish — which is exactly why the ORDER of these branches must not
110
+ // matter, and why this mirrors the hop loop in `drive.ts` (same `MAX_PARK_HOPS` bound) instead
111
+ // of the flat branch sequence it replaces. That sequence silently dropped any park raised by a
112
+ // branch EARLIER than the one already taken: an `awaiting_environment` raised by the deploy-job
113
+ // poll (an async provider still answering `provisioning` as its container finishes) matched no
114
+ // remaining branch at all, so the driver re-advanced and stood a second environment up for the
115
+ // same frame.
116
+ //
117
+ // Each hop gets its OWN durable name scope (see {@link PollLoopSite}); sharing one would have
118
+ // the second loop replay the first's memoised polls instead of issuing any of its own.
119
+ for (let hop = 0; hop < MAX_PARK_HOPS; hop++) {
120
+ const site = { index: i, scope: `${i}-${hop}` };
121
+ // An async step (a container coding job) dispatched and parked. Poll it between durable
122
+ // sleeps until it finishes — each poll is its own short, retriable step, so the job can run
123
+ // far longer than one step's timeout while the driver stays cheap and survives eviction. The
124
+ // job's bound is enforced container-side (inactivity + max-duration watchdogs); `jobMaxPolls`
125
+ // is only a backstop.
126
+ if (result.kind === 'awaiting_job') {
127
+ const polled = await drivePollLoop(deps.job, site, result);
128
+ if (polled === null)
129
+ return null;
130
+ result = polled;
131
+ continue;
132
+ }
133
+ // A `deployer` step is waiting for the environment it provisioned to become ready. Re-read
134
+ // the provider between durable sleeps on the JOB cadence (infra coming up, not a human-scale
135
+ // gate), through the same `pollAgentJob` entry point. The wait's own ceiling settles it long
136
+ // before this budget does.
137
+ if (result.kind === 'awaiting_environment') {
138
+ const waited = await drivePollLoop({
139
+ ...deps.job,
140
+ awaiting: 'awaiting_environment',
141
+ label: 'Environment readiness',
142
+ // Sleep-first, matching `drive.ts`: the advance that parked the step read the provider
143
+ // moments ago.
144
+ pollFirst: false,
145
+ }, site, result);
146
+ if (waited === null)
147
+ return null;
148
+ result = waited;
149
+ continue;
150
+ }
151
+ // A polling gate step (`ci` / `conflicts` / post-release-health) is gating the PR on its
152
+ // precheck. Re-run the precheck between durable sleeps until the gate yields something
153
+ // terminal (see {@link driveGatePollLoop}). One loop drives every gate kind, since which gate
154
+ // is resolved inside `pollGate` from the current step.
155
+ if (result.kind === 'awaiting_gate') {
156
+ const gated = await driveGatePollLoop(deps.gate, site, result);
157
+ if (gated === null)
158
+ return null;
159
+ result = gated;
160
+ // An unbounded-wait gate (human review) RE-ARMS by returning `awaiting_gate` from
161
+ // `resolveGatePollExhaustion`. Stop hopping and hand it back for a re-advance: another hop
162
+ // would spend a whole fresh poll budget of durable sleeps inside this instance for a wait
163
+ // that can last days, where re-advancing re-establishes the identical park and keeps the
164
+ // step history bounded (the same limit the driver's `paused` branch parks on `waitForEvent`
165
+ // to respect). `drive.ts` releases its in-process drive here for the sibling reason.
166
+ if (result.kind === 'awaiting_gate')
167
+ break;
168
+ continue;
169
+ }
170
+ break;
171
+ }
172
+ return result;
173
+ }
174
+ //# sourceMappingURL=parkDraining.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parkDraining.js","sourceRoot":"","sources":["../../../src/infrastructure/workflows/parkDraining.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAiE7E;;;;;;GAMG;A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AAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;YAC9D,IAAI,KAAK,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAA;YAC/B,MAAM,GAAG,KAAK,CAAA;YACd,kFAAkF;YAClF,2FAA2F;YAC3F,0FAA0F;YAC1F,yFAAyF;YACzF,4FAA4F;YAC5F,qFAAqF;YACrF,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe;gBAAE,MAAK;YAC1C,SAAQ;QACV,CAAC;QACD,MAAK;IACP,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/worker",
3
- "version": "0.201.5",
3
+ "version": "0.201.7",
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",
@@ -36,23 +36,23 @@
36
36
  "@ai-sdk/anthropic": "^4.0.41",
37
37
  "@ai-sdk/openai": "^4.0.46",
38
38
  "@ai-sdk/openai-compatible": "^3.0.35",
39
- "@cat-factory/agents": "0.145.2",
40
- "@cat-factory/binary-generators": "0.3.14",
41
- "@cat-factory/caching": "0.20.48",
42
- "@cat-factory/consensus": "0.17.13",
43
- "@cat-factory/contracts": "0.331.0",
44
- "@cat-factory/eks": "0.1.352",
45
- "@cat-factory/gates": "0.11.14",
46
- "@cat-factory/gitlab": "0.22.14",
47
- "@cat-factory/integrations": "0.166.14",
48
- "@cat-factory/kernel": "0.321.2",
49
- "@cat-factory/observability-langfuse": "0.11.14",
50
- "@cat-factory/observability-otel": "0.23.7",
51
- "@cat-factory/orchestration": "0.288.5",
52
- "@cat-factory/prompt-fragments": "1.1.10",
53
- "@cat-factory/provider-cloudflare": "0.7.505",
54
- "@cat-factory/server": "0.307.1",
55
- "@cat-factory/spend": "0.16.19",
39
+ "@cat-factory/agents": "0.146.0",
40
+ "@cat-factory/binary-generators": "0.3.16",
41
+ "@cat-factory/caching": "0.20.50",
42
+ "@cat-factory/consensus": "0.17.15",
43
+ "@cat-factory/contracts": "0.333.0",
44
+ "@cat-factory/eks": "0.1.354",
45
+ "@cat-factory/gates": "0.11.16",
46
+ "@cat-factory/gitlab": "0.22.16",
47
+ "@cat-factory/integrations": "0.166.16",
48
+ "@cat-factory/kernel": "0.322.0",
49
+ "@cat-factory/observability-langfuse": "0.11.16",
50
+ "@cat-factory/observability-otel": "0.23.9",
51
+ "@cat-factory/orchestration": "0.289.0",
52
+ "@cat-factory/prompt-fragments": "1.1.12",
53
+ "@cat-factory/provider-cloudflare": "0.7.507",
54
+ "@cat-factory/server": "0.307.3",
55
+ "@cat-factory/spend": "0.16.21",
56
56
  "@cloudflare/containers": "^0.3.7",
57
57
  "@hono/valibot-validator": "^0.6.1",
58
58
  "ai": "^7.0.77",
@@ -62,7 +62,7 @@
62
62
  "workers-ai-provider": "^4.0.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@cat-factory/conformance": "0.47.11",
65
+ "@cat-factory/conformance": "0.47.13",
66
66
  "@cloudflare/vitest-pool-workers": "^0.22.0",
67
67
  "@cloudflare/workers-types": "5.20260815.1",
68
68
  "typescript": "7.0.2",