@reticlehq/core 3.5.0 → 3.7.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 (113) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +4 -0
  2. package/dist/artifacts/artifacts-entry.js +4 -0
  3. package/dist/artifacts/drive-script.d.ts +1404 -0
  4. package/dist/artifacts/drive-script.js +220 -0
  5. package/dist/artifacts/flow-constants.d.ts +19 -0
  6. package/dist/artifacts/flow-constants.js +21 -0
  7. package/dist/artifacts/flow-results.d.ts +450 -0
  8. package/dist/artifacts/flow-results.js +1 -0
  9. package/dist/artifacts/flow-types.d.ts +75 -427
  10. package/dist/artifacts/flow-types.js +15 -2
  11. package/dist/artifacts/harness-credits.d.ts +39 -0
  12. package/dist/artifacts/harness-credits.js +69 -0
  13. package/dist/artifacts/harness-map.d.ts +98 -0
  14. package/dist/artifacts/harness-map.js +36 -0
  15. package/dist/artifacts/hud-notices.d.ts +134 -0
  16. package/dist/artifacts/hud-notices.js +124 -0
  17. package/dist/artifacts/impact.d.ts +489 -189
  18. package/dist/artifacts/impact.js +90 -47
  19. package/dist/artifacts/journal.d.ts +105 -5
  20. package/dist/artifacts/journal.js +41 -0
  21. package/dist/artifacts/prompt-context.d.ts +105 -0
  22. package/dist/artifacts/prompt-context.js +108 -0
  23. package/dist/artifacts/screenshot-upload.d.ts +51 -0
  24. package/dist/artifacts/screenshot-upload.js +26 -0
  25. package/dist/desktop-contract.cjs +1 -0
  26. package/dist/desktop-contract.d.cts +1 -0
  27. package/dist/hooks/hook-events.d.ts +4 -4
  28. package/dist/hud-entry.d.ts +2 -0
  29. package/dist/hud-entry.js +4 -0
  30. package/dist/identity/contract-fingerprint.d.ts +9 -0
  31. package/dist/identity/contract-fingerprint.js +12 -0
  32. package/dist/identity/testid-attribute.d.ts +18 -0
  33. package/dist/identity/testid-attribute.js +24 -0
  34. package/dist/index.d.ts +9 -1
  35. package/dist/index.js +9 -1
  36. package/dist/onboarding.d.ts +10 -2
  37. package/dist/onboarding.js +6 -0
  38. package/dist/realm/registry.js +19 -1
  39. package/dist/schema/command-message.json +36 -0
  40. package/dist/schema/command-name.json +5 -1
  41. package/dist/schema/event-payloads.json +56 -2
  42. package/dist/schema/reticle-message.json +36 -0
  43. package/dist/telemetry-bug.d.ts +169 -0
  44. package/dist/telemetry-bug.js +123 -0
  45. package/dist/telemetry-entry.d.ts +1 -0
  46. package/dist/telemetry-entry.js +1 -0
  47. package/dist/telemetry-feedback.d.ts +2 -2
  48. package/dist/telemetry-refusal.d.ts +5 -4
  49. package/dist/telemetry-session.d.ts +79 -1
  50. package/dist/telemetry-session.js +57 -1
  51. package/dist/telemetry-signals.d.ts +339 -0
  52. package/dist/telemetry-signals.js +138 -0
  53. package/dist/telemetry.d.ts +330 -276
  54. package/dist/telemetry.js +40 -115
  55. package/dist/tour.d.ts +1 -0
  56. package/dist/tour.js +13 -5
  57. package/dist/verdict/consequence.d.ts +3 -0
  58. package/dist/verdict/disparity.d.ts +105 -0
  59. package/dist/verdict/disparity.js +40 -0
  60. package/dist/verdict/findings.d.ts +11 -0
  61. package/dist/verdict/findings.js +16 -0
  62. package/dist/verdict/instrumentation-coverage.d.ts +115 -0
  63. package/dist/verdict/instrumentation-coverage.js +226 -0
  64. package/dist/verdict/instrumentation-gap.js +1 -1
  65. package/dist/verdict/intent.d.ts +19 -5
  66. package/dist/verdict/intent.js +13 -1
  67. package/dist/verdict/predicate-tree.d.ts +15 -0
  68. package/dist/verdict/predicate-tree.js +21 -0
  69. package/dist/verdict/predicate.d.ts +28 -0
  70. package/dist/verdict/predicate.js +94 -15
  71. package/dist/verdict/security.d.ts +25 -0
  72. package/dist/verdict/security.js +82 -0
  73. package/dist/verdict/verdict-attribution.js +1 -0
  74. package/dist/verdict/verification-run.d.ts +638 -32
  75. package/dist/verdict/verification-run.js +90 -0
  76. package/dist/verdict/verified-constants.d.ts +19 -0
  77. package/dist/verdict/verified-constants.js +22 -0
  78. package/dist/wire/constants/constants.d.ts +60 -32
  79. package/dist/wire/constants/constants.js +61 -33
  80. package/dist/wire/constants/hud-controls.d.ts +1 -1
  81. package/dist/wire/constants/hud-controls.js +34 -1
  82. package/dist/wire/constants/hud-use.d.ts +89 -1
  83. package/dist/wire/constants/hud-use.js +62 -1
  84. package/dist/wire/constants/mcp-wire.d.ts +10 -0
  85. package/dist/wire/constants/mcp-wire.js +10 -0
  86. package/dist/wire/constants/reticle-chrome.d.ts +19 -0
  87. package/dist/wire/constants/reticle-chrome.js +19 -0
  88. package/dist/wire/constants/session-constants.d.ts +21 -0
  89. package/dist/wire/constants/session-constants.js +21 -0
  90. package/dist/wire/desktop-contract.d.ts +11 -0
  91. package/dist/wire/desktop-contract.js +14 -0
  92. package/dist/wire/event-payloads.d.ts +77 -4
  93. package/dist/wire/event-payloads.js +27 -0
  94. package/dist/wire/global-press.d.ts +34 -3
  95. package/dist/wire/global-press.js +91 -3
  96. package/dist/wire/hold.d.ts +14 -0
  97. package/dist/wire/hold.js +18 -0
  98. package/dist/wire/messages.d.ts +129 -32
  99. package/dist/wire/messages.js +17 -1
  100. package/dist/wire/platform-link.d.ts +238 -0
  101. package/dist/wire/platform-link.js +234 -0
  102. package/dist/wire/tool-names.d.ts +2 -0
  103. package/dist/wire/tool-names.js +2 -0
  104. package/dist/wire/types.d.ts +26 -6
  105. package/dist/wire/types.js +5 -0
  106. package/dist/words/no-session-reason.d.ts +7 -0
  107. package/dist/words/no-session-reason.js +7 -0
  108. package/dist/words/notices.d.ts +1 -1
  109. package/dist/words/notices.js +5 -3
  110. package/dist/words/upgrade.js +1 -1
  111. package/dist/words/writing-rule.d.ts +14 -0
  112. package/dist/words/writing-rule.js +17 -0
  113. package/package.json +1 -1
