@ggui-ai/protocol 0.2.0-alpha.3 → 0.2.0-alpha.4

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.
@@ -205,11 +205,17 @@ export interface HandshakeSuggestion {
205
205
  */
206
206
  readonly amendments?: SuggestionAmendments;
207
207
  /**
208
- * Populated iff validators ran AND produced findings. On `origin:
209
- * 'cache'` these surface as a soft warning (the agent's draft
210
- * WOULD have had issues, but the cached blueprint is being served);
211
- * on `agent` / `synth` they're absent (agent path's validators
212
- * passed; synth path's amendments already addressed them).
208
+ * Deterministic-gate findings surfaced to the agent so it learns what
209
+ * its draft got wrong (even though the server repaired it). Populated:
210
+ * - `origin: 'agent'` — hygiene WARN findings on the (already-valid)
211
+ * draft, if any.
212
+ * - `origin: 'synth'` — the ERROR findings that rejected the draft
213
+ * and triggered the repair loop.
214
+ * - `origin: 'cache'` — absent (a registered blueprint is served;
215
+ * the draft was not the basis).
216
+ * The repaired contract itself is delivered via `blueprintMeta` /
217
+ * the handshake's stored effectiveContract — these findings are
218
+ * advisory, not the contract.
213
219
  */
214
220
  readonly validationFindings?: readonly SuggestionFinding[];
215
221
  }
