@reticlehq/core 3.10.11 → 3.11.1

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 (56) hide show
  1. package/dist/artifacts/flow-results.d.ts +34 -0
  2. package/dist/identity/github-action.d.ts +2 -2
  3. package/dist/identity/github-action.js +1 -1
  4. package/dist/index.d.ts +6 -0
  5. package/dist/index.js +6 -0
  6. package/dist/page-entry.d.ts +5 -2
  7. package/dist/page-entry.js +5 -2
  8. package/dist/realm/picture-text.d.ts +22 -0
  9. package/dist/realm/picture-text.js +19 -0
  10. package/dist/realm/registry.d.ts +15 -0
  11. package/dist/realm/registry.js +38 -2
  12. package/dist/schema/command-name.json +1 -0
  13. package/dist/schema/event-payloads.json +12 -0
  14. package/dist/schema/hello-message.json +5 -0
  15. package/dist/schema/reticle-message.json +5 -0
  16. package/dist/telemetry-bug.d.ts +7 -0
  17. package/dist/telemetry-bug.js +3 -0
  18. package/dist/telemetry-feedback.d.ts +15 -0
  19. package/dist/telemetry-feedback.js +7 -1
  20. package/dist/telemetry.d.ts +23 -0
  21. package/dist/telemetry.js +6 -1
  22. package/dist/verdict/check-sentence.js +8 -1
  23. package/dist/verdict/findings.d.ts +23 -0
  24. package/dist/verdict/findings.js +19 -0
  25. package/dist/verdict/property-assertion.d.ts +5 -0
  26. package/dist/verdict/property-assertion.js +36 -0
  27. package/dist/wire/click-input.d.ts +22 -1
  28. package/dist/wire/click-input.js +35 -1
  29. package/dist/wire/constants/constants.d.ts +13 -3
  30. package/dist/wire/constants/constants.js +14 -3
  31. package/dist/wire/constants/dialog-consent.d.ts +20 -0
  32. package/dist/wire/constants/dialog-consent.js +20 -0
  33. package/dist/wire/constants/event-types.d.ts +10 -0
  34. package/dist/wire/constants/event-types.js +10 -0
  35. package/dist/wire/constants/match-args.d.ts +2 -0
  36. package/dist/wire/constants/match-args.js +2 -0
  37. package/dist/wire/constants/navigate-history.d.ts +29 -0
  38. package/dist/wire/constants/navigate-history.js +27 -0
  39. package/dist/wire/constants/render-stats.d.ts +24 -0
  40. package/dist/wire/constants/render-stats.js +22 -0
  41. package/dist/wire/constants/reticle-env.d.ts +3 -0
  42. package/dist/wire/constants/reticle-env.js +3 -0
  43. package/dist/wire/constants/window-arrangement.d.ts +16 -0
  44. package/dist/wire/constants/window-arrangement.js +16 -0
  45. package/dist/wire/event-payloads.d.ts +4 -1
  46. package/dist/wire/event-payloads.js +19 -2
  47. package/dist/wire/messages.d.ts +13 -0
  48. package/dist/wire/messages.js +15 -0
  49. package/dist/wire/production/production-policy.d.ts +6 -1
  50. package/dist/wire/production/production-policy.js +6 -1
  51. package/dist/wire/tool-names.d.ts +12 -0
  52. package/dist/wire/tool-names.js +13 -0
  53. package/dist/wire/types.d.ts +8 -0
  54. package/dist/words/faded-reason.d.ts +11 -0
  55. package/dist/words/faded-reason.js +15 -0
  56. package/package.json +1 -1
@@ -40,3 +40,39 @@ export const propertyAssertionSchema = z.discriminatedUnion('property', [
40
40
  z.object({ property: z.literal('increased'), by: deltaSchema.optional() }).strict(),
41
41
  z.object({ property: z.literal('decreased'), by: deltaSchema.optional() }).strict(),
42
42
  ]);
