@agent-blueprint-protocol/verifier 0.8.4 → 1.0.0-rc.2

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.
Files changed (107) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/LICENSE +1 -1
  3. package/NOTICE +2 -2
  4. package/README.md +143 -255
  5. package/dist/corpus/cases/blueprint-decode.json +1 -1
  6. package/dist/corpus/cases/bounds-new.json +1 -1
  7. package/dist/corpus/cases/bounds_algebra-intersect.json +1 -1
  8. package/dist/corpus/cases/canonicalization-encode.json +1 -1
  9. package/dist/corpus/cases/deployment-decode.json +1 -1
  10. package/dist/corpus/cases/extension-resolve.json +1 -1
  11. package/dist/corpus/cases/federation-decode.json +1 -1
  12. package/dist/corpus/cases/federation-verify_commitment.json +1 -1
  13. package/dist/corpus/cases/json-decode.json +1 -1
  14. package/dist/corpus/cases/negotiation-negotiate.json +1 -1
  15. package/dist/corpus/cases/predicate.json +1 -0
  16. package/dist/corpus/cases/reconcile.json +1 -0
  17. package/dist/corpus/cases/schema-validate_instance.json +1 -1
  18. package/dist/corpus/cases/signature-verify.json +1 -1
  19. package/dist/corpus/index.json +1 -1
  20. package/dist/release-history.json +1 -0
  21. package/dist/release-metadata.json +1 -1
  22. package/dist/spec/FOUNDATION-TRANSITION.md +67 -0
  23. package/dist/spec/IPR.md +27 -0
  24. package/dist/spec/LICENSE +190 -0
  25. package/dist/spec/NOTICE +4 -0
  26. package/dist/spec/README.md +47 -0
  27. package/dist/spec/conformance/base64url-decode.schema.json +176 -0
  28. package/dist/spec/conformance/blueprint-decode.schema.json +280 -0
  29. package/dist/spec/conformance/bounds-new.schema.json +302 -0
  30. package/dist/spec/conformance/bounds_algebra-intersect.schema.json +457 -0
  31. package/dist/spec/conformance/canonicalization-encode.schema.json +280 -0
  32. package/dist/spec/conformance/case-file.schema.json +122 -0
  33. package/dist/spec/conformance/certified-results.json +1 -0
  34. package/dist/spec/conformance/claim.schema.json +52 -0
  35. package/dist/spec/conformance/compatibility-verify.schema.json +262 -0
  36. package/dist/spec/conformance/deployment-decode.schema.json +322 -0
  37. package/dist/spec/conformance/digest-tagged.schema.json +200 -0
  38. package/dist/spec/conformance/evidence.schema.json +249 -0
  39. package/dist/spec/conformance/execution.md +80 -0
  40. package/dist/spec/conformance/extension-resolve.schema.json +264 -0
  41. package/dist/spec/conformance/federation-decode.schema.json +318 -0
  42. package/dist/spec/conformance/federation-verify_commitment.schema.json +342 -0
  43. package/dist/spec/conformance/index.schema.json +102 -0
  44. package/dist/spec/conformance/json-decode.schema.json +287 -0
  45. package/dist/spec/conformance/negotiation-negotiate.schema.json +264 -0
  46. package/dist/spec/conformance/portability-scan.schema.json +188 -0
  47. package/dist/spec/conformance/predicate.schema.json +201 -0
  48. package/dist/spec/conformance/reconcile.schema.json +287 -0
  49. package/dist/spec/conformance/runner.md +185 -0
  50. package/dist/spec/conformance/schema-validate_instance.schema.json +206 -0
  51. package/dist/spec/conformance/signature-verify.schema.json +224 -0
  52. package/dist/spec/conformance/support.schema.json +72 -0
  53. package/dist/spec/errata.md +13 -0
  54. package/dist/spec/grammar/blueprint.cddl +92 -0
  55. package/dist/spec/grammar/deployment.cddl +125 -0
  56. package/dist/spec/grammar/derived/blueprint.schema.json +340 -0
  57. package/dist/spec/grammar/derived/deployment.schema.json +496 -0
  58. package/dist/spec/grammar/derived/taskenvelope.schema.json +244 -0
  59. package/dist/spec/grammar/taskenvelope.cddl +77 -0
  60. package/dist/spec/protocol.md +1237 -0
  61. package/dist/spec/registry/OPERATIONS.md +78 -0
  62. package/dist/spec/registry/registry.json +23 -0
  63. package/dist/verifier/b64url.js +1 -1
  64. package/dist/verifier/blueprint.d.ts +2 -15
  65. package/dist/verifier/blueprint.js +21 -107
  66. package/dist/verifier/bounds_algebra.d.ts +9 -0
  67. package/dist/verifier/bounds_algebra.js +6 -6
  68. package/dist/verifier/cli.js +14 -31
  69. package/dist/verifier/corpus.d.ts +1 -1
  70. package/dist/verifier/corpus.js +5 -1
  71. package/dist/verifier/decode.js +15 -3
  72. package/dist/verifier/deployment.d.ts +8 -0
  73. package/dist/verifier/deployment.js +17 -2
  74. package/dist/verifier/digest.js +1 -1
  75. package/dist/verifier/errors.d.ts +2 -0
  76. package/dist/verifier/errors.js +1 -0
  77. package/dist/verifier/execution.d.ts +13 -0
  78. package/dist/verifier/execution.js +82 -0
  79. package/dist/verifier/facade.d.ts +311 -0
  80. package/dist/verifier/facade.js +78 -0
  81. package/dist/verifier/federation.d.ts +2 -2
  82. package/dist/verifier/federation.js +10 -7
  83. package/dist/verifier/harness.d.ts +16 -0
  84. package/dist/verifier/harness.js +201 -0
  85. package/dist/verifier/index.d.ts +3 -0
  86. package/dist/verifier/index.js +2 -0
  87. package/dist/verifier/mapping.d.ts +139 -0
  88. package/dist/verifier/mapping.js +1 -0
  89. package/dist/verifier/negotiation.d.ts +2 -1
  90. package/dist/verifier/negotiation.js +6 -3
  91. package/dist/verifier/plain.d.ts +4 -0
  92. package/dist/verifier/plain.js +38 -0
  93. package/dist/verifier/predicate.d.ts +7 -0
  94. package/dist/verifier/predicate.js +60 -1
  95. package/dist/verifier/reconcile.d.ts +37 -0
  96. package/dist/verifier/reconcile.js +115 -0
  97. package/dist/verifier/registry.js +9 -51
  98. package/dist/verifier/registry_engine.d.ts +3 -0
  99. package/dist/verifier/registry_engine.js +8 -8
  100. package/dist/verifier/results.d.ts +3 -0
  101. package/dist/verifier/results.js +13 -0
  102. package/dist/verifier/runner.d.ts +2 -0
  103. package/dist/verifier/runner.js +115 -16
  104. package/dist/verifier/signature.d.ts +17 -6
  105. package/dist/verifier/signature.js +41 -25
  106. package/package.json +17 -12
  107. package/dist/corpus/schemas/estate-contract.schema.json +0 -1