@@ -1 +1 @@
1
- {"version":3,"file":"handshake-suggestion.d.ts","sourceRoot":"","sources":["../../src/types/handshake-suggestion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAElE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC;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AM,EAAE,gBAAgB,CAAC;IAClC,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAC3C;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC5D;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAA;CAAE,CAAC;AAE3E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,CAIpE;AA2DD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,sBAAsB,GAAG,SAAS,SAAS,EAAE,CAAC"}
@@ -237,8 +237,11 @@ export declare function checkRetiredContractFields(contract: DataContract): Hygi
237
237
  /**
238
238
  * Run every WIRE-side hygiene rule on a `DataContract`. Aggregates
239
239
  * warnings; order is stable (orphans → usage → example → gadget
240
- * hook-names → duplicate-hook → retired fields) so authoring tools
241
- * render a predictable checklist.
240
+ * hook-names → duplicate-hook) so authoring tools render a predictable
241
+ * checklist. Retired-field detection is NOT here — it is promoted to an
242
+ * ERROR phase (`phaseRetired` in lint-contract.ts); the detector
243
+ * `checkRetiredContractFields` stays exported for the author-time
244
+ * surface and the push-gate assert.
242
245
  *
243
246
  * Registry-side gadget lints (`lintGadgetCatalog`) are NOT run here:
244
247
  * they need an `App.gadgets` descriptor array, not a contract, and
@@ -1 +1 @@
1
- {"version":3,"file":"hygiene-rules.d.ts","sourceRoot":"","sources":["../../src/validation/hyg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AAE,CAiBlB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,YAAY,GACrB,cAAc,EAAE,CAgClB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,YAAY,GACrB,cAAc,EAAE,CAmBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,SAAS,gBAAgB,EAAE,GACvC,cAAc,EAAE,CAoHlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,YAAY,GACrB,cAAc,EAAE,CAiBlB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,YAAY,GACrB,cAAc,EAAE,CAYlB"}
@@ -543,8 +543,11 @@ export function checkRetiredContractFields(contract) {
543
543
  /**
544
544
  * Run every WIRE-side hygiene rule on a `DataContract`. Aggregates
545
545
  * warnings; order is stable (orphans → usage → example → gadget
546
- * hook-names → duplicate-hook → retired fields) so authoring tools
547
- * render a predictable checklist.
546
+ * hook-names → duplicate-hook) so authoring tools render a predictable
547
+ * checklist. Retired-field detection is NOT here — it is promoted to an
548
+ * ERROR phase (`phaseRetired` in lint-contract.ts); the detector
549
+ * `checkRetiredContractFields` stays exported for the author-time
550
+ * surface and the push-gate assert.
548
551
  *
549
552
  * Registry-side gadget lints (`lintGadgetCatalog`) are NOT run here:
550
553
  * they need an `App.gadgets` descriptor array, not a contract, and
@@ -559,6 +562,9 @@ export function checkHygiene(contract) {
559
562
  ...checkMissingExample(contract),
560
563
  ...checkGadgetHookNames(contract),
561
564
  ...checkDuplicateGadgetHooks(contract),
562
- ...checkRetiredContractFields(contract),
565
+ // Retired-field detection is promoted to an ERROR phase
566
+ // (`phaseRetired` in lint-contract.ts) — not a hygiene warning.
567
+ // `checkRetiredContractFields` stays exported for the author-time
568
+ // surface + the push-gate assert.
563
569
  ];
564
570
  }
@@ -17,9 +17,11 @@
17
17
  *
18
18
  * ```
19
19
  * phase 1: shape (zod wire-shape validation)
20
- * phase 2: references (CTR_REF_*, CTR_DUP_NAME, CTR_RESERVED_NAME)
21
- * phase 3: schema compat (CTR_SCHEMA_INCOMPAT)
22
- * phase 4: hygiene (LINT_* — graded, warnings only today)
20
+ * phase 2: retired (CTR_RETIRED_FIELD — dead top-level fields)
21
+ * phase 3: schema-meta (CTR_SCHEMA_META_INVALID — Ajv strict on inner schemas)
22
+ * phase 4: references (CTR_REF_*, CTR_DUP_NAME, CTR_RESERVED_NAME)
23
+ * phase 5: schema compat (CTR_SCHEMA_INCOMPAT)
24
+ * phase 6: hygiene (LINT_* — graded, warnings only)
23
25
  * ```
24
26
  *
25
27
  * Errors are reported one phase at a time during strict validation so
@@ -28,7 +30,6 @@
28
30
  * graded mode emits every issue at once so authoring tools can
29
31
  * present a complete checklist.
30
32
  */
31
- import type { DataContract } from '../types/data-contract';
32
33
  /**
33
34
  * Severity classification for a {@link ContractIssue}. Strict
34
35
  * `validateContract` throws on `'error'`; graded `lintContract`
@@ -40,7 +41,7 @@ export type ContractIssueSeverity = 'error' | 'warn';
40
41
  * authoring tools can render issues grouped by phase + drive the
41
42
  * "fix one phase at a time" UX.
42
43
  */
43
- export type ContractLintPhase = 'shape' | 'references' | 'schema-compat' | 'hygiene';
44
+ export type ContractLintPhase = 'shape' | 'retired' | 'schema-meta' | 'references' | 'schema-compat' | 'hygiene';
44
45
  /**
45
46
  * One observation about a contract from the linter's perspective.
46
47
  *
@@ -114,7 +115,7 @@ export declare class ContractValidationError extends Error {
114
115
  * Hygiene-only contracts (warnings without errors) pass the strict
115
116
  * gate. Use {@link lintContract} when warnings matter.
116
117
  */
117
- export declare function validateContract(contract: DataContract): void;
118
+ export declare function validateContract(contract: unknown): void;
118
119
  /**
119
120
  * Graded-mode linter. Runs ALL phases unconditionally and returns
120
121
  * errors + warnings partitioned. Suitable for authoring tools that
@@ -126,5 +127,5 @@ export declare function validateContract(contract: DataContract): void;
126
127
  * author seeing a phase-2 reference error also sees the phase-4
127
128
  * hygiene warnings on the same contract.
128
129
  */
129
- export declare function lintContract(contract: DataContract): ContractLintResult;
130
+ export declare function lintContract(contract: unknown): ContractLintResult;
130
131
  //# sourceMappingURL=lint-contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lint-contract.d.ts","sourceRoot":"","sources":["../../src/validation/lint-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAgB3D;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,MAAM,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GACzB,OAAO,GACP,YAAY,GACZ,eAAe,GACf,SAAS,CAAC;AAEd;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;CAC7C;AAED;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAG,4BAA4B,CAAU;IACtD,QAAQ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AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAG,4BAA4B,CAAU;IACtD,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;gBAE9B,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,SAAS,aAAa,EAAE;CAOvE;AA4KD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CA2BxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,kBAAkB,CAyBlE"}
@@ -17,9 +17,11 @@
17
17
  *
18
18
  * ```
19
19
  * phase 1: shape (zod wire-shape validation)
20
- * phase 2: references (CTR_REF_*, CTR_DUP_NAME, CTR_RESERVED_NAME)
21
- * phase 3: schema compat (CTR_SCHEMA_INCOMPAT)
22
- * phase 4: hygiene (LINT_* — graded, warnings only today)
20
+ * phase 2: retired (CTR_RETIRED_FIELD — dead top-level fields)
21
+ * phase 3: schema-meta (CTR_SCHEMA_META_INVALID — Ajv strict on inner schemas)
22
+ * phase 4: references (CTR_REF_*, CTR_DUP_NAME, CTR_RESERVED_NAME)
23
+ * phase 5: schema compat (CTR_SCHEMA_INCOMPAT)
24
+ * phase 6: hygiene (LINT_* — graded, warnings only)
23
25
  * ```
24
26
  *
25
27
  * Errors are reported one phase at a time during strict validation so
@@ -32,7 +34,8 @@ import { dataContractSchema } from '../schemas/data-contract.js';
32
34
  import { checkCrossReferences, } from './cross-references.js';
33
35
  import { checkNameInvariants, } from './name-invariants.js';
34
36
  import { checkSchemaCompat, } from './schema-compat-invariants.js';
35
- import { checkHygiene } from './hygiene-rules.js';
37
+ import { checkContractSchemasValid } from './schema-meta-validation.js';
38
+ import { checkHygiene, checkRetiredContractFields, } from './hygiene-rules.js';
36
39
  /**
37
40
  * Strict-mode failure. Carries the offending phase + every issue
38
41
  * the failing phase produced so error renderers can show every fix
@@ -60,8 +63,8 @@ export class ContractValidationError extends Error {
60
63
  function phaseShape(contract) {
61
64
  const parsed = dataContractSchema.safeParse(contract);
62
65
  if (parsed.success)
63
- return [];
64
- return zodErrorToIssues(parsed.error);
66
+ return { issues: [], parsed: parsed.data };
67
+ return { issues: zodErrorToIssues(parsed.error), parsed: null };
65
68
  }
66
69
  function zodErrorToIssues(error) {
67
70
  return error.issues.map((issue) => ({
@@ -89,6 +92,52 @@ function zodIssueCode(zodCode) {
89
92
  }
90
93
  }
91
94
  // =============================================================================
95
+ // Phase — retired fields (CTR_RETIRED_FIELD)
96
+ // =============================================================================
97
+ /**
98
+ * Retired top-level field carriers (`wiredTools`, `libraries`,
99
+ * `dispatch`, …) are a fatal contract bug: the field rides through the
100
+ * `.passthrough()` schema but names dead protocol surface. Promoted
101
+ * from a hygiene WARNING to an ERROR so it routes through the same gate
102
+ * as every other contract error — the handshake repair loop remaps it
103
+ * (an LLM correctly re-nests `wiredTools` → `agentCapabilities.tools`),
104
+ * and `ggui_render`'s override path rejects it. Shares the one detector
105
+ * (`checkRetiredContractFields`) with the author-time surface + the
106
+ * push-gate assert, so the retired vocabulary can't drift across sites.
107
+ */
108
+ function phaseRetired(contract) {
109
+ return checkRetiredContractFields(contract).map((w) => ({
110
+ code: 'CTR_RETIRED_FIELD',
111
+ severity: 'error',
112
+ phase: 'retired',
113
+ path: w.path,
114
+ message: w.message,
115
+ ...(w.fixHint !== undefined ? { fixHint: w.fixHint } : {}),
116
+ }));
117
+ }
118
+ // =============================================================================
119
+ // Phase — schema-meta (CTR_SCHEMA_META_INVALID, Ajv strict meta-validation)
120
+ // =============================================================================
121
+ /**
122
+ * Inner JSON Schema meta-validation — each `schema:` field must compile
123
+ * under Ajv strict mode. Distinct from phase-1 shape: zod validates the
124
+ * WRAPPER shape, but the wrapped JSON Schema rides through
125
+ * `.passthrough()` unvalidated. Runs before references / schema-compat,
126
+ * which read these schemas. This is the check the push/handshake assert
127
+ * set had that `validateContract` was previously missing — folding it in
128
+ * here is what makes the strict gate complete (and therefore safe to use
129
+ * as the single boundary gate).
130
+ */
131
+ function phaseSchemaMeta(contract) {
132
+ return checkContractSchemasValid(contract).map((v) => ({
133
+ code: 'CTR_SCHEMA_META_INVALID',
134
+ severity: 'error',
135
+ phase: 'schema-meta',
136
+ path: v.field,
137
+ message: v.message,
138
+ }));
139
+ }
140
+ // =============================================================================
92
141
  // Phase 2 — references (CTR_REF_*, CTR_DUP_NAME, CTR_RESERVED_NAME)
93
142
  // =============================================================================
94
143
  function phaseReferences(contract) {
@@ -171,18 +220,29 @@ function hygieneWarningToIssue(w) {
171
220
  * gate. Use {@link lintContract} when warnings matter.
172
221
  */
173
222
  export function validateContract(contract) {
174
- const shapeIssues = phaseShape(contract);
175
- if (shapeIssues.length > 0) {
176
- throw new ContractValidationError('shape', shapeIssues);
223
+ const shape = phaseShape(contract);
224
+ if (shape.issues.length > 0) {
225
+ throw new ContractValidationError('shape', shape.issues);
226
+ }
227
+ // Shape passed ⇒ a parsed DataContract is available for the deeper,
228
+ // type-dependent phases. The null check narrows `c` to DataContract
229
+ // without a cast (unreachable: no shape issues ⇒ parsed present).
230
+ const c = shape.parsed;
231
+ if (c === null)
232
+ return;
233
+ const retiredIssues = phaseRetired(c);
234
+ if (retiredIssues.length > 0) {
235
+ throw new ContractValidationError('retired', retiredIssues);
236
+ }
237
+ const schemaMetaIssues = phaseSchemaMeta(c);
238
+ if (schemaMetaIssues.length > 0) {
239
+ throw new ContractValidationError('schema-meta', schemaMetaIssues);
177
240
  }
178
- // After phase 1 we know the contract structurally parses; safe to
179
- // cast through into the phase-2 / phase-3 helpers (they accept
180
- // `DataContract` directly).
181
- const refIssues = phaseReferences(contract);
241
+ const refIssues = phaseReferences(c);
182
242
  if (refIssues.length > 0) {
183
243
  throw new ContractValidationError('references', refIssues);
184
244
  }
185
- const compatIssues = phaseSchemaCompat(contract);
245
+ const compatIssues = phaseSchemaCompat(c);
186
246
  if (compatIssues.length > 0) {
187
247
  throw new ContractValidationError('schema-compat', compatIssues);
188
248
  }
@@ -201,18 +261,21 @@ export function validateContract(contract) {
201
261
  */
202
262
  export function lintContract(contract) {
203
263
  const issues = [];
204
- issues.push(...phaseShape(contract));
205
- // Phase 2 + 3 produce shape-dependent errors. When the shape
206
- // phase already failed, the contract may not match the type
207
- // signatures these phases assume — skip downstream phases in that
208
- // case to avoid throwing during the lint run. Authoring tools see
209
- // "fix shape first" via the shape issues; once those are clean
210
- // the next `lintContract` run reaches the deeper phases.
211
- if (issues.length === 0) {
212
- issues.push(...phaseReferences(contract));
213
- issues.push(...phaseSchemaCompat(contract));
264
+ const shape = phaseShape(contract);
265
+ issues.push(...shape.issues);
266
+ // Phases beyond shape are shape-dependent and need a parsed
267
+ // DataContract. When shape failed, skip them (the contract may not
268
+ // match the type signatures these phases assume); authoring tools see
269
+ // "fix shape first" via the shape issues, and the next run reaches the
270
+ // deeper phases once shape is clean.
271
+ if (shape.issues.length === 0 && shape.parsed !== null) {
272
+ const c = shape.parsed;
273
+ issues.push(...phaseRetired(c));
274
+ issues.push(...phaseSchemaMeta(c));
275
+ issues.push(...phaseReferences(c));
276
+ issues.push(...phaseSchemaCompat(c));
277
+ issues.push(...phaseHygiene(c));
214
278
  }
215
- issues.push(...phaseHygiene(contract));
216
279
  const errors = [];
217
280
  const warnings = [];
218
281
  for (const issue of issues) {
@@ -50,11 +50,24 @@ export declare class ContractSchemaMetaError extends Error {
50
50
  constructor(violations: readonly SchemaMetaViolation[]);
51
51
  }
52
52
  /**
53
- * Walks the contract's six inner JSON Schema fields and asserts
54
- * each compiles cleanly under Ajv's strict mode. Throws
55
- * {@link ContractSchemaMetaError} on the first push attempt that
56
- * smuggles a malformed schema; collects every offender in one pass
57
- * before throwing so the agent sees the full list.
53
+ * Walks the contract's six inner JSON Schema fields and collects a
54
+ * {@link SchemaMetaViolation} for each that does not compile cleanly
55
+ * under Ajv's strict mode (unknown keyword, missing `items`, a
56
+ * non-schema `properties` value, or a missing `schema:` wrapper). Pure
57
+ * check — returns the full list so callers can either repair (the
58
+ * handshake repair loop) or throw (see {@link assertContractSchemasValid}).
59
+ *
60
+ * This is the inner-schema validity check folded into the unified
61
+ * `validateContract` gate (lint-contract.ts `phaseSchemaMeta`) — the
62
+ * one check the strict linter was previously missing relative to the
63
+ * push/handshake assert set.
64
+ */
65
+ export declare function checkContractSchemasValid(contract: DataContract): SchemaMetaViolation[];
66
+ /**
67
+ * Throwable wrapper around {@link checkContractSchemasValid}. Throws
68
+ * {@link ContractSchemaMetaError} (collecting every malformed schema in
69
+ * one pass) when any inner JSON Schema fails Ajv strict-mode
70
+ * compilation. No-op when all schemas are well-formed.
58
71
  */
59
72
  export declare function assertContractSchemasValid(contract: DataContract): void;
60
73
  //# sourceMappingURL=schema-meta-validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-meta-validation.d.ts","sourceRoot":"","sources":["../../src/validation/schema-meta-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,WAAW,mBAAmB;IAClC,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAG,yBAAyB,CAAU;IACnD,QAAQ,CAAC,UAAU,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,UAAU,EAAE,SAAS,mBAAmB,EAAE;CAWvD;AAmCD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAuDvE"}
1
+ {"version":3,"file":"schema-meta-validation.d.ts","sourceRoot":"","sources":["../../src/validation/schema-meta-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,WAAW,mBAAmB;IAClC,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAG,yBAAyB,CAAU;IACnD,QAAQ,CAAC,UAAU,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,UAAU,EAAE,SAAS,mBAAmB,EAAE;CAWvD;AAmCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,YAAY,GACrB,mBAAmB,EAAE,CAqDvB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAKvE"}
@@ -81,13 +81,19 @@ function truncate(s, max) {
81
81
  return s.length > max ? `${s.slice(0, max - 1)}…` : s;
82
82
  }
83
83
  /**
84
- * Walks the contract's six inner JSON Schema fields and asserts
85
- * each compiles cleanly under Ajv's strict mode. Throws
86
- * {@link ContractSchemaMetaError} on the first push attempt that
87
- * smuggles a malformed schema; collects every offender in one pass
88
- * before throwing so the agent sees the full list.
84
+ * Walks the contract's six inner JSON Schema fields and collects a
85
+ * {@link SchemaMetaViolation} for each that does not compile cleanly
86
+ * under Ajv's strict mode (unknown keyword, missing `items`, a
87
+ * non-schema `properties` value, or a missing `schema:` wrapper). Pure
88
+ * check — returns the full list so callers can either repair (the
89
+ * handshake repair loop) or throw (see {@link assertContractSchemasValid}).
90
+ *
91
+ * This is the inner-schema validity check folded into the unified
92
+ * `validateContract` gate (lint-contract.ts `phaseSchemaMeta`) — the
93
+ * one check the strict linter was previously missing relative to the
94
+ * push/handshake assert set.
89
95
  */
90
- export function assertContractSchemasValid(contract) {
96
+ export function checkContractSchemasValid(contract) {
91
97
  const violations = [];
92
98
  if (contract.propsSpec?.properties) {
93
99
  for (const [name, entry] of Object.entries(contract.propsSpec.properties)) {
@@ -125,6 +131,16 @@ export function assertContractSchemasValid(contract) {
125
131
  }
126
132
  }
127
133
  }
134
+ return violations;
135
+ }
136
+ /**
137
+ * Throwable wrapper around {@link checkContractSchemasValid}. Throws
138
+ * {@link ContractSchemaMetaError} (collecting every malformed schema in
139
+ * one pass) when any inner JSON Schema fails Ajv strict-mode
140
+ * compilation. No-op when all schemas are well-formed.
141
+ */
142
+ export function assertContractSchemasValid(contract) {
143
+ const violations = checkContractSchemasValid(contract);
128
144
  if (violations.length > 0) {
129
145
  throw new ContractSchemaMetaError(violations);
130
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ggui-ai/protocol",
3
- "version": "0.2.0-alpha.3",
3
+ "version": "0.2.0-alpha.4",
4
4
  "description": "ggui protocol types — events, renders, WebSocket, MCP, LLM models",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [