@reticlehq/core 2.13.1 → 3.1.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 (147) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +20 -0
  2. package/dist/artifacts/artifacts-entry.js +20 -0
  3. package/dist/artifacts/flow-composition.d.ts +30 -0
  4. package/dist/artifacts/flow-composition.js +19 -0
  5. package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +97 -3
  6. package/dist/{flow-constants.js → artifacts/flow-constants.js} +103 -4
  7. package/dist/artifacts/flow-mutation-target.d.ts +39 -0
  8. package/dist/artifacts/flow-mutation-target.js +89 -0
  9. package/dist/artifacts/flow-order.d.ts +30 -0
  10. package/dist/artifacts/flow-order.js +49 -0
  11. package/dist/artifacts/flow-select.d.ts +56 -0
  12. package/dist/artifacts/flow-select.js +56 -0
  13. package/dist/artifacts/flow-step-tool.d.ts +31 -0
  14. package/dist/artifacts/flow-step-tool.js +31 -0
  15. package/dist/artifacts/flow-types.d.ts +3736 -0
  16. package/dist/artifacts/flow-types.js +463 -0
  17. package/dist/artifacts/flow-unreached.d.ts +12 -0
  18. package/dist/artifacts/flow-unreached.js +24 -0
  19. package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +7 -3
  20. package/dist/{impact-savings.js → artifacts/impact-savings.js} +27 -4
  21. package/dist/{impact.d.ts → artifacts/impact.d.ts} +122 -54
  22. package/dist/{impact.js → artifacts/impact.js} +30 -0
  23. package/dist/{journal.d.ts → artifacts/journal.d.ts} +50 -6
  24. package/dist/{journal.js → artifacts/journal.js} +38 -2
  25. package/dist/artifacts/step-effect.d.ts +29 -0
  26. package/dist/artifacts/step-effect.js +28 -0
  27. package/dist/hooks/hook-events.d.ts +311 -0
  28. package/dist/hooks/hook-events.js +127 -0
  29. package/dist/hooks/hooks-entry.d.ts +9 -0
  30. package/dist/hooks/hooks-entry.js +9 -0
  31. package/dist/{brand.d.ts → identity/brand.d.ts} +7 -0
  32. package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
  33. package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
  34. package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
  35. package/dist/{document-identity.js → identity/document-identity.js} +4 -5
  36. package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
  37. package/dist/{source-constants.js → identity/source-constants.js} +4 -4
  38. package/dist/index.d.ts +69 -42
  39. package/dist/index.js +78 -44
  40. package/dist/onboarding.d.ts +114 -0
  41. package/dist/onboarding.js +141 -0
  42. package/dist/realm/registry.d.ts +212 -0
  43. package/dist/realm/registry.js +302 -0
  44. package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +4 -5
  45. package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
  46. package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
  47. package/dist/{project-registry.js → registry/project-registry.js} +5 -5
  48. package/dist/schema/command-name.json +31 -0
  49. package/dist/schema/event-message.json +1 -0
  50. package/dist/schema/event-payloads.json +791 -0
  51. package/dist/schema/event-type.json +1 -0
  52. package/dist/schema/hello-message.json +76 -2
  53. package/dist/schema/reticle-event.json +1 -0
  54. package/dist/schema/reticle-message.json +77 -2
  55. package/dist/telemetry-entry.d.ts +15 -0
  56. package/dist/telemetry-entry.js +15 -0
  57. package/dist/telemetry-feedback.d.ts +13 -14
  58. package/dist/telemetry-feedback.js +11 -12
  59. package/dist/telemetry-license.d.ts +1 -1
  60. package/dist/telemetry-license.js +1 -1
  61. package/dist/telemetry-refusal.d.ts +11 -11
  62. package/dist/telemetry-refusal.js +7 -8
  63. package/dist/telemetry-session.d.ts +49 -57
  64. package/dist/telemetry-session.js +47 -55
  65. package/dist/telemetry.d.ts +229 -198
  66. package/dist/telemetry.js +83 -98
  67. package/dist/tour-entry.d.ts +10 -0
  68. package/dist/tour-entry.js +10 -0
  69. package/dist/tour.d.ts +125 -0
  70. package/dist/tour.js +165 -0
  71. package/dist/{consequence.d.ts → verdict/consequence.d.ts} +35 -11
  72. package/dist/{consequence.js → verdict/consequence.js} +9 -22
  73. package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
  74. package/dist/{findings.d.ts → verdict/findings.d.ts} +149 -41
  75. package/dist/{findings.js → verdict/findings.js} +169 -48
  76. package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +22 -14
  77. package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +23 -15
  78. package/dist/{intent.d.ts → verdict/intent.d.ts} +41 -52
  79. package/dist/{intent.js → verdict/intent.js} +11 -22
  80. package/dist/verdict/revision.d.ts +44 -0
  81. package/dist/verdict/revision.js +53 -0
  82. package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
  83. package/dist/{run-context.js → verdict/run-context.js} +15 -36
  84. package/dist/{security.js → verdict/security.js} +12 -21
  85. package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +369 -93
  86. package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
  87. package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +36 -13
  88. package/dist/{verified-constants.js → verdict/verified-constants.js} +36 -13
  89. package/dist/verdict/verify-progress.d.ts +129 -0
  90. package/dist/verdict/verify-progress.js +74 -0
  91. package/dist/wire/channel.d.ts +46 -0
  92. package/dist/wire/channel.js +95 -0
  93. package/dist/{constants.d.ts → wire/constants/constants.d.ts} +124 -28
  94. package/dist/{constants.js → wire/constants/constants.js} +137 -28
  95. package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +9 -2
  96. package/dist/{session-constants.js → wire/constants/session-constants.js} +9 -2
  97. package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
  98. package/dist/{event-classification.js → wire/event-classification.js} +1 -1
  99. package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +229 -17
  100. package/dist/{event-payloads.js → wire/event-payloads.js} +61 -3
  101. package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
  102. package/dist/{event-priority.js → wire/event-priority.js} +2 -5
  103. package/dist/wire/global-press.d.ts +30 -0
  104. package/dist/wire/global-press.js +54 -0
  105. package/dist/{messages.d.ts → wire/messages.d.ts} +290 -38
  106. package/dist/{messages.js → wire/messages.js} +93 -5
  107. package/dist/wire/narrow.d.ts +39 -0
  108. package/dist/wire/narrow.js +45 -0
  109. package/dist/{net.d.ts → wire/net.d.ts} +49 -10
  110. package/dist/{net.js → wire/net.js} +49 -10
  111. package/dist/wire/platform.d.ts +37 -0
  112. package/dist/wire/platform.js +36 -0
  113. package/dist/{redaction.d.ts → wire/redaction.d.ts} +30 -0
  114. package/dist/wire/redaction.js +274 -0
  115. package/dist/wire/tool-names.d.ts +133 -0
  116. package/dist/wire/tool-names.js +142 -0
  117. package/dist/{toon.js → wire/toon.js} +1 -1
  118. package/dist/{types.d.ts → wire/types.d.ts} +106 -66
  119. package/dist/{types.js → wire/types.js} +24 -4
  120. package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
  121. package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
  122. package/dist/{notices.d.ts → words/notices.d.ts} +24 -12
  123. package/dist/{notices.js → words/notices.js} +27 -12
  124. package/package.json +22 -5
  125. package/dist/flow-types.d.ts +0 -1473
  126. package/dist/flow-types.js +0 -195
  127. package/dist/redaction.js +0 -149
  128. /package/dist/{brand.js → identity/brand.js} +0 -0
  129. /package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
  130. /package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
  131. /package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
  132. /package/dist/{project-id.js → identity/project-id.js} +0 -0
  133. /package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
  134. /package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
  135. /package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
  136. /package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
  137. /package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
  138. /package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
  139. /package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
  140. /package/dist/{state-select.js → wire/state-select.js} +0 -0
  141. /package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
  142. /package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
  143. /package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
  144. /package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
  145. /package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
  146. /package/dist/{upgrade.d.ts → words/upgrade.d.ts} +0 -0
  147. /package/dist/{upgrade.js → words/upgrade.js} +0 -0
