@cat-factory/orchestration 0.185.2 → 0.187.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 (59) hide show
  1. package/dist/container/dependencies.d.ts +44 -1
  2. package/dist/container/dependencies.d.ts.map +1 -1
  3. package/dist/container/execution-service.d.ts.map +1 -1
  4. package/dist/container/execution-service.js +4 -0
  5. package/dist/container/execution-service.js.map +1 -1
  6. package/dist/container/runtime.d.ts +3 -0
  7. package/dist/container/runtime.d.ts.map +1 -1
  8. package/dist/container/runtime.js +20 -1
  9. package/dist/container/runtime.js.map +1 -1
  10. package/dist/container.d.ts +25 -2
  11. package/dist/container.d.ts.map +1 -1
  12. package/dist/container.js +7 -1
  13. package/dist/container.js.map +1 -1
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +2 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/modules/execution/AgentContextBuilder.d.ts +8 -1
  19. package/dist/modules/execution/AgentContextBuilder.d.ts.map +1 -1
  20. package/dist/modules/execution/AgentContextBuilder.js +14 -13
  21. package/dist/modules/execution/AgentContextBuilder.js.map +1 -1
  22. package/dist/modules/execution/ExecutionServiceDependencies.d.ts +14 -1
  23. package/dist/modules/execution/ExecutionServiceDependencies.d.ts.map +1 -1
  24. package/dist/modules/execution/RunAdmission.d.ts +36 -1
  25. package/dist/modules/execution/RunAdmission.d.ts.map +1 -1
  26. package/dist/modules/execution/RunAdmission.js +61 -11
  27. package/dist/modules/execution/RunAdmission.js.map +1 -1
  28. package/dist/modules/execution/run-binary-output.d.ts +34 -1
  29. package/dist/modules/execution/run-binary-output.d.ts.map +1 -1
  30. package/dist/modules/execution/run-binary-output.js +72 -4
  31. package/dist/modules/execution/run-binary-output.js.map +1 -1
  32. package/dist/modules/execution/run-catalog-context.d.ts +50 -15
  33. package/dist/modules/execution/run-catalog-context.d.ts.map +1 -1
  34. package/dist/modules/execution/run-catalog-context.js +51 -23
  35. package/dist/modules/execution/run-catalog-context.js.map +1 -1
  36. package/dist/modules/execution/run-context-admission.d.ts +1 -1
  37. package/dist/modules/execution/run-context-admission.d.ts.map +1 -1
  38. package/dist/modules/execution/run-context-admission.js +2 -0
  39. package/dist/modules/execution/run-context-admission.js.map +1 -1
  40. package/dist/modules/execution/run-foundational-services.d.ts +9 -2
  41. package/dist/modules/execution/run-foundational-services.d.ts.map +1 -1
  42. package/dist/modules/execution/run-foundational-services.js.map +1 -1
  43. package/dist/modules/observability/operationalMetricsFlush.d.ts +32 -0
  44. package/dist/modules/observability/operationalMetricsFlush.d.ts.map +1 -0
  45. package/dist/modules/observability/operationalMetricsFlush.js +40 -0
  46. package/dist/modules/observability/operationalMetricsFlush.js.map +1 -0
  47. package/dist/modules/observability/platform-health.logic.d.ts +37 -1
  48. package/dist/modules/observability/platform-health.logic.d.ts.map +1 -1
  49. package/dist/modules/observability/platform-health.logic.js +100 -1
  50. package/dist/modules/observability/platform-health.logic.js.map +1 -1
  51. package/dist/modules/observability/retentionPass.d.ts +26 -0
  52. package/dist/modules/observability/retentionPass.d.ts.map +1 -0
  53. package/dist/modules/observability/retentionPass.js +31 -0
  54. package/dist/modules/observability/retentionPass.js.map +1 -0
  55. package/dist/validation/validateRegistrations.d.ts +9 -1
  56. package/dist/validation/validateRegistrations.d.ts.map +1 -1
  57. package/dist/validation/validateRegistrations.js +72 -1
  58. package/dist/validation/validateRegistrations.js.map +1 -1
  59. package/package.json +11 -11
@@ -1,5 +1,5 @@
1
1
  import { BINARY_OUTPUT_TRAIT, hasTrait } from '@cat-factory/agents';
2
- import { noopLogger, parseBinaryOutputDeclaration, runBestEffort } from '@cat-factory/kernel';
2
+ import { dispatchBinaryGenerators, noopLogger, parseBinaryOutputDeclaration, resolveBinaryGeneratorSelection, runBestEffort, } from '@cat-factory/kernel';
3
3
  /**
4
4
  * The `.cat-context/binary-output/` files this dispatch gets: the brief naming the selected
5
5
  * storage + context services plus their contract documents, for a kind carrying the
@@ -10,6 +10,12 @@ import { noopLogger, parseBinaryOutputDeclaration, runBestEffort } from '@cat-fa
10
10
  * trait guidance names the ABSENT brief as meaningful ("the platform could not provide
11
11
  * storage — do not attempt any upload; report it"), so the failure degrades into a stated
12
12
  * refusal rather than a guessed storage endpoint. The failure itself is logged with its cause.
13
+ *
14
+ * That disposition is what lets the GENERATIVE source be remote too. On a mothership-mode node
15
+ * its read can throw, and the absent brief already means "the platform could not provide" —
16
+ * which is true of an unreachable integration set exactly as it is of an unreachable catalog.
17
+ * What must never happen is a brief that RESOLVES and reports the step's integrations as
18
+ * unregistered, which is why the source throws instead of answering empty.
13
19
  */
