@ggui-ai/protocol 0.6.2 → 0.7.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/schemas/data-contract.d.ts +26 -20
- package/dist/schemas/data-contract.d.ts.map +1 -1
- package/dist/schemas/data-contract.js +31 -24
- package/dist/schemas/mcp.d.ts +58 -16
- package/dist/schemas/mcp.d.ts.map +1 -1
- package/dist/schemas/mcp.js +58 -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.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 +33 -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 +177 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +177 -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.7.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.7.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","source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,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";
|
|
@@ -492,7 +492,7 @@ export declare const gadgetDescriptorSchema: z.ZodObject<{
|
|
|
492
492
|
* Used by:
|
|
493
493
|
* - `createGguiGadget` SDK factory (validates wrapper specs).
|
|
494
494
|
* - `App.gadgets` registration handlers (ggui.json seed,
|
|
495
|
-
*
|
|
495
|
+
* `ggui gadget install`, config push).
|
|
496
496
|
*
|
|
497
497
|
* Same TS interface as the wire schema — the strictness lives in zod
|
|
498
498
|
* refinements, not the type system.
|
|
@@ -559,27 +559,33 @@ export declare const strictGadgetDescriptorSchema: z.ZodObject<{
|
|
|
559
559
|
typesSri: z.ZodOptional<z.ZodString>;
|
|
560
560
|
}, z.core.$strict>;
|
|
561
561
|
/**
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
562
|
+
* Types-pipeline descriptor validator — PARKED (2026-08-09 gadget
|
|
563
|
+
* catalog foundations): no catalog-serving boundary consumes it.
|
|
564
|
+
* {@link strictGadgetDescriptorSchema} plus the refinement that every
|
|
565
|
+
* non-stdlib package MUST carry a `typesUrl`.
|
|
566
|
+
*
|
|
567
|
+
* Every live catalog boundary — descriptor writes, catalog reads, and
|
|
568
|
+
* the generation-time catalog adapter — validates with
|
|
569
|
+
* `strictGadgetDescriptorSchema`, where `typesUrl` is optional:
|
|
570
|
+
* nothing in the publish→install chain stamps `typesUrl` yet, and the
|
|
571
|
+
* types fetcher already skips descriptors without one, so generation
|
|
572
|
+
* degrades gracefully to no-types codegen.
|
|
573
|
+
*
|
|
574
|
+
* The one surviving consumer is the wrapper-author build helper
|
|
575
|
+
* (`writeDescriptorJson` in `@ggui-ai/gadgets/codegen`) — the
|
|
576
|
+
* authoring-side front half of the types pipeline, where the wrapper
|
|
577
|
+
* build HAS just emitted a `.d.ts` and stamped `typesUrl` +
|
|
578
|
+
* `typesSri`, so requiring them is coherent there.
|
|
579
|
+
*
|
|
580
|
+
* The export stays because it is the already-written contract for the
|
|
581
|
+
* types-pipeline follow-up: publish stamps `typesUrl` + `typesSri` on
|
|
582
|
+
* the descriptor after the build emits the `.d.ts`, descriptor
|
|
583
|
+
* projections carry both fields through, and the generation-time
|
|
584
|
+
* catalog adapter adopts this schema as its posture again — the
|
|
585
|
+
* code-gen sandbox then loads the `.d.ts` the URL points at to
|
|
579
586
|
* typecheck generated component code against the package's real
|
|
580
587
|
* 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.
|
|
588
|
+
* sandbox loads its types directly.
|
|
583
589
|
*/
|
|
584
590
|
export declare const registeredGadgetDescriptorSchema: z.ZodObject<{
|
|
585
591
|
exports: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-contract.d.ts","sourceRoot":"","sources":["../../src/schemas/data-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACX,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAYhD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CA2BlD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;;;;;;kBASjB,CAAC;AAEZ,sFAAsF;AACtF,eAAO,MAAM,eAAe;;;;;;;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,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAanC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;kBAKxB,CAAC;AAEZ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAK9B,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAU1C,CAAC;AAQJ;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB;;;kBAKvB,CAAC;AAEZ;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB;;;mBAa/B,CAAC;AAEL;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,4BAA4B;;;;;kBAO9B,CAAC;AAEZ;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,sDAElB,CAAC;AAEd;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CASZ,CAAC"}
|
|
@@ -498,7 +498,7 @@ export const gadgetDescriptorSchema = z
|
|
|
498
498
|
* Used by:
|
|
499
499
|
* - `createGguiGadget` SDK factory (validates wrapper specs).
|
|
500
500
|
* - `App.gadgets` registration handlers (ggui.json seed,
|
|
501
|
-
*
|
|
501
|
+
* `ggui gadget install`, config push).
|
|
502
502
|
*
|
|
503
503
|
* Same TS interface as the wire schema — the strictness lives in zod
|
|
504
504
|
* refinements, not the type system.
|
|
@@ -510,37 +510,44 @@ export const strictGadgetDescriptorSchema = z
|
|
|
510
510
|
})
|
|
511
511
|
.strict();
|
|
512
512
|
/**
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
*
|
|
513
|
+
* Types-pipeline descriptor validator — PARKED (2026-08-09 gadget
|
|
514
|
+
* catalog foundations): no catalog-serving boundary consumes it.
|
|
515
|
+
* {@link strictGadgetDescriptorSchema} plus the refinement that every
|
|
516
|
+
* non-stdlib package MUST carry a `typesUrl`.
|
|
517
|
+
*
|
|
518
|
+
* Every live catalog boundary — descriptor writes, catalog reads, and
|
|
519
|
+
* the generation-time catalog adapter — validates with
|
|
520
|
+
* `strictGadgetDescriptorSchema`, where `typesUrl` is optional:
|
|
521
|
+
* nothing in the publish→install chain stamps `typesUrl` yet, and the
|
|
522
|
+
* types fetcher already skips descriptors without one, so generation
|
|
523
|
+
* degrades gracefully to no-types codegen.
|
|
524
|
+
*
|
|
525
|
+
* The one surviving consumer is the wrapper-author build helper
|
|
526
|
+
* (`writeDescriptorJson` in `@ggui-ai/gadgets/codegen`) — the
|
|
527
|
+
* authoring-side front half of the types pipeline, where the wrapper
|
|
528
|
+
* build HAS just emitted a `.d.ts` and stamped `typesUrl` +
|
|
529
|
+
* `typesSri`, so requiring them is coherent there.
|
|
530
|
+
*
|
|
531
|
+
* The export stays because it is the already-written contract for the
|
|
532
|
+
* types-pipeline follow-up: publish stamps `typesUrl` + `typesSri` on
|
|
533
|
+
* the descriptor after the build emits the `.d.ts`, descriptor
|
|
534
|
+
* projections carry both fields through, and the generation-time
|
|
535
|
+
* catalog adapter adopts this schema as its posture again — the
|
|
536
|
+
* code-gen sandbox then loads the `.d.ts` the URL points at to
|
|
530
537
|
* typecheck generated component code against the package's real
|
|
531
538
|
* export signatures. Stdlib (`@ggui-ai/gadgets`) is exempt — the
|
|
532
|
-
* sandbox loads its types directly.
|
|
533
|
-
* pre-launch posture forces strict typing across the board.
|
|
539
|
+
* sandbox loads its types directly.
|
|
534
540
|
*/
|
|
535
541
|
export const registeredGadgetDescriptorSchema = strictGadgetDescriptorSchema.refine((entry) => entry.package === STDLIB_GADGETS_PACKAGE ||
|
|
536
542
|
typeof entry.typesUrl === 'string', {
|
|
537
543
|
message: 'registered GadgetDescriptor MUST declare a `typesUrl` (HTTPS URL to the package\'s .d.ts) — the code-gen sandbox loads it to typecheck generated component code against the export signatures. Run `tsup --dts` (or `tsc --declaration`) in the wrapper build and publish the emitted .d.ts. Only the first-party `@ggui-ai/gadgets` stdlib is exempt.',
|
|
538
544
|
path: ['typesUrl'],
|
|
539
545
|
});
|
|
540
|
-
// `package` + `version` are required on every descriptor
|
|
541
|
-
//
|
|
542
|
-
//
|
|
543
|
-
//
|
|
546
|
+
// `package` + `version` are required on every descriptor —
|
|
547
|
+
// `(package, version)` is the registry's frozen identity tuple; the
|
|
548
|
+
// wire references packages by name only — so there is no "at least
|
|
549
|
+
// one of package / bundleUrl / bundleHost" refinement and no
|
|
550
|
+
// "bundleHost requires package + version" refinement.
|
|
544
551
|
/**
|
|
545
552
|
* Wire-side per-export USE entry on `clientCapabilities.gadgets`.
|
|
546
553
|
*
|
package/dist/schemas/mcp.d.ts
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
* Two consumption patterns, both anchored here:
|
|
8
8
|
*
|
|
9
9
|
* - **Wired raw shapes** (`*InputShape`): handlers in
|
|
10
|
-
* `@ggui-ai/mcp-server-handlers` (and the hosted pod's
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* `@ggui-ai/mcp-server-handlers` (and the hosted pod's discover
|
|
11
|
+
* tool) import the SHAPE directly as their `inputSchema` and
|
|
12
|
+
* validate with `z.object(shape)` — unknown keys are STRIPPED.
|
|
13
|
+
* The shape is the one authored copy of the validation rules AND
|
|
14
|
+
* the agent-facing `.describe()` strings that ship via
|
|
15
|
+
* `tools/list`.
|
|
16
16
|
*
|
|
17
17
|
* - **Lifecycle triad** (`ggui_handshake` / `ggui_update`): the
|
|
18
18
|
* handlers carry deliberate input divergences (handshake's
|
|
@@ -120,16 +120,6 @@ export declare const renderBlueprintInputSchema: z.ZodObject<{
|
|
|
120
120
|
}, z.core.$strip>;
|
|
121
121
|
export declare const discoverInputShape: {};
|
|
122
122
|
export declare const discoverInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
123
|
-
export declare const requestCredentialInputShape: {
|
|
124
|
-
readonly serviceId: z.ZodString;
|
|
125
|
-
readonly reason: z.ZodOptional<z.ZodString>;
|
|
126
|
-
readonly sessionId: z.ZodOptional<z.ZodString>;
|
|
127
|
-
};
|
|
128
|
-
export declare const requestCredentialInputSchema: z.ZodObject<{
|
|
129
|
-
serviceId: z.ZodString;
|
|
130
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
131
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
132
|
-
}, z.core.$strip>;
|
|
133
123
|
/**
|
|
134
124
|
* `ggui_handshake` — three-step suggestion protocol.
|
|
135
125
|
*
|
|
@@ -356,6 +346,58 @@ export declare const renderErrorSchema: z.ZodObject<{
|
|
|
356
346
|
}>;
|
|
357
347
|
message: z.ZodString;
|
|
358
348
|
}, z.core.$strip>;
|
|
349
|
+
/**
|
|
350
|
+
* Canonical failure codes for a `resources/read` on a render locator
|
|
351
|
+
* (`ui://ggui/render/{sessionId}/{blueprintKey}`). Closed enum.
|
|
352
|
+
*
|
|
353
|
+
* This is a DIFFERENT surface from {@link renderErrorCodeSchema}: that
|
|
354
|
+
* one classifies a `ggui_render` tool call that ran and failed, and
|
|
355
|
+
* rides in the tool result. This one classifies a resource read that
|
|
356
|
+
* cannot return a mount, and rides on a JSON-RPC error — a read either
|
|
357
|
+
* yields a live mount or fails, never a successful result wrapping a
|
|
358
|
+
* dead shell. That is what makes the contract host-checkable.
|
|
359
|
+
*
|
|
360
|
+
* - `NOT_FOUND` — no live render and no restorable record. The
|
|
361
|
+
* locator never existed, aged out, was erased, or the caller may
|
|
362
|
+
* not read it. Denial is deliberately reported as absence: a
|
|
363
|
+
* distinguishable "denied" would turn the read into an oracle for
|
|
364
|
+
* the existence of other callers' renders.
|
|
365
|
+
* - `BLUEPRINT_UNRESOLVABLE` — a record exists, but the component
|
|
366
|
+
* behind it cannot be resolved: removed, taken down, or the record
|
|
367
|
+
* carries no component reference at all.
|
|
368
|
+
* - `NOT_SUPPORTED` — this deployment keeps no durable record, so an
|
|
369
|
+
* evicted locator can never be restored. A property of the server,
|
|
370
|
+
* identical for every caller and every locator.
|
|
371
|
+
* - `NOT_MOUNTABLE` — the render resolved, but no delivery channel is
|
|
372
|
+
* available to mount it.
|
|
373
|
+
*/
|
|
374
|
+
export declare const resourceReadErrorCodeSchema: z.ZodEnum<{
|
|
375
|
+
NOT_FOUND: "NOT_FOUND";
|
|
376
|
+
BLUEPRINT_UNRESOLVABLE: "BLUEPRINT_UNRESOLVABLE";
|
|
377
|
+
NOT_SUPPORTED: "NOT_SUPPORTED";
|
|
378
|
+
NOT_MOUNTABLE: "NOT_MOUNTABLE";
|
|
379
|
+
}>;
|
|
380
|
+
/**
|
|
381
|
+
* Failure shape for a `resources/read` that cannot return a mount.
|
|
382
|
+
* Projected onto a JSON-RPC error by `resourceReadErrorToJsonRpc` —
|
|
383
|
+
* `code` lands on `error.data.code`, so hosts can branch on the
|
|
384
|
+
* classification without parsing prose.
|
|
385
|
+
*
|
|
386
|
+
* `message` is caller-facing and `detail` is operator-facing. NEITHER
|
|
387
|
+
* is preserved on `NOT_FOUND`: the mapper substitutes a constant there
|
|
388
|
+
* so a denied read and a genuine miss are byte-identical on the wire.
|
|
389
|
+
* Put diagnostics for that case in the server's own logs.
|
|
390
|
+
*/
|
|
391
|
+
export declare const resourceReadErrorSchema: z.ZodObject<{
|
|
392
|
+
code: z.ZodEnum<{
|
|
393
|
+
NOT_FOUND: "NOT_FOUND";
|
|
394
|
+
BLUEPRINT_UNRESOLVABLE: "BLUEPRINT_UNRESOLVABLE";
|
|
395
|
+
NOT_SUPPORTED: "NOT_SUPPORTED";
|
|
396
|
+
NOT_MOUNTABLE: "NOT_MOUNTABLE";
|
|
397
|
+
}>;
|
|
398
|
+
message: z.ZodString;
|
|
399
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
400
|
+
}, z.core.$strip>;
|
|
359
401
|
/**
|
|
360
402
|
* Wire-output shape — `{sessionId, resourceUri?, action, contractHash,
|
|
361
403
|
* cache, error?, nextStep?}`. `contractHash` (data-contract identity)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/schemas/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,cAAc;;;iBAGzB,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUnB,CAAC;AAYjB;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;CAgBpB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;iBAA8B,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;iBAA2B,CAAC;AAExD,eAAO,MAAM,oBAAoB;;CAKvB,CAAC;AAEX,eAAO,MAAM,qBAAqB;;iBAAiC,CAAC;AAEpE;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,IAAc,CAAC;AAE5D,eAAO,MAAM,iCAAiC,gCAE7C,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;CAM7B,CAAC;AAEX,eAAO,MAAM,2BAA2B;;;iBAA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