@ggui-ai/mcp-server-handlers 0.6.3 → 0.8.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 (57) hide show
  1. package/dist/blueprints/index.d.ts +2 -2
  2. package/dist/blueprints/index.d.ts.map +1 -1
  3. package/dist/blueprints/index.js +1 -1
  4. package/dist/blueprints/search-blueprints.d.ts +64 -12
  5. package/dist/blueprints/search-blueprints.d.ts.map +1 -1
  6. package/dist/blueprints/search-blueprints.js +166 -16
  7. package/dist/ops-apps/delete-app.d.ts +26 -9
  8. package/dist/ops-apps/delete-app.d.ts.map +1 -1
  9. package/dist/ops-apps/delete-app.js +34 -11
  10. package/dist/ops-apps/index.d.ts +1 -1
  11. package/dist/ops-apps/index.d.ts.map +1 -1
  12. package/dist/ops-apps/index.js +1 -1
  13. package/dist/ops-apps/types.d.ts +32 -1
  14. package/dist/ops-apps/types.d.ts.map +1 -1
  15. package/dist/ops-apps/types.js +16 -0
  16. package/dist/ops-blueprint/generate.d.ts.map +1 -1
  17. package/dist/ops-blueprint/generate.js +6 -2
  18. package/dist/ops-blueprint/register.d.ts.map +1 -1
  19. package/dist/ops-blueprint/register.js +7 -2
  20. package/dist/ops-connector-keys/types.d.ts +7 -0
  21. package/dist/ops-connector-keys/types.d.ts.map +1 -1
  22. package/dist/renders/blueprint-durability.d.ts +111 -0
  23. package/dist/renders/blueprint-durability.d.ts.map +1 -0
  24. package/dist/renders/blueprint-durability.js +85 -0
  25. package/dist/renders/blueprint-registry.d.ts +24 -0
  26. package/dist/renders/blueprint-registry.d.ts.map +1 -1
  27. package/dist/renders/blueprint-registry.js +9 -0
  28. package/dist/renders/code-delivery-events.d.ts +92 -0
  29. package/dist/renders/code-delivery-events.d.ts.map +1 -0
  30. package/dist/renders/code-delivery-events.js +77 -0
  31. package/dist/renders/fetch-gadget-types.d.ts +7 -3
  32. package/dist/renders/fetch-gadget-types.d.ts.map +1 -1
  33. package/dist/renders/fetch-gadget-types.js +7 -3
  34. package/dist/renders/generation-cache.d.ts +9 -0
  35. package/dist/renders/generation-cache.d.ts.map +1 -1
  36. package/dist/renders/handshake.d.ts +5 -3
  37. package/dist/renders/handshake.d.ts.map +1 -1
  38. package/dist/renders/handshake.js +9 -4
  39. package/dist/renders/index.d.ts +4 -1
  40. package/dist/renders/index.d.ts.map +1 -1
  41. package/dist/renders/index.js +14 -1
  42. package/dist/renders/render-identity.d.ts +178 -0
  43. package/dist/renders/render-identity.d.ts.map +1 -0
  44. package/dist/renders/render-identity.js +136 -0
  45. package/dist/renders/render.d.ts +39 -5
  46. package/dist/renders/render.d.ts.map +1 -1
  47. package/dist/renders/render.js +224 -85
  48. package/dist/renders/slice-meta-derivation.d.ts +89 -6
  49. package/dist/renders/slice-meta-derivation.d.ts.map +1 -1
  50. package/dist/renders/slice-meta-derivation.js +118 -7
  51. package/dist/renders/sync-context.d.ts +13 -1
  52. package/dist/renders/sync-context.d.ts.map +1 -1
  53. package/dist/renders/sync-context.js +6 -1
  54. package/dist/renders/update.d.ts +15 -1
  55. package/dist/renders/update.d.ts.map +1 -1
  56. package/dist/renders/update.js +14 -5
  57. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ops-apps/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2BAA2B;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,E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AGG;IACH,QAAQ,CAAC,IAAI,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,QAAQ,CAAC;KACjB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,UAAU,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,0EAA0E;IAC1E,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACtD;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAG,eAAe,CAAU;gBAC7B,KAAK,EAAE,MAAM;CAI1B;AAED;;;;;;;;GAQG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,EAAG,4BAA4B,CAAU;gBAC1C,KAAK,EAAE,MAAM;CAM1B;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,EAAG,wBAAwB,CAAU;gBACtC,OAAO,EAAE,MAAM;CAI5B"}
@@ -9,6 +9,22 @@ export class AppNotFoundError extends Error {
9
9
  this.name = 'AppNotFoundError';
10
10
  }
11
11
  }
