@reticlehq/core 3.4.0 → 3.6.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 (73) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +2 -0
  2. package/dist/artifacts/artifacts-entry.js +2 -0
  3. package/dist/artifacts/drive-script.d.ts +1298 -0
  4. package/dist/artifacts/drive-script.js +197 -0
  5. package/dist/artifacts/flow-constants.d.ts +1 -0
  6. package/dist/artifacts/flow-constants.js +1 -0
  7. package/dist/artifacts/flow-types.d.ts +60 -0
  8. package/dist/artifacts/flow-types.js +10 -0
  9. package/dist/artifacts/hud-notices.d.ts +134 -0
  10. package/dist/artifacts/hud-notices.js +124 -0
  11. package/dist/artifacts/impact.d.ts +135 -44
  12. package/dist/artifacts/impact.js +25 -0
  13. package/dist/artifacts/journal.d.ts +49 -0
  14. package/dist/artifacts/journal.js +15 -0
  15. package/dist/artifacts/prompt-context.d.ts +105 -0
  16. package/dist/artifacts/prompt-context.js +108 -0
  17. package/dist/desktop-contract.cjs +1 -0
  18. package/dist/desktop-contract.d.cts +1 -0
  19. package/dist/hud-entry.d.ts +1 -0
  20. package/dist/hud-entry.js +2 -0
  21. package/dist/identity/contract-fingerprint.d.ts +9 -0
  22. package/dist/identity/contract-fingerprint.js +12 -0
  23. package/dist/identity/testid-attribute.d.ts +18 -0
  24. package/dist/identity/testid-attribute.js +24 -0
  25. package/dist/index.d.ts +4 -1
  26. package/dist/index.js +4 -1
  27. package/dist/onboarding.d.ts +2 -2
  28. package/dist/schema/command-message.json +6 -0
  29. package/dist/schema/command-name.json +3 -1
  30. package/dist/schema/event-payloads.json +16 -0
  31. package/dist/schema/reticle-message.json +6 -0
  32. package/dist/telemetry-refusal.d.ts +3 -2
  33. package/dist/telemetry-session.d.ts +5 -1
  34. package/dist/telemetry-session.js +3 -1
  35. package/dist/telemetry.d.ts +42 -34
  36. package/dist/telemetry.js +3 -3
  37. package/dist/tour.d.ts +1 -0
  38. package/dist/tour.js +13 -5
  39. package/dist/verdict/consequence.d.ts +3 -0
  40. package/dist/verdict/findings.d.ts +5 -0
  41. package/dist/verdict/findings.js +7 -0
  42. package/dist/verdict/predicate.d.ts +14 -0
  43. package/dist/verdict/predicate.js +7 -12
  44. package/dist/verdict/verdict-attribution.js +1 -0
  45. package/dist/verdict/verification-run.d.ts +18 -0
  46. package/dist/verdict/verification-run.js +8 -0
  47. package/dist/verdict/verified-constants.d.ts +19 -0
  48. package/dist/verdict/verified-constants.js +22 -0
  49. package/dist/wire/constants/constants.d.ts +44 -16
  50. package/dist/wire/constants/constants.js +44 -16
  51. package/dist/wire/constants/hud-controls.d.ts +1 -1
  52. package/dist/wire/constants/hud-controls.js +21 -0
  53. package/dist/wire/constants/hud-use.d.ts +64 -1
  54. package/dist/wire/constants/hud-use.js +40 -1
  55. package/dist/wire/constants/session-constants.d.ts +8 -0
  56. package/dist/wire/constants/session-constants.js +8 -0
  57. package/dist/wire/desktop-contract.d.ts +3 -0
  58. package/dist/wire/desktop-contract.js +3 -0
  59. package/dist/wire/event-payloads.d.ts +25 -4
  60. package/dist/wire/event-payloads.js +10 -0
  61. package/dist/wire/global-press.d.ts +34 -3
  62. package/dist/wire/global-press.js +91 -3
  63. package/dist/wire/hold.d.ts +14 -0
  64. package/dist/wire/hold.js +18 -0
  65. package/dist/wire/messages.d.ts +42 -18
  66. package/dist/wire/messages.js +8 -0
  67. package/dist/wire/platform-link.d.ts +161 -0
  68. package/dist/wire/platform-link.js +189 -0
  69. package/dist/wire/types.d.ts +7 -0
  70. package/dist/words/no-session-reason.d.ts +7 -0
  71. package/dist/words/no-session-reason.js +7 -0
  72. package/dist/words/notices.js +4 -2
  73. package/package.json +1 -1
