@reticlehq/core 3.2.0 → 3.4.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 (91) hide show
  1. package/README.md +1 -1
  2. package/dist/artifacts/flow-composition.d.ts +3 -2
  3. package/dist/artifacts/flow-constants.d.ts +68 -2
  4. package/dist/artifacts/flow-constants.js +84 -2
  5. package/dist/artifacts/flow-expect-flat.d.ts +260 -0
  6. package/dist/artifacts/flow-expect-flat.js +284 -0
  7. package/dist/artifacts/flow-mutation-target.d.ts +0 -1
  8. package/dist/artifacts/flow-mutation-target.js +30 -2
  9. package/dist/artifacts/flow-step-tool.d.ts +2 -0
  10. package/dist/artifacts/flow-types.d.ts +1285 -1343
  11. package/dist/artifacts/flow-types.js +111 -140
  12. package/dist/artifacts/impact.d.ts +48 -20
  13. package/dist/artifacts/impact.js +11 -0
  14. package/dist/artifacts/journal.d.ts +34 -6
  15. package/dist/artifacts/journal.js +13 -0
  16. package/dist/hooks/hook-events.d.ts +18 -18
  17. package/dist/hud-entry.d.ts +9 -0
  18. package/dist/hud-entry.js +9 -0
  19. package/dist/identity/source-constants.d.ts +11 -0
  20. package/dist/identity/source-constants.js +11 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.js +25 -1
  23. package/dist/onboarding.d.ts +2 -2
  24. package/dist/realm/registry.d.ts +0 -8
  25. package/dist/realm/registry.js +1 -11
  26. package/dist/registry/daemon-registry.d.ts +14 -4
  27. package/dist/registry/daemon-registry.js +20 -4
  28. package/dist/schema/event-message.json +3 -1
  29. package/dist/schema/event-payloads.json +72 -0
  30. package/dist/schema/event-type.json +3 -1
  31. package/dist/schema/reticle-event.json +3 -1
  32. package/dist/schema/reticle-message.json +3 -1
  33. package/dist/source-constants.cjs +1 -0
  34. package/dist/source-constants.d.cts +1 -0
  35. package/dist/telemetry-feedback.d.ts +6 -6
  36. package/dist/telemetry-refusal.d.ts +5 -4
  37. package/dist/telemetry-session.d.ts +25 -2
  38. package/dist/telemetry-session.js +13 -0
  39. package/dist/telemetry.d.ts +130 -102
  40. package/dist/verdict/compare-source.d.ts +80 -0
  41. package/dist/verdict/compare-source.js +93 -0
  42. package/dist/verdict/consequence.d.ts +12 -0
  43. package/dist/verdict/consequence.js +15 -0
  44. package/dist/verdict/instrumentation-gap.js +1 -1
  45. package/dist/verdict/intent.d.ts +24 -0
  46. package/dist/verdict/intent.js +66 -10
  47. package/dist/verdict/predicate-tree.d.ts +82 -0
  48. package/dist/verdict/predicate-tree.js +186 -0
  49. package/dist/verdict/predicate.d.ts +138 -0
  50. package/dist/verdict/predicate.js +430 -0
  51. package/dist/verdict/property-assertion.d.ts +191 -0
  52. package/dist/verdict/property-assertion.js +42 -0
  53. package/dist/verdict/security.js +16 -4
  54. package/dist/verdict/verdict-attribution.d.ts +52 -0
  55. package/dist/verdict/verdict-attribution.js +87 -0
  56. package/dist/verdict/verification-run.d.ts +330 -83
  57. package/dist/verdict/verification-run.js +44 -1
  58. package/dist/verdict/verified-constants.d.ts +9 -0
  59. package/dist/verdict/verified-constants.js +9 -0
  60. package/dist/wire/channel.d.ts +10 -0
  61. package/dist/wire/channel.js +25 -0
  62. package/dist/wire/constants/constants.d.ts +65 -102
  63. package/dist/wire/constants/constants.js +79 -101
  64. package/dist/wire/constants/discovery.d.ts +25 -0
  65. package/dist/wire/constants/discovery.js +25 -0
  66. package/dist/wire/constants/event-types.d.ts +122 -0
  67. package/dist/wire/constants/event-types.js +121 -0
  68. package/dist/wire/constants/hud-controls.d.ts +19 -0
  69. package/dist/wire/constants/hud-controls.js +95 -0
  70. package/dist/wire/constants/hud-use.d.ts +27 -0
  71. package/dist/wire/constants/hud-use.js +24 -0
  72. package/dist/wire/constants/session-constants.d.ts +10 -0
  73. package/dist/wire/constants/session-constants.js +10 -0
  74. package/dist/wire/event-payloads.d.ts +72 -13
  75. package/dist/wire/event-payloads.js +26 -4
  76. package/dist/wire/messages.d.ts +97 -56
  77. package/dist/wire/messages.js +17 -0
  78. package/dist/wire/net.d.ts +35 -0
  79. package/dist/wire/net.js +41 -0
  80. package/dist/wire/redaction.js +17 -0
  81. package/dist/wire/state-select.d.ts +2 -1
  82. package/dist/wire/state-select.js +56 -3
  83. package/dist/wire/toon.d.ts +1 -1
  84. package/dist/wire/toon.js +30 -8
  85. package/dist/wire/types.d.ts +119 -94
  86. package/dist/wire/types.js +23 -1
  87. package/dist/words/no-session-reason.d.ts +7 -0
  88. package/dist/words/no-session-reason.js +7 -0
  89. package/dist/words/notices.d.ts +7 -0
  90. package/dist/words/notices.js +9 -2
  91. package/package.json +7 -2
