@guuey/mcp-apps-host 0.17.0 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -12,4 +12,5 @@ export { asToolCallResult, createMcpUiActionRelay, unavailableToolCallResult, UI
12
12
  export { initializeResult, initialViewHostState, resourceReadResponse, RESOURCES_READ_METHOD, teardownMessage, toolCallResponse, TOOLS_CALL_METHOD, viewHostElapsed, viewHostReceive, diagnoseCspViolation, type CspViolationLike, type ViewCspDiagnosis, type ViewCspOrigins, type ViewHostBehavior, type ViewHostEffect, type ViewHostOutbound, type ViewHostPhase, type ViewHostInfo, type ViewHostState, type ViewHostTransition, type ViewRequestId, } from "./view-host-protocol.js";
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
+ export { toolResultRenderRefusal, type PreGenerationRefusal } from "./render-refusal.js";
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"m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,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"}
package/dist/index.js CHANGED
@@ -11,3 +11,7 @@ export { asToolCallResult, createMcpUiActionRelay, unavailableToolCallResult, UI
11
11
  export { initializeResult, initialViewHostState, resourceReadResponse, RESOURCES_READ_METHOD, teardownMessage, toolCallResponse, TOOLS_CALL_METHOD, viewHostElapsed, viewHostReceive, diagnoseCspViolation, } from "./view-host-protocol.js";
12
12
  export { attachViewHost, viewDocumentHtml, } from "./view-host.js";
13
13
  export { attachSandboxPageDelivery, isSandboxProxyReady, SANDBOX_PROXY_READY_METHOD, SANDBOX_RESOURCE_READY_METHOD, } from "./sandbox-page.js";
14
+ // guuey#836 — the typed read of a ggui_render PRE-GENERATION refusal
15
+ // (`@ggui-ai/protocol` 0.14.0's third `outcome`). Hosts face it with words
16
+ // instead of showing the envelope as an unexplained tool failure.
17
+ export { toolResultRenderRefusal } from "./render-refusal.js";
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The typed read of a ggui_render PRE-GENERATION REFUSAL (guuey#836 —
3
+ * `@ggui-ai/protocol` 0.14.0, PROTOCOL_VERSION `draft-2026-09-04`).
4
+ *
5
+ * A render result now carries a REQUIRED `outcome` discriminant:
6
+ * `'rendered' | 'failed' | 'refused'`. The third arm is new — a deployment
7
+ * that declined the render BEFORE doing any work (a missing app policy, an
8
+ * exhausted trial, a deprovisioned app, …). Nothing was parsed, no session
9
+ * row was committed and the handshake is intact, so every identity field
10
+ * (`sessionId`, `resourceUri`, `cache`, …) is ABSENT and a `refusal`
11
+ * envelope carries the state: a registry `code`, a `message` (what was
12
+ * checked, against what), a `fix` addressed to the party that can take it,
13
+ * and a `retry` class.
14
+ *
15
+ * Before this read existed a refusal reached a host as an `isError` tool
16
+ * result with no locator — the mount dispatcher returned `undefined` and the
17
+ * transcript showed the raw envelope text as a generic tool failure. That is
18
+ * the "unexplained render failure" a builder cannot act on. This function
19
+ * names the state instead, so a host can face the refusal with its own
20
+ * words (the message, the fix, the retry hint) and never attempt a mount.
21
+ *
22
+ * Two properties are load-bearing and pinned by the tests:
23
+ * - It is TOLERANT of the previous wire: a result from a
24
+ * `draft-2026-08-*` server (no `outcome`, identity fields present) does
25
+ * not parse as a 0.14.0 output and yields `undefined` — exactly the
26
+ * behaviour such a result had before, never a false refusal.
27
+ * - It is STRICT about the envelope: the guard is the protocol's own
28
+ * `isRefusedRenderOutput` over `renderOutputSchema`'s parse, so a payload
29
+ * that merely SAYS `outcome: 'refused'` without a conformant `refusal`
30
+ * (an unregistered code, a missing `fix`) is not a refusal here either —
31
+ * the transport would have rejected it on the producing side, and a
32
+ * reader that half-trusted it would draw an authoritative-looking face
33
+ * over a non-conformant payload.
34
+ *
35
+ * The routing question (`uiData` vs `structuredContent`) does not arise: a
36
+ * refusal has no `_meta.ui` sibling by construction (there is no surface
37
+ * data), so it always lands in `structuredContent` (AgJSON §2.1).
38
+ */
39
+ import { type PreGenerationRefusal } from "@ggui-ai/protocol";
40
+ import type { JsonValue } from "@silverprotocol/core";
41
+ export type { PreGenerationRefusal };
42
+ /**
43
+ * The refusal a `tool-result` block carries, or `undefined` when the block is
44
+ * not a conformant 0.14.0 render output with `outcome: 'refused'`.
45
+ */
46
+ export declare function toolResultRenderRefusal(block: {
47
+ structuredContent?: JsonValue;
48
+ }): PreGenerationRefusal | undefined;
49
+ //# sourceMappingURL=render-refusal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-refusal.d.ts","sourceRoot":"","sources":["../src/render-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAErC;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,iBAAiB,CAAC,EAAE,SAAS,CAAC;CAC/B,GAAG,oBAAoB,GAAG,SAAS,CAKnC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The typed read of a ggui_render PRE-GENERATION REFUSAL (guuey#836 —
3
+ * `@ggui-ai/protocol` 0.14.0, PROTOCOL_VERSION `draft-2026-09-04`).
4
+ *
5
+ * A render result now carries a REQUIRED `outcome` discriminant:
6
+ * `'rendered' | 'failed' | 'refused'`. The third arm is new — a deployment
7
+ * that declined the render BEFORE doing any work (a missing app policy, an
8
+ * exhausted trial, a deprovisioned app, …). Nothing was parsed, no session
9
+ * row was committed and the handshake is intact, so every identity field
10
+ * (`sessionId`, `resourceUri`, `cache`, …) is ABSENT and a `refusal`
11
+ * envelope carries the state: a registry `code`, a `message` (what was
12
+ * checked, against what), a `fix` addressed to the party that can take it,
13
+ * and a `retry` class.
14
+ *
15
+ * Before this read existed a refusal reached a host as an `isError` tool
16
+ * result with no locator — the mount dispatcher returned `undefined` and the
17
+ * transcript showed the raw envelope text as a generic tool failure. That is
18
+ * the "unexplained render failure" a builder cannot act on. This function
19
+ * names the state instead, so a host can face the refusal with its own
20
+ * words (the message, the fix, the retry hint) and never attempt a mount.
21
+ *
22
+ * Two properties are load-bearing and pinned by the tests:
23
+ * - It is TOLERANT of the previous wire: a result from a
24
+ * `draft-2026-08-*` server (no `outcome`, identity fields present) does
25
+ * not parse as a 0.14.0 output and yields `undefined` — exactly the
26
+ * behaviour such a result had before, never a false refusal.
27
+ * - It is STRICT about the envelope: the guard is the protocol's own
28
+ * `isRefusedRenderOutput` over `renderOutputSchema`'s parse, so a payload
29
+ * that merely SAYS `outcome: 'refused'` without a conformant `refusal`
30
+ * (an unregistered code, a missing `fix`) is not a refusal here either —
31
+ * the transport would have rejected it on the producing side, and a
32
+ * reader that half-trusted it would draw an authoritative-looking face
33
+ * over a non-conformant payload.
34
+ *
35
+ * The routing question (`uiData` vs `structuredContent`) does not arise: a
36
+ * refusal has no `_meta.ui` sibling by construction (there is no surface
37
+ * data), so it always lands in `structuredContent` (AgJSON §2.1).
38
+ */
39
+ import { isRefusedRenderOutput, renderOutputSchema, } from "@ggui-ai/protocol";
40
+ /**
41
+ * The refusal a `tool-result` block carries, or `undefined` when the block is
42
+ * not a conformant 0.14.0 render output with `outcome: 'refused'`.
43
+ */
44
+ export function toolResultRenderRefusal(block) {
45
+ if (block.structuredContent === undefined)
46
+ return undefined;
47
+ const parsed = renderOutputSchema.safeParse(block.structuredContent);
48
+ if (!parsed.success)
49
+ return undefined;
50
+ return isRefusedRenderOutput(parsed.data) ? parsed.data.refusal : undefined;
51
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guuey/mcp-apps-host",
3
- "version": "0.17.0",
3
+ "version": "0.18.2",
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.14.0",
36
+ "@ggui-ai/protocol": "0.15.0",
37
37
  "@modelcontextprotocol/ext-apps": "^1.7.5",
38
38
  "@silverprotocol/core": "0.6.1"
39
39
  },
