@ggui-ai/protocol 0.6.3 → 0.8.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/dist/errors/resource-read.d.ts +105 -0
- package/dist/errors/resource-read.d.ts.map +1 -0
- package/dist/errors/resource-read.js +107 -0
- package/dist/gadgets/resolve-app-gadgets.d.ts +12 -6
- package/dist/gadgets/resolve-app-gadgets.d.ts.map +1 -1
- package/dist/gadgets/resolve-app-gadgets.js +19 -8
- package/dist/gadgets/stdlib-gadgets.d.ts +1 -1
- package/dist/gadgets/stdlib-gadgets.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/integrations/mcp-apps.d.ts +50 -4
- package/dist/integrations/mcp-apps.d.ts.map +1 -1
- package/dist/integrations/mcp-apps.js +44 -5
- package/dist/schemas/data-contract.d.ts +30 -22
- package/dist/schemas/data-contract.d.ts.map +1 -1
- package/dist/schemas/data-contract.js +35 -26
- package/dist/schemas/mcp.d.ts +62 -16
- package/dist/schemas/mcp.d.ts.map +1 -1
- package/dist/schemas/mcp.js +72 -12
- package/dist/transport/websocket.d.ts +2 -5
- package/dist/transport/websocket.d.ts.map +1 -1
- package/dist/types/data-contract.d.ts +6 -2
- package/dist/types/data-contract.d.ts.map +1 -1
- package/dist/types/live-channel.d.ts +14 -37
- package/dist/types/live-channel.d.ts.map +1 -1
- package/dist/types/mcp.d.ts +56 -25
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/mcp.js +19 -2
- package/dist/validation/hygiene-rules.d.ts +2 -2
- package/dist/validation/hygiene-rules.js +2 -2
- package/dist/version.d.ts +272 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +272 -0
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projection from a typed `resources/read` failure onto a JSON-RPC
|
|
3
|
+
* error (SPEC §7.9 Plane 1).
|
|
4
|
+
*
|
|
5
|
+
* A read of a render locator (`ui://ggui/render/{sessionId}/{blueprintKey}`)
|
|
6
|
+
* returns either a live mount or an error — never a successful result
|
|
7
|
+
* carrying a shell that will never come alive. Routing every failure
|
|
8
|
+
* branch through this one function is what makes that host-checkable:
|
|
9
|
+
* "any successful `contents` result IS a live mount" holds because the
|
|
10
|
+
* only other exit is a JSON-RPC error.
|
|
11
|
+
*
|
|
12
|
+
* # Numeric codes
|
|
13
|
+
*
|
|
14
|
+
* `NOT_FOUND` maps to `-32002`. That is the number MCP itself uses for
|
|
15
|
+
* a resource that does not exist, and the number this protocol already
|
|
16
|
+
* assigns to a missing session — for a locator keyed by `sessionId`
|
|
17
|
+
* those are one condition, not two.
|
|
18
|
+
*
|
|
19
|
+
* The other three map to `MOUNT_UNAVAILABLE` (`-32006`), a canonical
|
|
20
|
+
* code claimed from the range the protocol reserves for new ones. They
|
|
21
|
+
* are deliberately NOT `INTERNAL_ERROR`: a purged component, a server
|
|
22
|
+
* that keeps no durable record, and a render with no delivery channel
|
|
23
|
+
* are all deterministic outcomes of a correctly functioning server.
|
|
24
|
+
* `-32603` would report them as a malfunction and invite hosts to retry
|
|
25
|
+
* a read that cannot ever succeed. The fine-grained classification
|
|
26
|
+
* rides on `error.data.code`, so a host that only understands the
|
|
27
|
+
* number still routes correctly, and one that reads `data.code` can
|
|
28
|
+
* distinguish "come back never" from "come back with a fresh render".
|
|
29
|
+
*
|
|
30
|
+
* # Why `NOT_FOUND` loses its message
|
|
31
|
+
*
|
|
32
|
+
* A caller reading a locator it is not allowed to see and a caller
|
|
33
|
+
* reading a locator that never existed MUST receive byte-identical
|
|
34
|
+
* errors. Anything that varies between the two — a message naming a
|
|
35
|
+
* session, a `detail` mentioning a refusal — turns the read into an
|
|
36
|
+
* oracle for the existence of other callers' renders. Rather than
|
|
37
|
+
* leaving that to the discipline of every call site, this function
|
|
38
|
+
* substitutes a constant message and drops `detail` whenever the code
|
|
39
|
+
* is `NOT_FOUND`. Diagnostics for the refused case belong in the
|
|
40
|
+
* server's own logs, which the caller cannot read.
|
|
41
|
+
*
|
|
42
|
+
* # What this function CANNOT enforce — a server obligation
|
|
43
|
+
*
|
|
44
|
+
* Substituting the message closes only the message half of the problem.
|
|
45
|
+
* The code half stays with the caller: a server that runs its
|
|
46
|
+
* authorization check late can hand this function a `NOT_MOUNTABLE` or
|
|
47
|
+
* `BLUEPRINT_UNRESOLVABLE` for a locator the caller was never entitled
|
|
48
|
+
* to read, and the resulting `-32006` reveals that the locator exists —
|
|
49
|
+
* the same oracle, reached by a different route, with a mapper behaving
|
|
50
|
+
* perfectly.
|
|
51
|
+
*
|
|
52
|
+
* So the ordering is normative, scoped to the branches that can leak:
|
|
53
|
+
* a server using this projection MUST route a refusal through its
|
|
54
|
+
* TERMINAL failure — the single answer it gives for every locator it
|
|
55
|
+
* will not resolve — and MUST NOT run a branch whose outcome VARIES
|
|
56
|
+
* WITH THE LOCATOR before the access check. Reaching one of those is
|
|
57
|
+
* itself the disclosure. Resolution work is exactly such a branch, so
|
|
58
|
+
* it happens only after the check has passed.
|
|
59
|
+
*
|
|
60
|
+
* Naming the TERMINAL rather than a specific code is deliberate. Which
|
|
61
|
+
* code the terminal carries is a property of the deployment: a server
|
|
62
|
+
* keeping durable records answers `NOT_FOUND`, one keeping none answers
|
|
63
|
+
* `NOT_SUPPORTED`, and each answers it for a refused locator and a
|
|
64
|
+
* missing one alike. Pinning this rule to `NOT_FOUND` would declare the
|
|
65
|
+
* second server non-conformant for behaving correctly. What the rule
|
|
66
|
+
* protects is that refusal and absence are the SAME answer — never
|
|
67
|
+
* which answer it is.
|
|
68
|
+
*
|
|
69
|
+
* A deployment-global answer is not a locator-varying branch.
|
|
70
|
+
* `NOT_SUPPORTED` describes the server and is identical for every
|
|
71
|
+
* locator on a server that emits it, so answering it before any
|
|
72
|
+
* per-locator work — the access check included — reveals nothing and is
|
|
73
|
+
* permitted.
|
|
74
|
+
*/
|
|
75
|
+
import { MCP_ERROR_CODES, type ResourceReadError, type ResourceReadErrorCode } from '../types/mcp.js';
|
|
76
|
+
/**
|
|
77
|
+
* The single message every `NOT_FOUND` read returns, whatever the
|
|
78
|
+
* underlying reason. Names no session, app, or caller.
|
|
79
|
+
*/
|
|
80
|
+
export declare const RESOURCE_NOT_FOUND_MESSAGE = "Resource not found.";
|
|
81
|
+
/**
|
|
82
|
+
* JSON-RPC error body for a failed `resources/read`. `data.code` is the
|
|
83
|
+
* closed classification; `data.detail` is optional operator context and
|
|
84
|
+
* is absent whenever `data.code` is `NOT_FOUND`.
|
|
85
|
+
*/
|
|
86
|
+
export interface ResourceReadJsonRpcError {
|
|
87
|
+
/**
|
|
88
|
+
* Narrowed to the two numbers this projection can emit, so a consumer
|
|
89
|
+
* switching on it gets exhaustiveness rather than an open `number`.
|
|
90
|
+
*/
|
|
91
|
+
readonly code: typeof MCP_ERROR_CODES.SESSION_NOT_FOUND | typeof MCP_ERROR_CODES.MOUNT_UNAVAILABLE;
|
|
92
|
+
readonly message: string;
|
|
93
|
+
readonly data: {
|
|
94
|
+
readonly code: ResourceReadErrorCode;
|
|
95
|
+
readonly detail?: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Switch rather than an `if` with a fallthrough on purpose: every member
|
|
100
|
+
* of the enum is named, so adding a fifth code fails to compile here
|
|
101
|
+
* until someone decides which number it carries. A default branch would
|
|
102
|
+
* have swallowed it into `MOUNT_UNAVAILABLE` silently.
|
|
103
|
+
*/
|
|
104
|
+
export declare function resourceReadErrorToJsonRpc(err: ResourceReadError): ResourceReadJsonRpcError;
|
|
105
|
+
//# sourceMappingURL=resource-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-read.d.ts","sourceRoot":"","sources":["../../src/errors/resource-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,OAAO,EACL,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,eAAO,MAAM,0BAA0B,wBAAwB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EACT,OAAO,eAAe,CAAC,iBAAiB,GACxC,OAAO,eAAe,CAAC,iBAAiB,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;QACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,iBAAiB,GACrB,wBAAwB,CAqB1B"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projection from a typed `resources/read` failure onto a JSON-RPC
|
|
3
|
+
* error (SPEC §7.9 Plane 1).
|
|
4
|
+
*
|
|
5
|
+
* A read of a render locator (`ui://ggui/render/{sessionId}/{blueprintKey}`)
|
|
6
|
+
* returns either a live mount or an error — never a successful result
|
|
7
|
+
* carrying a shell that will never come alive. Routing every failure
|
|
8
|
+
* branch through this one function is what makes that host-checkable:
|
|
9
|
+
* "any successful `contents` result IS a live mount" holds because the
|
|
10
|
+
* only other exit is a JSON-RPC error.
|
|
11
|
+
*
|
|
12
|
+
* # Numeric codes
|
|
13
|
+
*
|
|
14
|
+
* `NOT_FOUND` maps to `-32002`. That is the number MCP itself uses for
|
|
15
|
+
* a resource that does not exist, and the number this protocol already
|
|
16
|
+
* assigns to a missing session — for a locator keyed by `sessionId`
|
|
17
|
+
* those are one condition, not two.
|
|
18
|
+
*
|
|
19
|
+
* The other three map to `MOUNT_UNAVAILABLE` (`-32006`), a canonical
|
|
20
|
+
* code claimed from the range the protocol reserves for new ones. They
|
|
21
|
+
* are deliberately NOT `INTERNAL_ERROR`: a purged component, a server
|
|
22
|
+
* that keeps no durable record, and a render with no delivery channel
|
|
23
|
+
* are all deterministic outcomes of a correctly functioning server.
|
|
24
|
+
* `-32603` would report them as a malfunction and invite hosts to retry
|
|
25
|
+
* a read that cannot ever succeed. The fine-grained classification
|
|
26
|
+
* rides on `error.data.code`, so a host that only understands the
|
|
27
|
+
* number still routes correctly, and one that reads `data.code` can
|
|
28
|
+
* distinguish "come back never" from "come back with a fresh render".
|
|
29
|
+
*
|
|
30
|
+
* # Why `NOT_FOUND` loses its message
|
|
31
|
+
*
|
|
32
|
+
* A caller reading a locator it is not allowed to see and a caller
|
|
33
|
+
* reading a locator that never existed MUST receive byte-identical
|
|
34
|
+
* errors. Anything that varies between the two — a message naming a
|
|
35
|
+
* session, a `detail` mentioning a refusal — turns the read into an
|
|
36
|
+
* oracle for the existence of other callers' renders. Rather than
|
|
37
|
+
* leaving that to the discipline of every call site, this function
|
|
38
|
+
* substitutes a constant message and drops `detail` whenever the code
|
|
39
|
+
* is `NOT_FOUND`. Diagnostics for the refused case belong in the
|
|
40
|
+
* server's own logs, which the caller cannot read.
|
|
41
|
+
*
|
|
42
|
+
* # What this function CANNOT enforce — a server obligation
|
|
43
|
+
*
|
|
44
|
+
* Substituting the message closes only the message half of the problem.
|
|
45
|
+
* The code half stays with the caller: a server that runs its
|
|
46
|
+
* authorization check late can hand this function a `NOT_MOUNTABLE` or
|
|
47
|
+
* `BLUEPRINT_UNRESOLVABLE` for a locator the caller was never entitled
|
|
48
|
+
* to read, and the resulting `-32006` reveals that the locator exists —
|
|
49
|
+
* the same oracle, reached by a different route, with a mapper behaving
|
|
50
|
+
* perfectly.
|
|
51
|
+
*
|
|
52
|
+
* So the ordering is normative, scoped to the branches that can leak:
|
|
53
|
+
* a server using this projection MUST route a refusal through its
|
|
54
|
+
* TERMINAL failure — the single answer it gives for every locator it
|
|
55
|
+
* will not resolve — and MUST NOT run a branch whose outcome VARIES
|
|
56
|
+
* WITH THE LOCATOR before the access check. Reaching one of those is
|
|
57
|
+
* itself the disclosure. Resolution work is exactly such a branch, so
|
|
58
|
+
* it happens only after the check has passed.
|
|
59
|
+
*
|
|
60
|
+
* Naming the TERMINAL rather than a specific code is deliberate. Which
|
|
61
|
+
* code the terminal carries is a property of the deployment: a server
|
|
62
|
+
* keeping durable records answers `NOT_FOUND`, one keeping none answers
|
|
63
|
+
* `NOT_SUPPORTED`, and each answers it for a refused locator and a
|
|
64
|
+
* missing one alike. Pinning this rule to `NOT_FOUND` would declare the
|
|
65
|
+
* second server non-conformant for behaving correctly. What the rule
|
|
66
|
+
* protects is that refusal and absence are the SAME answer — never
|
|
67
|
+
* which answer it is.
|
|
68
|
+
*
|
|
69
|
+
* A deployment-global answer is not a locator-varying branch.
|
|
70
|
+
* `NOT_SUPPORTED` describes the server and is identical for every
|
|
71
|
+
* locator on a server that emits it, so answering it before any
|
|
72
|
+
* per-locator work — the access check included — reveals nothing and is
|
|
73
|
+
* permitted.
|
|
74
|
+
*/
|
|
75
|
+
import { MCP_ERROR_CODES, } from '../types/mcp.js';
|
|
76
|
+
/**
|
|
77
|
+
* The single message every `NOT_FOUND` read returns, whatever the
|
|
78
|
+
* underlying reason. Names no session, app, or caller.
|
|
79
|
+
*/
|
|
80
|
+
export const RESOURCE_NOT_FOUND_MESSAGE = 'Resource not found.';
|
|
81
|
+
/**
|
|
82
|
+
* Switch rather than an `if` with a fallthrough on purpose: every member
|
|
83
|
+
* of the enum is named, so adding a fifth code fails to compile here
|
|
84
|
+
* until someone decides which number it carries. A default branch would
|
|
85
|
+
* have swallowed it into `MOUNT_UNAVAILABLE` silently.
|
|
86
|
+
*/
|
|
87
|
+
export function resourceReadErrorToJsonRpc(err) {
|
|
88
|
+
switch (err.code) {
|
|
89
|
+
case 'NOT_FOUND':
|
|
90
|
+
// Constant body — see "Why NOT_FOUND loses its message" above.
|
|
91
|
+
return {
|
|
92
|
+
code: MCP_ERROR_CODES.SESSION_NOT_FOUND,
|
|
93
|
+
message: RESOURCE_NOT_FOUND_MESSAGE,
|
|
94
|
+
data: { code: 'NOT_FOUND' },
|
|
95
|
+
};
|
|
96
|
+
case 'BLUEPRINT_UNRESOLVABLE':
|
|
97
|
+
case 'NOT_SUPPORTED':
|
|
98
|
+
case 'NOT_MOUNTABLE':
|
|
99
|
+
return {
|
|
100
|
+
code: MCP_ERROR_CODES.MOUNT_UNAVAILABLE,
|
|
101
|
+
message: err.message,
|
|
102
|
+
data: err.detail === undefined
|
|
103
|
+
? { code: err.code }
|
|
104
|
+
: { code: err.code, detail: err.detail },
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { GadgetDescriptor } from '../types/data-contract';
|
|
2
2
|
/**
|
|
3
|
-
* Resolve an app's effective gadget set
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* Resolve an app's effective gadget set from its three sources, in
|
|
4
|
+
* ascending precedence: the first-party stdlib package is the
|
|
5
|
+
* structural FLOOR, `installed` (rows added through the host's install
|
|
6
|
+
* surface) layers on top of it, and `declared` (app-declared extensions
|
|
7
|
+
* from the app's own config) wins over both. Later wins on a `package`
|
|
8
|
+
* collision — declared beats installed beats floor, because the app's
|
|
9
|
+
* own config is the operator's explicit source of truth and must not be
|
|
10
|
+
* silently shadowed by an install performed elsewhere.
|
|
11
|
+
*
|
|
12
|
+
* Absent/empty sources ⇒ exactly the stdlib set; idempotent over
|
|
13
|
+
* already-resolved input.
|
|
8
14
|
*/
|
|
9
|
-
export declare function resolveAppGadgets(declared?: readonly GadgetDescriptor[] | null): readonly GadgetDescriptor[];
|
|
15
|
+
export declare function resolveAppGadgets(declared?: readonly GadgetDescriptor[] | null, installed?: readonly GadgetDescriptor[] | null): readonly GadgetDescriptor[];
|
|
10
16
|
//# sourceMappingURL=resolve-app-gadgets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-app-gadgets.d.ts","sourceRoot":"","sources":["../../src/gadgets/resolve-app-gadgets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO/D
|
|
1
|
+
{"version":3,"file":"resolve-app-gadgets.d.ts","sourceRoot":"","sources":["../../src/gadgets/resolve-app-gadgets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO/D;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,CAAC,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,EAC7C,SAAS,CAAC,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,GAC7C,SAAS,gBAAgB,EAAE,CAS7B"}
|
|
@@ -6,14 +6,25 @@ function dedupeByPackage(list) {
|
|
|
6
6
|
return [...m.values()];
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Resolve an app's effective gadget set
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* Resolve an app's effective gadget set from its three sources, in
|
|
10
|
+
* ascending precedence: the first-party stdlib package is the
|
|
11
|
+
* structural FLOOR, `installed` (rows added through the host's install
|
|
12
|
+
* surface) layers on top of it, and `declared` (app-declared extensions
|
|
13
|
+
* from the app's own config) wins over both. Later wins on a `package`
|
|
14
|
+
* collision — declared beats installed beats floor, because the app's
|
|
15
|
+
* own config is the operator's explicit source of truth and must not be
|
|
16
|
+
* silently shadowed by an install performed elsewhere.
|
|
17
|
+
*
|
|
18
|
+
* Absent/empty sources ⇒ exactly the stdlib set; idempotent over
|
|
19
|
+
* already-resolved input.
|
|
14
20
|
*/
|
|
15
|
-
export function resolveAppGadgets(declared) {
|
|
16
|
-
if (!declared || declared.length === 0)
|
|
21
|
+
export function resolveAppGadgets(declared, installed) {
|
|
22
|
+
if ((!declared || declared.length === 0) && (!installed || installed.length === 0)) {
|
|
17
23
|
return STDLIB_GADGETS;
|
|
18
|
-
|
|
24
|
+
}
|
|
25
|
+
return dedupeByPackage([
|
|
26
|
+
...STDLIB_GADGETS,
|
|
27
|
+
...(installed ?? []),
|
|
28
|
+
...(declared ?? []),
|
|
29
|
+
]);
|
|
19
30
|
}
|
|
@@ -12,7 +12,7 @@ export declare const STDLIB_GADGETS_PACKAGE = "@ggui-ai/gadgets";
|
|
|
12
12
|
* in `@ggui-ai/gadgets` asserts the two stay in sync, so a release-time
|
|
13
13
|
* bump to the runtime package without updating this constant fails CI.
|
|
14
14
|
*/
|
|
15
|
-
export declare const STDLIB_GADGETS_VERSION = "0.
|
|
15
|
+
export declare const STDLIB_GADGETS_VERSION = "0.8.0";
|
|
16
16
|
/**
|
|
17
17
|
* v1 catalog of stdlib gadget descriptors. Every entry's
|
|
18
18
|
* `package` defaults to {@link STDLIB_GADGETS_PACKAGE}; the
|
|
@@ -39,7 +39,7 @@ export const STDLIB_GADGETS_PACKAGE = '@ggui-ai/gadgets';
|
|
|
39
39
|
* in `@ggui-ai/gadgets` asserts the two stay in sync, so a release-time
|
|
40
40
|
* bump to the runtime package without updating this constant fails CI.
|
|
41
41
|
*/
|
|
42
|
-
export const STDLIB_GADGETS_VERSION = '0.
|
|
42
|
+
export const STDLIB_GADGETS_VERSION = '0.8.0';
|
|
43
43
|
/**
|
|
44
44
|
* v1 catalog of stdlib gadget descriptors. Every entry's
|
|
45
45
|
* `package` defaults to {@link STDLIB_GADGETS_PACKAGE}; the
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export * from "./envelope-adapters";
|
|
|
36
36
|
export * from "./envelopes/builders";
|
|
37
37
|
export * from "./errors/version-mismatch";
|
|
38
38
|
export * from "./errors/unknown-permission-name";
|
|
39
|
+
export * from "./errors/resource-read";
|
|
39
40
|
export * from "./validation/contract-validator";
|
|
40
41
|
export * from "./validation/cross-references";
|
|
41
42
|
export * from "./validation/is-record";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAI/B,cAAc,sBAAsB,CAAC;AAOrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AAIxC,cAAc,qBAAqB,CAAC;AAIpC,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAK5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAMlE,YAAY,EAEV,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EAEZ,WAAW,EACX,eAAe,EAEf,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAI/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AAKnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC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nC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AAGjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oCAAoC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,9 @@ export * from "./envelope-adapters.js";
|
|
|
61
61
|
export * from "./envelopes/builders.js";
|
|
62
62
|
export * from "./errors/version-mismatch.js";
|
|
63
63
|
export * from "./errors/unknown-permission-name.js";
|
|
64
|
+
// Typed `resources/read` failures → JSON-RPC. The single exit for every
|
|
65
|
+
// non-mount outcome of a render-locator read.
|
|
66
|
+
export * from "./errors/resource-read.js";
|
|
64
67
|
export * from "./validation/contract-validator.js";
|
|
65
68
|
export * from "./validation/cross-references.js";
|
|
66
69
|
export * from "./validation/is-record.js";
|
|
@@ -198,10 +198,11 @@ export interface McpAppContextSlot {
|
|
|
198
198
|
* composes per-tick `&sinceSequence=<cursor>&limit=<N>` against this
|
|
199
199
|
* base; companion to `lastSequence` which seeds the initial cursor.
|
|
200
200
|
*
|
|
201
|
-
* **Mode discriminator.** At least one of `{ codeUrl, kind,
|
|
202
|
-
* MUST be present for the iframe to mount. `kind`
|
|
203
|
-
* mutually exclusive (kind = system-card mode;
|
|
204
|
-
*
|
|
201
|
+
* **Mode discriminator.** At least one of `{ codeUrl, codeB64, kind,
|
|
202
|
+
* wsUrl-with-token }` MUST be present for the iframe to mount. `kind` is
|
|
203
|
+
* mutually exclusive with `codeUrl`/`codeB64` (kind = system-card mode;
|
|
204
|
+
* codeUrl/codeB64 = static-component mode, fetched vs inline;
|
|
205
|
+
* live-channel = absent all).
|
|
205
206
|
*
|
|
206
207
|
* @public
|
|
207
208
|
*/
|
|
@@ -244,6 +245,19 @@ export interface McpAppAiGguiRenderMeta {
|
|
|
244
245
|
readonly validatorsUrl?: string;
|
|
245
246
|
readonly codeUrl?: string;
|
|
246
247
|
readonly codeHash?: string;
|
|
248
|
+
/**
|
|
249
|
+
* Base64-encoded compiled ES-module source of the component — the
|
|
250
|
+
* fetch-free twin of {@link codeUrl}. Produced by servers whose
|
|
251
|
+
* renders must mount inside hosts that forbid cross-origin fetches
|
|
252
|
+
* at the iframe CSP layer (no `connect-src`, no external
|
|
253
|
+
* `script-src`); consumed by the iframe-runtime's seed builder,
|
|
254
|
+
* which decodes it instead of fetching. MAY coexist with `codeUrl`
|
|
255
|
+
* (a consumer prefers the inline bytes; the URL remains for
|
|
256
|
+
* cache-addressable consumers); mutually exclusive with `kind`.
|
|
257
|
+
* Malformed base64 fails at decode time as a boot failure — the
|
|
258
|
+
* parser here validates shape only (non-empty string).
|
|
259
|
+
*/
|
|
260
|
+
readonly codeB64?: string;
|
|
247
261
|
readonly kind?: string;
|
|
248
262
|
}
|
|
249
263
|
/**
|
|
@@ -982,7 +996,39 @@ export interface GguiShellHtmlOptions {
|
|
|
982
996
|
* iframe and accept the Safari canvas-color trade-off.
|
|
983
997
|
*/
|
|
984
998
|
readonly background?: 'surface' | 'transparent';
|
|
999
|
+
/**
|
|
1000
|
+
* Full source text of the iframe-runtime bundle to embed as an
|
|
1001
|
+
* inline `<script type="module">` in place of the external
|
|
1002
|
+
* `src={runtimeUrl}` tag. For hosts whose iframe CSP forbids
|
|
1003
|
+
* external `script-src` while permitting inline scripts — the
|
|
1004
|
+
* external tag can never load there, so the shell carries the
|
|
1005
|
+
* runtime in its own bytes.
|
|
1006
|
+
*
|
|
1007
|
+
* The source is embedded via {@link escapeInlineScript}; see its
|
|
1008
|
+
* contract for the (esbuild-bundle-safe) escaping guarantee. The
|
|
1009
|
+
* bootstrap's `runtimeUrl` stays REQUIRED and stays on the inlined
|
|
1010
|
+
* meta — the runtime's boot validator requires it across all modes;
|
|
1011
|
+
* with this option set it is informational rather than fetched.
|
|
1012
|
+
*/
|
|
1013
|
+
readonly runtimeInlineSource?: string;
|
|
985
1014
|
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Make raw JS source safe to embed as the text content of an HTML
|
|
1017
|
+
* `<script>` element.
|
|
1018
|
+
*
|
|
1019
|
+
* The HTML parser terminates script data at the first
|
|
1020
|
+
* case-insensitive `</script` and shifts parse state on `<!--`; both
|
|
1021
|
+
* sequences are rewritten with a backslash (`<\/script`, `<\!--`).
|
|
1022
|
+
* Inside JS string, template, and regex literals — the only positions
|
|
1023
|
+
* these byte sequences occur in a well-formed bundled module (a bare
|
|
1024
|
+
* `<!--` outside a literal is a SyntaxError in module code; a bare
|
|
1025
|
+
* `</` cannot follow an expression) — `\/` and `\!` are identity
|
|
1026
|
+
* escapes, so the escaped source evaluates identically to the
|
|
1027
|
+
* original.
|
|
1028
|
+
*
|
|
1029
|
+
* @public
|
|
1030
|
+
*/
|
|
1031
|
+
export declare function escapeInlineScript(source: string): string;
|
|
986
1032
|
/**
|
|
987
1033
|
* Build the ggui **self-contained shell** for a render bootstrap.
|
|
988
1034
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-apps.d.ts","sourceRoot":"","sources":["../../src/integrations/mcp-apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAG,4BAAqC,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAG,kBAA2B,CAAC;AAEpE;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAG,2BAAoC,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC9B,kFAAkF;;IAElF,kEAAkE;;CAE1D,CAAC;AAEX;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD;;;;;;;;;GASG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,0BAA0B;IACzC,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM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AC9B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,MAAM,CAyCR"}
|
|
@@ -177,10 +177,13 @@ export function parseMcpAppAiGguiRenderMeta(meta) {
|
|
|
177
177
|
(typeof ls !== 'number' || !Number.isInteger(ls) || ls < 0)) {
|
|
178
178
|
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
179
179
|
}
|
|
180
|
-
// Component-mode discriminator:
|
|
180
|
+
// Component-mode discriminator: kind mutually exclusive with
|
|
181
|
+
// codeUrl/codeB64 (the two static-component carriers may coexist —
|
|
182
|
+
// consumers prefer the inline bytes).
|
|
181
183
|
const cu = s.codeUrl;
|
|
182
184
|
const ck = s.kind;
|
|
183
185
|
const ch = s.codeHash;
|
|
186
|
+
const cb = s.codeB64;
|
|
184
187
|
if (cu !== undefined && (typeof cu !== 'string' || cu.length === 0)) {
|
|
185
188
|
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
186
189
|
}
|
|
@@ -190,7 +193,12 @@ export function parseMcpAppAiGguiRenderMeta(meta) {
|
|
|
190
193
|
if (ch !== undefined && (typeof ch !== 'string' || ch.length === 0)) {
|
|
191
194
|
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
192
195
|
}
|
|
193
|
-
if (
|
|
196
|
+
if (cb !== undefined && (typeof cb !== 'string' || cb.length === 0)) {
|
|
197
|
+
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
198
|
+
}
|
|
199
|
+
const hasStaticComponent = (typeof cu === 'string' && cu.length > 0) ||
|
|
200
|
+
(typeof cb === 'string' && cb.length > 0);
|
|
201
|
+
if (hasStaticComponent && typeof ck === 'string' && ck.length > 0) {
|
|
194
202
|
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
195
203
|
}
|
|
196
204
|
// Contract pair — both present or both absent (or both effectively
|
|
@@ -253,6 +261,7 @@ export function parseMcpAppAiGguiRenderMeta(meta) {
|
|
|
253
261
|
: {}),
|
|
254
262
|
...(typeof cu === 'string' && cu.length > 0 ? { codeUrl: cu } : {}),
|
|
255
263
|
...(typeof ch === 'string' && ch.length > 0 ? { codeHash: ch } : {}),
|
|
264
|
+
...(typeof cb === 'string' && cb.length > 0 ? { codeB64: cb } : {}),
|
|
256
265
|
...(typeof ck === 'string' && ck.length > 0 ? { kind: ck } : {}),
|
|
257
266
|
};
|
|
258
267
|
return { ok: true, meta: slice };
|
|
@@ -533,8 +542,8 @@ export function isGguiSubmitActionInput(value) {
|
|
|
533
542
|
* Does this slice carry at least one MOUNT MODE discriminator?
|
|
534
543
|
* Mirrors the iframe-runtime's `validateMeta`: the runtime needs
|
|
535
544
|
* `runtimeUrl` PLUS one of live mode (`wsUrl` + `wsToken` together),
|
|
536
|
-
* `codeUrl`, or `kind` — without one of those
|
|
537
|
-
* nothing to mount.
|
|
545
|
+
* `codeUrl`, `codeB64`, or `kind` — without one of those the iframe
|
|
546
|
+
* has nothing to mount.
|
|
538
547
|
*/
|
|
539
548
|
function hasMountModeDiscriminator(slice) {
|
|
540
549
|
const nonEmpty = (v) => typeof v === 'string' && v.length > 0;
|
|
@@ -542,6 +551,8 @@ function hasMountModeDiscriminator(slice) {
|
|
|
542
551
|
return true;
|
|
543
552
|
if (nonEmpty(slice.codeUrl))
|
|
544
553
|
return true;
|
|
554
|
+
if (nonEmpty(slice.codeB64))
|
|
555
|
+
return true;
|
|
545
556
|
if (nonEmpty(slice.kind))
|
|
546
557
|
return true;
|
|
547
558
|
return false;
|
|
@@ -602,6 +613,27 @@ export function toolResultGguiRender(result) {
|
|
|
602
613
|
* @public
|
|
603
614
|
*/
|
|
604
615
|
export const GGUI_RENDER_SHELL_SURFACE = 'var(--ggui-color-surface, #1e293b)';
|
|
616
|
+
/**
|
|
617
|
+
* Make raw JS source safe to embed as the text content of an HTML
|
|
618
|
+
* `<script>` element.
|
|
619
|
+
*
|
|
620
|
+
* The HTML parser terminates script data at the first
|
|
621
|
+
* case-insensitive `</script` and shifts parse state on `<!--`; both
|
|
622
|
+
* sequences are rewritten with a backslash (`<\/script`, `<\!--`).
|
|
623
|
+
* Inside JS string, template, and regex literals — the only positions
|
|
624
|
+
* these byte sequences occur in a well-formed bundled module (a bare
|
|
625
|
+
* `<!--` outside a literal is a SyntaxError in module code; a bare
|
|
626
|
+
* `</` cannot follow an expression) — `\/` and `\!` are identity
|
|
627
|
+
* escapes, so the escaped source evaluates identically to the
|
|
628
|
+
* original.
|
|
629
|
+
*
|
|
630
|
+
* @public
|
|
631
|
+
*/
|
|
632
|
+
export function escapeInlineScript(source) {
|
|
633
|
+
return source
|
|
634
|
+
.replace(/<\/(script)/gi, '<\\/$1')
|
|
635
|
+
.replace(/<!--/g, '<\\!--');
|
|
636
|
+
}
|
|
605
637
|
/**
|
|
606
638
|
* Build the ggui **self-contained shell** for a render bootstrap.
|
|
607
639
|
*
|
|
@@ -658,10 +690,17 @@ export function gguiShellHtml(bootstrap, options) {
|
|
|
658
690
|
const background = options?.background === 'transparent'
|
|
659
691
|
? 'background:transparent'
|
|
660
692
|
: `background-color:${GGUI_RENDER_SHELL_SURFACE}`;
|
|
693
|
+
// Inline vs external runtime: same document shape either way — the
|
|
694
|
+
// classic meta script always runs first (parse order + module
|
|
695
|
+
// deferral), so `__GGUI_META__` is populated before the runtime
|
|
696
|
+
// evaluates in both variants.
|
|
697
|
+
const runtimeTag = options?.runtimeInlineSource !== undefined
|
|
698
|
+
? `<script type="module" data-ggui-runtime="inline">${escapeInlineScript(options.runtimeInlineSource)}</script>`
|
|
699
|
+
: `<script type="module" crossorigin="anonymous" src="${safeRuntimeUrl}"></script>`;
|
|
661
700
|
return `<!doctype html>
|
|
662
701
|
<html lang="en" style="${background}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="color-scheme" content="light dark"><title>ggui render</title></head>
|
|
663
702
|
<body style="margin:0;${background}">
|
|
664
703
|
<script>globalThis.__GGUI_META__ = ${json};</script>
|
|
665
|
-
|
|
704
|
+
${runtimeTag}
|
|
666
705
|
</body></html>`;
|
|
667
706
|
}
|
|
@@ -309,8 +309,10 @@ export declare const SEMVER_PIN_RE: RegExp;
|
|
|
309
309
|
/**
|
|
310
310
|
* Hostname-only regex for `bundleHost` — the registry hostname (no
|
|
311
311
|
* scheme, no path) that the server prepends `https://` to and
|
|
312
|
-
* appends the canonical
|
|
313
|
-
*
|
|
312
|
+
* appends the canonical
|
|
313
|
+
* `/bundles/public/<scope>/<name>/<version>/{bundle.js,style.css}`
|
|
314
|
+
* suffix to when resolving a gadget's URLs at render time (the PUBLIC
|
|
315
|
+
* prefix of the registry's visibility-split bundle layout).
|
|
314
316
|
*
|
|
315
317
|
* Examples that pass:
|
|
316
318
|
* - `registry.ggui.ai` (spec default)
|
|
@@ -492,7 +494,7 @@ export declare const gadgetDescriptorSchema: z.ZodObject<{
|
|
|
492
494
|
* Used by:
|
|
493
495
|
* - `createGguiGadget` SDK factory (validates wrapper specs).
|
|
494
496
|
* - `App.gadgets` registration handlers (ggui.json seed,
|
|
495
|
-
*
|
|
497
|
+
* `ggui gadget install`, config push).
|
|
496
498
|
*
|
|
497
499
|
* Same TS interface as the wire schema — the strictness lives in zod
|
|
498
500
|
* refinements, not the type system.
|
|
@@ -559,27 +561,33 @@ export declare const strictGadgetDescriptorSchema: z.ZodObject<{
|
|
|
559
561
|
typesSri: z.ZodOptional<z.ZodString>;
|
|
560
562
|
}, z.core.$strict>;
|
|
561
563
|
/**
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
564
|
+
* Types-pipeline descriptor validator — PARKED (2026-08-09 gadget
|
|
565
|
+
* catalog foundations): no catalog-serving boundary consumes it.
|
|
566
|
+
* {@link strictGadgetDescriptorSchema} plus the refinement that every
|
|
567
|
+
* non-stdlib package MUST carry a `typesUrl`.
|
|
568
|
+
*
|
|
569
|
+
* Every live catalog boundary — descriptor writes, catalog reads, and
|
|
570
|
+
* the generation-time catalog adapter — validates with
|
|
571
|
+
* `strictGadgetDescriptorSchema`, where `typesUrl` is optional:
|
|
572
|
+
* nothing in the publish→install chain stamps `typesUrl` yet, and the
|
|
573
|
+
* types fetcher already skips descriptors without one, so generation
|
|
574
|
+
* degrades gracefully to no-types codegen.
|
|
575
|
+
*
|
|
576
|
+
* The one surviving consumer is the wrapper-author build helper
|
|
577
|
+
* (`writeDescriptorJson` in `@ggui-ai/gadgets/codegen`) — the
|
|
578
|
+
* authoring-side front half of the types pipeline, where the wrapper
|
|
579
|
+
* build HAS just emitted a `.d.ts` and stamped `typesUrl` +
|
|
580
|
+
* `typesSri`, so requiring them is coherent there.
|
|
581
|
+
*
|
|
582
|
+
* The export stays because it is the already-written contract for the
|
|
583
|
+
* types-pipeline follow-up: publish stamps `typesUrl` + `typesSri` on
|
|
584
|
+
* the descriptor after the build emits the `.d.ts`, descriptor
|
|
585
|
+
* projections carry both fields through, and the generation-time
|
|
586
|
+
* catalog adapter adopts this schema as its posture again — the
|
|
587
|
+
* code-gen sandbox then loads the `.d.ts` the URL points at to
|
|
579
588
|
* typecheck generated component code against the package's real
|
|
580
589
|
* export signatures. Stdlib (`@ggui-ai/gadgets`) is exempt — the
|
|
581
|
-
* sandbox loads its types directly.
|
|
582
|
-
* pre-launch posture forces strict typing across the board.
|
|
590
|
+
* sandbox loads its types directly.
|
|
583
591
|
*/
|
|
584
592
|
export declare const registeredGadgetDescriptorSchema: z.ZodObject<{
|
|
585
593
|
exports: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|