@reticlehq/core 3.8.1 → 3.9.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.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The GitHub Action tag that users pin. The docs and the cloud's setup card print this one line.
3
+ * `scripts/set-version.mjs` writes the version on each release, and `version-lockstep.test.ts`
4
+ * fails when a doc pins another tag.
5
+ */
6
+ export declare const RETICLE_ACTION_VERSION = "3.9.0";
7
+ export declare const RETICLE_ACTION_USES = "reticlehq/reticle/action@v3.9.0";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The GitHub Action tag that users pin. The docs and the cloud's setup card print this one line.
3
+ * `scripts/set-version.mjs` writes the version on each release, and `version-lockstep.test.ts`
4
+ * fails when a doc pins another tag.
5
+ */
6
+ export const RETICLE_ACTION_VERSION = '3.9.0';
7
+ export const RETICLE_ACTION_USES = `reticlehq/reticle/action@v${RETICLE_ACTION_VERSION}`;
package/dist/index.d.ts CHANGED
@@ -28,7 +28,9 @@ export * from './wire/constants/constants.js';
28
28
  export * from './wire/constants/response-body-reason.js';
29
29
  export * from './identity/source-constants.js';
30
30
  export * from './identity/testid-attribute.js';
31
+ export * from './identity/github-action.js';
31
32
  export * from './wire/event-classification.js';
33
+ export * from './wire/click-input.js';
32
34
  export * from './wire/global-press.js';
33
35
  export * from './wire/hold.js';
34
36
  export * from './verdict/verified-constants.js';
@@ -39,6 +41,7 @@ export * from './wire/constants/session-constants.js';
39
41
  export * from './wire/constants/hud-use.js';
40
42
  export * from './wire/constants/reticle-chrome.js';
41
43
  export * from './wire/platform-link.js';
44
+ export * from './wire/constants/match-args.js';
42
45
  export * from './wire/constants/discovery.js';
43
46
  export * from './identity/document-identity.js';
44
47
  export * from './identity/edit-epoch.js';
package/dist/index.js CHANGED
@@ -29,7 +29,9 @@ export * from './wire/constants/constants.js'; // EventType, ActionType, wire co
29
29
  export * from './wire/constants/response-body-reason.js'; // why a NET_REQUEST carries no response body (#1520)
30
30
  export * from './identity/source-constants.js'; // DATA_RETICLE_SOURCE_ATTR, RETICLE_ROOT_GLOBAL
31
31
  export * from './identity/testid-attribute.js'; // DEFAULT_TESTID_ATTR, ALTERNATIVE_TESTID_ATTRS
32
+ export * from './identity/github-action.js'; // RETICLE_ACTION_USES — the Action tag docs and cloud print
32
33
  export * from './wire/event-classification.js'; // CHURN_TYPES — shared eviction priority for buffer/queue
34
+ export * from './wire/click-input.js'; // which button and modifiers a click may carry
33
35
  export * from './wire/global-press.js'; // which press is a document key (Escape / Tab / a shortcut)
34
36
  export * from './wire/hold.js'; // clampHoldMs — the bounded hold both input paths honour
35
37
  export * from './verdict/verified-constants.js'; // Verified — the one field an agent gates on
@@ -41,6 +43,7 @@ export * from './wire/constants/session-constants.js';
41
43
  export * from './wire/constants/hud-use.js'; // where the HUD sits, for HUD_USED events
42
44
  export * from './wire/constants/reticle-chrome.js'; // Reticle's own UI, hidden from every capture
43
45
  export * from './wire/platform-link.js'; // daemon <-> platform: capabilities, drive spec, tool session
46
+ export * from './wire/constants/match-args.js'; // the arguments of the `match` command
44
47
  export * from './wire/constants/discovery.js'; // the call-the-founder invitation, one link for every surface
45
48
  export * from './identity/document-identity.js'; // which document an observation belongs to
46
49
  export * from './identity/edit-epoch.js'; // which round of source edits an observation belongs to
@@ -59,6 +59,40 @@ export declare const NextStepOffered: {
59
59
  readonly INIT_CONSENT: "init_consent";
60
60
  };
61
61
  export type NextStepOffered = (typeof NextStepOffered)[keyof typeof NextStepOffered];
