@reticlehq/core 3.6.0 → 3.8.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 (133) hide show
  1. package/dist/activation-entry.d.ts +9 -0
  2. package/dist/activation-entry.js +9 -0
  3. package/dist/artifacts/artifacts-entry.d.ts +2 -0
  4. package/dist/artifacts/artifacts-entry.js +2 -0
  5. package/dist/artifacts/drive-script.d.ts +222 -116
  6. package/dist/artifacts/drive-script.js +24 -1
  7. package/dist/artifacts/flow-constants.d.ts +33 -0
  8. package/dist/artifacts/flow-constants.js +35 -0
  9. package/dist/artifacts/flow-expect-flat.d.ts +8 -8
  10. package/dist/artifacts/flow-results.d.ts +461 -0
  11. package/dist/artifacts/flow-results.js +1 -0
  12. package/dist/artifacts/flow-types.d.ts +177 -543
  13. package/dist/artifacts/flow-types.js +17 -2
  14. package/dist/artifacts/harness-credits.d.ts +42 -0
  15. package/dist/artifacts/harness-credits.js +72 -0
  16. package/dist/artifacts/harness-map.d.ts +98 -0
  17. package/dist/artifacts/harness-map.js +36 -0
  18. package/dist/artifacts/impact.d.ts +355 -149
  19. package/dist/artifacts/impact.js +84 -49
  20. package/dist/artifacts/journal.d.ts +81 -11
  21. package/dist/artifacts/journal.js +39 -0
  22. package/dist/artifacts/prompt-context.d.ts +12 -0
  23. package/dist/artifacts/prompt-context.js +14 -3
  24. package/dist/artifacts/screenshot-upload.d.ts +51 -0
  25. package/dist/artifacts/screenshot-upload.js +26 -0
  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 +26 -26
  29. package/dist/hud-entry.d.ts +1 -0
  30. package/dist/hud-entry.js +2 -0
  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 +15 -0
  36. package/dist/index.js +15 -0
  37. package/dist/onboarding.d.ts +30 -1
  38. package/dist/onboarding.js +25 -0
  39. package/dist/realm/registry.js +19 -1
  40. package/dist/registry/dev-server-registry.d.ts +2 -2
  41. package/dist/schema/command-message.json +30 -0
  42. package/dist/schema/command-name.json +3 -1
  43. package/dist/schema/event-message.json +3 -1
  44. package/dist/schema/event-payloads.json +156 -3
  45. package/dist/schema/event-type.json +3 -1
  46. package/dist/schema/hello-message.json +21 -0
  47. package/dist/schema/reticle-event.json +3 -1
  48. package/dist/schema/reticle-message.json +54 -1
  49. package/dist/telemetry-bug.d.ts +169 -0
  50. package/dist/telemetry-bug.js +123 -0
  51. package/dist/telemetry-entry.d.ts +2 -1
  52. package/dist/telemetry-entry.js +2 -1
  53. package/dist/telemetry-feedback.d.ts +16 -2
  54. package/dist/telemetry-feedback.js +19 -0
  55. package/dist/telemetry-session.d.ts +91 -2
  56. package/dist/telemetry-session.js +65 -0
  57. package/dist/telemetry-signals.d.ts +557 -0
  58. package/dist/telemetry-signals.js +225 -0
  59. package/dist/telemetry.d.ts +649 -296
  60. package/dist/telemetry.js +110 -119
  61. package/dist/verdict/check-sentence.d.ts +34 -0
  62. package/dist/verdict/check-sentence.js +228 -0
  63. package/dist/verdict/consequence.d.ts +15 -0
  64. package/dist/verdict/consequence.js +11 -0
  65. package/dist/verdict/disparity.d.ts +105 -0
  66. package/dist/verdict/disparity.js +40 -0
  67. package/dist/verdict/findings.d.ts +16 -0
  68. package/dist/verdict/findings.js +22 -0
  69. package/dist/verdict/instrumentation-coverage.d.ts +84 -0
  70. package/dist/verdict/instrumentation-coverage.js +182 -0
  71. package/dist/verdict/instrumentation-gap.d.ts +79 -0
  72. package/dist/verdict/instrumentation-gap.js +65 -1
  73. package/dist/verdict/intent.d.ts +19 -5
  74. package/dist/verdict/intent.js +13 -1
  75. package/dist/verdict/predicate-tree.d.ts +17 -0
  76. package/dist/verdict/predicate-tree.js +37 -0
  77. package/dist/verdict/predicate.d.ts +16 -1
  78. package/dist/verdict/predicate.js +188 -13
  79. package/dist/verdict/property-assertion.d.ts +2 -2
  80. package/dist/verdict/run-report.d.ts +166 -0
  81. package/dist/verdict/run-report.js +53 -0
  82. package/dist/verdict/security.d.ts +60 -1
  83. package/dist/verdict/security.js +174 -12
  84. package/dist/verdict/verification-run.d.ts +713 -68
  85. package/dist/verdict/verification-run.js +113 -0
  86. package/dist/verdict/verify-progress.d.ts +6 -6
  87. package/dist/wire/constants/constants.d.ts +69 -155
  88. package/dist/wire/constants/constants.js +78 -159
  89. package/dist/wire/constants/discovery.d.ts +4 -4
  90. package/dist/wire/constants/discovery.js +4 -4
  91. package/dist/wire/constants/event-types.d.ts +35 -1
  92. package/dist/wire/constants/event-types.js +33 -1
  93. package/dist/wire/constants/hud-controls.js +15 -5
  94. package/dist/wire/constants/hud-use.d.ts +33 -4
  95. package/dist/wire/constants/hud-use.js +30 -4
  96. package/dist/wire/constants/mcp-wire.d.ts +26 -0
  97. package/dist/wire/constants/mcp-wire.js +26 -0
  98. package/dist/wire/constants/response-body-reason.d.ts +19 -0
  99. package/dist/wire/constants/response-body-reason.js +18 -0
  100. package/dist/wire/constants/reticle-chrome.d.ts +19 -0
  101. package/dist/wire/constants/reticle-chrome.js +19 -0
  102. package/dist/wire/constants/reticle-env.d.ts +138 -0
  103. package/dist/wire/constants/reticle-env.js +138 -0
  104. package/dist/wire/constants/session-constants.d.ts +26 -2
  105. package/dist/wire/constants/session-constants.js +26 -2
  106. package/dist/wire/desktop-contract.d.ts +8 -0
  107. package/dist/wire/desktop-contract.js +11 -0
  108. package/dist/wire/event-payloads.d.ts +202 -36
  109. package/dist/wire/event-payloads.js +100 -16
  110. package/dist/wire/messages.d.ts +193 -54
  111. package/dist/wire/messages.js +25 -1
  112. package/dist/wire/narrow.d.ts +6 -0
  113. package/dist/wire/narrow.js +26 -0
  114. package/dist/wire/next-step.d.ts +90 -0
  115. package/dist/wire/next-step.js +37 -0
  116. package/dist/wire/platform-link.d.ts +84 -0
  117. package/dist/wire/platform-link.js +57 -6
  118. package/dist/wire/production/activation-ticket.d.ts +64 -0
  119. package/dist/wire/production/activation-ticket.js +148 -0
  120. package/dist/wire/production/hello-mode.d.ts +35 -0
  121. package/dist/wire/production/hello-mode.js +32 -0
  122. package/dist/wire/production/production-policy.d.ts +138 -0
  123. package/dist/wire/production/production-policy.js +133 -0
  124. package/dist/wire/tool-names.d.ts +4 -0
  125. package/dist/wire/tool-names.js +4 -0
  126. package/dist/wire/types.d.ts +90 -52
  127. package/dist/wire/types.js +5 -0
  128. package/dist/words/notices.d.ts +1 -1
  129. package/dist/words/notices.js +1 -1
  130. package/dist/words/upgrade.js +1 -1
  131. package/dist/words/writing-rule.d.ts +14 -0
  132. package/dist/words/writing-rule.js +17 -0
  133. package/package.json +5 -1