@@ -35,6 +35,14 @@ export declare const HumanControlKind: {
35
35
  * what to send is the daemon's question, and a panel that named artifacts could disagree with it.
36
36
  */
37
37
  readonly SYNC: "sync";
38
+ /**
39
+ * Human pressed Sign in in the panel. Carries nothing.
40
+ *
41
+ * A page cannot write `~/.reticle`, so the panel used to copy `reticle login` and stop there: a
42
+ * dead end for anybody who does not live in a terminal. The daemon owns the credential, so it
43
+ * starts the same browser approval flow `reticle login` does and the panel repaints when it lands.
44
+ */
45
+ readonly SIGNIN: "signin";
38
46
  /**
39
47
  * Human flipped the harness switch in the panel. `text` carries `on` or `off`.
40
48
  *
@@ -36,6 +36,14 @@ export const HumanControlKind = {
36
36
  * what to send is the daemon's question, and a panel that named artifacts could disagree with it.
37
37
  */
38
38
  SYNC: 'sync',
39
+ /**
40
+ * Human pressed Sign in in the panel. Carries nothing.
41
+ *
42
+ * A page cannot write `~/.reticle`, so the panel used to copy `reticle login` and stop there: a
43
+ * dead end for anybody who does not live in a terminal. The daemon owns the credential, so it
44
+ * starts the same browser approval flow `reticle login` does and the panel repaints when it lands.
45
+ */
46
+ SIGNIN: 'signin',
39
47
  /**
40
48
  * Human flipped the harness switch in the panel. `text` carries `on` or `off`.
41
49
  *
@@ -20,6 +20,8 @@
20
20
  export declare const RETICLE_IPC_GLOBAL = "__reticleIpc";
21
21
  /** The ipcMain channel the capture helper answers, invoked by the preload on the SDK's behalf. */
22
22
  export declare const RETICLE_CAPTURE_CHANNEL = "__reticle:capture";
23
+ /** The ipcMain channel that answers which window asked: the label the app registered it under. */
24
+ export declare const RETICLE_WINDOW_CHANNEL = "__reticle:window";
23
25
  /**
24
26
  * Filename prefix for a screenshot the main process writes to the OS temp directory.
25
27
  *
@@ -61,6 +63,7 @@ export declare const RETICLE_NOT_COMPOSITED: string;
61
63
  export declare const DESKTOP_CONTRACT: {
62
64
  readonly RETICLE_IPC_GLOBAL: "__reticleIpc";
63
65
  readonly RETICLE_CAPTURE_CHANNEL: "__reticle:capture";
66
+ readonly RETICLE_WINDOW_CHANNEL: "__reticle:window";
64
67
  readonly RETICLE_CAPTURE_FILE_PREFIX: "reticle-capture-";
65
68
  readonly RETICLE_TAURI_CAPTURE_COMMAND: "reticle_capture";
66
69
  readonly RETICLE_FULL_PAGE_UNSUPPORTED: string;
@@ -21,6 +21,8 @@ import { VisualReason } from './constants/constants.js';
21
21
  export const RETICLE_IPC_GLOBAL = '__reticleIpc';
22
22
  /** The ipcMain channel the capture helper answers, invoked by the preload on the SDK's behalf. */
23
23
  export const RETICLE_CAPTURE_CHANNEL = '__reticle:capture';
24
+ /** The ipcMain channel that answers which window asked: the label the app registered it under. */
25
+ export const RETICLE_WINDOW_CHANNEL = '__reticle:window';
24
26
  /**
25
27
  * Filename prefix for a screenshot the main process writes to the OS temp directory.
26
28
  *
@@ -62,6 +64,7 @@ export const RETICLE_NOT_COMPOSITED = VisualReason.NOT_COMPOSITED;
62
64
  export const DESKTOP_CONTRACT = {
63
65
  RETICLE_IPC_GLOBAL,
64
66
  RETICLE_CAPTURE_CHANNEL,
67
+ RETICLE_WINDOW_CHANNEL,
65
68
  RETICLE_CAPTURE_FILE_PREFIX,
66
69
  RETICLE_TAURI_CAPTURE_COMMAND,
67
70
  RETICLE_FULL_PAGE_UNSUPPORTED,
@@ -308,6 +308,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
308
308
  readonly CLOSE: "close";
309
309
  }>;
310
310
  url: z.ZodString;
311
+ urlRaw: z.ZodOptional<z.ZodString>;
311
312
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
312
313
  transport: z.ZodNativeEnum<{
313
314
  readonly SSE: "sse";
@@ -321,6 +322,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
321
322
  readonly CLOSE: "close";
322
323
  }>;
323
324
  url: z.ZodString;
325
+ urlRaw: z.ZodOptional<z.ZodString>;
324
326
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
325
327
  transport: z.ZodNativeEnum<{
326
328
  readonly SSE: "sse";
@@ -334,6 +336,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
334
336
  readonly CLOSE: "close";
335
337
  }>;
336
338
  url: z.ZodString;
339
+ urlRaw: z.ZodOptional<z.ZodString>;
337
340
  }, z.ZodTypeAny, "passthrough">>;
338
341
  download: z.ZodObject<{
339
342
  mimeType: z.ZodString;
@@ -575,6 +578,10 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
575
578
  runtime: z.ZodOptional<z.ZodString>;
576
579
  /** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
577
580
  engine: z.ZodOptional<z.ZodString>;
581
+ /** The desktop shell's own name for this window (Tauri's label: `main`, `setup`). */
582
+ windowLabel: z.ZodOptional<z.ZodString>;
583
+ /** The HTTP status the document was served with, when the page could read it. */
584
+ documentStatus: z.ZodOptional<z.ZodNumber>;
578
585
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
579
586
  hidden: z.ZodBoolean;
580
587
  focused: z.ZodBoolean;
@@ -613,6 +620,10 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
613
620
  runtime: z.ZodOptional<z.ZodString>;
614
621
  /** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
615
622
  engine: z.ZodOptional<z.ZodString>;
623
+ /** The desktop shell's own name for this window (Tauri's label: `main`, `setup`). */
624
+ windowLabel: z.ZodOptional<z.ZodString>;
625
+ /** The HTTP status the document was served with, when the page could read it. */
626
+ documentStatus: z.ZodOptional<z.ZodNumber>;
616
627
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
617
628
  hidden: z.ZodBoolean;
618
629
  focused: z.ZodBoolean;
@@ -651,6 +662,10 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
651
662
  runtime: z.ZodOptional<z.ZodString>;
652
663
  /** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
653
664
  engine: z.ZodOptional<z.ZodString>;
665
+ /** The desktop shell's own name for this window (Tauri's label: `main`, `setup`). */
666
+ windowLabel: z.ZodOptional<z.ZodString>;
667
+ /** The HTTP status the document was served with, when the page could read it. */
668
+ documentStatus: z.ZodOptional<z.ZodNumber>;
654
669
  }, z.ZodTypeAny, "passthrough">>;