62
+ /**
63
+ * Why the path to a first verdict stopped. One name for each stop, from a closed list.
64
+ *
65
+ * Each member has one detection point in the code. A stop that no code can detect is not on the
66
+ * list: a guessed reason is worse than no reason. `unclassified` is a stop that was seen and could
67
+ * not be named, so the unknown bucket can be measured.
68
+ */
69
+ export declare const OnboardingStop: {
70
+ /** The installer found no `node`. */
71
+ readonly NO_NODE: "no_node";
72
+ /** The installer found a `node` older than the minimum. */
73
+ readonly NODE_TOO_OLD: "node_too_old";
74
+ /** The installer could not install the CLI or put it on PATH. */
75
+ readonly CLI_INSTALL_FAILED: "cli_install_failed";
76
+ /** No detected coding agent got the MCP server. */
77
+ readonly MCP_NOT_REGISTERED: "mcp_not_registered";
78
+ /** `init` found no `package.json`, so no web app. */
79
+ readonly NO_WEB_APP: "no_web_app";
80
+ /** `init` could not write the setup: a bad manifest, a preflight refusal, a failed install, a busy bridge port. */
81
+ readonly SETUP_FAILED: "setup_failed";
82
+ /** `init` could not start the dev server or get a URL from it. */
83
+ readonly DEV_SERVER_FAILED: "dev_server_failed";
84
+ /** The page was served and no session dialled the daemon. */
85
+ readonly APP_NOT_CONNECTED: "app_not_connected";
86
+ /** The person stopped `init` with Ctrl-C. */
87
+ readonly INTERRUPTED: "interrupted";
88
+ /** The agent that ran `init` must restart before it has the `reticle_*` tools. */
89
+ readonly AGENT_NOT_RESTARTED: "agent_not_restarted";
90
+ /** Reticle could not launch Chromium: the browser or Playwright is not installed. */
91
+ readonly CHROMIUM_UNAVAILABLE: "chromium_unavailable";
92
+ /** A stop was seen and no rule named it. */
93
+ readonly UNCLASSIFIED: "unclassified";
94
+ };
95
+ export type OnboardingStop = (typeof OnboardingStop)[keyof typeof OnboardingStop];
62
96
  export declare const OnboardingStepSchema: z.ZodObject<{
63
97
  phase: z.ZodEnum<{
64
98
  /** Getting the CLI onto the machine and the MCP registered with the agents that are there. */
@@ -89,5 +123,31 @@ export declare const OnboardingStepSchema: z.ZodObject<{
89
123
  readonly INIT_CONSENT: "init_consent";
90
124
  }>>;
91
125
  nextFollowed: z.ZodOptional<z.ZodBoolean>;
126
+ stop: z.ZodOptional<z.ZodEnum<{
127
+ /** The installer found no `node`. */
128
+ readonly NO_NODE: "no_node";
129
+ /** The installer found a `node` older than the minimum. */
130
+ readonly NODE_TOO_OLD: "node_too_old";
131
+ /** The installer could not install the CLI or put it on PATH. */
132
+ readonly CLI_INSTALL_FAILED: "cli_install_failed";
133
+ /** No detected coding agent got the MCP server. */
134
+ readonly MCP_NOT_REGISTERED: "mcp_not_registered";
135
+ /** `init` found no `package.json`, so no web app. */
136
+ readonly NO_WEB_APP: "no_web_app";
137
+ /** `init` could not write the setup: a bad manifest, a preflight refusal, a failed install, a busy bridge port. */
138
+ readonly SETUP_FAILED: "setup_failed";
139
+ /** `init` could not start the dev server or get a URL from it. */
140
+ readonly DEV_SERVER_FAILED: "dev_server_failed";
141
+ /** The page was served and no session dialled the daemon. */
142
+ readonly APP_NOT_CONNECTED: "app_not_connected";
143
+ /** The person stopped `init` with Ctrl-C. */
144
+ readonly INTERRUPTED: "interrupted";
145
+ /** The agent that ran `init` must restart before it has the `reticle_*` tools. */
146
+ readonly AGENT_NOT_RESTARTED: "agent_not_restarted";
147
+ /** Reticle could not launch Chromium: the browser or Playwright is not installed. */
148
+ readonly CHROMIUM_UNAVAILABLE: "chromium_unavailable";
149
+ /** A stop was seen and no rule named it. */
150
+ readonly UNCLASSIFIED: "unclassified";
151
+ }>>;
92
152
  }, z.core.$strip>;
93
153
  export type OnboardingStep = z.infer<typeof OnboardingStepSchema>;
@@ -104,6 +104,39 @@ export const NextStepOffered = {
104
104
  LEASE: 'lease',
105
105
  INIT_CONSENT: 'init_consent',
106
106
  };
107
+ /**
108
+ * Why the path to a first verdict stopped. One name for each stop, from a closed list.
109
+ *
110
+ * Each member has one detection point in the code. A stop that no code can detect is not on the
111
+ * list: a guessed reason is worse than no reason. `unclassified` is a stop that was seen and could
112
+ * not be named, so the unknown bucket can be measured.
113
+ */
114
+ export const OnboardingStop = {
115
+ /** The installer found no `node`. */
116
+ NO_NODE: 'no_node',
117
+ /** The installer found a `node` older than the minimum. */
118
+ NODE_TOO_OLD: 'node_too_old',
119
+ /** The installer could not install the CLI or put it on PATH. */
120
+ CLI_INSTALL_FAILED: 'cli_install_failed',
121
+ /** No detected coding agent got the MCP server. */
122
+ MCP_NOT_REGISTERED: 'mcp_not_registered',
123
+ /** `init` found no `package.json`, so no web app. */
124
+ NO_WEB_APP: 'no_web_app',
125
+ /** `init` could not write the setup: a bad manifest, a preflight refusal, a failed install, a busy bridge port. */
126
+ SETUP_FAILED: 'setup_failed',
127
+ /** `init` could not start the dev server or get a URL from it. */
128
+ DEV_SERVER_FAILED: 'dev_server_failed',
129
+ /** The page was served and no session dialled the daemon. */
130
+ APP_NOT_CONNECTED: 'app_not_connected',
131
+ /** The person stopped `init` with Ctrl-C. */
132
+ INTERRUPTED: 'interrupted',
133
+ /** The agent that ran `init` must restart before it has the `reticle_*` tools. */
134
+ AGENT_NOT_RESTARTED: 'agent_not_restarted',
135
+ /** Reticle could not launch Chromium: the browser or Playwright is not installed. */
136
+ CHROMIUM_UNAVAILABLE: 'chromium_unavailable',
137
+ /** A stop was seen and no rule named it. */
138
+ UNCLASSIFIED: 'unclassified',
139
+ };
107
140
  /**
108
141
  * ONE event for every step of every phase, rather than an event name per step.
109
142
  *
@@ -163,4 +196,6 @@ export const OnboardingStepSchema = z.object({
163
196
  offered: z.nativeEnum(NextStepOffered).optional(),
164
197
  /** Only on a `completed` `next_step_offered`: the agent's next call did the offered step. */
165
198
  nextFollowed: z.boolean().optional(),
199
+ /** Only on a `failed` row: why the path to a first verdict stopped here. */
200
+ stop: z.nativeEnum(OnboardingStop).optional(),
166
201
  });
@@ -65,5 +65,6 @@ export declare const ToolRefusalSchema: z.ZodObject<{
65
65
  readonly SDK_NOT_REACHING_DAEMON: "sdk_not_reaching_daemon";
66
66
  }>>;
67
67
  retried: z.ZodBoolean;
68
+ params: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
69
  }, z.core.$strip>;
69
70
  export type ToolRefusal = z.infer<typeof ToolRefusalSchema>;
@@ -57,4 +57,11 @@ export const ToolRefusalSchema = z.object({
57
57
  * gets anybody unstuck.
58
58
  */
59
59
  retried: z.boolean(),
60
+ /**
61
+ * The arguments the refused call passed, by NAME, with the value only for an enum we defined
62
+ * (`action:list`, else `action:other`), as `toolParams` reports them. Never a free value. A
63
+ * `bad_args` refusal said nothing about the call's shape, so a tool that confuses agents could
64
+ * not be told apart from one that agents never reach.
65
+ */
66
+ params: z.array(z.string().min(1).max(64)).max(16).optional(),
60
67
  });
@@ -212,6 +212,31 @@ export declare const HarnessRunSchema: z.ZodObject<{
212
212
  }>>;
213
213
  }, z.core.$strip>;
214
214
  export type HarnessRun = z.infer<typeof HarnessRunSchema>;
215
+ /**
216
+ * How `reticle gate` ended. One value for each exit code the gate can give, and `error` for a gate
217
+ * that broke before it gave a judgement. `error` exits 1 like `fail`, and it is a different fact:
218
+ * a `fail` is about the change, an `error` is about Reticle.
219
+ */
220
+ export declare const GateOutcome: {
221
+ readonly PASS: "pass";
222
+ readonly FAIL: "fail";
223
+ readonly NOTHING_TO_CHECK: "nothing_to_check";
224
+ readonly REGRESSION: "regression";
225
+ readonly ERROR: "error";
226
+ };
227
+ export type GateOutcome = (typeof GateOutcome)[keyof typeof GateOutcome];
228
+ /** `gate_completed`: one per `reticle gate` run. No flow name and no file path. */
229
+ export declare const GateCompletedSchema: z.ZodObject<{
230
+ outcome: z.ZodEnum<{
231
+ readonly PASS: "pass";
232
+ readonly FAIL: "fail";
233
+ readonly NOTHING_TO_CHECK: "nothing_to_check";
234
+ readonly REGRESSION: "regression";
235
+ readonly ERROR: "error";
236
+ }>;
237
+ flowsChecked: z.ZodOptional<z.ZodNumber>;
238
+ }, z.core.$strip>;
239
+ export type GateCompleted = z.infer<typeof GateCompletedSchema>;
215
240
  /**
216
241
  * The envelope fields and blocks this file adds to `TelemetryEventSchema`, spread into it there.
217
242
  * Every one optional: an older sender has none of them.
@@ -344,6 +369,17 @@ export declare const SIGNAL_FIELDS: {
344
369
  readonly OTHER: "other";
345
370
  }>>;
346
371
  }, z.core.$strip>>;
372
+ /** Only on `gate_completed`. */
373
+ gate: z.ZodOptional<z.ZodObject<{
374
+ outcome: z.ZodEnum<{
375
+ readonly PASS: "pass";
376
+ readonly FAIL: "fail";
377
+ readonly NOTHING_TO_CHECK: "nothing_to_check";
378
+ readonly REGRESSION: "regression";
379
+ readonly ERROR: "error";
380
+ }>;
381
+ flowsChecked: z.ZodOptional<z.ZodNumber>;
382
+ }, z.core.$strip>>;
347
383
  };