@@ -140,47 +140,8 @@ export const AccountStateSchema = z.object({
140
140
  email: z.string().optional(),
141
141
  host: z.string().optional(),
142
142
  });
143
- /**
144
- * The standing offer on the autonomous harness, as the daemon last heard it from the platform.
145
- *
146
- * `claimed` is the only field that decides whether anything is shown, and ABSENCE of this whole
147
- * object means "we do not know" — never "not claimed". That distinction is the difference between
148
- * an offer and a nag: a machine that is offline, unlinked, or paired with an older daemon has not
149
- * told us the person still needs this, and advertising at them anyway is how a dev-only HUD gets
150
- * switched off for good. The account field beside this one already carries that warning; it applies
151
- * here with more force, because this one is marketing.
152
- */
153
- export const HarnessOfferSchema = z.object({
154
- /** True once this org has claimed. A claimed offer is shown as remaining time, never as a pitch. */
155
- claimed: z.boolean(),
156
- /** When the free period ends, epoch ms. Absent when nothing has been claimed. */
157
- expiresAt: z.number().optional(),
158
- /** Whole days left, already computed — the HUD has no clock worth trusting for this. */
159
- daysRemaining: z.number().optional(),
160
- /** Where claiming happens. Absent ⇒ the HUD shows nothing, because a pitch with no door is noise. */
161
- claimUrl: z.string().optional(),
162
- /**
163
- * Whether a drive could actually run if the offer were taken.
164
- *
165
- * Entitlement is not readiness. A workspace can be fully entitled against a deployment that holds
166
- * no key for its provider, and then every signal reads healthy while a drive cannot start —
167
- * including the card, which would sell three free months of something unusable and burn the one
168
- * claim the person gets. Absent means "not told", which is treated as drivable for the same
169
- * reason `claimed` is required and the rest are not: silence from an older platform must not
170
- * switch the feature off.
171
- */
172
- drivable: z.boolean().optional(),
173
- /**
174
- * Whether claiming would still grant anything.
175
- *
176
- * Carried separately because `claimed` is "running RIGHT NOW", and an expired free period reads
177
- * `claimed: false` — the same as never having taken it. Without this the HUD would advertise a
178
- * three-month offer to the one group of people who can never accept it again, which is worse than
179
- * saying nothing at all. Absent ⇒ treated as still offerable: an older platform that does not
180
- * report it also has no expiries to get wrong.
181
- */
182
- eligible: z.boolean().optional(),
183
- });
143
+ /** The grant credits came from: sign-up, the card-started trial, or a paid plan. */
144
+ export const CreditKind = { FREE: 'free', TRIAL: 'trial', PAID: 'paid' };
184
145
  /**
185
146
  * What the platform says about autonomous driving for this project.
186
147
  *
@@ -189,16 +150,84 @@ export const HarnessOfferSchema = z.object({
189
150
  */