@@ -1,8 +1,25 @@
1
1
  import type { Ref } from '../identity/brand.js';
2
+ import type { Predicate } from '../verdict/predicate.js';
2
3
  import { z } from 'zod';
3
4
  import { ElementState } from './constants/constants.js';
4
5
  import { type AnnotationErrorCode, type AnnotationTarget } from '../artifacts/flow-constants.js';
5
- import type { FlowExpect } from '../artifacts/flow-types.js';
6
+ /**
7
+ * Attribute NAMES to project. `name=value` is refused, never quietly half-honoured.
8
+ *
9
+ * `attrs` has only ever been a projection: the browser reads each string with `getAttribute` and
10
+ * omits what is absent (adapters/realm/browser/src/dom/query.ts). So `["data-status=complete"]`
11
+ * looked up an attribute literally called `data-status=complete`, found none anywhere, and left the
12
+ * verdict resting on the locator alone — reported from the field (#1057) as three contradictory
13
+ * values all answering `verified:"yes"` on one element, one of them used to call a pipeline stage
14
+ * finished while it was still running.
15
+ *
16
+ * REFUSED rather than taught to match, because `attrs` is a projection list and a filter list is a
17
+ * different thing: `["href", "data-status=done"]` would have to mean both at once, and an `=` is
18
+ * legal inside an attribute value, so any split is a guess. The value comparison already exists as
19
+ * the query's own `value` residual, and the projected map answers everything else. A predicate that
20
+ * cannot express a value is honest; one that pretends to is a false green.
21
+ */
22
+ export declare const AttrNamesSchema: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
6
23
  /**
7
24
  * A query describing which element(s) to find, Testing-Library style.
8
25
  *
@@ -37,7 +54,7 @@ export declare const ElementQuerySchema: z.ZodObject<{
37
54
  * Attribute names to project onto each match (e.g. `['href']` to inventory links, `['src']` for
38
55
  * images). Without this the descriptor carries only semantics, so URLs are unreachable.
39
56
  */
40
- attrs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
57
+ attrs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
41
58
  /** Source location of the target element (auto-anchor resolution) — the precise, granular match. */
