@ggui-ai/protocol 0.2.0-alpha.4 → 0.4.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.
- package/README.md +16 -16
- package/dist/envelope-adapters.d.ts +6 -5
- package/dist/envelope-adapters.d.ts.map +1 -1
- package/dist/envelope-adapters.js +3 -3
- package/dist/envelopes/builders.d.ts +6 -32
- package/dist/envelopes/builders.d.ts.map +1 -1
- package/dist/envelopes/builders.js +3 -25
- package/dist/errors/version-mismatch.d.ts +1 -1
- package/dist/errors/version-mismatch.js +1 -1
- package/dist/gadgets/resolve-app-gadgets.d.ts +10 -0
- package/dist/gadgets/resolve-app-gadgets.d.ts.map +1 -0
- package/dist/gadgets/resolve-app-gadgets.js +19 -0
- package/dist/gadgets/resolve-contract-gadgets.d.ts +6 -6
- package/dist/gadgets/resolve-contract-gadgets.js +5 -5
- package/dist/gadgets/stdlib-gadgets.d.ts +1 -1
- package/dist/gadgets/stdlib-gadgets.d.ts.map +1 -1
- package/dist/gadgets/stdlib-gadgets.js +43 -22
- package/dist/iframe-bridge.d.ts +4 -43
- package/dist/iframe-bridge.d.ts.map +1 -1
- package/dist/iframe-bridge.js +4 -141
- package/dist/index.d.ts +60 -62
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -61
- package/dist/integrations/mcp-apps.d.ts +83 -38
- package/dist/integrations/mcp-apps.d.ts.map +1 -1
- package/dist/integrations/mcp-apps.js +98 -52
- package/dist/recommended-prompts.d.ts +1 -1
- package/dist/recommended-prompts.js +1 -1
- package/dist/registry/blueprint-key.d.ts +3 -0
- package/dist/registry/blueprint-key.d.ts.map +1 -1
- package/dist/registry/blueprint-key.js +9 -0
- package/dist/registry/blueprint-stamp.d.ts +12 -0
- package/dist/registry/blueprint-stamp.d.ts.map +1 -0
- package/dist/registry/blueprint-stamp.js +12 -0
- package/dist/registry/canonicalize-contract.d.ts +31 -2
- package/dist/registry/canonicalize-contract.d.ts.map +1 -1
- package/dist/registry/canonicalize-contract.js +125 -13
- package/dist/registry/portable-blueprint.d.ts +71 -0
- package/dist/registry/portable-blueprint.d.ts.map +1 -0
- package/dist/registry/portable-blueprint.js +111 -0
- package/dist/registry/summarize-contract.d.ts +7 -2
- package/dist/registry/summarize-contract.d.ts.map +1 -1
- package/dist/registry/summarize-contract.js +12 -3
- package/dist/registry/variant-key.d.ts +17 -0
- package/dist/registry/variant-key.d.ts.map +1 -0
- package/dist/registry/variant-key.js +22 -0
- package/dist/schema-learning/derive-contract.d.ts +2 -2
- package/dist/schema-learning/derive-contract.js +2 -2
- package/dist/schema-learning/merge.d.ts.map +1 -1
- package/dist/schema-learning/merge.js +3 -2
- package/dist/schemas/app-theme.d.ts +38 -0
- package/dist/schemas/app-theme.d.ts.map +1 -0
- package/dist/schemas/app-theme.js +43 -0
- package/dist/schemas/blueprint.d.ts +30 -11
- package/dist/schemas/blueprint.d.ts.map +1 -1
- package/dist/schemas/blueprint.js +62 -26
- package/dist/schemas/data-contract.d.ts +28 -30
- package/dist/schemas/data-contract.d.ts.map +1 -1
- package/dist/schemas/data-contract.js +26 -26
- package/dist/schemas/handshake-suggestion.d.ts +2 -4
- package/dist/schemas/handshake-suggestion.d.ts.map +1 -1
- package/dist/schemas/handshake-suggestion.js +5 -14
- package/dist/schemas/mcp.d.ts +294 -59
- package/dist/schemas/mcp.d.ts.map +1 -1
- package/dist/schemas/mcp.js +350 -94
- package/dist/schemas/ops-blueprint.d.ts +12 -12
- package/dist/schemas/ops-blueprint.d.ts.map +1 -1
- package/dist/schemas/ops-blueprint.js +14 -24
- package/dist/screen-blueprints/define.d.ts +2 -2
- package/dist/screen-blueprints/match.d.ts +12 -7
- package/dist/screen-blueprints/match.d.ts.map +1 -1
- package/dist/screen-blueprints/match.js +7 -5
- package/dist/screen-blueprints/types.d.ts +14 -18
- package/dist/screen-blueprints/types.d.ts.map +1 -1
- package/dist/transport/websocket.d.ts +5 -26
- package/dist/transport/websocket.d.ts.map +1 -1
- package/dist/types/app-config.d.ts +0 -1
- package/dist/types/app-config.d.ts.map +1 -1
- package/dist/types/auth.d.ts +1 -46
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/blueprint-source.d.ts +123 -0
- package/dist/types/blueprint-source.d.ts.map +1 -0
- package/dist/types/blueprint-source.js +126 -0
- package/dist/types/blueprint.d.ts +25 -18
- package/dist/types/blueprint.d.ts.map +1 -1
- package/dist/types/contract-inference.d.ts +2 -43
- package/dist/types/contract-inference.d.ts.map +1 -1
- package/dist/types/data-contract.d.ts +59 -344
- package/dist/types/data-contract.d.ts.map +1 -1
- package/dist/types/data-contract.js +5 -12
- package/dist/types/events.d.ts +31 -69
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/{render-event.d.ts → ggui-session-event.d.ts} +15 -15
- package/dist/types/ggui-session-event.d.ts.map +1 -0
- package/dist/types/{render-event.js → ggui-session-event.js} +5 -5
- package/dist/types/handshake-suggestion.d.ts +49 -35
- package/dist/types/handshake-suggestion.d.ts.map +1 -1
- package/dist/types/host-context.d.ts +8 -8
- package/dist/types/host-context.d.ts.map +1 -1
- package/dist/types/host-context.js +5 -5
- package/dist/types/invoke.d.ts +1 -13
- package/dist/types/invoke.d.ts.map +1 -1
- package/dist/types/{canvas-lifecycle.d.ts → lifecycle.d.ts} +35 -37
- package/dist/types/lifecycle.d.ts.map +1 -0
- package/dist/types/{canvas-lifecycle.js → lifecycle.js} +12 -14
- package/dist/types/live-channel.d.ts +48 -104
- package/dist/types/live-channel.d.ts.map +1 -1
- package/dist/types/llm-route.d.ts +4 -4
- package/dist/types/llm-route.d.ts.map +1 -1
- package/dist/types/llm-route.js +24 -2
- package/dist/types/llm.d.ts +13 -24
- package/dist/types/llm.d.ts.map +1 -1
- package/dist/types/llm.js +23 -53
- package/dist/types/mcp.d.ts +74 -177
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/mcp.js +11 -4
- package/dist/types/oauth-user-id.d.ts +12 -0
- package/dist/types/oauth-user-id.d.ts.map +1 -0
- package/dist/types/oauth-user-id.js +10 -0
- package/dist/types/portable-blueprint.d.ts +61 -0
- package/dist/types/portable-blueprint.d.ts.map +1 -0
- package/dist/types/portable-blueprint.js +8 -0
- package/dist/types/{session.d.ts → render.d.ts} +51 -53
- package/dist/types/render.d.ts.map +1 -0
- package/dist/types/thread.d.ts.map +1 -1
- package/dist/types/thread.js +3 -3
- package/dist/types/ui-generator.d.ts +24 -47
- package/dist/types/ui-generator.d.ts.map +1 -1
- package/dist/types/ui-generator.js +1 -53
- package/dist/validation/ajv-runtime.d.ts +3 -3
- package/dist/validation/ajv-runtime.d.ts.map +1 -1
- package/dist/validation/ajv-runtime.js +6 -5
- package/dist/validation/contract-validator.d.ts +23 -22
- package/dist/validation/contract-validator.d.ts.map +1 -1
- package/dist/validation/contract-validator.js +28 -26
- package/dist/validation/cross-references.d.ts +3 -3
- package/dist/validation/cross-references.js +3 -3
- package/dist/validation/hygiene-rules.d.ts +9 -9
- package/dist/validation/hygiene-rules.js +13 -13
- package/dist/validation/is-record.d.ts +17 -0
- package/dist/validation/is-record.d.ts.map +1 -0
- package/dist/validation/is-record.js +18 -0
- package/dist/validation/lint-contract.d.ts +1 -1
- package/dist/validation/lint-contract.js +3 -3
- package/dist/validation/name-invariants.d.ts +4 -4
- package/dist/validation/name-invariants.js +4 -4
- package/dist/validation/reserved-channels.d.ts +43 -46
- package/dist/validation/reserved-channels.d.ts.map +1 -1
- package/dist/validation/reserved-channels.js +14 -177
- package/dist/validation/resolve-stream-channel.d.ts +3 -9
- package/dist/validation/resolve-stream-channel.d.ts.map +1 -1
- package/dist/validation/resolve-stream-channel.js +3 -4
- package/dist/validation/sanitize-error.d.ts +10 -9
- package/dist/validation/sanitize-error.d.ts.map +1 -1
- package/dist/validation/sanitize-error.js +19 -18
- package/dist/validation/schema-compat-invariants.d.ts +1 -1
- package/dist/validation/schema-compat-invariants.js +3 -3
- package/dist/validation/schema-meta-validation.d.ts +4 -4
- package/dist/validation/schema-meta-validation.d.ts.map +1 -1
- package/dist/validation/schema-meta-validation.js +7 -9
- package/dist/validation/schema-subset.d.ts +9 -8
- package/dist/validation/schema-subset.d.ts.map +1 -1
- package/dist/validation/ui-security.d.ts +0 -17
- package/dist/validation/ui-security.d.ts.map +1 -1
- package/dist/validation/ui-security.js +17 -22
- package/dist/validation/zod-to-json-schema.d.ts +1 -1
- package/dist/validation/zod-to-json-schema.d.ts.map +1 -1
- package/dist/validation/zod-to-json-schema.js +4 -3
- package/dist/version.d.ts +818 -9
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +817 -8
- package/package.json +3 -3
- package/dist/bridge/invoke-agent.d.ts +0 -65
- package/dist/bridge/invoke-agent.d.ts.map +0 -1
- package/dist/bridge/invoke-agent.js +0 -113
- package/dist/stream/stream-parser.d.ts +0 -62
- package/dist/stream/stream-parser.d.ts.map +0 -1
- package/dist/stream/stream-parser.js +0 -199
- package/dist/types/canvas-lifecycle.d.ts.map +0 -1
- package/dist/types/credential.d.ts +0 -41
- package/dist/types/credential.d.ts.map +0 -1
- package/dist/types/credential.js +0 -32
- package/dist/types/data-bindings.d.ts +0 -322
- package/dist/types/data-bindings.d.ts.map +0 -1
- package/dist/types/data-bindings.js +0 -29
- package/dist/types/feedback.d.ts +0 -22
- package/dist/types/feedback.d.ts.map +0 -1
- package/dist/types/feedback.js +0 -7
- package/dist/types/mcp-proxy.d.ts +0 -67
- package/dist/types/mcp-proxy.d.ts.map +0 -1
- package/dist/types/mcp-proxy.js +0 -46
- package/dist/types/openrouter-models.d.ts +0 -23
- package/dist/types/openrouter-models.d.ts.map +0 -1
- package/dist/types/openrouter-models.js +0 -4843
- package/dist/types/region.d.ts +0 -26
- package/dist/types/region.d.ts.map +0 -1
- package/dist/types/region.js +0 -36
- package/dist/types/render-event.d.ts.map +0 -1
- package/dist/types/session.d.ts.map +0 -1
- /package/dist/types/{session.js → render.js} +0 -0
package/dist/types/events.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import type { JsonValue } from './data-contract';
|
|
2
2
|
/**
|
|
3
|
-
* Event
|
|
3
|
+
* Event type that flows from user to agent.
|
|
4
|
+
*
|
|
5
|
+
* One member by design (actions-vs-context): actions drive turns;
|
|
6
|
+
* context observes state — there is no third category. The pre-
|
|
7
|
+
* actionSpec multi-event vocabulary (`data:change`, `lifecycle:*`,
|
|
8
|
+
* `interaction:*`, `error:*`) was deleted in draft-2026-06-12 — no
|
|
9
|
+
* first-party producer ever constructed those members, and the server
|
|
10
|
+
* only pipes `data:submit` to the agent-facing consume queue. A future
|
|
11
|
+
* second category re-enters with a real producer + a real server-side
|
|
12
|
+
* consumer, never as speculative vocabulary.
|
|
4
13
|
*/
|
|
5
|
-
export type EventType = 'data:submit'
|
|
14
|
+
export type EventType = 'data:submit';
|
|
6
15
|
/**
|
|
7
16
|
* Payload shape for `data:submit` events emitted by `useAction()`.
|
|
8
17
|
*
|
|
9
18
|
* Actions ALWAYS drive turns — every action emits an event the agent
|
|
10
19
|
* reacts to on its next turn through `ggui_consume`. There is no
|
|
11
|
-
* synchronous server-side dispatch
|
|
12
|
-
* optional `tool` hint mirrors the active render's
|
|
13
|
-
* `actionSpec[action].nextStep` so consumers (the WS-direct
|
|
14
|
-
* `wiredActionRouter` for agent-less `ggui serve` deployments, and
|
|
15
|
-
* telemetry on agent-mediated deployments) see which tool the agent
|
|
16
|
-
* intends to call next without re-looking-up the contract.
|
|
20
|
+
* synchronous server-side dispatch.
|
|
17
21
|
*
|
|
18
22
|
* @typeParam TData - Type of the action payload (defaults to `unknown`).
|
|
19
23
|
*/
|
|
@@ -23,21 +27,15 @@ export interface ActionEventValue<TData = unknown> {
|
|
|
23
27
|
/** Action payload (e.g., form data). */
|
|
24
28
|
data: TData;
|
|
25
29
|
/**
|
|
26
|
-
* MCP tool name
|
|
27
|
-
* `actionSpec[action].nextStep`
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* Consumer behavior:
|
|
32
|
-
* - Agent-mediated deployments: read by the agent on `ggui_consume`
|
|
33
|
-
* as a hint; agent decides whether to honor it.
|
|
34
|
-
* - WS-direct agent-less deployments (`ggui serve`): the
|
|
35
|
-
* `wiredActionRouter` fires this tool synchronously when present.
|
|
30
|
+
* MCP tool name populated SERVER-SIDE from the render's
|
|
31
|
+
* `actionSpec[action].nextStep` when the retained `user.submitted`
|
|
32
|
+
* ledger event is built at WS-action ingress. Absent when the
|
|
33
|
+
* action has no `nextStep`.
|
|
36
34
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
35
|
+
* Advisory and ledger-only: operator surfaces (console timeline,
|
|
36
|
+
* inspector feeds) read it. The `ggui_consume` pipe entry is the
|
|
37
|
+
* separate `ConsumeEventEntry` shape, which carries no tool slot —
|
|
38
|
+
* agents read `nextStep` from the contract they authored.
|
|
41
39
|
*/
|
|
42
40
|
tool?: string;
|
|
43
41
|
}
|
|
@@ -59,7 +57,7 @@ export interface ActionEventValue<TData = unknown> {
|
|
|
59
57
|
* - `timestamp` — the server uses its own clock for ordering + log
|
|
60
58
|
* emission; client-supplied timestamps aren't authoritative.
|
|
61
59
|
* - `correlationId` — the doctrine names this for agent-push ↔ user
|
|
62
|
-
* action pairing; `
|
|
60
|
+
* action pairing; `sessionId` covers the narrow case today.
|
|
63
61
|
*
|
|
64
62
|
* Required fields map to existing enforcement concerns; optional fields
|
|
65
63
|
* are doctrine-aligned forward-compat additions that cost nothing on the
|
|
@@ -67,22 +65,20 @@ export interface ActionEventValue<TData = unknown> {
|
|
|
67
65
|
*/
|
|
68
66
|
export interface ActionEnvelope<TPayload = JsonValue> {
|
|
69
67
|
/**
|
|
70
|
-
*
|
|
71
|
-
* envelopes whose
|
|
72
|
-
* render are rejected (
|
|
68
|
+
* GguiSession identity. Server enforces subscriber-render binding —
|
|
69
|
+
* envelopes whose sessionId doesn't match the ws subscriber's bound
|
|
70
|
+
* render are rejected (SESSION_MISMATCH).
|
|
73
71
|
*/
|
|
74
|
-
|
|
72
|
+
sessionId: string;
|
|
75
73
|
/**
|
|
76
|
-
* Action / event type
|
|
77
|
-
* `actionSpec` declarations.
|
|
74
|
+
* Action / event type — always `'data:submit'` (see {@link EventType}).
|
|
75
|
+
* Gated by the active render's `actionSpec` declarations.
|
|
78
76
|
*/
|
|
79
77
|
type: EventType;
|
|
80
78
|
/**
|
|
81
|
-
* Payload for the action.
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* `actionSpec[action].schema`. For non-data:submit types the payload
|
|
85
|
-
* is free-form — no schema enforcement.
|
|
79
|
+
* Payload for the action. Carries the {@link ActionEventValue} shape
|
|
80
|
+
* (`{action, data?, tool?}`) where `data` is validated against the
|
|
81
|
+
* render's `actionSpec[action].schema`.
|
|
86
82
|
*/
|
|
87
83
|
payload?: TPayload;
|
|
88
84
|
/**
|
|
@@ -90,7 +86,7 @@ export interface ActionEnvelope<TPayload = JsonValue> {
|
|
|
90
86
|
* shape; no server enforcement today (no inbound dedup infrastructure
|
|
91
87
|
* yet). Clients SHOULD populate when their transport can replay
|
|
92
88
|
* (e.g., reconnect-with-backfill); server SHOULD dedup by
|
|
93
|
-
* `(
|
|
89
|
+
* `(sessionId, clientSeq)` when dedup lands.
|
|
94
90
|
*/
|
|
95
91
|
clientSeq?: number;
|
|
96
92
|
/**
|
|
@@ -103,38 +99,4 @@ export interface ActionEnvelope<TPayload = JsonValue> {
|
|
|
103
99
|
*/
|
|
104
100
|
schemaVersion?: string;
|
|
105
101
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Emitted when an MCP server requires OAuth credentials that the user
|
|
108
|
-
* has not yet granted. The frontend should display a consent prompt
|
|
109
|
-
* linking to {@link consentUrl}.
|
|
110
|
-
*/
|
|
111
|
-
export interface McpAuthRequiredEvent {
|
|
112
|
-
type: 'system';
|
|
113
|
-
action: 'auth_required';
|
|
114
|
-
/** Identifier of the external service (e.g. `'github'`, `'slack'`) */
|
|
115
|
-
serviceId: string;
|
|
116
|
-
/** Human-readable service name shown in the consent UI */
|
|
117
|
-
displayName: string;
|
|
118
|
-
/** OAuth scopes being requested (optional — omitted when the service uses fixed scopes) */
|
|
119
|
-
scopes?: string[];
|
|
120
|
-
/** URL the user should visit to grant consent */
|
|
121
|
-
consentUrl: string;
|
|
122
|
-
/** Explanatory message for the user (e.g. "GitHub access is required to list repositories") */
|
|
123
|
-
message: string;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Emitted after the user completes (or denies) the OAuth consent flow.
|
|
127
|
-
* The frontend should dismiss the consent prompt and, if `status` is
|
|
128
|
-
* `'ready'`, retry the operation that triggered the auth request.
|
|
129
|
-
*/
|
|
130
|
-
export interface McpCredentialReadyEvent {
|
|
131
|
-
type: 'system';
|
|
132
|
-
action: 'credential_ready';
|
|
133
|
-
/** Identifier of the external service that was authorized */
|
|
134
|
-
serviceId: string;
|
|
135
|
-
/** Whether the credential is now available or the user denied access */
|
|
136
|
-
status: 'ready' | 'denied';
|
|
137
|
-
}
|
|
138
|
-
/** Union of all system events emitted by the MCP credential proxy */
|
|
139
|
-
export type McpCredentialSystemEvent = McpAuthRequiredEvent | McpCredentialReadyEvent;
|
|
140
102
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB,CAAC,KAAK,GAAG,OAAO;IAC/C,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,IAAI,EAAE,KAAK,CAAC;IACZ;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,cAAc,CAAC,QAAQ,GAAG,SAAS;IAClD;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,EAAE,SAAS,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* GguiSessionEvent ledger — wire-frame replay primitives (R7).
|
|
3
3
|
*
|
|
4
4
|
* Core protocol-layer types backing the unified cursor-replay model.
|
|
5
5
|
* The same ledger is read by:
|
|
6
6
|
*
|
|
7
|
-
* - `GET /api/
|
|
7
|
+
* - `GET /api/sessions/:sessionId/events?sinceSequence=N&limit=M` —
|
|
8
8
|
* HTTP cursor-replay endpoint; polling clients walk it on a
|
|
9
9
|
* 2s tick.
|
|
10
10
|
* - WS `subscribe` with `SubscribePayload.sinceSequence` — server
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* # Why this is core (not an integration)
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* GguiSessionEvent is the wire-frame ledger shape — the structural unit
|
|
20
20
|
* the live-channel transport replays. It sits at the same layer as
|
|
21
21
|
* other transport-level types (`StreamEnvelope`, `AckPayload`). It is
|
|
22
22
|
* NOT an MCP-Apps-integration-specific concept — it's the protocol's
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
*
|
|
26
26
|
* # Source of truth
|
|
27
27
|
*
|
|
28
|
-
* This is the canonical definition. The server-side `
|
|
28
|
+
* This is the canonical definition. The server-side `GguiSessionStore`
|
|
29
29
|
* seam in `@ggui-ai/mcp-server-core` re-exports these types so
|
|
30
30
|
* implementors (in-memory, sqlite, dynamo) all bind to the same
|
|
31
31
|
* shape. Wave 7 (flatten-render-identity, 2026-05-28): merged the
|
|
32
32
|
* earlier protocol-side `SessionEvent` (sequence + emittedAt + type +
|
|
33
|
-
* payload) into the server-side
|
|
33
|
+
* payload) into the server-side GguiSessionEvent shape (seq + timestamp +
|
|
34
34
|
* type + data); one ledger primitive everywhere. `timestamp` carries
|
|
35
35
|
* an ISO 8601 UTC string for cross-layer uniformity (was epoch-ms on
|
|
36
36
|
* the server side).
|
|
37
37
|
*/
|
|
38
38
|
/**
|
|
39
|
-
* Append-only ledger event for one
|
|
40
|
-
* monotonic `seq` that is gap-free within a single
|
|
39
|
+
* Append-only ledger event for one GguiSession. Each event carries a
|
|
40
|
+
* monotonic `seq` that is gap-free within a single GguiSession, starting
|
|
41
41
|
* at 1.
|
|
42
42
|
*
|
|
43
43
|
* Discriminator is `type`; `data` is type-specific and structurally
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
*
|
|
48
48
|
* @public
|
|
49
49
|
*/
|
|
50
|
-
export interface
|
|
50
|
+
export interface GguiSessionEvent<TData = unknown> {
|
|
51
51
|
/**
|
|
52
52
|
* Monotonic, gap-free per render. Starts at 1 for the first event;
|
|
53
53
|
* `0` is the sentinel for "no events yet" / fresh subscriber.
|
|
@@ -55,7 +55,7 @@ export interface RenderEvent<TData = unknown> {
|
|
|
55
55
|
readonly seq: number;
|
|
56
56
|
/**
|
|
57
57
|
* Wire-frame type. The canonical taxonomy lives at
|
|
58
|
-
* {@link
|
|
58
|
+
* {@link GguiSessionEventType} for type-discrimination ergonomics;
|
|
59
59
|
* keeping the field as a plain string lets first-party servers mint
|
|
60
60
|
* new types without a protocol bump.
|
|
61
61
|
*/
|
|
@@ -81,15 +81,15 @@ export interface RenderEvent<TData = unknown> {
|
|
|
81
81
|
*
|
|
82
82
|
* @public
|
|
83
83
|
*/
|
|
84
|
-
export type
|
|
84
|
+
export type GguiSessionEventType = 'ui.created' | 'ui.updated' | 'ui.committed' | 'tool.called' | 'tool.result' | 'user.submitted';
|
|
85
85
|
/**
|
|
86
|
-
* Response body for `GET /api/
|
|
86
|
+
* Response body for `GET /api/sessions/:sessionId/events?sinceSequence=N&limit=M`.
|
|
87
87
|
*
|
|
88
88
|
* Pagination semantics:
|
|
89
89
|
* - `events` — strictly ascending by `seq`; only events with
|
|
90
90
|
* `seq > sinceSequence`, capped at `limit`.
|
|
91
91
|
* - `lastSequence` — the server's current high-water mark
|
|
92
|
-
* (`
|
|
92
|
+
* (`GguiSession.eventSequence`), NOT the last event's seq in this
|
|
93
93
|
* page. Clients use it to advance their cursor even when the
|
|
94
94
|
* page is empty.
|
|
95
95
|
* - `hasMore` — `true` when `limit` truncated the result. Clients
|
|
@@ -99,7 +99,7 @@ export type RenderEventType = 'ui.created' | 'ui.updated' | 'ui.committed' | 'to
|
|
|
99
99
|
* @public
|
|
100
100
|
*/
|
|
101
101
|
export interface EventsResponse {
|
|
102
|
-
readonly events: ReadonlyArray<
|
|
102
|
+
readonly events: ReadonlyArray<GguiSessionEvent>;
|
|
103
103
|
readonly lastSequence: number;
|
|
104
104
|
readonly hasMore: boolean;
|
|
105
105
|
}
|
|
@@ -107,7 +107,7 @@ export interface EventsResponse {
|
|
|
107
107
|
* 410 Gone response body — `sinceSequence` predates the server's
|
|
108
108
|
* replay horizon (events evicted from the bounded ring buffer or
|
|
109
109
|
* never written before the ledger went online). Client recovery:
|
|
110
|
-
* re-mount from a fresh snapshot (`/api/
|
|
110
|
+
* re-mount from a fresh snapshot (`/api/sessions/:id/state`) and
|
|
111
111
|
* reset the cursor to the returned `currentSequence`.
|
|
112
112
|
*
|
|
113
113
|
* @public
|
|
@@ -116,4 +116,4 @@ export interface ReplayHorizonPassedError {
|
|
|
116
116
|
readonly reason: 'REPLAY_HORIZON_PASSED';
|
|
117
117
|
readonly currentSequence: number;
|
|
118
118
|
}
|
|
119
|
-
//# sourceMappingURL=
|
|
119
|
+
//# sourceMappingURL=ggui-session-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ggui-session-event.d.ts","sourceRoot":"","sources":["../../src/types/ggui-session-event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB,CAAC,KAAK,GAAG,OAAO;IAC/C;;;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,oBAAoB,GAC5B,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,gBAAgB,CAAC,CAAC;IACjD,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"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* GguiSessionEvent ledger — wire-frame replay primitives (R7).
|
|
3
3
|
*
|
|
4
4
|
* Core protocol-layer types backing the unified cursor-replay model.
|
|
5
5
|
* The same ledger is read by:
|
|
6
6
|
*
|
|
7
|
-
* - `GET /api/
|
|
7
|
+
* - `GET /api/sessions/:sessionId/events?sinceSequence=N&limit=M` —
|
|
8
8
|
* HTTP cursor-replay endpoint; polling clients walk it on a
|
|
9
9
|
* 2s tick.
|
|
10
10
|
* - WS `subscribe` with `SubscribePayload.sinceSequence` — server
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* # Why this is core (not an integration)
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* GguiSessionEvent is the wire-frame ledger shape — the structural unit
|
|
20
20
|
* the live-channel transport replays. It sits at the same layer as
|
|
21
21
|
* other transport-level types (`StreamEnvelope`, `AckPayload`). It is
|
|
22
22
|
* NOT an MCP-Apps-integration-specific concept — it's the protocol's
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
*
|
|
26
26
|
* # Source of truth
|
|
27
27
|
*
|
|
28
|
-
* This is the canonical definition. The server-side `
|
|
28
|
+
* This is the canonical definition. The server-side `GguiSessionStore`
|
|
29
29
|
* seam in `@ggui-ai/mcp-server-core` re-exports these types so
|
|
30
30
|
* implementors (in-memory, sqlite, dynamo) all bind to the same
|
|
31
31
|
* shape. Wave 7 (flatten-render-identity, 2026-05-28): merged the
|
|
32
32
|
* earlier protocol-side `SessionEvent` (sequence + emittedAt + type +
|
|
33
|
-
* payload) into the server-side
|
|
33
|
+
* payload) into the server-side GguiSessionEvent shape (seq + timestamp +
|
|
34
34
|
* type + data); one ledger primitive everywhere. `timestamp` carries
|
|
35
35
|
* an ISO 8601 UTC string for cross-layer uniformity (was epoch-ms on
|
|
36
36
|
* the server side).
|
|
@@ -19,15 +19,16 @@
|
|
|
19
19
|
* the contract. Provisional blueprintId; `amendments`
|
|
20
20
|
* carries the diff vs the agent's draft.
|
|
21
21
|
*
|
|
22
|
-
* Step 3 — the agent
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* Step 3 — the agent renders, optionally posting an `override`
|
|
23
|
+
* (re-aim the contract and/or variance). Omitting `override` accepts the
|
|
24
|
+
* suggestion as-is and resolves the proposed `(contractKey, variantKey)`;
|
|
25
|
+
* an `override` re-resolves the effective identity.
|
|
25
26
|
*
|
|
26
27
|
* Locked decisions:
|
|
27
28
|
*
|
|
28
29
|
* - `blueprintMeta` is ALWAYS present on a successful handshake
|
|
29
|
-
* (Option B from §D5). `codeHash`
|
|
30
|
-
*
|
|
30
|
+
* (Option B from §D5). `codeHash` + `source` are absent on
|
|
31
|
+
* non-cache origins (gen pending — no code, no provenance).
|
|
31
32
|
* - `amendments` is populated only on `origin: 'synth'`. On `cache`
|
|
32
33
|
* and `agent` origins it MUST be omitted.
|
|
33
34
|
* - `validationFindings` is populated only when validators ran AND
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
* telemetry only (synth's amendment already addressed them).
|
|
38
39
|
*/
|
|
39
40
|
import type { Blueprint, BlueprintVariance } from './blueprint.js';
|
|
41
|
+
import type { BlueprintSource } from './blueprint-source.js';
|
|
40
42
|
import type { DataContract, JsonValue } from './data-contract.js';
|
|
41
43
|
/**
|
|
42
44
|
* Where the handshake's `blueprintMeta` came from. Routes the agent's
|
|
@@ -44,10 +46,10 @@ import type { DataContract, JsonValue } from './data-contract.js';
|
|
|
44
46
|
*
|
|
45
47
|
* - `cache` — an existing blueprint matched at or above the per-app
|
|
46
48
|
* threshold. `blueprintMeta.codeHash` is present; the
|
|
47
|
-
* paired `ggui_render({
|
|
49
|
+
* paired `ggui_render({handshakeId, props})` (no `override`)
|
|
48
50
|
* short-circuits to cache delivery.
|
|
49
51
|
* - `agent` — no cache hit, but the agent's draft validated cleanly.
|
|
50
|
-
* `codeHash` absent; gen runs on
|
|
52
|
+
* `codeHash` absent; gen runs on render against the
|
|
51
53
|
* agent's draft contract verbatim.
|
|
52
54
|
* - `synth` — no cache hit AND validation failed. The synth
|
|
53
55
|
* amender produced a new contract; the diff vs the
|
|
@@ -57,7 +59,7 @@ export type SuggestionOrigin = 'cache' | 'agent' | 'synth';
|
|
|
57
59
|
/**
|
|
58
60
|
* Agent's draft on the handshake input — what the agent wants to
|
|
59
61
|
* build. The contract is required; variance + generator are optional
|
|
60
|
-
* hints. The server combines this with its own
|
|
62
|
+
* hints. The server combines this with its own render/app context
|
|
61
63
|
* (cached blueprints, validator outcomes, operator pins) to produce
|
|
62
64
|
* a {@link HandshakeSuggestion}.
|
|
63
65
|
*/
|
|
@@ -104,14 +106,19 @@ export interface BlueprintDraft {
|
|
|
104
106
|
* override (mint a fresh id with its own new draft).
|
|
105
107
|
*
|
|
106
108
|
* `blueprintId` is PROVISIONAL — it becomes durable iff the paired
|
|
107
|
-
*
|
|
109
|
+
* render sends `decision: 'accept'`. An override discards it.
|
|
108
110
|
*/
|
|
109
111
|
export interface BlueprintMeta {
|
|
110
112
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
+
* Stored blueprint id (`bp_<uuid>`). Present only when a cached
|
|
114
|
+
* blueprint backs the suggestion (`origin === 'cache'`) — that is the
|
|
115
|
+
* durable UUID minted at its first render-time registration. ABSENT on
|
|
116
|
+
* `agent` / `synth` origins (D4): the UUID is minted at render-time
|
|
117
|
+
* registration, not at handshake, so there is no id to report yet.
|
|
118
|
+
* Consumers MUST tolerate absence (the telemetry reader omits the
|
|
119
|
+
* clause; the agent falls back to `contractHash`).
|
|
113
120
|
*/
|
|
114
|
-
readonly blueprintId
|
|
121
|
+
readonly blueprintId?: string;
|
|
115
122
|
/** Canonical RFC 8785 (JCS) hash of the suggestion's contract. */
|
|
116
123
|
readonly contractHash: string;
|
|
117
124
|
/**
|
|
@@ -119,8 +126,17 @@ export interface BlueprintMeta {
|
|
|
119
126
|
* 'cache'`. Absent for `agent` / `synth` (gen pending).
|
|
120
127
|
*/
|
|
121
128
|
readonly codeHash?: string;
|
|
122
|
-
/**
|
|
123
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Provenance of the cached code backing this suggestion — the single
|
|
131
|
+
* {@link BlueprintSource} vocabulary, read from the matched
|
|
132
|
+
* blueprint's stored row. Present iff `origin === 'cache'` (same
|
|
133
|
+
* presence rule as {@link codeHash}). ABSENT on `agent` / `synth`
|
|
134
|
+
* origins: generation has not happened yet, so no provenance exists
|
|
135
|
+
* to report — the paired render mints the real `llm` arm from the
|
|
136
|
+
* engine's own metadata stamp at registration time. Fabricating a
|
|
137
|
+
* value here is banned.
|
|
138
|
+
*/
|
|
139
|
+
readonly source?: BlueprintSource;
|
|
124
140
|
/** Variance tags carried through from the suggestion. */
|
|
125
141
|
readonly variance: BlueprintVariance;
|
|
126
142
|
/**
|
|
@@ -190,7 +206,7 @@ export type JsonPatchOp = {
|
|
|
190
206
|
/**
|
|
191
207
|
* The full handshake suggestion. Produced by the server in step-2 of
|
|
192
208
|
* the three-step handshake; the agent reads this in the response and
|
|
193
|
-
* branches its
|
|
209
|
+
* branches its render decision on `origin` (accept vs override).
|
|
194
210
|
*/
|
|
195
211
|
export interface HandshakeSuggestion {
|
|
196
212
|
/** Routing discriminator — see {@link SuggestionOrigin}. */
|
|
@@ -199,6 +215,23 @@ export interface HandshakeSuggestion {
|
|
|
199
215
|
readonly rationale: string;
|
|
200
216
|
/** Provisional blueprint metadata — see {@link BlueprintMeta}. */
|
|
201
217
|
readonly blueprintMeta: BlueprintMeta;
|
|
218
|
+
/**
|
|
219
|
+
* Agent-readable projection of the contract the server proposes the
|
|
220
|
+
* agent build against. Parties: the SERVER produces it from the
|
|
221
|
+
* effective contract; the AGENT consumes it to make ONE accept-vs-
|
|
222
|
+
* override decision knowingly.
|
|
223
|
+
*
|
|
224
|
+
* Obligation: when set, it equals `summarizeContract(effectiveContract)`
|
|
225
|
+
* (the same lossy summary the matcher's judge feeds — one source of
|
|
226
|
+
* truth). OPTIONAL (D5): a malformed/absent contract → omitted (never
|
|
227
|
+
* throws); the agent then falls back to `blueprintMeta.contractHash`.
|
|
228
|
+
* Builders set it whenever a contract is available.
|
|
229
|
+
*
|
|
230
|
+
* This is the agent-readable projection only — the full contract still
|
|
231
|
+
* rides on the handshake record's stored `effectiveContract` for
|
|
232
|
+
* render-time generation.
|
|
233
|
+
*/
|
|
234
|
+
readonly proposedContractSummary?: string;
|
|
202
235
|
/**
|
|
203
236
|
* Populated iff `origin === 'synth'`. Carries the JSON-Patch diff
|
|
204
237
|
* vs the agent's draft and the synth model's reasoning.
|
|
@@ -219,25 +252,6 @@ export interface HandshakeSuggestion {
|
|
|
219
252
|
*/
|
|
220
253
|
readonly validationFindings?: readonly SuggestionFinding[];
|
|
221
254
|
}
|
|
222
|
-
/**
|
|
223
|
-
* Decision discriminator on the push input. Replaces the old
|
|
224
|
-
* `{contract? | contractHash?}` triad with a clearer accept-vs-
|
|
225
|
-
* override branch.
|
|
226
|
-
*
|
|
227
|
-
* - `accept` — use the handshake's `blueprintMeta` verbatim.
|
|
228
|
-
* If `codeHash` is present (origin === 'cache'),
|
|
229
|
-
* delivery is a fast cache fetch. Otherwise gen
|
|
230
|
-
* runs against the suggestion's stored contract.
|
|
231
|
-
* - `override` — mint a fresh blueprintId and run gen against the
|
|
232
|
-
* agent's NEW draft. The provisional id from the
|
|
233
|
-
* handshake is discarded.
|
|
234
|
-
*/
|
|
235
|
-
export type PushDecision = {
|
|
236
|
-
readonly kind: 'accept';
|
|
237
|
-
} | {
|
|
238
|
-
readonly kind: 'override';
|
|
239
|
-
readonly blueprintDraft: BlueprintDraft;
|
|
240
|
-
};
|
|
241
255
|
/**
|
|
242
256
|
* Build a minimal JSON-Patch RFC 6902 diff between two contracts.
|
|
243
257
|
*
|
|
@@ -257,7 +271,7 @@ export type PushDecision = {
|
|
|
257
271
|
export declare function jsonPatch(before: unknown, after: unknown): JsonPatch;
|
|
258
272
|
/**
|
|
259
273
|
* Top-N alternative blueprints surfaced on the handshake response.
|
|
260
|
-
* Agents can override into one of these (
|
|
274
|
+
* Agents can override into one of these (render with `decision:
|
|
261
275
|
* 'override'`) — the alternatives are full {@link Blueprint} rows so
|
|
262
276
|
* the agent inspects everything it needs to decide.
|
|
263
277
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handshake-suggestion.d.ts","sourceRoot":"","sources":["../../src/types/handshake-suggestion.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"handshake-suggestion.d.ts","sourceRoot":"","sources":["../../src/types/handshake-suggestion.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Host Context — projected subset of `McpUiHostContext` ggui captures from
|
|
3
|
-
* the MCP Apps `ui/initialize` response and echoes back to
|
|
3
|
+
* the MCP Apps `ui/initialize` response and echoes back to render state so
|
|
4
4
|
* the agent can reason about device/host capabilities on subsequent turns.
|
|
5
5
|
*
|
|
6
6
|
* The MCP Apps spec (`@modelcontextprotocol/ext-apps`) defines a rich
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* deviceCapabilities). ggui captures it iframe-side at `ui/initialize` and
|
|
10
10
|
* echoes a TRIMMED projection back over the live channel (via the
|
|
11
11
|
* `host_context_observed` outbound message) so the server can persist it on
|
|
12
|
-
* `
|
|
12
|
+
* `GguiSession.hostContext` and surface it on `ggui_handshake` /
|
|
13
13
|
* `ggui_consume` output for the agent.
|
|
14
14
|
*
|
|
15
15
|
* Why a projection rather than passthrough:
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
*
|
|
25
25
|
* What the projection KEEPS:
|
|
26
26
|
*
|
|
27
|
-
* - `availableDisplayModes` / `currentDisplayMode` — drives
|
|
28
|
-
* display-mode escalation policy (
|
|
27
|
+
* - `availableDisplayModes` / `currentDisplayMode` — drives the
|
|
28
|
+
* display-mode escalation policy (MCP Apps inline/fullscreen/pip).
|
|
29
29
|
* - `containerDimensions` — lets the agent reason about layout density
|
|
30
|
-
* and lets the
|
|
30
|
+
* and lets the rendered UI reflow on resize.
|
|
31
31
|
* - `platform` / `deviceCapabilities` — feeds the generator's
|
|
32
32
|
* responsive-UI prompts.
|
|
33
33
|
* - `locale` / `timeZone` — useful for the agent's date/number rendering.
|
|
@@ -74,7 +74,7 @@ export interface HostContextDeviceCapabilities {
|
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Trimmed projection of `McpUiHostContext` that ggui captures iframe-side
|
|
77
|
-
* and echoes to
|
|
77
|
+
* and echoes to render state for agent visibility.
|
|
78
78
|
*
|
|
79
79
|
* Every field is optional. Hosts that emit minimal context project to
|
|
80
80
|
* mostly-empty objects; consumers MUST treat every field as possibly
|
|
@@ -106,7 +106,7 @@ export interface HostContextProjection {
|
|
|
106
106
|
/**
|
|
107
107
|
* Live-channel inbound (client → server) payload that delivers the
|
|
108
108
|
* iframe-captured `HostContextProjection` to the server. Server-side
|
|
109
|
-
* handler writes to `
|
|
109
|
+
* handler writes to `GguiSession.hostContext`; subsequent
|
|
110
110
|
* `ggui_handshake` / `ggui_consume` responses surface the value to the
|
|
111
111
|
* agent via the optional `client.hostContext` field.
|
|
112
112
|
*
|
|
@@ -120,7 +120,7 @@ export interface HostContextProjection {
|
|
|
120
120
|
* stored value; no merge logic.
|
|
121
121
|
*/
|
|
122
122
|
export interface HostContextObservedPayload {
|
|
123
|
-
readonly
|
|
123
|
+
readonly sessionId: string;
|
|
124
124
|
readonly hostContext: HostContextProjection;
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-context.d.ts","sourceRoot":"","sources":["../../src/types/host-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAkBjD,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAMvE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAMlF;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAMD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,qBAAqB;IACpC,oFAAoF;IACpF,QAAQ,CAAC,qBAAqB,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC7D,8EAA8E;IAC9E,QAAQ,CAAC,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IAC/C,+EAA+E;IAC/E,QAAQ,CAAC,mBAAmB,CAAC,EAAE,8BAA8B,CAAC;IAC9D,oCAAoC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,sCAAsC;IACtC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,6BAA6B,CAAC;IAC5D,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAMD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"host-context.d.ts","sourceRoot":"","sources":["../../src/types/host-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAkBjD,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAMvE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAMlF;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAMD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,qBAAqB;IACpC,oFAAoF;IACpF,QAAQ,CAAC,qBAAqB,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC7D,8EAA8E;IAC9E,QAAQ,CAAC,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IAC/C,+EAA+E;IAC/E,QAAQ,CAAC,mBAAmB,CAAC,EAAE,8BAA8B,CAAC;IAC9D,oCAAoC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,sCAAsC;IACtC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,6BAA6B,CAAC;IAC5D,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAMD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAC;CAC7C;AAoBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,qBAAqB,GAAG,SAAS,CAsDlF;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,CAAC,EAAE,qBAAqB,GAAG,SAAS,EACpC,CAAC,EAAE,qBAAqB,GAAG,SAAS,GACnC,OAAO,CAIT;AAGD,YAAY,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Host Context — projected subset of `McpUiHostContext` ggui captures from
|
|
3
|
-
* the MCP Apps `ui/initialize` response and echoes back to
|
|
3
|
+
* the MCP Apps `ui/initialize` response and echoes back to render state so
|
|
4
4
|
* the agent can reason about device/host capabilities on subsequent turns.
|
|
5
5
|
*
|
|
6
6
|
* The MCP Apps spec (`@modelcontextprotocol/ext-apps`) defines a rich
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* deviceCapabilities). ggui captures it iframe-side at `ui/initialize` and
|
|
10
10
|
* echoes a TRIMMED projection back over the live channel (via the
|
|
11
11
|
* `host_context_observed` outbound message) so the server can persist it on
|
|
12
|
-
* `
|
|
12
|
+
* `GguiSession.hostContext` and surface it on `ggui_handshake` /
|
|
13
13
|
* `ggui_consume` output for the agent.
|
|
14
14
|
*
|
|
15
15
|
* Why a projection rather than passthrough:
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
*
|
|
25
25
|
* What the projection KEEPS:
|
|
26
26
|
*
|
|
27
|
-
* - `availableDisplayModes` / `currentDisplayMode` — drives
|
|
28
|
-
* display-mode escalation policy (
|
|
27
|
+
* - `availableDisplayModes` / `currentDisplayMode` — drives the
|
|
28
|
+
* display-mode escalation policy (MCP Apps inline/fullscreen/pip).
|
|
29
29
|
* - `containerDimensions` — lets the agent reason about layout density
|
|
30
|
-
* and lets the
|
|
30
|
+
* and lets the rendered UI reflow on resize.
|
|
31
31
|
* - `platform` / `deviceCapabilities` — feeds the generator's
|
|
32
32
|
* responsive-UI prompts.
|
|
33
33
|
* - `locale` / `timeZone` — useful for the agent's date/number rendering.
|
package/dist/types/invoke.d.ts
CHANGED
|
@@ -5,24 +5,12 @@
|
|
|
5
5
|
* of truth. Do not hand-author parallel types here.
|
|
6
6
|
*/
|
|
7
7
|
import type { z } from 'zod';
|
|
8
|
-
import type { textBlockSchema, toolUseBlockSchema, toolResultBlockSchema, contentBlockSchema,
|
|
8
|
+
import type { textBlockSchema, toolUseBlockSchema, toolResultBlockSchema, contentBlockSchema, invokeEventSchema, invokeErrorCodeSchema, invokeTurnSchema } from '../schemas/invoke';
|
|
9
9
|
export type TextBlock = z.infer<typeof textBlockSchema>;
|
|
10
10
|
export type ToolUseBlock = z.infer<typeof toolUseBlockSchema>;
|
|
11
11
|
export type ToolResultBlock = z.infer<typeof toolResultBlockSchema>;
|
|
12
12
|
export type ContentBlock = z.infer<typeof contentBlockSchema>;
|
|
13
|
-
export type TextDelta = z.infer<typeof textDeltaSchema>;
|
|
14
|
-
export type InputJsonDelta = z.infer<typeof inputJsonDeltaSchema>;
|
|
15
|
-
export type ContentBlockDeltaPayload = z.infer<typeof contentBlockDeltaPayloadSchema>;
|
|
16
|
-
export type MessageStartEvent = z.infer<typeof messageStartEventSchema>;
|
|
17
|
-
export type ContentBlockStartEvent = z.infer<typeof contentBlockStartEventSchema>;
|
|
18
|
-
export type ContentBlockDeltaEvent = z.infer<typeof contentBlockDeltaEventSchema>;
|
|
19
|
-
export type ContentBlockStopEvent = z.infer<typeof contentBlockStopEventSchema>;
|
|
20
|
-
export type MessageDeltaEvent = z.infer<typeof messageDeltaEventSchema>;
|
|
21
|
-
export type MessageStopEvent = z.infer<typeof messageStopEventSchema>;
|
|
22
|
-
export type PingEvent = z.infer<typeof pingEventSchema>;
|
|
23
|
-
export type ErrorEvent = z.infer<typeof errorEventSchema>;
|
|
24
13
|
export type InvokeEvent = z.infer<typeof invokeEventSchema>;
|
|
25
14
|
export type InvokeErrorCode = z.infer<typeof invokeErrorCodeSchema>;
|
|
26
15
|
export type InvokeTurn = z.infer<typeof invokeTurnSchema>;
|
|
27
|
-
export type InvokeRequest = z.infer<typeof invokeRequestSchema>;
|
|
28
16
|
//# sourceMappingURL=invoke.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../src/types/invoke.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAEV,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAElB,
|
|
1
|
+
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../src/types/invoke.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAEV,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAElB,iBAAiB,EACjB,qBAAqB,EAErB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAO9D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|