@cat-factory/kernel 0.141.0 → 0.143.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.
@@ -3,7 +3,7 @@ import type { AgentRunResult } from '../ports/agent-executor.js';
3
3
  import type { RaiseNotificationInput } from '../ports/notification-channel.js';
4
4
  import type { Clock } from '../ports/runtime.js';
5
5
  import type { RunInitiatorScope } from '../ports/user-secret-repositories.js';
6
- import { type ProviderToken } from './provider-registry.js';
6
+ import { type ProviderRegistry, type ProviderToken } from './provider-registry.js';
7
7
  /** The outcome of a single gate precheck against its provider. */
8
8
  export interface GateProbe {
9
9
  /**
@@ -221,9 +221,14 @@ export interface GateContext {
221
221
  /**
222
222
  * The wired impl for a provider token, or throw. SAFE inside `probe()` — the engine only
223
223
  * probes a gate whose `wired()` returned true, and a gate's `wired()` should be
224
- * `isProviderWired(token)` — so this replaces the old `getFoo()!` assertion with a guard.
224
+ * `ctx.isProviderWired(token)` — so this replaces the old `getFoo()!` assertion with a guard.
225
225
  */
226
226
  requireProvider<T>(token: ProviderToken<T>): T;
227
+ /**
228
+ * Whether an impl is wired for a provider token — the canonical source for a gate's `wired()`
229
+ * (reads the app-owned {@link ProviderRegistry} the engine threads in, not a module global).
230
+ */
231
+ isProviderWired<T>(token: ProviderToken<T>): boolean;
227
232
  }
228
233
  /**
229
234
  * A registered gate is a factory the engine invokes ONCE at registry-build time with a
@@ -272,8 +277,9 @@ export declare function defaultGateRegistry(): GateRegistry;
272
277
  /**
273
278
  * A minimal {@link GateContext} for tests that invoke a gate factory in isolation (the
274
279
  * real one is built by `ExecutionService.makeGateContext`). Defaults to harmless no-ops;
275
- * pass `overrides` to assert against a specific seam. Centralised here so a new required
276
- * `GateContext` field is filled in ONE place instead of every gate test.
280
+ * pass `providerRegistry` to have the provider seams read a specific registry (a gate test
281
+ * wires its provider on it), and `overrides` to assert against a specific seam. Centralised
282
+ * here so a new required `GateContext` field is filled in ONE place instead of every gate test.
277
283
  */
278
- export declare function stubGateContext(overrides?: Partial<GateContext>): GateContext;
284
+ export declare function stubGateContext(overrides?: Partial<GateContext>, providerRegistry?: ProviderRegistry): GateContext;
279
285
  //# sourceMappingURL=gate-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gate-registry.d.ts","sourceRoot":"","sources":["../../src/domain/gate-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,UAAU,EACV,YAAY,EACb,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAC9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAA;AAmB/B,kEAAkE;AAClE,MAAM,WAAW,SAAS;IACxB;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;IACnC,qFAAqF;IACrF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC;;;;;OAKG;IACH,cAAc,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACpE;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,aAAa,CAAC,EA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AE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;IACrE,uFAAuF;IACvF,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,oFAAoF;IACpF,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpF,uFAAuF;IACvF,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA;IACtD;;;;OAIG;IACH,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAC9C;;;OAGG;IACH,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAA;CACrD;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,cAAc,CAAA;AAE9D;;;;;;;;;;;;;;GAcG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAE1D;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAEjD;IAED,iDAAiD;IACjD,SAAS,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,EAAE,CAEpD;CACF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,EACpC,gBAAgB,GAAE,gBAA4C,GAC7D,WAAW,CAcb"}