42
59
  source: z.ZodOptional<z.ZodObject<{
43
60
  file: z.ZodString;
@@ -66,42 +83,42 @@ export declare const ElementQuerySchema: z.ZodObject<{
66
83
  */
67
84
  self: z.ZodOptional<z.ZodBoolean>;
68
85
  }, "strict", z.ZodTypeAny, {
69
- role?: string | undefined;
70
86
  text?: string | undefined;
87
+ testid?: string | undefined;
88
+ role?: string | undefined;
89
+ component?: string | undefined;
71
90
  label?: string | undefined;
72
91
  placeholder?: string | undefined;
73
- testid?: string | undefined;
74
92
  alt?: string | undefined;
75
- component?: string | undefined;
76
93
  value?: string | undefined;
94
+ name?: string | undefined;
95
+ by?: "text" | "testid" | "role" | "component" | "label" | "placeholder" | "alt" | undefined;
96
+ attrs?: string[] | undefined;
77
97
  source?: {
78
98
  file: string;
79
99
  line: number;
80
100
  column?: number | undefined;
81
101
  } | undefined;
82
- name?: string | undefined;
83
102
  scope?: string | undefined;
84
- by?: "role" | "text" | "label" | "placeholder" | "testid" | "alt" | "component" | undefined;
85
- attrs?: string[] | undefined;
86
103
  self?: boolean | undefined;
87
104
  }, {
88
- role?: string | undefined;
89
105
  text?: string | undefined;
106
+ testid?: string | undefined;
107
+ role?: string | undefined;
108
+ component?: string | undefined;
90
109
  label?: string | undefined;
91
110
  placeholder?: string | undefined;
92
- testid?: string | undefined;
93
111
  alt?: string | undefined;
94
- component?: string | undefined;
95
112
  value?: string | undefined;
113
+ name?: string | undefined;
114
+ by?: "text" | "testid" | "role" | "component" | "label" | "placeholder" | "alt" | undefined;
115
+ attrs?: string[] | undefined;
96
116
  source?: {
97
117
  file: string;
98
118
  line: number;
99
119
  column?: number | undefined;
100
120
  } | undefined;
101
- name?: string | undefined;
102
121
  scope?: string | undefined;
103
- by?: "role" | "text" | "label" | "placeholder" | "testid" | "alt" | "component" | undefined;
104
- attrs?: string[] | undefined;
105
122
  self?: boolean | undefined;
106
123
  }>;
107
124
  export type ElementQuery = z.infer<typeof ElementQuerySchema>;
@@ -188,6 +205,14 @@ export interface QueryEmptyHint {
188
205
  presentRegions: PresentRegion[];
189
206
  /** @deprecated Use presentRegions. Kept for one major cycle; removed next major. */
190
207
  presentTestids: string[];
208
+ /**
209
+ * Present only when `presentTestids` was cut at its cap: how many distinct testids there were
210
+ * before the cut. The list is collected in DOCUMENT ORDER, so what the cap drops is whatever sits
211
+ * lowest on the page — a detail panel after the header, nav and list — and a list handed back
212
+ * with no marker reads as "here is what is present", with the panel absent from it. That was read
213
+ * in the field as proof the panel never rendered. A trim is never silent.
214
+ */
215
+ presentTestidsTotal?: number;
191
216
  /** True if a capability-registered testid is present in the scope. */
192
217
  knownEmptyState: boolean;
193
218
  /**
@@ -230,11 +255,11 @@ export declare const CapabilityFlowSchema: z.ZodObject<{
230
255
  name: z.ZodString;
231
256
  steps: z.ZodArray<z.ZodString, "many">;
232
257
  }, "strip", z.ZodTypeAny, {
233
- name: string;
234
258
  steps: string[];
235
- }, {
236
259
  name: string;
260
+ }, {
237
261
  steps: string[];
262
+ name: string;
238
263
  }>;
239
264
  /**
240
265
  * A declared risk zone — the app naming a surface (auth/payment/db/…) and the paths it covers, so a
@@ -297,23 +322,23 @@ export declare const ManifestGovernanceSchema: z.ZodObject<{
297
322
  paths?: string[] | undefined;
298
323
  }>, "many">>;
299
324
  }, "strip", z.ZodTypeAny, {
300
- scope?: string[] | undefined;
301
- owner?: string | undefined;
302
325
  risk?: {
303
326
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
304
327
  note?: string | undefined;
305
328
  paths?: string[] | undefined;
306
329
  }[] | undefined;
330
+ scope?: string[] | undefined;
331
+ owner?: string | undefined;
307
332
  safety?: string[] | undefined;
308
333
  redact?: string[] | undefined;
309
334
  }, {
310
- scope?: string[] | undefined;
311
- owner?: string | undefined;
312
335
  risk?: {
313
336
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
314
337
  note?: string | undefined;
315
338
  paths?: string[] | undefined;
316
339
  }[] | undefined;
340
+ scope?: string[] | undefined;
341
+ owner?: string | undefined;
317
342
  safety?: string[] | undefined;
318
343
  redact?: string[] | undefined;
319
344
  }>;
@@ -327,11 +352,11 @@ export declare const CapabilitiesSchema: z.ZodObject<{
327
352
  name: z.ZodString;
328
353
  steps: z.ZodArray<z.ZodString, "many">;
329
354
  }, "strip", z.ZodTypeAny, {
330
- name: string;
331
355
  steps: string[];
332
- }, {
333
356
  name: string;
357
+ }, {
334
358
  steps: string[];
359
+ name: string;
335
360
  }>, "many">;
336
361
  /** Optional declared governance (owner/safety/scope/redact/risk). Additive — back-compat safe. */
337
362
  governance: z.ZodOptional<z.ZodObject<{
@@ -362,61 +387,61 @@ export declare const CapabilitiesSchema: z.ZodObject<{
362
387
  paths?: string[] | undefined;
363
388
  }>, "many">>;
364
389
  }, "strip", z.ZodTypeAny, {
365
- scope?: string[] | undefined;
366
- owner?: string | undefined;
367
390
  risk?: {
368
391
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
369
392
  note?: string | undefined;
370
393
  paths?: string[] | undefined;
371
394
  }[] | undefined;
395
+ scope?: string[] | undefined;
396
+ owner?: string | undefined;
372
397
  safety?: string[] | undefined;
373
398
  redact?: string[] | undefined;
374
399
  }, {
375
- scope?: string[] | undefined;
376
- owner?: string | undefined;
377
400
  risk?: {
378
401
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
379
402
  note?: string | undefined;
380
403
  paths?: string[] | undefined;
381
404
  }[] | undefined;
405
+ scope?: string[] | undefined;
406
+ owner?: string | undefined;
382
407
  safety?: string[] | undefined;
383
408
  redact?: string[] | undefined;
384
409
  }>>;
385
410
  }, "strip", z.ZodTypeAny, {
386
411
  flows: {
387
- name: string;
388
412
  steps: string[];
413
+ name: string;
389
414
  }[];
390
- signals: string[];
391
415
  testids: string[];
416
+ signals: string[];
392
417
  stores: string[];
393
418
  governance?: {
394
- scope?: string[] | undefined;
395
- owner?: string | undefined;
396
419
  risk?: {
397
420
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
398
421
  note?: string | undefined;
399
422
  paths?: string[] | undefined;
400
423
  }[] | undefined;
424
+ scope?: string[] | undefined;
425
+ owner?: string | undefined;
401
426
  safety?: string[] | undefined;
402
427
  redact?: string[] | undefined;
403
428
  } | undefined;
404
429
  }, {
405
430
  flows: {
406
- name: string;
407
431
  steps: string[];
432
+ name: string;
408
433
  }[];
409
- signals: string[];
410
434
  testids: string[];
435
+ signals: string[];
411
436
  stores: string[];
412
437
  governance?: {
413
- scope?: string[] | undefined;
414
- owner?: string | undefined;
415
438
  risk?: {
416
439
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
417
440
  note?: string | undefined;
418
441
  paths?: string[] | undefined;
419
442
  }[] | undefined;
443
+ scope?: string[] | undefined;
444
+ owner?: string | undefined;
420
445
  safety?: string[] | undefined;
421
446
  redact?: string[] | undefined;
422
447
  } | undefined;
@@ -434,11 +459,11 @@ export declare const ContractFileSchema: z.ZodObject<{
434
459
  name: z.ZodString;
435
460
  steps: z.ZodArray<z.ZodString, "many">;
436
461
  }, "strip", z.ZodTypeAny, {
437
- name: string;
438
462
  steps: string[];
439
- }, {
440
463
  name: string;
464
+ }, {
441
465
  steps: string[];
466
+ name: string;
442
467
  }>, "many">;
443
468
  /** Optional declared governance (owner/safety/scope/redact/risk). Additive — back-compat safe. */
444
469
  governance: z.ZodOptional<z.ZodObject<{
@@ -469,61 +494,61 @@ export declare const ContractFileSchema: z.ZodObject<{
469
494
  paths?: string[] | undefined;
470
495
  }>, "many">>;
471
496
  }, "strip", z.ZodTypeAny, {
472
- scope?: string[] | undefined;
473
- owner?: string | undefined;
474
497
  risk?: {
475
498
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
476
499
  note?: string | undefined;
477
500
  paths?: string[] | undefined;
478
501
  }[] | undefined;
502
+ scope?: string[] | undefined;
503
+ owner?: string | undefined;
479
504
  safety?: string[] | undefined;
480
505
  redact?: string[] | undefined;
481
506
  }, {
482
- scope?: string[] | undefined;
483
- owner?: string | undefined;
484
507
  risk?: {
485
508
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
486
509
  note?: string | undefined;
487
510
  paths?: string[] | undefined;
488
511
  }[] | undefined;
512
+ scope?: string[] | undefined;
513
+ owner?: string | undefined;
489
514
  safety?: string[] | undefined;
490
515
  redact?: string[] | undefined;
491
516
  }>>;
492
517
  }, "strip", z.ZodTypeAny, {
493
518
  flows: {
494
- name: string;
495
519
  steps: string[];
520
+ name: string;
496
521
  }[];
497
- signals: string[];
498
522
  testids: string[];
523
+ signals: string[];
499
524
  stores: string[];
500
525
  governance?: {
501
- scope?: string[] | undefined;
502
- owner?: string | undefined;
503
526
  risk?: {
504
527
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
505
528
  note?: string | undefined;
506
529
  paths?: string[] | undefined;
507
530
  }[] | undefined;
531
+ scope?: string[] | undefined;
532
+ owner?: string | undefined;
508
533
  safety?: string[] | undefined;
509
534
  redact?: string[] | undefined;
510
535
  } | undefined;
511
536
  }, {
512
537
  flows: {
513
- name: string;
514
538
  steps: string[];
539
+ name: string;
515
540
  }[];
516
- signals: string[];
517
541
  testids: string[];
542
+ signals: string[];
518
543
  stores: string[];
519
544
  governance?: {
520
- scope?: string[] | undefined;
521
- owner?: string | undefined;
522
545
  risk?: {
523
546
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
524
547
  note?: string | undefined;
525
548
  paths?: string[] | undefined;
526
549
  }[] | undefined;
550
+ scope?: string[] | undefined;
551
+ owner?: string | undefined;
527
552
  safety?: string[] | undefined;
528
553
  redact?: string[] | undefined;
529
554
  } | undefined;
@@ -531,20 +556,20 @@ export declare const ContractFileSchema: z.ZodObject<{
531
556
  }, "strip", z.ZodTypeAny, {
532
557
  capabilities: {
533
558
  flows: {
534
- name: string;
535
559
  steps: string[];
560
+ name: string;
536
561
  }[];
537
- signals: string[];
538
562
  testids: string[];
563
+ signals: string[];
539
564
  stores: string[];
540
565
  governance?: {
541
- scope?: string[] | undefined;
542
- owner?: string | undefined;
543
566
  risk?: {
544
567
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
545
568
  note?: string | undefined;
546
569
  paths?: string[] | undefined;
547
570
  }[] | undefined;
571
+ scope?: string[] | undefined;
572
+ owner?: string | undefined;
548
573
  safety?: string[] | undefined;
549
574
  redact?: string[] | undefined;
550
575
  } | undefined;
@@ -554,20 +579,20 @@ export declare const ContractFileSchema: z.ZodObject<{
554
579
  }, {
555
580
  capabilities: {
556
581
  flows: {
557
- name: string;
558
582
  steps: string[];
583
+ name: string;
559
584
  }[];
560
- signals: string[];
561
585
  testids: string[];
586
+ signals: string[];
562
587
  stores: string[];
563
588
  governance?: {
564
- scope?: string[] | undefined;
565
- owner?: string | undefined;
566
589
  risk?: {
567
590
  surface: "auth" | "payment" | "db" | "migration" | "rls" | "secrets" | "destructive" | "external";
568
591
  note?: string | undefined;
569
592
  paths?: string[] | undefined;
570
593
  }[] | undefined;
594
+ scope?: string[] | undefined;
595
+ owner?: string | undefined;
571
596
  safety?: string[] | undefined;
572
597
  redact?: string[] | undefined;
573
598
  } | undefined;
@@ -622,29 +647,29 @@ export declare const RunRecordSchema: z.ZodObject<{
622
647
  }>>;
623
648
  durationMs: z.ZodOptional<z.ZodNumber>;
624
649
  }, "strip", z.ZodTypeAny, {
625
- status: "pass" | "drift" | "error" | "fail";
626
650
  kind: "flow_replay" | "manual";
651
+ status: "pass" | "drift" | "error" | "fail";
627
652
  at: number;
628
653
  name: string;
629
- summary?: string | undefined;
630
654
  durationMs?: number | undefined;
631
655
  evidence?: {
632
656
  consoleErrors?: number | undefined;
633
657
  networkErrors?: number | undefined;
634
658
  driftSteps?: number | undefined;
635
659
  } | undefined;
660
+ summary?: string | undefined;
636
661
  }, {
637
- status: "pass" | "drift" | "error" | "fail";
638
662
  kind: "flow_replay" | "manual";
663
+ status: "pass" | "drift" | "error" | "fail";
639
664
  at: number;
640
665
  name: string;
641
- summary?: string | undefined;
642
666
  durationMs?: number | undefined;
643
667
  evidence?: {
644
668
  consoleErrors?: number | undefined;
645
669
  networkErrors?: number | undefined;
646
670
  driftSteps?: number | undefined;
647
671
  } | undefined;
672
+ summary?: string | undefined;
648
673
  }>;
649
674
  export type RunRecord = z.infer<typeof RunRecordSchema>;
650
675
  /** The optional learned map of the app (known flow/route names). */
@@ -763,43 +788,43 @@ export declare const ProjectFileSchema: z.ZodObject<{
763
788
  }>>;
764
789
  durationMs: z.ZodOptional<z.ZodNumber>;
765
790
  }, "strip", z.ZodTypeAny, {
766
- status: "pass" | "drift" | "error" | "fail";
767
791
  kind: "flow_replay" | "manual";
792
+ status: "pass" | "drift" | "error" | "fail";
768
793
  at: number;
769
794
  name: string;
770
- summary?: string | undefined;
771
795
  durationMs?: number | undefined;
772
796
  evidence?: {
773
797
  consoleErrors?: number | undefined;
774
798
  networkErrors?: number | undefined;
775
799
  driftSteps?: number | undefined;
776
800
  } | undefined;
801
+ summary?: string | undefined;
777
802
  }, {
778
- status: "pass" | "drift" | "error" | "fail";
779
803
  kind: "flow_replay" | "manual";
804
+ status: "pass" | "drift" | "error" | "fail";
780
805
  at: number;
781
806
  name: string;
782
- summary?: string | undefined;
783
807
  durationMs?: number | undefined;
784
808
  evidence?: {
785
809
  consoleErrors?: number | undefined;
786
810
  networkErrors?: number | undefined;
787
811
  driftSteps?: number | undefined;
788
812
  } | undefined;
813
+ summary?: string | undefined;
789
814
  }>, "many">;
790
815
  }, "strip", z.ZodTypeAny, {
791
816
  runs: {
792
- status: "pass" | "drift" | "error" | "fail";
793
817
  kind: "flow_replay" | "manual";
818
+ status: "pass" | "drift" | "error" | "fail";
794
819
  at: number;
795
820
  name: string;
796
- summary?: string | undefined;
797
821
  durationMs?: number | undefined;
798
822
  evidence?: {
799
823
  consoleErrors?: number | undefined;
800
824
  networkErrors?: number | undefined;
801
825
  driftSteps?: number | undefined;
802
826
  } | undefined;
827
+ summary?: string | undefined;
803
828
  }[];
804
829
  version: 1;
805
830
  learned?: {
@@ -812,17 +837,17 @@ export declare const ProjectFileSchema: z.ZodObject<{
812
837
  } | undefined;
813
838
  }, {
814
839
  runs: {
815
- status: "pass" | "drift" | "error" | "fail";
816
840
  kind: "flow_replay" | "manual";
841
+ status: "pass" | "drift" | "error" | "fail";
817
842
  at: number;
818
843
  name: string;
819
- summary?: string | undefined;
820
844
  durationMs?: number | undefined;
821
845
  evidence?: {
822
846
  consoleErrors?: number | undefined;
823
847
  networkErrors?: number | undefined;
824
848
  driftSteps?: number | undefined;
825
849
  } | undefined;
850
+ summary?: string | undefined;
826
851
  }[];
827
852
  version: 1;
828
853
  learned?: {
@@ -862,11 +887,11 @@ export declare const AnnotationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObj
862
887
  kind: z.ZodLiteral<"assert-visible">;
863
888
  testid: z.ZodString;
864
889
  }, "strip", z.ZodTypeAny, {
865
- testid: string;
866
890
  kind: "assert-visible";
867
- }, {
868
891
  testid: string;
892
+ }, {
869
893
  kind: "assert-visible";
894
+ testid: string;
870
895
  }>, z.ZodObject<{
871
896
  kind: z.ZodLiteral<"assert-state">;
872
897
  statePath: z.ZodString;
@@ -920,11 +945,11 @@ export declare const AnnotationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObj
920
945
  kind: z.ZodLiteral<"mark-dynamic">;
921
946
  testid: z.ZodString;
922
947
  }, "strip", z.ZodTypeAny, {
923
- testid: string;
924
948
  kind: "mark-dynamic";
925
- }, {
926
949
  testid: string;
950
+ }, {
927
951
  kind: "mark-dynamic";
952
+ testid: string;
928
953
  }>, z.ZodObject<{
929
954
  kind: z.ZodLiteral<"success-state">;
930
955
  signal: z.ZodOptional<z.ZodString>;
@@ -967,62 +992,62 @@ export declare const AnnotationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObj
967
992
  }, "strip", z.ZodTypeAny, {
968
993
  contains: string;
969
994
  visible?: boolean | undefined;
970
- absent?: boolean | undefined;
971
995
  scope?: string | undefined;
996
+ absent?: boolean | undefined;
972
997
  }, {
973
998
  contains: string;
974
999
  visible?: boolean | undefined;
975
- absent?: boolean | undefined;
976
1000
  scope?: string | undefined;
1001
+ absent?: boolean | undefined;
977
1002
  }>>;
978
1003
  }, "strip", z.ZodTypeAny, {
979
1004
  kind: "success-state";
980
1005
  signal?: string | undefined;
981
- text?: {
982
- contains: string;
983
- visible?: boolean | undefined;
984
- absent?: boolean | undefined;
985
- scope?: string | undefined;
986
- } | undefined;
987
- testid?: string | undefined;
988
1006
  net?: {
989
1007
  status?: number | undefined;
990
1008
  method?: string | undefined;
991
1009
  urlContains?: string | undefined;
992
1010
  count?: number | undefined;
993
1011
  } | undefined;
1012
+ text?: {
1013
+ contains: string;
1014
+ visible?: boolean | undefined;
1015
+ scope?: string | undefined;
1016
+ absent?: boolean | undefined;
1017
+ } | undefined;
994
1018
  console?: {
995
1019
  level?: string | undefined;
996
1020
  absent?: boolean | undefined;
997
1021
  } | undefined;
998
- store?: string | undefined;
999
- equals?: unknown;
1022
+ testid?: string | undefined;
1000
1023
  hold?: boolean | undefined;
1024
+ store?: string | undefined;
1001
1025
  statePath?: string | undefined;
1026
+ equals?: unknown;
1002
1027
  }, {
1003
1028
  kind: "success-state";
1004
1029
  signal?: string | undefined;
1005
- text?: {
1006
- contains: string;
1007
- visible?: boolean | undefined;
1008
- absent?: boolean | undefined;
1009
- scope?: string | undefined;
1010
- } | undefined;
1011
- testid?: string | undefined;
1012
1030
  net?: {
1013
1031
  status?: number | undefined;
1014
1032
  method?: string | undefined;
1015
1033
  urlContains?: string | undefined;
1016
1034
  count?: number | undefined;
1017
1035
  } | undefined;
1036
+ text?: {
1037
+ contains: string;
1038
+ visible?: boolean | undefined;
1039
+ scope?: string | undefined;
1040
+ absent?: boolean | undefined;
1041
+ } | undefined;
1018
1042
  console?: {
1019
1043
  level?: string | undefined;
1020
1044
  absent?: boolean | undefined;
1021
1045
  } | undefined;
1022
- store?: string | undefined;
1023
- equals?: unknown;
1046
+ testid?: string | undefined;
1024
1047
  hold?: boolean | undefined;
1048
+ store?: string | undefined;
1025
1049
  statePath?: string | undefined;
1050
+ equals?: unknown;
1026
1051
  }>, z.ZodObject<{
1027
1052
  kind: z.ZodLiteral<"intent">;
1028
1053
  text: z.ZodString;
@@ -1071,11 +1096,11 @@ export type AnnotateResult = {
1071
1096
  export interface AnnotatePatch {
1072
1097
  /** index of the step whose.expect is set (assert-signal / assert-visible). */
1073
1098
  stepIndex?: number;
1074
- stepExpect?: FlowExpect;
1099
+ stepExpect?: Predicate;
1075
1100
  /** the testid pushed into flow.dynamic[] (mark-dynamic). */
1076
1101
  dynamicAdd?: string;
1077
1102
  /** flow.success (success-state). */
1078
- success?: FlowExpect;
1103
+ success?: Predicate;
1079
1104
  /** flow.intent (intent) — the business goal this flow exists to verify. */
1080
1105
  intent?: string;
1081
1106
  }
@@ -3,6 +3,28 @@ import { CONTRACT_FILE_VERSION, ElementState, QueryBy } from './constants/consta
3
3
  // Imported from where they actually live: these are artifact constants, not wire constants.
4
4
  import { AnnotationKind, PROJECT_FILE_VERSION, RunKind, RunStatus, } from '../artifacts/flow-constants.js';
5
5
  import { RiskSurface } from '../verdict/verification-run.js';
6
+ /**
7
+ * Attribute NAMES to project. `name=value` is refused, never quietly half-honoured.
8
+ *
9
+ * `attrs` has only ever been a projection: the browser reads each string with `getAttribute` and
10
+ * omits what is absent (adapters/realm/browser/src/dom/query.ts). So `["data-status=complete"]`
11
+ * looked up an attribute literally called `data-status=complete`, found none anywhere, and left the
12
+ * verdict resting on the locator alone — reported from the field (#1057) as three contradictory
13
+ * values all answering `verified:"yes"` on one element, one of them used to call a pipeline stage
14
+ * finished while it was still running.
15
+ *
16
+ * REFUSED rather than taught to match, because `attrs` is a projection list and a filter list is a
17
+ * different thing: `["href", "data-status=done"]` would have to mean both at once, and an `=` is
18
+ * legal inside an attribute value, so any split is a guess. The value comparison already exists as
19
+ * the query's own `value` residual, and the projected map answers everything else. A predicate that
20
+ * cannot express a value is honest; one that pretends to is a false green.
21
+ */
22
+ export const AttrNamesSchema = z.array(z.string().refine((name) => !name.includes('='), (name) => ({
23
+ message: `\`attrs\` takes attribute NAMES only, not \`name=value\` — got ${JSON.stringify(name)}. ` +
24
+ 'It PROJECTS each attribute onto the match, it does not filter on it. Drop the `=value` ' +
25
+ 'half and read the returned `attrs` map, or assert the value with an `element` predicate ' +
26
+ 'carrying `value`.',
27
+ })));
6
28
  /**
7
29
  * A query describing which element(s) to find, Testing-Library style.
8
30
  *
@@ -30,7 +52,7 @@ export const ElementQuerySchema = z
30
52
  * Attribute names to project onto each match (e.g. `['href']` to inventory links, `['src']` for
31
53
  * images). Without this the descriptor carries only semantics, so URLs are unreachable.
32
54
  */
33
- attrs: z.array(z.string()).optional(),
55
+ attrs: AttrNamesSchema.optional(),
34
56
  /** Source location of the target element (auto-anchor resolution) — the precise, granular match. */
35
57
  source: z
36
58
  .object({ file: z.string(), line: z.number(), column: z.number().optional() })
@@ -23,6 +23,13 @@ export declare const NoSessionReason: {
23
23
  readonly LEASE_EXPIRED: "lease_expired";
24
24
  /** Connected before; the tab was closed, navigated away, or hard-reloaded. */
25
25
  readonly TAB_GONE: "tab_gone";
26
+ /**
27
+ * Connected before, and the route the tab was on answers 5xx right now. A server error tears the
28
+ * page down and the SDK never reconnects, so it used to read as TAB_GONE — the URL was known, and
29
+ * nothing asked it what it answers. This is the answer, and it outranks TAB_GONE because it is not
30
+ * an absence. Present tense only: a 5xx now is what was observed, not a claim about then.
31
+ */
32
+ readonly ROUTE_SERVER_ERROR: "route_server_error";
26
33
  /** This project has connected before, but not to this daemon run. Usually a restart with no reopen. */
27
34
  readonly APP_NOT_REOPENED: "app_not_reopened";
28
35
  /** A `.reticle.json` exists OUTSIDE this daemon's directory: a scope problem, not an install one. */
@@ -23,6 +23,13 @@ export const NoSessionReason = {
23
23
  LEASE_EXPIRED: 'lease_expired',
24
24
  /** Connected before; the tab was closed, navigated away, or hard-reloaded. */
25
25
  TAB_GONE: 'tab_gone',
26
+ /**
27
+ * Connected before, and the route the tab was on answers 5xx right now. A server error tears the
28
+ * page down and the SDK never reconnects, so it used to read as TAB_GONE — the URL was known, and
29
+ * nothing asked it what it answers. This is the answer, and it outranks TAB_GONE because it is not
30
+ * an absence. Present tense only: a 5xx now is what was observed, not a claim about then.
31
+ */
32
+ ROUTE_SERVER_ERROR: 'route_server_error',
26
33
  /** This project has connected before, but not to this daemon run. Usually a restart with no reopen. */
27
34
  APP_NOT_REOPENED: 'app_not_reopened',
28
35
  /** A `.reticle.json` exists OUTSIDE this daemon's directory: a scope problem, not an install one. */
@@ -42,6 +42,13 @@ export declare const BUFFER_EVICTION_WARNING = "event buffer evicted older event
42
42
  * so the two no-session paths now agree.
43
43
  */
44
44
  export declare const NO_SESSION_CONNECTED_ERROR = "no browser session connected. Two things to check: (1) your app is running with @reticlehq/browser enabled, and (2) it points at THIS daemon's port \u2014 a mismatch between the app's reticle({ port }) / VITE_RETICLE_WS_URL and the daemon's RETICLE_PORT is the usual cause. Call reticle_sessions for the diagnosis \u2014 it names which of these it is, and what to do next \u2014 rather than retrying this call.";
45
+ /**
46
+ * Explains an unconfirmed navigation that did reconnect, but at a different URL.
47
+ *
48
+ * The URL itself is supplied by the navigation result as `landedOn`; this constant keeps the
49
+ * surrounding explanation on the core wire-copy side rather than embedding it in the server tool.
50
+ */
51
+ export declare const NAVIGATION_REDIRECT_NOTE = "The navigation arrived, but the browser landed at a different URL. The app may have redirected the navigation, for example because authentication or another route guard changed the destination.";
45
52
  /** Surfaced on act/assert results when the target tab is throttled. */
46
53
  export declare const THROTTLED_WARNING = "tab throttled; timer/rAF/pointer gestures may silently no-op; refocus before driving";
47
54
  /**