@reticlehq/core 3.1.0 → 3.2.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.
@@ -225,11 +225,35 @@ export declare const BrowserLaunchKind: {
225
225
  readonly POOLED: "pooled";
226
226
  };
227
227
  export type BrowserLaunchKind = (typeof BrowserLaunchKind)[keyof typeof BrowserLaunchKind];
228
+ /**
229
+ * WHO drove the verdict.
230
+ *
231
+ * `actor` already splits a typed `reticle` command from an agent's own tool call, and both halves of
232
+ * an explore drive land on the agent side of that line: a model inside the daemon drives through the
233
+ * same chokepoint, under the same session, and its verdicts were indistinguishable from the ones the
234
+ * user's own agent earned. That matters for every rate computed per session — a session whose only
235
+ * verification came from a drive we ran on the user's behalf is not a session that verified.
236
+ *
237
+ * Absent means the agent's own call, which is the overwhelming majority: a value on every row would
238
+ * cost a field to say the ordinary thing.
239
+ */
240
+ export declare const VerificationDriver: {
241
+ /** A model inside the daemon drove this, on the user's behalf. */
242
+ readonly HARNESS: "harness";
243
+ };
244
+ export type VerificationDriver = (typeof VerificationDriver)[keyof typeof VerificationDriver];
228
245
  /** The outcome of one verification. `verified` is Reticle's own honesty grade, not merely pass/fail. */
