@adea-ai/contracts 4.0.0 → 5.0.1

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/README.md CHANGED
@@ -56,7 +56,7 @@ reproduce the published contracts 1.23.1 payload used by strict installed-packag
56
56
  qualification. Other packages retain the root optimization, and the unchanged
57
57
  repository distribution ceiling still applies.
58
58
 
59
- `src/declaration-emit.test.mjs` compiles an isolated public contract through both
59
+ `src/declaration-emit.test.ts` compiles an isolated public contract through both
60
60
  configurations and checks the exact declaration bytes: contracts retain public
61
61
  documentation while the root configuration strips it. Complete release payload
62
62
  qualification additionally compares the packed source files against the exact
@@ -26,7 +26,7 @@ import { z } from 'zod';
26
26
  */
27
27
  export declare const DECISION_RESOLUTION_CONTRACT_VERSION: Readonly<{
28
28
  major: 1;
29
- minor: 1;
29
+ minor: 2;
30
30
  }>;
31
31
  export declare const HarnessIdSchema: z.ZodString;
32
32
  export declare const ModelIdSchema: z.ZodString;
@@ -38,6 +38,11 @@ export declare const ResolutionSourceSchema: z.ZodEnum<{
38
38
  "project-default": "project-default";
39
39
  }>;
40
40
  export type ResolutionSource = z.output<typeof ResolutionSourceSchema>;
41
+ /**
42
+ * The versioned precedence order, highest first. It is part of the contract:
43
+ * changing it is a major version, never an edit in place.
44
+ */
45
+ export declare const DECISION_RESOLUTION_PRECEDENCE: readonly ResolutionSource[];
41
46
  /**
42
47
  * Sandbox selection stays inside M10-granted capabilities; it never grants.
43
48
  * `effectiveCapabilities` is always a subset of the resolved capability set
@@ -394,6 +399,30 @@ export declare const DecisionResolutionDiagnosticSchema: z.ZodEnum<{
394
399
  UNSUPPORTED_RUNTIME_PIN: "UNSUPPORTED_RUNTIME_PIN";
395
400
  }>;
396
401
  export type DecisionResolutionDiagnostic = z.output<typeof DecisionResolutionDiagnosticSchema>;
402
+ /**
403
+ * Every code a denial can carry. A denial is thrown, never returned in a
404
+ * resolution, so the codes v1.2 added live here and leave the response's
405
+ * closed `diagnostics` enum unchanged.
406
+ */
407
+ export declare const DecisionResolutionDenialSchema: z.ZodEnum<{
408
+ AUTO_MODE_EXPLICIT_PIN: "AUTO_MODE_EXPLICIT_PIN";
409
+ CAPABILITY_BEYOND_GRANT: "CAPABILITY_BEYOND_GRANT";
410
+ CONTEXT_PACKAGE_PIN_MISMATCH: "CONTEXT_PACKAGE_PIN_MISMATCH";
411
+ DELEGATION_BEYOND_POLICY: "DELEGATION_BEYOND_POLICY";
412
+ HARNESS_MAP_CONFLICTS_WITH_PIN: "HARNESS_MAP_CONFLICTS_WITH_PIN";
413
+ HARNESS_MAP_MODEL_ABSENT: "HARNESS_MAP_MODEL_ABSENT";
414
+ HARNESS_MAP_MODEL_UNMAPPED: "HARNESS_MAP_MODEL_UNMAPPED";
415
+ HARNESS_UNAVAILABLE_ON_PINNED_RUNTIME: "HARNESS_UNAVAILABLE_ON_PINNED_RUNTIME";
416
+ MODEL_ACCESS_NOT_ENTITLED: "MODEL_ACCESS_NOT_ENTITLED";
417
+ NO_COMPATIBLE_RUNTIME: "NO_COMPATIBLE_RUNTIME";
418
+ NO_DEFAULT_MODEL: "NO_DEFAULT_MODEL";
419
+ REQUIRED_CAPABILITY_NOT_RESOLVED: "REQUIRED_CAPABILITY_NOT_RESOLVED";
420
+ SANDBOX_PIN_MISMATCH: "SANDBOX_PIN_MISMATCH";
421
+ SKILL_BEYOND_CAPABILITIES: "SKILL_BEYOND_CAPABILITIES";
422
+ SKILL_UNAVAILABLE: "SKILL_UNAVAILABLE";
423
+ UNSUPPORTED_RUNTIME_PIN: "UNSUPPORTED_RUNTIME_PIN";
424
+ }>;
425
+ export type DecisionResolutionDenial = z.output<typeof DecisionResolutionDenialSchema>;
397
426
  /** One resolved output plus the precedence layer it came from. */