43
+ /**
44
+ * A short phrase describing a property assertion for claim titles and sentences.
45
+ * e.g. "matching /\d+ items/", "that is non-empty"
46
+ */
47
+ export function describePropertyAssertion(assertion) {
48
+ switch (assertion.property) {
49
+ case 'matchesPattern':
50
+ return `matching /${assertion.pattern}/`;
51
+ case 'nonEmpty':
52
+ return 'that is non-empty';
53
+ case 'oneOf':
54
+ return `matching one of ${JSON.stringify(assertion.values)}`;
55
+ case 'withinTolerance':
56
+ return `within ${String(assertion.tolerance)} of ${String(assertion.of)}`;
57
+ case 'type':
58
+ return `of type ${assertion.is}`;
59
+ case 'changed':
60
+ return 'that changed';
61
+ case 'unchanged':
62
+ return 'that is unchanged';
63
+ case 'increased':
64
+ if (assertion.by === undefined) {
65
+ return 'that increased';
66
+ }
67
+ return assertion.by.tolerance !== undefined
68
+ ? `increased by ${assertion.by.op} ${String(assertion.by.value)} (±${String(assertion.by.tolerance)})`
69
+ : `increased by ${assertion.by.op} ${String(assertion.by.value)}`;
70
+ case 'decreased':
71
+ if (assertion.by === undefined) {
72
+ return 'that decreased';
73
+ }
74
+ return assertion.by.tolerance !== undefined
75
+ ? `decreased by ${assertion.by.op} ${String(assertion.by.value)} (±${String(assertion.by.tolerance)})`
76
+ : `decreased by ${assertion.by.op} ${String(assertion.by.value)}`;
77
+ }
78
+ }
@@ -17,6 +17,18 @@ export declare function clickInputProblem(action: ActionType, args: Record<strin
17
17
  export declare const ACT_POINT_ARG = "at";
18
18
  /** The drag argument for the end point inside the drop target, or inside the source. */
19
19
  export declare const DRAG_TO_POINT_ARG = "to";
20
+ /**
21
+ * A point of the last picture of the screen (`reticle_screenshot`), `{ x, y }` in its pixels. Only
22
+ * a desktop realm takes it: the way to act on an application, or a part of one, that gives no
23
+ * element. `at` stays a fraction of the element's box in every realm.
24
+ */
25
+ export declare const PICTURE_POINT_ARG = "point";
26
+ /** The end of a drag as a point of the last picture of the screen, in its pixels. Desktop only. */
27
+ export declare const DRAG_TO_PICTURE_POINT_ARG = "toPoint";
28
+ /** The end of a drag on another element, by its ref: a card onto a list, a file onto a folder. */
29
+ export declare const DRAG_TO_REF_ARG = "toRef";
30
+ /** The act arguments that only a desktop realm takes. A page refuses each of them. */
31
+ export declare const DESKTOP_ONLY_ARGS: readonly string[];
20
32
  /** A point as fractions of a box: 0 is the left or top edge, 1 the right or bottom edge. */
21
33
  export interface BoxFraction {
22
34
  x: number;
@@ -37,5 +49,14 @@ export declare function pointInBox(box: {
37
49
  /**
38
50
  * Why `at` or `to` cannot be honoured on this action, or undefined when it can or is absent. A point
39
51
  * that is not two numbers is refused: an action at the centre is not the action that was asked for.
52
+ *
53
+ * `desktop` is true for a desktop session (a peer realm such as Reticle's computer). It takes the
54
+ * window action and the points of a picture, which a page refuses.
55
+ */
56
+ export declare function actPointProblem(action: string, args: Record<string, unknown>, desktop?: boolean): string | undefined;
57
+ /**
58
+ * Why a page refuses the act, when it is an action or has an argument that only a desktop realm
59
+ * takes. Undefined when there is none. A page that ignored `point` would act at the centre of the
60
+ * element and report the action that was asked for.
40
61
  */
41
- export declare function actPointProblem(action: string, args: Record<string, unknown>): string | undefined;
62
+ export declare function desktopArgProblem(args: Record<string, unknown>, action?: string): string | undefined;
@@ -1,4 +1,5 @@
1
1
  import { ActionType } from './constants/constants.js';
2
+ import { WINDOW_NEEDS_DESKTOP_MSG } from './constants/window-arrangement.js';
2
3
  import { pressModifiersFromArgs } from './global-press.js';
3
4
  /** The pointer buttons a click can use, as the agent spells them in `args.button`. */
4
5
  export const ClickButton = {
@@ -57,6 +58,18 @@ export function clickInputProblem(action, args) {
57
58
  export const ACT_POINT_ARG = 'at';
58
59
  /** The drag argument for the end point inside the drop target, or inside the source. */
59
60
  export const DRAG_TO_POINT_ARG = 'to';
61
+ /**
62
+ * A point of the last picture of the screen (`reticle_screenshot`), `{ x, y }` in its pixels. Only
63
+ * a desktop realm takes it: the way to act on an application, or a part of one, that gives no
64
+ * element. `at` stays a fraction of the element's box in every realm.
65
+ */
66
+ export const PICTURE_POINT_ARG = 'point';
67
+ /** The end of a drag as a point of the last picture of the screen, in its pixels. Desktop only. */
68
+ export const DRAG_TO_PICTURE_POINT_ARG = 'toPoint';
69
+ /** The end of a drag on another element, by its ref: a card onto a list, a file onto a folder. */
70
+ export const DRAG_TO_REF_ARG = 'toRef';
71
+ /** The act arguments that only a desktop realm takes. A page refuses each of them. */
72
+ export const DESKTOP_ONLY_ARGS = [PICTURE_POINT_ARG, DRAG_TO_PICTURE_POINT_ARG];
60
73
  /** The actions that land at a point. */
61
74
  const POINT_ACTIONS = new Set([
62
75
  ActionType.CLICK,
@@ -87,8 +100,15 @@ export function pointInBox(box, at) {
87
100
  /**
88
101
  * Why `at` or `to` cannot be honoured on this action, or undefined when it can or is absent. A point
89
102
  * that is not two numbers is refused: an action at the centre is not the action that was asked for.
103
+ *
104
+ * `desktop` is true for a desktop session (a peer realm such as Reticle's computer). It takes the
105
+ * window action and the points of a picture, which a page refuses.
90
106
  */
91
- export function actPointProblem(action, args) {
107
+ export function actPointProblem(action, args, desktop = false) {
108
+ const pageOnly = desktop ? undefined : desktopArgProblem(args, action);
109
+ if (pageOnly !== undefined) {
110
+ return pageOnly;
111
+ }
92
112
  for (const key of [ACT_POINT_ARG, DRAG_TO_POINT_ARG]) {
93
113
  if (args[key] === undefined) {
94
114
  continue;
@@ -105,3 +125,17 @@ export function actPointProblem(action, args) {
105
125
  }
106
126
  return undefined;
107
127
  }
128
+ /**
129
+ * Why a page refuses the act, when it is an action or has an argument that only a desktop realm
130
+ * takes. Undefined when there is none. A page that ignored `point` would act at the centre of the
131
+ * element and report the action that was asked for.
132
+ */
133
+ export function desktopArgProblem(args, action) {
134
+ if (ActionType.WINDOW === action) {
135
+ return WINDOW_NEEDS_DESKTOP_MSG;
136
+ }
137
+ const key = DESKTOP_ONLY_ARGS.find((name) => args[name] !== undefined);
138
+ return key === undefined
139
+ ? undefined
140
+ : `\`${key}\` is for a desktop session, where a point of a picture of the screen or another window has a meaning. In a page, use \`${ACT_POINT_ARG}\` and \`${DRAG_TO_POINT_ARG}\`: fractions of the element's box.`;
141
+ }
@@ -575,6 +575,7 @@ export declare const InputModeReason: {
575
575
  /** A production drive presses only in the page. A native key goes to whatever holds focus, so
576
576
  * the production policy could not judge the control it pressed. */
577
577
  readonly PRODUCTION_PRESS_IN_PAGE: "production-drive-presses-in-page";
578
+ readonly REALM_OWN_INPUT: "the-realm-drives-its-own-input";
578
579
  };
579
580
  export type InputModeReason = (typeof InputModeReason)[keyof typeof InputModeReason];
580
581
  /** Best-effort caveats attached to action results so the agent can interpret a no-op. */
@@ -680,6 +681,15 @@ export declare const ActionType: {
680
681
  * merely looks like zoom would report it caught while the layout viewport never changed.
681
682
  */
682
683
  readonly ZOOM: "zoom";
684
+ /**
685
+ * Arrange the window that holds the element: `args.arrange` is one of `WindowArrangement`, or
686
+ * `args.frame` is `{ x, y, width, height }` in screen points from the top left of the main
687
+ * display. The answer gives the frame of the window after the change.
688
+ *
689
+ * Only a desktop realm can do it. A page cannot move or resize its own window, so the browser
690
+ * SDK refuses it and does not pretend.
691
+ */
692
+ readonly WINDOW: "window";
683
693
  };
684
694
  export type ActionType = (typeof ActionType)[keyof typeof ActionType];
685
695
  /** Why an action's settle wait ended without a real animation frame. */
@@ -800,6 +810,8 @@ export declare const ReticleCommand: {
800
810
  readonly NAVIGATE: "navigate";
801
811
  /** Reload the page. `args: { hard?: boolean }` — hard clears the cache via location replace trick. */
802
812
  readonly REFRESH: "refresh";
813
+ /** Move through the tab's history. `args: { direction: NavigateHistory }`. See navigate-history.ts. */
814
+ readonly HISTORY: "history";
803
815
  /** Bridge → browser: replayable flows, `{ flows: [{ name, start? }] }`; `start` = first testid. */
804
816
  readonly FLOWS: "flows";
805
817
  /** Bridge → browser: a HUD replay's progress, `{ name, done, total, status }`. */
@@ -832,9 +844,7 @@ export declare const MessageKind: {
832
844
  readonly EVENT: "event";
833
845
  };
834
846
  export type MessageKind = (typeof MessageKind)[keyof typeof MessageKind];
835
- /**
836
- * Why a lease returned `ready: false`. Names each distinct recovery action rather than a bare false.
837
- */
847
+ /** Why a lease returned `ready: false`. Each value names a recovery action, not a bare false. */
838
848
  export declare const LeaseNotReadyReason: {
839
849
  /** No SDK dialled in within the wait. */
840
850
  readonly SDK_NEVER_DIALLED: "sdk_never_dialled";
@@ -619,6 +619,8 @@ export const InputModeReason = {
619
619
  /** A production drive presses only in the page. A native key goes to whatever holds focus, so
620
620
  * the production policy could not judge the control it pressed. */
621
621
  PRODUCTION_PRESS_IN_PAGE: 'production-drive-presses-in-page',
622
+ // A desktop realm (Reticle's computer) moves its own pointer and keys: the page's route is not its.
623
+ REALM_OWN_INPUT: 'the-realm-drives-its-own-input',
622
624
  };
623
625
  /** Best-effort caveats attached to action results so the agent can interpret a no-op. */
624
626
  export const ActionWarning = {
@@ -726,6 +728,15 @@ export const ActionType = {
726
728
  * merely looks like zoom would report it caught while the layout viewport never changed.
727
729
  */
728
730
  ZOOM: 'zoom',
731
+ /**
732
+ * Arrange the window that holds the element: `args.arrange` is one of `WindowArrangement`, or
733
+ * `args.frame` is `{ x, y, width, height }` in screen points from the top left of the main
734
+ * display. The answer gives the frame of the window after the change.
735
+ *
736
+ * Only a desktop realm can do it. A page cannot move or resize its own window, so the browser
737
+ * SDK refuses it and does not pretend.
738
+ */
739
+ WINDOW: 'window',
729
740
  };
730
741
  /** Why an action's settle wait ended without a real animation frame. */
731
742
  export const SettleReason = {
@@ -820,6 +831,8 @@ export const ReticleCommand = {
820
831
  NAVIGATE: 'navigate',
821
832
  /** Reload the page. `args: { hard?: boolean }` — hard clears the cache via location replace trick. */
822
833
  REFRESH: 'refresh',
834
+ /** Move through the tab's history. `args: { direction: NavigateHistory }`. See navigate-history.ts. */
835
+ HISTORY: 'history',
823
836
  /** Bridge → browser: replayable flows, `{ flows: [{ name, start? }] }`; `start` = first testid. */
824
837
  FLOWS: 'flows',
825
838
  /** Bridge → browser: a HUD replay's progress, `{ name, done, total, status }`. */
@@ -848,9 +861,7 @@ export const MessageKind = {
848
861
  COMMAND_RESULT: 'command_result',
849
862
  EVENT: 'event',
850
863
  };
851
- /**
852
- * Why a lease returned `ready: false`. Names each distinct recovery action rather than a bare false.
853
- */
864
+ /** Why a lease returned `ready: false`. Each value names a recovery action, not a bare false. */
854
865
  export const LeaseNotReadyReason = {
855
866
  /** No SDK dialled in within the wait. */
856
867
  SDK_NEVER_DIALLED: 'sdk_never_dialled',
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The positive yes to the app's own `confirm()` (#2167).
3
+ *
4
+ * Kept apart from `constants.ts`, which is at the 1000-line cap. The SDK reads it for a dispatched
5
+ * action, and the server reads it for a real key press on a leased tab.
6
+ *
7
+ * `confirmDangerous` only lets a destructive control be pressed. Server paths set it for a whole run
8
+ * (a crawl, a flow replay, a declaration in `reticle_act_and_wait`), so it cannot also be the yes.
9
+ * The yes is this separate argument, and only `reticle_act`, `reticle_act_and_wait` and
10
+ * `reticle_act_sequence` set it, when the caller itself passed `confirmDangerous`. Every other path
11
+ * leaves it out, so a `confirm()` there is answered no. An SDK that meets an older daemon gets no
12
+ * such argument and answers no too.
13
+ */
14
+ /**
15
+ * Set by the server on an action whose caller passed `confirmDangerous`: a yes to its `confirm()`.
16
+ * The name is short on purpose: the page must read it, so each character is paid on every page load.
17
+ */
18
+ export declare const DIALOG_CONSENT_ARG = "yes";
19
+ /** The `kind` of a native `window.confirm` dialog, the only kind the yes applies to. */
20
+ export declare const CONFIRM_DIALOG_KIND = "confirm";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The positive yes to the app's own `confirm()` (#2167).
3
+ *
4
+ * Kept apart from `constants.ts`, which is at the 1000-line cap. The SDK reads it for a dispatched
5
+ * action, and the server reads it for a real key press on a leased tab.
6
+ *
7
+ * `confirmDangerous` only lets a destructive control be pressed. Server paths set it for a whole run
8
+ * (a crawl, a flow replay, a declaration in `reticle_act_and_wait`), so it cannot also be the yes.
9
+ * The yes is this separate argument, and only `reticle_act`, `reticle_act_and_wait` and
10
+ * `reticle_act_sequence` set it, when the caller itself passed `confirmDangerous`. Every other path
11
+ * leaves it out, so a `confirm()` there is answered no. An SDK that meets an older daemon gets no
12
+ * such argument and answers no too.
13
+ */
14
+ /**
15
+ * Set by the server on an action whose caller passed `confirmDangerous`: a yes to its `confirm()`.
16
+ * The name is short on purpose: the page must read it, so each character is paid on every page load.
17
+ */
18
+ export const DIALOG_CONSENT_ARG = 'yes';
19
+ /** The `kind` of a native `window.confirm` dialog, the only kind the yes applies to. */
20
+ export const CONFIRM_DIALOG_KIND = 'confirm';
@@ -224,6 +224,16 @@ export declare const RouteChangeHow: {
224
224
  export type RouteChangeHow = (typeof RouteChangeHow)[keyof typeof RouteChangeHow];
225
225
  /** Wire field on `route.change` carrying a `RouteChangeHow`. */
226
226
  export declare const ROUTE_CHANGE_HOW_FIELD = "how";
227
+ /**
228
+ * Wire field on `dom.attr` and `dom.text` carrying the minted refs of the changed element's
229
+ * ancestors, nearest first.
230
+ *
231
+ * A change on a descendant of the acted control — a label living in a child span of the clicked
232
+ * button (#2318) — reports the descendant's ref. Without this field the wire carries no way to
233
+ * tell "inside the control the action touched" from churn on an unrelated element. Only refs the
234
+ * agent was already shown are collected; the field never mints one.
235
+ */
236
+ export declare const INSIDE_FIELD = "inside";
227
237
  /**
228
238
  * Why a `field.change` was emitted.
229
239
  *
@@ -201,6 +201,16 @@ export const RouteChangeHow = {
201
201
  };
202
202
  /** Wire field on `route.change` carrying a `RouteChangeHow`. */
203
203
  export const ROUTE_CHANGE_HOW_FIELD = 'how';
204
+ /**
205
+ * Wire field on `dom.attr` and `dom.text` carrying the minted refs of the changed element's
206
+ * ancestors, nearest first.
207
+ *
208
+ * A change on a descendant of the acted control — a label living in a child span of the clicked
209
+ * button (#2318) — reports the descendant's ref. Without this field the wire carries no way to
210
+ * tell "inside the control the action touched" from churn on an unrelated element. Only refs the
211
+ * agent was already shown are collected; the field never mints one.
212
+ */
213
+ export const INSIDE_FIELD = 'inside';
204
214
  /**
205
215
  * Why a `field.change` was emitted.
206
216
  *
@@ -16,4 +16,6 @@
16
16
  export declare const MatchArg: {
17
17
  /** `true` describes each match with up to `TRANSPORT_LIMITS.MAX_FULL_TEXT` characters of text, not the display-sized 80. */
18
18
  readonly FULL_TEXT: "fullText";
19
+ /** `true` asks the page to prove that a ref `scope` and every match are outside each virtualized list. See `MatchResult.outsideVirtualized`. */
20
+ readonly OUTSIDE_VIRTUALIZED: "outsideVirtualized";
19
21
  };
@@ -16,4 +16,6 @@
16
16
  export const MatchArg = {
17
17
  /** `true` describes each match with up to `TRANSPORT_LIMITS.MAX_FULL_TEXT` characters of text, not the display-sized 80. */
18
18
  FULL_TEXT: 'fullText',
19
+ /** `true` asks the page to prove that a ref `scope` and every match are outside each virtualized list. See `MatchResult.outsideVirtualized`. */
20
+ OUTSIDE_VIRTUALIZED: 'outsideVirtualized',
19
21
  };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The words of a history move: `reticle_navigate { history }` and the `history` command it sends.
3
+ *
4
+ * Kept apart from `constants.ts`: one small group with a reader on each side of the wire, and
5
+ * nothing else in that file depends on it.
6
+ *
7
+ * A synthetic Alt+ArrowLeft does not move a tab through its history, and a URL navigation adds an
8
+ * entry instead of moving along the ones there are. So a bug such as "Back after a form submit
9
+ * shows the wrong page" had no tool that could reproduce it (#1844).
10
+ */
11
+ export declare const NavigateHistory: {
12
+ readonly BACK: "back";
13
+ readonly FORWARD: "forward";
14
+ };
15
+ export type NavigateHistory = (typeof NavigateHistory)[keyof typeof NavigateHistory];
16
+ /** The argument of the `history` command that holds a `NavigateHistory`. */
17
+ export declare const HISTORY_DIRECTION_ARG = "direction";
18
+ /** Why the page did not move through its history. Sent as `reason` on an `ok:false` result. */
19
+ export declare const NavigateHistoryRefusal: {
20
+ /** The direction is not a `NavigateHistory` value. */
21
+ readonly UNKNOWN_DIRECTION: "history direction must be \"back\" or \"forward\"";
22
+ /**
23
+ * The browser reports no entry in that direction on this page's origin. The Navigation API counts
24
+ * only same-origin entries, so the first app page of a tab that came from another site (or from
25
+ * the `about:blank` a lease opens on) says no entry, and the move off the origin is not made.
26
+ */
27
+ readonly NO_ENTRY: "the tab has no history entry in that direction on this origin";
28
+ };
29
+ export type NavigateHistoryRefusal = (typeof NavigateHistoryRefusal)[keyof typeof NavigateHistoryRefusal];
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The words of a history move: `reticle_navigate { history }` and the `history` command it sends.
3
+ *
4
+ * Kept apart from `constants.ts`: one small group with a reader on each side of the wire, and
5
+ * nothing else in that file depends on it.
6
+ *
7
+ * A synthetic Alt+ArrowLeft does not move a tab through its history, and a URL navigation adds an
8
+ * entry instead of moving along the ones there are. So a bug such as "Back after a form submit
9
+ * shows the wrong page" had no tool that could reproduce it (#1844).
10
+ */
11
+ export const NavigateHistory = {
12
+ BACK: 'back',
13
+ FORWARD: 'forward',
14
+ };
15
+ /** The argument of the `history` command that holds a `NavigateHistory`. */
16
+ export const HISTORY_DIRECTION_ARG = 'direction';
17
+ /** Why the page did not move through its history. Sent as `reason` on an `ok:false` result. */
18
+ export const NavigateHistoryRefusal = {
19
+ /** The direction is not a `NavigateHistory` value. */
20
+ UNKNOWN_DIRECTION: 'history direction must be "back" or "forward"',
21
+ /**
22
+ * The browser reports no entry in that direction on this page's origin. The Navigation API counts
23
+ * only same-origin entries, so the first app page of a tab that came from another site (or from
24
+ * the `about:blank` a lease opens on) says no entry, and the move off the origin is not made.
25
+ */
26
+ NO_ENTRY: 'the tab has no history entry in that direction on this origin',
27
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The fields of the React adapter's `__reticle_renders` store (`RETICLE_RENDERS_STORE`) that the
3
+ * server reads. The adapter writes them and the server reads them, so each name is one fact here.
4
+ */
5
+ export declare const RenderStatsField: {
6
+ /** The page's `HydrationState`. Replay waits while it is `pending` (#1654). */
7
+ readonly HYDRATION: "hydration";
8
+ };
9
+ export type RenderStatsField = (typeof RenderStatsField)[keyof typeof RenderStatsField];
10
+ /**
11
+ * Has React hydrated every server-rendered part of the page? The adapter reads it from React's own
12
+ * fibers. Only `pending` makes replay wait: the other three give no reason to.
13
+ */
14
+ export declare const HydrationState: {
15
+ /** The adapter found no React root on the page. Nothing there waits for hydration. */
16
+ readonly NONE: "none";
17
+ /** A React root, or a Suspense or Activity boundary in it, is still dehydrated. */
18
+ readonly PENDING: "pending";
19
+ /** React rendered, and no part of the page waits for hydration. */
20
+ readonly DONE: "done";
21
+ /** The adapter could not read the tree to the end. It does not claim `done`. */
22
+ readonly UNKNOWN: "unknown";
23
+ };
24
+ export type HydrationState = (typeof HydrationState)[keyof typeof HydrationState];
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The fields of the React adapter's `__reticle_renders` store (`RETICLE_RENDERS_STORE`) that the
3
+ * server reads. The adapter writes them and the server reads them, so each name is one fact here.
4
+ */
5
+ export const RenderStatsField = {
6
+ /** The page's `HydrationState`. Replay waits while it is `pending` (#1654). */
7
+ HYDRATION: 'hydration',
8
+ };
9
+ /**
10
+ * Has React hydrated every server-rendered part of the page? The adapter reads it from React's own
11
+ * fibers. Only `pending` makes replay wait: the other three give no reason to.
12
+ */
13
+ export const HydrationState = {
14
+ /** The adapter found no React root on the page. Nothing there waits for hydration. */
15
+ NONE: 'none',
16
+ /** A React root, or a Suspense or Activity boundary in it, is still dehydrated. */
17
+ PENDING: 'pending',
18
+ /** React rendered, and no part of the page waits for hydration. */
19
+ DONE: 'done',
20
+ /** The adapter could not read the tree to the end. It does not claim `done`. */
21
+ UNKNOWN: 'unknown',
22
+ };
@@ -137,4 +137,7 @@ export declare const ReticleEnv: {
137
137
  readonly BACKGROUND_SYNC: "RETICLE_BACKGROUND_SYNC";
138
138
  /** Set by the parent that starts the daemon: how it started it. A `DaemonSpawnMethod`. */
139
139
  readonly SPAWN_METHOD: "RETICLE_SPAWN_METHOD";
140
+ /** The `reticle-computer` command that `reticle_open_realm { realm: "computer" }` runs, in place of
141
+ * `npx -p @reticlehq/computer@<this version> reticle-computer`. For a local build or an offline machine. */
142
+ readonly COMPUTER_BIN: "RETICLE_COMPUTER_BIN";
140
143
  };
@@ -137,4 +137,7 @@ export const ReticleEnv = {
137
137
  BACKGROUND_SYNC: 'RETICLE_BACKGROUND_SYNC',
138
138
  /** Set by the parent that starts the daemon: how it started it. A `DaemonSpawnMethod`. */
139
139
  SPAWN_METHOD: 'RETICLE_SPAWN_METHOD',
140
+ /** The `reticle-computer` command that `reticle_open_realm { realm: "computer" }` runs, in place of
141
+ * `npx -p @reticlehq/computer@<this version> reticle-computer`. For a local build or an offline machine. */
142
+ COMPUTER_BIN: 'RETICLE_COMPUTER_BIN',
140
143
  };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The arrangements of `ActionType.WINDOW`: what a person does with the buttons of a window and the
3
+ * Window menu. `left` and `right` fill that half of the screen, to put two windows side by side.
4
+ * `zoom` fills the screen without full screen. `restore` undoes minimize and full screen.
5
+ */
6
+ export declare const WindowArrangement: {
7
+ readonly MINIMIZE: "minimize";
8
+ readonly ZOOM: "zoom";
9
+ readonly FULLSCREEN: "fullscreen";
10
+ readonly RESTORE: "restore";
11
+ readonly LEFT: "left";
12
+ readonly RIGHT: "right";
13
+ };
14
+ export type WindowArrangement = (typeof WindowArrangement)[keyof typeof WindowArrangement];
15
+ /** Why the page refuses `window`: only a desktop realm can move or resize a window. */
16
+ export declare const WINDOW_NEEDS_DESKTOP_MSG: string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The arrangements of `ActionType.WINDOW`: what a person does with the buttons of a window and the
3
+ * Window menu. `left` and `right` fill that half of the screen, to put two windows side by side.
4
+ * `zoom` fills the screen without full screen. `restore` undoes minimize and full screen.
5
+ */
6
+ export const WindowArrangement = {
7
+ MINIMIZE: 'minimize',
8
+ ZOOM: 'zoom',
9
+ FULLSCREEN: 'fullscreen',
10
+ RESTORE: 'restore',
11
+ LEFT: 'left',
12
+ RIGHT: 'right',
13
+ };
14
+ /** Why the page refuses `window`: only a desktop realm can move or resize a window. */
15
+ export const WINDOW_NEEDS_DESKTOP_MSG = 'a page cannot move, resize, minimize or zoom its own window. Join the browser application as a ' +
16
+ 'desktop session (the computer realm) and arrange its window there.';
@@ -1,5 +1,6 @@
1
1
  import * as z from 'zod';
2
2
  import { EventType } from './constants/constants.js';
3
+ export { INSIDE_FIELD } from './constants/event-types.js';
3
4
  /**
4
5
  * Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
5
6
  * The envelope (`ReticleEventSchema.data`) stays open on the wire so a richer SDK is never rejected
@@ -89,6 +90,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
89
90
  attr: z.ZodString;
90
91
  value: z.ZodOptional<z.ZodString>;
91
92
  old: z.ZodOptional<z.ZodString>;
93
+ inside: z.ZodOptional<z.ZodArray<z.ZodString>>;
92
94
  }, z.core.$loose>;
93
95
  "dom.text": z.ZodObject<{
94
96
  text: z.ZodString;
@@ -99,6 +101,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
99
101
  readonly ASSERTIVE: "assertive";
100
102
  readonly POLITE: "polite";
101
103
  }>>;
104
+ inside: z.ZodOptional<z.ZodArray<z.ZodString>>;
102
105
  }, z.core.$strip>;
103
106
  "net.request": z.ZodObject<{
104
107
  id: z.ZodString;
@@ -266,8 +269,8 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
266
269
  "dialog.opened": z.ZodObject<{
267
270
  kind: z.ZodEnum<{
268
271
  prompt: "prompt";
269
- alert: "alert";
270
272
  confirm: "confirm";
273
+ alert: "alert";
271
274
  }>;
272
275
  message: z.ZodOptional<z.ZodString>;
273
276
  answered: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNull]>>;
@@ -1,11 +1,12 @@
1
1
  import * as z from 'zod';
2
2
  import { CanvasTrigger, EventType, MediaEvent, PerfMetric } from './constants/constants.js';
3
- import { FieldChangeField, FieldChangeKind, LivePoliteness, RouteChangeHow, ROUTE_CHANGE_HOW_FIELD, ScrollDirection, StorageArea, StreamDirection, StreamTransport, } from './constants/event-types.js';
3
+ import { FieldChangeField, FieldChangeKind, INSIDE_FIELD, LivePoliteness, RouteChangeHow, ROUTE_CHANGE_HOW_FIELD, ScrollDirection, StorageArea, StreamDirection, StreamTransport, } from './constants/event-types.js';
4
4
  import { ResponseBodyReason } from './constants/response-body-reason.js';
5
5
  import { BlindSpotKind } from '../verdict/verified-constants.js';
6
6
  import { BrowserBrand } from '../browser-brand.js';
7
7
  import { HudUseDataSchema, HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
8
8
  import { DepartedNetField, NEXT_ACTION_FIELD, REQUEST_SHAPE_FIELD } from './net.js';
9
+ export { INSIDE_FIELD } from './constants/event-types.js';
9
10
  /**
10
11
  * Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
11
12
  * The envelope (`ReticleEventSchema.data`) stays open on the wire so a richer SDK is never rejected
@@ -108,7 +109,17 @@ export const EVENT_PAYLOAD_SCHEMAS = {
108
109
  [EventType.DOM_ADDED]: elementLabel,
109
110
  [EventType.DOM_REMOVED]: elementLabel,
110
111
  [EventType.DOM_ATTR]: z
111
- .object({ attr: z.string(), value: z.string().optional(), old: z.string().optional() })
112
+ .object({
113
+ attr: z.string(),
114
+ value: z.string().optional(),
115
+ old: z.string().optional(),
116
+ /**
117
+ * The minted refs of the changed element's ancestors, nearest first. A change on a descendant
118
+ * of the acted control (a label in a child span, #2318) names the control's ref here; without
119
+ * it the wire carries no way to tell "inside the control" from churn on an unrelated element.
120
+ */
121
+ [INSIDE_FIELD]: z.array(z.string()).optional(),
122
+ })
112
123
  .passthrough(),
113
124
  [EventType.DOM_TEXT]: z.object({
114
125
  text: z.string(),
@@ -126,6 +137,12 @@ export const EVENT_PAYLOAD_SCHEMAS = {
126
137
  * about a failure, and a mount event does not record that write.
127
138
  */
128
139
  live: z.nativeEnum(LivePoliteness).optional(),
140
+ /**
141
+ * The minted refs of the changed element's ancestors, nearest first. A change on a descendant
142
+ * of the acted control (a label in a child span, #2318) names the control's ref here; without
143
+ * it the wire carries no way to tell "inside the control" from churn on an unrelated element.
144
+ */
145
+ [INSIDE_FIELD]: z.array(z.string()).optional(),
129
146
  }),
130
147
  [EventType.NET_REQUEST]: netRequestSchema,
131
148
  [EventType.NET_PENDING]: z.object({
@@ -154,6 +154,7 @@ export declare const HelloMessageSchema: z.ZodObject<{
154
154
  url: z.ZodString;
155
155
  title: z.ZodString;
156
156
  projectId: z.ZodOptional<z.ZodString>;
157
+ root: z.ZodOptional<z.ZodString>;
157
158
  adapters: z.ZodArray<z.ZodString>;
158
159
  token: z.ZodOptional<z.ZodString>;
159
160
  env: z.ZodOptional<z.ZodEnum<{
@@ -236,6 +237,17 @@ export declare const CommandResultSchema: z.ZodObject<{
236
237
  error: z.ZodOptional<z.ZodString>;
237
238
  }, z.core.$strip>;
238
239
  export type CommandResult = z.infer<typeof CommandResultSchema>;
240
+ /**
241
+ * The `result` of the page's reply to the `history` command (#1844). `ok: true` means the page sent
242
+ * the move, not that the tab arrived. `ok: false` means the page refused it, and `reason` says why.
243
+ */
244
+ export declare const HistoryReplySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
245
+ ok: z.ZodLiteral<true>;
246
+ }, z.core.$strip>, z.ZodObject<{
247
+ ok: z.ZodLiteral<false>;
248
+ reason: z.ZodOptional<z.ZodString>;
249
+ }, z.core.$strip>], "ok">;
250
+ export type HistoryReply = z.infer<typeof HistoryReplySchema>;
239
251
  /** Browser -> bridge streamed observation. */
240
252
  export declare const EventMessageSchema: z.ZodObject<{
241
253
  kind: z.ZodLiteral<"event">;
@@ -306,6 +318,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
306
318
  url: z.ZodString;
307
319
  title: z.ZodString;
308
320
  projectId: z.ZodOptional<z.ZodString>;
321
+ root: z.ZodOptional<z.ZodString>;
309
322
  adapters: z.ZodArray<z.ZodString>;
310
323
  token: z.ZodOptional<z.ZodString>;
311
324
  env: z.ZodOptional<z.ZodEnum<{
@@ -134,6 +134,13 @@ export const HelloMessageSchema = z.object({
134
134
  * ⇒ resolution falls back to origin + recency.
135
135
  */
136
136
  projectId: sessionIdSchema.optional(),
137
+ /**
138
+ * The project directory this page was built from.
139
+ *
140
+ * The build plugin sends it. A page reached through a port forward reports a directory that is
141
+ * not on the machine the daemon runs on. Absent on an older SDK.
142
+ */
143
+ root: z.string().min(1).max(TRANSPORT_LIMITS.MAX_URL_LENGTH).optional(),
137
144
  adapters: z
138
145
  .array(z.string().max(TRANSPORT_LIMITS.MAX_ADAPTER_NAME_LENGTH))
139
146
  .max(TRANSPORT_LIMITS.MAX_ADAPTERS),
@@ -290,6 +297,14 @@ export const CommandResultSchema = z.object({
290
297
  result: z.unknown().optional(),
291
298
  error: z.string().max(TRANSPORT_LIMITS.MAX_ERROR_LENGTH).optional(),
292
299
  });
300
+ /**
301
+ * The `result` of the page's reply to the `history` command (#1844). `ok: true` means the page sent
302
+ * the move, not that the tab arrived. `ok: false` means the page refused it, and `reason` says why.
303
+ */
304
+ export const HistoryReplySchema = z.discriminatedUnion('ok', [
305
+ z.object({ ok: z.literal(true) }),
306
+ z.object({ ok: z.literal(false), reason: z.string().optional() }),
307
+ ]);
293
308
  /** Browser -> bridge streamed observation. */
294
309
  export const EventMessageSchema = z.object({
295
310
  kind: z.literal(MessageKind.EVENT),
@@ -18,11 +18,16 @@ export declare const ProductionRule: {
18
18
  readonly OBSERVE_ONLY: "the session scope is observe, so it does not act";
19
19
  /** The drive stays on the origin it was activated for. */
20
20
  readonly OFF_ORIGIN: "leave the activated origin";
21
+ /**
22
+ * Back and Forward land on whatever entry the browser has, which can be another origin. Unlike a
23
+ * URL, that target cannot be checked against the origin first, so the move is refused (#1844).
24
+ */
25
+ readonly HISTORY_MOVE: "move through the tab history, to a page that cannot be checked first";
21
26
  /** The nonce's time is up; the drive is over. */
22
27
  readonly EXPIRED: "the session nonce expired";
23
28
  };
24
29
  export type ProductionRule = (typeof ProductionRule)[keyof typeof ProductionRule];
25
- /** The rules an intent can allow. The other three are never lifted. */
30
+ /** The rules an intent can allow. The other four are never lifted. */
26
31
  export declare const LIFTABLE_PRODUCTION_RULES: readonly ["payment or checkout", "delete a workspace or project", "revoke or rotate a key", "send an invite or email", "cancel a subscription", "change a member's role"];
27
32
  export type LiftableProductionRule = (typeof LIFTABLE_PRODUCTION_RULES)[number];
28
33
  /**