@agent-blueprint-protocol/verifier 0.8.4 → 1.0.0-rc.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/CHANGELOG.md +103 -0
- package/LICENSE +1 -1
- package/NOTICE +2 -2
- package/README.md +164 -255
- package/dist/corpus/cases/blueprint-decode.json +1 -1
- package/dist/corpus/cases/bounds-new.json +1 -1
- package/dist/corpus/cases/bounds_algebra-intersect.json +1 -1
- package/dist/corpus/cases/canonicalization-encode.json +1 -1
- package/dist/corpus/cases/deployment-decode.json +1 -1
- package/dist/corpus/cases/extension-resolve.json +1 -1
- package/dist/corpus/cases/federation-decode.json +1 -1
- package/dist/corpus/cases/federation-verify_commitment.json +1 -1
- package/dist/corpus/cases/json-decode.json +1 -1
- package/dist/corpus/cases/negotiation-negotiate.json +1 -1
- package/dist/corpus/cases/predicate.json +1 -0
- package/dist/corpus/cases/reconcile.json +1 -0
- package/dist/corpus/cases/schema-validate_instance.json +1 -1
- package/dist/corpus/cases/signature-verify.json +1 -1
- package/dist/corpus/index.json +1 -1
- package/dist/release-history.json +1 -0
- package/dist/release-metadata.json +1 -1
- package/dist/spec/FOUNDATION-TRANSITION.md +67 -0
- package/dist/spec/IPR.md +27 -0
- package/dist/spec/LICENSE +190 -0
- package/dist/spec/NOTICE +4 -0
- package/dist/spec/README.md +47 -0
- package/dist/spec/conformance/base64url-decode.schema.json +176 -0
- package/dist/spec/conformance/blueprint-decode.schema.json +280 -0
- package/dist/spec/conformance/bounds-new.schema.json +302 -0
- package/dist/spec/conformance/bounds_algebra-intersect.schema.json +457 -0
- package/dist/spec/conformance/canonicalization-encode.schema.json +280 -0
- package/dist/spec/conformance/case-file.schema.json +122 -0
- package/dist/spec/conformance/certified-results.json +1 -0
- package/dist/spec/conformance/claim.schema.json +52 -0
- package/dist/spec/conformance/compatibility-verify.schema.json +262 -0
- package/dist/spec/conformance/deployment-decode.schema.json +322 -0
- package/dist/spec/conformance/digest-tagged.schema.json +200 -0
- package/dist/spec/conformance/evidence.schema.json +249 -0
- package/dist/spec/conformance/execution.md +80 -0
- package/dist/spec/conformance/extension-resolve.schema.json +264 -0
- package/dist/spec/conformance/federation-decode.schema.json +318 -0
- package/dist/spec/conformance/federation-verify_commitment.schema.json +342 -0
- package/dist/spec/conformance/index.schema.json +102 -0
- package/dist/spec/conformance/json-decode.schema.json +287 -0
- package/dist/spec/conformance/negotiation-negotiate.schema.json +264 -0
- package/dist/spec/conformance/portability-scan.schema.json +188 -0
- package/dist/spec/conformance/predicate.schema.json +201 -0
- package/dist/spec/conformance/reconcile.schema.json +287 -0
- package/dist/spec/conformance/runner.md +182 -0
- package/dist/spec/conformance/schema-validate_instance.schema.json +206 -0
- package/dist/spec/conformance/signature-verify.schema.json +224 -0
- package/dist/spec/conformance/support.schema.json +72 -0
- package/dist/spec/errata.md +13 -0
- package/dist/spec/grammar/blueprint.cddl +92 -0
- package/dist/spec/grammar/deployment.cddl +125 -0
- package/dist/spec/grammar/derived/blueprint.schema.json +340 -0
- package/dist/spec/grammar/derived/deployment.schema.json +496 -0
- package/dist/spec/grammar/derived/taskenvelope.schema.json +244 -0
- package/dist/spec/grammar/taskenvelope.cddl +77 -0
- package/dist/spec/protocol.md +1238 -0
- package/dist/spec/registry/OPERATIONS.md +69 -0
- package/dist/spec/registry/registry.json +68 -0
- package/dist/verifier/b64url.js +1 -1
- package/dist/verifier/blueprint.d.ts +2 -15
- package/dist/verifier/blueprint.js +21 -107
- package/dist/verifier/bounds_algebra.d.ts +9 -0
- package/dist/verifier/bounds_algebra.js +6 -6
- package/dist/verifier/cli.js +14 -31
- package/dist/verifier/corpus.d.ts +1 -1
- package/dist/verifier/corpus.js +5 -1
- package/dist/verifier/decode.js +15 -3
- package/dist/verifier/deployment.d.ts +8 -0
- package/dist/verifier/deployment.js +17 -2
- package/dist/verifier/digest.js +1 -1
- package/dist/verifier/errors.d.ts +2 -0
- package/dist/verifier/errors.js +1 -0
- package/dist/verifier/execution.d.ts +13 -0
- package/dist/verifier/execution.js +82 -0
- package/dist/verifier/facade.d.ts +325 -0
- package/dist/verifier/facade.js +78 -0
- package/dist/verifier/federation.d.ts +2 -2
- package/dist/verifier/federation.js +10 -7
- package/dist/verifier/harness.d.ts +16 -0
- package/dist/verifier/harness.js +201 -0
- package/dist/verifier/index.d.ts +3 -0
- package/dist/verifier/index.js +2 -0
- package/dist/verifier/mapping.d.ts +139 -0
- package/dist/verifier/mapping.js +1 -0
- package/dist/verifier/negotiation.d.ts +2 -1
- package/dist/verifier/negotiation.js +6 -3
- package/dist/verifier/plain.d.ts +4 -0
- package/dist/verifier/plain.js +38 -0
- package/dist/verifier/predicate.d.ts +7 -0
- package/dist/verifier/predicate.js +60 -1
- package/dist/verifier/reconcile.d.ts +37 -0
- package/dist/verifier/reconcile.js +115 -0
- package/dist/verifier/registry.js +10 -1
- package/dist/verifier/registry_engine.d.ts +3 -0
- package/dist/verifier/registry_engine.js +8 -8
- package/dist/verifier/results.d.ts +3 -0
- package/dist/verifier/results.js +13 -0
- package/dist/verifier/runner.d.ts +2 -0
- package/dist/verifier/runner.js +115 -16
- package/dist/verifier/signature.d.ts +17 -6
- package/dist/verifier/signature.js +41 -25
- package/package.json +17 -12
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Registry operations process
|
|
2
|
+
|
|
3
|
+
How namespaces enter and leave the compiled extension registry. The
|
|
4
|
+
registry is governance-canonical in `registry.json` (this directory);
|
|
5
|
+
the compiled counterparts (Elixir module and TypeScript verifier) are
|
|
6
|
+
hand-mirrored and bound by the registry-equality gate.
|
|
7
|
+
|
|
8
|
+
## Qualification
|
|
9
|
+
|
|
10
|
+
A registration request MUST provide: the namespace (reverse-DNS-plus-
|
|
11
|
+
path, not parseable as a network endpoint), an owner, the declared
|
|
12
|
+
criticality, and, for critical namespaces, a schema document whose JCS
|
|
13
|
+
digest is pinned. A request SHOULD state the A2A declaration URI.
|
|
14
|
+
Example-class identities are the norm until a product is public.
|
|
15
|
+
|
|
16
|
+
## Registration steps
|
|
17
|
+
|
|
18
|
+
1. The owner submits the entry (and, for critical entries, the schema
|
|
19
|
+
document) as a change to `registry.json` and implements it in both
|
|
20
|
+
language packages.
|
|
21
|
+
2. The registry-equality check, corpus checks, and CI checks must pass.
|
|
22
|
+
Corpus verification fails when cases were generated for a different
|
|
23
|
+
registry state.
|
|
24
|
+
3. The change lands with a CHANGELOG entry and an ADR record when it
|
|
25
|
+
sets a precedent (the product-extension registration is the
|
|
26
|
+
recorded example).
|
|
27
|
+
|
|
28
|
+
## Lifecycle
|
|
29
|
+
|
|
30
|
+
`reserved` → `active` → `deprecated` → `retired`. Promotion to a
|
|
31
|
+
critical declaration requires a protocol revision increment (the
|
|
32
|
+
digest-covered evolution rule); demotion does not. A retired namespace
|
|
33
|
+
is never reused. Deprecated entries retain verifiable artifacts with a
|
|
34
|
+
typed notice.
|
|
35
|
+
|
|
36
|
+
## Decision rights
|
|
37
|
+
|
|
38
|
+
The registry steward accepts registrations; the two-consumer
|
|
39
|
+
rule governs promotion into shared surfaces: a member or helper earns
|
|
40
|
+
a shared seat only when two independently verified consumers use it.
|
|
41
|
+
The registry carries published facts, never authority.
|
|
42
|
+
|
|
43
|
+
## MCP metadata registrations
|
|
44
|
+
|
|
45
|
+
A namespace carried as an MCP `_meta` key follows the grammar in
|
|
46
|
+
[MCP revision 2026-07-28](https://modelcontextprotocol.io/specification/2026-07-28/basic#_meta).
|
|
47
|
+
This registry requires at least two prefix labels. Each begins with a
|
|
48
|
+
lowercase letter, ends with a lowercase letter or digit, and permits
|
|
49
|
+
lowercase letters, digits, and hyphens inside. The nonempty name begins and
|
|
50
|
+
ends with a lowercase letter or digit; its interior also permits lowercase
|
|
51
|
+
letters, digits, hyphens, underscores, and dots. These lowercase and
|
|
52
|
+
two-label restrictions are stricter than the MCP grammar. A prefix whose second label is `mcp` or `modelcontextprotocol` is
|
|
53
|
+
reserved. The registry equality gate checks registrations; artifact
|
|
54
|
+
decoding retains its revision 1 namespace grammar.
|
|
55
|
+
|
|
56
|
+
## Federation namespace
|
|
57
|
+
|
|
58
|
+
`io.github.baselabs/federation` is active and critical, with A2A URI
|
|
59
|
+
`https://baselabs.github.io/agent_blueprint_protocol/extensions/federation`.
|
|
60
|
+
It retains the schema pin of `com.example/federation`. Producers SHOULD
|
|
61
|
+
use the active namespace; both are supported. The deprecated spelling
|
|
62
|
+
emits `extension_deprecated` and is never retired in the 1.x line.
|
|
63
|
+
|
|
64
|
+
## Review and disputes
|
|
65
|
+
|
|
66
|
+
The maintainer evaluates namespace control, public owner identity, grammar,
|
|
67
|
+
criticality, schema digest reproducibility, compatibility, and test coverage.
|
|
68
|
+
Requests are reviewed on a best-effort basis, in the order received. An applicant can request reconsideration in the same public discussion. Unresolved disputes go to the registry steward with the evidence and requested change.
|
|
69
|
+
A dispute does not change a released registry entry.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "agent-blueprint-protocol-registry",
|
|
3
|
+
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"a2a_uri": "https://example.com/extensions/commerce-graph",
|
|
6
|
+
"criticality": "critical",
|
|
7
|
+
"namespace": "com.example.commerce/graph",
|
|
8
|
+
"owner": "ExampleCommerce",
|
|
9
|
+
"promoted_at_revision": null,
|
|
10
|
+
"schema_digest": null,
|
|
11
|
+
"state": "active"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"a2a_uri": "https://example.com/extensions/commerce-classification-labels",
|
|
15
|
+
"criticality": "optional",
|
|
16
|
+
"namespace": "com.example.commerce/classification-labels",
|
|
17
|
+
"owner": "ExampleCommerce",
|
|
18
|
+
"promoted_at_revision": null,
|
|
19
|
+
"schema_digest": null,
|
|
20
|
+
"state": "active"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"a2a_uri": "https://example.com/extensions/commerce-rubric-assertion",
|
|
24
|
+
"criticality": "optional",
|
|
25
|
+
"namespace": "com.example.commerce/rubric-assertion",
|
|
26
|
+
"owner": "ExampleCommerce",
|
|
27
|
+
"promoted_at_revision": null,
|
|
28
|
+
"schema_digest": null,
|
|
29
|
+
"state": "active"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"a2a_uri": "https://example.com/extensions/platform-estate",
|
|
33
|
+
"criticality": "optional",
|
|
34
|
+
"namespace": "com.example.platform/estate",
|
|
35
|
+
"owner": "ExamplePlatform",
|
|
36
|
+
"promoted_at_revision": null,
|
|
37
|
+
"schema_digest": null,
|
|
38
|
+
"state": "deprecated"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"a2a_uri": "https://example.com/extensions/platform-estate-contract",
|
|
42
|
+
"criticality": "critical",
|
|
43
|
+
"namespace": "com.example.platform/estate-contract",
|
|
44
|
+
"owner": "ExamplePlatform",
|
|
45
|
+
"promoted_at_revision": null,
|
|
46
|
+
"schema_digest": "sha-256:s_ToZWwxrhhd4vVxAyUh2Q6Gddston4tBSLHTLvCQAw",
|
|
47
|
+
"state": "active"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"a2a_uri": "https://example.com/extensions/federation",
|
|
51
|
+
"criticality": "critical",
|
|
52
|
+
"namespace": "com.example/federation",
|
|
53
|
+
"owner": "Agent Blueprint Protocol",
|
|
54
|
+
"promoted_at_revision": null,
|
|
55
|
+
"schema_digest": "sha-256:NgfEJT8JXJqRMpQS5TVBQDrk97-PzUtbgnRgWc8Dki0",
|
|
56
|
+
"state": "deprecated"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"a2a_uri": "https://baselabs.github.io/agent_blueprint_protocol/extensions/federation",
|
|
60
|
+
"criticality": "critical",
|
|
61
|
+
"namespace": "io.github.baselabs/federation",
|
|
62
|
+
"owner": "Agent Blueprint Protocol",
|
|
63
|
+
"promoted_at_revision": null,
|
|
64
|
+
"schema_digest": "sha-256:NgfEJT8JXJqRMpQS5TVBQDrk97-PzUtbgnRgWc8Dki0",
|
|
65
|
+
"state": "active"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
package/dist/verifier/b64url.js
CHANGED
|
@@ -30,7 +30,7 @@ export function decodeStrict(input) {
|
|
|
30
30
|
return { ok: false, e: "base64url_invalid" };
|
|
31
31
|
return { ok: true, v: decoded };
|
|
32
32
|
}
|
|
33
|
-
const LENIENT = /^[A-Za-z0-9_-]+={0,2}
|
|
33
|
+
const LENIENT = /^(?:[A-Za-z0-9_-]+={0,2})?$/;
|
|
34
34
|
export function decodeLenient(input) {
|
|
35
35
|
if (typeof input !== "string")
|
|
36
36
|
return { ok: false, e: "invalid_type" };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Bounds } from "./bounds.ts";
|
|
2
|
-
import * as digest from "./digest.ts";
|
|
3
2
|
import { type Spec } from "./registry_engine.ts";
|
|
4
3
|
import type { Value } from "./value.ts";
|
|
5
4
|
export interface Blueprint {
|
|
@@ -48,18 +47,6 @@ export declare function contentDigest(blueprint: Blueprint): string | {
|
|
|
48
47
|
e: string;
|
|
49
48
|
};
|
|
50
49
|
export declare function verifyContentDigest(blueprint: Blueprint): VResult;
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
createdAt: string;
|
|
54
|
-
keyId: string;
|
|
55
|
-
purpose: "blueprint" | "deployment" | "federation-envelope";
|
|
56
|
-
}
|
|
57
|
-
export declare function signatureAttributes(entry: Value): {
|
|
58
|
-
ok: true;
|
|
59
|
-
v: SignatureAttributes;
|
|
60
|
-
} | {
|
|
61
|
-
ok: false;
|
|
62
|
-
e: string;
|
|
63
|
-
};
|
|
50
|
+
export declare function scan(value: Value, authoredNs: Set<string>): VResult;
|
|
51
|
+
export { attributes as signatureAttributes } from "./signature.ts";
|
|
64
52
|
export declare function validZFormDate(stamped: string): boolean;
|
|
65
|
-
export {};
|
|
@@ -2,10 +2,9 @@ import { isValue } from "./value.js";
|
|
|
2
2
|
// The Blueprint artifact — the mirror of AgentBlueprintProtocol.Blueprint:
|
|
3
3
|
// canonical verify → the 18-member registry table → the portability scan →
|
|
4
4
|
// the content-digest comparison, over the digest-covered members minus the
|
|
5
|
-
// evidence trio.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import * as b64 from "./b64url.js";
|
|
5
|
+
// evidence trio. The artifact tables share the signature parser for
|
|
6
|
+
// attributes and purpose checks.
|
|
7
|
+
import { attributes as signatureAttributes } from "./signature.js";
|
|
9
8
|
import { coerce as coerceBounds, maximum as maxBounds } from "./bounds.js";
|
|
10
9
|
import * as canonical from "./canonical.js";
|
|
11
10
|
import * as digest from "./digest.js";
|
|
@@ -71,7 +70,7 @@ const SEGMENT = /^[a-z0-9][a-z0-9._-]*$/;
|
|
|
71
70
|
const Z_FORM = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/;
|
|
72
71
|
const CURRENCY = /^[A-Z]{3}$/;
|
|
73
72
|
const enumSet = (values) => new Set(values);
|
|
74
|
-
// ---- the 18-member table (
|
|
73
|
+
// ---- the 18-member table (protocol §2): data for the generic engine ---------------
|
|
75
74
|
function portElement() {
|
|
76
75
|
return {
|
|
77
76
|
kind: {
|
|
@@ -184,6 +183,7 @@ export function table() {
|
|
|
184
183
|
field("signatures", { array: { kind: "custom", check: checkSignatureEntry } }, {
|
|
185
184
|
required: false,
|
|
186
185
|
maxItems: CEILING_SIGNATURES,
|
|
186
|
+
check: checkSignatureIds,
|
|
187
187
|
}),
|
|
188
188
|
field("attestations", { array: { kind: "any" } }, {
|
|
189
189
|
required: false,
|
|
@@ -329,10 +329,20 @@ function checkSchemaDocument(value) {
|
|
|
329
329
|
// The purpose is the artifact's fact: the envelope parses AND must be
|
|
330
330
|
// "blueprint" here — a deployment-purpose signature riding a Blueprint is a
|
|
331
331
|
// wrong-position entry, denied as a table constraint.
|
|
332
|
+
function checkSignatureIds(value) {
|
|
333
|
+
if (value.t !== "arr")
|
|
334
|
+
return { ok: false, e: "invalid_type" };
|
|
335
|
+
const ids = value.v.flatMap((entry) => {
|
|
336
|
+
const attrs = entry?.t === "obj" ? keyfind(entry.v, "signed_attributes") : null;
|
|
337
|
+
const id = attrs?.t === "obj" ? keyfind(attrs.v, "key_id") : null;
|
|
338
|
+
return id?.t === "str" ? [id.v] : [];
|
|
339
|
+
});
|
|
340
|
+
return new Set(ids).size === ids.length ? { ok: true } : { ok: false, e: "invalid_constraint" };
|
|
341
|
+
}
|
|
332
342
|
function checkSignatureEntry(entry) {
|
|
333
343
|
const attrs = signatureAttributes(entry);
|
|
334
344
|
if (!attrs.ok)
|
|
335
|
-
return
|
|
345
|
+
return attrs;
|
|
336
346
|
return attrs.v.purpose === "blueprint" ? { ok: true } : { ok: false, e: "invalid_constraint" };
|
|
337
347
|
}
|
|
338
348
|
// The attestation kind registry is empty BY DESIGN; a non-empty array denies.
|
|
@@ -537,7 +547,9 @@ function memberArray(members, name) {
|
|
|
537
547
|
return found !== undefined && found.t === "arr" ? found.v : [];
|
|
538
548
|
}
|
|
539
549
|
// ---- the portability scan -----------------------------------------------------------
|
|
540
|
-
function scan(value, authoredNs) {
|
|
550
|
+
export function scan(value, authoredNs) {
|
|
551
|
+
if (!isValue(value) || value.t !== "obj" || !(authoredNs instanceof Set) || [...authoredNs].some(ns => typeof ns !== "string"))
|
|
552
|
+
return { ok: false, e: "invalid_type" };
|
|
541
553
|
if (value.t !== "obj")
|
|
542
554
|
return { ok: false, e: "invalid_type" };
|
|
543
555
|
const members = value.v;
|
|
@@ -690,106 +702,8 @@ function memberListOf(members, name) {
|
|
|
690
702
|
const found = keyfind(members, name);
|
|
691
703
|
return found !== null && found.t === "arr" ? found.v : [];
|
|
692
704
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
const HEADER_MEMBERS = ["alg", "b64", "crit", "kid"];
|
|
696
|
-
const ATTR_MEMBERS = ["algorithm", "content_digest", "created_at", "key_id", "purpose"];
|
|
697
|
-
function malformed() {
|
|
698
|
-
return { ok: false, e: "signature_malformed" };
|
|
699
|
-
}
|
|
700
|
-
export function signatureAttributes(entry) {
|
|
701
|
-
if (!isValue(entry))
|
|
702
|
-
return { ok: false, e: "invalid_type" };
|
|
703
|
-
if (entry.t !== "obj")
|
|
704
|
-
return malformed();
|
|
705
|
-
const entryPairs = entry.v;
|
|
706
|
-
const entryNames = entryPairs.map(([name]) => name).sort();
|
|
707
|
-
if (entryNames.length !== 3 ||
|
|
708
|
-
entryNames.join("\u0000") !== ENTRY_MEMBERS.join("\u0000")) {
|
|
709
|
-
return malformed();
|
|
710
|
-
}
|
|
711
|
-
const header = keyfind(entryPairs, "protected");
|
|
712
|
-
const attrs = keyfind(entryPairs, "signed_attributes");
|
|
713
|
-
const signatureBody = keyfind(entryPairs, "signature");
|
|
714
|
-
// Header: exactly {alg, b64, crit, kid}; the one algorithm-unsupported
|
|
715
|
-
// denial fires only when alg is a string naming another algorithm.
|
|
716
|
-
if (header.t !== "obj")
|
|
717
|
-
return malformed();
|
|
718
|
-
const headerNames = header.v.map(([name]) => name).sort();
|
|
719
|
-
if (headerNames.length !== 4 || headerNames.join("\u0000") !== HEADER_MEMBERS.join("\u0000")) {
|
|
720
|
-
return malformed();
|
|
721
|
-
}
|
|
722
|
-
const alg = keyfind(header.v, "alg");
|
|
723
|
-
if (alg.t === "str" && alg.v !== "EdDSA") {
|
|
724
|
-
return { ok: false, e: "signature_algorithm_unsupported" };
|
|
725
|
-
}
|
|
726
|
-
if (alg.t !== "str")
|
|
727
|
-
return malformed();
|
|
728
|
-
const b64Flag = keyfind(header.v, "b64");
|
|
729
|
-
if (b64Flag.t !== "bool" || b64Flag.v !== false)
|
|
730
|
-
return malformed();
|
|
731
|
-
const crit = keyfind(header.v, "crit");
|
|
732
|
-
if (crit.t !== "arr" ||
|
|
733
|
-
crit.v.length !== 1 ||
|
|
734
|
-
crit.v[0].t !== "str" ||
|
|
735
|
-
crit.v[0].v !== "b64") {
|
|
736
|
-
return malformed();
|
|
737
|
-
}
|
|
738
|
-
const kid = keyfind(header.v, "kid");
|
|
739
|
-
if (kid.t !== "str" || kid.v === "")
|
|
740
|
-
return malformed();
|
|
741
|
-
// Attributes: exactly the five closed members.
|
|
742
|
-
if (attrs.t !== "obj")
|
|
743
|
-
return malformed();
|
|
744
|
-
const attrNames = attrs.v.map(([name]) => name).sort();
|
|
745
|
-
if (attrNames.length !== 5 || attrNames.join("\u0000") !== ATTR_MEMBERS.join("\u0000")) {
|
|
746
|
-
return malformed();
|
|
747
|
-
}
|
|
748
|
-
const algorithm = keyfind(attrs.v, "algorithm");
|
|
749
|
-
if (algorithm.t === "str" && algorithm.v !== "Ed25519") {
|
|
750
|
-
return { ok: false, e: "signature_algorithm_unsupported" };
|
|
751
|
-
}
|
|
752
|
-
if (algorithm.t !== "str")
|
|
753
|
-
return malformed();
|
|
754
|
-
const contentDigest = keyfind(attrs.v, "content_digest");
|
|
755
|
-
if (contentDigest.t !== "str" || !digest.fromTagged(contentDigest.v).ok)
|
|
756
|
-
return malformed();
|
|
757
|
-
const createdAt = keyfind(attrs.v, "created_at");
|
|
758
|
-
if (createdAt.t !== "str" || !Z_FORM.test(createdAt.v) || !validZFormDate(createdAt.v)) {
|
|
759
|
-
return malformed();
|
|
760
|
-
}
|
|
761
|
-
const keyId = keyfind(attrs.v, "key_id");
|
|
762
|
-
if (keyId.t !== "str" || keyId.v === "" || keyId.v.includes("."))
|
|
763
|
-
return malformed();
|
|
764
|
-
const purpose = keyfind(attrs.v, "purpose");
|
|
765
|
-
if (purpose.t !== "str" || !PURPOSES.has(purpose.v))
|
|
766
|
-
return malformed();
|
|
767
|
-
if (kid.v !== keyId.v)
|
|
768
|
-
return malformed();
|
|
769
|
-
if (signatureBody.t !== "str")
|
|
770
|
-
return malformed();
|
|
771
|
-
const decodedSignature = b64.decodeStrict(signatureBody.v);
|
|
772
|
-
if (!decodedSignature.ok || decodedSignature.v.length !== 64)
|
|
773
|
-
return malformed();
|
|
774
|
-
// canonical_input: both halves must re-encode (invalid UTF-8 in a
|
|
775
|
-
// hand-built entry denies malformed).
|
|
776
|
-
const headerJson = canonical.encode(header);
|
|
777
|
-
const attrsJson = canonical.encode(attrs);
|
|
778
|
-
if (!headerJson.ok || !attrsJson.ok)
|
|
779
|
-
return malformed();
|
|
780
|
-
const parsedDigest = digest.fromTagged(contentDigest.v);
|
|
781
|
-
if (!parsedDigest.ok)
|
|
782
|
-
return malformed();
|
|
783
|
-
return {
|
|
784
|
-
ok: true,
|
|
785
|
-
v: {
|
|
786
|
-
contentDigest: parsedDigest.v,
|
|
787
|
-
createdAt: createdAt.v,
|
|
788
|
-
keyId: keyId.v,
|
|
789
|
-
purpose: purpose.v,
|
|
790
|
-
},
|
|
791
|
-
};
|
|
792
|
-
}
|
|
705
|
+
// Artifact tables and receipt checks use the signature module's parser.
|
|
706
|
+
export { attributes as signatureAttributes } from "./signature.js";
|
|
793
707
|
// DateTime.from_iso8601's field validation for the Z whole-second form.
|
|
794
708
|
export function validZFormDate(stamped) {
|
|
795
709
|
if (typeof stamped !== "string")
|
|
@@ -23,5 +23,14 @@ export declare function intersect(blueprint: Record<string, unknown>, deployment
|
|
|
23
23
|
} | {
|
|
24
24
|
ok: false;
|
|
25
25
|
e: string;
|
|
26
|
+
subject?: (string | number)[];
|
|
27
|
+
};
|
|
28
|
+
export declare function buildSet(raw: Record<string, unknown>): {
|
|
29
|
+
ok: true;
|
|
30
|
+
v: Record<string, BoundValue>;
|
|
31
|
+
} | {
|
|
32
|
+
ok: false;
|
|
33
|
+
e: string;
|
|
34
|
+
subject?: (string | number)[];
|
|
26
35
|
};
|
|
27
36
|
export {};
|
|
@@ -77,7 +77,7 @@ export function intersect(blueprint, deployment, host, posture) {
|
|
|
77
77
|
return cost.currency;
|
|
78
78
|
});
|
|
79
79
|
if (new Set(currencies).size !== 1) {
|
|
80
|
-
return { ok: false, e: "bound_unit_mismatch" };
|
|
80
|
+
return { ok: false, e: "bound_unit_mismatch", subject: ["max_cost"] };
|
|
81
81
|
}
|
|
82
82
|
return compose(sources, posture);
|
|
83
83
|
}
|
|
@@ -86,7 +86,7 @@ export function intersect(blueprint, deployment, host, posture) {
|
|
|
86
86
|
// The TS runner passes corpus bound-set objects through verbatim (the Elixir
|
|
87
87
|
// runner pre-filters unknown member names to :invalid_type at add_bound_entry;
|
|
88
88
|
// here that delegated filter runs first, then BoundSet.new's value checks).
|
|
89
|
-
function buildSet(raw) {
|
|
89
|
+
export function buildSet(raw) {
|
|
90
90
|
if (!isPlainObject(raw))
|
|
91
91
|
return { ok: false, e: "invalid_type" };
|
|
92
92
|
const out = {};
|
|
@@ -95,7 +95,7 @@ function buildSet(raw) {
|
|
|
95
95
|
return { ok: false, e: "invalid_type" };
|
|
96
96
|
const built = buildBound(name, value);
|
|
97
97
|
if (!built.ok)
|
|
98
|
-
return built;
|
|
98
|
+
return { ...built, subject: [name] };
|
|
99
99
|
out[name] = built.v;
|
|
100
100
|
}
|
|
101
101
|
return { ok: true, v: out };
|
|
@@ -159,7 +159,7 @@ function totalOf(sources) {
|
|
|
159
159
|
const expected = new Set(NAMES);
|
|
160
160
|
const extra = [...present].filter((name) => !expected.has(name));
|
|
161
161
|
if (extra.length > 0)
|
|
162
|
-
return { ok: false, e: "bound_unknown" };
|
|
162
|
+
return { ok: false, e: "bound_unknown", subject: ["bound_set"] };
|
|
163
163
|
if (present.size === expected.size && NAMES.every((n) => present.has(n))) {
|
|
164
164
|
// re-validate present values (bypassed-set parity)
|
|
165
165
|
for (const name of NAMES) {
|
|
@@ -177,7 +177,7 @@ function totalOf(sources) {
|
|
|
177
177
|
return rebuilt;
|
|
178
178
|
}
|
|
179
179
|
else {
|
|
180
|
-
return { ok: false, e: TABLE[name].cls === "operational" ? "missing_ceiling" : "bound_source_missing" };
|
|
180
|
+
return { ok: false, e: TABLE[name].cls === "operational" ? "missing_ceiling" : "bound_source_missing", subject: [name] };
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -202,7 +202,7 @@ function compose(sources, posture) {
|
|
|
202
202
|
continue;
|
|
203
203
|
}
|
|
204
204
|
if (def.cls === "protected" && posture === "deny") {
|
|
205
|
-
return { ok: false, e: "protected_bound_clamp_denied" };
|
|
205
|
+
return { ok: false, e: "protected_bound_clamp_denied", subject: [name] };
|
|
206
206
|
}
|
|
207
207
|
clamps.push({
|
|
208
208
|
field: name,
|
package/dist/verifier/cli.js
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
// IO.binwrite parity). Exit 3 marks an internal invariant (outside the
|
|
7
7
|
// 0/1/2 contract, exactly as an escript crash is — loud, never laundered
|
|
8
8
|
// into "disagreement").
|
|
9
|
+
import { resultsDocument, canonical } from "./results.js";
|
|
10
|
+
import { serve } from "./execution.js";
|
|
11
|
+
import { runHarness } from "./harness.js";
|
|
9
12
|
import { readdirSync, readFileSync, lstatSync, openSync, closeSync, readSync, fstatSync } from "node:fs";
|
|
10
13
|
import { join, relative, sep } from "node:path";
|
|
11
|
-
import { member } from "./corpus.js";
|
|
12
14
|
import { load, loadPriorCensus } from "./corpus.js";
|
|
13
15
|
import { encode } from "./canonical.js";
|
|
14
16
|
import { toBytes } from "./report.js";
|
|
@@ -17,7 +19,7 @@ import { decode as decodeBlueprint } from "./blueprint.js";
|
|
|
17
19
|
import { decode as decodeDeployment } from "./deployment.js";
|
|
18
20
|
import { decode as decodeEnvelope } from "./federation.js";
|
|
19
21
|
import { obj, str } from "./value.js";
|
|
20
|
-
const USAGE = `usage: agent-blueprint-protocol [--corpus <dir> | --prior-corpus <dir> | --artifact <file> | --help | --version]
|
|
22
|
+
const USAGE = `usage: agent-blueprint-protocol [--corpus <dir> | --prior-corpus <dir> | --artifact <file> | --results --corpus <dir> | --serve --corpus <dir> | conformance run <options> -- <command...> | --help | --version]
|
|
21
23
|
No arguments: verify the installed release's embedded corpus.
|
|
22
24
|
--corpus <dir>: verify a corpus and report agreement.
|
|
23
25
|
--prior-corpus <dir>: replay a released corpus under current verification.
|
|
@@ -38,7 +40,12 @@ function releaseMetadata() {
|
|
|
38
40
|
}
|
|
39
41
|
throw new Error("release metadata missing");
|
|
40
42
|
}
|
|
41
|
-
function main(argv) {
|
|
43
|
+
async function main(argv) {
|
|
44
|
+
if (argv[0] === "conformance" && argv[1] === "run")
|
|
45
|
+
return runHarness(argv.slice(2), readCorpus, releaseMetadata());
|
|
46
|
+
const mode = argv[0] === "--results" ? "results" : argv[0] === "--serve" ? "serve" : "report";
|
|
47
|
+
if (mode !== "report")
|
|
48
|
+
argv = argv.slice(1);
|
|
42
49
|
if (argv.length === 1 && argv[0] === "--help") {
|
|
43
50
|
process.stdout.write(USAGE + "\n");
|
|
44
51
|
return 0;
|
|
@@ -76,41 +83,17 @@ function main(argv) {
|
|
|
76
83
|
process.stderr.write("corpus integrity failure: :" + corpus.e + "\n");
|
|
77
84
|
return 2;
|
|
78
85
|
}
|
|
79
|
-
if (!corpus.v.cases.every((file) => file.cases.every(readerInput))) {
|
|
80
|
-
process.stderr.write("corpus integrity failure: :invalid_type\n");
|
|
81
|
-
return 2;
|
|
82
|
-
}
|
|
83
86
|
const certified = corpus.v.identity === releaseMetadata().corpus_digest ? "matches" : "does not match";
|
|
84
87
|
process.stderr.write(`corpus digest ${certified} the release-certified corpus\n`);
|
|
88
|
+
if (mode === "serve")
|
|
89
|
+
return serve(corpus.v);
|
|
85
90
|
const results = run(corpus.v);
|
|
86
91
|
const bytes = toBytes(corpus.v.identity, results);
|
|
87
92
|
// exitCode (not process.exit) so piped stdout drains before exit.
|
|
88
|
-
process.stdout.write(bytes);
|
|
93
|
+
process.stdout.write(mode === "results" ? canonical(resultsDocument(corpus.v)) : bytes);
|
|
89
94
|
const agreed = results.flat().filter((r) => r.agree).length;
|
|
90
95
|
return agreed === results.flat().length && agreed > 0 ? 0 : 1;
|
|
91
96
|
}
|
|
92
|
-
function fieldShape(input, key, predicate) {
|
|
93
|
-
const value = member(input, key);
|
|
94
|
-
return value === null || predicate(value);
|
|
95
|
-
}
|
|
96
|
-
function readerInput(row) {
|
|
97
|
-
const input = row.input;
|
|
98
|
-
if (row.surface === "negotiation.negotiate" || row.surface === "extension.resolve") {
|
|
99
|
-
const support = member(input, "support");
|
|
100
|
-
if (support === null || support.t === "null")
|
|
101
|
-
return true;
|
|
102
|
-
if (support.t !== "obj")
|
|
103
|
-
return false;
|
|
104
|
-
return ["revisions", "core_fields"].every((key) => fieldShape(support, key, (v) => v.t === "arr")) &&
|
|
105
|
-
fieldShape(support, "schemas", (v) => v.t === "obj") &&
|
|
106
|
-
fieldShape(support, "registry", (v) => v.t === "obj" && v.v.every(([, entry]) => entry.t === "obj"));
|
|
107
|
-
}
|
|
108
|
-
if (row.surface === "bounds_algebra.intersect") {
|
|
109
|
-
return ["blueprint", "deployment", "host"].every((key) => fieldShape(input, key, (v) => v.t === "obj" && v.v.every(([, bound]) => bound.t !== "obj" || member(bound, "ordinal") === null ||
|
|
110
|
-
fieldShape(bound, "markers", (markers) => markers.t === "arr"))));
|
|
111
|
-
}
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
97
|
// Single-artifact mode — a kit-side convenience the escript deliberately
|
|
115
98
|
// does NOT mirror (its CLI contract stays --corpus-only, so a vacuous run
|
|
116
99
|
// stays impossible there). One artifact file, verified against all three
|
|
@@ -216,7 +199,7 @@ function readCorpus(dir) {
|
|
|
216
199
|
return map;
|
|
217
200
|
}
|
|
218
201
|
try {
|
|
219
|
-
process.exitCode = main(process.argv.slice(2));
|
|
202
|
+
process.exitCode = await main(process.argv.slice(2));
|
|
220
203
|
}
|
|
221
204
|
catch (error) {
|
|
222
205
|
process.stderr.write("verifier internal error: " + error.message + "\n");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Value } from "./value.ts";
|
|
2
|
-
export declare const SURFACES: readonly ["json.decode", "canonicalization.encode", "base64url.decode", "digest.tagged", "signature.verify", "schema.validate_instance", "blueprint.decode", "deployment.decode", "negotiation.negotiate", "extension.resolve", "bounds.new", "bounds_algebra.intersect", "portability.scan", "compatibility.verify", "federation.decode", "federation.verify_commitment"];
|
|
2
|
+
export declare const SURFACES: readonly ["reconcile", "predicate", "json.decode", "canonicalization.encode", "base64url.decode", "digest.tagged", "signature.verify", "schema.validate_instance", "blueprint.decode", "deployment.decode", "negotiation.negotiate", "extension.resolve", "bounds.new", "bounds_algebra.intersect", "portability.scan", "compatibility.verify", "federation.decode", "federation.verify_commitment"];
|
|
3
3
|
export declare const CLASSES: readonly ["valid", "boundary_near", "exact_bound", "maximum_plus_one", "invalid_encoding", "invalid_duplicate", "invalid_type", "invalid_constraint", "invalid_cardinality", "unknown_member", "tamper_meaningful_byte", "digest_mismatch", "signature_invalid", "revision_above_max", "revision_below_min", "required_field_unsupported", "required_field_not_covered", "extension_unknown_critical", "extension_unknown_optional_roundtrip", "extension_criticality_conflict", "extension_schema_unavailable", "extension_deprecated_retained", "bound_widening_operational", "bound_widening_protected", "forbidden_portable_value", "compatibility_range_rejected", "binding_stale", "federation_state_unmappable", "federation_terminal_conflict", "audience_mismatch", "terminal_equivocation"];
|
|
4
4
|
export interface LoadedCorpus {
|
|
5
5
|
index: Value;
|
package/dist/verifier/corpus.js
CHANGED
|
@@ -25,6 +25,8 @@ import { registryDigest } from "./registry.js";
|
|
|
25
25
|
const INDEX_FORMAT = "agent-blueprint-protocol-conformance-corpus-index";
|
|
26
26
|
const CASE_FILE_FORMAT = "agent-blueprint-protocol-conformance-cases";
|
|
27
27
|
export const SURFACES = [
|
|
28
|
+
"reconcile",
|
|
29
|
+
"predicate",
|
|
28
30
|
"json.decode",
|
|
29
31
|
"canonicalization.encode",
|
|
30
32
|
"base64url.decode",
|
|
@@ -75,9 +77,11 @@ export const CLASSES = [
|
|
|
75
77
|
"audience_mismatch",
|
|
76
78
|
"terminal_equivocation",
|
|
77
79
|
];
|
|
78
|
-
// The pinned
|
|
80
|
+
// The pinned 18×31 floor: per surface, required classes + the falsifiable
|
|
79
81
|
// n_a reason covering its complement.
|
|
80
82
|
const FLOOR = {
|
|
83
|
+
reconcile: { required: ["valid", "invalid_type", "digest_mismatch", "revision_above_max", "unknown_member", "forbidden_portable_value", "signature_invalid", "binding_stale", "bound_widening_protected"], n_a: "byte codecs, schema and federation checks have their own surfaces" },
|
|
84
|
+
predicate: { required: ["valid", "invalid_type", "invalid_constraint", "invalid_cardinality", "maximum_plus_one", "exact_bound"], n_a: "artifact, signature, bounds and federation checks do not reach predicates" },
|
|
81
85
|
"json.decode": {
|
|
82
86
|
required: [
|
|
83
87
|
"valid",
|
package/dist/verifier/decode.js
CHANGED
|
@@ -79,7 +79,7 @@ class Scanner {
|
|
|
79
79
|
const value = this.parseValue();
|
|
80
80
|
this.skipWs();
|
|
81
81
|
if (!this.eof())
|
|
82
|
-
throw new
|
|
82
|
+
throw new CodeFail("trailing_bytes");
|
|
83
83
|
this.bumpNodes();
|
|
84
84
|
return this.sink(value);
|
|
85
85
|
}
|
|
@@ -113,8 +113,11 @@ class Scanner {
|
|
|
113
113
|
}
|
|
114
114
|
// Containers guard depth at ENTRY (live depth, root container = 1).
|
|
115
115
|
parseArray() {
|
|
116
|
-
this.enter();
|
|
117
116
|
this.pos++; // '['
|
|
117
|
+
this.skipWs();
|
|
118
|
+
if (this.eof())
|
|
119
|
+
throw new SyntaxFail();
|
|
120
|
+
this.enter();
|
|
118
121
|
const items = [];
|
|
119
122
|
this.skipWs();
|
|
120
123
|
if (!this.eof() && this.peek() === 0x5d) {
|
|
@@ -125,6 +128,9 @@ class Scanner {
|
|
|
125
128
|
for (;;) {
|
|
126
129
|
this.skipWs();
|
|
127
130
|
const element = this.parseValue();
|
|
131
|
+
this.skipWs();
|
|
132
|
+
if (this.eof() || (this.peek() !== 0x2c && this.peek() !== 0x5d))
|
|
133
|
+
throw new SyntaxFail();
|
|
128
134
|
this.guard(items.length + 1, this.bounds.items, "items");
|
|
129
135
|
this.bumpNodes();
|
|
130
136
|
items.push(this.sink(element));
|
|
@@ -144,8 +150,11 @@ class Scanner {
|
|
|
144
150
|
}
|
|
145
151
|
}
|
|
146
152
|
parseObject() {
|
|
147
|
-
this.enter();
|
|
148
153
|
this.pos++; // '{'
|
|
154
|
+
this.skipWs();
|
|
155
|
+
if (this.eof())
|
|
156
|
+
throw new SyntaxFail();
|
|
157
|
+
this.enter();
|
|
149
158
|
const members = [];
|
|
150
159
|
this.skipWs();
|
|
151
160
|
if (!this.eof() && this.peek() === 0x7d) {
|
|
@@ -164,6 +173,9 @@ class Scanner {
|
|
|
164
173
|
this.pos++;
|
|
165
174
|
this.skipWs();
|
|
166
175
|
const value = this.parseValue();
|
|
176
|
+
this.skipWs();
|
|
177
|
+
if (this.eof() || (this.peek() !== 0x2c && this.peek() !== 0x7d))
|
|
178
|
+
throw new SyntaxFail();
|
|
167
179
|
this.guard(members.length + 1, this.bounds.members, "members");
|
|
168
180
|
if (Buffer.byteLength(key, "utf8") > this.bounds.key) {
|
|
169
181
|
throw new CodeFail("ceiling:key");
|
|
@@ -15,6 +15,7 @@ type VResult = {
|
|
|
15
15
|
} | {
|
|
16
16
|
ok: false;
|
|
17
17
|
e: string;
|
|
18
|
+
subject?: (string | number)[];
|
|
18
19
|
};
|
|
19
20
|
export declare function table(): Spec[];
|
|
20
21
|
export declare function decode(bytes: Buffer | string | symbol, bounds?: Bounds | Record<string, unknown>): {
|
|
@@ -23,6 +24,7 @@ export declare function decode(bytes: Buffer | string | symbol, bounds?: Bounds
|
|
|
23
24
|
} | {
|
|
24
25
|
ok: false;
|
|
25
26
|
e: string;
|
|
27
|
+
subject?: (string | number)[];
|
|
26
28
|
};
|
|
27
29
|
export declare function fromValue(value: Value, opts?: {
|
|
28
30
|
authoredExtensions?: string[];
|
|
@@ -32,14 +34,17 @@ export declare function fromValue(value: Value, opts?: {
|
|
|
32
34
|
} | {
|
|
33
35
|
ok: false;
|
|
34
36
|
e: string;
|
|
37
|
+
subject?: (string | number)[];
|
|
35
38
|
};
|
|
36
39
|
export declare function toValue(deployment: Deployment): Value | {
|
|
37
40
|
ok: false;
|
|
38
41
|
e: string;
|
|
42
|
+
subject?: (string | number)[];
|
|
39
43
|
};
|
|
40
44
|
export declare function digestInput(deployment: Deployment): Value | {
|
|
41
45
|
ok: false;
|
|
42
46
|
e: string;
|
|
47
|
+
subject?: (string | number)[];
|
|
43
48
|
};
|
|
44
49
|
export declare function canonicalBytes(deployment: Deployment): {
|
|
45
50
|
ok: true;
|
|
@@ -47,12 +52,15 @@ export declare function canonicalBytes(deployment: Deployment): {
|
|
|
47
52
|
} | {
|
|
48
53
|
ok: false;
|
|
49
54
|
e: string;
|
|
55
|
+
subject?: (string | number)[];
|
|
50
56
|
};
|
|
51
57
|
export declare function contentDigest(deployment: Deployment): string | {
|
|
52
58
|
ok: false;
|
|
53
59
|
e: string;
|
|
60
|
+
subject?: (string | number)[];
|
|
54
61
|
};
|
|
55
62
|
export declare function verifyContentDigest(deployment: Deployment): VResult;
|
|
56
63
|
export declare function verifyBinding(deployment: Deployment, bound: blueprint.Blueprint, obs: Observations): VResult;
|
|
64
|
+
export declare function scan(value: Value, authoredNs: Set<string>): VResult;
|
|
57
65
|
export declare function parseTimestamp(stamped: string): number | null;
|
|
58
66
|
export {};
|