@@ -8,31 +8,20 @@ import { z } from 'zod';
8
8
  * holding the DOM, the diff, and no intent. So it asserts what it can SEE rather than what was
9
9
  * MEANT, and what it can see is almost always weaker. That gap is where a false green comes from.
10
10
  *
11
- * ## Why the prose is captured early and the predicate late
11
+ * ## Prose early, predicate late
12
12
  *
13
- * Intent has two properties that move in opposite directions over the life of a task.
14
- *
15
- * **Fidelity** is highest the moment the human asks and decays from there; every later restatement
16
- * is a lossy re-derivation. **Bindability** — whether it can be written as something checkable — is
17
- * near zero then, because there is no route, no ref and often no code, and rises as the code
18
- * appears.
19
- *
20
- * Capture at either end alone loses one of them. Demanding a predicate at declare time collects
21
- * MECHANISMS, which is what assertions already are. Waiting until drive time collects a
22
- * RE-DERIVATION, which is the weak artifact this exists to replace — by then the agent has already
23
- * forgotten, and that is the entire premise.
24
- *
25
- * So: `statement` is prose and mandatory. `binding` is a predicate, optional, and may arrive later
26
- * or never. An intent that stays `declared` and never becomes `bound` is not a failure — it is the
27
- * most interesting row in the ledger, because it names something the team meant that nothing can
28
- * currently prove.
13
+ * Fidelity is highest the moment the human asks and decays from there. Bindability — whether it can
14
+ * be written as something checkable — is near zero then and rises as the code appears. So
15
+ * `statement` is prose and mandatory, and `binding` is a predicate, optional, arriving later or
16
+ * never. An intent that stays `declared` is not a failure: it names something the team meant that
17
+ * nothing can currently prove.
29
18
  *
