@reticlehq/core 3.3.0 → 3.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 (48) hide show
  1. package/README.md +1 -1
  2. package/dist/artifacts/flow-constants.d.ts +19 -0
  3. package/dist/artifacts/flow-constants.js +36 -1
  4. package/dist/artifacts/flow-expect-flat.d.ts +16 -16
  5. package/dist/artifacts/flow-expect-flat.js +2 -2
  6. package/dist/artifacts/flow-mutation-target.js +4 -0
  7. package/dist/artifacts/flow-types.d.ts +393 -297
  8. package/dist/artifacts/flow-types.js +17 -2
  9. package/dist/artifacts/journal.d.ts +3 -2
  10. package/dist/hooks/hook-events.d.ts +4 -4
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +1 -0
  13. package/dist/registry/daemon-registry.d.ts +14 -4
  14. package/dist/registry/daemon-registry.js +20 -4
  15. package/dist/schema/event-payloads.json +3 -0
  16. package/dist/telemetry-refusal.d.ts +3 -2
  17. package/dist/telemetry.d.ts +17 -16
  18. package/dist/telemetry.js +3 -3
  19. package/dist/verdict/compare-source.d.ts +80 -0
  20. package/dist/verdict/compare-source.js +93 -0
  21. package/dist/verdict/consequence.d.ts +2 -0
  22. package/dist/verdict/consequence.js +2 -0
  23. package/dist/verdict/instrumentation-gap.js +1 -1
  24. package/dist/verdict/intent.d.ts +12 -12
  25. package/dist/verdict/predicate-tree.d.ts +35 -0
  26. package/dist/verdict/predicate-tree.js +40 -0
  27. package/dist/verdict/predicate.d.ts +11 -2
  28. package/dist/verdict/predicate.js +38 -2
  29. package/dist/verdict/verification-run.d.ts +261 -28
  30. package/dist/verdict/verification-run.js +36 -0
  31. package/dist/wire/channel.d.ts +10 -0
  32. package/dist/wire/channel.js +25 -0
  33. package/dist/wire/constants/constants.d.ts +45 -5
  34. package/dist/wire/constants/constants.js +57 -5
  35. package/dist/wire/event-payloads.d.ts +12 -9
  36. package/dist/wire/event-payloads.js +8 -3
  37. package/dist/wire/messages.d.ts +24 -24
  38. package/dist/wire/net.d.ts +17 -0
  39. package/dist/wire/net.js +17 -0
  40. package/dist/wire/redaction.js +17 -0
  41. package/dist/wire/toon.d.ts +1 -1
  42. package/dist/wire/toon.js +2 -1
  43. package/dist/wire/types.d.ts +44 -44
  44. package/dist/words/no-session-reason.d.ts +7 -0
  45. package/dist/words/no-session-reason.js +7 -0
  46. package/dist/words/notices.d.ts +7 -0
  47. package/dist/words/notices.js +9 -2
  48. package/package.json +3 -2
@@ -30,6 +30,13 @@ export declare const MCP_SERVER_NAME = "reticle";
30
30
  export declare const MCP_SHUTDOWN_EVENT = "reticle-shutdown";
31
31
  /** Local-only daemon introspection — `reticle status` GETs this for sessions + health at a glance. */
32
32
  export declare const STATUS_PATH = "/status";
33
+ /**
34
+ * Query flag on STATUS_PATH: the caller (a running `reticle init`) is waiting on this daemon, so it
35
+ * must not idle out yet. Without it the daemon init started exited mid-wait on a slow desktop build.
36
+ */
37
+ export declare const STATUS_HOLD_QUERY = "hold";
38
+ /** How long one hold lasts. The holder renews it well inside this window for as long as it waits. */
39
+ export declare const STATUS_HOLD_MS = 60000;
33
40
  /**
34
41
  * Local-only drive request — `reticle drive <url>` POSTs `{url}` here when a daemon already owns the
35
42
  * bridge port, and gets back the pooled session that daemon opened. The CLI asks instead of binding,
@@ -212,7 +219,10 @@ export declare const ReticleEnv: {
212
219
  readonly API_KEY: "RETICLE_API_KEY";
213
220
  /** The name this key had until 2026-09. Still honoured; see `apiKeyFrom()`. */
214
221
  readonly CLOUD_KEY: "RETICLE_CLOUD_KEY";
