@ggui-ai/protocol 0.8.0 → 0.10.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/gadgets/stdlib-gadgets.d.ts +1 -1
- package/dist/gadgets/stdlib-gadgets.d.ts.map +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 +7 -0
- package/dist/integrations/epoch-uri.d.ts +42 -0
- package/dist/integrations/epoch-uri.d.ts.map +1 -0
- package/dist/integrations/epoch-uri.js +48 -0
- package/dist/integrations/mcp-apps.d.ts +139 -6
- package/dist/integrations/mcp-apps.d.ts.map +1 -1
- package/dist/integrations/mcp-apps.js +117 -2
- package/dist/registry/props-schema-hash.d.ts +3 -0
- package/dist/registry/props-schema-hash.d.ts.map +1 -0
- package/dist/registry/props-schema-hash.js +23 -0
- package/dist/schemas/blueprint.d.ts +2 -0
- package/dist/schemas/blueprint.d.ts.map +1 -1
- package/dist/schemas/blueprint.js +9 -0
- package/dist/schemas/data-contract.d.ts +61 -7
- package/dist/schemas/data-contract.d.ts.map +1 -1
- package/dist/schemas/data-contract.js +73 -14
- package/dist/schemas/handshake-suggestion.d.ts +3 -6
- package/dist/schemas/handshake-suggestion.d.ts.map +1 -1
- package/dist/schemas/handshake-suggestion.js +11 -9
- package/dist/schemas/invoke.d.ts +1 -1
- package/dist/schemas/invoke.js +1 -1
- package/dist/schemas/mcp.d.ts +238 -6
- package/dist/schemas/mcp.d.ts.map +1 -1
- package/dist/schemas/mcp.js +286 -14
- package/dist/schemas/ops-blueprint.d.ts +19 -10
- package/dist/schemas/ops-blueprint.d.ts.map +1 -1
- package/dist/schemas/ops-blueprint.js +39 -10
- package/dist/types/blueprint.d.ts +12 -0
- package/dist/types/blueprint.d.ts.map +1 -1
- package/dist/types/contract-inference.d.ts +5 -1
- package/dist/types/contract-inference.d.ts.map +1 -1
- package/dist/types/data-contract.d.ts +14 -4
- package/dist/types/data-contract.d.ts.map +1 -1
- package/dist/types/ggui-session-event.d.ts +42 -1
- package/dist/types/ggui-session-event.d.ts.map +1 -1
- package/dist/types/ggui-session-event.js +16 -1
- package/dist/types/live-channel.d.ts +8 -0
- package/dist/types/live-channel.d.ts.map +1 -1
- package/dist/types/llm-route.d.ts +3 -3
- package/dist/types/llm-route.d.ts.map +1 -1
- package/dist/types/llm-route.js +27 -8
- package/dist/types/llm.d.ts +1 -1
- package/dist/types/llm.d.ts.map +1 -1
- package/dist/types/llm.js +22 -5
- package/dist/types/mcp.d.ts +53 -3
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/render.d.ts +45 -0
- package/dist/types/render.d.ts.map +1 -1
- package/dist/types/render.js +26 -1
- package/dist/types/ui-generator.d.ts +20 -3
- package/dist/types/ui-generator.d.ts.map +1 -1
- package/dist/validation/ajv-runtime.d.ts +26 -6
- package/dist/validation/ajv-runtime.d.ts.map +1 -1
- package/dist/validation/ajv-runtime.js +87 -9
- package/dist/validation/contract-validator.d.ts +106 -35
- package/dist/validation/contract-validator.d.ts.map +1 -1
- package/dist/validation/contract-validator.js +152 -42
- package/dist/validation/enforced-props-schema.d.ts +56 -0
- package/dist/validation/enforced-props-schema.d.ts.map +1 -0
- package/dist/validation/enforced-props-schema.js +232 -0
- package/dist/validation/resolve-stream-channel.d.ts +2 -2
- package/dist/validation/resolve-stream-channel.js +2 -2
- package/dist/validation/schema-subset.d.ts.map +1 -1
- package/dist/validation/schema-subset.js +27 -10
- package/dist/validation/ui-security.d.ts +2 -2
- package/dist/validation/ui-security.js +2 -2
- package/dist/version.d.ts +319 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +318 -1
- package/package.json +7 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../src/schemas/blueprint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAA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CAAC,OAAO,CAAC,sBAAsB,CAE3B,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAI7B,CAAC;AAEjC;;;;;;;;;GASG;AACH,sFAAsF;AACtF,eAAO,MAAM,uBAAuB,4DAA6D,CAAC;AAElG,eAAO,MAAM,uBAAuB,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAgCtB,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAwBd,CAAC;AAmBpC;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAM7B,CAAC"}
|
|
@@ -48,6 +48,8 @@ export const blueprintSourceSchema = z.union([
|
|
|
48
48
|
* metadata via `tools/list`, so they stay mechanism-only and
|
|
49
49
|
* vendor-neutral.
|
|
50
50
|
*/
|
|
51
|
+
/** The four — and only — variance keys; the strict object names them on rejection. */
|
|
52
|
+
export const BLUEPRINT_VARIANCE_KEYS = ['persona', 'aesthetic', 'context', 'seedPrompt'];
|
|
51
53
|
export const blueprintVarianceSchema = z
|
|
52
54
|
.object({
|
|
53
55
|
persona: z
|
|
@@ -66,6 +68,13 @@ export const blueprintVarianceSchema = z
|
|
|
66
68
|
.string()
|
|
67
69
|
.optional()
|
|
68
70
|
.describe('Generation seed directive. Part of cache identity.'),
|
|
71
|
+
}, {
|
|
72
|
+
// A rejection that teaches (ggui#523 item 2): the first live guest
|
|
73
|
+
// turn sent `mood` and got a bare "Unrecognized key" — name the
|
|
74
|
+
// legal set and where the misplaced intent belongs.
|
|
75
|
+
error: (issue) => issue.code === 'unrecognized_keys'
|
|
76
|
+
? `variance: unknown key(s) ${issue.keys.map((k) => JSON.stringify(k)).join(', ')} — variance is EXACTLY {${BLUEPRINT_VARIANCE_KEYS.join(', ')}}; put tonal intent in \`aesthetic\`, and per-user runtime data in props / contextSpec, never in variance`
|
|
77
|
+
: undefined,
|
|
69
78
|
})
|
|
70
79
|
.strict();
|
|
71
80
|
/**
|
|
@@ -58,13 +58,6 @@ import type { DataContract, JsonValue, JsonSchema } from '../types/data-contract
|
|
|
58
58
|
* values, examples, or arbitrary JSON payloads use this.
|
|
59
59
|
*/
|
|
60
60
|
export declare const jsonValueSchema: z.ZodType<JsonValue>;
|
|
61
|
-
/**
|
|
62
|
-
* {@link JsonSchema} — JSON Schema draft-07 subset. Mirrors the
|
|
63
|
-
* fields the TS interface enumerates. `additionalProperties` and
|
|
64
|
-
* `items` are recursive — kept loose (`z.unknown()`) to avoid
|
|
65
|
-
* deep `z.lazy` chains; the F4 schema-subset checker validates
|
|
66
|
-
* full structural correctness at render time.
|
|
67
|
-
*/
|
|
68
61
|
export declare const jsonSchemaSchema: z.ZodType<JsonSchema>;
|
|
69
62
|
/**
|
|
70
63
|
* {@link PropEntry} — per-prop metadata in a {@link PropsSpec}.
|
|
@@ -753,5 +746,66 @@ export declare const appPublicEnvSchema: z.ZodReadonly<z.ZodRecord<z.ZodString,
|
|
|
753
746
|
* posture (`handshakeInputSchema`, `renderInputSchema`, etc. all
|
|
754
747
|
* `passthrough` for the same reason).
|
|
755
748
|
*/
|
|
749
|
+
/**
|
|
750
|
+
* The one-paragraph shape rule every teaching surface quotes (ggui#523
|
|
751
|
+
* item 1): the handshake's tool description, the loose `contract`
|
|
752
|
+
* field the handshake publishes on `tools/list`, and the format doc.
|
|
753
|
+
* One constant, so the wording cannot drift between them. Mechanism-
|
|
754
|
+
* only and vendor-neutral — it ships as JSON-Schema metadata to every
|
|
755
|
+
* agent that lists the tools.
|
|
756
|
+
*/
|
|
757
|
+
export declare const DATA_CONTRACT_SHAPE_RULE: string;
|
|
758
|
+
/**
|
|
759
|
+
* A minimal, complete, valid example — published beside the rule so a
|
|
760
|
+
* first-time caller can copy a shape that parses (JSON-Schema
|
|
761
|
+
* `examples`). Deliberately tiny: one prop, one action with a payload,
|
|
762
|
+
* one context slot.
|
|
763
|
+
*/
|
|
764
|
+
export declare const DATA_CONTRACT_MINIMAL_EXAMPLE: {
|
|
765
|
+
readonly propsSpec: {
|
|
766
|
+
readonly properties: {
|
|
767
|
+
readonly items: {
|
|
768
|
+
readonly schema: {
|
|
769
|
+
readonly type: "array";
|
|
770
|
+
readonly items: {
|
|
771
|
+
readonly type: "object";
|
|
772
|
+
readonly properties: {
|
|
773
|
+
readonly id: {
|
|
774
|
+
readonly type: "string";
|
|
775
|
+
};
|
|
776
|
+
readonly title: {
|
|
777
|
+
readonly type: "string";
|
|
778
|
+
};
|
|
779
|
+
};
|
|
780
|
+
readonly required: readonly ["id", "title"];
|
|
781
|
+
};
|
|
782
|
+
};
|
|
783
|
+
readonly required: true;
|
|
784
|
+
};
|
|
785
|
+
};
|
|
786
|
+
};
|
|
787
|
+
readonly actionSpec: {
|
|
788
|
+
readonly toggle: {
|
|
789
|
+
readonly label: "Toggle";
|
|
790
|
+
readonly schema: {
|
|
791
|
+
readonly type: "object";
|
|
792
|
+
readonly properties: {
|
|
793
|
+
readonly id: {
|
|
794
|
+
readonly type: "string";
|
|
795
|
+
};
|
|
796
|
+
};
|
|
797
|
+
readonly required: readonly ["id"];
|
|
798
|
+
};
|
|
799
|
+
};
|
|
800
|
+
};
|
|
801
|
+
readonly contextSpec: {
|
|
802
|
+
readonly filter: {
|
|
803
|
+
readonly schema: {
|
|
804
|
+
readonly type: "string";
|
|
805
|
+
};
|
|
806
|
+
readonly default: "all";
|
|
807
|
+
};
|
|
808
|
+
};
|
|
809
|
+
};
|
|
756
810
|
export declare const dataContractSchema: z.ZodType<DataContract>;
|
|
757
811
|
//# sourceMappingURL=data-contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-contract.d.ts","sourceRoot":"","sources":["../../src/schemas/data-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;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;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,QAQa,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAehC,CAAC;AAEX,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAiCZ,CAAC"}
|
|
@@ -77,17 +77,26 @@ export const jsonValueSchema = z.lazy(() => z.union([
|
|
|
77
77
|
* deep `z.lazy` chains; the F4 schema-subset checker validates
|
|
78
78
|
* full structural correctness at render time.
|
|
79
79
|
*/
|
|
80
|
+
const jsonSchemaTypeNameSchema = z.enum([
|
|
81
|
+
'string',
|
|
82
|
+
'number',
|
|
83
|
+
'integer',
|
|
84
|
+
'boolean',
|
|
85
|
+
'array',
|
|
86
|
+
'object',
|
|
87
|
+
'null',
|
|
88
|
+
]);
|
|
80
89
|
export const jsonSchemaSchema = z.lazy(() => z
|
|
81
90
|
.object({
|
|
91
|
+
// Single type OR a draft-07 type array (`['string','null']` —
|
|
92
|
+
// the canonical nullability form the enforced-props-schema
|
|
93
|
+
// emission produces). Mirrors `JsonSchemaTypeName | JsonSchemaTypeName[]`
|
|
94
|
+
// on the TS type — the zod and TS sides are an SSoT pair; widen
|
|
95
|
+
// both or neither.
|
|
82
96
|
type: z
|
|
83
|
-
.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
'integer',
|
|
87
|
-
'boolean',
|
|
88
|
-
'array',
|
|
89
|
-
'object',
|
|
90
|
-
'null',
|
|
97
|
+
.union([
|
|
98
|
+
jsonSchemaTypeNameSchema,
|
|
99
|
+
z.array(jsonSchemaTypeNameSchema),
|
|
91
100
|
])
|
|
92
101
|
.optional(),
|
|
93
102
|
description: z.string().optional(),
|
|
@@ -661,13 +670,63 @@ export const appPublicEnvSchema = z
|
|
|
661
670
|
* posture (`handshakeInputSchema`, `renderInputSchema`, etc. all
|
|
662
671
|
* `passthrough` for the same reason).
|
|
663
672
|
*/
|
|
673
|
+
/**
|
|
674
|
+
* The one-paragraph shape rule every teaching surface quotes (ggui#523
|
|
675
|
+
* item 1): the handshake's tool description, the loose `contract`
|
|
676
|
+
* field the handshake publishes on `tools/list`, and the format doc.
|
|
677
|
+
* One constant, so the wording cannot drift between them. Mechanism-
|
|
678
|
+
* only and vendor-neutral — it ships as JSON-Schema metadata to every
|
|
679
|
+
* agent that lists the tools.
|
|
680
|
+
*/
|
|
681
|
+
export const DATA_CONTRACT_SHAPE_RULE = 'DataContract = up to six top-level specs: propsSpec (initial render data), ' +
|
|
682
|
+
'actionSpec (user gestures that drive the agent\'s next turn), contextSpec (observable client state), ' +
|
|
683
|
+
'streamSpec (live update channels), agentCapabilities (MCP tools the AGENT may call — the catalog ' +
|
|
684
|
+
'actionSpec[*].nextStep and streamSpec[*].source.tool must resolve into), clientCapabilities (browser ' +
|
|
685
|
+
'gadget hooks the COMPONENT imports). EVERY entry under propsSpec.properties / actionSpec / streamSpec / ' +
|
|
686
|
+
'contextSpec is a WRAPPER object whose JSON Schema sits in its `schema:` field — never a flat JSON Schema ' +
|
|
687
|
+
'at the entry level. Wrappers reject unrecognized keys. Placement test: needs next-turn reasoning ⇒ ' +
|
|
688
|
+
'actionSpec; observed state only ⇒ contextSpec.';
|
|
689
|
+
/**
|
|
690
|
+
* A minimal, complete, valid example — published beside the rule so a
|
|
691
|
+
* first-time caller can copy a shape that parses (JSON-Schema
|
|
692
|
+
* `examples`). Deliberately tiny: one prop, one action with a payload,
|
|
693
|
+
* one context slot.
|
|
694
|
+
*/
|
|
695
|
+
export const DATA_CONTRACT_MINIMAL_EXAMPLE = {
|
|
696
|
+
propsSpec: {
|
|
697
|
+
properties: {
|
|
698
|
+
items: {
|
|
699
|
+
schema: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, title: { type: 'string' } }, required: ['id', 'title'] } },
|
|
700
|
+
required: true,
|
|
701
|
+
},
|
|
702
|
+
},
|
|
703
|
+
},
|
|
704
|
+
actionSpec: {
|
|
705
|
+
toggle: { label: 'Toggle', schema: { type: 'object', properties: { id: { type: 'string' } }, required: ['id'] } },
|
|
706
|
+
},
|
|
707
|
+
contextSpec: {
|
|
708
|
+
filter: { schema: { type: 'string' }, default: 'all' },
|
|
709
|
+
},
|
|
710
|
+
};
|
|
664
711
|
export const dataContractSchema = z
|
|
665
712
|
.object({
|
|
666
|
-
propsSpec: propsSpecSchema
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
713
|
+
propsSpec: propsSpecSchema
|
|
714
|
+
.optional()
|
|
715
|
+
.describe('Initial render data: {description?, properties: {<name>: {schema: <JSON Schema>, required?: boolean, description?, default?, example?}}}. A prop is required at the wire gate ONLY when `required: true`; omitted ⇒ optional (declare `required: true` for props the render must always pass).'),
|
|
716
|
+
actionSpec: actionSpecSchema
|
|
717
|
+
.optional()
|
|
718
|
+
.describe("User gestures the agent reacts to on its next turn: {<action>: {label: string (REQUIRED — button copy / accessible name), schema?: <payload JSON Schema>, description?, example?, icon?, confirm?, nextStep?: '<agentCapabilities.tools key>'}}. Every action is agent-routed; `nextStep` is a hint, not a dispatch."),
|
|
719
|
+
streamSpec: streamSpecSchema
|
|
720
|
+
.optional()
|
|
721
|
+
.describe('Live update channels the agent emits into: {<channel>: {schema: <JSON Schema>, description?, example?, mode?: append|replace, replay?: latest|all|none, complete?, source?: {tool, args?}}}. `source.tool` must be declared in agentCapabilities.tools.'),
|
|
722
|
+
contextSpec: contextSpecSchema
|
|
723
|
+
.optional()
|
|
724
|
+
.describe('Observable client state the agent reads alongside each action: {<slot>: {schema: <JSON Schema>, description?, default?, debounceMs?, example?}}. State that needs no next-turn reasoning belongs here, not in actionSpec.'),
|
|
725
|
+
agentCapabilities: agentCapabilitiesSpecSchema
|
|
726
|
+
.optional()
|
|
727
|
+
.describe("MCP tools the AGENT may call: {tools: {<bareToolName>: {toolInfo: {inputSchema (REQUIRED), description?, outputSchema?}, serverInfo?: {name, version?}, usage?, example?: {input, output}}}}. Key by the BARE tool name (after any `mcp__<server>__` prefix); the component never calls these."),
|
|
728
|
+
clientCapabilities: clientCapabilitiesSpecSchema
|
|
729
|
+
.optional()
|
|
730
|
+
.describe('Browser-capability gadgets the COMPONENT imports: {gadgets: {<npm package>: {<exportName>: {description?, usage?}}}} — `use`-prefixed export keys are hooks, PascalCase keys are components; version and transport resolve from the app\'s registered catalog, never on the wire.'),
|
|
672
731
|
})
|
|
673
732
|
.passthrough();
|
|
@@ -21,14 +21,11 @@ export declare const jsonPatchSchema: z.ZodType<JsonPatch>;
|
|
|
21
21
|
* normal consumers should prefer {@link blueprintDraftSchema} (typed
|
|
22
22
|
* `z.ZodType<BlueprintDraft>`).
|
|
23
23
|
*/
|
|
24
|
+
/** The three — and only — draft keys; the strict object names them on rejection. */
|
|
25
|
+
export declare const BLUEPRINT_DRAFT_KEYS: readonly ["contract", "variance", "generator"];
|
|
24
26
|
export declare const blueprintDraftObjectSchema: z.ZodObject<{
|
|
25
27
|
contract: z.ZodType<import("../index.js").DataContract, unknown, z.core.$ZodTypeInternals<import("../index.js").DataContract, unknown>>;
|
|
26
|
-
variance: z.ZodOptional<z.
|
|
27
|
-
persona: z.ZodOptional<z.ZodString>;
|
|
28
|
-
aesthetic: z.ZodOptional<z.ZodString>;
|
|
29
|
-
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../index.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("../index.js").JsonValue, unknown>>>>;
|
|
30
|
-
seedPrompt: z.ZodOptional<z.ZodString>;
|
|
31
|
-
}, z.core.$strict>>;
|
|
28
|
+
variance: z.ZodOptional<z.ZodType<import("../index.js").BlueprintVariance, unknown, z.core.$ZodTypeInternals<import("../index.js").BlueprintVariance, unknown>>>;
|
|
32
29
|
generator: z.ZodOptional<z.ZodString>;
|
|
33
30
|
}, z.core.$strict>;
|
|
34
31
|
/** `BlueprintDraft` — input shape on the handshake. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handshake-suggestion.d.ts","sourceRoot":"","sources":["../../src/schemas/handshake-suggestion.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,kCAAkC,CAAC;AAI1C,qEAAqE;AACrE,eAAO,MAAM,sBAAsB,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAI7D,CAAC;AAEH,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAezB,CAAC;AAE7B,8DAA8D;AAC9D,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAsD,CAAC;AAExG;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"handshake-suggestion.d.ts","sourceRoot":"","sources":["../../src/schemas/handshake-suggestion.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,kCAAkC,CAAC;AAI1C,qEAAqE;AACrE,eAAO,MAAM,sBAAsB,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAI7D,CAAC;AAEH,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAezB,CAAC;AAE7B,8DAA8D;AAC9D,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAsD,CAAC;AAExG;;;;;GAKG;AACH,oFAAoF;AACpF,eAAO,MAAM,oBAAoB,gDAAiD,CAAC;AAEnF,eAAO,MAAM,0BAA0B;;;;kBAkB5B,CAAC;AAEZ,uDAAuD;AACvD,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAA2D,CAAC;AAEvH,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CASlB,CAAC;AAExC,0EAA0E;AAC1E,eAAO,MAAM,uBAAuB,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAOtB,CAAC;AAE5C,qDAAqD;AACrD,eAAO,MAAM,0BAA0B,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAKzB,CAAC;AAE/C,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CASxB,CAAC"}
|
|
@@ -41,19 +41,21 @@ export const jsonPatchSchema = z.array(jsonPatchOpSchema);
|
|
|
41
41
|
* normal consumers should prefer {@link blueprintDraftSchema} (typed
|
|
42
42
|
* `z.ZodType<BlueprintDraft>`).
|
|
43
43
|
*/
|
|
44
|
+
/** The three — and only — draft keys; the strict object names them on rejection. */
|
|
45
|
+
export const BLUEPRINT_DRAFT_KEYS = ['contract', 'variance', 'generator'];
|
|
44
46
|
export const blueprintDraftObjectSchema = z
|
|
45
47
|
.object({
|
|
46
48
|
contract: dataContractSchema,
|
|
47
|
-
variance:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
seedPrompt: z.string().optional(),
|
|
53
|
-
})
|
|
54
|
-
.strict()
|
|
55
|
-
.optional(),
|
|
49
|
+
// ONE declaration of the variance shape, protocol-wide: the same
|
|
50
|
+
// schema (with its `.describe()` teaching and its legal-set
|
|
51
|
+
// rejection message) that `blueprintMeta.variance` projects on the
|
|
52
|
+
// way back out (ggui#523 item 1 — the mirror-of-a-mirror is gone).
|
|
53
|
+
variance: blueprintVarianceSchema.optional(),
|
|
56
54
|
generator: z.string().optional(),
|
|
55
|
+
}, {
|
|
56
|
+
error: (issue) => issue.code === 'unrecognized_keys'
|
|
57
|
+
? `blueprintDraft: unknown key(s) ${issue.keys.map((k) => JSON.stringify(k)).join(', ')} — a draft is EXACTLY {${BLUEPRINT_DRAFT_KEYS.join(', ')}}; \`intent\` is a top-level ggui_handshake field, not a draft field, and the four specs live INSIDE \`contract\``
|
|
58
|
+
: undefined,
|
|
57
59
|
})
|
|
58
60
|
.strict();
|
|
59
61
|
/** `BlueprintDraft` — input shape on the handshake. */
|
package/dist/schemas/invoke.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* client tools — no ggui-specific block type.
|
|
9
9
|
*
|
|
10
10
|
* TS types in types/invoke.ts are derived from these via z.infer. Consumers
|
|
11
|
-
* (@ggui-ai/server, @ggui-ai/react) import schemas for runtime validation
|
|
11
|
+
* (@ggui-ai/server, @ggui-ai/mcp-apps-react) import schemas for runtime validation
|
|
12
12
|
* and types for authoring.
|
|
13
13
|
*/
|
|
14
14
|
import { z } from 'zod';
|
package/dist/schemas/invoke.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* client tools — no ggui-specific block type.
|
|
9
9
|
*
|
|
10
10
|
* TS types in types/invoke.ts are derived from these via z.infer. Consumers
|
|
11
|
-
* (@ggui-ai/server, @ggui-ai/react) import schemas for runtime validation
|
|
11
|
+
* (@ggui-ai/server, @ggui-ai/mcp-apps-react) import schemas for runtime validation
|
|
12
12
|
* and types for authoring.
|
|
13
13
|
*/
|
|
14
14
|
import { z } from 'zod';
|
package/dist/schemas/mcp.d.ts
CHANGED
|
@@ -96,6 +96,19 @@ export declare const getSessionInputShape: {
|
|
|
96
96
|
export declare const getSessionInputSchema: z.ZodObject<{
|
|
97
97
|
sessionId: z.ZodString;
|
|
98
98
|
}, z.core.$strip>;
|
|
99
|
+
/**
|
|
100
|
+
* `ggui_get_render_source` input — read the generated source of the
|
|
101
|
+
* calling app's own render. Same shape as {@link getSessionInputShape}
|
|
102
|
+
* (both take only a sessionId); kept as its own named export rather
|
|
103
|
+
* than reused directly so each tool's wire contract is independently
|
|
104
|
+
* pinned, per this file's one-shape-per-tool convention.
|
|
105
|
+
*/
|
|
106
|
+
export declare const getRenderSourceInputShape: {
|
|
107
|
+
readonly sessionId: z.ZodString;
|
|
108
|
+
};
|
|
109
|
+
export declare const getRenderSourceInputSchema: z.ZodObject<{
|
|
110
|
+
sessionId: z.ZodString;
|
|
111
|
+
}, z.core.$strip>;
|
|
99
112
|
/**
|
|
100
113
|
* `ggui_list_featured_blueprints` input — intentionally EMPTY. The
|
|
101
114
|
* pre-launch No-Backcompat scrub deleted the level/category/tags/limit
|
|
@@ -316,7 +329,7 @@ export declare const renderCacheMarkerSchema: z.ZodObject<{
|
|
|
316
329
|
/**
|
|
317
330
|
* Canonical failure codes for the in-result `ggui_render` failure
|
|
318
331
|
* envelope (SPEC §7.9 Plane 3). Closed enum — a failed render's
|
|
319
|
-
* `error.code` is always one of these
|
|
332
|
+
* `error.code` is always one of these five; finer-grained diagnostics
|
|
320
333
|
* ride on `error.message`.
|
|
321
334
|
*
|
|
322
335
|
* - `PRODUCTION_FAILED` — generation ran but did not produce a
|
|
@@ -328,13 +341,29 @@ export declare const renderCacheMarkerSchema: z.ZodObject<{
|
|
|
328
341
|
* configuration has no key for the resolved route.
|
|
329
342
|
* - `NO_CREDENTIALS` — no generation credentials are configured on
|
|
330
343
|
* the server at all.
|
|
344
|
+
* - `GENERATION_QUEUE_OVERLOADED` — the deployment's generation
|
|
345
|
+
* admission gate rejected this request before any generation
|
|
346
|
+
* attempt started (concurrent-request queue full, or wait for a
|
|
347
|
+
* free slot exceeded the configured timeout). Distinct from
|
|
348
|
+
* `PRODUCTION_FAILED` by design: generation never ran, so callers
|
|
349
|
+
* MUST NOT bill or count it as a failed attempt. See
|
|
350
|
+
* {@link GenerationError} in `types/ui-generator.ts` for the full
|
|
351
|
+
* contract.
|
|
331
352
|
*/
|
|
332
353
|
export declare const renderErrorCodeSchema: z.ZodEnum<{
|
|
333
354
|
PRODUCTION_FAILED: "PRODUCTION_FAILED";
|
|
334
355
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
335
356
|
NO_PLATFORM_KEY: "NO_PLATFORM_KEY";
|
|
336
357
|
NO_CREDENTIALS: "NO_CREDENTIALS";
|
|
358
|
+
GENERATION_QUEUE_OVERLOADED: "GENERATION_QUEUE_OVERLOADED";
|
|
337
359
|
}>;
|
|
360
|
+
/**
|
|
361
|
+
* Canonical inferred type for {@link renderErrorCodeSchema}. Lives
|
|
362
|
+
* beside the schema (rather than in `types/mcp.ts`, which re-exports
|
|
363
|
+
* it) so `types/render.ts` can reference it without a type-only
|
|
364
|
+
* import cycle through `types/mcp.ts`.
|
|
365
|
+
*/
|
|
366
|
+
export type RenderErrorCode = z.infer<typeof renderErrorCodeSchema>;
|
|
338
367
|
/**
|
|
339
368
|
* In-result failure marker for `ggui_render`. Present on the wire
|
|
340
369
|
* output iff the tool result is `isError: true` — the structuredContent
|
|
@@ -347,6 +376,7 @@ export declare const renderErrorSchema: z.ZodObject<{
|
|
|
347
376
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
348
377
|
NO_PLATFORM_KEY: "NO_PLATFORM_KEY";
|
|
349
378
|
NO_CREDENTIALS: "NO_CREDENTIALS";
|
|
379
|
+
GENERATION_QUEUE_OVERLOADED: "GENERATION_QUEUE_OVERLOADED";
|
|
350
380
|
}>;
|
|
351
381
|
message: z.ZodString;
|
|
352
382
|
}, z.core.$strip>;
|
|
@@ -458,6 +488,7 @@ export declare const renderOutputSchema: z.ZodObject<{
|
|
|
458
488
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
459
489
|
NO_PLATFORM_KEY: "NO_PLATFORM_KEY";
|
|
460
490
|
NO_CREDENTIALS: "NO_CREDENTIALS";
|
|
491
|
+
GENERATION_QUEUE_OVERLOADED: "GENERATION_QUEUE_OVERLOADED";
|
|
461
492
|
}>;
|
|
462
493
|
message: z.ZodString;
|
|
463
494
|
}, z.core.$strip>>;
|
|
@@ -467,6 +498,7 @@ export declare const renderOutputSchema: z.ZodObject<{
|
|
|
467
498
|
example: z.ZodString;
|
|
468
499
|
args: z.ZodObject<{
|
|
469
500
|
sessionId: z.ZodString;
|
|
501
|
+
timeout: z.ZodNumber;
|
|
470
502
|
}, z.core.$strip>;
|
|
471
503
|
}, z.core.$strip>>;
|
|
472
504
|
}, z.core.$strip>;
|
|
@@ -510,21 +542,55 @@ export declare const updateInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
510
542
|
kind: z.ZodLiteral<"merge">;
|
|
511
543
|
patch: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
512
544
|
}, z.core.$strict>], "kind">;
|
|
545
|
+
/**
|
|
546
|
+
* `ggui_amend` wire input (#483) — same replace/merge mutation
|
|
547
|
+
* grammar as `ggui_update`, different mount identity: amend targets
|
|
548
|
+
* the ALREADY-MOUNTED card. No new card, no history entry, the
|
|
549
|
+
* history number does not advance. Git reading: `ggui_update` =
|
|
550
|
+
* commit; `ggui_amend` = commit --amend.
|
|
551
|
+
*/
|
|
552
|
+
export declare const amendInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
553
|
+
sessionId: z.ZodString;
|
|
554
|
+
kind: z.ZodLiteral<"replace">;
|
|
555
|
+
props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
556
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
557
|
+
sessionId: z.ZodString;
|
|
558
|
+
kind: z.ZodLiteral<"merge">;
|
|
559
|
+
patch: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
560
|
+
}, z.core.$strict>], "kind">;
|
|
513
561
|
/**
|
|
514
562
|
* Wire-output shape — minimal acknowledgement. The handler carries
|
|
515
563
|
* `decision`, `contract`, `contractHash` on its internal `UpdateOutput`
|
|
516
564
|
* TS shape — zod strips them before structuredContent serialization.
|
|
517
565
|
*
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
* `
|
|
522
|
-
*
|
|
566
|
+
* Every REAL update (`updated: true`) mints a new history record and
|
|
567
|
+
* its result carries the `ai.ggui/render` slice as a FULL bootable
|
|
568
|
+
* mount package (#483 — hosts mint a per-result view for the new
|
|
569
|
+
* card); a no-op (`updated: false`) carries NO result `_meta`.
|
|
570
|
+
* Already-mounted frames are not repainted by update — they freeze as
|
|
571
|
+
* history when its higher-epoch `props_update` frame lands; the
|
|
572
|
+
* in-place repaint over the live-channel ladder (WS / SSE / polling /
|
|
573
|
+
* bridge-pull) is `ggui_amend`'s job.
|
|
523
574
|
*/
|
|
524
575
|
export declare const updateOutputSchema: z.ZodObject<{
|
|
525
576
|
sessionId: z.ZodString;
|
|
526
577
|
updated: z.ZodBoolean;
|
|
527
578
|
resourceUri: z.ZodString;
|
|
579
|
+
epoch: z.ZodNumber;
|
|
580
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
581
|
+
}, z.core.$strip>;
|
|
582
|
+
/**
|
|
583
|
+
* `ggui_amend` wire output (#483) — acknowledgement only. `resourceUri`
|
|
584
|
+
* is the BARE live-head URI (amend targets the mounted card; it never
|
|
585
|
+
* mints a record, so there is no pinned URI to return and no epoch
|
|
586
|
+
* field — the history number is untouched by construction). The
|
|
587
|
+
* mounted card receives the new props over the live channels.
|
|
588
|
+
*/
|
|
589
|
+
export declare const amendOutputSchema: z.ZodObject<{
|
|
590
|
+
sessionId: z.ZodString;
|
|
591
|
+
updated: z.ZodBoolean;
|
|
592
|
+
resourceUri: z.ZodString;
|
|
593
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
528
594
|
}, z.core.$strip>;
|
|
529
595
|
/**
|
|
530
596
|
* `ggui_runtime_declare_tool_catalog` — the host runtime declares its
|
|
@@ -560,4 +626,170 @@ export declare const declareToolCatalogOutputSchema: z.ZodObject<{
|
|
|
560
626
|
saved: z.ZodBoolean;
|
|
561
627
|
appId: z.ZodString;
|
|
562
628
|
}, z.core.$strict>;
|
|
629
|
+
/**
|
|
630
|
+
* Server-side page cap for `ggui_runtime_pull`. A `limit` above this is
|
|
631
|
+
* CLAMPED (not rejected) — the tool mirrors the cursor-walk posture of
|
|
632
|
+
* the `/events` HTTP route, where a too-eager page size is a tuning
|
|
633
|
+
* knob, not a caller bug. Shared so the pulling client and the serving
|
|
634
|
+
* handler agree on the effective page ceiling from one constant.
|
|
635
|
+
*/
|
|
636
|
+
export declare const RUNTIME_PULL_MAX_LIMIT = 100;
|
|
637
|
+
/**
|
|
638
|
+
* Server-side ceiling on `ggui_runtime_pull`'s `wait` hold, in seconds.
|
|
639
|
+
* Chosen under `ggui_consume`'s proven 25-second host tolerance for
|
|
640
|
+
* held tool calls — the hold must resolve before any host-side
|
|
641
|
+
* `tools/call` timeout fires, or the transport counts a failure the
|
|
642
|
+
* server intended as a quiet success.
|
|
643
|
+
*/
|
|
644
|
+
export declare const RUNTIME_PULL_MAX_WAIT_SECONDS = 20;
|
|
645
|
+
/**
|
|
646
|
+
* One `GguiSessionEvent` ledger row on the `ggui_runtime_pull` wire —
|
|
647
|
+
* the zod mirror of the canonical `GguiSessionEvent` interface in
|
|
648
|
+
* `types/ggui-session-event.ts` (which stays the type-level source of
|
|
649
|
+
* truth; `mcp.test.ts` pins the two together in both directions).
|
|
650
|
+
*/
|
|
651
|
+
export declare const gguiSessionEventSchema: z.ZodObject<{
|
|
652
|
+
seq: z.ZodNumber;
|
|
653
|
+
type: z.ZodString;
|
|
654
|
+
timestamp: z.ZodString;
|
|
655
|
+
data: z.ZodUnknown;
|
|
656
|
+
}, z.core.$strip>;
|
|
657
|
+
/**
|
|
658
|
+
* `ggui_runtime_pull` input — the terminal bridge-pull rung of the
|
|
659
|
+
* live-channel failover ladder (WS → SSE → HTTP polling → bridge-pull).
|
|
660
|
+
*
|
|
661
|
+
* Two named parties:
|
|
662
|
+
*
|
|
663
|
+
* - **Puller** — the `@ggui-ai/iframe-runtime` bridge rung. In a
|
|
664
|
+
* CSP-jailed MCP Apps host the iframe can reach no network origin
|
|
665
|
+
* at all, so it pulls the event ledger by issuing `tools/call`
|
|
666
|
+
* postMessages that the host's MCP client relays (the tool
|
|
667
|
+
* registers `_meta.ui.visibility: ['app']` per MCP Apps spec §401
|
|
668
|
+
* — hosts MUST route view-issued calls to it and MUST reject
|
|
669
|
+
* view-issued calls to tools without it).
|
|
670
|
+
* - **Server** — the MCP server hosting the render. It serves the
|
|
671
|
+
* SAME `GguiSessionEvent` ledger `GET
|
|
672
|
+
* /api/sessions/:sessionId/events` serves, through the same
|
|
673
|
+
* `listEventsSince` read, and MUST answer with the same shapes
|
|
674
|
+
* (see {@link runtimePullOutputSchema}) so one client parse core
|
|
675
|
+
* handles both carriers.
|
|
676
|
+
*
|
|
677
|
+
* Divergences from the HTTP route, both deliberate: `sinceSequence` is
|
|
678
|
+
* OPTIONAL here (the bridge rung owns its cursor and seeds from 0; the
|
|
679
|
+
* route requires it because a bare browser GET has no cursor owner),
|
|
680
|
+
* and `limit` is clamped to {@link RUNTIME_PULL_MAX_LIMIT} instead of
|
|
681
|
+
* rejecting above it. Tenancy violations and unknown sessionIds
|
|
682
|
+
* surface uniformly as the `session_not_found` error — existence of
|
|
683
|
+
* other tenants' renders is never leaked.
|
|
684
|
+
*/
|
|
685
|
+
export declare const runtimePullInputShape: {
|
|
686
|
+
readonly sessionId: z.ZodString;
|
|
687
|
+
readonly sinceSequence: z.ZodOptional<z.ZodNumber>;
|
|
688
|
+
readonly limit: z.ZodOptional<z.ZodNumber>;
|
|
689
|
+
readonly wait: z.ZodOptional<z.ZodNumber>;
|
|
690
|
+
};
|
|
691
|
+
export declare const runtimePullInputSchema: z.ZodObject<{
|
|
692
|
+
sessionId: z.ZodString;
|
|
693
|
+
sinceSequence: z.ZodOptional<z.ZodNumber>;
|
|
694
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
695
|
+
wait: z.ZodOptional<z.ZodNumber>;
|
|
696
|
+
}, z.core.$strip>;
|
|
697
|
+
/**
|
|
698
|
+
* Normal-page arm — EXACT `EventsResponse` parity with
|
|
699
|
+
* `GET /api/sessions/:sessionId/events` (same keys, same semantics):
|
|
700
|
+
* `events` strictly ascending by seq, `lastSequence` = the render's
|
|
701
|
+
* current high-water mark (NOT the page's last seq — advances the
|
|
702
|
+
* cursor on empty pages), `hasMore` = the page was truncated by
|
|
703
|
+
* `limit`.
|
|
704
|
+
*/
|
|
705
|
+
export declare const runtimePullEventsPageSchema: z.ZodObject<{
|
|
706
|
+
events: z.ZodArray<z.ZodObject<{
|
|
707
|
+
seq: z.ZodNumber;
|
|
708
|
+
type: z.ZodString;
|
|
709
|
+
timestamp: z.ZodString;
|
|
710
|
+
data: z.ZodUnknown;
|
|
711
|
+
}, z.core.$strip>>;
|
|
712
|
+
lastSequence: z.ZodNumber;
|
|
713
|
+
hasMore: z.ZodBoolean;
|
|
714
|
+
}, z.core.$strip>;
|
|
715
|
+
/**
|
|
716
|
+
* Replay-horizon arm — parity with the route's 410 body, but on this
|
|
717
|
+
* carrier it is a NORMAL result arm, not an error: the bridge rung is
|
|
718
|
+
* terminal and treats it as a re-sync instruction. Returned when the
|
|
719
|
+
* cursor fell out of the replayable window on EITHER side
|
|
720
|
+
* (`sinceSequence` above the server's `lastSequence` — a cursor from a
|
|
721
|
+
* different deployment/reset render — or below the retention horizon).
|
|
722
|
+
* Client recovery: re-mount state from a fresh snapshot and reset the
|
|
723
|
+
* cursor to `currentSequence`.
|
|
724
|
+
*/
|
|
725
|
+
export declare const runtimePullHorizonSchema: z.ZodObject<{
|
|
726
|
+
reason: z.ZodLiteral<"REPLAY_HORIZON_PASSED">;
|
|
727
|
+
currentSequence: z.ZodNumber;
|
|
728
|
+
}, z.core.$strip>;
|
|
729
|
+
/**
|
|
730
|
+
* `ggui_runtime_pull` output — the canonical strict wire contract, a
|
|
731
|
+
* two-arm union: {@link runtimePullEventsPageSchema} (normal page) |
|
|
732
|
+
* {@link runtimePullHorizonSchema} (cursor out of window). The handler
|
|
733
|
+
* registers a flat raw shape (MCP tool registration takes a
|
|
734
|
+
* `ZodRawShape`, which cannot express a top-level union) and its
|
|
735
|
+
* alignment test pins that shape to this union — same posture as
|
|
736
|
+
* `updateInputSchema`.
|
|
737
|
+
*/
|
|
738
|
+
export declare const runtimePullOutputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
739
|
+
events: z.ZodArray<z.ZodObject<{
|
|
740
|
+
seq: z.ZodNumber;
|
|
741
|
+
type: z.ZodString;
|
|
742
|
+
timestamp: z.ZodString;
|
|
743
|
+
data: z.ZodUnknown;
|
|
744
|
+
}, z.core.$strip>>;
|
|
745
|
+
lastSequence: z.ZodNumber;
|
|
746
|
+
hasMore: z.ZodBoolean;
|
|
747
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
748
|
+
reason: z.ZodLiteral<"REPLAY_HORIZON_PASSED">;
|
|
749
|
+
currentSequence: z.ZodNumber;
|
|
750
|
+
}, z.core.$strip>]>;
|
|
751
|
+
/**
|
|
752
|
+
* Per-batch event cap on `ggui_runtime_telemetry` — a bounded
|
|
753
|
+
* fire-and-forget diagnostic channel, never a data plane.
|
|
754
|
+
*/
|
|
755
|
+
export declare const RUNTIME_TELEMETRY_MAX_EVENTS = 40;
|
|
756
|
+
/**
|
|
757
|
+
* `ggui_runtime_telemetry` input — the iframe runtime's transport
|
|
758
|
+
* self-report (`_meta.ui.visibility: ['app']`, view-callable only).
|
|
759
|
+
*
|
|
760
|
+
* Contract (both parties named): the IFRAME RUNTIME batches short
|
|
761
|
+
* `{at, kind, detail?}` events describing its delivery-ladder journey
|
|
762
|
+
* (boot-path decision, per-rung status transitions and failures —
|
|
763
|
+
* `channel_failover_swap`, `channel_polling_budget_exhausted`, … —
|
|
764
|
+
* and outbound doorbell rings) and flushes them over the host's
|
|
765
|
+
* `tools/call` postMessage bridge; the SERVER logs one structured
|
|
766
|
+
* line per batch for operator forensics and stores NOTHING. Sandboxed
|
|
767
|
+
* hosts (claude.ai's `claudemcpcontent.com` frames) expose no
|
|
768
|
+
* readable console and no network — this tool is the ONLY way the
|
|
769
|
+
* ladder's behavior on such hosts reaches an operator. `sessionId` is
|
|
770
|
+
* client-claimed (log-tagged, never trusted for reads); events are
|
|
771
|
+
* bounded (≤ {@link RUNTIME_TELEMETRY_MAX_EVENTS} per batch, `kind` ≤
|
|
772
|
+
* 64 chars, `detail` ≤ 512) so a hostile view cannot use the channel
|
|
773
|
+
* for bulk exfiltration or log flooding.
|
|
774
|
+
*/
|
|
775
|
+
export declare const runtimeTelemetryInputShape: {
|
|
776
|
+
readonly sessionId: z.ZodString;
|
|
777
|
+
readonly events: z.ZodArray<z.ZodObject<{
|
|
778
|
+
at: z.ZodNumber;
|
|
779
|
+
kind: z.ZodString;
|
|
780
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
781
|
+
}, z.core.$strip>>;
|
|
782
|
+
};
|
|
783
|
+
export declare const runtimeTelemetryInputSchema: z.ZodObject<{
|
|
784
|
+
sessionId: z.ZodString;
|
|
785
|
+
events: z.ZodArray<z.ZodObject<{
|
|
786
|
+
at: z.ZodNumber;
|
|
787
|
+
kind: z.ZodString;
|
|
788
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
789
|
+
}, z.core.$strip>>;
|
|
790
|
+
}, z.core.$strip>;
|
|
791
|
+
/** `ggui_runtime_telemetry` output — bare acknowledgement. */
|
|
792
|
+
export declare const runtimeTelemetryOutputSchema: z.ZodObject<{
|
|
793
|
+
ok: z.ZodLiteral<true>;
|
|
794
|
+
}, z.core.$strip>;
|
|
563
795
|
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -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;;;;;CAwB7B,CAAC;AAEX,eAAO,MAAM,2BAA2B;;;;;iBAAuC,CAAC;AAEhF,eAAO,MAAM,yBAAyB;;CAO5B,CAAC;AAEX,eAAO,MAAM,0BAA0B;;iBAAsC,CAAC;AAE9E,eAAO,MAAM,kBAAkB,IAAc,CAAC;AAE9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