@sanning/proof 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +30 -29
  2. package/dist/agent-record.d.ts +62 -0
  3. package/dist/agent-record.js +527 -0
  4. package/dist/agent-schemas.generated.d.ts +15 -0
  5. package/dist/agent-schemas.generated.js +5759 -0
  6. package/dist/case-file.d.ts +32 -89
  7. package/dist/case-file.js +41 -93
  8. package/dist/case.d.ts +343 -810
  9. package/dist/case.js +693 -1151
  10. package/dist/chain.d.ts +19 -47
  11. package/dist/chain.js +78 -205
  12. package/dist/claims.d.ts +211 -0
  13. package/dist/claims.js +1081 -0
  14. package/dist/cli.d.ts +45 -68
  15. package/dist/cli.js +618 -1022
  16. package/dist/compose.js +23 -65
  17. package/dist/crypto.d.ts +7 -8
  18. package/dist/crypto.js +60 -147
  19. package/dist/declaration.d.ts +68 -194
  20. package/dist/declaration.js +175 -518
  21. package/dist/environment.d.ts +9 -30
  22. package/dist/environment.js +17 -66
  23. package/dist/evidence.d.ts +119 -160
  24. package/dist/evidence.js +744 -1103
  25. package/dist/exit-codes.d.ts +11 -27
  26. package/dist/exit-codes.js +24 -59
  27. package/dist/file-match.d.ts +33 -79
  28. package/dist/file-match.js +33 -69
  29. package/dist/grading.d.ts +98 -135
  30. package/dist/grading.js +224 -380
  31. package/dist/handoff.d.ts +62 -160
  32. package/dist/handoff.js +153 -393
  33. package/dist/index.d.ts +14 -10
  34. package/dist/index.js +60 -167
  35. package/dist/json-schema.d.ts +29 -0
  36. package/dist/json-schema.js +298 -0
  37. package/dist/merkle.js +16 -28
  38. package/dist/message-parts.d.ts +56 -212
  39. package/dist/message-parts.js +142 -502
  40. package/dist/side-content.d.ts +11 -22
  41. package/dist/side-content.js +22 -65
  42. package/dist/types.d.ts +17 -0
  43. package/dist/types.js +19 -5
  44. package/dist/verifier.d.ts +40 -114
  45. package/dist/verifier.js +196 -535
  46. package/dist/witness-cache.d.ts +24 -45
  47. package/dist/witness-cache.js +38 -81
  48. package/dist/witness-lookup.d.ts +36 -57
  49. package/dist/witness-lookup.js +89 -139
  50. package/dist/zip-reader.d.ts +18 -33
  51. package/dist/zip-reader.js +19 -34
  52. package/package.json +11 -3
  53. package/src/agent-record.ts +608 -0
  54. package/src/agent-schemas.generated.ts +5764 -0
  55. package/src/case-file.ts +45 -109
  56. package/src/case.ts +848 -1322
  57. package/src/chain.ts +85 -224
  58. package/src/claims.ts +1253 -0
  59. package/src/cli.ts +714 -1176
  60. package/src/compose.ts +33 -79
  61. package/src/crypto.ts +60 -147
  62. package/src/declaration.ts +219 -656
  63. package/src/environment.ts +17 -65
  64. package/src/evidence.ts +958 -1381
  65. package/src/exit-codes.ts +24 -63
  66. package/src/file-match.ts +40 -89
  67. package/src/grading.ts +287 -421
  68. package/src/handoff.ts +175 -427
  69. package/src/index.ts +132 -177
  70. package/src/json-schema.ts +295 -0
  71. package/src/merkle.ts +16 -28
  72. package/src/message-parts.ts +155 -533
  73. package/src/side-content.ts +25 -68
  74. package/src/types.ts +55 -36
  75. package/src/verifier.ts +202 -526
  76. package/src/witness-cache.ts +45 -94
  77. package/src/witness-lookup.ts +107 -177
  78. package/src/zip-reader.ts +20 -38
  79. package/vectors/README.md +52 -34
  80. package/vectors/agent-record.json +2175 -0
  81. package/vectors/case-file-index.json +1 -1
  82. package/vectors/case-split.json +2 -2
  83. package/vectors/chain-reading.json +3 -3
  84. package/vectors/file-match.json +285 -148
  85. package/vectors/jcs-reader.json +6 -6
  86. package/vectors/pack-grading.json +102 -25
  87. package/vectors/sandbox-evidence.json +597 -580
  88. package/vectors/stamp-on-chain.json +18 -18
  89. package/vectors/witness-cache.json +49 -49
  90. package/dist/agent-proof.d.ts +0 -28
  91. package/dist/agent-proof.js +0 -226
  92. package/dist/run-adapters.d.ts +0 -10
  93. package/dist/run-adapters.js +0 -35
  94. package/dist/run.d.ts +0 -209
  95. package/dist/run.js +0 -1405
  96. package/src/agent-proof.ts +0 -264
  97. package/src/run-adapters.ts +0 -44
  98. package/src/run.ts +0 -1598