12
+ /**
13
+ * Thrown when the delete target IS the caller's default app.
14
+ *
15
+ * `defaultAppId` is what the universal route resolves on every
16
+ * request; deleting the app it names would leave that route pointing
17
+ * at a row that no longer exists. Same lock the console's Delete
18
+ * enforces — the operator picks a different default first, then
19
+ * deletes.
20
+ */
21
+ export class DefaultAppDeleteBlockedError extends Error {
22
+ code = 'default_app_delete_blocked';
23
+ constructor(appId) {
24
+ super(`default_app_delete_blocked: app ${JSON.stringify(appId)} is the calling user's default — set a different default app first, then delete this one`);
25
+ this.name = 'DefaultAppDeleteBlockedError';
26
+ }
27
+ }
12
28
  /**
13
29
  * Thrown by adapters that prefer surfacing access denial over the
14
30
  * "treat as not-found" privacy posture. Handlers translate to the
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/ops-blueprint/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,aAAa,EAGd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,YAAY,EAGjB,KAAK,0BAA0B,EAChC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjE,QAAA,MAAM,cAAc;;;;;;;;CAAwC,CAAC;AAC7D,QAAA,MAAM,eAAe;;;;;;;;;CAWb,CAAC;AAET;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,C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AG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,MAAM,CAAC;CACzC;AAmCD,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,4BAA4B,GACjC,aAAa,CAAC,OAAO,cAAc,EAAE,OAAO,eAAe,EAAE,0BAA0B,CAAC,CAyP1F"}
@@ -123,8 +123,9 @@ export function createGguiOpsGenerateBlueprintHandler(deps) {
123
123
  // in `renders/`.
124
124
  assertContractNoRetiredFields(parsed.contract);
125
125
  // 0. Every `contract.clientCapabilities.gadgets[*]` MUST
126
- // resolve in `App.gadgets` by the full `(hook, package,
127
- // version)` tuple. Throws a precise reject when an
126
+ // resolve in `App.gadgets` by `(package, export name)` — the
127
+ // wire carries no version; the operator's catalog is the
128
+ // version pin. Throws a precise reject when an
128
129
  // unregistered wrapper is referenced. No-op when
129
130
  // `appMetadataStore` is unset.
130
131
  //
@@ -268,7 +269,10 @@ export function createGguiOpsGenerateBlueprintHandler(deps) {
268
269
  // Operator-DISPATCHED but engine-GENERATED: the code came
269
270
  // out of `generator.generate(...)`, so provenance is the
270
271
  // llm arm — the same `source` stamped on the MVB row above.
272
+ // The two axes disagree here on purpose, which is exactly
273
+ // why `createdBy` cannot be derived from `source`.
271
274
  source,
275
+ createdBy: "operator",
272
276
  });
273
277
  }
274
278
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/ops-blueprint/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,YAAY,EAEjB,KAAK,0BAA0B,EAEhC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB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78
  // in `renders/`.
79
79
  assertContractNoRetiredFields(parsed.contract);
80
80
  // Every `contract.clientCapabilities.gadgets[*]` MUST resolve
81
- // in `App.gadgets` by the full `(hook, package, version)`
82
- // tuple. Fails fast with a precise reject before any state
81
+ // in `App.gadgets` by `(package, export name)` — the wire
82
+ // carries no version; the operator's catalog is the version
83
+ // pin. Fails fast with a precise reject before any state
83
84
  // mutation. No-op when no `appMetadataStore` is bound.
84
85
  if (deps.appMetadataStore) {
85
86
  const appRecord = await deps.appMetadataStore.get(ctx.appId);
@@ -166,6 +167,10 @@ export function createGguiOpsRegisterBlueprintHandler(deps) {
166
167
  // Same user-arm provenance as the MVB row above — one
167
168
  // handler call, one provenance claim across both stores.
168
169
  source: USER_SOURCE,
170
+ // An operator invoked this tool. Without it the durable
171
+ // record would claim the standard agent flow minted a row
172
+ // that is retained permanently.
173
+ createdBy: "operator",
169
174
  });
170
175
  }
171
176
  catch (err) {
@@ -57,6 +57,13 @@ export interface IssueConnectorKeyResult {
57
57
  * - `revoke` is idempotent — re-revoking a `revoked` row returns the
58
58
  * same row with `alreadyRevoked: true`. Cross-user revoke is
59
59
  * rejected with `ConnectorKeyAccessDeniedError`.
60
+ * - When `issue` is asked to bind the key to an app (`appId` set),
61
+ * the implementation MUST verify the subject owns that app before
62
+ * minting, and MUST reject with `ConnectorKeyAccessDeniedError`
63
+ * when it does not or when the deployment cannot verify. A key
64
+ * bound to an app the subject does not own is a credential for
65
+ * someone else's data — refusing the mint is the contract, not a
66
+ * quality-of-implementation choice.
60
67
  */
