@ggui-ai/protocol 0.13.0 → 0.15.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 (85) hide show
  1. package/dist/envelope-adapters.d.ts +1 -14
  2. package/dist/envelope-adapters.d.ts.map +1 -1
  3. package/dist/envelope-adapters.js +17 -1
  4. package/dist/envelopes/render-refusal.d.ts +49 -0
  5. package/dist/envelopes/render-refusal.d.ts.map +1 -0
  6. package/dist/envelopes/render-refusal.js +12 -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 +67 -60
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +10 -0
  13. package/dist/integrations/mcp-apps.d.ts +4 -10
  14. package/dist/integrations/mcp-apps.d.ts.map +1 -1
  15. package/dist/schemas/app-theme.d.ts +5 -0
  16. package/dist/schemas/app-theme.d.ts.map +1 -1
  17. package/dist/schemas/app-theme.js +23 -0
  18. package/dist/schemas/blueprint.d.ts +2 -2
  19. package/dist/schemas/data-contract.d.ts +12 -30
  20. package/dist/schemas/data-contract.d.ts.map +1 -1
  21. package/dist/schemas/data-contract.js +6 -27
  22. package/dist/schemas/interface-context.d.ts +44 -0
  23. package/dist/schemas/interface-context.d.ts.map +1 -0
  24. package/dist/schemas/interface-context.js +22 -0
  25. package/dist/schemas/invoke.d.ts +1 -1
  26. package/dist/schemas/invoke.js +1 -1
  27. package/dist/schemas/mcp.d.ts +636 -69
  28. package/dist/schemas/mcp.d.ts.map +1 -1
  29. package/dist/schemas/mcp.js +554 -47
  30. package/dist/schemas/public-env-key.d.ts +26 -0
  31. package/dist/schemas/public-env-key.d.ts.map +1 -0
  32. package/dist/schemas/public-env-key.js +25 -0
  33. package/dist/schemas/render-input-envelope.d.ts +20 -0
  34. package/dist/schemas/render-input-envelope.d.ts.map +1 -0
  35. package/dist/schemas/render-input-envelope.js +56 -0
  36. package/dist/schemas/runtime-telemetry-limits.d.ts +11 -0
  37. package/dist/schemas/runtime-telemetry-limits.d.ts.map +1 -0
  38. package/dist/schemas/runtime-telemetry-limits.js +10 -0
  39. package/dist/transport/websocket.d.ts +5 -5
  40. package/dist/types/auth.d.ts +1 -1
  41. package/dist/types/contract-inference.d.ts +1 -1
  42. package/dist/types/events.d.ts +1 -1
  43. package/dist/types/ggui-session-event.d.ts +4 -5
  44. package/dist/types/ggui-session-event.d.ts.map +1 -1
  45. package/dist/types/ggui-session-event.js +0 -37
  46. package/dist/types/host-context.d.ts +18 -17
  47. package/dist/types/host-context.d.ts.map +1 -1
  48. package/dist/types/host-context.js +7 -0
  49. package/dist/types/interface-context.d.ts +1 -1
  50. package/dist/types/invoke.d.ts +1 -1
  51. package/dist/types/lifecycle.d.ts +1 -1
  52. package/dist/types/live-channel.d.ts +2 -2
  53. package/dist/types/llm-route.d.ts +2 -2
  54. package/dist/types/llm-route.d.ts.map +1 -1
  55. package/dist/types/llm-route.js +11 -3
  56. package/dist/types/llm.d.ts +397 -7
  57. package/dist/types/llm.d.ts.map +1 -1
  58. package/dist/types/llm.js +111 -10
  59. package/dist/types/mcp.d.ts +31 -111
  60. package/dist/types/mcp.d.ts.map +1 -1
  61. package/dist/types/mcp.js +7 -0
  62. package/dist/types/readonly.d.ts +11 -0
  63. package/dist/types/readonly.d.ts.map +1 -0
  64. package/dist/types/readonly.js +1 -0
  65. package/dist/types/refusal-codes.d.ts +340 -0
  66. package/dist/types/refusal-codes.d.ts.map +1 -0
  67. package/dist/types/refusal-codes.js +346 -0
  68. package/dist/types/render.d.ts +9 -8
  69. package/dist/types/render.d.ts.map +1 -1
  70. package/dist/types/ui-generator.d.ts +1 -1
  71. package/dist/validation/ajv-runtime.d.ts +2 -2
  72. package/dist/validation/contract-validator.d.ts +6 -6
  73. package/dist/validation/cross-references.d.ts +2 -2
  74. package/dist/validation/hygiene-rules.d.ts +1 -1
  75. package/dist/validation/name-invariants.d.ts +2 -2
  76. package/dist/validation/reserved-channels.d.ts +1 -1
  77. package/dist/validation/schema-compat-invariants.d.ts +2 -2
  78. package/dist/validation/schema-meta-validation.d.ts +1 -1
  79. package/dist/version.d.ts +201 -5
  80. package/dist/version.d.ts.map +1 -1
  81. package/dist/version.js +200 -4
  82. package/dist/wire.d.ts +45 -0
  83. package/dist/wire.d.ts.map +1 -0
  84. package/dist/wire.js +44 -0
  85. package/package.json +13 -3
