@reticlehq/core 2.14.0 → 3.2.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 (148) hide show
  1. package/dist/{artifacts-entry.d.ts → artifacts/artifacts-entry.d.ts} +7 -7
  2. package/dist/{artifacts-entry.js → artifacts/artifacts-entry.js} +7 -7
  3. package/dist/artifacts/flow-composition.d.ts +30 -0
  4. package/dist/artifacts/flow-composition.js +19 -0
  5. package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +99 -3
  6. package/dist/{flow-constants.js → artifacts/flow-constants.js} +108 -4
  7. package/dist/artifacts/flow-mutation-target.d.ts +39 -0
  8. package/dist/artifacts/flow-mutation-target.js +89 -0
  9. package/dist/artifacts/flow-order.d.ts +30 -0
  10. package/dist/artifacts/flow-order.js +49 -0
  11. package/dist/artifacts/flow-select.d.ts +56 -0
  12. package/dist/artifacts/flow-select.js +56 -0
  13. package/dist/artifacts/flow-step-tool.d.ts +31 -0
  14. package/dist/artifacts/flow-step-tool.js +31 -0
  15. package/dist/artifacts/flow-types.d.ts +3736 -0
  16. package/dist/artifacts/flow-types.js +463 -0
  17. package/dist/artifacts/flow-unreached.d.ts +12 -0
  18. package/dist/artifacts/flow-unreached.js +24 -0
  19. package/dist/{impact.d.ts → artifacts/impact.d.ts} +271 -103
  20. package/dist/{impact.js → artifacts/impact.js} +75 -5
  21. package/dist/artifacts/journal.d.ts +218 -0
  22. package/dist/artifacts/journal.js +130 -0
  23. package/dist/artifacts/step-effect.d.ts +29 -0
  24. package/dist/artifacts/step-effect.js +28 -0
  25. package/dist/hooks/hook-events.d.ts +311 -0
  26. package/dist/hooks/hook-events.js +127 -0
  27. package/dist/hooks/hooks-entry.d.ts +9 -0
  28. package/dist/hooks/hooks-entry.js +9 -0
  29. package/dist/identity/brand.d.ts +102 -0
  30. package/dist/{brand.js → identity/brand.js} +7 -0
  31. package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
  32. package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
  33. package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
  34. package/dist/{document-identity.js → identity/document-identity.js} +4 -5
  35. package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
  36. package/dist/{source-constants.js → identity/source-constants.js} +4 -4
  37. package/dist/index.d.ts +57 -43
  38. package/dist/index.js +66 -45
  39. package/dist/onboarding.d.ts +114 -0
  40. package/dist/onboarding.js +141 -0
  41. package/dist/realm/registry.d.ts +212 -0
  42. package/dist/realm/registry.js +302 -0
  43. package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +6 -7
  44. package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
  45. package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
  46. package/dist/{project-registry.js → registry/project-registry.js} +5 -5
  47. package/dist/schema/command-name.json +31 -0
  48. package/dist/schema/event-payloads.json +795 -0
  49. package/dist/schema/hello-message.json +70 -2
  50. package/dist/schema/reticle-message.json +70 -2
  51. package/dist/telemetry-entry.d.ts +1 -1
  52. package/dist/telemetry-entry.js +1 -1
  53. package/dist/telemetry-feedback.d.ts +15 -16
  54. package/dist/telemetry-feedback.js +11 -12
  55. package/dist/telemetry-license.d.ts +1 -1
  56. package/dist/telemetry-license.js +1 -1
  57. package/dist/telemetry-refusal.d.ts +11 -11
  58. package/dist/telemetry-refusal.js +7 -8
  59. package/dist/telemetry-session.d.ts +51 -59
  60. package/dist/telemetry-session.js +47 -55
  61. package/dist/telemetry.d.ts +306 -222
  62. package/dist/telemetry.js +112 -99
  63. package/dist/tour-entry.d.ts +10 -0
  64. package/dist/tour-entry.js +10 -0
  65. package/dist/tour.d.ts +125 -0
  66. package/dist/tour.js +165 -0
  67. package/dist/{consequence.d.ts → verdict/consequence.d.ts} +32 -15
  68. package/dist/{consequence.js → verdict/consequence.js} +9 -31
  69. package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
  70. package/dist/{findings.d.ts → verdict/findings.d.ts} +86 -39
  71. package/dist/{findings.js → verdict/findings.js} +103 -49
  72. package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +7 -14
  73. package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +7 -15
  74. package/dist/{intent.d.ts → verdict/intent.d.ts} +35 -46
  75. package/dist/{intent.js → verdict/intent.js} +11 -22
  76. package/dist/verdict/revision.d.ts +44 -0
  77. package/dist/verdict/revision.js +53 -0
  78. package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
  79. package/dist/{run-context.js → verdict/run-context.js} +15 -36
  80. package/dist/{security.js → verdict/security.js} +12 -21
  81. package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +381 -105
  82. package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
  83. package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +34 -13
  84. package/dist/{verified-constants.js → verdict/verified-constants.js} +34 -13
  85. package/dist/{verify-progress.d.ts → verdict/verify-progress.d.ts} +18 -22
  86. package/dist/{verify-progress.js → verdict/verify-progress.js} +6 -10
  87. package/dist/wire/channel.d.ts +46 -0
  88. package/dist/wire/channel.js +95 -0
  89. package/dist/{constants.d.ts → wire/constants/constants.d.ts} +179 -28
  90. package/dist/{constants.js → wire/constants/constants.js} +199 -28
  91. package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +23 -2
  92. package/dist/{session-constants.js → wire/constants/session-constants.js} +23 -2
  93. package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
  94. package/dist/{event-classification.js → wire/event-classification.js} +1 -1
  95. package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +72 -13
  96. package/dist/{event-payloads.js → wire/event-payloads.js} +23 -3
  97. package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
  98. package/dist/{event-priority.js → wire/event-priority.js} +2 -5
  99. package/dist/{global-press.js → wire/global-press.js} +1 -1
  100. package/dist/{messages.d.ts → wire/messages.d.ts} +240 -48
  101. package/dist/{messages.js → wire/messages.js} +68 -5
  102. package/dist/wire/narrow.d.ts +39 -0
  103. package/dist/wire/narrow.js +45 -0
  104. package/dist/{net.d.ts → wire/net.d.ts} +36 -13
  105. package/dist/{net.js → wire/net.js} +36 -13
  106. package/dist/wire/platform.d.ts +37 -0
  107. package/dist/wire/platform.js +36 -0
  108. package/dist/{redaction.js → wire/redaction.js} +12 -12
  109. package/dist/wire/snapshot-tree.d.ts +33 -0
  110. package/dist/wire/snapshot-tree.js +43 -0
  111. package/dist/wire/tool-names.d.ts +133 -0
  112. package/dist/wire/tool-names.js +142 -0
  113. package/dist/{toon.js → wire/toon.js} +1 -1
  114. package/dist/{types.d.ts → wire/types.d.ts} +77 -76
  115. package/dist/{types.js → wire/types.js} +4 -3
  116. package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
  117. package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
  118. package/dist/{notices.d.ts → words/notices.d.ts} +8 -12
  119. package/dist/{notices.js → words/notices.js} +8 -12
  120. package/package.json +16 -7
  121. package/dist/brand.d.ts +0 -49
  122. package/dist/flow-types.d.ts +0 -1711
  123. package/dist/flow-types.js +0 -247
  124. package/dist/journal.d.ts +0 -122
  125. package/dist/journal.js +0 -57
  126. package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +0 -0
  127. package/dist/{impact-savings.js → artifacts/impact-savings.js} +0 -0
  128. package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
  129. package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
  130. package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
  131. package/dist/{project-id.js → identity/project-id.js} +0 -0
  132. package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
  133. package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
  134. package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
  135. package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
  136. package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
  137. package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
  138. package/dist/{global-press.d.ts → wire/global-press.d.ts} +0 -0
  139. package/dist/{redaction.d.ts → wire/redaction.d.ts} +0 -0
  140. package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
  141. package/dist/{state-select.js → wire/state-select.js} +0 -0
  142. package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
  143. package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
  144. package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
  145. package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
  146. package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
  147. package/dist/{upgrade.d.ts → words/upgrade.d.ts} +2 -2
  148. /package/dist/{upgrade.js → words/upgrade.js} +0 -0