package/src/index.ts CHANGED
@@ -96,3 +96,7 @@ export {
96
96
  SANDBOX_RESOURCE_READY_METHOD,
97
97
  type SandboxPageDeliveryConfig,
98
98
  } from "./sandbox-page.js";
99
+ // guuey#836 — the typed read of a ggui_render PRE-GENERATION refusal
100
+ // (`@ggui-ai/protocol` 0.14.0's third `outcome`). Hosts face it with words
101
+ // instead of showing the envelope as an unexplained tool failure.
102
+ export { toolResultRenderRefusal, type PreGenerationRefusal } from "./render-refusal.js";
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The typed read of a ggui_render PRE-GENERATION REFUSAL (guuey#836 —
3
+ * `@ggui-ai/protocol` 0.14.0, PROTOCOL_VERSION `draft-2026-09-04`).
4
+ *
5
+ * A render result now carries a REQUIRED `outcome` discriminant:
6
+ * `'rendered' | 'failed' | 'refused'`. The third arm is new — a deployment
7
+ * that declined the render BEFORE doing any work (a missing app policy, an
8
+ * exhausted trial, a deprovisioned app, …). Nothing was parsed, no session
9
+ * row was committed and the handshake is intact, so every identity field
10
+ * (`sessionId`, `resourceUri`, `cache`, …) is ABSENT and a `refusal`
11
+ * envelope carries the state: a registry `code`, a `message` (what was
12
+ * checked, against what), a `fix` addressed to the party that can take it,
13
+ * and a `retry` class.
14
+ *
15
+ * Before this read existed a refusal reached a host as an `isError` tool
16
+ * result with no locator — the mount dispatcher returned `undefined` and the
17
+ * transcript showed the raw envelope text as a generic tool failure. That is
18
+ * the "unexplained render failure" a builder cannot act on. This function
19
+ * names the state instead, so a host can face the refusal with its own
20
+ * words (the message, the fix, the retry hint) and never attempt a mount.
21
+ *
22
+ * Two properties are load-bearing and pinned by the tests:
23
+ * - It is TOLERANT of the previous wire: a result from a
24
+ * `draft-2026-08-*` server (no `outcome`, identity fields present) does
25
+ * not parse as a 0.14.0 output and yields `undefined` — exactly the
26
+ * behaviour such a result had before, never a false refusal.
27
+ * - It is STRICT about the envelope: the guard is the protocol's own
28
+ * `isRefusedRenderOutput` over `renderOutputSchema`'s parse, so a payload
29
+ * that merely SAYS `outcome: 'refused'` without a conformant `refusal`
30
+ * (an unregistered code, a missing `fix`) is not a refusal here either —
31
+ * the transport would have rejected it on the producing side, and a
32
+ * reader that half-trusted it would draw an authoritative-looking face
33
+ * over a non-conformant payload.
34
+ *
35
+ * The routing question (`uiData` vs `structuredContent`) does not arise: a
36
+ * refusal has no `_meta.ui` sibling by construction (there is no surface
37
+ * data), so it always lands in `structuredContent` (AgJSON §2.1).
38
+ */
39
+ import {
40
+ isRefusedRenderOutput,
41
+ renderOutputSchema,
42
+ type PreGenerationRefusal,
43
+ } from "@ggui-ai/protocol";
44
+ import type { JsonValue } from "@silverprotocol/core";
45
+
46
+ export type { PreGenerationRefusal };
47
+
48
+ /**
49
+ * The refusal a `tool-result` block carries, or `undefined` when the block is
50
+ * not a conformant 0.14.0 render output with `outcome: 'refused'`.
51
+ */
52
+ export function toolResultRenderRefusal(block: {
53
+ structuredContent?: JsonValue;
54
+ }): PreGenerationRefusal | undefined {
55
+ if (block.structuredContent === undefined) return undefined;
56
+ const parsed = renderOutputSchema.safeParse(block.structuredContent);
57
+ if (!parsed.success) return undefined;
58
+ return isRefusedRenderOutput(parsed.data) ? parsed.data.refusal : undefined;
59
+ }