@ggui-ai/protocol 0.2.0-alpha.3 → 0.3.0-rc.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 (199) hide show
  1. package/README.md +16 -16
  2. package/dist/envelope-adapters.d.ts +6 -5
  3. package/dist/envelope-adapters.d.ts.map +1 -1
  4. package/dist/envelope-adapters.js +3 -3
  5. package/dist/envelopes/builders.d.ts +6 -32
  6. package/dist/envelopes/builders.d.ts.map +1 -1
  7. package/dist/envelopes/builders.js +3 -25
  8. package/dist/errors/version-mismatch.d.ts +1 -1
  9. package/dist/errors/version-mismatch.js +1 -1
  10. package/dist/gadgets/resolve-app-gadgets.d.ts +10 -0
  11. package/dist/gadgets/resolve-app-gadgets.d.ts.map +1 -0
  12. package/dist/gadgets/resolve-app-gadgets.js +19 -0
  13. package/dist/gadgets/resolve-contract-gadgets.d.ts +6 -6
  14. package/dist/gadgets/resolve-contract-gadgets.js +5 -5
  15. package/dist/gadgets/stdlib-gadgets.d.ts +1 -1
  16. package/dist/gadgets/stdlib-gadgets.d.ts.map +1 -1
  17. package/dist/gadgets/stdlib-gadgets.js +43 -22
  18. package/dist/iframe-bridge.d.ts +4 -43
  19. package/dist/iframe-bridge.d.ts.map +1 -1
  20. package/dist/iframe-bridge.js +4 -141
  21. package/dist/index.d.ts +60 -62
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +66 -61
  24. package/dist/integrations/mcp-apps.d.ts +83 -38
  25. package/dist/integrations/mcp-apps.d.ts.map +1 -1
  26. package/dist/integrations/mcp-apps.js +98 -52
  27. package/dist/recommended-prompts.d.ts +1 -1
  28. package/dist/recommended-prompts.js +1 -1
  29. package/dist/registry/blueprint-key.d.ts +3 -0
  30. package/dist/registry/blueprint-key.d.ts.map +1 -1
  31. package/dist/registry/blueprint-key.js +9 -0
  32. package/dist/registry/blueprint-stamp.d.ts +12 -0
  33. package/dist/registry/blueprint-stamp.d.ts.map +1 -0
  34. package/dist/registry/blueprint-stamp.js +12 -0
  35. package/dist/registry/canonicalize-contract.d.ts +31 -2
  36. package/dist/registry/canonicalize-contract.d.ts.map +1 -1
  37. package/dist/registry/canonicalize-contract.js +125 -13
  38. package/dist/registry/portable-blueprint.d.ts +64 -0
  39. package/dist/registry/portable-blueprint.d.ts.map +1 -0
  40. package/dist/registry/portable-blueprint.js +103 -0
  41. package/dist/registry/summarize-contract.d.ts +7 -2
  42. package/dist/registry/summarize-contract.d.ts.map +1 -1
  43. package/dist/registry/summarize-contract.js +12 -3
  44. package/dist/registry/variant-key.d.ts +17 -0
  45. package/dist/registry/variant-key.d.ts.map +1 -0
  46. package/dist/registry/variant-key.js +22 -0
  47. package/dist/schema-learning/derive-contract.d.ts +2 -2
  48. package/dist/schema-learning/derive-contract.js +2 -2
  49. package/dist/schema-learning/merge.d.ts.map +1 -1
  50. package/dist/schema-learning/merge.js +3 -2
  51. package/dist/schemas/app-theme.d.ts +38 -0
  52. package/dist/schemas/app-theme.d.ts.map +1 -0
  53. package/dist/schemas/app-theme.js +43 -0
  54. package/dist/schemas/blueprint.d.ts +30 -11
  55. package/dist/schemas/blueprint.d.ts.map +1 -1
  56. package/dist/schemas/blueprint.js +62 -26
  57. package/dist/schemas/data-contract.d.ts +28 -30
  58. package/dist/schemas/data-contract.d.ts.map +1 -1
  59. package/dist/schemas/data-contract.js +26 -26
  60. package/dist/schemas/handshake-suggestion.d.ts +2 -4
  61. package/dist/schemas/handshake-suggestion.d.ts.map +1 -1
  62. package/dist/schemas/handshake-suggestion.js +5 -14
  63. package/dist/schemas/mcp.d.ts +240 -58
  64. package/dist/schemas/mcp.d.ts.map +1 -1
  65. package/dist/schemas/mcp.js +285 -93
  66. package/dist/schemas/ops-blueprint.d.ts +12 -12
  67. package/dist/schemas/ops-blueprint.d.ts.map +1 -1
  68. package/dist/schemas/ops-blueprint.js +14 -24
  69. package/dist/screen-blueprints/define.d.ts +2 -2
  70. package/dist/screen-blueprints/match.d.ts +12 -7
  71. package/dist/screen-blueprints/match.d.ts.map +1 -1
  72. package/dist/screen-blueprints/match.js +7 -5
  73. package/dist/screen-blueprints/types.d.ts +14 -18
  74. package/dist/screen-blueprints/types.d.ts.map +1 -1
  75. package/dist/transport/websocket.d.ts +5 -26
  76. package/dist/transport/websocket.d.ts.map +1 -1
  77. package/dist/types/app-config.d.ts +0 -1
  78. package/dist/types/app-config.d.ts.map +1 -1
  79. package/dist/types/auth.d.ts +1 -46
  80. package/dist/types/auth.d.ts.map +1 -1
  81. package/dist/types/blueprint-source.d.ts +123 -0
  82. package/dist/types/blueprint-source.d.ts.map +1 -0
  83. package/dist/types/blueprint-source.js +126 -0
  84. package/dist/types/blueprint.d.ts +25 -18
  85. package/dist/types/blueprint.d.ts.map +1 -1
  86. package/dist/types/contract-inference.d.ts +2 -43
  87. package/dist/types/contract-inference.d.ts.map +1 -1
  88. package/dist/types/data-contract.d.ts +59 -344
  89. package/dist/types/data-contract.d.ts.map +1 -1
  90. package/dist/types/data-contract.js +5 -12
  91. package/dist/types/events.d.ts +31 -69
  92. package/dist/types/events.d.ts.map +1 -1
  93. package/dist/types/{render-event.d.ts → ggui-session-event.d.ts} +15 -15
  94. package/dist/types/ggui-session-event.d.ts.map +1 -0
  95. package/dist/types/{render-event.js → ggui-session-event.js} +5 -5
  96. package/dist/types/handshake-suggestion.d.ts +60 -40
  97. package/dist/types/handshake-suggestion.d.ts.map +1 -1
  98. package/dist/types/host-context.d.ts +8 -8
  99. package/dist/types/host-context.d.ts.map +1 -1
  100. package/dist/types/host-context.js +5 -5
  101. package/dist/types/invoke.d.ts +1 -13
  102. package/dist/types/invoke.d.ts.map +1 -1
  103. package/dist/types/{canvas-lifecycle.d.ts → lifecycle.d.ts} +35 -37
  104. package/dist/types/lifecycle.d.ts.map +1 -0
  105. package/dist/types/{canvas-lifecycle.js → lifecycle.js} +12 -14
  106. package/dist/types/live-channel.d.ts +48 -104
  107. package/dist/types/live-channel.d.ts.map +1 -1
  108. package/dist/types/llm.d.ts +13 -24
  109. package/dist/types/llm.d.ts.map +1 -1
  110. package/dist/types/llm.js +23 -53
  111. package/dist/types/mcp.d.ts +55 -176
  112. package/dist/types/mcp.d.ts.map +1 -1
  113. package/dist/types/mcp.js +2 -2
  114. package/dist/types/oauth-user-id.d.ts +12 -0
  115. package/dist/types/oauth-user-id.d.ts.map +1 -0
  116. package/dist/types/oauth-user-id.js +10 -0
  117. package/dist/types/portable-blueprint.d.ts +53 -0
  118. package/dist/types/portable-blueprint.d.ts.map +1 -0
  119. package/dist/types/portable-blueprint.js +8 -0
  120. package/dist/types/{session.d.ts → render.d.ts} +51 -53
  121. package/dist/types/render.d.ts.map +1 -0
  122. package/dist/types/thread.d.ts.map +1 -1
  123. package/dist/types/thread.js +3 -3
  124. package/dist/types/ui-generator.d.ts +5 -46
  125. package/dist/types/ui-generator.d.ts.map +1 -1
  126. package/dist/types/ui-generator.js +1 -53
  127. package/dist/validation/ajv-runtime.d.ts +3 -3
  128. package/dist/validation/ajv-runtime.d.ts.map +1 -1
  129. package/dist/validation/ajv-runtime.js +6 -5
  130. package/dist/validation/contract-validator.d.ts +23 -22
  131. package/dist/validation/contract-validator.d.ts.map +1 -1
  132. package/dist/validation/contract-validator.js +28 -26
  133. package/dist/validation/cross-references.d.ts +3 -3
  134. package/dist/validation/cross-references.js +3 -3
  135. package/dist/validation/hygiene-rules.d.ts +13 -10
  136. package/dist/validation/hygiene-rules.d.ts.map +1 -1
  137. package/dist/validation/hygiene-rules.js +20 -14
  138. package/dist/validation/is-record.d.ts +17 -0
  139. package/dist/validation/is-record.d.ts.map +1 -0
  140. package/dist/validation/is-record.js +18 -0
  141. package/dist/validation/lint-contract.d.ts +9 -8
  142. package/dist/validation/lint-contract.d.ts.map +1 -1
  143. package/dist/validation/lint-contract.js +89 -26
  144. package/dist/validation/name-invariants.d.ts +4 -4
  145. package/dist/validation/name-invariants.js +4 -4
  146. package/dist/validation/reserved-channels.d.ts +43 -46
  147. package/dist/validation/reserved-channels.d.ts.map +1 -1
  148. package/dist/validation/reserved-channels.js +14 -177
  149. package/dist/validation/resolve-stream-channel.d.ts +3 -9
  150. package/dist/validation/resolve-stream-channel.d.ts.map +1 -1
  151. package/dist/validation/resolve-stream-channel.js +3 -4
  152. package/dist/validation/sanitize-error.d.ts +10 -9
  153. package/dist/validation/sanitize-error.d.ts.map +1 -1
  154. package/dist/validation/sanitize-error.js +19 -18
  155. package/dist/validation/schema-compat-invariants.d.ts +1 -1
  156. package/dist/validation/schema-compat-invariants.js +3 -3
  157. package/dist/validation/schema-meta-validation.d.ts +21 -8
  158. package/dist/validation/schema-meta-validation.d.ts.map +1 -1
  159. package/dist/validation/schema-meta-validation.js +28 -14
  160. package/dist/validation/schema-subset.d.ts +9 -8
  161. package/dist/validation/schema-subset.d.ts.map +1 -1
  162. package/dist/validation/ui-security.d.ts +0 -17
  163. package/dist/validation/ui-security.d.ts.map +1 -1
  164. package/dist/validation/ui-security.js +17 -22
  165. package/dist/validation/zod-to-json-schema.d.ts +1 -1
  166. package/dist/validation/zod-to-json-schema.d.ts.map +1 -1
  167. package/dist/validation/zod-to-json-schema.js +4 -3
  168. package/dist/version.d.ts +783 -9
  169. package/dist/version.d.ts.map +1 -1
  170. package/dist/version.js +782 -8
  171. package/package.json +2 -2
  172. package/dist/bridge/invoke-agent.d.ts +0 -65
  173. package/dist/bridge/invoke-agent.d.ts.map +0 -1
  174. package/dist/bridge/invoke-agent.js +0 -113
  175. package/dist/stream/stream-parser.d.ts +0 -62
  176. package/dist/stream/stream-parser.d.ts.map +0 -1
  177. package/dist/stream/stream-parser.js +0 -199
  178. package/dist/types/canvas-lifecycle.d.ts.map +0 -1
  179. package/dist/types/credential.d.ts +0 -41
  180. package/dist/types/credential.d.ts.map +0 -1
  181. package/dist/types/credential.js +0 -32
  182. package/dist/types/data-bindings.d.ts +0 -322
  183. package/dist/types/data-bindings.d.ts.map +0 -1
  184. package/dist/types/data-bindings.js +0 -29
  185. package/dist/types/feedback.d.ts +0 -22
  186. package/dist/types/feedback.d.ts.map +0 -1
  187. package/dist/types/feedback.js +0 -7
  188. package/dist/types/mcp-proxy.d.ts +0 -67
  189. package/dist/types/mcp-proxy.d.ts.map +0 -1
  190. package/dist/types/mcp-proxy.js +0 -46
  191. package/dist/types/openrouter-models.d.ts +0 -23
  192. package/dist/types/openrouter-models.d.ts.map +0 -1
  193. package/dist/types/openrouter-models.js +0 -4843
  194. package/dist/types/region.d.ts +0 -26
  195. package/dist/types/region.d.ts.map +0 -1
  196. package/dist/types/region.js +0 -36
  197. package/dist/types/render-event.d.ts.map +0 -1
  198. package/dist/types/session.d.ts.map +0 -1
  199. /package/dist/types/{session.js → render.js} +0 -0