30
19
  * ## Amendments are append-only
31
20
  *
32
- * A long build changes its mind, so an intent must be amendable. But an amendable intent is also how
33
- * an agent could quietly rewrite what it meant to match what it can already prove. Keeping the
34
- * previous statement makes a NARROWING visible in the git diff, which is the only real defence —
35
- * and it is a partial one, stated here rather than papered over.
21
+ * A long build changes its mind, so an intent must be amendable — and an amendable intent is also
22
+ * how an agent could quietly rewrite what it meant to match what it can already prove. Keeping the
23
+ * previous statement makes a NARROWING visible in the git diff. That is a PARTIAL defence and the
24
+ * only one there is.
36
25
  */
37
26
  export declare const INTENT_FILE_VERSION = 1;
38
27
  export declare const IntentState: {
@@ -50,12 +39,12 @@ export declare const IntentSurfaceSchema: z.ZodObject<{
50
39
  flow: z.ZodOptional<z.ZodString>;
51
40
  files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
52
41
  }, "strip", z.ZodTypeAny, {
53
- flow?: string | undefined;
54
42
  route?: string | undefined;
43
+ flow?: string | undefined;
55
44
  files?: string[] | undefined;
56
45
  }, {
57
- flow?: string | undefined;
58
46
  route?: string | undefined;
47
+ flow?: string | undefined;
59
48
  files?: string[] | undefined;
60
49
  }>;
61
50
  export type IntentSurface = z.infer<typeof IntentSurfaceSchema>;
@@ -66,12 +55,12 @@ export declare const IntentProofSchema: z.ZodObject<{
66
55
  at: z.ZodNumber;
67
56
  }, "strip", z.ZodTypeAny, {
68
57
  at: number;
69
- verdictId: string;
70
58
  grade: string;
59
+ verdictId: string;
71
60
  }, {
72
61
  at: number;
73
- verdictId: string;
74
62
  grade: string;
63
+ verdictId: string;
75
64
  }>;
76
65
  export declare const IntentSchema: z.ZodObject<{
77
66
  id: z.ZodString;
@@ -86,12 +75,12 @@ export declare const IntentSchema: z.ZodObject<{
86
75
  flow: z.ZodOptional<z.ZodString>;
87
76
  files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
88
77
  }, "strip", z.ZodTypeAny, {
89
- flow?: string | undefined;
90
78
  route?: string | undefined;
79
+ flow?: string | undefined;
91
80
  files?: string[] | undefined;
92
81
  }, {
93
- flow?: string | undefined;
94
82
  route?: string | undefined;
83
+ flow?: string | undefined;
95
84
  files?: string[] | undefined;
96
85
  }>>;
97
86
  provenBy: z.ZodOptional<z.ZodObject<{
@@ -100,12 +89,12 @@ export declare const IntentSchema: z.ZodObject<{
100
89
  at: z.ZodNumber;
101
90
  }, "strip", z.ZodTypeAny, {
102
91
  at: number;
103
- verdictId: string;
104
92
  grade: string;
93
+ verdictId: string;
105
94
  }, {
106
95
  at: number;
107
- verdictId: string;
108
96
  grade: string;
97
+ verdictId: string;
109
98
  }>>;
110
99
  /** Every statement this intent previously carried, oldest first. Append-only, never rewritten. */
111
100
  amended: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -119,40 +108,40 @@ export declare const IntentSchema: z.ZodObject<{
119
108
  statement: string;
120
109
  }>, "many">>;
121
110
  }, "strip", z.ZodTypeAny, {
122
- id: string;
123
111
  state: "proved" | "declared" | "bound";
112
+ id: string;
124
113
  statement: string;
125
114
  declaredAt: number;
126
115
  surface?: {
127
- flow?: string | undefined;
128
116
  route?: string | undefined;
117
+ flow?: string | undefined;
129
118
  files?: string[] | undefined;
130
119
  } | undefined;
131
120
  binding?: unknown;
132
121
  provenBy?: {
133
122
  at: number;
134
- verdictId: string;
135
123
  grade: string;
124
+ verdictId: string;
136
125
  } | undefined;
137
126
  amended?: {
138
127
  at: number;
139
128
  statement: string;
140
129
  }[] | undefined;
141
130
  }, {
142
- id: string;
143
131
  state: "proved" | "declared" | "bound";
132
+ id: string;
144
133
  statement: string;
145
134
  declaredAt: number;
146
135
  surface?: {
147
- flow?: string | undefined;
148
136
  route?: string | undefined;
137
+ flow?: string | undefined;
149
138
  files?: string[] | undefined;
150
139
  } | undefined;
151
140
  binding?: unknown;
152
141
  provenBy?: {
153
142
  at: number;
154
- verdictId: string;
155
143
  grade: string;
144
+ verdictId: string;
156
145
  } | undefined;
157
146
  amended?: {
158
147
  at: number;
@@ -175,12 +164,12 @@ export declare const IntentFileSchema: z.ZodObject<{
175
164
  flow: z.ZodOptional<z.ZodString>;
176
165
  files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
177
166
  }, "strip", z.ZodTypeAny, {
178
- flow?: string | undefined;
179
167
  route?: string | undefined;
168
+ flow?: string | undefined;
180
169
  files?: string[] | undefined;
181
170
  }, {
182
- flow?: string | undefined;
183
171
  route?: string | undefined;
172
+ flow?: string | undefined;
184
173
  files?: string[] | undefined;
185
174
  }>>;
186
175
  provenBy: z.ZodOptional<z.ZodObject<{
@@ -189,12 +178,12 @@ export declare const IntentFileSchema: z.ZodObject<{
189
178
  at: z.ZodNumber;
190
179
  }, "strip", z.ZodTypeAny, {
191
180
  at: number;
192
- verdictId: string;
193
181
  grade: string;
182
+ verdictId: string;
194
183
  }, {
195
184
  at: number;
196
- verdictId: string;
197
185
  grade: string;
186
+ verdictId: string;
198
187
  }>>;
199
188
  /** Every statement this intent previously carried, oldest first. Append-only, never rewritten. */
200
189
  amended: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -208,40 +197,40 @@ export declare const IntentFileSchema: z.ZodObject<{
208
197
  statement: string;
209
198
  }>, "many">>;
210
199
  }, "strip", z.ZodTypeAny, {
211
- id: string;
212
200
  state: "proved" | "declared" | "bound";
201
+ id: string;
213
202
  statement: string;
214
203
  declaredAt: number;
215
204
  surface?: {
216
- flow?: string | undefined;
217
205
  route?: string | undefined;
206
+ flow?: string | undefined;
218
207
  files?: string[] | undefined;
219
208
  } | undefined;
220
209
  binding?: unknown;
221
210
  provenBy?: {
222
211
  at: number;
223
- verdictId: string;
224
212
  grade: string;
213
+ verdictId: string;
225
214
  } | undefined;
226
215
  amended?: {
227
216
  at: number;
228
217
  statement: string;
229
218
  }[] | undefined;
230
219
  }, {
231
- id: string;
232
220
  state: "proved" | "declared" | "bound";
221
+ id: string;
233
222
  statement: string;
234
223
  declaredAt: number;
235
224
  surface?: {
236
- flow?: string | undefined;
237
225
  route?: string | undefined;
226
+ flow?: string | undefined;
238
227
  files?: string[] | undefined;
239
228
  } | undefined;
240
229
  binding?: unknown;
241
230
  provenBy?: {
242
231
  at: number;
243
- verdictId: string;
244
232
  grade: string;
233
+ verdictId: string;
245
234
  } | undefined;
246
235
  amended?: {
247
236
  at: number;
@@ -251,20 +240,20 @@ export declare const IntentFileSchema: z.ZodObject<{
251
240
  }, "strip", z.ZodTypeAny, {
252
241
  version: 1;
253
242
  intents: Record<string, {
254
- id: string;
255
243
  state: "proved" | "declared" | "bound";
244
+ id: string;
256
245
  statement: string;
257
246
  declaredAt: number;
258
247
  surface?: {
259
- flow?: string | undefined;
260
248
  route?: string | undefined;
249
+ flow?: string | undefined;
261
250
  files?: string[] | undefined;
262
251
  } | undefined;
263
252
  binding?: unknown;
264
253
  provenBy?: {
265
254
  at: number;
266
- verdictId: string;
267
255
  grade: string;
256
+ verdictId: string;
268
257
  } | undefined;
269
258
  amended?: {
270
259
  at: number;
@@ -274,20 +263,20 @@ export declare const IntentFileSchema: z.ZodObject<{
274
263
  }, {
275
264
  version: 1;
276
265
  intents: Record<string, {
277
- id: string;
278
266
  state: "proved" | "declared" | "bound";
267
+ id: string;
279
268
  statement: string;
280
269
  declaredAt: number;
281
270
  surface?: {
282
- flow?: string | undefined;
283
271
  route?: string | undefined;
272
+ flow?: string | undefined;
284
273
  files?: string[] | undefined;
285
274
  } | undefined;
286
275
  binding?: unknown;
287
276
  provenBy?: {
288
277
  at: number;
289
- verdictId: string;
290
278
  grade: string;
279
+ verdictId: string;
291
280
  } | undefined;
292
281
  amended?: {
293
282
  at: number;
@@ -319,7 +308,7 @@ export declare function dischargeIntent(intent: Intent, proof: {
319
308
  at: number;
320
309
  }): Intent;
321
310
  /**
322
- * Add or amend an intent, keeping what it used to say.
311
+ * Add or amend an intent, keeping the previous statement in its history.
323
312
  *
324
313
  * An amendment is recorded only when the statement actually changed — re-declaring the same intent
325
314
  * unchanged is what a re-run does, and filling the history with identical rows would bury the one
@@ -8,31 +8,20 @@ import { z } from 'zod';
8
8
  * holding the DOM, the diff, and no intent. So it asserts what it can SEE rather than what was
9
9
  * MEANT, and what it can see is almost always weaker. That gap is where a false green comes from.
10
10
  *
11
- * ## Why the prose is captured early and the predicate late
11
+ * ## Prose early, predicate late
12
12
  *
13
- * Intent has two properties that move in opposite directions over the life of a task.
14
- *
15
- * **Fidelity** is highest the moment the human asks and decays from there; every later restatement
16
- * is a lossy re-derivation. **Bindability** — whether it can be written as something checkable — is
17
- * near zero then, because there is no route, no ref and often no code, and rises as the code
18
- * appears.
19
- *
20
- * Capture at either end alone loses one of them. Demanding a predicate at declare time collects
21
- * MECHANISMS, which is what assertions already are. Waiting until drive time collects a
22
- * RE-DERIVATION, which is the weak artifact this exists to replace — by then the agent has already
23
- * forgotten, and that is the entire premise.
24
- *
25
- * So: `statement` is prose and mandatory. `binding` is a predicate, optional, and may arrive later
26
- * or never. An intent that stays `declared` and never becomes `bound` is not a failure — it is the
27
- * most interesting row in the ledger, because it names something the team meant that nothing can
28
- * currently prove.
13
+ * Fidelity is highest the moment the human asks and decays from there. Bindability — whether it can
14
+ * be written as something checkable — is near zero then and rises as the code appears. So
15
+ * `statement` is prose and mandatory, and `binding` is a predicate, optional, arriving later or
16
+ * never. An intent that stays `declared` is not a failure: it names something the team meant that
17
+ * nothing can currently prove.
29
18
  *
30
19
  * ## Amendments are append-only
31
20
  *
32
- * A long build changes its mind, so an intent must be amendable. But an amendable intent is also how
33
- * an agent could quietly rewrite what it meant to match what it can already prove. Keeping the
34
- * previous statement makes a NARROWING visible in the git diff, which is the only real defence —
35
- * and it is a partial one, stated here rather than papered over.
21
+ * A long build changes its mind, so an intent must be amendable — and an amendable intent is also
22
+ * how an agent could quietly rewrite what it meant to match what it can already prove. Keeping the
23
+ * previous statement makes a NARROWING visible in the git diff. That is a PARTIAL defence and the
24
+ * only one there is.
36
25
  */
37
26
  export const INTENT_FILE_VERSION = 1;
38
27
  export const IntentState = {
@@ -102,7 +91,7 @@ export function dischargeIntent(intent, proof) {
102
91
  return { ...intent, state: IntentState.PROVED, provenBy: proof };
103
92
  }
104
93
  /**
105
- * Add or amend an intent, keeping what it used to say.
94
+ * Add or amend an intent, keeping the previous statement in its history.
106
95
  *
107
96
  * An amendment is recorded only when the statement actually changed — re-declaring the same intent
108
97
  * unchanged is what a re-run does, and filling the history with identical rows would bury the one
@@ -0,0 +1,44 @@
1
+ import type { RunId, RunVerdict } from './verification-run.js';
2
+ /**
3
+ * Correcting a verdict when the truth arrives after the window closed.
4
+ *
5
+ * Two of the reasons a verdict can carry mean, in plain words, "the truth has not arrived yet": a
6
+ * write the server accepted for later processing, and a window that closed while something was
7
+ * still in flight. Both were final the moment they were made. A write that is accepted and then
8
+ * succeeds was recorded as `unknown` forever, and nothing anywhere could say otherwise.
9
+ *
10
+ * That is an unsoundness rather than a missing convenience. A judgement made over a bounded stretch
11
+ * of time, presented as final, is a claim the evidence does not support -- the evidence supports
12
+ * "this is what it looked like by the time we stopped watching".
13
+ *
14
+ * **A revision never edits the verdict it replaces.** It is a new verdict that cites the old one.
15
+ * Both are kept. Anybody reading them can see that the first answer was given, when it changed, and
16
+ * why -- and "we always knew" stops being expressible.
17
+ *
18
+ * Nothing calls this yet. The mechanism exists so that a later adjudication over late evidence has
19
+ * somewhere to put its answer; wiring it into a live adjudication changes what verdicts a run
20
+ * produces, which is a measurable change and belongs with its measurement.
21
+ */
22
+ /** How a verdict is named, so another can point at it. */
23
+ export declare function citeVerdict(runId: RunId, checkId: string): string;
24
+ /** Is this verdict a correction of that one? */
25
+ export declare function isRevisionOf(verdict: RunVerdict, runId: RunId, checkId: string): boolean;
26
+ interface Revision {
27
+ /** The verdict being corrected. Left untouched. */
28
+ readonly earlier: RunVerdict;
29
+ /** The run the earlier verdict belongs to. */
30
+ readonly earlierRunId: RunId;
31
+ /** What the answer is now that the rest of the evidence has arrived. */
32
+ readonly status: RunVerdict['status'];
33
+ /** Why it changed, in the words of whoever made the new judgement. */
34
+ readonly reasons: readonly string[];
35
+ }
36
+ /**
37
+ * A new verdict that corrects an earlier one.
38
+ *
39
+ * Returns a fresh object; the earlier verdict is not modified. It carries the new reasons rather
40
+ * than appending to the old ones -- the old ones described what was known at the time, and they are
41
+ * still there, on the verdict this one cites.
42
+ */
43
+ export declare function reviseVerdict(revision: Revision): RunVerdict;
44
+ export {};
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Correcting a verdict when the truth arrives after the window closed.
3
+ *
4
+ * Two of the reasons a verdict can carry mean, in plain words, "the truth has not arrived yet": a
5
+ * write the server accepted for later processing, and a window that closed while something was
6
+ * still in flight. Both were final the moment they were made. A write that is accepted and then
7
+ * succeeds was recorded as `unknown` forever, and nothing anywhere could say otherwise.
8
+ *
9
+ * That is an unsoundness rather than a missing convenience. A judgement made over a bounded stretch
10
+ * of time, presented as final, is a claim the evidence does not support -- the evidence supports
11
+ * "this is what it looked like by the time we stopped watching".
12
+ *
13
+ * **A revision never edits the verdict it replaces.** It is a new verdict that cites the old one.
14
+ * Both are kept. Anybody reading them can see that the first answer was given, when it changed, and
15
+ * why -- and "we always knew" stops being expressible.
16
+ *
17
+ * Nothing calls this yet. The mechanism exists so that a later adjudication over late evidence has
18
+ * somewhere to put its answer; wiring it into a live adjudication changes what verdicts a run
19
+ * produces, which is a measurable change and belongs with its measurement.
20
+ */
21
+ /** How a verdict is named, so another can point at it. */
22
+ export function citeVerdict(runId, checkId) {
23
+ return `${runId}#${checkId}`;
24
+ }
25
+ /** Is this verdict a correction of that one? */
26
+ export function isRevisionOf(verdict, runId, checkId) {
27
+ return verdict.supersedes === citeVerdict(runId, checkId);
28
+ }
29
+ /**
30
+ * A new verdict that corrects an earlier one.
31
+ *
32
+ * Returns a fresh object; the earlier verdict is not modified. It carries the new reasons rather
33
+ * than appending to the old ones -- the old ones described what was known at the time, and they are
34
+ * still there, on the verdict this one cites.
35
+ */
36
+ export function reviseVerdict(revision) {
37
+ const { earlier, earlierRunId, status, reasons } = revision;
38
+ const checkId = earlier.checkId;
39
+ if (checkId === undefined) {
40
+ // A citation nobody can resolve is not a citation. Refusing here is better than emitting a
41
+ // correction that points at something unidentifiable.
42
+ throw new Error('cannot revise a verdict that never said which check it was about: nothing could resolve ' +
43
+ 'the citation, so the correction would claim to replace something nobody can find');
44
+ }
45
+ return {
46
+ status,
47
+ reasons: [...reasons],
48
+ confidence: earlier.confidence,
49
+ blockingRisks: earlier.blockingRisks,
50
+ checkId,
51
+ supersedes: citeVerdict(earlierRunId, checkId),
52
+ };
53
+ }
@@ -1,43 +1,22 @@
1
1
  /**
2
2
  * What a run has established, held so the agent can ASK for it back.
3
3
  *
4
- * Verification is multi-step, and the only thing holding the thread together is the agent's own
5
- * context window. When that compacts, or the turn ends, or a sub-agent takes over, the thread is
6
- * gone and the work restarts. The shape of that shows in the field without needing the theory: long
7
- * runs of the same read-only call, an agent searching by exhaustion because it no longer remembers
8
- * what it already saw.
4
+ * PULLED, NEVER PUSHED. Riding along on every tool response duplicates context the agent still has,
5
+ * on every call. The value is not that Reticle remembers MORE, it is that Reticle's copy does not
6
+ * degrade when the agent's does — so the agent asks once, at the moment its own memory is gone.
7
+ * That is why nothing here returns `undefined` for an empty run: a pull was asked a question, and
8
+ * "nothing established yet" is the answer the asker needs.
9
9
  *
10
- * ## Pulled, never pushed
10
+ * It must SHRINK, not grow: superseding facts REPLACE rather than append, and both blocks are
11
+ * capped.
11
12
  *
12
- * An earlier version of this rode along on every tool response. It cost +136% on a verdict and was
13
- * cut, because the agent still had most of that context most of the time: we paid on every call to
14
- * duplicate what it already knew. The asymmetry that makes the feature work is not that Reticle
15
- * remembers MORE, it is that Reticle's copy does not degrade at the moment the agent's does. So the
16
- * agent asks, at the moment it knows its own memory is gone, and pays once.
13
+ * A fact that can be wrong is worse than no fact, so every one carries the document AND the edit
14
+ * epoch it was observed under and is dropped the moment either moves — `isSameDocument` /
15
+ * `isSameEditEpoch`, no grace period.
17
16
  *
18
- * That inversion is why nothing here returns `undefined` for an empty run. A push had to stay silent
19
- * when it had nothing to say; a pull was asked a question, and "nothing established yet" is the
20
- * answer the asker needs.
21
- *
22
- * ## Two rules stop it becoming the thing it prevents
23
- *
24
- * **It must shrink, not grow.** Superseding facts REPLACE rather than append, and both blocks are
25
- * capped. A context object that accumulates is a token bomb, and read-only payloads are already the
26
- * largest thing this product emits.
27
- *
28
- * **Memory that can be wrong is worse than no memory.** A stale established fact is precisely the
29
- * false-green mechanism this product exists to prevent, and stale refs are already the most common
30
- * error an agent sees from us. So every fact carries the document AND the edit epoch it was observed
31
- * under, and is dropped the moment either moves: no grace period, no probably-fine. The comparison
32
- * is `isSameDocument`/`isSameEditEpoch` rather than a third rule written beside them.
33
- *
34
- * ## What may never go in
35
- *
36
- * Only what Reticle OBSERVED. Never what the agent intends, plans, or believes: that is not ours to
37
- * hold, it is unbounded, and a verification tool that remembers what an agent was thinking is
38
- * inventing evidence. `remaining` is the one forward-looking field and it is derived mechanically
39
- * from declared bindings, so it remains a report of a fact — which bindings are undischarged — and
40
- * not a prediction.
17
+ * Only what Reticle OBSERVED goes in, never what the agent intends or believes: that is unbounded,
18
+ * and remembering it would be inventing evidence. `remaining` is the one forward-looking field and
19
+ * is derived mechanically from declared bindings, so it reports a fact rather than a prediction.
41
20
  */
42
21
  import { type Intent } from './intent.js';
43
22
  import type { Verified } from './verified-constants.js';
@@ -1,46 +1,25 @@
1
1
  /**
2
2
  * What a run has established, held so the agent can ASK for it back.
3
3
  *
4
- * Verification is multi-step, and the only thing holding the thread together is the agent's own
5
- * context window. When that compacts, or the turn ends, or a sub-agent takes over, the thread is
6
- * gone and the work restarts. The shape of that shows in the field without needing the theory: long
7
- * runs of the same read-only call, an agent searching by exhaustion because it no longer remembers
8
- * what it already saw.
4
+ * PULLED, NEVER PUSHED. Riding along on every tool response duplicates context the agent still has,
5
+ * on every call. The value is not that Reticle remembers MORE, it is that Reticle's copy does not
6
+ * degrade when the agent's does — so the agent asks once, at the moment its own memory is gone.
7
+ * That is why nothing here returns `undefined` for an empty run: a pull was asked a question, and
8
+ * "nothing established yet" is the answer the asker needs.
9
9
  *
10
- * ## Pulled, never pushed
10
+ * It must SHRINK, not grow: superseding facts REPLACE rather than append, and both blocks are
11
+ * capped.
11
12
  *
12
- * An earlier version of this rode along on every tool response. It cost +136% on a verdict and was
13
- * cut, because the agent still had most of that context most of the time: we paid on every call to
14
- * duplicate what it already knew. The asymmetry that makes the feature work is not that Reticle
15
- * remembers MORE, it is that Reticle's copy does not degrade at the moment the agent's does. So the
16
- * agent asks, at the moment it knows its own memory is gone, and pays once.
13
+ * A fact that can be wrong is worse than no fact, so every one carries the document AND the edit
14
+ * epoch it was observed under and is dropped the moment either moves — `isSameDocument` /
15
+ * `isSameEditEpoch`, no grace period.
17
16
  *
18
- * That inversion is why nothing here returns `undefined` for an empty run. A push had to stay silent
19
- * when it had nothing to say; a pull was asked a question, and "nothing established yet" is the
20
- * answer the asker needs.
21
- *
22
- * ## Two rules stop it becoming the thing it prevents
23
- *
24
- * **It must shrink, not grow.** Superseding facts REPLACE rather than append, and both blocks are
25
- * capped. A context object that accumulates is a token bomb, and read-only payloads are already the
26
- * largest thing this product emits.
27
- *
28
- * **Memory that can be wrong is worse than no memory.** A stale established fact is precisely the
29
- * false-green mechanism this product exists to prevent, and stale refs are already the most common
30
- * error an agent sees from us. So every fact carries the document AND the edit epoch it was observed
31
- * under, and is dropped the moment either moves: no grace period, no probably-fine. The comparison
32
- * is `isSameDocument`/`isSameEditEpoch` rather than a third rule written beside them.
33
- *
34
- * ## What may never go in
35
- *
36
- * Only what Reticle OBSERVED. Never what the agent intends, plans, or believes: that is not ours to
37
- * hold, it is unbounded, and a verification tool that remembers what an agent was thinking is
38
- * inventing evidence. `remaining` is the one forward-looking field and it is derived mechanically
39
- * from declared bindings, so it remains a report of a fact — which bindings are undischarged — and
40
- * not a prediction.
17
+ * Only what Reticle OBSERVED goes in, never what the agent intends or believes: that is unbounded,
18
+ * and remembering it would be inventing evidence. `remaining` is the one forward-looking field and
19
+ * is derived mechanically from declared bindings, so it reports a fact rather than a prediction.
41
20
  */
42
- import { isSameDocument } from './document-identity.js';
43
- import { isSameEditEpoch } from './edit-epoch.js';
21
+ import { isSameDocument } from '../identity/document-identity.js';
22
+ import { isSameEditEpoch } from '../identity/edit-epoch.js';
44
23
  import { IntentState } from './intent.js';
45
24
  /**
46
25
  * How many rows either block may carry.
@@ -1,40 +1,31 @@
1
1
  /**
2
2
  * Labels that can trigger an irreversible or money-moving effect.
3
3
  *
4
- * `send` used to be a bare token here, to cover moving money, and it taxed every ordinary button
5
- * that sends something: reported from the field on `Send check-in` (a POST that logs a text
6
- * message) and alongside it `Send message`, `Send invite`, `Send feedback`. A false block costs a
7
- * round-trip and, repeated, trains an agent to pass confirmDangerous reflexively — which is the one
8
- * outcome that makes this guard worthless.
4
+ * `send` is deliberately NOT a bare token here. It taxes every ordinary button that sends
5
+ * something — `Send message`, `Send invite`, `Send feedback`, `Send check-in` — and a false block
6
+ * costs a round-trip and, repeated, trains an agent to pass confirmDangerous reflexively, which is
7
+ * the one outcome that makes this guard worthless.
9
8
  *
10
9
  * The money cases are still covered, through the thing being SENT rather than the act of sending:
11
10
  * `payment` catches "Send payment" and "Confirm payment" (which the bare-verb list missed entirely,
12
11
  * because `\bpay\b` does not match "payment"), and `send money`/`send funds` catch the rest.
13
12
  *
14
- * `logout` / `log out` / `sign out` were here and are not. Signing out is reversible, and the
15
- * words fire on almost every authenticated drive — a `Log out` menuitem was blocked on every
16
- * session. Same cost as `send`: a guard that fires on routine controls trains agents to pass
17
- * `confirmDangerous` reflexively.
13
+ * `logout` / `log out` / `sign out` are deliberately absent for the same reason: signing out is
14
+ * reversible, and the words fire on almost every authenticated drive.
18
15
  *
19
16
  * The guard stays deliberately asymmetric — a false block costs one round-trip, a missed block can
20
- * charge somebody's card — so this narrows the trigger without lowering money coverage. Both
21
- * directions are pinned in security.test.ts.
17
+ * charge somebody's card — so the trigger narrows without lowering money coverage. Both directions
18
+ * are pinned in security.test.ts.
22
19
  */
23
20
  /**
24
21
  * Labels that read as irreversible: something is destroyed, or money moves.
25
22
  *
26
- * `deploy` and `publish` were here and are not. The guard's contract — written at the top of
23
+ * `deploy` and `publish` are deliberately absent. The guard's contract — written at the top of
27
24
  * act-danger.ts — is "a money-moving or destructive control", and a deploy is neither: nothing is
28
- * destroyed, nothing is paid, and the thing it produces did not exist before. Consequential is a
25
+ * destroyed, nothing is paid, and the thing it produces did not exist before. CONSEQUENTIAL is a
29
26
  * wider net than this list is allowed to be, or half the buttons in a dev tool sit behind a
30
- * permission flag.
31
- *
32
- * Removed on measurement, not taste. Three benchmark runs against an app with a "New deploy" button
33
- * lost their ENTIRE turn budget to the refusal. Improving its wording did not rescue the last one:
34
- * the agent spent its remaining turns weighing a bug report about the block and looking for a
35
- * webmcp workaround. A guard that costs a whole run on a control it was never written to catch is
36
- * not protecting anybody — it is training agents to route around it, which is worse than not having
37
- * it, because the routing-around generalises to the buttons that DO matter.
27
+ * permission flag — and a guard that fires on a control it was never written to catch trains agents
28
+ * to route around it, which generalises to the buttons that DO matter.
38
29
  */
39
30
  const DANGEROUS_ACTION = /\b(delete|remove|destroy|erase|drop|terminate|revoke|reset|close account|cancel subscription|purchase|buy|pay|payment|place order|confirm order|send money|send funds|transfer|withdraw|refund)\b/i;
40
31
  /**