@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
package/dist/version.d.ts CHANGED
@@ -6,6 +6,75 @@
6
6
  * schema change; the most recent change anchors {@link PROTOCOL_VERSION}.
7
7
  *
8
8
  * --------------------------------------------------------------------
9
+ * SPEC §7.1's refused arm is ONE primitive (2026-09-05, additive,
10
+ * pre-launch, ggui#803 leg 9). The tool result a render gate answers a
11
+ * pre-generation refusal with was built by hand in
12
+ * `@ggui-ai/mcp-server-handlers` (`buildRenderRefusalText` + an inline
13
+ * `{ outcome: 'refused', refusal }`), the conformance kit carried its
14
+ * own reference, and the reference server could not project it at all
15
+ * — so the reference server was not a reference for the refused
16
+ * envelope, and a third hand-built copy there would only have re-graded
17
+ * the kit's reference.
18
+ *
19
+ * rr1. **`projectRenderRefusal(refusal): RenderRefusalResult`** (new
20
+ * export, `envelopes/render-refusal.ts`) — `isError: true`,
21
+ * `content[0].text` = `<code>: <message> <fix>`, `structuredContent`
22
+ * = `{ outcome: 'refused', refusal }` typed as **`RefusedRenderOutput`**
23
+ * (`z.infer<typeof refusedOutputSchema>`, new export), no `_meta`.
24
+ * Pure and synchronous. The four facts have one source.
25
+ *
26
+ * rr2. **Consumers**: `mcp-server-handlers`' `ggui_render` builds the
27
+ * refused result here (its local builder, inline object and
28
+ * `RenderRefusedOutput` alias are deleted — no shim); the
29
+ * reference server supplies the kit's `refusalProjector` from the
30
+ * same primitive at the kit's stringly boundary (a code off
31
+ * `RENDER_GATE_REFUSAL_CODES` → `null`; anything else parsed by
32
+ * `renderRefusalSchema`), so its six `refusal-envelope/*` rows are
33
+ * GRADED, not skipped. The kit's own hand-built reference stays as
34
+ * the second source that catches the primitive drifting.
35
+ *
36
+ * Conformance-kit verdict: no new kit entry — the six `refusal-envelope`
37
+ * cases already grade exactly these four facts; what changed is that
38
+ * two implementations now answer them through one function, and the
39
+ * reference server's exact-set assertion moved the rows from SKIPPED to
40
+ * PASSING. Bytes on the wire: unchanged.
41
+ *
42
+ * Package version — classification MADE here: MINOR for
43
+ * `@ggui-ai/protocol` (two new exports, additive) and for
44
+ * `@ggui-ai/mcp-server-handlers` (same result, one source), pre-1.0 and
45
+ * pre-launch. PROTOCOL_VERSION unchanged — no WS envelope moved.
46
+ *
47
+ * --------------------------------------------------------------------
48
+ * Authorization refusals carry JSON-RPC `data` (2026-09-05, additive,
49
+ * pre-launch, ggui#825). `@ggui-ai/mcp-server`'s per-app `authorize`
50
+ * hook refuses by throwing, and the route answered every throw with a
51
+ * bare `403 {code: -32000, message: "Forbidden"}` — correct in effect,
52
+ * illegible to a client that needs to tell "this app is no longer served" from
53
+ * "your credential is wrong".
54
+ *
55
+ * ar1. **`ErrorMapperResult.data?: JsonValue`** — a deployment's
56
+ * `errorMapper` may attach JSON-RPC 2.0 error `data` (any JSON
57
+ * value) to a mapped result; serialized verbatim on `error.data`,
58
+ * omitted when absent. Applies to every mapped error, not only
59
+ * authorization refusals.
60
+ *
61
+ * ar2. **The per-app authorization refusal consults the mapper**,
62
+ * bounded to 401 / 403: a mapper answering any other status, or
63
+ * throwing, is ignored and logged (`per_app_authorize_mapper_out_
64
+ * of_bounds` / `error_mapper_failed` on the route logger) and the
65
+ * default-deny 403 stands byte-identical to a deployment with no
66
+ * mapper. The allow path never consults the mapper.
67
+ *
68
+ * Conformance-kit verdict: no kit entry required — an optional field on
69
+ * an operator-side hook result, no MCP tool name/shape touched; the
70
+ * shape of any `data.refusal` a deployment chooses to attach is that
71
+ * deployment's declaration, not this package's.
72
+ *
73
+ * Package version — classification MADE here: MINOR for
74
+ * `@ggui-ai/mcp-server` (new optional field on `ErrorMapperResult` +
75
+ * the authorization refusal path consults `errorMapper`), pre-1.0 and
76
+ * pre-launch. PROTOCOL_VERSION unchanged — no WS envelope moved.
77
+ * --------------------------------------------------------------------
9
78
  * Authored source rides blueprint reuse (2026-08-14, additive,
10
79
  * pre-launch). Cache-reuse renders (a repeated prompt semantic-matches
11
80
  * a cached blueprint) previously committed without authored
@@ -1865,8 +1934,11 @@
1865
1934
  * now `{stackItemId, updated}`.
1866
1935
  * Pre-launch no-backcompat: consumers that read any of the dropped
1867
1936
  * fields off the wire response MUST migrate. Internal telemetry
1868
- * threading via TS-only `HandshakeOutput` / `PushOutput` /
1869
- * `UpdateOutput` shapes is preserved for handler-side callers.
1937
+ * threading via the TS-only `HandshakeOutput` / `PushOutput`
1938
+ * shapes is preserved for handler-side callers. (`ggui_update`'s
1939
+ * parallel TS shape is gone as of ggui#798 — the handler's return
1940
+ * type is `GguiUpdateOutput`, `z.infer` of `updateOutputSchema`,
1941
+ * so there is nothing left for it to carry beyond the wire.)
1870
1942
  *
1871
1943
  * u2. **`validatePropsData` is closed-shape (strict mode).** Keys
1872
1944
  * not declared on `propsSpec.properties` are now rejected with
@@ -3072,8 +3144,108 @@
3072
3144
  * (drift / hash / profile / authority obligations; pins the
3073
3145
  * 2026-08-19 out-of-vocabulary enum incident as a permanent
3074
3146
  * sample).
3147
+ *
3148
+ * draft-2026-09-04 — PRE-GENERATION REFUSAL ENVELOPE (ggui#786;
3149
+ * BREAKING IN INTENT, pre-launch so no shim and no `@deprecated`
3150
+ * — see `docs/protocol/migrations/2026-09-04-pre-generation-refusal-envelope.md`):
3151
+ *
3152
+ * r1. **`outcome` on every render result** (SPEC §7.1). A REQUIRED
3153
+ * discriminant, `'rendered' | 'failed' | 'refused'`. Under
3154
+ * §1.1 of VERSION-POLICY a required-field addition on an
3155
+ * envelope is a major-class change; §1.4 waives the migration
3156
+ * obligation while the version carries the `draft-` prefix, and
3157
+ * the dated doc above is written anyway. `ggui_update` is
3158
+ * UNCHANGED — it binds no pre-generation gate and consumes no
3159
+ * handshake, so a mutation arm is a separate slice.
3160
+ * r2. **Identity present-iff-committed** — `sessionId`, `action`,
3161
+ * `contractHash`, `blueprintId`, `variantKey` and `cache` are
3162
+ * OPTIONAL at the schema level and pinned present on the two
3163
+ * committed outcomes by a presence refinement. A refusal
3164
+ * commits nothing, so it carries none of them. The same
3165
+ * refinement pins `resourceUri` present-iff-`'rendered'` — the
3166
+ * mount affordance, whose iff its docstring already stated and
3167
+ * nothing enforced: a `failed` result carrying one advertises a
3168
+ * mount for a render that does not exist.
3169
+ * r3. **The refusal envelope** — `refusal: {code, message, fix,
3170
+ * retry, handshake: 'intact', balanceCentsAtCheck?}`, present
3171
+ * iff `outcome: 'refused'` and then the ONLY field beside
3172
+ * `outcome`. Enforced ON THE WIRE: a handler now declares
3173
+ * `outputEnvelopeSchema` (the composed schema) beside
3174
+ * `outputSchema` (the raw shape the SDK registers), and the
3175
+ * transport validates against the former — so the presence
3176
+ * rules a raw-shape rebuild would drop fail loudly instead.
3177
+ * r4. **`PRE_GENERATION_REFUSAL_CODES`** — a closed registry, one
3178
+ * `code` namespace across the render-gate, owner-api and
3179
+ * provisioning-api surfaces, with `retry` on every row and
3180
+ * `fixBy` on every `after-fix` row. `refusal.code` is the
3181
+ * render-gate subset; a code outside it fails the wire enum.
3182
+ * r5. **Hook contract** — `preValidationGate` RETURNS a refusal
3183
+ * instead of throwing; the handler owns the envelope and
3184
+ * projects it before the handler's OWN input parse (after the
3185
+ * SDK's declared-shape validation, so a wire-malformed call
3186
+ * never reaches a gate). A gate that throws to refuse is a
3187
+ * conformance failure, observable in the `tool_invoked` line.
3188
+ * r6. **Conformance:** two catalogs — `refusal-envelope-conformance`
3189
+ * (the projection obligation, graded against a kit-local
3190
+ * reference and against the shipping projector in
3191
+ * `@ggui-ai/mcp-server-handlers`) and `registry-completeness`
3192
+ * (the registry's structural pins, bound to the LIVE registry).
3193
+ * r7. **Tool output shapes are protocol-owned (ggui#817 part C):**
3194
+ * seven schemas — search / featured / validate / consume's
3195
+ * host-context projection / list_sessions' summary / runtime_pull's
3196
+ * page / get_session — registered as `.shape`, types derived and
3197
+ * wearing `DeepReadonly` at the seam; `ggui_get_session`'s wire is the
3198
+ * projection (`variant` + six base fields, `contextSnapshot` when the
3199
+ * row has one), never a `GguiSession` — the alias was a lie the
3200
+ * strip-parse hid. No `.readonly()` in a wire schema (zod 4 projects
3201
+ * it as `readOnly`).
3202
+ * r8. **`infra.model` route grammar (ggui#818):** either wire form —
3203
+ * canonical `provider:model` or LiteLLM `provider/model`, aliases in
3204
+ * both — or the handler's route guard fails at zod path `infra.model`
3205
+ * BEFORE the pre-generation gate (`renderInputRouteGuardSchema`, the
3206
+ * grammar and nothing else, so `{}` still reaches the gate per r5); the
3207
+ * full envelope (`renderInputEnvelopeSchema`) parses after the gate.
3208
+ * Bare model ids are out.
3209
+ * r9. **Endpoint-level refusal (ggui#825):** registry surface
3210
+ * `mcp-endpoint` (v11) and the transport envelope — a per-app MCP
3211
+ * endpoint that refuses a request for a registry state answers HTTP
3212
+ * 403 with `{ code: -32000, message: 'Forbidden', data: { refusal } }`
3213
+ * (`transportRefusalErrorSchema`; `refusal` = the projection without
3214
+ * the render-only fields, `MCP_ENDPOINT_REFUSAL_CODES` derived — today
3215
+ * `app_deprovisioned`). Untyped authorization failures keep the bare
3216
+ * 403 by contract. Additive.
3217
+ * r10. **Consume / list_sessions / emit own their wire shapes (ggui#817
3218
+ * part C2):** `consumeEventEntrySchema` (the drained row, closed),
3219
+ * `gguiSessionStatusSchema` (`active` | `expired`), `gguiConsumeOutputSchema`,
3220
+ * `gguiListSessionsOutputSchema`, `gguiEmitOutputSchema`; the types
3221
+ * derive (`ConsumeEventEntry`, `GguiConsumeOutput`, `GguiEmitOutput`,
3222
+ * `GguiListSessionsOutput`, `GguiSessionStatus`). `tools/list` now
3223
+ * advertises the entry vocabulary and the status enum for
3224
+ * `ggui_consume`; `parsePendingEnvelope` parses a drained row instead
3225
+ * of casting it, so a malformed pipe entry refuses at the seam. The
3226
+ * wire bytes of a well-formed row are unchanged. Additive.
3227
+ * r11. **Endpoint refusal codes (ggui#836):** the per-app endpoint speaks
3228
+ * §7.9 Plane-1 rows — the typed deprovisioned arm is `-32003`
3229
+ * (`APP_NOT_FOUND`, `App not found`) with `data.refusal`; untyped
3230
+ * authorization failures are `-32001` (`UNAUTHORIZED`) with no
3231
+ * `data`; HTTP 403 on both. `-32000` (the SDK client's
3232
+ * `ConnectionClosed`) is never a code a first-party server chooses.
3233
+ * Supersedes r9's literals; pre-launch, no compatibility arm.
3234
+ * r12. **`GENERATION_OVERLOADED: -32014`** joins `PLATFORM_ERROR_CODES` —
3235
+ * the generation queue is saturated (HTTP 503 + `Retry-After`; the
3236
+ * server is the limit, unlike `-32013`). Additive; the four complete
3237
+ * mirrors carry it under `check-error-code-mirrors`.
3238
+ *
3239
+ * FOLLOWER — moves in the SAME commit as this constant, pinned by a
3240
+ * gate that fails loud when it lags: the `protocol` field of every
3241
+ * shipped `samples/gguis/<name>/ggui.json` (the `@ggui-ai/project-config`
3242
+ * samples test). That pin is a HOUSE rule — shipped samples declare the
3243
+ * CURRENT stamp, because a new project starts from them. The CONTRACT
3244
+ * for any `ggui.json#protocol` is membership in
3245
+ * `CLIENT_SUPPORTED_VERSIONS`, enforced by the loader (`UPGRADE_REQUIRED`
3246
+ * on a non-member); the two coincide only while the set is a singleton.
3075
3247
  */
3076
- export declare const PROTOCOL_VERSION = "draft-2026-08-19";
3248
+ export declare const PROTOCOL_VERSION = "draft-2026-09-04";
3077
3249
  /**
3078
3250
  * The shipped `@ggui-ai/*` WAVE version — bare semver, identical to
3079
3251
  * `package.json#version` on every published package (the lockstep
@@ -3089,8 +3261,32 @@ export declare const PROTOCOL_VERSION = "draft-2026-08-19";
3089
3261
  * `package.json#version` (the same parity pattern as
3090
3262
  * `STDLIB_GADGETS_VERSION` and `agent-server`'s `CLIENT_INFO`), and the
3091
3263
  * `/release:cut` straggler list names it so the bump is mechanical.
3264
+ *
3265
+ * Wave classifications (protocol seat; the kit is the arbiter,
3266
+ * docs/protocol/VERSION-POLICY.md §1–2):
3267
+ *
3268
+ * - **0.15.0 — MINOR** (ruled 2026-09-05). Every `@ggui-ai/protocol`
3269
+ * landing since the 0.14.0 cut (`f3cf6c906`) is additive under
3270
+ * §1.2: the `@ggui-ai/protocol/wire` browser entry (ggui#819), the
3271
+ * `GENERATION_OVERLOADED: -32014` canonical code and SPEC §7.9's
3272
+ * Plane 0 (ggui#840), `ErrorMapperResult.data` (ggui#825), the
3273
+ * endpoint-level refusal — `403 {code: -32003, data.refusal}` for
3274
+ * `app_deprovisioned` (ggui#836), the `ggui_consume` /
3275
+ * `ggui_list_sessions` / `ggui_emit` output schemas (ggui#817 C2),
3276
+ * and the `.readonly()` removal from the gadget wire schema
3277
+ * (ggui#824). The one non-additive-looking line — the untyped
3278
+ * authorization refusal moving from `-32000` to `-32001
3279
+ * UNAUTHORIZED` (ggui#836) — is not a fixture regression: no
3280
+ * fixture on 0.14.0 pinned `-32000` (it was the SDK's default
3281
+ * courtesy code, never a first-party choice; ggui#840's Plane-0
3282
+ * ruling), and the transport-refusal catalog now states `-32001`.
3283
+ * §1.4 (`draft-`: semver describes intent) applies on top. A
3284
+ * 0.14.1 is legitimate ONLY as a founder-ruled hotfix branch off
3285
+ * `f3cf6c906` carrying ggui#846 alone (a declaration-emit fix —
3286
+ * PATCH under §1.3); it cannot be cut from main, whose delta since
3287
+ * 0.14.0 is minor-class.
3092
3288
  */
3093
- export declare const GGUI_WAVE_VERSION = "0.13.0";
3289
+ export declare const GGUI_WAVE_VERSION = "0.15.0";
3094
3290
  /**
3095
3291
  * Schema version stamped onto wire envelopes that opt into the
3096
3292
  * `schemaVersion` forward-compat field (see {@link ActionEnvelope},
@@ -3111,7 +3307,7 @@ export declare const GGUI_WAVE_VERSION = "0.13.0";
3111
3307
  * consumers can reference schema-versioning specifically without
3112
3308
  * coupling to the broader cache-invalidation constant.
3113
3309
  */
3114
- export declare const PROTOCOL_SCHEMA_VERSION = "draft-2026-08-19";
3310
+ export declare const PROTOCOL_SCHEMA_VERSION = "draft-2026-09-04";
3115
3311
  /**
3116
3312
  * Canonical live-channel error code emitted when a peer's declared
3117
3313
  * {@link SubscribePayload.supportedVersions} /
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAErD,CAAC"}
package/dist/version.js CHANGED
@@ -6,6 +6,75 @@
6
6
  * schema change; the most recent change anchors {@link PROTOCOL_VERSION}.
7
7
  *
8
8
  * --------------------------------------------------------------------
9
+ * SPEC §7.1's refused arm is ONE primitive (2026-09-05, additive,
10
+ * pre-launch, ggui#803 leg 9). The tool result a render gate answers a
11
+ * pre-generation refusal with was built by hand in
12
+ * `@ggui-ai/mcp-server-handlers` (`buildRenderRefusalText` + an inline
13
+ * `{ outcome: 'refused', refusal }`), the conformance kit carried its
14
+ * own reference, and the reference server could not project it at all
15
+ * — so the reference server was not a reference for the refused
16
+ * envelope, and a third hand-built copy there would only have re-graded
17
+ * the kit's reference.
18
+ *
19
+ * rr1. **`projectRenderRefusal(refusal): RenderRefusalResult`** (new
20
+ * export, `envelopes/render-refusal.ts`) — `isError: true`,
21
+ * `content[0].text` = `<code>: <message> <fix>`, `structuredContent`
22
+ * = `{ outcome: 'refused', refusal }` typed as **`RefusedRenderOutput`**
23
+ * (`z.infer<typeof refusedOutputSchema>`, new export), no `_meta`.
24
+ * Pure and synchronous. The four facts have one source.
25
+ *
26
+ * rr2. **Consumers**: `mcp-server-handlers`' `ggui_render` builds the
27
+ * refused result here (its local builder, inline object and
28
+ * `RenderRefusedOutput` alias are deleted — no shim); the
29
+ * reference server supplies the kit's `refusalProjector` from the
30
+ * same primitive at the kit's stringly boundary (a code off
31
+ * `RENDER_GATE_REFUSAL_CODES` → `null`; anything else parsed by
32
+ * `renderRefusalSchema`), so its six `refusal-envelope/*` rows are
33
+ * GRADED, not skipped. The kit's own hand-built reference stays as
34
+ * the second source that catches the primitive drifting.
35
+ *
36
+ * Conformance-kit verdict: no new kit entry — the six `refusal-envelope`
37
+ * cases already grade exactly these four facts; what changed is that
38
+ * two implementations now answer them through one function, and the
39
+ * reference server's exact-set assertion moved the rows from SKIPPED to
40
+ * PASSING. Bytes on the wire: unchanged.
41
+ *
42
+ * Package version — classification MADE here: MINOR for
43
+ * `@ggui-ai/protocol` (two new exports, additive) and for
44
+ * `@ggui-ai/mcp-server-handlers` (same result, one source), pre-1.0 and
45
+ * pre-launch. PROTOCOL_VERSION unchanged — no WS envelope moved.
46
+ *
47
+ * --------------------------------------------------------------------
48
+ * Authorization refusals carry JSON-RPC `data` (2026-09-05, additive,
49
+ * pre-launch, ggui#825). `@ggui-ai/mcp-server`'s per-app `authorize`
50
+ * hook refuses by throwing, and the route answered every throw with a
51
+ * bare `403 {code: -32000, message: "Forbidden"}` — correct in effect,
52
+ * illegible to a client that needs to tell "this app is no longer served" from
53
+ * "your credential is wrong".
54
+ *
55
+ * ar1. **`ErrorMapperResult.data?: JsonValue`** — a deployment's
56
+ * `errorMapper` may attach JSON-RPC 2.0 error `data` (any JSON
57
+ * value) to a mapped result; serialized verbatim on `error.data`,
58
+ * omitted when absent. Applies to every mapped error, not only
59
+ * authorization refusals.
60
+ *
61
+ * ar2. **The per-app authorization refusal consults the mapper**,
62
+ * bounded to 401 / 403: a mapper answering any other status, or
63
+ * throwing, is ignored and logged (`per_app_authorize_mapper_out_
64
+ * of_bounds` / `error_mapper_failed` on the route logger) and the
65
+ * default-deny 403 stands byte-identical to a deployment with no
66
+ * mapper. The allow path never consults the mapper.
67
+ *
68
+ * Conformance-kit verdict: no kit entry required — an optional field on
69
+ * an operator-side hook result, no MCP tool name/shape touched; the
70
+ * shape of any `data.refusal` a deployment chooses to attach is that
71
+ * deployment's declaration, not this package's.
72
+ *
73
+ * Package version — classification MADE here: MINOR for
74
+ * `@ggui-ai/mcp-server` (new optional field on `ErrorMapperResult` +
75
+ * the authorization refusal path consults `errorMapper`), pre-1.0 and
76
+ * pre-launch. PROTOCOL_VERSION unchanged — no WS envelope moved.
77
+ * --------------------------------------------------------------------
9
78
  * Authored source rides blueprint reuse (2026-08-14, additive,
10
79
  * pre-launch). Cache-reuse renders (a repeated prompt semantic-matches
11
80
  * a cached blueprint) previously committed without authored
@@ -1865,8 +1934,11 @@
1865
1934
  * now `{stackItemId, updated}`.
1866
1935
  * Pre-launch no-backcompat: consumers that read any of the dropped
1867
1936
  * fields off the wire response MUST migrate. Internal telemetry
1868
- * threading via TS-only `HandshakeOutput` / `PushOutput` /
1869
- * `UpdateOutput` shapes is preserved for handler-side callers.
1937
+ * threading via the TS-only `HandshakeOutput` / `PushOutput`
1938
+ * shapes is preserved for handler-side callers. (`ggui_update`'s
1939
+ * parallel TS shape is gone as of ggui#798 — the handler's return
1940
+ * type is `GguiUpdateOutput`, `z.infer` of `updateOutputSchema`,
1941
+ * so there is nothing left for it to carry beyond the wire.)
1870
1942
  *
1871
1943
  * u2. **`validatePropsData` is closed-shape (strict mode).** Keys
1872
1944
  * not declared on `propsSpec.properties` are now rejected with
@@ -3072,8 +3144,108 @@
3072
3144
  * (drift / hash / profile / authority obligations; pins the
3073
3145
  * 2026-08-19 out-of-vocabulary enum incident as a permanent
3074
3146
  * sample).
3147
+ *
3148
+ * draft-2026-09-04 — PRE-GENERATION REFUSAL ENVELOPE (ggui#786;
3149
+ * BREAKING IN INTENT, pre-launch so no shim and no `@deprecated`
3150
+ * — see `docs/protocol/migrations/2026-09-04-pre-generation-refusal-envelope.md`):
3151
+ *
3152
+ * r1. **`outcome` on every render result** (SPEC §7.1). A REQUIRED
3153
+ * discriminant, `'rendered' | 'failed' | 'refused'`. Under
3154
+ * §1.1 of VERSION-POLICY a required-field addition on an
3155
+ * envelope is a major-class change; §1.4 waives the migration
3156
+ * obligation while the version carries the `draft-` prefix, and
3157
+ * the dated doc above is written anyway. `ggui_update` is
3158
+ * UNCHANGED — it binds no pre-generation gate and consumes no
3159
+ * handshake, so a mutation arm is a separate slice.
3160
+ * r2. **Identity present-iff-committed** — `sessionId`, `action`,
3161
+ * `contractHash`, `blueprintId`, `variantKey` and `cache` are
3162
+ * OPTIONAL at the schema level and pinned present on the two
3163
+ * committed outcomes by a presence refinement. A refusal
3164
+ * commits nothing, so it carries none of them. The same
3165
+ * refinement pins `resourceUri` present-iff-`'rendered'` — the
3166
+ * mount affordance, whose iff its docstring already stated and
3167
+ * nothing enforced: a `failed` result carrying one advertises a
3168
+ * mount for a render that does not exist.
3169
+ * r3. **The refusal envelope** — `refusal: {code, message, fix,
3170
+ * retry, handshake: 'intact', balanceCentsAtCheck?}`, present
3171
+ * iff `outcome: 'refused'` and then the ONLY field beside
3172
+ * `outcome`. Enforced ON THE WIRE: a handler now declares
3173
+ * `outputEnvelopeSchema` (the composed schema) beside
3174
+ * `outputSchema` (the raw shape the SDK registers), and the
3175
+ * transport validates against the former — so the presence
3176
+ * rules a raw-shape rebuild would drop fail loudly instead.
3177
+ * r4. **`PRE_GENERATION_REFUSAL_CODES`** — a closed registry, one
3178
+ * `code` namespace across the render-gate, owner-api and
3179
+ * provisioning-api surfaces, with `retry` on every row and
3180
+ * `fixBy` on every `after-fix` row. `refusal.code` is the
3181
+ * render-gate subset; a code outside it fails the wire enum.
3182
+ * r5. **Hook contract** — `preValidationGate` RETURNS a refusal
3183
+ * instead of throwing; the handler owns the envelope and
3184
+ * projects it before the handler's OWN input parse (after the
3185
+ * SDK's declared-shape validation, so a wire-malformed call
3186
+ * never reaches a gate). A gate that throws to refuse is a
3187
+ * conformance failure, observable in the `tool_invoked` line.
3188
+ * r6. **Conformance:** two catalogs — `refusal-envelope-conformance`
3189
+ * (the projection obligation, graded against a kit-local
3190
+ * reference and against the shipping projector in
3191
+ * `@ggui-ai/mcp-server-handlers`) and `registry-completeness`
3192
+ * (the registry's structural pins, bound to the LIVE registry).
3193
+ * r7. **Tool output shapes are protocol-owned (ggui#817 part C):**
3194
+ * seven schemas — search / featured / validate / consume's
3195
+ * host-context projection / list_sessions' summary / runtime_pull's
3196
+ * page / get_session — registered as `.shape`, types derived and
3197
+ * wearing `DeepReadonly` at the seam; `ggui_get_session`'s wire is the
3198
+ * projection (`variant` + six base fields, `contextSnapshot` when the
3199
+ * row has one), never a `GguiSession` — the alias was a lie the
3200
+ * strip-parse hid. No `.readonly()` in a wire schema (zod 4 projects
3201
+ * it as `readOnly`).
3202
+ * r8. **`infra.model` route grammar (ggui#818):** either wire form —
3203
+ * canonical `provider:model` or LiteLLM `provider/model`, aliases in
3204
+ * both — or the handler's route guard fails at zod path `infra.model`
3205
+ * BEFORE the pre-generation gate (`renderInputRouteGuardSchema`, the
3206
+ * grammar and nothing else, so `{}` still reaches the gate per r5); the
3207
+ * full envelope (`renderInputEnvelopeSchema`) parses after the gate.
3208
+ * Bare model ids are out.
3209
+ * r9. **Endpoint-level refusal (ggui#825):** registry surface
3210
+ * `mcp-endpoint` (v11) and the transport envelope — a per-app MCP
3211
+ * endpoint that refuses a request for a registry state answers HTTP
3212
+ * 403 with `{ code: -32000, message: 'Forbidden', data: { refusal } }`
3213
+ * (`transportRefusalErrorSchema`; `refusal` = the projection without
3214
+ * the render-only fields, `MCP_ENDPOINT_REFUSAL_CODES` derived — today
3215
+ * `app_deprovisioned`). Untyped authorization failures keep the bare
3216
+ * 403 by contract. Additive.
3217
+ * r10. **Consume / list_sessions / emit own their wire shapes (ggui#817
3218
+ * part C2):** `consumeEventEntrySchema` (the drained row, closed),
3219
+ * `gguiSessionStatusSchema` (`active` | `expired`), `gguiConsumeOutputSchema`,
3220
+ * `gguiListSessionsOutputSchema`, `gguiEmitOutputSchema`; the types
3221
+ * derive (`ConsumeEventEntry`, `GguiConsumeOutput`, `GguiEmitOutput`,
3222
+ * `GguiListSessionsOutput`, `GguiSessionStatus`). `tools/list` now
3223
+ * advertises the entry vocabulary and the status enum for
3224
+ * `ggui_consume`; `parsePendingEnvelope` parses a drained row instead
3225
+ * of casting it, so a malformed pipe entry refuses at the seam. The
3226
+ * wire bytes of a well-formed row are unchanged. Additive.
3227
+ * r11. **Endpoint refusal codes (ggui#836):** the per-app endpoint speaks
3228
+ * §7.9 Plane-1 rows — the typed deprovisioned arm is `-32003`
3229
+ * (`APP_NOT_FOUND`, `App not found`) with `data.refusal`; untyped
3230
+ * authorization failures are `-32001` (`UNAUTHORIZED`) with no
3231
+ * `data`; HTTP 403 on both. `-32000` (the SDK client's
3232
+ * `ConnectionClosed`) is never a code a first-party server chooses.
3233
+ * Supersedes r9's literals; pre-launch, no compatibility arm.
3234
+ * r12. **`GENERATION_OVERLOADED: -32014`** joins `PLATFORM_ERROR_CODES` —
3235
+ * the generation queue is saturated (HTTP 503 + `Retry-After`; the
3236
+ * server is the limit, unlike `-32013`). Additive; the four complete
3237
+ * mirrors carry it under `check-error-code-mirrors`.
3238
+ *
3239
+ * FOLLOWER — moves in the SAME commit as this constant, pinned by a
3240
+ * gate that fails loud when it lags: the `protocol` field of every
3241
+ * shipped `samples/gguis/<name>/ggui.json` (the `@ggui-ai/project-config`
3242
+ * samples test). That pin is a HOUSE rule — shipped samples declare the
3243
+ * CURRENT stamp, because a new project starts from them. The CONTRACT
3244
+ * for any `ggui.json#protocol` is membership in
3245
+ * `CLIENT_SUPPORTED_VERSIONS`, enforced by the loader (`UPGRADE_REQUIRED`
3246
+ * on a non-member); the two coincide only while the set is a singleton.
3075
3247
  */
3076
- export const PROTOCOL_VERSION = "draft-2026-08-19";
3248
+ export const PROTOCOL_VERSION = "draft-2026-09-04";
3077
3249
  /**
3078
3250
  * The shipped `@ggui-ai/*` WAVE version — bare semver, identical to
3079
3251
  * `package.json#version` on every published package (the lockstep
@@ -3089,8 +3261,32 @@ export const PROTOCOL_VERSION = "draft-2026-08-19";
3089
3261
  * `package.json#version` (the same parity pattern as
3090
3262
  * `STDLIB_GADGETS_VERSION` and `agent-server`'s `CLIENT_INFO`), and the
3091
3263
  * `/release:cut` straggler list names it so the bump is mechanical.
3264
+ *
3265
+ * Wave classifications (protocol seat; the kit is the arbiter,
3266
+ * docs/protocol/VERSION-POLICY.md §1–2):
3267
+ *
3268
+ * - **0.15.0 — MINOR** (ruled 2026-09-05). Every `@ggui-ai/protocol`
3269
+ * landing since the 0.14.0 cut (`f3cf6c906`) is additive under
3270
+ * §1.2: the `@ggui-ai/protocol/wire` browser entry (ggui#819), the
3271
+ * `GENERATION_OVERLOADED: -32014` canonical code and SPEC §7.9's
3272
+ * Plane 0 (ggui#840), `ErrorMapperResult.data` (ggui#825), the
3273
+ * endpoint-level refusal — `403 {code: -32003, data.refusal}` for
3274
+ * `app_deprovisioned` (ggui#836), the `ggui_consume` /
3275
+ * `ggui_list_sessions` / `ggui_emit` output schemas (ggui#817 C2),
3276
+ * and the `.readonly()` removal from the gadget wire schema
3277
+ * (ggui#824). The one non-additive-looking line — the untyped
3278
+ * authorization refusal moving from `-32000` to `-32001
3279
+ * UNAUTHORIZED` (ggui#836) — is not a fixture regression: no
3280
+ * fixture on 0.14.0 pinned `-32000` (it was the SDK's default
3281
+ * courtesy code, never a first-party choice; ggui#840's Plane-0
3282
+ * ruling), and the transport-refusal catalog now states `-32001`.
3283
+ * §1.4 (`draft-`: semver describes intent) applies on top. A
3284
+ * 0.14.1 is legitimate ONLY as a founder-ruled hotfix branch off
3285
+ * `f3cf6c906` carrying ggui#846 alone (a declaration-emit fix —
3286
+ * PATCH under §1.3); it cannot be cut from main, whose delta since
3287
+ * 0.14.0 is minor-class.
3092
3288
  */
3093
- export const GGUI_WAVE_VERSION = "0.13.0";
3289
+ export const GGUI_WAVE_VERSION = "0.15.0";
3094
3290
  /**
3095
3291
  * Schema version stamped onto wire envelopes that opt into the
3096
3292
  * `schemaVersion` forward-compat field (see {@link ActionEnvelope},
package/dist/wire.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ /**
2
+ * `@ggui-ai/protocol/wire` — the browser entry (ggui#819).
3
+ *
4
+ * What a renderer running inside an iframe validates and types against:
5
+ * the contract's shapes and their inference, the live-channel frames, the
6
+ * action envelope, the host-context projection, the reserved-channel
7
+ * guard, the interface-context snapshot, the invoke event, the permission
8
+ * grammar and the two limits the runtime shares with the server. Nothing
9
+ * a SERVER registers or validates — no tool input/output schema, no ops
10
+ * tool, no LLM route table, no contract zod schema — is reachable from
11
+ * here at runtime: a bundler cannot drop a module whose top level builds
12
+ * zod schemas, so the iframe pays for every module its entry reaches
13
+ * (`wire.test.ts` walks the graph and pins that). The root barrel keeps
14
+ * every name; this entry is the same names, fewer modules.
15
+ */
16
+ export * from './types/contract-inference.js';
17
+ export * from './types/data-contract.js';
18
+ export * from './types/live-channel.js';
19
+ export * from './types/render.js';
20
+ export * from './types/invoke.js';
21
+ export * from './types/events.js';
22
+ export * from './types/ggui-session-event.js';
23
+ export * from './types/host-context.js';
24
+ export * from './types/interface-context.js';
25
+ export * from './validation/contract-validator.js';
26
+ export * from './validation/reserved-channels.js';
27
+ export * from './validation/hygiene-rules.js';
28
+ export * from './errors/unknown-permission-name.js';
29
+ export * from './envelopes/builders.js';
30
+ export * from './schemas/invoke.js';
31
+ export * from './schemas/interface-context.js';
32
+ export * from './schemas/runtime-telemetry-limits.js';
33
+ export * from './schemas/public-env-key.js';
34
+ export * from './version.js';
35
+ export * from './schemas/data-contract.js';
36
+ export * from './types/gadget.js';
37
+ export * from './gadgets/stdlib-gadgets.js';
38
+ export * from './gadgets/resolve-contract-gadgets.js';
39
+ export * from './iframe-bridge.js';
40
+ export type { ValidateFunction } from './validation/ajv-runtime.js';
41
+ export type { AppTheme } from './schemas/app-theme.js';
42
+ export type { AppDisplayConfig } from './types/app-config.js';
43
+ export type { EndUserIdentity } from './types/auth.js';
44
+ export type { GguiRuntimePullInput, GguiConsumeOutput, ConsumeEventEntry, GguiEmitOutput, GguiSessionStatus, } from './types/mcp.js';
45
+ //# sourceMappingURL=wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAI1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AAGnD,cAAc,iBAAiB,CAAC;AAChC,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,GAClB,MAAM,aAAa,CAAC"}
package/dist/wire.js ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * `@ggui-ai/protocol/wire` — the browser entry (ggui#819).
3
+ *
4
+ * What a renderer running inside an iframe validates and types against:
5
+ * the contract's shapes and their inference, the live-channel frames, the
6
+ * action envelope, the host-context projection, the reserved-channel
7
+ * guard, the interface-context snapshot, the invoke event, the permission
8
+ * grammar and the two limits the runtime shares with the server. Nothing
9
+ * a SERVER registers or validates — no tool input/output schema, no ops
10
+ * tool, no LLM route table, no contract zod schema — is reachable from
11
+ * here at runtime: a bundler cannot drop a module whose top level builds
12
+ * zod schemas, so the iframe pays for every module its entry reaches
13
+ * (`wire.test.ts` walks the graph and pins that). The root barrel keeps
14
+ * every name; this entry is the same names, fewer modules.
15
+ */
16
+ export * from './types/contract-inference.js';
17
+ export * from './types/data-contract.js';
18
+ export * from './types/live-channel.js';
19
+ export * from './types/render.js';
20
+ export * from './types/invoke.js';
21
+ export * from './types/events.js';
22
+ export * from './types/ggui-session-event.js';
23
+ export * from './types/host-context.js';
24
+ export * from './types/interface-context.js';
25
+ export * from './validation/contract-validator.js';
26
+ export * from './validation/reserved-channels.js';
27
+ export * from './validation/hygiene-rules.js';
28
+ export * from './errors/unknown-permission-name.js';
29
+ export * from './envelopes/builders.js';
30
+ export * from './schemas/invoke.js';
31
+ export * from './schemas/interface-context.js';
32
+ export * from './schemas/runtime-telemetry-limits.js';
33
+ export * from './schemas/public-env-key.js';
34
+ export * from './version.js';
35
+ // The gadget family: the stdlib hooks bundled into the iframe validate a
36
+ // descriptor draft at runtime (`createGguiGadget`), so the contract-schema
37
+ // module comes along — it is what the browser validates there.
38
+ export * from './schemas/data-contract.js';
39
+ export * from './types/gadget.js';
40
+ export * from './gadgets/stdlib-gadgets.js';
41
+ export * from './gadgets/resolve-contract-gadgets.js';
42
+ // The iframe bridge vocabulary (`BRIDGE_EVENTS`) — what the RN WebView bridge
43
+ // and the web runtime agree on; browser data, not a tool schema.
44
+ export * from './iframe-bridge.js';
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@ggui-ai/protocol",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
+ "sideEffects": [
5
+ "./dist/schemas/sync-check.js",
6
+ "./dist/validation/ajv-runtime.js"
7
+ ],
4
8
  "description": "ggui protocol types — events, renders, WebSocket, MCP, LLM models",
5
9
  "license": "Apache-2.0",
6
10
  "keywords": [
@@ -74,6 +78,12 @@
74
78
  "require": "./dist/integrations/theme-binding.js",
75
79
  "default": "./dist/integrations/theme-binding.js"
76
80
  },
81
+ "./wire": {
82
+ "types": "./dist/wire.d.ts",
83
+ "import": "./dist/wire.js",
84
+ "require": "./dist/wire.js",
85
+ "default": "./dist/wire.js"
86
+ },
77
87
  "./version": {
78
88
  "types": "./dist/version.d.ts",
79
89
  "import": "./dist/version.js",
@@ -112,11 +122,11 @@
112
122
  "access": "public"
113
123
  },
114
124
  "engines": {
115
- "node": ">=20.0.0"
125
+ "node": ">=22.0.0"
116
126
  },
117
127
  "author": "ggui contributors <hello@ggui.ai>",
118
128
  "scripts": {
119
- "build": "rm -rf dist.staging && tsc --outDir dist.staging && node ../scripts/fix-esm-imports.mjs dist.staging && node ../scripts/atomic-swap.mjs dist.staging dist",
129
+ "build": "rm -rf dist.staging-$$ && tsc --outDir dist.staging-$$ && node ../scripts/fix-esm-imports.mjs dist.staging-$$ && node ../scripts/atomic-swap.mjs dist.staging-$$ dist",
120
130
  "dev": "tsc --watch",
121
131
  "typecheck": "tsc --noEmit",
122
132
  "sync-check": "tsx src/schemas/sync-check.ts",