package/src/index.ts CHANGED
@@ -1,39 +1,23 @@
1
- // @sanning/proof — TypeScript kernel of the Sanning verification stack.
2
- //
3
- // The verification primitives for the Verifiable Event Envelope family
4
- // (specs/envelope-spec.md), sanning.agent/v1 profile: RFC 8785 (JCS)
5
- // canonicalization, SHA-256, Ed25519 envelope verification, and the
6
- // content-hash extraction used for reverse provenance lookup. Sibling of the
7
- // Python `sanning-proof` kernel and the Go `pkg/proof` reference; conformance
8
- // is byte-for-byte against the shared `test-vectors/` corpus.
9
- //
10
- // Scope boundary (envelope-spec §10 #13): this package verifies a SINGLE
11
- // envelope. Chain walking (previous_hash), checkpoint reconciliation, and
12
- // gateway/transport concerns are consumer-layer logic composed above it.
1
+ // @sanning/proof: the TypeScript verification kernel for the Verifiable Event
2
+ // Envelope family (specs/envelope-spec.md): RFC 8785 (JCS), SHA-256, Ed25519
3
+ // envelope verification, and the bundle, pack and case readings built on them.
4
+ // Conformance is byte-for-byte against the shared `test-vectors/` corpus.
13
5
 
14
- // ACCEPTED_SPEC_MAJORS is exported for parity with the sibling kernels'
15
- // registries (Python ACCEPTED_SPEC_MAJORS, Go SupportedSpecMajor): a consumer
16
- // can see which profiles this build admits without inferring it from probe
17
- // calls. It is frozen at its definition (`Object.freeze`, typed
18
- // `readonly string[]`) because the verifier reads that same array — an exported
19
- // mutable accept-set would be a runtime-widenable kernel. Additive — no
20
- // existing export changes.
6
+ // The accept-set this build admits. Frozen at its definition, because the
7
+ // verifier reads the same array.
21
8
  export {
22
9
  ACCEPTED_SPEC_MAJORS,
23
10
  contentHashes,
24
11
  jcs,
25
12
  specVersionSupported,
26
13
  verifyEnvelope,
14
+ envelopeFault,
15
+ envelopeFaults,
27
16
  } from "./verifier.js";
28
- // The strict reader of bytes that claim to be JCS, the twin of Python's public
29
- // `canonicalize.jcs_loads`. The enclave attestation adapters read a token's
30
- // JSON through it, so they refuse what the kernel refuses. Additive.
17
+ export { ENVELOPE_FAULTS } from "./types.js";
18
+ export type { EnvelopeFault } from "./types.js";
19
+ // The strict reader of bytes that claim to be JCS (Python's `jcs_loads`).
31
20
  export { jcsParse } from "./verifier.js";
