@ggui-ai/protocol 0.1.0-rc.3 → 0.2.0-alpha.2

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 (90) hide show
  1. package/README.md +3 -3
  2. package/dist/bridge/invoke-agent.d.ts +8 -8
  3. package/dist/bridge/invoke-agent.d.ts.map +1 -1
  4. package/dist/bridge/invoke-agent.js +12 -12
  5. package/dist/envelopes/builders.d.ts +2 -4
  6. package/dist/envelopes/builders.d.ts.map +1 -1
  7. package/dist/envelopes/builders.js +2 -6
  8. package/dist/index.d.ts +2 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +4 -3
  11. package/dist/integrations/mcp-apps.d.ts +354 -711
  12. package/dist/integrations/mcp-apps.d.ts.map +1 -1
  13. package/dist/integrations/mcp-apps.js +266 -208
  14. package/dist/recommended-prompts.d.ts +1 -1
  15. package/dist/recommended-prompts.js +1 -1
  16. package/dist/schemas/data-contract.d.ts +4 -3
  17. package/dist/schemas/data-contract.d.ts.map +1 -1
  18. package/dist/schemas/data-contract.js +4 -3
  19. package/dist/schemas/invoke.d.ts +2 -2
  20. package/dist/schemas/invoke.js +2 -2
  21. package/dist/schemas/mcp.d.ts +60 -79
  22. package/dist/schemas/mcp.d.ts.map +1 -1
  23. package/dist/schemas/mcp.js +93 -116
  24. package/dist/schemas/sync-check.js +1 -1
  25. package/dist/stream/stream-parser.d.ts +4 -4
  26. package/dist/stream/stream-parser.d.ts.map +1 -1
  27. package/dist/stream/stream-parser.js +9 -9
  28. package/dist/transport/websocket.d.ts +14 -49
  29. package/dist/transport/websocket.d.ts.map +1 -1
  30. package/dist/types/app-config.d.ts +17 -32
  31. package/dist/types/app-config.d.ts.map +1 -1
  32. package/dist/types/canvas-lifecycle.d.ts +13 -13
  33. package/dist/types/canvas-lifecycle.d.ts.map +1 -1
  34. package/dist/types/canvas-lifecycle.js +3 -3
  35. package/dist/types/contract-inference.d.ts +4 -7
  36. package/dist/types/contract-inference.d.ts.map +1 -1
  37. package/dist/types/data-bindings.d.ts +1 -1
  38. package/dist/types/data-bindings.d.ts.map +1 -1
  39. package/dist/types/data-contract.d.ts +10 -10
  40. package/dist/types/data-contract.d.ts.map +1 -1
  41. package/dist/types/events.d.ts +14 -56
  42. package/dist/types/events.d.ts.map +1 -1
  43. package/dist/types/events.js +1 -8
  44. package/dist/types/feedback.d.ts +2 -4
  45. package/dist/types/feedback.d.ts.map +1 -1
  46. package/dist/types/handshake-suggestion.d.ts +1 -1
  47. package/dist/types/host-context.d.ts +5 -15
  48. package/dist/types/host-context.d.ts.map +1 -1
  49. package/dist/types/host-context.js +1 -1
  50. package/dist/types/live-channel.d.ts +128 -191
  51. package/dist/types/live-channel.d.ts.map +1 -1
  52. package/dist/types/llm-route.d.ts +233 -0
  53. package/dist/types/llm-route.d.ts.map +1 -0
  54. package/dist/types/llm-route.js +433 -0
  55. package/dist/types/llm.d.ts +34 -16
  56. package/dist/types/llm.d.ts.map +1 -1
  57. package/dist/types/llm.js +34 -38
  58. package/dist/types/mcp.d.ts +47 -137
  59. package/dist/types/mcp.d.ts.map +1 -1
  60. package/dist/types/mcp.js +2 -2
  61. package/dist/types/openrouter-models.d.ts +3 -2
  62. package/dist/types/openrouter-models.d.ts.map +1 -1
  63. package/dist/types/render-event.d.ts +119 -0
  64. package/dist/types/render-event.d.ts.map +1 -0
  65. package/dist/types/render-event.js +38 -0
  66. package/dist/types/session.d.ts +216 -342
  67. package/dist/types/session.d.ts.map +1 -1
  68. package/dist/types/ui-generator.d.ts +8 -9
  69. package/dist/types/ui-generator.d.ts.map +1 -1
  70. package/dist/validation/contract-validator.d.ts +60 -4
  71. package/dist/validation/contract-validator.d.ts.map +1 -1
  72. package/dist/validation/contract-validator.js +101 -5
  73. package/dist/validation/reserved-channels.d.ts +1 -1
  74. package/dist/validation/reserved-channels.js +5 -5
  75. package/dist/validation/sanitize-error.js +1 -1
  76. package/dist/validation/schema-compat-invariants.d.ts +2 -2
  77. package/dist/validation/schema-compat-invariants.js +2 -2
  78. package/dist/validation/schema-meta-validation.d.ts +1 -1
  79. package/dist/validation/schema-meta-validation.js +2 -2
  80. package/dist/validation/schema-subset.d.ts +1 -1
  81. package/dist/version.d.ts +253 -46
  82. package/dist/version.d.ts.map +1 -1
  83. package/dist/version.js +253 -46
  84. package/package.json +3 -2
  85. package/dist/navigation/index.d.ts +0 -3
  86. package/dist/navigation/index.d.ts.map +0 -1
  87. package/dist/navigation/index.js +0 -1
  88. package/dist/navigation/stack-navigation.d.ts +0 -55
  89. package/dist/navigation/stack-navigation.d.ts.map +0 -1
  90. package/dist/navigation/stack-navigation.js +0 -80
