@reticlehq/core 3.8.2 → 3.10.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 (66) hide show
  1. package/dist/artifacts/flow-constants.d.ts +17 -0
  2. package/dist/artifacts/flow-constants.js +15 -0
  3. package/dist/artifacts/flow-results.d.ts +27 -2
  4. package/dist/artifacts/flow-step-tool.d.ts +17 -0
  5. package/dist/artifacts/flow-step-tool.js +18 -1
  6. package/dist/artifacts/flow-types.d.ts +59 -0
  7. package/dist/artifacts/flow-types.js +51 -6
  8. package/dist/identity/github-action.d.ts +7 -0
  9. package/dist/identity/github-action.js +7 -0
  10. package/dist/index.d.ts +5 -0
  11. package/dist/index.js +5 -0
  12. package/dist/onboarding.d.ts +60 -0
  13. package/dist/onboarding.js +35 -0
  14. package/dist/schema/event-message.json +1 -0
  15. package/dist/schema/event-payloads.json +47 -1
  16. package/dist/schema/event-type.json +1 -0
  17. package/dist/schema/reticle-event.json +1 -0
  18. package/dist/schema/reticle-message.json +1 -0
  19. package/dist/telemetry-refusal.d.ts +83 -0
  20. package/dist/telemetry-refusal.js +56 -0
  21. package/dist/telemetry-signals.d.ts +132 -0
  22. package/dist/telemetry-signals.js +68 -0
  23. package/dist/telemetry.d.ts +89 -4
  24. package/dist/telemetry.js +5 -3
  25. package/dist/verdict/findings.d.ts +34 -0
  26. package/dist/verdict/findings.js +37 -0
  27. package/dist/verdict/predicate.d.ts +1 -0
  28. package/dist/verdict/predicate.js +145 -5
  29. package/dist/verdict/verdict-attribution.js +1 -0
  30. package/dist/verdict/verified-constants.d.ts +17 -0
  31. package/dist/verdict/verified-constants.js +17 -0
  32. package/dist/wire/click-input.d.ts +26 -0
  33. package/dist/wire/click-input.js +65 -0
  34. package/dist/wire/constants/animation-command.d.ts +2 -0
  35. package/dist/wire/constants/animation-command.js +2 -0
  36. package/dist/wire/constants/console-event.d.ts +44 -0
  37. package/dist/wire/constants/console-event.js +44 -0
  38. package/dist/wire/constants/constants.d.ts +45 -0
  39. package/dist/wire/constants/constants.js +45 -0
  40. package/dist/wire/constants/determinism.d.ts +17 -0
  41. package/dist/wire/constants/determinism.js +17 -0
  42. package/dist/wire/constants/event-types.d.ts +113 -0
  43. package/dist/wire/constants/event-types.js +87 -0
  44. package/dist/wire/constants/match-args.d.ts +19 -0
  45. package/dist/wire/constants/match-args.js +19 -0
  46. package/dist/wire/constants/reticle-chrome.d.ts +12 -0
  47. package/dist/wire/constants/reticle-chrome.js +14 -0
  48. package/dist/wire/constants/session-constants.d.ts +17 -0
  49. package/dist/wire/constants/session-constants.js +5 -0
  50. package/dist/wire/event-payloads.d.ts +16 -93
  51. package/dist/wire/event-payloads.js +26 -72
  52. package/dist/wire/event-priority.js +1 -0
  53. package/dist/wire/global-press.d.ts +9 -2
  54. package/dist/wire/global-press.js +39 -12
  55. package/dist/wire/messages.d.ts +3 -0
  56. package/dist/wire/net.d.ts +39 -0
  57. package/dist/wire/net.js +56 -8
  58. package/dist/wire/redaction.d.ts +18 -0
  59. package/dist/wire/redaction.js +72 -0
  60. package/dist/wire/tool-names.d.ts +4 -0
  61. package/dist/wire/tool-names.js +4 -0
  62. package/dist/wire/types.d.ts +31 -0
  63. package/dist/wire/types.js +10 -0
  64. package/dist/words/notices.d.ts +10 -0
  65. package/dist/words/notices.js +19 -0
  66. package/package.json +1 -1
@@ -15,12 +15,12 @@
15
15
  * `z.nativeEnum`, timestamps are epoch-ms NUMBERS, no `any`.
16
16
  */
17
17
  import * as z from 'zod';
18
- import { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, type OnboardingStep } from './onboarding.js';
18
+ import { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, OnboardingStop, type OnboardingStep } from './onboarding.js';
19
19
  /**
20
20
  * The setup funnel's vocabulary. It is defined in `onboarding.ts`, which is its own subject, and
21
21
  * re-exported here so every `@reticlehq/core/telemetry` import reaches it.
22
22
  */
23
- export { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, type OnboardingStep, };
23
+ export { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingStop, OnboardingSteps, type OnboardingStep, };
24
24
  export * from './telemetry-bug.js';
25
25
  /** Bump when the event shape changes so the analytics side can segment old senders. */
26
26
  export declare const TELEMETRY_EVENT_VERSION = 3;
