@ggui-ai/protocol 0.1.0-rc.1 → 0.2.0-alpha.1
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.
- package/README.md +3 -3
- package/dist/bridge/invoke-agent.d.ts +8 -8
- package/dist/bridge/invoke-agent.d.ts.map +1 -1
- package/dist/bridge/invoke-agent.js +12 -12
- package/dist/envelopes/builders.d.ts +2 -4
- package/dist/envelopes/builders.d.ts.map +1 -1
- package/dist/envelopes/builders.js +2 -6
- package/dist/gadgets/stdlib-gadgets.d.ts +1 -1
- package/dist/gadgets/stdlib-gadgets.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/integrations/mcp-apps.d.ts +354 -711
- package/dist/integrations/mcp-apps.d.ts.map +1 -1
- package/dist/integrations/mcp-apps.js +266 -208
- package/dist/recommended-prompts.d.ts +1 -1
- package/dist/recommended-prompts.js +1 -1
- package/dist/schemas/data-contract.d.ts +4 -3
- package/dist/schemas/data-contract.d.ts.map +1 -1
- package/dist/schemas/data-contract.js +4 -3
- package/dist/schemas/invoke.d.ts +2 -2
- package/dist/schemas/invoke.js +2 -2
- package/dist/schemas/mcp.d.ts +60 -79
- package/dist/schemas/mcp.d.ts.map +1 -1
- package/dist/schemas/mcp.js +93 -116
- package/dist/schemas/sync-check.js +1 -1
- package/dist/stream/stream-parser.d.ts +4 -4
- package/dist/stream/stream-parser.d.ts.map +1 -1
- package/dist/stream/stream-parser.js +9 -9
- package/dist/transport/websocket.d.ts +14 -49
- package/dist/transport/websocket.d.ts.map +1 -1
- package/dist/types/app-config.d.ts +17 -32
- package/dist/types/app-config.d.ts.map +1 -1
- package/dist/types/canvas-lifecycle.d.ts +13 -13
- package/dist/types/canvas-lifecycle.d.ts.map +1 -1
- package/dist/types/canvas-lifecycle.js +3 -3
- package/dist/types/contract-inference.d.ts +4 -7
- package/dist/types/contract-inference.d.ts.map +1 -1
- package/dist/types/data-bindings.d.ts +1 -1
- package/dist/types/data-bindings.d.ts.map +1 -1
- package/dist/types/data-contract.d.ts +10 -10
- package/dist/types/data-contract.d.ts.map +1 -1
- package/dist/types/events.d.ts +14 -56
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/events.js +1 -8
- package/dist/types/feedback.d.ts +2 -4
- package/dist/types/feedback.d.ts.map +1 -1
- package/dist/types/handshake-suggestion.d.ts +1 -1
- package/dist/types/host-context.d.ts +5 -15
- package/dist/types/host-context.d.ts.map +1 -1
- package/dist/types/host-context.js +1 -1
- package/dist/types/live-channel.d.ts +128 -191
- package/dist/types/live-channel.d.ts.map +1 -1
- package/dist/types/llm-route.d.ts +233 -0
- package/dist/types/llm-route.d.ts.map +1 -0
- package/dist/types/llm-route.js +433 -0
- package/dist/types/llm.d.ts +35 -17
- package/dist/types/llm.d.ts.map +1 -1
- package/dist/types/llm.js +50 -39
- package/dist/types/mcp.d.ts +47 -137
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/mcp.js +2 -2
- package/dist/types/openrouter-models.d.ts +3 -2
- package/dist/types/openrouter-models.d.ts.map +1 -1
- package/dist/types/render-event.d.ts +119 -0
- package/dist/types/render-event.d.ts.map +1 -0
- package/dist/types/render-event.js +38 -0
- package/dist/types/session.d.ts +216 -342
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/ui-generator.d.ts +8 -9
- package/dist/types/ui-generator.d.ts.map +1 -1
- package/dist/validation/contract-validator.d.ts +60 -4
- package/dist/validation/contract-validator.d.ts.map +1 -1
- package/dist/validation/contract-validator.js +101 -5
- package/dist/validation/reserved-channels.d.ts +1 -1
- package/dist/validation/reserved-channels.js +5 -5
- package/dist/validation/sanitize-error.js +1 -1
- package/dist/validation/schema-compat-invariants.d.ts +2 -2
- package/dist/validation/schema-compat-invariants.js +2 -2
- package/dist/validation/schema-meta-validation.d.ts +1 -1
- package/dist/validation/schema-meta-validation.js +2 -2
- package/dist/validation/schema-subset.d.ts +1 -1
- package/dist/version.d.ts +253 -46
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +253 -46
- package/package.json +17 -16
- package/dist/navigation/index.d.ts +0 -3
- package/dist/navigation/index.d.ts.map +0 -1
- package/dist/navigation/index.js +0 -1
- package/dist/navigation/stack-navigation.d.ts +0 -55
- package/dist/navigation/stack-navigation.d.ts.map +0 -1
- package/dist/navigation/stack-navigation.js +0 -80
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RenderEvent ledger — wire-frame replay primitives (R7).
|
|
3
|
+
*
|
|
4
|
+
* Core protocol-layer types backing the unified cursor-replay model.
|
|
5
|
+
* The same ledger is read by:
|
|
6
|
+
*
|
|
7
|
+
* - `GET /api/renders/:renderId/events?sinceSequence=N&limit=M` —
|
|
8
|
+
* HTTP cursor-replay endpoint; polling clients walk it on a
|
|
9
|
+
* 2s tick.
|
|
10
|
+
* - WS `subscribe` with `SubscribePayload.sinceSequence` — server
|
|
11
|
+
* replays events with `seq > sinceSequence` as `render_event`
|
|
12
|
+
* wire frames BEFORE entering live-stream mode.
|
|
13
|
+
*
|
|
14
|
+
* Two transports, same cursor — switching transports does not lose
|
|
15
|
+
* events.
|
|
16
|
+
*
|
|
17
|
+
* # Why this is core (not an integration)
|
|
18
|
+
*
|
|
19
|
+
* RenderEvent is the wire-frame ledger shape — the structural unit
|
|
20
|
+
* the live-channel transport replays. It sits at the same layer as
|
|
21
|
+
* other transport-level types (`StreamEnvelope`, `AckPayload`). It is
|
|
22
|
+
* NOT an MCP-Apps-integration-specific concept — it's the protocol's
|
|
23
|
+
* primary durable cursor primitive, equally consumed by the
|
|
24
|
+
* `@ggui-ai/iframe-runtime` polling layer and any non-MCP-Apps host.
|
|
25
|
+
*
|
|
26
|
+
* # Source of truth
|
|
27
|
+
*
|
|
28
|
+
* This is the canonical definition. The server-side `RenderStore`
|
|
29
|
+
* seam in `@ggui-ai/mcp-server-core` re-exports these types so
|
|
30
|
+
* implementors (in-memory, sqlite, dynamo) all bind to the same
|
|
31
|
+
* shape. Wave 7 (flatten-render-identity, 2026-05-28): merged the
|
|
32
|
+
* earlier protocol-side `SessionEvent` (sequence + emittedAt + type +
|
|
33
|
+
* payload) into the server-side RenderEvent shape (seq + timestamp +
|
|
34
|
+
* type + data); one ledger primitive everywhere. `timestamp` carries
|
|
35
|
+
* an ISO 8601 UTC string for cross-layer uniformity (was epoch-ms on
|
|
36
|
+
* the server side).
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Append-only ledger event for one render. Each event carries a
|
|
40
|
+
* monotonic `seq` that is gap-free within a single render, starting
|
|
41
|
+
* at 1.
|
|
42
|
+
*
|
|
43
|
+
* Discriminator is `type`; `data` is type-specific and structurally
|
|
44
|
+
* identical to the matching live-channel wire frame's payload.
|
|
45
|
+
* Consumers fold events into local state by dispatching to the
|
|
46
|
+
* registered handler for `event.type`.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export interface RenderEvent<TData = unknown> {
|
|
51
|
+
/**
|
|
52
|
+
* Monotonic, gap-free per render. Starts at 1 for the first event;
|
|
53
|
+
* `0` is the sentinel for "no events yet" / fresh subscriber.
|
|
54
|
+
*/
|
|
55
|
+
readonly seq: number;
|
|
56
|
+
/**
|
|
57
|
+
* Wire-frame type. The canonical taxonomy lives at
|
|
58
|
+
* {@link RenderEventType} for type-discrimination ergonomics;
|
|
59
|
+
* keeping the field as a plain string lets first-party servers mint
|
|
60
|
+
* new types without a protocol bump.
|
|
61
|
+
*/
|
|
62
|
+
readonly type: string;
|
|
63
|
+
/** ISO 8601 UTC timestamp the server stamped on emission. */
|
|
64
|
+
readonly timestamp: string;
|
|
65
|
+
/**
|
|
66
|
+
* Type-specific payload — structurally identical to the matching
|
|
67
|
+
* live-channel frame's payload. Typed at the consumer via
|
|
68
|
+
* discriminating `event.type` before reading.
|
|
69
|
+
*/
|
|
70
|
+
readonly data: TData;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Canonical event-type taxonomy. Implementations MUST emit events for
|
|
74
|
+
* the core types; custom types may be added with a `x-` or `ext:`
|
|
75
|
+
* prefix.
|
|
76
|
+
*
|
|
77
|
+
* No terminal event. Renders decay implicitly via TTL — there is no
|
|
78
|
+
* `'session.closed'` / `'render.terminated'` literal because there is
|
|
79
|
+
* no terminal write to make. Observers detect end-of-life by
|
|
80
|
+
* `expiresAt` elapsing relative to wall-clock.
|
|
81
|
+
*
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
export type RenderEventType = 'ui.created' | 'ui.updated' | 'ui.committed' | 'tool.called' | 'tool.result' | 'user.submitted';
|
|
85
|
+
/**
|
|
86
|
+
* Response body for `GET /api/renders/:renderId/events?sinceSequence=N&limit=M`.
|
|
87
|
+
*
|
|
88
|
+
* Pagination semantics:
|
|
89
|
+
* - `events` — strictly ascending by `seq`; only events with
|
|
90
|
+
* `seq > sinceSequence`, capped at `limit`.
|
|
91
|
+
* - `lastSequence` — the server's current high-water mark
|
|
92
|
+
* (`Render.eventSequence`), NOT the last event's seq in this
|
|
93
|
+
* page. Clients use it to advance their cursor even when the
|
|
94
|
+
* page is empty.
|
|
95
|
+
* - `hasMore` — `true` when `limit` truncated the result. Clients
|
|
96
|
+
* SHOULD immediately re-fetch with `sinceSequence = lastEventInPage.seq`
|
|
97
|
+
* until `hasMore === false`.
|
|
98
|
+
*
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
export interface EventsResponse {
|
|
102
|
+
readonly events: ReadonlyArray<RenderEvent>;
|
|
103
|
+
readonly lastSequence: number;
|
|
104
|
+
readonly hasMore: boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 410 Gone response body — `sinceSequence` predates the server's
|
|
108
|
+
* replay horizon (events evicted from the bounded ring buffer or
|
|
109
|
+
* never written before the ledger went online). Client recovery:
|
|
110
|
+
* re-mount from a fresh snapshot (`/api/renders/:id/state`) and
|
|
111
|
+
* reset the cursor to the returned `currentSequence`.
|
|
112
|
+
*
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
export interface ReplayHorizonPassedError {
|
|
116
|
+
readonly reason: 'REPLAY_HORIZON_PASSED';
|
|
117
|
+
readonly currentSequence: number;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=render-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-event.d.ts","sourceRoot":"","sources":["../../src/types/render-event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW,CAAC,KAAK,GAAG,OAAO;IAC1C;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,aAAa,GACb,aAAa,GACb,gBAAgB,CAAC;AAErB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;IACzC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RenderEvent ledger — wire-frame replay primitives (R7).
|
|
3
|
+
*
|
|
4
|
+
* Core protocol-layer types backing the unified cursor-replay model.
|
|
5
|
+
* The same ledger is read by:
|
|
6
|
+
*
|
|
7
|
+
* - `GET /api/renders/:renderId/events?sinceSequence=N&limit=M` —
|
|
8
|
+
* HTTP cursor-replay endpoint; polling clients walk it on a
|
|
9
|
+
* 2s tick.
|
|
10
|
+
* - WS `subscribe` with `SubscribePayload.sinceSequence` — server
|
|
11
|
+
* replays events with `seq > sinceSequence` as `render_event`
|
|
12
|
+
* wire frames BEFORE entering live-stream mode.
|
|
13
|
+
*
|
|
14
|
+
* Two transports, same cursor — switching transports does not lose
|
|
15
|
+
* events.
|
|
16
|
+
*
|
|
17
|
+
* # Why this is core (not an integration)
|
|
18
|
+
*
|
|
19
|
+
* RenderEvent is the wire-frame ledger shape — the structural unit
|
|
20
|
+
* the live-channel transport replays. It sits at the same layer as
|
|
21
|
+
* other transport-level types (`StreamEnvelope`, `AckPayload`). It is
|
|
22
|
+
* NOT an MCP-Apps-integration-specific concept — it's the protocol's
|
|
23
|
+
* primary durable cursor primitive, equally consumed by the
|
|
24
|
+
* `@ggui-ai/iframe-runtime` polling layer and any non-MCP-Apps host.
|
|
25
|
+
*
|
|
26
|
+
* # Source of truth
|
|
27
|
+
*
|
|
28
|
+
* This is the canonical definition. The server-side `RenderStore`
|
|
29
|
+
* seam in `@ggui-ai/mcp-server-core` re-exports these types so
|
|
30
|
+
* implementors (in-memory, sqlite, dynamo) all bind to the same
|
|
31
|
+
* shape. Wave 7 (flatten-render-identity, 2026-05-28): merged the
|
|
32
|
+
* earlier protocol-side `SessionEvent` (sequence + emittedAt + type +
|
|
33
|
+
* payload) into the server-side RenderEvent shape (seq + timestamp +
|
|
34
|
+
* type + data); one ledger primitive everywhere. `timestamp` carries
|
|
35
|
+
* an ISO 8601 UTC string for cross-layer uniformity (was epoch-ms on
|
|
36
|
+
* the server side).
|
|
37
|
+
*/
|
|
38
|
+
export {};
|