@reticlehq/core 2.13.1 → 3.1.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 (147) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +20 -0
  2. package/dist/artifacts/artifacts-entry.js +20 -0
  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} +97 -3
  6. package/dist/{flow-constants.js → artifacts/flow-constants.js} +103 -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-savings.d.ts → artifacts/impact-savings.d.ts} +7 -3
  20. package/dist/{impact-savings.js → artifacts/impact-savings.js} +27 -4
  21. package/dist/{impact.d.ts → artifacts/impact.d.ts} +122 -54
  22. package/dist/{impact.js → artifacts/impact.js} +30 -0
  23. package/dist/{journal.d.ts → artifacts/journal.d.ts} +50 -6
  24. package/dist/{journal.js → artifacts/journal.js} +38 -2
  25. package/dist/artifacts/step-effect.d.ts +29 -0
  26. package/dist/artifacts/step-effect.js +28 -0
  27. package/dist/hooks/hook-events.d.ts +311 -0
  28. package/dist/hooks/hook-events.js +127 -0
  29. package/dist/hooks/hooks-entry.d.ts +9 -0
  30. package/dist/hooks/hooks-entry.js +9 -0
  31. package/dist/{brand.d.ts → identity/brand.d.ts} +7 -0
  32. package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
  33. package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
  34. package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
  35. package/dist/{document-identity.js → identity/document-identity.js} +4 -5
  36. package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
  37. package/dist/{source-constants.js → identity/source-constants.js} +4 -4
  38. package/dist/index.d.ts +69 -42
  39. package/dist/index.js +78 -44
  40. package/dist/onboarding.d.ts +114 -0
  41. package/dist/onboarding.js +141 -0
  42. package/dist/realm/registry.d.ts +212 -0
  43. package/dist/realm/registry.js +302 -0
  44. package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +4 -5
  45. package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
  46. package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
  47. package/dist/{project-registry.js → registry/project-registry.js} +5 -5
  48. package/dist/schema/command-name.json +31 -0
  49. package/dist/schema/event-message.json +1 -0
  50. package/dist/schema/event-payloads.json +791 -0
  51. package/dist/schema/event-type.json +1 -0
  52. package/dist/schema/hello-message.json +76 -2
  53. package/dist/schema/reticle-event.json +1 -0
  54. package/dist/schema/reticle-message.json +77 -2
  55. package/dist/telemetry-entry.d.ts +15 -0
  56. package/dist/telemetry-entry.js +15 -0
  57. package/dist/telemetry-feedback.d.ts +13 -14
  58. package/dist/telemetry-feedback.js +11 -12
  59. package/dist/telemetry-license.d.ts +1 -1
  60. package/dist/telemetry-license.js +1 -1
  61. package/dist/telemetry-refusal.d.ts +11 -11
  62. package/dist/telemetry-refusal.js +7 -8
  63. package/dist/telemetry-session.d.ts +49 -57
  64. package/dist/telemetry-session.js +47 -55
  65. package/dist/telemetry.d.ts +229 -198
  66. package/dist/telemetry.js +83 -98
  67. package/dist/tour-entry.d.ts +10 -0
  68. package/dist/tour-entry.js +10 -0
  69. package/dist/tour.d.ts +125 -0
  70. package/dist/tour.js +165 -0
  71. package/dist/{consequence.d.ts → verdict/consequence.d.ts} +35 -11
  72. package/dist/{consequence.js → verdict/consequence.js} +9 -22
  73. package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
  74. package/dist/{findings.d.ts → verdict/findings.d.ts} +149 -41
  75. package/dist/{findings.js → verdict/findings.js} +169 -48
  76. package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +22 -14
  77. package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +23 -15
  78. package/dist/{intent.d.ts → verdict/intent.d.ts} +41 -52
  79. package/dist/{intent.js → verdict/intent.js} +11 -22
  80. package/dist/verdict/revision.d.ts +44 -0
  81. package/dist/verdict/revision.js +53 -0
  82. package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
  83. package/dist/{run-context.js → verdict/run-context.js} +15 -36
  84. package/dist/{security.js → verdict/security.js} +12 -21
  85. package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +369 -93
  86. package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
  87. package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +36 -13
  88. package/dist/{verified-constants.js → verdict/verified-constants.js} +36 -13
  89. package/dist/verdict/verify-progress.d.ts +129 -0
  90. package/dist/verdict/verify-progress.js +74 -0
  91. package/dist/wire/channel.d.ts +46 -0
  92. package/dist/wire/channel.js +95 -0
  93. package/dist/{constants.d.ts → wire/constants/constants.d.ts} +124 -28
  94. package/dist/{constants.js → wire/constants/constants.js} +137 -28
  95. package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +9 -2
  96. package/dist/{session-constants.js → wire/constants/session-constants.js} +9 -2
  97. package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
  98. package/dist/{event-classification.js → wire/event-classification.js} +1 -1
  99. package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +229 -17
  100. package/dist/{event-payloads.js → wire/event-payloads.js} +61 -3
  101. package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
  102. package/dist/{event-priority.js → wire/event-priority.js} +2 -5
  103. package/dist/wire/global-press.d.ts +30 -0
  104. package/dist/wire/global-press.js +54 -0
  105. package/dist/{messages.d.ts → wire/messages.d.ts} +290 -38
  106. package/dist/{messages.js → wire/messages.js} +93 -5
  107. package/dist/wire/narrow.d.ts +39 -0
  108. package/dist/wire/narrow.js +45 -0
  109. package/dist/{net.d.ts → wire/net.d.ts} +49 -10
  110. package/dist/{net.js → wire/net.js} +49 -10
  111. package/dist/wire/platform.d.ts +37 -0
  112. package/dist/wire/platform.js +36 -0
  113. package/dist/{redaction.d.ts → wire/redaction.d.ts} +30 -0
  114. package/dist/wire/redaction.js +274 -0
  115. package/dist/wire/tool-names.d.ts +133 -0
  116. package/dist/wire/tool-names.js +142 -0
  117. package/dist/{toon.js → wire/toon.js} +1 -1
  118. package/dist/{types.d.ts → wire/types.d.ts} +106 -66
  119. package/dist/{types.js → wire/types.js} +24 -4
  120. package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
  121. package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
  122. package/dist/{notices.d.ts → words/notices.d.ts} +24 -12
  123. package/dist/{notices.js → words/notices.js} +27 -12
  124. package/package.json +22 -5
  125. package/dist/flow-types.d.ts +0 -1473
  126. package/dist/flow-types.js +0 -195
  127. package/dist/redaction.js +0 -149
  128. /package/dist/{brand.js → identity/brand.js} +0 -0
  129. /package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
  130. /package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
  131. /package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
  132. /package/dist/{project-id.js → identity/project-id.js} +0 -0
  133. /package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
  134. /package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
  135. /package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
  136. /package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
  137. /package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
  138. /package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
  139. /package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
  140. /package/dist/{state-select.js → wire/state-select.js} +0 -0
  141. /package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
  142. /package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
  143. /package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
  144. /package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
  145. /package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
  146. /package/dist/{upgrade.d.ts → words/upgrade.d.ts} +0 -0
  147. /package/dist/{upgrade.js → words/upgrade.js} +0 -0