@@ -1,24 +1,21 @@
1
1
  /**
2
- * Canvas-mode lifecycle envelopes.
2
+ * Generation-progress lifecycle envelopes.
3
3
  *
4
4
  * Carried over the reserved `_ggui:lifecycle` channel via `data`
5
5
  * WebSocket messages. The server emits at four lifecycle moments;
6
- * canvas iframes consume (via the animator host) to drive their
7
- * pill state machine:
6
+ * subscribed clients consume them to drive progress indicators:
8
7
  *
9
8
  * - `handshake_started` / `handshake_completed`: bracket each
10
- * `ggui_handshake` call so the animator can render "negotiating"
9
+ * `ggui_handshake` call so a progress UI can render "negotiating"
11
10
  * during the gap.
12
11
  * - `render_started`: emitted at the gen gate of `ggui_render`, before
13
- * the final `render` envelope lands. Drives the animator's
14
- * `constructing` state. The eventual `render` envelope (existing
15
- * wire type) signals completion → animator transitions to
16
- * `content`.
12
+ * the final `render` envelope lands. Drives a "constructing"
13
+ * indicator. The eventual `render` envelope (existing wire type)
14
+ * signals completion → the indicator gives way to content.
17
15
  * - `consume_polling`: signals that `ggui_consume` opened a long-
18
- * poll. The animator's `listening` state. The complementary
19
- * "close" signal is the existing `drain_ack` envelope (consume
20
- * drained an action) — no separate "closed" lifecycle kind is
21
- * needed.
16
+ * poll — a "listening" indicator. The complementary "close"
17
+ * signal is the existing `drain_ack` envelope (consume drained an
18
+ * action) — no separate "closed" lifecycle kind is needed.
22
19
  *
23
20
  * Discriminated on `kind`. Adding a kind is a protocol-version bump,
24
21
  * not a silent extension — keeps the union closed so producers and
@@ -30,38 +27,39 @@
30
27
  *
31
28
  * Boundary discipline:
32
29
  * - This module describes ENVELOPE SHAPES carried on a reserved
33
- * channel. It does NOT describe the animator state machine that
34
- * consumes them (lives in `@ggui-ai/iframe-runtime/canvas/animator`).
30
+ * channel. It does NOT describe the progress-indicator state
31
+ * machine that consumes them — that is client-side presentation,
32
+ * outside the protocol.
35
33
  * - This module is `data` only — no functions, no reducers. Pure
36
34
  * types so the protocol bundle stays tiny.
37
35
  */