655
670
  "context.opened": z.ZodObject<{
656
671
  href: z.ZodOptional<z.ZodString>;
@@ -818,14 +833,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
818
833
  readonly MESSAGE: "message";
819
834
  readonly REPLAY: "replay";
820
835
  readonly SYNC: "sync";
836
+ readonly SIGNIN: "signin";
821
837
  readonly HARNESS: "harness";
822
838
  }>;
823
839
  text: z.ZodOptional<z.ZodString>;
824
840
  }, "strip", z.ZodTypeAny, {
825
- kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync";
841
+ kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync" | "signin";
826
842
  text?: string | undefined;
827
843
  }, {
828
- kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync";
844
+ kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync" | "signin";
829
845
  text?: string | undefined;
830
846
  }>;
831
847
  "human.mark": z.ZodObject<{
@@ -883,20 +899,25 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
883
899
  }>>;
884
900
  panel: z.ZodOptional<z.ZodNativeEnum<{
885
901
  readonly CHAT: "chat";
902
+ readonly FLOWS: "flows";
903
+ readonly NOTES: "notes";
886
904
  readonly SETTINGS: "settings";
887
905
  readonly REPORT: "report";
888
906
  readonly NONE: "none";
889
907
  }>>;
908
+ slide: z.ZodOptional<z.ZodString>;
890
909
  }, "strip", z.ZodTypeAny, {
891
910
  control?: string | undefined;
892
911
  toggle?: "on" | "off" | undefined;
893
912
  view?: "expanded" | "bubble" | "collapsed" | undefined;
894
- panel?: "none" | "chat" | "settings" | "report" | undefined;
913
+ panel?: "flows" | "none" | "chat" | "notes" | "settings" | "report" | undefined;
914
+ slide?: string | undefined;
895
915
  }, {
896
916
  control?: string | undefined;
897
917
  toggle?: "on" | "off" | undefined;
898
918
  view?: "expanded" | "bubble" | "collapsed" | undefined;
899
- panel?: "none" | "chat" | "settings" | "report" | undefined;
919
+ panel?: "flows" | "none" | "chat" | "notes" | "settings" | "report" | undefined;
920
+ slide?: string | undefined;
900
921
  }>;
901
922
  };
