@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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "rule": "case-file-index",
3
3
  "ruleVersion": 2,
4
- "statement": "How a reader compares a case file's index, contents.json, with the folder it sits at the root of (evidence-bundle.md §5.6.3 v1.20, A25). The index is never an input to the case reading, and no finding here moves a verdict, a note, a contribution or an exit code. Findings come in this order: case_index_unreadable (and nothing else), case_index_pack_missing, case_index_pack_unlisted, case_index_file_missing, case_index_file_unlisted, case_index_file_differs, case_index_file_too_large, case_index_names_absent; within a kind by the UTF-8 bytes of the ref or path, and names_absent in the index's own order. Only files under a listed pack's folder or under report/ are reported as unlisted.",
4
+ "statement": "How a reader compares a case file's index, contents.json, with the folder it sits at the root of (evidence-bundle.md §5.6.3). The index is never an input to the case reading, and no finding here moves a verdict, a note, a contribution or an exit code. Findings come in this order: case_index_unreadable (and nothing else), case_index_pack_missing, case_index_pack_unlisted, case_index_file_missing, case_index_file_unlisted, case_index_file_differs, case_index_file_too_large, case_index_names_absent; within a kind by the UTF-8 bytes of the ref or path, and names_absent in the index's own order. Only files under a listed pack's folder or under report/ are reported as unlisted.",
5
5
  "howToUse": "Call readCaseFileIndex / read_case_file_index with the bytes of index_hex (null: no index in the folder) and `files`, and compare the result with `expected`. A finding lists only the fields it carries.",