@@ -1,9 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { EventAttribution, EventType, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS, } from './constants.js';
3
- import { HumanControlKind, MarkAnchorStrategy } from './session-constants.js';
2
+ import { EventAttribution, EventType, RETICLE_MIN_PROTOCOL_VERSION, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS, } from './constants/constants.js';
3
+ import { HumanControlKind, MarkAnchorStrategy } from './constants/session-constants.js';
4
4
  import { MAX_WIRE_REDACT_KEYS, MAX_WIRE_REDACT_KEY_LENGTH } from './redaction.js';
5
- import { DOCUMENT_ID_LENGTH } from './document-identity.js';
6
- import { NO_EDITS_OBSERVED } from './edit-epoch.js';
5
+ import { DOCUMENT_ID_LENGTH } from '../identity/document-identity.js';
6
+ import { NO_EDITS_OBSERVED } from '../identity/edit-epoch.js';
7
+ import { PlatformProfile } from './platform.js';
8
+ import { ChannelId } from './channel.js';
7
9
  const sessionIdSchema = z.string().min(1).max(TRANSPORT_LIMITS.MAX_SESSION_ID_LENGTH);
8
10
  const refSchema = z.string().max(TRANSPORT_LIMITS.MAX_REF_LENGTH);
9
11
  const documentIdSchema = z.string().min(1).max(DOCUMENT_ID_LENGTH);