@@ -1,4 +1,4 @@
1
- import { getProvider as registryGetProvider, requireProvider as registryRequireProvider, } from './provider-registry.js';
1
+ import { defaultProviderRegistry, } from './provider-registry.js';
2
2
  /**
3
3
  * Build the record of a just-finished gate-helper attempt (a ci-fixer / conflict-resolver
4
4
  * run) for {@link GateStepState.attemptLog}. It captures BOTH sides of the round so the run
@@ -69,19 +69,22 @@ export function defaultGateRegistry() {
69
69
  /**
70
70
  * A minimal {@link GateContext} for tests that invoke a gate factory in isolation (the
71
71
  * real one is built by `ExecutionService.makeGateContext`). Defaults to harmless no-ops;
72
- * pass `overrides` to assert against a specific seam. Centralised here so a new required
73
- * `GateContext` field is filled in ONE place instead of every gate test.
72
+ * pass `providerRegistry` to have the provider seams read a specific registry (a gate test
73
+ * wires its provider on it), and `overrides` to assert against a specific seam. Centralised
74
+ * here so a new required `GateContext` field is filled in ONE place instead of every gate test.
74
75
  */
75
- export function stubGateContext(overrides = {}) {
76
+ export function stubGateContext(overrides = {}, providerRegistry = defaultProviderRegistry()) {
76
77
  return {
77
78
  clock: { now: () => 0 },
78
79
  getBlock: async () => null,
79
80
  runInitiatorScope: (_initiatedBy, fn) => fn(),
80
81
  raiseNotification: async () => { },
81
- // Default to the real process-wide registry so a gate test that wires a provider sees
82
- // it, and `requireProvider` on an unwired token throws exactly as it would in prod.
83
- getProvider: registryGetProvider,
84
- requireProvider: registryRequireProvider,
82
+ // Read the provider seams off the given registry (a fresh empty one by default), so a gate
83
+ // test that wires a provider on it sees it and `requireProvider` on an unwired token throws
84
+ // exactly as it would in prod.
85
+ getProvider: (token) => providerRegistry.get(token),
86
+ requireProvider: (token) => providerRegistry.require(token),
87
+ isProviderWired: (token) => providerRegistry.isWired(token),
85
88
  ...overrides,
86
89
  };
87
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gate-registry.js","sourceRoot":"","sources":["../../src/domain/gate-registry.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,WAAW,IAAI,mBAAmB,EAClC,eAAe,IAAI,uBAAuB,GAE3C,MAAM,wBAAwB,CAAA;AAuE/B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAC/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AC3D,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC;QAC3D,GAAG,SAAS;KACb,CAAA;AACH,CAAC"}
@@ -1,19 +1,27 @@
1
1
  import type { Pipeline } from './types.js';
2
2
  /**
3
- * Register an extra predefined pipeline. A registered pipeline whose id matches a
4
- * built-in (or an earlier registration) replaces it, so a deployment can both add new
5
- * pipelines and customize the built-in catalog.
3
+ * App-owned registry of extra predefined pipelines. The composition root news ONE instance and a
4
+ * deployment registers its pipelines on it by reference; the seeding path merges them into the
5
+ * built-in catalog via {@link merge}.
6
6
  */
7
- export declare function registerPipeline(pipeline: Pipeline): void;
8
- /** Register several extra predefined pipelines at once. */
9
- export declare function registerPipelines(pipelines: Iterable<Pipeline>): void;
10
- /** The registered extra pipelines (registration order). */
11
- export declare function registeredPipelines(): Pipeline[];
12
- /**
13
- * Merge the registered pipelines into a built-in list: a registered pipeline replaces a
14
- * built-in with the same id in place, new ones are appended (registration order).
15
- */
16
- export declare function mergeRegisteredPipelines(builtins: readonly Pipeline[]): Pipeline[];
17
- /** Drop all registered pipelines. Intended for tests that exercise registration. */
18
- export declare function clearRegisteredPipelines(): void;
7
+ export declare class PipelineRegistry {
8
+ private readonly extra;
9
+ /**
10
+ * Register an extra predefined pipeline. A registered pipeline whose id matches a built-in (or an
11
+ * earlier registration) replaces it, so a deployment can both add new pipelines and customize the
12
+ * built-in catalog.
13
+ */
14
+ register(pipeline: Pipeline): void;
15
+ /** Register several extra predefined pipelines at once. */
16
+ registerMany(pipelines: Iterable<Pipeline>): void;
17
+ /** The registered extra pipelines (registration order). */
18
+ registered(): Pipeline[];
19
+ /**
20
+ * Merge the registered pipelines into a built-in list: a registered pipeline replaces a built-in
21
+ * with the same id in place, new ones are appended (registration order).
22
+ */
23
+ merge(builtins: readonly Pipeline[]): Pipeline[];
24
+ }
25
+ /** A fresh, empty pipeline registry. Each facade news one and a deployment registers its pipelines on it. */
26
+ export declare function defaultPipelineRegistry(): PipelineRegistry;
19
27
  //# sourceMappingURL=pipeline-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline-registry.d.ts","sourceRoot":"","sources":["../../src/domain/pipeline-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAU1C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAIzD;AAED,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAErE;AAED,2DAA2D;AAC3D,wBAAgB,mBAAmB,IAAI,QAAQ,EAAE,CAEhD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAQlF;AAED,oFAAoF;AACpF,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C"}
1
+ {"version":3,"file":"pipeline-registry.d.ts","sourceRoot":"","sources":["../../src/domain/pipeline-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAa1C;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAIjC;IAED,2DAA2D;IAC3D,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAEhD;IAED,2DAA2D;IAC3D,UAAU,IAAI,QAAQ,EAAE,CAEvB;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAQ/C;CACF;AAED,6GAA6G;AAC7G,wBAAgB,uBAAuB,IAAI,gBAAgB,CAE1D"}
@@ -1,48 +1,59 @@
1
- // Installation-level extension point for predefined pipelines, mirroring the custom
2
- // agent-kind and model-provider registry seams. A deployment — e.g. a proprietary org
3
- // package registers extra pipelines once at startup (an import side effect);
4
- // `seedPipelines()` then includes them, so every new workspace is seeded with them
5
- // alongside the built-in catalog. Registered pipelines can reference both built-in and
6
- // custom (registered) agent kinds.
7
- const extra = [];
1
+ // App-owned registry of extra predefined pipelines, mirroring the agent-kind / gate registries.
2
+ // A deployment — e.g. a proprietary org package — registers extra pipelines on the instance the
3
+ // composition root injects (`registry.register(pipeline)`); `seedPipelines(registry)` then merges
4
+ // them into the built-in catalog, so every new workspace is seeded with them. Registered pipelines
5
+ // can reference both built-in and custom (registered) agent kinds.
6
+ //
7
+ // This replaces the previous module-global array: the composition root news ONE instance
8
+ // (`defaultPipelineRegistry()`), threads it through `CoreDependencies`, and the workspace + pipeline
9
+ // services read it from there — so there is no module-global state, no `clear*()` test cruft, and a
10
+ // separately-published extension package can never register into a phantom array.
8
11
  /**
9
- * Register an extra predefined pipeline. A registered pipeline whose id matches a
10
- * built-in (or an earlier registration) replaces it, so a deployment can both add new
11
- * pipelines and customize the built-in catalog.
12
+ * App-owned registry of extra predefined pipelines. The composition root news ONE instance and a
13
+ * deployment registers its pipelines on it by reference; the seeding path merges them into the
14
+ * built-in catalog via {@link merge}.
12
15
  */
13
- export function registerPipeline(pipeline) {
14
- const existing = extra.findIndex((p) => p.id === pipeline.id);
15
- if (existing >= 0)
16
- extra[existing] = pipeline;
17
- else
18
- extra.push(pipeline);
19
- }
20
- /** Register several extra predefined pipelines at once. */
21
- export function registerPipelines(pipelines) {
22
- for (const pipeline of pipelines)
23
- registerPipeline(pipeline);
24
- }
25
- /** The registered extra pipelines (registration order). */
26
- export function registeredPipelines() {
27
- return [...extra];
28
- }
29
- /**
30
- * Merge the registered pipelines into a built-in list: a registered pipeline replaces a
31
- * built-in with the same id in place, new ones are appended (registration order).
32
- */
33
- export function mergeRegisteredPipelines(builtins) {
34
- const merged = [...builtins];
35
- for (const pipeline of extra) {
36
- const at = merged.findIndex((p) => p.id === pipeline.id);
16
+ export class PipelineRegistry {
17
+ extra = [];
18
+ /**
19
+ * Register an extra predefined pipeline. A registered pipeline whose id matches a built-in (or an
20
+ * earlier registration) replaces it, so a deployment can both add new pipelines and customize the
21
+ * built-in catalog.
22
+ */
23
+ register(pipeline) {
24
+ const at = this.extra.findIndex((p) => p.id === pipeline.id);
37
25
  if (at >= 0)
38
- merged[at] = pipeline;
26
+ this.extra[at] = pipeline;
39
27
  else
40
- merged.push(pipeline);
28
+ this.extra.push(pipeline);
29
+ }
30
+ /** Register several extra predefined pipelines at once. */
31
+ registerMany(pipelines) {
32
+ for (const pipeline of pipelines)
33
+ this.register(pipeline);
34
+ }
35
+ /** The registered extra pipelines (registration order). */
36
+ registered() {
37
+ return [...this.extra];
38
+ }
39
+ /**
40
+ * Merge the registered pipelines into a built-in list: a registered pipeline replaces a built-in
41
+ * with the same id in place, new ones are appended (registration order).
42
+ */
43
+ merge(builtins) {
44
+ const merged = [...builtins];
45
+ for (const pipeline of this.extra) {
46
+ const at = merged.findIndex((p) => p.id === pipeline.id);
47
+ if (at >= 0)
48
+ merged[at] = pipeline;
49
+ else
50
+ merged.push(pipeline);
51
+ }
52
+ return merged;
41
53
  }
42
- return merged;
43
54
  }
44
- /** Drop all registered pipelines. Intended for tests that exercise registration. */
45
- export function clearRegisteredPipelines() {
46
- extra.length = 0;
55
+ /** A fresh, empty pipeline registry. Each facade news one and a deployment registers its pipelines on it. */
56
+ export function defaultPipelineRegistry() {
57
+ return new PipelineRegistry();
47
58
  }
48
59
  //# sourceMappingURL=pipeline-registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline-registry.js","sourceRoot":"","sources":["../../src/domain/pipeline-registry.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,sFAAsF;AACtF,+EAA+E;AAC/E,mFAAmF;AACnF,uFAAuF;AACvF,mCAAmC;AACnC,MAAM,KAAK,GAAe,EAAE,CAA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,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,6GAA6G;AAC7G,MAAM,UAAU,uBAAuB;IACrC,OAAO,IAAI,gBAAgB,EAAE,CAAA;AAC/B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A typed handle for a wired provider. The phantom `T` carries the provider's interface so
3
- * `wireProvider`/`getProvider`/`requireProvider` are type-checked against the token. Create
4
- * one with {@link defineProviderToken} and export it next to the provider interface.
3
+ * `wire`/`get`/`require` are type-checked against the token. Create one with
4
+ * {@link defineProviderToken} and export it next to the provider interface.
5
5
  */
6
6
  export interface ProviderToken<T> {
7
7
  /** Unique identity for the registry map (one per `defineProviderToken` call). */
@@ -16,18 +16,28 @@ export interface ProviderToken<T> {
16
16
  * `export const LICENSE_PROVIDER = defineProviderToken<LicenseProvider>('license')`.
17
17
  */
18
18
  export declare function defineProviderToken<T>(description: string): ProviderToken<T>;
19
- /** Wire (or clear, with `undefined`) the impl for a token. */
20
- export declare function wireProvider<T>(token: ProviderToken<T>, impl: T | undefined): void;
21
- /** The wired impl for a token, or `undefined` when nothing is wired. */
22
- export declare function getProvider<T>(token: ProviderToken<T>): T | undefined;
23
- /** Whether an impl is wired for a token (the canonical source for a gate's `wired()`). */
24
- export declare function isProviderWired<T>(token: ProviderToken<T>): boolean;
25
19
  /**
26
- * The wired impl for a token, or throw when nothing is wired. SAFE inside a gate's
27
- * `probe()` the engine only probes a gate whose `wired()` (i.e. {@link isProviderWired})
28
- * returned true so it replaces the old `getFoo()!` assertion with a real guard.
20
+ * App-owned registry of wired providers, keyed by a {@link ProviderToken}'s symbol. Mirrors the
21
+ * gate / agent-kind registries: the composition root news ONE instance, threads it through
22
+ * `CoreDependencies` into the gate machine's {@link GateContext}, and each facade wires its
23
+ * configured providers here at build time. There is no module-global `Map` and no `clear*()`
24
+ * cruft — a fresh instance per build starts empty.
29
25
  */
30
- export declare function requireProvider<T>(token: ProviderToken<T>): T;
31
- /** Clear EVERY wired provider. Intended for tests that exercise wiring in isolation. */
32
- export declare function clearProviders(): void;
26
+ export declare class ProviderRegistry {
27
+ private readonly providers;
28
+ /** Wire (or clear, with `undefined`) the impl for a token. */
29
+ wire<T>(token: ProviderToken<T>, impl: T | undefined): void;
30
+ /** The wired impl for a token, or `undefined` when nothing is wired. */
31
+ get<T>(token: ProviderToken<T>): T | undefined;
32
+ /** Whether an impl is wired for a token (the canonical source for a gate's `wired()`). */
33
+ isWired<T>(token: ProviderToken<T>): boolean;
34
+ /**
35
+ * The wired impl for a token, or throw when nothing is wired. SAFE inside a gate's `probe()` —
36
+ * the engine only probes a gate whose `wired()` (i.e. {@link isWired}) returned true — so it
37
+ * replaces the old `getFoo()!` assertion with a real guard.
38
+ */
39
+ require<T>(token: ProviderToken<T>): T;
40
+ }
41
+ /** A fresh, empty provider registry. Each facade news one and wires its configured providers on it. */
42
+ export declare function defaultProviderRegistry(): ProviderRegistry;
33
43
  //# sourceMappingURL=provider-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-registry.d.ts","sourceRoot":"","sources":["../../src/domain/provider-registry.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,iFAAiF;IACjF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;CACpB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAE5E;AAMD,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,CAGlF;AAED,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,CAAC,EAAE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C,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAMrC;CACF;AAED,uGAAuG;AACvG,wBAAgB,uBAAuB,IAAI,gBAAgB,CAE1D"}
@@ -1,23 +1,26 @@
1
1
  // ---------------------------------------------------------------------------
2
- // A typed, process-wide registry of wired "providers" — the deployment-supplied data
3
- // sources a gate (or any extension) probes. It replaces the per-provider module-global
4
- // `let provider; wireFoo(); getFoo()` trio that every gate package used to hand-author,
5
- // and the unsafe `getFoo()!` non-null assertion that followed a `wired()` check.
2
+ // A typed, app-owned registry of wired "providers" — the deployment-supplied data sources a
3
+ // gate (or any extension) probes. It replaces the per-provider module-global `let provider;
4
+ // wireFoo(); getFoo()` trio that every gate package used to hand-author, and the unsafe
5
+ // `getFoo()!` non-null assertion that followed a `wired()` check.
6
6
  //
7
- // A provider is identified by a {@link ProviderToken} — an opaque, phantom-typed handle
8
- // the registrant defines once and exports. The deployment wires an impl against the token
9
- // at startup ({@link wireProvider}); the gate reads it back through its {@link GateContext}
10
- // (`ctx.getProvider` / `ctx.requireProvider`), so it no longer closes over a module global.
7
+ // A provider is identified by a {@link ProviderToken} — an opaque, phantom-typed handle the
8
+ // registrant defines once and exports. The deployment wires an impl against the token at
9
+ // startup on the registry INSTANCE the facade owns ({@link ProviderRegistry.wire}); the gate
10
+ // reads it back through its {@link GateContext} (`ctx.getProvider` / `ctx.requireProvider` /
11
+ // `ctx.isProviderWired`), so it no longer closes over a module global.
11
12
  //
12
- // `requireProvider` throws when the token is unwired — which is SAFE inside a gate's
13
- // `probe()` because the engine only ever probes a gate whose `wired()` returned true, and
14
- // a gate's `wired()` is `isProviderWired(token)`. So the "checked wired, then asserted with
15
- // `!`" race the old pattern had is gone: the same token drives both.
13
+ // `require` throws when the token is unwired — which is SAFE inside a gate's `probe()` because
14
+ // the engine only ever probes a gate whose `wired()` returned true, and a gate's `wired()` is
15
+ // `ctx.isProviderWired(token)`. So the "checked wired, then asserted with `!`" race the old
16
+ // pattern had is gone: the same token drives both.
16
17
  //
17
- // This lives in kernel (alongside the gate / pipeline registries) so both the kernel
18
- // `GateContext` and the `@cat-factory/gates` package can reference it, and so a deployment
19
- // package can wire a provider as a startup import side effect without depending on the heavy
20
- // orchestration package.
18
+ // This lives in kernel (alongside the gate registry) so both the kernel `GateContext` and the
19
+ // `@cat-factory/gates` package can reference it. The composition root news ONE instance
20
+ // (`defaultProviderRegistry()`), threads it through `CoreDependencies`, and each facade wires
21
+ // its configured providers on that instance — so, unlike the former module global, a fresh
22
+ // instance per container build starts empty (no leak of a previous build's wiring) and a
23
+ // separately-published extension package can never register into a phantom `Map`.
21
24
  // ---------------------------------------------------------------------------
22
25
  /**
23
26
  * Define a new provider token. Call once at module scope and export the result, e.g.
@@ -26,38 +29,45 @@
26
29
  export function defineProviderToken(description) {
27
30
  return { key: Symbol(description), description };
28
31
  }
29
- // Process-wide map, keyed by the token's symbol. Mirrors the gate / agent-kind / pipeline
30
- // registry model: wiring is a startup side effect, read at gate-probe time.
31
- const providers = new Map();
32
- /** Wire (or clear, with `undefined`) the impl for a token. */
33
- export function wireProvider(token, impl) {
34
- if (impl === undefined)
35
- providers.delete(token.key);
36
- else
37
- providers.set(token.key, impl);
38
- }
39
- /** The wired impl for a token, or `undefined` when nothing is wired. */
40
- export function getProvider(token) {
41
- return providers.get(token.key);
42
- }
43
- /** Whether an impl is wired for a token (the canonical source for a gate's `wired()`). */
44
- export function isProviderWired(token) {
45
- return providers.has(token.key);
46
- }
47
32
  /**
48
- * The wired impl for a token, or throw when nothing is wired. SAFE inside a gate's
49
- * `probe()` the engine only probes a gate whose `wired()` (i.e. {@link isProviderWired})
50
- * returned true so it replaces the old `getFoo()!` assertion with a real guard.
33
+ * App-owned registry of wired providers, keyed by a {@link ProviderToken}'s symbol. Mirrors the
34
+ * gate / agent-kind registries: the composition root news ONE instance, threads it through
35
+ * `CoreDependencies` into the gate machine's {@link GateContext}, and each facade wires its
36
+ * configured providers here at build time. There is no module-global `Map` and no `clear*()`
37
+ * cruft — a fresh instance per build starts empty.
51
38
  */
52
- export function requireProvider(token) {
53
- const impl = providers.get(token.key);
54
- if (impl === undefined) {
55
- throw new Error(`Provider "${token.description}" is not wired.`);
39
+ export class ProviderRegistry {
40
+ providers = new Map();
41
+ /** Wire (or clear, with `undefined`) the impl for a token. */
42
+ wire(token, impl) {
43
+ if (impl === undefined)
44
+ this.providers.delete(token.key);
45
+ else
46
+ this.providers.set(token.key, impl);
47
+ }
48
+ /** The wired impl for a token, or `undefined` when nothing is wired. */
49
+ get(token) {
50
+ return this.providers.get(token.key);
51
+ }
52
+ /** Whether an impl is wired for a token (the canonical source for a gate's `wired()`). */
53
+ isWired(token) {
54
+ return this.providers.has(token.key);
55
+ }
56
+ /**
57
+ * The wired impl for a token, or throw when nothing is wired. SAFE inside a gate's `probe()` —
58
+ * the engine only probes a gate whose `wired()` (i.e. {@link isWired}) returned true — so it
59
+ * replaces the old `getFoo()!` assertion with a real guard.
60
+ */
61
+ require(token) {
62
+ const impl = this.providers.get(token.key);
63
+ if (impl === undefined) {
64
+ throw new Error(`Provider "${token.description}" is not wired.`);
65
+ }
66
+ return impl;
56
67
  }
57
- return impl;
58
68
  }
59
- /** Clear EVERY wired provider. Intended for tests that exercise wiring in isolation. */
60
- export function clearProviders() {
61
- providers.clear();
69
+ /** A fresh, empty provider registry. Each facade news one and wires its configured providers on it. */
70
+ export function defaultProviderRegistry() {
71
+ return new ProviderRegistry();
62
72
  }
63
73
  //# sourceMappingURL=provider-registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-registry.js","sourceRoot":"","sources":["../../src/domain/provider-registry.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,qFAAqF;AACrF,uFAAuF;AACvF,wFAAwF;AACxF,iFAAiF;AACjF,EAAE;AACF,wFAAwF;AACxF,0FAA0F;AAC1F,4FAA4F;AAC5F,4FAA4F;AAC5F,EAAE;AACF,qFAAqF;AACrF,0FAA0F;AAC1F,4FAA4F;AAC5F,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,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC1C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,aAAa,KAAK,CAAC,WAAW,iBAAiB,CAAC,CAAA;QAClE,CAAC;QACD,OAAO,IAAS,CAAA;IAClB,CAAC;CACF;AAED,uGAAuG;AACvG,MAAM,UAAU,uBAAuB;IACrC,OAAO,IAAI,gBAAgB,EAAE,CAAA;AAC/B,CAAC"}
@@ -1,11 +1,15 @@
1
+ import type { PipelineRegistry } from './pipeline-registry.js';
1
2
  import type { Block, Pipeline } from './types.js';
2
3
  export declare function seedBlocks(): Block[];
3
4
  /**
4
- * Reusable pipelines shown in the pipeline palette on first load: the built-in catalog
5
- * plus any pipelines a deployment registered via `registerPipeline` (e.g. a proprietary
6
- * org package), merged by id.
5
+ * Reusable pipelines shown in the pipeline palette on first load: the built-in catalog plus any
6
+ * pipelines a deployment registered on the app-owned {@link PipelineRegistry} (e.g. a proprietary
7
+ * org package), merged by id. Omit `registry` (or pass a fresh one) for the built-in catalog only —
8
+ * the shape a caller that only resolves a BUILT-IN pipeline's id needs (e.g. plan-helpers, the
9
+ * cross-runtime conformance baseline). The workspace + pipeline services thread the app-owned
10
+ * instance so a deployment's custom pipelines are seeded into every new workspace.
7
11
  */
8
- export declare function seedPipelines(): Pipeline[];
12
+ export declare function seedPipelines(registry?: PipelineRegistry): Pipeline[];
9
13
  /** Pipeline id of the blueprint-only run kicked off after a successful bootstrap. */
10
14
  export declare const BLUEPRINT_PIPELINE_ID = "pl_blueprint";
11
15
  /** Pipeline id of the Initiative Planning pipeline (initiative blocks only). */
@@ -1 +1 @@
1
- {"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../../src/domain/seed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAOjD,wBAAgB,UAAU,IAAI,KAAK,EAAE,CAgHpC;AA4CD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