222
+ /** The platform host. Read through `cloudUrlFrom()`, which also accepts `URL`. */
215
223
  readonly CLOUD_URL: "RETICLE_CLOUD_URL";
224
+ /** The short name for `CLOUD_URL`, which people type first. `CLOUD_URL` wins when both are set. */
225
+ readonly URL: "RETICLE_URL";
216
226
  };
217
227
  /**
218
228
  * The platform API key, whichever name it arrives under.
@@ -231,6 +241,34 @@ export declare const ReticleEnv: {
231
241
  * works before removing the old.
232
242
  */
233
243
  export declare function apiKeyFrom(env: Record<string, string | undefined>): string | undefined;
244
+ /** The platform URL, under either name — one function so no caller forgets the second. */
245
+ export declare function cloudUrlFrom(env: Record<string, string | undefined>): string | undefined;
246
+ /** The hosted platform: where every client dials when nothing names another host. */
247
+ export declare const DEFAULT_PLATFORM_URL = "https://app.reticle.sh";
248
+ /** The platform URL from the environment, else the hosted service. No trailing slash. */
249
+ export declare function platformUrlFrom(env: Record<string, string | undefined>): string;
250
+ /**
251
+ * The platform credential the environment carries, or undefined when it carries no key.
252
+ *
253
+ * The key alone is enough: the URL falls back to the hosted service. Every reader of the env key
254
+ * goes through here, because each of them used to demand a URL as well, and a CI job that set only
255
+ * the key — which is what the platform tells it to do — silently reached nothing.
256
+ */
257
+ export declare function platformCredentialFrom(env: Record<string, string | undefined>): {
258
+ url: string;
259
+ apiKey: string;
260
+ } | undefined;
261
+ /**
262
+ * How many runs one `POST /v1/sync` may carry, by count and by serialized size.
263
+ *
264
+ * One request used to carry every unsent run, so a backlog bigger than the platform's body limit
265
+ * was refused whole, offered again next cycle, and never caught up. The byte bound sits well under
266
+ * that limit because flows, capsules and derived records ride in the first request too.
267
+ */
268
+ export declare const SYNC_BATCH_LIMITS: {
269
+ readonly MAX_RUNS: 50;
270
+ readonly MAX_BYTES: number;
271
+ };
234
272
  /** Hard transport bounds shared by the browser and bridge. */