@@ -0,0 +1,346 @@
1
+ /**
2
+ * `PRE_GENERATION_REFUSAL_CODES` — the closed registry of refusal codes
3
+ * (ggui#786).
4
+ *
5
+ * A **pre-generation refusal** is a deployment declining a call BEFORE
6
+ * it does any work: no state read, nothing committed, no model spend.
7
+ * (The call has already passed the SDK's check against the declared
8
+ * `inputSchema`; the claim is nothing READ, not nothing validated.)
9
+ * It is a third outcome, not a failure — a failure describes work
10
+ * that ran and did not produce a result. The wire shape
11
+ * of a refused render lives in `../schemas/mcp.ts`
12
+ * (`renderRefusalSchema`); this file owns the NAMES.
13
+ *
14
+ * ## Why one file
15
+ *
16
+ * The registry is the anti-drift mechanism: one `code` namespace across
17
+ * every surface a deployment can refuse on, so two names can never mean
18
+ * the same state and one name can never mean two. Emitters read a row
19
+ * from here; they never mint a code literal of their own. A code that
20
+ * is not in this file fails the wire enum at the transport, loudly — a
21
+ * bug, never a wire state.
22
+ *
23
+ * ## The rules every row obeys
24
+ *
25
+ * - **Name the STATE, not the verb.** `subscription_exists`, not
26
+ * `cannot_create_subscription`: the same state may refuse more than
27
+ * one action later, and the code must not encode which.
28
+ * - **One state, one code.** Two codes never share a name; one code MAY
29
+ * list several `surfaces` when a single state surfaces in more than
30
+ * one place (`billing_mode_anomaly`).
31
+ * - **`retry` is defined from the CALLER's side.** `after-fix` — a
32
+ * named party can act and the SAME call then succeeds; `next-period`
33
+ * — time restores it at the next period boundary; `later` —
34
+ * unbounded time (transient unavailability); `never` — no action by
35
+ * the caller restores the call under this identity.
36
+ * - **`fixBy` names WHO acts.** REQUIRED on every `after-fix` row;
37
+ * PERMITTED on a `later` row (naming the operator who restores a
38
+ * surface that is transiently unavailable); FORBIDDEN on
39
+ * `next-period` and `never` — time restores the first and nothing
40
+ * restores the second, so naming a party would be a lie about who
41
+ * can act. **An agent MUST NOT auto-retry an `after-fix` refusal
42
+ * whose `fixBy` is not `caller`** — otherwise "retry after fix"
43
+ * would mean "perform someone else's billing or policy decision on
44
+ * their behalf". `caller` is the only value an agent may act on
45
+ * itself.
46
+ * - **`emitter` is named.** A row whose emitter is unrecorded is the
47
+ * drift the registry exists to prevent.
48
+ *
49
+ * ## Reading this file as a self-hoster
50
+ *
51
+ * Every `description` here ships to npm, and the render-gate subset
52
+ * reaches an agent as JSON-Schema metadata through `tools/list`. The
53
+ * wording is therefore written from the DEPLOYMENT-POLICY perspective
54
+ * ("the allowance this deployment configured for the app is
55
+ * exhausted"), never from an operator's internal vocabulary. A
56
+ * deployment that configures none of these policies emits none of these
57
+ * codes; the registry is the vocabulary, not a mandate.
58
+ */
59
+ /**
60
+ * The surfaces a refusal code may be emitted on.
61
+ *
62
+ * - `render-gate` — the pre-generation gate on the render/mutation
63
+ * tools. These are the only codes that can appear in a refused
64
+ * tool result's `refusal.code`.
65
+ * - `owner-api` — an app owner's own billing mutations.
66
+ * - `provisioning-api` — a tenant provisioning an app on behalf of
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.
75
+ */
76
+ export const REFUSAL_SURFACES = [
77
+ 'render-gate',
78
+ 'owner-api',
79
+ 'provisioning-api',
80
+ 'mcp-endpoint',
81
+ ];
82
+ /** The closed `retry` vocabulary — see the file header for semantics. */
83
+ export const REFUSAL_RETRIES = [
84
+ 'after-fix',
85
+ 'next-period',
86
+ 'later',
87
+ 'never',
88
+ ];
89
+ /**
90
+ * Who can act on an `after-fix` refusal. Only `caller` is the agent
91
+ * itself — see the no-auto-retry rule in the file header.
92
+ */
93
+ export const REFUSAL_FIX_BY = ['caller', 'owner', 'tenant', 'operator'];
94
+ /**
95
+ * The registry is the ONLY list of refusal codes: {@link RefusalCode}
96
+ * is derived from the keys below, and this definer forces every row's
97
+ * `code` to equal its key at the type level. The `const` type parameter
98
+ * preserves each `surfaces` list as a literal tuple, which is what lets
99
+ * {@link PreGenerationRefusalCode} be derived per surface rather than
100
+ * written down a second time.
101
+ *
102
+ * Same posture as `defineModelRegistry` in `./llm.ts`.
103
+ */
104
+ function defineRefusalRegistry(rows) {
105
+ return rows;
106
+ }
107
+ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
108
+ // ── render-gate ───────────────────────────────────────────────────
109
+ unsupported_provider: {
110
+ code: 'unsupported_provider',
111
+ surfaces: ['render-gate'],
112
+ retry: 'after-fix',
113
+ fixBy: 'owner',
114
+ emitter: "a deployment's generation gate, provider arm",
115
+ description: 'The provider behind the requested model is not one this deployment can fund for the app. The app owner picks a funded provider or configures the app with its own credentials.',
116
+ },
117
+ insufficient_credit: {
118
+ code: 'insufficient_credit',
119
+ surfaces: ['render-gate'],
120
+ retry: 'after-fix',
121
+ fixBy: 'owner',
122
+ emitter: "a deployment's generation gate, balance arm",
123
+ description: 'The balance this deployment funds the app from is exhausted. The app owner adds funds, after which the same call succeeds.',
124
+ },
125
+ hard_cap_exceeded: {
126
+ code: 'hard_cap_exceeded',
127
+ surfaces: ['render-gate'],
128
+ retry: 'next-period',
129
+ emitter: "a deployment's generation gate, cap arm",
130
+ 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.',
131
+ },
132
+ model_not_in_tier: {
133
+ code: 'model_not_in_tier',
134
+ surfaces: ['render-gate'],
135
+ retry: 'after-fix',
136
+ fixBy: 'caller',
137
+ emitter: "a deployment's generation gate, model arm",
138
+ 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.',
139
+ },
140
+ managed_default_cap_exceeded: {
141
+ code: 'managed_default_cap_exceeded',
142
+ surfaces: ['render-gate'],
143
+ retry: 'after-fix',
144
+ fixBy: 'tenant',
145
+ emitter: "a deployment's generation gate, delegated-policy arm",
146
+ description: 'The app is running on the default ceiling because the tenant that provisioned it has declared no policy of its own, and that ceiling is reached. The tenant declares an explicit policy for the app.',
147
+ },
148
+ app_policy_missing: {
149
+ code: 'app_policy_missing',
150
+ surfaces: ['render-gate'],
151
+ retry: 'after-fix',
152
+ fixBy: 'tenant',
153
+ emitter: "a deployment's generation gate, delegated-policy arm",
154
+ description: 'The app exists but carries no policy yet — the window between provisioning it and declaring what it may spend. The tenant declares the policy.',
155
+ },
156
+ billing_mode_anomaly: {
157
+ code: 'billing_mode_anomaly',
158
+ // ONE state on TWO surfaces: the same unreadable record refuses a
159
+ // provisioning call and a render. Two entries with one name would
160
+ // be the collision the namespace rule forbids; this is not one.
161
+ surfaces: ['provisioning-api', 'render-gate'],
162
+ retry: 'never',
163
+ emitter: "a deployment's provisioning guard and its generation gate, reading the same record",
164
+ 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.',
165
+ },
166
+ app_canceled: {
167
+ code: 'app_canceled',
168
+ surfaces: ['render-gate'],
169
+ retry: 'after-fix',
170
+ fixBy: 'owner',
171
+ emitter: "a deployment's generation gate, plan-state arm",
172
+ 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.",
173
+ },
174
+ trial_exhausted: {
175
+ code: 'trial_exhausted',
176
+ surfaces: ['render-gate'],
177
+ retry: 'after-fix',
178
+ fixBy: 'owner',
179
+ emitter: "a deployment's generation gate, trial arm",
180
+ description: 'The trial this deployment grants the app has used up its allotment. The owner starts a paid plan.',
181
+ },
182
+ trial_expired: {
183
+ code: 'trial_expired',
184
+ surfaces: ['render-gate'],
185
+ retry: 'after-fix',
186
+ fixBy: 'owner',
187
+ emitter: "a deployment's generation gate, trial arm",
188
+ description: "The app's trial window has closed. The owner starts a paid plan.",
189
+ },
190
+ issuer_rate_limited: {
191
+ code: 'issuer_rate_limited',
192
+ surfaces: ['render-gate'],
193
+ retry: 'later',
194
+ emitter: "the per-issuer render-rate cap's denial",
195
+ description: 'Calls arriving under this issuing identity are over the rate this deployment allows. Time restores it; retry shortly.',
196
+ },
197
+ app_rate_limited: {
198
+ code: 'app_rate_limited',
199
+ surfaces: ['render-gate'],
200
+ retry: 'later',
201
+ emitter: "the per-app render-rate cap's denial",
202
+ description: 'This app is rendering faster than the rate this deployment allows it. The cap is the app\u2019s own, not the issuing identity\u2019s \u2014 the two are separate states with separate codes. Time restores it; retry shortly.',
203
+ },
204
+ app_deprovisioned: {
205
+ code: 'app_deprovisioned',
206
+ surfaces: ['render-gate', 'mcp-endpoint'],
207
+ retry: 'never',
208
+ emitter: "the generation gate's owner-claim check, before any reservation or metering",
209
+ 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.',
210
+ },
211
+ billing_path_missing: {
212
+ code: 'billing_path_missing',
213
+ surfaces: ['render-gate'],
214
+ retry: 'after-fix',
215
+ fixBy: 'owner',
216
+ 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)",
217
+ 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.',
218
+ },
219
+ // ── owner-api ─────────────────────────────────────────────────────
220
+ subscription_exists: {
221
+ code: 'subscription_exists',
222
+ surfaces: ['owner-api'],
223
+ retry: 'after-fix',
224
+ fixBy: 'owner',
225
+ emitter: "a deployment's owner billing mutations",
226
+ 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.",
227
+ },
228
+ checkout_unavailable: {
229
+ code: 'checkout_unavailable',
230
+ surfaces: ['owner-api'],
231
+ retry: 'later',
232
+ fixBy: 'operator',
233
+ emitter: "a deployment's owner billing mutations",
234
+ 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.',
235
+ },
236
+ card_update_unavailable: {
237
+ code: 'card_update_unavailable',
238
+ surfaces: ['owner-api'],
239
+ retry: 'later',
240
+ fixBy: 'operator',
241
+ emitter: "a deployment's owner billing mutations",
242
+ description: 'The surface that updates a payment method is unavailable on this deployment right now. Only the operator can restore it.',
243
+ },
244
+ portal_unavailable: {
245
+ code: 'portal_unavailable',
246
+ surfaces: ['owner-api'],
247
+ retry: 'later',
248
+ fixBy: 'operator',
249
+ emitter: "a deployment's owner billing mutations",
250
+ description: "The self-service billing surface is unavailable on this deployment right now. Only the operator can restore it.",
251
+ },
252
+ no_subscription: {
253
+ code: 'no_subscription',
254
+ surfaces: ['owner-api'],
255
+ retry: 'after-fix',
256
+ fixBy: 'owner',
257
+ emitter: "a deployment's owner billing mutations",
258
+ description: 'A plan-management action was called on an app that has no plan. The owner starts a plan first.',
259
+ },
260
+ already_on_tier: {
261
+ code: 'already_on_tier',
262
+ surfaces: ['owner-api'],
263
+ retry: 'after-fix',
264
+ fixBy: 'owner',
265
+ emitter: "a deployment's owner billing mutations",
266
+ description: 'The plan requested is the one the app is already on. The owner picks a different plan.',
267
+ },
268
+ managed_app_no_checkout: {
269
+ code: 'managed_app_no_checkout',
270
+ surfaces: ['owner-api'],
271
+ retry: 'never',
272
+ emitter: "a deployment's owner billing mutations",
273
+ 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.',
274
+ },
275
+ managed_app_no_card_update: {
276
+ code: 'managed_app_no_card_update',
277
+ surfaces: ['owner-api'],
278
+ retry: 'never',
279
+ emitter: "a deployment's owner billing mutations",
280
+ description: 'This app is funded by the tenant that provisioned it, so it carries no owner payment method to update.',
281
+ },
282
+ managed_app_no_portal: {
283
+ code: 'managed_app_no_portal',
284
+ surfaces: ['owner-api'],
285
+ retry: 'never',
286
+ emitter: "a deployment's owner billing mutations",
287
+ description: 'This app is funded by the tenant that provisioned it, so it has no owner self-service billing surface.',
288
+ },
289
+ // ── provisioning-api ──────────────────────────────────────────────
290
+ owner_ref_mismatch: {
291
+ code: 'owner_ref_mismatch',
292
+ surfaces: ['provisioning-api'],
293
+ retry: 'after-fix',
294
+ fixBy: 'tenant',
295
+ emitter: "a deployment's provisioning guard",
296
+ description: "The owner reference the caller supplied is not the one recorded on this app. The refusal names the route and the app, never the recorded reference. The tenant re-derives the reference and retries.",
297
+ },
298
+ policy_version_stale: {
299
+ code: 'policy_version_stale',
300
+ surfaces: ['provisioning-api'],
301
+ retry: 'after-fix',
302
+ fixBy: 'tenant',
303
+ emitter: "a deployment's provisioning guard, policy-write arm",
304
+ description: "The policy write carries a version older than the one stored, so it would overwrite a newer decision. The refusal reports the stored version; the tenant re-derives from it and writes again.",
305
+ },
306
+ });
307
+ /** The registry consumers read. */
308
+ export const PRE_GENERATION_REFUSAL_CODES = REFUSAL_ROWS;
309
+ /**
310
+ * Identity helper that only accepts an EXHAUSTIVE tuple of one surface's
311
+ * codes: omit one and the parameter type collapses to `never`, so the
312
+ * call site is a compile error. A tuple is needed because a wire enum
313
+ * requires a literal, non-empty tuple — a runtime filter over the rows
314
+ * yields `string[]`, which cannot type an enum. This keeps every
315
+ * per-surface tuple derived-CHECKED rather than a second list.
316
+ */
317
+ const exhaustiveCodesOn = () => (codes) => codes;
318
+ /**
319
+ * Every render-gate code, as the literal tuple the wire enum
320
+ * (`renderRefusalSchema.code`) is built from. Order is the registry's.
321
+ */
322
+ export const RENDER_GATE_REFUSAL_CODES = exhaustiveCodesOn()([
323
+ 'unsupported_provider',
324
+ 'insufficient_credit',
325
+ 'hard_cap_exceeded',
326
+ 'model_not_in_tier',
327
+ 'managed_default_cap_exceeded',
328
+ 'app_policy_missing',
329
+ 'billing_mode_anomaly',
330
+ 'billing_path_missing',
331
+ 'app_canceled',
332
+ 'trial_exhausted',
333
+ 'trial_expired',
334
+ 'issuer_rate_limited',
335
+ 'app_rate_limited',
336
+ 'app_deprovisioned',
337
+ ]);
338
+ /**
339
+ * Every mcp-endpoint code, as the literal tuple the transport wire enum
340
+ * (`transportRefusalSchema.code`) is built from — the refusals a per-app
341
+ * MCP endpoint's authorization types on `error.data.refusal`
342
+ * (ggui#825). Order is the registry's.
343
+ */
344
+ export const MCP_ENDPOINT_REFUSAL_CODES = exhaustiveCodesOn()([
345
+ 'app_deprovisioned',
346
+ ]);
@@ -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,7 +43,7 @@ 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
49
  * tenancy, lifecycle, and conversation-scoped context that every