348
384
  /**
349
385
  * The socket error code behind a drop, as a closed set. Anything else reports `other`, so a new code
@@ -387,9 +423,43 @@ export declare const ProxyExitSchema: z.ZodObject<{
387
423
  proxyId: z.ZodOptional<z.ZodString>;
388
424
  }, z.core.$strip>;
389
425
  export type ProxyExit = z.infer<typeof ProxyExitSchema>;
426
+ /** How a daemon's life ended, as far as its own log can say. */
427
+ export declare const DaemonEnd: {
428
+ /** Still beating within tolerance. */
429
+ readonly ALIVE: "alive";
430
+ /** Logged its own exit, with no signal before it. */
431
+ readonly CLEAN: "clean";
432
+ /** A signal arrived: the cause an exit line with `code: 0` does not carry. */
433
+ readonly SIGNALLED: "signalled";
434
+ /** The beat simply stopped. No exit, no signal: killed, crashed, or swept. */
435
+ readonly DIED_SILENTLY: "died_silently";
436
+ /** No beat was ever emitted, so the log cannot answer the question. */
437
+ readonly UNKNOWN: "unknown";
438
+ };
439
+ export type DaemonEnd = (typeof DaemonEnd)[keyof typeof DaemonEnd];
440
+ /** A Node error code, such as `EADDRINUSE` or `ERR_MODULE_NOT_FOUND`. Never a message or a path. */
441
+ export declare const NODE_ERROR_CODE: RegExp;
390
442
  /** `daemon_died_unclean`: a daemon start found the pidfile of a daemon that never stopped cleanly. */
391
443
  export declare const DaemonDeathSchema: z.ZodObject<{
392
444
  ageMs: z.ZodNumber;
445
+ end: z.ZodOptional<z.ZodEnum<{
446
+ /** Still beating within tolerance. */
447
+ readonly ALIVE: "alive";
448
+ /** Logged its own exit, with no signal before it. */
449
+ readonly CLEAN: "clean";
450
+ /** A signal arrived: the cause an exit line with `code: 0` does not carry. */
451
+ readonly SIGNALLED: "signalled";
452
+ /** The beat simply stopped. No exit, no signal: killed, crashed, or swept. */
453
+ readonly DIED_SILENTLY: "died_silently";
454
+ /** No beat was ever emitted, so the log cannot answer the question. */
455
+ readonly UNKNOWN: "unknown";
456
+ }>>;
457
+ silentMs: z.ZodOptional<z.ZodNumber>;
458
+ signal: z.ZodOptional<z.ZodString>;
459
+ sessions: z.ZodOptional<z.ZodNumber>;
460
+ served: z.ZodOptional<z.ZodBoolean>;
461
+ rssMb: z.ZodOptional<z.ZodNumber>;
462
+ error: z.ZodOptional<z.ZodString>;
393
463
  }, z.core.$strip>;
394
464
  export type DaemonDeath = z.infer<typeof DaemonDeathSchema>;
395
465
  /** How the parent started the daemon. On Windows a start through WMI leaves the Job Object. */