package/dist/tour.js ADDED
@@ -0,0 +1,165 @@
1
+ /**
2
+ * The onboarding tour, once, for both surfaces that show it.
3
+ *
4
+ * The CLI prints it at the end of `reticle setup install`; the browser SDK renders it as a carousel
5
+ * over the user's own running app, beside the HUD. Those are two audiences in two media, and the
6
+ * rule that governs them is the one `tutorial.ts` already stated about its own two audiences: what
7
+ * they MUST share is the order and the claims, because two routes through one product is how a
8
+ * support answer stops matching what anybody actually did.
9
+ *
10
+ * So the steps live here, in the package both ends already depend on, and neither renderer owns
11
+ * them. `@reticlehq/server` cannot be imported by the browser and `@reticlehq/browser` cannot be
12
+ * imported by the server; core is the only place a shared sentence can sit without inventing an
13
+ * edge between them.
14
+ *
15
+ * The sequence is not arbitrary. It ends at a VERDICT because a tour that ends at "you can see the
16
+ * page now" has taught the least valuable half: looking is not verifying, and an agent that learns
17
+ * only to look will report that it looked. And it declares the consequence BEFORE acting, because
18
+ * that ordering IS the idea being taught — naming what should happen first is the difference
19
+ * between a check and a rationalisation written afterwards.
20
+ */
21
+ /**
22
+ * What a slide points at when the tour is drawn over a real page.
23
+ *
24
+ * The HUD is addressable because Reticle put it there, and so is every control inside it. The APP is
25
+ * addressable only as a WHOLE — "here is the thing being snapshotted" — which needs a region, not a
26
+ * control. The line is about authorship rather than size: a tour may ring any control it rendered
27
+ * itself, and may never ring a button in the app, because that would be a guess about unseen markup.
28
+ *
29
+ * It matters that the tour points at the app at least once. The pitch is verifying YOUR RUNNING
30
+ * APP from the inside, and a tour drawn entirely over a dimmed page reads as a modal that happens
31
+ * to sit on top of one.
32
+ */
33
+ export const TourAnchor = {
34
+ /** No target: the slide is prose, centred. */
35
+ NONE: 'none',
36
+ /** Reticle's own in-page HUD. */
37
+ HUD: 'hud',
38
+ /** The app's own content region — `<main>`, else the framework's mount node. */
39
+ APP: 'app',
40
+ /** One control in the HUD's toolbar. Ours, so naming it is not a guess. */
41
+ HUD_CHAT: 'hud-chat',
42
+ HUD_ANNOTATE: 'hud-annotate',
43
+ HUD_IMPACT: 'hud-impact',
44
+ HUD_SETTINGS: 'hud-settings',
45
+ };
46
+ /**
47
+ * The prompts the last slide hands over.
48
+ *
49
+ * A tour that ends with "now go and try it" ends at the point where somebody has to invent the
50
+ * next move themselves, which is where they stop. These are the moves, written out, ready to paste
51
+ * into whichever agent they use.
52
+ *
53
+ * THREE rather than one, and short rather than thorough. The single prompt this replaced was a
54
+ * paragraph that named a verdict as the finish line — correct, and not a sentence anybody types
55
+ * twice. What people actually send an agent is one line, so a handoff written in a register they
56
+ * will never reuse teaches the register as much as the task. Each of these is a line somebody
57
+ * would plausibly type on their own the second time, which is the only version of this slide that
58
+ * survives contact with the week after the install.
59
+ *
60
+ * Every one of them names something the product does: driving one flow to a verdict, the `/reticle`
61
+ * command `init` writes into the project, and the autonomous crawl. The flows they name — login,
62
+ * checkout — are examples of the SHAPE, since this tour runs over an unknown app; the
63
+ * capability behind each is real, which is the part a tour must not get wrong.
64
+ */
65
+ export const TOUR_HANDOFF_PROMPTS = [
66
+ {
67
+ label: 'Verify one flow',
68
+ text: 'verify the login flow with Reticle, and tell me the verdict',
69
+ },
70
+ {
71
+ label: 'Check what is proved',
72
+ text: '/reticle',
73
+ },
74
+ {
75
+ label: 'Let it loose',
76
+ text: 'monkey-test the checkout flow with Reticle and tell me what breaks',
77
+ },
78
+ ];
79
+ export const TOUR_STEPS = [
80
+ {
81
+ id: 'connect',
82
+ title: 'Yayyy! It is connected',
83
+ // The ring points at the HUD, so the prose has to make the HUD the evidence: it is mounted only
84
+ // on a connected session and never appears without one. Naming the call's output as the proof
85
+ // instead sends a reader to the panel for a claim the panel does not make.
86
+ say: 'That panel is Reticle. Seeing it is your proof the SDK is connected to your app.',
87
+ why: 'It only mounts on a connected session, so it cannot show up without one. Having the tools is not the same as being set up.',
88
+ // The merged surface has no `reticle_sessions`. It answers -32602 and names the replacement, so
89
+ // a reader who pasted the old name lost a round trip to a tour that was teaching a dead call.
90
+ call: 'reticle_session { action: "list" }',
91
+ anchor: TourAnchor.HUD,
92
+ },
93
+ {
94
+ id: 'look',
95
+ title: 'Look, without pixels',
96
+ say: 'Take a semantic snapshot. You get the controls and their refs, not pixels, so you can point at things by name.',
97
+ why: 'A ref is stable across snapshots, which is what lets you plan several steps before spending any of them.',
98
+ // Likewise merged: `reticle_snapshot` is now `reticle_look { action: "page" }`.
99
+ call: 'reticle_look { action: "page" }',
100
+ // The one slide that points at the app itself, and the only one where that is the subject: a
101
+ // snapshot is OF this region. Without it the tour never once directs attention at the thing it
102
+ // spends five slides talking about.
103
+ anchor: TourAnchor.APP,
104
+ },
105
+ {
106
+ id: 'declare',
107
+ title: 'Say it first',
108
+ say: 'Decide what should happen BEFORE you touch anything. "Clicking Pay makes the receipt appear" is a claim that can be wrong.',
109
+ why: 'This is the whole idea. A consequence named first is a check; the same sentence written after the fact is a rationalisation, and it is the difference between a verdict and a story.',
110
+ // Every other slide's block is something you can run; this one was a comment — a placeholder on
111
+ // the most important screen in the tour. It now shows the distinction it is teaching, because
112
+ // "name the consequence" means nothing until you see one next to a wait that proves nothing.
113
+ call: 'until: { signal: "order:placed" } // a consequence — not until: { ms: 500 }',
114
+ anchor: TourAnchor.NONE,
115
+ },
116
+ {
117
+ id: 'verdict',
118
+ title: 'Act, and prove it',
119
+ say: 'Act and prove in one call. The answer says verified yes / no / unknown, and `because` names the evidence that decided it.',
120
+ why: 'Only `reticle_act_and_wait` and `reticle_assert` produce a verdict. A drive that ends without one has no result, however many tools it used — and "unknown" is an honest answer, not a pass.',
121
+ call: 'reticle_act_and_wait { ref, action: "click", until: { signal: "order:placed" } }',
122
+ anchor: TourAnchor.HUD,
123
+ },
124
+ ];
125
+ /**
126
+ * The HUD's own controls, one card each, in the order somebody meets them.
127
+ *
128
+ * Browser-only. The CLI renders the shared steps into a terminal, where "click the Impact button" is
129
+ * an instruction nobody can follow, so a card about a control in a panel cannot sit in the list both
130
+ * surfaces print. The same reasoning already keeps the handoff out of `TOUR_STEPS`.
131
+ *
132
+ * They carry no `why`. A terminal step needs one because it has nothing beside it; these have a ring
133
+ * on the button they describe and an invitation to press it, and a second paragraph explaining a
134
+ * button somebody is about to click is the kind of text people stop reading tours over.
135
+ */
136
+ export const TOUR_HUD_STEPS = [
137
+ {
138
+ id: 'hud-chat',
139
+ title: 'Activity Panel',
140
+ say: 'Watch what your agent is doing in your app, as it happens.',
141
+ anchor: TourAnchor.HUD_CHAT,
142
+ tryIt: 'Open it.',
143
+ },
144
+ {
145
+ id: 'hud-annotate',
146
+ title: 'Annotate',
147
+ say: 'Click anywhere in your app to drop a numbered pin with a note. Hand the pins to your agent and it fixes them.',
148
+ anchor: TourAnchor.HUD_ANNOTATE,
149
+ tryIt: 'Turn it on, then click something in your app.',
150
+ },
151
+ {
152
+ id: 'hud-impact',
153
+ title: "What's the impact?",
154
+ say: 'Everything Reticle has done here. Every bug it caught, every metric.',
155
+ anchor: TourAnchor.HUD_IMPACT,
156
+ tryIt: 'Take a look.',
157
+ },
158
+ {
159
+ id: 'hud-settings',
160
+ title: 'Make it yours',
161
+ say: 'Change how Reticle looks and behaves.',
162
+ anchor: TourAnchor.HUD_SETTINGS,
163
+ tryIt: 'Open it.',
164
+ },
165
+ ];
@@ -1,11 +1,12 @@
1
- import type { FlowExpect } from './flow-types.js';
2
1
  /**
3
- * The product thesis, in one place: a verification "kind" is either a CONSEQUENCE (the app provably
4
- * did something a locator healed to the WRONG element, or a stale render, cannot fake) or a mere
5
- * PRESENCE check (which such a wrong locator CAN still satisfy). This classification is the moat —
6
- * it decides when "green" actually means the feature worked. It was implemented three times over
7
- * (flow classification, ad-hoc assert grading, flow-success compilation); keeping the vocabulary here
8
- * means a contributor can never strengthen one grader and silently leave the others weaker.
2
+ * A verification "kind" is either a CONSEQUENCE — the app provably did something that a locator
3
+ * healed to the WRONG element, or a stale render, cannot fake — or a mere PRESENCE check, which such
4
+ * a wrong locator CAN still satisfy. The classification decides when "green" actually means the
5
+ * feature worked.
6
+ *
7
+ * The vocabulary lives here because three separate graders depend on it (flow classification, ad-hoc
8
+ * assert grading, flow-success compilation), and a contributor must not be able to strengthen one and
9
+ * silently leave the others weaker.
9
10
  */