@@ -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,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AA6BnE;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAC7B,gBAAgB,GAChB,gBAAgB,GAEhB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC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KG;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
@@ -1,9 +1,9 @@
1
- import type { PropsSpec, StreamSpec, ActionSpec, ContextSpec, JsonSchema, JsonObject, DataContract } from '../types/data-contract';
2
- import type { ActionEnvelope } from '../types/events';
3
- import type { CompiledContractValidators } from '../integrations/mcp-apps';
4
- import type { ValidateFunction } from './ajv-runtime';
5
- export type { ValidateFunction } from './ajv-runtime';
6
- import { type ReservedChannelValidator } from './reserved-channels';
1
+ import type { PropsSpec, StreamSpec, ActionSpec, ContextSpec, JsonSchema, JsonObject, DataContract } from '../types/data-contract.js';
2
+ import type { ActionEnvelope } from '../types/events.js';
3
+ import type { CompiledContractValidators } from '../integrations/mcp-apps.js';
4
+ import type { ValidateFunction } from './ajv-runtime.js';
5
+ export type { ValidateFunction } from './ajv-runtime.js';
6
+ import { type ReservedChannelValidator } from './reserved-channels.js';
7
7
  export interface ContractViolation extends JsonObject {
8
8
  field: string;
9
9
  message: string;
@@ -15,8 +15,8 @@
15
15
  * declarative source of truth for every referenced tool). Violations