@@ -442,6 +512,24 @@ export declare const TRANSPORT_FIELDS: {
442
512
  /** Only on `daemon_died_unclean`. */
443
513
  daemonDeath: z.ZodOptional<z.ZodObject<{
444
514
  ageMs: z.ZodNumber;
515
+ end: z.ZodOptional<z.ZodEnum<{
516
+ /** Still beating within tolerance. */
517
+ readonly ALIVE: "alive";
518
+ /** Logged its own exit, with no signal before it. */
519
+ readonly CLEAN: "clean";
520
+ /** A signal arrived: the cause an exit line with `code: 0` does not carry. */
521
+ readonly SIGNALLED: "signalled";
522
+ /** The beat simply stopped. No exit, no signal: killed, crashed, or swept. */
523
+ readonly DIED_SILENTLY: "died_silently";
524
+ /** No beat was ever emitted, so the log cannot answer the question. */
525
+ readonly UNKNOWN: "unknown";
526
+ }>>;
527
+ silentMs: z.ZodOptional<z.ZodNumber>;
528
+ signal: z.ZodOptional<z.ZodString>;
529
+ sessions: z.ZodOptional<z.ZodNumber>;
530
+ served: z.ZodOptional<z.ZodBoolean>;
531
+ rssMb: z.ZodOptional<z.ZodNumber>;
532
+ error: z.ZodOptional<z.ZodString>;
445
533
  }, z.core.$strip>>;
446
534
  /** Only on `wake_refused`. */
447
535
  wakeRefusal: z.ZodOptional<z.ZodObject<{
@@ -138,6 +138,24 @@ export const HarnessRunSchema = z.object({
138
138
  /** Only on a `blocked` or `failed` run: why it did not drive. */
139
139
  reason: z.nativeEnum(HarnessRunReason).optional(),
140
140
  });
141
+ /**
142
+ * How `reticle gate` ended. One value for each exit code the gate can give, and `error` for a gate
143
+ * that broke before it gave a judgement. `error` exits 1 like `fail`, and it is a different fact:
144
+ * a `fail` is about the change, an `error` is about Reticle.
145
+ */
146
+ export const GateOutcome = {
147
+ PASS: 'pass',
148
+ FAIL: 'fail',
149
+ NOTHING_TO_CHECK: 'nothing_to_check',
150
+ REGRESSION: 'regression',
151
+ ERROR: 'error',
152
+ };
153
+ /** `gate_completed`: one per `reticle gate` run. No flow name and no file path. */
154
+ export const GateCompletedSchema = z.object({
155
+ outcome: z.nativeEnum(GateOutcome),
156
+ /** The saved flows that the change affects, which the gate judged. Absent on `error`. */
157
+ flowsChecked: z.number().int().nonnegative().optional(),
158
+ });
141
159
  /**
142
160
  * The envelope fields and blocks this file adds to `TelemetryEventSchema`, spread into it there.
143
161
  * Every one optional: an older sender has none of them.
@@ -162,6 +180,8 @@ export const SIGNAL_FIELDS = {
162
180
  link: PlatformLinkSchema.optional(),
163
181
  /** Only on `harness_run`. */
164
182
  harness: HarnessRunSchema.optional(),
183
+ /** Only on `gate_completed`. */
184
+ gate: GateCompletedSchema.optional(),
165
185
  };
166
186
  // ── Transport: what happens to the MCP proxy and its daemon when the link fails ──
167
187
  // No block below carries a path, a port, a pid or a message.
@@ -198,10 +218,41 @@ export const ProxyExitSchema = z.object({
198
218
  toolCalls: z.number().int().nonnegative(),
199
219
  proxyId: z.string().min(1).max(64).optional(),
200
220
  });
221
+ /** How a daemon's life ended, as far as its own log can say. */
222
+ export const DaemonEnd = {
223
+ /** Still beating within tolerance. */
224
+ ALIVE: 'alive',
225
+ /** Logged its own exit, with no signal before it. */
226
+ CLEAN: 'clean',
227
+ /** A signal arrived: the cause an exit line with `code: 0` does not carry. */
228
+ SIGNALLED: 'signalled',
229
+ /** The beat simply stopped. No exit, no signal: killed, crashed, or swept. */
230
+ DIED_SILENTLY: 'died_silently',
231
+ /** No beat was ever emitted, so the log cannot answer the question. */
232
+ UNKNOWN: 'unknown',
233
+ };
234
+ /** A signal name, never anything else. */
235
+ const SIGNAL_NAME = /^SIG[A-Z0-9]{1,12}$/;
236
+ /** A Node error code, such as `EADDRINUSE` or `ERR_MODULE_NOT_FOUND`. Never a message or a path. */
237
+ export const NODE_ERROR_CODE = /^(E[A-Z0-9]{2,30}|ERR_[A-Z0-9_]{2,60})$/;
201
238
  /** `daemon_died_unclean`: a daemon start found the pidfile of a daemon that never stopped cleanly. */
202
239
  export const DaemonDeathSchema = z.object({
203
240
  /** Time from the dead daemon's start (its pidfile write) to this discovery. */
204
241
  ageMs: z.number().int().nonnegative(),
242
+ /** How the dead daemon's own log says it ended. */
243
+ end: z.nativeEnum(DaemonEnd).optional(),
244
+ /** Time from its last heartbeat to this discovery. Short with a client connected: killed in use. */
245
+ silentMs: z.number().int().nonnegative().optional(),
246
+ /** The signal it logged before it exited. */
247
+ signal: z.string().regex(SIGNAL_NAME).optional(),
248
+ /** Browser sessions connected at its last heartbeat. */
249
+ sessions: z.number().int().nonnegative().optional(),
250
+ /** Whether it had served any tool call by its last heartbeat. */
251
+ served: z.boolean().optional(),
252
+ /** Its resident memory at its last heartbeat, in MB. */
253
+ rssMb: z.number().int().nonnegative().optional(),
254
+ /** The Node error code of a failed start or a crash. */
255
+ error: z.string().regex(NODE_ERROR_CODE).optional(),
205
256
  });
206
257
  /** How the parent started the daemon. On Windows a start through WMI leaves the Job Object. */
207
258
  export const DaemonSpawnMethod = {
@@ -15,12 +15,12 @@
15
15
  * `z.nativeEnum`, timestamps are epoch-ms NUMBERS, no `any`.
16
16
  */
17
17
  import * as z from 'zod';
18
- import { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, type OnboardingStep } from './onboarding.js';
18
+ import { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, OnboardingStop, type OnboardingStep } from './onboarding.js';
19
19
  /**
20
20
  * The setup funnel's vocabulary. It is defined in `onboarding.ts`, which is its own subject, and
21
21
  * re-exported here so every `@reticlehq/core/telemetry` import reaches it.
22
22
  */
23
- export { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, type OnboardingStep, };
23
+ export { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingStop, OnboardingSteps, type OnboardingStep, };
24
24
  export * from './telemetry-bug.js';
25
25
  /** Bump when the event shape changes so the analytics side can segment old senders. */
26
26
  export declare const TELEMETRY_EVENT_VERSION = 3;
@@ -193,6 +193,8 @@ export declare const TelemetryEventKind: {
193
193
  readonly PLATFORM_LINKED: "platform_linked";
194
194
  /** A Harness run started, or ended: one of each per run. */
195
195
  readonly HARNESS_RUN: "harness_run";
196
+ /** `reticle gate` ended: how, and over how many flows. A one-shot CLI event. */
197
+ readonly GATE_COMPLETED: "gate_completed";
196
198
  };
197
199
  export type TelemetryEventKind = (typeof TelemetryEventKind)[keyof typeof TelemetryEventKind];
198
200
  /** True when this event happened inside a daemon run, so a `sessionId` on it means something. */
@@ -716,6 +718,19 @@ export declare const TelemetryEventSchema: z.ZodObject<{
716
718
  }, z.core.$strip>>;
717
719
  daemonDeath: z.ZodOptional<z.ZodObject<{
718
720
  ageMs: z.ZodNumber;
721
+ end: z.ZodOptional<z.ZodEnum<{
722
+ readonly ALIVE: "alive";
723
+ readonly CLEAN: "clean";
724
+ readonly SIGNALLED: "signalled";
725
+ readonly DIED_SILENTLY: "died_silently";
726
+ readonly UNKNOWN: "unknown";
727
+ }>>;
728
+ silentMs: z.ZodOptional<z.ZodNumber>;
729
+ signal: z.ZodOptional<z.ZodString>;
730
+ sessions: z.ZodOptional<z.ZodNumber>;
731
+ served: z.ZodOptional<z.ZodBoolean>;
732
+ rssMb: z.ZodOptional<z.ZodNumber>;
733
+ error: z.ZodOptional<z.ZodString>;
719
734
  }, z.core.$strip>>;
720
735
  wakeRefusal: z.ZodOptional<z.ZodObject<{
721
736
  presence: z.ZodEnum<{
@@ -832,6 +847,16 @@ export declare const TelemetryEventSchema: z.ZodObject<{
832
847
  readonly OTHER: "other";
833
848
  }>>;
834
849
  }, z.core.$strip>>;
850
+ gate: z.ZodOptional<z.ZodObject<{
851
+ outcome: z.ZodEnum<{
852
+ readonly PASS: "pass";
853
+ readonly FAIL: "fail";
854
+ readonly NOTHING_TO_CHECK: "nothing_to_check";
855
+ readonly REGRESSION: "regression";
856
+ readonly ERROR: "error";
857
+ }>;
858
+ flowsChecked: z.ZodOptional<z.ZodNumber>;
859
+ }, z.core.$strip>>;
835
860
  v: z.ZodLiteral<3>;
836
861
  anonymousId: z.ZodString;
837
862
  projectId: z.ZodOptional<z.ZodString>;
@@ -993,6 +1018,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
993
1018
  readonly PLATFORM_LINKED: "platform_linked";
994
1019
  /** A Harness run started, or ended: one of each per run. */
995
1020
  readonly HARNESS_RUN: "harness_run";
1021
+ /** `reticle gate` ended: how, and over how many flows. A one-shot CLI event. */
1022
+ readonly GATE_COMPLETED: "gate_completed";
996
1023
  }>;
997
1024
  ts: z.ZodNumber;
998
1025
  version: z.ZodString;
@@ -1402,6 +1429,20 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1402
1429
  readonly INIT_CONSENT: "init_consent";
1403
1430
  }>>;
1404
1431
  nextFollowed: z.ZodOptional<z.ZodBoolean>;
1432
+ stop: z.ZodOptional<z.ZodEnum<{
1433
+ readonly NO_NODE: "no_node";
1434
+ readonly NODE_TOO_OLD: "node_too_old";
1435
+ readonly CLI_INSTALL_FAILED: "cli_install_failed";
1436
+ readonly MCP_NOT_REGISTERED: "mcp_not_registered";
1437
+ readonly NO_WEB_APP: "no_web_app";
1438
+ readonly SETUP_FAILED: "setup_failed";
1439
+ readonly DEV_SERVER_FAILED: "dev_server_failed";
1440
+ readonly APP_NOT_CONNECTED: "app_not_connected";
1441
+ readonly INTERRUPTED: "interrupted";
1442
+ readonly AGENT_NOT_RESTARTED: "agent_not_restarted";
1443
+ readonly CHROMIUM_UNAVAILABLE: "chromium_unavailable";
1444
+ readonly UNCLASSIFIED: "unclassified";
1445
+ }>>;
1405
1446
  }, z.core.$strip>>;
1406
1447
  bug: z.ZodOptional<z.ZodObject<{
1407
1448
  source: z.ZodEnum<{
@@ -1447,6 +1488,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1447
1488
  readonly SDK_NOT_REACHING_DAEMON: "sdk_not_reaching_daemon";
1448
1489
  }>>;
1449
1490
  retried: z.ZodBoolean;
1491
+ params: z.ZodOptional<z.ZodArray<z.ZodString>>;
1450
1492
  }, z.core.$strip>>;
