@reticlehq/core 2.14.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.
Files changed (148) hide show
  1. package/dist/{artifacts-entry.d.ts → artifacts/artifacts-entry.d.ts} +7 -7
  2. package/dist/{artifacts-entry.js → artifacts/artifacts-entry.js} +7 -7
  3. package/dist/artifacts/flow-composition.d.ts +30 -0
  4. package/dist/artifacts/flow-composition.js +19 -0
  5. package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +99 -3
  6. package/dist/{flow-constants.js → artifacts/flow-constants.js} +108 -4
  7. package/dist/artifacts/flow-mutation-target.d.ts +39 -0
  8. package/dist/artifacts/flow-mutation-target.js +89 -0
  9. package/dist/artifacts/flow-order.d.ts +30 -0
  10. package/dist/artifacts/flow-order.js +49 -0
  11. package/dist/artifacts/flow-select.d.ts +56 -0
  12. package/dist/artifacts/flow-select.js +56 -0
  13. package/dist/artifacts/flow-step-tool.d.ts +31 -0
  14. package/dist/artifacts/flow-step-tool.js +31 -0
  15. package/dist/artifacts/flow-types.d.ts +3736 -0
  16. package/dist/artifacts/flow-types.js +463 -0
  17. package/dist/artifacts/flow-unreached.d.ts +12 -0
  18. package/dist/artifacts/flow-unreached.js +24 -0
  19. package/dist/{impact.d.ts → artifacts/impact.d.ts} +271 -103
  20. package/dist/{impact.js → artifacts/impact.js} +75 -5
  21. package/dist/artifacts/journal.d.ts +218 -0
  22. package/dist/artifacts/journal.js +130 -0
  23. package/dist/artifacts/step-effect.d.ts +29 -0
  24. package/dist/artifacts/step-effect.js +28 -0
  25. package/dist/hooks/hook-events.d.ts +311 -0
  26. package/dist/hooks/hook-events.js +127 -0
  27. package/dist/hooks/hooks-entry.d.ts +9 -0
  28. package/dist/hooks/hooks-entry.js +9 -0
  29. package/dist/identity/brand.d.ts +102 -0
  30. package/dist/{brand.js → identity/brand.js} +7 -0
  31. package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
  32. package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
  33. package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
  34. package/dist/{document-identity.js → identity/document-identity.js} +4 -5
  35. package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
  36. package/dist/{source-constants.js → identity/source-constants.js} +4 -4
  37. package/dist/index.d.ts +57 -43
  38. package/dist/index.js +66 -45
  39. package/dist/onboarding.d.ts +114 -0
  40. package/dist/onboarding.js +141 -0
  41. package/dist/realm/registry.d.ts +212 -0
  42. package/dist/realm/registry.js +302 -0
  43. package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +6 -7
  44. package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
  45. package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
  46. package/dist/{project-registry.js → registry/project-registry.js} +5 -5
  47. package/dist/schema/command-name.json +31 -0
  48. package/dist/schema/event-payloads.json +795 -0
  49. package/dist/schema/hello-message.json +70 -2
  50. package/dist/schema/reticle-message.json +70 -2
  51. package/dist/telemetry-entry.d.ts +1 -1
  52. package/dist/telemetry-entry.js +1 -1
  53. package/dist/telemetry-feedback.d.ts +15 -16
  54. package/dist/telemetry-feedback.js +11 -12
  55. package/dist/telemetry-license.d.ts +1 -1
  56. package/dist/telemetry-license.js +1 -1
  57. package/dist/telemetry-refusal.d.ts +11 -11
  58. package/dist/telemetry-refusal.js +7 -8
  59. package/dist/telemetry-session.d.ts +51 -59
  60. package/dist/telemetry-session.js +47 -55
  61. package/dist/telemetry.d.ts +306 -222
  62. package/dist/telemetry.js +112 -99
  63. package/dist/tour-entry.d.ts +10 -0
  64. package/dist/tour-entry.js +10 -0
  65. package/dist/tour.d.ts +125 -0
  66. package/dist/tour.js +165 -0
  67. package/dist/{consequence.d.ts → verdict/consequence.d.ts} +32 -15
  68. package/dist/{consequence.js → verdict/consequence.js} +9 -31
  69. package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
  70. package/dist/{findings.d.ts → verdict/findings.d.ts} +86 -39
  71. package/dist/{findings.js → verdict/findings.js} +103 -49
  72. package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +7 -14
  73. package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +7 -15
  74. package/dist/{intent.d.ts → verdict/intent.d.ts} +35 -46
  75. package/dist/{intent.js → verdict/intent.js} +11 -22
  76. package/dist/verdict/revision.d.ts +44 -0
  77. package/dist/verdict/revision.js +53 -0
  78. package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
  79. package/dist/{run-context.js → verdict/run-context.js} +15 -36
  80. package/dist/{security.js → verdict/security.js} +12 -21
  81. package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +381 -105
  82. package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
  83. package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +34 -13
  84. package/dist/{verified-constants.js → verdict/verified-constants.js} +34 -13
  85. package/dist/{verify-progress.d.ts → verdict/verify-progress.d.ts} +18 -22
  86. package/dist/{verify-progress.js → verdict/verify-progress.js} +6 -10
  87. package/dist/wire/channel.d.ts +46 -0
  88. package/dist/wire/channel.js +95 -0
  89. package/dist/{constants.d.ts → wire/constants/constants.d.ts} +179 -28
  90. package/dist/{constants.js → wire/constants/constants.js} +199 -28
  91. package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +23 -2
  92. package/dist/{session-constants.js → wire/constants/session-constants.js} +23 -2
  93. package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
  94. package/dist/{event-classification.js → wire/event-classification.js} +1 -1
  95. package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +72 -13
  96. package/dist/{event-payloads.js → wire/event-payloads.js} +23 -3
  97. package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
  98. package/dist/{event-priority.js → wire/event-priority.js} +2 -5
  99. package/dist/{global-press.js → wire/global-press.js} +1 -1
  100. package/dist/{messages.d.ts → wire/messages.d.ts} +240 -48
  101. package/dist/{messages.js → wire/messages.js} +68 -5
  102. package/dist/wire/narrow.d.ts +39 -0
  103. package/dist/wire/narrow.js +45 -0
  104. package/dist/{net.d.ts → wire/net.d.ts} +36 -13
  105. package/dist/{net.js → wire/net.js} +36 -13
  106. package/dist/wire/platform.d.ts +37 -0
  107. package/dist/wire/platform.js +36 -0
  108. package/dist/{redaction.js → wire/redaction.js} +12 -12
  109. package/dist/wire/snapshot-tree.d.ts +33 -0
  110. package/dist/wire/snapshot-tree.js +43 -0
  111. package/dist/wire/tool-names.d.ts +133 -0
  112. package/dist/wire/tool-names.js +142 -0
  113. package/dist/{toon.js → wire/toon.js} +1 -1
  114. package/dist/{types.d.ts → wire/types.d.ts} +77 -76
  115. package/dist/{types.js → wire/types.js} +4 -3
  116. package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
  117. package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
  118. package/dist/{notices.d.ts → words/notices.d.ts} +8 -12
  119. package/dist/{notices.js → words/notices.js} +8 -12
  120. package/package.json +16 -7
  121. package/dist/brand.d.ts +0 -49
  122. package/dist/flow-types.d.ts +0 -1711
  123. package/dist/flow-types.js +0 -247
  124. package/dist/journal.d.ts +0 -122
  125. package/dist/journal.js +0 -57
  126. package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +0 -0
  127. package/dist/{impact-savings.js → artifacts/impact-savings.js} +0 -0
  128. package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
  129. package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
  130. package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
  131. package/dist/{project-id.js → identity/project-id.js} +0 -0
  132. package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
  133. package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
  134. package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
  135. package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
  136. package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
  137. package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
  138. package/dist/{global-press.d.ts → wire/global-press.d.ts} +0 -0
  139. package/dist/{redaction.d.ts → wire/redaction.d.ts} +0 -0
  140. package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
  141. package/dist/{state-select.js → wire/state-select.js} +0 -0
  142. package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
  143. package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
  144. package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
  145. package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
  146. package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
  147. package/dist/{upgrade.d.ts → words/upgrade.d.ts} +2 -2
  148. /package/dist/{upgrade.js → words/upgrade.js} +0 -0