6
6
  "rows": [
7
7
  {
@@ -1,5 +1,5 @@
1
1
  {
2
- "description": "How `case` reads folders into packs: the verify page's splitting rule (sanning-io/verify-page src/lib/case.ts splitCase, src/lib/pack.ts assemble) over a walk whose rules are the command's own, and the bundle.json reader that verify and case share. Restated in both kernels and pinned here. Written by tools/gen-vectors/gen_case_split_vectors.py, whose expectations are literals, not kernel output. A tree row lists what to create under an empty folder <root>: a file (path, hex), a folder (dir), a symbolic link (symlink, its target as written), a file whose path is bytes (path_hex), or `files` empty files in a folder (fill). `args` are paths under <root>, and <root> in an expected error stands for that folder. File contents are lowercase hex.",
2
+ "description": "How `case` reads folders into packs: the verify page's splitting rule (splitCase, assemble) over a walk whose rules are the command's own, and the bundle.json reader that verify and case share. Restated in both kernels and pinned here. Written by tools/gen-vectors/gen_case_split_vectors.py, whose expectations are literals, not kernel output. A tree row lists what to create under an empty folder <root>: a file (path, hex), a folder (dir), a symbolic link (symlink, its target as written), a file whose path is bytes (path_hex), or `files` empty files in a folder (fill). `args` are paths under <root>, and <root> in an expected error stands for that folder. File contents are lowercase hex.",
3
3
  "limits": {
4
4
  "max_json_depth": 512,
5
5
  "max_walk_depth": 32,
@@ -230,7 +230,7 @@
230
230
  "args": [
231
231
  "pack.zip"
232
232
  ],
233
- "description": "A .zip named on the command line is read as a case file (evidence-bundle §5.6, v1.20 A25): <name>.zip is read at <name>/<entry>, the folder unzip <name>.zip -d <name> makes, so the archive and its unpacked folder give one reading.",
233
+ "description": "A .zip named on the command line is read as a case file (evidence-bundle §5.6): <name>.zip is read at <name>/<entry>, the folder unzip <name>.zip -d <name> makes, so the archive and its unpacked folder give one reading.",
234
234
  "expected": {
235
235
  "not_regular": [],
236
236
  "outside": [],
@@ -11,7 +11,7 @@
11
11
  "null": "In prev_event_id: this record claims to begin its adapter chain.",
12
12
  "publicKey": "An alias, not a real Ed25519 key. The reader treats it as an opaque grouping token — a chain is one head per (public_key, chain_key), profile section 3.2 — so only its distinctness is load-bearing."
13
13
  },
14
- "adapterNamespaces": "Verified against sanning-io/anchor @ main, 2026-09-07: `run` (LangChain callbacks, TS and Python — anchor#68 promoted this out of the old `langchain` namespace), `vercel_ai` (Vercel AI SDK middleware), `interchange` (Interchange adapter). All three carry `prev_event_id` and `seq`; their chain key is `root_run_id`, `chain_key` and `session_id` respectively. These are read ONLY where the record carries no chain of its own, and they are transitional: once every adapter sets the record's own previous_hash, a reader needs no adapter knowledge at all.",
14
+ "adapterNamespaces": "As written by the @sanning/anchor SDK: `run` (LangChain callbacks, TS and Python), `vercel_ai` (Vercel AI SDK middleware), `interchange` (Interchange adapter). All three carry `prev_event_id` and `seq`; their chain key is `root_run_id`, `chain_key` and `session_id` respectively. These are read ONLY where the record carries no chain of its own, and they are transitional: once every adapter sets the record's own previous_hash, a reader needs no adapter knowledge at all.",
15
15
  "recordScaffold": {
16
16
  "payload_version": 1,
17
17
  "spec_version": "sanning.events/v2",
@@ -165,7 +165,7 @@
165
165
  },
166
166
  {
167
167
  "id": "intact-adapter-chain-run",
168
- "why": "the batched LangChain path writes its linkage only in metadata; its records all say GENESIS and carry no chain_key. Three of them must read as ONE chain with nothing to report — not as three roots of a fictional one. The namespace is `run`, not `langchain`: anchor#68 moved it, and a reader still pinned on the old name would find no chain here and report nothing, which is indistinguishable from a clean bundle.",
168
+ "why": "the batched LangChain path writes its linkage only in metadata; its records all say GENESIS and carry no chain_key. Three of them must read as ONE chain with nothing to report — not as three roots of a fictional one. The namespace is `run`, not `langchain`: a reader pinned on the name `langchain` would find no chain here and report nothing, which is indistinguishable from a clean bundle.",
169
169
  "events": [
170
170
  { "id": "e1", "publicKey": "kA", "previous_hash": "GENESIS", "context": {}, "metadata": { "run": { "run_id": "r1", "parent_run_id": null, "root_run_id": "root-1", "seq": 0, "prev_event_id": null } } },
171
171
  { "id": "e2", "publicKey": "kA", "previous_hash": "GENESIS", "context": {}, "metadata": { "run": { "run_id": "r2", "parent_run_id": "r1", "root_run_id": "root-1", "seq": 1, "prev_event_id": "@e1" } } },
@@ -180,7 +180,7 @@
180
180
  },
181
181
  {
182
182
  "id": "adapter-chain-one-event-dropped-run",
183
- "why": "a deletion on the adapter path shows twice, and both are worth saying: the pointer dangles AND the sequence has a hole. anchor's own comment is that the slot is burned BEFORE the hash, so a dropped event consumed a seq number and leaves a permanent gap.",
183
+ "why": "a deletion on the adapter path shows twice, and both are worth saying: the pointer dangles AND the sequence has a hole. the adapter burns the slot BEFORE the hash, so a dropped event consumed a seq number and leaves a permanent gap.",
184
184
  "events": [
185
185
  { "id": "e1", "publicKey": "kA", "previous_hash": "GENESIS", "context": {}, "metadata": { "run": { "run_id": "r1", "parent_run_id": null, "root_run_id": "root-1", "seq": 0, "prev_event_id": null } } },
186
186
  { "id": "e2", "publicKey": "kA", "previous_hash": "GENESIS", "context": {}, "metadata": { "run": { "run_id": "r2", "parent_run_id": "r1", "root_run_id": "root-1", "seq": 1, "prev_event_id": "@e1" } } },