1451
1493
  outage: z.ZodOptional<z.ZodObject<{
1452
1494
  stage: z.ZodEnum<{
package/dist/telemetry.js CHANGED
@@ -15,12 +15,12 @@
15
15
  * `z.nativeEnum`, timestamps are epoch-ms NUMBERS, no `any`.
16
16
  */
17
17
  import * as z from 'zod';
18
- import { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, } from './onboarding.js';
18
+ import { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, OnboardingStop, } from './onboarding.js';
19
19
  /**
20
20
  * The setup funnel's vocabulary. It is defined in `onboarding.ts`, which is its own subject, and
21
21
  * re-exported here so every `@reticlehq/core/telemetry` import reaches it.
22
22
  */
23
- export { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, };
23
+ export { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingStop, OnboardingSteps, };
24
24
  import { ToolRefusalSchema } from './telemetry-refusal.js';
25
25
  import { MachineSnapshotSchema, ProjectProfileSchema, SessionSummarySchema, } from './telemetry-session.js';
26
26
  import { BrowserBrand, FeedbackSchema } from './telemetry-feedback.js';
@@ -201,6 +201,8 @@ export const TelemetryEventKind = {
201
201
  PLATFORM_LINKED: 'platform_linked',
202
202
  /** A Harness run started, or ended: one of each per run. */
203
203
  HARNESS_RUN: 'harness_run',
204
+ /** `reticle gate` ended: how, and over how many flows. A one-shot CLI event. */
205
+ GATE_COMPLETED: 'gate_completed',
204
206
  };
205
207
  /**
206
208
  * Events that belong to a DAEMON RUN, and therefore carry `sessionId`.
@@ -180,6 +180,110 @@ function withKind(given) {
180
180
  const kind = kindToInfer(given);
181
181
  return kind === undefined ? renamed : { ...renamed, kind };
182
182
  }
183
+ /** The kind written as `absent`. `absent` is a field of `element`, `text` and `console`. */
184
+ const ABSENT_FIELD = 'absent';
185
+ /**
186
+ * Bare strings that can also be another kind's value. Each one is refused, with both readings.
187
+ * A text check on `/dashboard` fails on a page that does not show that text, so a guess here
188
+ * gives a false "no" and blames the app.
189
+ */
190
+ const BARE_STRING_OTHER_READINGS = [
191
+ { test: /:\/\//, example: (quoted) => `{ kind: "route", contains: ${quoted} }` },
192
+ { test: /^\//, example: (quoted) => `{ kind: "route", pathname: ${quoted} }` },
193
+ {
194
+ test: /^[#.[]/,
195
+ example: (quoted) => `{ kind: "element", query: { scope: ${quoted}, self: true } }`,
196
+ },
197
+ { test: /^[\w-]+:[\w:.-]+$/, example: (quoted) => `{ kind: "signal", name: ${quoted} }` },
198
+ ];
199
+ /**
200
+ * Words that make a bare string read as a description of the outcome ("the receipt appears"), not
201
+ * as text on the page. Read as text, a description fails on every page and blames the app, so it
202
+ * is refused. A refusal costs one call. A false "no" sends the agent to fix code that works.
203
+ */
204
+ const DESCRIPTION_WORDS = /\b(should|must|appears?|shown|shows|displays|displayed|navigates|redirects|succeeds|expect(ed)?)\b/i;
205
+ const isPlainRecord = (value) => 'object' === typeof value && null !== value && !Array.isArray(value);
206
+ /** `"Saved"`: text that must be visible. Visible, so that a hidden copy does not pass. */
207
+ function readBareString(written) {
208
+ const quoted = JSON.stringify(written);
209
+ if (0 === written.trim().length) {
210
+ return {
211
+ value: written,
212
+ refusal: 'an empty string names no check: empty text is on every page. Write the text the page ' +
213
+ 'must show: { kind: "text", contains: "Saved", visible: true }',
214
+ };
215
+ }
216
+ if (DESCRIPTION_WORDS.test(written)) {
217
+ return {
218
+ value: written,
219
+ refusal: `the string ${quoted} reads as a description of the outcome, so it was not checked as ` +
220
+ 'text. Write the exact text the page shows: { kind: "text", contains: "Saved" }, or ' +
221
+ 'the consequence by its kind (signal, net, route, state)',
222
+ };
223
+ }
224
+ const other = BARE_STRING_OTHER_READINGS.find((reading) => reading.test.test(written));
225
+ if (other !== undefined) {
226
+ return {
227
+ value: written,
228
+ refusal: `the string ${quoted} has two readings, so it was not guessed. Write the one you mean: ` +
229
+ `${other.example(quoted)} or { kind: "text", contains: ${quoted} }`,
230
+ };
231
+ }
232
+ return {
233
+ value: { kind: PredicateKind.TEXT, contains: written, visible: true },
234
+ note: `${quoted} → { kind: "text", contains: ${quoted}, visible: true }`,
235
+ };
236
+ }
237
+ /**
238
+ * Fields of `{ text: { ... } }` that mean the same in both places that form is read: here, and in
239
+ * the `text` part of a version 1 flow `expect` (`flowExpectToPredicate`). `absent` is not one of
240
+ * them: that format adds a settle gate to it, so `absent` has two readings and is refused.
241
+ */
242
+ const TEXT_WRAPPER_FIELDS = new Set(['contains', 'scope', 'visible']);
243
+ /** `{ text: { contains } }`: the form agents send after reading a grammar keyed by kind. */
244
+ function readTextWrapper(obj) {
245
+ const keys = writtenKeys(obj);
246
+ const inner = obj[PredicateKind.TEXT];
247
+ if (1 !== keys.length || !isPlainRecord(inner)) {
248
+ return undefined;
249
+ }
250
+ const fields = writtenKeys(inner);
251
+ if (!fields.includes('contains') || !fields.every((field) => TEXT_WRAPPER_FIELDS.has(field))) {
252
+ return undefined;
253
+ }
254
+ return {
255
+ value: { ...inner, kind: PredicateKind.TEXT },
256
+ note: '{ text: { ... } } → { kind: "text", ... }',
257
+ };
258
+ }
259
+ /** `{ kind: "absent", text: "Error" }`: the absence of the one kind the other keys name. */
260
+ function readAbsentKind(obj) {
261
+ if (ABSENT_FIELD !== obj['kind'] || false === obj[ABSENT_FIELD]) {
262
+ return undefined;
263
+ }
264
+ const rest = { ...obj };
265
+ delete rest['kind'];
266
+ delete rest[ABSENT_FIELD];
267
+ const kind = inferKind(rest);
268
+ if (kind === undefined || true !== keysOfEachKind().get(kind)?.has(ABSENT_FIELD)) {
269
+ return undefined;
270
+ }
271
+ return {
272
+ value: { ...rest, kind, [ABSENT_FIELD]: true },
273
+ note: `kind: "${ABSENT_FIELD}" → kind: "${kind}", ${ABSENT_FIELD}: true`,
274
+ };
275
+ }
276
+ /** The one place a lenient form is read. The parse and the report both call it. */
277
+ function readShorthand(input) {
278
+ if ('string' === typeof input) {
279
+ return readBareString(input);
280
+ }
281
+ if (!isPlainRecord(input)) {
282
+ return { value: input };
283
+ }
284
+ const renamed = renameKindSpelling(input);
285
+ return readTextWrapper(renamed) ?? readAbsentKind(renamed) ?? { value: input };
286
+ }
183
287
  /** Why a predicate with no `kind` was refused: the keys it had, and the kinds there are. */
184
288
  function noKindRefusal(obj) {
185
289
  const keys = writtenKeys(obj).map((key) => `\`${key}\``);
@@ -196,10 +300,15 @@ function noKindRefusal(obj) {
196
300
  * schema still refuses them.
197
301
  */
198
302
  export function predicateAliasesUsed(input, depth = 0) {
199
- if (depth > 8 || typeof input !== 'object' || null === input || Array.isArray(input))
303
+ if (depth > 8) {
200
304
  return [];
201
- const given = input;
202
- const used = [];
305
+ }
306
+ const read = readShorthand(input);
307
+ const used = read.note === undefined ? [] : [read.note];
308
+ if (!isPlainRecord(read.value)) {
309
+ return used;
310
+ }
311
+ const given = read.value;
203
312
  if (given['kind'] === undefined && 'string' === typeof given[KIND_SPELLING]) {
204
313
  used.push(`${KIND_SPELLING} → kind`);
205
314
  }
@@ -229,9 +338,15 @@ export function predicateAliasesUsed(input, depth = 0) {
229
338
  }
230
339
  /** Rename known aliases before parse; an explicit canonical key always wins. */
231
340
  function applyPredicateAliases(input, ctx) {
232
- if (typeof input !== 'object' || null === input || Array.isArray(input))
341
+ const read = readShorthand(input);
342
+ if (read.refusal !== undefined) {
343
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: read.refusal });
233
344
  return input;
234
- const given = input;
345
+ }
346
+ if (!isPlainRecord(read.value)) {
347
+ return read.value;
348
+ }
349
+ const given = read.value;
235
350
  const obj = withKind(given);
236
351
  if (obj['kind'] === undefined) {
237
352
  ctx.addIssue({ code: z.ZodIssueCode.custom, message: noKindRefusal(obj) });
@@ -0,0 +1,15 @@
1
+ import { ActionType } from './constants/constants.js';
2
+ /** The pointer buttons a click can use, as the agent spells them in `args.button`. */
3
+ export declare const ClickButton: {
4
+ readonly LEFT: "left";
5
+ readonly MIDDLE: "middle";
6
+ readonly RIGHT: "right";
7
+ };
8
+ export type ClickButton = (typeof ClickButton)[keyof typeof ClickButton];
9
+ /** The button a click asks for: left when `args.button` is absent, undefined when it is unknown. */
10
+ export declare function clickButtonFromArgs(args: Record<string, unknown>): ClickButton | undefined;
11
+ /**
12
+ * Why a click or dblclick cannot be driven as asked, or undefined when it can. The page and the
13
+ * server both refuse with this sentence, so an argument is never dropped without a word.
14
+ */
15
+ export declare function clickInputProblem(action: ActionType, args: Record<string, unknown>): string | undefined;
@@ -0,0 +1,42 @@
1
+ import { ActionType } from './constants/constants.js';
2
+ import { pressModifiersFromArgs } from './global-press.js';
3
+ /** The pointer buttons a click can use, as the agent spells them in `args.button`. */
4
+ export const ClickButton = {
5
+ LEFT: 'left',
6
+ MIDDLE: 'middle',
7
+ RIGHT: 'right',
8
+ };
9
+ const CLICK_BUTTON_NAMES = Object.values(ClickButton);
10
+ /** The button a click asks for: left when `args.button` is absent, undefined when it is unknown. */
11
+ export function clickButtonFromArgs(args) {
12
+ const raw = args['button'];
13
+ if (raw === undefined) {
14
+ return ClickButton.LEFT;
15
+ }
16
+ if ('string' !== typeof raw) {
17
+ return undefined;
18
+ }
19
+ const name = raw.toLowerCase();
20
+ return CLICK_BUTTON_NAMES.find((known) => known === name);
21
+ }
22
+ /**
23
+ * Why a click or dblclick cannot be driven as asked, or undefined when it can. The page and the
24
+ * server both refuse with this sentence, so an argument is never dropped without a word.
25
+ */
26
+ export function clickInputProblem(action, args) {
27
+ const button = clickButtonFromArgs(args);
28
+ if (button === undefined) {
29
+ return `unsupported click button ${JSON.stringify(args['button'])}: use ${CLICK_BUTTON_NAMES.join(', ')}`;
30
+ }
31
+ if (action === ActionType.DBLCLICK && button !== ClickButton.LEFT) {
32
+ return 'a dblclick uses the left button only: a browser sends no dblclick for another button';
33
+ }
34
+ const raw = args['modifiers'];
35
+ if (Array.isArray(raw)) {
36
+ const unknown = raw.filter((item) => 0 === pressModifiersFromArgs({ modifiers: [item] }).length);
37
+ if (0 < unknown.length) {
38
+ return `unsupported click modifier ${JSON.stringify(unknown[0])}: use Meta, Control, Shift or Alt`;
39
+ }
40
+ }
41
+ return undefined;
42
+ }
@@ -105,6 +105,20 @@ export declare const RETICLE_URL_PARAM: {
105
105
  */
106
106
  readonly HUD: "__reticle_hud";
107
107
  };
108
+ /**
109
+ * Payload fields and `kind` values on console/error events that the AGENT reads back through
110
+ * `reticle_console`. The console payload is passthrough rather than closed, so these are named
111
+ * here instead of schema-enforced: a wire string a server writes inline is one a rename
112
+ * half-lands, with the agent reading a field that quietly stopped arriving.
113
+ */
114
+ export declare const CONSOLE_EVENT: {
115
+ /** The payload field naming what kind of console/error event it is (`resource`, `pageerror`, ...). */
116
+ readonly KIND: "kind";
117
+ /** The kind for an uncaught error the SERVER observed through the page's own browser handle. */
118
+ readonly PAGE_ERROR: "pageerror";
119
+ /** The payload field reporting how many buffered page errors were dropped — loss, declared. */
120
+ readonly DROPPED_PAGE_ERRORS: "droppedPageErrors";
121
+ };
108
122
  /** The loopback bind address. The daemon/bridge bind here by default — never expose Reticle off-host. */
109
123
  export declare const LOOPBACK_HOST = "127.0.0.1";
110
124
  export { ReticleEnv } from './reticle-env.js';
@@ -192,6 +206,12 @@ export declare const TRANSPORT_LIMITS: {
192
206
  readonly MAX_STACK_LENGTH: 4000;
193
207
  readonly MAX_SERIALIZE_DEPTH: 8;
194
208
  readonly MAX_COLLECTION_ITEMS: 200;
209
+ /** What a descriptor carries of an element's text for an agent to READ: 80 characters and an ellipsis. */
210
+ readonly MAX_DESCRIBED_TEXT: 80;
211
+ /** What a descriptor carries when a verdict has to JUDGE the text (`MatchArg.FULL_TEXT`); a text MORE than this long was cut. */
212
+ readonly MAX_FULL_TEXT: 4000;
213
+ /** Elements a MATCH describes in full-text mode, about half the transport's character budget; `count` still reports all. */
214
+ readonly MAX_FULL_TEXT_ELEMENTS: 32;
195
215
  readonly MAX_OBJECT_KEYS: 200;
196
216
  readonly MAX_STRING_LENGTH: number;
197
217
  /** Human review marks: the note the human types when flagging a mistake on the page. */
@@ -108,6 +108,20 @@ export const RETICLE_URL_PARAM = {
108
108
  */
109
109
  HUD: '__reticle_hud',
110
110
  };
111
+ /**
112
+ * Payload fields and `kind` values on console/error events that the AGENT reads back through
113
+ * `reticle_console`. The console payload is passthrough rather than closed, so these are named
114
+ * here instead of schema-enforced: a wire string a server writes inline is one a rename
115
+ * half-lands, with the agent reading a field that quietly stopped arriving.
116
+ */
117
+ export const CONSOLE_EVENT = {
118
+ /** The payload field naming what kind of console/error event it is (`resource`, `pageerror`, ...). */
119
+ KIND: 'kind',
120
+ /** The kind for an uncaught error the SERVER observed through the page's own browser handle. */
121
+ PAGE_ERROR: 'pageerror',
122
+ /** The payload field reporting how many buffered page errors were dropped — loss, declared. */
123
+ DROPPED_PAGE_ERRORS: 'droppedPageErrors',
124
+ };
111
125
  /** The loopback bind address. The daemon/bridge bind here by default — never expose Reticle off-host. */
112
126
  export const LOOPBACK_HOST = '127.0.0.1';
113
127
  export { ReticleEnv } from './reticle-env.js';
@@ -230,6 +244,12 @@ export const TRANSPORT_LIMITS = {
230
244
  MAX_STACK_LENGTH: 4000,
231
245
  MAX_SERIALIZE_DEPTH: 8,
232
246
  MAX_COLLECTION_ITEMS: 200,
247
+ /** What a descriptor carries of an element's text for an agent to READ: 80 characters and an ellipsis. */
248
+ MAX_DESCRIBED_TEXT: 80,
249
+ /** What a descriptor carries when a verdict has to JUDGE the text (`MatchArg.FULL_TEXT`); a text MORE than this long was cut. */
250
+ MAX_FULL_TEXT: 4000,
251
+ /** Elements a MATCH describes in full-text mode, about half the transport's character budget; `count` still reports all. */
252
+ MAX_FULL_TEXT_ELEMENTS: 32,
233
253
  MAX_OBJECT_KEYS: 200,
234
254
  MAX_STRING_LENGTH: 64 * 1024,
235
255
  /** Human review marks: the note the human types when flagging a mistake on the page. */
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Arguments of the `match` command beyond its `query` and `state`.
3
+ *
4
+ * Kept apart from `constants.ts`: one small group with a reader on each side of the wire, and
5
+ * nothing else in that file depends on it.
6
+ *
7
+ * The display form of an element's text is 80 characters and an ellipsis (`MAX_DESCRIBED_TEXT`),
8
+ * which is right for output an agent reads and wrong for a verdict: it fails an exact `oneOf` or an
9
+ * end-anchored pattern on anything longer. A verdict asks for `FULL_TEXT`, and the page answers with
10
+ * up to `MAX_FULL_TEXT` characters for at most `MAX_FULL_TEXT_ELEMENTS` elements. Both are bounded
11
+ * because the transport spends ONE budget of `MAX_MESSAGE_BYTES / 4` characters per response and
12
+ * silently replaces the overflow; 32 elements of 4000 characters is about half of it, leaving the
13
+ * rest for every other descriptor field. `count` still reports every match, and a text cut at the
14
+ * bound is `MAX_FULL_TEXT` characters plus an ellipsis, so only a cut text is ever longer than it.
15
+ */
16
+ export declare const MatchArg: {
17
+ /** `true` describes each match with up to `TRANSPORT_LIMITS.MAX_FULL_TEXT` characters of text, not the display-sized 80. */
18
+ readonly FULL_TEXT: "fullText";
19
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Arguments of the `match` command beyond its `query` and `state`.
3
+ *
4
+ * Kept apart from `constants.ts`: one small group with a reader on each side of the wire, and
5
+ * nothing else in that file depends on it.
6
+ *
7
+ * The display form of an element's text is 80 characters and an ellipsis (`MAX_DESCRIBED_TEXT`),
8
+ * which is right for output an agent reads and wrong for a verdict: it fails an exact `oneOf` or an
9
+ * end-anchored pattern on anything longer. A verdict asks for `FULL_TEXT`, and the page answers with
10
+ * up to `MAX_FULL_TEXT` characters for at most `MAX_FULL_TEXT_ELEMENTS` elements. Both are bounded
11
+ * because the transport spends ONE budget of `MAX_MESSAGE_BYTES / 4` characters per response and
12
+ * silently replaces the overflow; 32 elements of 4000 characters is about half of it, leaving the
13
+ * rest for every other descriptor field. `count` still reports every match, and a text cut at the
14
+ * bound is `MAX_FULL_TEXT` characters plus an ellipsis, so only a cut text is ever longer than it.
15
+ */
16
+ export const MatchArg = {
17
+ /** `true` describes each match with up to `TRANSPORT_LIMITS.MAX_FULL_TEXT` characters of text, not the display-sized 80. */
18
+ FULL_TEXT: 'fullText',
19
+ };
@@ -17,3 +17,15 @@ export declare const RETICLE_OVERLAY_SELECTOR = "[data-reticle-overlay],[data-re
17
17
  * page without Reticle would have looked like.
18
18
  */
19
19
  export declare const HIDE_RETICLE_CHROME_CSS = "[data-reticle-overlay],[data-reticle-cursor],[data-reticle-hud],[data-reticle-glow],[data-reticle-mark],[data-reticle-blocker],[data-reticle-tour]{display:none !important}";
20
+ /**
21
+ * A page script that takes Reticle's own UI out of the hit test for one real pointer gesture.
22
+ *
23
+ * A real click goes to the topmost element that takes pointer events. When a HUD control sat over
24
+ * the app's button, the HUD took the daemon's click, and the verdict said the app did nothing
25
+ * (#992). Each Reticle node gets an inline `pointer-events: none !important`, because a control
26
+ * sets `pointer-events: auto` on itself and a value on the host alone does not reach it. Inline
27
+ * style is not blocked by a page's CSP, and an injected stylesheet can be. Nothing moves or flickers.
28
+ */
29
+ export declare const RETICLE_CHROME_PASS_THROUGH_SCRIPT: string;
30
+ /** Puts back what `RETICLE_CHROME_PASS_THROUGH_SCRIPT` changed, so a person can click the HUD again. */
31
+ export declare const RETICLE_CHROME_RESTORE_POINTER_SCRIPT = "(() => { for (const [el, value, priority] of window.__reticlePointerHeld ?? []) { if (value) el.style.setProperty('pointer-events', value, priority); else el.style.removeProperty('pointer-events'); } delete window.__reticlePointerHeld; })()";
@@ -17,3 +17,17 @@ export const RETICLE_OVERLAY_SELECTOR = '[data-reticle-overlay],[data-reticle-cu
17
17
  * page without Reticle would have looked like.
18
18
  */
19
19
  export const HIDE_RETICLE_CHROME_CSS = `${RETICLE_OVERLAY_SELECTOR}{display:none !important}`;
20
+ /** Where the pass-through keeps each node's own inline `pointer-events`, on the page's window. */
21
+ const POINTER_HELD_KEY = '__reticlePointerHeld';
22
+ /**
23
+ * A page script that takes Reticle's own UI out of the hit test for one real pointer gesture.
24
+ *
25
+ * A real click goes to the topmost element that takes pointer events. When a HUD control sat over
26
+ * the app's button, the HUD took the daemon's click, and the verdict said the app did nothing
27
+ * (#992). Each Reticle node gets an inline `pointer-events: none !important`, because a control
28
+ * sets `pointer-events: auto` on itself and a value on the host alone does not reach it. Inline
29
+ * style is not blocked by a page's CSP, and an injected stylesheet can be. Nothing moves or flickers.
30
+ */
31
+ export const RETICLE_CHROME_PASS_THROUGH_SCRIPT = `(() => { const held = []; const seen = new Set(); for (const host of document.querySelectorAll(${JSON.stringify(RETICLE_OVERLAY_SELECTOR)})) { for (const el of [host, ...host.querySelectorAll('*')]) { if (seen.has(el) || !el.style) continue; seen.add(el); held.push([el, el.style.getPropertyValue('pointer-events'), el.style.getPropertyPriority('pointer-events')]); el.style.setProperty('pointer-events', 'none', 'important'); } } window.${POINTER_HELD_KEY} = held; })()`;
32
+ /** Puts back what `RETICLE_CHROME_PASS_THROUGH_SCRIPT` changed, so a person can click the HUD again. */
33
+ export const RETICLE_CHROME_RESTORE_POINTER_SCRIPT = `(() => { for (const [el, value, priority] of window.${POINTER_HELD_KEY} ?? []) { if (value) el.style.setProperty('pointer-events', value, priority); else el.style.removeProperty('pointer-events'); } delete window.${POINTER_HELD_KEY}; })()`;
@@ -202,3 +202,20 @@ export declare const NoSessionAction: {
202
202
  readonly DAEMON_SPLIT: "daemon_split";
203
203
  };
204
204
  export type NoSessionAction = (typeof NoSessionAction)[keyof typeof NoSessionAction];
205
+ /** How a tool call started a session that did not exist before the call. */
206
+ export declare const SessionStartedVia: {
207
+ /** The daemon opened a lease on the URL that the call named. */
208
+ readonly LEASE: "lease";
209
+ };
210
+ export type SessionStartedVia = (typeof SessionStartedVia)[keyof typeof SessionStartedVia];
211
+ /**
212
+ * `sessionStarted` on a `reticle_navigate` result. Present only when the call found no session and
213
+ * opened one, so the agent knows that the tab it now drives is new. The zod schema is in the tool's
214
+ * output schema: zod in this file goes into the first load of every page that loads the SDK.
215
+ */
216
+ export interface SessionStarted {
217
+ sessionId: string;
218
+ via: SessionStartedVia;
219
+ /** The page has no Reticle SDK, so the lease supplied one: no component state, no source line. */
220
+ zeroInstall?: boolean;
221
+ }
@@ -198,3 +198,8 @@ export const NoSessionAction = {
198
198
  */
199
199
  DAEMON_SPLIT: 'daemon_split',
200
200
  };
201
+ /** How a tool call started a session that did not exist before the call. */
202
+ export const SessionStartedVia = {
203
+ /** The daemon opened a lease on the URL that the call named. */
204
+ LEASE: 'lease',
205
+ };
@@ -106,6 +106,13 @@ export interface MatchResult {
106
106
  matched: boolean;
107
107
  count: number;
108
108
  elements: ElementDescriptor[];
109
+ /**
110
+ * Present, and true, only when the page honoured `MatchArg.FULL_TEXT`: each element's `text` is
111
+ * then the full-form reading, not the 80-character display one. A page too old to know the
112
+ * argument ignores it and answers with the short form, which looks exactly like a short text, so
113
+ * the caller needs this to tell the two apart before it judges a property on what it was given.
114
+ */
115
+ fullText?: true;
109
116
  /**
110
117
  * True when a `scope` was given but resolved to nothing (the container was unmounted or the selector
111
118
  * matched no element). The search returns zero matches WITHOUT falling back to the whole page, and
@@ -210,7 +217,23 @@ export interface QueryEmptyHint {
210
217
  * technology", which have opposite fixes (#1070).
211
218
  */
212
219
  ariaHiddenMatch?: boolean;
220
+ /**
221
+ * Present only when a query missed and the page has visible targets like the one asked for: up
222
+ * to three, ranked by role and then by name similarity. Advice for one retry, never a match.
223
+ */
224
+ nearest?: NearestTarget[];
213
225
  }
226
+ /**
227
+ * One target near a query that matched nothing. `name` is cut at 60 characters, and
228
+ * `nameTruncated` is true when it was cut.
229
+ */
230
+ export declare const NearestTargetSchema: z.ZodObject<{
231
+ ref: z.ZodString;
232
+ role: z.ZodString;
233
+ name: z.ZodString;
234
+ nameTruncated: z.ZodOptional<z.ZodLiteral<true>>;
235
+ }, z.core.$strip>;
236
+ export type NearestTarget = z.infer<typeof NearestTargetSchema>;
214
237
  /** Result of the QUERY command / reticle_query tool. `hint` present ONLY on zero matches. */
215
238
  export interface QueryResult {
216
239
  elements: ElementDescriptor[];
@@ -78,6 +78,16 @@ export const ElementQuerySchema = z
78
78
  matchCase: z.boolean().optional(),
79
79
  })
80
80
  .strict();
81
+ /**
82
+ * One target near a query that matched nothing. `name` is cut at 60 characters, and
83
+ * `nameTruncated` is true when it was cut.
84
+ */
85
+ export const NearestTargetSchema = z.object({
86
+ ref: z.string(),
87
+ role: z.string(),
88
+ name: z.string(),
89
+ nameTruncated: z.literal(true).optional(),
90
+ });
81
91
  /** One named flow advertised by the app (mirrors the browser CapabilityFlow). */
82
92
  export const CapabilityFlowSchema = z.object({
83
93
  name: z.string(),
@@ -42,6 +42,16 @@ export declare const BUFFER_EVICTION_WARNING = "event buffer evicted older event
42
42
  * so the two no-session paths now agree.
43
43
  */
44
44
  export declare const NO_SESSION_CONNECTED_ERROR = "no browser session connected. Two things to check: (1) your app is running with @reticlehq/browser enabled, and (2) it points at THIS daemon's port \u2014 a mismatch between the port the app dials (the build plugin's reticle({ port }), or RETICLE_PORT when the dev server started) and the daemon's port is the usual cause. Call reticle_session { action: \"list\" } for the diagnosis \u2014 it names which of these it is, and what to do next \u2014 rather than retrying this call.";
45
+ /**
46
+ * The one call that starts a session, added to every no-session refusal. `reticle_navigate` with an
47
+ * absolute URL opens a lease on the app when nothing is connected, so the agent does not stop at
48
+ * the diagnosis.
49
+ */
50
+ export declare const NO_SESSION_NAVIGATE_FIX: string;
51
+ /** Said on a `reticle_navigate` result that opened a lease because no session was connected. */
52
+ export declare const SESSION_STARTED_NOTE: string;
53
+ /** A relative URL with no session: nothing names the app, so the refusal names the absolute form. */
54
+ export declare function relativeUrlNoSession(path: string, origin: string): string;
45
55
  /**
46
56
  * Explains an unconfirmed navigation that did reconnect, but at a different URL.
47
57
  *
@@ -46,6 +46,25 @@ export const BUFFER_EVICTION_WARNING = 'event buffer evicted older events (age/s
46
46
  * so the two no-session paths now agree.
47
47
  */
48
48
  export const NO_SESSION_CONNECTED_ERROR = "no browser session connected. Two things to check: (1) your app is running with @reticlehq/browser enabled, and (2) it points at THIS daemon's port — a mismatch between the port the app dials (the build plugin's reticle({ port }), or RETICLE_PORT when the dev server started) and the daemon's port is the usual cause. Call reticle_session { action: \"list\" } for the diagnosis — it names which of these it is, and what to do next — rather than retrying this call.";
49
+ /**
50
+ * The one call that starts a session, added to every no-session refusal. `reticle_navigate` with an
51
+ * absolute URL opens a lease on the app when nothing is connected, so the agent does not stop at
52
+ * the diagnosis.
53
+ */
54
+ export const NO_SESSION_NAVIGATE_FIX = ' To start a session now, call reticle_navigate with the absolute URL of the app, for example ' +
55
+ '{ url: "http://localhost:3000/" }. Reticle opens the app in its own browser tab. Nothing in ' +
56
+ 'the project changes.';
57
+ /** Said on a `reticle_navigate` result that opened a lease because no session was connected. */
58
+ export const SESSION_STARTED_NOTE = 'No session was connected, so Reticle opened this URL in a new leased browser tab. Use the ' +
59
+ 'sessionId of this result. Release the lease with reticle_lease { action: "release" } when you ' +
60
+ 'are done.';
61
+ /** A relative URL with no session: nothing names the app, so the refusal names the absolute form. */
62
+ export function relativeUrlNoSession(path, origin) {
63
+ const absolute = new URL(path, origin).toString();
64
+ return (` The URL "${path}" is relative, and no tab is open to resolve it against. Call ` +
65
+ `reticle_navigate with the absolute URL, for example { url: "${absolute}" }, and Reticle ` +
66
+ 'opens a session on it.');
67
+ }
49
68
  /**
50
69
  * Explains an unconfirmed navigation that did reconnect, but at a different URL.
51
70
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reticlehq/core",
3
- "version": "3.8.1",
3
+ "version": "3.9.0",
4
4
  "description": "The Reticle foundation: the shared wire contract — types, zod schemas, constants, messages, and the isomorphic kernel that every Reticle package (browser SDK, server, kits, test harness) imports. Depends only on zod and open-verification.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "zod": "^4.6.6",
50
- "open-verification": "1.0.0"
50
+ "open-verification": "1.1.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "fast-check": "^4.10.2"