@@ -37,6 +37,17 @@ export const STATUS_PATH = '/status';
37
37
  */
38
38
  export const DRIVE_PATH = '/drive';
39
39
  export const RETICLE_PROTOCOL_VERSION = 1;
40
+ /**
41
+ * The oldest protocol version this build still talks to.
42
+ *
43
+ * A range rather than a single number. An exact door refuses a peer one version out, which is
44
+ * correct when both sides ship together and wrong the moment anything else implements this -- an
45
+ * SDK a user has not upgraded yet is not an incompatible SDK.
46
+ *
47
+ * Equal to the current version today, so nothing changes yet. It exists so that raising the current
48
+ * version is a decision about what to keep supporting, rather than an automatic break.
49
+ */
50
+ export const RETICLE_MIN_PROTOCOL_VERSION = 1;
40
51
  /**
41
52
  * The host a CLIENT names when it dials the bridge, as opposed to the address the bridge BINDS.
42
53
  *
@@ -69,6 +80,15 @@ export function bridgeWsUrl(port = RETICLE_DEFAULT_PORT, host = RETICLE_CLIENT_H
69
80
  export const RETICLE_URL_PARAM = {
70
81
  SESSION: '__reticle_session',
71
82
  PROJECT: '__reticle_project',
83
+ /**
84
+ * "Reticle opened this page for itself" — and nothing more.
85
+ *
86
+ * Deliberately NOT the session stamp. `resolveConnectIdentity` reads SESSION as the session id
87
+ * when the app names none, so marking a drive with it would rename every driven session to one
88
+ * shared constant and make two concurrent drives collide. This carries the one fact the page
89
+ * needs (nobody is sitting in front of it) without touching identity.
90
+ */
91
+ OPENED: '__reticle_opened',
72
92
  };
