@ggui-ai/protocol 0.14.0 → 0.16.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/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/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/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 +69 -63
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/integrations/mcp-apps.d.ts +35 -9
- package/dist/integrations/mcp-apps.d.ts.map +1 -1
- package/dist/integrations/mcp-apps.js +13 -13
- 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-theme.d.ts +46 -10
- package/dist/schemas/app-theme.d.ts.map +1 -1
- package/dist/schemas/app-theme.js +108 -40
- package/dist/schemas/blueprint.d.ts +4 -3
- package/dist/schemas/blueprint.d.ts.map +1 -1
- package/dist/schemas/blueprint.js +15 -3
- package/dist/schemas/data-contract.d.ts +11 -31
- package/dist/schemas/data-contract.d.ts.map +1 -1
- package/dist/schemas/data-contract.js +5 -28
- package/dist/schemas/handshake-suggestion.d.ts.map +1 -1
- package/dist/schemas/handshake-suggestion.js +8 -1
- 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 +3 -3
- package/dist/schemas/invoke.js +1 -1
- package/dist/schemas/mcp.d.ts +246 -111
- package/dist/schemas/mcp.d.ts.map +1 -1
- package/dist/schemas/mcp.js +149 -42
- package/dist/schemas/ops-blueprint.d.ts +4 -4
- package/dist/schemas/ops-blueprint.d.ts.map +1 -1
- package/dist/schemas/ops-blueprint.js +13 -8
- 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 +2 -2
- package/dist/schemas/render-input-envelope.js +1 -1
- 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/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/contract-inference.d.ts +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/events.d.ts +1 -1
- package/dist/types/ggui-session-event.d.ts +2 -2
- package/dist/types/handshake-suggestion.d.ts +2 -2
- package/dist/types/host-context.d.ts +3 -3
- 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 +3 -3
- 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 +49 -100
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/mcp.js +28 -9
- package/dist/types/refusal-codes.d.ts +54 -95
- package/dist/types/refusal-codes.d.ts.map +1 -1
- package/dist/types/refusal-codes.js +67 -105
- package/dist/types/render.d.ts +12 -11
- 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 +14 -8
- package/dist/validation/contract-validator.d.ts.map +1 -1
- package/dist/validation/contract-validator.js +12 -4
- package/dist/validation/cross-references.d.ts +2 -2
- package/dist/validation/hygiene-rules.d.ts +1 -1
- 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/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/validation/schema-subset.d.ts +3 -3
- package/dist/version.d.ts +485 -12
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +484 -11
- package/dist/wire.d.ts +45 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +44 -0
- package/package.json +7 -1
- package/dist/envelope-adapters.d.ts +0 -25
- package/dist/envelope-adapters.d.ts.map +0 -1
- package/dist/envelope-adapters.js +0 -14
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { PropsSpec, StreamSpec, ActionSpec, ContextSpec, JsonSchema, JsonObject, DataContract } from '../types/data-contract';
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { PropsSpec, StreamSpec, ActionSpec, ContextSpec, JsonSchema, JsonObject, DataContract } from '../types/data-contract.js';
|
|
2
|
+
import { DomainError } from '../errors/domain-error.js';
|
|
3
|
+
import type { ActionEnvelope } from '../types/events.js';
|
|
4
|
+
import type { CompiledContractValidators } from '../integrations/mcp-apps.js';
|
|
5
|
+
import type { ValidateFunction } from './ajv-runtime.js';
|
|
6
|
+
export type { ValidateFunction } from './ajv-runtime.js';
|
|
7
|
+
import { type ReservedChannelValidator } from './reserved-channels.js';
|
|
7
8
|
export interface ContractViolation extends JsonObject {
|
|
8
9
|
field: string;
|
|
9
10
|
message: string;
|
|
@@ -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,WAA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../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',
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* declarative source of truth for every referenced tool). Violations
|
|
16
16
|
* are author-recoverable at render time.
|
|
17
17
|
*/
|
|
18
|
-
import type { DataContract, ActionSpec, StreamSpec, AgentCapabilitiesSpec } from '../types/data-contract';
|
|
19
|
-
import type { ContractViolation } from './contract-validator';
|
|
18
|
+
import type { DataContract, ActionSpec, StreamSpec, AgentCapabilitiesSpec } from '../types/data-contract.js';
|
|
19
|
+
import type { ContractViolation } from './contract-validator.js';
|
|
20
20
|
/**
|
|
21
21
|
* Stable error code emitted when an `actionSpec[*].nextStep` value
|
|
22
22
|
* does not resolve to a declared `agentCapabilities.tools[*]` key on
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* set is wired into `lintContract` via `phaseHygiene`; consumers that
|
|
42
42
|
* want strict gates layer their own assertions on top.
|
|
43
43
|
*/
|
|
44
|
-
import type { DataContract, GadgetDescriptor } from '../types/data-contract';
|
|
44
|
+
import type { DataContract, GadgetDescriptor } from '../types/data-contract.js';
|
|
45
45
|
/**
|
|
46
46
|
* Stable codes for hygiene rules. Each is a `LINT_*` rather than a
|
|
47
47
|
* `CTR_*` — the convention: errors are `CTR_*`, warnings are `LINT_*`.
|
|
@@ -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.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;
|
|
1
|
+
{"version":3,"file":"lint-contract.d.ts","sourceRoot":"","sources":["../../src/validation/lint-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAuBrD;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,MAAM,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GACzB,OAAO,GACP,SAAS,GACT,aAAa,GACb,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,WAAW,CAAC,4BAA4B,CAAC;IACpF,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;CASvE;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
|
}
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
* Companion to {@link CrossReferenceError} in `./cross-references` —
|
|
36
36
|
* the two modules ship the "phase 2: references" rule registry.
|
|
37
37
|
*/
|
|
38
|
-
import type { DataContract } from '../types/data-contract';
|
|
39
|
-
import type { ContractViolation } from './contract-validator';
|
|
38
|
+
import type { DataContract } from '../types/data-contract.js';
|
|
39
|
+
import type { ContractViolation } from './contract-validator.js';
|
|
40
40
|
/**
|
|
41
41
|
* Stable error code for collisions across the three inbound spec maps
|
|
42
42
|
* (`actionSpec` / `streamSpec` / `contextSpec`). The boilerplate
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* file describes a NAMING POLICY that the contract-structure validator
|
|
32
32
|
* enforces. Separate concerns — easier to audit the boundary.
|
|
33
33
|
*/
|
|
34
|
-
import type { ValidationResult } from './contract-validator';
|
|
34
|
+
import type { ValidationResult } from './contract-validator.js';
|
|
35
35
|
/** Prefix that marks a channel as server-owned (reserved from agents). */
|
|
36
36
|
export declare const RESERVED_CHANNEL_PREFIX = "_ggui:";
|
|
37
37
|
/**
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
* they ship companion rule registries to cross-references and
|
|
43
43
|
* name-invariants under the unified `lintContract` API.
|
|
44
44
|
*/
|
|
45
|
-
import type { AgentCapabilitiesSpec, DataContract } from '../types/data-contract';
|
|
46
|
-
import type { ContractViolation } from './contract-validator';
|
|
45
|
+
import type { AgentCapabilitiesSpec, DataContract } from '../types/data-contract.js';
|
|
46
|
+
import type { ContractViolation } from './contract-validator.js';
|
|
47
47
|
/**
|
|
48
48
|
* Stable error code for protocol-level schema-compatibility
|
|
49
49
|
* violations on action ⊆ inputSchema or channel ⊇ outputSchema.
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* assertions for the same author-recoverable failure class; this
|
|
31
31
|
* sits alongside them.
|
|
32
32
|
*/
|
|
33
|
-
import type { DataContract } from '../types/data-contract';
|
|
33
|
+
import type { DataContract } from '../types/data-contract.js';
|
|
34
34
|
export interface SchemaMetaViolation {
|
|
35
35
|
/** Path to the malformed schema field (e.g., `propsSpec.properties.todos.schema`). */
|
|
36
36
|
field: string;
|
|
@@ -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;
|