902
923
  /** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
@@ -97,6 +97,12 @@ const netStreamSchema = z
97
97
  transport: z.nativeEnum(StreamTransport),
98
98
  direction: z.nativeEnum(StreamDirection),
99
99
  url: z.string(),
100
+ // The match haystack, exactly as NET_PENDING carries it. A stream record whose URL was redacted
101
+ // is classified by the same `urlForMatch` every other consumer uses; without the raw copy here
102
+ // the stream half of one request and the pending half disagree about whose traffic it is, and a
103
+ // declared `background` endpoint comes back into the settle count through the one field the
104
+ // classifier could not see.
105
+ urlRaw: z.string().optional(),
100
106
  })
101
107
  .passthrough();
102
108
  const netRequestSchema = z
@@ -207,6 +213,10 @@ export const EVENT_PAYLOAD_SCHEMAS = {
207
213
  runtime: z.string().optional(),
208
214
  /** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
209
215
  engine: z.string().optional(),
216
+ /** The desktop shell's own name for this window (Tauri's label: `main`, `setup`). */
217
+ windowLabel: z.string().optional(),
218
+ /** The HTTP status the document was served with, when the page could read it. */
219
+ documentStatus: z.number().int().optional(),
210
220
  })
211
221
  .passthrough(),
212
222
  // The page called window.open — the clicked consequence may continue in a context the SDK cannot
@@ -19,9 +19,40 @@ export declare const GLOBAL_PRESS_KEYS: readonly ["Escape", "Tab"];
19
19
  */
20
20
  export declare function pressKeyFromArgs(args: Record<string, unknown>): string;
21
21
  /**
22
- * A press that is a document key, not an element action: Escape, Tab, or any key with modifiers
23
- * (Cmd+K). Requiring a ref for these forced a snapshot just to name an element the keystroke is
24
- * not about.
22
+ * The keys a `press` holds down TOGETHER, from `args.keys`. Empty for the ordinary one-key press.
23
+ *
24
+ * `modifiers` cannot express this: they are FLAGS on one event, so "Control held while k and then j
25
+ * are struck" has no spelling there. Only the in-page dispatcher implements the sequence — it
26
+ * presses these in order and releases them in reverse — so the server reads them through here to
27
+ * route such a press to that path rather than sending a chord it cannot spell.
28
+ */
29
+ export declare function pressKeysFromArgs(args: Record<string, unknown>): string[];
30
+ /**
31
+ * An explicit `code` the caller named, if any. The browser derives one from the key when this is
32
+ * absent (`pressCode`); an explicit one always wins there, because a caller driving a non-US layout
33
+ * knows something that derivation cannot.
34
+ */
35
+ export declare function explicitCodeFromArgs(args: Record<string, unknown>): string | undefined;
36
+ /** Canonical modifier names, in chord order — the spelling Playwright accepts. */
37
+ export declare const PRESS_MODIFIERS: readonly ["Alt", "Control", "Meta", "Shift"];
38
+ export type PressModifier = (typeof PRESS_MODIFIERS)[number];
39
+ /**
40
+ * Canonical, deduped modifiers in `PRESS_MODIFIERS` order; unknown names are dropped, since one the
41
+ * driver cannot spell would change the whole chord. Server-side only — see `hasModifiers`.
42
+ */
43
+ export declare function pressModifiersFromArgs(args: Record<string, unknown>): PressModifier[];
44
+ /**
45
+ * A press that is a document key, not an element action: Escape, Tab, any key with modifiers
46
+ * (Cmd+K), or several keys held together. Requiring a ref for these forced a snapshot just to name
47
+ * an element the keystroke is not about.
48
+ *
49
+ * `keys` counts even though `hasModifiers` cannot see it: a multi-key press is a sequence held at
50
+ * the page, never aimed at one control, and without this the documented `keys` spelling would be
51
+ * refused with "pass a ref" before anything could route it.
52
+ *
53
+ * A ONE-element `keys` is judged by the same rule as the one-key spelling rather than by its length:
54
+ * it names the same key, so it owes the same answer. Counting the list instead let `{ keys: ["Enter"] }`
55
+ * pass where `{ key: "Enter" }` is refused.
25
56
  */
26
57
  export declare function isGlobalPress(args: Record<string, unknown>): boolean;