@@ -80,7 +80,7 @@ export declare const TelemetryEventKind: {
80
80
  readonly PROJECT_PROFILED: "project_profiled";
81
81
  /**
82
82
  * A start found a version that differs from the last start on this machine, or `reticle update` /
83
- * `reticle rollback` moved it. Carries from → to.
83
+ * `reticle update --rollback` moved it. Carries from → to.
84
84
  */
85
85
  readonly VERSION_CHANGED: "version_changed";
86
86
  /** An uncaught exception or unhandled rejection reached the top of the daemon. Crash analytics. */
@@ -193,6 +193,8 @@ export declare const TelemetryEventKind: {
193
193
  readonly PLATFORM_LINKED: "platform_linked";
194
194
  /** A Harness run started, or ended: one of each per run. */
195
195
  readonly HARNESS_RUN: "harness_run";
196
+ /** `reticle gate` ended: how, and over how many flows. A one-shot CLI event. */
197
+ readonly GATE_COMPLETED: "gate_completed";
196
198
  };
197
199
  export type TelemetryEventKind = (typeof TelemetryEventKind)[keyof typeof TelemetryEventKind];
198
200
  /** True when this event happened inside a daemon run, so a `sessionId` on it means something. */
@@ -291,6 +293,7 @@ export declare const VerificationSchema: z.ZodObject<{
291
293
  readonly INCONCLUSIVE: "inconclusive";
292
294
  readonly OBSERVATION_LOST: "observation_lost";
293
295
  readonly WINDOW_CLOSED_EARLY: "window_closed_early";
296
+ readonly DIALOG_DECLINED: "dialog_declined";
294
297
  readonly ASSERTION_FAILED: "assertion_failed";
295
298
  readonly CONTRADICTED: "contradicted";
296
299
  readonly ALREADY_TRUE: "already_true";
@@ -716,6 +719,27 @@ export declare const TelemetryEventSchema: z.ZodObject<{
716
719
  }, z.core.$strip>>;
717
720
  daemonDeath: z.ZodOptional<z.ZodObject<{
718
721
  ageMs: z.ZodNumber;
722
+ end: z.ZodOptional<z.ZodEnum<{
723
+ readonly ALIVE: "alive";
724
+ readonly CLEAN: "clean";
725
+ readonly SIGNALLED: "signalled";
726
+ readonly DIED_SILENTLY: "died_silently";
727
+ readonly START_FAILED: "start_failed";
728
+ readonly UNKNOWN: "unknown";
729
+ }>>;
730
+ silentMs: z.ZodOptional<z.ZodNumber>;
731
+ signal: z.ZodOptional<z.ZodString>;
732
+ sessions: z.ZodOptional<z.ZodNumber>;
733
+ served: z.ZodOptional<z.ZodBoolean>;
734
+ rssMb: z.ZodOptional<z.ZodNumber>;
735
+ error: z.ZodOptional<z.ZodString>;
736
+ startupError: z.ZodOptional<z.ZodEnum<{
737
+ readonly LISTEN: "listen";
738
+ readonly START: "start";
739
+ readonly UNCAUGHT_EXCEPTION: "uncaught_exception";
740
+ readonly UNHANDLED_REJECTION: "unhandled_rejection";
741
+ readonly BEFORE_LOG: "before_log";
742
+ }>>;
719
743
  }, z.core.$strip>>;
720
744
  wakeRefusal: z.ZodOptional<z.ZodObject<{
721
745
  presence: z.ZodEnum<{
@@ -832,6 +856,16 @@ export declare const TelemetryEventSchema: z.ZodObject<{
832
856
  readonly OTHER: "other";
833
857
  }>>;
834
858
  }, z.core.$strip>>;
859
+ gate: z.ZodOptional<z.ZodObject<{
860
+ outcome: z.ZodEnum<{
861
+ readonly PASS: "pass";
862
+ readonly FAIL: "fail";
863
+ readonly NOTHING_TO_CHECK: "nothing_to_check";
864
+ readonly REGRESSION: "regression";
865
+ readonly ERROR: "error";
866
+ }>;
867
+ flowsChecked: z.ZodOptional<z.ZodNumber>;
868
+ }, z.core.$strip>>;
835
869
  v: z.ZodLiteral<3>;
836
870
  anonymousId: z.ZodString;
837
871
  projectId: z.ZodOptional<z.ZodString>;
@@ -880,7 +914,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
880
914
  readonly PROJECT_PROFILED: "project_profiled";
881
915
  /**
882
916
  * A start found a version that differs from the last start on this machine, or `reticle update` /
883
- * `reticle rollback` moved it. Carries from → to.
917
+ * `reticle update --rollback` moved it. Carries from → to.
884
918
  */
885
919
  readonly VERSION_CHANGED: "version_changed";
886
920
  /** An uncaught exception or unhandled rejection reached the top of the daemon. Crash analytics. */
@@ -993,6 +1027,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
993
1027
  readonly PLATFORM_LINKED: "platform_linked";
994
1028
  /** A Harness run started, or ended: one of each per run. */
995
1029
  readonly HARNESS_RUN: "harness_run";
1030
+ /** `reticle gate` ended: how, and over how many flows. A one-shot CLI event. */
1031
+ readonly GATE_COMPLETED: "gate_completed";
996
1032
  }>;
997
1033
  ts: z.ZodNumber;
998
1034
  version: z.ZodString;
@@ -1246,6 +1282,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1246
1282
  readonly INCONCLUSIVE: "inconclusive";
1247
1283
  readonly OBSERVATION_LOST: "observation_lost";
1248
1284
  readonly WINDOW_CLOSED_EARLY: "window_closed_early";
1285
+ readonly DIALOG_DECLINED: "dialog_declined";
1249
1286
  readonly ASSERTION_FAILED: "assertion_failed";
1250
1287
  readonly CONTRADICTED: "contradicted";
1251
1288
  readonly ALREADY_TRUE: "already_true";
@@ -1402,6 +1439,20 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1402
1439
  readonly INIT_CONSENT: "init_consent";
1403
1440
  }>>;
1404
1441
  nextFollowed: z.ZodOptional<z.ZodBoolean>;
1442
+ stop: z.ZodOptional<z.ZodEnum<{
1443
+ readonly NO_NODE: "no_node";
1444
+ readonly NODE_TOO_OLD: "node_too_old";
1445
+ readonly CLI_INSTALL_FAILED: "cli_install_failed";
1446
+ readonly MCP_NOT_REGISTERED: "mcp_not_registered";
1447
+ readonly NO_WEB_APP: "no_web_app";
1448
+ readonly SETUP_FAILED: "setup_failed";
1449
+ readonly DEV_SERVER_FAILED: "dev_server_failed";
1450
+ readonly APP_NOT_CONNECTED: "app_not_connected";
1451
+ readonly INTERRUPTED: "interrupted";
1452
+ readonly AGENT_NOT_RESTARTED: "agent_not_restarted";
1453
+ readonly CHROMIUM_UNAVAILABLE: "chromium_unavailable";
1454
+ readonly UNCLASSIFIED: "unclassified";
1455
+ }>>;
1405
1456
  }, z.core.$strip>>;