@@ -35,6 +35,20 @@ export const StreamTransport = { SSE: 'sse', WS: 'ws', FETCH: 'fetch' };
35
35
  /** `CLOSE` pairs with `OPEN`: until it arrives, the body is still being written. */
36
36
  export const StreamDirection = { OPEN: 'open', IN: 'in', OUT: 'out', CLOSE: 'close' };
37
37
  export const ScrollDirection = { UP: 'up', DOWN: 'down' };
38
+ /**
39
+ * How a `route.change` happened.
40
+ *
41
+ * `push` is `history.pushState`, `replace` is `history.replaceState`, and `pop` is the session
42
+ * history moving under the page (`popstate`, or a `hashchange` the page did not push). A
43
+ * same-pathname replace records UI state in the URL; it is not a navigation to a new view.
44
+ */
45
+ export const RouteChangeHow = {
46
+ PUSH: 'push',
47
+ REPLACE: 'replace',
48
+ POP: 'pop',
49
+ };
50
+ /** Wire field on `route.change` carrying a `RouteChangeHow`. */
51
+ export const ROUTE_CHANGE_HOW_FIELD = 'how';
38
52
  /**
39
53
  * The three readable client-side storage areas.
40
54
  *
@@ -97,6 +111,12 @@ const netStreamSchema = z
97
111
  transport: z.nativeEnum(StreamTransport),
98
112
  direction: z.nativeEnum(StreamDirection),
99
113
  url: z.string(),
114
+ // The match haystack, exactly as NET_PENDING carries it. A stream record whose URL was redacted
115
+ // is classified by the same `urlForMatch` every other consumer uses; without the raw copy here
116
+ // the stream half of one request and the pending half disagree about whose traffic it is, and a
117
+ // declared `background` endpoint comes back into the settle count through the one field the
118
+ // classifier could not see.
119
+ urlRaw: z.string().optional(),
100
120
  })
101
121
  .passthrough();
102
122
  const netRequestSchema = z
@@ -139,6 +159,8 @@ export const EVENT_PAYLOAD_SCHEMAS = {
139
159
  metric: z.nativeEnum(PerfMetric),
140
160
  value: z.number(),
141
161
  at: z.number(),
162
+ // CLS only: the element the shift moved most, so the value has somewhere to point (#1266).
163
+ shifted: z.object({ ref: z.string(), selector: z.string() }).optional(),
142
164
  }),
143
165
  [EventType.ROUTE_CHANGE]: z.object({
144
166
  from: z.string(),
@@ -146,6 +168,7 @@ export const EVENT_PAYLOAD_SCHEMAS = {
146
168
  pathname: z.string(),
147
169
  search: z.string(),
148
170
  hash: z.string(),
171
+ [ROUTE_CHANGE_HOW_FIELD]: z.nativeEnum(RouteChangeHow),
149
172
  }),
150
173
  [EventType.CONSOLE_LOG]: consoleSchema,
151
174
  [EventType.CONSOLE_WARN]: consoleSchema,
@@ -207,6 +230,10 @@ export const EVENT_PAYLOAD_SCHEMAS = {
207
230
  runtime: z.string().optional(),
208
231
  /** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
209
232
  engine: z.string().optional(),
233
+ /** The desktop shell's own name for this window (Tauri's label: `main`, `setup`). */
234
+ windowLabel: z.string().optional(),
235
+ /** The HTTP status the document was served with, when the page could read it. */
236
+ documentStatus: z.number().int().optional(),
210
237
  })