10
11
  /** Kinds whose satisfaction proves an observable outcome — a wrong/healed element cannot fake them. */
11
12
  export declare const ConsequenceKind: {
@@ -47,18 +48,34 @@ export declare const PredicateKind: {
47
48
  readonly NOT: "not";
48
49
  };
49
50
  export type PredicateKind = (typeof PredicateKind)[keyof typeof PredicateKind];
51
+ export declare const CONSEQUENCE_KINDS: ReadonlySet<string>;
50
52
  /** True when `kind` (a predicate/expect kind) asserts a consequence (signal/net/state). */
51
53
  export declare function isConsequenceKind(kind: string): boolean;
52
54
  /** True when `kind` is a weak presence check (element/text). */
53
55
  export declare function isPresenceKind(kind: string): boolean;
54
- /** True when a FlowExpect asserts at least one consequence (any of the ConsequenceKind fields set). */
55
- export declare function flowExpectHasConsequence(expect: FlowExpect | undefined): boolean;
56
56
  /**
57
- * True when a FlowExpect checks ONLY presence — an element or rendered text, no consequence field.
57
+ * One thing an app can be shown to have done, named in a way both sides agree on.
58
+ *
59
+ * Two separate parts of Reticle need this exact shape. The rules that decide a verdict produce it
60
+ * when they read a declared consequence; the part that explains a red verdict walks it, step by
61
+ * step, to say which link in the chain broke. Neither one owns it, so it lives here with the rest of
62
+ * the shared vocabulary, and neither has to reach into the other to say the same thing.
58
63
  *
59
- * `text` counts here for the same reason `element` does, and leaving it out would have been the
60
- * expensive kind of omission: a text-only expect would have been neither a consequence nor
61
- * presence-only, so it would have fallen through to `assertion-free` — a permanent green wearing
62
- * an assertion (#811).
64
+ * It is exactly `ConsequenceKind` spelled out, so the two can never drift apart.
65
+ *
66
+ * Examples:
67
+ * { kind: ConsequenceKind.SIGNAL, name: 'cart:updated' }
68
+ * { kind: ConsequenceKind.NET, urlContains: '/api/save', status: 200 }
69
+ * { kind: ConsequenceKind.STATE, name: 'cart.items' }
63
70
  */
64
- export declare function flowExpectIsPresenceOnly(expect: FlowExpect | undefined): boolean;
71
+ export type ExpectedLink = {
72
+ kind: typeof ConsequenceKind.SIGNAL;
73
+ name: string;
74
+ } | {
75
+ kind: typeof ConsequenceKind.NET;
76
+ urlContains: string;
77
+ status?: number;
78
+ } | {
79
+ kind: typeof ConsequenceKind.STATE;
80
+ name: string;
81
+ };
@@ -1,10 +1,12 @@
1
1
  /**
2
- * The product thesis, in one place: a verification "kind" is either a CONSEQUENCE (the app provably
3
- * did something a locator healed to the WRONG element, or a stale render, cannot fake) or a mere
4
- * PRESENCE check (which such a wrong locator CAN still satisfy). This classification is the moat —
5
- * it decides when "green" actually means the feature worked. It was implemented three times over
6
- * (flow classification, ad-hoc assert grading, flow-success compilation); keeping the vocabulary here
7
- * means a contributor can never strengthen one grader and silently leave the others weaker.
2
+ * A verification "kind" is either a CONSEQUENCE — the app provably did something that a locator
3
+ * healed to the WRONG element, or a stale render, cannot fake — or a mere PRESENCE check, which such
4
+ * a wrong locator CAN still satisfy. The classification decides when "green" actually means the
5
+ * feature worked.
6
+ *
7
+ * The vocabulary lives here because three separate graders depend on it (flow classification, ad-hoc
8
+ * assert grading, flow-success compilation), and a contributor must not be able to strengthen one and
9
+ * silently leave the others weaker.
8
10
  */
9
11
  /** Kinds whose satisfaction proves an observable outcome — a wrong/healed element cannot fake them. */
10
12
  export const ConsequenceKind = {
@@ -43,7 +45,7 @@ export const PredicateKind = {
43
45
  ANY_OF: 'anyOf',
44
46
  NOT: 'not',
45
47
  };
46
- const CONSEQUENCE_KINDS = new Set(Object.values(ConsequenceKind));
48
+ export const CONSEQUENCE_KINDS = new Set(Object.values(ConsequenceKind));
47
49
  const PRESENCE_KINDS = new Set(Object.values(PresenceKind));
48
50
  /** True when `kind` (a predicate/expect kind) asserts a consequence (signal/net/state). */
49
51
  export function isConsequenceKind(kind) {
@@ -53,27 +55,3 @@ export function isConsequenceKind(kind) {
53
55
  export function isPresenceKind(kind) {
54
56
  return PRESENCE_KINDS.has(kind);
55
57
  }
56
- /** True when a FlowExpect asserts at least one consequence (any of the ConsequenceKind fields set). */
57
- export function flowExpectHasConsequence(expect) {
58
- if (expect === undefined)
59
- return false;
60
- const fields = expect;
61
- for (const kind of CONSEQUENCE_KINDS) {
62
- if (fields[kind] !== undefined)
63
- return true;
64
- }
65
- return false;
66
- }
67
- /**
68
- * True when a FlowExpect checks ONLY presence — an element or rendered text, no consequence field.
69
- *
70
- * `text` counts here for the same reason `element` does, and leaving it out would have been the
71
- * expensive kind of omission: a text-only expect would have been neither a consequence nor
72
- * presence-only, so it would have fallen through to `assertion-free` — a permanent green wearing
73
- * an assertion (#811).
74
- */
75
- export function flowExpectIsPresenceOnly(expect) {
76
- if (expect === undefined || flowExpectHasConsequence(expect))
77
- return false;
78
- return expect.element !== undefined || expect.text !== undefined;
79
- }
@@ -5,7 +5,7 @@
5
5
  * The hash travels in `bug_found`; the inputs (route, selector) never do. Same pattern as
6
6
  * `projectId`: hash the identifying bits, send only the hash, let the analytics side group by it.
7
7
  */
8
- import { fnv1a } from './contract-fingerprint.js';
8
+ import { fnv1a } from '../identity/contract-fingerprint.js';
9
9
  /**
10
10
  * Produce a short hex fingerprint that identifies a finding stably across sessions.
11
11
  *
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * What a verification can FIND — the vocabulary of faults and contradictions shared by the crawl,
3
- * the contradiction hunter and the tools that report them. Split out of constants.ts to keep that
4
- * file under the size cap.
3
+ * the contradiction hunter and the tools that report them.
5
4
  */
5
+ import { ChannelId } from '../wire/channel.js';
6
6
  /**
7
7
  * Cross-channel contradictions: two observation channels making INCOMPATIBLE claims about the same
8
8
  * action. This is the bug class a human structurally cannot see, because a human has one channel
@@ -13,6 +13,27 @@
13
13
  * and the app is wrong. Contrast `CrawlAnomalyKind`, whose members are all SINGLE-channel facts (an
14
14
  * error was logged; a request failed) — those are findable by reading one stream.
15
15
  */
16
+ /**
17
+ * Two channels disagreeing about the same action — the shape every rule reports.
18
+ *
19
+ * Lives here, beside the kinds, because it is part of the artifact contract: a replayed step and a
20
+ * driven one both carry these, and a shape declared twice is a shape that drifts.
21
+ *
22
+ * `kind` is typed `string`, not `ContradictionKind`, because the vocabulary is open at the EDGE. The
23
+ * enum below enumerates what the engine's own rules emit and every one of those is still checked
24
+ * against it; a rule registered by a consumer emits kinds this package has never heard of and must
25
+ * not have to be added here to be reportable. A shared closed enum is exactly how a consumer's
26
+ * private vocabulary ends up shipped in the free product by accident.
27
+ */
28
+ export interface Contradiction {
29
+ kind: string;
30
+ /** What one channel asserted — the optimistic half. */
31
+ claim: string;
32
+ /** What the other channel asserted — the half that contradicts it. */
33
+ counter: string;
34
+ /** Concrete evidence, so the agent can go straight to the call or the control. */
35
+ detail: string;
36
+ }
16
37
  export declare const ContradictionKind: {
17
38
  /** The screen moved forward while a request in the same window failed — the swallowed rejection. */
18
39
  readonly UI_ADVANCED_REQUEST_FAILED: "ui-advanced-request-failed";
@@ -29,7 +50,7 @@ export declare const ContradictionKind: {
29
50
  * "dispatched but the app did NOTHING (no DOM/net/route/signal)", so firing a signal was enough to
30
51
  * rescue a control that did nothing at all. That is the hole. An app whose signal is emitted from
31
52
  * the value it was ASKED for rather than the one it COMMITTED gets a verdict at signal grade —
32
- * the strongest we award — for a click that changed nothing. Measured on the bench fixture: a
53
+ * the strongest grade there is — for a click that changed nothing. On the bench fixture: a
33
54
  * modal that never opened came back `verified: "yes" / proved`.
34
55
  *
35
56
  * Absence-derived on purpose (see below). "Nothing corroborated it" is not "it did not happen":
@@ -37,6 +58,20 @@ export declare const ContradictionKind: {
37
58
  * so the false green cannot stand, without asserting a fault nobody proved.
38
59
  */
39
60
  readonly SIGNAL_WITHOUT_CONSEQUENCE: "signal-without-consequence";
61
+ /**
62
+ * The store committed and the screen never moved.
63
+ *
64
+ * `response-ignored` covers *a write succeeded and nothing moved*; `action-had-no-effect` covers
65
+ * *the click did nothing at all*. Neither covers the commonest render defect there is: state
66
+ * commits and the component that should have re-rendered does not — a memo with a stale
67
+ * comparator, a key that never changes, a selector reading the wrong slice. The app is internally
68
+ * consistent and the user is looking at the old value.
69
+ *
70
+ * Absence-derived, for the same reason as the entry above: a store holds plenty that was never
71
+ * meant to paint — an analytics flag, a timer, a cached token — so "nothing rendered" is not proof
72
+ * of a fault. It removes the false green and never invents a NO.
73
+ */
74
+ readonly STATE_VS_RENDER: "state-vs-render";
40
75
  /**
41
76
  * A write succeeded on the server and nothing moved in THIS document — because the page opened
42
77
  * another browsing context (an OAuth popup is the archetype) and the consequence lives there,
@@ -96,7 +131,7 @@ export declare const ContradictionKind: {
96
131
  * PATCH honouring a subset, an enum falling back to a default. The status is 2xx, the body reports
97
132
  * no failure, the UI advanced, the page settled — so every channel except the payload agrees the
98
133
  * save worked, and the screen goes on showing the value the user typed rather than the value that
99
- * was stored. Measured on a preferences write that asked for `locale: fr` and echoed `locale: en`.
134
+ * was stored — a write asking for `locale: fr` and echoing `locale: en`.
100
135
  */
101
136
  readonly WRITE_FIELD_IGNORED: "write-field-ignored";
102
137
  /** The UI advanced while a request was still in flight, so `settled` was reported over a live call. */
@@ -115,9 +150,8 @@ export declare const ContradictionKind: {
115
150
  * `dispatched: true, settled: true`, and every observation channel reports an empty window. The
116
151
  * settle half is the trap — a page that does nothing is quiet, and quiet is exactly what `settled`
117
152
  * tests for, so `until: { kind: 'settled' }` PASSES on a dead click and the verdict read
118
- * `verified: "yes", because: "no channel disagreeing"`. Measured on a real merchant dashboard by
119
- * clicking a `styled.div` that `reticle_query { by: 'text' }` had resolved instead of the button
120
- * beside it: zero events, store unchanged, green verdict.
153
+ * `verified: "yes", because: "no channel disagreeing"`. The shape that produces it: a `by: 'text'`
154
+ * query resolves a `styled.div` instead of the button beside it, and the click lands on nothing.
121
155
  */
122
156
  readonly ACTION_HAD_NO_EFFECT: "action-had-no-effect";
123
157
  /**
@@ -125,22 +159,18 @@ export declare const ContradictionKind: {
125
159
  * The URL says you arrived somewhere; the page is blank.
126
160
  *
127
161
  * This is the class every "did the control work" heuristic misses, because the control DID work:
128
- * it navigated. Measured on a real merchant dashboard with nine such links (Invoices, Route,
129
- * Subscriptions, QR Codes, Customers…), `reticle_crawl` drove all nine and reported
130
- * `deadControls: 0` — correctly, by its own definition, since a route change is activity.
162
+ * it navigated. A crawler counting dead controls reports none, correctly by its own definition,
163
+ * since a route change IS activity.
131
164
  *
132
- * The discriminator came from executing both cases and comparing, not from reasoning: a working
133
- * nav emitted `domAdded: 1, network: 2`; a blank one emitted `domAdded: 0, domRemoved: 0,
134
- * network: 0` and left the page at an eighth the size. A real transition either fetches something
135
- * or renders something.
165
+ * The discriminator: a working nav emits `domAdded: 1, network: 2`; a blank one emits
166
+ * `domAdded: 0, domRemoved: 0, network: 0`. A real transition either fetches something or renders
167
+ * something.
136
168
  *
137
- * MEASURED PRECISION, and the limit is real: 11 findings on that dashboard, 10 of them genuinely
138
- * blank destinations (verified by reading the DOM directly, not by asking Reticle), 1 false
139
- * positive. The false positive is instructive rather than fixable by tuning — a route whose view
140
- * is REVEALED from DOM that already existed emits `route.change` + `dom.attr` and nothing else,
141
- * which is byte-for-byte the window a blank destination emits. No event-only rule separates them.
142
- * Over-warning is the safe direction here (a false alarm costs a glance; a blank page shipped as
143
- * working does not), so it is reported with that ceiling stated rather than tuned into silence.
169
+ * THE LIMIT IS REAL, and is not fixable by tuning: a route whose view is REVEALED from DOM that
170
+ * already existed emits `route.change` + `dom.attr` and nothing else, which is byte-for-byte the
171
+ * window a blank destination emits. No event-only rule separates them. Over-warning is the safe
172
+ * direction (a false alarm costs a glance; a blank page shipped as working does not), so this is
173
+ * reported with the ceiling stated rather than tuned into silence.
144
174
  */
145
175
  readonly ROUTE_RENDERED_NOTHING: "route-rendered-nothing";
146
176
  /**
@@ -207,26 +237,22 @@ export type ContradictionKind = (typeof ContradictionKind)[keyof typeof Contradi
207
237
  /**
208
238
  * Contradictions inferred from the ABSENCE of evidence in a window whose end Reticle itself chose.
209
239
  *
210
- * The distinction is not cosmetic — it decides whether Reticle is entitled to say an action FAILED.
211
- * The other kinds are things we positively observed: a request came back 500 while the UI advanced,
212
- * a signal fired carrying data that disagrees with the DOM, a written field echoed a different
213
- * value. Those are evidence AGAINST the action, and they must keep outranking a passing assertion,
214
- * because a green assertion sitting on top of a failed write is the entire bug class this product
215
- * exists to catch.
240
+ * The distinction decides whether Reticle is entitled to say an action FAILED. The other kinds are
241
+ * POSITIVELY observed — a request came back 500 while the UI advanced, a signal fired carrying data
242
+ * that disagrees with the DOM, a written field echoed a different value — and they must keep
243
+ * outranking a passing assertion, because a green assertion on top of a failed write is the bug
244
+ * class this product exists to catch.
216
245
  *
217
- * These five are different. Each says "the thing I expected to see had not happened YET when I
218
- * stopped looking" — and the window closes the moment the predicate first passes, which on an app
219
- * that navigates optimistically is routinely before the network drains. Reproduced on the bench app:
220
- * `auth:granted` fired WITH matching data, application state changed, the token was stored, capture
221
- * integrity was clean and the honesty grade was `signal` — our strongest evidence class — and the
222
- * verdict was still `no`, because one POST had not settled. A timing observation overruled a
223
- * consequence observation, which inverts the grade hierarchy the verifier is built on.
246
+ * These five say only "the thing I expected had not happened YET when I stopped looking", and the
247
+ * window closes the moment the predicate first passes — on an app that navigates optimistically,
248
+ * routinely before the network drains. Letting one assert NO makes a timing observation overrule a
249
+ * consequence observation, which inverts the grade hierarchy the verifier is built on: the bench app
250
+ * produces a `no` over a fired signal with matching data, changed state, a stored token and a clean
251
+ * capture, because one POST had not settled.
224
252
  *
225
253
  * A false negative is not the mirror of a false positive here. A false positive stops an agent
226
254
  * early; a false NEGATIVE makes it redo work that already succeeded, or stop trusting the verdict
227
- * channel — and the verdict channel is the product. `bug.attribution` was deleted for exactly this
228
- * reason: every `attribution: 'app'` on `request-never-settled` turned out to be a misattribution.
229
- * We removed the field and left the verdict.
255
+ * channel — and the verdict channel is the product.
230
256
  *
231
257
  * So these downgrade a verdict to UNKNOWN rather than asserting NO. The finding is still reported in
232
258
  * `contradictions` either way — nothing is hidden, and an agent that wants to wait and re-check has
@@ -273,13 +299,14 @@ export declare const FindingTier: {
273
299
  readonly OBSERVED: "observed";
274
300
  /**
275
301
  * Inferred from something NOT having happened yet, in a window whose end Reticle chose. It may
276
- * become true a moment later. It is a statement about our timing at least as much as about the app.
302
+ * become true a moment later. It is a statement about the window's timing at least as much as
303
+ * about the app.
277
304
  */
278
305
  readonly ABSENCE_DERIVED: "absence-derived";
279
306
  /**
280
307
  * True, reported, and not about the question asked. Traffic the assertion never named.
281
308
  *
282
- * Distinct from ABSENCE_DERIVED, which IS about the declared consequence and says our timing was
309
+ * Distinct from ABSENCE_DERIVED, which IS about the declared consequence and says the timing was
283
310
  * inconclusive about it. This one is about something else entirely, so downgrading on it answers a
284
311
  * question nobody put.
285
312
  */
@@ -306,6 +333,26 @@ export declare function tierOfFinding(kind: string): FindingTier;
306
333
  * write. Narrowing to writes is what keeps the rules from crying wolf on ordinary reads.
307
334
  */
308
335
  export declare const MUTATING_METHODS: readonly string[];
336
+ /**
337
+ * Which two channels each contradiction sets against each other.
338
+ *
339
+ * `Record<ContradictionKind, ...>` on purpose: a new kind does not compile until somebody says what
340
+ * it compares. That is the point -- the independence rule is only checkable if the pairing is
341
+ * written down, and until now it was carried in the head of whoever added the rule.
342
+ *
343
+ * The pairing is causal, not observational: it names where each side of the disagreement was
344
+ * PRODUCED. A screenshot is `ui` even though it is taken out of process, because the pixels came
345
+ * from the render the action caused.
346
+ */
347
+ export declare const CONTRADICTION_CHANNELS: Record<ContradictionKind, readonly [ChannelId, ChannelId]>;
348
+ /**
349
+ * May this kind of disagreement be reported as a fault in the app?
350
+ *
351
+ * False when both sides come from the app's own actuation path. Such a disagreement is real and
352
+ * worth reporting -- the app contradicted itself -- but it is not evidence that the action failed,
353
+ * and treating it as such is how a verdict channel earns a reputation for crying wolf.
354
+ */
355
+ export declare function contradictionCanConvict(kind: ContradictionKind): boolean;
309
356
  export declare const CrawlAnomalyKind: {
310
357
  readonly CONSOLE_ERROR: "console-error";
311
358
  readonly FAILED_REQUEST: "failed-request";