235
273
  export declare const TRANSPORT_LIMITS: {
236
274
  readonly MAX_MESSAGE_BYTES: number;
@@ -360,6 +398,8 @@ export declare const ReticleDir: {
360
398
  readonly AMBIENT_FILE: "ambient.json";
361
399
  /** per-flow flake ledger — replay outcomes that decide intermittent-failure quarantine. */
362
400
  readonly FLAKE_FILE: "flake.json";
401
+ /** The app-wide coverage ledger — see server features/exhaust/ledger.ts. */
402
+ readonly COVERAGE_FILE: "coverage.json";
363
403
  /**
364
404
  * the project's cloud binding — .reticle/cloud.json, written by `reticle link`. Git-checked and
365
405
  * non-secret: the project id, the API origin, and where its dashboard lives. The KEY lives in
@@ -658,7 +698,6 @@ export declare const ActionType: {
658
698
  * merely looks like zoom would report it caught while the layout viewport never changed.
659
699
  */
660
700
  readonly ZOOM: "zoom";
661
- readonly WEBMCP: "webmcp";
662
701
  };
663
702
  export type ActionType = (typeof ActionType)[keyof typeof ActionType];
664
703
  /** Why an action's settle wait ended without a real animation frame. */
@@ -701,14 +740,15 @@ export declare const ElementState: {
701
740
  readonly DISABLED: "disabled";
702
741
  readonly CHECKED: "checked";
703
742
  readonly EXPANDED: "expanded";
743
+ readonly PRESSED: "pressed";
704
744
  readonly FOCUSED: "focused";
705
745
  readonly PRESENT: "present";
706
746
  /**
707
747
  * Inside the viewport right now (getBoundingClientRect intersects the window). Distinct from
708
- * `visible`, which folds only aria-hidden/[hidden]/display/visibility/opacity and so is already
709
- * true for content below the fold of a scrolling container. Without this, `scrollIntoView` is
710
- * ungradeable: the target satisfied `visible`/`present` before the scroll, so act_and_wait
711
- * returns already_true. (#398)
748
+ * `visible`, which folds only aria-hidden/[hidden]/display/visibility/opacity and a closed
749
+ * `<details>` ancestor, and so is already true for content below the fold of a scrolling
750
+ * container. Without this, `scrollIntoView` is ungradeable: the target satisfied
751
+ * `visible`/`present` before the scroll, so act_and_wait returns already_true. (#398)
712
752
  */
713
753
  readonly IN_VIEWPORT: "inViewport";
714
754
  };
@@ -30,6 +30,13 @@ export const MCP_SERVER_NAME = 'reticle';
30
30
  export const MCP_SHUTDOWN_EVENT = 'reticle-shutdown';
31
31
  /** Local-only daemon introspection — `reticle status` GETs this for sessions + health at a glance. */
32
32
  export const STATUS_PATH = '/status';
33
+ /**
34
+ * Query flag on STATUS_PATH: the caller (a running `reticle init`) is waiting on this daemon, so it
35
+ * must not idle out yet. Without it the daemon init started exited mid-wait on a slow desktop build.
36
+ */
37
+ export const STATUS_HOLD_QUERY = 'hold';
38
+ /** How long one hold lasts. The holder renews it well inside this window for as long as it waits. */
39
+ export const STATUS_HOLD_MS = 60_000;
33
40
  /**
34
41
  * Local-only drive request — `reticle drive <url>` POSTs `{url}` here when a daemon already owns the
35
42
  * bridge port, and gets back the pooled session that daemon opened. The CLI asks instead of binding,
@@ -214,7 +221,10 @@ export const ReticleEnv = {
214
221
  API_KEY: 'RETICLE_API_KEY',
215
222
  /** The name this key had until 2026-09. Still honoured; see `apiKeyFrom()`. */
216
223
  CLOUD_KEY: 'RETICLE_CLOUD_KEY',
224
+ /** The platform host. Read through `cloudUrlFrom()`, which also accepts `URL`. */
217
225
  CLOUD_URL: 'RETICLE_CLOUD_URL',
226
+ /** The short name for `CLOUD_URL`, which people type first. `CLOUD_URL` wins when both are set. */
227
+ URL: 'RETICLE_URL',
218
228
  };
219
229
  /**
220
230
  * The platform API key, whichever name it arrives under.
@@ -239,6 +249,46 @@ export function apiKeyFrom(env) {
239
249
  const legacy = env[ReticleEnv.CLOUD_KEY];
240
250
  return legacy !== undefined && 0 < legacy.length ? legacy : undefined;
241
251
  }
252
+ /** The platform URL, under either name — one function so no caller forgets the second. */
253
+ export function cloudUrlFrom(env) {
254
+ const canonical = env[ReticleEnv.CLOUD_URL];
255
+ if (canonical !== undefined && 0 < canonical.length)
256
+ return canonical;
257
+ const short = env[ReticleEnv.URL];
258
+ return short !== undefined && 0 < short.length ? short : undefined;
259
+ }
260
+ /** The hosted platform: where every client dials when nothing names another host. */
261
+ export const DEFAULT_PLATFORM_URL = 'https://app.reticle.sh';
262
+ /** The platform URL from the environment, else the hosted service. No trailing slash. */
263
+ export function platformUrlFrom(env) {
264
+ // A loop, not /\/+$/: that pattern is polynomial on a value made of many slashes.
265
+ let url = cloudUrlFrom(env) ?? DEFAULT_PLATFORM_URL;
266
+ while (url.endsWith('/'))
267
+ url = url.slice(0, -1);
268
+ return url;
269
+ }
270
+ /**
271
+ * The platform credential the environment carries, or undefined when it carries no key.
272
+ *
273
+ * The key alone is enough: the URL falls back to the hosted service. Every reader of the env key
274
+ * goes through here, because each of them used to demand a URL as well, and a CI job that set only
275
+ * the key — which is what the platform tells it to do — silently reached nothing.
276
+ */
277
+ export function platformCredentialFrom(env) {
278
+ const apiKey = apiKeyFrom(env);
279
+ return apiKey === undefined ? undefined : { url: platformUrlFrom(env), apiKey };
280
+ }
281
+ /**
282
+ * How many runs one `POST /v1/sync` may carry, by count and by serialized size.
283
+ *
284
+ * One request used to carry every unsent run, so a backlog bigger than the platform's body limit
285
+ * was refused whole, offered again next cycle, and never caught up. The byte bound sits well under
286
+ * that limit because flows, capsules and derived records ride in the first request too.
287
+ */
288
+ export const SYNC_BATCH_LIMITS = {
289
+ MAX_RUNS: 50,
290
+ MAX_BYTES: 4 * 1024 * 1024,
291
+ };
242
292
  /** Hard transport bounds shared by the browser and bridge. */
