@mnemom/mnemom 0.17.35 → 0.17.37

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 (101) hide show
  1. package/dist/commands/agent-run.d.ts +4 -0
  2. package/dist/commands/agent-run.js +9 -1
  3. package/dist/commands/agent-share-render.js +1 -1
  4. package/dist/commands/scan.d.ts +13 -3
  5. package/dist/commands/scan.js +48 -10
  6. package/dist/host/commands.js +4 -1
  7. package/dist/host/owner.d.ts +2 -0
  8. package/dist/host/verbs.d.ts +16 -1
  9. package/dist/host/verbs.js +45 -3
  10. package/dist/index.js +3 -2
  11. package/dist/lib/config.d.ts +7 -0
  12. package/dist/lib/config.js +21 -0
  13. package/dist/lib/scan/pr-source.js +2 -0
  14. package/dist/lib/scan/repo-picker.d.ts +32 -0
  15. package/dist/lib/scan/repo-picker.js +80 -0
  16. package/dist/vendor/durable-contract/index.js +6 -3
  17. package/dist/vendor/shared/durable-contract/cli-surface.js +2 -2
  18. package/dist/vendor/shared/durable-contract/codes.js +4 -1
  19. package/node_modules/@mnemom/aip-verifier/LICENSE +190 -0
  20. package/node_modules/@mnemom/aip-verifier/dist/claim-lint-CVITIRcU.d.cts +478 -0
  21. package/node_modules/@mnemom/aip-verifier/dist/claim-lint-CVITIRcU.d.ts +478 -0
  22. package/node_modules/@mnemom/aip-verifier/dist/index.cjs +971 -0
  23. package/node_modules/@mnemom/aip-verifier/dist/index.cjs.map +1 -0
  24. package/node_modules/@mnemom/aip-verifier/dist/index.d.cts +330 -0
  25. package/node_modules/@mnemom/aip-verifier/dist/index.d.ts +330 -0
  26. package/node_modules/@mnemom/aip-verifier/dist/index.js +933 -0
  27. package/node_modules/@mnemom/aip-verifier/dist/index.js.map +1 -0
  28. package/node_modules/@mnemom/aip-verifier/dist/render-lines.cjs +879 -0
  29. package/node_modules/@mnemom/aip-verifier/dist/render-lines.cjs.map +1 -0
  30. package/node_modules/@mnemom/aip-verifier/dist/render-lines.d.cts +96 -0
  31. package/node_modules/@mnemom/aip-verifier/dist/render-lines.d.ts +96 -0
  32. package/node_modules/@mnemom/aip-verifier/dist/render-lines.js +875 -0
  33. package/node_modules/@mnemom/aip-verifier/dist/render-lines.js.map +1 -0
  34. package/node_modules/@mnemom/aip-verifier/package.json +86 -0
  35. package/node_modules/@noble/ed25519/LICENSE +21 -0
  36. package/node_modules/@noble/ed25519/README.md +371 -0
  37. package/node_modules/@noble/ed25519/index.d.ts +391 -0
  38. package/node_modules/@noble/ed25519/index.js +933 -0
  39. package/node_modules/@noble/ed25519/index.ts +1134 -0
  40. package/node_modules/@noble/ed25519/package.json +54 -0
  41. package/node_modules/@noble/hashes/LICENSE +21 -0
  42. package/node_modules/@noble/hashes/README.md +478 -0
  43. package/node_modules/@noble/hashes/_blake.d.ts +20 -0
  44. package/node_modules/@noble/hashes/_blake.js +59 -0
  45. package/node_modules/@noble/hashes/_md.d.ts +95 -0
  46. package/node_modules/@noble/hashes/_md.js +209 -0
  47. package/node_modules/@noble/hashes/_u64.d.ts +36 -0
  48. package/node_modules/@noble/hashes/_u64.js +77 -0
  49. package/node_modules/@noble/hashes/argon2.d.ts +148 -0
  50. package/node_modules/@noble/hashes/argon2.js +577 -0
  51. package/node_modules/@noble/hashes/blake1.d.ts +162 -0
  52. package/node_modules/@noble/hashes/blake1.js +630 -0
  53. package/node_modules/@noble/hashes/blake2.d.ts +203 -0
  54. package/node_modules/@noble/hashes/blake2.js +573 -0
  55. package/node_modules/@noble/hashes/blake3.d.ts +68 -0
  56. package/node_modules/@noble/hashes/blake3.js +310 -0
  57. package/node_modules/@noble/hashes/eskdf.d.ts +91 -0
  58. package/node_modules/@noble/hashes/eskdf.js +225 -0
  59. package/node_modules/@noble/hashes/hkdf.d.ts +70 -0
  60. package/node_modules/@noble/hashes/hkdf.js +152 -0
  61. package/node_modules/@noble/hashes/hmac.d.ts +50 -0
  62. package/node_modules/@noble/hashes/hmac.js +93 -0
  63. package/node_modules/@noble/hashes/index.d.ts +1 -0
  64. package/node_modules/@noble/hashes/index.js +34 -0
  65. package/node_modules/@noble/hashes/legacy.d.ts +107 -0
  66. package/node_modules/@noble/hashes/legacy.js +348 -0
  67. package/node_modules/@noble/hashes/package.json +91 -0
  68. package/node_modules/@noble/hashes/pbkdf2.d.ts +66 -0
  69. package/node_modules/@noble/hashes/pbkdf2.js +176 -0
  70. package/node_modules/@noble/hashes/scrypt.d.ts +98 -0
  71. package/node_modules/@noble/hashes/scrypt.js +304 -0
  72. package/node_modules/@noble/hashes/sha2.d.ts +176 -0
  73. package/node_modules/@noble/hashes/sha2.js +446 -0
  74. package/node_modules/@noble/hashes/sha3-addons.d.ts +533 -0
  75. package/node_modules/@noble/hashes/sha3-addons.js +973 -0
  76. package/node_modules/@noble/hashes/sha3.d.ts +208 -0
  77. package/node_modules/@noble/hashes/sha3.js +475 -0
  78. package/node_modules/@noble/hashes/src/_blake.ts +67 -0
  79. package/node_modules/@noble/hashes/src/_md.ts +227 -0
  80. package/node_modules/@noble/hashes/src/_u64.ts +111 -0
  81. package/node_modules/@noble/hashes/src/argon2.ts +693 -0
  82. package/node_modules/@noble/hashes/src/blake1.ts +677 -0
  83. package/node_modules/@noble/hashes/src/blake2.ts +648 -0
  84. package/node_modules/@noble/hashes/src/blake3.ts +344 -0
  85. package/node_modules/@noble/hashes/src/eskdf.ts +265 -0
  86. package/node_modules/@noble/hashes/src/hkdf.ts +161 -0
  87. package/node_modules/@noble/hashes/src/hmac.ts +130 -0
  88. package/node_modules/@noble/hashes/src/index.ts +33 -0
  89. package/node_modules/@noble/hashes/src/legacy.ts +361 -0
  90. package/node_modules/@noble/hashes/src/pbkdf2.ts +219 -0
  91. package/node_modules/@noble/hashes/src/scrypt.ts +375 -0
  92. package/node_modules/@noble/hashes/src/sha2.ts +486 -0
  93. package/node_modules/@noble/hashes/src/sha3-addons.ts +1157 -0
  94. package/node_modules/@noble/hashes/src/sha3.ts +525 -0
  95. package/node_modules/@noble/hashes/src/utils.ts +978 -0
  96. package/node_modules/@noble/hashes/src/webcrypto.ts +283 -0
  97. package/node_modules/@noble/hashes/utils.d.ts +560 -0
  98. package/node_modules/@noble/hashes/utils.js +687 -0
  99. package/node_modules/@noble/hashes/webcrypto.d.ts +121 -0
  100. package/node_modules/@noble/hashes/webcrypto.js +228 -0
  101. package/package.json +5 -2
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Mnemon
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,478 @@
1
+ /**
2
+ * Record statements: the four signed statement types the Mnemom record is
3
+ * built from, their bundle, and the JWKS they verify against.
4
+ *
5
+ * Shape (design "The record", decisions T2, T3, T12):
6
+ *
7
+ * - Every statement carries `typ` (domain separation), `signing_key_id` (the
8
+ * `kid` of an Ed25519 key in the published JWKS) and a detached `signature`:
9
+ * base64url Ed25519 over `canonicalJson(statement minus signature)`.
10
+ * - Statements link by digest. A statement's digest is the lowercase sha256
11
+ * hex of that same canonical commitment. `previous_digest` points at the
12
+ * previous build of the same record; a PR record lists the conduct records
13
+ * it rolls up; an outcome and a share card name the statement they derive
14
+ * from.
15
+ * - A conduct record cites checkpoints by their signed `combined_commitment`
16
+ * (T12). A citation with no `card_hash` is flagged "card hash not recorded";
17
+ * one with no signed commitment is flagged "card not bound". Flags never
18
+ * make a statement invalid: they tell the reader how strong the binding is.
19
+ * - A share card carries only measured lines, outcome lines, and verdict
20
+ * lines shown with their coverage. Any other class fails the card.
21
+ */
22
+ /**
23
+ * One key from the published JWKS. Only Ed25519 OKP keys with `alg: EdDSA`
24
+ * are used: a key whose `alg` is absent or anything else is refused with
25
+ * `key_not_ed25519`, so the field is required here as it is at runtime.
26
+ */
27
+ interface RecordJwk {
28
+ kty: string;
29
+ crv?: string;
30
+ x?: string;
31
+ kid?: string;
32
+ alg: string;
33
+ use?: string;
34
+ [k: string]: unknown;
35
+ }
36
+ /** The published key set, as served at `/v1/.well-known/jwks.json`. */
37
+ interface RecordJwks {
38
+ keys: RecordJwk[];
39
+ }
40
+ declare const STATEMENT_TYPES: readonly ["AAP-ConductRecord/v1", "AAP-PRRecord/v1", "AAP-Outcome/v1", "AAP-ShareCard/v1"];
41
+ type StatementTyp = (typeof STATEMENT_TYPES)[number];
42
+ declare const BUNDLE_TYP: "AAP-RecordBundle/v1";
43
+ /** Fields every signed statement carries. */
44
+ interface SignedStatementBase {
45
+ typ: StatementTyp;
46
+ /** `kid` of the signing key in the JWKS. */
47
+ signing_key_id: string;
48
+ /** base64url Ed25519 signature over `canonicalJson(statement minus signature)`. */
49
+ signature: string;
50
+ /** Optional, must equal `EdDSA` when present. */
51
+ alg?: string;
52
+ /** ISO 8601 time the statement was built. */
53
+ built_at?: string;
54
+ /** Digest of the previous build of this record, or null for the first build (T2). */
55
+ previous_digest?: string | null;
56
+ /** `kid` of the key that made `commitment_signature`, or null when the attestation failed open. */
57
+ commitment_key_id?: string | null;
58
+ /** Generic unit the statement is about, e.g. `pull_request`. */
59
+ unit_kind?: string;
60
+ [k: string]: unknown;
61
+ }
62
+ /** A checkpoint cited by a conduct record (T12). */
63
+ interface CheckpointCitation {
64
+ checkpoint_id: string;
65
+ /** sha256 hex of the alignment card the checkpoint was judged against, or null when not recorded. */
66
+ card_hash?: string | null;
67
+ /** The checkpoint's signed `combined_commitment`, or null when none was signed. */
68
+ combined_commitment?: string | null;
69
+ /** The checkpoint certificate's signature over its own payload (own key, own payload per T3). */
70
+ commitment_signature?: string | null;
71
+ [k: string]: unknown;
72
+ }
73
+ interface ConductRecordStatement extends SignedStatementBase {
74
+ typ: "AAP-ConductRecord/v1";
75
+ /** Lineage the record is keyed on (T1), e.g. a conversation id. */
76
+ lineage_key?: string;
77
+ checkpoints?: CheckpointCitation[];
78
+ }
79
+ interface PRRecordStatement extends SignedStatementBase {
80
+ typ: "AAP-PRRecord/v1";
81
+ /** Digests of the conduct records this PR record rolls up. */
82
+ conduct_digests?: string[];
83
+ /** Head SHA from before the App's bundle commit. */
84
+ head_sha?: string;
85
+ }
86
+ interface OutcomeStatement extends SignedStatementBase {
87
+ typ: "AAP-Outcome/v1";
88
+ /** Digest of the PR record this outcome belongs to. */
89
+ pr_record_digest?: string;
90
+ merge_sha?: string;
91
+ }
92
+ /** Claim classes a share card may carry. */
93
+ declare const CARD_LINE_CLASSES: readonly ["measured", "verdict", "outcome"];
94
+ type CardLineClass = (typeof CARD_LINE_CLASSES)[number];
95
+ interface ShareCardLine {
96
+ class: string;
97
+ text: string;
98
+ /** Required on a verdict line: "N of M judged". */
99
+ coverage?: {
100
+ judged: number;
101
+ total: number;
102
+ } | null;
103
+ [k: string]: unknown;
104
+ }
105
+ interface ShareCardStatement extends SignedStatementBase {
106
+ typ: "AAP-ShareCard/v1";
107
+ /** Digest of the statement the card's lines were taken from. */
108
+ source_digest?: string;
109
+ lines?: ShareCardLine[];
110
+ }
111
+ type SignedStatement = ConductRecordStatement | PRRecordStatement | OutcomeStatement | ShareCardStatement;
112
+ /** A customer-held bundle: statements in build order. */
113
+ interface RecordBundle {
114
+ typ: typeof BUNDLE_TYP;
115
+ statements: SignedStatement[];
116
+ [k: string]: unknown;
117
+ }
118
+ /**
119
+ * Named reasons a statement fails. Stable strings: tampered fixtures assert
120
+ * on them, and every renderer prints them as they are.
121
+ */
122
+ declare const REASONS: {
123
+ readonly not_an_object: "not_an_object";
124
+ readonly unknown_typ: "unknown_typ";
125
+ readonly unsupported_alg: "unsupported_alg";
126
+ readonly signing_key_id_missing: "signing_key_id_missing";
127
+ readonly signature_missing: "signature_missing";
128
+ readonly signature_malformed: "signature_malformed";
129
+ readonly key_not_found: "key_not_found";
130
+ readonly key_not_ed25519: "key_not_ed25519";
131
+ readonly signature_invalid: "signature_invalid";
132
+ readonly bundle_not_an_object: "bundle_not_an_object";
133
+ readonly bundle_unknown_typ: "bundle_unknown_typ";
134
+ readonly bundle_statements_missing: "bundle_statements_missing";
135
+ readonly digest_malformed: "digest_malformed";
136
+ readonly linked_statement_wrong_typ: "linked_statement_wrong_typ";
137
+ readonly card_line_class_not_allowed: "card_line_class_not_allowed";
138
+ readonly card_verdict_without_coverage: "card_verdict_without_coverage";
139
+ };
140
+ type Reason = (typeof REASONS)[keyof typeof REASONS];
141
+ /** Named flags. A flag weakens a binding but never invalidates a statement. */
142
+ declare const FLAGS: {
143
+ readonly card_hash_not_recorded: "card hash not recorded";
144
+ readonly card_not_bound: "card not bound";
145
+ readonly linked_statement_not_in_bundle: "linked statement not in bundle";
146
+ };
147
+ type Flag = (typeof FLAGS)[keyof typeof FLAGS];
148
+ interface StatementFlag {
149
+ flag: Flag;
150
+ /** `checkpoint_id` or the digest the flag is about. */
151
+ subject: string;
152
+ }
153
+ interface StatementVerificationResult {
154
+ valid: boolean;
155
+ typ: string | null;
156
+ /** sha256 hex of the canonical commitment, or null when the input is not an object. */
157
+ digest: string | null;
158
+ signing_key_id: string | null;
159
+ reasons: Reason[];
160
+ flags: StatementFlag[];
161
+ }
162
+ interface RecordVerificationResult {
163
+ valid: boolean;
164
+ /** Reasons at the bundle level, plus every statement reason prefixed by its index. */
165
+ reasons: string[];
166
+ flags: StatementFlag[];
167
+ statements: StatementVerificationResult[];
168
+ verified_at: string;
169
+ }
170
+
171
+ /**
172
+ * The claim table (design decision T5): one table mapping record fields to
173
+ * the claim class they may be rendered as and, for goal and protection lines,
174
+ * the verb each mode produces. Every renderer and the verifier read this
175
+ * table; copy is never written per renderer.
176
+ *
177
+ * Rules the table encodes (design "Claim classes and verbs", "Cost",
178
+ * "Share cards"):
179
+ * - A line is exactly one class. "Safe", "correct" and "prevented" never appear.
180
+ * - No protection or goal line carries a dollar figure.
181
+ * - An implicit goal line never says "sealed"; goals off read "not checked".
182
+ * - The verb comes from the area's mode at the time of the act and, for a
183
+ * protection act, its verdict. "Stopped" shows the tool name and never its
184
+ * arguments; on a card, no tool name at all.
185
+ * - Cards carry measured, outcome and covered verdict lines only. Estimates
186
+ * and savings never appear on a card or a PR comment (T8).
187
+ * - No benchmark line ships until the head-to-head is published with its
188
+ * losing arms; no savings percentage appears anywhere until then.
189
+ */
190
+ declare const CLAIM_CLASSES: readonly ["measured", "verdict", "estimate", "benchmark", "outcome"];
191
+ type ClaimClass = (typeof CLAIM_CLASSES)[number];
192
+ /**
193
+ * Where a rendering is shown. Cards are the share card and the period card.
194
+ * `share_card` is the `AAP-ShareCard/v1` record statement's lines
195
+ * (`RecordShareCardLine`, statements.ts: `{class, text, coverage}`), the shape
196
+ * `verify` checks; not the MNE-9022 numeric card (sharecard.ts `ShareCardLine`).
197
+ */
198
+ declare const SURFACES: readonly ["record_page", "check_summary", "pr_comment", "share_card", "period_card"];
199
+ type Surface = (typeof SURFACES)[number];
200
+ declare const CARD_SURFACES: readonly Surface[];
201
+ /** Surfaces that never show the savings estimate, even once it qualifies (T8). */
202
+ declare const ESTIMATE_FORBIDDEN_SURFACES: readonly Surface[];
203
+ /** Protection and goal area modes, as stored at the act. */
204
+ declare const MODES: readonly ["off", "observe", "nudge", "enforce"];
205
+ type Mode = (typeof MODES)[number];
206
+ /**
207
+ * The verb each mode produces at its strongest verdict. `off` produces no line, or
208
+ * "not checked". A protection act's verb also depends on its verdict: see
209
+ * `protectionVerb`.
210
+ */
211
+ declare const MODE_VERBS: Record<Mode, string>;
212
+ /** A protection act's verdict, as stored at the act (mnemom-api `ProtectionVerdict`). */
213
+ declare const PROTECTION_VERDICTS: readonly ["pass", "warn", "nudge", "quarantine", "block"];
214
+ type ProtectionVerdict = (typeof PROTECTION_VERDICTS)[number];
215
+ /**
216
+ * The verb one protection act produces, from the mode and verdict stored at the act; null
217
+ * means the act has no line (mode off, or a pass). Mirrors mnemom-api
218
+ * `src/record/claims.ts` `protectionVerb`: under enforce only a block or quarantine
219
+ * "stopped" anything and anything else is "flagged"; under nudge only a nudge verdict
220
+ * reads "flagged, agent nudged".
221
+ */
222
+ declare function protectionVerb(mode: Mode, verdict: ProtectionVerdict): string | null;
223
+ /** How the goal was set. An implicit goal is never read as sealed (T16). */
224
+ declare const GOAL_MODES: readonly ["sealed", "implicit", "off"];
225
+ type GoalMode = (typeof GOAL_MODES)[number];
226
+ interface ClaimTableEntry {
227
+ class: ClaimClass;
228
+ /** True for the goal and protection areas: the verb comes from the mode. */
229
+ verb_by_mode: boolean;
230
+ /** True when the line may carry a money figure (model cost and μ only). */
231
+ money_allowed: boolean;
232
+ /** Surfaces this field may appear on; absent means every surface. */
233
+ surfaces?: readonly Surface[];
234
+ }
235
+ declare const CLAIM_TABLE: {
236
+ readonly commits_recorded: {
237
+ readonly class: "measured";
238
+ readonly verb_by_mode: false;
239
+ readonly money_allowed: false;
240
+ };
241
+ readonly messages_from_person: {
242
+ readonly class: "measured";
243
+ readonly verb_by_mode: false;
244
+ readonly money_allowed: false;
245
+ };
246
+ readonly compactions: {
247
+ readonly class: "measured";
248
+ readonly verb_by_mode: false;
249
+ readonly money_allowed: false;
250
+ };
251
+ readonly tokens_sent_vs_reaching: {
252
+ readonly class: "measured";
253
+ readonly verb_by_mode: false;
254
+ readonly money_allowed: false;
255
+ };
256
+ readonly peak_context: {
257
+ readonly class: "measured";
258
+ readonly verb_by_mode: false;
259
+ readonly money_allowed: false;
260
+ };
261
+ readonly model_cost: {
262
+ readonly class: "measured";
263
+ readonly verb_by_mode: false;
264
+ readonly money_allowed: true;
265
+ };
266
+ readonly mu_cost: {
267
+ readonly class: "measured";
268
+ readonly verb_by_mode: false;
269
+ readonly money_allowed: true;
270
+ };
271
+ readonly approval: {
272
+ readonly class: "measured";
273
+ readonly verb_by_mode: false;
274
+ readonly money_allowed: false;
275
+ };
276
+ /** How the goal was set: "sealed contract", "implicit goal" or "not checked" (M7: its own measured line). */
277
+ readonly goal_mode: {
278
+ readonly class: "measured";
279
+ readonly verb_by_mode: false;
280
+ readonly money_allowed: false;
281
+ };
282
+ readonly goal: {
283
+ readonly class: "verdict";
284
+ readonly verb_by_mode: true;
285
+ readonly money_allowed: false;
286
+ };
287
+ /** The protection area's mode when no act is shown: "not checked" under off. */
288
+ readonly protection_mode: {
289
+ readonly class: "measured";
290
+ readonly verb_by_mode: false;
291
+ readonly money_allowed: false;
292
+ };
293
+ readonly protection: {
294
+ readonly class: "verdict";
295
+ readonly verb_by_mode: true;
296
+ readonly money_allowed: false;
297
+ };
298
+ readonly autonomy: {
299
+ readonly class: "measured";
300
+ readonly verb_by_mode: false;
301
+ readonly money_allowed: false;
302
+ };
303
+ readonly savings_estimate: {
304
+ readonly class: "estimate";
305
+ readonly verb_by_mode: false;
306
+ readonly money_allowed: true;
307
+ readonly surfaces: readonly ["record_page", "check_summary"];
308
+ };
309
+ readonly benchmark: {
310
+ readonly class: "benchmark";
311
+ readonly verb_by_mode: false;
312
+ readonly money_allowed: false;
313
+ };
314
+ readonly outcome: {
315
+ readonly class: "outcome";
316
+ readonly verb_by_mode: false;
317
+ readonly money_allowed: false;
318
+ };
319
+ };
320
+ type ClaimField = keyof typeof CLAIM_TABLE;
321
+ declare function isClaimField(field: unknown): field is ClaimField;
322
+ /**
323
+ * Line keys the builder (mnemom-api `src/record/claims.ts`) writes on a
324
+ * statement's `lines[]`, mapped to the claim-table field each one renders
325
+ * (cross-lane pick M6). `protection.act.<n>` maps to `protection` for any n.
326
+ */
327
+ declare const LINE_KEY_FIELDS: Readonly<Record<string, ClaimField>>;
328
+ /** The claim-table field a statement line key renders, or undefined for a key the table does not know. */
329
+ declare function fieldForLineKey(key: unknown): ClaimField | undefined;
330
+
331
+ /**
332
+ * claim-lint: the mechanical check every rendering passes (criterion K1.17).
333
+ *
334
+ * A rendering is a surface plus the lines shown on it. Each line names its
335
+ * class, its text, and when it comes from a mode-bearing area, the mode stored
336
+ * at the act. The lint returns every violation with a stable rule name; it
337
+ * never rewrites a line.
338
+ *
339
+ * Line shape (cross-lane pick M6): a signed statement carries
340
+ * `{class, key, text}` per line, with the builder's keys (`cost.model`,
341
+ * `goal.verdict`, `protection.act.0`, ...). The renderer attaches `mode`,
342
+ * `verdict`, `goal_mode`, `tool_name` and `coverage` from the statement's
343
+ * `goal` and `protection` blocks before linting. The lint resolves `field`
344
+ * from `key` when `field` is absent, and off a card reads a verdict line's
345
+ * coverage from the "<n> of <m> turns judged" words when no `coverage` object
346
+ * is attached.
347
+ *
348
+ * On `share_card` the lines are the record share card statement's lines
349
+ * (`RecordShareCardLine`, statements.ts `{class, text, coverage}`), the ones
350
+ * `verify` checks in `shareCardReasons`. The MNE-9022 card (sharecard.ts,
351
+ * `{id, kind, label, value, statement_hash}`) carries no `class` and is not a
352
+ * `Rendering`; linting its lines as-is reports `one_class_per_line` on each.
353
+ *
354
+ * Rules, each from the claim table (T5) and the design's claim rules:
355
+ * one_class_per_line class is one of the five, and matches the field's class
356
+ * forbidden_word "safe", "correct", "prevented" never appear
357
+ * money_on_goal_or_protection no dollar figure on a goal or protection line
358
+ * implicit_goal_sealed an implicit goal line never says "sealed"
359
+ * goal_off_not_checked with goals off the goal line reads "not checked"
360
+ * estimate_on_forbidden_surface no estimate or savings on a card or PR comment
361
+ * verb_mismatch the verb is the one the mode and the act's verdict produce, exactly
362
+ * (mnemom-api `protectionVerb`); a tool name follows "stopped" only
363
+ * enforce_without_tool_name "stopped" names the tool off-card
364
+ * tool_name_on_card a card never shows a tool name
365
+ * tool_arguments_shown tool arguments never appear
366
+ * trust_claim no minutes-to-trust, review-time or re-checking claim
367
+ * savings_percentage no savings percentage anywhere until the board exists
368
+ * benchmark_not_published no benchmark line ships yet
369
+ * verdict_without_coverage off a card, a goal verdict always shows its coverage ("N of M turns
370
+ * judged") and a protection act, one recorded decision, carries none;
371
+ * on a card every verdict line carries a `coverage` object, as
372
+ * `verify` requires (`card_verdict_without_coverage`)
373
+ * card_class_not_allowed a card carries measured, outcome and verdict lines only
374
+ * period_card_without_revert a period card renders its reverts
375
+ * field_not_on_surface the field is not shown on this surface
376
+ * provisional_mu_on_card a provisional μ amount ("≈ N μ (pending)", A-S-001) never appears on a card:
377
+ * cards keep K1.17 and read "μ pending" at most
378
+ * provisional_mu_off_cost_line a provisional μ amount appears on the μ cost line and nowhere else
379
+ */
380
+
381
+ interface RenderedLine {
382
+ /** Record field the line renders; when present its class must match the claim table. */
383
+ field?: string;
384
+ /** Builder line key (`cost.model`, `goal.verdict`, `protection.act.0`, ...); resolves `field` when that is absent. */
385
+ key?: string;
386
+ class: string;
387
+ text: string;
388
+ /** Mode stored at the act, for goal and protection lines. */
389
+ mode?: Mode;
390
+ /** Verdict stored at a protection act; required with nudge and enforce, whose verb depends on it. */
391
+ verdict?: ProtectionVerdict;
392
+ /** How the goal was set, for goal lines. */
393
+ goal_mode?: GoalMode;
394
+ /** Tool the act concerned; shown only after "stopped", and never on a card. */
395
+ tool_name?: string;
396
+ /** Never rendered; present here only so the lint can prove it is absent from the text. */
397
+ tool_arguments?: unknown;
398
+ /** "N of M judged". Required on every verdict line on a card; off a card a goal verdict may say it in words instead. */
399
+ coverage?: {
400
+ judged: number;
401
+ total: number;
402
+ } | null;
403
+ [k: string]: unknown;
404
+ }
405
+ interface Rendering {
406
+ surface: Surface;
407
+ lines: RenderedLine[];
408
+ [k: string]: unknown;
409
+ }
410
+ declare const LINT_RULES: {
411
+ readonly one_class_per_line: "one_class_per_line";
412
+ readonly forbidden_word: "forbidden_word";
413
+ readonly money_on_goal_or_protection: "money_on_goal_or_protection";
414
+ readonly implicit_goal_sealed: "implicit_goal_sealed";
415
+ readonly goal_off_not_checked: "goal_off_not_checked";
416
+ readonly estimate_on_forbidden_surface: "estimate_on_forbidden_surface";
417
+ readonly verb_mismatch: "verb_mismatch";
418
+ readonly enforce_without_tool_name: "enforce_without_tool_name";
419
+ readonly tool_name_on_card: "tool_name_on_card";
420
+ readonly tool_arguments_shown: "tool_arguments_shown";
421
+ readonly trust_claim: "trust_claim";
422
+ readonly savings_percentage: "savings_percentage";
423
+ readonly benchmark_not_published: "benchmark_not_published";
424
+ readonly verdict_without_coverage: "verdict_without_coverage";
425
+ readonly card_class_not_allowed: "card_class_not_allowed";
426
+ readonly period_card_without_revert: "period_card_without_revert";
427
+ readonly field_not_on_surface: "field_not_on_surface";
428
+ readonly provisional_mu_on_card: "provisional_mu_on_card";
429
+ readonly provisional_mu_off_cost_line: "provisional_mu_off_cost_line";
430
+ readonly unknown_surface: "unknown_surface";
431
+ };
432
+ type LintRule = (typeof LINT_RULES)[keyof typeof LINT_RULES];
433
+ interface LintViolation {
434
+ rule: LintRule;
435
+ /** Index of the line in the rendering, or -1 for a rendering-level violation. */
436
+ line: number;
437
+ text: string;
438
+ }
439
+ interface LintResult {
440
+ ok: boolean;
441
+ violations: LintViolation[];
442
+ }
443
+ /** Lint one rendering. Never throws; a malformed rendering is a violation. */
444
+ declare function lintRendering(rendering: unknown): LintResult;
445
+ /** Lint several renderings and keep each result keyed by its position. */
446
+ declare function lintRenderings(renderings: unknown[]): LintResult[];
447
+ /** The `goal` block a conduct record statement carries (mnemom-api `src/record/builder.ts`). */
448
+ interface StatementGoalBlock {
449
+ mode: GoalMode;
450
+ [k: string]: unknown;
451
+ }
452
+ /** One entry of a conduct record statement's `protection.acts[]`. */
453
+ interface StatementProtectionAct {
454
+ mode: Mode;
455
+ verdict: ProtectionVerdict;
456
+ tool_name: string | null;
457
+ [k: string]: unknown;
458
+ }
459
+ /** A statement line as the builder signs it: one class, a stable key, the words shown. */
460
+ interface StatementLine {
461
+ class: string;
462
+ key: string;
463
+ text: string;
464
+ }
465
+ /**
466
+ * Attach the lint context a signed statement's lines leave out (cross-lane
467
+ * pick M6). The statement carries `{class, key, text}` only; this returns the
468
+ * same lines with `goal_mode` on `goal.*` lines, and `mode`, `verdict` and
469
+ * `tool_name` on `protection.act.*` lines, read from the statement's `goal`
470
+ * and `protection.acts` blocks (`protection.act.<i>` is `acts[i]`). Coverage
471
+ * stays in the verdict line's words; a card renderer attaches the `coverage`
472
+ * object itself. The text is never changed.
473
+ */
474
+ declare function attachLineContext(lines: readonly StatementLine[], goal: StatementGoalBlock | null | undefined, protection: {
475
+ acts: readonly StatementProtectionAct[];
476
+ } | null | undefined): RenderedLine[];
477
+
478
+ export { lintRenderings as $, type RenderedLine as A, BUNDLE_TYP as B, CARD_LINE_CLASSES as C, type Rendering as D, ESTIMATE_FORBIDDEN_SURFACES as E, FLAGS as F, GOAL_MODES as G, STATEMENT_TYPES as H, SURFACES as I, type ShareCardStatement as J, type SignedStatementBase as K, LINE_KEY_FIELDS as L, MODES as M, type StatementFlag as N, type OutcomeStatement as O, PROTECTION_VERDICTS as P, type StatementGoalBlock as Q, type RecordBundle as R, type SignedStatement as S, type StatementLine as T, type StatementProtectionAct as U, type StatementTyp as V, type Surface as W, attachLineContext as X, fieldForLineKey as Y, isClaimField as Z, lintRendering as _, type RecordJwks as a, protectionVerb as a0, type RecordVerificationResult as b, type StatementVerificationResult as c, CARD_SURFACES as d, CLAIM_CLASSES as e, CLAIM_TABLE as f, type CardLineClass as g, type CheckpointCitation as h, type ClaimClass as i, type ClaimField as j, type ClaimTableEntry as k, type ConductRecordStatement as l, type Flag as m, type GoalMode as n, LINT_RULES as o, type LintResult as p, type LintRule as q, type LintViolation as r, MODE_VERBS as s, type Mode as t, type PRRecordStatement as u, type ProtectionVerdict as v, REASONS as w, type Reason as x, type RecordJwk as y, type ShareCardLine as z };