73
93
  /** The loopback bind address. The daemon/bridge bind here by default — never expose Reticle off-host. */
74
94
  export const LOOPBACK_HOST = '127.0.0.1';
@@ -146,32 +166,96 @@ export const ReticleEnv = {
146
166
  RECONNECT_ATTEMPTS: 'RETICLE_RECONNECT_ATTEMPTS',
147
167
  /** Quiet window before an abandoned MCP stdio proxy exits; `0` disables the watcher. */
148
168
  MCP_PROXY_IDLE: 'RETICLE_MCP_PROXY_IDLE_MS',
169
+ /**
170
+ * API key for the harness — the model that drives the app when no coding agent is in the loop.
171
+ *
172
+ * The standard Anthropic name, on purpose: a machine that can already run a coding agent can
173
+ * already run the harness, with nothing to configure. Absent ⇒ the harness is simply unavailable
174
+ * and every other part of Reticle is unaffected.
175
+ */
176
+ HARNESS_KEY: 'ANTHROPIC_API_KEY',
177
+ /** Model the harness drives with. Defaults to a small one — see `DEFAULT_HARNESS_MODEL`. */
178
+ HARNESS_MODEL: 'RETICLE_HARNESS_MODEL',
179
+ /** Base URL for the harness's model API, for a proxy or a gateway. */
180
+ HARNESS_BASE_URL: 'RETICLE_HARNESS_BASE_URL',
181
+ /** Hard ceiling on harness model turns in one drive. Bounds cost, not value. */
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',
149
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
+ }
150
242
  /** Hard transport bounds shared by the browser and bridge. */