16
16
  * are author-recoverable at render time.
17
17
  */
18
- import type { DataContract, ActionSpec, StreamSpec, AgentCapabilitiesSpec } from '../types/data-contract';
19
- import type { ContractViolation } from './contract-validator';
18
+ import type { DataContract, ActionSpec, StreamSpec, AgentCapabilitiesSpec } from '../types/data-contract.js';
19
+ import type { ContractViolation } from './contract-validator.js';
20
20
  /**
21
21
  * Stable error code emitted when an `actionSpec[*].nextStep` value
22
22
  * does not resolve to a declared `agentCapabilities.tools[*]` key on
@@ -41,7 +41,7 @@
41
41
  * set is wired into `lintContract` via `phaseHygiene`; consumers that
42
42
  * want strict gates layer their own assertions on top.
43
43
  */
44
- import type { DataContract, GadgetDescriptor } from '../types/data-contract';
44
+ import type { DataContract, GadgetDescriptor } from '../types/data-contract.js';
45
45
  /**
46
46
  * Stable codes for hygiene rules. Each is a `LINT_*` rather than a
47
47
  * `CTR_*` — the convention: errors are `CTR_*`, warnings are `LINT_*`.
@@ -35,8 +35,8 @@
35
35
  * Companion to {@link CrossReferenceError} in `./cross-references` —
36
36
  * the two modules ship the "phase 2: references" rule registry.
37
37
  */