243
293
  export const TRANSPORT_LIMITS = {
244
294
  MAX_MESSAGE_BYTES: 1024 * 1024,
@@ -382,6 +432,8 @@ export const ReticleDir = {
382
432
  AMBIENT_FILE: 'ambient.json',
383
433
  /** per-flow flake ledger — replay outcomes that decide intermittent-failure quarantine. */
384
434
  FLAKE_FILE: 'flake.json',
435
+ /** The app-wide coverage ledger — see server features/exhaust/ledger.ts. */
436
+ COVERAGE_FILE: 'coverage.json',
385
437
  /**
386
438
  * the project's cloud binding — .reticle/cloud.json, written by `reticle link`. Git-checked and
387
439
  * non-secret: the project id, the API origin, and where its dashboard lives. The KEY lives in
@@ -687,7 +739,6 @@ export const ActionType = {
687
739
  * merely looks like zoom would report it caught while the layout viewport never changed.
688
740
  */
689
741
  ZOOM: 'zoom',
690
- WEBMCP: 'webmcp',
691
742
  };
692
743
  /** Why an action's settle wait ended without a real animation frame. */
693
744
  export const SettleReason = {
@@ -706,14 +757,15 @@ export const ElementState = {
706
757
  DISABLED: 'disabled',
707
758
  CHECKED: 'checked',
708
759
  EXPANDED: 'expanded',
760
+ PRESSED: 'pressed',
709
761
  FOCUSED: 'focused',
710
762
  PRESENT: 'present',
711
763
  /**
712
764
  * Inside the viewport right now (getBoundingClientRect intersects the window). Distinct from
713
- * `visible`, which folds only aria-hidden/[hidden]/display/visibility/opacity and so is already
714
- * true for content below the fold of a scrolling container. Without this, `scrollIntoView` is
715
- * ungradeable: the target satisfied `visible`/`present` before the scroll, so act_and_wait
716
- * returns already_true. (#398)
765
+ * `visible`, which folds only aria-hidden/[hidden]/display/visibility/opacity and a closed
766
+ * `<details>` ancestor, and so is already true for content below the fold of a scrolling
767
+ * container. Without this, `scrollIntoView` is ungradeable: the target satisfied
768
+ * `visible`/`present` before the scroll, so act_and_wait returns already_true. (#398)
717
769
  */
718
770
  IN_VIEWPORT: 'inViewport',
719
771
  };
@@ -164,7 +164,7 @@ export declare const SeedStorageSchema: z.ZodObject<{
164
164
  sameSite?: "Strict" | "Lax" | "None" | undefined;
165
165
  expires?: number | undefined;
166
166
  }>, "many">]>>;
167
- }, "strip", z.ZodTypeAny, {
167
+ }, "strict", z.ZodTypeAny, {
168
168
  local?: Record<string, string> | undefined;
169
169
  session?: Record<string, string> | undefined;
170
170
  cookies?: Record<string, string> | {
@@ -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
+ nextAction: z.ZodOptional<z.ZodString>;
254
255
  requestShape: z.ZodOptional<z.ZodString>;
255
256
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
256
257
  id: z.ZodString;
@@ -261,6 +262,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
261
262
  durationMs: z.ZodNumber;
262
263
  initiator: z.ZodString;
263
264
  urlRaw: z.ZodOptional<z.ZodString>;
265
+ nextAction: z.ZodOptional<z.ZodString>;
264
266
  requestShape: z.ZodOptional<z.ZodString>;
265
267
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
266
268
  id: z.ZodString;
@@ -271,6 +273,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
271
273
  durationMs: z.ZodNumber;
272
274
  initiator: z.ZodString;
273
275
  urlRaw: z.ZodOptional<z.ZodString>;
276
+ nextAction: z.ZodOptional<z.ZodString>;
274
277
  requestShape: z.ZodOptional<z.ZodString>;
275
278
  }, z.ZodTypeAny, "passthrough">>;
276
279
  "net.pending": z.ZodObject<{
@@ -280,15 +283,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
280
283
  initiator: z.ZodString;
281
284
  urlRaw: z.ZodOptional<z.ZodString>;
282
285
  }, "strip", z.ZodTypeAny, {
283
- id: string;
284
286
  method: string;
285
287
  url: string;
288
+ id: string;
286
289
  initiator: string;
287
290
  urlRaw?: string | undefined;
288
291
  }, {
289
- id: string;
290
292
  method: string;
291
293
  url: string;
294
+ id: string;
292
295
  initiator: string;
293
296
  urlRaw?: string | undefined;
294
297
  }>;
@@ -714,14 +717,14 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
714
717
  value: z.ZodOptional<z.ZodString>;
715
718
  redacted: z.ZodOptional<z.ZodLiteral<true>>;
716
719
  }, "strip", z.ZodTypeAny, {
717
- length: number;
718
720
  kind: "input" | "change";
721
+ length: number;
719
722
  field: string;
720
723
  value?: string | undefined;
721
724
  redacted?: true | undefined;
722
725
  }, {
723
- length: number;
724
726
  kind: "input" | "change";
727
+ length: number;
725
728
  field: string;
726
729
  value?: string | undefined;
727
730
  redacted?: true | undefined;
@@ -847,21 +850,21 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
847
850
  }>>;