190
151
  export const HarnessConfigSchema = z.object({
191
152
  provider: z.string(),
192
- /** The switch somebody set. The platform's default is on. */
153
+ /** The switch somebody set. Off for a new project: the Harness is opt-in. */
193
154
  harnessEnabled: z.boolean(),
194
155
  /** Whether this workspace may drive on OUR model spend. Never folded into the switch. */
195
156
  harnessEntitled: z.boolean(),
196
157
  /** Whether the selected provider has a usable platform key. Older daemons may omit it. */
197
158
  providerReady: z.boolean().optional(),
198
- /** Harness credits used and held this 30 days; one is one Harness decision. Absent: unbounded or unknown. */
199
- credits: z.object({ used: z.number().int().min(0), limit: z.number().int().min(0) }).optional(),
159
+ /** Credits used and held this 30 days; a Harness decision is one. Absent: unbounded or unknown. */
160
+ credits: z
161
+ .object({
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),
166
+ /** The grant they came from. Optional on the wire: an older platform omits it. */
167
+ kind: z.enum([CreditKind.FREE, CreditKind.TRIAL, CreditKind.PAID]).optional(),
168
+ /** Whole days the grant has left, counted by the daemon from the platform's end date. */
169
+ daysLeft: z.number().int().min(0).optional(),
170
+ })
171
+ .optional(),
200
172
  /** The platform this answer came from, so the HUD's links go there and not to the hosted one. */
201
173
  platformUrl: z.string().optional(),
174
+ /**
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.
177
+ */
178
+ planUrl: z.string().optional(),
179
+ /** The plan in force: which grant, trial days left, seats. Absent from a platform that sent none. */
180
+ plan: z
181
+ .object({
182
+ kind: z.enum([CreditKind.FREE, CreditKind.TRIAL, CreditKind.PAID]),
183
+ daysLeft: z.number().int().min(0).optional(),
184
+ seats: z.number().int().min(0).optional(),
185
+ })
186
+ .optional(),
187
+ /** Harness runs the platform holds for this project. Absent: the platform did not say. */
188
+ harnessRuns: z.number().int().min(0).optional(),
189
+ /** Memory entries the platform holds for this project. Absent: the platform did not say. */
190
+ memoryEntries: z.number().int().min(0).optional(),
191
+ });
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
+ });
215
+ /** The longest note a person can send their coding agent from the HUD. */
216
+ export const AGENT_NOTE_MAX = 500;
217
+ /** How many of a tab's latest notes the HUD shows. */
218
+ export const AGENT_NOTES_SHOWN = 5;
219
+ const AGENT_LABEL_MAX = 64;
220
+ /** A note sent to the coding agent from this tab. `seen` only once an agent's tool call took it. */
221
+ export const AgentNoteSchema = z.object({
222
+ text: z.string().max(AGENT_NOTE_MAX),
223
+ seen: z.boolean(),
224
+ /** Which agent took it, when the daemon knows. */
225
+ by: z.string().max(AGENT_LABEL_MAX).optional(),
226
+ });
227
+ /** The coding agents attached to the daemon now (friendly names), and this tab's latest notes. */
228
+ export const AgentLinkSchema = z.object({
229
+ agents: z.array(z.string().max(AGENT_LABEL_MAX)).max(8),
230
+ notes: z.array(AgentNoteSchema).max(AGENT_NOTES_SHOWN),
202
231
  });
