@agent-blueprint-protocol/verifier 0.8.3 → 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 +137 -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/kit/cli.mjs +1 -4
- 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.d.ts +6 -2
- package/dist/verifier/b64url.js +7 -1
- package/dist/verifier/blueprint.d.ts +12 -16
- package/dist/verifier/blueprint.js +40 -112
- package/dist/verifier/bounds.d.ts +1 -1
- package/dist/verifier/bounds.js +2 -2
- package/dist/verifier/bounds_algebra.d.ts +9 -0
- package/dist/verifier/bounds_algebra.js +10 -7
- package/dist/verifier/canonical.d.ts +1 -1
- package/dist/verifier/canonical.js +41 -8
- package/dist/verifier/cli.js +97 -45
- package/dist/verifier/compatibility.js +5 -7
- package/dist/verifier/corpus.d.ts +1 -1
- package/dist/verifier/corpus.js +10 -2
- package/dist/verifier/decode.js +24 -6
- package/dist/verifier/deployment.d.ts +20 -3
- package/dist/verifier/deployment.js +48 -10
- package/dist/verifier/digest.d.ts +12 -0
- package/dist/verifier/digest.js +17 -3
- 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/extension.js +4 -4
- 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 +26 -79
- 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 +12 -3
- package/dist/verifier/plain.d.ts +4 -0
- package/dist/verifier/plain.js +38 -0
- package/dist/verifier/portability.d.ts +1 -1
- package/dist/verifier/portability.js +19 -6
- package/dist/verifier/predicate.d.ts +7 -0
- package/dist/verifier/predicate.js +63 -7
- 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 +37 -20
- package/dist/verifier/report.d.ts +8 -0
- package/dist/verifier/report.js +9 -2
- package/dist/verifier/results.d.ts +3 -0
- package/dist/verifier/results.js +13 -0
- package/dist/verifier/run_corpus.js +4 -80
- package/dist/verifier/runner.d.ts +6 -0
- package/dist/verifier/runner.js +123 -17
- package/dist/verifier/schema.js +14 -55
- package/dist/verifier/signature.d.ts +19 -8
- package/dist/verifier/signature.js +51 -29
- package/dist/verifier/value.d.ts +9 -2
- package/dist/verifier/value.js +81 -11
- package/package.json +17 -12
package/dist/verifier/value.js
CHANGED
|
@@ -18,7 +18,48 @@ export const IJSON_MAX = 9_007_199_254_740_991;
|
|
|
18
18
|
// Deep equality over the tagged algebra. Numbers compare numerically
|
|
19
19
|
// (int 2 equals float 2.0 — Elixir's `==` semantics, which the runner's
|
|
20
20
|
// expectation comparison relies on); ±0 are equal.
|
|
21
|
+
// Host-built tagged values are bounded before recursive projections or comparisons.
|
|
22
|
+
export function isValue(value) {
|
|
23
|
+
return isValueAt(value, 0);
|
|
24
|
+
}
|
|
25
|
+
function isValueAt(value, depth) {
|
|
26
|
+
if (value === null || typeof value !== "object" || depth > 64)
|
|
27
|
+
return false;
|
|
28
|
+
const v = value;
|
|
29
|
+
switch (v.t) {
|
|
30
|
+
case "null": return true;
|
|
31
|
+
case "bool": return typeof v.v === "boolean";
|
|
32
|
+
case "int": return Number.isSafeInteger(v.v);
|
|
33
|
+
case "float": return typeof v.v === "number" && Number.isFinite(v.v);
|
|
34
|
+
case "str": return typeof v.v === "string" && Buffer.from(v.v).toString("utf8") === v.v;
|
|
35
|
+
case "arr":
|
|
36
|
+
if (!Array.isArray(v.v))
|
|
37
|
+
return false;
|
|
38
|
+
for (const item of v.v)
|
|
39
|
+
if (!isValueAt(item, depth + 1))
|
|
40
|
+
return false;
|
|
41
|
+
return true;
|
|
42
|
+
case "obj": {
|
|
43
|
+
if (!Array.isArray(v.v))
|
|
44
|
+
return false;
|
|
45
|
+
const seen = new Set();
|
|
46
|
+
for (const pair of v.v) {
|
|
47
|
+
if (!Array.isArray(pair) || pair.length !== 2 || typeof pair[0] !== "string" ||
|
|
48
|
+
Buffer.from(pair[0]).toString("utf8") !== pair[0] || seen.has(pair[0]))
|
|
49
|
+
return false;
|
|
50
|
+
seen.add(pair[0]);
|
|
51
|
+
if (!isValueAt(pair[1], depth + 1))
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
default: return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
21
59
|
export function sameValue(a, b) {
|
|
60
|
+
return isValue(a) && isValue(b) && sameValueAt(a, b);
|
|
61
|
+
}
|
|
62
|
+
function sameValueAt(a, b) {
|
|
22
63
|
if (a.t !== b.t) {
|
|
23
64
|
if ((a.t === "int" || a.t === "float") && (b.t === "int" || b.t === "float")) {
|
|
24
65
|
return a.v === b.v;
|
|
@@ -34,16 +75,19 @@ export function sameValue(a, b) {
|
|
|
34
75
|
case "str":
|
|
35
76
|
return a.v === b.v;
|
|
36
77
|
case "arr":
|
|
37
|
-
return (a.v.length === b.v.length && a.v.every((x, i) =>
|
|
78
|
+
return (a.v.length === b.v.length && a.v.every((x, i) => sameValueAt(x, b.v[i])));
|
|
38
79
|
case "obj":
|
|
39
80
|
return (a.v.length === b.v.length &&
|
|
40
81
|
a.v.every((pair, i) => {
|
|
41
82
|
const other = b.v[i];
|
|
42
|
-
return pair[0] === other[0] &&
|
|
83
|
+
return pair[0] === other[0] && sameValueAt(pair[1], other[1]);
|
|
43
84
|
}));
|
|
44
85
|
}
|
|
45
86
|
}
|
|
46
87
|
export function toPlain(v) {
|
|
88
|
+
return isValue(v) ? toPlainAt(v) : { ok: false, e: "invalid_type" };
|
|
89
|
+
}
|
|
90
|
+
function toPlainAt(v) {
|
|
47
91
|
switch (v.t) {
|
|
48
92
|
case "null":
|
|
49
93
|
return null;
|
|
@@ -53,25 +97,51 @@ export function toPlain(v) {
|
|
|
53
97
|
case "str":
|
|
54
98
|
return v.v;
|
|
55
99
|
case "arr":
|
|
56
|
-
return v.v.map(
|
|
100
|
+
return v.v.map(toPlainAt);
|
|
57
101
|
case "obj":
|
|
58
102
|
// Null prototype: "__proto__" and friends stay plain members.
|
|
59
103
|
const out = Object.create(null);
|
|
60
104
|
for (const [k, member] of v.v)
|
|
61
|
-
out[k] =
|
|
105
|
+
out[k] = toPlainAt(member);
|
|
62
106
|
return out;
|
|
63
107
|
}
|
|
64
108
|
}
|
|
65
109
|
export function fromPlain(p) {
|
|
110
|
+
const result = fromPlainAt(p, 0);
|
|
111
|
+
return result.ok ? result.v : result;
|
|
112
|
+
}
|
|
113
|
+
function fromPlainAt(p, depth) {
|
|
114
|
+
if (depth > 64)
|
|
115
|
+
return err("invalid_type");
|
|
66
116
|
if (p === null)
|
|
67
|
-
return nil;
|
|
117
|
+
return ok(nil);
|
|
68
118
|
if (typeof p === "boolean")
|
|
69
|
-
return bool(p);
|
|
119
|
+
return ok(bool(p));
|
|
70
120
|
if (typeof p === "number")
|
|
71
|
-
return Number.
|
|
121
|
+
return Number.isFinite(p) && (!Number.isInteger(p) || Number.isSafeInteger(p))
|
|
122
|
+
? ok(Number.isInteger(p) ? int(p) : float(p)) : err("invalid_type");
|
|
72
123
|
if (typeof p === "string")
|
|
73
|
-
return str(p);
|
|
74
|
-
if (Array.isArray(p))
|
|
75
|
-
|
|
76
|
-
|
|
124
|
+
return Buffer.from(p).toString("utf8") === p ? ok(str(p)) : err("invalid_type");
|
|
125
|
+
if (Array.isArray(p)) {
|
|
126
|
+
const items = [];
|
|
127
|
+
for (const item of p) {
|
|
128
|
+
const result = fromPlainAt(item, depth + 1);
|
|
129
|
+
if (!result.ok)
|
|
130
|
+
return result;
|
|
131
|
+
items.push(result.v);
|
|
132
|
+
}
|
|
133
|
+
return ok(arr(items));
|
|
134
|
+
}
|
|
135
|
+
if (typeof p !== "object" || (Object.getPrototypeOf(p) !== null && Object.getPrototypeOf(p) !== Object.prototype))
|
|
136
|
+
return err("invalid_type");
|
|
137
|
+
const members = [];
|
|
138
|
+
for (const [key, member] of Object.entries(p)) {
|
|
139
|
+
if (Buffer.from(key).toString("utf8") !== key)
|
|
140
|
+
return err("invalid_type");
|
|
141
|
+
const result = fromPlainAt(member, depth + 1);
|
|
142
|
+
if (!result.ok)
|
|
143
|
+
return result;
|
|
144
|
+
members.push([key, result.v]);
|
|
145
|
+
}
|
|
146
|
+
return ok(obj(members));
|
|
77
147
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-blueprint-protocol/verifier",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Installable verifier for the Agent Blueprint Protocol: canonical-bytes, digest, signature, bounds, and conformance-corpus verification. Non-authorizing
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
|
+
"description": "Installable verifier for the Agent Blueprint Protocol: canonical-bytes, digest, signature, bounds, and conformance-corpus verification. Non-authorizing — evidence, never a decision.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -16,21 +16,18 @@
|
|
|
16
16
|
"verifier": "dist/kit/cli.mjs"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
|
-
"dist",
|
|
19
|
+
"dist/verifier",
|
|
20
20
|
"!dist/verifier/self_checks.*",
|
|
21
|
+
"dist/kit",
|
|
22
|
+
"dist/corpus",
|
|
23
|
+
"dist/spec",
|
|
24
|
+
"dist/release-metadata.json",
|
|
25
|
+
"dist/release-history.json",
|
|
21
26
|
"README.md",
|
|
22
27
|
"CHANGELOG.md",
|
|
23
28
|
"LICENSE",
|
|
24
29
|
"NOTICE"
|
|
25
30
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsc -p tsconfig.json && node scripts/build_kit.mjs",
|
|
28
|
-
"prepack": "npm run build"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/node": "^25.0.0",
|
|
32
|
-
"typescript": "^7.0.2"
|
|
33
|
-
},
|
|
34
31
|
"keywords": [
|
|
35
32
|
"agent",
|
|
36
33
|
"protocol",
|
|
@@ -39,5 +36,13 @@
|
|
|
39
36
|
"interoperability",
|
|
40
37
|
"mcp",
|
|
41
38
|
"a2a"
|
|
42
|
-
]
|
|
39
|
+
],
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/verifier/index.d.ts",
|
|
43
|
+
"import": "./dist/verifier/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"types": "./dist/verifier/index.d.ts"
|
|
43
48
|
}
|