38
- import type { DataContract } from '../types/data-contract';
39
- import type { ContractViolation } from './contract-validator';
38
+ import type { DataContract } from '../types/data-contract.js';
39
+ import type { ContractViolation } from './contract-validator.js';
40
40
  /**
41
41
  * Stable error code for collisions across the three inbound spec maps
42
42
  * (`actionSpec` / `streamSpec` / `contextSpec`). The boilerplate
@@ -31,7 +31,7 @@
31
31
  * file describes a NAMING POLICY that the contract-structure validator
32
32
  * enforces. Separate concerns — easier to audit the boundary.
33
33
  */
34
- import type { ValidationResult } from './contract-validator';
34
+ import type { ValidationResult } from './contract-validator.js';
35
35
  /** Prefix that marks a channel as server-owned (reserved from agents). */
36
36
  export declare const RESERVED_CHANNEL_PREFIX = "_ggui:";
37
37
  /**
@@ -42,8 +42,8 @@
42
42
  * they ship companion rule registries to cross-references and
43
43
  * name-invariants under the unified `lintContract` API.
44
44
  */
45
- import type { AgentCapabilitiesSpec, DataContract } from '../types/data-contract';
46
- import type { ContractViolation } from './contract-validator';
45
+ import type { AgentCapabilitiesSpec, DataContract } from '../types/data-contract.js';
46
+ import type { ContractViolation } from './contract-validator.js';
47
47
  /**
48
48
  * Stable error code for protocol-level schema-compatibility
49
49
  * violations on action ⊆ inputSchema or channel ⊇ outputSchema.
@@ -30,7 +30,7 @@
30
30
  * assertions for the same author-recoverable failure class; this
31
31
  * sits alongside them.
32
32
  */
33
- import type { DataContract } from '../types/data-contract';
33
+ import type { DataContract } from '../types/data-contract.js';
34
34
  export interface SchemaMetaViolation {
35
35
  /** Path to the malformed schema field (e.g., `propsSpec.properties.todos.schema`). */
36
36
  field: string;