27
58
  /**
@@ -28,18 +28,106 @@ export function pressKeyFromArgs(args) {
28
28
  return key;
29
29
  return DEFAULT_PRESS_KEY;
30
30
  }
31
+ /**
32
+ * The keys a `press` holds down TOGETHER, from `args.keys`. Empty for the ordinary one-key press.
33
+ *
34
+ * `modifiers` cannot express this: they are FLAGS on one event, so "Control held while k and then j
35
+ * are struck" has no spelling there. Only the in-page dispatcher implements the sequence — it
36
+ * presses these in order and releases them in reverse — so the server reads them through here to
37
+ * route such a press to that path rather than sending a chord it cannot spell.
38
+ */
39
+ export function pressKeysFromArgs(args) {
40
+ const raw = args['keys'];
41
+ if (!Array.isArray(raw))
42
+ return [];
43
+ const keys = [];
44
+ for (const item of raw) {
45
+ if ('string' === typeof item && 0 < item.length)
46
+ keys.push(item);
47
+ }
48
+ return keys;
49
+ }
50
+ /**
51
+ * An explicit `code` the caller named, if any. The browser derives one from the key when this is
52
+ * absent (`pressCode`); an explicit one always wins there, because a caller driving a non-US layout
53
+ * knows something that derivation cannot.
54
+ */
55
+ export function explicitCodeFromArgs(args) {
56
+ const code = args['code'];
57
+ return 'string' === typeof code && 0 < code.length ? code : undefined;
58
+ }
59
+ /** Canonical modifier names, in chord order — the spelling Playwright accepts. */
60
+ export const PRESS_MODIFIERS = ['Alt', 'Control', 'Meta', 'Shift'];
61
+ const MODIFIER_ALIASES = {
62
+ alt: 'Alt',
63
+ option: 'Alt',
64
+ opt: 'Alt',
65
+ control: 'Control',
66
+ ctrl: 'Control',
67
+ meta: 'Meta',
68
+ cmd: 'Meta',
69
+ command: 'Meta',
70
+ super: 'Meta',
71
+ win: 'Meta',
72
+ shift: 'Shift',
73
+ };
74
+ /**
75
+ * Canonical, deduped modifiers in `PRESS_MODIFIERS` order; unknown names are dropped, since one the
76
+ * driver cannot spell would change the whole chord. Server-side only — see `hasModifiers`.
77
+ */
78
+ export function pressModifiersFromArgs(args) {
79
+ const raw = args['modifiers'];
80
+ if (!Array.isArray(raw))
81
+ return [];
82
+ const named = new Set();
83
+ for (const item of raw) {
84
+ if ('string' !== typeof item)
85
+ continue;
86
+ const canonical = MODIFIER_ALIASES[item.toLowerCase()];
87
+ if (canonical !== undefined)
88
+ named.add(canonical);
89
+ }
90
+ return PRESS_MODIFIERS.filter((modifier) => named.has(modifier));
91
+ }
92
+ /**
93
+ * Whether any modifier was named. Deliberately not via `pressModifiersFromArgs`: the alias table is
94
+ * only referenced from there, so a page that never calls it does not carry the table — measured, by
95
+ * splitting the table into its own module and watching the bundle stay byte-identical. The two
96
+ * readings differ only for a name the alias table does not know, and that difference is inert here
97
+ * — this answers "is a ref required", never which chord to send.
98
+ */
31
99
  function hasModifiers(args) {
32
100
  const raw = args['modifiers'];
33
101
  return Array.isArray(raw) && 0 < raw.length;
34
102
  }
35
103
  /**
36
- * A press that is a document key, not an element action: Escape, Tab, or any key with modifiers
37
- * (Cmd+K). Requiring a ref for these forced a snapshot just to name an element the keystroke is
38
- * not about.
104
+ * A press that is a document key, not an element action: Escape, Tab, any key with modifiers
105
+ * (Cmd+K), or several keys held together. Requiring a ref for these forced a snapshot just to name
106
+ * an element the keystroke is not about.
107
+ *
108
+ * `keys` counts even though `hasModifiers` cannot see it: a multi-key press is a sequence held at
109
+ * the page, never aimed at one control, and without this the documented `keys` spelling would be
110
+ * refused with "pass a ref" before anything could route it.
111
+ *
112
+ * A ONE-element `keys` is judged by the same rule as the one-key spelling rather than by its length:
113
+ * it names the same key, so it owes the same answer. Counting the list instead let `{ keys: ["Enter"] }`
114
+ * pass where `{ key: "Enter" }` is refused.
39
115
  */
40
116
  export function isGlobalPress(args) {
41
117
  if (hasModifiers(args))
42
118
  return true;
119
+ const keys = pressKeysFromArgs(args);
120
+ // SEVERAL keys held together is a sequence at the page, never aimed at one control.
121
+ if (1 < keys.length)
122
+ return true;
123
+ // ONE key in `keys` is the same press as naming it in `key`/`text`, so it must answer the same
124
+ // question. Reading the list by LENGTH alone let `{ keys: ["Enter"] }` omit a ref, which the
125
+ // one-key spelling refuses on purpose: Enter lands on whatever holds focus, and on a focused field
126
+ // inside a form that submits it. The caller named a list, not a different key.
127
+ if (1 === keys.length) {
128
+ const only = keys[0];
129
+ return only !== undefined && GLOBAL_PRESS_KEY_SET.has(only.toLowerCase());
130
+ }
43
131
  return GLOBAL_PRESS_KEY_SET.has(pressKeyFromArgs(args).toLowerCase());
44
132
  }
