@reticlehq/core 2.3.0 → 2.5.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 (45) hide show
  1. package/dist/consequence.d.ts +27 -0
  2. package/dist/consequence.js +26 -0
  3. package/dist/constants.d.ts +52 -8
  4. package/dist/constants.js +49 -8
  5. package/dist/contract-fingerprint.d.ts +29 -0
  6. package/dist/contract-fingerprint.js +56 -0
  7. package/dist/daemon-registry.js +1 -1
  8. package/dist/event-payloads.d.ts +50 -2
  9. package/dist/event-payloads.js +12 -1
  10. package/dist/flow-constants.d.ts +8 -0
  11. package/dist/flow-constants.js +12 -0
  12. package/dist/flow-types.d.ts +40 -1
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.js +3 -0
  15. package/dist/journal.d.ts +2 -2
  16. package/dist/messages.d.ts +72 -0
  17. package/dist/messages.js +34 -0
  18. package/dist/net.d.ts +40 -0
  19. package/dist/net.js +44 -0
  20. package/dist/project-id.d.ts +28 -0
  21. package/dist/project-id.js +51 -0
  22. package/dist/redaction.d.ts +64 -0
  23. package/dist/redaction.js +118 -1
  24. package/dist/schema/hello-message.json +17 -0
  25. package/dist/schema/reticle-message.json +17 -0
  26. package/dist/security.js +10 -5
  27. package/dist/source-constants.d.ts +32 -0
  28. package/dist/source-constants.js +32 -0
  29. package/dist/state-select.d.ts +24 -2
  30. package/dist/state-select.js +102 -22
  31. package/dist/telemetry-feedback.d.ts +32 -10
  32. package/dist/telemetry-feedback.js +21 -0
  33. package/dist/telemetry-session.d.ts +30 -0
  34. package/dist/telemetry-session.js +24 -0
  35. package/dist/telemetry.d.ts +491 -81
  36. package/dist/telemetry.js +188 -2
  37. package/dist/toon.d.ts +2 -1
  38. package/dist/toon.js +37 -37
  39. package/dist/types.d.ts +54 -6
  40. package/dist/types.js +12 -0
  41. package/dist/upgrade.js +1 -1
  42. package/dist/verification-run.d.ts +38 -38
  43. package/dist/verified-constants.d.ts +37 -0
  44. package/dist/verified-constants.js +36 -0
  45. package/package.json +5 -3
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Source mapping: how a DOM node is traced back to the line of code that rendered it.
3
+ *
4
+ * Split out of `constants.ts` — these two are read by the build plugins, the browser SDK and the
5
+ * React adapter together, and they change for one reason (the source-pointer feature) rather than
6
+ * for the dozen reasons the wire contract does.
7
+ */
8
+ /**
9
+ * The attribute the build plugin stamps on JSX host elements as `file:line:column`, so the browser SDK
10
+ * and the React adapter can map a DOM node back to its source file (the source-pointer feature, needed
11
+ * on React 19 which dropped _debugSource). Read here by both packages — it was duplicated as a local
12
+ * const in dom/source.ts AND dom/query.ts and inlined as a literal in the React adapter. The stamper
13
+ * (@reticlehq/babel-plugin, separate build tooling) stamps this same literal and MUST match it.
14
+ */
15
+ export const DATA_RETICLE_SOURCE_ATTR = 'data-reticle-source';
16
+ /**
17
+ * Compile-time global carrying the project root, so the SDK can report source paths RELATIVE to the
18
+ * repo.
19
+ *
20
+ * React's `_debugSource.fileName` is ABSOLUTE (`/Users/you/app/src/Counter.tsx`), while the babel
21
+ * stamp is repo-relative (`src/Counter.tsx`). Both reach the agent as `source`, so the same product
22
+ * emitted two different path shapes depending on which React version an app happened to be on —
23
+ * and an absolute path from someone else's machine is noise in a report, not a pointer. Defined by
24
+ * the build plugins, which are the only place that knows the root.
25
+ */
26
+ export const RETICLE_ROOT_GLOBAL = '__RETICLE_ROOT__';
27
+ /**
28
+ * Compile-time global carrying the SDK's own package version, so a version-skewed pair can name
29
+ * itself. Defined by the build plugins, which are the only place that can read the installed
30
+ * package's version. See `sdkVersion` on the HELLO message.
31
+ */
32
+ export const RETICLE_SDK_VERSION_GLOBAL = '__RETICLE_SDK_VERSION__';
@@ -1,9 +1,10 @@
1
1
  /**
2
- * reticle_state path selection + depth capping — pure, shared by the browser SDK (which applies them
2
+ * reticle_state output projection — pure, shared by the browser SDK (which applies them
3
3
  * BEFORE the transport so a scoped read of a huge store isn't truncated) and the server (back-compat
4
4
  * fallback when an older browser returns the whole store). `selectPath` walks a dot-path (with numeric
5
5
  * array indices) and, on a miss, returns the keys that WERE available at the last good level so a wrong
6
6
  * path is diagnosable rather than a bare null. `capDepth` prunes deeply-nested values to a budget.
7
+ * `projectComponentState` strips React fiber plumbing (effect chains) from a component hook read.
7
8
  */