211
238
  .passthrough(),
212
239
  // 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,18 @@ 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";
16
+ readonly HARNESS_RUN: "harness-run";
17
+ readonly HARNESS_STOP: "harness-stop";
18
+ readonly HARNESS_LINK: "harness-link";
15
19
  }>;
16
20
  text: z.ZodOptional<z.ZodString>;
17
21
  }, "strip", z.ZodTypeAny, {
18
- kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync";
22
+ kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync" | "signin" | "harness-run" | "harness-stop" | "harness-link";
19
23
  text?: string | undefined;
20
24
  }, {
21
- kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync";
25
+ kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync" | "signin" | "harness-run" | "harness-stop" | "harness-link";
22
26
  text?: string | undefined;
23
27
  }>;
24
28
  export type HumanControlData = z.infer<typeof HumanControlDataSchema>;
@@ -41,20 +45,36 @@ export declare const HudUseDataSchema: z.ZodObject<{
41
45
  }>>;
42
46
  panel: z.ZodOptional<z.ZodNativeEnum<{
43
47
  readonly CHAT: "chat";
48
+ readonly FLOWS: "flows";
49
+ readonly NOTES: "notes";
50
+ readonly HARNESS: "harness";
44
51
  readonly SETTINGS: "settings";
45
52
  readonly REPORT: "report";
53
+ readonly ACCOUNT: "account";
46
54
  readonly NONE: "none";
47
55
  }>>;