38
36
  import type { JsonObject } from './data-contract';
39
37
  /**
40
38
  * Emitted when the server starts processing a `ggui_handshake` call.
41
- * Animator transitions from current state into `handshake` (or its
42
- * `content`-substate equivalent).
39
+ * Progress UIs transition from their current state into a
40
+ * "negotiating" indicator.
43
41
  */
44
42
  export interface HandshakeStartedPayload extends JsonObject {
45
43
  readonly kind: 'handshake_started';
46
44
  readonly handshakeId: string;
47
- /** Agent's intent string — animator may surface this as a label. */
45
+ /** Agent's intent string — consumers may surface this as a label. */
48
46
  readonly intent: string;
49
47
  }
50
48
  /**
51
- * Emitted when the server finishes a `ggui_handshake` call. Animator
52
- * either drops back to `ready`/`content` (no gen expected) or
53
- * pre-warms to `constructing` if `genExpected: true` so the
54
- * transition from handshake → constructing doesn't flicker.
49
+ * Emitted when the server finishes a `ggui_handshake` call. A progress
50
+ * UI either drops back to its idle/content state (no gen expected) or
51
+ * pre-warms its "constructing" indicator if `genExpected: true` so the
52
+ * handshake → constructing transition doesn't flicker.
55
53
  */