8
9
  /** Result of walking a dot-path: the value, or a near-miss with the keys available where it stopped. */
9
10
  export interface PathSelection {
@@ -11,8 +12,21 @@ export interface PathSelection {
11
12
  value: unknown;
12
13
  /** On a miss: the keys present at the deepest level reached (so the agent can correct the path). */
13
14
  availableKeys?: string[];
15
+ /**
16
+ * On a miss where `availableKeys` is a SAMPLE: how many keys were really there.
17
+ *
18
+ * Present only when the list was cut. `availableKeys` is capped, and without this a 10,000-key
19
+ * store answered a wrong path with 50 names and no sign there were more — so an agent reading it
20
+ * concludes the key it wants does not exist, when it is simply key 51. That reads as the strongest
21
+ * possible negative signal and it is a false one, which is the precise failure this near-miss
22
+ * payload was added to prevent.
23
+ */
24
+ totalKeys?: number;
14
25
  }
15
- /** Walk `path` (e.g. "captionCache.v3.0.text") into `root`. Empty path returns root unchanged. */
26
+ /**
27
+ * Walk `path` (e.g. "captionCache.v3.0.text") into `root`. Empty path returns root unchanged.
28
+ * Segments are own keys, canonical array indices, Map keys, or `length` on an array/string.
29
+ */
16
30
  export declare function selectPath(root: unknown, path: string): PathSelection;
17
31
  /**
18
32
  * Prune `value` to `maxDepth` levels: objects/arrays deeper than the budget collapse to a compact
@@ -20,3 +34,11 @@ export declare function selectPath(root: unknown, path: string): PathSelection;
20
34
  * budget means "no cap".
21
35
  */
22
36
  export declare function capDepth(value: unknown, maxDepth: number): unknown;
37
+ /**
38
+ * Project a component-state read down to what an agent can act on: the hook VALUES. Effect entries
39
+ * are dropped (see `EFFECT_HOOK_KEYS`); everything else — useState values, useRef, and the
40
+ * `[value, deps]` tuple of useMemo/useCallback — is passed through untouched, because React exposes
41
+ * no hook KINDS here and a two-element state value is indistinguishable from a memo tuple.
42
+ * A non-conforming value (no `hooks` array) is returned unchanged.
43
+ */
44
+ export declare function projectComponentState(result: unknown): unknown;
@@ -1,35 +1,73 @@
1
1
  /**
2
- * reticle_state path selection + depth capping — pure, shared by the browser SDK (which applies them
2
+ * reticle_state output projection — pure, shared by the browser SDK (which applies them
3
3
  * BEFORE the transport so a scoped read of a huge store isn't truncated) and the server (back-compat
4
4
  * fallback when an older browser returns the whole store). `selectPath` walks a dot-path (with numeric
5
5
  * array indices) and, on a miss, returns the keys that WERE available at the last good level so a wrong
6
6
  * path is diagnosable rather than a bare null. `capDepth` prunes deeply-nested values to a budget.
7
+ * `projectComponentState` strips React fiber plumbing (effect chains) from a component hook read.
7
8
  */
8
9
  /** Cap on how many near-miss keys travel in a failed selection — a 10k-key store must not return a
9
10
  * 10k-entry array in the error payload (that was the token blowup the near-miss exists to avoid). */
10
11
  const MAX_AVAILABLE_KEYS = 50;
12
+ /**
13
+ * The ONLY intrinsic (non-own) property a path segment may select, and only on an array or a string.
14
+ * `todos.length` is the tool's own shipped example, so it has to resolve — but a path walks UNTRUSTED
15
+ * app state, so this stays a closed one-name set rather than a general property read: anything wider
16
+ * puts `constructor`/`__proto__`/`toString` (and every array method) back on the path grammar.
17
+ */
18
+ const LENGTH_SEGMENT = 'length';
19
+ /** True where `LENGTH_SEGMENT` is a real, meaningful count — arrays and strings, nothing else. */
20
+ function hasIntrinsicLength(value) {
21
+ return Array.isArray(value) || 'string' === typeof value;
22
+ }
23
+ /** The keys at a level, as a bounded sample plus the true count when the sample is short. */
11
24
  function keysOf(value) {
12
- if (Array.isArray(value))
13
- return value.slice(0, MAX_AVAILABLE_KEYS).map((_, i) => String(i));
25
+ if (Array.isArray(value)) {
26
+ // `length` is listed because it IS selectable here — answering `["First task"]` with just `["0"]`
27
+ // sent someone who mistyped `length` looking for a key that does not exist.
28
+ const indices = value.slice(0, MAX_AVAILABLE_KEYS - 1).map((_, i) => String(i));
29
+ return { keys: [...indices, LENGTH_SEGMENT], total: value.length + 1 };
30
+ }
31
+ if ('string' === typeof value)
32
+ return { keys: [LENGTH_SEGMENT], total: 1 };
14
33
  if (value instanceof Map) {
15
- const out = [];
34
+ const keys = [];
35
+ let total = 0;
16
36
  for (const k of value.keys()) {
17
- if (typeof k === 'string')
18
- out.push(k);
19
- if (out.length >= MAX_AVAILABLE_KEYS)
20
- break;
37
+ total += 1;
38
+ if ('string' === typeof k && keys.length < MAX_AVAILABLE_KEYS)
39
+ keys.push(k);
21
40
  }
22
- return out;
41
+ return { keys, total };
42
+ }
43
+ if ('object' === typeof value && value !== null) {
44
+ const all = Object.keys(value);
45
+ return { keys: all.slice(0, MAX_AVAILABLE_KEYS), total: all.length };
23
46
  }
24
- if (typeof value === 'object' && value !== null)
25
- return Object.keys(value).slice(0, MAX_AVAILABLE_KEYS);
26
- return [];
47
+ return { keys: [], total: 0 };
27
48
  }
28
- /** Walk `path` (e.g. "captionCache.v3.0.text") into `root`. Empty path returns root unchanged. */
49
+ /** A miss, with the sample of keys available where it stopped and the count when that sample is cut. */
50
+ function miss(value) {
51
+ const { keys, total } = keysOf(value);
52
+ return {
53
+ found: false,
54
+ value: null,
55
+ availableKeys: keys,
56
+ ...(total > keys.length ? { totalKeys: total } : {}),
57
+ };
58
+ }
59
+ /**
60
+ * Walk `path` (e.g. "captionCache.v3.0.text") into `root`. Empty path returns root unchanged.
61
+ * Segments are own keys, canonical array indices, Map keys, or `length` on an array/string.
62
+ */
29
63
  export function selectPath(root, path) {
30
64
  const segments = path.split('.').filter((s) => s.length > 0);
31
65
  let current = root;
32
66
  for (const segment of segments) {
67
+ if (LENGTH_SEGMENT === segment && hasIntrinsicLength(current)) {
68
+ current = current.length;
69
+ continue;
70
+ }
33
71
  if (Array.isArray(current)) {
34
72
  // Require a CANONICAL index string. `Number('01')`/`Number('1e0')`/`Number(' 1')` all coerce to 1,
35
73
  // so `items.01` silently read index 1 — an assertion on a path that doesn't exist quietly passed.
@@ -39,7 +77,7 @@ export function selectPath(root, path) {
39
77
  index < 0 ||
40
78
  String(index) !== segment ||
41
79
  index >= current.length) {
42
- return { found: false, value: null, availableKeys: keysOf(current) };
80
+ return miss(current);
43
81
  }
44
82
  current = current[index];
45
83
  continue;
@@ -49,17 +87,17 @@ export function selectPath(root, path) {
49
87
  current = current.get(segment);
50
88
  continue;
51
89
  }
52
- return { found: false, value: null, availableKeys: keysOf(current) };
90
+ return miss(current);
53
91
  }
54
92
  // `Object.hasOwn`, not `in`: `in` walks the prototype, so a path segment of `constructor`,
55
93
  // `__proto__`, or `toString` reported found:true and returned a function from Object.prototype —
56
94
  // a state assertion on a typo'd path silently passed against a builtin instead of failing with
57
95
  // availableKeys. Only an OWN key is a real state path.
58
- if (typeof current === 'object' && current !== null && Object.hasOwn(current, segment)) {
96
+ if ('object' === typeof current && current !== null && Object.hasOwn(current, segment)) {
59
97
  current = current[segment];
60
98
  continue;
61
99
  }
62
- return { found: false, value: null, availableKeys: keysOf(current) };
100
+ return miss(current);
63
101
  }
64
102
  return { found: true, value: current };
65
103
  }
@@ -74,12 +112,12 @@ export function capDepth(value, maxDepth) {
74
112
  if (value instanceof Date)
75
113
  return Number.isNaN(value.getTime()) ? null : value.toISOString();
76
114
  if (value instanceof Set) {
77
- if (maxDepth === 0)
115
+ if (0 === maxDepth)
78
116
  return `[Set(${String(value.size)})]`;
79
117
  return [...value].map((v) => capDepth(v, maxDepth - 1));
80
118
  }
81
119
  if (value instanceof Map) {
82
- if (maxDepth === 0)
120
+ if (0 === maxDepth)
83
121
  return `{Map(${String(value.size)})}`;
84
122
  const out = Object.create(null);
85
123
  for (const [k, v] of value)
@@ -87,13 +125,13 @@ export function capDepth(value, maxDepth) {
87
125
  return out;
88
126
  }
89
127
  if (Array.isArray(value)) {
90
- if (maxDepth === 0)
128
+ if (0 === maxDepth)
91
129
  return `[Array(${String(value.length)})]`;
92
130
  return value.map((v) => capDepth(v, maxDepth - 1));
93
131
  }
94
- if (typeof value === 'object' && value !== null) {
132
+ if ('object' === typeof value && value !== null) {
95
133
  const keys = Object.keys(value);
96
- if (maxDepth === 0)
134
+ if (0 === maxDepth)
97
135
  return `{…${String(keys.length)} keys}`;
98
136
  // Null-proto target: a wire object can carry an own `__proto__` key (via JSON.parse), and
99
137
  // `out['__proto__'] = …` on a normal object writes the prototype slot instead of a key, losing
@@ -105,3 +143,45 @@ export function capDepth(value, maxDepth) {
105
143
  }
106
144
  return value;
107
145
  }
146
+ /**
147
+ * Keys a React effect hook's `memoizedState` can carry once sanitized: `create`/`destroy` are
148
+ * functions (already nulled), `deps` re-states values the value-hooks above it already carry, and
149
+ * `next` chains the WHOLE effect list into every effect entry — so N effects cost O(N^2) of nulls.
150
+ * React 18 uses `destroy`, React 19 wraps it in `inst`; both are listed so either version matches.
151
+ */
152
+ const EFFECT_HOOK_KEYS = new Set(['tag', 'create', 'destroy', 'deps', 'inst', 'next']);
153
+ /** Disclosure text for a projected hook list — a trim is never silent. */
154
+ const HOOKS_PROJECTED_NOTE = 'projected — effect hook(s) dropped (create/destroy are functions, deps duplicate the state values, and each entry re-chains the whole effect list). Every state/memo/ref hook value is unchanged.';
155
+ /** True for a sanitized React effect object — internals with no value an agent can act on. */
156
+ function isEffectHook(value) {
157
+ if ('object' !== typeof value || null === value || Array.isArray(value))
158
+ return false;
159
+ const keys = Object.keys(value);
160
+ if (!keys.includes('tag') || !keys.includes('deps') || !keys.includes('next'))
161
+ return false;
162
+ if ('number' !== typeof value.tag)
163
+ return false;
164
+ return keys.every((k) => EFFECT_HOOK_KEYS.has(k));
165
+ }
166
+ /**
167
+ * Project a component-state read down to what an agent can act on: the hook VALUES. Effect entries
168
+ * are dropped (see `EFFECT_HOOK_KEYS`); everything else — useState values, useRef, and the
169
+ * `[value, deps]` tuple of useMemo/useCallback — is passed through untouched, because React exposes
170
+ * no hook KINDS here and a two-element state value is indistinguishable from a memo tuple.
171
+ * A non-conforming value (no `hooks` array) is returned unchanged.
172
+ */
173
+ export function projectComponentState(result) {
174
+ if ('object' !== typeof result || null === result)
175
+ return result;
176
+ const hooks = result.hooks;
177
+ if (!Array.isArray(hooks))
178
+ return result;
179
+ const kept = hooks.filter((h) => !isEffectHook(h));
180
+ if (kept.length === hooks.length)
181
+ return result;
182
+ return {
183
+ ...result,
184
+ hooks: kept,
185
+ truncation: { droppedItems: hooks.length - kept.length, note: HOOKS_PROJECTED_NOTE },
186
+ };
187
+ }
@@ -67,6 +67,28 @@ export declare const BrowserEngine: {
67
67
  readonly WEBKIT: "webkit";
68
68
  };
69
69
  export type BrowserEngine = (typeof BrowserEngine)[keyof typeof BrowserEngine];
70
+ /**
71
+ * The browser BRAND behind the connected page — the axis `engine` cannot answer.
72
+ *
73
+ * Chrome, Edge, Arc, Dia, Brave and Opera are all `blink`, and the most common mode by far is
74
+ * `attached`: Reticle launched nothing, so the page itself is the only thing that knows which
75
+ * browser it is. A CLOSED list on purpose — the raw UA string and a raw `userAgentData` brand are
76
+ * both unbounded and fingerprintable, so anything unrecognised reports `OTHER` rather than
77
+ * forwarding a name we have never seen.
78
+ */
79
+ export declare const BrowserBrand: {
80
+ readonly CHROME: "chrome";
81
+ readonly EDGE: "edge";
82
+ readonly ARC: "arc";
83
+ readonly DIA: "dia";
84
+ readonly BRAVE: "brave";
85
+ readonly OPERA: "opera";
86
+ readonly FIREFOX: "firefox";
87
+ readonly SAFARI: "safari";
88
+ /** Anything we do not recognise — including a Chromium that names no brand at all. */
89
+ readonly OTHER: "other";
90
+ };
91
+ export type BrowserBrand = (typeof BrowserBrand)[keyof typeof BrowserBrand];
70
92
  /** How Reticle reaches the page: a driven CDP browser, or the SDK inside the human's own browser. */
71
93
  export declare const PageDriver: {
72
94
  readonly CDP: "cdp";
@@ -196,39 +218,39 @@ export declare const FeedbackSchema: z.ZodObject<{
196
218
  }, "strip", z.ZodTypeAny, {
197
219
  text: string;
198
220
  kind: "bug" | "gap" | "ambiguity" | "feature_request" | "improvement" | "experience";
199
- source: "human" | "agent";
200
- model?: string | undefined;
201
- stack?: string | undefined;
202
- stackMajor?: number | undefined;
221
+ source: "agent" | "human";
203
222
  trace?: string | undefined;
204
223
  rating?: number | undefined;
205
224
  need?: string | undefined;
206
225
  impact?: string | undefined;
207
226
  currentApproach?: string | undefined;
227
+ model?: string | undefined;
208
228
  clientVersion?: string | undefined;
229
+ stack?: string | undefined;
230
+ stackMajor?: number | undefined;
209
231
  runtime?: "web" | "electron" | "tauri" | undefined;
210
232
  engine?: "blink" | "gecko" | "webkit" | undefined;
211
233
  driver?: "cdp" | "sdk" | undefined;
212
234
  client?: string | undefined;
213
- mcpScope?: "project" | "user" | undefined;
235
+ mcpScope?: "user" | "project" | undefined;
214
236
  }, {
215
237
  text: string;
216
238
  kind: "bug" | "gap" | "ambiguity" | "feature_request" | "improvement" | "experience";
217
- source: "human" | "agent";
218
- model?: string | undefined;
219
- stack?: string | undefined;
220
- stackMajor?: number | undefined;
239
+ source: "agent" | "human";
221
240
  trace?: string | undefined;
222
241
  rating?: number | undefined;
223
242
  need?: string | undefined;
224
243
  impact?: string | undefined;
225
244
  currentApproach?: string | undefined;
245
+ model?: string | undefined;
226
246
  clientVersion?: string | undefined;
247
+ stack?: string | undefined;
248
+ stackMajor?: number | undefined;
227
249
  runtime?: "web" | "electron" | "tauri" | undefined;
228
250
  engine?: "blink" | "gecko" | "webkit" | undefined;
229
251
  driver?: "cdp" | "sdk" | undefined;
230
252
  client?: string | undefined;
231
- mcpScope?: "project" | "user" | undefined;
253
+ mcpScope?: "user" | "project" | undefined;
232
254
  }>;
233
255
  export type Feedback = z.infer<typeof FeedbackSchema>;
234
256
  /** What Reticle is being used for. Self-declared; never inferred. */
@@ -63,6 +63,27 @@ export const BrowserEngine = {
63
63
  GECKO: 'gecko',
64
64
  WEBKIT: 'webkit',
65
65
  };
66
+ /**
67
+ * The browser BRAND behind the connected page — the axis `engine` cannot answer.
68
+ *
69
+ * Chrome, Edge, Arc, Dia, Brave and Opera are all `blink`, and the most common mode by far is
70
+ * `attached`: Reticle launched nothing, so the page itself is the only thing that knows which
71
+ * browser it is. A CLOSED list on purpose — the raw UA string and a raw `userAgentData` brand are
72
+ * both unbounded and fingerprintable, so anything unrecognised reports `OTHER` rather than
73
+ * forwarding a name we have never seen.
74
+ */
75
+ export const BrowserBrand = {
76
+ CHROME: 'chrome',
77
+ EDGE: 'edge',
78
+ ARC: 'arc',
79
+ DIA: 'dia',
80
+ BRAVE: 'brave',
81
+ OPERA: 'opera',
82
+ FIREFOX: 'firefox',
83
+ SAFARI: 'safari',
84
+ /** Anything we do not recognise — including a Chromium that names no brand at all. */
85
+ OTHER: 'other',
86
+ };
66
87
  /** How Reticle reaches the page: a driven CDP browser, or the SDK inside the human's own browser. */
67
88
  export const PageDriver = {
68
89
  CDP: 'cdp',
@@ -289,6 +289,30 @@ export declare const SessionSummarySchema: z.ZodObject<{
289
289
  peakConcurrentTools: z.ZodOptional<z.ZodNumber>;
290
290
  /** Calls for a tool name that does not exist. A non-zero value means our surface is confusing. */
291
291
  unknownToolCalls: z.ZodOptional<z.ZodNumber>;
292
+ /**
293
+ * Tool calls that failed because there was no app to reach — no session connected, no session by
294
+ * that id, or several with none named.
295
+ *
296
+ * The single biggest drop-off in the funnel, and it used to be reachable only by unpacking
297
+ * `errors[]` in HogQL. 74% of daemons never call a tool at all, and of the sessions that made
298
+ * exactly one call, most bounced on precisely this. Absent when it never happened, so the field's
299
+ * PRESENCE is the signal.
300
+ */
301
+ noSessionErrors: z.ZodOptional<z.ZodNumber>;
302
+ /**
303
+ * Longest back-to-back run per tool name — the shape of a retry loop.
304
+ *
305
+ * `toolCounts` reports five useful calls and five retries of one failing call identically, and
306
+ * those are opposite facts: engagement versus an agent stuck. Only tools actually repeated appear.
307
+ */
308
+ consecutiveRepeats: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
309
+ /**
310
+ * Actions driven with no verdict after them — the signature of the loop breaking mid-task.
311
+ *
312
+ * An agent that acts and then verifies is the product working; one that acts and wanders off has
313
+ * either given up or lost the thread, and nothing distinguished the two before.
314
+ */
315
+ abandonedActions: z.ZodOptional<z.ZodNumber>;
292
316
  /** The machine at shutdown — was it starved while all this was happening? */
293
317
  machine: z.ZodOptional<z.ZodObject<{
294
318
  /** Resident set size of the daemon itself — our footprint, the one we can actually fix. */
@@ -356,6 +380,9 @@ export declare const SessionSummarySchema: z.ZodObject<{
356
380
  browserCommands?: number | undefined;
357
381
  peakConcurrentTools?: number | undefined;
358
382
  unknownToolCalls?: number | undefined;
383
+ noSessionErrors?: number | undefined;
384
+ consecutiveRepeats?: Record<string, number> | undefined;
385
+ abandonedActions?: number | undefined;
359
386
  machine?: {
360
387
  rssMb: number;
361
388
  heapUsedMb: number;
@@ -402,6 +429,9 @@ export declare const SessionSummarySchema: z.ZodObject<{
402
429
  browserCommands?: number | undefined;
403
430
  peakConcurrentTools?: number | undefined;
404
431
  unknownToolCalls?: number | undefined;
432
+ noSessionErrors?: number | undefined;
433
+ consecutiveRepeats?: Record<string, number> | undefined;
434
+ abandonedActions?: number | undefined;
405
435
  machine?: {
406
436
  rssMb: number;
407
437
  heapUsedMb: number;
@@ -182,6 +182,30 @@ export const SessionSummarySchema = z.object({
182
182
  peakConcurrentTools: z.number().int().nonnegative().optional(),
183
183
  /** Calls for a tool name that does not exist. A non-zero value means our surface is confusing. */
184
184
  unknownToolCalls: z.number().int().nonnegative().optional(),
185
+ /**
186
+ * Tool calls that failed because there was no app to reach — no session connected, no session by
187
+ * that id, or several with none named.
188
+ *
189
+ * The single biggest drop-off in the funnel, and it used to be reachable only by unpacking
190
+ * `errors[]` in HogQL. 74% of daemons never call a tool at all, and of the sessions that made
191
+ * exactly one call, most bounced on precisely this. Absent when it never happened, so the field's
192
+ * PRESENCE is the signal.
193
+ */
194
+ noSessionErrors: z.number().int().nonnegative().optional(),
195
+ /**
196
+ * Longest back-to-back run per tool name — the shape of a retry loop.
197
+ *
198
+ * `toolCounts` reports five useful calls and five retries of one failing call identically, and
199
+ * those are opposite facts: engagement versus an agent stuck. Only tools actually repeated appear.
200
+ */
201
+ consecutiveRepeats: z.record(z.number().int().positive()).optional(),
202
+ /**
203
+ * Actions driven with no verdict after them — the signature of the loop breaking mid-task.
204
+ *
205
+ * An agent that acts and then verifies is the product working; one that acts and wanders off has
206
+ * either given up or lost the thread, and nothing distinguished the two before.
207
+ */
208
+ abandonedActions: z.number().int().nonnegative().optional(),
185
209
  /** The machine at shutdown — was it starved while all this was happening? */
186
210
  machine: MachineSnapshotSchema.optional(),
187
211
  /** Distinct MCP clients seen (`claude-code`, `cursor`), so multi-agent use is visible. */