package/dist/version.d.ts CHANGED
@@ -6,10 +6,118 @@
6
6
  * schema change; the most recent change anchors {@link PROTOCOL_VERSION}.
7
7
  *
8
8
  * --------------------------------------------------------------------
9
- * `GguiBootstrapMeta.compiledValidators` — precompiled eval-free
9
+ * R4 — auth-credential `bootstrap` renamed to `wsToken`; aggregate
10
+ * polling endpoint deleted; console session-meta route renamed
11
+ * (BREAKING, pre-launch):
12
+ *
13
+ * r4.1. **WS auth-credential field renamed.** The wire field that
14
+ * authenticates a live-channel subscribe was named "bootstrap" by
15
+ * historical accident — post-R3 the only thing called "bootstrap"
16
+ * on the wire was the credential, so the term lost its meaning.
17
+ * Renamed everywhere internally to `wsToken` (sharper, symmetric
18
+ * with `wsUrl`):
19
+ * - {@link SubscribePayload.bootstrap} → `SubscribePayload.wsToken`
20
+ * - `?bootstrap=<token>` WS upgrade query → `?wsToken=<token>`
21
+ * - `McpAppAiGguiSessionMeta.token` slice field → `wsToken`
22
+ * - `ChannelClientBootstrap.token` → `wsToken`
23
+ * - `bootstrap-tokens.ts` module → `ws-tokens.ts`
24
+ * - `mintBootstrapToken` / `verifyBootstrapToken` →
25
+ * `mintWsToken` / `verifyWsToken`
26
+ * - `refresh-bootstrap.ts` handler → `refresh-ws-token.ts`
27
+ * - `ggui_runtime_refresh_bootstrap` MCP tool →
28
+ * `ggui_runtime_refresh_ws_token`
29
+ * - Server config `bootstrapSecret` → `wsTokenSecret`
30
+ * The boot-lifecycle observable surface is independent and
31
+ * survives unchanged: {@link BootstrapFailureReason} +
32
+ * `ggui:bootstrap-failed` postMessage describe the boot lifecycle
33
+ * (mounting → code-ready → error), not the credential.
34
+ *
35
+ * r4.2. **`/api/bootstrap/:shortCode` deleted; `/r/:shortCode`
36
+ * content-negotiated.** The standalone JSON polling endpoint was
37
+ * a workaround for `_meta`-stripping hosts + the iframe-runtime's
38
+ * `PollingTransport`. The HTML at `/r/<shortCode>` already
39
+ * inlines the same projection via `__GGUI_META__`. Replaced
40
+ * with one URL, two representations:
41
+ * - `GET /r/:shortCode` with `Accept: text/html` (or default) →
42
+ * HTML shell (unchanged byte-for-byte).
43
+ * - `GET /r/:shortCode` with `Accept: application/json` → slice
44
+ * envelope (`{"ai.ggui/session": {...}, "ai.ggui/stack-item":
45
+ * {...}}`), same shape as the wire `_meta` and the inline
46
+ * `__GGUI_META__` global. Single source of truth.
47
+ * Consumers (iframe-runtime polling, sample-agent useChat
48
+ * fallback, future cross-host clients) all migrate to the
49
+ * content-negotiated endpoint.
50
+ *
51
+ * r4.3. **Inline global renamed.** `window.__GGUI_BOOTSTRAP__` →
52
+ * `window.__GGUI_META__`. The "BOOTSTRAP" prefix referred to the
53
+ * retired aggregate; the global now carries the slice meta pair
54
+ * (same shape as the wire `_meta`), so the name aligns with what
55
+ * the global is.
56
+ *
57
+ * r4.4. **Console meta route renamed.**
58
+ * `/ggui/console/session-bootstrap?session=<id>` →
59
+ * `/ggui/console/sessions/:sessionId/meta`. Same JSON response
60
+ * shape (slice envelope post-R3). Console SessionViewer migrated.
61
+ *
62
+ * r4.5. **Server-side `StackItemBootstrapView` →
63
+ * `StackItemMetaView`; `deriveStackItemBootstrapView` →
64
+ * `deriveStackItemMeta`.** The projection layer's "bootstrap" name
65
+ * was the last lingering vestige of the deleted aggregate.
66
+ *
67
+ * --------------------------------------------------------------------
68
+ * R3 — `_meta.ggui.bootstrap` aggregate split into per-stability-window
69
+ * slices (#109, BREAKING, pre-launch):
70
+ *
71
+ * r3.1. **`_meta.ggui.bootstrap` aggregate DELETED from the wire.**
72
+ * The single-key MCP-Apps envelope ggui shipped for the iframe
73
+ * runtime is replaced by two per-stability-window keys on `_meta`:
74
+ *
75
+ * - `_meta["ai.ggui/session"]` — mount-time identity, boot
76
+ * wiring, live-channel auth, capability advertisements
77
+ * ({@link McpAppAiGguiSessionMeta}).
78
+ * - `_meta["ai.ggui/stack-item"]` — the active stack item:
79
+ * stackItemId, props, action hints, contract pointer,
80
+ * component-mode discriminator
81
+ * ({@link McpAppAiGguiStackItemMeta}).
82
+ *
83
+ * Hosts cache the session slice keyed by `sessionId`; render-only
84
+ * delta pushes carry just `stack-item`. Auth-rotation pushes carry
85
+ * just `session`.
86
+ *
87
+ * r3.2. **`McpAppAiGguiMountView` deleted.** The aggregated TS type
88
+ * (and its pre-R1 `GguiBootstrapMeta` predecessor) is gone.
89
+ * Replaced by {@link McpAppAiGguiMeta} = `{session?, stackItem?}`
90
+ * — the parsed slice pair {@link parseMcpAppAiGguiMeta} returns.
91
+ * Wire-emitter helpers `mergeSlicesIntoMountView`,
92
+ * `splitMountViewIntoSlices`, `mountViewToMcpAppMeta`,
93
+ * `slicesToMcpAppMeta`, `combineMcpAppAiGguiMeta` all retired
94
+ * in favor of {@link parseMcpAppAiGguiMeta} (parse) +
95
+ * {@link toMcpAppEnvelope} (emit).
96
+ *
97
+ * r3.3. **Auth-credential `bootstrap` survives R3.** R3 kept the
98
+ * `bootstrap` naming on the auth-credential surface
99
+ * ({@link SubscribePayload.wsToken}, `ws-tokens.ts`, the
100
+ * `wsTokenSecret` config field, the `mintWsToken` minter, the
101
+ * `__GGUI_META__` inline global, and the
102
+ * `ggui_runtime_refresh_ws_token` tool) on the principle that
103
+ * "bootstrap-the-credential" is a distinct namespace from
104
+ * "bootstrap-the-aggregate". R4 (entry above) retired that
105
+ * naming too — the credential namespace is now `wsToken` /
106
+ * `ws-tokens.*`.
107
+ *
108
+ * r3.4. **Server projection layer renamed in R4.** R3 kept
109
+ * `StackItemBootstrapView` + `deriveStackItemBootstrapView` on
110
+ * the principle that the projection layer is its own namespace.
111
+ * R4 (entry above) renamed both to `StackItemMetaView` +
112
+ * `deriveStackItemMeta` — the projection now feeds slice meta
113
+ * (`{ "ai.ggui/session", "ai.ggui/stack-item" }`), so the
114
+ * "Meta" naming aligns with what the projection produces.
115
+ *
116
+ * --------------------------------------------------------------------
117
+ * `McpAppAiGguiMeta.compiledValidators` — precompiled eval-free
10
118
  * runtime validators (ADDITIVE, non-breaking):
11
119
  *
12
- * - `GguiBootstrapMeta` (and the server's `StackItemBootstrapView`
120
+ * - `McpAppAiGguiMeta` (and the server's `StackItemMetaView`
13
121
  * projection) gain an optional `compiledValidators` field —
14
122
  * `CompiledContractValidators`: ESM validator-module source
15
123
  * strings, one per `propsSpec` / `actionSpec` entry / `streamSpec`
@@ -66,7 +174,7 @@
66
174
  * `loadGadgets()` retired — gadgets direct-imported, runtime registry
67
175
  * per-package (BREAKING, pre-launch):
68
176
  *
69
- * v1. **`GguiBootstrapMeta.gadgets` is per-package.** The channel
177
+ * v1. **`McpAppAiGguiMeta.gadgets` is per-package.** The channel
70
178
  * flipped from one entry per hook (`{hook, package?, bundleUrl?,
71
179
  * bundleSri?}`) to one entry per registered gadget PACKAGE
72
180
  * (`{package, bundleUrl?, bundleSri?}` — `package` REQUIRED). The
@@ -213,7 +321,7 @@
213
321
  * origin buckets. `composeContentSecurityPolicy(origins)` formats
214
322
  * them into a `Content-Security-Policy` header value
215
323
  * (`script-src 'self' 'unsafe-inline' <origins>` so the inline
216
- * `__GGUI_BOOTSTRAP__` survives, `style-src 'self' 'unsafe-inline'
324
+ * `__GGUI_META__` survives, `style-src 'self' 'unsafe-inline'
217
325
  * <origins>`, `connect-src 'self' <origins>`, `img-src 'self'
218
326
  * data: <connect-origins>` so map tiles load). The renderer route
219
327
  * attaches the header on `/r/<shortCode>` ONLY when libraries
@@ -382,31 +490,31 @@
382
490
  *
383
491
  * t1. **`ggui_runtime_claim_pending` retired.** The iframe-side rescue
384
492
  * drain + its 10s claim timer + per-action `pendingActions` map
385
- * are gone. The pipe is now the single source of truth: every
386
- * `submit_action` either succeeds (event lands on the pipe; agent
387
- * drains via `ggui_consume`) or fails (`PIPE_NOT_FOUND` / transport
388
- * error; iframe emits the action inline via `ui/message`). No
389
- * timer, no rescue, no race between two atomic-pop callers.
390
- *
391
- * t2. **`_meta.ggui.userAction` unifies `fallback` + `nudge`.** New
392
- * single discriminator on `ui/message` envelopes replacing the
393
- * separate `_meta.ggui.fallback` (reason: pipe_not_found | timeout)
394
- * + `_meta.ggui.nudge` (no_active_consumer) split:
395
- *
396
- * - `kind: 'queued'` — pipe HAS the event; agent SHOULD dispatch
397
- * the prepared `{tool: 'ggui_consume', args: {stackItemId}}`
398
- * nextStep to drain. Emitted when `submit_action` returned
399
- * `{ok:true, consumerPresent:false}`.
400
- * - `kind: 'inline'` — pipe is GONE; action data + uiContext
401
- * delivered inline in `payload`. Agent MUST act directly on
402
- * `payload.actionData`; calling `ggui_consume` would return
403
- * empty. Emitted when `submit_action` returned PIPE_NOT_FOUND,
404
- * INVALID_ACTION_KIND, or any transport/relay error. Optional
405
- * `nextStep: string` hint surfaces the contract's bound agent
406
- * tool when present.
407
- *
408
- * Type guard `isGguiUserActionMeta` lives on
409
- * `@ggui-ai/protocol/integrations/mcp-apps`.
493
+ * are gone. The pipe is the single source of truth: the agent
494
+ * retrieves every gesture EXCLUSIVELY via `ggui_consume`. When the
495
+ * event lands on the pipe but no consume long-poll is listening
496
+ * (`consumerPresent: false`), the iframe emits a pure-pointer
497
+ * `ui/message` doorbell so a fresh turn drains it; on enqueue
498
+ * failure (`PIPE_NOT_FOUND` / transport error) the gesture is on no
499
+ * pipe, so a local toast surfaces and no `ui/message` is sent. No
500
+ * timer, no rescue, no inline payload, no race between atomic-pop
501
+ * callers.
502
+ *
503
+ * t2. **`content[0]._meta["ai.ggui/userAction"]` PURE DOORBELL.** A
504
+ * single `kind: 'user-action'` slice on `ui/message` envelopes
505
+ * (it replaced the earlier `fallback`/`nudge` split, and then the
506
+ * `queued`/`inline` discriminated union — the `inline` variant's
507
+ * inline payload was a double-trigger hazard). The slice carries
508
+ * ONLY a pointer to the render whose pipe holds the gesture
509
+ * (`renderId` + the prepared `{tool: 'ggui_consume', args:
510
+ * {renderId}}` nextStep); the agent retrieves the action
511
+ * EXCLUSIVELY via `ggui_consume`, so it fires exactly once.
512
+ * Emitted when `submit_action` returned `{ok:true,
513
+ * consumerPresent:false}`. The actionable directive lives in the
514
+ * iframe-authored `ui/message` TEXT (every host forwards it to the
515
+ * model); this `_meta` slice is the OPTIONAL structured mirror —
516
+ * `GguiUserActionMeta` on `@ggui-ai/protocol/integrations/
517
+ * mcp-apps`. No part of the loop depends on a server-side parse.
410
518
  *
411
519
  * t3. **Per-event `uiContext` on the pipe.** `submit_action`'s
412
520
  * `dispatch` payload reshaped from `{intent, data}` to `{intent,
@@ -497,7 +605,7 @@
497
605
  * handler from its `codeStore` + `codeBaseUrl` deps. The
498
606
  * `hasPushBootstrapMeta` discriminator collapses from
499
607
  * `{wsUrl-with-token, componentCode, codeUrl, kind}` to
500
- * `{wsUrl-with-token, codeUrl, kind}`. `StackItemBootstrapView`
608
+ * `{wsUrl-with-token, codeUrl, kind}`. `StackItemMetaView`
501
609
  * drops the field on the projection layer. `buildSelfContainedShell`
502
610
  * accepts `{codeUrl, codeHash}` (or `systemKind`, or live-mode
503
611
  * trio); throws when none are set. `/r/<shortCode>` mints
@@ -508,7 +616,7 @@
508
616
  *
509
617
  * q2. **`_meta.ggui.bootstrap.adapters` retired.** The
510
618
  * dormant dynamic-import-at-boot adapter loader is deleted from
511
- * the wire surface. `GguiBootstrapMeta.adapters?` field removed;
619
+ * the wire surface. `McpAppAiGguiMeta.adapters?` field removed;
512
620
  * `parseAdapterSpecs` + `installAdapters` + the
513
621
  * `globalThis.__ggui__.adapters` registry slot retired from
514
622
  * iframe-runtime. An earlier change had already moved capability
@@ -539,7 +647,7 @@
539
647
  *
540
648
  * Untouched (NOT the tool name): `streamSpec`, `StreamChannelEntry`,
541
649
  * `StreamEnvelope`, `SessionChannelServer`, `streamReplayOps`, and
542
- * file paths like `session-mutations/stream.ts`. These describe the
650
+ * file paths like `renders/stream.ts`. These describe the
543
651
  * channel data plane, not the imperative emit action.
544
652
  * Pre-launch breaking rename; no compatibility shim.
545
653
  *
@@ -554,7 +662,7 @@
554
662
  * `themeId`, `themeMode`, `themeProvider`, `appCallableTools`,
555
663
  * `streamWebSocketLocalTools`) and emits `_meta.ggui.bootstrap`
556
664
  * derived from the just-patched stack item via the shared
557
- * `deriveStackItemBootstrapView` projection — byte-identical to
665
+ * `deriveStackItemMeta` projection — byte-identical to
558
666
  * `ggui_push`'s bootstrap envelope at the projection boundary.
559
667
  * Strictly additive: prior consumers that ignored `resultMeta` are
560
668
  * unaffected; hosts that DO forward `_meta.ggui.bootstrap` now
@@ -564,7 +672,7 @@
564
672
  * `_meta` only.
565
673
  *
566
674
  * p3. **`/r/<shortCode>` mints the live trio (`wsUrl + token + expiresAt`)
567
- * and inlines it in `__GGUI_BOOTSTRAP__`.** Previously the public
675
+ * and inlines it in `__GGUI_META__`.** Previously the public
568
676
  * render route minted no bootstrap token, so iframe-runtime's
569
677
  * `subscribe.ts` rejected the envelope as "live-mode required" and
570
678
  * never opened a WS — `props_update` and stream frames never reached
@@ -808,7 +916,7 @@
808
916
  * gate with per-contract derivation. `StackItem` gains an
809
917
  * optional `clientCapabilities?: ClientCapabilitiesSpec` field
810
918
  * so push commit-time persists the catalog onto the active stack
811
- * item. `StackItemBootstrapView.permissionsPolicy?: readonly
919
+ * item. `StackItemMetaView.permissionsPolicy?: readonly
812
920
  * string[]` projects the union-deduplicated directive list every
813
921
  * transport reads — public-render `/r/<shortCode>` emits a
814
922
  * `Permissions-Policy` HTTP response header (`<directive>=(self)`
@@ -818,9 +926,9 @@
818
926
  * iframe-runtime can surface the gate set to in-iframe consumers.
819
927
  * Browser-enforced gates flow from the parent transport; the
820
928
  * iframe-runtime itself cannot mutate Permissions-Policy
821
- * post-load. `GguiBootstrapMeta` gains an optional matching
929
+ * post-load. `McpAppAiGguiMeta` gains an optional matching
822
930
  * `permissionsPolicy?: readonly string[]` field;
823
- * `validateGguiBootstrapMeta` validates the array shape.
931
+ * `validateMcpAppAiGguiMeta` validates the array shape.
824
932
  * Boilerplate generator (`@ggui-ai/ui-gen`) reads
825
933
  * `clientCapabilities.gadgets` and emits
826
934
  * one combined `import { hookA, hookB } from '<pkg>'` per
@@ -1036,13 +1144,17 @@
1036
1144
  * --------------------------------------------------------------------
1037
1145
  * Canvas mode (additive):
1038
1146
  *
1039
- * 1. `GguiBootstrapMeta.canvasMode?: boolean` — discriminator for
1040
- * the iframe-runtime canvas-mount path. When `true`, the runtime
1041
- * mounts a session-scoped `CanvasShell` (one iframe for the
1042
- * whole session) instead of the legacy per-stack-item iframe.
1043
- * Mutually exclusive with `stackItemId`. Producers SHOULD reject
1044
- * bootstraps with both fields set; the protocol does not
1045
- * require them to. Absent / `false` ⇒ existing inline behavior.
1147
+ * 1. `McpAppAiGguiMeta.displayMode?: 'inline' | 'fullscreen'` —
1148
+ * discriminator for the iframe-runtime canvas-mount path.
1149
+ * When `'fullscreen'`, the runtime mounts a session-scoped
1150
+ * `CanvasShell` (one iframe for the whole session) instead of
1151
+ * the legacy per-stack-item iframe. Mutually exclusive with
1152
+ * `stackItemId`. Producers SHOULD reject bootstraps with both
1153
+ * `displayMode === 'fullscreen'` and `stackItemId` set; the
1154
+ * protocol does not require them to. Absent ⇒ existing inline
1155
+ * behavior. Spec-aligned with MCP App `McpUiDisplayMode` (the
1156
+ * `'pip'` literal is reserved for a future floating-canvas
1157
+ * variant, not yet implemented).
1046
1158
  *
1047
1159
  * 2. `_ggui:lifecycle` reserved channel + `CanvasLifecyclePayload`
1048
1160
  * discriminated union. Server publishes lifecycle envelopes
@@ -1385,8 +1497,103 @@
1385
1497
  * `package` / `version` on a wire ref now fail at parse — the loud
1386
1498
  * failure is the design intent (a caller bug, not a forward-compat
1387
1499
  * hedge).
1500
+ *
1501
+ * --------------------------------------------------------------------
1502
+ * Phase B — flatten-render-identity. Session vessel deleted; renderId
1503
+ * is the single identity referenced across the wire (BREAKING,
1504
+ * pre-launch):
1505
+ *
1506
+ * b1. **`Session` deleted.** The vessel-wrapping-a-stack-of-one model
1507
+ * is gone. `SessionStackEntry` (the actual rendered thing) was
1508
+ * promoted to a flat `Render` union (`ComponentRender | SystemRender
1509
+ * | McpAppsRender`) and `SessionView` was retired. Conversation
1510
+ * grouping (sibling renders within one host chat) flows via the
1511
+ * unchanged `_meta["ai.ggui/host-session"]` channel captured ONCE
1512
+ * at render creation, NOT by lifting fields onto every Render.
1513
+ *
1514
+ * b2. **`sessionId` + `stackItemId` → `renderId`.** One identifier on
1515
+ * the wire (the two values were already the same once each render
1516
+ * was its own thing). Renames cover `SubscribePayload`, `AckPayload`,
1517
+ * `StreamEnvelope`, `ActionEnvelope`, `GguiConsumeInput`,
1518
+ * `GguiCloseInput`, `GguiEmitInput`, `PropsUpdatePayload`,
1519
+ * `DrainAckPayload`, lifecycle events, `submit-action` envelope,
1520
+ * user-action meta. `AckPayload.stack[]` → `AckPayload.render`
1521
+ * (single item — vessel is gone).
1522
+ *
1523
+ * b3. **Tools collapsed: `ggui_new_session` deleted; `ggui_push`
1524
+ * renamed to `ggui_render`.** The three-tool flow is `ggui_handshake`
1525
+ * → `ggui_render` → `ggui_update` / `ggui_consume`. The handshake
1526
+ * mints the render server-side; `ggui_new_session` is gone (its
1527
+ * sessionId minting folded into the handshake-internal renderId
1528
+ * mint). TS aliases `GguiPushInput/Output` → `GguiRenderInput/Output`;
1529
+ * Zod schemas `pushInputSchema` / `pushOutputSchema` → `renderInputSchema`
1530
+ * / `renderOutputSchema`. `handshakeInputSchema.sessionId` REMOVED
1531
+ * (handshake input no longer carries a session handle); `nextStep.tool`
1532
+ * literal `'ggui_push'` → `'ggui_render'`; output `stackItemId` field
1533
+ * → `renderId`. The `'compose'` action enum value dropped (was
1534
+ * multi-item-stack push semantics, retired with the stack).
1535
+ *
1536
+ * b4. **Slice envelope collapsed.** `_meta["ai.ggui/session"]` +
1537
+ * `_meta["ai.ggui/stack-item"]` (the two-key pair) → one
1538
+ * `_meta["ai.ggui/render"]` key carrying identity + boot wiring +
1539
+ * live-channel auth + capability advertisements + render state +
1540
+ * contract pointer + component-mode discriminator. Single-slice
1541
+ * parser `parseMcpAppAiGguiRenderMeta`; emitter
1542
+ * `toMcpAppEnvelope` emits one key.
1543
+ *
1544
+ * b5. **Resource URI renamed.** `ui://ggui/session` → `ui://ggui/render`;
1545
+ * `GGUI_SESSION_RESOURCE_URI` → `GGUI_RENDER_RESOURCE_URI`;
1546
+ * `GGUI_SESSION_UI_META` → `GGUI_RENDER_UI_META`. Error codes
1547
+ * renamed too: `SESSION_NOT_FOUND` → `RENDER_NOT_FOUND`;
1548
+ * `STACK_ITEM_NOT_FOUND` → `RENDER_NOT_FOUND`;
1549
+ * `CONCURRENT_SESSION_LIMIT` → `CONCURRENT_RENDER_LIMIT`.
1550
+ *
1551
+ * b6. **Retired wire-side payloads deleted (no shims).** `PushPayload`,
1552
+ * `PopPayload`, `GetStackPayload`, `SessionPayload`,
1553
+ * `CanvasNavigatedPayload`, `GeneratePayload`, `GenerateAckPayload`,
1554
+ * `GguiNewSessionInput/Output`, `GguiGetStackInput/Output`,
1555
+ * `StackItemSummary`, `EventSubscription`, `DEFAULT_SUBSCRIPTION`,
1556
+ * `Action` re-export, lifecycle-event literals
1557
+ * `lifecycle:stack_push`, `stack_pop`, `session_start`,
1558
+ * `session_end`. `SessionSummaryWire` → `RenderSummaryWire`
1559
+ * (always-1 `stackItemCount` field deleted). Stack-navigation
1560
+ * reducer (`stackNavigationReducer`, `initialNavigationState`,
1561
+ * `StackNavigationState`, `StackNavigationAction`) deleted — no
1562
+ * stack of N to navigate.
1563
+ *
1564
+ * b7. **`ggui_close` tool deleted.** Matches the earlier deletion of
1565
+ * `ggui_new_session`: with the Session vessel gone, there is no
1566
+ * entry-and-exit ceremony to bracket a render. Renders decay
1567
+ * implicitly via TTL — created → active → expired. The
1568
+ * `RenderStatus` union collapses from
1569
+ * `'active' | 'completed' | 'expired'` to `'active' | 'expired'`;
1570
+ * the `'session.closed'` `RenderEventType` literal is gone (no
1571
+ * terminal ledger event); `GguiCloseInput` / `GguiCloseOutput`
1572
+ * types + `closeInputSchema` Zod schema deleted from the protocol
1573
+ * surface. `notifyRenderClosed` observer-notifier seam, the
1574
+ * `RenderStore`-side `closed` bucket flag + per-render-close revoke
1575
+ * paths (`shortCodeIndex.revokeByStackItemId`,
1576
+ * `pendingEventConsumer.markDeleted`) all retire alongside.
1577
+ * Agent-side: the long-poll loop terminates on TTL expiry rather
1578
+ * than on an explicit terminal status.
1579
+ *
1580
+ * b8. **SessionEvent dropped; RenderEvent is the single ledger
1581
+ * primitive (Wave 7, 2026-05-28).** The protocol-side `SessionEvent`
1582
+ * (sequence + emittedAt + type + payload) and the server-side
1583
+ * `RenderEvent` (seq + timestamp[ms-epoch] + type + data) merge
1584
+ * into one canonical `RenderEvent` owned by `@ggui-ai/protocol`.
1585
+ * Field shape: `seq + type + timestamp[ISO 8601 UTC string] +
1586
+ * data`. `EventsResponse.events` now ships `ReadonlyArray<RenderEvent>`.
1587
+ * The WS replay frame discriminator renames
1588
+ * `'session_event' → 'render_event'`; payload type follows the
1589
+ * same shape. `@ggui-ai/mcp-server-core` re-exports `RenderEvent`
1590
+ * / `RenderEventType` from `@ggui-ai/protocol` so downstream
1591
+ * import paths stay stable. Sqlite + DDB stores stamp ISO
1592
+ * strings on write; legacy numeric rows are coerced on read.
1593
+ * Cross-deployment uniformity: the same field type ships from
1594
+ * polling HTTP endpoint, WS replay frame, and store-side `observe()`.
1388
1595
  */
1389
- export declare const PROTOCOL_VERSION = "draft-2026-05-24";
1596
+ export declare const PROTOCOL_VERSION = "draft-2026-05-28";
1390
1597
  /**
1391
1598
  * Schema version stamped onto wire envelopes that opt into the
1392
1599
  * `schemaVersion` forward-compat field (see {@link ActionEnvelope},
@@ -1407,7 +1614,7 @@ export declare const PROTOCOL_VERSION = "draft-2026-05-24";
1407
1614
  * consumers can reference schema-versioning specifically without
1408
1615
  * coupling to the broader cache-invalidation constant.
1409
1616
  */
1410
- export declare const PROTOCOL_SCHEMA_VERSION = "draft-2026-05-24";
1617
+ export declare const PROTOCOL_SCHEMA_VERSION = "draft-2026-05-28";
1411
1618
  /**
1412
1619
  * Canonical live-channel error code emitted when a peer's declared
1413
1620
  * {@link SubscribePayload.supportedVersions} /
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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