14
20
  export async function resolveBinaryOutputContext(input) {
15
21
  const resolver = input.foundationalServiceResolver;
@@ -17,9 +23,37 @@ export async function resolveBinaryOutputContext(input) {
17
23
  return [];
18
24
  if (!hasTrait(input.agentKind, BINARY_OUTPUT_TRAIT, input.agentKindRegistry))
19
25
  return [];
20
- const files = await runBestEffort(input.logger ?? noopLogger, 'binaryOutput.context', () => resolver.binaryOutputContextFilesFor(input.workspaceId, input.step.stepOptions?.binaryOutput), { workspaceId: input.workspaceId, agentKind: input.agentKind });
26
+ const files = await runBestEffort(input.logger ?? noopLogger, 'binaryOutput.context', () => resolver.binaryOutputContextFilesFor(input.workspaceId, input.step.stepOptions?.binaryOutput, input.binaryGeneratorSource), { workspaceId: input.workspaceId, agentKind: input.agentKind });
21
27
  return files ?? [];
22
28
  }
29
+ /**
30
+ * The GENERATIVE INTEGRATIONS this dispatch carries on its `AgentRunContext` — the non-secret
31
+ * projection (ids, content types, the credential's KEY NAME) the container executor needs to
32
+ * resolve each declared credential onto the job body.
33
+ *
34
+ * Gated on the SAME condition as the brief — the effective kind carries the trait — because the
35
+ * two are two halves of one hand-off: the brief tells the agent to read `$RD_TOKEN`, and this is
36
+ * what puts a value there. A kind that gets one without the other is either an agent told to use
37
+ * a credential nobody delivered, or a credential delivered to an agent with no idea it exists.
38
+ *
39
+ * BEST-EFFORT and independently of the brief, which is safe in BOTH directions precisely because
40
+ * each half already defines its own absence. A brief with no credentials behind it is the state
41
+ * the brief itself describes ("an unset variable means the platform could not provide the key —
42
+ * report rather than call"); credentials with no brief reach an agent that was never told the
43
+ * integrations exist and so never calls them. Sharing one read between the two would buy
44
+ * consistency the failure modes do not need, at the price of a cache with no invalidation path.
45
+ */
46
+ export async function dispatchBinaryGeneratorsFor(input) {
47
+ const source = input.binaryGeneratorSource;
48
+ if (!source)
49
+ return [];
50
+ if (!hasTrait(input.agentKind, BINARY_OUTPUT_TRAIT, input.agentKindRegistry))
51
+ return [];
52
+ const views = await runBestEffort(input.logger ?? noopLogger, 'binaryOutput.generators', () => source.views(), { agentKind: input.agentKind });
53
+ if (!views)
54
+ return [];
55
+ return dispatchBinaryGenerators(resolveBinaryGeneratorSelection(input.step.stepOptions?.binaryOutput, views));
56
+ }
23
57
  /**
24
58
  * Whether a SETTLED step may carry a binary-output declaration worth reading back — the
25
59
  * read-back's counterpart to {@link resolveBinaryOutputContext}'s trait check.
@@ -45,16 +79,50 @@ export function stepMayDeclareBinaryOutputs(step, agentKindRegistry) {
45
79
  return true;
46
80
  return hasTrait(step.agentKind, BINARY_OUTPUT_TRAIT, agentKindRegistry);
47
81
  }
82
+ /**
83
+ * The registered generator ids for a settlement read-back, as the three states
84
+ * `parseBinaryOutputDeclaration` distinguishes: a real set, a real EMPTY set (no source wired —
85
+ * this deployment registers none), or UNVERIFIED (the source is remote and could not be read).
86
+ *
87
+ * Kept apart from the caller so the failure is caught at the exact read that can fail, rather
88
+ * than by a wrapper that would also swallow the catalog read and the parse beside it. The read
89
+ * is best-effort with the outage logged; the flag it returns is what carries the fact onto the
90
+ * step, where a human reviewing the run's artifacts can see it.
91
+ */
92
+ async function readGenerativeIds(deps) {
93
+ const source = deps.binaryGeneratorSource;
94
+ if (!source)
95
+ return { generators: [] };
96
+ const views = await runBestEffort(deps.logger ?? noopLogger, 'binaryOutput.generatorIds', () => source.views());
97
+ if (!views)
98
+ return { generators: [], generatorsUnverified: true };
99
+ return { generators: views.map((view) => view.id) };
100
+ }
48
101
  /** Bind a {@link BinaryOutputDeclarationRecorder} to the dispatcher's collaborators. */
49
102
  export function createBinaryOutputDeclarationRecorder(deps) {
50
103
  return async (workspaceId, step, output) => {
51
104
  if (!stepMayDeclareBinaryOutputs(step, deps.agentKindRegistry))
52
105
  return;
53
106
  await runBestEffort(deps.logger ?? noopLogger, 'binaryOutput.recordDeclaration', async () => {
54
- const known = deps.foundationalServiceResolver
107
+ const services = deps.foundationalServiceResolver
55
108
  ? await deps.foundationalServiceResolver.catalogIdsFor(workspaceId)
56
109
  : [];
57
- step.binaryOutputs = parseBinaryOutputDeclaration(output, known);
110
+ // The generative ids resolve through the same source the dispatch did, so a run on a
111
+ // mothership-mode node classifies its declaration against the set the mothership
112
+ // registers rather than whatever this node's build happens to hold. An UNWIRED source
113
+ // checks against an EMPTY set — the honest answer on a deployment that registers no
114
+ // integrations, where every claimed id lands in `unknownGenerators` rather than being
115
+ // quietly accepted.
116
+ //
117
+ // An UNREACHABLE one is a third state and gets its own disposition, caught HERE rather
118
+ // than left to the wrapper below. Letting it abort the record would have discarded the
119
+ // whole report — the artifacts the agent stored and the STORAGE half's verdict, which
120
+ // resolves against the workspace catalog and was never in doubt — over a question about
121
+ // the generative half nobody could answer. So the report is written with what IS known
122
+ // and says the rest was unverified: the run's evidence survives an outage, and the one
123
+ // claim that cannot be made is not made.
124
+ const generative = await readGenerativeIds(deps);
125
+ step.binaryOutputs = parseBinaryOutputDeclaration(output, { services, ...generative });
58
126
  }, { workspaceId, agentKind: step.agentKind });
59
127
  };
60
128
  }
@@ -1 +1 @@
1
- {"version":3,"file":"run-binary-output.js","sourceRoot":"","sources":["../../../src/modules/execution/run-binary-output.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAGnE,OAAO,EAAE,UAAU,EAAE,4BAA4B,EAAE,aAAa,EAAE,MA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CAAC"}
@@ -1,10 +1,27 @@
1
1
  import type { AgentKindRegistry } from '@cat-factory/agents';
2
2
  import type { PipelineStep } from '@cat-factory/contracts';
3
- import type { ExecutionInstance, InjectedContextFile, Logger } from '@cat-factory/kernel';
3
+ import type { BinaryGeneratorSource, ExecutionInstance, InjectedContextFile, Logger, ResolvedBinaryGenerator } from '@cat-factory/kernel';
4
4
  import { type FoundationalServiceResolver } from './run-foundational-services.js';
5
+ /**
6
+ * Everything one dispatch takes from the CATALOG side, as {@link CatalogRunContext.sliceFor}
7
+ * returns it: the two injected-file groups the agent reads, and the structured integration
8
+ * projection the container executor turns into credentials on the job body.
9
+ */
10
+ export interface CatalogRunSlice {
11
+ foundationalContextFiles: InjectedContextFile[];
12
+ binaryOutputContextFiles: InjectedContextFile[];
13
+ binaryGenerators: ResolvedBinaryGenerator[];
14
+ }
5
15
  export interface CatalogRunContextDeps {
6
16
  agentKindRegistry: AgentKindRegistry;
7
17
  foundationalServiceResolver?: FoundationalServiceResolver;
18
+ /**
19
+ * The deployment's generative binary integrations. It rides HERE, beside the catalog resolver,
20
+ * because the binary-output brief describes both halves of one selection and the declaration
21
+ * read-back resolves ids against both — keeping them apart would be two places for a dispatch
22
+ * and its settlement to disagree about which integrations existed.
23
+ */
24
+ binaryGeneratorSource?: BinaryGeneratorSource;
8
25
  logger?: Logger;
9
26
  }
10
27
  export declare class CatalogRunContext {
@@ -18,28 +35,46 @@ export declare class CatalogRunContext {
18
35
  private readonly recordBinaryOutput;
19
36
  constructor(deps: CatalogRunContextDeps);
20
37
  /**
21
- * The FOUNDATIONAL SERVICES slice of a dispatch's `.cat-context/` — the catalog for a design
22
- * kind, the declared services' contracts for a consumer kind, nothing for anything else. Reads
23
- * only the steps BEFORE the one being dispatched, so a re-dispatched design cannot read its
24
- * own prior round.
25
- */
26
- foundationalContextFor(workspaceId: string, agentKind: string, instance: ExecutionInstance): Promise<InjectedContextFile[]>;
27
- /**
28
- * The BINARY-OUTPUT slice of a dispatch's `.cat-context/` — the storage/context brief +
29
- * contract files for a kind carrying the `binary-output` trait, resolved off the step's own
30
- * `stepOptions.binaryOutput` selection. Sibling of {@link foundationalContextFor}, off the
31
- * same resolver and failure policy.
38
+ * ALL THREE catalog-backed reads of one dispatch, resolved concurrently — the ONE entry the
39
+ * context read wave takes, so the builder holds a single wave slot rather than three:
40
+ *
41
+ * - the FOUNDATIONAL SERVICES files (the catalog for a design kind, the declared services' API
42
+ * contracts for a consumer kind, nothing for anything else), read only from the steps BEFORE
43
+ * the one being dispatched so a re-dispatched design cannot read its own prior round;
44
+ * - the BINARY-OUTPUT brief for a kind carrying the trait, off the step's own selection;
45
+ * - the GENERATIVE INTEGRATIONS that selection names — the non-secret projection the container
46
+ * executor turns into credentials on the job body.
47
+ *
48
+ * They belong together rather than merely being adjacent: all three go through this
49
+ * collaborator, all three are BEST-EFFORT inside (each gap has a stated rendering — an
50
+ * `unavailable` catalog file, an absent brief the trait guidance already defines as "do not
51
+ * attempt any upload", no integrations to hand credentials for), and on a mothership-mode node
52
+ * all three can cross the machine API. That last point is why the generative half belongs in
53
+ * the wave at all rather than after it, where it would serialise a round trip behind the
54
+ * others for nothing.
55
+ *
56
+ * Exposed as the WHOLE slice rather than three per-read methods, because the sharing below is
57
+ * only correct within one dispatch: a caller that could take the halves separately could take
58
+ * them at different times, which is the drift this collaborator exists to prevent.
59
+ *
60
+ * The two halves of the binary-output selection share ONE `views()` read
61
+ * ({@link memoizeBinaryGeneratorViews}), scoped to this call and discarded with it. The brief
62
+ * that tells an agent which integrations it has and the projection that puts a credential
63
+ * behind each are answers about the same set, so reading it twice bought a second round trip
64
+ * and a window in which they could disagree. Sharing costs no coherence: on a failure both
65
+ * degrade, which is the pair's coherent state (an agent told nothing, handed nothing), and
66
+ * each still applies its own disposition rather than one failing the other.
32
67
  */
33
- binaryOutputContextFor(workspaceId: string, agentKind: string, step: PipelineStep): Promise<InjectedContextFile[]>;
68
+ sliceFor(workspaceId: string, agentKind: string, step: PipelineStep, instance: ExecutionInstance): Promise<CatalogRunSlice>;
34
69
  /**
35
70
  * Read back what a settled DESIGN step declared, and record it on the step — the counterpart
36
- * of {@link foundationalContextFor}, so the completion hub takes no dependency of its own for
71
+ * of the catalog half of {@link sliceFor}, so the completion hub takes no dependency of its own for
37
72
  * it.
38
73
  */
39
74
  recordFoundationalDeclaration(workspaceId: string, step: PipelineStep, output: string | undefined): Promise<void>;
40
75
  /**
41
76
  * Read back what a settled BINARY-GENERATING step declared it stored, and record it on the
42
- * step — the counterpart of {@link binaryOutputContextFor}.
77
+ * step — the counterpart of the binary-output half of {@link sliceFor}.
43
78
  */
44
79
  recordBinaryOutputDeclaration(workspaceId: string, step: PipelineStep, output: string | undefined): Promise<void>;
45
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"run-catalog-context.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-catalog-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACzF,OAAO,EAEL,KAAK,2BAA2B,EAGjC,MAAM,gCAAgC,CAAA;AAiBvC,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,2BAA2B,CAAC,EAAE,2BAA2B,CAAA;IACzD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,iBAAiB;IAShB,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAiC;IACpE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAiC;IAEpE,YAA6B,IAAI,EAAE,qBAAqB,EAGvD;IAED;;;;;OAKG;IACH,sBAAsB,CACpB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAOhC;IAED;;;;;OAKG;IACH,sBAAsB,CACpB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAEhC;IAED;;;;OAIG;IACH,6BAA6B,CAC3B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,OAAO,CAAC,IAAI,CAAC,CAEf;IAED;;;OAGG;IACH,6BAA6B,CAC3B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,OAAO,CAAC,IAAI,CAAC,CAEf;CACF"}
1
+ {"version":3,"file":"run-catalog-context.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-catalog-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EACN,uBAAuB,EACxB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAEL,KAAK,2BAA2B,EAGjC,MAAM,gCAAgC,CAAA;AAkBvC;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,wBAAwB,EAAE,mBAAmB,EAAE,CAAA;IAC/C,wBAAwB,EAAE,mBAAmB,EAAE,CAAA;IAC/C,gBAAgB,EAAE,uBAAuB,EAAE,CAAA;CAC5C;AAED,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,2BAA2B,CAAC,EAAE,2BAA2B,CAAA;IACzD;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,iBAAiB;IAShB,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAiC;IACpE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAiC;IAEpE,YAA6B,IAAI,EAAE,qBAAqB,EAGvD;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,QAAQ,CACZ,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC,eAAe,CAAC,CAmB1B;IAED;;;;OAIG;IACH,6BAA6B,CAC3B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,OAAO,CAAC,IAAI,CAAC,CAEf;IAED;;;OAGG;IACH,6BAA6B,CAC3B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,OAAO,CAAC,IAAI,CAAC,CAEf;CACF"}
@@ -1,5 +1,6 @@
1
+ import { memoizeBinaryGeneratorViews } from '@cat-factory/kernel';
1
2
  import { createFoundationalDeclarationRecorder, resolveFoundationalContext, } from './run-foundational-services.js';
2
- import { createBinaryOutputDeclarationRecorder, resolveBinaryOutputContext, } from './run-binary-output.js';
3
+ import { createBinaryOutputDeclarationRecorder, dispatchBinaryGeneratorsFor, resolveBinaryOutputContext, } from './run-binary-output.js';
3
4
  export class CatalogRunContext {
4
5
  deps;
5
6
  /**
@@ -15,31 +16,58 @@ export class CatalogRunContext {
15
16
  this.recordBinaryOutput = createBinaryOutputDeclarationRecorder(deps);
16
17
  }
17
18
  /**
18
- * The FOUNDATIONAL SERVICES slice of a dispatch's `.cat-context/` — the catalog for a design
19
- * kind, the declared services' contracts for a consumer kind, nothing for anything else. Reads
20
- * only the steps BEFORE the one being dispatched, so a re-dispatched design cannot read its
21
- * own prior round.
19
+ * ALL THREE catalog-backed reads of one dispatch, resolved concurrently — the ONE entry the
20
+ * context read wave takes, so the builder holds a single wave slot rather than three:
21
+ *
22
+ * - the FOUNDATIONAL SERVICES files (the catalog for a design kind, the declared services' API
23
+ * contracts for a consumer kind, nothing for anything else), read only from the steps BEFORE
24
+ * the one being dispatched so a re-dispatched design cannot read its own prior round;
25
+ * - the BINARY-OUTPUT brief for a kind carrying the trait, off the step's own selection;
26
+ * - the GENERATIVE INTEGRATIONS that selection names — the non-secret projection the container
27
+ * executor turns into credentials on the job body.
28
+ *
29
+ * They belong together rather than merely being adjacent: all three go through this
30
+ * collaborator, all three are BEST-EFFORT inside (each gap has a stated rendering — an
31
+ * `unavailable` catalog file, an absent brief the trait guidance already defines as "do not
32
+ * attempt any upload", no integrations to hand credentials for), and on a mothership-mode node
33
+ * all three can cross the machine API. That last point is why the generative half belongs in
34
+ * the wave at all rather than after it, where it would serialise a round trip behind the
35
+ * others for nothing.
36
+ *
37
+ * Exposed as the WHOLE slice rather than three per-read methods, because the sharing below is
38
+ * only correct within one dispatch: a caller that could take the halves separately could take
39
+ * them at different times, which is the drift this collaborator exists to prevent.
40
+ *
41
+ * The two halves of the binary-output selection share ONE `views()` read
42
+ * ({@link memoizeBinaryGeneratorViews}), scoped to this call and discarded with it. The brief
43
+ * that tells an agent which integrations it has and the projection that puts a credential
44
+ * behind each are answers about the same set, so reading it twice bought a second round trip
45
+ * and a window in which they could disagree. Sharing costs no coherence: on a failure both
46
+ * degrade, which is the pair's coherent state (an agent told nothing, handed nothing), and
47
+ * each still applies its own disposition rather than one failing the other.
22
48
  */
23
- foundationalContextFor(workspaceId, agentKind, instance) {
24
- return resolveFoundationalContext({
25
- ...this.deps,
26
- workspaceId,
27
- agentKind,
28
- priorSteps: instance.steps.slice(0, instance.currentStep),
29
- });
30
- }
31
- /**
32
- * The BINARY-OUTPUT slice of a dispatch's `.cat-context/` — the storage/context brief +
33
- * contract files for a kind carrying the `binary-output` trait, resolved off the step's own
34
- * `stepOptions.binaryOutput` selection. Sibling of {@link foundationalContextFor}, off the
35
- * same resolver and failure policy.
36
- */
37
- binaryOutputContextFor(workspaceId, agentKind, step) {
38
- return resolveBinaryOutputContext({ ...this.deps, workspaceId, agentKind, step });
49
+ async sliceFor(workspaceId, agentKind, step, instance) {
50
+ const deps = this.deps.binaryGeneratorSource
51
+ ? {
52
+ ...this.deps,
53
+ binaryGeneratorSource: memoizeBinaryGeneratorViews(this.deps.binaryGeneratorSource),
54
+ }
55
+ : this.deps;
56
+ const [foundationalContextFiles, binaryOutputContextFiles, binaryGenerators] = await Promise.all([
57
+ resolveFoundationalContext({
58
+ ...deps,
59
+ workspaceId,
60
+ agentKind,
61
+ priorSteps: instance.steps.slice(0, instance.currentStep),
62
+ }),
63
+ resolveBinaryOutputContext({ ...deps, workspaceId, agentKind, step }),
64
+ dispatchBinaryGeneratorsFor({ ...deps, agentKind, step }),
65
+ ]);
66
+ return { foundationalContextFiles, binaryOutputContextFiles, binaryGenerators };
39
67
  }
40
68
  /**
41
69
  * Read back what a settled DESIGN step declared, and record it on the step — the counterpart
42
- * of {@link foundationalContextFor}, so the completion hub takes no dependency of its own for
70
+ * of the catalog half of {@link sliceFor}, so the completion hub takes no dependency of its own for
43
71
  * it.
44
72
  */
45
73
  recordFoundationalDeclaration(workspaceId, step, output) {
@@ -47,7 +75,7 @@ export class CatalogRunContext {
47
75
  }
48
76
  /**
49
77
  * Read back what a settled BINARY-GENERATING step declared it stored, and record it on the
50
- * step — the counterpart of {@link binaryOutputContextFor}.
78
+ * step — the counterpart of the binary-output half of {@link sliceFor}.
51
79
  */
52
80
  recordBinaryOutputDeclaration(workspaceId, step, output) {
53
81
  return this.recordBinaryOutput(workspaceId, step, output);
@@ -1 +1 @@
1
- {"version":3,"file":"run-catalog-context.js","sourceRoot":"","sources":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IAC3D,CAAC;CACF"}
1
+ {"version":3,"file":"run-catalog-context.js","sourceRoot":"","sources":["../../../src/modules/execution/run-catalog-context.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAGL,qCAAqC,EACrC,0BAA0B,GAC3B,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAEL,qCAAqC,EACrC,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,wBAAwB,CAAA;AAoC/B,MAAM,OAAO,iBAAiB;IASC,IAAI;IARjC;;;;OAIG;IACc,kBAAkB,CAAiC;IACnD,kBAAkB,CAAiC;IAEpE,YAA6B,IAA2B;oBAA3B,IAAI;QAC/B,IAAI,CAAC,kBAAkB,GAAG,qCAAqC,CAAC,IAAI,CAAC,CAAA;QACrE,IAAI,CAAC,kBAAkB,GAAG,qCAAqC,CAAC,IAAI,CAAC,CAAA;IACvE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,KAAK,CAAC,QAAQ,CACZ,WAAmB,EACnB,SAAiB,EACjB,IAAkB,EAClB,QAA2B;QAE3B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB;YAC1C,CAAC,CAAC;gBACE,GAAG,IAAI,CAAC,IAAI;gBACZ,qBAAqB,EAAE,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC;aACpF;YACH,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;QACb,MAAM,CAAC,wBAAwB,EAAE,wBAAwB,EAAE,gBAAgB,CAAC,GAC1E,MAAM,OAAO,CAAC,GAAG,CAAC;YAChB,0BAA0B,CAAC;gBACzB,GAAG,IAAI;gBACP,WAAW;gBACX,SAAS;gBACT,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;aAC1D,CAAC;YACF,0BAA0B,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;YACrE,2BAA2B,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;SAC1D,CAAC,CAAA;QACJ,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,CAAA;IACjF,CAAC;IAED;;;;OAIG;IACH,6BAA6B,CAC3B,WAAmB,EACnB,IAAkB,EAClB,MAA0B;QAE1B,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;IAC3D,CAAC;IAED;;;OAGG;IACH,6BAA6B,CAC3B,WAAmB,EACnB,IAAkB,EAClB,MAA0B;QAE1B,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;IAC3D,CAAC;CACF"}
@@ -17,7 +17,7 @@ import type { ExecutionServiceDependencies } from './ExecutionService.js';
17
17
  * value the constructor passed inline, so the two collaborators are built from an identical
18
18
  * input to before.
19
19
  */
20
- export type RunContextAdmissionDeps = Pick<ExecutionServiceDependencies, 'workspaceRepository' | 'blockRepository' | 'executionRepository' | 'accountRepository' | 'agentKindRegistry' | 'initiativePresetRegistry' | 'agentPromptRepository' | 'consensusGroupRepository' | 'documentRepository' | 'documentUrlResolver' | 'taskRepository' | 'requirementReviewRepository' | 'docInterviewRepository' | 'clarityReviewRepository' | 'brainstormSessionRepository' | 'initiativeRepository' | 'environmentProvisioning' | 'resolveTestSecretRefs' | 'resolveValidationChecks' | 'fragmentResolver' | 'skillResolver' | 'spendService' | 'workspaceSettingsService' | 'resolveBinaryArtifactStore' | 'resolveProviderCapabilities' | 'inlineHarnessRef' | 'resolveWorkspaceModelDefault' | 'assertAgentBackendConfigured' | 'logger' | 'workspaceAgentSettingsRepository' | 'foundationalServiceResolver'>;
20
+ export type RunContextAdmissionDeps = Pick<ExecutionServiceDependencies, 'workspaceRepository' | 'blockRepository' | 'executionRepository' | 'accountRepository' | 'agentKindRegistry' | 'initiativePresetRegistry' | 'agentPromptRepository' | 'consensusGroupRepository' | 'documentRepository' | 'documentUrlResolver' | 'taskRepository' | 'requirementReviewRepository' | 'docInterviewRepository' | 'clarityReviewRepository' | 'brainstormSessionRepository' | 'initiativeRepository' | 'environmentProvisioning' | 'resolveTestSecretRefs' | 'resolveValidationChecks' | 'fragmentResolver' | 'skillResolver' | 'spendService' | 'workspaceSettingsService' | 'resolveBinaryArtifactStore' | 'resolveProviderCapabilities' | 'inlineHarnessRef' | 'resolveWorkspaceModelDefault' | 'assertAgentBackendConfigured' | 'logger' | 'workspaceAgentSettingsRepository' | 'foundationalServiceResolver' | 'binaryGeneratorSource'>;
21
21
  export declare function buildRunContextAndAdmission(deps: RunContextAdmissionDeps): {
22
22
  contextBuilder: AgentContextBuilder;
23
23
  admission: RunAdmission;
@@ -1 +1 @@
1
- {"version":3,"file":"run-context-admission.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-context-admission.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAA;AAEzE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,4BAA4B,EAC1B,qBAAqB,GACrB,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,0BAA0B,GAC1B,uBAAuB,GACvB,0BAA0B,GAC1B,oBAAoB,GACpB,qBAAqB,GACrB,gBAAgB,GAChB,6BAA6B,GAC7B,wBAAwB,GACxB,yBAAyB,GACzB,6BAA6B,GAC7B,sBAAsB,GACtB,yBAAyB,GACzB,uBAAuB,GACvB,yBAAyB,GACzB,kBAAkB,GAClB,eAAe,GACf,cAAc,GACd,0BAA0B,GAC1B,4BAA4B,GAC5B,6BAA6B,GAC7B,kBAAkB,GAClB,8BAA8B,GAC9B,8BAA8B,GAC9B,QAAQ,GACR,kCAAkC,GAClC,6BAA6B,CAChC,CAAA;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,uBAAuB,GAAG;IAC1E,cAAc,EAAE,mBAAmB,CAAA;IACnC,SAAS,EAAE,YAAY,CAAA;CACxB,CA6CA"}
1
+ {"version":3,"file":"run-context-admission.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-context-admission.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAA;AAEzE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,4BAA4B,EAC1B,qBAAqB,GACrB,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,0BAA0B,GAC1B,uBAAuB,GACvB,0BAA0B,GAC1B,oBAAoB,GACpB,qBAAqB,GACrB,gBAAgB,GAChB,6BAA6B,GAC7B,wBAAwB,GACxB,yBAAyB,GACzB,6BAA6B,GAC7B,sBAAsB,GACtB,yBAAyB,GACzB,uBAAuB,GACvB,yBAAyB,GACzB,kBAAkB,GAClB,eAAe,GACf,cAAc,GACd,0BAA0B,GAC1B,4BAA4B,GAC5B,6BAA6B,GAC7B,kBAAkB,GAClB,8BAA8B,GAC9B,8BAA8B,GAC9B,QAAQ,GACR,kCAAkC,GAClC,6BAA6B,GAC7B,uBAAuB,CAC1B,CAAA;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,uBAAuB,GAAG;IAC1E,cAAc,EAAE,mBAAmB,CAAA;IACnC,SAAS,EAAE,YAAY,CAAA;CACxB,CA+CA"}
@@ -35,6 +35,7 @@ export function buildRunContextAndAdmission(deps) {
35
35
  fragmentResolver: deps.fragmentResolver,
36
36
  skillResolver: deps.skillResolver,
37
37
  foundationalServiceResolver: deps.foundationalServiceResolver,
38
+ binaryGeneratorSource: deps.binaryGeneratorSource,
38
39
  logger: deps.logger,
39
40
  });
40
41
  // The run-admission preflights (the shared start/retry/restart `assert*` gate family).
@@ -50,6 +51,7 @@ export function buildRunContextAndAdmission(deps) {
50
51
  workspaceSettingsService: deps.workspaceSettingsService,
51
52
  resolveBinaryArtifactStore: deps.resolveBinaryArtifactStore,
52
53
  foundationalServiceResolver: deps.foundationalServiceResolver,
54
+ binaryGeneratorSource: deps.binaryGeneratorSource,
53
55
  resolveProviderCapabilities: deps.resolveProviderCapabilities,
54
56
  inlineHarnessRef: deps.inlineHarnessRef,
55
57
  resolveWorkspaceModelDefault: deps.resolveWorkspaceModelDefault,
@@ -1 +1 @@
1
- {"version":3,"file":"run-context-admission.js","sourceRoot":"","sources":["../../../src/modules/execution/run-context-admission.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AA2ChD,MAAM,UAAU,2BAA2B,CAAC,IAA6B;IAIvE,MAAM,cAAc,GAAG,IAAI,mBAAmB,CAAC;QAC7C,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;QACvD,YAAY,EAAE,IAAI,CAAC,qBAAqB;QACxC,aAAa,EAAE,IAAI,CAAC,gCAAgC;QACpD,eAAe,EAAE,IAAI,CAAC,wBAAwB;QAC9C,SAAS,EAAE,IAAI,CAAC,kBAAkB;QAClC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,EAAE,CAAA;AACtC,CAAC"}
1
+ {"version":3,"file":"run-context-admission.js","sourceRoot":"","sources":["../../../src/modules/execution/run-context-admission.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AA4ChD,MAAM,UAAU,2BAA2B,CAAC,IAA6B;IAIvE,MAAM,cAAc,GAAG,IAAI,mBAAmB,CAAC;QAC7C,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;QACvD,YAAY,EAAE,IAAI,CAAC,qBAAqB;QACxC,aAAa,EAAE,IAAI,CAAC,gCAAgC;QACpD,eAAe,EAAE,IAAI,CAAC,wBAAwB;QAC9C,SAAS,EAAE,IAAI,CAAC,kBAAkB;QAClC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,KAAK,EAAE,IAAI,CAAC,cAAc;QAC1B,kBAAkB,EAAE,IAAI,CAAC,2BAA2B;QACpD,aAAa,EAAE,IAAI,CAAC,sBAAsB;QAC1C,cAAc,EAAE,IAAI,CAAC,uBAAuB;QAC5C,kBAAkB,EAAE,IAAI,CAAC,2BAA2B;QACpD,WAAW,EAAE,IAAI,CAAC,oBAAoB;QACtC,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;QACrD,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;QACjD,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;QACrD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,2BAA2B,EAAE,IAAI,CAAC,2BAA2B;QAC7D,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;QACjD,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC,CAAA;IACF,uFAAuF;IACvF,gFAAgF;IAChF,MAAM,SAAS,GAAG,IAAI,YAAY,CAAC;QACjC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,cAAc;QACd,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,KAAK,EAAE,IAAI,CAAC,YAAY;QACxB,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;QACrD,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;QACvD,0BAA0B,EAAE,IAAI,CAAC,0BAA0B;QAC3D,2BAA2B,EAAE,IAAI,CAAC,2BAA2B;QAC7D,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;QACjD,2BAA2B,EAAE,IAAI,CAAC,2BAA2B;QAC7D,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,4BAA4B,EAAE,IAAI,CAAC,4BAA4B;QAC/D,4BAA4B,EAAE,IAAI,CAAC,4BAA4B;KAChE,CAAC,CAAA;IACF,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,CAAA;AACtC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { AgentKindRegistry } from '@cat-factory/agents';
2
2
  import type { BinaryOutputConfig, FoundationalServiceSelection, PipelineStep } from '@cat-factory/contracts';
3
- import type { AgentKind, FoundationalCatalogView, InjectedContextFile, Logger } from '@cat-factory/kernel';
3
+ import type { AgentKind, BinaryGeneratorSource, FoundationalCatalogView, InjectedContextFile, Logger } from '@cat-factory/kernel';
4
4
  /**
5
5
  * The engine-facing seam over the catalog, implemented by
6
6
  * `FoundationalServiceRunResolver` (`@cat-factory/agents`) and wired only when the catalog is
@@ -21,8 +21,15 @@ export interface FoundationalServiceResolver {
21
21
  * generating step's own selection (`stepOptions.binaryOutput`). On this interface rather
22
22
  * than its own seam because it is the same catalog behind the same tier merge and cache —
23
23
  * two resolvers would be two places for a workspace override to win differently.
24
+ *
25
+ * The GENERATIVE half of that selection resolves against the deployment's own integrations,
26
+ * passed in rather than held by the resolver: they are a different kind of fact from the
27
+ * workspace catalog (deployment code, no tenancy), so binding them to a catalog service would
28
+ * misplace them. Absent ⇒ no integration resolves, and the brief states that rather than
29
+ * implying the step has one. On a mothership-mode node the source is remote and can THROW,
30
+ * which the caller's best-effort wrapper turns into an absent brief.
24
31
  */
25
- binaryOutputContextFilesFor(workspaceId: string, config: BinaryOutputConfig | undefined): Promise<InjectedContextFile[]>;
32
+ binaryOutputContextFilesFor(workspaceId: string, config: BinaryOutputConfig | undefined, generatorSource?: BinaryGeneratorSource): Promise<InjectedContextFile[]>;
26
33
  }
27
34
  export interface ResolveFoundationalContextInput {
28
35
  workspaceId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"run-foundational-services.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-foundational-services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAM5D,OAAO,KAAK,EACV,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACb,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EACV,SAAS,EACT,uBAAuB,EACvB,mBAAmB,EACnB,MAAM,EACP,MAAM,qBAAqB,CAAA;AAwB5B;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAA;IACnE;;;;;OAKG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACrD,eAAe,CACb,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,4BAA4B,GAAG,SAAS,GAClD,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACjC;;;;;OAKG;IACH,2BAA2B,CACzB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,GAAG,SAAS,GACrC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;CAClC;AAED,MAAM,WAAW,+BAA+B;IAC9C,WAAW,EAAE,MAAM,CAAA;IACnB,6FAA6F;IAC7F,SAAS,EAAE,SAAS,CAAA;IACpB,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,oEAAoE;IACpE,UAAU,EAAE,YAAY,EAAE,CAAA;IAC1B,2BAA2B,CAAC,EAAE,2BAA2B,CAAA;IACzD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAwDhC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,YAAY,EAAE,GACzB,4BAA4B,GAAG,SAAS,CAM1C;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,+BAA+B,GAAG,CAC5C,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,YAAY;AAClB;sEACsE;AACtE,MAAM,EAAE,MAAM,GAAG,SAAS,KACvB,OAAO,CAAC,IAAI,CAAC,CAAA;AAElB;;;;GAIG;AACH,wBAAgB,qCAAqC,CAAC,IAAI,EAAE;IAC1D,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,2BAA2B,CAAC,EAAE,2BAA2B,CAAA;IACzD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,+BAA+B,CAelC"}
1
+ {"version":3,"file":"run-foundational-services.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-foundational-services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAM5D,OAAO,KAAK,EACV,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY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WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,YAAY;AAClB;sEACsE;AACtE,MAAM,EAAE,MAAM,GAAG,SAAS,KACvB,OAAO,CAAC,IAAI,CAAC,CAAA;AAElB;;;;GAIG;AACH,wBAAgB,qCAAqC,CAAC,IAAI,EAAE;IAC1D,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,2BAA2B,CAAC,EAAE,2BAA2B,CAAA;IACzD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,+BAA+B,CAelC"}
@@ -1 +1 @@
1
- {"version":3,"file":"run-foundational-services.js","sourceRoot":"","sources":["../../../src/modules/execution/run-foundational-services.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,QAAQ,GACT,MAAM,qBAAqB,CAAA;AAY5B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,UAAU,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,uBAAuB,EACvB,aAAa,GACd,MAAM,qBAAqB,CAAA;AAwD5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,KAAsC;IAEtC,MAAM,QAAQ,GAAG,KAAK,CAAC,2BAA2B,CAAA;IAClD,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAA;IACxB,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAA;IAC9C,IAAI,QAAQ,CAAC,SAAS,EAAE,0BAA0B,EAAE,iBAAiB,CAAC,EAAE,CAAC;QACvE,MAAM,KAAK,GAAG,MAAM,aAAa,CAC/B,KAAK,CAAC,MAAM,IAAI,UAAU,EAC1B,8BAA8B,EAC9B,KAAK,IAAI,EAAE;YACT,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;YAC5D,mFAAmF;YACnF,sFAAsF;YACtF,kFAAkF;YAClF,kDAAkD;YA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CAAC;QAChD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAA;QACrD,IAAI,SAAS;YAAE,OAAO,SAAS,CAAA;IACjC,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAsBD;;;;GAIG;AACH,MAAM,UAAU,qCAAqC,CAAC,IAIrD;IACC,MAAM,QAAQ,GAAG,IAAI,CAAC,2BAA2B,CAAA;IACjD,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,IAAI,EAAE,GAAE,CAAC,CAAA;IACpC,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,EAAE,IAAI,CAAC,iBAAiB,CAAC;YAAE,OAAM;QACzF,MAAM,aAAa,CACjB,IAAI,CAAC,MAAM,IAAI,UAAU,EACzB,wCAAwC,EACxC,KAAK,IAAI,EAAE;YACT,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;YACvD,IAAI,CAAC,oBAAoB,GAAG,4BAA4B,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACzE,CAAC,EACD,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAC3C,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"run-foundational-services.js","sourceRoot":"","sources":["../../../src/modules/execution/run-foundational-services.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,QAAQ,GACT,MAAM,qBAAqB,CAAA;AAa5B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,UAAU,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,uBAAuB,EACvB,aAAa,GACd,MAAM,qBAAqB,CAAA;AAgE5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAA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AC,oBAAoB,GAAG,4BAA4B,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACzE,CAAC,EACD,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAC3C,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { Logger, OperationalCounterSample, OperationalGaugeSample, OperationalMetricsCollector } from '@cat-factory/kernel';
2
+ /** Where a flush pushes its operational samples (the OTLP platform-metrics exporter). */
3
+ export interface OperationalMetricsSink {
4
+ exportOperational(counters: OperationalCounterSample[], gauges: OperationalGaugeSample[], at: number): Promise<void>;
5
+ }
6
+ export interface OperationalMetricsFlushDeps {
7
+ /** The process/isolate-local accumulator to drain. */
8
+ collector: OperationalMetricsCollector;
9
+ sink: OperationalMetricsSink;
10
+ /**
11
+ * Read the point-in-time gauges this runtime can answer (queue depth). OMITTED where the
12
+ * runtime genuinely cannot read them — Cloudflare Queues expose no backlog to the Worker
13
+ * that consumes them — in which case nothing is emitted for those series. That is
14
+ * deliberate: an absent data point says "nobody could look", where a zero would say "the
15
+ * queue is empty", and those are opposite facts about a wedged queue.
16
+ */
17
+ probeGauges?: () => Promise<OperationalGaugeSample[]>;
18
+ /** The flush clock (injected, so this module reads no wall clock of its own). */
19
+ now: number;
20
+ logger?: Logger;
21
+ }
22
+ /**
23
+ * Drain the collector, probe the gauges, and export both. Returns the number of samples sent
24
+ * (0 when there was nothing to say, in which case no request is made at all).
25
+ *
26
+ * A gauge probe that THROWS costs only its gauges: the drained counters are already out of
27
+ * the collector by then, and dropping them because an unrelated `COUNT(*)` failed would lose
28
+ * events nothing can recover. A failing SINK loses the whole flush — that is the accepted
29
+ * cost of an in-memory accumulator, and it is why the drop is logged rather than swallowed.
30
+ */
31
+ export declare function flushOperationalMetrics(deps: OperationalMetricsFlushDeps): Promise<number>;
32
+ //# sourceMappingURL=operationalMetricsFlush.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationalMetricsFlush.d.ts","sourceRoot":"","sources":["../../../src/modules/observability/operationalMetricsFlush.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,wBAAwB,EACxB,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,qBAAqB,CAAA;AAmB5B,yFAAyF;AACzF,MAAM,WAAW,sBAAsB;IACrC,iBAAiB,CACf,QAAQ,EAAE,wBAAwB,EAAE,EACpC,MAAM,EAAE,sBAAsB,EAAE,EAChC,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAAA;CACjB;AAED,MAAM,WAAW,2BAA2B;IAC1C,sDAAsD;IACtD,SAAS,EAAE,2BAA2B,CAAA;IACtC,IAAI,EAAE,sBAAsB,CAAA;IAC5B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAA;IACrD,iFAAiF;IACjF,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BhG"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Drain the collector, probe the gauges, and export both. Returns the number of samples sent
3
+ * (0 when there was nothing to say, in which case no request is made at all).
4
+ *
5
+ * A gauge probe that THROWS costs only its gauges: the drained counters are already out of
6
+ * the collector by then, and dropping them because an unrelated `COUNT(*)` failed would lose
7
+ * events nothing can recover. A failing SINK loses the whole flush — that is the accepted
8
+ * cost of an in-memory accumulator, and it is why the drop is logged rather than swallowed.
9
+ */
10
+ export async function flushOperationalMetrics(deps) {
11
+ const counters = deps.collector.drain();
12
+ let gauges = [];
13
+ if (deps.probeGauges) {
14
+ try {
15
+ gauges = await deps.probeGauges();
16
+ }
17
+ catch (err) {
18
+ deps.logger?.warn('operational-metrics: gauge probe failed; exporting counters only', {
19
+ scope: 'operational-metrics',
20
+ err: err instanceof Error ? err.message : String(err),
21
+ });
22
+ }
23
+ }
24
+ if (counters.length === 0 && gauges.length === 0)
25
+ return 0;
26
+ try {
27
+ await deps.sink.exportOperational(counters, gauges, deps.now);
28
+ }
29
+ catch (err) {
30
+ deps.logger?.warn('operational-metrics: export failed; the drained deltas are lost', {
31
+ scope: 'operational-metrics',
32
+ counters: counters.length,
33
+ gauges: gauges.length,
34
+ err: err instanceof Error ? err.message : String(err),
35
+ });
36
+ return 0;
37
+ }
38
+ return counters.length + gauges.length;
39
+ }
40
+ //# sourceMappingURL=operationalMetricsFlush.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationalMetricsFlush.js","sourceRoot":"","sources":["../../../src/modules/observability/operationalMetricsFlush.ts"],"names":[],"mappings":"AAkDA;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,IAAiC;IAC7E,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;IACvC,IAAI,MAAM,GAA6B,EAAE,CAAA;IACzC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,kEAAkE,EAAE;gBACpF,KAAK,EAAE,qBAAqB;gBAC5B,GAAG,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;aACtD,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAA;IAC1D,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,iEAAiE,EAAE;YACnF,KAAK,EAAE,qBAAqB;YAC5B,QAAQ,EAAE,QAAQ,CAAC,MAAM;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,GAAG,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACtD,CAAC,CAAA;QACF,OAAO,CAAC,CAAA;IACV,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;AACxC,CAAC"}
@@ -16,6 +16,32 @@ export interface PlatformAlertThresholds {
16
16
  maxP99DurationMs: number;
17
17
  /** Live running/blocked/paused/pending depth at or above which `backlog_high` fires. */
18
18
  maxBacklog: number;
19
+ /**
20
+ * How many TRAILING trend buckets must be completely empty before `throughput_stalled` can
21
+ * fire. Expressed in buckets rather than hours so the condition scales with the configured
22
+ * window: the projection buckets `1h` far more finely than `7d`, and a fixed hour count
23
+ * would be a hair trigger on one and useless on the other.
24
+ */
25
+ stalledBuckets: number;
26
+ /**
27
+ * Runs that must have been created in the EARLIER part of the same window before a stall
28
+ * counts as one. Without it, a deployment that is merely idle overnight — genuinely nothing
29
+ * to do — pages exactly like one that is wedged, and the alert gets muted, which costs the
30
+ * signal on the night it matters.
31
+ */
32
+ minStalledPriorRuns: number;
33
+ /**
34
+ * Share (0..1) of the window's failures that ONE kind must account for before
35
+ * `failure_kind_dominant` fires. Gated by {@link minRuns} like the failure rate, so a
36
+ * single early failure is never "100% evicted".
37
+ */
38
+ maxFailureKindShare: number;
39
+ /**
40
+ * Consecutive failed passes of ONE sweeper before `sweep_degraded` fires. Counted by the
41
+ * caller (the sweep observes its own history; this logic stays pure), so a transient
42
+ * hiccup on a single tick is not an alert.
43
+ */
44
+ maxSweepFailures: number;
19
45
  }
20
46
  /** Conservative defaults: quiet unless the deployment is genuinely unhealthy. */
21
47
  export declare const DEFAULT_PLATFORM_ALERT_THRESHOLDS: PlatformAlertThresholds;
@@ -26,7 +52,17 @@ export declare const DEFAULT_PLATFORM_ALERT_THRESHOLDS: PlatformAlertThresholds;
26
52
  * dedup on the reason SET only (see {@link platformAlertReasons}); the fluctuating values here
27
53
  * are intentionally not carried on the card (they'd re-toast the inbox every sweep).
28
54
  */
29
- export declare function evaluatePlatformHealth(snapshot: PlatformObservability, thresholds: PlatformAlertThresholds): PlatformAlert[];
55
+ export declare function evaluatePlatformHealth(snapshot: PlatformObservability, thresholds: PlatformAlertThresholds,
56
+ /**
57
+ * The worst consecutive-failure streak across the deployment's sweepers, and which sweeper
58
+ * it belongs to. Supplied by the CALLER because it is history rather than a property of the
59
+ * snapshot — this function stays pure. Omitted ⇒ `sweep_degraded` cannot fire, which is the
60
+ * right answer for a caller that does not track it rather than a claim that nothing failed.
61
+ */
62
+ sweepFailures?: {
63
+ sweep: string;
64
+ consecutive: number;
65
+ }): PlatformAlert[];
30
66
  /**
31
67
  * The SORTED set of reason codes from a list of fired alerts — the platform-health card's
32
68
  * stable dedup identity. Sorted so the card content is a pure function of WHICH conditions
@@ -1 +1 @@
1
- {"version":3,"file":"platform-health.logic.d.ts","sourceRoot":"","sources":["../../../src/modules/observability/platform-health.logic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,wBAAwB,CAAA;AAc/B;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,2EAA2E;IAC3E,cAAc,EAAE,MAAM,CAAA;IACtB,oFAAoF;IACpF,gBAAgB,EAAE,MAAM,CAAA;IACxB,wFAAwF;IACxF,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,iFAAiF;AACjF,eAAO,MAAM,iCAAiC,EAAE,uBAK/C,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,qBAAqB,EAC/B,UAAU,EAAE,uBAAuB,GAClC,aAAa,EAAE,CAiCjB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,mBAAmB,EAAE,CAEnF;AAeD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,mBAAmB,EAAE,EAC9B,MAAM,EAAE,2BAA2B,GAClC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAUjC"}
1
+ {"version":3,"file":"platform-health.logic.d.ts","sourceRoot":"","sources":["../../../src/modules/observability/platform-health.logic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,wBAAwB,CAAA;AAc/B;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,2EAA2E;IAC3E,cAAc,EAAE,MAAM,CAAA;IACtB,oFAAoF;IACpF,gBAAgB,EAAE,MAAM,CAAA;IACxB,wFAAwF;IACxF,UAAU,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,CAAA;IAC3B;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAA;IAC3B;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,iFAAiF;AACjF,eAAO,MAAM,iCAAiC,EAAE,uBAa/C,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,qBAAqB,EAC/B,UAAU,EAAE,uBAAuB;AACnC;;;;;GAKG;AACH,aAAa,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACrD,aAAa,EAAE,CAyEjB;AA6CD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,mBAAmB,EAAE,CAEnF;AAkBD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,mBAAmB,EAAE,EAC9B,MAAM,EAAE,2BAA2B,GAClC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAUjC"}