56
+ /** A rail slide that became the visible one. Its shape is checked where it is counted. */
57
+ slide: z.ZodOptional<z.ZodString>;
58
+ /** A sign-in or link prompt became visible on this surface. */
59
+ prompt: z.ZodOptional<z.ZodNativeEnum<{
60
+ readonly RAIL: "rail";
61
+ readonly HARNESS: "harness";
62
+ readonly HEADER: "header";
63
+ }>>;
48
64
  }, "strip", z.ZodTypeAny, {
49
65
  control?: string | undefined;
50
66
  toggle?: "on" | "off" | undefined;
51
67
  view?: "expanded" | "bubble" | "collapsed" | undefined;
52
- panel?: "none" | "chat" | "settings" | "report" | undefined;
68
+ panel?: "flows" | "harness" | "none" | "chat" | "notes" | "settings" | "report" | "account" | undefined;
69
+ slide?: string | undefined;
70
+ prompt?: "harness" | "rail" | "header" | undefined;
53
71
  }, {
54
72
  control?: string | undefined;
55
73
  toggle?: "on" | "off" | undefined;
56
74
  view?: "expanded" | "bubble" | "collapsed" | undefined;
57
- panel?: "none" | "chat" | "settings" | "report" | undefined;
75
+ panel?: "flows" | "harness" | "none" | "chat" | "notes" | "settings" | "report" | "account" | undefined;
76
+ slide?: string | undefined;
77
+ prompt?: "harness" | "rail" | "header" | undefined;
58
78
  }>;
59
79
  export type HudUseData = z.infer<typeof HudUseDataSchema>;
60
80
  /**
@@ -203,21 +223,21 @@ export declare const ReticleEventSchema: z.ZodObject<{
203
223
  data: Record<string, unknown>;
204
224
  t: number;
205
225
  sessionId: string;
206
- editEpoch?: number | undefined;
207
- ref?: string | undefined;
208
226
  seq?: number | undefined;
209
227
  actionId?: string | undefined;
228
+ editEpoch?: number | undefined;
229
+ ref?: string | undefined;
210
230
  attribution?: "window" | undefined;
211
231
  documentId?: string | undefined;
212
232
  }, {
213
233
  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";
214
234
  t: number;
215
235
  sessionId: string;
236
+ seq?: number | undefined;
237
+ actionId?: string | undefined;
216
238
  editEpoch?: number | undefined;
217
239
  data?: Record<string, unknown> | undefined;
218
240
  ref?: string | undefined;
219
- seq?: number | undefined;
220
- actionId?: string | undefined;
221
241
  attribution?: "window" | undefined;
222
242
  documentId?: string | undefined;
223
243
  }>;
@@ -378,14 +398,14 @@ export declare const HelloMessageSchema: z.ZodObject<{
378
398
  }, "strip", z.ZodTypeAny, {
379
399
  kind: "hello";
380
400
  url: string;
401
+ adapters: string[];
381
402
  sessionId: string;
382
403
  protocolVersion: number;
383
404
  title: string;
384
- adapters: string[];
385
405
  projectId?: string | undefined;
386
- token?: string | undefined;
387
406
  platform?: "native" | "web" | "webview" | "service" | undefined;
388
407
  channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
408
+ token?: string | undefined;
389
409
  commands?: string[] | undefined;
390
410
  contractParts?: {
391
411
  events: string[];
@@ -401,14 +421,14 @@ export declare const HelloMessageSchema: z.ZodObject<{
401
421
  }, {
402
422
  kind: "hello";
403
423
  url: string;
424
+ adapters: string[];
404
425
  sessionId: string;
405
426
  protocolVersion: number;
406
427
  title: string;
407
- adapters: string[];
408
428
  projectId?: string | undefined;
409
- token?: string | undefined;
410
429
  platform?: "native" | "web" | "webview" | "service" | undefined;
411
430
  channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
431
+ token?: string | undefined;
412
432
  commands?: string[] | undefined;
413
433
  contractParts?: {
414
434
  events: string[];
@@ -424,24 +444,65 @@ export declare const HelloMessageSchema: z.ZodObject<{
424
444
  }>;
425
445
  export type HelloMessage = z.infer<typeof HelloMessageSchema>;
426
446
  /** Agent -> browser request, routed by the bridge with a correlation id. */