45
133
  /**
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The longest a single action may hold a pointer or a key down, in milliseconds.
3
+ *
4
+ * An unbounded `holdMs` is a tool call that never returns, which is the failure the transport layer
5
+ * is shaped around. 30s is far above any real hold-to-confirm (the reported case was 1.2s) and far
6
+ * below a hang.
7
+ *
8
+ * In core because BOTH sides clamp the same argument: the in-page dispatcher (a held mouse button,
9
+ * a held key) and the real-input provider (a held key through the driver). Two caps would let the
10
+ * same `holdMs` hold for longer through one path than the other.
11
+ */
12
+ export declare const MAX_HOLD_MS = 30000;
13
+ /** A hold the caller asked for, bounded and sanitised. Non-numbers and negatives mean "no hold". */
14
+ export declare function clampHoldMs(raw: unknown): number;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The longest a single action may hold a pointer or a key down, in milliseconds.
3
+ *
4
+ * An unbounded `holdMs` is a tool call that never returns, which is the failure the transport layer
5
+ * is shaped around. 30s is far above any real hold-to-confirm (the reported case was 1.2s) and far
6
+ * below a hang.
7
+ *
8
+ * In core because BOTH sides clamp the same argument: the in-page dispatcher (a held mouse button,
9
+ * a held key) and the real-input provider (a held key through the driver). Two caps would let the
10
+ * same `holdMs` hold for longer through one path than the other.
11
+ */
12
+ export const MAX_HOLD_MS = 30_000;
13
+ /** A hold the caller asked for, bounded and sanitised. Non-numbers and negatives mean "no hold". */
14
+ export function clampHoldMs(raw) {
15
+ if ('number' !== typeof raw || !Number.isFinite(raw) || raw <= 0)
16
+ return 0;
17
+ return Math.min(raw, MAX_HOLD_MS);
18
+ }
@@ -11,14 +11,15 @@ export declare const HumanControlDataSchema: z.ZodObject<{
11
11
  readonly MESSAGE: "message";
12
12
  readonly REPLAY: "replay";
13
13
  readonly SYNC: "sync";
14
+ readonly SIGNIN: "signin";
14
15
  readonly HARNESS: "harness";
15
16
  }>;
16
17
  text: z.ZodOptional<z.ZodString>;
17
18
  }, "strip", z.ZodTypeAny, {
18
- kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync";
19
+ kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync" | "signin";
19
20
  text?: string | undefined;
20
21
  }, {
21
- kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync";
22
+ kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync" | "signin";
22
23
  text?: string | undefined;
23
24
  }>;
24
25
  export type HumanControlData = z.infer<typeof HumanControlDataSchema>;
@@ -41,20 +42,26 @@ export declare const HudUseDataSchema: z.ZodObject<{
41
42
  }>>;
42
43
  panel: z.ZodOptional<z.ZodNativeEnum<{
43
44
  readonly CHAT: "chat";
45
+ readonly FLOWS: "flows";
46
+ readonly NOTES: "notes";
44
47
  readonly SETTINGS: "settings";
45
48
  readonly REPORT: "report";
46
49
  readonly NONE: "none";
47
50
  }>>;
51
+ /** A rail slide that became the visible one. Its shape is checked where it is counted. */
52
+ slide: z.ZodOptional<z.ZodString>;
48
53
  }, "strip", z.ZodTypeAny, {
49
54
  control?: string | undefined;
50
55
  toggle?: "on" | "off" | undefined;
51
56
  view?: "expanded" | "bubble" | "collapsed" | undefined;
52
- panel?: "none" | "chat" | "settings" | "report" | undefined;
57
+ panel?: "flows" | "none" | "chat" | "notes" | "settings" | "report" | undefined;
58
+ slide?: string | undefined;
53
59
  }, {
54
60
  control?: string | undefined;
55
61
  toggle?: "on" | "off" | undefined;
56
62
  view?: "expanded" | "bubble" | "collapsed" | undefined;
57
- panel?: "none" | "chat" | "settings" | "report" | undefined;
63
+ panel?: "flows" | "none" | "chat" | "notes" | "settings" | "report" | undefined;
64
+ slide?: string | undefined;
58
65
  }>;
59
66
  export type HudUseData = z.infer<typeof HudUseDataSchema>;
