@guuey/mcp-apps-host 0.24.0 → 0.26.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 +5 -0
- package/dist/action.d.ts +7 -1
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +7 -1
- package/dist/host-style-variables.d.ts +29 -0
- package/dist/host-style-variables.d.ts.map +1 -0
- package/dist/host-style-variables.js +92 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/react.d.ts +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/view-host-protocol.d.ts +26 -1
- package/dist/view-host-protocol.d.ts.map +1 -1
- package/dist/view-host-protocol.js +12 -1
- package/dist/view-host.d.ts +16 -0
- package/dist/view-host.d.ts.map +1 -1
- package/dist/view-host.js +11 -29
- package/package.json +2 -2
- package/src/action.ts +8 -1
- package/src/host-style-variables.ts +117 -0
- package/src/index.ts +10 -0
- package/src/react.tsx +1 -0
- package/src/view-host-protocol.ts +34 -1
- package/src/view-host.ts +26 -1
package/README.md
CHANGED
|
@@ -56,3 +56,8 @@ package is guuey's OSS host-side support for the same spec.
|
|
|
56
56
|
|
|
57
57
|
Conformance status and roadmap: `docs/development/mcp-apps-host-conformance.md`
|
|
58
58
|
in the guuey monorepo (guuey#123).
|
|
59
|
+
|
|
60
|
+
## Support
|
|
61
|
+
|
|
62
|
+
Questions and help: the guuey community on Discord — https://guuey.com/discord.
|
|
63
|
+
Bugs and feature requests: https://github.com/withguuey/guuey-sdks/issues.
|
package/dist/action.d.ts
CHANGED
|
@@ -128,8 +128,14 @@ export declare const PULL_CIRCUIT_THRESHOLD = 3;
|
|
|
128
128
|
/**
|
|
129
129
|
* Logged ONCE when a locator's pull circuit opens — the bounded-storm marker
|
|
130
130
|
* (sentry's readability ask; the #1233 next-incident is scopeable from it).
|
|
131
|
+
* The SYMBOL is the handle code and tests grep; its VALUE is the sentence a
|
|
132
|
+
* builder reads in their own site's console (guuey#1375) — our one prefix,
|
|
133
|
+
* then what happened and what follows, never an internal token. It says
|
|
134
|
+
* exactly what the circuit does: the relay stops pulling for that locator,
|
|
135
|
+
* the host is told the session is unrestorable (`onSessionUnrestorable`),
|
|
136
|
+
* and nothing retries unattended.
|
|
131
137
|
*/
|
|
132
|
-
export declare const UI_ACTION_PULL_CIRCUIT_OPEN = "
|
|
138
|
+
export declare const UI_ACTION_PULL_CIRCUIT_OPEN = "[guuey] card updates stopped \u2014 the session behind this card could not be restored; the widget reports it, and a new conversation starts fresh";
|
|
133
139
|
/**
|
|
134
140
|
* Assemble the sandbox-facing action relay from a host transport. The
|
|
135
141
|
* returned function is shaped for an `onCallTool` bridge: it always
|
package/dist/action.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,oFAAoF;AACpF,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACjD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,CAC3C;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAChB;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CACnB,CAAC;CACH,CAAC;AAEN;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,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,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD;AAED,uEAAuE;AACvE,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,wBAAwB,CAAC;CACtC;AAKD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,uJACyG,CAAC;AAElJ;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,0BAA0B,GAC/B,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAmD1D"}
|
package/dist/action.js
CHANGED
|
@@ -125,8 +125,14 @@ export const PULL_CIRCUIT_THRESHOLD = 3;
|
|
|
125
125
|
/**
|
|
126
126
|
* Logged ONCE when a locator's pull circuit opens — the bounded-storm marker
|
|
127
127
|
* (sentry's readability ask; the #1233 next-incident is scopeable from it).
|
|
128
|
+
* The SYMBOL is the handle code and tests grep; its VALUE is the sentence a
|
|
129
|
+
* builder reads in their own site's console (guuey#1375) — our one prefix,
|
|
130
|
+
* then what happened and what follows, never an internal token. It says
|
|
131
|
+
* exactly what the circuit does: the relay stops pulling for that locator,
|
|
132
|
+
* the host is told the session is unrestorable (`onSessionUnrestorable`),
|
|
133
|
+
* and nothing retries unattended.
|
|
128
134
|
*/
|
|
129
|
-
export const UI_ACTION_PULL_CIRCUIT_OPEN = "
|
|
135
|
+
export const UI_ACTION_PULL_CIRCUIT_OPEN = "[guuey] card updates stopped — the session behind this card could not be restored; the widget reports it, and a new conversation starts fresh";
|
|
130
136
|
/**
|
|
131
137
|
* Assemble the sandbox-facing action relay from a host transport. The
|
|
132
138
|
* returned function is shaped for an `onCallTool` bridge: it always
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The spec's `hostContext.styles.variables` record, complete (guuey#1128).
|
|
3
|
+
*
|
|
4
|
+
* `@modelcontextprotocol/ext-apps` types `McpUiStyles` as
|
|
5
|
+
* `Record<McpUiStyleVariableKey, string | undefined>` — every key PRESENT,
|
|
6
|
+
* value optional — and says why in its own doc: "rather than
|
|
7
|
+
* `Partial<Record<K, string>>` for compatibility with Zod schema generation.
|
|
8
|
+
* Both are functionally equivalent for validation." So a host that announces
|
|
9
|
+
* a partial palette must hand the type a complete record whose unset slots
|
|
10
|
+
* are `undefined`. On the wire the two are the same bytes (`JSON.stringify`
|
|
11
|
+
* drops `undefined`), the app-side `applyHostStyleVariables` skips
|
|
12
|
+
* `undefined` values, and ggui's bridge takes `string | undefined` per slot.
|
|
13
|
+
*
|
|
14
|
+
* {@link EMPTY_HOST_STYLE_VARIABLES} is that complete record with nothing
|
|
15
|
+
* set — a MIRROR of the spec's key union that the compiler enforces both
|
|
16
|
+
* ways (`Record<McpUiStyleVariableKey, undefined>`: a key missing here or a
|
|
17
|
+
* key the spec dropped is a type error the moment the dependency moves), and
|
|
18
|
+
* `host-style-variables.test.ts` pins it against the spec's own zod schema
|
|
19
|
+
* at runtime. {@link hostStyleVariablesRecord} completes a partial palette.
|
|
20
|
+
*/
|
|
21
|
+
import type { McpUiStyleVariableKey, McpUiStyles } from "@modelcontextprotocol/ext-apps";
|
|
22
|
+
export type { McpUiStyleVariableKey, McpUiStyles };
|
|
23
|
+
/** Every spec style-variable key, unset. Spread a partial palette over it. */
|
|
24
|
+
export declare const EMPTY_HOST_STYLE_VARIABLES: Readonly<Record<McpUiStyleVariableKey, undefined>>;
|
|
25
|
+
/** The spec-typed record for a partial palette: the announced slots set, every other slot `undefined`. */
|
|
26
|
+
export declare function hostStyleVariablesRecord(partial: Readonly<Partial<McpUiStyles>>): McpUiStyles;
|
|
27
|
+
/** The slots a record actually announces (the wire's view of it). */
|
|
28
|
+
export declare function announcedHostStyleVariables(record: Readonly<McpUiStyles>): Partial<Record<McpUiStyleVariableKey, string>>;
|
|
29
|
+
//# sourceMappingURL=host-style-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-style-variables.d.ts","sourceRoot":"","sources":["../src/host-style-variables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAEzF,YAAY,EAAE,qBAAqB,EAAE,WAAW,EAAE,CAAC;AAEnD,8EAA8E;AAC9E,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,qBAAqB,EAAE,SAAS,CAAC,CA6EzF,CAAC;AAEF,0GAA0G;AAC1G,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,WAAW,CAE7F;AAED,qEAAqE;AACrE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAMzH"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** Every spec style-variable key, unset. Spread a partial palette over it. */
|
|
2
|
+
export const EMPTY_HOST_STYLE_VARIABLES = {
|
|
3
|
+
"--color-background-primary": undefined,
|
|
4
|
+
"--color-background-secondary": undefined,
|
|
5
|
+
"--color-background-tertiary": undefined,
|
|
6
|
+
"--color-background-inverse": undefined,
|
|
7
|
+
"--color-background-ghost": undefined,
|
|
8
|
+
"--color-background-info": undefined,
|
|
9
|
+
"--color-background-danger": undefined,
|
|
10
|
+
"--color-background-success": undefined,
|
|
11
|
+
"--color-background-warning": undefined,
|
|
12
|
+
"--color-background-disabled": undefined,
|
|
13
|
+
"--color-text-primary": undefined,
|
|
14
|
+
"--color-text-secondary": undefined,
|
|
15
|
+
"--color-text-tertiary": undefined,
|
|
16
|
+
"--color-text-inverse": undefined,
|
|
17
|
+
"--color-text-ghost": undefined,
|
|
18
|
+
"--color-text-info": undefined,
|
|
19
|
+
"--color-text-danger": undefined,
|
|
20
|
+
"--color-text-success": undefined,
|
|
21
|
+
"--color-text-warning": undefined,
|
|
22
|
+
"--color-text-disabled": undefined,
|
|
23
|
+
"--color-border-primary": undefined,
|
|
24
|
+
"--color-border-secondary": undefined,
|
|
25
|
+
"--color-border-tertiary": undefined,
|
|
26
|
+
"--color-border-inverse": undefined,
|
|
27
|
+
"--color-border-ghost": undefined,
|
|
28
|
+
"--color-border-info": undefined,
|
|
29
|
+
"--color-border-danger": undefined,
|
|
30
|
+
"--color-border-success": undefined,
|
|
31
|
+
"--color-border-warning": undefined,
|
|
32
|
+
"--color-border-disabled": undefined,
|
|
33
|
+
"--color-ring-primary": undefined,
|
|
34
|
+
"--color-ring-secondary": undefined,
|
|
35
|
+
"--color-ring-inverse": undefined,
|
|
36
|
+
"--color-ring-info": undefined,
|
|
37
|
+
"--color-ring-danger": undefined,
|
|
38
|
+
"--color-ring-success": undefined,
|
|
39
|
+
"--color-ring-warning": undefined,
|
|
40
|
+
"--font-sans": undefined,
|
|
41
|
+
"--font-mono": undefined,
|
|
42
|
+
"--font-weight-normal": undefined,
|
|
43
|
+
"--font-weight-medium": undefined,
|
|
44
|
+
"--font-weight-semibold": undefined,
|
|
45
|
+
"--font-weight-bold": undefined,
|
|
46
|
+
"--font-text-xs-size": undefined,
|
|
47
|
+
"--font-text-sm-size": undefined,
|
|
48
|
+
"--font-text-md-size": undefined,
|
|
49
|
+
"--font-text-lg-size": undefined,
|
|
50
|
+
"--font-heading-xs-size": undefined,
|
|
51
|
+
"--font-heading-sm-size": undefined,
|
|
52
|
+
"--font-heading-md-size": undefined,
|
|
53
|
+
"--font-heading-lg-size": undefined,
|
|
54
|
+
"--font-heading-xl-size": undefined,
|
|
55
|
+
"--font-heading-2xl-size": undefined,
|
|
56
|
+
"--font-heading-3xl-size": undefined,
|
|
57
|
+
"--font-text-xs-line-height": undefined,
|
|
58
|
+
"--font-text-sm-line-height": undefined,
|
|
59
|
+
"--font-text-md-line-height": undefined,
|
|
60
|
+
"--font-text-lg-line-height": undefined,
|
|
61
|
+
"--font-heading-xs-line-height": undefined,
|
|
62
|
+
"--font-heading-sm-line-height": undefined,
|
|
63
|
+
"--font-heading-md-line-height": undefined,
|
|
64
|
+
"--font-heading-lg-line-height": undefined,
|
|
65
|
+
"--font-heading-xl-line-height": undefined,
|
|
66
|
+
"--font-heading-2xl-line-height": undefined,
|
|
67
|
+
"--font-heading-3xl-line-height": undefined,
|
|
68
|
+
"--border-radius-xs": undefined,
|
|
69
|
+
"--border-radius-sm": undefined,
|
|
70
|
+
"--border-radius-md": undefined,
|
|
71
|
+
"--border-radius-lg": undefined,
|
|
72
|
+
"--border-radius-xl": undefined,
|
|
73
|
+
"--border-radius-full": undefined,
|
|
74
|
+
"--border-width-regular": undefined,
|
|
75
|
+
"--shadow-hairline": undefined,
|
|
76
|
+
"--shadow-sm": undefined,
|
|
77
|
+
"--shadow-md": undefined,
|
|
78
|
+
"--shadow-lg": undefined,
|
|
79
|
+
};
|
|
80
|
+
/** The spec-typed record for a partial palette: the announced slots set, every other slot `undefined`. */
|
|
81
|
+
export function hostStyleVariablesRecord(partial) {
|
|
82
|
+
return { ...EMPTY_HOST_STYLE_VARIABLES, ...partial };
|
|
83
|
+
}
|
|
84
|
+
/** The slots a record actually announces (the wire's view of it). */
|
|
85
|
+
export function announcedHostStyleVariables(record) {
|
|
86
|
+
const out = {};
|
|
87
|
+
for (const [key, value] of Object.entries(record)) {
|
|
88
|
+
if (value !== undefined)
|
|
89
|
+
out[key] = value;
|
|
90
|
+
}
|
|
91
|
+
return out;
|
|
92
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export { initializeResult, initialViewHostState, resourceReadResponse, RESOURCES
|
|
|
13
13
|
export { attachViewHost, viewDocumentHtml, type AttachViewHostConfig, type ViewCspEvents, type ViewFrameLike, type ViewHostEvents, } from "./view-host.js";
|
|
14
14
|
export { attachSandboxPageDelivery, isSandboxProxyReady, SANDBOX_PROXY_READY_METHOD, SANDBOX_RESOURCE_READY_METHOD, type SandboxPageDeliveryConfig, } from "./sandbox-page.js";
|
|
15
15
|
export { toolResultRenderRefusal, type PreGenerationRefusal } from "./render-refusal.js";
|
|
16
|
+
export { EMPTY_HOST_STYLE_VARIABLES, announcedHostStyleVariables, hostStyleVariablesRecord, type McpUiStyleVariableKey, type McpUiStyles, } from "./host-style-variables.js";
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,4BAA4B,EAC5B,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,GAC3B,MAAM,aAAa,CAAC;AAIrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,0BAA0B,EAC1B,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,aAAa,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,0BAA0B,EAC1B,6BAA6B,EAC7B,KAAK,yBAAyB,GAC/B,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,uBAAuB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,4BAA4B,EAC5B,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,i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GAC/B,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,uBAAuB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAIzF,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,GACjB,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,3 +15,7 @@ export { attachSandboxPageDelivery, isSandboxProxyReady, SANDBOX_PROXY_READY_MET
|
|
|
15
15
|
// (`@ggui-ai/protocol` 0.14.0's third `outcome`). Hosts face it with words
|
|
16
16
|
// instead of showing the envelope as an unexplained tool failure.
|
|
17
17
|
export { toolResultRenderRefusal } from "./render-refusal.js";
|
|
18
|
+
// guuey#1128: the spec's complete `hostContext.styles.variables` record for a
|
|
19
|
+
// partial host palette (the type is every key, values optional — by the
|
|
20
|
+
// spec's own design; the wire is the partial).
|
|
21
|
+
export { EMPTY_HOST_STYLE_VARIABLES, announcedHostStyleVariables, hostStyleVariablesRecord, } from "./host-style-variables.js";
|
package/dist/react.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export type { ViewCspDiagnosis, ViewCspOrigins, ViewHostPhase } from "./view-hos
|
|
|
44
44
|
export type { ResolvedViewMount, ViewMount, ViewMountChannel } from "./card-mount.js";
|
|
45
45
|
export { defaultViewHostStrings } from "./view-strings.js";
|
|
46
46
|
export type { ViewHostStrings } from "./view-strings.js";
|
|
47
|
-
export interface GuueyViewProps extends Pick<AttachViewHostConfig, "hostCapabilities" | "hostInfo" | "hostContext" | "onCallTool" | "onUpdateModelContext" | "onUserMessage" | "onOpenLink" | "onReadResource" | "onSizeChanged" | "negotiationTimeoutMs" | "cspOrigins" | "onCspDiagnosis"> {
|
|
47
|
+
export interface GuueyViewProps extends Pick<AttachViewHostConfig, "hostCapabilities" | "hostInfo" | "hostContext" | "onCallTool" | "onUpdateModelContext" | "onUserMessage" | "onOpenLink" | "onReadResource" | "onSizeChanged" | "onDismiss" | "negotiationTimeoutMs" | "cspOrigins" | "onCspDiagnosis"> {
|
|
48
48
|
/** The resolved card to mount (see `toolResultViewMount`/`resolveViewMount`). */
|
|
49
49
|
mount: ResolvedViewMount;
|
|
50
50
|
/**
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAwC,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjG,OAAO,EAAoC,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAG7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACzG,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,0BAA0B,EAC1B,6BAA6B,EAC7B,KAAK,yBAAyB,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC/F,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKzD,MAAM,WAAW,cACf,SAAQ,IAAI,CACV,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H,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,gBAAgB,KAAK,SAAS,CAAC;IACjF;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CACpC;AAkDD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CAsL1D"}
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
* minor as deprecated re-exports and was deleted at 0.8.0.)
|
|
33
33
|
*/
|
|
34
34
|
import { type McpUiHostCapabilities, type McpUiHostContext, type McpUiInitializeResult, type McpUiResourceCsp } from "@modelcontextprotocol/ext-apps";
|
|
35
|
+
import { type McpAppDismissReason } from "@ggui-ai/protocol/integrations/mcp-apps";
|
|
35
36
|
import type { McpToolStructuredContent } from "./action.js";
|
|
36
37
|
import type { McpResourceReadResult } from "./reader.js";
|
|
37
38
|
/**
|
|
@@ -207,6 +208,28 @@ export type ViewHostEffect = {
|
|
|
207
208
|
kind: "size-changed";
|
|
208
209
|
width?: number;
|
|
209
210
|
height?: number;
|
|
211
|
+
} | {
|
|
212
|
+
/**
|
|
213
|
+
* The view asked to be dismissed (`ggui:dismiss`, protocol 0.18.0 —
|
|
214
|
+
* ggui#1109 / guuey#1423): the user made a dismiss gesture with focus
|
|
215
|
+
* INSIDE the card document, where the embedding page's own key
|
|
216
|
+
* handlers cannot hear it, and the card forwarded it. An INTENT, never
|
|
217
|
+
* a command — the embedder decides what dismiss means on its surface
|
|
218
|
+
* (close a takeover, return focus, collapse to a chip, nothing);
|
|
219
|
+
* ignoring it is conformant, so the glue only ever OBSERVES it
|
|
220
|
+
* ({@link AttachViewHostConfig.onDismiss} in `view-host.ts`).
|
|
221
|
+
*
|
|
222
|
+
* `reason` is the card's stated cause, forwarded verbatim. The set is
|
|
223
|
+
* EXTENSIBLY-closed on the wire: `MCP_APP_DISMISS_REASONS` documents
|
|
224
|
+
* the reasons this release NAMES, and `isMcpAppDismissMessage` admits
|
|
225
|
+
* any non-empty string on purpose — a reason a later card names that
|
|
226
|
+
* this host does not know is still a dismiss request, of unknown
|
|
227
|
+
* cause, never a message to drop (the N−1 failure the openness exists
|
|
228
|
+
* to prevent). So: NO reason whitelist here, no `reason === "escape"`
|
|
229
|
+
* branch; the effect fires for every shape the protocol guard accepts.
|
|
230
|
+
*/
|
|
231
|
+
kind: "dismiss";
|
|
232
|
+
reason: McpAppDismissReason;
|
|
210
233
|
};
|
|
211
234
|
/**
|
|
212
235
|
* The host identity/behavior the machine answers with. Everything here is
|
|
@@ -268,7 +291,9 @@ export declare function teardownMessage(): ViewHostOutbound;
|
|
|
268
291
|
* Feed one inbound postMessage payload to the machine.
|
|
269
292
|
*
|
|
270
293
|
* The contract, exactly:
|
|
271
|
-
* - non-RPC data → ignored (not ours)
|
|
294
|
+
* - non-RPC data → ignored (not ours) — with ONE typed exception: protocol
|
|
295
|
+
* 0.18.0's `ggui:dismiss` intent (`isMcpAppDismissMessage`) → a `dismiss`
|
|
296
|
+
* effect, state untouched (guuey#1423);
|
|
272
297
|
* - notifications (no id) → consumed silently, JSON-RPC-correctly; the
|
|
273
298
|
* `ui/notifications/initialized` ack is remembered on the state;
|
|
274
299
|
* - `ui/initialize` → answered spec-canonically; phase → `"connected"`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-host-protocol.d.ts","sourceRoot":"","sources":["../src/view-host-protocol.ts"],"names":[],"mappings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;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,gBAAgB,CAElD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,EAAE,OAAO,GACZ,kBAAkB,CAwKpB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAEnE;AAID;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uFAAuF;IACvF,cAAc,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0FAA0F;IAC1F,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAyBD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,cAAc,GAAG,SAAS,GAClC,gBAAgB,GAAG,SAAS,CAqB9B"}
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
* minor as deprecated re-exports and was deleted at 0.8.0.)
|
|
33
33
|
*/
|
|
34
34
|
import { INITIALIZE_METHOD, LATEST_PROTOCOL_VERSION, RESOURCE_TEARDOWN_METHOD, SIZE_CHANGED_METHOD, } from "@modelcontextprotocol/ext-apps";
|
|
35
|
+
// The ONE non-JSON-RPC message this host hears: protocol 0.18.0's dismiss
|
|
36
|
+
// INTENT (ggui#1109 / guuey#1423). The guard proves the envelope's shape and,
|
|
37
|
+
// by design, admits any non-empty `reason` — see the `dismiss` effect.
|
|
38
|
+
import { isMcpAppDismissMessage } from "@ggui-ai/protocol/integrations/mcp-apps";
|
|
35
39
|
/** JSON-RPC `method not found` — the spec's code, not an invented one. */
|
|
36
40
|
const METHOD_NOT_SUPPORTED = -32601;
|
|
37
41
|
/** The standard MCP method a view uses to reach host-proxied tools. */
|
|
@@ -157,7 +161,9 @@ export function teardownMessage() {
|
|
|
157
161
|
* Feed one inbound postMessage payload to the machine.
|
|
158
162
|
*
|
|
159
163
|
* The contract, exactly:
|
|
160
|
-
* - non-RPC data → ignored (not ours)
|
|
164
|
+
* - non-RPC data → ignored (not ours) — with ONE typed exception: protocol
|
|
165
|
+
* 0.18.0's `ggui:dismiss` intent (`isMcpAppDismissMessage`) → a `dismiss`
|
|
166
|
+
* effect, state untouched (guuey#1423);
|
|
161
167
|
* - notifications (no id) → consumed silently, JSON-RPC-correctly; the
|
|
162
168
|
* `ui/notifications/initialized` ack is remembered on the state;
|
|
163
169
|
* - `ui/initialize` → answered spec-canonically; phase → `"connected"`
|
|
@@ -167,6 +173,11 @@ export function teardownMessage() {
|
|
|
167
173
|
* - every other REQUEST → `method_not_supported`, honestly.
|
|
168
174
|
*/
|
|
169
175
|
export function viewHostReceive(state, behavior, data) {
|
|
176
|
+
// Checked BEFORE the envelope narrowing, which would otherwise file this
|
|
177
|
+
// non-RPC intent under "not ours". Any accepted shape dismisses — the
|
|
178
|
+
// reason is classified by the embedder, never whitelisted here.
|
|
179
|
+
if (isMcpAppDismissMessage(data))
|
|
180
|
+
return { state, effects: [{ kind: "dismiss", reason: data.reason }] };
|
|
170
181
|
const req = asInboundEnvelope(data);
|
|
171
182
|
if (req === undefined)
|
|
172
183
|
return { state, effects: [] };
|
package/dist/view-host.d.ts
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* Seeded from ggui's console `surface-host.ts` (donated, guuey#186 audit);
|
|
28
28
|
* re-derived here against the pure machine + our own tests.
|
|
29
29
|
*/
|
|
30
|
+
import type { McpAppDismissReason } from "@ggui-ai/protocol/integrations/mcp-apps";
|
|
30
31
|
import { type CspViolationLike, type ViewCspDiagnosis, type ViewCspOrigins, type ViewHostPhase } from "./view-host-protocol.js";
|
|
31
32
|
import type { McpResourceReadResult } from "./reader.js";
|
|
32
33
|
import { type McpToolCallResult, type UiActionRequest } from "./action.js";
|
|
@@ -157,6 +158,21 @@ export interface AttachViewHostConfig {
|
|
|
157
158
|
width?: number;
|
|
158
159
|
height?: number;
|
|
159
160
|
}) => void;
|
|
161
|
+
/**
|
|
162
|
+
* The view asked to be dismissed — protocol 0.18.0's `ggui:dismiss`
|
|
163
|
+
* INTENT (ggui#1109 / guuey#1423): a dismiss gesture made with focus
|
|
164
|
+
* INSIDE the card document, which the embedding page's own key handlers
|
|
165
|
+
* can never hear. The card forwards; the EMBEDDER decides what dismiss
|
|
166
|
+
* means on its surface (guuey's widget routes it to the same collapse its
|
|
167
|
+
* host-document Escape takes; a transcript card may do nothing). Ignoring
|
|
168
|
+
* is conformant, so this is an observer, not a capability: nothing is
|
|
169
|
+
* advertised, nothing is answered, and absent → the intent is consumed
|
|
170
|
+
* silently exactly as before 0.18.0. `reason` is the card's stated cause
|
|
171
|
+
* and the set is extensibly-closed: it fires for EVERY shape the protocol
|
|
172
|
+
* guard accepts, an unknown reason included — treat one as "dismiss
|
|
173
|
+
* requested, cause unknown", never as nothing.
|
|
174
|
+
*/
|
|
175
|
+
onDismiss?: (reason: McpAppDismissReason) => void;
|
|
160
176
|
/** Observe phase transitions (see {@link ViewHostPhase}). */
|
|
161
177
|
onPhaseChange?: (phase: ViewHostPhase) => void;
|
|
162
178
|
/**
|
package/dist/view-host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-host.d.ts","sourceRoot":"","sources":["../src/view-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAQL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,cA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|
-
/**
|
|
2
|
-
* `attachViewHost` — the DOM glue around `view-host-protocol.ts`'s pure
|
|
3
|
-
* machine (guuey#186 Gap 1). Framework-agnostic: any embedder with an
|
|
4
|
-
* iframe can play the MCP Apps Host role with one call; `react.tsx` is one
|
|
5
|
-
* convenience composition of exactly this, and a future full transcript
|
|
6
|
-
* renderer composes the same primitive differently.
|
|
7
|
-
*
|
|
8
|
-
* This module is glue by DESIGN — every decision (what to answer, what to
|
|
9
|
-
* refuse, when the negotiation window lapses) lives in the machine, which
|
|
10
|
-
* the Node-only publish gate can test. What genuinely needs a browser is
|
|
11
|
-
* this file's five moves: listen, identity-filter, post, time, detach —
|
|
12
|
-
* covered by the monorepo's Playwright leg (`e2e/`), which the guuey-sdks
|
|
13
|
-
* mirror deliberately does not carry.
|
|
14
|
-
*
|
|
15
|
-
* ## The identity filter (security invariant)
|
|
16
|
-
*
|
|
17
|
-
* Messages are matched by `event.source === frame.contentWindow`, NEVER by
|
|
18
|
-
* `event.origin`: a view frame runs `sandbox="allow-scripts"` WITHOUT
|
|
19
|
-
* `allow-same-origin`, so its origin is opaque — every message it posts
|
|
20
|
-
* carries `"null"`, a value every other sandboxed frame on the page
|
|
21
|
-
* shares, identifying nobody. The window handle is the only identity that
|
|
22
|
-
* names the frame; a frame with no `contentWindow` matches nothing rather
|
|
23
|
-
* than everything. Responses target `'*'` for the same reason: an opaque
|
|
24
|
-
* origin is not addressable by name, and the handshake payload carries no
|
|
25
|
-
* secrets — it is the result the spec defines for any host.
|
|
26
|
-
*
|
|
27
|
-
* Seeded from ggui's console `surface-host.ts` (donated, guuey#186 audit);
|
|
28
|
-
* re-derived here against the pure machine + our own tests.
|
|
29
|
-
*/
|
|
30
1
|
import { diagnoseCspViolation, initialViewHostState, resourceReadResponse, teardownMessage, toolCallResponse, viewHostElapsed, viewHostReceive, } from "./view-host-protocol.js";
|
|
31
2
|
import { unavailableToolCallResult, } from "./action.js";
|
|
32
3
|
const DEFAULT_HOST_INFO = { name: "guuey-view-host", version: "1" };
|
|
@@ -171,6 +142,17 @@ export function attachViewHost(frame, config = {}) {
|
|
|
171
142
|
// logs; the view's contract is already satisfied.
|
|
172
143
|
}
|
|
173
144
|
}
|
|
145
|
+
else if (effect.kind === "dismiss") {
|
|
146
|
+
// Observation only (guuey#1423): the machine answered nothing (an
|
|
147
|
+
// intent owes no reply) and the embedder's decision is its own —
|
|
148
|
+
// contained like every other observer.
|
|
149
|
+
try {
|
|
150
|
+
config.onDismiss?.(effect.reason);
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
// Observer failure is the embedder's bug; the message pump stands.
|
|
154
|
+
}
|
|
155
|
+
}
|
|
174
156
|
else {
|
|
175
157
|
config.onSizeChanged?.({
|
|
176
158
|
...(effect.width !== undefined ? { width: effect.width } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guuey/mcp-apps-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "The MCP Apps (SEP-1865) Host role for guuey's chat surfaces — view-mount narrowing across UI channels, ui:// locator rehydration by resources/read, and the sandbox-trust channel contract. Vendor-neutral: any spec-following MCP App mounts through it.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@ggui-ai/protocol": "0.
|
|
36
|
+
"@ggui-ai/protocol": "0.19.0",
|
|
37
37
|
"@modelcontextprotocol/ext-apps": "^1.7.5",
|
|
38
38
|
"@silverprotocol/core": "0.6.2"
|
|
39
39
|
},
|
package/src/action.ts
CHANGED
|
@@ -199,8 +199,15 @@ export const PULL_CIRCUIT_THRESHOLD = 3;
|
|
|
199
199
|
/**
|
|
200
200
|
* Logged ONCE when a locator's pull circuit opens — the bounded-storm marker
|
|
201
201
|
* (sentry's readability ask; the #1233 next-incident is scopeable from it).
|
|
202
|
+
* The SYMBOL is the handle code and tests grep; its VALUE is the sentence a
|
|
203
|
+
* builder reads in their own site's console (guuey#1375) — our one prefix,
|
|
204
|
+
* then what happened and what follows, never an internal token. It says
|
|
205
|
+
* exactly what the circuit does: the relay stops pulling for that locator,
|
|
206
|
+
* the host is told the session is unrestorable (`onSessionUnrestorable`),
|
|
207
|
+
* and nothing retries unattended.
|
|
202
208
|
*/
|
|
203
|
-
export const UI_ACTION_PULL_CIRCUIT_OPEN =
|
|
209
|
+
export const UI_ACTION_PULL_CIRCUIT_OPEN =
|
|
210
|
+
"[guuey] card updates stopped — the session behind this card could not be restored; the widget reports it, and a new conversation starts fresh";
|
|
204
211
|
|
|
205
212
|
/**
|
|
206
213
|
* Assemble the sandbox-facing action relay from a host transport. The
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The spec's `hostContext.styles.variables` record, complete (guuey#1128).
|
|
3
|
+
*
|
|
4
|
+
* `@modelcontextprotocol/ext-apps` types `McpUiStyles` as
|
|
5
|
+
* `Record<McpUiStyleVariableKey, string | undefined>` — every key PRESENT,
|
|
6
|
+
* value optional — and says why in its own doc: "rather than
|
|
7
|
+
* `Partial<Record<K, string>>` for compatibility with Zod schema generation.
|
|
8
|
+
* Both are functionally equivalent for validation." So a host that announces
|
|
9
|
+
* a partial palette must hand the type a complete record whose unset slots
|
|
10
|
+
* are `undefined`. On the wire the two are the same bytes (`JSON.stringify`
|
|
11
|
+
* drops `undefined`), the app-side `applyHostStyleVariables` skips
|
|
12
|
+
* `undefined` values, and ggui's bridge takes `string | undefined` per slot.
|
|
13
|
+
*
|
|
14
|
+
* {@link EMPTY_HOST_STYLE_VARIABLES} is that complete record with nothing
|
|
15
|
+
* set — a MIRROR of the spec's key union that the compiler enforces both
|
|
16
|
+
* ways (`Record<McpUiStyleVariableKey, undefined>`: a key missing here or a
|
|
17
|
+
* key the spec dropped is a type error the moment the dependency moves), and
|
|
18
|
+
* `host-style-variables.test.ts` pins it against the spec's own zod schema
|
|
19
|
+
* at runtime. {@link hostStyleVariablesRecord} completes a partial palette.
|
|
20
|
+
*/
|
|
21
|
+
import type { McpUiStyleVariableKey, McpUiStyles } from "@modelcontextprotocol/ext-apps";
|
|
22
|
+
|
|
23
|
+
export type { McpUiStyleVariableKey, McpUiStyles };
|
|
24
|
+
|
|
25
|
+
/** Every spec style-variable key, unset. Spread a partial palette over it. */
|
|
26
|
+
export const EMPTY_HOST_STYLE_VARIABLES: Readonly<Record<McpUiStyleVariableKey, undefined>> = {
|
|
27
|
+
"--color-background-primary": undefined,
|
|
28
|
+
"--color-background-secondary": undefined,
|
|
29
|
+
"--color-background-tertiary": undefined,
|
|
30
|
+
"--color-background-inverse": undefined,
|
|
31
|
+
"--color-background-ghost": undefined,
|
|
32
|
+
"--color-background-info": undefined,
|
|
33
|
+
"--color-background-danger": undefined,
|
|
34
|
+
"--color-background-success": undefined,
|
|
35
|
+
"--color-background-warning": undefined,
|
|
36
|
+
"--color-background-disabled": undefined,
|
|
37
|
+
"--color-text-primary": undefined,
|
|
38
|
+
"--color-text-secondary": undefined,
|
|
39
|
+
"--color-text-tertiary": undefined,
|
|
40
|
+
"--color-text-inverse": undefined,
|
|
41
|
+
"--color-text-ghost": undefined,
|
|
42
|
+
"--color-text-info": undefined,
|
|
43
|
+
"--color-text-danger": undefined,
|
|
44
|
+
"--color-text-success": undefined,
|
|
45
|
+
"--color-text-warning": undefined,
|
|
46
|
+
"--color-text-disabled": undefined,
|
|
47
|
+
"--color-border-primary": undefined,
|
|
48
|
+
"--color-border-secondary": undefined,
|
|
49
|
+
"--color-border-tertiary": undefined,
|
|
50
|
+
"--color-border-inverse": undefined,
|
|
51
|
+
"--color-border-ghost": undefined,
|
|
52
|
+
"--color-border-info": undefined,
|
|
53
|
+
"--color-border-danger": undefined,
|
|
54
|
+
"--color-border-success": undefined,
|
|
55
|
+
"--color-border-warning": undefined,
|
|
56
|
+
"--color-border-disabled": undefined,
|
|
57
|
+
"--color-ring-primary": undefined,
|
|
58
|
+
"--color-ring-secondary": undefined,
|
|
59
|
+
"--color-ring-inverse": undefined,
|
|
60
|
+
"--color-ring-info": undefined,
|
|
61
|
+
"--color-ring-danger": undefined,
|
|
62
|
+
"--color-ring-success": undefined,
|
|
63
|
+
"--color-ring-warning": undefined,
|
|
64
|
+
"--font-sans": undefined,
|
|
65
|
+
"--font-mono": undefined,
|
|
66
|
+
"--font-weight-normal": undefined,
|
|
67
|
+
"--font-weight-medium": undefined,
|
|
68
|
+
"--font-weight-semibold": undefined,
|
|
69
|
+
"--font-weight-bold": undefined,
|
|
70
|
+
"--font-text-xs-size": undefined,
|
|
71
|
+
"--font-text-sm-size": undefined,
|
|
72
|
+
"--font-text-md-size": undefined,
|
|
73
|
+
"--font-text-lg-size": undefined,
|
|
74
|
+
"--font-heading-xs-size": undefined,
|
|
75
|
+
"--font-heading-sm-size": undefined,
|
|
76
|
+
"--font-heading-md-size": undefined,
|
|
77
|
+
"--font-heading-lg-size": undefined,
|
|
78
|
+
"--font-heading-xl-size": undefined,
|
|
79
|
+
"--font-heading-2xl-size": undefined,
|
|
80
|
+
"--font-heading-3xl-size": undefined,
|
|
81
|
+
"--font-text-xs-line-height": undefined,
|
|
82
|
+
"--font-text-sm-line-height": undefined,
|
|
83
|
+
"--font-text-md-line-height": undefined,
|
|
84
|
+
"--font-text-lg-line-height": undefined,
|
|
85
|
+
"--font-heading-xs-line-height": undefined,
|
|
86
|
+
"--font-heading-sm-line-height": undefined,
|
|
87
|
+
"--font-heading-md-line-height": undefined,
|
|
88
|
+
"--font-heading-lg-line-height": undefined,
|
|
89
|
+
"--font-heading-xl-line-height": undefined,
|
|
90
|
+
"--font-heading-2xl-line-height": undefined,
|
|
91
|
+
"--font-heading-3xl-line-height": undefined,
|
|
92
|
+
"--border-radius-xs": undefined,
|
|
93
|
+
"--border-radius-sm": undefined,
|
|
94
|
+
"--border-radius-md": undefined,
|
|
95
|
+
"--border-radius-lg": undefined,
|
|
96
|
+
"--border-radius-xl": undefined,
|
|
97
|
+
"--border-radius-full": undefined,
|
|
98
|
+
"--border-width-regular": undefined,
|
|
99
|
+
"--shadow-hairline": undefined,
|
|
100
|
+
"--shadow-sm": undefined,
|
|
101
|
+
"--shadow-md": undefined,
|
|
102
|
+
"--shadow-lg": undefined,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/** The spec-typed record for a partial palette: the announced slots set, every other slot `undefined`. */
|
|
106
|
+
export function hostStyleVariablesRecord(partial: Readonly<Partial<McpUiStyles>>): McpUiStyles {
|
|
107
|
+
return { ...EMPTY_HOST_STYLE_VARIABLES, ...partial };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The slots a record actually announces (the wire's view of it). */
|
|
111
|
+
export function announcedHostStyleVariables(record: Readonly<McpUiStyles>): Partial<Record<McpUiStyleVariableKey, string>> {
|
|
112
|
+
const out: Partial<Record<McpUiStyleVariableKey, string>> = {};
|
|
113
|
+
for (const [key, value] of Object.entries(record) as Array<[McpUiStyleVariableKey, string | undefined]>) {
|
|
114
|
+
if (value !== undefined) out[key] = value;
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -100,3 +100,13 @@ export {
|
|
|
100
100
|
// (`@ggui-ai/protocol` 0.14.0's third `outcome`). Hosts face it with words
|
|
101
101
|
// instead of showing the envelope as an unexplained tool failure.
|
|
102
102
|
export { toolResultRenderRefusal, type PreGenerationRefusal } from "./render-refusal.js";
|
|
103
|
+
// guuey#1128: the spec's complete `hostContext.styles.variables` record for a
|
|
104
|
+
// partial host palette (the type is every key, values optional — by the
|
|
105
|
+
// spec's own design; the wire is the partial).
|
|
106
|
+
export {
|
|
107
|
+
EMPTY_HOST_STYLE_VARIABLES,
|
|
108
|
+
announcedHostStyleVariables,
|
|
109
|
+
hostStyleVariablesRecord,
|
|
110
|
+
type McpUiStyleVariableKey,
|
|
111
|
+
type McpUiStyles,
|
|
112
|
+
} from "./host-style-variables.js";
|
package/src/react.tsx
CHANGED
|
@@ -41,6 +41,10 @@ import {
|
|
|
41
41
|
type McpUiInitializeResult,
|
|
42
42
|
type McpUiResourceCsp,
|
|
43
43
|
} from "@modelcontextprotocol/ext-apps";
|
|
44
|
+
// The ONE non-JSON-RPC message this host hears: protocol 0.18.0's dismiss
|
|
45
|
+
// INTENT (ggui#1109 / guuey#1423). The guard proves the envelope's shape and,
|
|
46
|
+
// by design, admits any non-empty `reason` — see the `dismiss` effect.
|
|
47
|
+
import { isMcpAppDismissMessage, type McpAppDismissReason } from "@ggui-ai/protocol/integrations/mcp-apps";
|
|
44
48
|
import type { McpToolStructuredContent } from "./action.js";
|
|
45
49
|
import type { McpResourceReadResult } from "./reader.js";
|
|
46
50
|
|
|
@@ -233,6 +237,29 @@ export type ViewHostEffect =
|
|
|
233
237
|
kind: "size-changed";
|
|
234
238
|
width?: number;
|
|
235
239
|
height?: number;
|
|
240
|
+
}
|
|
241
|
+
| {
|
|
242
|
+
/**
|
|
243
|
+
* The view asked to be dismissed (`ggui:dismiss`, protocol 0.18.0 —
|
|
244
|
+
* ggui#1109 / guuey#1423): the user made a dismiss gesture with focus
|
|
245
|
+
* INSIDE the card document, where the embedding page's own key
|
|
246
|
+
* handlers cannot hear it, and the card forwarded it. An INTENT, never
|
|
247
|
+
* a command — the embedder decides what dismiss means on its surface
|
|
248
|
+
* (close a takeover, return focus, collapse to a chip, nothing);
|
|
249
|
+
* ignoring it is conformant, so the glue only ever OBSERVES it
|
|
250
|
+
* ({@link AttachViewHostConfig.onDismiss} in `view-host.ts`).
|
|
251
|
+
*
|
|
252
|
+
* `reason` is the card's stated cause, forwarded verbatim. The set is
|
|
253
|
+
* EXTENSIBLY-closed on the wire: `MCP_APP_DISMISS_REASONS` documents
|
|
254
|
+
* the reasons this release NAMES, and `isMcpAppDismissMessage` admits
|
|
255
|
+
* any non-empty string on purpose — a reason a later card names that
|
|
256
|
+
* this host does not know is still a dismiss request, of unknown
|
|
257
|
+
* cause, never a message to drop (the N−1 failure the openness exists
|
|
258
|
+
* to prevent). So: NO reason whitelist here, no `reason === "escape"`
|
|
259
|
+
* branch; the effect fires for every shape the protocol guard accepts.
|
|
260
|
+
*/
|
|
261
|
+
kind: "dismiss";
|
|
262
|
+
reason: McpAppDismissReason;
|
|
236
263
|
};
|
|
237
264
|
|
|
238
265
|
/**
|
|
@@ -366,7 +393,9 @@ export function teardownMessage(): ViewHostOutbound {
|
|
|
366
393
|
* Feed one inbound postMessage payload to the machine.
|
|
367
394
|
*
|
|
368
395
|
* The contract, exactly:
|
|
369
|
-
* - non-RPC data → ignored (not ours)
|
|
396
|
+
* - non-RPC data → ignored (not ours) — with ONE typed exception: protocol
|
|
397
|
+
* 0.18.0's `ggui:dismiss` intent (`isMcpAppDismissMessage`) → a `dismiss`
|
|
398
|
+
* effect, state untouched (guuey#1423);
|
|
370
399
|
* - notifications (no id) → consumed silently, JSON-RPC-correctly; the
|
|
371
400
|
* `ui/notifications/initialized` ack is remembered on the state;
|
|
372
401
|
* - `ui/initialize` → answered spec-canonically; phase → `"connected"`
|
|
@@ -380,6 +409,10 @@ export function viewHostReceive(
|
|
|
380
409
|
behavior: ViewHostBehavior,
|
|
381
410
|
data: unknown,
|
|
382
411
|
): ViewHostTransition {
|
|
412
|
+
// Checked BEFORE the envelope narrowing, which would otherwise file this
|
|
413
|
+
// non-RPC intent under "not ours". Any accepted shape dismisses — the
|
|
414
|
+
// reason is classified by the embedder, never whitelisted here.
|
|
415
|
+
if (isMcpAppDismissMessage(data)) return { state, effects: [{ kind: "dismiss", reason: data.reason }] };
|
|
383
416
|
const req = asInboundEnvelope(data);
|
|
384
417
|
if (req === undefined) return { state, effects: [] };
|
|
385
418
|
|
package/src/view-host.ts
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* Seeded from ggui's console `surface-host.ts` (donated, guuey#186 audit);
|
|
28
28
|
* re-derived here against the pure machine + our own tests.
|
|
29
29
|
*/
|
|
30
|
+
import type { McpAppDismissReason } from "@ggui-ai/protocol/integrations/mcp-apps";
|
|
30
31
|
import {
|
|
31
32
|
diagnoseCspViolation,
|
|
32
33
|
initialViewHostState,
|
|
@@ -172,6 +173,21 @@ export interface AttachViewHostConfig {
|
|
|
172
173
|
* exactly this callback.
|
|
173
174
|
*/
|
|
174
175
|
onSizeChanged?: (size: { width?: number; height?: number }) => void;
|
|
176
|
+
/**
|
|
177
|
+
* The view asked to be dismissed — protocol 0.18.0's `ggui:dismiss`
|
|
178
|
+
* INTENT (ggui#1109 / guuey#1423): a dismiss gesture made with focus
|
|
179
|
+
* INSIDE the card document, which the embedding page's own key handlers
|
|
180
|
+
* can never hear. The card forwards; the EMBEDDER decides what dismiss
|
|
181
|
+
* means on its surface (guuey's widget routes it to the same collapse its
|
|
182
|
+
* host-document Escape takes; a transcript card may do nothing). Ignoring
|
|
183
|
+
* is conformant, so this is an observer, not a capability: nothing is
|
|
184
|
+
* advertised, nothing is answered, and absent → the intent is consumed
|
|
185
|
+
* silently exactly as before 0.18.0. `reason` is the card's stated cause
|
|
186
|
+
* and the set is extensibly-closed: it fires for EVERY shape the protocol
|
|
187
|
+
* guard accepts, an unknown reason included — treat one as "dismiss
|
|
188
|
+
* requested, cause unknown", never as nothing.
|
|
189
|
+
*/
|
|
190
|
+
onDismiss?: (reason: McpAppDismissReason) => void;
|
|
175
191
|
/** Observe phase transitions (see {@link ViewHostPhase}). */
|
|
176
192
|
onPhaseChange?: (phase: ViewHostPhase) => void;
|
|
177
193
|
/**
|
|
@@ -361,7 +377,16 @@ export function attachViewHost(frame: ViewFrameLike, config: AttachViewHostConfi
|
|
|
361
377
|
// logs; the view's contract is already satisfied.
|
|
362
378
|
}
|
|
363
379
|
}
|
|
364
|
-
else {
|
|
380
|
+
else if (effect.kind === "dismiss") {
|
|
381
|
+
// Observation only (guuey#1423): the machine answered nothing (an
|
|
382
|
+
// intent owes no reply) and the embedder's decision is its own —
|
|
383
|
+
// contained like every other observer.
|
|
384
|
+
try {
|
|
385
|
+
config.onDismiss?.(effect.reason);
|
|
386
|
+
} catch {
|
|
387
|
+
// Observer failure is the embedder's bug; the message pump stands.
|
|
388
|
+
}
|
|
389
|
+
} else {
|
|
365
390
|
config.onSizeChanged?.({
|
|
366
391
|
...(effect.width !== undefined ? { width: effect.width } : {}),
|
|
367
392
|
...(effect.height !== undefined ? { height: effect.height } : {}),
|