@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
@@ -13,6 +13,7 @@ import { z } from 'zod';
13
13
  import { SubjectRefSchema } from 'open-verification';
14
14
  import { PredicateKind } from './consequence.js';
15
15
  import { Verified } from './verified-constants.js';
16
+ import { RunDisparitySchema } from './disparity.js';
16
17
  /** Schema version stamped into every run file so a reader can reject/upgrade old artifacts. */
17
18
  export const RUN_FILE_VERSION = 3;
18
19
  /**
@@ -90,6 +91,18 @@ export const RunFlowStatus = {
90
91
  SKIPPED: 'skipped',
91
92
  HEALED: 'healed',
92
93
  };
94
+ /**
95
+ * What one drive came to, and the only place that is decided. A check that came back no is the only
96
+ * failure. Checks nobody could decide, or a goal the model judged missed with no check against it,
97
+ * are NOT PROVED (`skipped`): undecided evidence calls for a better check, never a code change, and
98
+ * a drive with nothing failed was reported "1 broken" before this rule was one rule.
99
+ */
100
+ export function driveFlowStatus(checks) {
101
+ if (0 < checks.failed) {
102
+ return RunFlowStatus.FAIL;
103
+ }
104
+ return 0 < checks.held && false !== checks.goalMet ? RunFlowStatus.PASS : RunFlowStatus.SKIPPED;
105
+ }
93
106
  /**
94
107
  * The kind of standalone assertion captured outside a flow.
95
108
  *
@@ -195,6 +208,54 @@ export const RunChangedFileSchema = z.object({
195
208
  export const RUN_STEP_RESULTS_MAX = 200;
196
209
  export const RUN_TEXT_MAX = 300;
197
210
  export const RUN_RECORDING_MAX_BYTES = 64 * 1024;
211
+ /**
212
+ * Where a step screenshot's pixels came from. `browser` is a real screenshot (CDP, a leased page, or
213
+ * the desktop shell's own window capture); `rendered` is the page drawn in-page by the SDK, which can
214
+ * miss cross-origin images and fonts, so a reader is told it is approximate.
215
+ */
216
+ export const ScreenshotSource = {
217
+ BROWSER: 'browser',
218
+ RENDERED: 'rendered',
219
+ };
220
+ /** How a step screenshot is taken and kept — shared by the daemon, the SDK and the platform. */
221
+ export const STEP_SCREENSHOT = {
222
+ /** `.reticle/visual/runs/<runId>/<seq>-<tool>.jpg` */
223
+ RUNS_DIR: 'runs',
224
+ /** One line per landed screenshot, beside the images: what the run artifact and the upload read. */
225
+ MANIFEST_FILE: 'shots.jsonl',
226
+ JPEG_QUALITY: 0.7,
227
+ MAX_SIDE_PX: 1600,
228
+ /** The platform refuses more than this for one run, so the daemon stops taking them there. */
229
+ MAX_PER_RUN: 300,
230
+ /** The platform refuses an image larger than this, decoded. */
231
+ MAX_BYTES: 1.5 * 1024 * 1024,
232
+ /**
233
+ * The `tool` of a frame: a picture taken between steps while Reticle drives a tab, about once a
234
+ * second. Frames share the run's `seq`, so the shots in `seq` order play the run as a film.
235
+ */
236
+ FRAME_TOOL: 'frame',
237
+ };
238
+ /** One step's screenshot as a run artifact records it. `file` is relative to the run's directory. */
239
+ export const StepScreenshotSchema = z.object({
240
+ file: z.string(),
241
+ source: z.nativeEnum(ScreenshotSource),
242
+ width: z.number(),
243
+ height: z.number(),
244
+ sha256: z.string(),
245
+ });
246
+ /** Every screenshot a run took, in order — including the actions that produced no verdict. */
247
+ export const RunScreenshotSchema = StepScreenshotSchema.extend({
248
+ seq: z.number(),
249
+ tool: z.string(),
250
+ /** The flow step it belongs to, as `<flow>#<step>`, when it was taken during a replay. */
251
+ step: z.string().optional(),
252
+ /** Taken for a call that produced a verdict — what lets the run pair it with its check. */
253
+ verdict: z.boolean().optional(),
254
+ /** The check this picture is of (see `RunCheck.checkId`), when it could be paired with one. */
255
+ checkId: z.string().optional(),
256
+ /** The journal action it was taken for: how a run pairs it with its check (`RunCheck.actionId`). */
257
+ actionId: z.string().optional(),
258
+ });
198
259
  /** One step of a replayed flow, as synced: its outcome and the pages it ran on and led to. */