@@ -0,0 +1,201 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { readFileSync, writeFileSync } from 'node:fs';
3
+ import { createHash } from 'node:crypto';
4
+ import { once } from 'node:events';
5
+ import { load, loadPriorCensus } from './corpus.js';
6
+ import { canonical } from './results.js';
7
+ import { lines, handshake, ExecutionFailure } from './execution.js';
8
+ import { plain } from './plain.js';
9
+ export const OUTCOMES = { handshake_mismatch: 10, duplicate_id: 11, missing_response: 12, extra_response: 13, reordered_response: 14, malformed_line: 15, oversized_line: 16, response_timeout: 17, early_exit: 18, disagreement: 19 };
10
+ export function documentDigest(bytes) { return 'sha-256:' + createHash('sha256').update(bytes).digest('base64url'); }
11
+ export async function runHarness(args, readCorpus, metadata) {
12
+ const separator = args.indexOf('--');
13
+ if (separator < 0 || separator === args.length - 1)
14
+ return 2;
15
+ const options = {};
16
+ for (let i = 0; i < separator; i += 2) {
17
+ if (!['--corpus', '--results', '--timeout-ms', '--claim', '--implementation', '--implementation-version', '--source', '--platform', '--date', '--prior-corpus-digest'].includes(args[i]) || !args[i + 1] || i + 1 >= separator || Object.hasOwn(options, args[i]))
18
+ return 2;
19
+ options[args[i]] = args[i + 1];
20
+ }
21
+ const timeout = Number(options['--timeout-ms'] ?? '30000');
22
+ if (!Number.isInteger(timeout) || timeout < 1 || timeout > 300000)
23
+ return 2;
24
+ if (!options['--corpus'])
25
+ return 2;
26
+ let loaded;
27
+ try {
28
+ loaded = (options['--prior-corpus-digest'] ? loadPriorCensus : load)(readCorpus(options['--corpus']));
29
+ }
30
+ catch {
31
+ return 2;
32
+ }
33
+ if (!loaded.ok)
34
+ return 2;
35
+ const corpus = loaded.v;
36
+ const certified = corpus.identity === metadata.corpus_digest;
37
+ process.stderr.write(`corpus digest ${certified ? 'matches' : 'does not match'} the release-certified corpus\n`);
38
+ if (options['--claim'] && (!certified && options['--prior-corpus-digest'] !== corpus.identity))
39
+ return 2;
40
+ if (options['--prior-corpus-digest']) {
41
+ let history;
42
+ for (const path of ['../priv/release-history.json', '../release-history.json', './release-history.json']) {
43
+ try {
44
+ history = JSON.parse(readFileSync(new URL(path, import.meta.url), 'utf8'));
45
+ break;
46
+ }
47
+ catch (error) {
48
+ if (error.code !== 'ENOENT')
49
+ return 2;
50
+ }
51
+ }
52
+ if (options['--prior-corpus-digest'] !== corpus.identity || !history?.rows?.some((row) => row.corpus_digest === corpus.identity))
53
+ return 2;
54
+ }
55
+ if (options['--claim'] && ['--implementation', '--implementation-version', '--source', '--platform', '--date'].some(k => !options[k]))
56
+ return 2;
57
+ if (options['--claim'] && (!/^\d{4}-\d{2}-\d{2}$/.test(options['--date']) || !/^https?:\/\//.test(options['--source'])))
58
+ return 2;
59
+ let certifiedRows = null;
60
+ if (certified) {
61
+ let document;
62
+ for (const path of ['../spec/conformance/certified-results.json', './spec/conformance/certified-results.json']) {
63
+ try {
64
+ document = JSON.parse(readFileSync(new URL(path, import.meta.url), 'utf8'));
65
+ break;
66
+ }
67
+ catch (error) {
68
+ if (error.code !== 'ENOENT')
69
+ throw error;
70
+ }
71
+ }
72
+ if (!document || document.corpus_digest !== corpus.identity || document.registry_digest !== plain(corpus.index).registry_digest)
73
+ return 2;
74
+ certifiedRows = new Map(document.results.map((row) => [row.id, row]));
75
+ if (certifiedRows.size !== corpus.caseIds.size)
76
+ return 2;
77
+ }
78
+ const child = spawn(args[separator + 1], args.slice(separator + 2), { stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true, detached: process.platform !== 'win32' });
79
+ child.stderr.pipe(process.stderr);
80
+ child.stdin.on('error', () => { });
81
+ let exitCode;
82
+ const exited = new Promise(resolve => { child.once('error', () => { exitCode = -1; resolve(); }); child.once('exit', code => { exitCode = code; resolve(); }); });
83
+ const finish = async () => {
84
+ let timer;
85
+ try {
86
+ await Promise.race([exited, new Promise((_, reject) => { timer = setTimeout(() => reject(new ExecutionFailure('response_timeout')), timeout); })]);
87
+ }
88
+ finally {
89
+ if (timer)
90
+ clearTimeout(timer);
91
+ }
92
+ };
93
+ const reader = lines(child.stdout);
94
+ // Output still buffered when the adapter exits arrives within the grace;
95
+ // after it, a descendant holding the pipe open cannot hide the exit.
96
+ child.once('exit', () => { setTimeout(reader.end, Math.min(250, Math.floor(timeout / 4))).unref(); });
97
+ const rows = corpus.cases.flatMap(f => f.cases).sort((a, b) => Buffer.compare(Buffer.from(a.id), Buffer.from(b.id)));
98
+ const results = [];
99
+ const ids = new Set();
100
+ try {
101
+ child.stdin.write(canonical(handshake(corpus)) + '\n');
102
+ const hello = await reader.next(timeout);
103
+ if (hello === null)
104
+ throw new ExecutionFailure('early_exit');
105
+ if (canonical(hello) !== canonical(handshake(corpus)))
106
+ throw new ExecutionFailure('handshake_mismatch');
107
+ const sending = (async () => { for (const row of rows) {
108
+ if (!child.stdin.write(canonical({ id: row.id, surface: row.surface, input: plain(row.input) }) + '\n'))
109
+ await once(child.stdin, 'drain');
110
+ } child.stdin.end(); })();
111
+ sending.catch(() => { });
112
+ let agreement = true;
113
+ for (let i = 0; i < rows.length; i++) {
114
+ const response = await reader.next(timeout);
115
+ if (response === null) {
116
+ process.stderr.write('harness response ended before ' + rows[i].id + '\n');
117
+ await finish();
118
+ throw new ExecutionFailure(exitCode === 0 && i > 0 ? 'missing_response' : 'early_exit');
119
+ }
120
+ if (!response || typeof response !== 'object' || Object.keys(response).sort().join(',') !== 'id,result' || typeof response.id !== 'string' || !response.result || typeof response.result !== 'object' || Array.isArray(response.result))
121
+ throw new ExecutionFailure('malformed_line');
122
+ if (ids.has(response.id))
123
+ throw new ExecutionFailure('duplicate_id');
124
+ if (response.id !== rows[i].id)
125
+ throw new ExecutionFailure('reordered_response');
126
+ ids.add(response.id);
127
+ const expected = plain(rows[i].expected);
128
+ const certifiedRow = certifiedRows?.get(rows[i].id);
129
+ const exact = !certifiedRows || (certifiedRow?.surface === rows[i].surface && canonical(certifiedRow.result) === canonical(response.result));
130
+ if (!exact || !matches(expected, response.result)) {
131
+ agreement = false;
132
+ process.stderr.write("harness disagreement: " + rows[i].id + "\n");
133
+ }
134
+ results.push({ id: response.id, surface: rows[i].surface, result: response.result });
135
+ }
136
+ const extra = await reader.next(timeout);
137
+ if (extra !== null)
138
+ throw new ExecutionFailure('extra_response');
139
+ await finish();
140
+ if (exitCode !== 0)
141
+ throw new ExecutionFailure('early_exit');
142
+ await sending;
143
+ const document = canonical({ format: 'agent-blueprint-protocol-conformance-results', corpus_digest: corpus.identity, registry_digest: plain(corpus.index).registry_digest, results });
144
+ if (options['--results'])
145
+ writeFileSync(options['--results'], document);
146
+ else
147
+ process.stdout.write(document);
148
+ if (!agreement)
149
+ throw new ExecutionFailure('disagreement');
150
+ if (options['--claim']) {
151
+ const claim = { format: 'agent-blueprint-protocol-conformance-claim', implementation: options['--implementation'], version: options['--implementation-version'], source_url: options['--source'], platform: options['--platform'], corpus_digest: corpus.identity, registry_digest: plain(corpus.index).registry_digest, results_digest: documentDigest(document), date: options['--date'] };
152
+ writeFileSync(options['--claim'], canonical(claim));
153
+ }
154
+ process.stderr.write('harness: agreement\n');
155
+ return 0;
156
+ }
157
+ catch (error) {
158
+ const outcome = error instanceof ExecutionFailure ? error.outcome : 'early_exit';
159
+ process.stderr.write('harness: ' + outcome + '\n');
160
+ return OUTCOMES[outcome] ?? 18;
161
+ }
162
+ finally {
163
+ // POSIX groups include descendants that can inherit the output pipes.
164
+ // Windows uses the adapter handle: detached groups have no POSIX kill semantics.
165
+ if (process.platform !== 'win32' && child.pid) {
166
+ try {
167
+ process.kill(-child.pid, 'SIGKILL');
168
+ }
169
+ catch (error) {
170
+ if (!['ESRCH', 'EPERM'].includes(error.code ?? ''))
171
+ throw error;
172
+ if (exitCode === undefined)
173
+ child.kill('SIGKILL');
174
+ }
175
+ }
176
+ else if (exitCode === undefined)
177
+ child.kill('SIGKILL');
178
+ child.stdin.destroy();
179
+ child.stdout.destroy();
180
+ child.stderr.destroy();
181
+ let timer;
182
+ try {
183
+ await Promise.race([exited, new Promise(resolve => { timer = setTimeout(resolve, Math.min(timeout, 1000)); })]);
184
+ }
185
+ finally {
186
+ if (timer)
187
+ clearTimeout(timer);
188
+ }
189
+ }
190
+ }
191
+ function matches(expected, actual) {
192
+ if (!actual || typeof actual !== 'object' || actual.verdict !== expected.verdict)
193
+ return false;
194
+ return Object.entries(expected).every(([key, value]) => {
195
+ if (!Object.hasOwn(actual, key))
196
+ return false;
197
+ if (canonical(value) === canonical(actual[key]))
198
+ return true;
199
+ return ['encoded', 'canonical', 'decoded'].includes(key) && typeof value === 'string' && typeof actual[key] === 'string' && Buffer.from(actual[key], 'base64url').equals(Buffer.from(value));
200
+ });
201
+ }
@@ -0,0 +1,3 @@
1
+ /** The supported package-root API. Importing it runs no command and performs no I/O. */
2
+ export * from './facade.ts';
3
+ export type { ErrorCode } from './errors.ts';
@@ -0,0 +1,2 @@
1
+ /** The supported package-root API. Importing it runs no command and performs no I/O. */
2
+ export * from './facade.js';
@@ -0,0 +1,139 @@
1
+ export declare const rows: readonly [{
2
+ readonly index: 1;
3
+ readonly a2a_location: "Task.id (a2a.proto:170)";
4
+ readonly logical_field: "task_identity";
5
+ readonly mcp_location: "Task.taskId (mcp-schema.ts:47)";
6
+ readonly verdict: "native";
7
+ }, {
8
+ readonly index: 2;
9
+ readonly a2a_location: "none — Message.message_id (a2a.proto:262) is a message id, not an idempotency key";
10
+ readonly logical_field: "idempotency_identity";
11
+ readonly mcp_location: "none";
12
+ readonly verdict: "extension";
13
+ }, {
14
+ readonly index: 3;
15
+ readonly a2a_location: "Message.reference_task_ids (a2a.proto:276), Task.context_id (a2a.proto:173) — a reference, not a parent execution";
16
+ readonly logical_field: "parent_execution_reference";
17
+ readonly mcp_location: "none";
18
+ readonly verdict: "partial";
19
+ }, {
20
+ readonly index: 4;
21
+ readonly a2a_location: "none — SecurityScheme/SecurityRequirement (a2a.proto:495-517) are transport-level";
22
+ readonly logical_field: "initiating_subject";
23
+ readonly mcp_location: "none — transport auth";
24
+ readonly verdict: "extension";
25
+ }, {
26
+ readonly index: 5;
27
+ readonly a2a_location: "none";
28
+ readonly logical_field: "blueprint_digest";
29
+ readonly mcp_location: "none";
30
+ readonly verdict: "extension";
31
+ }, {
32
+ readonly index: 6;
33
+ readonly a2a_location: "none";
34
+ readonly logical_field: "deployment_digest";
35
+ readonly mcp_location: "none";
36
+ readonly verdict: "extension";
37
+ }, {
38
+ readonly index: 7;
39
+ readonly a2a_location: "Message.parts[].data (a2a.proto:233), Part.metadata (a2a.proto:236) — a payload home, not a digest commitment";
40
+ readonly logical_field: "input_commitment";
41
+ readonly mcp_location: "request params";
42
+ readonly verdict: "partial";
43
+ }, {
44
+ readonly index: 8;
45
+ readonly a2a_location: "Part.media_type (a2a.proto:241), AgentSkill.output_modes (a2a.proto:449) — media type is not a schema identity";
46
+ readonly logical_field: "result_schema";
47
+ readonly mcp_location: "CompletedTask.result {[key: string]: unknown} (mcp-schema.ts:135)";
48
+ readonly verdict: "extension";
49
+ }, {
50
+ readonly index: 9;
51
+ readonly a2a_location: "none";
52
+ readonly logical_field: "result_classification_ceiling";
53
+ readonly mcp_location: "none";
54
+ readonly verdict: "extension";
55
+ }, {
56
+ readonly index: 10;
57
+ readonly a2a_location: "SendMessageConfiguration (a2a.proto:143-161) has no time bound";
58
+ readonly logical_field: "time_policy";
59
+ readonly mcp_location: "Task.ttlMs (mcp-schema.ts:82) — a storage TTL, NOT an execution bound";
60
+ readonly verdict: "partial";
61
+ }, {
62
+ readonly index: 11;
63
+ readonly a2a_location: "none";
64
+ readonly logical_field: "resource_policy";
65
+ readonly mcp_location: "none";
66
+ readonly verdict: "extension";
67
+ }, {
68
+ readonly index: 12;
69
+ readonly a2a_location: "Task.id + GetTask (a2a.proto:45)";
70
+ readonly logical_field: "recovery_handle";
71
+ readonly mcp_location: "taskId + tasks/get (mcp-tasks.md Task Polling)";
72
+ readonly verdict: "native";
73
+ }, {
74
+ readonly index: 13;
75
+ readonly a2a_location: "transport-level only (SecurityScheme)";
76
+ readonly logical_field: "issuer";
77
+ readonly mcp_location: "transport auth";
78
+ readonly verdict: "extension";
79
+ }, {
80
+ readonly index: 14;
81
+ readonly a2a_location: "none";
82
+ readonly logical_field: "subject";
83
+ readonly mcp_location: "none";
84
+ readonly verdict: "extension";
85
+ }, {
86
+ readonly index: 15;
87
+ readonly a2a_location: "none";
88
+ readonly logical_field: "audience";
89
+ readonly mcp_location: "none";
90
+ readonly verdict: "extension";
91
+ }, {
92
+ readonly index: 16;
93
+ readonly a2a_location: "none";
94
+ readonly logical_field: "identity_mapping_evidence";
95
+ readonly mcp_location: "none";
96
+ readonly verdict: "extension";
97
+ }, {
98
+ readonly index: 17;
99
+ readonly a2a_location: "TASK_STATE_INPUT_REQUIRED (a2a.proto:201) + TaskStatus.message — free-form, not typed";
100
+ readonly logical_field: "checkpoint_request";
101
+ readonly mcp_location: "status input_required + inputRequests: InputRequest union (mcp-schema.ts:111-119, mcp-spec.types.ts:545)";
102
+ readonly verdict: "partial";
103
+ }, {
104
+ readonly index: 18;
105
+ readonly a2a_location: "TaskStatus.state (a2a.proto:213)";
106
+ readonly logical_field: "checkpoint_status";
107
+ readonly mcp_location: "Task.status (mcp-schema.ts:31-36)";
108
+ readonly verdict: "native";
109
+ }, {
110
+ readonly index: 19;
111
+ readonly a2a_location: "none";
112
+ readonly logical_field: "checkpoint_commitment";
113
+ readonly mcp_location: "tasks/update inputResponses (mcp-schema.ts:232-246) carries responses, no commitment digest";
114
+ readonly verdict: "extension";
115
+ }, {
116
+ readonly index: 20;
117
+ readonly a2a_location: "TASK_STATE_COMPLETED/FAILED/CANCELED/REJECTED (a2a.proto:194-205)";
118
+ readonly logical_field: "terminal_state";
119
+ readonly mcp_location: "completed/failed/cancelled (mcp-schema.ts:31-36) — lossy both directions";
120
+ readonly verdict: "partial";
121
+ }, {
122
+ readonly index: 21;
123
+ readonly a2a_location: "AgentCardSignature (a2a.proto:455-467) signs the AgentCard, not a task result";
124
+ readonly logical_field: "evidence_receipt";
125
+ readonly mcp_location: "none";
126
+ readonly verdict: "extension";
127
+ }, {
128
+ readonly index: 22;
129
+ readonly a2a_location: "AgentCard.version (a2a.proto:374-376) — a version string, not an exact build identity";
130
+ readonly logical_field: "compatibility_reference";
131
+ readonly mcp_location: "none";
132
+ readonly verdict: "extension";
133
+ }, {
134
+ readonly index: 23;
135
+ readonly a2a_location: "transport-level only";
136
+ readonly logical_field: "authority_proof_references";
137
+ readonly mcp_location: "transport auth";
138
+ readonly verdict: "extension";
139
+ }];
@@ -0,0 +1 @@
1
+ export const rows = [{ "index": 1, "a2a_location": "Task.id (a2a.proto:170)", "logical_field": "task_identity", "mcp_location": "Task.taskId (mcp-schema.ts:47)", "verdict": "native" }, { "index": 2, "a2a_location": "none — Message.message_id (a2a.proto:262) is a message id, not an idempotency key", "logical_field": "idempotency_identity", "mcp_location": "none", "verdict": "extension" }, { "index": 3, "a2a_location": "Message.reference_task_ids (a2a.proto:276), Task.context_id (a2a.proto:173) — a reference, not a parent execution", "logical_field": "parent_execution_reference", "mcp_location": "none", "verdict": "partial" }, { "index": 4, "a2a_location": "none — SecurityScheme/SecurityRequirement (a2a.proto:495-517) are transport-level", "logical_field": "initiating_subject", "mcp_location": "none — transport auth", "verdict": "extension" }, { "index": 5, "a2a_location": "none", "logical_field": "blueprint_digest", "mcp_location": "none", "verdict": "extension" }, { "index": 6, "a2a_location": "none", "logical_field": "deployment_digest", "mcp_location": "none", "verdict": "extension" }, { "index": 7, "a2a_location": "Message.parts[].data (a2a.proto:233), Part.metadata (a2a.proto:236) — a payload home, not a digest commitment", "logical_field": "input_commitment", "mcp_location": "request params", "verdict": "partial" }, { "index": 8, "a2a_location": "Part.media_type (a2a.proto:241), AgentSkill.output_modes (a2a.proto:449) — media type is not a schema identity", "logical_field": "result_schema", "mcp_location": "CompletedTask.result {[key: string]: unknown} (mcp-schema.ts:135)", "verdict": "extension" }, { "index": 9, "a2a_location": "none", "logical_field": "result_classification_ceiling", "mcp_location": "none", "verdict": "extension" }, { "index": 10, "a2a_location": "SendMessageConfiguration (a2a.proto:143-161) has no time bound", "logical_field": "time_policy", "mcp_location": "Task.ttlMs (mcp-schema.ts:82) — a storage TTL, NOT an execution bound", "verdict": "partial" }, { "index": 11, "a2a_location": "none", "logical_field": "resource_policy", "mcp_location": "none", "verdict": "extension" }, { "index": 12, "a2a_location": "Task.id + GetTask (a2a.proto:45)", "logical_field": "recovery_handle", "mcp_location": "taskId + tasks/get (mcp-tasks.md Task Polling)", "verdict": "native" }, { "index": 13, "a2a_location": "transport-level only (SecurityScheme)", "logical_field": "issuer", "mcp_location": "transport auth", "verdict": "extension" }, { "index": 14, "a2a_location": "none", "logical_field": "subject", "mcp_location": "none", "verdict": "extension" }, { "index": 15, "a2a_location": "none", "logical_field": "audience", "mcp_location": "none", "verdict": "extension" }, { "index": 16, "a2a_location": "none", "logical_field": "identity_mapping_evidence", "mcp_location": "none", "verdict": "extension" }, { "index": 17, "a2a_location": "TASK_STATE_INPUT_REQUIRED (a2a.proto:201) + TaskStatus.message — free-form, not typed", "logical_field": "checkpoint_request", "mcp_location": "status input_required + inputRequests: InputRequest union (mcp-schema.ts:111-119, mcp-spec.types.ts:545)", "verdict": "partial" }, { "index": 18, "a2a_location": "TaskStatus.state (a2a.proto:213)", "logical_field": "checkpoint_status", "mcp_location": "Task.status (mcp-schema.ts:31-36)", "verdict": "native" }, { "index": 19, "a2a_location": "none", "logical_field": "checkpoint_commitment", "mcp_location": "tasks/update inputResponses (mcp-schema.ts:232-246) carries responses, no commitment digest", "verdict": "extension" }, { "index": 20, "a2a_location": "TASK_STATE_COMPLETED/FAILED/CANCELED/REJECTED (a2a.proto:194-205)", "logical_field": "terminal_state", "mcp_location": "completed/failed/cancelled (mcp-schema.ts:31-36) — lossy both directions", "verdict": "partial" }, { "index": 21, "a2a_location": "AgentCardSignature (a2a.proto:455-467) signs the AgentCard, not a task result", "logical_field": "evidence_receipt", "mcp_location": "none", "verdict": "extension" }, { "index": 22, "a2a_location": "AgentCard.version (a2a.proto:374-376) — a version string, not an exact build identity", "logical_field": "compatibility_reference", "mcp_location": "none", "verdict": "extension" }, { "index": 23, "a2a_location": "transport-level only", "logical_field": "authority_proof_references", "mcp_location": "transport auth", "verdict": "extension" }];
@@ -5,7 +5,7 @@ export interface RegistryEntryInput {
5
5
  criticality: "critical" | "optional";
6
6
  state: RegState;
7
7
  schemaDigest: string | null;
8
- a2aUri: string;
8
+ a2aUri: string | null;
9
9
  promotedAtRevision: number | null;
10
10
  }
11
11
  export interface Support {
@@ -19,6 +19,7 @@ export interface Outcome {
19
19
  criticalExtensions: string[];
20
20
  quarantinedExtensions: string[];
21
21
  notices: string[];
22
+ optionalRetained: string[];
22
23
  }
23
24
  export declare function negotiate(artifact: Value, support: Support): {
24
25
  ok: true;
@@ -111,6 +111,7 @@ export function negotiate(artifact, support) {
111
111
  criticalExtensions: extensions.v.critical,
112
112
  quarantinedExtensions: extensions.v.quarantined,
113
113
  notices: extensions.v.notices,
114
+ optionalRetained: extensions.v.optionalRetained,
114
115
  },
115
116
  };
116
117
  }
@@ -183,7 +184,7 @@ function extensionsCheck(value, support) {
183
184
  return reserved;
184
185
  const critical = regionNamespaces(regions, "critical");
185
186
  const optional = regionNamespaces(regions, "optional");
186
- const flow = { critical: [], quarantined: [], notices: [] };
187
+ const flow = { critical: [], quarantined: [], notices: [], optionalRetained: [] };
187
188
  for (const ns of critical) {
188
189
  const judgment = criticalJudgment(ns, regions, support);
189
190
  if (!judgment.ok)
@@ -200,8 +201,10 @@ function extensionsCheck(value, support) {
200
201
  flow.quarantined.push(ns);
201
202
  flow.notices.push("extension_unknown_optional_retained");
202
203
  }
203
- else if (judgment.notice !== null) {
204
- flow.notices.push(judgment.notice);
204
+ else {
205
+ flow.optionalRetained.push(ns);
206
+ if (judgment.notice !== null)
207
+ flow.notices.push(judgment.notice);
205
208
  }
206
209
  }
207
210
  return { ok: true, v: flow };
@@ -0,0 +1,4 @@
1
+ import type { Value } from './value.ts';
2
+ export declare function tagged(value: unknown, depth?: number): Value;
3
+ export declare function plain(value: Value): any;
4
+ export declare function jsonValue(value: unknown): any;
@@ -0,0 +1,38 @@
1
+ export function tagged(value, depth = 0) {
2
+ if (depth > 64)
3
+ throw new TypeError('invalid_type');
4
+ if (value === null)
5
+ return { t: 'null' };
6
+ if (typeof value === 'string')
7
+ return { t: 'str', v: value };
8
+ if (typeof value === 'boolean')
9
+ return { t: 'bool', v: value };
10
+ if (typeof value === 'number' && Number.isFinite(value))
11
+ return { t: Number.isSafeInteger(value) ? 'int' : 'float', v: value };
12
+ if (Array.isArray(value))
13
+ return { t: 'arr', v: Array.from(value, x => tagged(x, depth + 1)) };
14
+ if (value && typeof value === 'object' && [Object.prototype, null].includes(Object.getPrototypeOf(value))) {
15
+ return { t: 'obj', v: Object.entries(value).map(([k, v]) => [k, tagged(v, depth + 1)]) };
16
+ }
17
+ throw new TypeError('invalid_type');
18
+ }
19
+ export function plain(value) {
20
+ if (value.t === 'null')
21
+ return null;
22
+ if (value.t === 'arr')
23
+ return value.v.map(plain);
24
+ if (value.t === 'obj')
25
+ return Object.fromEntries(value.v.map(([k, v]) => [k, plain(v)]));
26
+ return value.v;
27
+ }
28
+ export function jsonValue(value) {
29
+ if (value instanceof Set)
30
+ return [...value].sort();
31
+ if (value instanceof Uint8Array)
32
+ return Buffer.from(value).toString('base64url');
33
+ if (Array.isArray(value))
34
+ return value.map(jsonValue);
35
+ if (value && typeof value === 'object')
36
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, jsonValue(v)]));
37
+ return value;
38
+ }
@@ -7,4 +7,11 @@ type VResult = {
7
7
  e: Reason;
8
8
  };
9
9
  export declare function validate(predicate: Value, portNames: string[]): VResult;
10
+ export declare function evaluate(predicate: Value, ports: Map<string, Value>, portNames?: string[]): {
11
+ ok: true;
12
+ v: boolean;
13
+ } | {
14
+ ok: false;
15
+ e: string;
16
+ };
10
17
  export {};
@@ -137,7 +137,7 @@ function pathMember(members, ports) {
137
137
  if (!segments.every((s) => s.t === "str"))
138
138
  return { ok: false, e: "invalid_type" };
139
139
  const root = segments[0].v;
140
- return ports.has(root) ? { ok: true } : { ok: false, e: "predicate_path_unresolved" };
140
+ return ports === null || ports.has(root) ? { ok: true } : { ok: false, e: "predicate_path_unresolved" };
141
141
  }
142
142
  function valuesMember(members) {
143
143
  const found = keyfind(members, "values");
@@ -167,3 +167,62 @@ function keyfind(members, name) {
167
167
  const found = members.find(([key]) => key === name);
168
168
  return found ? found[1] : null;
169
169
  }
170
+ export function evaluate(predicate, ports, portNames) {
171
+ if (!(ports instanceof Map) || [...ports].some(([k, v]) => typeof k !== 'string' || !isValue(v)))
172
+ return { ok: false, e: 'invalid_type' };
173
+ if (!isValue(predicate))
174
+ return { ok: false, e: "invalid_type" };
175
+ const checked = portNames === undefined ? shape(predicate, null, 0) : validate(predicate, portNames);
176
+ if (!checked.ok)
177
+ return checked;
178
+ return apply(predicate);
179
+ function resolve(path) {
180
+ if (path.t !== 'arr')
181
+ return null;
182
+ const segments = path.v.map(x => x.v);
183
+ let found = ports.get(segments[0]) ?? null;
184
+ for (const segment of segments.slice(1)) {
185
+ if (found?.t === 'obj')
186
+ found = keyfind(found.v, segment);
187
+ else if (found?.t === 'arr' && /^(0|[1-9][0-9]*)$/.test(segment))
188
+ found = found.v[Number(segment)] ?? null;
189
+ else
190
+ return null;
191
+ }
192
+ return found;
193
+ }
194
+ function apply(node) {
195
+ const members = node.v;
196
+ const op = keyfind(members, 'op').v;
197
+ if (ARG_OPS.includes(op)) {
198
+ const args = keyfind(members, 'args').v;
199
+ const values = [];
200
+ for (const arg of args) {
201
+ const result = apply(arg);
202
+ if (!result.ok)
203
+ return result;
204
+ values.push(result.v);
205
+ }
206
+ return { ok: true, v: op === 'not' ? !values[0] : op === 'and' ? values.every(Boolean) : values.some(Boolean) };
207
+ }
208
+ const actual = resolve(keyfind(members, 'path'));
209
+ if (op === 'present' || op === 'absent')
210
+ return { ok: true, v: op === 'present' ? actual !== null : actual === null };
211
+ if (actual === null)
212
+ return { ok: false, e: 'predicate_path_unresolved' };
213
+ if (op === 'in')
214
+ return { ok: true, v: keyfind(members, 'values').v.some(v => schemaEqual(actual, v)) };
215
+ const wanted = keyfind(members, 'value');
216
+ if (op === 'eq' || op === 'ne')
217
+ return { ok: true, v: op === 'eq' ? schemaEqual(actual, wanted) : !schemaEqual(actual, wanted) };
218
+ let order;
219
+ if ((actual.t === 'int' || actual.t === 'float') && (wanted.t === 'int' || wanted.t === 'float'))
220
+ order = actual.v < wanted.v ? -1 : actual.v > wanted.v ? 1 : 0;
221
+ else if (actual.t === 'str' && wanted.t === 'str')
222
+ order = Buffer.compare(Buffer.from(actual.v), Buffer.from(wanted.v));
223
+ else
224
+ return { ok: false, e: 'predicate_path_unresolved' };
225
+ return { ok: true, v: op === 'lt' ? order < 0 : op === 'lte' ? order <= 0 : op === 'gt' ? order > 0 : order >= 0 };
226
+ }
227
+ }
228
+ import { equal as schemaEqual } from './schema.js';
@@ -0,0 +1,37 @@
1
+ import * as blueprint from './blueprint.ts';
2
+ import * as deployment from './deployment.ts';
3
+ import * as negotiation from './negotiation.ts';
4
+ import * as signature from './signature.ts';
5
+ type Failure = {
6
+ ok: false;
7
+ e: string;
8
+ subject?: (string | number)[];
9
+ };
10
+ export interface Inputs {
11
+ hostBounds: Record<string, unknown>;
12
+ support: negotiation.Support;
13
+ keys: signature.PublicKey[];
14
+ protectedClamp: 'deny' | 'acknowledge';
15
+ observations: deployment.Observations;
16
+ }
17
+ export interface Check {
18
+ surface: string;
19
+ subject: (string | number)[];
20
+ verified: boolean;
21
+ detail: unknown;
22
+ }
23
+ export interface Evidence {
24
+ protocol_revision: number;
25
+ blueprint_digest: string;
26
+ deployment_digest: string;
27
+ checks: Check[];
28
+ effective_bounds: Record<string, unknown>;
29
+ clamps: unknown[];
30
+ optional_extensions_retained: string[];
31
+ not_verified: string[];
32
+ }
33
+ export declare function reconcile(bp: blueprint.Blueprint, dep: deployment.Deployment, inputs: Inputs): {
34
+ ok: true;
35
+ v: Evidence;
36
+ } | Failure;
37
+ export {};