@ggui-ai/protocol 0.15.0 → 0.17.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/domain-error.d.ts +70 -0
- package/dist/errors/domain-error.d.ts.map +1 -0
- package/dist/errors/domain-error.js +118 -0
- package/dist/gadgets/stdlib-gadgets.d.ts +1 -1
- package/dist/gadgets/stdlib-gadgets.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/integrations/mcp-apps.d.ts +48 -8
- package/dist/integrations/mcp-apps.d.ts.map +1 -1
- package/dist/integrations/mcp-apps.js +29 -23
- package/dist/integrations/overlay-hash.d.ts +19 -0
- package/dist/integrations/overlay-hash.d.ts.map +1 -0
- package/dist/integrations/overlay-hash.js +29 -0
- package/dist/integrations/theme-binding.d.ts +14 -12
- package/dist/integrations/theme-binding.d.ts.map +1 -1
- package/dist/integrations/theme-binding.js +10 -6
- package/dist/registry/blueprint-key.d.ts.map +1 -1
- package/dist/registry/blueprint-key.js +4 -3
- package/dist/schemas/app-generation-profile.d.ts +139 -0
- package/dist/schemas/app-generation-profile.d.ts.map +1 -0
- package/dist/schemas/app-generation-profile.js +121 -0
- package/dist/schemas/app-theme.d.ts +235 -9
- package/dist/schemas/app-theme.d.ts.map +1 -1
- package/dist/schemas/app-theme.js +218 -40
- package/dist/schemas/blueprint.d.ts +2 -1
- package/dist/schemas/blueprint.d.ts.map +1 -1
- package/dist/schemas/blueprint.js +15 -3
- package/dist/schemas/data-contract.d.ts +1 -1
- package/dist/schemas/data-contract.js +1 -1
- package/dist/schemas/handshake-suggestion.d.ts.map +1 -1
- package/dist/schemas/handshake-suggestion.js +8 -1
- package/dist/schemas/mcp.d.ts +62 -27
- package/dist/schemas/mcp.d.ts.map +1 -1
- package/dist/schemas/mcp.js +59 -21
- package/dist/schemas/ops-blueprint.d.ts +11 -4
- package/dist/schemas/ops-blueprint.d.ts.map +1 -1
- package/dist/schemas/ops-blueprint.js +25 -8
- package/dist/schemas/render-input-envelope.js +1 -1
- package/dist/schemas/rendering-context.d.ts +48 -0
- package/dist/schemas/rendering-context.d.ts.map +1 -0
- package/dist/schemas/rendering-context.js +39 -0
- package/dist/types/blueprint-source.d.ts +27 -7
- package/dist/types/blueprint-source.d.ts.map +1 -1
- package/dist/types/blueprint-source.js +19 -3
- package/dist/types/blueprint.d.ts +2 -2
- package/dist/types/blueprint.d.ts.map +1 -1
- package/dist/types/data-contract.d.ts +3 -3
- package/dist/types/domain-error-codes.d.ts +167 -0
- package/dist/types/domain-error-codes.d.ts.map +1 -0
- package/dist/types/domain-error-codes.js +170 -0
- package/dist/types/handshake-suggestion.d.ts +2 -2
- package/dist/types/live-channel.d.ts +1 -1
- package/dist/types/llm-route.d.ts +59 -2
- package/dist/types/llm-route.d.ts.map +1 -1
- package/dist/types/llm-route.js +62 -16
- package/dist/types/llm.d.ts +22 -2
- package/dist/types/llm.d.ts.map +1 -1
- package/dist/types/llm.js +29 -2
- package/dist/types/mcp.d.ts +31 -39
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/mcp.js +22 -10
- package/dist/types/refusal-codes.d.ts +31 -93
- package/dist/types/refusal-codes.d.ts.map +1 -1
- package/dist/types/refusal-codes.js +41 -96
- package/dist/types/render.d.ts +6 -5
- package/dist/types/render.d.ts.map +1 -1
- package/dist/validation/contract-validator.d.ts +8 -2
- package/dist/validation/contract-validator.d.ts.map +1 -1
- package/dist/validation/contract-validator.js +12 -4
- package/dist/validation/lint-contract.d.ts +2 -2
- package/dist/validation/lint-contract.d.ts.map +1 -1
- package/dist/validation/lint-contract.js +6 -4
- package/dist/validation/schema-subset.d.ts +3 -3
- package/dist/version.d.ts +445 -6
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +444 -5
- package/package.json +1 -1
- package/dist/envelope-adapters.d.ts +0 -12
- package/dist/envelope-adapters.d.ts.map +0 -1
- package/dist/envelope-adapters.js +0 -30
|
@@ -91,6 +91,22 @@ export const REFUSAL_RETRIES = [
|
|
|
91
91
|
* itself — see the no-auto-retry rule in the file header.
|
|
92
92
|
*/
|
|
93
93
|
export const REFUSAL_FIX_BY = ['caller', 'owner', 'tenant', 'operator'];
|
|
94
|
+
/**
|
|
95
|
+
* Registry v11 (ggui#960, 2026-09-08) — the plan model is retired: a
|
|
96
|
+
* deployment funds renders from a credit balance at flat rates, and the
|
|
97
|
+
* states that only a plan, a trial or a subscription could produce no
|
|
98
|
+
* longer exist. Retired with their emitting arms, in the same slice:
|
|
99
|
+
* render-gate `trial_exhausted`, `trial_expired`, `app_canceled`;
|
|
100
|
+
* owner-api `subscription_exists`, `no_subscription`,
|
|
101
|
+
* `subscription_unchanged`, `portal_unavailable`, `card_update_unavailable`,
|
|
102
|
+
* `managed_app_no_portal`, `managed_app_no_card_update`,
|
|
103
|
+
* `managed_app_no_checkout` (the top-up mutation is user-scoped — no
|
|
104
|
+
* managed branch exists to refuse from). Re-described: `billing_path_missing`
|
|
105
|
+
* (off the trial), `model_not_allowed` (per-account grant),
|
|
106
|
+
* `checkout_unavailable` (adding credit), `insufficient_credit` (pool or
|
|
107
|
+
* BYOK — the BYOK lane is charged). `managed_default_cap_exceeded` is NOT in this
|
|
108
|
+
* bump: unemitted since N1's swap but federated-side (ggui#965).
|
|
109
|
+
*/
|
|
94
110
|
/**
|
|
95
111
|
* The registry is the ONLY list of refusal codes: {@link RefusalCode}
|
|
96
112
|
* is derived from the keys below, and this definer forces every row's
|
|
@@ -120,7 +136,7 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
|
|
|
120
136
|
retry: 'after-fix',
|
|
121
137
|
fixBy: 'owner',
|
|
122
138
|
emitter: "a deployment's generation gate, balance arm",
|
|
123
|
-
description:
|
|
139
|
+
description: "The balance this deployment funds the render from is at or below zero — pool or BYOK lane alike — so nothing renders under it. The owner adds credit, after which the same call succeeds.",
|
|
124
140
|
},
|
|
125
141
|
hard_cap_exceeded: {
|
|
126
142
|
code: 'hard_cap_exceeded',
|
|
@@ -129,13 +145,13 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
|
|
|
129
145
|
emitter: "a deployment's generation gate, cap arm",
|
|
130
146
|
description: 'The app reached the hard ceiling this deployment set for the current period. Nothing the caller or the owner does lifts it before the period rolls over.',
|
|
131
147
|
},
|
|
132
|
-
|
|
133
|
-
code: '
|
|
148
|
+
model_not_allowed: {
|
|
149
|
+
code: 'model_not_allowed',
|
|
134
150
|
surfaces: ['render-gate'],
|
|
135
151
|
retry: 'after-fix',
|
|
136
152
|
fixBy: 'caller',
|
|
137
153
|
emitter: "a deployment's generation gate, model arm",
|
|
138
|
-
description: 'The requested model is not
|
|
154
|
+
description: 'The requested model is not one this account has been granted on this deployment. The caller picks a granted model and retries with the same handshakeId — the one render-gate state an agent may act on itself.',
|
|
139
155
|
},
|
|
140
156
|
managed_default_cap_exceeded: {
|
|
141
157
|
code: 'managed_default_cap_exceeded',
|
|
@@ -163,30 +179,6 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
|
|
|
163
179
|
emitter: "a deployment's provisioning guard and its generation gate, reading the same record",
|
|
164
180
|
description: 'The app record declares a funding mode this deployment does not recognise, or declares none at all. The value is reported as read and never coerced — an unreadable record is not a policy.',
|
|
165
181
|
},
|
|
166
|
-
app_canceled: {
|
|
167
|
-
code: 'app_canceled',
|
|
168
|
-
surfaces: ['render-gate'],
|
|
169
|
-
retry: 'after-fix',
|
|
170
|
-
fixBy: 'owner',
|
|
171
|
-
emitter: "a deployment's generation gate, plan-state arm",
|
|
172
|
-
description: "The app's plan has ended, so it renders nothing while the stored work is kept. The owner starts a new plan to restore rendering.",
|
|
173
|
-
},
|
|
174
|
-
trial_exhausted: {
|
|
175
|
-
code: 'trial_exhausted',
|
|
176
|
-
surfaces: ['render-gate'],
|
|
177
|
-
retry: 'after-fix',
|
|
178
|
-
fixBy: 'owner',
|
|
179
|
-
emitter: "a deployment's generation gate, trial arm",
|
|
180
|
-
description: 'The trial this deployment grants the app has used up its allotment. The owner starts a paid plan.',
|
|
181
|
-
},
|
|
182
|
-
trial_expired: {
|
|
183
|
-
code: 'trial_expired',
|
|
184
|
-
surfaces: ['render-gate'],
|
|
185
|
-
retry: 'after-fix',
|
|
186
|
-
fixBy: 'owner',
|
|
187
|
-
emitter: "a deployment's generation gate, trial arm",
|
|
188
|
-
description: "The app's trial window has closed. The owner starts a paid plan.",
|
|
189
|
-
},
|
|
190
182
|
issuer_rate_limited: {
|
|
191
183
|
code: 'issuer_rate_limited',
|
|
192
184
|
surfaces: ['render-gate'],
|
|
@@ -213,78 +205,17 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
|
|
|
213
205
|
surfaces: ['render-gate'],
|
|
214
206
|
retry: 'after-fix',
|
|
215
207
|
fixBy: 'owner',
|
|
216
|
-
emitter: "the generation gate's fall-through arm: a non-playground identity that resolves to no billing path (not a
|
|
217
|
-
description:
|
|
208
|
+
emitter: "the generation gate's fall-through arm: a non-playground identity that resolves to no billing path (not a managed app, not a credit holder)",
|
|
209
|
+
description: "The caller has no billing subject on this deployment, so nothing renders under it. The owner provisions one — a managed policy, or credit. Unlike `billing_mode_anomaly` — an app record that exists and declares a funding mode this deployment cannot read — no record arm applies here: there is simply no subject to bill. A deployment MAY suppress this refusal by operator override; that switch is deployment policy, not a wire state.",
|
|
218
210
|
},
|
|
219
211
|
// ── owner-api ─────────────────────────────────────────────────────
|
|
220
|
-
subscription_exists: {
|
|
221
|
-
code: 'subscription_exists',
|
|
222
|
-
surfaces: ['owner-api'],
|
|
223
|
-
retry: 'after-fix',
|
|
224
|
-
fixBy: 'owner',
|
|
225
|
-
emitter: "a deployment's owner billing mutations",
|
|
226
|
-
description: "An active (non-canceled) plan exists on this app. It refuses starting another one AND deleting the app — the refusal's own `fix` names the next step for the action that was called.",
|
|
227
|
-
},
|
|
228
212
|
checkout_unavailable: {
|
|
229
213
|
code: 'checkout_unavailable',
|
|
230
214
|
surfaces: ['owner-api'],
|
|
231
215
|
retry: 'later',
|
|
232
216
|
fixBy: 'operator',
|
|
233
217
|
emitter: "a deployment's owner billing mutations",
|
|
234
|
-
description: 'The surface that
|
|
235
|
-
},
|
|
236
|
-
card_update_unavailable: {
|
|
237
|
-
code: 'card_update_unavailable',
|
|
238
|
-
surfaces: ['owner-api'],
|
|
239
|
-
retry: 'later',
|
|
240
|
-
fixBy: 'operator',
|
|
241
|
-
emitter: "a deployment's owner billing mutations",
|
|
242
|
-
description: 'The surface that updates a payment method is unavailable on this deployment right now. Only the operator can restore it.',
|
|
243
|
-
},
|
|
244
|
-
portal_unavailable: {
|
|
245
|
-
code: 'portal_unavailable',
|
|
246
|
-
surfaces: ['owner-api'],
|
|
247
|
-
retry: 'later',
|
|
248
|
-
fixBy: 'operator',
|
|
249
|
-
emitter: "a deployment's owner billing mutations",
|
|
250
|
-
description: "The self-service billing surface is unavailable on this deployment right now. Only the operator can restore it.",
|
|
251
|
-
},
|
|
252
|
-
no_subscription: {
|
|
253
|
-
code: 'no_subscription',
|
|
254
|
-
surfaces: ['owner-api'],
|
|
255
|
-
retry: 'after-fix',
|
|
256
|
-
fixBy: 'owner',
|
|
257
|
-
emitter: "a deployment's owner billing mutations",
|
|
258
|
-
description: 'A plan-management action was called on an app that has no plan. The owner starts a plan first.',
|
|
259
|
-
},
|
|
260
|
-
already_on_tier: {
|
|
261
|
-
code: 'already_on_tier',
|
|
262
|
-
surfaces: ['owner-api'],
|
|
263
|
-
retry: 'after-fix',
|
|
264
|
-
fixBy: 'owner',
|
|
265
|
-
emitter: "a deployment's owner billing mutations",
|
|
266
|
-
description: 'The plan requested is the one the app is already on. The owner picks a different plan.',
|
|
267
|
-
},
|
|
268
|
-
managed_app_no_checkout: {
|
|
269
|
-
code: 'managed_app_no_checkout',
|
|
270
|
-
surfaces: ['owner-api'],
|
|
271
|
-
retry: 'never',
|
|
272
|
-
emitter: "a deployment's owner billing mutations",
|
|
273
|
-
description: 'This app is funded by the tenant that provisioned it, so it has no owner-facing plan surface at all. No owner action creates one.',
|
|
274
|
-
},
|
|
275
|
-
managed_app_no_card_update: {
|
|
276
|
-
code: 'managed_app_no_card_update',
|
|
277
|
-
surfaces: ['owner-api'],
|
|
278
|
-
retry: 'never',
|
|
279
|
-
emitter: "a deployment's owner billing mutations",
|
|
280
|
-
description: 'This app is funded by the tenant that provisioned it, so it carries no owner payment method to update.',
|
|
281
|
-
},
|
|
282
|
-
managed_app_no_portal: {
|
|
283
|
-
code: 'managed_app_no_portal',
|
|
284
|
-
surfaces: ['owner-api'],
|
|
285
|
-
retry: 'never',
|
|
286
|
-
emitter: "a deployment's owner billing mutations",
|
|
287
|
-
description: 'This app is funded by the tenant that provisioned it, so it has no owner self-service billing surface.',
|
|
218
|
+
description: 'The surface that adds credit (a top-up) is unavailable on this deployment right now — unconfigured, or its provider is down. Only the operator can restore it.',
|
|
288
219
|
},
|
|
289
220
|
// ── provisioning-api ──────────────────────────────────────────────
|
|
290
221
|
owner_ref_mismatch: {
|
|
@@ -306,6 +237,15 @@ const REFUSAL_ROWS = /* @__PURE__ */ defineRefusalRegistry({
|
|
|
306
237
|
});
|
|
307
238
|
/** The registry consumers read. */
|
|
308
239
|
export const PRE_GENERATION_REFUSAL_CODES = REFUSAL_ROWS;
|
|
240
|
+
/**
|
|
241
|
+
* The SAME registry object with its per-key literal types kept
|
|
242
|
+
* (ggui#889): `PRE_GENERATION_REFUSAL_ROWS.app_rate_limited.code` is
|
|
243
|
+
* `'app_rate_limited'`, its `retry` is `'later'`. The normalized view
|
|
244
|
+
* above erases those literals so `fixBy` reads uniformly; a producer
|
|
245
|
+
* that must satisfy a wire enum from a row (the registry-purity pin
|
|
246
|
+
* forbids the literal in source) reads it here — no parse, no literal.
|
|
247
|
+
*/
|
|
248
|
+
export const PRE_GENERATION_REFUSAL_ROWS = REFUSAL_ROWS;
|
|
309
249
|
/**
|
|
310
250
|
* Identity helper that only accepts an EXHAUSTIVE tuple of one surface's
|
|
311
251
|
* codes: omit one and the parameter type collapses to `never`, so the
|
|
@@ -323,14 +263,11 @@ export const RENDER_GATE_REFUSAL_CODES = exhaustiveCodesOn()([
|
|
|
323
263
|
'unsupported_provider',
|
|
324
264
|
'insufficient_credit',
|
|
325
265
|
'hard_cap_exceeded',
|
|
326
|
-
'
|
|
266
|
+
'model_not_allowed',
|
|
327
267
|
'managed_default_cap_exceeded',
|
|
328
268
|
'app_policy_missing',
|
|
329
269
|
'billing_mode_anomaly',
|
|
330
270
|
'billing_path_missing',
|
|
331
|
-
'app_canceled',
|
|
332
|
-
'trial_exhausted',
|
|
333
|
-
'trial_expired',
|
|
334
271
|
'issuer_rate_limited',
|
|
335
272
|
'app_rate_limited',
|
|
336
273
|
'app_deprovisioned',
|
|
@@ -344,3 +281,11 @@ export const RENDER_GATE_REFUSAL_CODES = exhaustiveCodesOn()([
|
|
|
344
281
|
export const MCP_ENDPOINT_REFUSAL_CODES = exhaustiveCodesOn()([
|
|
345
282
|
'app_deprovisioned',
|
|
346
283
|
]);
|
|
284
|
+
/**
|
|
285
|
+
* Every owner-api code, as the literal tuple a backend's owner-API
|
|
286
|
+
* refusal helper types its `code` from (ggui#960). Order is the
|
|
287
|
+
* registry's.
|
|
288
|
+
*/
|
|
289
|
+
export const OWNER_API_REFUSAL_CODES = exhaustiveCodesOn()([
|
|
290
|
+
'checkout_unavailable',
|
|
291
|
+
]);
|
package/dist/types/render.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export type AdapterPermissions = {
|
|
|
46
46
|
export type GguiSessionStatus = z.infer<typeof gguiSessionStatusSchema>;
|
|
47
47
|
/**
|
|
48
48
|
* Common base for every {@link GguiSession} variant. Carries identity,
|
|
49
|
-
*
|
|
49
|
+
* app scope, lifecycle, and conversation-scoped context that every
|
|
50
50
|
* rendered thing has regardless of how its visible bits are
|
|
51
51
|
* produced (LLM-generated component, server-emitted system card,
|
|
52
52
|
* embedded MCP-App iframe).
|
|
@@ -62,7 +62,7 @@ export interface GguiSessionBase {
|
|
|
62
62
|
/** GguiSession identity. The value an iframe's bootstrap meta and every
|
|
63
63
|
* wire reference (props_update, consume, update) keys by. */
|
|
64
64
|
readonly id: string;
|
|
65
|
-
/** App identity (
|
|
65
|
+
/** App identity (the app-scope boundary, always per-render). */
|
|
66
66
|
readonly appId: string;
|
|
67
67
|
/** Authenticated end-user (after the auth gate). Absent for anon
|
|
68
68
|
* flows. */
|
|
@@ -143,7 +143,7 @@ export interface GguiSessionBase {
|
|
|
143
143
|
/**
|
|
144
144
|
* `GguiSession` — the canonical protocol shape for a single rendered UI.
|
|
145
145
|
*
|
|
146
|
-
* Three variants share {@link GguiSessionBase} (identity,
|
|
146
|
+
* Three variants share {@link GguiSessionBase} (identity, app scope,
|
|
147
147
|
* lifecycle); each variant adds its own visible-bits surface:
|
|
148
148
|
*
|
|
149
149
|
* - {@link ComponentGguiSession} — LLM-generated / native React component.
|
|
@@ -261,8 +261,9 @@ export interface ComponentGguiSession<TProps = JsonObject> extends GguiSessionBa
|
|
|
261
261
|
*/
|
|
262
262
|
readonly gadgetDescriptors?: readonly GadgetDescriptor[];
|
|
263
263
|
/**
|
|
264
|
-
* Theme sidecar — the resolved per-app theme overlay (mode
|
|
265
|
-
* `--ggui-*`
|
|
264
|
+
* Theme sidecar — the resolved per-app theme overlay (the two-mode
|
|
265
|
+
* `--ggui-*` projection, its attestation, and since ggui#1093 the
|
|
266
|
+
* declared assets `fonts` / `imagery`) snapshotted from `App.theme` at
|
|
266
267
|
* render-commit time. Sibling to {@link ComponentGguiSession.gadgetDescriptors}:
|
|
267
268
|
* a render-time snapshot the slice-meta derivation reads without
|
|
268
269
|
* re-resolving against the App record. The bootstrap projection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/types/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EACV,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MAAM,SAAS,UAAU,GAAG,UAAU,CACvE,SAAQ,eAAe;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,gDAAgD;IAChD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAMD;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB,CAAC,SAAS,GAAG,UAAU;IACtD,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PropsSpec, StreamSpec, ActionSpec, ContextSpec, JsonSchema, JsonObject, DataContract } from '../types/data-contract.js';
|
|
2
|
+
import { DomainError } from '../errors/domain-error.js';
|
|
2
3
|
import type { ActionEnvelope } from '../types/events.js';
|
|
3
4
|
import type { CompiledContractValidators } from '../integrations/mcp-apps.js';
|
|
4
5
|
import type { ValidateFunction } from './ajv-runtime.js';
|
|
@@ -337,7 +338,7 @@ export declare function formatViolations(violations: ContractViolation[]): strin
|
|
|
337
338
|
* `tool.inputSchema`; `streamSpec[*].schema` ⊇ `tool.outputSchema`).
|
|
338
339
|
*/
|
|
339
340
|
export declare function validateContractStructure(contract: DataContract): ValidationResult;
|
|
340
|
-
export declare class ContractViolationError extends
|
|
341
|
+
export declare class ContractViolationError extends DomainError<'contract_violation'> {
|
|
341
342
|
readonly violations: ContractViolation[];
|
|
342
343
|
readonly tool: 'ggui_render' | 'ggui_update' | 'ggui_amend' | 'ggui_emit' | 'ggui_event';
|
|
343
344
|
readonly hint: string;
|
|
@@ -360,7 +361,12 @@ export declare class ContractViolationError extends Error {
|
|
|
360
361
|
hint?: string;
|
|
361
362
|
propsSchemaHash?: string;
|
|
362
363
|
});
|
|
363
|
-
/**
|
|
364
|
+
/**
|
|
365
|
+
* Structured recovery payload carrying the same slug (`error:
|
|
366
|
+
* 'contract_violation'`). It rides the live channel's error frame; on
|
|
367
|
+
* `tools/call` it does not travel — the slug leads the result text there
|
|
368
|
+
* (SPEC §7.9 Plane 2, ggui#880) and the detail carries the same facts.
|
|
369
|
+
*/
|
|
364
370
|
toErrorData(): {
|
|
365
371
|
error: 'contract_violation';
|
|
366
372
|
tool: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-validator.d.ts","sourceRoot":"","sources":["../../src/validation/contract-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"contract-validator.d.ts","sourceRoot":"","sources":["../../src/validation/contract-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACnI,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAItD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKtD,OAAO,EAKL,KAAK,wBAAwB,EAC9B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACn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IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;gBAEtB,IAAI,EAAE;QAChB,IAAI,EAAE,aAAa,GAAG,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,CAAC;QAChF,UAAU,EAAE,iBAAiB,EAAE,CAAC;QAChC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;IAcD;;;;;OAKG;IACH,WAAW,IAAI;QACb,KAAK,EAAE,oBAAoB,CAAC;QAC5B,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,iBAAiB,EAAE,CAAC;QAChC,IAAI,EAAE,MAAM,CAAC;QACb,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;CAWF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DomainError } from '../errors/domain-error.js';
|
|
1
2
|
import { deriveContextDefault } from '../types/data-contract.js';
|
|
2
3
|
import { compileForValidation, compileValidatorFunctionExpr, compileValidatorModule, mapAjvErrorsToViolations, prefixViolations, } from './ajv-runtime.js';
|
|
3
4
|
import { checkCrossReferences } from './cross-references.js';
|
|
@@ -876,7 +877,7 @@ function defaultHintFor(tool) {
|
|
|
876
877
|
}
|
|
877
878
|
return 'Fix your data to match the contract, or call ggui_render to create a new UI for this data shape.';
|
|
878
879
|
}
|
|
879
|
-
export class ContractViolationError extends
|
|
880
|
+
export class ContractViolationError extends DomainError {
|
|
880
881
|
violations;
|
|
881
882
|
tool;
|
|
882
883
|
hint;
|
|
@@ -895,8 +896,10 @@ export class ContractViolationError extends Error {
|
|
|
895
896
|
propsSchemaHash;
|
|
896
897
|
constructor(opts) {
|
|
897
898
|
const formattedViolations = formatViolations(opts.violations);
|
|
898
|
-
|
|
899
|
-
|
|
899
|
+
// Plane 2 (SPEC §7.9, ggui#880): the base composes the wire text
|
|
900
|
+
// `contract_violation: <detail>`; the detail keeps the tool + the
|
|
901
|
+
// formatted violations. `name` is the class name, set by the base.
|
|
902
|
+
super('contract_violation', `Contract violation in ${opts.tool}:\n${formattedViolations}`);
|
|
900
903
|
this.violations = opts.violations;
|
|
901
904
|
this.tool = opts.tool;
|
|
902
905
|
this.hint = opts.hint ?? defaultHintFor(opts.tool);
|
|
@@ -904,7 +907,12 @@ export class ContractViolationError extends Error {
|
|
|
904
907
|
this.propsSchemaHash = opts.propsSchemaHash;
|
|
905
908
|
}
|
|
906
909
|
}
|
|
907
|
-
/**
|
|
910
|
+
/**
|
|
911
|
+
* Structured recovery payload carrying the same slug (`error:
|
|
912
|
+
* 'contract_violation'`). It rides the live channel's error frame; on
|
|
913
|
+
* `tools/call` it does not travel — the slug leads the result text there
|
|
914
|
+
* (SPEC §7.9 Plane 2, ggui#880) and the detail carries the same facts.
|
|
915
|
+
*/
|
|
908
916
|
toErrorData() {
|
|
909
917
|
return {
|
|
910
918
|
error: 'contract_violation',
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* graded mode emits every issue at once so authoring tools can
|
|
31
31
|
* present a complete checklist.
|
|
32
32
|
*/
|
|
33
|
+
import { DomainError } from '../errors/domain-error.js';
|
|
33
34
|
/**
|
|
34
35
|
* Severity classification for a {@link ContractIssue}. Strict
|
|
35
36
|
* `validateContract` throws on `'error'`; graded `lintContract`
|
|
@@ -92,8 +93,7 @@ export interface ContractLintResult {
|
|
|
92
93
|
* surface as a single rolled-up zod failure; reference / schema-compat
|
|
93
94
|
* errors carry one issue per violation.
|
|
94
95
|
*/
|
|
95
|
-
export declare class ContractValidationError extends
|
|
96
|
-
readonly code: "contract_validation_failed";
|
|
96
|
+
export declare class ContractValidationError extends DomainError<'contract_validation_failed'> {
|
|
97
97
|
readonly phase: ContractLintPhase;
|
|
98
98
|
readonly issues: readonly ContractIssue[];
|
|
99
99
|
constructor(phase: ContractLintPhase, issues: readonly ContractIssue[]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint-contract.d.ts","sourceRoot":"","sources":["../../src/validation/lint-contract.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AA4KD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CA2BxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,kBAAkB,CAyBlE"}
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* graded mode emits every issue at once so authoring tools can
|
|
31
31
|
* present a complete checklist.
|
|
32
32
|
*/
|
|
33
|
+
import { DomainError } from '../errors/domain-error.js';
|
|
33
34
|
import { dataContractSchema } from '../schemas/data-contract.js';
|
|
34
35
|
import { checkCrossReferences, } from './cross-references.js';
|
|
35
36
|
import { checkNameInvariants, } from './name-invariants.js';
|
|
@@ -45,14 +46,15 @@ import { checkHygiene, checkRetiredContractFields, } from './hygiene-rules.js';
|
|
|
45
46
|
* surface as a single rolled-up zod failure; reference / schema-compat
|
|
46
47
|
* errors carry one issue per violation.
|
|
47
48
|
*/
|
|
48
|
-
export class ContractValidationError extends
|
|
49
|
-
code = 'contract_validation_failed';
|
|
49
|
+
export class ContractValidationError extends DomainError {
|
|
50
50
|
phase;
|
|
51
51
|
issues;
|
|
52
52
|
constructor(phase, issues) {
|
|
53
53
|
const summary = issues.map((i) => `[${i.code}] ${i.message}`).join(' | ');
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
// Plane 2 (SPEC §7.9, ggui#880): the base composes the wire text
|
|
55
|
+
// `contract_validation_failed: <detail>`; the detail names the phase
|
|
56
|
+
// and every issue. `code` and `name` come from the base.
|
|
57
|
+
super('contract_validation_failed', `Contract validation failed at phase '${phase}': ${summary}`);
|
|
56
58
|
this.phase = phase;
|
|
57
59
|
this.issues = issues;
|
|
58
60
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* **Why this lives in the protocol package.** The schema-alignment
|
|
6
6
|
* contract is enforced at render-time + blueprint-registration; the
|
|
7
|
-
* canonical failure is the named `'
|
|
7
|
+
* canonical failure is the named `'schema_mismatch_error'` rejection
|
|
8
8
|
* the push / registration call answers with — fail-loud at
|
|
9
9
|
* declaration time, before a malformed payload reaches the agentic
|
|
10
10
|
* loop. See the schema-compat docstrings
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
* **Determinism contract.** No randomness, no IO, no thrown
|
|
73
73
|
* exceptions for normal violations. Every incompatibility is
|
|
74
74
|
* reported as a {@link SubsetViolation} with enough field-path
|
|
75
|
-
* context for the `
|
|
75
|
+
* context for the `schema_mismatch_error` rejection to name the
|
|
76
76
|
* mismatch cleanly. Thrown errors are reserved for programmer-
|
|
77
77
|
* bug conditions (a caller passes `null` where a JsonSchema is
|
|
78
78
|
* expected).
|
|
@@ -133,7 +133,7 @@ export interface SubsetViolation {
|
|
|
133
133
|
* {@link SubsetViolation.superset}. */
|
|
134
134
|
readonly subset?: string;
|
|
135
135
|
/** Human-readable summary suitable for inclusion in a
|
|
136
|
-
* `
|
|
136
|
+
* `schema_mismatch_error` rejection. Producers MAY ignore this
|
|
137
137
|
* and render their own message from `path` + `reason` if they
|
|
138
138
|
* prefer a consistent localized format. */
|
|
139
139
|
readonly message: string;
|