398
427
  export declare const ResolvedOutputSchema: z.ZodObject<{
399
428
  source: z.ZodEnum<{
@@ -28,7 +28,7 @@ import { ContractVersionSchema } from './versioning.js';
28
28
  *
29
29
  * Spec: docs/architecture/decision-558-resolution-contract.md.
30
30
  */
31
- export const DECISION_RESOLUTION_CONTRACT_VERSION = Object.freeze({ major: 1, minor: 1 });
31
+ export const DECISION_RESOLUTION_CONTRACT_VERSION = Object.freeze({ major: 1, minor: 2 });
32
32
  const TimestampSchema = z.iso.datetime();
33
33
  const DigestSchema = z.string().regex(/^sha256:[a-f0-9]{64}$/);
34
34
  const CapabilityNameSchema = z
@@ -62,6 +62,13 @@ export const ResolutionSourceSchema = z.enum([
62
62
  'profile-default',
63
63
  'policy-default',
64
64
  ]);
65
+ /**
66
+ * The versioned precedence order, highest first. It is part of the contract:
67
+ * changing it is a major version, never an edit in place.
68
+ */
69
+ export const DECISION_RESOLUTION_PRECEDENCE = Object.freeze([
70
+ ...ResolutionSourceSchema.options,
71
+ ]);
65
72
  /**
66
73
  * Sandbox selection stays inside M10-granted capabilities; it never grants.
67
74
  * `effectiveCapabilities` is always a subset of the resolved capability set
@@ -226,6 +233,20 @@ export const DecisionResolutionDiagnosticSchema = z.enum([
226
233
  'HARNESS_MAP_MODEL_UNMAPPED',
227
234
  'HARNESS_MAP_CONFLICTS_WITH_PIN',
228
235
  ]);
236
+ /**
237
+ * Every code a denial can carry. A denial is thrown, never returned in a
238
+ * resolution, so the codes v1.2 added live here and leave the response's
239
+ * closed `diagnostics` enum unchanged.
240
+ */
241
+ export const DecisionResolutionDenialSchema = z.enum([
242
+ ...DecisionResolutionDiagnosticSchema.options,
243
+ // v1.2: a resolved capability set that leaves out a capability the request
244
+ // requires. The run would otherwise start without it: a silent narrowing.
245
+ 'REQUIRED_CAPABILITY_NOT_RESOLVED',
246
+ // v1.2: a sandbox pin of mode `none` that names capabilities. `none` runs
247
+ // without the managed sandbox, so it can carry no capability.
248
+ 'SANDBOX_PIN_MISMATCH',
249
+ ]);
229
250
  /** One resolved output plus the precedence layer it came from. */
230
251
  export const ResolvedOutputSchema = z
231
252
  .object({
@@ -3,7 +3,9 @@ import { z } from 'zod';
3
3
  export const OPAQUE_IDENTIFIER_SUFFIX_LENGTH = 26;
4
4
  const opaqueIdentifier = (prefix, kind) => z
5
5
  .string()
6
- .regex(new RegExp(`^${prefix}_[0-9A-HJKMNP-TV-Z]{${OPAQUE_IDENTIFIER_SUFFIX_LENGTH}}$`), `Expected a canonical opaque ${kind}`)
6
+ .regex(
7
+ // nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp -- pattern built from a repo constant or escaped value, anchored; not attacker input
8
+ new RegExp(`^${prefix}_[0-9A-HJKMNP-TV-Z]{${OPAQUE_IDENTIFIER_SUFFIX_LENGTH}}$`), `Expected a canonical opaque ${kind}`)
7
9
  .transform((value) => value);
8
10
  export const IdentifierSchemas = {
9
11
  requestId: opaqueIdentifier('req', 'request ID'),
@@ -10,17 +10,9 @@ export const PublicContractManifest = Object.freeze({
10
10
  // 4.0 removes the managed-cloud, Agent HQ cloud and remote-host runtime vocabulary; every Pi
11
11
  // device is `local_device`. Everything 3.3 added (negotiated, read-only observation of an
12
12
  // already-open Pi child owner, which conveys no attachment or control permission) is part of 4.0.
13
- // Major 3 is still served until its consumers have moved.
13
+ // Only major 4 is served.
14
14
  current: { major: 4, minor: 0 },
15
- supported: [
16
- { major: 1, minor: 0 },
17
- { major: 2, minor: 0 },
18
- { major: 3, minor: 0 },
19
- { major: 3, minor: 1 },
20
- { major: 3, minor: 2 },
21
- { major: 3, minor: 3 },
22
- { major: 4, minor: 0 },
23
- ],
15
+ supported: [{ major: 4, minor: 0 }],
24
16
  });
25
17
  export function assessContractCompatibility(input) {
26
18
  const consumer = ContractVersionSchema.parse(input.consumer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/contracts",
3
- "version": "4.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Runtime-independent service boundary between Adea and the Control Plane: canonical identifiers, envelopes, Control API schemas, pagination, and versioning.",
5
5
  "keywords": [
6
6
  "agents",
@@ -39,12 +39,11 @@
39
39
  }
40
40
  },
41
41
  "publishConfig": {
42
- "access": "public",
43
- "provenance": true
42
+ "access": "public"
44
43
  },
45
44
  "scripts": {
46
45
  "build": "tsc -p tsconfig.json",
47
- "typecheck": "bun check -p tsconfig.json",
46
+ "typecheck": "bun check -p tsconfig.json && bun check -p tsconfig.test.json",
48
47
  "lint": "oxlint src",
49
48
  "test": "bun test --pass-with-no-tests"
50
49
  },