1406
1457
  bug: z.ZodOptional<z.ZodObject<{
1407
1458
  source: z.ZodEnum<{
@@ -1446,7 +1497,41 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1446
1497
  readonly NO_CONFIG: "no_config";
1447
1498
  readonly SDK_NOT_REACHING_DAEMON: "sdk_not_reaching_daemon";
1448
1499
  }>>;
1500
+ detail: z.ZodOptional<z.ZodEnum<{
1501
+ readonly NO_SESSION: "no_session";
1502
+ readonly MULTIPLE_SESSIONS: "multiple_sessions";
1503
+ readonly UNKNOWN_SESSION: "unknown_session";
1504
+ readonly SCOPE_MISMATCH: "scope_mismatch";
1505
+ readonly SESSION_GONE: "session_gone";
1506
+ readonly THROTTLED: "throttled";
1507
+ readonly COMMAND_TIMEOUT: "command_timeout";
1508
+ readonly POOL_UNAVAILABLE: "pool_unavailable";
1509
+ readonly POOL_SHUT_DOWN: "pool_shut_down";
1510
+ readonly CHROMIUM_MISSING: "chromium_missing";
1511
+ readonly CHROMIUM_PATH: "chromium_path";
1512
+ readonly TOKEN_REQUIRED: "token_required";
1513
+ readonly MISSING_BASELINE: "missing_baseline";
1514
+ readonly MISSING_RECORDING: "missing_recording";
1515
+ readonly STALE_REF: "stale_ref";
1516
+ readonly STALE_REF_AFTER_EDIT: "stale_ref_after_edit";
1517
+ readonly UNISSUED_REF: "unissued_ref";
1518
+ readonly NO_SUCH_OPTION: "no_such_option";
1519
+ readonly TARGET_MISSED: "target_missed";
1520
+ readonly AMBIGUOUS_TARGET: "ambiguous_target";
1521
+ readonly FLOW_STEP_MISSING: "flow_step_missing";
1522
+ readonly UNSUPPORTED_SURFACE: "unsupported_surface";
1523
+ readonly HOVER_NEEDS_POINTER: "hover_needs_pointer";
1524
+ readonly NOT_EDITABLE: "not_editable";
1525
+ readonly CONFIRM_DANGEROUS: "confirm_dangerous";
1526
+ readonly WRONG_TARGET: "wrong_target";
1527
+ readonly PRODUCTION_POLICY: "production_policy";
1528
+ readonly BAD_ARGUMENTS: "bad_arguments";
1529
+ readonly INVALID_NAME: "invalid_name";
1530
+ readonly HARNESS_OFF: "harness_off";
1531
+ readonly HARNESS_LOCKED: "harness_locked";
1532
+ }>>;
1449
1533
  retried: z.ZodBoolean;
1534
+ params: z.ZodOptional<z.ZodArray<z.ZodString>>;
1450
1535
  }, z.core.$strip>>;