56
54
  export interface HandshakeCompletedPayload extends JsonObject {
57
55
  readonly kind: 'handshake_completed';
58
56
  readonly handshakeId: string;
59
- /** Negotiator outcome — informational; animator may surface. */
57
+ /** Negotiator outcome — informational; consumers may surface. */
60
58
  readonly outcome: 'accepted' | 'amended' | 'declined' | 'cached';
61
59
  /**
62
60
  * Whether a cold gen is about to follow this handshake. When true,
63
- * the canvas may pre-warm the `constructing` state to suppress a
64
- * `handshake → ready → constructing` flicker.
61
+ * the consumer may pre-warm its "constructing" indicator to suppress
62
+ * a `handshake → idle → constructing` flicker.
65
63
  */
66
64
  readonly genExpected: boolean;
67
65
  }
@@ -72,34 +70,34 @@ export interface HandshakeCompletedPayload extends JsonObject {
72
70
  */
73
71
  export interface RenderStartedPayload extends JsonObject {
74
72
  readonly kind: 'render_started';
75
- /** The render id the eventual `render` envelope will carry. */
76
- readonly renderId: string;
77
- /** Echoed for the animator label ("Building: <intent>"). */
73
+ /** The GguiSession id the eventual `render` envelope will carry. */
74
+ readonly sessionId: string;
75
+ /** Echoed for the progress label ("Building: <intent>"). */
78
76
  readonly intent: string;
79
77
  }
80
78
  /**
81
79
  * Emitted when `ggui_consume` opens a long-poll (after the action
82
- * pipe is found empty). Animator transitions to `listening`. The
83
- * complementary "close" signal is the existing `drain_ack` envelope.
80
+ * pipe is found empty) — a "listening" indicator. The complementary
81
+ * "close" signal is the existing `drain_ack` envelope.
84
82
  */
85
83
  export interface ConsumePollingPayload extends JsonObject {
86
84
  readonly kind: 'consume_polling';
87
85
  /**
88
86
  * Always `'open'` today — the closing transition is signaled
89
87
  * by the existing `drain_ack` envelope (action consumed) and by the
90
- * absence of further `consume_polling` for the same render.
88
+ * absence of further `consume_polling` for the same GguiSession.
91
89
  * Reserved as a discriminator field rather than implicit so future
92
90
  * `'closed'` / `'timeout'` variants can layer in without a wire
93
91
  * shape change.
94
92
  */
95
93
  readonly state: 'open';
96
- /** Render id whose action pipe is being polled. */
97
- readonly renderId: string;
94
+ /** GguiSession id whose action pipe is being polled. */
95
+ readonly sessionId: string;
98
96
  }
99
97
  /**
100
- * Closed discriminated union of every canvas-mode lifecycle payload.
101
- * New kinds bump the protocol version; consumers narrow on `kind`
102
- * with exhaustive switch.
98
+ * Closed discriminated union of every generation-progress lifecycle
99
+ * payload. New kinds bump the protocol version; consumers narrow on
100
+ * `kind` with exhaustive switch.
103
101
  */
104
- export type CanvasLifecyclePayload = HandshakeStartedPayload | HandshakeCompletedPayload | RenderStartedPayload | ConsumePollingPayload;
105
- //# sourceMappingURL=canvas-lifecycle.d.ts.map
102
+ export type GguiLifecyclePayload = HandshakeStartedPayload | HandshakeCompletedPayload | RenderStartedPayload | ConsumePollingPayload;
103
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/types/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,UAAU;IACzD,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,yBAA0B,SAAQ,UAAU;IAC3D,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IACjE;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACtD,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,oEAAoE;IACpE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACvD,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAC5B,uBAAuB,GACvB,yBAAyB,GACzB,oBAAoB,GACpB,qBAAqB,CAAC"}
@@ -1,24 +1,21 @@
1
1
  /**
2
- * Canvas-mode lifecycle envelopes.
2
+ * Generation-progress lifecycle envelopes.
3
3
  *
4
4
  * Carried over the reserved `_ggui:lifecycle` channel via `data`
5
5
  * WebSocket messages. The server emits at four lifecycle moments;
6
- * canvas iframes consume (via the animator host) to drive their
7
- * pill state machine:
6
+ * subscribed clients consume them to drive progress indicators:
8
7
  *
9
8
  * - `handshake_started` / `handshake_completed`: bracket each
10
- * `ggui_handshake` call so the animator can render "negotiating"
9
+ * `ggui_handshake` call so a progress UI can render "negotiating"
11
10
  * during the gap.
12
11
  * - `render_started`: emitted at the gen gate of `ggui_render`, before
13
- * the final `render` envelope lands. Drives the animator's
14
- * `constructing` state. The eventual `render` envelope (existing
15
- * wire type) signals completion → animator transitions to
16
- * `content`.
12
+ * the final `render` envelope lands. Drives a "constructing"
13
+ * indicator. The eventual `render` envelope (existing wire type)
14
+ * signals completion → the indicator gives way to content.
17
15
  * - `consume_polling`: signals that `ggui_consume` opened a long-
18
- * poll. The animator's `listening` state. The complementary
19
- * "close" signal is the existing `drain_ack` envelope (consume
20
- * drained an action) — no separate "closed" lifecycle kind is
21
- * needed.
16
+ * poll — a "listening" indicator. The complementary "close"
17
+ * signal is the existing `drain_ack` envelope (consume drained an
18
+ * action) — no separate "closed" lifecycle kind is needed.
22
19
  *
23
20
  * Discriminated on `kind`. Adding a kind is a protocol-version bump,
24
21
  * not a silent extension — keeps the union closed so producers and
@@ -30,8 +27,9 @@
30
27
  *
31
28
  * Boundary discipline:
32
29
  * - This module describes ENVELOPE SHAPES carried on a reserved
33
- * channel. It does NOT describe the animator state machine that
34
- * consumes them (lives in `@ggui-ai/iframe-runtime/canvas/animator`).
30
+ * channel. It does NOT describe the progress-indicator state
31
+ * machine that consumes them — that is client-side presentation,
32
+ * outside the protocol.
35
33
  * - This module is `data` only — no functions, no reducers. Pure
36
34
  * types so the protocol bundle stays tiny.
37
35
  */
@@ -15,14 +15,25 @@
15
15
  * The corresponding inbound user-action envelope ({@link ActionEnvelope})
16
16
  * lives in `types/events.ts` alongside the event-type enum.
17
17
  */
18
- import type { Render } from './session';
18
+ import type { GguiSession } from './render';
19
19
  import type { JsonObject, JsonValue, StreamChannelMode } from './data-contract';
20
20
  /**
21
21
  * Payload for subscribe message
22
22
  */
23
23
  export interface SubscribePayload {
24
- renderId: string;
25
- appId: string;
24
+ sessionId: string;
25
+ /**
26
+ * App (tenant) identity. OPTIONAL — absent ⇒ the server resolves the
27
+ * caller's identity-default app, the same resolution rule the MCP
28
+ * route uses: a token binding (`wsToken` binds `(sessionId, appId)`)
29
+ * wins, then the deployment's identity → appId mapping, then the
30
+ * deployment default. Clients never invent a default; the identity
31
+ * resolves it server-side.
32
+ *
33
+ * When present it MUST match the GguiSession's bound `appId` or the
34
+ * subscribe fails `APP_MISMATCH` (SPEC §12.2.3).
35
+ */
36
+ appId?: string;
26
37
  /** Role of the subscriber: 'user' (Portal) or 'agent' (MCP bridge) */
27
38
  role?: 'user' | 'agent';
28
39
  /**
@@ -42,7 +53,7 @@ export interface SubscribePayload {
42
53
  * the last envelope the client observed.
43
54
  *
44
55
  * Honored only by implementations that expose
45
- * `RenderStreamBuffer`-backed replay. Hosted cloud does NOT
56
+ * `GguiSessionStreamBuffer`-backed replay. Hosted cloud does NOT
46
57
  * yet honor `fromSeq` — the field is silently ignored there. OSS
47
58
  * `@ggui-ai/mcp-server` honors it fully.
48
59
  */
@@ -50,7 +61,7 @@ export interface SubscribePayload {
50
61
  /**
51
62
  * Opaque WS auth credential for initial subscribe — the live-channel
52
63
  * counterpart to a bearer token. Symmetric with {@link
53
- * SubscribePayload.renderId}/`appId`/`wsUrl` — names what it auths.
64
+ * SubscribePayload.sessionId}/`appId`/`wsUrl` — names what it auths.
54
65
  *
55
66
  * **Auth-credential string only.** Identity/render fields ride on
56
67
  * the `ai.ggui/render` slice meta delivered through the MCP Apps
@@ -64,7 +75,7 @@ export interface SubscribePayload {
64
75
  * field with the same semantics:
65
76
  *
66
77
  * - Opaque to the client — validated server-side against the
67
- * subscribe's `renderId` + `appId`.
78
+ * subscribe's `sessionId` + `appId`.
68
79
  * - Short TTL (seconds-to-minutes); stale tokens are rejected
69
80
  * (refresh via `ggui_runtime_refresh_ws_token` within the
70
81
  * refresh window, otherwise re-handshake).
@@ -72,7 +83,7 @@ export interface SubscribePayload {
72
83
  * can reconnect without a fresh handshake.
73
84
  *
74
85
  * On a successful ws-token-authed subscribe, the server SHOULD issue
75
- * a longer-lived reconnect credential via {@link AckPayload.renderToken}.
86
+ * a longer-lived reconnect credential via {@link AckPayload.sessionToken}.
76
87
  *
77
88
  * Mutually compatible with upstream bearer-auth (`Authorization`
78
89
  * header / `?token=` query). When both are present, server behavior
@@ -101,7 +112,7 @@ export interface SubscribePayload {
101
112
  *
102
113
  * **Distinct from `fromSeq`.** `fromSeq` is for per-stream-channel
103
114
  * `StreamEnvelope` replay (declared `streamSpec[name].replay`
104
- * policy); `sinceSequence` is for the render-level event ledger
115
+ * policy); `sinceSequence` is for the GguiSession-level event ledger
105
116
  * (render/update/props_update/etc.). Both cursors travel on the
106
117
  * same subscribe frame and the server honors them independently —
107
118
  * `sinceSequence` events replay first, then per-channel `fromSeq`
@@ -132,14 +143,6 @@ export interface SubscribePayload {
132
143
  * windows.
133
144
  */
134
145
  supportedVersions?: string[];
135
- /**
136
- * Optional bootstrap credential for transports that mint a one-time
137
- * opaque token at handshake (e.g. an MCP Apps `_meta`-delivered short-
138
- * lived bootstrap). Generic string slot, not coupled to any specific
139
- * integration — host adapters interpret the value per their own
140
- * bootstrap contract.
141
- */
142
- bootstrap?: string;
143
146
  }
144
147
  /**
145
148
  * Payload for ack message (subscribe response includes current render)
@@ -147,9 +150,9 @@ export interface SubscribePayload {
147
150
  export interface AckPayload {
148
151
  sequence: number;
149
152
  timestamp: number;
150
- /** Current render snapshot (returned on subscribe). Single item,
153
+ /** Current session snapshot (returned on subscribe). Single item,
151
154
  * not an array — Phase B collapsed the vessel. */
152
- render?: Render;
155
+ session?: GguiSession;
153
156
  /**
154
157
  * Current outbound-stream cursor snapshot at the moment the ack is
155
158
  * sent. Distinct from `sequence` (which counts INBOUND events like
@@ -158,7 +161,7 @@ export interface AckPayload {
158
161
  * - seed their `lastSeenSeq` if they didn't pass `fromSeq` on
159
162
  * subscribe.
160
163
  *
161
- * Absent on implementations without a `RenderStreamBuffer`.
164
+ * Absent on implementations without a `GguiSessionStreamBuffer`.
162
165
  * 0 means the render has recorded no outbound envelopes yet.
163
166
  */
164
167
  streamSeq?: number;
@@ -185,16 +188,16 @@ export interface AckPayload {
185
188
  *
186
189
  * Semantics:
187
190
  * - Longer TTL than the ws token (minutes-to-hours).
188
- * - Bound to the same `renderId` + `appId`.
191
+ * - Bound to the same `sessionId` + `appId`.
189
192
  * - Passed on reconnect via the standard bearer path
190
- * (`Authorization: Bearer <renderToken>` or `?token=`), NOT in
193
+ * (`Authorization: Bearer <sessionToken>` or `?token=`), NOT in
191
194
  * `SubscribePayload.wsToken` (which is short-TTL and credential-scoped).
192
195
  *
193
196
  * Absent when the subscribe was bearer-authed (no ws-token-bound
194
197
  * reconnect credential needed) and on servers that don't implement
195
198
  * ws-token auth.
196
199
  */
197
- renderToken?: string;
200
+ sessionToken?: string;
198
201
  /**
199
202
  * Protocol schema version this server emits on. Advertised on every
200
203
  * successful ack. First-party servers populate this with
@@ -213,11 +216,11 @@ export interface AckPayload {
213
216
  }
214
217
  /**
215
218
  * Payload for render message (Server → Client: agent push event with
216
- * generated/cached UI). Carries a {@link Render} — either a
219
+ * generated/cached UI). Carries a {@link GguiSession} — either a
217
220
  * component variant or an embedded MCP Apps iframe variant.
218
221
  */
219
222
  export interface RenderPayload {
220
- render: Render;
223
+ session: GguiSession;
221
224
  matchType?: string;
222
225
  }
223
226
  /**
@@ -242,8 +245,8 @@ export interface RenderPayload {
242
245
  * addition driven by a concrete client-UX need.
243
246
  */
244
247
  export interface StreamEnvelope {
245
- /** Render this delivery belongs to. */
246
- renderId: string;
248
+ /** GguiSession this delivery belongs to. */
249
+ sessionId: string;
247
250
  /** Channel name (keys into `spec.channels`). */
248
251
  channel: string;
249
252
  /**
@@ -266,7 +269,7 @@ export interface StreamEnvelope {
266
269
  */
267
270
  complete?: boolean;
268
271
  /**
269
- * Render-scoped monotonic outbound sequence. Server-assigned;
272
+ * GguiSession-scoped monotonic outbound sequence. Server-assigned;
270
273
  * clients MUST NOT populate it on producer-side inputs. Gap-free
271
274
  * within a single render, starting at 1. Used by the client to:
272
275
  * - track `lastSeenSeq` for reconnect (pass it back as
@@ -274,7 +277,7 @@ export interface StreamEnvelope {
274
277
  * - dedupe deliveries (at-least-once semantics).
275
278
  *
276
279
  * OPTIONAL because hosted cloud does not yet stamp `seq`;
277
- * implementations backed by `RenderStreamBuffer`
280
+ * implementations backed by `GguiSessionStreamBuffer`
278
281
  * (OSS `@ggui-ai/mcp-server`) always populate it. When absent,
279
282
  * clients treat deliveries as single-shot with no replay possible.
280
283
  * This becomes required once the hosted runtime supports replay.
@@ -290,17 +293,6 @@ export interface StreamEnvelope {
290
293
  */
291
294
  schemaVersion?: string;
292
295
  }
293
- /**
294
- * Payload for stream message (Server → Client)
295
- * Delivers streaming text chunks from the agent in real-time.
296
- */
297
- export interface StreamPayload {
298
- renderId: string;
299
- /** Text chunk from agent. Empty string on final (done=true) message. */
300
- chunk: string;
301
- /** Whether this is the final chunk in the stream. */
302
- done: boolean;
303
- }
304
296
  /**
305
297
  * Payload for error message.
306
298
  * The `details` field is {@link JsonValue} to carry any JSON-safe diagnostic data.
@@ -328,15 +320,15 @@ export interface ErrorPayload {
328
320
  * to begin polling the channel's `streamSpec[ch].source.tool` on the
329
321
  * iframe's behalf and fan results out as `channel_payload` frames.
330
322
  *
331
- * Idempotent on reconnect: replaying the same `{renderId, channelName,
323
+ * Idempotent on reconnect: replaying the same `{sessionId, channelName,
332
324
  * pollIntervalMs?, args?}` triple after a WS disconnect re-binds the
333
325
  * existing subscription rather than minting a duplicate. The server is
334
326
  * authoritative on `pollIntervalMs` — clients propose, server caps to
335
327
  * its policy floor.
336
328
  */
337
329
  export interface ChannelSubscribePayload {
338
- /** Active render id from the iframe's bootstrap. */
339
- renderId: string;
330
+ /** Active GguiSession id from the iframe's bootstrap. */
331
+ sessionId: string;
340
332
  /** Active app id from the iframe's bootstrap. */
341
333
  appId: string;
342
334
  /** Channel name as keyed in `streamSpec`. The source.tool comes from the contract. */
@@ -356,13 +348,13 @@ export interface ChannelSubscribePayload {
356
348
  }
357
349
  /**
358
350
  * Payload for `channel_unsubscribe` (Client → Server). Idempotent: the
359
- * server tolerates an unsubscribe for an unknown `{renderId,
351
+ * server tolerates an unsubscribe for an unknown `{sessionId,
360
352
  * channelName}` pair (treats as a no-op + ack). Closing the WebSocket
361
353
  * implicitly unsubscribes all channels on that subscriber — this
362
354
  * message is for fine-grained mid-render cancellation.
363
355
  */
364
356
  export interface ChannelUnsubscribePayload {
365
- renderId: string;
357
+ sessionId: string;
366
358
  appId: string;
367
359
  channelName: string;
368
360
  }
@@ -377,7 +369,7 @@ export interface ChannelUnsubscribePayload {
377
369
  * semantics as iframe-polled payloads.
378
370
  */
379
371
  export interface ChannelPayloadFrame {
380
- renderId: string;
372
+ sessionId: string;
381
373
  appId: string;
382
374
  channelName: string;
383
375
  /** Server-monotonic sequence for this channel — gap-detection on the client. */
@@ -406,75 +398,34 @@ export interface ChannelPayloadFrame {
406
398
  *
407
399
  * - `CHANNEL_UNKNOWN` — channelName not present in streamSpec.
408
400
  * - `CHANNEL_NOT_LOCAL` — `source.tool` not in `streamWebSocketLocalTools`; iframe must poll directly.
409
- * - `RENDER_NOT_FOUND` — `renderId` not on the server.
401
+ * - `SESSION_NOT_FOUND` — `sessionId` not on the server.
410
402
  * - `SUBSCRIBE_UNAUTHORIZED` — WS auth token expired or render-mismatch.
411
403
  * - `POLL_FAILED` — source.tool invocation threw. `details` carries the error.
412
404
  */
413
405
  export interface ChannelErrorPayload {
414
- renderId: string;
406
+ sessionId: string;
415
407
  channelName: string;
416
- code: 'CHANNEL_UNKNOWN' | 'CHANNEL_NOT_LOCAL' | 'RENDER_NOT_FOUND' | 'SUBSCRIBE_UNAUTHORIZED' | 'POLL_FAILED' | (string & {});
408
+ code: 'CHANNEL_UNKNOWN' | 'CHANNEL_NOT_LOCAL' | 'SESSION_NOT_FOUND' | 'SUBSCRIBE_UNAUTHORIZED' | 'POLL_FAILED' | (string & {});
417
409
  message: string;
418
410
  details?: JsonValue;
419
411
  }
420
- /**
421
- * Payload for close message (Client → Server: close render)
422
- */
423
- export interface ClosePayload {
424
- renderId: string;
425
- }
426
412
  /**
427
413
  * Generation strategy controls how ggui resolves UI generation requests.
428
414
  *
429
- * - `strict` — Only use predefined/cached blueprints. Fails if no match found.
415
+ * - `strict` — Only use cached/curated blueprints. Fails if no match found.
430
416
  * - `balanced` — Try blueprint matching first, fall back to LLM generation.
431
- * - `creative` — Always generate fresh UI via LLM (no blueprint matching).
432
- */
433
- export type GenerationStrategy = 'strict' | 'balanced' | 'creative';
434
- /**
435
- * Progress step during UI generation
436
417
  */
437
- export type ProgressStep = 'queued' | 'primitives' | 'writing' | 'compiling';
438
- /**
439
- * Payload for progress message (Server → Client)
440
- */
441
- export interface ProgressPayload {
442
- renderId: string;
443
- step: ProgressStep;
444
- message: string;
445
- }
446
- /**
447
- * Payload for agent thinking message (Server → Client).
448
- * Sent immediately when a user message is received, before the agent processes it.
449
- * Agent message payload — used for both thinking and final messages.
450
- */
451
- export type AgentMsgType = 'thinking' | 'chat';
452
- export interface AgentMsgPayload {
453
- /** Message type — 'thinking' for status updates, 'chat' for final responses */
454
- type: AgentMsgType;
455
- /** Message text from the agent */
456
- message: string;
457
- /** Render ID */
458
- renderId: string;
459
- }
418
+ export type GenerationStrategy = 'strict' | 'balanced';
460
419
  /**
461
420
  * Payload for props_update message (Server → Client).
462
421
  * Replaces props on an existing rendered component without re-generation.
463
422
  */
464
423
  export interface PropsUpdatePayload {
465
- /** Render id of the rendered component being updated. */
466
- renderId: string;
424
+ /** GguiSession id of the rendered component being updated. */
425
+ sessionId: string;
467
426
  /** New props — full replacement */
468
427
  props: JsonObject;
469
428
  }
470
- /**
471
- * Payload for url message (Server → Client)
472
- * Note: shortCode is returned; client constructs full URL using renderUrl from amplify_outputs
473
- */
474
- export interface UrlPayload {
475
- renderId: string;
476
- shortCode: string;
477
- }
478
429
  /**
479
430
  * System-level event actions sent from platform to client.
480
431
  *
@@ -501,15 +452,8 @@ export interface SystemPayload {
501
452
  status?: string;
502
453
  /** App ID requesting access (used with auth_required for app-scoped grants) */
503
454
  appId?: string;
504
- /** Render ID for WebSocket context (used with auth_required) */
505
- renderId?: string;
506
- }
507
- /**
508
- * Payload for internal:progress message (generator → handler)
509
- */
510
- export interface InternalProgressPayload {
511
- renderId: string;
512
- step: ProgressStep;
455
+ /** GguiSession ID for WebSocket context (used with auth_required) */
456
+ sessionId?: string;
513
457
  }
514
458
  /**
515
459
  * Payload for `drain_ack` (Server → Client). Sent by `ggui_consume` after
@@ -532,8 +476,8 @@ export interface InternalProgressPayload {
532
476
  export interface DrainAckPayload {
533
477
  /** Active app id from the bootstrap that emitted the action. */
534
478
  appId: string;
535
- /** Render the drained event was queued on. */
536
- renderId: string;
479
+ /** GguiSession the drained event was queued on. */
480
+ sessionId: string;
537
481
  /**
538
482
  * Server-assigned `ActionEnvelope.id` of the specific event that
539
483
  * was drained. The iframe-runtime keys its toast resolution on this
@@ -1 +1 @@
1
- {"version":3,"file":"live-channel.d.ts","sourceRoot":"","sources":["../../src/types/live-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAg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;IAClB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -32,17 +32,7 @@
32
32
  * https://ai.google.dev/gemini-api/docs/pricing
33
33
  */
34
34
  import type { LlmProvider } from "./llm-route.js";
35
- /**
36
- * Display metadata keyed by `LlmProvider`. The `bedrock` entry is
37
- * synthesized for UI continuity — operators picking a bedrock route
38
- * still see a label. Pricing/key-prefix conventions for bedrock are
39
- * AWS-IAM driven and don't follow the API-key prefix shape.
40
- */
41
- export declare const PROVIDER_INFO: Record<LlmProvider, {
42
- displayName: string;
43
- keyPrefix: string;
44
- }>;
45
- export type ModelId = "anthropic/claude-haiku-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-6" | "gemini/gemini-3.5-flash" | "gemini/gemini-3.1-flash-lite-preview" | "gemini/gemini-3-flash-preview" | "gemini/gemini-3.1-pro-preview" | "openai/gpt-5.3-codex" | "openai/gpt-5.4" | "openai/gpt-5.4-mini" | "openai/gpt-5.4-nano";
35
+ export type ModelId = "anthropic/claude-haiku-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-6" | "gemini/gemini-3.5-flash" | "gemini/gemini-3.1-flash-lite" | "gemini/gemini-3-flash-preview" | "gemini/gemini-3.1-pro-preview" | "openai/gpt-5.3-codex" | "openai/gpt-5.4" | "openai/gpt-5.4-mini" | "openai/gpt-5.4-nano";
46
36
  export type ModelTier = "fast" | "balanced" | "premium";
47
37
  export interface ModelConfig {
48
38
  id: ModelId;
@@ -52,6 +42,18 @@ export interface ModelConfig {
52
42
  costs: {
53
43
  inputPer1M: number;
54
44
  outputPer1M: number;
45
+ /**
46
+ * Cache-write token rate (Anthropic prices a cache WRITE at ~1.25×
47
+ * the input rate). Omit if the provider doesn't bill prompt caching
48
+ * separately — consumers fall back to {@link inputPer1M}.
49
+ */
50
+ cacheWritePer1M?: number;
51
+ /**
52
+ * Cache-read token rate (Anthropic prices a cache READ at ~0.1× the
53
+ * input rate). Omit if the provider doesn't bill prompt caching
54
+ * separately — consumers fall back to {@link inputPer1M}.
55
+ */
56
+ cacheReadPer1M?: number;
55
57
  };
56
58
  maxTokens: number;
57
59
  supportsTools: boolean;
@@ -63,17 +65,4 @@ export declare const MODEL_REGISTRY: Record<ModelId, ModelConfig>;
63
65
  * Default model for generation
64
66
  */
65
67
  export declare const DEFAULT_MODEL: ModelId;
66
- export declare function isValidModelId(id: string): id is ModelId;
67
- /**
68
- * Get all model IDs for a given provider.
69
- */
70
- export declare function getModelsForProvider(provider: LlmProvider): ModelId[];
71
- /**
72
- * Get all model IDs for a given tier.
73
- */
74
- export declare function getModelsForTier(tier: ModelTier): ModelId[];
75
- /**
76
- * Select the default model for a given tier.
77
- */
78
- export declare function selectModelByTier(tier: ModelTier): ModelId;
79
68
  //# sourceMappingURL=llm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/types/llm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMlD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,WAAW,EACX;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAO3C,CAAC;AAMF,MAAM,MAAM,OAAO,GAEf,4BAA4B,GAC5B,6BAA6B,GAC7B,2BAA2B,GAE3B,yBAAyB,GACzB,sCAAsC,GACtC,+BAA+B,GAC/B,+BAA+B,GAE/B,sBAAsB,GACtB,gBAAgB,GAChB,qBAAqB,GACrB,qBAAqB,CAAC;AAE1B,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,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