203
232
  export const ImpactSnapshotSchema = z.object({
204
233
  schemaVersion: z.number().int().positive(),
@@ -218,11 +247,6 @@ export const ImpactSnapshotSchema = z.object({
218
247
  * kind of nag that gets a dev-only HUD switched off for good.
219
248
  */
220
249
  account: AccountStateSchema.optional(),
221
- /**
222
- * The harness offer, when the daemon knows it. Absent is "unknown" and shows nothing — see
223
- * `HarnessOfferSchema` for why that asymmetry is deliberate.
224
- */
225
- harnessOffer: HarnessOfferSchema.optional(),
226
250
  /**
227
251
  * The harness switch and whether this workspace may drive on our spend.
228
252
  *
@@ -236,6 +260,12 @@ export const ImpactSnapshotSchema = z.object({
236
260
  * cannot be honoured is worse than showing none.
237
261
  */
238
262
  harnessConfig: HarnessConfigSchema.optional(),
263
+ /** The drive running now, when there is one. Absent: nothing is driving. */
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(),
267
+ /** Who is coding against this daemon, and what this tab said to them. Absent: an older daemon. */
268
+ agent: AgentLinkSchema.optional(),
239
269
  /**
240
270
  * The rail's notices, already chosen for this machine by the daemon (see `hud-notices.ts`).
241
271
  * Absent means the daemon has nothing newer than the SDK's bundled slides, which then show.
@@ -255,6 +285,11 @@ export const ImpactSnapshotSchema = z.object({
255
285
  * push, and the sentence describing it). Loose here, shaped by the daemon's sync-status.
256
286
  */
257
287
  sync: z.record(z.unknown()).optional(),
288
+ /**
289
+ * How much of THIS tab's app Reticle sees, and the prompt that asks a coding agent to close the
290
+ * rest (`covered`, `total`, `missing`, `prompt`). Loose here, shaped by the daemon's coverageOf.
291
+ */
292
+ instrumentation: z.record(z.unknown()).optional(),
258
293
  });
259
294
  /** Empty counters - the starting point for a fresh store and the identity for merges. */
260
295
  export function emptyImpactCounts() {
@@ -90,17 +90,24 @@ export declare const JournalActionSchema: z.ZodObject<{
90
90
  driver: string;
91
91
  persona?: string | undefined;
92
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
+ */
98
+ agent: z.ZodOptional<z.ZodString>;
93
99
  }, "strip", z.ZodTypeAny, {
100
+ v: 1;
94
101
  at: number;
95
102
  tool: string;
96
- args: Record<string, unknown>;
97
103
  actionId: string;
98
- v: 1;
104
+ args: Record<string, unknown>;
99
105
  tRange: {
100
106
  from: number;
101
107
  to: number;
102
108
  };
103
109
  settled?: boolean | undefined;
110
+ agent?: string | undefined;
104
111
  effect?: unknown;
105
112
  settledInMs?: number | undefined;
106
113
  seqRange?: {
@@ -113,15 +120,16 @@ export declare const JournalActionSchema: z.ZodObject<{
113
120
  persona?: string | undefined;
114
121
  } | undefined;
115
122
  }, {
123
+ v: 1;
116
124
  at: number;
117
125
  tool: string;
118
126
  actionId: string;
119
- v: 1;
120
127
  tRange: {
121
128
  from: number;
122
129
  to: number;
123
130
  };
124
131
  settled?: boolean | undefined;
132
+ agent?: string | undefined;
125
133
  effect?: unknown;
126
134
  args?: Record<string, unknown> | undefined;
127
135
  settledInMs?: number | undefined;
@@ -173,15 +181,15 @@ export declare const JournalWriteLossSchema: z.ZodObject<{
173
181
  /** Elapsed-ms stamp of the last record in the first refused batch; not a loss-window boundary. */
174
182
  at: z.ZodOptional<z.ZodNumber>;
175
183
  }, "strip", z.ZodTypeAny, {
176
- channel: "journal";
177
184
  v: 1;
185
+ channel: "journal";
178
186
  at?: number | undefined;
179
187
  capBytes?: number | undefined;
180
188
  bytesOnDisk?: number | undefined;
181
189
  droppedInBatch?: number | undefined;
182
190
  }, {
183
- channel: "journal";
184
191
  v: 1;
192
+ channel: "journal";
185
193
  at?: number | undefined;
186
194
  capBytes?: number | undefined;
187
195
  bytesOnDisk?: number | undefined;
@@ -211,6 +219,13 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
211
219
  }>;
212
220
  /** `file:line` for the element driven, when the page told us one. */
213
221
  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
+ observed: z.ZodOptional<z.ZodString>;
227
+ /** What the check required, in the engine's words ("an element … in state 'enabled'"). */
228
+ expected: z.ZodOptional<z.ZodString>;
214
229
  /**
215
230
  * Which source of truth answering the claim required -- the predicate's own kind.
216
231
  *
@@ -247,6 +262,26 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
247
262
  * Absent is not `false`. `false` says the claim came afterwards; absent says nobody recorded which.
248
263
  */
249
264
  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
+ net: z.ZodOptional<z.ZodArray<z.ZodObject<{
270
+ method: z.ZodString;
271
+ url: z.ZodString;
272
+ status: z.ZodOptional<z.ZodNumber>;
273
+ 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">>;
250
285
  /**
251
286
  * What kind of evidence bought the answer -- the grade the verdict actually proved.
252
287
  *
@@ -273,23 +308,58 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
273
308
  * be read as though it did.
274
309
  */
275
310
  reason: z.ZodOptional<z.ZodString>;
311
+ /**
312
+ * What the check is for, as a person's sentence: the agent's `intent`, else one built from the
313
+ * predicate in the failure voice ("No PATCH request to /assignee was made"). Without it a check
314
+ * the agent gave no words for reached the platform as engine wording. Absent on older records.
315
+ */
316
+ intent: z.ZodOptional<z.ZodString>;
317
+ /** True when `intent` was built from the predicate, not given by the agent. */
318
+ intentDerived: z.ZodOptional<z.ZodBoolean>;
319
+ /**
320
+ * The index of the part of an `allOf` that failed, so a title can name the one thing that did
321
+ * not happen rather than "not all of these happened". Absent on a pass, a leaf, and older records.
322
+ */
323
+ failedPart: z.ZodOptional<z.ZodNumber>;
276
324
  }, "strip", z.ZodTypeAny, {
277
- claim: string;
278
325
  verified: "yes" | "no" | "unknown" | "no-fault";
326
+ claim: string;
327
+ reason?: string | undefined;
328
+ net?: {
329
+ method: string;
330
+ url: string;
331
+ status?: number | undefined;
332
+ body?: string | undefined;
333
+ }[] | undefined;
279
334
  kind?: "signal" | "net" | "state" | "element" | "text" | "route" | "console" | "animation" | "settled" | "compare" | "allOf" | "anyOf" | "not" | undefined;
335
+ intent?: string | undefined;
336
+ expected?: string | undefined;
337
+ source?: string | undefined;
280
338
  declaredBeforeActing?: boolean | undefined;
339
+ observed?: string | undefined;
281
340
  grade?: string | undefined;
282
341
  couldNotSee?: string[] | undefined;
283
- reason?: string | undefined;
284
- source?: string | undefined;
342
+ intentDerived?: boolean | undefined;
343
+ failedPart?: number | undefined;
285
344
  }, {
286
- claim: string;
287
345
  verified: "yes" | "no" | "unknown" | "no-fault";
346
+ claim: string;
347
+ reason?: string | undefined;
348
+ net?: {
349
+ method: string;
350
+ url: string;
351
+ status?: number | undefined;
352
+ body?: string | undefined;
353
+ }[] | undefined;
288
354
  kind?: "signal" | "net" | "state" | "element" | "text" | "route" | "console" | "animation" | "settled" | "compare" | "allOf" | "anyOf" | "not" | undefined;
355
+ intent?: string | undefined;
356
+ expected?: string | undefined;
357
+ source?: string | undefined;
289
358
  declaredBeforeActing?: boolean | undefined;
359
+ observed?: string | undefined;
290
360
  grade?: string | undefined;
291
361
  couldNotSee?: string[] | undefined;
292
- reason?: string | undefined;
293
- source?: string | undefined;
362
+ intentDerived?: boolean | undefined;
363
+ failedPart?: number | undefined;
294
364
  }>;
295
365
  export type JournalVerdictEffect = z.infer<typeof JournalVerdictEffectSchema>;
@@ -51,6 +51,12 @@ export const JournalActionSchema = z.object({
51
51
  at: z.number().int().min(0),
52
52
  /** Set only when the Harness drove this action; absent means the connected agent did. */
53
53
  drivenBy: DrivenBySchema.optional(),
54
+ /**
55
+ * The MCP client that made this call, as its handshake named it (`claude-code`, `cursor`…). Read
56
+ * per call rather than at session end: by teardown the agent has often detached, and two agents on
57
+ * one daemon cannot be told apart from anything but the call itself.
58
+ */
59
+ agent: z.string().min(1).max(TRANSPORT_LIMITS.MAX_REF_LENGTH).optional(),
54
60
  });
55
61
  /**
56
62
  * The report written beside `events.jsonl` when its byte ceiling refuses a batch.
@@ -107,6 +113,13 @@ export const JournalVerdictEffectSchema = z.object({
107
113
  verified: z.nativeEnum(Verified),
108
114
  /** `file:line` for the element driven, when the page told us one. */
109
115
  source: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH).optional(),
116
+ /**
117
+ * What the check saw, in the engine's words ("present, visible, disabled"), when it said. Kept so
118
+ * a failed check can say what it found rather than only that the claim did not hold.
119
+ */
120
+ observed: z.string().max(TRANSPORT_LIMITS.MAX_STRING_LENGTH).optional(),
121
+ /** What the check required, in the engine's words ("an element … in state 'enabled'"). */
122
+ expected: z.string().max(TRANSPORT_LIMITS.MAX_STRING_LENGTH).optional(),
110
123
  /**
111
124
  * Which source of truth answering the claim required -- the predicate's own kind.
112
125
  *
@@ -129,6 +142,19 @@ export const JournalVerdictEffectSchema = z.object({
129
142
  * Absent is not `false`. `false` says the claim came afterwards; absent says nobody recorded which.
130
143
  */
131
144
  declaredBeforeActing: z.boolean().optional(),
145
+ /**
146
+ * The requests seen in a failed check's window: method, url, status and a short excerpt of the
147
+ * (already redacted) response, so a failure's page can show the call that explains it.
148
+ */
149
+ net: z
150
+ .array(z.object({
151
+ method: z.string().max(TRANSPORT_LIMITS.MAX_COMMAND_NAME_LENGTH),
152
+ url: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH),
153
+ status: z.number().optional(),
154
+ body: z.string().max(TRANSPORT_LIMITS.MAX_STRING_LENGTH).optional(),
155
+ }))
156
+ .max(5)
157
+ .optional(),
132
158
  /**
133
159
  * What kind of evidence bought the answer -- the grade the verdict actually proved.
134
160
  *
@@ -155,4 +181,17 @@ export const JournalVerdictEffectSchema = z.object({
155
181
  * be read as though it did.
156
182
  */
157
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(),
158
197
  });
@@ -81,6 +81,14 @@ export declare const PromptContextSchema: z.ZodObject<{
81
81
  /** When the request was given, epoch ms. A run long after it is not about it. */
82
82
  at: z.ZodOptional<z.ZodNumber>;
83
83
  shared: z.ZodOptional<z.ZodBoolean>;
84
+ /**
85
+ * What the agent said when it finished the turn this run belongs to: the first `agent_stop`
86
+ * message at or after the run's last Reticle call, redacted and bounded where it was recorded.
87
+ * The user's words' counterpart, so it leaves the machine under the same `shared` decision.
88
+ */
89
+ closingClaim: z.ZodOptional<z.ZodString>;
90
+ /** When that turn ended, epoch ms. */
91
+ closingClaimAt: z.ZodOptional<z.ZodNumber>;
84
92
  }, "strip", z.ZodTypeAny, {
85
93
  statements: {
86
94
  text: string;
@@ -90,6 +98,8 @@ export declare const PromptContextSchema: z.ZodObject<{
90
98
  at?: number | undefined;
91
99
  request?: string | undefined;
92
100
  shared?: boolean | undefined;
101
+ closingClaim?: string | undefined;
102
+ closingClaimAt?: number | undefined;
93
103
  }, {
94
104
  at?: number | undefined;
95
105
  request?: string | undefined;
@@ -99,6 +109,8 @@ export declare const PromptContextSchema: z.ZodObject<{
99
109
  source: "agent" | "user";
100
110
  }[] | undefined;
101
111
  shared?: boolean | undefined;
112
+ closingClaim?: string | undefined;
113
+ closingClaimAt?: number | undefined;
102
114
  }>;
103
115
  export type PromptContext = z.infer<typeof PromptContextSchema>;
104
116
  /** A run as it may leave this machine: its prompt context only when the project shares it. */
@@ -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
  }
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The body of `POST /v1/runs/:runId/screenshots` — one step screenshot, sent once, after the
4
+ * platform has accepted its run. One schema for both ends, so the daemon cannot send a field the
5
+ * platform does not read.
6
+ *
7
+ * `jpeg` is base64 of real JPEG bytes, and `sha256` is of those decoded bytes. The platform answers
8
+ * 201 stored, 200 already held (same run, seq and sha256), 404 run not found, 400 invalid, 413 too
9
+ * large, 409 too many for one run or a different image already at that seq (a seq is never reused).
10
+ */
11
+ /** The platform's bound on every text field of an upload. */
12
+ export declare const UPLOAD_TEXT_MAX = 300;
13
+ export declare const ScreenshotUploadSchema: z.ZodObject<{
14
+ seq: z.ZodNumber;
15
+ file: z.ZodString;
16
+ step: z.ZodOptional<z.ZodString>;
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
+ checkId: z.ZodOptional<z.ZodString>;
20
+ source: z.ZodNativeEnum<{
21
+ readonly BROWSER: "browser";
22
+ readonly RENDERED: "rendered";
23
+ }>;
24
+ width: z.ZodNumber;
25
+ height: z.ZodNumber;
26
+ sha256: z.ZodString;
27
+ 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
+ }>;
51
+ export type ScreenshotUpload = z.infer<typeof ScreenshotUploadSchema>;
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { ScreenshotSource } from '../verdict/verification-run.js';
3
+ /**
4
+ * The body of `POST /v1/runs/:runId/screenshots` — one step screenshot, sent once, after the
5
+ * platform has accepted its run. One schema for both ends, so the daemon cannot send a field the
6
+ * platform does not read.
7
+ *
8
+ * `jpeg` is base64 of real JPEG bytes, and `sha256` is of those decoded bytes. The platform answers
9
+ * 201 stored, 200 already held (same run, seq and sha256), 404 run not found, 400 invalid, 413 too
10
+ * large, 409 too many for one run or a different image already at that seq (a seq is never reused).
11
+ */
12
+ /** The platform's bound on every text field of an upload. */
13
+ export const UPLOAD_TEXT_MAX = 300;
14
+ export const ScreenshotUploadSchema = z.object({
15
+ seq: z.number().int().min(0),
16
+ file: z.string().min(1).max(UPLOAD_TEXT_MAX),
17
+ step: z.string().min(1).max(UPLOAD_TEXT_MAX).optional(),
18
+ tool: z.string().min(1).max(UPLOAD_TEXT_MAX).optional(),
19
+ /** The check this picture is of, so the platform's run page can show it beside that check. */
20
+ checkId: z.string().min(1).max(UPLOAD_TEXT_MAX).optional(),
21
+ source: z.nativeEnum(ScreenshotSource),
22
+ width: z.number().int().min(0),
23
+ height: z.number().int().min(0),
24
+ sha256: z.string().regex(/^[0-9a-f]{64}$/),
25
+ jpeg: z.string().min(1),
26
+ });