151
243
  export const TRANSPORT_LIMITS = {
152
244
  MAX_MESSAGE_BYTES: 1024 * 1024,
153
245
  /**
154
246
  * Inbound events per second before the bridge SAMPLES rather than records everything.
155
247
  *
156
- * This was 1000, and an ordinary React app with an active query cache blew through it: the
157
- * reporter's FIRST `act_and_wait` of the session came back `unknown` with `unclean_capture` and a
158
- * four-figure drop count, and setting the env override to twenty times the default fixed it (#316).
159
- * Reticle was right to refuse the verdict — a sampled window cannot support one, and the guard that
160
- * catches false greens is blindest exactly there — but landing that on the first drive after an
161
- * install, recoverable only by knowing an environment variable exists and inventing a number for
162
- * it, is the worst possible place to spend the honesty.
163
- *
164
- * 20000 is the value that was measured to work on the page that reported it. The cap exists to stop
165
- * a PATHOLOGICAL page (an animation loop firing DOM mutations every frame), not to throttle a busy
166
- * one, and the ceiling it has to defend is cheap: the daemon is on the same machine and a typical
167
- * event is a few hundred bytes, so this is single-digit MB/s over loopback.
248
+ * The cap exists to stop a PATHOLOGICAL page (an animation loop firing DOM mutations every frame),
249
+ * not to throttle a busy one: an ordinary React app with an active query cache passes 1000/s, and a
250
+ * sampled window cannot support a verdict, so too low a cap answers `unknown` with
251
+ * `unclean_capture` on the first `act_and_wait` after an install (#316).
168
252
  *
169
- * Raising it does not raise what a runaway page can make the bridge HOLD, and that separation is
170
- * what makes the change safe. Memory is bounded independently by the ring buffer, which evicts on
171
- * `RING_BUFFER_DEFAULTS.MAX_BYTES` (this same constant, reached through that alias) as well as on
172
- * a count and an age. Grep for `MAX_BUFFER_BYTES` alone and it looks like a constant nobody reads,
173
- * which is exactly the wrong conclusion to draw before touching this number: the rate cap defends
174
- * parse cost, the ring buffer defends memory, and they are not substitutes.
253
+ * The ceiling it defends is cheap — the daemon is on the same machine and a typical event is a few
254
+ * hundred bytes, so 20000/s is single-digit MB/s over loopback. Raising it does not raise what a
255
+ * runaway page can make the bridge HOLD: memory is bounded independently by the ring buffer, which
256
+ * evicts on `RING_BUFFER_DEFAULTS.MAX_BYTES` (this same constant through that alias) as well as on
257
+ * a count and an age. The rate cap defends parse cost, the ring buffer defends memory, and they are
258
+ * not substitutes.
175
259
  */
176
260
  MAX_MESSAGES_PER_SECOND: 20000,
177
261
  MAX_SESSIONS: 32,
@@ -182,6 +266,21 @@ export const TRANSPORT_LIMITS = {
182
266
  MAX_URL_LENGTH: 4096,
183
267
  MAX_TITLE_LENGTH: 512,
184
268
  MAX_ADAPTERS: 32,
269
+ /*
270
+ * The cap on ONE vocabulary in `contractParts` — the commands, events or actions a peer says it
271
+ * speaks.
272
+ *
273
+ * Its own number, and the reason is an outage this nearly shipped. `contractParts` reused
274
+ * `MAX_ADAPTERS` (32), and this implementation's own event vocabulary is larger than that. The
275
+ * field had never had a producer, so nothing had ever tried: the first build to actually send it
276
+ * had every HELLO rejected by the schema and NO SESSION COULD CONNECT AT ALL. The unit gate is
277
+ * blind to it — the schema accepts the shape in isolation, and only a real page talking to a real
278
+ * daemon fails — so the e2e battery is what caught it.
279
+ *
280
+ * 128 leaves the vocabularies room to roughly triple. A cap here is still worth having: this
281
+ * arrives on an unauthenticated HELLO, so it is an untrusted list and the bound is chosen here.
282
+ */
283
+ MAX_CONTRACT_NAMES: 128,
185
284
  MAX_ADAPTER_NAME_LENGTH: 128,
186
285
  MAX_TOKEN_LENGTH: 512,
187
286
  MAX_COMMAND_ID_LENGTH: 128,
@@ -224,12 +323,30 @@ export const ReticleDir = {
224
323
  /**
225
324
  * the user's own record of what Reticle has done for them — .reticle/impact.json.
226
325
  *
227
- * Local only, never uploaded, and deliberately NOT part of telemetry: telemetry answers our
228
- * questions about the product; this answers the user's question about their own work.
326
+ * Local only, never uploaded, and deliberately NOT part of telemetry: telemetry answers questions
327
+ * about the product; this answers the user's question about their own work.
229
328
  */
230
329
  IMPACT_FILE: 'impact.json',
231
330
  /** what changes were SUPPOSED to make true —.reticle/intent.json (git-checked, reviewed) */
232
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',
233
350
  /** opt-in pixel baselines —.reticle/visual/<name>.png + <name>.diff.png. */
234
351
  VISUAL_SUBDIR: 'visual',
235
352
  /** verification-run artifacts —.reticle/runs/<runId>.json (the OEM/CI-consumable verdict). */
@@ -242,6 +359,15 @@ export const ReticleDir = {
242
359
  JOURNAL_EVENTS_FILE: 'events.jsonl',
243
360
  /** append-only action ledger inside a session dir (one JournalAction per line). */
244
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',
245
371
  /** learned expected-envelopes per route, accumulated across runs (the deviation-report baseline). */
246
372
  ENVELOPES_FILE: 'envelopes.json',
247
373
  /** learned ambient (action-less churn) region map — excluded from settle/summaries/envelopes. */
@@ -268,6 +394,17 @@ export const ReticleDir = {
268
394
  ISSUES_FILE: 'issues.json',
269
395
  /** Per-flow assertion tiers recorded on each PASSING replay — the gate's anti-downgrade baseline. */
270
396
  TIERS_FILE: 'assertion-tiers.json',
397
+ /**
398
+ * what to run when something happens — .reticle/hooks.json. Git-checked on purpose: a hook is a
399
+ * decision the whole team shares, the same way a git hook or a package script is, and one that
400
+ * only exists on the machine that wrote it is a rule nobody else is following.
401
+ *
402
+ * It names COMMANDS, so it is exactly as trusted as `package.json` scripts in the same repository
403
+ * and no more: opening a repo does not run them, and Reticle runs one only when the event it is
404
+ * attached to actually happens. The event payload is handed over on stdin, never interpolated into
405
+ * the command line, so a defect's own text can never become part of a command.
406
+ */
407
+ HOOKS_FILE: 'hooks.json',
271
408
  /**
272
409
  * Auto-provisioned bridge pairing token, stored at ~/.reticle/pairing-token (mode 0600). Written by
273
410
  * the daemon, read Node-side by the build plugins to inject into connect. A browser sandbox cannot
@@ -336,9 +473,7 @@ export const ContractReadError = {
336
473
  MISSING: 'contract-missing', // no .reticle/contract.json on disk
337
474
  MALFORMED: 'contract-malformed', // present but not valid JSON / fails schema
338
475
  };
339
- /** On-disk artifact constants (project/flow/replay/recorder/heal/annotation) live here. */
340
- export * from './flow-constants.js';
341
- /** Bounds for the per-session ring buffer (see plan/02-architecture.md). */
476
+ /** Bounds for the per-session ring buffer. */
342
477
  export const RING_BUFFER_DEFAULTS = {
343
478
  MAX_EVENTS: 2000,
344
479
  MAX_AGE_MS: 60_000,
@@ -486,6 +621,15 @@ export const RETICLE_HYDRATION_ERROR_SIGNAL = 'reticle:hydration-error';
486
621
  /** The observation channel a TRUNCATED event names, so downstream knows WHICH data is incomplete. */
487
622
  export const TruncationChannel = {
488
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',
489
633
  };
490
634
  /**
491
635
  * How an event was linked to the action it is attributed to. `window` means the SDK stamped the
@@ -560,7 +704,7 @@ export const DriveErrorCode = {
560
704
  };
561
705
  /** Human-facing message when the optional playwright dep is absent. */
562
706
  export const DRIVE_PLAYWRIGHT_MISSING_MSG = "reticle drive needs the optional 'playwright' package — install it: pnpm add -D playwright && npx playwright install chromium";
563
- /** Actions the executor can perform against a ref (plan/03 + plan/05). */
707
+ /** Actions the executor can perform against a ref. */
564
708
  /**
565
709
  * The console levels an agent can filter by, DERIVED from the console EventTypes rather than
566
710
  * retyped. `reticle_console { level }` matches by building `console.${level}`, so any list written
@@ -590,7 +734,34 @@ export const ActionType = {
590
734
  PRESS: 'press',
591
735
  UPLOAD: 'upload',
592
736
  SCROLL_INTO_VIEW: 'scrollIntoView',
737
+ /**
738
+ * Scroll a container (or the document) by a delta, in either axis and EITHER DIRECTION.
739
+ *
740
+ * `scrollIntoView` puts a known element on screen; this is the gesture for looking around when you
741
+ * do not know what you are looking for yet — back up to what scrolled past, or move sideways on a
742
+ * wide table. Until now the only scroll available stepped DOWN, so a page could be walked in one
743
+ * direction and never back, and `inspect` reported `scrollLeft`/`scrollWidth` that nothing could act on.
744
+ */
745
+ SCROLL: 'scroll',
593
746
  DRAG: 'drag',
747
+ /**
748
+ * A TOUCH tap: pointerdown(touch) → touchstart → touchend → pointerup → click.
749
+ *
750
+ * Not a click with another name. A handler bound to `touchstart`, or one that branches on
751
+ * `event.pointerType`, never runs for a mouse click — so mobile-web behaviour, swipe/press
752
+ * affordances and touch-only controls were undriveable. `args.holdMs` makes it a LONG PRESS, the
753
+ * gesture behind context menus and reorder handles on touch.
754
+ */
755
+ TAP: 'tap',
756
+ /**
757
+ * Page zoom, as a fraction (1 = 100%).
758
+ *
759
+ * Real browser zoom is not scriptable from inside the page, so this needs a driven browser and
760
+ * REFUSES without one rather than faking it with CSS — see the note on `hover`, which refuses for
761
+ * the same reason. A layout that breaks at 200% is a real and common defect; a CSS transform that
762
+ * merely looks like zoom would report it caught while the layout viewport never changed.
763
+ */
764
+ ZOOM: 'zoom',
594
765
  WEBMCP: 'webmcp',
595
766
  };
596
767
  /** Why an action's settle wait ended without a real animation frame. */
@@ -602,7 +773,7 @@ export const SettleReason = {
602
773
  export const ComponentStateReason = {
603
774
  UNAVAILABLE: 'component-state-unavailable',
604
775
  };
605
- /** Element states the assertion engine can check (plan/06). */
776
+ /** Element states the assertion engine can check. */
606
777
  export const ElementState = {
607
778
  VISIBLE: 'visible',
608
779
  HIDDEN: 'hidden',
@@ -621,7 +792,7 @@ export const ElementState = {
621
792
  */
622
793
  IN_VIEWPORT: 'inViewport',
623
794
  };
624
- /** Query strategies, aligned with Testing Library semantics (plan/04). */
795
+ /** Query strategies, aligned with Testing Library semantics. */
625
796
  export const QueryBy = {
626
797
  ROLE: 'role',
627
798
  TEXT: 'text',
@@ -660,7 +831,7 @@ export const ReticleCommand = {
660
831
  /**
661
832
  * Bridge -> browser: the user's own impact record, so the HUD can show what Reticle has done for
662
833
  * them without the page asking for it. `args: { snapshot: ImpactSnapshot }`. Local data on a
663
- * local socket - it is the same file the report is stored in, not a fetch to us.
834
+ * local socket - it is the same file the report is stored in, not a network fetch.
664
835
  */
665
836
  IMPACT: 'impact',
666
837
  /**
@@ -689,7 +860,7 @@ export const PresenterMode = {
689
860
  READING: 'reading',
690
861
  ACTING: 'acting',
691
862
  };
692
- /** Snapshot rendering modes (plan/04). */
863
+ /** Snapshot rendering modes. */
693
864
  export const SnapshotMode = {
694
865
  FULL: 'full',
695
866
  INTERACTIVE: 'interactive',
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Session lifecycle, health, control, and lease constants. Split out of constants.ts to keep each
3
- * file under the cohesion cap; re-exported from the package index, so importers are unaffected.
2
+ * Session lifecycle, health, control, and lease constants. Re-exported from the package index.
4
3
  */
5
4
  /**
6
5
  * Live-control: per-session lifecycle state (server-owned). The presenter panel mirrors it.
@@ -28,6 +27,28 @@ export declare const HumanControlKind: {
28
27
  readonly MESSAGE: "message";
29
28
  /** Human clicked ▶ on a saved flow in the panel — replay it (no agent). `text` carries the name. */
30
29
  readonly REPLAY: "replay";
30
+ /**
31
+ * Human asked the panel to push to the dashboard NOW, rather than waiting for the sync timer.
32
+ *
33
+ * The timer already keeps the dashboard current on its own, so this is not how sync happens — it
34
+ * is how somebody watching the panel stops wondering whether it is happening. Carries nothing:
35
+ * what to send is the daemon's question, and a panel that named artifacts could disagree with it.
36
+ */
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";
31
52
  };
32
53
  export type HumanControlKind = (typeof HumanControlKind)[keyof typeof HumanControlKind];
33
54
  /**
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Session lifecycle, health, control, and lease constants. Split out of constants.ts to keep each
3
- * file under the cohesion cap; re-exported from the package index, so importers are unaffected.
2
+ * Session lifecycle, health, control, and lease constants. Re-exported from the package index.
4
3
  */
5
4
  /**
6
5
  * Live-control: per-session lifecycle state (server-owned). The presenter panel mirrors it.
@@ -29,6 +28,28 @@ export const HumanControlKind = {
29
28
  MESSAGE: 'message',
30
29
  /** Human clicked ▶ on a saved flow in the panel — replay it (no agent). `text` carries the name. */
31
30
  REPLAY: 'replay',
31
+ /**
32
+ * Human asked the panel to push to the dashboard NOW, rather than waiting for the sync timer.
33
+ *
34
+ * The timer already keeps the dashboard current on its own, so this is not how sync happens — it
35
+ * is how somebody watching the panel stops wondering whether it is happening. Carries nothing:
36
+ * what to send is the daemon's question, and a panel that named artifacts could disagree with it.
37
+ */
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',
32
53
  };
33
54
  /**
34
55
  * Human review marks: the durability tier of the anchor that pins a mark to an element. Mirrors the
@@ -1,4 +1,4 @@
1
- import { VisualReason } from './constants.js';
1
+ import { VisualReason } from './constants/constants.js';
2
2
  /**
3
3
  * The desktop wiring contract — the single source of truth for the strings that let an Electron
4
4
  * app's three worlds recognise each other.
@@ -1,4 +1,4 @@
1
- import { EventType } from './constants.js';
1
+ import { EventType } from './constants/constants.js';
2
2
  /**
3
3
  * The high-volume, low-signal floor. These fire continuously on any live page and are the ONLY
4
4
  * thing that should be sacrificed when a buffer is full. Everything else is scarce evidence a
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { EventType } from './constants.js';
2
+ import { EventType } from './constants/constants.js';
3
3
  /**
4
4
  * Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
5
5
  * The envelope (`ReticleEventSchema.data`) stays open on the wire so a richer SDK is never rejected
@@ -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;
@@ -277,15 +280,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
277
280
  initiator: z.ZodString;
278
281
  urlRaw: z.ZodOptional<z.ZodString>;
279
282
  }, "strip", z.ZodTypeAny, {
280
- url: string;
281
283
  id: string;
282
284
  method: string;
285
+ url: string;
283
286
  initiator: string;
284
287
  urlRaw?: string | undefined;
285
288
  }, {
286
- url: string;
287
289
  id: string;
288
290
  method: string;
291
+ url: string;
289
292
  initiator: string;
290
293
  urlRaw?: string | undefined;
291
294
  }>;
@@ -375,15 +378,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
375
378
  search: z.ZodString;
376
379
  hash: z.ZodString;
377
380
  }, "strip", z.ZodTypeAny, {
381
+ pathname: string;
378
382
  from: string;
379
383
  to: string;
380
- pathname: string;
381
384
  search: string;
382
385
  hash: string;
383
386
  }, {
387
+ pathname: string;
384
388
  from: string;
385
389
  to: string;
386
- pathname: string;
387
390
  search: string;
388
391
  hash: string;
389
392
  }>;
@@ -551,6 +554,24 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
551
554
  readonly SAFARI: "safari";
552
555
  readonly OTHER: "other";
553
556
  }>>;
557
+ /**
558
+ * Which shell the page is running in: `web`, `electron`, `tauri`, or something newer.
559
+ *
560
+ * The SDK has always sent this and the server has always read it, but until now the field was
561
+ * not declared here, so it travelled through `.passthrough()` and appeared in NONE of the
562
+ * generated `dist/schema/*.json` files. Anyone implementing this contract from the published
563
+ * schemas -- which is what a third-party realm does -- could not see that the field exists, let
564
+ * alone that the server depends on it.
565
+ *
566
+ * A plain string on purpose, NOT a closed list of the three shells that ship today. A realm
567
+ * that does not exist yet has to be able to name itself, and an enum here would mean one
568
+ * unknown value fails the whole health report, taking visibility, focus and the heartbeat down
569
+ * with it. The wire says the field exists and is a string; which values mean something stays
570
+ * with the reader, where it already is.
571
+ */
572
+ runtime: z.ZodOptional<z.ZodString>;
573
+ /** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
574
+ engine: z.ZodOptional<z.ZodString>;
554
575
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
555
576
  hidden: z.ZodBoolean;
556
577
  focused: z.ZodBoolean;
@@ -571,6 +592,24 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
571
592
  readonly SAFARI: "safari";
572
593
  readonly OTHER: "other";
573
594
  }>>;
595
+ /**
596
+ * Which shell the page is running in: `web`, `electron`, `tauri`, or something newer.
597
+ *
598
+ * The SDK has always sent this and the server has always read it, but until now the field was
599
+ * not declared here, so it travelled through `.passthrough()` and appeared in NONE of the
600
+ * generated `dist/schema/*.json` files. Anyone implementing this contract from the published
601
+ * schemas -- which is what a third-party realm does -- could not see that the field exists, let
602
+ * alone that the server depends on it.
603
+ *
604
+ * A plain string on purpose, NOT a closed list of the three shells that ship today. A realm
605
+ * that does not exist yet has to be able to name itself, and an enum here would mean one
606
+ * unknown value fails the whole health report, taking visibility, focus and the heartbeat down
607
+ * with it. The wire says the field exists and is a string; which values mean something stays
608
+ * with the reader, where it already is.
609
+ */
610
+ runtime: z.ZodOptional<z.ZodString>;
611
+ /** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
612
+ engine: z.ZodOptional<z.ZodString>;
574
613
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
575
614
  hidden: z.ZodBoolean;
576
615
  focused: z.ZodBoolean;
@@ -591,6 +630,24 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
591
630
  readonly SAFARI: "safari";
592
631
  readonly OTHER: "other";
593
632
  }>>;
633
+ /**
634
+ * Which shell the page is running in: `web`, `electron`, `tauri`, or something newer.
635
+ *
636
+ * The SDK has always sent this and the server has always read it, but until now the field was
637
+ * not declared here, so it travelled through `.passthrough()` and appeared in NONE of the
638
+ * generated `dist/schema/*.json` files. Anyone implementing this contract from the published
639
+ * schemas -- which is what a third-party realm does -- could not see that the field exists, let
640
+ * alone that the server depends on it.
641
+ *
642
+ * A plain string on purpose, NOT a closed list of the three shells that ship today. A realm
643
+ * that does not exist yet has to be able to name itself, and an enum here would mean one
644
+ * unknown value fails the whole health report, taking visibility, focus and the heartbeat down
645
+ * with it. The wire says the field exists and is a string; which values mean something stays
646
+ * with the reader, where it already is.
647
+ */
648
+ runtime: z.ZodOptional<z.ZodString>;
649
+ /** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
650
+ engine: z.ZodOptional<z.ZodString>;
594
651
  }, z.ZodTypeAny, "passthrough">>;
595
652
  "context.opened": z.ZodObject<{
596
653
  href: z.ZodOptional<z.ZodString>;
@@ -729,13 +786,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
729
786
  readonly END: "end";
730
787
  readonly MESSAGE: "message";
731
788
  readonly REPLAY: "replay";
789
+ readonly SYNC: "sync";
790
+ readonly HARNESS: "harness";
732
791
  }>;
733
792
  text: z.ZodOptional<z.ZodString>;
734
793
  }, "strip", z.ZodTypeAny, {
735
- kind: "message" | "pause" | "resume" | "end" | "replay";
794
+ kind: "message" | "pause" | "resume" | "end" | "replay" | "sync" | "harness";
736
795
  text?: string | undefined;
737
796
  }, {
738
- kind: "message" | "pause" | "resume" | "end" | "replay";
797
+ kind: "message" | "pause" | "resume" | "end" | "replay" | "sync" | "harness";
739
798
  text?: string | undefined;
740
799
  }>;
741
800
  "human.mark": z.ZodObject<{
@@ -760,25 +819,25 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
760
819
  }>>;
761
820
  route: z.ZodOptional<z.ZodString>;
762
821
  }, "strip", z.ZodTypeAny, {
763
- note: string;
764
822
  anchor: string;
765
- strategy: "testid" | "role" | "component" | "position";
823
+ note: string;
824
+ strategy: "role" | "testid" | "component" | "position";
825
+ label?: string | undefined;
766
826
  route?: string | undefined;
767
827
  source?: {
768
828
  file: string;
769
829
  line: number;
770
830
  } | undefined;
771
- label?: string | undefined;
772
831
  }, {
773
- note: string;
774
832
  anchor: string;
775
- strategy: "testid" | "role" | "component" | "position";
833
+ note: string;
834
+ strategy: "role" | "testid" | "component" | "position";
835
+ label?: string | undefined;
776
836
  route?: string | undefined;
777
837
  source?: {
778
838
  file: string;
779
839
  line: number;
780
840
  } | undefined;
781
- label?: string | undefined;
782
841
  }>;
783
842
  };
784
843
  /** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */