@ggui-ai/protocol 0.14.0 → 0.16.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 (112) hide show
  1. package/dist/envelopes/render-refusal.d.ts +49 -0
  2. package/dist/envelopes/render-refusal.d.ts.map +1 -0
  3. package/dist/envelopes/render-refusal.js +12 -0
  4. package/dist/errors/domain-error.d.ts +70 -0
  5. package/dist/errors/domain-error.d.ts.map +1 -0
  6. package/dist/errors/domain-error.js +118 -0
  7. package/dist/gadgets/resolve-app-gadgets.d.ts +1 -1
  8. package/dist/gadgets/stdlib-gadgets.d.ts +2 -2
  9. package/dist/gadgets/stdlib-gadgets.js +1 -1
  10. package/dist/index.d.ts +69 -63
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +8 -2
  13. package/dist/integrations/mcp-apps.d.ts +35 -9
  14. package/dist/integrations/mcp-apps.d.ts.map +1 -1
  15. package/dist/integrations/mcp-apps.js +13 -13
  16. package/dist/integrations/overlay-hash.d.ts +19 -0
  17. package/dist/integrations/overlay-hash.d.ts.map +1 -0
  18. package/dist/integrations/overlay-hash.js +29 -0
  19. package/dist/integrations/theme-binding.d.ts +14 -12
  20. package/dist/integrations/theme-binding.d.ts.map +1 -1
  21. package/dist/integrations/theme-binding.js +10 -6
  22. package/dist/registry/blueprint-key.d.ts.map +1 -1
  23. package/dist/registry/blueprint-key.js +4 -3
  24. package/dist/schemas/app-theme.d.ts +46 -10
  25. package/dist/schemas/app-theme.d.ts.map +1 -1
  26. package/dist/schemas/app-theme.js +108 -40
  27. package/dist/schemas/blueprint.d.ts +4 -3
  28. package/dist/schemas/blueprint.d.ts.map +1 -1
  29. package/dist/schemas/blueprint.js +15 -3
  30. package/dist/schemas/data-contract.d.ts +11 -31
  31. package/dist/schemas/data-contract.d.ts.map +1 -1
  32. package/dist/schemas/data-contract.js +5 -28
  33. package/dist/schemas/handshake-suggestion.d.ts.map +1 -1
  34. package/dist/schemas/handshake-suggestion.js +8 -1
  35. package/dist/schemas/interface-context.d.ts +44 -0
  36. package/dist/schemas/interface-context.d.ts.map +1 -0
  37. package/dist/schemas/interface-context.js +22 -0
  38. package/dist/schemas/invoke.d.ts +3 -3
  39. package/dist/schemas/invoke.js +1 -1
  40. package/dist/schemas/mcp.d.ts +246 -111
  41. package/dist/schemas/mcp.d.ts.map +1 -1
  42. package/dist/schemas/mcp.js +149 -42
  43. package/dist/schemas/ops-blueprint.d.ts +4 -4
  44. package/dist/schemas/ops-blueprint.d.ts.map +1 -1
  45. package/dist/schemas/ops-blueprint.js +13 -8
  46. package/dist/schemas/public-env-key.d.ts +26 -0
  47. package/dist/schemas/public-env-key.d.ts.map +1 -0
  48. package/dist/schemas/public-env-key.js +25 -0
  49. package/dist/schemas/render-input-envelope.d.ts +2 -2
  50. package/dist/schemas/render-input-envelope.js +1 -1
  51. package/dist/schemas/runtime-telemetry-limits.d.ts +11 -0
  52. package/dist/schemas/runtime-telemetry-limits.d.ts.map +1 -0
  53. package/dist/schemas/runtime-telemetry-limits.js +10 -0
  54. package/dist/transport/websocket.d.ts +5 -5
  55. package/dist/types/auth.d.ts +1 -1
  56. package/dist/types/blueprint-source.d.ts +27 -7
  57. package/dist/types/blueprint-source.d.ts.map +1 -1
  58. package/dist/types/blueprint-source.js +19 -3
  59. package/dist/types/blueprint.d.ts +2 -2
  60. package/dist/types/blueprint.d.ts.map +1 -1
  61. package/dist/types/contract-inference.d.ts +1 -1
  62. package/dist/types/data-contract.d.ts +3 -3
  63. package/dist/types/domain-error-codes.d.ts +167 -0
  64. package/dist/types/domain-error-codes.d.ts.map +1 -0
  65. package/dist/types/domain-error-codes.js +170 -0
  66. package/dist/types/events.d.ts +1 -1
  67. package/dist/types/ggui-session-event.d.ts +2 -2
  68. package/dist/types/handshake-suggestion.d.ts +2 -2
  69. package/dist/types/host-context.d.ts +3 -3
  70. package/dist/types/interface-context.d.ts +1 -1
  71. package/dist/types/invoke.d.ts +1 -1
  72. package/dist/types/lifecycle.d.ts +1 -1
  73. package/dist/types/live-channel.d.ts +3 -3
  74. package/dist/types/llm-route.d.ts +59 -2
  75. package/dist/types/llm-route.d.ts.map +1 -1
  76. package/dist/types/llm-route.js +62 -16
  77. package/dist/types/llm.d.ts +22 -2
  78. package/dist/types/llm.d.ts.map +1 -1
  79. package/dist/types/llm.js +29 -2
  80. package/dist/types/mcp.d.ts +49 -100
  81. package/dist/types/mcp.d.ts.map +1 -1
  82. package/dist/types/mcp.js +28 -9
  83. package/dist/types/refusal-codes.d.ts +54 -95
  84. package/dist/types/refusal-codes.d.ts.map +1 -1
  85. package/dist/types/refusal-codes.js +67 -105
  86. package/dist/types/render.d.ts +12 -11
  87. package/dist/types/render.d.ts.map +1 -1
  88. package/dist/types/ui-generator.d.ts +1 -1
  89. package/dist/validation/ajv-runtime.d.ts +2 -2
  90. package/dist/validation/contract-validator.d.ts +14 -8
  91. package/dist/validation/contract-validator.d.ts.map +1 -1
  92. package/dist/validation/contract-validator.js +12 -4
  93. package/dist/validation/cross-references.d.ts +2 -2
  94. package/dist/validation/hygiene-rules.d.ts +1 -1
  95. package/dist/validation/lint-contract.d.ts +2 -2
  96. package/dist/validation/lint-contract.d.ts.map +1 -1
  97. package/dist/validation/lint-contract.js +6 -4
  98. package/dist/validation/name-invariants.d.ts +2 -2
  99. package/dist/validation/reserved-channels.d.ts +1 -1
  100. package/dist/validation/schema-compat-invariants.d.ts +2 -2
  101. package/dist/validation/schema-meta-validation.d.ts +1 -1
  102. package/dist/validation/schema-subset.d.ts +3 -3
  103. package/dist/version.d.ts +485 -12
  104. package/dist/version.d.ts.map +1 -1
  105. package/dist/version.js +484 -11
  106. package/dist/wire.d.ts +45 -0
  107. package/dist/wire.d.ts.map +1 -0
  108. package/dist/wire.js +44 -0
  109. package/package.json +7 -1
  110. package/dist/envelope-adapters.d.ts +0 -25
  111. package/dist/envelope-adapters.d.ts.map +0 -1
  112. package/dist/envelope-adapters.js +0 -14