1451
1536
  outage: z.ZodOptional<z.ZodObject<{
1452
1537
  stage: z.ZodEnum<{
package/dist/telemetry.js CHANGED
@@ -15,12 +15,12 @@
15
15
  * `z.nativeEnum`, timestamps are epoch-ms NUMBERS, no `any`.
16
16
  */
17
17
  import * as z from 'zod';
18
- import { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, } from './onboarding.js';
18
+ import { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, OnboardingStop, } from './onboarding.js';
19
19
  /**
20
20
  * The setup funnel's vocabulary. It is defined in `onboarding.ts`, which is its own subject, and
21
21
  * re-exported here so every `@reticlehq/core/telemetry` import reaches it.
22
22
  */
23
- export { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, };
23
+ export { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingStop, OnboardingSteps, };
24
24
  import { ToolRefusalSchema } from './telemetry-refusal.js';
25
25
  import { MachineSnapshotSchema, ProjectProfileSchema, SessionSummarySchema, } from './telemetry-session.js';
26
26
  import { BrowserBrand, FeedbackSchema } from './telemetry-feedback.js';
@@ -88,7 +88,7 @@ export const TelemetryEventKind = {
88
88
  PROJECT_PROFILED: 'project_profiled',
89
89
  /**
90
90
  * A start found a version that differs from the last start on this machine, or `reticle update` /
91
- * `reticle rollback` moved it. Carries from → to.
91
+ * `reticle update --rollback` moved it. Carries from → to.
92
92
  */
93
93
  VERSION_CHANGED: 'version_changed',
94
94
  /** An uncaught exception or unhandled rejection reached the top of the daemon. Crash analytics. */
@@ -201,6 +201,8 @@ export const TelemetryEventKind = {
201
201
  PLATFORM_LINKED: 'platform_linked',
202
202
  /** A Harness run started, or ended: one of each per run. */
203
203
  HARNESS_RUN: 'harness_run',
204
+ /** `reticle gate` ended: how, and over how many flows. A one-shot CLI event. */
205
+ GATE_COMPLETED: 'gate_completed',
204
206
  };
205
207
  /**
206
208
  * Events that belong to a DAEMON RUN, and therefore carry `sessionId`.
@@ -253,6 +253,19 @@ export declare const ContradictionKind: {
253
253
  * "you changed the code and then looked only at what happened before you did".
254
254
  */
255
255
  readonly EVIDENCE_PREDATES_EDIT: "evidence-predates-edit";
256
+ /**
257
+ * A read of the app's own failed with a server error (5xx) inside the action window, and no later
258
+ * call to the same url recovered it.
259
+ *
260
+ * A GET is skipped by the write rules because the DOM shows its payload. A FAILED GET breaks that
261
+ * premise: the page can keep stale or placeholder content, and a route, a label or a visible
262
+ * control still holds over it. Found in the field: a replayed flow passed over a 500 and a 502 from
263
+ * the app's own API, and the app had a real serialization bug.
264
+ *
265
+ * Absence-derived, so it makes a verdict unknown, never no. The screen may show data that an
266
+ * earlier load put there, which is correct. What is absent is proof that it is this action's data.
267
+ */
268
+ readonly READ_SERVER_FAULT: "read-server-fault";
256
269
  };
257
270
  export type ContradictionKind = (typeof ContradictionKind)[keyof typeof ContradictionKind];
258
271
  /**
@@ -380,3 +393,24 @@ export declare const CrawlAnomalyKind: {
380
393
  readonly DEAD_CONTROL: "dead-control";
381
394
  };
382
395
  export type CrawlAnomalyKind = (typeof CrawlAnomalyKind)[keyof typeof CrawlAnomalyKind];
396
+ /**
397
+ * Behaviour faults that the systematic explorer finds by driving the app against itself. Each one
398
+ * needs no reference answer: the app's own earlier state, request or run is the reference.
399
+ *
400
+ * Like `CrawlAnomalyKind`, these are not cross-channel contradictions and do not decide a verdict.
401
+ */
402
+ export declare const BehaviourFindingKind: {
403
+ /** An undo or cancel did not return the page to the state before the action. */
404
+ readonly UNDO_NOT_RESTORED: "undo-not-restored";
405
+ /** A repeated identical action changed state that the first action did not change. */
406
+ readonly REPEAT_CHANGED_STATE: "repeat-changed-state";
407
+ /** A value the app saved is not shown after a reload, and the app did not say it was not saved. */
408
+ readonly LOST_AFTER_RELOAD: "lost-after-reload";
409
+ /** The value the page shows after a write is not the value the write request sent. */
410
+ readonly SHOWN_DIFFERS_FROM_SENT: "shown-differs-from-sent";
411
+ /** Two identical drives from a fresh page showed different results. */
412
+ readonly INTERMITTENT_RESULT: "intermittent-result";
413
+ /** With a write failing, the app arrived where it goes when the write succeeds. */
414
+ readonly FAILURE_UNHANDLED: "failure-unhandled";
415
+ };
416
+ export type BehaviourFindingKind = (typeof BehaviourFindingKind)[keyof typeof BehaviourFindingKind];
@@ -222,6 +222,19 @@ export const ContradictionKind = {
222
222
  * "you changed the code and then looked only at what happened before you did".
223
223
  */
224
224
  EVIDENCE_PREDATES_EDIT: 'evidence-predates-edit',
225
+ /**
226
+ * A read of the app's own failed with a server error (5xx) inside the action window, and no later
227
+ * call to the same url recovered it.
228
+ *
229
+ * A GET is skipped by the write rules because the DOM shows its payload. A FAILED GET breaks that
230
+ * premise: the page can keep stale or placeholder content, and a route, a label or a visible
231
+ * control still holds over it. Found in the field: a replayed flow passed over a 500 and a 502 from
232
+ * the app's own API, and the app had a real serialization bug.
233
+ *
234
+ * Absence-derived, so it makes a verdict unknown, never no. The screen may show data that an
235
+ * earlier load put there, which is correct. What is absent is proof that it is this action's data.
236
+ */
237
+ READ_SERVER_FAULT: 'read-server-fault',
225
238
  };
226
239
  /**
227
240
  * Contradictions inferred from the ABSENCE of evidence in a window whose end Reticle itself chose.
@@ -271,6 +284,8 @@ export const ABSENCE_DERIVED_CONTRADICTIONS = new Set([
271
284
  ContradictionKind.EVIDENCE_SUPERSEDED,
272
285
  // Nothing here says the app is wrong either — only that the window predates the edit under test.
273
286
  ContradictionKind.EVIDENCE_PREDATES_EDIT,
287
+ // The 5xx is observed. What is absent is proof that the screen shows this action's data.
288
+ ContradictionKind.READ_SERVER_FAULT,
274
289
  ]);
275
290
  /** True when this kind was inferred from absence rather than positively observed. */
276
291
  export function isAbsenceDerived(kind) {
@@ -404,6 +419,8 @@ export const CONTRADICTION_CHANNELS = {
404
419
  // side. Recorded rather than exempted: an exemption is a hole somebody later widens.
405
420
  [ContradictionKind.EVIDENCE_SUPERSEDED]: [ChannelId.TIME, ChannelId.UI],
406
421
  [ContradictionKind.EVIDENCE_PREDATES_EDIT]: [ChannelId.TIME, ChannelId.UI],
422
+ // What the screen shows against the status of the read that should have filled it.
423
+ [ContradictionKind.READ_SERVER_FAULT]: [ChannelId.UI, ChannelId.NET],
407
424
  };
408
425
  /**
409
426
  * May this kind of disagreement be reported as a fault in the app?
@@ -421,3 +438,23 @@ export const CrawlAnomalyKind = {
421
438
  FAILED_REQUEST: 'failed-request', // it fired a request that returned >= 400
422
439
  DEAD_CONTROL: 'dead-control', // it dispatched but the app did NOTHING (no DOM/net/route/signal)
423
440
  };
441
+ /**
442
+ * Behaviour faults that the systematic explorer finds by driving the app against itself. Each one
443
+ * needs no reference answer: the app's own earlier state, request or run is the reference.
444
+ *
445
+ * Like `CrawlAnomalyKind`, these are not cross-channel contradictions and do not decide a verdict.
446
+ */
447
+ export const BehaviourFindingKind = {
448
+ /** An undo or cancel did not return the page to the state before the action. */
449
+ UNDO_NOT_RESTORED: 'undo-not-restored',
450
+ /** A repeated identical action changed state that the first action did not change. */
451
+ REPEAT_CHANGED_STATE: 'repeat-changed-state',
452
+ /** A value the app saved is not shown after a reload, and the app did not say it was not saved. */
453
+ LOST_AFTER_RELOAD: 'lost-after-reload',
454
+ /** The value the page shows after a write is not the value the write request sent. */
455
+ SHOWN_DIFFERS_FROM_SENT: 'shown-differs-from-sent',
456
+ /** Two identical drives from a fresh page showed different results. */
457
+ INTERMITTENT_RESULT: 'intermittent-result',
458
+ /** With a write failing, the app arrived where it goes when the write succeeds. */
459
+ FAILURE_UNHANDLED: 'failure-unhandled',
460
+ };
@@ -91,6 +91,7 @@ export type Predicate = {
91
91
  } | {
92
92
  kind: typeof PredicateKind.ANIMATION;
93
93
  name?: string;
94
+ /** Target element as a Reticle ref (`e12`) or a CSS selector resolved against the live page. */
94
95
  target?: string;
95
96
  completed?: boolean;
96
97
  since?: number;
@@ -180,6 +180,134 @@ function withKind(given) {
180
180
  const kind = kindToInfer(given);
181
181
  return kind === undefined ? renamed : { ...renamed, kind };
182
182
  }
183
+ /** The kind written as `absent`. `absent` is a field of `element`, `text` and `console`. */
184
+ const ABSENT_FIELD = 'absent';
185
+ /**
186
+ * Bare strings that can also be another kind's value. Each one is refused, with both readings.
187
+ * A text check on `/dashboard` fails on a page that does not show that text, so a guess here
188
+ * gives a false "no" and blames the app.
189
+ */
190
+ const BARE_STRING_OTHER_READINGS = [
191
+ { test: /:\/\//, example: (quoted) => `{ kind: "route", contains: ${quoted} }` },
192
+ { test: /^\//, example: (quoted) => `{ kind: "route", pathname: ${quoted} }` },
193
+ {
194
+ test: /^[#.[]/,
195
+ example: (quoted) => `{ kind: "element", query: { scope: ${quoted}, self: true } }`,
196
+ },
197
+ { test: /^[\w-]+:[\w:.-]+$/, example: (quoted) => `{ kind: "signal", name: ${quoted} }` },
198
+ ];
199
+ /**
200
+ * Words that make a bare string read as a description of the outcome ("the receipt appears"), not
201
+ * as text on the page. Read as text, a description fails on every page and blames the app, so it
202
+ * is refused. A refusal costs one call. A false "no" sends the agent to fix code that works.
203
+ */
204
+ const DESCRIPTION_WORDS = /\b(should|must|appears?|shown|shows|displays|displayed|navigates|redirects|succeeds|expect(ed)?)\b/i;
205
+ const isPlainRecord = (value) => 'object' === typeof value && null !== value && !Array.isArray(value);
206
+ /** `"Saved"`: text that must be visible. Visible, so that a hidden copy does not pass. */
207
+ function readBareString(written) {
208
+ const quoted = JSON.stringify(written);
209
+ if (0 === written.trim().length) {
210
+ return {
211
+ value: written,
212
+ refusal: 'an empty string names no check: empty text is on every page. Write the text the page ' +
213
+ 'must show: { kind: "text", contains: "Saved", visible: true }',
214
+ };
215
+ }
216
+ if (DESCRIPTION_WORDS.test(written)) {
217
+ return {
218
+ value: written,
219
+ refusal: `the string ${quoted} reads as a description of the outcome, so it was not checked as ` +
220
+ 'text. Write the exact text the page shows: { kind: "text", contains: "Saved" }, or ' +
221
+ 'the consequence by its kind (signal, net, route, state)',
222
+ };
223
+ }
224
+ const other = BARE_STRING_OTHER_READINGS.find((reading) => reading.test.test(written));
225
+ if (other !== undefined) {
226
+ return {
227
+ value: written,
228
+ refusal: `the string ${quoted} has two readings, so it was not guessed. Write the one you mean: ` +
229
+ `${other.example(quoted)} or { kind: "text", contains: ${quoted} }`,
230
+ };
231
+ }
232
+ return {
233
+ value: { kind: PredicateKind.TEXT, contains: written, visible: true },
234
+ note: `${quoted} → { kind: "text", contains: ${quoted}, visible: true }`,
235
+ };
236
+ }
237
+ /**
238
+ * Fields of `{ text: { ... } }` that mean the same in both places that form is read: here, and in
239
+ * the `text` part of a version 1 flow `expect` (`flowExpectToPredicate`). `absent` is not one of
240
+ * them: that format adds a settle gate to it, so `absent` has two readings and is refused.
241
+ */
242
+ const TEXT_WRAPPER_FIELDS = new Set(['contains', 'scope', 'visible']);
243
+ /** `{ text: { contains } }`: the form agents send after reading a grammar keyed by kind. */
244
+ function readTextWrapper(obj) {
245
+ const keys = writtenKeys(obj);
246
+ const inner = obj[PredicateKind.TEXT];
247
+ if (1 !== keys.length || !isPlainRecord(inner)) {
248
+ return undefined;
249
+ }
250
+ const fields = writtenKeys(inner);
251
+ if (!fields.includes('contains') || !fields.every((field) => TEXT_WRAPPER_FIELDS.has(field))) {
252
+ return undefined;
253
+ }
254
+ return {
255
+ value: { ...inner, kind: PredicateKind.TEXT },
256
+ note: '{ text: { ... } } → { kind: "text", ... }',
257
+ };
258
+ }
259
+ /** `{ kind: "absent", text: "Error" }`: the absence of the one kind the other keys name. */
260
+ function readAbsentKind(obj) {
261
+ if (ABSENT_FIELD !== obj['kind'] || false === obj[ABSENT_FIELD]) {
262
+ return undefined;
263
+ }
264
+ const rest = { ...obj };
265
+ delete rest['kind'];
266
+ delete rest[ABSENT_FIELD];
267
+ const kind = inferKind(rest);
268
+ if (kind === undefined || true !== keysOfEachKind().get(kind)?.has(ABSENT_FIELD)) {
269
+ return undefined;
270
+ }
271
+ return {
272
+ value: { ...rest, kind, [ABSENT_FIELD]: true },
273
+ note: `kind: "${ABSENT_FIELD}" → kind: "${kind}", ${ABSENT_FIELD}: true`,
274
+ };
275
+ }
276
+ /**
277
+ * `"{\"kind\":\"text\",...}"`: the predicate object sent as a JSON string (#1117). Read as page
278
+ * text, it is on no page, so a check that held answered `no`. A JSON object is read as that object.
279
+ * Any other string that starts with `{` is refused: it has no reading as text on a page.
280
+ */
281
+ function readJsonString(written) {
282
+ let parsed;
283
+ try {
284
+ parsed = JSON.parse(written);
285
+ }
286
+ catch {
287
+ parsed = undefined;
288
+ }
289
+ if (!isPlainRecord(parsed)) {
290
+ return {
291
+ value: written,
292
+ refusal: 'this string starts with { but is not a JSON object, so it was not read as text. Send the ' +
293
+ 'predicate as an object: { kind: "text", contains: "Saved" }',
294
+ };
295
+ }
296
+ const inner = readShorthand(parsed);
297
+ const note = 'a JSON string → the object it holds';
298
+ return { ...inner, note: inner.note === undefined ? note : `${note}; ${inner.note}` };
299
+ }
300
+ /** The one place a lenient form is read. The parse and the report both call it. */
301
+ function readShorthand(input) {
302
+ if ('string' === typeof input) {
303
+ return input.trimStart().startsWith('{') ? readJsonString(input) : readBareString(input);
304
+ }
305
+ if (!isPlainRecord(input)) {
306
+ return { value: input };
307
+ }
308
+ const renamed = renameKindSpelling(input);
309
+ return readTextWrapper(renamed) ?? readAbsentKind(renamed) ?? { value: input };
310
+ }
183
311
  /** Why a predicate with no `kind` was refused: the keys it had, and the kinds there are. */
184
312
  function noKindRefusal(obj) {
185
313
  const keys = writtenKeys(obj).map((key) => `\`${key}\``);
@@ -196,10 +324,15 @@ function noKindRefusal(obj) {
196
324
  * schema still refuses them.
197
325
  */
198
326
  export function predicateAliasesUsed(input, depth = 0) {
199
- if (depth > 8 || typeof input !== 'object' || null === input || Array.isArray(input))
327
+ if (depth > 8) {
200
328
  return [];
201
- const given = input;
202
- const used = [];
329
+ }
330
+ const read = readShorthand(input);
331
+ const used = read.note === undefined ? [] : [read.note];
332
+ if (!isPlainRecord(read.value)) {
333
+ return used;
334
+ }
335
+ const given = read.value;
203
336
  if (given['kind'] === undefined && 'string' === typeof given[KIND_SPELLING]) {
204
337
  used.push(`${KIND_SPELLING} → kind`);
205
338
  }
@@ -229,9 +362,15 @@ export function predicateAliasesUsed(input, depth = 0) {
229
362
  }
230
363
  /** Rename known aliases before parse; an explicit canonical key always wins. */
231
364
  function applyPredicateAliases(input, ctx) {
232
- if (typeof input !== 'object' || null === input || Array.isArray(input))
365
+ const read = readShorthand(input);
366
+ if (read.refusal !== undefined) {
367
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: read.refusal });
233
368
  return input;
234
- const given = input;
369
+ }
370
+ if (!isPlainRecord(read.value)) {
371
+ return read.value;
372
+ }
373
+ const given = read.value;
235
374
  const obj = withKind(given);
236
375
  if (obj['kind'] === undefined) {
237
376
  ctx.addIssue({ code: z.ZodIssueCode.custom, message: noKindRefusal(obj) });
@@ -418,6 +557,7 @@ function predicateUnion() {
418
557
  .object({
419
558
  kind: z.literal(PredicateKind.ANIMATION),
420
559
  name: z.string().optional(),
560
+ /** Target element as a Reticle ref (`e12`) or a CSS selector resolved against the live page. */
421
561
  target: z.string().optional(),
422
562
  completed: z.boolean().optional(),
423
563
  since: z.number().optional(),
@@ -68,6 +68,7 @@ const OWNER = {
68
68
  // Ours, or the caller's — either way not the app's.
69
69
  [VerifiedReason.VERSION_SKEW]: VerdictAttribution.HARNESS,
70
70
  [VerifiedReason.WINDOW_CLOSED_EARLY]: VerdictAttribution.HARNESS,
71
+ [VerifiedReason.DIALOG_DECLINED]: VerdictAttribution.HARNESS,
71
72
  [VerifiedReason.NOTHING_DECLARED]: VerdictAttribution.HARNESS,
72
73
  [VerifiedReason.VACUOUS_GRADE]: VerdictAttribution.HARNESS,
73
74
  [VerifiedReason.ALREADY_TRUE]: VerdictAttribution.HARNESS,
@@ -100,6 +100,12 @@ export declare const VerifiedReason: {
100
100
  * forbid. See #669.
101
101
  */
102
102
  readonly WINDOW_CLOSED_EARLY: "window_closed_early";
103
+ /**
104
+ * The app opened a `confirm` or `prompt` during the action, and Reticle declined it so that the
105
+ * tab cannot wedge. The app then took the path for "no", so a consequence that needed "yes" was
106
+ * not judged. NEVER `"no"`: the answer that decided the path was Reticle's, not the app's.
107
+ */
108
+ readonly DIALOG_DECLINED: "dialog_declined";
103
109
  /** The declared consequence did not hold. */
104
110
  readonly ASSERTION_FAILED: "assertion_failed";
105
111
  /** Channels disagreed about the action — the false green this product exists to catch. */
@@ -282,6 +288,17 @@ export declare const BlindSpotKind: {
282
288
  * subscribable store registers, which is when the SDK emits this kind with count 0.
283
289
  */
284
290
  readonly UNWATCHED_STATE: "unwatched-state";
291
+ /**
292
+ * The store committed, no DOM node moved, and a `<canvas>` on screen showed no change that the
293
+ * canvas digest could see.
294
+ *
295
+ * A canvas renders as pixels, so a repaint makes no DOM mutation. The digest is a 16x16 sample, so
296
+ * a small repaint can leave it the same, and a WebGL canvas without `preserveDrawingBuffer` reads
297
+ * back blank. `state-vs-render` does not fire then, and this says why: the render may be in pixels
298
+ * this window could not compare (#1525). Computed by the daemon for one act window; no SDK sends
299
+ * it. BOUNDING, never impeaching: what WAS observed is observed completely.
300
+ */
301
+ readonly CANVAS_PAINT_UNOBSERVED: "canvas-paint-unobserved";
285
302
  };
286
303
  export type BlindSpotKind = (typeof BlindSpotKind)[keyof typeof BlindSpotKind];
287
304
  /**
@@ -99,6 +99,12 @@ export const VerifiedReason = {
99
99
  * forbid. See #669.
100
100
  */
101
101
  WINDOW_CLOSED_EARLY: 'window_closed_early',
102
+ /**
103
+ * The app opened a `confirm` or `prompt` during the action, and Reticle declined it so that the
104
+ * tab cannot wedge. The app then took the path for "no", so a consequence that needed "yes" was
105
+ * not judged. NEVER `"no"`: the answer that decided the path was Reticle's, not the app's.
106
+ */
107
+ DIALOG_DECLINED: 'dialog_declined',
102
108
  /** The declared consequence did not hold. */
103
109
  ASSERTION_FAILED: 'assertion_failed',
104
110
  /** Channels disagreed about the action — the false green this product exists to catch. */
@@ -282,6 +288,17 @@ export const BlindSpotKind = {
282
288
  * subscribable store registers, which is when the SDK emits this kind with count 0.
283
289
  */
284
290
  UNWATCHED_STATE: 'unwatched-state',
291
+ /**
292
+ * The store committed, no DOM node moved, and a `<canvas>` on screen showed no change that the
293
+ * canvas digest could see.
294
+ *
295
+ * A canvas renders as pixels, so a repaint makes no DOM mutation. The digest is a 16x16 sample, so
296
+ * a small repaint can leave it the same, and a WebGL canvas without `preserveDrawingBuffer` reads
297
+ * back blank. `state-vs-render` does not fire then, and this says why: the render may be in pixels
298
+ * this window could not compare (#1525). Computed by the daemon for one act window; no SDK sends
299
+ * it. BOUNDING, never impeaching: what WAS observed is observed completely.
300
+ */
301
+ CANVAS_PAINT_UNOBSERVED: 'canvas-paint-unobserved',
285
302
  };
286
303
  /**
287
304
  * Blind spots that only exist in an Electron renderer.
@@ -13,3 +13,29 @@ export declare function clickButtonFromArgs(args: Record<string, unknown>): Clic
13
13
  * server both refuse with this sentence, so an argument is never dropped without a word.
14
14
  */
15
15
  export declare function clickInputProblem(action: ActionType, args: Record<string, unknown>): string | undefined;
16
+ /** The act argument for a point inside the target element. */
17
+ export declare const ACT_POINT_ARG = "at";
18
+ /** The drag argument for the end point inside the drop target, or inside the source. */
19
+ export declare const DRAG_TO_POINT_ARG = "to";
20
+ /** A point as fractions of a box: 0 is the left or top edge, 1 the right or bottom edge. */
21
+ export interface BoxFraction {
22
+ x: number;
23
+ y: number;
24
+ }
25
+ /** The point under `key`, each fraction clamped to 0..1, or undefined when absent or unreadable. */
26
+ export declare function boxFractionFromArgs(args: Record<string, unknown>, key: typeof ACT_POINT_ARG | typeof DRAG_TO_POINT_ARG): BoxFraction | undefined;
27
+ /** The point at `at` in `box`, in the coordinates of the box. */
28
+ export declare function pointInBox(box: {
29
+ x: number;
30
+ y: number;
31
+ width: number;
32
+ height: number;
33
+ }, at: BoxFraction): {
34
+ x: number;
35
+ y: number;
36
+ };
37
+ /**
38
+ * Why `at` or `to` cannot be honoured on this action, or undefined when it can or is absent. A point
39
+ * that is not two numbers is refused: an action at the centre is not the action that was asked for.
40
+ */
41
+ export declare function actPointProblem(action: string, args: Record<string, unknown>): string | undefined;