@mnemom/mnemom 0.17.34 → 0.17.36

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 (177) hide show
  1. package/dist/commands/agent-config.js +3 -0
  2. package/dist/commands/agent-goal.d.ts +8 -3
  3. package/dist/commands/agent-goal.js +22 -8
  4. package/dist/commands/agent-run.d.ts +14 -2
  5. package/dist/commands/agent-run.js +28 -7
  6. package/dist/commands/agent-share-render.js +1 -1
  7. package/dist/commands/agent-slack.js +32 -0
  8. package/dist/commands/durable-inbox.d.ts +51 -0
  9. package/dist/commands/durable-inbox.js +134 -0
  10. package/dist/commands/durable-questions.d.ts +64 -0
  11. package/dist/commands/durable-questions.js +161 -0
  12. package/dist/commands/scan.d.ts +13 -3
  13. package/dist/commands/scan.js +48 -10
  14. package/dist/durable/seat-proxy.d.ts +12 -1
  15. package/dist/durable/seat-proxy.js +55 -9
  16. package/dist/durable/seat-socket.d.ts +20 -2
  17. package/dist/durable/seat-socket.js +58 -0
  18. package/dist/durable/turn-chain.d.ts +8 -0
  19. package/dist/durable/turn-chain.js +25 -4
  20. package/dist/host/client.d.ts +41 -0
  21. package/dist/host/client.js +7 -0
  22. package/dist/host/control.d.ts +7 -0
  23. package/dist/host/control.js +15 -0
  24. package/dist/host/daemon.d.ts +20 -0
  25. package/dist/host/daemon.js +74 -1
  26. package/dist/host/inbox-delivery.d.ts +174 -0
  27. package/dist/host/inbox-delivery.js +453 -0
  28. package/dist/host/run.d.ts +18 -0
  29. package/dist/host/run.js +61 -0
  30. package/dist/host/s1-names.d.ts +2 -0
  31. package/dist/host/s1-names.js +2 -0
  32. package/dist/host/tmux.d.ts +7 -0
  33. package/dist/host/tmux.js +19 -0
  34. package/dist/index.js +62 -3
  35. package/dist/lib/api.d.ts +5 -0
  36. package/dist/lib/api.js +16 -0
  37. package/dist/lib/config.d.ts +7 -0
  38. package/dist/lib/config.js +21 -0
  39. package/dist/lib/durable/api.d.ts +11 -0
  40. package/dist/lib/durable/api.js +28 -3
  41. package/dist/lib/durable/gate.d.ts +1 -1
  42. package/dist/lib/durable/gate.js +8 -1
  43. package/dist/lib/durable/live.d.ts +5 -0
  44. package/dist/lib/durable/live.js +19 -0
  45. package/dist/lib/experimental.js +3 -0
  46. package/dist/lib/goal-api.d.ts +11 -4
  47. package/dist/lib/goal-api.js +4 -3
  48. package/dist/lib/launcher-config.d.ts +5 -0
  49. package/dist/lib/launcher-config.js +17 -2
  50. package/dist/lib/prompt.d.ts +4 -2
  51. package/dist/lib/prompt.js +15 -5
  52. package/dist/lib/runner/job.d.ts +2 -2
  53. package/dist/lib/runner/job.js +16 -3
  54. package/dist/lib/runner/pr-body.d.ts +17 -0
  55. package/dist/lib/runner/pr-body.js +42 -0
  56. package/dist/lib/runner/proxy.d.ts +18 -3
  57. package/dist/lib/runner/proxy.js +24 -5
  58. package/dist/lib/scan/pr-source.js +2 -0
  59. package/dist/lib/scan/record.d.ts +60 -9
  60. package/dist/lib/scan/record.js +157 -39
  61. package/dist/lib/scan/repo-picker.d.ts +32 -0
  62. package/dist/lib/scan/repo-picker.js +80 -0
  63. package/dist/lib/scan/report.d.ts +6 -8
  64. package/dist/lib/scan/report.js +21 -7
  65. package/dist/lib/scan/share.d.ts +5 -1
  66. package/dist/lib/scan/share.js +15 -5
  67. package/dist/lib/slack-durable.d.ts +123 -0
  68. package/dist/lib/slack-durable.js +237 -0
  69. package/dist/lib/slack-router.d.ts +7 -0
  70. package/dist/lib/slack-router.js +50 -4
  71. package/dist/vendor/durable-contract/index.js +992 -34
  72. package/dist/vendor/shared/durable-contract/admission.d.ts +81 -2
  73. package/dist/vendor/shared/durable-contract/admission.js +319 -2
  74. package/dist/vendor/shared/durable-contract/cli-surface.js +21 -0
  75. package/dist/vendor/shared/durable-contract/codes.d.ts +60 -0
  76. package/dist/vendor/shared/durable-contract/codes.js +22 -0
  77. package/dist/vendor/shared/durable-contract/events.d.ts +4 -2
  78. package/dist/vendor/shared/durable-contract/events.js +55 -1
  79. package/dist/vendor/shared/durable-contract/freeze-record.d.ts +14 -0
  80. package/dist/vendor/shared/durable-contract/inbox.d.ts +299 -0
  81. package/dist/vendor/shared/durable-contract/inbox.js +462 -0
  82. package/dist/vendor/shared/durable-contract/index.d.ts +2 -0
  83. package/dist/vendor/shared/durable-contract/index.js +2 -0
  84. package/dist/vendor/shared/durable-contract/question.d.ts +218 -0
  85. package/dist/vendor/shared/durable-contract/question.js +373 -0
  86. package/dist/vendor/shared/durable-contract/routes.d.ts +44 -2
  87. package/dist/vendor/shared/durable-contract/routes.js +43 -1
  88. package/dist/vendor/shared/durable-contract/turn.d.ts +15 -1
  89. package/dist/vendor/shared/durable-contract/turn.js +33 -1
  90. package/dist/vendor/shared/durable-contract/vectors.d.ts +45 -0
  91. package/dist/vendor/shared/durable-contract/vectors.js +49 -0
  92. package/node_modules/@mnemom/aip-verifier/LICENSE +190 -0
  93. package/node_modules/@mnemom/aip-verifier/dist/claim-lint-CVITIRcU.d.cts +478 -0
  94. package/node_modules/@mnemom/aip-verifier/dist/claim-lint-CVITIRcU.d.ts +478 -0
  95. package/node_modules/@mnemom/aip-verifier/dist/index.cjs +971 -0
  96. package/node_modules/@mnemom/aip-verifier/dist/index.cjs.map +1 -0
  97. package/node_modules/@mnemom/aip-verifier/dist/index.d.cts +330 -0
  98. package/node_modules/@mnemom/aip-verifier/dist/index.d.ts +330 -0
  99. package/node_modules/@mnemom/aip-verifier/dist/index.js +933 -0
  100. package/node_modules/@mnemom/aip-verifier/dist/index.js.map +1 -0
  101. package/node_modules/@mnemom/aip-verifier/dist/render-lines.cjs +879 -0
  102. package/node_modules/@mnemom/aip-verifier/dist/render-lines.cjs.map +1 -0
  103. package/node_modules/@mnemom/aip-verifier/dist/render-lines.d.cts +96 -0
  104. package/node_modules/@mnemom/aip-verifier/dist/render-lines.d.ts +96 -0
  105. package/node_modules/@mnemom/aip-verifier/dist/render-lines.js +875 -0
  106. package/node_modules/@mnemom/aip-verifier/dist/render-lines.js.map +1 -0
  107. package/node_modules/@mnemom/aip-verifier/package.json +86 -0
  108. package/node_modules/@noble/ed25519/LICENSE +21 -0
  109. package/node_modules/@noble/ed25519/README.md +371 -0
  110. package/node_modules/@noble/ed25519/index.d.ts +391 -0
  111. package/node_modules/@noble/ed25519/index.js +933 -0
  112. package/node_modules/@noble/ed25519/index.ts +1134 -0
  113. package/node_modules/@noble/ed25519/package.json +54 -0
  114. package/node_modules/@noble/hashes/LICENSE +21 -0
  115. package/node_modules/@noble/hashes/README.md +478 -0
  116. package/node_modules/@noble/hashes/_blake.d.ts +20 -0
  117. package/node_modules/@noble/hashes/_blake.js +59 -0
  118. package/node_modules/@noble/hashes/_md.d.ts +95 -0
  119. package/node_modules/@noble/hashes/_md.js +209 -0
  120. package/node_modules/@noble/hashes/_u64.d.ts +36 -0
  121. package/node_modules/@noble/hashes/_u64.js +77 -0
  122. package/node_modules/@noble/hashes/argon2.d.ts +148 -0
  123. package/node_modules/@noble/hashes/argon2.js +577 -0
  124. package/node_modules/@noble/hashes/blake1.d.ts +162 -0
  125. package/node_modules/@noble/hashes/blake1.js +630 -0
  126. package/node_modules/@noble/hashes/blake2.d.ts +203 -0
  127. package/node_modules/@noble/hashes/blake2.js +573 -0
  128. package/node_modules/@noble/hashes/blake3.d.ts +68 -0
  129. package/node_modules/@noble/hashes/blake3.js +310 -0
  130. package/node_modules/@noble/hashes/eskdf.d.ts +91 -0
  131. package/node_modules/@noble/hashes/eskdf.js +225 -0
  132. package/node_modules/@noble/hashes/hkdf.d.ts +70 -0
  133. package/node_modules/@noble/hashes/hkdf.js +152 -0
  134. package/node_modules/@noble/hashes/hmac.d.ts +50 -0
  135. package/node_modules/@noble/hashes/hmac.js +93 -0
  136. package/node_modules/@noble/hashes/index.d.ts +1 -0
  137. package/node_modules/@noble/hashes/index.js +34 -0
  138. package/node_modules/@noble/hashes/legacy.d.ts +107 -0
  139. package/node_modules/@noble/hashes/legacy.js +348 -0
  140. package/node_modules/@noble/hashes/package.json +91 -0
  141. package/node_modules/@noble/hashes/pbkdf2.d.ts +66 -0
  142. package/node_modules/@noble/hashes/pbkdf2.js +176 -0
  143. package/node_modules/@noble/hashes/scrypt.d.ts +98 -0
  144. package/node_modules/@noble/hashes/scrypt.js +304 -0
  145. package/node_modules/@noble/hashes/sha2.d.ts +176 -0
  146. package/node_modules/@noble/hashes/sha2.js +446 -0
  147. package/node_modules/@noble/hashes/sha3-addons.d.ts +533 -0
  148. package/node_modules/@noble/hashes/sha3-addons.js +973 -0
  149. package/node_modules/@noble/hashes/sha3.d.ts +208 -0
  150. package/node_modules/@noble/hashes/sha3.js +475 -0
  151. package/node_modules/@noble/hashes/src/_blake.ts +67 -0
  152. package/node_modules/@noble/hashes/src/_md.ts +227 -0
  153. package/node_modules/@noble/hashes/src/_u64.ts +111 -0
  154. package/node_modules/@noble/hashes/src/argon2.ts +693 -0
  155. package/node_modules/@noble/hashes/src/blake1.ts +677 -0
  156. package/node_modules/@noble/hashes/src/blake2.ts +648 -0
  157. package/node_modules/@noble/hashes/src/blake3.ts +344 -0
  158. package/node_modules/@noble/hashes/src/eskdf.ts +265 -0
  159. package/node_modules/@noble/hashes/src/hkdf.ts +161 -0
  160. package/node_modules/@noble/hashes/src/hmac.ts +130 -0
  161. package/node_modules/@noble/hashes/src/index.ts +33 -0
  162. package/node_modules/@noble/hashes/src/legacy.ts +361 -0
  163. package/node_modules/@noble/hashes/src/pbkdf2.ts +219 -0
  164. package/node_modules/@noble/hashes/src/scrypt.ts +375 -0
  165. package/node_modules/@noble/hashes/src/sha2.ts +486 -0
  166. package/node_modules/@noble/hashes/src/sha3-addons.ts +1157 -0
  167. package/node_modules/@noble/hashes/src/sha3.ts +525 -0
  168. package/node_modules/@noble/hashes/src/utils.ts +978 -0
  169. package/node_modules/@noble/hashes/src/webcrypto.ts +283 -0
  170. package/node_modules/@noble/hashes/utils.d.ts +560 -0
  171. package/node_modules/@noble/hashes/utils.js +687 -0
  172. package/node_modules/@noble/hashes/webcrypto.d.ts +121 -0
  173. package/node_modules/@noble/hashes/webcrypto.js +228 -0
  174. package/package.json +5 -2
  175. package/plugins/integrity-manifest.json +6 -2
  176. package/plugins/mnemom/hooks/hooks.json +12 -0
  177. package/plugins/mnemom/hooks/seat-ask.mjs +221 -0
@@ -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 };