447
+ /** Who sent a command: the Harness, or (when absent) the agent connected to the daemon. */
448
+ export declare const CommandActor: {
449
+ readonly HARNESS: "harness";
450
+ };
451
+ export type CommandActor = (typeof CommandActor)[keyof typeof CommandActor];
427
452
  export declare const CommandMessageSchema: z.ZodObject<{
428
453
  kind: z.ZodLiteral<"command">;
429
454
  id: z.ZodString;
430
455
  sessionId: z.ZodOptional<z.ZodString>;
431
456
  name: z.ZodString;
432
457
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
458
+ /** Set when the Harness sent it, so the HUD can say who is driving. */
459
+ by: z.ZodOptional<z.ZodNativeEnum<{
460
+ readonly HARNESS: "harness";
461
+ }>>;
462
+ /**
463
+ * Set on a Harness command a model chose: the outward actions (`OutwardAction`) its journey asks
464
+ * for. The page presses no other outward control. Absent: not gated (an agent, a saved flow).
465
+ */
466
+ outward: z.ZodOptional<z.ZodObject<{
467
+ allowed: z.ZodArray<z.ZodNativeEnum<{
468
+ readonly INVITE: "invite";
469
+ readonly SEND: "send";
470
+ readonly SHARE: "share";
471
+ readonly DELETE: "delete";
472
+ readonly PAY: "pay";
473
+ readonly PUBLISH: "publish";
474
+ readonly REVOKE: "revoke";
475
+ readonly TRANSFER: "transfer";
476
+ readonly SIGN_OUT: "sign out";
477
+ readonly CHANGE_ROLE: "change role";
478
+ readonly CREATE_KEY: "create key";
479
+ readonly CHANGE_STATE: "change state";
480
+ }>, "many">;
481
+ }, "strip", z.ZodTypeAny, {
482
+ allowed: ("invite" | "send" | "share" | "delete" | "pay" | "publish" | "revoke" | "transfer" | "sign out" | "change role" | "create key" | "change state")[];
483
+ }, {
484
+ allowed: ("invite" | "send" | "share" | "delete" | "pay" | "publish" | "revoke" | "transfer" | "sign out" | "change role" | "create key" | "change state")[];
485
+ }>>;
433
486
  }, "strip", z.ZodTypeAny, {
434
487
  kind: "command";
435
488
  name: string;
436
489
  id: string;
437
490
  args: Record<string, unknown>;
491
+ by?: "harness" | undefined;
438
492
  sessionId?: string | undefined;
493
+ outward?: {
494
+ allowed: ("invite" | "send" | "share" | "delete" | "pay" | "publish" | "revoke" | "transfer" | "sign out" | "change role" | "create key" | "change state")[];
495
+ } | undefined;
439
496
  }, {
440
497
  kind: "command";
441
498
  name: string;
442
499
  id: string;
500
+ by?: "harness" | undefined;
443
501
  args?: Record<string, unknown> | undefined;
444
502
  sessionId?: string | undefined;
503
+ outward?: {
504
+ allowed: ("invite" | "send" | "share" | "delete" | "pay" | "publish" | "revoke" | "transfer" | "sign out" | "change role" | "create key" | "change state")[];
505
+ } | undefined;
445
506
  }>;
446
507
  export type CommandMessage = z.infer<typeof CommandMessageSchema>;
447
508
  /** Browser -> agent reply to a command. */
