@reticlehq/core 3.7.0 → 3.8.1

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 (138) hide show
  1. package/dist/activation-entry.d.ts +9 -0
  2. package/dist/activation-entry.js +9 -0
  3. package/dist/artifacts/drive-script.d.ts +84 -1217
  4. package/dist/artifacts/drive-script.js +1 -1
  5. package/dist/artifacts/flow-constants.d.ts +15 -0
  6. package/dist/artifacts/flow-constants.js +15 -0
  7. package/dist/artifacts/flow-expect-flat.d.ts +8 -192
  8. package/dist/artifacts/flow-expect-flat.js +2 -2
  9. package/dist/artifacts/flow-results.d.ts +26 -0
  10. package/dist/artifacts/flow-types.d.ts +212 -2295
  11. package/dist/artifacts/flow-types.js +14 -2
  12. package/dist/artifacts/harness-credits.d.ts +6 -3
  13. package/dist/artifacts/harness-credits.js +9 -6
  14. package/dist/artifacts/harness-map.d.ts +8 -69
  15. package/dist/artifacts/harness-map.js +1 -1
  16. package/dist/artifacts/hud-notices.d.ts +8 -82
  17. package/dist/artifacts/hud-notices.js +1 -1
  18. package/dist/artifacts/impact.d.ts +104 -1665
  19. package/dist/artifacts/impact.js +38 -21
  20. package/dist/artifacts/journal.d.ts +15 -231
  21. package/dist/artifacts/journal.js +15 -2
  22. package/dist/artifacts/prompt-context.d.ts +7 -33
  23. package/dist/artifacts/prompt-context.js +15 -4
  24. package/dist/artifacts/screenshot-upload.d.ts +3 -26
  25. package/dist/artifacts/screenshot-upload.js +1 -1
  26. package/dist/graph/app-graph.d.ts +137 -0
  27. package/dist/graph/app-graph.js +498 -0
  28. package/dist/hooks/hook-events.d.ts +15 -171
  29. package/dist/hooks/hook-events.js +1 -1
  30. package/dist/hud-entry.js +1 -1
  31. package/dist/identity/checkout.d.ts +41 -0
  32. package/dist/identity/checkout.js +118 -0
  33. package/dist/identity/state-dir.d.ts +23 -0
  34. package/dist/identity/state-dir.js +43 -0
  35. package/dist/index.d.ts +10 -0
  36. package/dist/index.js +10 -0
  37. package/dist/onboarding.d.ts +23 -52
  38. package/dist/onboarding.js +20 -1
  39. package/dist/registry/daemon-registry.d.ts +2 -14
  40. package/dist/registry/daemon-registry.js +1 -1
  41. package/dist/registry/dev-server-registry.d.ts +2 -31
  42. package/dist/registry/dev-server-registry.js +1 -1
  43. package/dist/registry/project-registry.d.ts +4 -32
  44. package/dist/registry/project-registry.js +1 -1
  45. package/dist/schema/command-message.json +65 -68
  46. package/dist/schema/command-name.json +29 -33
  47. package/dist/schema/command-result.json +25 -30
  48. package/dist/schema/event-message.json +104 -101
  49. package/dist/schema/event-payloads.json +246 -108
  50. package/dist/schema/event-type.json +47 -48
  51. package/dist/schema/hello-message.json +150 -133
  52. package/dist/schema/reticle-event.json +98 -94
  53. package/dist/schema/reticle-message.json +338 -310
  54. package/dist/telemetry-bug.d.ts +4 -75
  55. package/dist/telemetry-bug.js +1 -1
  56. package/dist/telemetry-entry.d.ts +1 -1
  57. package/dist/telemetry-entry.js +1 -1
  58. package/dist/telemetry-feedback.d.ts +17 -91
  59. package/dist/telemetry-feedback.js +20 -1
  60. package/dist/telemetry-refusal.d.ts +4 -31
  61. package/dist/telemetry-refusal.js +1 -1
  62. package/dist/telemetry-session.d.ts +45 -624
  63. package/dist/telemetry-session.js +25 -12
  64. package/dist/telemetry-signals.d.ts +211 -86
  65. package/dist/telemetry-signals.js +100 -2
  66. package/dist/telemetry.d.ts +321 -1691
  67. package/dist/telemetry.js +72 -6
  68. package/dist/verdict/check-sentence.d.ts +34 -0
  69. package/dist/verdict/check-sentence.js +228 -0
  70. package/dist/verdict/compare-source.d.ts +1 -1
  71. package/dist/verdict/compare-source.js +1 -1
  72. package/dist/verdict/consequence.d.ts +15 -0
  73. package/dist/verdict/consequence.js +11 -0
  74. package/dist/verdict/disparity.d.ts +8 -56
  75. package/dist/verdict/disparity.js +1 -1
  76. package/dist/verdict/findings.d.ts +10 -0
  77. package/dist/verdict/findings.js +13 -0
  78. package/dist/verdict/instrumentation-coverage.d.ts +6 -37
  79. package/dist/verdict/instrumentation-coverage.js +15 -59
  80. package/dist/verdict/instrumentation-gap.d.ts +72 -0
  81. package/dist/verdict/instrumentation-gap.js +64 -0
  82. package/dist/verdict/intent.d.ts +25 -224
  83. package/dist/verdict/intent.js +1 -1
  84. package/dist/verdict/predicate-tree.d.ts +2 -0
  85. package/dist/verdict/predicate-tree.js +16 -0
  86. package/dist/verdict/predicate.d.ts +3 -2
  87. package/dist/verdict/predicate.js +107 -16
  88. package/dist/verdict/property-assertion.d.ts +23 -101
  89. package/dist/verdict/property-assertion.js +1 -1
  90. package/dist/verdict/run-report.d.ts +71 -0
  91. package/dist/verdict/run-report.js +53 -0
  92. package/dist/verdict/security.d.ts +48 -2
  93. package/dist/verdict/security.js +185 -18
  94. package/dist/verdict/verification-run.d.ts +124 -1623
  95. package/dist/verdict/verification-run.js +37 -6
  96. package/dist/verdict/verify-progress.d.ts +22 -64
  97. package/dist/verdict/verify-progress.js +1 -1
  98. package/dist/wire/constants/constants.d.ts +56 -141
  99. package/dist/wire/constants/constants.js +64 -144
  100. package/dist/wire/constants/discovery.d.ts +4 -4
  101. package/dist/wire/constants/discovery.js +4 -4
  102. package/dist/wire/constants/event-types.d.ts +37 -1
  103. package/dist/wire/constants/event-types.js +35 -1
  104. package/dist/wire/constants/hud-controls.js +0 -2
  105. package/dist/wire/constants/hud-use.d.ts +4 -0
  106. package/dist/wire/constants/hud-use.js +4 -0
  107. package/dist/wire/constants/mcp-wire.d.ts +16 -0
  108. package/dist/wire/constants/mcp-wire.js +16 -0
  109. package/dist/wire/constants/response-body-reason.d.ts +19 -0
  110. package/dist/wire/constants/response-body-reason.js +18 -0
  111. package/dist/wire/constants/reticle-env.d.ts +140 -0
  112. package/dist/wire/constants/reticle-env.js +140 -0
  113. package/dist/wire/constants/session-constants.d.ts +11 -0
  114. package/dist/wire/constants/session-constants.js +11 -0
  115. package/dist/wire/event-payloads.d.ts +173 -629
  116. package/dist/wire/event-payloads.js +107 -23
  117. package/dist/wire/event-priority.js +1 -0
  118. package/dist/wire/messages.d.ts +90 -713
  119. package/dist/wire/messages.js +19 -3
  120. package/dist/wire/narrow.d.ts +6 -0
  121. package/dist/wire/narrow.js +26 -0
  122. package/dist/wire/next-step.d.ts +50 -0
  123. package/dist/wire/next-step.js +37 -0
  124. package/dist/wire/platform-link.d.ts +7 -0
  125. package/dist/wire/platform-link.js +14 -8
  126. package/dist/wire/production/activation-ticket.d.ts +64 -0
  127. package/dist/wire/production/activation-ticket.js +148 -0
  128. package/dist/wire/production/hello-mode.d.ts +35 -0
  129. package/dist/wire/production/hello-mode.js +32 -0
  130. package/dist/wire/production/production-policy.d.ts +92 -0
  131. package/dist/wire/production/production-policy.js +133 -0
  132. package/dist/wire/tool-names.d.ts +2 -0
  133. package/dist/wire/tool-names.js +2 -0
  134. package/dist/wire/types.d.ts +102 -700
  135. package/dist/wire/types.js +5 -5
  136. package/dist/words/upgrade.d.ts +3 -13
  137. package/dist/words/upgrade.js +1 -1
  138. package/package.json +7 -4
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  /**
3
3
  * The impact record: what Reticle has actually done for this user, and what that is worth.
4
4
  *
@@ -140,7 +140,7 @@ export const AccountStateSchema = z.object({
140
140
  email: z.string().optional(),
141
141
  host: z.string().optional(),
142
142
  });
143
- /** The grant Harness credits came from: sign-up, the card-started trial, or a paid plan. */
143
+ /** The grant credits came from: sign-up, the card-started trial, or a paid plan. */
144
144
  export const CreditKind = { FREE: 'free', TRIAL: 'trial', PAID: 'paid' };