199
260
  export const RunStepResultSchema = z.object({
200
261
  step: z.number(),
@@ -206,6 +267,8 @@ export const RunStepResultSchema = z.object({
206
267
  error: z.string().optional(),
207
268
  /** The drift's reason kind, when the step drifted. */
208
269
  drift: z.string().optional(),
270
+ /** What the page looked like when this step's outcome was decided. */
271
+ screenshot: StepScreenshotSchema.optional(),
209
272
  });
210
273
  /**
211
274
  * The flow a run replayed, as recorded: enough to replay it again somewhere else.
@@ -261,6 +324,13 @@ export const RunCheckSchema = z.object({
261
324
  * recorded which, and those are different facts about the evidence.
262
325
  */
263
326
  declaredBeforeActing: z.boolean().optional(),
327
+ /**
328
+ * What the check required and what it saw, in the engine's words, when it said — "an element
329
+ * matching {"testid":"pay"} in state 'enabled'" and "present, visible, disabled". Without them an
330
+ * issue a CI run found had no Expected or Actual to show. Optional: older runs carry neither.
331
+ */
332
+ expected: z.string().optional(),
333
+ observed: z.string().optional(),
264
334
  /**
265
335
  * What kind of evidence bought this answer.
266
336
  *
@@ -286,6 +356,19 @@ export const RunCheckSchema = z.object({
286
356
  reason: z.string().optional(),
287
357
  /** This check's own name, so a later verdict can cite it. See revision.ts. */
288
358
  checkId: z.string().optional(),
359
+ /** The journal action that produced it, kept on this machine to pair it with its screenshot. */
360
+ actionId: z.string().optional(),
361
+ /**
362
+ * What this check proves: the agent's `intent` (a sentence, or the id of a declared intent), else a
363
+ * sentence the engine built from the predicate in the failure voice — see `intentDerived`.
364
+ */
365
+ intent: z.string().optional(),
366
+ /** True when `intent` was built from the predicate, not given by the agent. */
367
+ intentDerived: z.boolean().optional(),
368
+ /** The index of the `allOf` part that failed, so a title can name the one thing that did not happen. */
369
+ failedPart: z.number().int().min(0).optional(),
370
+ /** What the page looked like when this check was decided. */
371
+ screenshot: StepScreenshotSchema.optional(),
289
372
  /**
290
373
  * The earlier check this one corrects, as `<runId>#<checkId>`.
291
374
  *
@@ -394,6 +477,12 @@ export const ReticleVerificationRunSchema = z.object({
394
477
  name: z.string(),
395
478
  framework: z.nativeEnum(RunFramework),
396
479
  commit: z.string().optional(),
480
+ /**
481
+ * The git branch of the checkout that served the page. Several agents can drive one project at
482
+ * once, each in its own worktree; the branch tells their runs apart. Optional and additive: an
483
+ * older reader strips it and keeps the run.
484
+ */
485
+ branch: z.string().optional(),
397
486
  env: z.nativeEnum(RunEnv).optional(),
398
487
  previewUrl: z.string().optional(),
399
488
  }),
@@ -402,6 +491,18 @@ export const ReticleVerificationRunSchema = z.object({
402
491
  kind: z.nativeEnum(RunAgentKind),
403
492
  model: z.string().optional(),
404
493
  }),