@@ -553,21 +614,21 @@ export declare const EventMessageSchema: z.ZodObject<{
553
614
  data: Record<string, unknown>;
554
615
  t: number;
555
616
  sessionId: string;
556
- editEpoch?: number | undefined;
557
- ref?: string | undefined;
558
617
  seq?: number | undefined;
559
618
  actionId?: string | undefined;
619
+ editEpoch?: number | undefined;
620
+ ref?: string | undefined;
560
621
  attribution?: "window" | undefined;
561
622
  documentId?: string | undefined;
562
623
  }, {
563
624
  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";
564
625
  t: number;
565
626
  sessionId: string;
627
+ seq?: number | undefined;
628
+ actionId?: string | undefined;
566
629
  editEpoch?: number | undefined;
567
630
  data?: Record<string, unknown> | undefined;
568
631
  ref?: string | undefined;
569
- seq?: number | undefined;
570
- actionId?: string | undefined;
571
632
  attribution?: "window" | undefined;
572
633
  documentId?: string | undefined;
573
634
  }>;
@@ -578,10 +639,10 @@ export declare const EventMessageSchema: z.ZodObject<{
578
639
  data: Record<string, unknown>;
579
640
  t: number;
580
641
  sessionId: string;
581
- editEpoch?: number | undefined;
582
- ref?: string | undefined;
583
642
  seq?: number | undefined;
584
643
  actionId?: string | undefined;
644
+ editEpoch?: number | undefined;
645
+ ref?: string | undefined;
585
646
  attribution?: "window" | undefined;
586
647
  documentId?: string | undefined;
587
648
  };
@@ -591,11 +652,11 @@ export declare const EventMessageSchema: z.ZodObject<{
591
652
  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";
592
653
  t: number;
593
654
  sessionId: string;
655
+ seq?: number | undefined;
656
+ actionId?: string | undefined;
594
657
  editEpoch?: number | undefined;
595
658
  data?: Record<string, unknown> | undefined;
596
659
  ref?: string | undefined;
597
- seq?: number | undefined;
598
- actionId?: string | undefined;
599
660
  attribution?: "window" | undefined;
600
661
  documentId?: string | undefined;
601
662
  };