145
145
  /**
146
146
  * What the platform says about autonomous driving for this project.
@@ -156,11 +156,13 @@ export const HarnessConfigSchema = z.object({
156
156
  harnessEntitled: z.boolean(),
157
157
  /** Whether the selected provider has a usable platform key. Older daemons may omit it. */
158
158
  providerReady: z.boolean().optional(),
159
- /** Harness credits used and held this 30 days; one is one Harness decision. Absent: unbounded or unknown. */
159
+ /** Credits used and held this 30 days; a Harness decision is one. Absent: unbounded or unknown. */
160
160
  credits: z
161
161
  .object({
162
- used: z.number().int().min(0),
163
- limit: z.number().int().min(0),
162
+ // Not `.int()`: the platform charges part credits (a check can cost 0.25). One float here
163
+ // failed the whole impact snapshot, and the HUD then showed no account and no Harness at all.
164
+ used: z.number().min(0),
165
+ limit: z.number().min(0),
164
166
  /** The grant they came from. Optional on the wire: an older platform omits it. */
165
167
  kind: z.enum([CreditKind.FREE, CreditKind.TRIAL, CreditKind.PAID]).optional(),
166
168
  /** Whole days the grant has left, counted by the daemon from the platform's end date. */
@@ -170,18 +172,10 @@ export const HarnessConfigSchema = z.object({
170
172
  /** The platform this answer came from, so the HUD's links go there and not to the hosted one. */
171
173
  platformUrl: z.string().optional(),
172
174
  /**
173
- * The platform's own Harness coverage gate, which it enforces. The HUD prefers it to the daemon's
174
- * local score; absent from an older platform, which leaves the local score to decide.
175
+ * The console's page for credits and the trial. The API and the console are two origins, so a
176
+ * link built from `platformUrl` opened a 404. The HUD links here, and to this origin for set-up.
175
177
  */
176
- gate: z
177
- .object({
178
- unlocked: z.boolean(),
179
- /** floor(score × 100); absent before any app reported. */
180
- percent: z.number().int().min(0).max(100).optional(),
181
- reason: z.string().max(400).optional(),
182
- prompt: z.string().max(4000).optional(),
183
- })
184
- .optional(),
178
+ planUrl: z.string().optional(),
185
179
  /** The plan in force: which grant, trial days left, seats. Absent from a platform that sent none. */
186
180
  plan: z
187
181
  .object({
@@ -195,8 +189,29 @@ export const HarnessConfigSchema = z.object({
195
189
  /** Memory entries the platform holds for this project. Absent: the platform did not say. */
196
190
  memoryEntries: z.number().int().min(0).optional(),
197
191
  });
198
- /** The Harness drive running in this tab's project, so the panel can show progress and Stop. */
199
- export const HarnessDriveSchema = z.object({ runId: z.string(), steps: z.number().int().min(0) });
192
+ /** How many of a running drive's latest lines the snapshot carries for the Harness page's log. */
193
+ export const HARNESS_LINES_MAX = 60;
194
+ /**
195
+ * The Harness drive running in this tab's project, so the panel can show progress and Stop.
196
+ *
197
+ * `lines` is the drive's step log, held by the daemon: kept in the HUD's view alone, it was empty
198
+ * after the Harness page was closed and reopened, or the page reloaded, mid-run.
199
+ */
200
+ export const HarnessDriveSchema = z.object({
201
+ runId: z.string(),
202
+ steps: z.number().int().min(0),
203
+ lines: z.array(z.string()).max(HARNESS_LINES_MAX).optional(),
204
+ });
205
+ /**
206
+ * This tab's last word from the Harness once nothing is driving: the finished run's result page,
207
+ * and, when it did not run to its end, why (stopped by a reload, refused, the cloud unreachable).
208
+ */
209
+ export const LastDriveSchema = z.object({
210
+ runUrl: z.string().optional(),
211
+ said: z.string().optional(),
212
+ /** Which word this is, rising: the page tells the answer to its press from an earlier word. */
213
+ seq: z.number().int().min(0).optional(),
214
+ });
200
215
  /** The longest note a person can send their coding agent from the HUD. */
201
216
  export const AGENT_NOTE_MAX = 500;
202
217
  /** How many of a tab's latest notes the HUD shows. */
@@ -247,6 +262,8 @@ export const ImpactSnapshotSchema = z.object({
247
262
  harnessConfig: HarnessConfigSchema.optional(),
248
263
  /** The drive running now, when there is one. Absent: nothing is driving. */
249
264
  harnessDrive: HarnessDriveSchema.optional(),
265
+ /** How the last drive on this tab ended, or why none started. Absent while one drives. */
266
+ lastDrive: LastDriveSchema.optional(),
250
267
  /** Who is coding against this daemon, and what this tab said to them. Absent: an older daemon. */
251
268
  agent: AgentLinkSchema.optional(),
252
269
  /**
@@ -262,17 +279,17 @@ export const ImpactSnapshotSchema = z.object({
262
279
  * Reticle Coverage: each level's percentage from the project's coverage ledger (`reached` routes,
263
280
  * `proved` controls, `executed` code, ...). Numbers only. Absent until something was measured.
264
281
  */
265
- coverage: z.record(z.number()).optional(),
282
+ coverage: z.record(z.string(), z.number()).optional(),
266
283
  /**
267
284
  * Where this project's work stands with the platform (status, runs on it, waiting, refused, last
268
285
  * push, and the sentence describing it). Loose here, shaped by the daemon's sync-status.
269
286
  */
270
- sync: z.record(z.unknown()).optional(),
287
+ sync: z.record(z.string(), z.unknown()).optional(),
271
288
  /**
272
289
  * How much of THIS tab's app Reticle sees, and the prompt that asks a coding agent to close the
273
290
  * rest (`covered`, `total`, `missing`, `prompt`). Loose here, shaped by the daemon's coverageOf.
274
291
  */
275
- instrumentation: z.record(z.unknown()).optional(),
292
+ instrumentation: z.record(z.string(), z.unknown()).optional(),
276
293
  });
277
294
  /** Empty counters - the starting point for a fresh store and the identity for merges. */
278
295
  export function emptyImpactCounts() {
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  /**
3
3
  * The durable causal journal. Each session gets an append-only pair on disk:
4
4
  * `.reticle/sessions/<id>/events.jsonl` (one `ReticleEvent` per line — already seq/actionId-stamped
@@ -19,130 +19,35 @@ export declare const JOURNAL_FILE_VERSION = 1;
19
19
  * tell what their agent proved from what the Harness proved.
20
20
  */
21
21
  export declare const DrivenBySchema: z.ZodObject<{
22
- /** One Harness drive; every action it took carries the same id. */
23
22
  harness: z.ZodString;
24
- /** Which model drove it: `server` is the platform's Harness. */
25
23
  driver: z.ZodString;
26
- /** The journey it was asked to complete, when one was named. */
27
24
  persona: z.ZodOptional<z.ZodString>;
28
- }, "strip", z.ZodTypeAny, {
29
- harness: string;
30
- driver: string;
31
- persona?: string | undefined;
32
- }, {
33
- harness: string;
34
- driver: string;
35
- persona?: string | undefined;
36
- }>;
25
+ }, z.core.$strip>;
37
26
  export type DrivenBy = z.infer<typeof DrivenBySchema>;
38
27
  export declare const JournalActionSchema: z.ZodObject<{
39
28
  v: z.ZodLiteral<1>;
40
- /** The command correlation id (`c<n>`) — the natural, cross-side-stable action identity. */
41
29
  actionId: z.ZodString;
42
- /** The MCP tool / command name that drove it (e.g. "reticle_act"). */
43
30
  tool: z.ZodString;
44
- /** Redacted invocation args. */
45
31
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
46
- /** Bounded effect summary (settle glyph, target, etc.). Kept open; narrowed by the writer. */
47
32
  effect: z.ZodOptional<z.ZodUnknown>;
48
- /** Whether the page settled within budget after the action, when known. */
49
33
  settled: z.ZodOptional<z.ZodBoolean>;
50
- /** Time from dispatch to settle in ms, when known. */
51
34
  settledInMs: z.ZodOptional<z.ZodNumber>;
52
- /** Inclusive seq range of events attributed to this action, when any were observed. */
53
35
  seqRange: z.ZodOptional<z.ZodObject<{
54
36
  from: z.ZodNumber;
55
37
  to: z.ZodNumber;
56
- }, "strip", z.ZodTypeAny, {
57
- from: number;
58
- to: number;
59
- }, {
60
- from: number;
61
- to: number;
62
- }>>;
63
- /** Elapsed-ms window [dispatch, resolve] used for window attribution. */
38
+ }, z.core.$strip>>;
64
39
  tRange: z.ZodObject<{
65
40
  from: z.ZodNumber;
66
41
  to: z.ZodNumber;
67
- }, "strip", z.ZodTypeAny, {
68
- from: number;
69
- to: number;
70
- }, {
71
- from: number;
72
- to: number;
73
- }>;
74
- /** Elapsed-ms timestamp the action was recorded at (clock injected by the writer). */
42
+ }, z.core.$strip>;
75
43
  at: z.ZodNumber;
76
- /** Set only when the Harness drove this action; absent means the connected agent did. */
77
44
  drivenBy: z.ZodOptional<z.ZodObject<{
78
- /** One Harness drive; every action it took carries the same id. */
79
45
  harness: z.ZodString;
80
- /** Which model drove it: `server` is the platform's Harness. */
81
46
  driver: z.ZodString;
82
- /** The journey it was asked to complete, when one was named. */
83
47
  persona: z.ZodOptional<z.ZodString>;
84
- }, "strip", z.ZodTypeAny, {
85
- harness: string;
86
- driver: string;
87
- persona?: string | undefined;
88
- }, {
89
- harness: string;
90
- driver: string;
91
- persona?: string | undefined;
92
- }>>;
93
- /**
94
- * The MCP client that made this call, as its handshake named it (`claude-code`, `cursor`…). Read
95
- * per call rather than at session end: by teardown the agent has often detached, and two agents on
96
- * one daemon cannot be told apart from anything but the call itself.
97
- */
48
+ }, z.core.$strip>>;
98
49
  agent: z.ZodOptional<z.ZodString>;
99
- }, "strip", z.ZodTypeAny, {
100
- at: number;
101
- tool: string;
102
- actionId: string;
103
- args: Record<string, unknown>;
104
- v: 1;
105
- tRange: {
106
- from: number;
107
- to: number;
108
- };
109
- settled?: boolean | undefined;
110
- agent?: string | undefined;
111
- effect?: unknown;
112
- settledInMs?: number | undefined;
113
- seqRange?: {
114
- from: number;
115
- to: number;
116
- } | undefined;
117
- drivenBy?: {
118
- harness: string;
119
- driver: string;
120
- persona?: string | undefined;
121
- } | undefined;
122
- }, {
123
- at: number;
124
- tool: string;
125
- actionId: string;
126
- v: 1;
127
- tRange: {
128
- from: number;
129
- to: number;
130
- };
131
- settled?: boolean | undefined;
132
- agent?: string | undefined;
133
- effect?: unknown;
134
- args?: Record<string, unknown> | undefined;
135
- settledInMs?: number | undefined;
136
- seqRange?: {
137
- from: number;
138
- to: number;
139
- } | undefined;
140
- drivenBy?: {
141
- harness: string;
142
- driver: string;
143
- persona?: string | undefined;
144
- } | undefined;
145
- }>;
50
+ }, z.core.$strip>;
146
51
  export type JournalAction = z.infer<typeof JournalActionSchema>;
147
52
  /**
148
53
  * The report written beside `events.jsonl` when its byte ceiling refuses a batch.
@@ -164,37 +69,12 @@ export type JournalAction = z.infer<typeof JournalActionSchema>;
164
69
  */
165
70
  export declare const JournalWriteLossSchema: z.ZodObject<{
166
71
  v: z.ZodLiteral<1>;
167
- /** Which channel lost data — the same vocabulary the in-band `TRUNCATED` record names. */
168
72
  channel: z.ZodLiteral<"journal">;
169
- /** The ceiling that refused the write, in bytes. */
170
73
  capBytes: z.ZodOptional<z.ZodNumber>;
171
- /** Bytes already in the ledger when it was closed. */
172
74
  bytesOnDisk: z.ZodOptional<z.ZodNumber>;
173
- /**
174
- * Events in the ONE batch that was refused — never a running total of everything dropped after.
175
- *
176
- * An append-only file cannot revise a line it has already written, and re-emitting a fresh count
177
- * per refusal would recreate the growth this bound exists to stop. The load-bearing fact is that
178
- * the ledger closed; the count says how much was in the batch that closed it, and nothing more.
179
- */
180
75
  droppedInBatch: z.ZodOptional<z.ZodNumber>;
181
- /** Elapsed-ms stamp of the last record in the first refused batch; not a loss-window boundary. */
182
76
  at: z.ZodOptional<z.ZodNumber>;
183
- }, "strip", z.ZodTypeAny, {
184
- channel: "journal";
185
- v: 1;
186
- at?: number | undefined;
187
- capBytes?: number | undefined;
188
- bytesOnDisk?: number | undefined;
189
- droppedInBatch?: number | undefined;
190
- }, {
191
- channel: "journal";
192
- v: 1;
193
- at?: number | undefined;
194
- capBytes?: number | undefined;
195
- bytesOnDisk?: number | undefined;
196
- droppedInBatch?: number | undefined;
197
- }>;
77
+ }, z.core.$strip>;
198
78
  export type JournalWriteLoss = z.infer<typeof JournalWriteLossSchema>;
199
79
  /**
200
80
  * The bounded verdict summary a verification tool writes into a journal action's `effect`.
@@ -208,36 +88,17 @@ export type JournalWriteLoss = z.infer<typeof JournalWriteLossSchema>;
208
88
  * source it pointed. A transcript here would grow the journal without making the answer better.
209
89
  */
210
90
  export declare const JournalVerdictEffectSchema: z.ZodObject<{
211
- /** What was claimed, in the caller's own words — the subject a later proof supersedes. */
212
91
  claim: z.ZodString;
213
- /** The verdict, as the one field an agent reads. The enum, never a re-typed copy of it. */
214
- verified: z.ZodNativeEnum<{
92
+ verified: z.ZodEnum<{
215
93
  readonly YES: "yes";
216
94
  readonly NO: "no";
217
95
  readonly UNKNOWN: "unknown";
218
96
  readonly NO_FAULT: "no-fault";
219
97
  }>;
220
- /** `file:line` for the element driven, when the page told us one. */
221
98
  source: z.ZodOptional<z.ZodString>;
222
- /**
223
- * What the check saw, in the engine's words ("present, visible, disabled"), when it said. Kept so
224
- * a failed check can say what it found rather than only that the claim did not hold.
225
- */
226
99
  observed: z.ZodOptional<z.ZodString>;
227
- /** What the check required, in the engine's words ("an element … in state 'enabled'"). */
228
100
  expected: z.ZodOptional<z.ZodString>;
229
- /**
230
- * Which source of truth answering the claim required -- the predicate's own kind.
231
- *
232
- * A run folded from this journal has to say what a check READ, and with no field here it had
233
- * nothing to say it from: every check ever folded was stamped `element`, including the ones whose
234
- * own `grade` in the same object said `net`. Channel routing reads this, so a network verdict
235
- * arrived as a UI verdict.
236
- *
237
- * Optional, because a record written before this field existed has no kind and must not be read
238
- * as though it had one.
239
- */
240
- kind: z.ZodOptional<z.ZodNativeEnum<{
101
+ kind: z.ZodOptional<z.ZodEnum<{
241
102
  readonly ELEMENT: "element";
242
103
  readonly TEXT: "text";
243
104
  readonly SIGNAL: "signal";
@@ -252,95 +113,18 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
252
113
  readonly ANY_OF: "anyOf";
253
114
  readonly NOT: "not";
254
115
  }>>;
255
- /**
256
- * Was the claim written down BEFORE the action, or after it?
257
- *
258
- * The difference between a check and a rationalisation. Recorded here because the journal is the
259
- * durable record a run artifact is built from: a fact that never reaches it is a fact nothing
260
- * downstream can ever report, however well the verdict knew it at the time.
261
- *
262
- * Absent is not `false`. `false` says the claim came afterwards; absent says nobody recorded which.
263
- */
264
116
  declaredBeforeActing: z.ZodOptional<z.ZodBoolean>;
265
- /**
266
- * The requests seen in a failed check's window: method, url, status and a short excerpt of the
267
- * (already redacted) response, so a failure's page can show the call that explains it.
268
- */
269
117
  net: z.ZodOptional<z.ZodArray<z.ZodObject<{
270
118
  method: z.ZodString;
271
119
  url: z.ZodString;
272
120
  status: z.ZodOptional<z.ZodNumber>;
273
121
  body: z.ZodOptional<z.ZodString>;
274
- }, "strip", z.ZodTypeAny, {
275
- method: string;
276
- url: string;
277
- status?: number | undefined;
278
- body?: string | undefined;
279
- }, {
280
- method: string;
281
- url: string;
282
- status?: number | undefined;
283
- body?: string | undefined;
284
- }>, "many">>;
285
- /**
286
- * What kind of evidence bought the answer -- the grade the verdict actually proved.
287
- *
288
- * A green paid for with "something matching was on screen" is not the green paid for with "the
289
- * request went out", and a record that keeps only the word `yes` cannot tell them apart later.
290
- */
122
+ }, z.core.$strip>>>;
291
123
  grade: z.ZodOptional<z.ZodString>;
292
- /**
293
- * What could not be seen while this was being checked.
294
- *
295
- * The one property with no prior art: every other kind of test record is silent about its own
296
- * blind spots. Empty means nothing was hidden; absent means nobody looked.
297
- */
298
- couldNotSee: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
299
- /**
300
- * WHY the verdict came out this way, in the engine's own vocabulary.
301
- *
302
- * Without it, `unknown` is one word for facts that need opposite responses: "the outcome has
303
- * not arrived yet" and "the capture was dirty so I could not see" are both `unknown`, and only
304
- * the first can ever be answered by waiting. A reader of the record -- or a fold over it --
305
- * cannot tell a question that is still open from one that was never answerable.
306
- *
307
- * Optional, because a record written before this existed has no reason to offer and must not
308
- * be read as though it did.
309
- */
124
+ couldNotSee: z.ZodOptional<z.ZodArray<z.ZodString>>;
310
125
  reason: z.ZodOptional<z.ZodString>;
311
- }, "strip", z.ZodTypeAny, {
312
- verified: "yes" | "no" | "unknown" | "no-fault";
313
- claim: string;
314
- net?: {
315
- method: string;
316
- url: string;
317
- status?: number | undefined;
318
- body?: string | undefined;
319
- }[] | undefined;
320
- kind?: "signal" | "net" | "state" | "element" | "text" | "route" | "console" | "animation" | "settled" | "compare" | "allOf" | "anyOf" | "not" | undefined;
321
- expected?: string | undefined;
322
- source?: string | undefined;
323
- declaredBeforeActing?: boolean | undefined;
324
- observed?: string | undefined;
325
- grade?: string | undefined;
326
- couldNotSee?: string[] | undefined;
327
- reason?: string | undefined;
328
- }, {
329
- verified: "yes" | "no" | "unknown" | "no-fault";
330
- claim: string;
331
- net?: {
332
- method: string;
333
- url: string;
334
- status?: number | undefined;
335
- body?: string | undefined;
336
- }[] | undefined;
337
- kind?: "signal" | "net" | "state" | "element" | "text" | "route" | "console" | "animation" | "settled" | "compare" | "allOf" | "anyOf" | "not" | undefined;
338
- expected?: string | undefined;
339
- source?: string | undefined;
340
- declaredBeforeActing?: boolean | undefined;
341
- observed?: string | undefined;
342
- grade?: string | undefined;
343
- couldNotSee?: string[] | undefined;
344
- reason?: string | undefined;
345
- }>;
126
+ intent: z.ZodOptional<z.ZodString>;
127
+ intentDerived: z.ZodOptional<z.ZodBoolean>;
128
+ failedPart: z.ZodOptional<z.ZodNumber>;
129
+ }, z.core.$strip>;
346
130
  export type JournalVerdictEffect = z.infer<typeof JournalVerdictEffectSchema>;
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  import { TRANSPORT_LIMITS, TruncationChannel } from '../wire/constants/constants.js';
3
3
  import { Verified } from '../verdict/verified-constants.js';
4
4
  import { PredicateKind } from '../verdict/consequence.js';
@@ -36,7 +36,7 @@ export const JournalActionSchema = z.object({
36
36
  /** The MCP tool / command name that drove it (e.g. "reticle_act"). */
37
37
  tool: z.string().min(1).max(TRANSPORT_LIMITS.MAX_COMMAND_NAME_LENGTH),
38
38
  /** Redacted invocation args. */
39
- args: z.record(z.unknown()).default({}),
39
+ args: z.record(z.string(), z.unknown()).default({}),
40
40
  /** Bounded effect summary (settle glyph, target, etc.). Kept open; narrowed by the writer. */
41
41
  effect: z.unknown().optional(),
42
42
  /** Whether the page settled within budget after the action, when known. */
@@ -181,4 +181,17 @@ export const JournalVerdictEffectSchema = z.object({
181
181
  * be read as though it did.
182
182
  */
183
183
  reason: z.string().max(TRANSPORT_LIMITS.MAX_STRING_LENGTH).optional(),
184
+ /**
185
+ * What the check is for, as a person's sentence: the agent's `intent`, else one built from the
186
+ * predicate in the failure voice ("No PATCH request to /assignee was made"). Without it a check
187
+ * the agent gave no words for reached the platform as engine wording. Absent on older records.
188
+ */
189
+ intent: z.string().max(TRANSPORT_LIMITS.MAX_STRING_LENGTH).optional(),
190
+ /** True when `intent` was built from the predicate, not given by the agent. */
191
+ intentDerived: z.boolean().optional(),
192
+ /**
193
+ * The index of the part of an `allOf` that failed, so a title can name the one thing that did
194
+ * not happen rather than "not all of these happened". Absent on a pass, a leaf, and older records.
195
+ */
196
+ failedPart: z.number().int().min(0).optional(),
184
197
  });
@@ -3,7 +3,7 @@
3
3
  * statement in it and in the agent's declared intents, classified and attributed. Daemon-side only:
4
4
  * a run carries it loosely (`context`), so it adds nothing to what a page downloads.
5
5
  */
6
- import { z } from 'zod';
6
+ import * as z from 'zod';
7
7
  /** What a statement in the prompt context is, so a reader can tell a goal from a preference. */
8
8
  export declare const StatementKind: {
9
9
  /** What the product should do for its users: the reason the work exists. */
@@ -46,11 +46,10 @@ export declare function splitStatements(text: string): string[];
46
46
  * and an unlinked project has nowhere to send it. See `shareableRun`.
47
47
  */
48
48
  export declare const PromptContextSchema: z.ZodObject<{
49
- /** The whole prompt, redacted. Long prompts are the useful ones, so the cap is generous. */
50
49
  request: z.ZodOptional<z.ZodString>;
51
50
  statements: z.ZodDefault<z.ZodArray<z.ZodObject<{
52
51
  text: z.ZodString;
53
- kind: z.ZodNativeEnum<{
52
+ kind: z.ZodEnum<{
54
53
  /** What the product should do for its users: the reason the work exists. */
55
54
  readonly BUSINESS_INTENT: "business-intent";
56
55
  /** What to change in the code: implement, fix, refactor, rename, test. */
@@ -65,41 +64,16 @@ export declare const PromptContextSchema: z.ZodObject<{
65
64
  /** What not to touch, or not now. */
66
65
  readonly OUT_OF_SCOPE: "out-of-scope";
67
66
  }>;
68
- source: z.ZodNativeEnum<{
67
+ source: z.ZodEnum<{
69
68
  readonly USER: "user";
70
69
  readonly AGENT: "agent";
71
70
  }>;
72
- }, "strip", z.ZodTypeAny, {
73
- text: string;
74
- kind: "business-intent" | "coding-intent" | "ux-expectation" | "security-requirement" | "acceptance-criterion" | "technical-constraint" | "preference" | "out-of-scope";
75
- source: "agent" | "user";
76
- }, {
77
- text: string;
78
- kind: "business-intent" | "coding-intent" | "ux-expectation" | "security-requirement" | "acceptance-criterion" | "technical-constraint" | "preference" | "out-of-scope";
79
- source: "agent" | "user";
80
- }>, "many">>;
81
- /** When the request was given, epoch ms. A run long after it is not about it. */
71
+ }, z.core.$strip>>>;
82
72
  at: z.ZodOptional<z.ZodNumber>;
83
73
  shared: z.ZodOptional<z.ZodBoolean>;
84
- }, "strip", z.ZodTypeAny, {
85
- statements: {
86
- text: string;
87
- kind: "business-intent" | "coding-intent" | "ux-expectation" | "security-requirement" | "acceptance-criterion" | "technical-constraint" | "preference" | "out-of-scope";
88
- source: "agent" | "user";
89
- }[];
90
- at?: number | undefined;
91
- request?: string | undefined;
92
- shared?: boolean | undefined;
93
- }, {
94
- at?: number | undefined;
95
- request?: string | undefined;
96
- statements?: {
97
- text: string;
98
- kind: "business-intent" | "coding-intent" | "ux-expectation" | "security-requirement" | "acceptance-criterion" | "technical-constraint" | "preference" | "out-of-scope";
99
- source: "agent" | "user";
100
- }[] | undefined;
101
- shared?: boolean | undefined;
102
- }>;
74
+ closingClaim: z.ZodOptional<z.ZodString>;
75
+ closingClaimAt: z.ZodOptional<z.ZodNumber>;
76
+ }, z.core.$strip>;
103
77
  export type PromptContext = z.infer<typeof PromptContextSchema>;
104
78
  /** A run as it may leave this machine: its prompt context only when the project shares it. */
105
79
  export declare function shareableRun(run: unknown): unknown;
@@ -3,7 +3,7 @@
3
3
  * statement in it and in the agent's declared intents, classified and attributed. Daemon-side only:
4
4
  * a run carries it loosely (`context`), so it adds nothing to what a page downloads.
5
5
  */
6
- import { z } from 'zod';
6
+ import * as z from 'zod';
7
7
  /** What a statement in the prompt context is, so a reader can tell a goal from a preference. */
8
8
  export const StatementKind = {
9
9
  /** What the product should do for its users: the reason the work exists. */
@@ -64,9 +64,11 @@ const STATEMENT_RULES = [
64
64
  * function without changing what is stored.
65
65
  */
66
66
  export function classifyStatement(text) {
67
- for (const rule of STATEMENT_RULES)
68
- if (rule.words.test(text))
67
+ for (const rule of STATEMENT_RULES) {
68
+ if (rule.words.test(text)) {
69
69
  return rule.kind;
70
+ }
71
+ }
70
72
  return StatementKind.BUSINESS_INTENT;
71
73
  }
72
74
  /** A request split into the sentences a reader would weigh one at a time. */
@@ -98,11 +100,20 @@ export const PromptContextSchema = z.object({
98
100
  /** When the request was given, epoch ms. A run long after it is not about it. */
99
101
  at: z.number().optional(),
100
102
  shared: z.boolean().optional(),
103
+ /**
104
+ * What the agent said when it finished the turn this run belongs to: the first `agent_stop`
105
+ * message at or after the run's last Reticle call, redacted and bounded where it was recorded.
106
+ * The user's words' counterpart, so it leaves the machine under the same `shared` decision.
107
+ */
108
+ closingClaim: z.string().max(20_000).optional(),
109
+ /** When that turn ended, epoch ms. */
110
+ closingClaimAt: z.number().optional(),
101
111
  });
102
112
  /** A run as it may leave this machine: its prompt context only when the project shares it. */
103
113
  export function shareableRun(run) {
104
- if ('object' !== typeof run || null === run || !('context' in run))
114
+ if ('object' !== typeof run || null === run || !('context' in run)) {
105
115
  return run;
116
+ }
106
117
  const { context, ...rest } = run;
107
118
  return true === context?.shared ? run : rest;
108
119
  }
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  /**
3
3
  * The body of `POST /v1/runs/:runId/screenshots` — one step screenshot, sent once, after the
4
4
  * platform has accepted its run. One schema for both ends, so the daemon cannot send a field the
@@ -15,9 +15,8 @@ export declare const ScreenshotUploadSchema: z.ZodObject<{
15
15
  file: z.ZodString;
16
16
  step: z.ZodOptional<z.ZodString>;
17
17
  tool: z.ZodOptional<z.ZodString>;
18
- /** The check this picture is of, so the platform's run page can show it beside that check. */
19
18
  checkId: z.ZodOptional<z.ZodString>;
20
- source: z.ZodNativeEnum<{
19
+ source: z.ZodEnum<{
21
20
  readonly BROWSER: "browser";
22
21
  readonly RENDERED: "rendered";
23
22
  }>;
@@ -25,27 +24,5 @@ export declare const ScreenshotUploadSchema: z.ZodObject<{
25
24
  height: z.ZodNumber;
26
25
  sha256: z.ZodString;
27
26
  jpeg: z.ZodString;
28
- }, "strip", z.ZodTypeAny, {
29
- file: string;
30
- source: "browser" | "rendered";
31
- width: number;
32
- height: number;
33
- sha256: string;
34
- seq: number;
35
- jpeg: string;
36
- step?: string | undefined;
37
- tool?: string | undefined;
38
- checkId?: string | undefined;
39
- }, {
40
- file: string;
41
- source: "browser" | "rendered";
42
- width: number;
43
- height: number;
44
- sha256: string;
45
- seq: number;
46
- jpeg: string;
47
- step?: string | undefined;
48
- tool?: string | undefined;
49
- checkId?: string | undefined;
50
- }>;
27
+ }, z.core.$strip>;
51
28
  export type ScreenshotUpload = z.infer<typeof ScreenshotUploadSchema>;
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  import { ScreenshotSource } from '../verdict/verification-run.js';
3
3
  /**
4
4
  * The body of `POST /v1/runs/:runId/screenshots` — one step screenshot, sent once, after the