32
- // The same reader within the enclave readers' limits (enclave-attestation
33
- // section 2.1): depth checked on the bytes first, every number finite. The
34
- // adapters read a token's header and claims and the manifest through it.
35
- // Additive.
36
- export { exceedsTextDepth, hasNonFiniteNumber, jcsParseWithinLimits, MAX_READ_DEPTH } from "./verifier.js";
37
21
  export {
38
22
  bytesToHex,
39
23
  deriveOperatorAddress,
@@ -55,20 +39,10 @@ export {
55
39
  } from "./merkle.js";
56
40
  export type { ContentRole, Envelope, Subject, VerificationResult, VerifyOptions } from "./types.js";
57
41
 
58
- // Evidence-bundle verification (specs/evidence-bundle.md): the signed
59
- // sanning.evidence/v1 wrapper carrying the sanning.anchor.trace/v3 body. The CLI
60
- // (`npx @sanning/proof verify`) is built on this. The same path dispatches on the
61
- // issuer-composed sanning.evidence.export/v2 body (specs/evidence-export.md) to
62
- // verifyExportBody (embedded RSA-PSS operator attestations + a recomputed §4
63
- // verdict object with per-gateway on-chain outcomes).
64
- //
65
- // `disclosedContent` is the INGEST half of the same path (evidence-bundle
66
- // §5.1). A received bundle carries its disclosed raw bytes as lowercase hex, so
67
- // materializing them was, until now, every consumer re-implementing the
68
- // encoding convention — and a consumer that copied the field VERBATIM wrote
69
- // files that failed verification on genuine evidence. This hands back DECODED
70
- // bytes, and only for events whose verification bound them to the committed
71
- // content_hash. Additive; verifyEvidenceBundle's behavior is unchanged.
42
+ // Evidence-bundle verification (specs/evidence-bundle.md), including the
43
+ // sanning.evidence.export/v2 body (specs/evidence-export.md).
44
+ // `disclosedContent` returns decoded disclosed bytes, only for events whose
45
+ // verification bound them to the committed content_hash.
72
46
  export {
73
47
  ACCEPTED_EVIDENCE_MAJORS,
74
48
  ANCHOR_TRACE_BODY_TYPE,
@@ -96,7 +70,6 @@ export type {
96
70
  EvidenceBundleResult,
97
71
  EvidenceIssuer,
98
72
  EvidenceStatus,
99
- EvidenceVerdict,
100
73
  EventResult,
101
74
  ExportBody,
102
75
  ExportResult,
@@ -125,21 +98,9 @@ export type {
125
98
  VerifyEvidenceOptions,
126
99
  } from "./evidence.js";
127
100
 
128
- // Pack grading (src/grading.ts): what a verification SURFACE may claim about a
129
- // pack — the signed bundle PLUS whatever disclosed bytes travelled beside it.
130
- //
131
- // The rule is already normative in evidence-bundle.md §5.1 (absent disclosure is
132
- // undetermined, not failed) and §6 (no status ever means "safe"); what the
133
- // surfaces added on top was a sharper word for undetermined and an account of
134
- // what the pack failed to disclose. It lived twice, in two repos and two
135
- // languages, and the two derivations had already diverged once. It lives here.
136
- //
137
- // Pure — data in, data out, no I/O, so the kernel's scope boundary
138
- // (specs/architecture.md §3) is unchanged. `vectors/pack-grading.json` is the
139
- // conformance statement of the rule and ships in the published tarball, so a
140
- // consumer that cannot yet import `gradePack` can vendor the table, hold its own
141
- // derivation to it, and diff its copy against ours. Additive — no existing
142
- // export changes.
101
+ // Pack grading: what a verification surface may claim about a pack and the
102
+ // disclosed bytes beside it (evidence-bundle.md §5.1, §6). Pure.
103
+ // `vectors/pack-grading.json` states the rule for consumers to test against.
143
104
  export {
144
105
  PACK_GRADE_CAUSE_KINDS,
145
106
  PACK_VERDICTS,
@@ -160,22 +121,9 @@ export type {
160
121
  PackVerdict,
161
122
  } from "./grading.js";
162
123
 
163
- // The declaration (src/declaration.ts): what a pack SAYS it holds, checked
164
- // against what it does (evidence-bundle.md §5.4).
165
- //
166
- // Every other check in this kernel checks a record that is PRESENT, so a pack
167
- // with half its records dropped verifies perfectly and an auditor cannot tell
168
- // a full hand-over from a trimmed one. The declaration is the pack's own
169
- // statement of what it was meant to contain, inside `body` and therefore under
170
- // the bundle's signature. Any deviation FAILS and every deviation is NAMED; a
171
- // pack that carries no declaration is `partial`, never `verified`; and a
172
- // reading that rests on the UNSIGNED content handed in beside the pack is
173
- // named on its own and carries the weaker word, because whoever assembles a
174
- // case chose those bytes (proof#147).
175
- //
176
- // Pure: data in, data out, no I/O. `gradePack` takes the result as an
177
- // optional fourth argument, so a surface gets one verdict; omitting it is the
178
- // pre-§5.4 behavior, unchanged. Additive: no existing export changes.
124
+ // The declaration: what a pack says it holds, checked against what it does
125
+ // (evidence-bundle.md §5.4). Pure. `gradePack` takes the result as an optional
126
+ // fourth argument.
179
127
  export {
180
128
  DECLARATION_CONTENT_KINDS,
181
129
  DECLARATION_DEVIATION_KINDS,
@@ -208,23 +156,10 @@ export type {
208
156
  PackRecord,
209
157
  } from "./declaration.js";
210
158
 
211
- // The case (src/case.ts): one verdict over SEVERAL packs, across organizations
212
- // (anchor#198). The layer above the declaration, and the closure for what a
213
- // declaration cannot reach.
214
- //
215
- // A pack a party assembles about itself is not self-proving about what that
216
- // party LEFT OUT (envelope-spec.md §4.1 A15, evidence-bundle.md §5.4.2 rule 7),
217
- // because the omission happens before any reader runs. Reading several parties'
218
- // packs at once is what closes it: a `handoff.sent` with no counterpart is
219
- // always named, and where a pack signed by the key it names is in the case, the
220
- // reading says that pack holds no counterpart (unless every candidate was
221
- // accounted for under A20, which reads as no counterpart and names no pack). Whether a party that presented
222
- // no such pack recorded anything is not established (proof#143). `readCase`
223
- // verifies every pack itself, offline, so it is async. Matching is on keys and hashes alone and NEVER on tenancy, so a pair from two
224
- // organizations verifies (DL-60).
225
- //
226
- // Pure: data in, data out, no I/O. Additive: a new module, no existing export
227
- // changes, and no new verdict word anywhere.
159
+ // The case: one verdict over several parties' packs, closing what a single
160
+ // pack cannot prove about its own omissions (evidence-bundle.md §5.5).
161
+ // Matching is on keys and hashes alone, never tenancy, so a pair across two
162
+ // organizations verifies. `readCase` verifies every pack itself, offline.
228
163
  export {
229
164
  CASE_BODY_TYPES,
230
165
  CASE_EXCEPTION_KINDS,
@@ -234,6 +169,7 @@ export {
234
169
  CASE_NOTE_KINDS,
235
170
  CASE_RELIANCE,
236
171
  CASE_RELIANCE_HANDOFF_CLAUSE,
172
+ CASE_RELIANCE_SANDBOX,
237
173
  CASE_VERDICTS,
238
174
  CONTENT_WITHHELD_BY_DECLARATION,
239
175
  CO_SIGNATURES_PRESENT,
@@ -242,6 +178,7 @@ export {
242
178
  WITNESS_STATES,
243
179
  WITNESS_TIME_CACHED,
244
180
  WITNESS_TIME_RECORDED,
181
+ caseProblems,
245
182
  caseReliance,
246
183
  readCase,
247
184
  renderCaseNote,
@@ -249,8 +186,8 @@ export {
249
186
  renderException,
250
187
  renderWitnessLine,
251
188
  } from "./case.js";
252
- // The witnessed-time cache (evidence-bundle 5.6.6, v1.25, A30): read it, look it
253
- // up, print it. Never an input to a verdict.
189
+ // The witnessed-time cache (evidence-bundle.md §5.6.6). Never an input to a
190
+ // verdict.
254
191
  export {
255
192
  MAX_BLOCK_TIME,
256
193
  MAX_WITNESS_CACHE_DEPTH,
@@ -264,21 +201,73 @@ export {
264
201
  } from "./witness-cache.js";
265
202
  export type { CachedWitnessTime, WitnessTimeAnswer, WitnessTimeCheck } from "./witness-cache.js";
266
203
 
267
- // The public-record (witness) lookup the CLI runs with `--gateways`
268
- // (src/witness-lookup.ts, proof#200): moved out of the CLI so a consumer
269
- // that is not the CLI, the verify page, calls the SAME implementation
270
- // rather than keeping its own copy (verify-page#70). Pure kernel scope: the
271
- // one network call lives in `lookupPublicRecord` and `onChainHalf`, runs
272
- // only when a caller hands in a gateway, and goes through `options.fetchImpl`
273
- // where a caller supplies one (a browser page's own `fetch`) or the ambient
274
- // global `fetch` otherwise, so this export runs in a browser exactly as it
275
- // runs in Node. `onChainHalf` and `witnessLine` are the CLI's own unchanged
276
- // building blocks; `lookupPublicRecord` is the new one-call, four-state entry
277
- // point a page wants, additive over both. `confirmed` from
278
- // `lookupPublicRecord` is a claim about the BYTES only, never about whether
279
- // the pack itself verifies, and a caller must never show it apart from the
280
- // pack's own verdict.
281
- export { lookupPublicRecord, onChainHalf, witnessLine } from "./witness-lookup.js";
204
+ // The public-record lookup behind `--gateways`. The only network call runs when
205
+ // a caller hands in a gateway, through `options.fetchImpl` or the global
206
+ // `fetch`, so it runs in a browser. `confirmed` is a claim about the bytes
207
+ // only: never show it apart from the pack's own verdict.
208
+ export {
209
+ lookupPublicRecord,
210
+ onChainHalf,
211
+ onChainOutcome,
212
+ onChainRow,
213
+ witnessLine,
214
+ } from "./witness-lookup.js";
215
+
216
+ // Six claims, three verdicts, and the person layer (evidence-bundle.md section 3): every
217
+ // detailed kind maps to one claim and one state, and the verdict is read off the claims.
218
+ export {
219
+ CLAIMS,
220
+ CLAIM_LABELS,
221
+ CLAIM_QUESTIONS,
222
+ CLAIM_STATES,
223
+ ENVELOPE_FAULT_KINDS,
224
+ KIND_CLAIMS,
225
+ NOTE_FINDINGS,
226
+ NOTE_ORDER,
227
+ NOT_IN_SCOPE_REASONS,
228
+ NOT_PROVEN_REASONS,
229
+ PERSON_TITLES,
230
+ PERSON_TITLE_PARTS,
231
+ REASON_KINDS,
232
+ RECORD_REASON_CLAIMS,
233
+ RECORD_REASON_LINES,
234
+ SANDBOX_PERSON_LINE,
235
+ VERDICTS,
236
+ VERDICT_COLOURS,
237
+ VERDICT_TITLES,
238
+ bundleProblems,
239
+ claimsOf,
240
+ downgraded,
241
+ note,
242
+ orderedNotes,
243
+ restOnSigned,
244
+ personText,
245
+ problem,
246
+ problemToJson,
247
+ renderFindingNote,
248
+ renderPerson,
249
+ verdictOf,
250
+ withItems,
251
+ } from "./claims.js";
252
+ export type {
253
+ Claim,
254
+ ClaimEntry,
255
+ ClaimItem,
256
+ ClaimState,
257
+ Labels,
258
+ LinePart,
259
+ NoteEntry,
260
+ NotInScopeReason,
261
+ NotProvenReason,
262
+ Person,
263
+ Problem,
264
+ ProblemItem,
265
+ ProblemJson,
266
+ ProblemValues,
267
+ ReasonKind,
268
+ Verdict,
269
+ VerdictJson,
270
+ } from "./claims.js";
282
271
  export type {
283
272
  OnChainHalf,
284
273
  OnChainRow,
@@ -303,9 +292,8 @@ export type {
303
292
  WitnessState,
304
293
  } from "./case.js";
305
294
 
306
- // The case file's index (src/case-file.ts, evidence-bundle.md §5.6, A25):
307
- // compared with the drop it describes, with NO verdict contribution. The index
308
- // is never an input to `readCase`. Pure: bytes and a file list in.
295
+ // The case file's index (evidence-bundle.md §5.6), compared with the drop it
296
+ // describes. Never an input to `readCase` or any verdict.
309
297
  export {
310
298
  CASE_FILE_FINDING_KINDS,
311
299
  CASE_FILE_INDEX_NAME,
@@ -323,9 +311,8 @@ export type {
323
311
  CaseFileIndexReading,
324
312
  } from "./case-file.js";
325
313
 
326
- // Files handed in beside a pack (src/file-match.ts, evidence-bundle.md §5.7,
327
- // A29, proof#92): each file's SHA-256 matched against the commitments the
328
- // pack's SIGNED records make, by hash alone. Never moves a verdict.
314
+ // Files handed in beside a pack (evidence-bundle.md §5.7), matched by SHA-256
315
+ // against the pack's signed commitments. Never moves a verdict.
329
316
  export {
330
317
  FILE_MATCH_SCOPE,
331
318
  NOT_READ_REASONS,
@@ -349,29 +336,11 @@ export type {
349
336
  UnmatchedFile,
350
337
  } from "./file-match.js";
351
338
 
352
- // Chain reading (src/chain.ts): following the pointer every sanning.events/v2
353
- // record carries to the record before it, over the records ONE bundle presents.
354
- //
355
- // Every anchored event has carried that pointer since the profile was ratified
356
- // and nothing we shipped read it, so a bundle with an event removed — and a
357
- // chain that restarted after a crash and now asserts two beginnings — passed
358
- // every check we had (proof#43). The verifier was right not to do this: it
359
- // verifies a single envelope and says so. Nothing above it did it either.
360
- //
361
- // Pure — data in, data out, no I/O — so the kernel's scope boundary
362
- // (specs/architecture.md §3) is unchanged, and the rule ships as
363
- // `vectors/chain-reading.json` beside the pack-grading table for the same
364
- // reason: a rule consumers must agree with needs a statement they can fetch.
365
- //
366
- // It returns FINDINGS, never a verdict, and it feeds no status on its own: a
367
- // pack's signed v3 declaration can claim a chain complete and in order, and
368
- // `checkDeclaration` holds that claim to the links `readChainLinks` reads
369
- // (evidence-bundle.md 5.4.2 rule 11). Chain links are
370
- // deletion/reorder-evidence for the events present and NOT a completeness proof
371
- // (`anchor/docs/profile-sanning.events-v2.md` §5), drop the last N events of a
372
- // chain and nothing dangles. `CHAIN_READING_SCOPE` is that sentence, exported so
373
- // every surface prints the same limit rather than paraphrasing it into a claim.
374
- // Additive — no existing export changes.
339
+ // Chain reading: findings over the `previous_hash` links one bundle presents,
340
+ // never a verdict and never a completeness proof. `CHAIN_READING_SCOPE` is the
341
+ // sentence every surface prints beside them. `vectors/chain-reading.json`
342
+ // states the rule; a v3 declaration's chain claim is checked against
343
+ // `readChainLinks` (evidence-bundle.md §5.4.2 rule 11).
375
344
  export {
376
345
  ADAPTER_CHAIN_NAMESPACES,
377
346
  CHAIN_READING_SCOPE,
@@ -388,55 +357,31 @@ export type {
388
357
  ChainSummary,
389
358
  } from "./chain.js";
390
359
 
391
- // The `proof export` composer (specs/evidence-export.md §5, phase 2): produce a
392
- // signed, offline-verifiable sanning.evidence.export/v2 artifact from a source
393
- // anchor-trace bundle + operator attestations + an exporter Ed25519 key. The
394
- // inverse of verifyEvidenceBundle's verifyExportBody dispatch.
395
- // One exit-code table for every verb (0.13.0): the verdict word to the exit
396
- // code, and the help text every verb prints. Additive.
360
+ // The `proof export` composer (specs/evidence-export.md §5): a signed,
361
+ // offline-verifiable sanning.evidence.export/v2 artifact. Also the one
362
+ // exit-code table and help text every verb uses.
397
363
  export {
398
364
  EXIT_CODES,
399
365
  EXIT_CODES_HELP,
366
+ EXIT_COULD_NOT_RUN,
400
367
  EXIT_FAILED,
401
- EXIT_MALFORMED,
402
- EXIT_MIXED,
368
+ EXIT_INCOMPLETE,
403
369
  EXIT_SANDBOX,
404
- EXIT_UNDETERMINED,
405
370
  EXIT_VERIFIED,
406
371
  exitCodeFor,
407
- sandboxExit,
408
372
  } from "./exit-codes.js";
409
- // Sandbox evidence: the environment marker over the envelopes a pack or case
410
- // holds (envelope-spec §2, the `environment_marker` MAY), and the headline and
411
- // line both commands print for it. Additive.
373
+ // Sandbox evidence: the environment marker over a pack's or case's envelopes
374
+ // (envelope-spec section 2).
412
375
  export {
413
- SANDBOX_HEADLINE,
414
- SANDBOX_LINE,
415
- SANDBOX_TITLE,
416
376
  environmentMarker,
417
- onlySimulatedUnsettled,
418
377
  packEnvelopes,
419
378
  } from "./environment.js";
420
379
  export type { EnvironmentMarker } from "./environment.js";
421
380
  export { attestationSignatureToHex, composeExport } from "./compose.js";
422
381
  export type { ComposeExportOptions, ComposeExportResult, ExporterKey } from "./compose.js";
423
382
 
424
- // Agent inclusion-proof bundle verification: the
425
- // sanning.agent.proof/v1 bundle. The CLI sniffs spec_version and routes here so
426
- // one verifier covers both agent and anchor bundles.
427
- export { AGENT_PROOF_SPEC_VERSION, isAgentProofSpec, verifyAgentProof } from "./agent-proof.js";
428
- export type {
429
- AgentProofBundle,
430
- AgentProofResult,
431
- VerifyAgentProofOptions,
432
- } from "./agent-proof.js";
433
-
434
- // The hand-off pairing rule (src/handoff.ts): which records are candidates to
435
- // be the counterpart of a hand-off record, how a candidate set of more than one
436
- // is ordered, and what a formed pair grades to (specs/envelope-spec.md §4.1
437
- // v1.9, proof#132 and proof#136). The Python half is src/sanning_proof/handoff.py and the two
438
- // answer identically on identical bytes. Additive: a new module, and no
439
- // existing export changes.
383
+ // The hand-off pairing rule (envelope-spec.md §4.1). The Python half answers
384
+ // identically on identical bytes.
440
385
  export {
441
386
  CANDIDATE_NAMESPACE,
442
387
  DEFINED_EVENT_TYPES,
@@ -444,7 +389,9 @@ export {
444
389
  isConformantHandoffRecord,
445
390
  readHandoff,
446
391
  readHandoffs,
392
+ recordDefect,
447
393
  recordIsMalformed,
394
+ recordIsNonconforming,
448
395
  } from "./handoff.js";
449
396
  export type {
450
397
  CandidateReading,
@@ -454,14 +401,9 @@ export type {
454
401
  HeldRecord,
455
402
  } from "./handoff.js";
456
403
 
457
- // A file part's BYTES (src/message-parts.ts): what a file part is, and what a
458
- // receiver that HOLDS a part's bytes commits to (envelope-spec.md section 4.1
459
- // v1.13, A18, proof#145). A receiver that holds the bytes hashes them and, on a
460
- // mismatch, commits to the message AS IT HELD IT, so the pair fails on
461
- // `message_hash` rather than verifying over bytes nobody checked. The Python
462
- // half is src/sanning_proof/message_parts.py and the two are held together by
463
- // cross-kernel/run_parts.sh. Pure: it neither canonicalizes nor hashes the
464
- // message.
404
+ // File parts (envelope-spec.md §4.1): a receiver holding a part's bytes
405
+ // commits to the message as it held it, so a mismatch fails on `message_hash`
406
+ // rather than verifying over unchecked bytes.
465
407
  export {
466
408
  BYTES_FOR_UNKNOWN_PART,
467
409
  CONFLICTING_PART_BYTES,
@@ -483,3 +425,16 @@ export {
483
425
  uncheckedHeldParts,
484
426
  } from "./message-parts.js";
485
427
  export type { HeldMessage, Note, PartReading, Refusal, SuppliedPart } from "./message-parts.js";
428
+
429
+ // Reading a sanning.agent record (vendor/specs/agent-events.md §10) against
430
+ // the schemas bundled from the pinned specs release: no file read, no fetch.
431
+ export {
432
+ AGENT_EVENT_TYPES,
433
+ RECORD_TYPES_OUTSIDE_AGENT,
434
+ readAgentRecord,
435
+ readAgentRecordWithHeld,
436
+ readAgentRecords,
437
+ renderAgentReading,
438
+ } from "./agent-record.js";
439
+ export type { AgentHeldRecord, AgentReason, AgentRecordReading, AgentVerdict } from "./agent-record.js";
440
+ export { AGENT_SCHEMA_PIN, AGENT_SCHEMA_VERSIONS } from "./agent-schemas.generated.js";