@@ -756,14 +817,14 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
756
817
  }, "strip", z.ZodTypeAny, {
757
818
  kind: "hello";
758
819
  url: string;
820
+ adapters: string[];
759
821
  sessionId: string;
760
822
  protocolVersion: number;
761
823
  title: string;
762
- adapters: string[];
763
824
  projectId?: string | undefined;
764
- token?: string | undefined;
765
825
  platform?: "native" | "web" | "webview" | "service" | undefined;
766
826
  channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
827
+ token?: string | undefined;
767
828
  commands?: string[] | undefined;
768
829
  contractParts?: {
769
830
  events: string[];
@@ -779,14 +840,14 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
779
840
  }, {
780
841
  kind: "hello";
781
842
  url: string;
843
+ adapters: string[];
782
844
  sessionId: string;
783
845
  protocolVersion: number;
784
846
  title: string;
785
- adapters: string[];
786
847
  projectId?: string | undefined;
787
- token?: string | undefined;
788
848
  platform?: "native" | "web" | "webview" | "service" | undefined;
789
849
  channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
850
+ token?: string | undefined;
790
851
  commands?: string[] | undefined;
791
852
  contractParts?: {
792
853
  events: string[];
@@ -805,18 +866,54 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
805
866
  sessionId: z.ZodOptional<z.ZodString>;
806
867
  name: z.ZodString;
807
868
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
869
+ /** Set when the Harness sent it, so the HUD can say who is driving. */
870
+ by: z.ZodOptional<z.ZodNativeEnum<{
871
+ readonly HARNESS: "harness";
872
+ }>>;
873
+ /**
874
+ * Set on a Harness command a model chose: the outward actions (`OutwardAction`) its journey asks
875
+ * for. The page presses no other outward control. Absent: not gated (an agent, a saved flow).
876
+ */
877
+ outward: z.ZodOptional<z.ZodObject<{
878
+ allowed: z.ZodArray<z.ZodNativeEnum<{
879
+ readonly INVITE: "invite";
880
+ readonly SEND: "send";
881
+ readonly SHARE: "share";
882
+ readonly DELETE: "delete";
883
+ readonly PAY: "pay";
884
+ readonly PUBLISH: "publish";
885
+ readonly REVOKE: "revoke";
886
+ readonly TRANSFER: "transfer";
887
+ readonly SIGN_OUT: "sign out";
888
+ readonly CHANGE_ROLE: "change role";
889
+ readonly CREATE_KEY: "create key";
890
+ readonly CHANGE_STATE: "change state";
891
+ }>, "many">;
892
+ }, "strip", z.ZodTypeAny, {
893
+ allowed: ("invite" | "send" | "share" | "delete" | "pay" | "publish" | "revoke" | "transfer" | "sign out" | "change role" | "create key" | "change state")[];
894
+ }, {
895
+ allowed: ("invite" | "send" | "share" | "delete" | "pay" | "publish" | "revoke" | "transfer" | "sign out" | "change role" | "create key" | "change state")[];
896
+ }>>;
808
897
  }, "strip", z.ZodTypeAny, {
809
898
  kind: "command";
810
899
  name: string;
811
900
  id: string;
812
901
  args: Record<string, unknown>;
902
+ by?: "harness" | undefined;
813
903
  sessionId?: string | undefined;
904
+ outward?: {
905
+ allowed: ("invite" | "send" | "share" | "delete" | "pay" | "publish" | "revoke" | "transfer" | "sign out" | "change role" | "create key" | "change state")[];
906
+ } | undefined;
814
907
  }, {
815
908
  kind: "command";
816
909
  name: string;
817
910
  id: string;
911
+ by?: "harness" | undefined;
818
912
  args?: Record<string, unknown> | undefined;
819
913
  sessionId?: string | undefined;
914
+ outward?: {
915
+ allowed: ("invite" | "send" | "share" | "delete" | "pay" | "publish" | "revoke" | "transfer" | "sign out" | "change role" | "create key" | "change state")[];
916
+ } | undefined;
820
917
  }>, z.ZodObject<{
821
918
  kind: z.ZodLiteral<"command_result">;
822
919
  id: z.ZodString;
@@ -922,21 +1019,21 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
922
1019
  data: Record<string, unknown>;
923
1020
  t: number;
924
1021
  sessionId: string;
925
- editEpoch?: number | undefined;
926
- ref?: string | undefined;
927
1022
  seq?: number | undefined;
928
1023
  actionId?: string | undefined;
1024
+ editEpoch?: number | undefined;
1025
+ ref?: string | undefined;
929
1026
  attribution?: "window" | undefined;
930
1027
  documentId?: string | undefined;
931
1028
  }, {
932
1029
  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";
933
1030
  t: number;
934
1031
  sessionId: string;
1032
+ seq?: number | undefined;
1033
+ actionId?: string | undefined;
935
1034
  editEpoch?: number | undefined;
936
1035
  data?: Record<string, unknown> | undefined;
937
1036
  ref?: string | undefined;
938
- seq?: number | undefined;
939
- actionId?: string | undefined;
940
1037
  attribution?: "window" | undefined;
941
1038
  documentId?: string | undefined;
942
1039
  }>;
@@ -947,10 +1044,10 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
947
1044
  data: Record<string, unknown>;
948
1045
  t: number;
949
1046
  sessionId: string;
950
- editEpoch?: number | undefined;
951
- ref?: string | undefined;
952
1047
  seq?: number | undefined;
953
1048
  actionId?: string | undefined;
1049
+ editEpoch?: number | undefined;
1050
+ ref?: string | undefined;
954
1051
  attribution?: "window" | undefined;
955
1052
  documentId?: string | undefined;
956
1053
  };
@@ -960,11 +1057,11 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
960
1057
  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";
961
1058
  t: number;
962
1059
  sessionId: string;
1060
+ seq?: number | undefined;
1061
+ actionId?: string | undefined;
963
1062
  editEpoch?: number | undefined;
964
1063
  data?: Record<string, unknown> | undefined;
965
1064
  ref?: string | undefined;
966
- seq?: number | undefined;
967
- actionId?: string | undefined;
968
1065
  attribution?: "window" | undefined;
969
1066
  documentId?: string | undefined;
970
1067
  };