package/dist/types/mcp.js CHANGED
@@ -11,8 +11,17 @@
11
11
  * §7.1; see {@link RenderErrorCode}). The slot stays unassigned so a
12
12
  * future canonical code can't silently collide with stale consumers.
13
13
  *
14
+ * `-32001` is RETIRED-RESERVED too (ggui#853): `UNAUTHORIZED` lived
15
+ * there until the 0.16.0 wave, but `-32001` is the MCP SDK client's own
16
+ * `RequestTimeout` — minted locally, never sent by a server — so a
17
+ * client reading the number could not tell a server's UNAUTHORIZED
18
+ * from its own timeout, the class ggui#836 closed for `-32000`
19
+ * (`ConnectionClosed`). `UNAUTHORIZED` is `-32007`; the slot stays
20
+ * unassigned. `error-codes-vs-sdk.test.ts` pins that no ggui-chosen
21
+ * code equals a code the SDK's `ErrorCode` enum owns.
22
+ *
14
23
  * `-32006` is assigned to `MOUNT_UNAVAILABLE`; new canonical codes come
15
- * at `-32007` onwards.
24
+ * at `-32008` onwards.
16
25
  */
17
26
  export const MCP_ERROR_CODES = {
18
27
  PARSE_ERROR: -32700,
@@ -20,11 +29,10 @@ export const MCP_ERROR_CODES = {
20
29
  METHOD_NOT_FOUND: -32601,
21
30
  INVALID_PARAMS: -32602,
22
31
  INTERNAL_ERROR: -32603,
23
- // Protocol-specific error codes (-32004 retired-reserved — see above)
24
- UNAUTHORIZED: -32001,
32
+ // Protocol-specific error codes (-32001, -32004 and -32005 retired-reserved — see above)
33
+ UNAUTHORIZED: -32007,
25
34
  SESSION_NOT_FOUND: -32002,
26
35
  APP_NOT_FOUND: -32003,
27
- CAPABILITY_DENIED: -32005,
28
36
  /**
29
37
  * A `resources/read` identified the resource but cannot return a
30
38
  * mount for it — the component behind it is gone, the server keeps no
@@ -44,11 +52,22 @@ export const MCP_ERROR_CODES = {
44
52
  /**
45
53
  * Platform-specific error codes (-32010 range).
46
54
  * These are ggui platform extensions, not part of the core protocol.
55
+ * `-32010`..`-32013` and `-32020` are retired-reserved (SPEC §7.9,
56
+ * ggui#910 / ggui#890): declared once, emitted by nothing first-party —
57
+ * quota, app-limit and concurrency states are refusals or
58
+ * implementation-range codes, and a contract violation is the Plane-2
59
+ * `contract_violation` result or the live channel's `CONTRACT_VIOLATION`
60
+ * frame code, never a JSON-RPC number.
47
61
  */
48
62
  export const PLATFORM_ERROR_CODES = {
49
- GENERATION_QUOTA_EXCEEDED: -32010,
50
- APP_LIMIT_EXCEEDED: -32011,
51
- CONCURRENT_SESSION_LIMIT: -32012,
52
- RATE_LIMIT_EXCEEDED: -32013,
53
- CONTRACT_VIOLATION: -32020,
63
+ /**
64
+ * The generation queue is saturated — the server, not the caller, is
65
+ * the limit (contrast a caller-side rate cap, which is a render-gate
66
+ * REFUSAL — `app_rate_limited` / `issuer_rate_limited`, SPEC §7.1 — the
67
+ * caller slows down; its former numeric `-32013` is retired-reserved,
68
+ * SPEC §7.9, ggui#890). HTTP
69
+ * 503 with `Retry-After`, which governs the retry; a parsed request's
70
+ * refusal, so it speaks this table (ggui#836 follow-up).
71
+ */
72
+ GENERATION_OVERLOADED: -32014,
54
73
  };
@@ -65,8 +65,15 @@
65
65
  * - `owner-api` — an app owner's own billing mutations.
66
66
  * - `provisioning-api` — a tenant provisioning an app on behalf of
67
67
  * its own users.
68
+ * - `mcp-endpoint` — the per-app MCP endpoint's authorization, on
69
+ * any JSON-RPC request (`initialize` included). The refusal rides
70
+ * the JSON-RPC error object's `data.refusal` (HTTP 403, error code
71
+ * `-32003` `APP_NOT_FOUND`, message `App not found` — ggui#836); only the codes listed
72
+ * here are ever typed there, and an authorization failure that is
73
+ * NOT one of them stays a bare 403 by contract, so a client can
74
+ * never learn which of the untyped arms it hit.
68
75
  */
69
- export declare const REFUSAL_SURFACES: readonly ["render-gate", "owner-api", "provisioning-api"];
76
+ export declare const REFUSAL_SURFACES: readonly ["render-gate", "owner-api", "provisioning-api", "mcp-endpoint"];
70
77
  /** One member of {@link REFUSAL_SURFACES}. */
71
78
  export type RefusalSurface = (typeof REFUSAL_SURFACES)[number];
72
79
  /** The closed `retry` vocabulary — see the file header for semantics. */
@@ -95,7 +102,7 @@ declare const REFUSAL_ROWS: {
95
102
  readonly retry: "after-fix";
96
103
  readonly fixBy: "owner";
97
104
  readonly emitter: "a deployment's generation gate, balance arm";
98
- readonly description: "The balance this deployment funds the app from is exhausted. The app owner adds funds, after which the same call succeeds.";
105
+ readonly description: "The balance this deployment funds the render from is at or below zero — pool or BYOK lane alike — so nothing renders under it. The owner adds credit, after which the same call succeeds.";
99
106
  };
100
107
  readonly hard_cap_exceeded: {
101
108
  readonly code: "hard_cap_exceeded";
@@ -104,13 +111,13 @@ declare const REFUSAL_ROWS: {
104
111
  readonly emitter: "a deployment's generation gate, cap arm";
105
112
  readonly description: "The app reached the hard ceiling this deployment set for the current period. Nothing the caller or the owner does lifts it before the period rolls over.";
106
113
  };
107
- readonly model_not_in_tier: {
108
- readonly code: "model_not_in_tier";
114
+ readonly model_not_allowed: {
115
+ readonly code: "model_not_allowed";
109
116
  readonly surfaces: readonly ["render-gate"];
110
117
  readonly retry: "after-fix";
111
118
  readonly fixBy: "caller";
112
119
  readonly emitter: "a deployment's generation gate, model arm";
113
- readonly description: "The requested model is not among those the app is allowed to use. The caller picks an allowed model and retries — the one render-gate state an agent may act on itself.";
120
+ readonly description: "The requested model is not one this account has been granted on this deployment. The caller picks a granted model and retries with the same handshakeId — the one render-gate state an agent may act on itself.";
114
121
  };
115
122
  readonly managed_default_cap_exceeded: {
116
123
  readonly code: "managed_default_cap_exceeded";
@@ -135,30 +142,6 @@ declare const REFUSAL_ROWS: {
135
142
  readonly emitter: "a deployment's provisioning guard and its generation gate, reading the same record";
136
143
  readonly description: "The app record declares a funding mode this deployment does not recognise, or declares none at all. The value is reported as read and never coerced — an unreadable record is not a policy.";
137
144
  };
138
- readonly app_canceled: {
139
- readonly code: "app_canceled";
140
- readonly surfaces: readonly ["render-gate"];
141
- readonly retry: "after-fix";
142
- readonly fixBy: "owner";
143
- readonly emitter: "a deployment's generation gate, plan-state arm";
144
- readonly description: "The app's plan has ended, so it renders nothing while the stored work is kept. The owner starts a new plan to restore rendering.";
145
- };
146
- readonly trial_exhausted: {
147
- readonly code: "trial_exhausted";
148
- readonly surfaces: readonly ["render-gate"];
149
- readonly retry: "after-fix";
150
- readonly fixBy: "owner";
151
- readonly emitter: "a deployment's generation gate, trial arm";
152
- readonly description: "The trial this deployment grants the app has used up its allotment. The owner starts a paid plan.";
153
- };
154
- readonly trial_expired: {
155
- readonly code: "trial_expired";
156
- readonly surfaces: readonly ["render-gate"];
157
- readonly retry: "after-fix";
158
- readonly fixBy: "owner";
159
- readonly emitter: "a deployment's generation gate, trial arm";
160
- readonly description: "The app's trial window has closed. The owner starts a paid plan.";
161
- };
162
145
  readonly issuer_rate_limited: {
163
146
  readonly code: "issuer_rate_limited";
164
147
  readonly surfaces: readonly ["render-gate"];
@@ -175,7 +158,7 @@ declare const REFUSAL_ROWS: {
175
158
  };
176
159
  readonly app_deprovisioned: {
177
160
  readonly code: "app_deprovisioned";
178
- readonly surfaces: readonly ["render-gate"];
161
+ readonly surfaces: readonly ["render-gate", "mcp-endpoint"];
179
162
  readonly retry: "never";
180
163
  readonly emitter: "the generation gate's owner-claim check, before any reservation or metering";
181
164
  readonly description: "The app record has no owner claim any more — either the claim was removed, or the record names no issuing tenant at all. A record with no owner cannot be funded, so nothing renders under it and no caller action restores it.";
@@ -185,16 +168,8 @@ declare const REFUSAL_ROWS: {
185
168
  readonly surfaces: readonly ["render-gate"];
186
169
  readonly retry: "after-fix";
187
170
  readonly fixBy: "owner";
188
- readonly emitter: "the generation gate's fall-through arm: a non-playground identity that resolves to no billing path (not a trial account, not a managed app, not a credit holder)";
189
- readonly description: "The caller has no billing subject on this deployment, so nothing renders under it. The owner provisions one — a trial account, a managed policy, or credit. Unlike `billing_mode_anomaly` — an app record that exists and declares a funding mode this deployment cannot read — no record arm applies here: there is simply no subject to bill. A deployment MAY suppress this refusal by operator override; that switch is deployment policy, not a wire state.";
190
- };
191
- readonly subscription_exists: {
192
- readonly code: "subscription_exists";
193
- readonly surfaces: readonly ["owner-api"];
194
- readonly retry: "after-fix";
195
- readonly fixBy: "owner";
196
- readonly emitter: "a deployment's owner billing mutations";
197
- readonly description: "An active (non-canceled) plan exists on this app. It refuses starting another one AND deleting the app — the refusal's own `fix` names the next step for the action that was called.";
171
+ readonly emitter: "the generation gate's fall-through arm: a non-playground identity that resolves to no billing path (not a managed app, not a credit holder)";
172
+ readonly description: "The caller has no billing subject on this deployment, so nothing renders under it. The owner provisions one — a managed policy, or credit. Unlike `billing_mode_anomaly` — an app record that exists and declares a funding mode this deployment cannot read — no record arm applies here: there is simply no subject to bill. A deployment MAY suppress this refusal by operator override; that switch is deployment policy, not a wire state.";
198
173
  };
199
174
  readonly checkout_unavailable: {
200
175
  readonly code: "checkout_unavailable";
@@ -202,60 +177,7 @@ declare const REFUSAL_ROWS: {
202
177
  readonly retry: "later";
203
178
  readonly fixBy: "operator";
204
179
  readonly emitter: "a deployment's owner billing mutations";
205
- readonly description: "The surface that starts a plan is unavailable on this deployment right now — unconfigured, or its provider is down. Only the operator can restore it.";
206
- };
207
- readonly card_update_unavailable: {
208
- readonly code: "card_update_unavailable";
209
- readonly surfaces: readonly ["owner-api"];
210
- readonly retry: "later";
211
- readonly fixBy: "operator";
212
- readonly emitter: "a deployment's owner billing mutations";
213
- readonly description: "The surface that updates a payment method is unavailable on this deployment right now. Only the operator can restore it.";
214
- };
215
- readonly portal_unavailable: {
216
- readonly code: "portal_unavailable";
217
- readonly surfaces: readonly ["owner-api"];
218
- readonly retry: "later";
219
- readonly fixBy: "operator";
220
- readonly emitter: "a deployment's owner billing mutations";
221
- readonly description: "The self-service billing surface is unavailable on this deployment right now. Only the operator can restore it.";
222
- };
223
- readonly no_subscription: {
224
- readonly code: "no_subscription";
225
- readonly surfaces: readonly ["owner-api"];
226
- readonly retry: "after-fix";
227
- readonly fixBy: "owner";
228
- readonly emitter: "a deployment's owner billing mutations";
229
- readonly description: "A plan-management action was called on an app that has no plan. The owner starts a plan first.";
230
- };
231
- readonly already_on_tier: {
232
- readonly code: "already_on_tier";
233
- readonly surfaces: readonly ["owner-api"];
234
- readonly retry: "after-fix";
235
- readonly fixBy: "owner";
236
- readonly emitter: "a deployment's owner billing mutations";
237
- readonly description: "The plan requested is the one the app is already on. The owner picks a different plan.";
238
- };
239
- readonly managed_app_no_checkout: {
240
- readonly code: "managed_app_no_checkout";
241
- readonly surfaces: readonly ["owner-api"];
242
- readonly retry: "never";
243
- readonly emitter: "a deployment's owner billing mutations";
244
- readonly description: "This app is funded by the tenant that provisioned it, so it has no owner-facing plan surface at all. No owner action creates one.";
245
- };
246
- readonly managed_app_no_card_update: {
247
- readonly code: "managed_app_no_card_update";
248
- readonly surfaces: readonly ["owner-api"];
249
- readonly retry: "never";
250
- readonly emitter: "a deployment's owner billing mutations";
251
- readonly description: "This app is funded by the tenant that provisioned it, so it carries no owner payment method to update.";
252
- };
253
- readonly managed_app_no_portal: {
254
- readonly code: "managed_app_no_portal";
255
- readonly surfaces: readonly ["owner-api"];
256
- readonly retry: "never";
257
- readonly emitter: "a deployment's owner billing mutations";
258
- readonly description: "This app is funded by the tenant that provisioned it, so it has no owner self-service billing surface.";
180
+ readonly description: "The surface that adds credit (a top-up) is unavailable on this deployment right now — unconfigured, or its provider is down. Only the operator can restore it.";
259
181
  };
260
182
  readonly owner_ref_mismatch: {
261
183
  readonly code: "owner_ref_mismatch";
@@ -294,6 +216,15 @@ export interface RefusalRow {
294
216
  }
295
217
  /** The registry consumers read. */
296
218
  export declare const PRE_GENERATION_REFUSAL_CODES: Readonly<Record<RefusalCode, RefusalRow>>;
219
+ /**
220
+ * The SAME registry object with its per-key literal types kept
221
+ * (ggui#889): `PRE_GENERATION_REFUSAL_ROWS.app_rate_limited.code` is
222
+ * `'app_rate_limited'`, its `retry` is `'later'`. The normalized view
223
+ * above erases those literals so `fixBy` reads uniformly; a producer
224
+ * that must satisfy a wire enum from a row (the registry-purity pin
225
+ * forbids the literal in source) reads it here — no parse, no literal.
226
+ */
227
+ export declare const PRE_GENERATION_REFUSAL_ROWS: typeof REFUSAL_ROWS;
297
228
  /**
298
229
  * The codes on one surface, derived type-level from the literal rows'
299
230
  * `surfaces` tuples. A runtime `.filter()` cannot narrow a type, so the
@@ -310,10 +241,38 @@ type CodesOnSurface<S extends RefusalSurface> = {
310
241
  * render wire.
311
242
  */
312
243
  export type PreGenerationRefusalCode = CodesOnSurface<'render-gate'>;
244
+ /**
245
+ * A code that can appear in a per-app MCP endpoint refusal's
246
+ * `error.data.refusal.code` — i.e. one whose `surfaces` include
247
+ * `mcp-endpoint` (ggui#825). Derived, so a render-gate-only code is not
248
+ * expressible on the transport wire.
249
+ */
250
+ export type McpEndpointRefusalCode = CodesOnSurface<'mcp-endpoint'>;
313
251
  /**
314
252
  * Every render-gate code, as the literal tuple the wire enum
315
253
  * (`renderRefusalSchema.code`) is built from. Order is the registry's.
316
254
  */
317
- export declare const RENDER_GATE_REFUSAL_CODES: readonly ["unsupported_provider", "insufficient_credit", "hard_cap_exceeded", "model_not_in_tier", "managed_default_cap_exceeded", "app_policy_missing", "billing_mode_anomaly", "billing_path_missing", "app_canceled", "trial_exhausted", "trial_expired", "issuer_rate_limited", "app_rate_limited", "app_deprovisioned"];
255
+ export declare const RENDER_GATE_REFUSAL_CODES: readonly ["unsupported_provider", "insufficient_credit", "hard_cap_exceeded", "model_not_allowed", "managed_default_cap_exceeded", "app_policy_missing", "billing_mode_anomaly", "billing_path_missing", "issuer_rate_limited", "app_rate_limited", "app_deprovisioned"];
256
+ /**
257
+ * Every mcp-endpoint code, as the literal tuple the transport wire enum
258
+ * (`transportRefusalSchema.code`) is built from — the refusals a per-app
259
+ * MCP endpoint's authorization types on `error.data.refusal`
260
+ * (ggui#825). Order is the registry's.
261
+ */
262
+ export declare const MCP_ENDPOINT_REFUSAL_CODES: readonly ["app_deprovisioned"];
263
+ /**
264
+ * A code an owner-API billing mutation may refuse with — i.e. one whose
265
+ * `surfaces` include `owner-api`. Derived, so a render-gate code is not
266
+ * expressible on an owner-API refusal. Registry v11 (ggui#960): the
267
+ * plan-era owner-api rows retired with the plan model; one owner billing
268
+ * surface remains — adding credit.
269
+ */
270
+ export type OwnerApiRefusalCode = CodesOnSurface<'owner-api'>;
271
+ /**
272
+ * Every owner-api code, as the literal tuple a backend's owner-API
273
+ * refusal helper types its `code` from (ggui#960). Order is the
274
+ * registry's.
275
+ */
276
+ export declare const OWNER_API_REFUSAL_CODES: readonly ["checkout_unavailable"];
318
277
  export {};
319
278
  //# sourceMappingURL=refusal-codes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refusal-codes.d.ts","sourceRoot":"","sources":["../../src/types/refusal-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,2DAInB,CAAC;AAEX,8CAA8C;AAC9C,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,yEAAyE;AACzE,eAAO,MAAM,eAAe,yDAKlB,CAAC;AAEX,6CAA6C;AAC7C,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,cAAc,oDAAqD,CAAC;AAEjF,4CAA4C;AAC5C,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAiD3D,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqOhB,CAAC;AAEH,qEAAqE;AACrE,MAAM,MAAM,WAAW,GAAG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;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAkBpE;;;GAGG;AACH,eAAO,MAAM,yBAAyB,0QAYpC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,gCAErC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,mCAElC,CAAC"}
@@ -65,11 +65,19 @@
65
65
  * - `owner-api` — an app owner's own billing mutations.
66
66
  * - `provisioning-api` — a tenant provisioning an app on behalf of
67
67
  * its own users.
68
+ * - `mcp-endpoint` — the per-app MCP endpoint's authorization, on
69
+ * any JSON-RPC request (`initialize` included). The refusal rides
70
+ * the JSON-RPC error object's `data.refusal` (HTTP 403, error code
71
+ * `-32003` `APP_NOT_FOUND`, message `App not found` — ggui#836); only the codes listed
72
+ * here are ever typed there, and an authorization failure that is
73
+ * NOT one of them stays a bare 403 by contract, so a client can
74
+ * never learn which of the untyped arms it hit.
68
75
  */
69
76
  export const REFUSAL_SURFACES = [
70
77
  'render-gate',
71
78
  'owner-api',
72
79
  'provisioning-api',
80
+ 'mcp-endpoint',
73
81
  ];
74
82
  /** The closed `retry` vocabulary — see the file header for semantics. */
75
83
  export const REFUSAL_RETRIES = [
@@ -83,6 +91,22 @@ export const REFUSAL_RETRIES = [
83
91
  * itself — see the no-auto-retry rule in the file header.
84
92
  */
85
93
  export const REFUSAL_FIX_BY = ['caller', 'owner', 'tenant', 'operator'];
94
+ /**
95
+ * Registry v11 (ggui#960, 2026-09-08) — the plan model is retired: a
96
+ * deployment funds renders from a credit balance at flat rates, and the
97
+ * states that only a plan, a trial or a subscription could produce no
98
+ * longer exist. Retired with their emitting arms, in the same slice:
99
+ * render-gate `trial_exhausted`, `trial_expired`, `app_canceled`;
100
+ * owner-api `subscription_exists`, `no_subscription`,
101
+ * `subscription_unchanged`, `portal_unavailable`, `card_update_unavailable`,
102
+ * `managed_app_no_portal`, `managed_app_no_card_update`,
103
+ * `managed_app_no_checkout` (the top-up mutation is user-scoped — no
104
+ * managed branch exists to refuse from). Re-described: `billing_path_missing`
105
+ * (off the trial), `model_not_allowed` (per-account grant),
106
+ * `checkout_unavailable` (adding credit), `insufficient_credit` (pool or
107
+ * BYOK — the BYOK lane is charged). `managed_default_cap_exceeded` is NOT in this
108
+ * bump: unemitted since N1's swap but federated-side (ggui#965).
109
+ */
86
110
  /**
87
111
  * The registry is the ONLY list of refusal codes: {@link RefusalCode}
88
112
  * is derived from the keys below, and this definer forces every row's
@@ -112,7 +136,7 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
112
136
  retry: 'after-fix',
113
137
  fixBy: 'owner',
114
138
  emitter: "a deployment's generation gate, balance arm",
115
- description: 'The balance this deployment funds the app from is exhausted. The app owner adds funds, after which the same call succeeds.',
139
+ description: "The balance this deployment funds the render from is at or below zero — pool or BYOK lane alike — so nothing renders under it. The owner adds credit, after which the same call succeeds.",
116
140
  },
117
141
  hard_cap_exceeded: {
118
142
  code: 'hard_cap_exceeded',
@@ -121,13 +145,13 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
121
145
  emitter: "a deployment's generation gate, cap arm",
122
146
  description: 'The app reached the hard ceiling this deployment set for the current period. Nothing the caller or the owner does lifts it before the period rolls over.',
123
147
  },
124
- model_not_in_tier: {
125
- code: 'model_not_in_tier',
148
+ model_not_allowed: {
149
+ code: 'model_not_allowed',
126
150
  surfaces: ['render-gate'],
127
151
  retry: 'after-fix',
128
152
  fixBy: 'caller',
129
153
  emitter: "a deployment's generation gate, model arm",
130
- description: 'The requested model is not among those the app is allowed to use. The caller picks an allowed model and retries — the one render-gate state an agent may act on itself.',
154
+ description: 'The requested model is not one this account has been granted on this deployment. The caller picks a granted model and retries with the same handshakeId — the one render-gate state an agent may act on itself.',
131
155
  },
132
156
  managed_default_cap_exceeded: {
133
157
  code: 'managed_default_cap_exceeded',
@@ -155,30 +179,6 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
155
179
  emitter: "a deployment's provisioning guard and its generation gate, reading the same record",
156
180
  description: 'The app record declares a funding mode this deployment does not recognise, or declares none at all. The value is reported as read and never coerced — an unreadable record is not a policy.',
157
181
  },
158
- app_canceled: {
159
- code: 'app_canceled',
160
- surfaces: ['render-gate'],
161
- retry: 'after-fix',
162
- fixBy: 'owner',
163
- emitter: "a deployment's generation gate, plan-state arm",
164
- description: "The app's plan has ended, so it renders nothing while the stored work is kept. The owner starts a new plan to restore rendering.",
165
- },
166
- trial_exhausted: {
167
- code: 'trial_exhausted',
168
- surfaces: ['render-gate'],
169
- retry: 'after-fix',
170
- fixBy: 'owner',
171
- emitter: "a deployment's generation gate, trial arm",
172
- description: 'The trial this deployment grants the app has used up its allotment. The owner starts a paid plan.',
173
- },
174
- trial_expired: {
175
- code: 'trial_expired',
176
- surfaces: ['render-gate'],
177
- retry: 'after-fix',
178
- fixBy: 'owner',
179
- emitter: "a deployment's generation gate, trial arm",
180
- description: "The app's trial window has closed. The owner starts a paid plan.",
181
- },
182
182
  issuer_rate_limited: {
183
183
  code: 'issuer_rate_limited',
184
184
  surfaces: ['render-gate'],
@@ -195,7 +195,7 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
195
195
  },
196
196
  app_deprovisioned: {
197
197
  code: 'app_deprovisioned',
198
- surfaces: ['render-gate'],
198
+ surfaces: ['render-gate', 'mcp-endpoint'],
199
199
  retry: 'never',
200
200
  emitter: "the generation gate's owner-claim check, before any reservation or metering",
201
201
  description: 'The app record has no owner claim any more \u2014 either the claim was removed, or the record names no issuing tenant at all. A record with no owner cannot be funded, so nothing renders under it and no caller action restores it.',
@@ -205,78 +205,17 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
205
205
  surfaces: ['render-gate'],
206
206
  retry: 'after-fix',
207
207
  fixBy: 'owner',
208
- emitter: "the generation gate's fall-through arm: a non-playground identity that resolves to no billing path (not a trial account, not a managed app, not a credit holder)",
209
- description: 'The caller has no billing subject on this deployment, so nothing renders under it. The owner provisions one — a trial account, a managed policy, or credit. Unlike `billing_mode_anomaly` — an app record that exists and declares a funding mode this deployment cannot read — no record arm applies here: there is simply no subject to bill. A deployment MAY suppress this refusal by operator override; that switch is deployment policy, not a wire state.',
208
+ emitter: "the generation gate's fall-through arm: a non-playground identity that resolves to no billing path (not a managed app, not a credit holder)",
209
+ description: "The caller has no billing subject on this deployment, so nothing renders under it. The owner provisions one — a managed policy, or credit. Unlike `billing_mode_anomaly` — an app record that exists and declares a funding mode this deployment cannot read — no record arm applies here: there is simply no subject to bill. A deployment MAY suppress this refusal by operator override; that switch is deployment policy, not a wire state.",
210
210
  },
211
211
  // ── owner-api ─────────────────────────────────────────────────────
212
- subscription_exists: {
213
- code: 'subscription_exists',
214
- surfaces: ['owner-api'],
215
- retry: 'after-fix',
216
- fixBy: 'owner',
217
- emitter: "a deployment's owner billing mutations",
218
- description: "An active (non-canceled) plan exists on this app. It refuses starting another one AND deleting the app — the refusal's own `fix` names the next step for the action that was called.",
219
- },
220
212
  checkout_unavailable: {
221
213
  code: 'checkout_unavailable',
222
214
  surfaces: ['owner-api'],
223
215
  retry: 'later',
224
216
  fixBy: 'operator',
225
217
  emitter: "a deployment's owner billing mutations",
226
- description: 'The surface that starts a plan is unavailable on this deployment right now — unconfigured, or its provider is down. Only the operator can restore it.',
227
- },
228
- card_update_unavailable: {
229
- code: 'card_update_unavailable',
230
- surfaces: ['owner-api'],
231
- retry: 'later',
232
- fixBy: 'operator',
233
- emitter: "a deployment's owner billing mutations",
234
- description: 'The surface that updates a payment method is unavailable on this deployment right now. Only the operator can restore it.',
235
- },
236
- portal_unavailable: {
237
- code: 'portal_unavailable',
238
- surfaces: ['owner-api'],
239
- retry: 'later',
240
- fixBy: 'operator',
241
- emitter: "a deployment's owner billing mutations",
242
- description: "The self-service billing surface is unavailable on this deployment right now. Only the operator can restore it.",
243
- },
244
- no_subscription: {
245
- code: 'no_subscription',
246
- surfaces: ['owner-api'],
247
- retry: 'after-fix',
248
- fixBy: 'owner',
249
- emitter: "a deployment's owner billing mutations",
250
- description: 'A plan-management action was called on an app that has no plan. The owner starts a plan first.',
251
- },
252
- already_on_tier: {
253
- code: 'already_on_tier',
254
- surfaces: ['owner-api'],
255
- retry: 'after-fix',
256
- fixBy: 'owner',
257
- emitter: "a deployment's owner billing mutations",
258
- description: 'The plan requested is the one the app is already on. The owner picks a different plan.',
259
- },
260
- managed_app_no_checkout: {
261
- code: 'managed_app_no_checkout',
262
- surfaces: ['owner-api'],
263
- retry: 'never',
264
- emitter: "a deployment's owner billing mutations",
265
- description: 'This app is funded by the tenant that provisioned it, so it has no owner-facing plan surface at all. No owner action creates one.',
266
- },
267
- managed_app_no_card_update: {
268
- code: 'managed_app_no_card_update',
269
- surfaces: ['owner-api'],
270
- retry: 'never',
271
- emitter: "a deployment's owner billing mutations",
272
- description: 'This app is funded by the tenant that provisioned it, so it carries no owner payment method to update.',
273
- },
274
- managed_app_no_portal: {
275
- code: 'managed_app_no_portal',
276
- surfaces: ['owner-api'],
277
- retry: 'never',
278
- emitter: "a deployment's owner billing mutations",
279
- description: 'This app is funded by the tenant that provisioned it, so it has no owner self-service billing surface.',
218
+ description: 'The surface that adds credit (a top-up) is unavailable on this deployment right now — unconfigured, or its provider is down. Only the operator can restore it.',
280
219
  },
281
220
  // ── provisioning-api ──────────────────────────────────────────────
282
221
  owner_ref_mismatch: {
@@ -299,31 +238,54 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
299
238
  /** The registry consumers read. */
300
239
  export const PRE_GENERATION_REFUSAL_CODES = REFUSAL_ROWS;
301
240
  /**
302
- * Identity helper that only accepts an EXHAUSTIVE tuple of the
303
- * render-gate codes: omit one and the parameter type collapses to
304
- * `never`, so the call site is a compile error. A tuple is needed
305
- * because the wire enum requires a literal, non-empty tuple — a
306
- * runtime filter over the rows yields `string[]`, which cannot type an
307
- * enum. This keeps the tuple derived-CHECKED rather than a second list.
241
+ * The SAME registry object with its per-key literal types kept
242
+ * (ggui#889): `PRE_GENERATION_REFUSAL_ROWS.app_rate_limited.code` is
243
+ * `'app_rate_limited'`, its `retry` is `'later'`. The normalized view
244
+ * above erases those literals so `fixBy` reads uniformly; a producer
245
+ * that must satisfy a wire enum from a row (the registry-purity pin
246
+ * forbids the literal in source) reads it here — no parse, no literal.
247
+ */
248
+ export const PRE_GENERATION_REFUSAL_ROWS = REFUSAL_ROWS;
249
+ /**
250
+ * Identity helper that only accepts an EXHAUSTIVE tuple of one surface's
251
+ * codes: omit one and the parameter type collapses to `never`, so the
252
+ * call site is a compile error. A tuple is needed because a wire enum
253
+ * requires a literal, non-empty tuple — a runtime filter over the rows
254
+ * yields `string[]`, which cannot type an enum. This keeps every
255
+ * per-surface tuple derived-CHECKED rather than a second list.
308
256
  */
309
- const exhaustiveRenderGateCodes = (codes) => codes;
257
+ const exhaustiveCodesOn = () => (codes) => codes;
310
258
  /**
311
259
  * Every render-gate code, as the literal tuple the wire enum
312
260
  * (`renderRefusalSchema.code`) is built from. Order is the registry's.
313
261
  */
314
- export const RENDER_GATE_REFUSAL_CODES = exhaustiveRenderGateCodes([
262
+ export const RENDER_GATE_REFUSAL_CODES = exhaustiveCodesOn()([
315
263
  'unsupported_provider',
316
264
  'insufficient_credit',
317
265
  'hard_cap_exceeded',
318
- 'model_not_in_tier',
266
+ 'model_not_allowed',
319
267
  'managed_default_cap_exceeded',
320
268
  'app_policy_missing',
321
269
  'billing_mode_anomaly',
322
270
  'billing_path_missing',
323
- 'app_canceled',
324
- 'trial_exhausted',
325
- 'trial_expired',
326
271
  'issuer_rate_limited',
327
272
  'app_rate_limited',
328
273
  'app_deprovisioned',
329
274
  ]);
275
+ /**
276
+ * Every mcp-endpoint code, as the literal tuple the transport wire enum
277
+ * (`transportRefusalSchema.code`) is built from — the refusals a per-app
278
+ * MCP endpoint's authorization types on `error.data.refusal`
279
+ * (ggui#825). Order is the registry's.
280
+ */
281
+ export const MCP_ENDPOINT_REFUSAL_CODES = exhaustiveCodesOn()([
282
+ 'app_deprovisioned',
283
+ ]);
284
+ /**
285
+ * Every owner-api code, as the literal tuple a backend's owner-API
286
+ * refusal helper types its `code` from (ggui#960). Order is the
287
+ * registry's.
288
+ */
289
+ export const OWNER_API_REFUSAL_CODES = exhaustiveCodesOn()([
290
+ 'checkout_unavailable',
291
+ ]);
@@ -1,10 +1,11 @@
1
- import type { KNOWN_PERMISSION_NAMES } from '../validation/hygiene-rules';
2
- import type { PropsSpec, StreamSpec, ActionSpec, ContextSpec, ClientCapabilitiesSpec, GadgetDescriptor, JsonSchema, JsonObject } from './data-contract';
3
- import type { EndUserIdentity } from './auth';
4
- import type { HostContextProjection } from './host-context';
5
- import type { AppTheme } from '../schemas/app-theme';
6
- import type { RenderErrorCode } from '../schemas/mcp';
7
- import type { McpAppsGguiSession } from '../integrations/mcp-apps';
1
+ import type { KNOWN_PERMISSION_NAMES } from '../validation/hygiene-rules.js';
2
+ import type { PropsSpec, StreamSpec, ActionSpec, ContextSpec, ClientCapabilitiesSpec, GadgetDescriptor, JsonSchema, JsonObject } from './data-contract.js';
3
+ import type { EndUserIdentity } from './auth.js';
4
+ import type { HostContextProjection } from './host-context.js';
5
+ import type { AppTheme } from '../schemas/app-theme.js';
6
+ import type { z } from 'zod';
7
+ import type { RenderErrorCode, gguiSessionStatusSchema } from '../schemas/mcp.js';
8
+ import type { McpAppsGguiSession } from '../integrations/mcp-apps.js';
8
9
  /**
9
10
  * Recognised system-card kinds the runtime renders via built-in
10
11
  * components. The wire is open-ended (string), but new kinds without a
@@ -42,10 +43,10 @@ export type AdapterPermissions = {
42
43
  * in the earlier handshake collapse. The companion `ggui_close` tool
43
44
  * that wrote it was removed in the same slice.
44
45
  */
45
- export type GguiSessionStatus = 'active' | 'expired';
46
+ export type GguiSessionStatus = z.infer<typeof gguiSessionStatusSchema>;
46
47
  /**
47
48
  * Common base for every {@link GguiSession} variant. Carries identity,
48
- * tenancy, lifecycle, and conversation-scoped context that every
49
+ * app scope, lifecycle, and conversation-scoped context that every
49
50
  * rendered thing has regardless of how its visible bits are
50
51
  * produced (LLM-generated component, server-emitted system card,
51
52
  * embedded MCP-App iframe).
@@ -61,7 +62,7 @@ export interface GguiSessionBase {
61
62
  /** GguiSession identity. The value an iframe's bootstrap meta and every
62
63
  * wire reference (props_update, consume, update) keys by. */
63
64
  readonly id: string;
64
- /** App identity (tenancy boundary, always per-render). */
65
+ /** App identity (the app-scope boundary, always per-render). */
65
66
  readonly appId: string;
66
67
  /** Authenticated end-user (after the auth gate). Absent for anon
67
68
  * flows. */
@@ -142,7 +143,7 @@ export interface GguiSessionBase {
142
143
  /**
143
144
  * `GguiSession` — the canonical protocol shape for a single rendered UI.
144
145
  *
145
- * Three variants share {@link GguiSessionBase} (identity, tenancy,
146
+ * Three variants share {@link GguiSessionBase} (identity, app scope,
146
147
  * lifecycle); each variant adds its own visible-bits surface:
147
148
  *
148
149
  * - {@link ComponentGguiSession} — LLM-generated / native React component.
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/types/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,sBAAsB,EACtB,gBAAgB,EAChB,UAAU,EACV,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,E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C,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;IACrD;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACzD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;IAC1B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC;CACvC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU,CACvE,SAAQ,eAAe;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,gDAAgD;IAChD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAMD;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB,CAAC,SAAS,GAAG,UAAU;IACtD,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -1,4 +1,4 @@
1
- import type { DataContract, JsonObject, JsonSchema, JsonValue } from './data-contract';
1
+ import type { DataContract, JsonObject, JsonSchema, JsonValue } from './data-contract.js';
2
2
  /**
3
3
  * Request to generate a UI component.
4
4
  * Generic `TContext` defaults to {@link JsonObject} for generator context hints.
@@ -50,8 +50,8 @@ import type { ErrorObject, ValidateFunction } from 'ajv';
50
50
  * dependency — TS resolves the type transitively through this package.
51
51
  */
52
52
  export type { ValidateFunction } from 'ajv';
53
- import type { JsonSchema } from '../types/data-contract';
54
- import type { ContractViolation } from './contract-validator';
53
+ import type { JsonSchema } from '../types/data-contract.js';
54
+ import type { ContractViolation } from './contract-validator.js';
55
55
  /**
56
56
  * Recursively walk a JSON Schema and inject
57
57
  * `additionalProperties: false` at every object node. Authors who