60
67
  /**
@@ -204,8 +211,8 @@ export declare const ReticleEventSchema: z.ZodObject<{
204
211
  t: number;
205
212
  sessionId: string;
206
213
  editEpoch?: number | undefined;
207
- ref?: string | undefined;
208
214
  seq?: number | undefined;
215
+ ref?: string | undefined;
209
216
  actionId?: string | undefined;
210
217
  attribution?: "window" | undefined;
211
218
  documentId?: string | undefined;
@@ -215,8 +222,8 @@ export declare const ReticleEventSchema: z.ZodObject<{
215
222
  sessionId: string;
216
223
  editEpoch?: number | undefined;
217
224
  data?: Record<string, unknown> | undefined;
218
- ref?: string | undefined;
219
225
  seq?: number | undefined;
226
+ ref?: string | undefined;
220
227
  actionId?: string | undefined;
221
228
  attribution?: "window" | undefined;
222
229
  documentId?: string | undefined;
@@ -383,8 +390,8 @@ export declare const HelloMessageSchema: z.ZodObject<{
383
390
  title: string;
384
391
  adapters: string[];
385
392
  projectId?: string | undefined;
386
- token?: string | undefined;
387
393
  platform?: "native" | "web" | "webview" | "service" | undefined;
394
+ token?: string | undefined;
388
395
  channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
389
396
  commands?: string[] | undefined;
390
397
  contractParts?: {
@@ -406,8 +413,8 @@ export declare const HelloMessageSchema: z.ZodObject<{
406
413
  title: string;
407
414
  adapters: string[];
408
415
  projectId?: string | undefined;
409
- token?: string | undefined;
410
416
  platform?: "native" | "web" | "webview" | "service" | undefined;
417
+ token?: string | undefined;
411
418
  channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
412
419
  commands?: string[] | undefined;
413
420
  contractParts?: {
@@ -424,22 +431,33 @@ export declare const HelloMessageSchema: z.ZodObject<{
424
431
  }>;
425
432
  export type HelloMessage = z.infer<typeof HelloMessageSchema>;
426
433
  /** Agent -> browser request, routed by the bridge with a correlation id. */
434
+ /** Who sent a command: the Harness, or (when absent) the agent connected to the daemon. */
435
+ export declare const CommandActor: {
436
+ readonly HARNESS: "harness";
437
+ };
438
+ export type CommandActor = (typeof CommandActor)[keyof typeof CommandActor];
427
439
  export declare const CommandMessageSchema: z.ZodObject<{
428
440
  kind: z.ZodLiteral<"command">;
429
441
  id: z.ZodString;
430
442
  sessionId: z.ZodOptional<z.ZodString>;
431
443
  name: z.ZodString;
432
444
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
445
+ /** Set when the Harness sent it, so the HUD can say who is driving. */
446
+ by: z.ZodOptional<z.ZodNativeEnum<{
447
+ readonly HARNESS: "harness";
448
+ }>>;
433
449
  }, "strip", z.ZodTypeAny, {
434
450
  kind: "command";
435
451
  name: string;
436
452
  id: string;
437
453
  args: Record<string, unknown>;
454
+ by?: "harness" | undefined;
438
455
  sessionId?: string | undefined;
439
456
  }, {
440
457
  kind: "command";
441
458
  name: string;
442
459
  id: string;
460
+ by?: "harness" | undefined;
443
461
  args?: Record<string, unknown> | undefined;
444
462
  sessionId?: string | undefined;
445
463
  }>;