494
+ /**
495
+ * The episode that produced this run: `.reticle/episodes/<episodeId>.jsonl` on the machine that
496
+ * ran it. Joins the run to every tool call the agent made, exactly. Absent when no episode was
497
+ * written (the journal off, a CI run with no agent).
498
+ */
499
+ episodeId: z.string().optional(),
500
+ /**
501
+ * The coding agent's own session id, as its MCP server announced it (Claude Code's
502
+ * `CLAUDE_CODE_SESSION_ID`, the `session_id` its hooks receive). Joins the run to the agent
503
+ * hooks' `agent-<session>.jsonl` exactly, even with two sessions of one agent in a project.
504
+ */
505
+ agentSession: z.string().optional(),
405
506
  trigger: z.object({
406
507
  kind: z.nativeEnum(RunTrigger),
407
508
  diffRef: z.string().optional(),
@@ -442,6 +543,18 @@ export const ReticleVerificationRunSchema = z.object({
442
543
  risks: z.array(RunRiskSchema).default([]),
443
544
  evidence: VerificationEvidenceSchema,
444
545
  repair: z.object({ failurePackets: z.array(RepairPacketSchema).default([]) }).optional(),
546
+ /** What the page looked like after each action, assert and replayed step. Absent on older runs. */
547
+ screenshots: z.array(RunScreenshotSchema).optional(),
445
548
  verdict: RunVerdictSchema,
446
549
  signature: RunSignatureSchema.optional(),
550
+ /**
551
+ * On a Harness run: each goal the session's coding agent also judged, and how the two compare.
552
+ * Optional and additive; an older platform strips it and keeps the body.
553
+ */
554
+ disparity: z.array(RunDisparitySchema).optional(),
555
+ /**
556
+ * What the coding agent itself said the session showed (`reticle_session { end, claim }`), kept
557
+ * beside the graded `verdict` so claimed-vs-graded can be compared. Never read as the verdict.
558
+ */
559
+ agentClaim: z.nativeEnum(VerdictStatus).optional(),
447
560
  });
@@ -60,15 +60,15 @@ export declare const verifyProgressEventSchema: z.ZodObject<{
60
60
  }, "strip", z.ZodTypeAny, {
61
61
  at: number;
62
62
  phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
63
- ok?: boolean | undefined;
64
63
  name?: string | undefined;
64
+ ok?: boolean | undefined;
65
65
  total?: number | undefined;
66
66
  index?: number | undefined;
67
67
  }, {
68
68
  at: number;
69
69
  phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
70
- ok?: boolean | undefined;
71
70
  name?: string | undefined;
71
+ ok?: boolean | undefined;
72
72
  total?: number | undefined;
73
73
  index?: number | undefined;
74
74
  }>;
@@ -91,15 +91,15 @@ export declare const verifyProgressBatchSchema: z.ZodObject<{
91
91
  }, "strip", z.ZodTypeAny, {
92
92
  at: number;
93
93
  phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
94
- ok?: boolean | undefined;
95
94
  name?: string | undefined;
95
+ ok?: boolean | undefined;
96
96
  total?: number | undefined;
97
97
  index?: number | undefined;
98
98
  }, {
99
99
  at: number;
100
100
  phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
101
- ok?: boolean | undefined;
102
101
  name?: string | undefined;
102
+ ok?: boolean | undefined;
103
103
  total?: number | undefined;
104
104
  index?: number | undefined;
105
105
  }>, "many">;
@@ -108,8 +108,8 @@ export declare const verifyProgressBatchSchema: z.ZodObject<{
108
108
  events: {
109
109
  at: number;
110
110
  phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
111
- ok?: boolean | undefined;
112
111
  name?: string | undefined;
112
+ ok?: boolean | undefined;
113
113
  total?: number | undefined;
114
114
  index?: number | undefined;
115
115
  }[];
@@ -118,8 +118,8 @@ export declare const verifyProgressBatchSchema: z.ZodObject<{
118
118
  events: {
119
119
  at: number;
120
120
  phase: "connecting" | "waiting_for_app" | "flows_found" | "flow_started" | "flow_finished" | "grading" | "pushed";
121
- ok?: boolean | undefined;
122
121
  name?: string | undefined;
122
+ ok?: boolean | undefined;
123
123
  total?: number | undefined;
124
124
  index?: number | undefined;
125
125
  }[];
@@ -4,9 +4,7 @@
4
4
  */
5
5
  export declare const RETICLE_DEFAULT_PORT = 4400;
6
6
  export declare const RETICLE_WS_PATH = "/reticle";
7
- /** Agent↔server MCP wire paths — served by the daemon HTTP plane, forwarded by the stdio proxy. */
8
- export declare const MCP_SSE_PATH = "/mcp/sse";
9
- export declare const MCP_MESSAGE_PATH = "/mcp/message";
7
+ export * from './mcp-wire.js';
10
8
  /**
11
9
  * The name this MCP server answers to — in its own `serverInfo` handshake, and in the registration
12
10
  * an installer writes into an agent's config. Those must be the same string or the agent registers
@@ -30,6 +28,12 @@ export declare const MCP_SERVER_NAME = "reticle";
30
28
  export declare const MCP_SHUTDOWN_EVENT = "reticle-shutdown";
31
29
  /** Local-only daemon introspection — `reticle status` GETs this for sessions + health at a glance. */
32
30
  export declare const STATUS_PATH = "/status";
31
+ /**
32
+ * Local-only stop request — `reticle stop` and `reticle kill` POST here first, with the pairing token
33
+ * as a bearer token. It runs the daemon's normal shutdown path. A signal cannot do that on Windows,
34
+ * where it ends the process at once.
35
+ */
36
+ export declare const SHUTDOWN_PATH = "/shutdown";
33
37
  /**
34
38
  * Query flag on STATUS_PATH: the caller (a running `reticle init`) is waiting on this daemon, so it
35
39
  * must not idle out yet. Without it the daemon init started exited mid-wait on a slow desktop build.
@@ -103,138 +107,7 @@ export declare const RETICLE_URL_PARAM: {
103
107
  };
104
108
  /** The loopback bind address. The daemon/bridge bind here by default — never expose Reticle off-host. */
105
109
  export declare const LOOPBACK_HOST = "127.0.0.1";
106
- /**
107
- * Every environment variable Reticle reads, named once. A misspelled inline env string silently
108
- * disables the control it gates (e.g. a typo'd `RETICLE_TOKEN` would disable auth) — so the names live
109
- * here and nowhere else. The values are the literal process.env keys.
110
- */
111
- export declare const ReticleEnv: {
112
- /** "0"/"false"/"off" turns off telemetry and every optional outbound call; DO_NOT_TRACK too. */
113
- readonly TELEMETRY: "RETICLE_TELEMETRY";
114
- readonly DO_NOT_TRACK: "DO_NOT_TRACK";
115
- /** Shared-secret the browser SDK must present in HELLO; absent ⇒ loopback-trust only. */
116
- readonly TOKEN: "RETICLE_TOKEN";
117
- /** Bridge bind host. Defaults to loopback; setting anything else is opt-in remote exposure. */
118
- readonly HOST: "RETICLE_HOST";
119
- /** Comma-separated WS Origin allow-list for the bridge. */
120
- readonly ALLOWED_ORIGINS: "RETICLE_ALLOWED_ORIGINS";
121
- /** Bridge/daemon WS port override. */
122
- readonly PORT: "RETICLE_PORT";
123
- /** Daemon state — pidfiles, discovery registry, logs. Defaults to `~/.reticle`. Overridable
124
- * because a read-only $HOME (sandboxed agent, locked-down Windows profile, container) otherwise
125
- * makes the daemon unstartable with a raw EACCES naming nothing. Reported by a Windows user. */
126
- readonly STATE_DIR: "RETICLE_STATE_DIR";
127
- /** Attach to an already-running browser over CDP instead of launching one. */
128
- readonly CDP_URL: "RETICLE_CDP_URL";
129
- /** The Chromium executable to launch, in place of Playwright's own build or an installed Chrome. */
130
- readonly CHROMIUM_PATH: "RETICLE_CHROMIUM_PATH";
131
- /** Max simultaneous leased headless contexts in the browser pool (resource cap). */
132
- readonly MAX_CONTEXTS: "RETICLE_MAX_CONTEXTS";
133
- /**
134
- * Inbound events per second before the bridge starts SAMPLING (never disconnecting).
135
- *
136
- * Raise it for a legitimately busy app — a streaming dashboard, a live grid — rather than accept
137
- * partial coverage. Free and local: the daemon runs on the same machine, so a higher ceiling costs
138
- * nothing to anyone.
139
- */
140
- readonly MAX_MESSAGES_PER_SECOND: "RETICLE_MAX_MESSAGES_PER_SECOND";
141
- /** Bearer token required by the optional `reticle serve --http` verify endpoint. */
142
- readonly VERIFY_TOKEN: "RETICLE_VERIFY_TOKEN";
143
- /** Ms of continuous idleness (no agent, no browser session, no lease) before the daemon self-exits;
144
- * `0` disables. Keeps Reticle from lingering on a user's machine after the editor closes. */
145
- readonly IDLE_SHUTDOWN: "RETICLE_IDLE_SHUTDOWN_MS";
146
- /** Idle re-check cadence (default 30s). Overridable so daemon-lifecycle-test can watch a full
147
- * exit/wake cycle in seconds rather than minutes. */
148
- readonly IDLE_CHECK: "RETICLE_IDLE_CHECK_MS";
149
- /**
150
- * Grace for a daemon with an agent ATTACHED. Longer than the base on purpose: quiet with a client
151
- * present means a slow install or a thinking human, not an unwanted daemon — a flat 5 minutes was
152
- * killing live runs mid-install. Derived from the base when unset.
153
- */
154
- readonly IDLE_ATTACHED: "RETICLE_IDLE_ATTACHED_MS";
155
- /**
156
- * How often the daemon writes `reticle_daemon_alive`, so a GAP in its log is evidence it died.
157
- *
158
- * Overridable for the same reason the idle windows are: a spec that has to prove "a killed daemon
159
- * is distinguishable from a tidy one" cannot wait 30 seconds per beat, and a spec that instead
160
- * re-implements the cadence is insensitive to the thing it claims to guard.
161
- */
162
- readonly HEARTBEAT: "RETICLE_HEARTBEAT_MS";
163
- /** Directory holding the auto-provisioned pairing token. Defaults to ~/.reticle; relocatable for CI. */
164
- readonly PAIRING_TOKEN_DIR: "RETICLE_PAIRING_TOKEN_DIR";
165
- /** Force the durable causal journal off (`0`/`false`/`off`) or on (`1`/`true`/`on`); default on. */
166
- readonly JOURNAL: "RETICLE_JOURNAL";
167
- /**
168
- * Verbose internal flow tracing for people working ON Reticle (`1`/`true`/`on`); default off.
169
- *
170
- * Distinct from the journal, which records what the AGENT did to the app. This records what
171
- * RETICLE did to answer it: one line per internal stage, with its duration and nesting, so a
172
- * developer can see which code a tool call actually went through and where the time went.
173
- * Off by default and free when off — a trace on every tool call is a cost on the hot path.
174
- */
175
- readonly TRACE: "RETICLE_TRACE";
176
- /**
177
- * How many consecutive reconnects the MCP proxy attempts before it stops retrying and goes
178
- * dormant. Overridable for the same reason the idle windows are: the real budget takes MINUTES to
179
- * exhaust, so the one spec that proves the proxy SURVIVES exhaustion could not run at all without
180
- * shortening it. A budget nobody can reach in a test is a budget nobody tests.
181
- */
182
- readonly RECONNECT_ATTEMPTS: "RETICLE_RECONNECT_ATTEMPTS";
183
- /** Quiet window before an abandoned MCP stdio proxy exits; `0` disables the watcher. */
184
- readonly MCP_PROXY_IDLE: "RETICLE_MCP_PROXY_IDLE_MS";
185
- /**
186
- * API key for the harness — the model that drives the app when no coding agent is in the loop.
187
- *
188
- * The standard Anthropic name, on purpose: a machine that can already run a coding agent can
189
- * already run the harness, with nothing to configure. Absent ⇒ the harness is simply unavailable
190
- * and every other part of Reticle is unaffected.
191
- */
192
- readonly HARNESS_KEY: "ANTHROPIC_API_KEY";
193
- /** Model the harness drives with. Defaults to a small one — see `DEFAULT_HARNESS_MODEL`. */
194
- readonly HARNESS_MODEL: "RETICLE_HARNESS_MODEL";
195
- /** Base URL for the harness's model API, for a proxy or a gateway. */
196
- readonly HARNESS_BASE_URL: "RETICLE_HARNESS_BASE_URL";
197
- /** Hard ceiling on harness model turns in one drive. Bounds cost, not value. */
198
- readonly HARNESS_MAX_STEPS: "RETICLE_HARNESS_MAX_STEPS";
199
- /**
200
- * Which model backs the harness driver: `anthropic` (the default) or `jev`.
201
- *
202
- * Two drivers exist because the driver's job turns out not to need a text generator. It picks the
203
- * next action and says what it expects; the verdict is decided afterwards by the engine, with no
204
- * model anywhere near it. A System One model answers typed questions against a state, which is
205
- * exactly that job and none of the rest, so it can drive without being able to generate a
206
- * sentence. Unset keeps the existing behaviour for everybody who has not asked for this.
207
- */
208
- readonly HARNESS_DRIVER: "RETICLE_HARNESS_DRIVER";
209
- /**
210
- * A direct Jev key, for this repo's own benchmarks and for anyone holding a TypeSafe account.
211
- *
212
- * Users are not expected to have one. The ordinary path is the key they already minted on the
213
- * platform (`RETICLE_API_KEY`), which reaches Jev through the proxy at `RETICLE_CLOUD_URL` —
214
- * this variable is the escape hatch that skips it, and it takes precedence when both are set so
215
- * that a developer debugging the upstream is never silently talking to the proxy instead.
216
- */
217
- readonly HARNESS_JEV_KEY: "JEV_API_KEY";
218
- /** Base URL for the Jev API, for a proxy or a gateway. Defaults to TypeSafe's own endpoint. */
219
- readonly HARNESS_JEV_URL: "RETICLE_HARNESS_JEV_URL";
220
- /** A direct OpenAI key. As with Jev, the ordinary path is the platform key and its proxy. */
221
- readonly HARNESS_OPENAI_KEY: "OPENAI_API_KEY";
222
- /** Model the OpenAI driver uses. Defaults to a small one — see `DEFAULT_OPENAI_MODEL`. */
223
- readonly HARNESS_OPENAI_MODEL: "RETICLE_HARNESS_OPENAI_MODEL";
224
- /**
225
- * The API key minted on the platform, and the host it belongs to.
226
- *
227
- * Read through `apiKeyFrom()`, never directly — see the note on that function for why there are
228
- * two names for one key and why neither may be dropped.
229
- */
230
- readonly API_KEY: "RETICLE_API_KEY";
231
- /** The name this key had until 2026-09. Still honoured; see `apiKeyFrom()`. */
232
- readonly CLOUD_KEY: "RETICLE_CLOUD_KEY";
233
- /** The platform host. Read through `cloudUrlFrom()`, which also accepts `URL`. */
234
- readonly CLOUD_URL: "RETICLE_CLOUD_URL";
235
- /** The short name for `CLOUD_URL`, which people type first. `CLOUD_URL` wins when both are set. */
236
- readonly URL: "RETICLE_URL";
237
- };
110
+ export { ReticleEnv } from './reticle-env.js';
238
111
  /**
239
112
  * The platform API key, whichever name it arrives under.
240
113
  *
@@ -337,8 +210,27 @@ export declare const DANGEROUS_ACTION_CONFIRM_ARG = "confirmDangerous";
337
210
  * through the SDK instead.
338
211
  */
339
212
  export declare const NATIVE_INPUT_ARG = "native";
213
+ /**
214
+ * INSPECT argument: scroll an off-viewport element to the center before it is measured. The real-input
215
+ * path sends it, because a real pointer aimed at an off-viewport box lands on nothing (#1711).
216
+ */
217
+ export declare const INSPECT_REVEAL_ARG = "reveal";
218
+ /**
219
+ * INSPECT result field, present only when `INSPECT_REVEAL_ARG` was sent: whether the element's center
220
+ * is inside the viewport, measured after the scroll. An SDK that predates it omits it, and a caller
221
+ * must read that absence as unknown, never as out of view.
222
+ */
223
+ export declare const INSPECT_IN_VIEWPORT_FIELD = "inViewport";
340
224
  /** Schema version stamped onto compiled replay programs. */
341
225
  export declare const REPLAY_PROGRAM_VERSION = 1;
226
+ /**
227
+ * The instruction files `reticle init` writes its Reticle section into, and the line that opens the
228
+ * section. `init` writes it and the server reads it, so both take it from here.
229
+ */
230
+ export declare const AgentRules: {
231
+ readonly FILES: readonly ["CLAUDE.md", "AGENTS.md"];
232
+ readonly BEGIN: "<!-- reticle:begin (managed by `reticle init` — edit outside these markers) -->";
233
+ };
342
234
  /** The git-checked Reticle workspace directory + its layout. No free strings. */
343
235
  export declare const ReticleDir: {
344
236
  readonly ROOT: ".reticle";
@@ -371,6 +263,8 @@ export declare const ReticleDir: {
371
263
  readonly VISUAL_SUBDIR: "visual";
372
264
  /** verification-run artifacts —.reticle/runs/<runId>.json (the OEM/CI-consumable verdict). */
373
265
  readonly RUNS_SUBDIR: "runs";
266
+ /** Dev-server logs, only when the state home cannot be written. Machine-local, like `runs/`. */
267
+ readonly LOGS_SUBDIR: "logs";
374
268
  /** fail-to-pass bug capsules —.reticle/capsules/<id>.json (a minimal failing flow + its evidence). */
375
269
  readonly CAPSULES_SUBDIR: "capsules";
376
270
  /**
@@ -385,6 +279,11 @@ export declare const ReticleDir: {
385
279
  readonly PLANS_SUBDIR: "plans";
386
280
  /** durable causal journal —.reticle/sessions/<id>/{events,actions}.jsonl (the substrate). */
387
281
  readonly SESSIONS_SUBDIR: "sessions";
282
+ /**
283
+ * Every tool call an agent made, in full, with what it did to the page —
284
+ * .reticle/episodes/<connection>.jsonl. Local evidence: never committed, never sent.
285
+ */
286
+ readonly EPISODES_SUBDIR: "episodes";
388
287
  /** append-only event ledger inside a session dir (one ReticleEvent per line). */
389
288
  readonly JOURNAL_EVENTS_FILE: "events.jsonl";
390
289
  /** append-only action ledger inside a session dir (one JournalAction per line). */
@@ -400,7 +299,6 @@ export declare const ReticleDir: {
400
299
  readonly JOURNAL_EVENTS_CLOSED_FILE: "events.closed.json";
401
300
  /** learned expected-envelopes per route, accumulated across runs (the deviation-report baseline). */
402
301
  readonly ENVELOPES_FILE: "envelopes.json";
403
- /** learned ambient (action-less churn) region map — excluded from settle/summaries/envelopes. */
404
302
  readonly AMBIENT_FILE: "ambient.json";
405
303
  /** per-flow flake ledger — replay outcomes that decide intermittent-failure quarantine. */
406
304
  readonly FLAKE_FILE: "flake.json";
@@ -408,11 +306,16 @@ export declare const ReticleDir: {
408
306
  readonly COVERAGE_FILE: "coverage.json";
409
307
  /** Human review marks (HUD notes), pending and resolved — see server portal/session/human. */
410
308
  readonly NOTES_FILE: "notes.json";
411
- /** The user's latest request, as the agent relayed it. Local: it is the user's own words. */
309
+ /** The user's latest request: the newest prompt the hook captured, or the one the agent relayed. Local. */
412
310
  readonly REQUEST_FILE: "request.json";
311
+ /** Every prompt the agent hook captured, one JSON line each, oldest first. `request.json` holds the newest. */
312
+ readonly REQUESTS_LOG_FILE: "requests.jsonl";
313
+ /** The prompt history moved aside when `requests.jsonl` fills. The same words, so the same rule. */
314
+ readonly REQUESTS_LOG_ROTATED_FILE: "requests.1.jsonl";
315
+ readonly APP_NOTES_FILE: "app-notes.json";
413
316
  readonly PLATFORM_MOMENTS_FILE: "platform-moments.json";
414
317
  /**
415
- * the project's cloud binding — .reticle/cloud.json, written by `reticle link`. Git-checked and
318
+ * the project's cloud binding — .reticle/cloud.json, written by `reticle connect`. Git-checked and
416
319
  * non-secret: the project id, the API origin, and where its dashboard lives. The KEY lives in
417
320
  * ~/.reticle/credentials.json instead, because that one must never reach a repository.
418
321
  */
@@ -470,6 +373,7 @@ export declare const VisualReason: {
470
373
  readonly BASELINE_MISSING: "baseline-missing";
471
374
  readonly DIMENSION_MISMATCH: "dimension-mismatch";
472
375
  readonly FULL_PAGE_UNSUPPORTED: "full-page-unsupported";
376
+ readonly CROP_UNSUPPORTED: "crop-unsupported";
473
377
  readonly NOT_COMPOSITED: "window-not-composited";
474
378
  };
475
379
  export type VisualReason = (typeof VisualReason)[keyof typeof VisualReason];
@@ -514,8 +418,8 @@ export declare const ContractReadError: {
514
418
  readonly MALFORMED: "contract-malformed";
515
419
  };
516
420
  export type ContractReadError = (typeof ContractReadError)[keyof typeof ContractReadError];
517
- import { EventType } from './event-types.js';
518
- export { EventType };
421
+ import { CanvasTrigger, EventType, MediaEvent } from './event-types.js';
422
+ export { CanvasTrigger, EventType, MediaEvent };
519
423
  /** Bounds for the per-session ring buffer. */
520
424
  export declare const RING_BUFFER_DEFAULTS: {
521
425
  readonly MAX_EVENTS: 2000;
@@ -542,6 +446,11 @@ export declare const PhenomenonType: {
542
446
  export type PhenomenonType = (typeof PhenomenonType)[keyof typeof PhenomenonType];
543
447
  /** Signal the React adapter fires once hydration commits (handlers attached). Shared browser↔server. */
544
448
  export declare const RETICLE_HYDRATION_SIGNAL = "reticle:hydration-complete";
449
+ /**
450
+ * Work the app declared it is doing (`reticle.busy(work)`): `{ delta: 1 }` when it starts and
451
+ * `{ delta: -1 }` when it ends. `settled` counts it as in flight, like a request. Shared browser↔server.
452
+ */
453
+ export declare const RETICLE_BUSY_SIGNAL = "reticle:busy";
545
454
  /**
546
455
  * The registered-store name the React adapter uses for render stats, read via reticle_state. It crosses
547
456
  * the wire as a store id AND the browser SDK special-cases it as reticle-owned (so it isn't flagged as
@@ -637,6 +546,10 @@ export declare const InputModeReason: {
637
546
  * permanent for the session, not a transient downgrade, so it should stop asking.
638
547
  */
639
548
  readonly NOT_CONFIGURED: "real-input-not-configured-for-this-session";
549
+ readonly TARGET_NOT_FOCUSABLE: "target-cannot-hold-focus";
550
+ /** A production drive presses only in the page. A native key goes to whatever holds focus, so
551
+ * the production policy could not judge the control it pressed. */
552
+ readonly PRODUCTION_PRESS_IN_PAGE: "production-drive-presses-in-page";
640
553
  };
641
554
  export type InputModeReason = (typeof InputModeReason)[keyof typeof InputModeReason];
642
555
  /** Best-effort caveats attached to action results so the agent can interpret a no-op. */
@@ -650,11 +563,9 @@ export declare const ActionWarning: {
650
563
  * actionable. Scroll it into a clear area or dismiss the overlay on top.
651
564
  */
652
565
  readonly CLICK_OCCLUDED: "target is visually occluded by another element; a real user could not click it (synthetic dispatch still delivered the event) — dismiss the overlay or scroll the target clear";
653
- /**
654
- * A document-key press (Escape, Tab, a modifier shortcut) was dispatched at the focused
655
- * element or the document. No named target was given, so the effect must not claim one.
656
- */
566
+ /** A document-key press (Escape, Tab, a shortcut) went to the focused element or document. */
657
567
  readonly GLOBAL_PRESS: "press landed on the focused element or document — no named target was given, so this effect does not claim one";
568
+ readonly CLICK_NOT_A_CONTROL: "target is not a control and sits inside none (no button/link/input role, onclick, tabindex or pointer cursor), so a click on it may do nothing — if nothing happened, target the control inside it by role";
658
569
  };
659
570
  export type ActionWarning = (typeof ActionWarning)[keyof typeof ActionWarning];
660
571
  /** Failure modes when Reticle launches/drives its own browser (`reticle drive`). */
@@ -814,10 +725,7 @@ export declare const ReticleCommand: {
814
725
  readonly SCROLL: "scroll";
815
726
  /** Session lifecycle: agent tunes the presenter session (e.g. idle-end timeout) for the app's needs. */
816
727
  readonly SESSION_CONFIG: "session_config";
817
- /**
818
- * Live-control: bridge → browser. Pushes the current session state to the panel so an
819
- * AGENT-driven pause/end keeps the presenter in sync. `args: { state, text? }`.
820
- */
728
+ /** Bridge → browser: the session state, so an agent's pause/end syncs the panel. `{ state, text? }`. */
821
729
  readonly PRESENTER: "presenter";
822
730
  /**
823
731
  * Bridge -> browser: the user's own impact record, so the HUD can show what Reticle has done for
@@ -834,6 +742,8 @@ export declare const ReticleCommand: {
834
742
  * screen-recording permission. Answered only when the app installed the capture helper.
835
743
  */
836
744
  readonly CAPTURE: "capture";
745
+ /** The page drawn in-page to a JPEG, `{ ok, width, height, chunks }` (base64 under the string cap). */
746
+ readonly RENDER: "render";
837
747
  /** Navigate the page to a new URL. `args: { url: string }`. */
838
748
  readonly NAVIGATE: "navigate";
839
749
  /** Reload the page. `args: { hard?: boolean }` — hard clears the cache via location replace trick. */
@@ -844,6 +754,8 @@ export declare const ReticleCommand: {
844
754
  readonly FLOW_PROGRESS: "flow.progress";
845
755
  /** Bridge → browser: the Harness's drive plan and each part's status, a `PlanView`. */
846
756
  readonly PLAN: "plan";
757
+ /** The coverage markers (`CoverageMarker`) the app's own page carries; silent, no HUD paint. */
758
+ readonly MARKERS: "markers";
847
759
  };
848
760
  export type ReticleCommand = (typeof ReticleCommand)[keyof typeof ReticleCommand];
849
761
  /** Presenter intent shown to the human watcher: is the agent reading or acting? */
@@ -869,18 +781,20 @@ export declare const MessageKind: {
869
781
  };
870
782
  export type MessageKind = (typeof MessageKind)[keyof typeof MessageKind];
871
783
  /**
872
- * WHY a lease came back `ready: false` — the two situations that were one word.
873
- *
874
- * `ready: false` meant exactly one thing on the mint path: the SDK never dialled in, so the app
875
- * probably does not embed `@reticlehq/core`. A REUSED lease can fail readiness a second way, and it
876
- * is the opposite problem: an SDK did dial in, and has since stopped answering. The next action
877
- * differs — check the install versus recover the tab — so the two get names rather than sharing a
878
- * bare `false`.
784
+ * WHY a lease came back `ready: false`. Each reason wants a different next action — check the
785
+ * install, recover a wedged tab, or bring a hidden one to the front — so they get names rather
786
+ * than sharing a bare `false`.
879
787
  */
880
788
  export declare const LeaseNotReadyReason: {
881
789
  /** No SDK dialled in within the wait. The install is the thing to look at. */
882
790
  readonly SDK_NEVER_DIALLED: "sdk_never_dialled";
883
791
  /** One dialled in and stopped answering: the tab is attached but wedged. */
884
792
  readonly SDK_STOPPED_ANSWERING: "sdk_stopped_answering";
793
+ /** The SDK answers, but its tab is hidden: timers and rAF are throttled, so nothing on it verifies. */
794
+ readonly TAB_HIDDEN: "tab_hidden";
795
+ /** The page is not an HTML document (an `.svg`, for example), so the zero-install reader did not run. */
796
+ readonly NOT_HTML_DOCUMENT: "not_html_document";
797
+ /** The zero-install reader failed, for example because the tab closed during setup. */
798
+ readonly READER_FAILED: "reader_failed";
885
799
  };
886
800
  export type LeaseNotReadyReason = (typeof LeaseNotReadyReason)[keyof typeof LeaseNotReadyReason];