@ggui-ai/protocol 0.13.0 → 0.15.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/envelope-adapters.d.ts +1 -14
- package/dist/envelope-adapters.d.ts.map +1 -1
- package/dist/envelope-adapters.js +17 -1
- package/dist/envelopes/render-refusal.d.ts +49 -0
- package/dist/envelopes/render-refusal.d.ts.map +1 -0
- package/dist/envelopes/render-refusal.js +12 -0
- package/dist/gadgets/resolve-app-gadgets.d.ts +1 -1
- package/dist/gadgets/stdlib-gadgets.d.ts +2 -2
- package/dist/gadgets/stdlib-gadgets.js +1 -1
- package/dist/index.d.ts +67 -60
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/integrations/mcp-apps.d.ts +4 -10
- package/dist/integrations/mcp-apps.d.ts.map +1 -1
- package/dist/schemas/app-theme.d.ts +5 -0
- package/dist/schemas/app-theme.d.ts.map +1 -1
- package/dist/schemas/app-theme.js +23 -0
- package/dist/schemas/blueprint.d.ts +2 -2
- package/dist/schemas/data-contract.d.ts +12 -30
- package/dist/schemas/data-contract.d.ts.map +1 -1
- package/dist/schemas/data-contract.js +6 -27
- package/dist/schemas/interface-context.d.ts +44 -0
- package/dist/schemas/interface-context.d.ts.map +1 -0
- package/dist/schemas/interface-context.js +22 -0
- package/dist/schemas/invoke.d.ts +1 -1
- package/dist/schemas/invoke.js +1 -1
- package/dist/schemas/mcp.d.ts +636 -69
- package/dist/schemas/mcp.d.ts.map +1 -1
- package/dist/schemas/mcp.js +554 -47
- package/dist/schemas/public-env-key.d.ts +26 -0
- package/dist/schemas/public-env-key.d.ts.map +1 -0
- package/dist/schemas/public-env-key.js +25 -0
- package/dist/schemas/render-input-envelope.d.ts +20 -0
- package/dist/schemas/render-input-envelope.d.ts.map +1 -0
- package/dist/schemas/render-input-envelope.js +56 -0
- package/dist/schemas/runtime-telemetry-limits.d.ts +11 -0
- package/dist/schemas/runtime-telemetry-limits.d.ts.map +1 -0
- package/dist/schemas/runtime-telemetry-limits.js +10 -0
- package/dist/transport/websocket.d.ts +5 -5
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/contract-inference.d.ts +1 -1
- package/dist/types/events.d.ts +1 -1
- package/dist/types/ggui-session-event.d.ts +4 -5
- package/dist/types/ggui-session-event.d.ts.map +1 -1
- package/dist/types/ggui-session-event.js +0 -37
- package/dist/types/host-context.d.ts +18 -17
- package/dist/types/host-context.d.ts.map +1 -1
- package/dist/types/host-context.js +7 -0
- package/dist/types/interface-context.d.ts +1 -1
- package/dist/types/invoke.d.ts +1 -1
- package/dist/types/lifecycle.d.ts +1 -1
- package/dist/types/live-channel.d.ts +2 -2
- package/dist/types/llm-route.d.ts +2 -2
- package/dist/types/llm-route.d.ts.map +1 -1
- package/dist/types/llm-route.js +11 -3
- package/dist/types/llm.d.ts +397 -7
- package/dist/types/llm.d.ts.map +1 -1
- package/dist/types/llm.js +111 -10
- package/dist/types/mcp.d.ts +31 -111
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/mcp.js +7 -0
- package/dist/types/readonly.d.ts +11 -0
- package/dist/types/readonly.d.ts.map +1 -0
- package/dist/types/readonly.js +1 -0
- package/dist/types/refusal-codes.d.ts +340 -0
- package/dist/types/refusal-codes.d.ts.map +1 -0
- package/dist/types/refusal-codes.js +346 -0
- package/dist/types/render.d.ts +9 -8
- package/dist/types/render.d.ts.map +1 -1
- package/dist/types/ui-generator.d.ts +1 -1
- package/dist/validation/ajv-runtime.d.ts +2 -2
- package/dist/validation/contract-validator.d.ts +6 -6
- package/dist/validation/cross-references.d.ts +2 -2
- package/dist/validation/hygiene-rules.d.ts +1 -1
- package/dist/validation/name-invariants.d.ts +2 -2
- package/dist/validation/reserved-channels.d.ts +1 -1
- package/dist/validation/schema-compat-invariants.d.ts +2 -2
- package/dist/validation/schema-meta-validation.d.ts +1 -1
- package/dist/version.d.ts +201 -5
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +200 -4
- package/dist/wire.d.ts +45 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +44 -0
- package/package.json +13 -3
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
* just to accept the contract and pass it to the generator.
|
|
52
52
|
*/
|
|
53
53
|
import { z } from 'zod';
|
|
54
|
+
import { PUBLIC_ENV_APP_KEY_RE } from './public-env-key.js';
|
|
54
55
|
import { KNOWN_PERMISSION_NAMES } from '../validation/hygiene-rules.js';
|
|
55
56
|
import { STDLIB_GADGETS_PACKAGE } from '../gadgets/stdlib-gadgets.js';
|
|
56
57
|
import { COMPONENT_NAME_RE, HOOK_NAME_RE } from './gadget-name-grammar.js';
|
|
@@ -70,6 +71,8 @@ export const jsonValueSchema = z.lazy(() => z.union([
|
|
|
70
71
|
// surface as `undefined` at runtime which JSON.stringify drops.
|
|
71
72
|
z.record(z.string(), jsonValueSchema),
|
|
72
73
|
]));
|
|
74
|
+
/** A JSON object — the protocol's `JsonObject`, never a bare `Record`. */
|
|
75
|
+
export const jsonObjectSchema = z.record(z.string(), jsonValueSchema);
|
|
73
76
|
/**
|
|
74
77
|
* {@link JsonSchema} — JSON Schema draft-07 subset. Mirrors the
|
|
75
78
|
* fields the TS interface enumerates. `additionalProperties` and
|
|
@@ -218,26 +221,6 @@ export const agentCapabilitiesSpecSchema = z
|
|
|
218
221
|
tools: z.record(z.string(), agentToolEntrySchema),
|
|
219
222
|
})
|
|
220
223
|
.passthrough();
|
|
221
|
-
/**
|
|
222
|
-
* `App.publicEnv` key regex.
|
|
223
|
-
*
|
|
224
|
-
* Each key in `App.publicEnv` MUST match this pattern. The prefix is
|
|
225
|
-
* the **security boundary** — operators can't accidentally stash
|
|
226
|
-
* sensitive credentials under arbitrary names, and downstream consumers
|
|
227
|
-
* (render gate, bootstrap projection, iframe shim) can rely on the
|
|
228
|
-
* naming convention to mean "public-by-design".
|
|
229
|
-
*
|
|
230
|
-
* Rule: `GGUI_PUBLIC_APP_` prefix, then uppercase letters / digits /
|
|
231
|
-
* underscores, at least one char after the prefix.
|
|
232
|
-
*
|
|
233
|
-
* `GGUI_PUBLIC_USER_*` keys are RESERVED for a future per-user
|
|
234
|
-
* channel. The current regex rejects them so App-side config can't
|
|
235
|
-
* pre-emptively use the namespace.
|
|
236
|
-
*
|
|
237
|
-
* Hoisted above `gadgetDescriptorSchema` so the wrapper's `requires`
|
|
238
|
-
* array can reference it at schema-construction time (TDZ-safe).
|
|
239
|
-
*/
|
|
240
|
-
export const PUBLIC_ENV_APP_KEY_RE = /^GGUI_PUBLIC_APP_[A-Z0-9_]+$/;
|
|
241
224
|
/**
|
|
242
225
|
* Single source of truth for the `requires[]` field shape on gadget
|
|
243
226
|
* descriptors. The wire-permissive `gadgetDescriptorSchema`, the
|
|
@@ -251,9 +234,7 @@ export const PUBLIC_ENV_APP_KEY_RE = /^GGUI_PUBLIC_APP_[A-Z0-9_]+$/;
|
|
|
251
234
|
* that declare a `requires` key must have a corresponding App-side
|
|
252
235
|
* publicEnv value at render time (gate: `assertPublicEnvSatisfied`).
|
|
253
236
|
*/
|
|
254
|
-
export const gadgetRequiresSchema = z
|
|
255
|
-
.array(z.string().regex(PUBLIC_ENV_APP_KEY_RE))
|
|
256
|
-
.readonly();
|
|
237
|
+
export const gadgetRequiresSchema = z.array(z.string().regex(PUBLIC_ENV_APP_KEY_RE));
|
|
257
238
|
/**
|
|
258
239
|
* SRI hash format for gadget bundles. Registry install writes
|
|
259
240
|
* `bundleSri` in this shape; iframe-runtime emits it verbatim into
|
|
@@ -432,7 +413,7 @@ const basePackageFieldsShape = {
|
|
|
432
413
|
bundleSri: z.string().regex(BUNDLE_SRI_RE).optional(),
|
|
433
414
|
styleUrl: z.url().optional(),
|
|
434
415
|
// CSP `connect-src` feed — full URL shape on every entry.
|
|
435
|
-
connect: z.array(z.url()).
|
|
416
|
+
connect: z.array(z.url()).optional(),
|
|
436
417
|
// Shared `gadgetRequiresSchema`.
|
|
437
418
|
requires: gadgetRequiresSchema.optional(),
|
|
438
419
|
// HTTPS URL of the package's `.d.ts`. The handler fetches it at
|
|
@@ -638,9 +619,7 @@ export const clientCapabilitiesSpecSchema = z
|
|
|
638
619
|
* - Defensive re-validation in the iframe-runtime slice-meta
|
|
639
620
|
* extractors (`parseMetaFromGlobal`, `parseMetaFromToolResult`).
|
|
640
621
|
*/
|
|
641
|
-
export const appPublicEnvSchema = z
|
|
642
|
-
.record(z.string().regex(PUBLIC_ENV_APP_KEY_RE), z.string())
|
|
643
|
-
.readonly();
|
|
622
|
+
export const appPublicEnvSchema = z.record(z.string().regex(PUBLIC_ENV_APP_KEY_RE), z.string());
|
|
644
623
|
/**
|
|
645
624
|
* {@link DataContract} — the unified four-spec contract surface
|
|
646
625
|
* agents author on `story.contract` and that the generator
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface-context schema — the client's viewport/platform snapshot every
|
|
3
|
+
* handshake and every `InvokeEvent` carries. Its own module (ggui#819) so
|
|
4
|
+
* the browser entry (`@ggui-ai/protocol/wire`) reaches it without the
|
|
5
|
+
* tool schemas that used to share its file.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export declare const viewportSchema: z.ZodObject<{
|
|
9
|
+
width: z.ZodNumber;
|
|
10
|
+
height: z.ZodNumber;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const interfaceContextSchema: z.ZodObject<{
|
|
13
|
+
viewport: z.ZodObject<{
|
|
14
|
+
width: z.ZodNumber;
|
|
15
|
+
height: z.ZodNumber;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
platform: z.ZodEnum<{
|
|
18
|
+
web: "web";
|
|
19
|
+
desktop: "desktop";
|
|
20
|
+
mobile: "mobile";
|
|
21
|
+
}>;
|
|
22
|
+
deviceType: z.ZodEnum<{
|
|
23
|
+
desktop: "desktop";
|
|
24
|
+
tablet: "tablet";
|
|
25
|
+
phone: "phone";
|
|
26
|
+
}>;
|
|
27
|
+
orientation: z.ZodEnum<{
|
|
28
|
+
portrait: "portrait";
|
|
29
|
+
landscape: "landscape";
|
|
30
|
+
}>;
|
|
31
|
+
devicePixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
touchPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
shellType: z.ZodOptional<z.ZodEnum<{
|
|
34
|
+
fullscreen: "fullscreen";
|
|
35
|
+
chat: "chat";
|
|
36
|
+
spatial: "spatial";
|
|
37
|
+
}>>;
|
|
38
|
+
colorScheme: z.ZodOptional<z.ZodEnum<{
|
|
39
|
+
light: "light";
|
|
40
|
+
dark: "dark";
|
|
41
|
+
}>>;
|
|
42
|
+
reducedMotion: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
}, z.core.$loose>;
|
|
44
|
+
//# sourceMappingURL=interface-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface-context.d.ts","sourceRoot":"","sources":["../../src/schemas/interface-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc;;;iBAGzB,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUnB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface-context schema — the client's viewport/platform snapshot every
|
|
3
|
+
* handshake and every `InvokeEvent` carries. Its own module (ggui#819) so
|
|
4
|
+
* the browser entry (`@ggui-ai/protocol/wire`) reaches it without the
|
|
5
|
+
* tool schemas that used to share its file.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export const viewportSchema = z.object({
|
|
9
|
+
width: z.number(),
|
|
10
|
+
height: z.number(),
|
|
11
|
+
});
|
|
12
|
+
export const interfaceContextSchema = z.object({
|
|
13
|
+
viewport: viewportSchema,
|
|
14
|
+
platform: z.enum(['web', 'mobile', 'desktop']),
|
|
15
|
+
deviceType: z.enum(['phone', 'tablet', 'desktop']),
|
|
16
|
+
orientation: z.enum(['portrait', 'landscape']),
|
|
17
|
+
devicePixelRatio: z.number().optional(),
|
|
18
|
+
touchPrimary: z.boolean().optional(),
|
|
19
|
+
shellType: z.enum(['chat', 'fullscreen', 'spatial']).optional(),
|
|
20
|
+
colorScheme: z.enum(['light', 'dark']).optional(),
|
|
21
|
+
reducedMotion: z.boolean().optional(),
|
|
22
|
+
}).passthrough();
|
package/dist/schemas/invoke.d.ts
CHANGED
package/dist/schemas/invoke.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* and types for authoring.
|
|
13
13
|
*/
|
|
14
14
|
import { z } from 'zod';
|
|
15
|
-
import { interfaceContextSchema } from './
|
|
15
|
+
import { interfaceContextSchema } from './interface-context.js';
|
|
16
16
|
// ── Content blocks ────────────────────────────────────────────────────
|
|
17
17
|
/** Plain text content — streamed via `text_delta` events. */
|
|
18
18
|
export const textBlockSchema = z.object({
|