@@ -88,7 +90,16 @@ export const ReticleEventSchema = z.object({
88
90
  /** Browser announces itself to the bridge on connect. */
89
91
  export const HelloMessageSchema = z.object({
90
92
  kind: z.literal(MessageKind.HELLO),
91
- protocolVersion: z.literal(RETICLE_PROTOCOL_VERSION),
93
+ /**
94
+ * The wire protocol this peer speaks.
95
+ *
96
+ * A RANGE, not a fixed number. An exact match is right while both halves ship together and wrong
97
+ * as soon as anything else implements this: a peer one version behind is not incompatible, it is
98
+ * behind. The bridge accepts anything from the oldest version it still talks to up to its own.
99
+ *
100
+ * Out of range is still a hard door, with the diagnostics that already name which side is stale.
101
+ */
102
+ protocolVersion: z.number().int().min(RETICLE_MIN_PROTOCOL_VERSION).max(RETICLE_PROTOCOL_VERSION),
92
103
  sessionId: sessionIdSchema,
93
104
  url: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH),
94
105
  title: z.string().max(TRANSPORT_LIMITS.MAX_TITLE_LENGTH),
@@ -104,8 +115,85 @@ export const HelloMessageSchema = z.object({
104
115
  .max(TRANSPORT_LIMITS.MAX_ADAPTERS),
105
116
  /** Optional browser/bridge pairing token. Required when the bridge configures one. */
106
117
  token: z.string().max(TRANSPORT_LIMITS.MAX_TOKEN_LENGTH).optional(),
118
+ /**
119
+ * What kind of surface this is: a browser document, a web page in somebody else's window, a
120
+ * native view tree, or no rendering surface at all. See platform.ts.
121
+ *
122
+ * ABSENT MEANS `web`, never "unknown". Everything that connected before this field existed was a
123
+ * browser document, so absence is not a gap -- it is the answer those connections would have
124
+ * given. This is the same convention five other fields on this message already use.
125
+ *
126
+ * It is deliberately not the shell name. Electron and Tauri are two shells and one surface, and
127
+ * verification wants the surface: the question being asked is what can be demanded of you, not
128
+ * which product you are.
129
+ */
130
+ platform: z.nativeEnum(PlatformProfile).optional(),
131
+ /**
132
+ * The channels this build can actually observe. See channel.ts.
133
+ *
134
+ * ABSENT MEANS "everything", not "nothing" -- an SDK built before this field existed watched
135
+ * whatever it watched, and reading its silence as "observes nothing" would refuse every claim it
136
+ * makes. Same convention as every other optional field on this message.
137
+ *
138
+ * A closed list rather than free strings, because the rule that refuses a claim reading an
139
+ * undeclared channel has to switch on these. Commands below are free strings for the opposite
140
+ * reason: nothing switches on them, and command names are already opaque on this wire.
141
+ */
142
+ channels: z.array(z.nativeEnum(ChannelId)).max(TRANSPORT_LIMITS.MAX_ADAPTERS).optional(),
143
+ /**
144
+ * The commands this build can serve.
145
+ *
146
+ * Absent means "assume the usual set". Present and missing a name means asking for it is a
147
+ * mistake somebody can be told about before they spend an action on it, rather than after.
148
+ */
149
+ commands: z
150
+ .array(z.string().max(TRANSPORT_LIMITS.MAX_TOKEN_LENGTH))
151
+ .max(TRANSPORT_LIMITS.MAX_ADAPTERS)
152
+ .optional(),
153
+ /**
154
+ * The wire names this peer actually speaks, so compatibility can be judged name by name.
155
+ *
156
+ * The fingerprint beside it is a hash over the whole vocabulary: it can say "same" or "different"
157
+ * and nothing else. An implementation that speaks part of the contract -- which is the right thing
158
+ * for anything that is not a browser to do -- can never produce a matching hash, and was therefore
159
+ * reported as skewed on every call forever.
160
+ *
161
+ * Absent means "compare the fingerprint", which is what a build predating this field does.
162
+ */
163
+ contractParts: z
164
+ .object({
165
+ commands: z.array(z.string()).max(TRANSPORT_LIMITS.MAX_CONTRACT_NAMES),
166
+ events: z.array(z.string()).max(TRANSPORT_LIMITS.MAX_CONTRACT_NAMES),
167
+ actions: z.array(z.string()).max(TRANSPORT_LIMITS.MAX_CONTRACT_NAMES),
168
+ })
169
+ .optional(),
107
170
  /** Whether the app has advertised a capability registry (reticle.describe). */
108
171
  hasCapabilities: z.boolean().optional(),
172
+ /**
173
+ * Whether this page records request/response bodies (`connect({ captureNetworkBodies: true })`).
174
+ *
175
+ * Announced so an assertion that can only be answered from a body is refused BEFORE the action is
176
+ * spent, rather than after. Reported from the field: an `act_and_wait` matched the right call and
177
+ * came back `verified: "no"` with "a matching call with no recorded body" — knowable in advance,
178
+ * and on a drive that mutates state the action is not always repeatable.
179
+ *
180
+ * ABSENT means unknown, never false. An SDK predating this field says nothing, and treating
181
+ * silence as "off" would refuse a clause every one of those sessions can satisfy.
182
+ */
183
+ captureBodies: z.boolean().optional(),
184
+ /**
185
+ * Whether the build plugin's `data-reticle-source` stamp is switched OFF for this project.
186
+ *
187
+ * Announced for the same reason `captureBodies` is, and read by the same kind of rule: a verdict
188
+ * that cannot name a file and line needs to know WHY before it prescribes a fix. Without it, an
189
+ * app that disabled the stamp deliberately — which react-three-fiber apps must, and which `reticle
190
+ * init` now does for them automatically — was told on every red verdict to install a build plugin
191
+ * it already had.
192
+ *
193
+ * ABSENT means unknown, never false. An older SDK says nothing, and reading silence as "off"
194
+ * would suppress the honest gap for every app that simply has no source mapping at all.
195
+ */
196
+ sourceMapping: z.boolean().optional(),
109
197
  /**
110
198
  * The version of the SDK in the page, so a version-skewed pair can SAY so.
111
199
  *
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Reading a value off the wire without trusting it.
3
+ *
4
+ * Everything that arrives from a page, a config file or an agent's arguments is `unknown` until
5
+ * something checks it. These are that check, in the smallest form: give me the string if it is a
6
+ * string, and nothing if it is not.
7
+ *
8
+ * They lived under `tools/` in the server package, because a tool handler was the first thing that
9
+ * needed them. Nothing about them is a tool: the rules that decide a verdict use them, the session
10
+ * uses them, the command line uses them. A helper filed under where it was first needed rather than
11
+ * what it does is a helper that drags its old neighbourhood along behind it, and this one was
12
+ * dragging the whole tool surface into the verdict engine.
13
+ *
14
+ * `undefined` for a value of the wrong type, never a default. A number that arrives as the string
15
+ * "12" is not a number, and quietly making it one is how a wire mistake becomes a wrong answer that
16
+ * nothing reports.
17
+ */
18
+ /** The value if it is a string, otherwise nothing. */
19
+ export declare function asString(value: unknown): string | undefined;
20
+ /**
21
+ * The value if it is a number, otherwise nothing.
22
+ *
23
+ * `NaN` and `Infinity` pass, because `typeof NaN` is `'number'`. That is worth knowing rather than
24
+ * quietly fixing here: this moved out of the server unchanged, and tightening it in the same commit
25
+ * would be a behaviour change wearing a refactor's message. If a caller needs a finite number it
26
+ * should say so where it reads the value.
27
+ */
28
+ export declare function asNumber(value: unknown): number | undefined;
29
+ /**
30
+ * The value if it is an object, otherwise an empty one.
31
+ *
32
+ * The odd one out: it answers with `{}` rather than `undefined`, because every caller is about to
33
+ * read a key off it and an empty object gives them `undefined` for free.
34
+ *
35
+ * An ARRAY passes, because an array is an object to JavaScript. Almost certainly not what a caller
36
+ * reaching for a named key meant, and left exactly as it was for the same reason as above: this is a
37
+ * move, and a move that also changes behaviour is two changes wearing one message.
38
+ */
39
+ export declare function asRecord(value: unknown): Record<string, unknown>;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Reading a value off the wire without trusting it.
3
+ *
4
+ * Everything that arrives from a page, a config file or an agent's arguments is `unknown` until
5
+ * something checks it. These are that check, in the smallest form: give me the string if it is a
6
+ * string, and nothing if it is not.
7
+ *
8
+ * They lived under `tools/` in the server package, because a tool handler was the first thing that
9
+ * needed them. Nothing about them is a tool: the rules that decide a verdict use them, the session
10
+ * uses them, the command line uses them. A helper filed under where it was first needed rather than
11
+ * what it does is a helper that drags its old neighbourhood along behind it, and this one was
12
+ * dragging the whole tool surface into the verdict engine.
13
+ *
14
+ * `undefined` for a value of the wrong type, never a default. A number that arrives as the string
15
+ * "12" is not a number, and quietly making it one is how a wire mistake becomes a wrong answer that
16
+ * nothing reports.
17
+ */
18
+ /** The value if it is a string, otherwise nothing. */
19
+ export function asString(value) {
20
+ return 'string' === typeof value ? value : undefined;
21
+ }
22
+ /**
23
+ * The value if it is a number, otherwise nothing.
24
+ *
25
+ * `NaN` and `Infinity` pass, because `typeof NaN` is `'number'`. That is worth knowing rather than
26
+ * quietly fixing here: this moved out of the server unchanged, and tightening it in the same commit
27
+ * would be a behaviour change wearing a refactor's message. If a caller needs a finite number it
28
+ * should say so where it reads the value.
29
+ */
30
+ export function asNumber(value) {
31
+ return 'number' === typeof value ? value : undefined;
32
+ }
33
+ /**
34
+ * The value if it is an object, otherwise an empty one.
35
+ *
36
+ * The odd one out: it answers with `{}` rather than `undefined`, because every caller is about to
37
+ * read a key off it and an empty object gives them `undefined` for free.
38
+ *
39
+ * An ARRAY passes, because an array is an object to JavaScript. Almost certainly not what a caller
40
+ * reaching for a named key meant, and left exactly as it was for the same reason as above: this is a
41
+ * move, and a move that also changes behaviour is two changes wearing one message.
42
+ */
43
+ export function asRecord(value) {
44
+ return 'object' === typeof value && value !== null ? value : {};
45
+ }
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Network-call vocabulary shared by the browser SDK and the server. Split out of constants.ts to
3
- * keep that file under the size cap.
2
+ * Network-call vocabulary shared by the browser SDK and the server.
4
3
  */
5
4
  /**
6
5
  * What issued a network-shaped call. Desktop apps (Electron, Tauri) reach their backend over IPC
@@ -12,6 +11,46 @@ export declare const NetInitiator: {
12
11
  readonly XHR: "xhr";
13
12
  readonly BEACON: "beacon";
14
13
  readonly IPC: "ipc";
14
+ /**
15
+ * The request that fetched the DOCUMENT itself, read once from `PerformanceNavigationTiming`.
16
+ *
17
+ * A server-rendered app answers a click with a full document load: the old document is torn down
18
+ * with the SDK inside it, and the SDK comes back up in a page whose defining request happened
19
+ * before it existed. No patched transport could have seen it, so without this initiator the net
20
+ * channel has no record of it at all: a `net` clause naming the destination MISSES and the verdict
21
+ * comes back `unknown` even though route and heading verified.
22
+ *
23
+ * DISTINCT FROM the document-INITIATED subresource initiators (`link`, `css`, `img`, `script`,
24
+ * `manifest`, `other`) that the resource-timing observer stamps. Those prove that observer is
25
+ * alive on this page and gate a downgrade in `predicate-eval`; this one does not, because the
26
+ * navigation entry exists on every page with Navigation Timing including ones where
27
+ * `PerformanceObserver` never fired. Conflating them would turn an honest "cannot tell" into a
28
+ * false red over favicons and fonts.
29
+ */
30
+ readonly DOCUMENT: "document";
31
+ /**
32
+ * The browser is LEAVING for this URL, recorded at the moment of departure.
33
+ *
34
+ * Emitted as a NET_PENDING that can never be matched, because that is exactly what it is: a
35
+ * request the browser is about to make and whose outcome this SDK will never see, having died with
36
+ * the document. Absence of a completion is honest here rather than a defect, and `reconcileNet`
37
+ * already renders an unmatched pending as `{status: 'pending'}` — so a `urlContains` assertion
38
+ * matches it and a `status: 200` one correctly does not.
39
+ *
40
+ * It exists because leaving the instrumented origin returned `observation_lost` and nothing else.
41
+ * "Sign in with <provider>" is on a large share of real apps, and the checkable claim is narrow:
42
+ * does the app hand the browser to the expected provider, with the expected parameters? Nobody
43
+ * expects Reticle to verify the provider's own pages. That modest claim came back as `unknown`,
44
+ * and the reporter's fallback was to read the local endpoint's 302 by hand and report the whole
45
+ * flow unverified.
46
+ *
47
+ * The same event covers a native download — an `<a download href="/api/export.pdf">` produces no
48
+ * fetch and no new document, so an export was equally unprovable.
49
+ *
50
+ * MUST be excluded from the settle oracle: a pending that by construction never completes would
51
+ * otherwise mean no page containing an outbound link ever settles again.
52
+ */
53
+ readonly NAVIGATION: "navigation";
15
54
  };
16
55
  export type NetInitiator = (typeof NetInitiator)[keyof typeof NetInitiator];
17
56
  /**
@@ -34,19 +73,19 @@ export declare const IpcStatus: {
34
73
  * `202 Accepted` — the server took the request and has NOT finished processing it.
35
74
  *
36
75
  * The only status in HTTP whose meaning is "no outcome yet". Folding it into the 2xx success band is
37
- * how an asynchronous workflow gets verified at exactly the moment nothing has been decided:
38
- * measured on a logistics console, a dispatch answered 202, the UI rendered success, the page
39
- * settled, and the server reverted the shipment 1.2s later.
76
+ * how an asynchronous workflow gets verified at exactly the moment nothing has been decided: a
77
+ * dispatch answers 202, the UI renders success, the page settles, and the server reverts the write
78
+ * a second later.
40
79
  */
41
80
  export declare const HTTP_ACCEPTED = 202;
42
81
  /**
43
82
  * Traffic the DEV TOOLCHAIN makes about itself — never the app under test.
44
83
  *
45
- * A CLOSED list, deliberately. Reported from a real drive: a correct Next.js navigation graded
46
- * `verified: "no"` because the dev overlay was fetching a source map for an unrelated React key
47
- * warning (`POST /__nextjs_original-stack-frames`), and that in-flight request counted as "the UI
48
- * advanced over a request that never settled". Every app that logs one dev warning got a false
49
- * negative on every action — the worst defect class after a false green.
84
+ * A CLOSED list, deliberately. Without it a correct navigation grades `verified: "no"` because the
85
+ * dev overlay is fetching a source map for an unrelated React warning (`POST
86
+ * /__nextjs_original-stack-frames`) and that in-flight request counts as "the UI advanced over a
87
+ * request that never settled" — a false negative on every action in any app that logs one dev
88
+ * warning.
50
89
  *
51
90
  * The rule for adding an entry: it must be a channel the FRAMEWORK owns, that no application route
52
91
  * can occupy, and that fires as a consequence of running in dev rather than of anything the user
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Network-call vocabulary shared by the browser SDK and the server. Split out of constants.ts to
3
- * keep that file under the size cap.
2
+ * Network-call vocabulary shared by the browser SDK and the server.
4
3
  */
5
4
  /**
6
5
  * What issued a network-shaped call. Desktop apps (Electron, Tauri) reach their backend over IPC
@@ -12,6 +11,46 @@ export const NetInitiator = {
12
11
  XHR: 'xhr',
13
12
  BEACON: 'beacon',
14
13
  IPC: 'ipc',
14
+ /**
15
+ * The request that fetched the DOCUMENT itself, read once from `PerformanceNavigationTiming`.
16
+ *
17
+ * A server-rendered app answers a click with a full document load: the old document is torn down
18
+ * with the SDK inside it, and the SDK comes back up in a page whose defining request happened
19
+ * before it existed. No patched transport could have seen it, so without this initiator the net
20
+ * channel has no record of it at all: a `net` clause naming the destination MISSES and the verdict
21
+ * comes back `unknown` even though route and heading verified.
22
+ *
23
+ * DISTINCT FROM the document-INITIATED subresource initiators (`link`, `css`, `img`, `script`,
24
+ * `manifest`, `other`) that the resource-timing observer stamps. Those prove that observer is
25
+ * alive on this page and gate a downgrade in `predicate-eval`; this one does not, because the
26
+ * navigation entry exists on every page with Navigation Timing including ones where
27
+ * `PerformanceObserver` never fired. Conflating them would turn an honest "cannot tell" into a
28
+ * false red over favicons and fonts.
29
+ */
30
+ DOCUMENT: 'document',
31
+ /**
32
+ * The browser is LEAVING for this URL, recorded at the moment of departure.
33
+ *
34
+ * Emitted as a NET_PENDING that can never be matched, because that is exactly what it is: a
35
+ * request the browser is about to make and whose outcome this SDK will never see, having died with
36
+ * the document. Absence of a completion is honest here rather than a defect, and `reconcileNet`
37
+ * already renders an unmatched pending as `{status: 'pending'}` — so a `urlContains` assertion
38
+ * matches it and a `status: 200` one correctly does not.
39
+ *
40
+ * It exists because leaving the instrumented origin returned `observation_lost` and nothing else.
41
+ * "Sign in with <provider>" is on a large share of real apps, and the checkable claim is narrow:
42
+ * does the app hand the browser to the expected provider, with the expected parameters? Nobody
43
+ * expects Reticle to verify the provider's own pages. That modest claim came back as `unknown`,
44
+ * and the reporter's fallback was to read the local endpoint's 302 by hand and report the whole
45
+ * flow unverified.
46
+ *
47
+ * The same event covers a native download — an `<a download href="/api/export.pdf">` produces no
48
+ * fetch and no new document, so an export was equally unprovable.
49
+ *
50
+ * MUST be excluded from the settle oracle: a pending that by construction never completes would
51
+ * otherwise mean no page containing an outbound link ever settles again.
52
+ */
53
+ NAVIGATION: 'navigation',
15
54
  };
16
55
  /**
17
56
  * Synthetic URL scheme for an IPC call, so a channel/command name occupies the `url` field the way a
@@ -33,19 +72,19 @@ export const IpcStatus = {
33
72
  * `202 Accepted` — the server took the request and has NOT finished processing it.
34
73
  *
35
74
  * The only status in HTTP whose meaning is "no outcome yet". Folding it into the 2xx success band is
36
- * how an asynchronous workflow gets verified at exactly the moment nothing has been decided:
37
- * measured on a logistics console, a dispatch answered 202, the UI rendered success, the page
38
- * settled, and the server reverted the shipment 1.2s later.
75
+ * how an asynchronous workflow gets verified at exactly the moment nothing has been decided: a
76
+ * dispatch answers 202, the UI renders success, the page settles, and the server reverts the write
77
+ * a second later.
39
78
  */
40
79
  export const HTTP_ACCEPTED = 202;
41
80
  /**
42
81
  * Traffic the DEV TOOLCHAIN makes about itself — never the app under test.
43
82
  *
44
- * A CLOSED list, deliberately. Reported from a real drive: a correct Next.js navigation graded
45
- * `verified: "no"` because the dev overlay was fetching a source map for an unrelated React key
46
- * warning (`POST /__nextjs_original-stack-frames`), and that in-flight request counted as "the UI
47
- * advanced over a request that never settled". Every app that logs one dev warning got a false
48
- * negative on every action — the worst defect class after a false green.
83
+ * A CLOSED list, deliberately. Without it a correct navigation grades `verified: "no"` because the
84
+ * dev overlay is fetching a source map for an unrelated React warning (`POST
85
+ * /__nextjs_original-stack-frames`) and that in-flight request counts as "the UI advanced over a
86
+ * request that never settled" — a false negative on every action in any app that logs one dev
87
+ * warning.
49
88
  *
50
89
  * The rule for adding an entry: it must be a channel the FRAMEWORK owns, that no application route
51
90
  * can occupy, and that fires as a consequence of running in dev rather than of anything the user
@@ -0,0 +1,37 @@
1
+ /**
2
+ * What kind of surface an app presents, which decides what can be demanded of it.
3
+ *
4
+ * This is deliberately NOT the list of shells. "Which shell is this" -- a browser, Electron, Tauri --
5
+ * is a question about what somebody is using, and it belongs to the usage contract. "What kind of
6
+ * surface is this" is a question about what can be observed, and it is the one verification needs.
7
+ *
8
+ * Electron and Tauri are two different products and one kind of surface: a web page inside a native
9
+ * window. Code that branched on the shell had to name both, and would have to name a third that
10
+ * behaved identically. Code that branches on the surface names `webview` once.
11
+ *
12
+ * There are no dependencies here on purpose. A third-party implementation says which of these it is
13
+ * and needs nothing from this package to say it.
14
+ *
15
+ * Absent on the wire means `web`. That is the back-compat convention used throughout the handshake:
16
+ * a field nobody sent means what everything meant before the field existed.
17
+ */
18
+ export declare const PlatformProfile: {
19
+ /** A browser document. The page owns the window. */
20
+ readonly WEB: "web";
21
+ /**
22
+ * A web page inside something else's window: Electron's renderer, Tauri, Capacitor, a React
23
+ * Native WebView. It renders like the web and the window around it is not ours.
24
+ */
25
+ readonly WEBVIEW: "webview";
26
+ /**
27
+ * A native view tree -- iOS, Android, Flutter. There are elements and they are not DOM nodes, so
28
+ * anything that assumes a document is wrong here.
29
+ */
30
+ readonly NATIVE: "native";
31
+ /**
32
+ * No rendering surface at all: a job, a worker, an API. It can still be observed and it can still
33
+ * be asserted about; it just cannot be looked at or photographed.
34
+ */
35
+ readonly SERVICE: "service";
36
+ };
37
+ export type PlatformProfile = (typeof PlatformProfile)[keyof typeof PlatformProfile];
@@ -0,0 +1,36 @@
1
+ /**
2
+ * What kind of surface an app presents, which decides what can be demanded of it.
3
+ *
4
+ * This is deliberately NOT the list of shells. "Which shell is this" -- a browser, Electron, Tauri --
5
+ * is a question about what somebody is using, and it belongs to the usage contract. "What kind of
6
+ * surface is this" is a question about what can be observed, and it is the one verification needs.
7
+ *
8
+ * Electron and Tauri are two different products and one kind of surface: a web page inside a native
9
+ * window. Code that branched on the shell had to name both, and would have to name a third that
10
+ * behaved identically. Code that branches on the surface names `webview` once.
11
+ *
12
+ * There are no dependencies here on purpose. A third-party implementation says which of these it is
13
+ * and needs nothing from this package to say it.
14
+ *
15
+ * Absent on the wire means `web`. That is the back-compat convention used throughout the handshake:
16
+ * a field nobody sent means what everything meant before the field existed.
17
+ */
18
+ export const PlatformProfile = {
19
+ /** A browser document. The page owns the window. */
20
+ WEB: 'web',
21
+ /**
22
+ * A web page inside something else's window: Electron's renderer, Tauri, Capacitor, a React
23
+ * Native WebView. It renders like the web and the window around it is not ours.
24
+ */
25
+ WEBVIEW: 'webview',
26
+ /**
27
+ * A native view tree -- iOS, Android, Flutter. There are elements and they are not DOM nodes, so
28
+ * anything that assumes a document is wrong here.
29
+ */
30
+ NATIVE: 'native',
31
+ /**
32
+ * No rendering surface at all: a job, a worker, an API. It can still be observed and it can still
33
+ * be asserted about; it just cannot be looked at or photographed.
34
+ */
35
+ SERVICE: 'service',
36
+ };
@@ -42,6 +42,36 @@ export declare function setActiveRedactionPolicy(policy: RedactionPolicy): void;
42
42
  export declare function resetActiveRedactionPolicy(): void;
43
43
  /** Whether a key carries a credential, under the policy in force. */
44
44
  export declare function isSensitiveKey(key: string): boolean;
45
+ /**
46
+ * Redact credential-bearing values in a URL so they don't leak into the agent transcript / flow / run
47
+ * artifacts: query params (`?access_token=…`, signed-URL keys), the authority's userinfo, path-embedded
48
+ * tokens (`/reset/<token>`, `/invite/<token>`), and the fragment an OAuth implicit flow uses. The URL is
49
+ * returned byte-for-byte when nothing matched.
50
+ *
51
+ * Lives in core, beside the key rule, because it is a property of the WIRE rather than of one side of
52
+ * it. It was implemented in the browser SDK, which was the only consumer until the driven path began
53
+ * building NET_DETAIL straight from the network stack: those URLs are raw, and a second copy of this
54
+ * heuristic is the worst possible thing to let drift.
55
+ *
56
+ * `isSensitive` defaults to the ambient rule, which is what the browser wants. The server passes its
57
+ * own session policy explicitly, because a daemon serves many apps in one process and has no ambient
58
+ * rule to consult.
59
+ */
60
+ export declare function redactUrl(raw: string, isSensitive?: (key: string) => boolean): string;
61
+ /**
62
+ * Displayed URL plus, when redaction rewrote it, the raw request for graders.
63
+ *
64
+ * `url` is what the agent reads. `urlRaw` exists only so `urlContains` can still match a public
65
+ * path segment that the heuristic rewrote (`/auth/token/refresh-context`), and so two observations of
66
+ * the same request can be matched to each other. Omitted when nothing changed, so an ordinary request
67
+ * pays nothing.
68
+ */
69
+ export declare function netUrlFields(raw: string, isSensitive?: (key: string) => boolean): {
70
+ url: string;
71
+ } | {
72
+ url: string;
73
+ urlRaw: string;
74
+ };
45
75
  /** Cap on how many declared keys travel in a hello — a bound, not a limit anyone should reach. */
46
76
  export declare const MAX_WIRE_REDACT_KEYS = 64;
47
77
  /** Cap on one declared key's length, so a hello cannot be inflated by a pathological name. */