@@ -554,8 +572,8 @@ export declare const EventMessageSchema: z.ZodObject<{
554
572
  t: number;
555
573
  sessionId: string;
556
574
  editEpoch?: number | undefined;
557
- ref?: string | undefined;
558
575
  seq?: number | undefined;
576
+ ref?: string | undefined;
559
577
  actionId?: string | undefined;
560
578
  attribution?: "window" | undefined;
561
579
  documentId?: string | undefined;
@@ -565,8 +583,8 @@ export declare const EventMessageSchema: z.ZodObject<{
565
583
  sessionId: string;
566
584
  editEpoch?: number | undefined;
567
585
  data?: Record<string, unknown> | undefined;
568
- ref?: string | undefined;
569
586
  seq?: number | undefined;
587
+ ref?: string | undefined;
570
588
  actionId?: string | undefined;
571
589
  attribution?: "window" | undefined;
572
590
  documentId?: string | undefined;
@@ -579,8 +597,8 @@ export declare const EventMessageSchema: z.ZodObject<{
579
597
  t: number;
580
598
  sessionId: string;
581
599
  editEpoch?: number | undefined;
582
- ref?: string | undefined;
583
600
  seq?: number | undefined;
601
+ ref?: string | undefined;
584
602
  actionId?: string | undefined;
585
603
  attribution?: "window" | undefined;
586
604
  documentId?: string | undefined;
@@ -593,8 +611,8 @@ export declare const EventMessageSchema: z.ZodObject<{
593
611
  sessionId: string;
594
612
  editEpoch?: number | undefined;
595
613
  data?: Record<string, unknown> | undefined;
596
- ref?: string | undefined;
597
614
  seq?: number | undefined;
615
+ ref?: string | undefined;
598
616
  actionId?: string | undefined;
599
617
  attribution?: "window" | undefined;
600
618
  documentId?: string | undefined;
@@ -761,8 +779,8 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
761
779
  title: string;
762
780
  adapters: string[];
763
781
  projectId?: string | undefined;
764
- token?: string | undefined;
765
782
  platform?: "native" | "web" | "webview" | "service" | undefined;
783
+ token?: string | undefined;
766
784
  channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
767
785
  commands?: string[] | undefined;
768
786
  contractParts?: {
@@ -784,8 +802,8 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
784
802
  title: string;
785
803
  adapters: string[];
786
804
  projectId?: string | undefined;
787
- token?: string | undefined;
788
805
  platform?: "native" | "web" | "webview" | "service" | undefined;
806
+ token?: string | undefined;
789
807
  channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
790
808
  commands?: string[] | undefined;
791
809
  contractParts?: {
@@ -805,16 +823,22 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
805
823
  sessionId: z.ZodOptional<z.ZodString>;
806
824
  name: z.ZodString;
807
825
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
826
+ /** Set when the Harness sent it, so the HUD can say who is driving. */
827
+ by: z.ZodOptional<z.ZodNativeEnum<{
828
+ readonly HARNESS: "harness";
829
+ }>>;
808
830
  }, "strip", z.ZodTypeAny, {
809
831
  kind: "command";
810
832
  name: string;
811
833
  id: string;
812
834
  args: Record<string, unknown>;
835
+ by?: "harness" | undefined;
813
836
  sessionId?: string | undefined;
814
837
  }, {
815
838
  kind: "command";
816
839
  name: string;
817
840
  id: string;
841
+ by?: "harness" | undefined;
818
842
  args?: Record<string, unknown> | undefined;
819
843
  sessionId?: string | undefined;
820
844
  }>, z.ZodObject<{
@@ -923,8 +947,8 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
923
947
  t: number;
924
948
  sessionId: string;
925
949
  editEpoch?: number | undefined;
926
- ref?: string | undefined;
927
950
  seq?: number | undefined;
951
+ ref?: string | undefined;
928
952
  actionId?: string | undefined;
929
953
  attribution?: "window" | undefined;
930
954
  documentId?: string | undefined;
@@ -934,8 +958,8 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
934
958
  sessionId: string;
935
959
  editEpoch?: number | undefined;
936
960
  data?: Record<string, unknown> | undefined;
937
- ref?: string | undefined;
938
961
  seq?: number | undefined;
962
+ ref?: string | undefined;
939
963
  actionId?: string | undefined;
940
964
  attribution?: "window" | undefined;
941
965
  documentId?: string | undefined;
@@ -948,8 +972,8 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
948
972
  t: number;
949
973
  sessionId: string;
950
974
  editEpoch?: number | undefined;
951
- ref?: string | undefined;
952
975
  seq?: number | undefined;
976
+ ref?: string | undefined;
953
977
  actionId?: string | undefined;
954
978
  attribution?: "window" | undefined;
955
979
  documentId?: string | undefined;
@@ -962,8 +986,8 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
962
986
  sessionId: string;
963
987
  editEpoch?: number | undefined;
964
988
  data?: Record<string, unknown> | undefined;
965
- ref?: string | undefined;
966
989
  seq?: number | undefined;
990
+ ref?: string | undefined;
967
991
  actionId?: string | undefined;
968
992
  attribution?: "window" | undefined;
969
993
  documentId?: string | undefined;
@@ -33,6 +33,8 @@ export const HudUseDataSchema = z.object({
33
33
  toggle: z.nativeEnum(HudToggle).optional(),
34
34
  view: z.nativeEnum(HudView).optional(),
35
35
  panel: z.nativeEnum(HudPanel).optional(),
36
+ /** A rail slide that became the visible one. Its shape is checked where it is counted. */
37
+ slide: z.string().max(56).optional(),
36
38
  });
37
39
  /**
38
40
  * Human review: the narrowed payload of a HUMAN_MARK event. A human flagged a mistake pinned to an
@@ -246,12 +248,18 @@ export const HelloMessageSchema = z.object({
246
248
  .optional(),
247
249
  });
248
250
  /** Agent -> browser request, routed by the bridge with a correlation id. */
251
+ /** Who sent a command: the Harness, or (when absent) the agent connected to the daemon. */
252
+ export const CommandActor = {
253
+ HARNESS: 'harness',
254
+ };
249
255
  export const CommandMessageSchema = z.object({
250
256
  kind: z.literal(MessageKind.COMMAND),
251
257
  id: z.string().min(1).max(TRANSPORT_LIMITS.MAX_COMMAND_ID_LENGTH),
252
258
  sessionId: sessionIdSchema.optional(),
253
259
  name: z.string().min(1).max(TRANSPORT_LIMITS.MAX_COMMAND_NAME_LENGTH),
254
260
  args: z.record(z.unknown()).default({}),
261
+ /** Set when the Harness sent it, so the HUD can say who is driving. */
262
+ by: z.nativeEnum(CommandActor).optional(),
255
263
  });
256
264
  /** Browser -> agent reply to a command. */
257
265
  export const CommandResultSchema = z.object({