61
68
  export interface ConnectorKeysSource {
62
69
  list(ownerSub: string): Promise<readonly ConnectorKeySummary[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ops-connector-keys/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;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CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACrC,MAAM,CAAC,IAAI,EAAE;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,mBAAmB,CAAC;QAAC,cAAc,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACxE;AAED,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,QAAQ,CAAC,IAAI,EAAG,6BAA6B,CAAU;gBAC3C,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,EAAG,yBAAyB,CAAU;gBACvC,KAAK,EAAE,MAAM;CAM1B"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Durable write-through for freshly registered blueprints (#430 slice
3
+ * 2).
4
+ *
5
+ * The blueprint registry (`blueprint-registry.ts`) is a CAPPED vector
6
+ * store: registering past `maxPerKind` evicts the lowest-hit entry, and
7
+ * a deployment whose vector store is process-local loses the whole
8
+ * bucket on restart. That is the right shape for a match cache — a miss
9
+ * costs one regeneration. It is the wrong shape for anything that needs
10
+ * to resolve a blueprint by id LATER, because "later" is exactly when
11
+ * the entry is gone.
12
+ *
13
+ * So a registration that mints a fresh row also writes it through to a
14
+ * durable pair: metadata to a {@link BlueprintStore}, the compiled body
15
+ * to a {@link CodeStore} keyed by content hash. Deployments that bind
16
+ * neither keep today's behavior exactly.
17
+ *
18
+ * ## Two `Blueprint` types, and the projection between them
19
+ *
20
+ * The registry's {@link RegistryBlueprint} and the protocol's
21
+ * `Blueprint` share a name and almost nothing else. The registry row is
22
+ * a match candidate: `id`, `kind`, `intent`, `componentCode` inline, a
23
+ * `hitCount`. The protocol row is a persistence record: `blueprintId`,
24
+ * `appId`, `contractHash`, a `codeHash` POINTER to the body. The
25
+ * projection below is where they meet on the DURABLE-WRITE path, and
26
+ * it is where the registry's `contractKey` becomes the protocol's
27
+ * `contractHash` — one value, two spellings, same 16-char blueprintKey
28
+ * domain.
29
+ *
30
+ * Not the only such hop in the codebase: `decide-handshake.ts` makes
31
+ * the same translation projecting a matched blueprint onto
32
+ * `blueprintMeta`, and predates this module. The claim is scoped on
33
+ * purpose — a docstring that overstates its reach is how a reader
34
+ * concludes a rename is contained when it is not.
35
+ *
36
+ * ## Best-effort, and what "best" means when it fails
37
+ *
38
+ * Registration must never fail because durability hiccuped: the render
39
+ * that triggered it already produced working code and already
40
+ * committed. Both writes are therefore try/caught into named events.
41
+ *
42
+ * The order is body first, then metadata, and that is load-bearing. A
43
+ * body with no row is an orphan — invisible, reclaimable, harmless. A
44
+ * row naming a `codeHash` with no object behind it is a LIE: a later
45
+ * resolve finds the record, fetches the body, gets nothing, and fails
46
+ * at the point where it looked like it would succeed. So when the body
47
+ * write fails, the row is still written but WITHOUT `codeHash`, which
48
+ * reads as "metadata recorded, no body stored" — a state the protocol
49
+ * type already models and consumers already branch on.
50
+ *
51
+ * ## Backfill posture — documented, not built
52
+ *
53
+ * Blueprints registered before this shipped exist only in the capped
54
+ * vector registry. Their records carry a `blueprintId` that resolves to
55
+ * nothing durable, so a re-mint against them lands in
56
+ * `blueprint_unresolvable`. No backfill job exists, deliberately: the
57
+ * affected rows are sandbox-only, the cost of the miss is one
58
+ * regeneration, and a job to walk a capped in-memory registry would be
59
+ * writing whatever survived rather than what was actually registered.
60
+ * If real data ever needs it, the job is a scope scan of the vector
61
+ * store through this same projection — but not until then.
62
+ */
63
+ import type { BlueprintStore, CodeStore } from '@ggui-ai/mcp-server-core';
64
+ import type { Blueprint as DurableBlueprint } from '@ggui-ai/protocol';
65
+ import type { Blueprint as RegistryBlueprint } from './blueprint-registry.js';
66
+ /**
67
+ * Every event this module can emit. Closed union — a new emitter picks
68
+ * from these or extends the type, which is what makes a rename a
69
+ * compile error rather than an alert filter that quietly stops
70
+ * matching.
71
+ */
72
+ export type BlueprintDurabilityEvent = 'blueprint_durable_write_failed' | 'blueprint_code_write_failed';
73
+ /**
74
+ * The event names as values, so every emitter — in this package or a
75
+ * storage backend elsewhere — spells them from one place.
76
+ */
77
+ export declare const BLUEPRINT_DURABILITY_EVENTS: {
78
+ /** Metadata row rejected. The blueprint is not durably resolvable. */
79
+ readonly durableWriteFailed: "blueprint_durable_write_failed";
80
+ /** Body rejected. The row still lands, without a `codeHash`. */
81
+ readonly codeWriteFailed: "blueprint_code_write_failed";
82
+ };
83
+ /**
84
+ * The durable pair. Both optional at the binding site — a deployment
85
+ * may have neither (no durability), or metadata without a body store
86
+ * (rows persist, bodies do not).
87
+ */
88
+ export interface BlueprintDurabilityDeps {
89
+ readonly blueprintStore?: BlueprintStore;
90
+ readonly codeStore?: CodeStore;
91
+ }
92
+ /**
93
+ * Project a registry row onto the durable record.
94
+ *
95
+ * `codeHash` is passed rather than derived so the caller can omit it
96
+ * when the body write failed — the record then honestly says no body
97
+ * is stored. `codeS3Url` is deliberately NOT set here: it names a
98
+ * location only the storage adapter knows, and the adapter composes it
99
+ * on read.
100
+ */
101
+ export declare function projectDurableBlueprint(blueprint: RegistryBlueprint, appId: string, codeHash: string | undefined, createdBy?: DurableBlueprint['createdBy']): DurableBlueprint;
102
+ /**
103
+ * Write a freshly minted blueprint through to durable storage.
104
+ *
105
+ * Never throws and never retries: one round-trip per store, both
106
+ * try/caught. An unbound store is a no-op — not an error, and not an
107
+ * event, because a deployment that never bound one is not failing at
108
+ * anything.
109
+ */
110
+ export declare function writeBlueprintDurably(deps: BlueprintDurabilityDeps | undefined, appId: string, blueprint: RegistryBlueprint, createdBy?: DurableBlueprint['createdBy']): Promise<void>;
111
+ //# sourceMappingURL=blueprint-durability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blueprint-durability.d.ts","sourceRoot":"","sources":["../../src/renders/blueprint-durability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAChC,gCAAgC,GAChC,6BAA6B,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,2BAA2B;IACtC,sEAAsE;;IAEtE,gEAAgE;;CAEL,CAAC;AAQ9D;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,GAAE,gBAAgB,CAAC,WAAW,CAAW,GACjD,gBAAgB,CAmBlB;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,uBAAuB,GAAG,SAAS,EACzC,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,iBAAiB,EAC5B,SAAS,GAAE,gBAAgB,CAAC,WAAW,CAAW,GACjD,OAAO,CAAC,IAAI,CAAC,CAyBf"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The event names as values, so every emitter — in this package or a
3
+ * storage backend elsewhere — spells them from one place.
4
+ */
5
+ export const BLUEPRINT_DURABILITY_EVENTS = {
6
+ /** Metadata row rejected. The blueprint is not durably resolvable. */
7
+ durableWriteFailed: 'blueprint_durable_write_failed',
8
+ /** Body rejected. The row still lands, without a `codeHash`. */
9
+ codeWriteFailed: 'blueprint_code_write_failed',
10
+ };
11
+ const DURABLE_WRITE_FAILED = BLUEPRINT_DURABILITY_EVENTS.durableWriteFailed;
12
+ const CODE_WRITE_FAILED = BLUEPRINT_DURABILITY_EVENTS.codeWriteFailed;
13
+ /**
14
+ * Project a registry row onto the durable record.
15
+ *
16
+ * `codeHash` is passed rather than derived so the caller can omit it
17
+ * when the body write failed — the record then honestly says no body
18
+ * is stored. `codeS3Url` is deliberately NOT set here: it names a
19
+ * location only the storage adapter knows, and the adapter composes it
20
+ * on read.
21
+ */
22
+ export function projectDurableBlueprint(blueprint, appId, codeHash, createdBy = 'agent') {
23
+ return {
24
+ blueprintId: blueprint.id,
25
+ appId,
26
+ // Registry `contractKey` → protocol `contractHash`. Same 16-char
27
+ // blueprintKey value; see the module docstring.
28
+ contractHash: blueprint.contractKey,
29
+ source: blueprint.source,
30
+ variance: blueprint.variance,
31
+ createdAt: blueprint.createdAt,
32
+ // WHO initiated the mint — a different axis from `source`, which
33
+ // records what produced the code. An operator-invoked registration
34
+ // is `createdBy: 'operator'` even when `source.kind` is `'llm'`.
35
+ // Defaulted rather than derived: the registry row does not carry
36
+ // this, and only the caller knows which tool it is serving.
37
+ createdBy,
38
+ contract: blueprint.contract,
39
+ ...(codeHash !== undefined ? { codeHash } : {}),
40
+ };
41
+ }
42
+ /**
43
+ * Write a freshly minted blueprint through to durable storage.
44
+ *
45
+ * Never throws and never retries: one round-trip per store, both
46
+ * try/caught. An unbound store is a no-op — not an error, and not an
47
+ * event, because a deployment that never bound one is not failing at
48
+ * anything.
49
+ */
50
+ export async function writeBlueprintDurably(deps, appId, blueprint, createdBy = 'agent') {
51
+ const blueprintStore = deps?.blueprintStore;
52
+ if (!blueprintStore)
53
+ return;
54
+ // Body first — see the module docstring on why an orphan body beats a
55
+ // row that points at nothing.
56
+ let codeHash;
57
+ const codeStore = deps?.codeStore;
58
+ if (codeStore && blueprint.componentCode.length > 0) {
59
+ try {
60
+ const hash = codeStore.hashOf(blueprint.componentCode);
61
+ await codeStore.put(hash, blueprint.componentCode);
62
+ codeHash = hash;
63
+ }
64
+ catch (err) {
65
+ logDurabilityFailure(CODE_WRITE_FAILED, blueprint, appId, err);
66
+ }
67
+ }
68
+ try {
69
+ await blueprintStore.put(projectDurableBlueprint(blueprint, appId, codeHash, createdBy));
70
+ }
71
+ catch (err) {
72
+ logDurabilityFailure(DURABLE_WRITE_FAILED, blueprint, appId, err);
73
+ }
74
+ }
75
+ function logDurabilityFailure(event, blueprint, appId, err) {
76
+ // eslint-disable-next-line no-console -- structured single-line event for log-pipeline pickup
77
+ console.warn(JSON.stringify({
78
+ msg: event,
79
+ blueprintId: blueprint.id,
80
+ contractKey: blueprint.contractKey,
81
+ appId,
82
+ source: blueprint.source.kind,
83
+ error: err instanceof Error ? err.message : String(err),
84
+ }));
85
+ }
@@ -2,6 +2,7 @@ import type { BlueprintIndex, EmbeddingProvider, EnumerableVectorStore, VectorSt
2
2
  export type { BlueprintIndex } from '@ggui-ai/mcp-server-core';
3
3
  import { type BlueprintSource, type BlueprintVariance, type DataContract } from '@ggui-ai/protocol';
4
4
  import { type ContractValidationFinding, type ContractValidationResult } from '@ggui-ai/negotiator';
5
+ import { type BlueprintDurabilityDeps } from './blueprint-durability.js';
5
6
  /**
6
7
  * Atomic-design level. The runtime currently writes only
7
8
  * `'template'` — the full-component case. Smaller-grain kinds are
@@ -112,6 +113,17 @@ export interface BlueprintRegistryDeps {
112
113
  * indexed exact lookup that consume it land next wave.
113
114
  */
114
115
  readonly index: BlueprintIndex;
116
+ /**
117
+ * Durable write-through target (#430 slice 2). When bound, a fresh
118
+ * mint is also written to a {@link BlueprintStore} (+ optional
119
+ * {@link CodeStore} for the body) so it stays resolvable by id after
120
+ * the capped registry has evicted it or the process has restarted.
121
+ *
122
+ * Optional and best-effort: absent ⇒ no write, no event; present and
123
+ * failing ⇒ a named event and a registration that still succeeds.
124
+ * See `blueprint-durability.ts`.
125
+ */
126
+ readonly durability?: BlueprintDurabilityDeps;
115
127
  }
116
128
  /** Input for {@link registerBlueprint}. */
117
129
  export interface RegisterBlueprintInput {
@@ -140,6 +152,18 @@ export interface RegisterBlueprintInput {
140
152
  * empty variance as one stable sentinel.
141
153
  */
142
154
  readonly variance?: BlueprintVariance;
155
+ /**
156
+ * WHO initiated this mint, for the durable record. `'agent'` is the
157
+ * standard handshake → render flow; the operator tools
158
+ * (`ggui_ops_register_blueprint` / `ggui_ops_generate_blueprint`)
159
+ * pass `'operator'`.
160
+ *
161
+ * A different axis from {@link source}, which records what PRODUCED
162
+ * the code: an operator-invoked generation is `createdBy: 'operator'`
163
+ * AND `source.kind: 'llm'`. Defaults to `'agent'` — the registry row
164
+ * itself does not carry the field, so only the caller knows.
165
+ */
166
+ readonly createdBy?: 'agent' | 'operator';
143
167
  }
144
168
  /**
145
169
  * Compose the deterministic exact-lookup key — the `(scope, exactKey)`
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint-registry.d.ts","sourceRoot":"","sources":["../../src/renders/blueprint-registry.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EAGrB,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAKlC,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC9B,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAE1E,mDAAmD;AACnD,MAAM,WAAW,SAAS;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAA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AAC,IAAI,CAAC,CAoCf;AAoBD;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,EACzD,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAaf"}
@@ -45,6 +45,7 @@ import { blueprintSourceToFlat, flatToBlueprintSource, summarizeContract, } from
45
45
  // can't bundle.
46
46
  import { blueprintKey, variantKey } from '@ggui-ai/protocol/blueprint-key';
47
47
  import { validateContractRedundancy, } from '@ggui-ai/negotiator';
48
+ import { writeBlueprintDurably, } from './blueprint-durability.js';
48
49
  /**
49
50
  * Thrown by {@link registerBlueprint} when the structural validator
50
51
  * emits one or more `severity: 'error'` findings. Carries the full
@@ -361,6 +362,14 @@ export async function registerBlueprint(deps, scope, input, options = {}) {
361
362
  metadata: blueprintToMetadata(blueprint),
362
363
  });
363
364
  await deps.index.putId(scope, exactKey, id);
365
+ // Durable write-through for the fresh mint only. The dedup return
366
+ // above skips it deliberately: that row was written through when it
367
+ // was first minted, and re-writing it would fail the durable store's
368
+ // already-exists guard on every cache hit.
369
+ //
370
+ // `scope` is the appId at every call site — the registry's tenancy
371
+ // unit and the durable record's are the same thing.
372
+ await writeBlueprintDurably(deps.durability, scope, blueprint, input.createdBy ?? 'agent');
364
373
  return blueprint;
365
374
  }
366
375
  /**
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Named events for the content-addressable code-delivery channel.
3
+ *
4
+ * `codeUrl` is the CACHE-ADDRESSABLE static delivery surface of a
5
+ * COMPILED-COMPONENT envelope — since #471 it is no longer the only
6
+ * static one: `deriveRenderMeta` also stamps the size-capped inline
7
+ * `codeB64` twin, independent of this channel's store. A failed
8
+ * `codeUrl` mint therefore usually IS absorbed by the inline channel;
9
+ * what it still costs is deployment-shaped:
10
+ *
11
+ * - Every under-cap compiled render keeps mounting via `codeB64`
12
+ * (and, when minted, the live trio). The loss is the browser-
13
+ * cacheable content-addressable URL — repeat renders of the same
14
+ * bytes re-ship them inline instead of hitting HTTP cache.
15
+ * - An OVER-CAP render (no `codeB64`) falls back to exactly the
16
+ * pre-#471 posture: live trio mounts it; a host that resolves
17
+ * `resourceUri` re-mints `codeUrl` at READ time; a deployment
18
+ * with neither loses the mount for that one envelope.
19
+ *
20
+ * None of this is distinguishable from the wire — the render reports
21
+ * success either way — which is why the failure is emitted under a
22
+ * name instead of swallowed. The event carries whether a live channel
23
+ * is wired; combined with the render's size class it separates
24
+ * "slower / uncacheable delivery" from "this envelope cannot mount".
25
+ */
26
+ /**
27
+ * Every event this module can emit. Closed union — a new emitter picks
28
+ * from these or extends the type, which is what makes a rename a
29
+ * compile error rather than an alert filter that quietly stops
30
+ * matching.
31
+ */
32
+ export type CodeDeliveryEvent = 'render_code_write_failed' | 'render_code_b64_over_cap';
33
+ /**
34
+ * The event names as values, so every emitter — in this package or a
35
+ * storage backend elsewhere — spells them from one place.
36
+ */
37
+ export declare const CODE_DELIVERY_EVENTS: {
38
+ /**
39
+ * The `codeUrl` mint failed for a render envelope. That envelope
40
+ * loses the cache-addressable static channel; see the module
41
+ * docstring for what survives.
42
+ */
43
+ readonly renderCodeWriteFailed: "render_code_write_failed";
44
+ /**
45
+ * A compiled render's source exceeded the inline `codeB64` cap, so
46
+ * the slice was emitted WITHOUT the fetch-free channel. On hosts
47
+ * whose iframe CSP blocks fetches AND WebSockets, that render
48
+ * cannot paint — the omission must be visible, not silent.
49
+ */
50
+ readonly renderCodeB64OverCap: "render_code_b64_over_cap";
51
+ };
52
+ /**
53
+ * What an emitter knows at the point the mint failed.
54
+ */
55
+ export interface RenderCodeWriteFailure {
56
+ /** Render whose envelope lost its static channel. */
57
+ readonly sessionId: string;
58
+ /** Owning app, so the event joins the rest of a deployment's logs. */
59
+ readonly appId: string;
60
+ /**
61
+ * Whether this deployment mints live-channel credentials.
62
+ *
63
+ * `true` ⇒ the render still mounts over the WS subscribe; the loss
64
+ * is the instant first paint. `false` ⇒ the envelope mounts only
65
+ * through the inline `codeB64` channel (present for every under-cap
66
+ * compiled render, independent of this store); an OVER-CAP render
67
+ * with `false` here truly has no mount mode, and only a host that
68
+ * resolves `resourceUri` will still produce a card.
69
+ */
70
+ readonly liveChannelWired: boolean;
71
+ /** Whatever the store threw. Unshaped by construction. */
72
+ readonly cause: unknown;
73
+ }
74
+ /**
75
+ * Emit {@link CODE_DELIVERY_EVENTS.renderCodeWriteFailed}.
76
+ *
77
+ * Never throws: a render that already produced valid code and already
78
+ * committed must not fail because its delivery-channel telemetry did.
79
+ */
80
+ export declare function reportRenderCodeWriteFailed(failure: RenderCodeWriteFailure): void;
81
+ /**
82
+ * Emit {@link CODE_DELIVERY_EVENTS.renderCodeB64OverCap}.
83
+ *
84
+ * Never throws — same posture as the write-failure emitter above.
85
+ */
86
+ export declare function reportRenderCodeB64OverCap(over: {
87
+ readonly sessionId: string;
88
+ readonly appId: string;
89
+ /** UTF-8 byte length of the compiled source that exceeded the cap. */
90
+ readonly sourceBytes: number;
91
+ }): void;
92
+ //# sourceMappingURL=code-delivery-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-delivery-events.d.ts","sourceRoot":"","sources":["../../src/renders/code-delivery-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GACzB,0BAA0B,GAC1B,0BAA0B,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;OAIG;;IAEH;;;;;OAKG;;CAEiD,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qDAAqD;IACrD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAgBN;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,GAAG,IAAI,CAUP"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Named events for the content-addressable code-delivery channel.
3
+ *
4
+ * `codeUrl` is the CACHE-ADDRESSABLE static delivery surface of a
5
+ * COMPILED-COMPONENT envelope — since #471 it is no longer the only
6
+ * static one: `deriveRenderMeta` also stamps the size-capped inline
7
+ * `codeB64` twin, independent of this channel's store. A failed
8
+ * `codeUrl` mint therefore usually IS absorbed by the inline channel;
9
+ * what it still costs is deployment-shaped:
10
+ *
11
+ * - Every under-cap compiled render keeps mounting via `codeB64`
12
+ * (and, when minted, the live trio). The loss is the browser-
13
+ * cacheable content-addressable URL — repeat renders of the same
14
+ * bytes re-ship them inline instead of hitting HTTP cache.
15
+ * - An OVER-CAP render (no `codeB64`) falls back to exactly the
16
+ * pre-#471 posture: live trio mounts it; a host that resolves
17
+ * `resourceUri` re-mints `codeUrl` at READ time; a deployment
18
+ * with neither loses the mount for that one envelope.
19
+ *
20
+ * None of this is distinguishable from the wire — the render reports
21
+ * success either way — which is why the failure is emitted under a
22
+ * name instead of swallowed. The event carries whether a live channel
23
+ * is wired; combined with the render's size class it separates
24
+ * "slower / uncacheable delivery" from "this envelope cannot mount".
25
+ */
26
+ /**
27
+ * The event names as values, so every emitter — in this package or a
28
+ * storage backend elsewhere — spells them from one place.
29
+ */
30
+ export const CODE_DELIVERY_EVENTS = {
31
+ /**
32
+ * The `codeUrl` mint failed for a render envelope. That envelope
33
+ * loses the cache-addressable static channel; see the module
34
+ * docstring for what survives.
35
+ */
36
+ renderCodeWriteFailed: 'render_code_write_failed',
37
+ /**
38
+ * A compiled render's source exceeded the inline `codeB64` cap, so
39
+ * the slice was emitted WITHOUT the fetch-free channel. On hosts
40
+ * whose iframe CSP blocks fetches AND WebSockets, that render
41
+ * cannot paint — the omission must be visible, not silent.
42
+ */
43
+ renderCodeB64OverCap: 'render_code_b64_over_cap',
44
+ };
45
+ /**
46
+ * Emit {@link CODE_DELIVERY_EVENTS.renderCodeWriteFailed}.
47
+ *
48
+ * Never throws: a render that already produced valid code and already
49
+ * committed must not fail because its delivery-channel telemetry did.
50
+ */
51
+ export function reportRenderCodeWriteFailed(failure) {
52
+ // eslint-disable-next-line no-console -- structured single-line event for log-pipeline pickup
53
+ console.warn(JSON.stringify({
54
+ msg: CODE_DELIVERY_EVENTS.renderCodeWriteFailed,
55
+ sessionId: failure.sessionId,
56
+ appId: failure.appId,
57
+ liveChannelWired: failure.liveChannelWired,
58
+ error: failure.cause instanceof Error
59
+ ? failure.cause.message
60
+ : String(failure.cause),
61
+ errorName: failure.cause instanceof Error ? failure.cause.name : undefined,
62
+ }));
63
+ }
64
+ /**
65
+ * Emit {@link CODE_DELIVERY_EVENTS.renderCodeB64OverCap}.
66
+ *
67
+ * Never throws — same posture as the write-failure emitter above.
68
+ */
69
+ export function reportRenderCodeB64OverCap(over) {
70
+ // eslint-disable-next-line no-console -- structured single-line event for log-pipeline pickup
71
+ console.warn(JSON.stringify({
72
+ msg: CODE_DELIVERY_EVENTS.renderCodeB64OverCap,
73
+ sessionId: over.sessionId,
74
+ appId: over.appId,
75
+ sourceBytes: over.sourceBytes,
76
+ }));
77
+ }
@@ -14,9 +14,13 @@
14
14
  * Behavior:
15
15
  * - Stdlib (`@ggui-ai/gadgets`) is skipped — the sandbox VFS already
16
16
  * carries its types directly.
17
- * - Descriptors without a `typesUrl` are skipped (pre-launch the
18
- * `registeredGadgetDescriptorSchema` makes `typesUrl` required for
19
- * non-stdlib, so this only spares a stdlib / hand-authored ref).
17
+ * - Descriptors without a `typesUrl` are skipped — the catalog's
18
+ * `strict` posture keeps `typesUrl` optional (nothing in the
19
+ * publish→install chain stamps it yet), so generation degrades
20
+ * gracefully to no-types codegen for such packages. The
21
+ * types-pipeline follow-up (publish stamps `typesUrl` + `typesSri`;
22
+ * `registeredGadgetDescriptorSchema` becomes the registration
23
+ * posture again) turns this skip back into a rare case.
20
24
  * - Unique `typesUrl`s are fetched in parallel (`Promise.all`).
21
25
  * - Each fetched body is SHA-384-verified against the descriptor's
22
26
  * `typesSri` when present — a CDN-compromise defense symmetric
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-gadget-types.d.ts","sourceRoot":"","sources":["../../src/renders/fetch-gadget-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAG,2BAA2B,CAAU;IACrD,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;QAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,CAAC,CAAC;gBAED,QAAQ,EAAE,aAAa,CAAC;QACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,CAAC;CAaL;AAOD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,SAAS,gBAAgB,EAAE,EACxC,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkEjC"}
1
+ {"version":3,"file":"fetch-gadget-types.d.ts","sourceRoot":"","sources":["../../src/renders/fetch-gadget-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAG,2BAA2B,CAAU;IACrD,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;QAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,CAAC,CAAC;gBAED,QAAQ,EAAE,aAAa,CAAC;QACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,CAAC;CAaL;AAOD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,SAAS,gBAAgB,EAAE,EACxC,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkEjC"}
@@ -14,9 +14,13 @@
14
14
  * Behavior:
15
15
  * - Stdlib (`@ggui-ai/gadgets`) is skipped — the sandbox VFS already
16
16
  * carries its types directly.
17
- * - Descriptors without a `typesUrl` are skipped (pre-launch the
18
- * `registeredGadgetDescriptorSchema` makes `typesUrl` required for
19
- * non-stdlib, so this only spares a stdlib / hand-authored ref).
17
+ * - Descriptors without a `typesUrl` are skipped — the catalog's
18
+ * `strict` posture keeps `typesUrl` optional (nothing in the
19
+ * publish→install chain stamps it yet), so generation degrades
20
+ * gracefully to no-types codegen for such packages. The
21
+ * types-pipeline follow-up (publish stamps `typesUrl` + `typesSri`;
22
+ * `registeredGadgetDescriptorSchema` becomes the registration
23
+ * posture again) turns this skip back into a rare case.
20
24
  * - Unique `typesUrl`s are fetched in parallel (`Promise.all`).
21
25
  * - Each fetched body is SHA-384-verified against the descriptor's
22
26
  * `typesSri` when present — a CDN-compromise defense symmetric