848
851
  route: z.ZodOptional<z.ZodString>;
849
852
  }, "strip", z.ZodTypeAny, {
850
- note: string;
851
853
  anchor: string;
854
+ note: string;
852
855
  strategy: "testid" | "role" | "component" | "position";
853
- label?: string | undefined;
854
856
  route?: string | undefined;
857
+ label?: string | undefined;
855
858
  source?: {
856
859
  file: string;
857
860
  line: number;
858
861
  } | undefined;
859
862
  }, {
860
- note: string;
861
863
  anchor: string;
864
+ note: string;
862
865
  strategy: "testid" | "role" | "component" | "position";
863
- label?: string | undefined;
864
866
  route?: string | undefined;
867
+ label?: string | undefined;
865
868
  source?: {
866
869
  file: string;
867
870
  line: number;
@@ -3,7 +3,7 @@ import { EventType, PerfMetric } from './constants/constants.js';
3
3
  import { BlindSpotKind } from '../verdict/verified-constants.js';
4
4
  import { BrowserBrand } from '../telemetry-feedback.js';
5
5
  import { HudUseDataSchema, HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
6
- import { REQUEST_SHAPE_FIELD } from './net.js';
6
+ import { NEXT_ACTION_FIELD, REQUEST_SHAPE_FIELD } from './net.js';
7
7
  /**
8
8
  * Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
9
9
  * The envelope (`ReticleEventSchema.data`) stays open on the wire so a richer SDK is never rejected
@@ -62,7 +62,8 @@ export const SeedCookiesSchema = z.union([z.record(z.string()), z.array(SeedCook
62
62
  * Client storage and session state to seed into an isolated context before the first navigation.
63
63
  * Matches the three storage areas Reticle already observes (localStorage, sessionStorage, cookies).
64
64
  */
65
- export const SeedStorageSchema = z.object({
65
+ export const SeedStorageSchema = z
66
+ .object({
66
67
  local: z
67
68
  .record(z.string())
68
69
  .optional()
@@ -72,7 +73,10 @@ export const SeedStorageSchema = z.object({
72
73
  .optional()
73
74
  .describe('Key-value pairs to seed into window.sessionStorage before first navigation.'),
74
75
  cookies: SeedCookiesSchema.optional().describe('Cookies to seed before first navigation: a name-value record scoped to the lease URL or an array of cookie objects.'),
75
- });
76
+ })
77
+ // Unknown keys (e.g. a typo'd `localStorage`, or a Playwright `storageState` shape) must be
78
+ // rejected, not silently dropped, or the caller believes seeding happened when nothing was seeded.
79
+ .strict();
76
80
  const elementLabel = z.object({ role: z.string().optional(), name: z.string().optional() });
77
81
  /**
78
82
  * A file the app produced. `preview`/`lines` are present only when body capture is on, for the same
@@ -105,6 +109,7 @@ const netRequestSchema = z
105
109
  durationMs: z.number(),
106
110
  initiator: z.string(),
107
111
  urlRaw: z.string().optional(),
112
+ [NEXT_ACTION_FIELD]: z.string().optional(),
108
113
  [REQUEST_SHAPE_FIELD]: z.string().optional(),
109
114
  })
110
115
  .passthrough();
@@ -92,21 +92,21 @@ export declare const HumanMarkDataSchema: z.ZodObject<{
92
92
  /** Route/URL the mark was made on, so the agent can reproduce the context. */
93
93
  route: z.ZodOptional<z.ZodString>;
94
94
  }, "strip", z.ZodTypeAny, {
95
- note: string;
96
95
  anchor: string;
96
+ note: string;
97
97
  strategy: "testid" | "role" | "component" | "position";
98
- label?: string | undefined;
99
98
  route?: string | undefined;
99
+ label?: string | undefined;
100
100
  source?: {
101
101
  file: string;
102
102
  line: number;
103
103
  } | undefined;
104
104
  }, {
105
- note: string;
106
105
  anchor: string;
106
+ note: string;
107
107
  strategy: "testid" | "role" | "component" | "position";
108
- label?: string | undefined;
109
108
  route?: string | undefined;
109
+ label?: string | undefined;
110
110
  source?: {
111
111
  file: string;
112
112
  line: number;
@@ -385,7 +385,7 @@ export declare const HelloMessageSchema: z.ZodObject<{
385
385
  projectId?: string | undefined;
386
386
  token?: string | undefined;
387
387
  platform?: "native" | "web" | "webview" | "service" | undefined;
388
- channels?: ("signal" | "visual" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
388
+ channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
389
389
  commands?: string[] | undefined;
390
390
  contractParts?: {
391
391
  events: string[];
@@ -408,7 +408,7 @@ export declare const HelloMessageSchema: z.ZodObject<{
408
408
  projectId?: string | undefined;
409
409
  token?: string | undefined;
410
410
  platform?: "native" | "web" | "webview" | "service" | undefined;
411
- channels?: ("signal" | "visual" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
411
+ channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
412
412
  commands?: string[] | undefined;
413
413
  contractParts?: {
414
414
  events: string[];
@@ -431,15 +431,15 @@ export declare const CommandMessageSchema: z.ZodObject<{
431
431
  name: z.ZodString;
432
432
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
433
433
  }, "strip", z.ZodTypeAny, {
434
- id: string;
435
- name: string;
436
434
  kind: "command";
435
+ name: string;
436
+ id: string;
437
437
  args: Record<string, unknown>;
438
438
  sessionId?: string | undefined;
439
439
  }, {
440
- id: string;
441
- name: string;
442
440
  kind: "command";
441
+ name: string;
442
+ id: string;
443
443
  args?: Record<string, unknown> | undefined;
444
444
  sessionId?: string | undefined;
445
445
  }>;
@@ -452,15 +452,15 @@ export declare const CommandResultSchema: z.ZodObject<{
452
452
  result: z.ZodOptional<z.ZodUnknown>;
453
453
  error: z.ZodOptional<z.ZodString>;
454
454
  }, "strip", z.ZodTypeAny, {
455
+ kind: "command_result";
455
456
  ok: boolean;
456
457
  id: string;
457
- kind: "command_result";
458
458
  error?: string | undefined;
459
459
  result?: unknown;
460
460
  }, {
461
+ kind: "command_result";
461
462
  ok: boolean;
462
463
  id: string;
463
- kind: "command_result";
464
464
  error?: string | undefined;
465
465
  result?: unknown;
466
466
  }>;
@@ -572,6 +572,7 @@ export declare const EventMessageSchema: z.ZodObject<{
572
572
  documentId?: string | undefined;
573
573
  }>;
574
574
  }, "strip", z.ZodTypeAny, {
575
+ kind: "event";
575
576
  event: {
576
577
  type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
577
578
  data: Record<string, unknown>;
@@ -584,8 +585,8 @@ export declare const EventMessageSchema: z.ZodObject<{
584
585
  attribution?: "window" | undefined;
585
586
  documentId?: string | undefined;
586
587
  };
587
- kind: "event";
588
588
  }, {
589
+ kind: "event";
589
590
  event: {
590
591
  type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
591
592
  t: number;
@@ -598,7 +599,6 @@ export declare const EventMessageSchema: z.ZodObject<{
598
599
  attribution?: "window" | undefined;
599
600
  documentId?: string | undefined;
600
601
  };
601
- kind: "event";
602
602
  }>;
603
603
  export type EventMessage = z.infer<typeof EventMessageSchema>;
604
604
  export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
@@ -763,7 +763,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
763
763
  projectId?: string | undefined;
764
764
  token?: string | undefined;
765
765
  platform?: "native" | "web" | "webview" | "service" | undefined;
766
- channels?: ("signal" | "visual" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
766
+ channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
767
767
  commands?: string[] | undefined;
768
768
  contractParts?: {
769
769
  events: string[];
@@ -786,7 +786,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
786
786
  projectId?: string | undefined;
787
787
  token?: string | undefined;
788
788
  platform?: "native" | "web" | "webview" | "service" | undefined;
789
- channels?: ("signal" | "visual" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
789
+ channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
790
790
  commands?: string[] | undefined;
791
791
  contractParts?: {
792
792
  events: string[];
@@ -806,15 +806,15 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
806
806
  name: z.ZodString;
807
807
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
808
808
  }, "strip", z.ZodTypeAny, {
809
- id: string;
810
- name: string;
811
809
  kind: "command";
810
+ name: string;
811
+ id: string;
812
812
  args: Record<string, unknown>;
813
813
  sessionId?: string | undefined;
814
814
  }, {
815
- id: string;
816
- name: string;
817
815
  kind: "command";
816
+ name: string;
817
+ id: string;
818
818
  args?: Record<string, unknown> | undefined;
819
819
  sessionId?: string | undefined;
820
820
  }>, z.ZodObject<{
@@ -824,15 +824,15 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
824
824
  result: z.ZodOptional<z.ZodUnknown>;
825
825
  error: z.ZodOptional<z.ZodString>;
826
826
  }, "strip", z.ZodTypeAny, {
827
+ kind: "command_result";
827
828
  ok: boolean;
828
829
  id: string;
829
- kind: "command_result";
830
830
  error?: string | undefined;
831
831
  result?: unknown;
832
832
  }, {
833
+ kind: "command_result";
833
834
  ok: boolean;
834
835
  id: string;
835
- kind: "command_result";
836
836
  error?: string | undefined;
837
837
  result?: unknown;
838
838
  }>, z.ZodObject<{
@@ -941,6 +941,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
941
941
  documentId?: string | undefined;
942
942
  }>;
943
943
  }, "strip", z.ZodTypeAny, {
944
+ kind: "event";
944
945
  event: {
945
946
  type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
946
947
  data: Record<string, unknown>;
@@ -953,8 +954,8 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
953
954
  attribution?: "window" | undefined;
954
955
  documentId?: string | undefined;
955
956
  };
956
- kind: "event";
957
957
  }, {
958
+ kind: "event";
958
959
  event: {
959
960
  type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
960
961
  t: number;
@@ -967,5 +968,4 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
967
968
  attribution?: "window" | undefined;
968
969
  documentId?: string | undefined;
969
970
  };
970
- kind: "event";
971
971
  }>]>;
@@ -194,3 +194,20 @@ export declare const REQUEST_SHAPE_FIELD = "requestShape";
194
194
  * makes by not sending it: a body may have existed and nothing about it is on the record.
195
195
  */
196
196
  export declare const REQUEST_SHAPE_NONE = "none";
197
+ /**
198
+ * The request header a Next.js Server Action carries.
199
+ *
200
+ * An app's Server Actions all POST to the page's own URL, so method plus URL cannot tell the calls
201
+ * apart, and the usual `FormData` body has no shape fingerprint either. This header names the action
202
+ * that ran — an opaque id for the code, not a projection of the data — and it is present on every
203
+ * Server Action request. Recorded as `NEXT_ACTION_FIELD`; the engine folds it into the write
204
+ * discriminator in `identityOf`.
205
+ */
206
+ export declare const NEXT_ACTION_HEADER = "Next-Action";
207
+ /**
208
+ * Where the header above lands in a `NET_REQUEST`'s data.
209
+ *
210
+ * Alone it is a KNOWN identity: two POSTs that named different actions are different writes, and two
211
+ * that named the same action are the same write even when the body could not be read as text.
212
+ */
213
+ export declare const NEXT_ACTION_FIELD = "nextAction";
package/dist/wire/net.js CHANGED
@@ -255,3 +255,20 @@ export const REQUEST_SHAPE_FIELD = 'requestShape';
255
255
  * makes by not sending it: a body may have existed and nothing about it is on the record.
256
256
  */
257
257
  export const REQUEST_SHAPE_NONE = 'none';
258
+ /**
259
+ * The request header a Next.js Server Action carries.
260
+ *
261
+ * An app's Server Actions all POST to the page's own URL, so method plus URL cannot tell the calls
262
+ * apart, and the usual `FormData` body has no shape fingerprint either. This header names the action
263
+ * that ran — an opaque id for the code, not a projection of the data — and it is present on every
264
+ * Server Action request. Recorded as `NEXT_ACTION_FIELD`; the engine folds it into the write
265
+ * discriminator in `identityOf`.
266
+ */
267
+ export const NEXT_ACTION_HEADER = 'Next-Action';
268
+ /**
269
+ * Where the header above lands in a `NET_REQUEST`'s data.
270
+ *
271
+ * Alone it is a KNOWN identity: two POSTs that named different actions are different writes, and two
272
+ * that named the same action are the same write even when the body could not be read as text.
273
+ */
274
+ export const NEXT_ACTION_FIELD = 'nextAction';
@@ -117,6 +117,20 @@ export function isSensitiveKey(key) {
117
117
  const SENSITIVE_PATH_SEGMENT = /^(reset|verify|verification|confirm|activate|invite|magic|magiclink|token|key|oauth|unsubscribe|password)$/i;
118
118
  /** Only mask a following segment that looks token-like — short ids/words (`reset/form`) are left alone. */
119
119
  const PATH_TOKEN_MIN_LENGTH = 12;
120
+ function utf8Length(value) {
121
+ return new TextEncoder().encode(value).byteLength;
122
+ }
123
+ function summarizeEmbeddedUrl(raw) {
124
+ if (!/^data:/i.test(raw))
125
+ return undefined;
126
+ const comma = raw.indexOf(',');
127
+ const header = -1 === comma ? raw.slice(5) : raw.slice(5, comma);
128
+ const [candidateType = '', ...parameters] = header.split(';');
129
+ const mediaType = /^[\w.+-]+\/[\w.+-]+$/.test(candidateType) ? candidateType : 'text/plain';
130
+ const encoding = parameters.some((value) => 'base64' === value.toLowerCase()) ? ';base64' : '';
131
+ const payload = -1 === comma ? '' : raw.slice(comma + 1);
132
+ return `data:${mediaType}${encoding},<…${String(utf8Length(payload))} bytes…>`;
133
+ }
120
134
  /**
121
135
  * Redact credential-bearing values in a URL so they don't leak into the agent transcript / flow / run
122
136
  * artifacts: query params (`?access_token=…`, signed-URL keys), the authority's userinfo, path-embedded
@@ -133,6 +147,9 @@ const PATH_TOKEN_MIN_LENGTH = 12;
133
147
  * rule to consult.
134
148
  */
135
149
  export function redactUrl(raw, isSensitive = isSensitiveKey) {
150
+ const embeddedSummary = summarizeEmbeddedUrl(raw);
151
+ if (embeddedSummary !== undefined)
152
+ return embeddedSummary;
136
153
  const hashStart = raw.indexOf('#');
137
154
  const hash = -1 === hashStart ? '' : raw.slice(hashStart);
138
155
  const beforeHash = -1 === hashStart ? raw : raw.slice(0, hashStart);
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * State flags (inside []):
19
19
  * vis visible hid hidden en enabled dis disabled
20
- * chk checked exp expanded focus focused
20
+ * chk checked exp expanded prs pressed focus focused
21
21
  * (`present` is on every element, so it is never encoded — see STATE_FLAG.)
22
22
  *
23
23
  * Attributes (key=value, space-separated):
package/dist/wire/toon.js CHANGED
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * State flags (inside []):
19
19
  * vis visible hid hidden en enabled dis disabled
20
- * chk checked exp expanded focus focused
20
+ * chk checked exp expanded prs pressed focus focused
21
21
  * (`present` is on every element, so it is never encoded — see STATE_FLAG.)
22
22
  *
23
23
  * Attributes (key=value, space-separated):
@@ -83,6 +83,7 @@ const STATE_FLAG = {
83
83
  [ElementState.DISABLED]: 'dis',
84
84
  [ElementState.CHECKED]: 'chk',
85
85
  [ElementState.EXPANDED]: 'exp',
86
+ [ElementState.PRESSED]: 'prs',
86
87
  [ElementState.FOCUSED]: 'focus',
87
88
  };
88
89
  /** States the `visible` field already encodes, plus the one that is true of everything. */