@reticlehq/core 2.13.1 → 2.14.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.
- package/dist/artifacts-entry.d.ts +20 -0
- package/dist/artifacts-entry.js +20 -0
- package/dist/consequence.d.ts +8 -1
- package/dist/consequence.js +11 -2
- package/dist/constants.d.ts +33 -0
- package/dist/constants.js +32 -0
- package/dist/dev-server-registry.d.ts +2 -2
- package/dist/event-payloads.d.ts +167 -10
- package/dist/event-payloads.js +40 -0
- package/dist/findings.d.ts +61 -0
- package/dist/findings.js +67 -0
- package/dist/flow-constants.d.ts +8 -0
- package/dist/flow-constants.js +8 -0
- package/dist/flow-types.d.ts +371 -133
- package/dist/flow-types.js +55 -3
- package/dist/global-press.d.ts +30 -0
- package/dist/global-press.js +54 -0
- package/dist/impact-savings.d.ts +7 -3
- package/dist/impact-savings.js +27 -4
- package/dist/impact.d.ts +96 -44
- package/dist/impact.js +21 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +16 -2
- package/dist/instrumentation-gap.d.ts +15 -0
- package/dist/instrumentation-gap.js +16 -0
- package/dist/intent.d.ts +24 -24
- package/dist/journal.d.ts +7 -7
- package/dist/messages.d.ts +107 -46
- package/dist/messages.js +25 -0
- package/dist/net.d.ts +40 -0
- package/dist/net.js +40 -0
- package/dist/notices.d.ts +16 -0
- package/dist/notices.js +19 -0
- package/dist/redaction.d.ts +30 -0
- package/dist/redaction.js +127 -2
- package/dist/schema/event-message.json +1 -0
- package/dist/schema/event-type.json +1 -0
- package/dist/schema/hello-message.json +6 -0
- package/dist/schema/reticle-event.json +1 -0
- package/dist/schema/reticle-message.json +7 -0
- package/dist/telemetry-entry.d.ts +15 -0
- package/dist/telemetry-entry.js +15 -0
- package/dist/telemetry-feedback.d.ts +2 -2
- package/dist/telemetry-session.d.ts +2 -2
- package/dist/telemetry.d.ts +52 -50
- package/dist/types.d.ts +83 -44
- package/dist/types.js +20 -1
- package/dist/upgrade.d.ts +2 -2
- package/dist/verification-run.d.ts +36 -36
- package/dist/verified-constants.d.ts +11 -0
- package/dist/verified-constants.js +11 -0
- package/dist/verify-progress.d.ts +133 -0
- package/dist/verify-progress.js +78 -0
- package/package.json +9 -1
package/dist/messages.js
CHANGED
|
@@ -106,6 +106,31 @@ export const HelloMessageSchema = z.object({
|
|
|
106
106
|
token: z.string().max(TRANSPORT_LIMITS.MAX_TOKEN_LENGTH).optional(),
|
|
107
107
|
/** Whether the app has advertised a capability registry (reticle.describe). */
|
|
108
108
|
hasCapabilities: z.boolean().optional(),
|
|
109
|
+
/**
|
|
110
|
+
* Whether this page records request/response bodies (`connect({ captureNetworkBodies: true })`).
|
|
111
|
+
*
|
|
112
|
+
* Announced so an assertion that can only be answered from a body is refused BEFORE the action is
|
|
113
|
+
* spent, rather than after. Reported from the field: an `act_and_wait` matched the right call and
|
|
114
|
+
* came back `verified: "no"` with "a matching call with no recorded body" — knowable in advance,
|
|
115
|
+
* and on a drive that mutates state the action is not always repeatable.
|
|
116
|
+
*
|
|
117
|
+
* ABSENT means unknown, never false. An SDK predating this field says nothing, and treating
|
|
118
|
+
* silence as "off" would refuse a clause every one of those sessions can satisfy.
|
|
119
|
+
*/
|
|
120
|
+
captureBodies: z.boolean().optional(),
|
|
121
|
+
/**
|
|
122
|
+
* Whether the build plugin's `data-reticle-source` stamp is switched OFF for this project.
|
|
123
|
+
*
|
|
124
|
+
* Announced for the same reason `captureBodies` is, and read by the same kind of rule: a verdict
|
|
125
|
+
* that cannot name a file and line needs to know WHY before it prescribes a fix. Without it, an
|
|
126
|
+
* app that disabled the stamp deliberately — which react-three-fiber apps must, and which `reticle
|
|
127
|
+
* init` now does for them automatically — was told on every red verdict to install a build plugin
|
|
128
|
+
* it already had.
|
|
129
|
+
*
|
|
130
|
+
* ABSENT means unknown, never false. An older SDK says nothing, and reading silence as "off"
|
|
131
|
+
* would suppress the honest gap for every app that simply has no source mapping at all.
|
|
132
|
+
*/
|
|
133
|
+
sourceMapping: z.boolean().optional(),
|
|
109
134
|
/**
|
|
110
135
|
* The version of the SDK in the page, so a version-skewed pair can SAY so.
|
|
111
136
|
*
|
package/dist/net.d.ts
CHANGED
|
@@ -12,6 +12,46 @@ export declare const NetInitiator: {
|
|
|
12
12
|
readonly XHR: "xhr";
|
|
13
13
|
readonly BEACON: "beacon";
|
|
14
14
|
readonly IPC: "ipc";
|
|
15
|
+
/**
|
|
16
|
+
* The request that fetched the DOCUMENT itself, read once from `PerformanceNavigationTiming`.
|
|
17
|
+
*
|
|
18
|
+
* A server-rendered app answers a click with a full document load: the old document is torn down
|
|
19
|
+
* with the SDK inside it, and the SDK comes back up in a page whose defining request happened
|
|
20
|
+
* before it existed. No patched transport could have seen it, so the net channel had no record of
|
|
21
|
+
* it at all — a Django MPA click was verified on route and heading while the `net` clause naming
|
|
22
|
+
* the destination MISSED, and the verdict came back `unknown`.
|
|
23
|
+
*
|
|
24
|
+
* DISTINCT FROM the document-INITIATED subresource initiators (`link`, `css`, `img`, `script`,
|
|
25
|
+
* `manifest`, `other`) that the resource-timing observer stamps. Those prove that observer is
|
|
26
|
+
* alive on this page and gate a downgrade in `predicate-eval`; this one does not, because the
|
|
27
|
+
* navigation entry exists on every page with Navigation Timing including ones where
|
|
28
|
+
* `PerformanceObserver` never fired. Conflating them would turn an honest "cannot tell" into a
|
|
29
|
+
* false red over favicons and fonts.
|
|
30
|
+
*/
|
|
31
|
+
readonly DOCUMENT: "document";
|
|
32
|
+
/**
|
|
33
|
+
* The browser is LEAVING for this URL, recorded at the moment of departure.
|
|
34
|
+
*
|
|
35
|
+
* Emitted as a NET_PENDING that can never be matched, because that is exactly what it is: a
|
|
36
|
+
* request the browser is about to make and whose outcome this SDK will never see, having died with
|
|
37
|
+
* the document. Absence of a completion is honest here rather than a defect, and `reconcileNet`
|
|
38
|
+
* already renders an unmatched pending as `{status: 'pending'}` — so a `urlContains` assertion
|
|
39
|
+
* matches it and a `status: 200` one correctly does not.
|
|
40
|
+
*
|
|
41
|
+
* It exists because leaving the instrumented origin returned `observation_lost` and nothing else.
|
|
42
|
+
* "Sign in with <provider>" is on a large share of real apps, and the checkable claim is narrow:
|
|
43
|
+
* does the app hand the browser to the expected provider, with the expected parameters? Nobody
|
|
44
|
+
* expects Reticle to verify the provider's own pages. That modest claim came back as `unknown`,
|
|
45
|
+
* and the reporter's fallback was to read the local endpoint's 302 by hand and report the whole
|
|
46
|
+
* flow unverified.
|
|
47
|
+
*
|
|
48
|
+
* The same event covers a native download — an `<a download href="/api/export.pdf">` produces no
|
|
49
|
+
* fetch and no new document, so an export was equally unprovable.
|
|
50
|
+
*
|
|
51
|
+
* MUST be excluded from the settle oracle: a pending that by construction never completes would
|
|
52
|
+
* otherwise mean no page containing an outbound link ever settles again.
|
|
53
|
+
*/
|
|
54
|
+
readonly NAVIGATION: "navigation";
|
|
15
55
|
};
|
|
16
56
|
export type NetInitiator = (typeof NetInitiator)[keyof typeof NetInitiator];
|
|
17
57
|
/**
|
package/dist/net.js
CHANGED
|
@@ -12,6 +12,46 @@ export const NetInitiator = {
|
|
|
12
12
|
XHR: 'xhr',
|
|
13
13
|
BEACON: 'beacon',
|
|
14
14
|
IPC: 'ipc',
|
|
15
|
+
/**
|
|
16
|
+
* The request that fetched the DOCUMENT itself, read once from `PerformanceNavigationTiming`.
|
|
17
|
+
*
|
|
18
|
+
* A server-rendered app answers a click with a full document load: the old document is torn down
|
|
19
|
+
* with the SDK inside it, and the SDK comes back up in a page whose defining request happened
|
|
20
|
+
* before it existed. No patched transport could have seen it, so the net channel had no record of
|
|
21
|
+
* it at all — a Django MPA click was verified on route and heading while the `net` clause naming
|
|
22
|
+
* the destination MISSED, and the verdict came back `unknown`.
|
|
23
|
+
*
|
|
24
|
+
* DISTINCT FROM the document-INITIATED subresource initiators (`link`, `css`, `img`, `script`,
|
|
25
|
+
* `manifest`, `other`) that the resource-timing observer stamps. Those prove that observer is
|
|
26
|
+
* alive on this page and gate a downgrade in `predicate-eval`; this one does not, because the
|
|
27
|
+
* navigation entry exists on every page with Navigation Timing including ones where
|
|
28
|
+
* `PerformanceObserver` never fired. Conflating them would turn an honest "cannot tell" into a
|
|
29
|
+
* false red over favicons and fonts.
|
|
30
|
+
*/
|
|
31
|
+
DOCUMENT: 'document',
|
|
32
|
+
/**
|
|
33
|
+
* The browser is LEAVING for this URL, recorded at the moment of departure.
|
|
34
|
+
*
|
|
35
|
+
* Emitted as a NET_PENDING that can never be matched, because that is exactly what it is: a
|
|
36
|
+
* request the browser is about to make and whose outcome this SDK will never see, having died with
|
|
37
|
+
* the document. Absence of a completion is honest here rather than a defect, and `reconcileNet`
|
|
38
|
+
* already renders an unmatched pending as `{status: 'pending'}` — so a `urlContains` assertion
|
|
39
|
+
* matches it and a `status: 200` one correctly does not.
|
|
40
|
+
*
|
|
41
|
+
* It exists because leaving the instrumented origin returned `observation_lost` and nothing else.
|
|
42
|
+
* "Sign in with <provider>" is on a large share of real apps, and the checkable claim is narrow:
|
|
43
|
+
* does the app hand the browser to the expected provider, with the expected parameters? Nobody
|
|
44
|
+
* expects Reticle to verify the provider's own pages. That modest claim came back as `unknown`,
|
|
45
|
+
* and the reporter's fallback was to read the local endpoint's 302 by hand and report the whole
|
|
46
|
+
* flow unverified.
|
|
47
|
+
*
|
|
48
|
+
* The same event covers a native download — an `<a download href="/api/export.pdf">` produces no
|
|
49
|
+
* fetch and no new document, so an export was equally unprovable.
|
|
50
|
+
*
|
|
51
|
+
* MUST be excluded from the settle oracle: a pending that by construction never completes would
|
|
52
|
+
* otherwise mean no page containing an outbound link ever settles again.
|
|
53
|
+
*/
|
|
54
|
+
NAVIGATION: 'navigation',
|
|
15
55
|
};
|
|
16
56
|
/**
|
|
17
57
|
* Synthetic URL scheme for an IPC call, so a channel/command name occupies the `url` field the way a
|
package/dist/notices.d.ts
CHANGED
|
@@ -51,6 +51,22 @@ export declare const THROTTLED_WARNING = "tab throttled; timer/rAF/pointer gestu
|
|
|
51
51
|
* failure. The CLI escape hatch is named second; an MCP-only agent has no shell.
|
|
52
52
|
*/
|
|
53
53
|
export declare const THROTTLED_STARVED_NOTE: string;
|
|
54
|
+
/**
|
|
55
|
+
* Carried by a `console absent` pass whose window starts where the SDK attached.
|
|
56
|
+
*
|
|
57
|
+
* The console channel does not exist until `installConsole` patches `console`, and the documented
|
|
58
|
+
* Next.js install connects through a dynamic import inside a `useEffect` — so a `console.error`
|
|
59
|
+
* fired during first render is never captured. Not evicted, permanently invisible: a reporter
|
|
60
|
+
* proved it with a control, and the same error fired from a click seconds later IS captured.
|
|
61
|
+
* Meanwhile the response said the observation "ran and found none, which is a result, not a missing
|
|
62
|
+
* reading", which is the opposite of true for that stretch of the page's life.
|
|
63
|
+
*
|
|
64
|
+
* Same shape and same argument as PRE_ATTACH_CAVEAT one channel over, and the same deliberate
|
|
65
|
+
* restraint: the grade is NOT downgraded. A clean console is the finding this oracle exists to
|
|
66
|
+
* make, and turning every startup window into `unknown` would retire the check rather than fix it.
|
|
67
|
+
* What changes is only what the pass CLAIMS.
|
|
68
|
+
*/
|
|
69
|
+
export declare const CONSOLE_ATTACH_NOTE: string;
|
|
54
70
|
/**
|
|
55
71
|
* Pushed to the panel when the last agent's MCP connection drops — the agent (any of
|
|
56
72
|
* Codex/OpenCode/Claude/Hermes) has stopped or is waiting on you. Tells the human, who is
|
package/dist/notices.js
CHANGED
|
@@ -57,6 +57,25 @@ export const THROTTLED_WARNING = 'tab throttled; timer/rAF/pointer gestures may
|
|
|
57
57
|
export const THROTTLED_STARVED_NOTE = 'this tab is throttled and has not rendered; a miss here is not evidence the UI is absent. ' +
|
|
58
58
|
'acquire a scriptable context with reticle_run { tool: "reticle_lease", action: "acquire", url } ' +
|
|
59
59
|
'(the human can run `reticle drive <url>` if they have a shell)';
|
|
60
|
+
/**
|
|
61
|
+
* Carried by a `console absent` pass whose window starts where the SDK attached.
|
|
62
|
+
*
|
|
63
|
+
* The console channel does not exist until `installConsole` patches `console`, and the documented
|
|
64
|
+
* Next.js install connects through a dynamic import inside a `useEffect` — so a `console.error`
|
|
65
|
+
* fired during first render is never captured. Not evicted, permanently invisible: a reporter
|
|
66
|
+
* proved it with a control, and the same error fired from a click seconds later IS captured.
|
|
67
|
+
* Meanwhile the response said the observation "ran and found none, which is a result, not a missing
|
|
68
|
+
* reading", which is the opposite of true for that stretch of the page's life.
|
|
69
|
+
*
|
|
70
|
+
* Same shape and same argument as PRE_ATTACH_CAVEAT one channel over, and the same deliberate
|
|
71
|
+
* restraint: the grade is NOT downgraded. A clean console is the finding this oracle exists to
|
|
72
|
+
* make, and turning every startup window into `unknown` would retire the check rather than fix it.
|
|
73
|
+
* What changes is only what the pass CLAIMS.
|
|
74
|
+
*/
|
|
75
|
+
export const CONSOLE_ATTACH_NOTE = 'this window starts where the SDK attached, and the console channel does not exist until then — ' +
|
|
76
|
+
'anything logged during first render (or before a dynamically-imported connect ran) was never ' +
|
|
77
|
+
'captured, so a clean read here cannot tell a silent page apart from one that logged before ' +
|
|
78
|
+
'anything was watching; drive the page and re-check, or assert on what the error produces';
|
|
60
79
|
/**
|
|
61
80
|
* Pushed to the panel when the last agent's MCP connection drops — the agent (any of
|
|
62
81
|
* Codex/OpenCode/Claude/Hermes) has stopped or is waiting on you. Tells the human, who is
|
package/dist/redaction.d.ts
CHANGED
|
@@ -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. */
|
package/dist/redaction.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { REDACTED_VALUE } from './constants.js';
|
|
2
|
+
import { URL_RAW } from './net.js';
|
|
2
3
|
/**
|
|
3
4
|
* Wire redaction rules — which field names carry credentials, and which VALUE shapes are secrets
|
|
4
5
|
* regardless of the field they sit in.
|
|
@@ -8,6 +9,19 @@ import { REDACTED_VALUE } from './constants.js';
|
|
|
8
9
|
* request bodies straight from the network stack — those are raw and unscrubbed, and duplicating a
|
|
9
10
|
* security regex to redact them would be the worst possible place to have two copies drift.
|
|
10
11
|
*/
|
|
12
|
+
// `pass[-_]?phrase` is the fourth spelling of the first three. There is no benign field called
|
|
13
|
+
// `passphrase`: it is what an SSH key, a keystore, an encrypted backup and a wallet all call their
|
|
14
|
+
// secret, so it is a gap rather than a judgement call.
|
|
15
|
+
//
|
|
16
|
+
// The one-time codes are the second family. They expire, which is what makes them easy to wave
|
|
17
|
+
// away, but the window in which one is useful is the window in which a drive is running, and the
|
|
18
|
+
// journal is written to disk and read back later. `(otp|totp|mfa|recovery|backup)[-_]?codes?`
|
|
19
|
+
// carries the camelCase spellings too, since `[-_]?` is optional and the rule is case-insensitive.
|
|
20
|
+
// Bare `otp`/`totp` are boundary-anchored: unanchored they would fire inside ordinary words, and
|
|
21
|
+
// this file's own history is a list of false positives that had to be walked back.
|
|
22
|
+
// `code` on its own is deliberately NOT here — `statusCode`, `postcode`, `couponCode` and
|
|
23
|
+
// `countryCode` are ordinary app data an agent needs in order to reach a verdict.
|
|
24
|
+
//
|
|
11
25
|
// `token` must match auth CREDENTIALS, not compound design fields. Bare/separated `token(s)` and
|
|
12
26
|
// auth-prefixed tokens (accessToken, auth_token, sessionToken, …) are redacted; `colorToken`,
|
|
13
27
|
// `backgroundToken`, `tokenCount`, `designToken` are NOT — they were false-positives that redacted
|
|
@@ -17,7 +31,7 @@ import { REDACTED_VALUE } from './constants.js';
|
|
|
17
31
|
// bundle the session credential and were the one wire payload reaching the journal + the agent
|
|
18
32
|
// unredacted), NOT any key that merely contains the substring — `scopecookie`, `cookieConsent`,
|
|
19
33
|
// `cookiePolicy` are legitimate app values an agent may need to read, and stay visible.
|
|
20
|
-
const SENSITIVE_KEY = /password|passwd|passcode|secret|(?:(?:access|refresh|auth|bearer|api|id|session|csrf|client)[-_]?tokens?|(?:^|[-_])tokens?(?=$|[-_]))|session[-_]?id|(?:^|[-_])(?:sid|pwd|jwt)(?=$|[-_])|authorization|(?:^|[-_])(?:set[-_])?cookie(?=$|[-_])|api[-_]?key|access[-_]?key|private[-_]?key|client[-_]?secret|credit[-_]?card|card[-_]?number|cvv|cvc|ssn|(?:^|[-_])(?:signature|sig)$|(?:^|[-_])credential$|x-(?:amz|goog)-(?:signature|credential|security-token)$/i;
|
|
34
|
+
const SENSITIVE_KEY = /password|passwd|passcode|pass[-_]?phrase|(?:otp|totp|mfa|recovery|backup)[-_]?codes?|(?:^|[-_])(?:otp|totp)(?=$|[-_])|secret|(?:(?:access|refresh|auth|bearer|api|id|session|csrf|client)[-_]?tokens?|(?:^|[-_])tokens?(?=$|[-_]))|session[-_]?id|(?:^|[-_])(?:sid|pwd|jwt)(?=$|[-_])|authorization|(?:^|[-_])(?:set[-_])?cookie(?=$|[-_])|api[-_]?key|access[-_]?key|private[-_]?key|client[-_]?secret|credit[-_]?card|card[-_]?number|cvv|cvc|ssn|(?:^|[-_])(?:signature|sig)$|(?:^|[-_])credential$|x-(?:amz|goog)-(?:signature|credential|security-token)$/i;
|
|
21
35
|
/**
|
|
22
36
|
* The built-in rule, always available and never configurable.
|
|
23
37
|
*
|
|
@@ -99,6 +113,102 @@ export function resetActiveRedactionPolicy() {
|
|
|
99
113
|
export function isSensitiveKey(key) {
|
|
100
114
|
return activePolicy === undefined ? defaultIsSensitiveKey(key) : activePolicy.isSensitiveKey(key);
|
|
101
115
|
}
|
|
116
|
+
/** A path segment name that is typically followed by a single-use secret token in the NEXT segment. */
|
|
117
|
+
const SENSITIVE_PATH_SEGMENT = /^(reset|verify|verification|confirm|activate|invite|magic|magiclink|token|key|oauth|unsubscribe|password)$/i;
|
|
118
|
+
/** Only mask a following segment that looks token-like — short ids/words (`reset/form`) are left alone. */
|
|
119
|
+
const PATH_TOKEN_MIN_LENGTH = 12;
|
|
120
|
+
/**
|
|
121
|
+
* Redact credential-bearing values in a URL so they don't leak into the agent transcript / flow / run
|
|
122
|
+
* artifacts: query params (`?access_token=…`, signed-URL keys), the authority's userinfo, path-embedded
|
|
123
|
+
* tokens (`/reset/<token>`, `/invite/<token>`), and the fragment an OAuth implicit flow uses. The URL is
|
|
124
|
+
* returned byte-for-byte when nothing matched.
|
|
125
|
+
*
|
|
126
|
+
* Lives in core, beside the key rule, because it is a property of the WIRE rather than of one side of
|
|
127
|
+
* it. It was implemented in the browser SDK, which was the only consumer until the driven path began
|
|
128
|
+
* building NET_DETAIL straight from the network stack: those URLs are raw, and a second copy of this
|
|
129
|
+
* heuristic is the worst possible thing to let drift.
|
|
130
|
+
*
|
|
131
|
+
* `isSensitive` defaults to the ambient rule, which is what the browser wants. The server passes its
|
|
132
|
+
* own session policy explicitly, because a daemon serves many apps in one process and has no ambient
|
|
133
|
+
* rule to consult.
|
|
134
|
+
*/
|
|
135
|
+
export function redactUrl(raw, isSensitive = isSensitiveKey) {
|
|
136
|
+
const hashStart = raw.indexOf('#');
|
|
137
|
+
const hash = -1 === hashStart ? '' : raw.slice(hashStart);
|
|
138
|
+
const beforeHash = -1 === hashStart ? raw : raw.slice(0, hashStart);
|
|
139
|
+
const queryStart = beforeHash.indexOf('?');
|
|
140
|
+
const pathPart = -1 === queryStart ? beforeHash : beforeHash.slice(0, queryStart);
|
|
141
|
+
const query = -1 === queryStart ? '' : beforeHash.slice(queryStart + 1);
|
|
142
|
+
let changed = false;
|
|
143
|
+
// Credentials in the authority (`scheme://user:pass@host`) never belong in a transcript.
|
|
144
|
+
// Match to the LAST `@` before the path (`[^/]*@`, greedy), not the first — a password containing
|
|
145
|
+
// `@` (`user:p@ss@host`) otherwise left its tail (`ss@host`) in the clear.
|
|
146
|
+
let authority = pathPart;
|
|
147
|
+
const userinfo = /^([a-z][a-z0-9+.-]*:\/\/)[^/]*@/i.exec(pathPart);
|
|
148
|
+
if (userinfo !== null) {
|
|
149
|
+
authority = `${userinfo[1] ?? ''}${REDACTED_VALUE}@${pathPart.slice(userinfo[0].length)}`;
|
|
150
|
+
changed = true;
|
|
151
|
+
}
|
|
152
|
+
let newQuery = query;
|
|
153
|
+
if (query !== '') {
|
|
154
|
+
const params = new URLSearchParams(query);
|
|
155
|
+
let queryChanged = false;
|
|
156
|
+
for (const key of [...params.keys()]) {
|
|
157
|
+
if (isSensitive(key)) {
|
|
158
|
+
params.set(key, REDACTED_VALUE);
|
|
159
|
+
queryChanged = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (queryChanged) {
|
|
163
|
+
newQuery = params.toString();
|
|
164
|
+
changed = true;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const segments = authority.split('/');
|
|
168
|
+
for (let i = 0; i + 1 < segments.length; i++) {
|
|
169
|
+
const name = segments[i];
|
|
170
|
+
const next = segments[i + 1];
|
|
171
|
+
if (name !== undefined &&
|
|
172
|
+
next !== undefined &&
|
|
173
|
+
next.length >= PATH_TOKEN_MIN_LENGTH &&
|
|
174
|
+
SENSITIVE_PATH_SEGMENT.test(name)) {
|
|
175
|
+
segments[i + 1] = REDACTED_VALUE;
|
|
176
|
+
changed = true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// OAuth implicit flow puts the access_token in the FRAGMENT (`#access_token=…`), and hash-routers carry
|
|
180
|
+
// `?token=…` in the hash — redact sensitive params there too, leaving plain anchors (`#section`) alone.
|
|
181
|
+
//
|
|
182
|
+
// The key is anchored to the delimiter that must precede it rather than being allowed to start
|
|
183
|
+
// anywhere. Unanchored, `([A-Za-z0-9_.-]+)=` can begin at every index of a long run of `-` and
|
|
184
|
+
// rescan the rest of it each time, which is quadratic in the length of the fragment. That was
|
|
185
|
+
// harmless while this only ever ran in the page on the app's own URLs; it runs in the daemon now,
|
|
186
|
+
// over URLs read off the network stack, so the input is no longer the app's to vouch for.
|
|
187
|
+
// Anchoring costs nothing: `#`, `&`, `?` and `/` are already outside the key character class, so
|
|
188
|
+
// every key this matched before began right after one of them.
|
|
189
|
+
let newHash = hash;
|
|
190
|
+
if (hash.length > 1) {
|
|
191
|
+
newHash = hash.replace(/(^|[#&?/])([A-Za-z0-9_.-]+)=([^&\s]+)/g, (m, delimiter, key) => isSensitive(key) ? `${delimiter}${key}=${REDACTED_VALUE}` : m);
|
|
192
|
+
if (newHash !== hash)
|
|
193
|
+
changed = true;
|
|
194
|
+
}
|
|
195
|
+
if (!changed)
|
|
196
|
+
return raw;
|
|
197
|
+
const queryOut = -1 === queryStart ? '' : `?${newQuery}`;
|
|
198
|
+
return `${segments.join('/')}${queryOut}${newHash}`;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Displayed URL plus, when redaction rewrote it, the raw request for graders.
|
|
202
|
+
*
|
|
203
|
+
* `url` is what the agent reads. `urlRaw` exists only so `urlContains` can still match a public
|
|
204
|
+
* path segment that the heuristic rewrote (`/auth/token/refresh-context`), and so two observations of
|
|
205
|
+
* the same request can be matched to each other. Omitted when nothing changed, so an ordinary request
|
|
206
|
+
* pays nothing.
|
|
207
|
+
*/
|
|
208
|
+
export function netUrlFields(raw, isSensitive = isSensitiveKey) {
|
|
209
|
+
const url = redactUrl(raw, isSensitive);
|
|
210
|
+
return url === raw ? { url } : { url, [URL_RAW]: raw };
|
|
211
|
+
}
|
|
102
212
|
/** Cap on how many declared keys travel in a hello — a bound, not a limit anyone should reach. */
|
|
103
213
|
export const MAX_WIRE_REDACT_KEYS = 64;
|
|
104
214
|
/** Cap on one declared key's length, so a hello cannot be inflated by a pathological name. */
|
|
@@ -142,7 +252,22 @@ export function wireRedactionKeys(config) {
|
|
|
142
252
|
// a secret can sit under a benign key (`{"note":"<jwt>"}`, `<meta content="sk_live_…">`). Deliberately
|
|
143
253
|
// narrow (JWT, known provider prefixes) so it never corrupts legitimate prose the way a broad
|
|
144
254
|
// entropy/length heuristic would.
|
|
145
|
-
|
|
255
|
+
//
|
|
256
|
+
// Every entry is a vendor-RESERVED prefix plus a length floor, which is the property that makes the
|
|
257
|
+
// rule safe to widen: `github_pattern_matching`, `ASIAN_MARKETS`, and `AIzawa` are all prose that
|
|
258
|
+
// starts with one of these prefixes and none of them reaches the floor. A vendor that ships a new
|
|
259
|
+
// prefix belongs here; a shape recognisable only by entropy does not.
|
|
260
|
+
//
|
|
261
|
+
// - `AKIA` / `ASIA` are both AWS access key ids: long-term and STS-temporary. They are the same 20
|
|
262
|
+
// characters and leak from the same places, so covering one and not the other was an accident of
|
|
263
|
+
// which one got written down first.
|
|
264
|
+
// - `github_pat_` is GitHub's fine-grained token, now the default a user is handed. It does not
|
|
265
|
+
// share the `gh[pousr]_` shape of the classic tokens.
|
|
266
|
+
// - `AIza` is the Google API key handed out for Maps/Firebase/YouTube, the one credential most
|
|
267
|
+
// likely to sit in a front-end request this SDK is watching.
|
|
268
|
+
// - `sk-<product>-` covers the LLM-provider keys (OpenAI `sk-proj-`, Anthropic `sk-ant-`). The
|
|
269
|
+
// product segment is required: bare `sk-` is two characters and would catch prose.
|
|
270
|
+
const KNOWN_SECRET = /eyJ[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}|(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{10,}|sk-(?:ant|proj|svcacct|admin)-[A-Za-z0-9_-]{20,}|(?:AKIA|ASIA)[0-9A-Z]{16}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{22,}|AIza[0-9A-Za-z_-]{35}|xox[baprs]-[A-Za-z0-9-]{10,}|ya29\.[A-Za-z0-9._-]{20,}/g;
|
|
146
271
|
/** Redact high-confidence secret shapes anywhere in a text/value, independent of any surrounding key. */
|
|
147
272
|
export function scrubKnownSecrets(text) {
|
|
148
273
|
return text.replace(KNOWN_SECRET, REDACTED_VALUE);
|
|
@@ -45,6 +45,12 @@
|
|
|
45
45
|
"hasCapabilities": {
|
|
46
46
|
"type": "boolean"
|
|
47
47
|
},
|
|
48
|
+
"captureBodies": {
|
|
49
|
+
"type": "boolean"
|
|
50
|
+
},
|
|
51
|
+
"sourceMapping": {
|
|
52
|
+
"type": "boolean"
|
|
53
|
+
},
|
|
48
54
|
"sdkVersion": {
|
|
49
55
|
"type": "string",
|
|
50
56
|
"maxLength": 128
|
|
@@ -175,6 +181,7 @@
|
|
|
175
181
|
"storage.change",
|
|
176
182
|
"page.health",
|
|
177
183
|
"context.opened",
|
|
184
|
+
"dialog.opened",
|
|
178
185
|
"render.commit",
|
|
179
186
|
"focus.change",
|
|
180
187
|
"flow.recorded",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@reticlehq/core/telemetry` — the analytics wire contract.
|
|
3
|
+
*
|
|
4
|
+
* The event kinds, their zod schemas, and the two payloads a PERSON writes (feedback + identity).
|
|
5
|
+
* Separate from the root entry point because this is a different wire from the browser↔bridge one:
|
|
6
|
+
* it goes to the capture endpoint, not to the agent. See docs/telemetry-contract.md.
|
|
7
|
+
*
|
|
8
|
+
* Every name below is ALSO exported from the root entry point, which stays as it was.
|
|
9
|
+
*/
|
|
10
|
+
export * from './telemetry.js';
|
|
11
|
+
export * from './no-session-reason.js';
|
|
12
|
+
export * from './telemetry-refusal.js';
|
|
13
|
+
export * from './telemetry-session.js';
|
|
14
|
+
export * from './telemetry-license.js';
|
|
15
|
+
export * from './telemetry-feedback.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@reticlehq/core/telemetry` — the analytics wire contract.
|
|
3
|
+
*
|
|
4
|
+
* The event kinds, their zod schemas, and the two payloads a PERSON writes (feedback + identity).
|
|
5
|
+
* Separate from the root entry point because this is a different wire from the browser↔bridge one:
|
|
6
|
+
* it goes to the capture endpoint, not to the agent. See docs/telemetry-contract.md.
|
|
7
|
+
*
|
|
8
|
+
* Every name below is ALSO exported from the root entry point, which stays as it was.
|
|
9
|
+
*/
|
|
10
|
+
export * from './telemetry.js';
|
|
11
|
+
export * from './no-session-reason.js';
|
|
12
|
+
export * from './telemetry-refusal.js';
|
|
13
|
+
export * from './telemetry-session.js';
|
|
14
|
+
export * from './telemetry-license.js';
|
|
15
|
+
export * from './telemetry-feedback.js';
|
|
@@ -240,9 +240,9 @@ export declare const FeedbackSchema: z.ZodObject<{
|
|
|
240
240
|
readonly PROJECT: "project";
|
|
241
241
|
}>>;
|
|
242
242
|
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
source: "agent" | "human";
|
|
243
244
|
text: string;
|
|
244
245
|
kind: "bug" | "gap" | "ambiguity" | "feature_request" | "improvement" | "experience";
|
|
245
|
-
source: "agent" | "human";
|
|
246
246
|
impact?: string | undefined;
|
|
247
247
|
trace?: string | undefined;
|
|
248
248
|
rating?: number | undefined;
|
|
@@ -258,9 +258,9 @@ export declare const FeedbackSchema: z.ZodObject<{
|
|
|
258
258
|
client?: string | undefined;
|
|
259
259
|
mcpScope?: "user" | "project" | undefined;
|
|
260
260
|
}, {
|
|
261
|
+
source: "agent" | "human";
|
|
261
262
|
text: string;
|
|
262
263
|
kind: "bug" | "gap" | "ambiguity" | "feature_request" | "improvement" | "experience";
|
|
263
|
-
source: "agent" | "human";
|
|
264
264
|
impact?: string | undefined;
|
|
265
265
|
trace?: string | undefined;
|
|
266
266
|
rating?: number | undefined;
|
|
@@ -566,7 +566,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
|
|
|
566
566
|
endedWithVerdict?: boolean | undefined;
|
|
567
567
|
updateNudged?: boolean | undefined;
|
|
568
568
|
updateOffered?: string | undefined;
|
|
569
|
-
exit?: "
|
|
569
|
+
exit?: "unknown" | "signal" | "idle" | undefined;
|
|
570
570
|
}, {
|
|
571
571
|
durationMs: number;
|
|
572
572
|
toolCalls: number;
|
|
@@ -631,7 +631,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
|
|
|
631
631
|
endedWithVerdict?: boolean | undefined;
|
|
632
632
|
updateNudged?: boolean | undefined;
|
|
633
633
|
updateOffered?: string | undefined;
|
|
634
|
-
exit?: "
|
|
634
|
+
exit?: "unknown" | "signal" | "idle" | undefined;
|
|
635
635
|
}>;
|
|
636
636
|
export type SessionSummary = z.infer<typeof SessionSummarySchema>;
|
|
637
637
|
/**
|