229
246
  export declare const VerificationSchema: z.ZodObject<{
230
247
  /** Which tool produced the verdict (`reticle_assert`, `reticle_flow_verify`, …). */
231
248
  via: z.ZodString;
232
- /** `yes` | `no` | `unknown` — the honest verdict, where `unknown` means the evidence could not decide. */
249
+ /**
250
+ * `yes` | `no` | `unknown` | `no-fault` — the honest verdict, from `Verified`.
251
+ *
252
+ * FOUR values, not three. This comment said three for long enough that a dashboard written from it
253
+ * silently drops the bucket that is most actionable: `no-fault` means the window was clean and
254
+ * nothing was declared to prove, which is a teachable agent behaviour rather than a Reticle or an
255
+ * app problem, and `unknown` means the evidence could not decide.
256
+ */
233
257
  verified: z.ZodString;
234
258
  /** Did the underlying assertion pass? Distinct from `verified` on purpose. */
235
259
  passed: z.ZodBoolean;
@@ -314,8 +338,17 @@ export declare const VerificationSchema: z.ZodObject<{
314
338
  readonly BUFFER_LOSS: "buffer_loss";
315
339
  readonly TRANSPORT_GAP: "transport_gap";
316
340
  readonly BLIND_SPOT: "blind_spot";
341
+ readonly JOURNAL_LOSS: "journal_loss";
317
342
  readonly OTHER: "other";
318
343
  }>>;
344
+ /**
345
+ * Set when one of our OWN drives produced this verdict rather than the user's agent — see
346
+ * `VerificationDriver`. Absent is the ordinary case and means the agent called the tool itself.
347
+ */
348
+ driven: z.ZodOptional<z.ZodNativeEnum<{
349
+ /** A model inside the daemon drove this, on the user's behalf. */
350
+ readonly HARNESS: "harness";
351
+ }>>;
319
352
  }, "strip", z.ZodTypeAny, {
320
353
  verified: string;
321
354
  via: string;
@@ -324,8 +357,9 @@ export declare const VerificationSchema: z.ZodObject<{
324
357
  reason?: "capability-absent" | "inconclusive" | "observation_lost" | "window_closed_early" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
325
358
  durationMs?: number | undefined;
326
359
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
360
+ driven?: "harness" | undefined;
327
361
  browser?: string | undefined;
328
- uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
362
+ uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "journal_loss" | "other" | undefined;
329
363
  }, {
330
364
  verified: string;
331
365
  via: string;
@@ -334,8 +368,9 @@ export declare const VerificationSchema: z.ZodObject<{
334
368
  reason?: "capability-absent" | "inconclusive" | "observation_lost" | "window_closed_early" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
335
369
  durationMs?: number | undefined;
336
370
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
371
+ driven?: "harness" | undefined;
337
372
  browser?: string | undefined;
338
- uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
373
+ uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "journal_loss" | "other" | undefined;
339
374
  }>;
340
375
  export type Verification = z.infer<typeof VerificationSchema>;
341
376
  /** Which way the installed version moved, and between which versions. */
@@ -1639,7 +1674,14 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1639
1674
  verification: z.ZodOptional<z.ZodObject<{
1640
1675
  /** Which tool produced the verdict (`reticle_assert`, `reticle_flow_verify`, …). */
1641
1676
  via: z.ZodString;
1642
- /** `yes` | `no` | `unknown` — the honest verdict, where `unknown` means the evidence could not decide. */
1677
+ /**
1678
+ * `yes` | `no` | `unknown` | `no-fault` — the honest verdict, from `Verified`.
1679
+ *
1680
+ * FOUR values, not three. This comment said three for long enough that a dashboard written from it
1681
+ * silently drops the bucket that is most actionable: `no-fault` means the window was clean and
1682
+ * nothing was declared to prove, which is a teachable agent behaviour rather than a Reticle or an
1683
+ * app problem, and `unknown` means the evidence could not decide.
1684
+ */
1643
1685
  verified: z.ZodString;
1644
1686
  /** Did the underlying assertion pass? Distinct from `verified` on purpose. */
1645
1687
  passed: z.ZodBoolean;
@@ -1724,8 +1766,17 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1724
1766
  readonly BUFFER_LOSS: "buffer_loss";
1725
1767
  readonly TRANSPORT_GAP: "transport_gap";
1726
1768
  readonly BLIND_SPOT: "blind_spot";
1769
+ readonly JOURNAL_LOSS: "journal_loss";
1727
1770
  readonly OTHER: "other";
1728
1771
  }>>;
1772
+ /**
1773
+ * Set when one of our OWN drives produced this verdict rather than the user's agent — see
1774
+ * `VerificationDriver`. Absent is the ordinary case and means the agent called the tool itself.
1775
+ */
1776
+ driven: z.ZodOptional<z.ZodNativeEnum<{
1777
+ /** A model inside the daemon drove this, on the user's behalf. */
1778
+ readonly HARNESS: "harness";
1779
+ }>>;
1729
1780
  }, "strip", z.ZodTypeAny, {
1730
1781
  verified: string;
1731
1782
  via: string;
@@ -1734,8 +1785,9 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1734
1785
  reason?: "capability-absent" | "inconclusive" | "observation_lost" | "window_closed_early" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
1735
1786
  durationMs?: number | undefined;
1736
1787
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
1788
+ driven?: "harness" | undefined;
1737
1789
  browser?: string | undefined;
1738
- uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
1790
+ uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "journal_loss" | "other" | undefined;
1739
1791
  }, {
1740
1792
  verified: string;
1741
1793
  via: string;
@@ -1744,8 +1796,9 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1744
1796
  reason?: "capability-absent" | "inconclusive" | "observation_lost" | "window_closed_early" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
1745
1797
  durationMs?: number | undefined;
1746
1798
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
1799
+ driven?: "harness" | undefined;
1747
1800
  browser?: string | undefined;
1748
- uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
1801
+ uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "journal_loss" | "other" | undefined;
1749
1802
  }>>;
1750
1803
  /** Only on `version_changed`. */
1751
1804
  versionChange: z.ZodOptional<z.ZodObject<{
@@ -2471,8 +2524,9 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2471
2524
  reason?: "capability-absent" | "inconclusive" | "observation_lost" | "window_closed_early" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
2472
2525
  durationMs?: number | undefined;
2473
2526
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
2527
+ driven?: "harness" | undefined;
2474
2528
  browser?: string | undefined;
2475
- uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
2529
+ uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "journal_loss" | "other" | undefined;
2476
2530
  } | undefined;
2477
2531
  versionChange?: {
2478
2532
  direction: string;
@@ -2691,8 +2745,9 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2691
2745
  reason?: "capability-absent" | "inconclusive" | "observation_lost" | "window_closed_early" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
2692
2746
  durationMs?: number | undefined;
2693
2747
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
2748
+ driven?: "harness" | undefined;
2694
2749
  browser?: string | undefined;
2695
- uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
2750
+ uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "journal_loss" | "other" | undefined;
2696
2751
  } | undefined;
2697
2752
  versionChange?: {
2698
2753
  direction: string;
package/dist/telemetry.js CHANGED
@@ -253,11 +253,34 @@ export const BrowserLaunchKind = {
253
253
  /** A pooled headless context leased for a parallel flow. */
254
254
  POOLED: 'pooled',
255
255
  };
256
+ /**
257
+ * WHO drove the verdict.
258
+ *
259
+ * `actor` already splits a typed `reticle` command from an agent's own tool call, and both halves of
260
+ * an explore drive land on the agent side of that line: a model inside the daemon drives through the
261
+ * same chokepoint, under the same session, and its verdicts were indistinguishable from the ones the
262
+ * user's own agent earned. That matters for every rate computed per session — a session whose only
263
+ * verification came from a drive we ran on the user's behalf is not a session that verified.
264
+ *
265
+ * Absent means the agent's own call, which is the overwhelming majority: a value on every row would
266
+ * cost a field to say the ordinary thing.
267
+ */
268
+ export const VerificationDriver = {
269
+ /** A model inside the daemon drove this, on the user's behalf. */
270
+ HARNESS: 'harness',
271
+ };
256
272
  /** The outcome of one verification. `verified` is Reticle's own honesty grade, not merely pass/fail. */
257
273
  export const VerificationSchema = z.object({
258
274
  /** Which tool produced the verdict (`reticle_assert`, `reticle_flow_verify`, …). */
259
275
  via: z.string().min(1).max(64),
260
- /** `yes` | `no` | `unknown` — the honest verdict, where `unknown` means the evidence could not decide. */
276
+ /**
277
+ * `yes` | `no` | `unknown` | `no-fault` — the honest verdict, from `Verified`.
278
+ *
279
+ * FOUR values, not three. This comment said three for long enough that a dashboard written from it
280
+ * silently drops the bucket that is most actionable: `no-fault` means the window was clean and
281
+ * nothing was declared to prove, which is a teachable agent behaviour rather than a Reticle or an
282
+ * app problem, and `unknown` means the evidence could not decide.
283
+ */
261
284
  verified: z.string().min(1).max(16),
262
285
  /** Did the underlying assertion pass? Distinct from `verified` on purpose. */
263
286
  passed: z.boolean(),
@@ -312,6 +335,11 @@ export const VerificationSchema = z.object({
312
335
  * ownership — Reticle's before the page's. Absent on every verdict whose capture was clean.
313
336
  */
314
337
  uncleanLoss: z.nativeEnum(CaptureLoss).optional(),
338
+ /**
339
+ * Set when one of our OWN drives produced this verdict rather than the user's agent — see
340
+ * `VerificationDriver`. Absent is the ordinary case and means the agent called the tool itself.
341
+ */
342
+ driven: z.nativeEnum(VerificationDriver).optional(),
315
343
  });
316
344
  /** Which way the installed version moved, and between which versions. */
317
345
  export const VersionChangeSchema = z.object({
@@ -147,6 +147,15 @@ export declare const CaptureLoss: {
147
147
  readonly TRANSPORT_GAP: "transport_gap";
148
148
  /** A region the SDK cannot see through — a cross-origin frame, a closed shadow root. */
149
149
  readonly BLIND_SPOT: "blind_spot";
150
+ /**
151
+ * The durable event ledger refused writes at its byte ceiling, so evidence is missing from DISK.
152
+ *
153
+ * A fourth owner, and the one whose loss does not heal. `buffer_loss` is a window that aged out of
154
+ * memory and `transport_gap` is a queue that overflowed for a moment; this one is a file that
155
+ * stopped accepting writes for the rest of the session. Folding it into `buffer_loss` would put
156
+ * "wait and re-drive" next to a condition no re-drive can fix.
157
+ */
158
+ readonly JOURNAL_LOSS: "journal_loss";
150
159
  /** A loss we have not classified. A classifier that cannot say "I don't know" lies instead. */
151
160
  readonly OTHER: "other";
152
161
  };
@@ -145,6 +145,15 @@ export const CaptureLoss = {
145
145
  TRANSPORT_GAP: 'transport_gap',
146
146
  /** A region the SDK cannot see through — a cross-origin frame, a closed shadow root. */
147
147
  BLIND_SPOT: 'blind_spot',
148
+ /**
149
+ * The durable event ledger refused writes at its byte ceiling, so evidence is missing from DISK.
150
+ *
151
+ * A fourth owner, and the one whose loss does not heal. `buffer_loss` is a window that aged out of
152
+ * memory and `transport_gap` is a queue that overflowed for a moment; this one is a file that
153
+ * stopped accepting writes for the rest of the session. Folding it into `buffer_loss` would put
154
+ * "wait and re-drive" next to a condition no re-drive can fix.
155
+ */
156
+ JOURNAL_LOSS: 'journal_loss',
148
157
  /** A loss we have not classified. A classifier that cannot say "I don't know" lies instead. */
149
158
  OTHER: 'other',
150
159
  };
@@ -178,7 +178,59 @@ export declare const ReticleEnv: {
178
178
  readonly HARNESS_BASE_URL: "RETICLE_HARNESS_BASE_URL";
179
179
  /** Hard ceiling on harness model turns in one drive. Bounds cost, not value. */
180
180
  readonly HARNESS_MAX_STEPS: "RETICLE_HARNESS_MAX_STEPS";
181
+ /**
182
+ * Which model backs the harness driver: `anthropic` (the default) or `jev`.
183
+ *
184
+ * Two drivers exist because the driver's job turns out not to need a text generator. It picks the
185
+ * next action and says what it expects; the verdict is decided afterwards by the engine, with no
186
+ * model anywhere near it. A System One model answers typed questions against a state, which is
187
+ * exactly that job and none of the rest, so it can drive without being able to generate a
188
+ * sentence. Unset keeps the existing behaviour for everybody who has not asked for this.
189
+ */
190
+ readonly HARNESS_DRIVER: "RETICLE_HARNESS_DRIVER";
191
+ /**
192
+ * A direct Jev key, for this repo's own benchmarks and for anyone holding a TypeSafe account.
193
+ *
194
+ * Users are not expected to have one. The ordinary path is the key they already minted on the
195
+ * platform (`RETICLE_API_KEY`), which reaches Jev through the proxy at `RETICLE_CLOUD_URL` —
196
+ * this variable is the escape hatch that skips it, and it takes precedence when both are set so
197
+ * that a developer debugging the upstream is never silently talking to the proxy instead.
198
+ */
199
+ readonly HARNESS_JEV_KEY: "JEV_API_KEY";
200
+ /** Base URL for the Jev API, for a proxy or a gateway. Defaults to TypeSafe's own endpoint. */
201
+ readonly HARNESS_JEV_URL: "RETICLE_HARNESS_JEV_URL";
202
+ /** A direct OpenAI key. As with Jev, the ordinary path is the platform key and its proxy. */
203
+ readonly HARNESS_OPENAI_KEY: "OPENAI_API_KEY";
204
+ /** Model the OpenAI driver uses. Defaults to a small one — see `DEFAULT_OPENAI_MODEL`. */
205
+ readonly HARNESS_OPENAI_MODEL: "RETICLE_HARNESS_OPENAI_MODEL";
206
+ /**
207
+ * The API key minted on the platform, and the host it belongs to.
208
+ *
209
+ * Read through `apiKeyFrom()`, never directly — see the note on that function for why there are
210
+ * two names for one key and why neither may be dropped.
211
+ */
212
+ readonly API_KEY: "RETICLE_API_KEY";
213
+ /** The name this key had until 2026-09. Still honoured; see `apiKeyFrom()`. */
214
+ readonly CLOUD_KEY: "RETICLE_CLOUD_KEY";
215
+ readonly CLOUD_URL: "RETICLE_CLOUD_URL";
181
216
  };
217
+ /**
218
+ * The platform API key, whichever name it arrives under.
219
+ *
220
+ * `RETICLE_API_KEY` is the name. `RETICLE_CLOUD_KEY` is what it was called until 2026-09, and it
221
+ * keeps working — not out of politeness, but because the console printed that name to every user
222
+ * who ever connected a project, so it is exported in shells and CI configs we cannot see or edit.
223
+ * A rename that silently stops reading the old name does not look like a rename to those people;
224
+ * it looks like the product quietly losing their credentials.
225
+ *
226
+ * ONE function, because the alternative is each caller remembering both names and one of them
227
+ * forgetting. That is not hypothetical: this key was read inline in several places before it was
228
+ * named here at all, which is exactly how a rename half-lands.
229
+ *
230
+ * The new name wins when both are set, so a user migrating can export the new one and confirm it
231
+ * works before removing the old.
232
+ */
233
+ export declare function apiKeyFrom(env: Record<string, string | undefined>): string | undefined;
182
234
  /** Hard transport bounds shared by the browser and bridge. */
183
235
  export declare const TRANSPORT_LIMITS: {
184
236
  readonly MAX_MESSAGE_BYTES: number;
@@ -255,6 +307,24 @@ export declare const ReticleDir: {
255
307
  readonly IMPACT_FILE: "impact.json";
256
308
  /** what changes were SUPPOSED to make true —.reticle/intent.json (git-checked, reviewed) */
257
309
  readonly INTENT_FILE: "intent.json";
310
+ /**
311
+ * The sharded form of the same ledger —.reticle/intent/ (git-checked, for the same reason).
312
+ *
313
+ * Named here rather than inline at the store that writes it, because the partition guard over
314
+ * this object is what decides whether a name Reticle creates is committed or ignored. A directory
315
+ * spelled as a free string somewhere else is one the guard cannot see, so nobody ever makes that
316
+ * decision: `intent/` was written into users' repositories for that reason alone, neither
317
+ * classified nor ignored.
318
+ */
319
+ readonly INTENT_SUBDIR: "intent";
320
+ /**
321
+ * what a drive types into a field, keyed by the field's label —.reticle/fill-values.json.
322
+ *
323
+ * Git-checked on purpose. A generated value is paid for once and then belongs to the project: the
324
+ * next drive reuses it for free, a replay sends exactly what the recording sent, and a human who
325
+ * dislikes one can edit the file rather than argue with a model.
326
+ */
327
+ readonly FILL_VALUES_FILE: "fill-values.json";
258
328
  /** opt-in pixel baselines —.reticle/visual/<name>.png + <name>.diff.png. */
259
329
  readonly VISUAL_SUBDIR: "visual";
260
330
  /** verification-run artifacts —.reticle/runs/<runId>.json (the OEM/CI-consumable verdict). */
@@ -267,6 +337,15 @@ export declare const ReticleDir: {
267
337
  readonly JOURNAL_EVENTS_FILE: "events.jsonl";
268
338
  /** append-only action ledger inside a session dir (one JournalAction per line). */
269
339
  readonly JOURNAL_ACTIONS_FILE: "actions.jsonl";
340
+ /**
341
+ * the event ledger's closure report — .reticle/sessions/<id>/events.closed.json.
342
+ *
343
+ * Written once, when the byte ceiling refuses a batch, and never removed. Its PRESENCE is what
344
+ * makes the ceiling durable: a session id survives a reload, so the next connection reopens the
345
+ * same ledger with an empty memory, and a bound that lives only in one object's field is a bound
346
+ * per connection. Its CONTENTS are the loss report a time-windowed query cannot filter away.
347
+ */
348
+ readonly JOURNAL_EVENTS_CLOSED_FILE: "events.closed.json";
270
349
  /** learned expected-envelopes per route, accumulated across runs (the deviation-report baseline). */
271
350
  readonly ENVELOPES_FILE: "envelopes.json";
272
351
  /** learned ambient (action-less churn) region map — excluded from settle/summaries/envelopes. */
@@ -516,6 +595,15 @@ export declare const RETICLE_HYDRATION_ERROR_SIGNAL = "reticle:hydration-error";
516
595
  /** The observation channel a TRUNCATED event names, so downstream knows WHICH data is incomplete. */
517
596
  export declare const TruncationChannel: {
518
597
  readonly DOM: "dom";
598
+ /**
599
+ * The durable per-session event ledger stopped accepting writes at its byte ceiling.
600
+ *
601
+ * The only channel here that names a SERVER-side refusal rather than a browser-side batch cap, and
602
+ * the only one that is terminal: `dom` truncates one flood and keeps observing, while this says the
603
+ * file is closed and every event after it is absent from disk. A reader that finds it knows a
604
+ * negative answer drawn from the journal may be "the ledger was full", not "it never happened".
605
+ */
606
+ readonly JOURNAL: "journal";
519
607
  };
520
608
  export type TruncationChannel = (typeof TruncationChannel)[keyof typeof TruncationChannel];
521
609
  /**
@@ -180,7 +180,65 @@ export const ReticleEnv = {
180
180
  HARNESS_BASE_URL: 'RETICLE_HARNESS_BASE_URL',
181
181
  /** Hard ceiling on harness model turns in one drive. Bounds cost, not value. */
182
182
  HARNESS_MAX_STEPS: 'RETICLE_HARNESS_MAX_STEPS',
183
+ /**
184
+ * Which model backs the harness driver: `anthropic` (the default) or `jev`.
185
+ *
186
+ * Two drivers exist because the driver's job turns out not to need a text generator. It picks the
187
+ * next action and says what it expects; the verdict is decided afterwards by the engine, with no
188
+ * model anywhere near it. A System One model answers typed questions against a state, which is
189
+ * exactly that job and none of the rest, so it can drive without being able to generate a
190
+ * sentence. Unset keeps the existing behaviour for everybody who has not asked for this.
191
+ */
192
+ HARNESS_DRIVER: 'RETICLE_HARNESS_DRIVER',
193
+ /**
194
+ * A direct Jev key, for this repo's own benchmarks and for anyone holding a TypeSafe account.
195
+ *
196
+ * Users are not expected to have one. The ordinary path is the key they already minted on the
197
+ * platform (`RETICLE_API_KEY`), which reaches Jev through the proxy at `RETICLE_CLOUD_URL` —
198
+ * this variable is the escape hatch that skips it, and it takes precedence when both are set so
199
+ * that a developer debugging the upstream is never silently talking to the proxy instead.
200
+ */
201
+ HARNESS_JEV_KEY: 'JEV_API_KEY',
202
+ /** Base URL for the Jev API, for a proxy or a gateway. Defaults to TypeSafe's own endpoint. */
203
+ HARNESS_JEV_URL: 'RETICLE_HARNESS_JEV_URL',
204
+ /** A direct OpenAI key. As with Jev, the ordinary path is the platform key and its proxy. */
205
+ HARNESS_OPENAI_KEY: 'OPENAI_API_KEY',
206
+ /** Model the OpenAI driver uses. Defaults to a small one — see `DEFAULT_OPENAI_MODEL`. */
207
+ HARNESS_OPENAI_MODEL: 'RETICLE_HARNESS_OPENAI_MODEL',
208
+ /**
209
+ * The API key minted on the platform, and the host it belongs to.
210
+ *
211
+ * Read through `apiKeyFrom()`, never directly — see the note on that function for why there are
212
+ * two names for one key and why neither may be dropped.
213
+ */
214
+ API_KEY: 'RETICLE_API_KEY',
215
+ /** The name this key had until 2026-09. Still honoured; see `apiKeyFrom()`. */
216
+ CLOUD_KEY: 'RETICLE_CLOUD_KEY',
217
+ CLOUD_URL: 'RETICLE_CLOUD_URL',
183
218
  };
219
+ /**
220
+ * The platform API key, whichever name it arrives under.
221
+ *
222
+ * `RETICLE_API_KEY` is the name. `RETICLE_CLOUD_KEY` is what it was called until 2026-09, and it
223
+ * keeps working — not out of politeness, but because the console printed that name to every user
224
+ * who ever connected a project, so it is exported in shells and CI configs we cannot see or edit.
225
+ * A rename that silently stops reading the old name does not look like a rename to those people;
226
+ * it looks like the product quietly losing their credentials.
227
+ *
228
+ * ONE function, because the alternative is each caller remembering both names and one of them
229
+ * forgetting. That is not hypothetical: this key was read inline in several places before it was
230
+ * named here at all, which is exactly how a rename half-lands.
231
+ *
232
+ * The new name wins when both are set, so a user migrating can export the new one and confirm it
233
+ * works before removing the old.
234
+ */
235
+ export function apiKeyFrom(env) {
236
+ const current = env[ReticleEnv.API_KEY];
237
+ if (current !== undefined && 0 < current.length)
238
+ return current;
239
+ const legacy = env[ReticleEnv.CLOUD_KEY];
240
+ return legacy !== undefined && 0 < legacy.length ? legacy : undefined;
241
+ }
184
242
  /** Hard transport bounds shared by the browser and bridge. */
185
243
  export const TRANSPORT_LIMITS = {
186
244
  MAX_MESSAGE_BYTES: 1024 * 1024,
@@ -271,6 +329,24 @@ export const ReticleDir = {
271
329
  IMPACT_FILE: 'impact.json',
272
330
  /** what changes were SUPPOSED to make true —.reticle/intent.json (git-checked, reviewed) */
273
331
  INTENT_FILE: 'intent.json',
332
+ /**
333
+ * The sharded form of the same ledger —.reticle/intent/ (git-checked, for the same reason).
334
+ *
335
+ * Named here rather than inline at the store that writes it, because the partition guard over
336
+ * this object is what decides whether a name Reticle creates is committed or ignored. A directory
337
+ * spelled as a free string somewhere else is one the guard cannot see, so nobody ever makes that
338
+ * decision: `intent/` was written into users' repositories for that reason alone, neither
339
+ * classified nor ignored.
340
+ */
341
+ INTENT_SUBDIR: 'intent',
342
+ /**
343
+ * what a drive types into a field, keyed by the field's label —.reticle/fill-values.json.
344
+ *
345
+ * Git-checked on purpose. A generated value is paid for once and then belongs to the project: the
346
+ * next drive reuses it for free, a replay sends exactly what the recording sent, and a human who
347
+ * dislikes one can edit the file rather than argue with a model.
348
+ */
349
+ FILL_VALUES_FILE: 'fill-values.json',
274
350
  /** opt-in pixel baselines —.reticle/visual/<name>.png + <name>.diff.png. */
275
351
  VISUAL_SUBDIR: 'visual',
276
352
  /** verification-run artifacts —.reticle/runs/<runId>.json (the OEM/CI-consumable verdict). */
@@ -283,6 +359,15 @@ export const ReticleDir = {
283
359
  JOURNAL_EVENTS_FILE: 'events.jsonl',
284
360
  /** append-only action ledger inside a session dir (one JournalAction per line). */
285
361
  JOURNAL_ACTIONS_FILE: 'actions.jsonl',
362
+ /**
363
+ * the event ledger's closure report — .reticle/sessions/<id>/events.closed.json.
364
+ *
365
+ * Written once, when the byte ceiling refuses a batch, and never removed. Its PRESENCE is what
366
+ * makes the ceiling durable: a session id survives a reload, so the next connection reopens the
367
+ * same ledger with an empty memory, and a bound that lives only in one object's field is a bound
368
+ * per connection. Its CONTENTS are the loss report a time-windowed query cannot filter away.
369
+ */
370
+ JOURNAL_EVENTS_CLOSED_FILE: 'events.closed.json',
286
371
  /** learned expected-envelopes per route, accumulated across runs (the deviation-report baseline). */
287
372
  ENVELOPES_FILE: 'envelopes.json',
288
373
  /** learned ambient (action-less churn) region map — excluded from settle/summaries/envelopes. */
@@ -536,6 +621,15 @@ export const RETICLE_HYDRATION_ERROR_SIGNAL = 'reticle:hydration-error';
536
621
  /** The observation channel a TRUNCATED event names, so downstream knows WHICH data is incomplete. */
537
622
  export const TruncationChannel = {
538
623
  DOM: 'dom',
624
+ /**
625
+ * The durable per-session event ledger stopped accepting writes at its byte ceiling.
626
+ *
627
+ * The only channel here that names a SERVER-side refusal rather than a browser-side batch cap, and
628
+ * the only one that is terminal: `dom` truncates one flood and keeps observing, while this says the
629
+ * file is closed and every event after it is absent from disk. A reader that finds it knows a
630
+ * negative answer drawn from the journal may be "the ledger was full", not "it never happened".
631
+ */
632
+ JOURNAL: 'journal',
539
633
  };
540
634
  /**
541
635
  * How an event was linked to the action it is attributed to. `window` means the SDK stamped the
@@ -35,6 +35,20 @@ export declare const HumanControlKind: {
35
35
  * what to send is the daemon's question, and a panel that named artifacts could disagree with it.
36
36
  */
37
37
  readonly SYNC: "sync";
38
+ /**
39
+ * Human flipped the harness switch in the panel. `text` carries `on` or `off`.
40
+ *
41
+ * The panel does NOT keep this state. It emits the intent and the daemon writes it to the
42
+ * platform, because the same preference is settable from the dashboard and two writable copies of
43
+ * one switch is two sources of truth — the HUD would disagree with the console the first time
44
+ * somebody used both, and neither would be wrong. So: the console and the panel both WRITE
45
+ * through to the platform, and both READ what it says.
46
+ *
47
+ * Carries the desired state rather than meaning "toggle". A toggle sent twice by a double-click
48
+ * lands back where it started; an explicit `on` is idempotent, which is what a flaky connection
49
+ * and an impatient finger both need.
50
+ */
51
+ readonly HARNESS: "harness";
38
52
  };
39
53
  export type HumanControlKind = (typeof HumanControlKind)[keyof typeof HumanControlKind];
40
54
  /**
@@ -36,6 +36,20 @@ export const HumanControlKind = {
36
36
  * what to send is the daemon's question, and a panel that named artifacts could disagree with it.
37
37
  */
38
38
  SYNC: 'sync',
39
+ /**
40
+ * Human flipped the harness switch in the panel. `text` carries `on` or `off`.
41
+ *
42
+ * The panel does NOT keep this state. It emits the intent and the daemon writes it to the
43
+ * platform, because the same preference is settable from the dashboard and two writable copies of
44
+ * one switch is two sources of truth — the HUD would disagree with the console the first time
45
+ * somebody used both, and neither would be wrong. So: the console and the panel both WRITE
46
+ * through to the platform, and both READ what it says.
47
+ *
48
+ * Carries the desired state rather than meaning "toggle". A toggle sent twice by a double-click
49
+ * lands back where it started; an explicit `on` is idempotent, which is what a flaky connection
50
+ * and an impatient finger both need.
51
+ */
52
+ HARNESS: 'harness',
39
53
  };
40
54
  /**
41
55
  * Human review marks: the durability tier of the anchor that pins a mark to an element. Mirrors the
@@ -251,6 +251,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
251
251
  durationMs: z.ZodNumber;
252
252
  initiator: z.ZodString;
253
253
  urlRaw: z.ZodOptional<z.ZodString>;
254
+ requestShape: z.ZodOptional<z.ZodString>;
254
255
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
255
256
  id: z.ZodString;
256
257
  method: z.ZodString;
@@ -260,6 +261,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
260
261
  durationMs: z.ZodNumber;
261
262
  initiator: z.ZodString;
262
263
  urlRaw: z.ZodOptional<z.ZodString>;
264
+ requestShape: z.ZodOptional<z.ZodString>;
263
265
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
264
266
  id: z.ZodString;
265
267
  method: z.ZodString;
@@ -269,6 +271,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
269
271
  durationMs: z.ZodNumber;
270
272
  initiator: z.ZodString;
271
273
  urlRaw: z.ZodOptional<z.ZodString>;
274
+ requestShape: z.ZodOptional<z.ZodString>;
272
275
  }, z.ZodTypeAny, "passthrough">>;
273
276
  "net.pending": z.ZodObject<{
274
277
  id: z.ZodString;
@@ -784,13 +787,14 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
784
787
  readonly MESSAGE: "message";
785
788
  readonly REPLAY: "replay";
786
789
  readonly SYNC: "sync";
790
+ readonly HARNESS: "harness";
787
791
  }>;
788
792
  text: z.ZodOptional<z.ZodString>;
789
793
  }, "strip", z.ZodTypeAny, {
790
- kind: "message" | "pause" | "resume" | "end" | "replay" | "sync";
794
+ kind: "message" | "pause" | "resume" | "end" | "replay" | "sync" | "harness";
791
795
  text?: string | undefined;
792
796
  }, {
793
- kind: "message" | "pause" | "resume" | "end" | "replay" | "sync";
797
+ kind: "message" | "pause" | "resume" | "end" | "replay" | "sync" | "harness";
794
798
  text?: string | undefined;
795
799
  }>;
796
800
  "human.mark": z.ZodObject<{
@@ -3,6 +3,7 @@ import { EventType, PerfMetric } from './constants/constants.js';
3
3
  import { BlindSpotKind } from '../verdict/verified-constants.js';
4
4
  import { BrowserBrand } from '../telemetry-feedback.js';
5
5
  import { HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
6
+ import { REQUEST_SHAPE_FIELD } from './net.js';
6
7
  /**
7
8
  * Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
8
9
  * The envelope (`ReticleEventSchema.data`) stays open on the wire so a richer SDK is never rejected
@@ -104,6 +105,7 @@ const netRequestSchema = z
104
105
  durationMs: z.number(),
105
106
  initiator: z.string(),
106
107
  urlRaw: z.string().optional(),
108
+ [REQUEST_SHAPE_FIELD]: z.string().optional(),
107
109
  })
108
110
  .passthrough();
109
111
  const consoleSchema = z.object({ message: z.string() }).passthrough();
@@ -11,13 +11,14 @@ export declare const HumanControlDataSchema: z.ZodObject<{
11
11
  readonly MESSAGE: "message";
12
12
  readonly REPLAY: "replay";
13
13
  readonly SYNC: "sync";
14
+ readonly HARNESS: "harness";
14
15
  }>;
15
16
  text: z.ZodOptional<z.ZodString>;
16
17
  }, "strip", z.ZodTypeAny, {
17
- kind: "message" | "pause" | "resume" | "end" | "replay" | "sync";
18
+ kind: "message" | "pause" | "resume" | "end" | "replay" | "sync" | "harness";
18
19
  text?: string | undefined;
19
20
  }, {
20
- kind: "message" | "pause" | "resume" | "end" | "replay" | "sync";
21
+ kind: "message" | "pause" | "resume" | "end" | "replay" | "sync" | "harness";
21
22
  text?: string | undefined;
22
23
  }>;
23
24
  export type HumanControlData = z.infer<typeof HumanControlDataSchema>;
@@ -152,3 +152,27 @@ export declare const URL_RAW = "urlRaw";
152
152
  * otherwise the displayed (possibly redacted) `url`.
153
153
  */
154
154
  export declare function urlForMatch(data: Record<string, unknown>): string;
155
+ /**
156
+ * The NET_REQUEST field carrying a DISCRIMINATOR for the request body.
157
+ *
158
+ * `duplicate-request` asks whether two writes in one action's window were the same write. Method
159
+ * plus URL cannot answer that — a command-bus API posts every mutation to one endpoint, and a
160
+ * submit that intentionally saves and then advances sends two different payloads to the same URL —
161
+ * and the body that could answer it is not on the record: capturing bodies by default would put
162
+ * passwords, tokens and customer data on the wire for every request an app makes.
163
+ *
164
+ * So the page sends a fingerprint of the body's SHAPE instead: key names, value types and the total
165
+ * length, hashed. It is equal for two identical payloads and different for two payloads that differ
166
+ * in structure or size, which is all the rule needs, and it is not a projection of the payload —
167
+ * no character of any value is ever read into it, so there is nothing in it to recover.
168
+ */
169
+ export declare const REQUEST_SHAPE_FIELD = "requestShape";
170
+ /**
171
+ * The fingerprint of a request that carried NO body.
172
+ *
173
+ * A KNOWN discriminator, not a missing one: two bodyless POSTs to one URL are indistinguishable to
174
+ * the server too, so they are allowed to be a duplicate. A body the page cannot read as text
175
+ * (FormData, Blob, a stream) omits the field ALTOGETHER, which is the same statement an older SDK
176
+ * makes by not sending it: a body may have existed and nothing about it is on the record.
177
+ */
178
+ export declare const REQUEST_SHAPE_NONE = "none";