@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.
- package/dist/artifacts/artifacts-entry.d.ts +20 -0
- package/dist/artifacts/artifacts-entry.js +20 -0
- package/dist/artifacts/flow-composition.d.ts +30 -0
- package/dist/artifacts/flow-composition.js +19 -0
- package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +97 -3
- package/dist/{flow-constants.js → artifacts/flow-constants.js} +103 -4
- package/dist/artifacts/flow-mutation-target.d.ts +39 -0
- package/dist/artifacts/flow-mutation-target.js +89 -0
- package/dist/artifacts/flow-order.d.ts +30 -0
- package/dist/artifacts/flow-order.js +49 -0
- package/dist/artifacts/flow-select.d.ts +56 -0
- package/dist/artifacts/flow-select.js +56 -0
- package/dist/artifacts/flow-step-tool.d.ts +31 -0
- package/dist/artifacts/flow-step-tool.js +31 -0
- package/dist/artifacts/flow-types.d.ts +3736 -0
- package/dist/artifacts/flow-types.js +463 -0
- package/dist/artifacts/flow-unreached.d.ts +12 -0
- package/dist/artifacts/flow-unreached.js +24 -0
- package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +7 -3
- package/dist/{impact-savings.js → artifacts/impact-savings.js} +27 -4
- package/dist/{impact.d.ts → artifacts/impact.d.ts} +122 -54
- package/dist/{impact.js → artifacts/impact.js} +30 -0
- package/dist/{journal.d.ts → artifacts/journal.d.ts} +50 -6
- package/dist/{journal.js → artifacts/journal.js} +38 -2
- package/dist/artifacts/step-effect.d.ts +29 -0
- package/dist/artifacts/step-effect.js +28 -0
- package/dist/hooks/hook-events.d.ts +311 -0
- package/dist/hooks/hook-events.js +127 -0
- package/dist/hooks/hooks-entry.d.ts +9 -0
- package/dist/hooks/hooks-entry.js +9 -0
- package/dist/{brand.d.ts → identity/brand.d.ts} +7 -0
- package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
- package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
- package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
- package/dist/{document-identity.js → identity/document-identity.js} +4 -5
- package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
- package/dist/{source-constants.js → identity/source-constants.js} +4 -4
- package/dist/index.d.ts +69 -42
- package/dist/index.js +78 -44
- package/dist/onboarding.d.ts +114 -0
- package/dist/onboarding.js +141 -0
- package/dist/realm/registry.d.ts +212 -0
- package/dist/realm/registry.js +302 -0
- package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +4 -5
- package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
- package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
- package/dist/{project-registry.js → registry/project-registry.js} +5 -5
- package/dist/schema/command-name.json +31 -0
- package/dist/schema/event-message.json +1 -0
- package/dist/schema/event-payloads.json +791 -0
- package/dist/schema/event-type.json +1 -0
- package/dist/schema/hello-message.json +76 -2
- package/dist/schema/reticle-event.json +1 -0
- package/dist/schema/reticle-message.json +77 -2
- package/dist/telemetry-entry.d.ts +15 -0
- package/dist/telemetry-entry.js +15 -0
- package/dist/telemetry-feedback.d.ts +13 -14
- package/dist/telemetry-feedback.js +11 -12
- package/dist/telemetry-license.d.ts +1 -1
- package/dist/telemetry-license.js +1 -1
- package/dist/telemetry-refusal.d.ts +11 -11
- package/dist/telemetry-refusal.js +7 -8
- package/dist/telemetry-session.d.ts +49 -57
- package/dist/telemetry-session.js +47 -55
- package/dist/telemetry.d.ts +229 -198
- package/dist/telemetry.js +83 -98
- package/dist/tour-entry.d.ts +10 -0
- package/dist/tour-entry.js +10 -0
- package/dist/tour.d.ts +125 -0
- package/dist/tour.js +165 -0
- package/dist/{consequence.d.ts → verdict/consequence.d.ts} +35 -11
- package/dist/{consequence.js → verdict/consequence.js} +9 -22
- package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
- package/dist/{findings.d.ts → verdict/findings.d.ts} +149 -41
- package/dist/{findings.js → verdict/findings.js} +169 -48
- package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +22 -14
- package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +23 -15
- package/dist/{intent.d.ts → verdict/intent.d.ts} +41 -52
- package/dist/{intent.js → verdict/intent.js} +11 -22
- package/dist/verdict/revision.d.ts +44 -0
- package/dist/verdict/revision.js +53 -0
- package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
- package/dist/{run-context.js → verdict/run-context.js} +15 -36
- package/dist/{security.js → verdict/security.js} +12 -21
- package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +369 -93
- package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
- package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +36 -13
- package/dist/{verified-constants.js → verdict/verified-constants.js} +36 -13
- package/dist/verdict/verify-progress.d.ts +129 -0
- package/dist/verdict/verify-progress.js +74 -0
- package/dist/wire/channel.d.ts +46 -0
- package/dist/wire/channel.js +95 -0
- package/dist/{constants.d.ts → wire/constants/constants.d.ts} +124 -28
- package/dist/{constants.js → wire/constants/constants.js} +137 -28
- package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +9 -2
- package/dist/{session-constants.js → wire/constants/session-constants.js} +9 -2
- package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
- package/dist/{event-classification.js → wire/event-classification.js} +1 -1
- package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +229 -17
- package/dist/{event-payloads.js → wire/event-payloads.js} +61 -3
- package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
- package/dist/{event-priority.js → wire/event-priority.js} +2 -5
- package/dist/wire/global-press.d.ts +30 -0
- package/dist/wire/global-press.js +54 -0
- package/dist/{messages.d.ts → wire/messages.d.ts} +290 -38
- package/dist/{messages.js → wire/messages.js} +93 -5
- package/dist/wire/narrow.d.ts +39 -0
- package/dist/wire/narrow.js +45 -0
- package/dist/{net.d.ts → wire/net.d.ts} +49 -10
- package/dist/{net.js → wire/net.js} +49 -10
- package/dist/wire/platform.d.ts +37 -0
- package/dist/wire/platform.js +36 -0
- package/dist/{redaction.d.ts → wire/redaction.d.ts} +30 -0
- package/dist/wire/redaction.js +274 -0
- package/dist/wire/tool-names.d.ts +133 -0
- package/dist/wire/tool-names.js +142 -0
- package/dist/{toon.js → wire/toon.js} +1 -1
- package/dist/{types.d.ts → wire/types.d.ts} +106 -66
- package/dist/{types.js → wire/types.js} +24 -4
- package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
- package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
- package/dist/{notices.d.ts → words/notices.d.ts} +24 -12
- package/dist/{notices.js → words/notices.js} +27 -12
- package/package.json +22 -5
- package/dist/flow-types.d.ts +0 -1473
- package/dist/flow-types.js +0 -195
- package/dist/redaction.js +0 -149
- /package/dist/{brand.js → identity/brand.js} +0 -0
- /package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
- /package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
- /package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
- /package/dist/{project-id.js → identity/project-id.js} +0 -0
- /package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
- /package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
- /package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
- /package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
- /package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
- /package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
- /package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
- /package/dist/{state-select.js → wire/state-select.js} +0 -0
- /package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
- /package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
- /package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
- /package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
- /package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
- /package/dist/{upgrade.d.ts → words/upgrade.d.ts} +0 -0
- /package/dist/{upgrade.js → words/upgrade.js} +0 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { REDACTED_VALUE } from './constants/constants.js';
|
|
2
|
+
import { URL_RAW } from './net.js';
|
|
3
|
+
/**
|
|
4
|
+
* Wire redaction rules — which field names carry credentials, and which VALUE shapes are secrets
|
|
5
|
+
* regardless of the field they sit in.
|
|
6
|
+
*
|
|
7
|
+
* These live in core because they are a property of the wire, not of one side of it: the browser
|
|
8
|
+
* SDK and the driven path (which captures request bodies raw off the network stack) both redact
|
|
9
|
+
* with them, and a security regex is the worst possible place to have two copies drift.
|
|
10
|
+
*/
|
|
11
|
+
// `pass[-_]?phrase` is the fourth spelling of the first three. There is no benign field called
|
|
12
|
+
// `passphrase`: it is what an SSH key, a keystore, an encrypted backup and a wallet all call their
|
|
13
|
+
// secret, so it is a gap rather than a judgement call.
|
|
14
|
+
//
|
|
15
|
+
// The one-time codes are the second family. They expire, which is what makes them easy to wave
|
|
16
|
+
// away, but the window in which one is useful is the window in which a drive is running, and the
|
|
17
|
+
// journal is written to disk and read back later. `(otp|totp|mfa|recovery|backup)[-_]?codes?`
|
|
18
|
+
// carries the camelCase spellings too, since `[-_]?` is optional and the rule is case-insensitive.
|
|
19
|
+
// Bare `otp`/`totp` are boundary-anchored: unanchored they fire inside ordinary words.
|
|
20
|
+
// `code` on its own is deliberately NOT here — `statusCode`, `postcode`, `couponCode` and
|
|
21
|
+
// `countryCode` are ordinary app data an agent needs in order to reach a verdict.
|
|
22
|
+
//
|
|
23
|
+
// `token` must match auth CREDENTIALS, not compound design fields. Bare/separated `token(s)` and
|
|
24
|
+
// auth-prefixed tokens (accessToken, auth_token, sessionToken, …) are redacted; `colorToken`,
|
|
25
|
+
// `backgroundToken`, `tokenCount`, `designToken` are NOT — redacting those blinds
|
|
26
|
+
// reticle_inspect/reticle_state to legitimate app data. `cookie` is boundary-anchored the same way: it targets the `Cookie` / `Set-Cookie` HTTP HEADER names (which
|
|
27
|
+
// bundle the session credential and were the one wire payload reaching the journal + the agent
|
|
28
|
+
// unredacted), NOT any key that merely contains the substring — `scopecookie`, `cookieConsent`,
|
|
29
|
+
// `cookiePolicy` are legitimate app values an agent may need to read, and stay visible.
|
|
30
|
+
// Bare `card` and `pan` are boundary-anchored for the same reason. Without them a checkout POST
|
|
31
|
+
// reaches the agent as `{"planId":"team","card":"4111111111111111"}` — `credit_card` and
|
|
32
|
+
// `card_number` are not the only spellings, and `card` is what Stripe's own object calls it. The
|
|
33
|
+
// anchors keep `discard`, `cardinality` and `panel` visible.
|
|
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|num|no|pan)(?=$|[-_])|(?:^|[-_])(?:card|pan)(?=$|[-_])|cvv|cvc|ssn|(?:^|[-_])(?:signature|sig)$|(?:^|[-_])credential$|x-(?:amz|goog)-(?:signature|credential|security-token)$/i;
|
|
35
|
+
/**
|
|
36
|
+
* The built-in rule, always available and never configurable.
|
|
37
|
+
*
|
|
38
|
+
* Separate from `isSensitiveKey` on purpose: the driven path needs a floor that no page-supplied
|
|
39
|
+
* config can lower, and the conformance test needs something to compare an unconfigured policy
|
|
40
|
+
* against. Every existing caller wants `isSensitiveKey`.
|
|
41
|
+
*/
|
|
42
|
+
export function defaultIsSensitiveKey(key) {
|
|
43
|
+
return SENSITIVE_KEY.test(key);
|
|
44
|
+
}
|
|
45
|
+
function normalizeNames(values) {
|
|
46
|
+
const out = new Set();
|
|
47
|
+
for (const value of values ?? []) {
|
|
48
|
+
const trimmed = value.trim().toLowerCase();
|
|
49
|
+
if (trimmed.length > 0)
|
|
50
|
+
out.add(trimmed);
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolve a config into a rule.
|
|
56
|
+
*
|
|
57
|
+
* `onWarn` fires ONCE here, at build time, rather than per key: the check runs on every serialized
|
|
58
|
+
* key of every event, so a per-key warning would flood the console of the app it is trying to help.
|
|
59
|
+
*/
|
|
60
|
+
export function buildRedactionPolicy(config, onWarn) {
|
|
61
|
+
const literalKeys = normalizeNames(config?.keys?.filter((k) => 'string' === typeof k));
|
|
62
|
+
const patterns = (config?.keys ?? []).filter((k) => k instanceof RegExp);
|
|
63
|
+
const allowed = normalizeNames(config?.allow);
|
|
64
|
+
// Exempting a key the default rule calls a credential is a deliberate choice with a real blast
|
|
65
|
+
// radius: that value now reaches the agent transcript and the on-disk journal. Say it once, name
|
|
66
|
+
// the keys, and say nothing about the ordinary case — an exemption for a key the rule never
|
|
67
|
+
// matched is the false-positive fix this option exists for, and warning about it would train
|
|
68
|
+
// people to ignore the warning that matters.
|
|
69
|
+
const exemptedCredentials = [...allowed].filter((key) => defaultIsSensitiveKey(key) && !literalKeys.has(key));
|
|
70
|
+
if (exemptedCredentials.length > 0 && onWarn !== undefined) {
|
|
71
|
+
onWarn(`[reticle] redact.allow is exempting ${exemptedCredentials.join(', ')} from redaction. The ` +
|
|
72
|
+
`default rule treats ${1 === exemptedCredentials.length ? 'that key' : 'those keys'} as a ` +
|
|
73
|
+
`credential, so ${1 === exemptedCredentials.length ? 'its value' : 'their values'} will now ` +
|
|
74
|
+
`reach the agent transcript and the on-disk journal in cleartext.`);
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
isSensitiveKey: (key) => {
|
|
78
|
+
const normalized = key.toLowerCase();
|
|
79
|
+
if (literalKeys.has(normalized))
|
|
80
|
+
return true;
|
|
81
|
+
for (const pattern of patterns) {
|
|
82
|
+
// `test` on a /g regex advances lastIndex between calls, so the same key alternates
|
|
83
|
+
// true/false. Reset it rather than trusting every caller to omit the flag.
|
|
84
|
+
pattern.lastIndex = 0;
|
|
85
|
+
if (pattern.test(key))
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
if (allowed.has(normalized))
|
|
89
|
+
return false;
|
|
90
|
+
return defaultIsSensitiveKey(key);
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The rule in force for THIS process.
|
|
96
|
+
*
|
|
97
|
+
* Ambient rather than threaded through the ~10 call sites that redact, so configuring it changes
|
|
98
|
+
* every one of them at once and adding a new one cannot accidentally opt out. Set by `connect()` in
|
|
99
|
+
* the browser, where one page means one config.
|
|
100
|
+
*
|
|
101
|
+
* The server deliberately does NOT set this. A daemon serves many sessions in one process, so an
|
|
102
|
+
* ambient policy there would let one app's config decide another app's redaction; the driven path
|
|
103
|
+
* holds its own policy per daemon instead, built only from what sessions declared as EXTRA keys.
|
|
104
|
+
*/
|
|
105
|
+
let activePolicy;
|
|
106
|
+
export function setActiveRedactionPolicy(policy) {
|
|
107
|
+
activePolicy = policy;
|
|
108
|
+
}
|
|
109
|
+
export function resetActiveRedactionPolicy() {
|
|
110
|
+
activePolicy = undefined;
|
|
111
|
+
}
|
|
112
|
+
/** Whether a key carries a credential, under the policy in force. */
|
|
113
|
+
export function isSensitiveKey(key) {
|
|
114
|
+
return activePolicy === undefined ? defaultIsSensitiveKey(key) : activePolicy.isSensitiveKey(key);
|
|
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
|
+
}
|
|
212
|
+
/** Cap on how many declared keys travel in a hello — a bound, not a limit anyone should reach. */
|
|
213
|
+
export const MAX_WIRE_REDACT_KEYS = 64;
|
|
214
|
+
/** Cap on one declared key's length, so a hello cannot be inflated by a pathological name. */
|
|
215
|
+
export const MAX_WIRE_REDACT_KEY_LENGTH = 128;
|
|
216
|
+
/**
|
|
217
|
+
* The part of a config that may cross the bridge, so the server redacts an app's own credentials on
|
|
218
|
+
* the driven path too — where request bodies are captured raw from the network stack and never pass
|
|
219
|
+
* through the SDK at all.
|
|
220
|
+
*
|
|
221
|
+
* Two deliberate exclusions, and both are the safe direction of the asymmetry:
|
|
222
|
+
*
|
|
223
|
+
* - **RegExp entries do not travel.** Compiling a pattern that arrived over a socket and running it
|
|
224
|
+
* against every key of every request body is a ReDoS surface handed to whatever is on the page.
|
|
225
|
+
* A dropped pattern means the driven path over-redacts relative to the config, never under.
|
|
226
|
+
* - **`allow` never travels.** It is the only part of the config that REMOVES redaction, so a page
|
|
227
|
+
* able to send it could quietly un-redact `password` in the daemon's journal for every session.
|
|
228
|
+
* The driven path keeps the default floor.
|
|
229
|
+
*
|
|
230
|
+
* Both limitations are documented for users in docs/usage.md ("Extending the redaction rules").
|
|
231
|
+
*/
|
|
232
|
+
export function wireRedactionKeys(config) {
|
|
233
|
+
const seen = new Set();
|
|
234
|
+
const out = [];
|
|
235
|
+
for (const key of config?.keys ?? []) {
|
|
236
|
+
if (typeof key !== 'string')
|
|
237
|
+
continue;
|
|
238
|
+
const trimmed = key.trim();
|
|
239
|
+
if (0 === trimmed.length || trimmed.length > MAX_WIRE_REDACT_KEY_LENGTH)
|
|
240
|
+
continue;
|
|
241
|
+
const normalized = trimmed.toLowerCase();
|
|
242
|
+
if (seen.has(normalized))
|
|
243
|
+
continue;
|
|
244
|
+
seen.add(normalized);
|
|
245
|
+
out.push(trimmed);
|
|
246
|
+
if (out.length >= MAX_WIRE_REDACT_KEYS)
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
return out;
|
|
250
|
+
}
|
|
251
|
+
// High-confidence credential SHAPES, redacted regardless of key name — for scanning body/value text where
|
|
252
|
+
// a secret can sit under a benign key (`{"note":"<jwt>"}`, `<meta content="sk_live_…">`). Deliberately
|
|
253
|
+
// narrow (JWT, known provider prefixes) so it never corrupts legitimate prose the way a broad
|
|
254
|
+
// entropy/length heuristic would.
|
|
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;
|
|
271
|
+
/** Redact high-confidence secret shapes anywhere in a text/value, independent of any surrounding key. */
|
|
272
|
+
export function scrubKnownSecrets(text) {
|
|
273
|
+
return text.replace(KNOWN_SECRET, REDACTED_VALUE);
|
|
274
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The names an agent calls Reticle by.
|
|
3
|
+
*
|
|
4
|
+
* Wire strings, and this package is where wire strings live: a name here crosses the boundary between
|
|
5
|
+
* an agent and the daemon exactly as an event type crosses the one between the page and the bridge.
|
|
6
|
+
* It sat under the server's tool directory because that is where the handlers are, and the result was
|
|
7
|
+
* that every feature wanting to name a tool -- flows naming the steps it replays, crawl, runs -- had
|
|
8
|
+
* to import from the tool surface to get at a string. Thirty-three of those imports were this one
|
|
9
|
+
* table.
|
|
10
|
+
*
|
|
11
|
+
* MCP tool names exposed to the coding agent. No free strings. The three that appear in a persisted
|
|
12
|
+
* flow (ACT / ACT_SEQUENCE / ACT_AND_WAIT) come from core's FlowStepTool — one source shared with the
|
|
13
|
+
* browser recorder and the flow schema, so a rename can't desync the recorder from the replayer. */
|
|
14
|
+
export declare const ReticleTool: {
|
|
15
|
+
readonly SESSIONS: "reticle_sessions";
|
|
16
|
+
/**
|
|
17
|
+
* The merged read family — snapshot/query/inspect/state under one name, on the `merged` surface.
|
|
18
|
+
*
|
|
19
|
+
* A name of its own rather than reusing `reticle_snapshot`, because the merged tool answers four
|
|
20
|
+
* different questions and calling it "snapshot" would make three of them undiscoverable.
|
|
21
|
+
*/
|
|
22
|
+
readonly LOOK: "reticle_look";
|
|
23
|
+
readonly SNAPSHOT: "reticle_snapshot";
|
|
24
|
+
readonly QUERY: "reticle_query";
|
|
25
|
+
readonly INSPECT: "reticle_inspect";
|
|
26
|
+
readonly ACT: "reticle_act";
|
|
27
|
+
readonly ACT_SEQUENCE: "reticle_act_sequence";
|
|
28
|
+
readonly ACT_AND_WAIT: "reticle_act_and_wait";
|
|
29
|
+
readonly OBSERVE: "reticle_observe";
|
|
30
|
+
readonly LINEAGE: "reticle_lineage";
|
|
31
|
+
readonly WAIT_FOR: "reticle_wait_for";
|
|
32
|
+
readonly NETWORK: "reticle_network";
|
|
33
|
+
readonly CONSOLE: "reticle_console";
|
|
34
|
+
readonly ANIMATIONS: "reticle_animations";
|
|
35
|
+
readonly ASSERT: "reticle_assert";
|
|
36
|
+
readonly RECONCILE: "reticle_reconcile";
|
|
37
|
+
readonly BASELINE_SAVE: "reticle_baseline_save";
|
|
38
|
+
readonly BASELINE_LIST: "reticle_baseline_list";
|
|
39
|
+
readonly DIFF: "reticle_diff";
|
|
40
|
+
readonly RECORD_START: "reticle_record_start";
|
|
41
|
+
readonly RECORD_STOP: "reticle_record_stop";
|
|
42
|
+
readonly REPLAY: "reticle_replay";
|
|
43
|
+
readonly EXPLORE: "reticle_explore";
|
|
44
|
+
readonly NARRATE: "reticle_narrate";
|
|
45
|
+
readonly CLOCK: "reticle_clock";
|
|
46
|
+
readonly STATE: "reticle_state";
|
|
47
|
+
readonly STORAGE: "reticle_storage";
|
|
48
|
+
readonly CAPABILITIES: "reticle_capabilities";
|
|
49
|
+
readonly CONTRACT_SAVE: "reticle_contract_save";
|
|
50
|
+
readonly DOMAIN: "reticle_domain";
|
|
51
|
+
readonly FLOW_SAVE: "reticle_flow_save";
|
|
52
|
+
readonly FLOW_LIST: "reticle_flow_list";
|
|
53
|
+
readonly FLOW_LOAD: "reticle_flow_load";
|
|
54
|
+
readonly FLOW_DELETE: "reticle_flow_delete";
|
|
55
|
+
readonly FLOW_REPLAY: "reticle_flow_replay";
|
|
56
|
+
/** replay EVERY saved flow → one consolidated suite verdict + prioritized fixes (the loop closer). */
|
|
57
|
+
readonly FLOW_VERIFY: "reticle_flow_verify";
|
|
58
|
+
/** persist the human-recorded flow from the live tab. */
|
|
59
|
+
readonly FLOW_SAVE_RECORDED: "reticle_flow_save_recorded";
|
|
60
|
+
/** propose (+ opt-in apply) a nearest-match rebind for a drifted flow. */
|
|
61
|
+
readonly FLOW_HEAL: "reticle_flow_heal";
|
|
62
|
+
/** Does this flow notice when the thing it depends on breaks? See flow-mutate-tools.ts. */
|
|
63
|
+
readonly FLOW_MUTATE: "reticle_flow_mutate";
|
|
64
|
+
/** structured annotation → compiles into the recording's expect/dynamic/success. */
|
|
65
|
+
readonly ANNOTATE: "reticle_annotate";
|
|
66
|
+
readonly AFFECTED: "reticle_affected";
|
|
67
|
+
readonly COVERAGE: "reticle_coverage";
|
|
68
|
+
readonly VERIFY_CHANGE: "reticle_verify_change";
|
|
69
|
+
/** drive the app with a model and SAVE what it drove, for a project with nothing to replay yet. */
|
|
70
|
+
readonly VERIFY_EXPLORE: "reticle_verify_explore";
|
|
71
|
+
/** Merged: change/flows/affected/coverage/crawl — "what is proved, and what is not". */
|
|
72
|
+
readonly INTENT: "reticle_intent";
|
|
73
|
+
/** what THIS run has established, proved, and not yet discharged — pulled when memory is gone. */
|
|
74
|
+
readonly CONTEXT: "reticle_context";
|
|
75
|
+
readonly VERIFY: "reticle_verify";
|
|
76
|
+
/** read cross-run history (.reticle/project.json) + diff-vs-last for a name. */
|
|
77
|
+
readonly PROJECT: "reticle_project";
|
|
78
|
+
/** The team's shared memory, read on demand — see memory/memory-tools.ts. */
|
|
79
|
+
readonly MEMORY: "reticle_memory";
|
|
80
|
+
/** explicitly record a run outcome (the manual companion to auto-recording). */
|
|
81
|
+
readonly RUN_RECORD: "reticle_run_record";
|
|
82
|
+
/** capture a pixel screenshot (CDP/driven browser) →.reticle/visual/<name>.png. */
|
|
83
|
+
readonly SCREENSHOT: "reticle_screenshot";
|
|
84
|
+
/** stub/intercept network on the driven page (500, offline, delay) for error/edge-state testing. */
|
|
85
|
+
readonly NETWORK_MOCK: "reticle_network_mock";
|
|
86
|
+
/** pin the driven page's viewport to fixed pixels for reproducible visual baselines. */
|
|
87
|
+
readonly VIEWPORT: "reticle_viewport";
|
|
88
|
+
/** perceptual-diff the live page against a saved visual baseline. */
|
|
89
|
+
readonly VISUAL_DIFF: "reticle_visual_diff";
|
|
90
|
+
/** autonomously click every reachable control + report anomalies (no script). */
|
|
91
|
+
readonly CRAWL: "reticle_crawl";
|
|
92
|
+
/** scroll a virtualized list until a queried row mounts, then return it. */
|
|
93
|
+
readonly SCROLL_TO: "reticle_scroll_to";
|
|
94
|
+
/** Session lifecycle: tune the presenter session (e.g. idle-end window) for the app's needs.
|
|
95
|
+
* Member of the consolidated reticle_session {action:"tune"} — no longer advertised alone. */
|
|
96
|
+
readonly SESSION_TUNE: "reticle_session_tune";
|
|
97
|
+
/** Live-control: end the session (→ ended + push PRESENTER). Handlers live in the tools facet. */
|
|
98
|
+
readonly END_SESSION: "reticle_end_session";
|
|
99
|
+
/** Live-control: hand the session back to the human between turns (→ waiting/ask, revivable). */
|
|
100
|
+
readonly YIELD: "reticle_yield";
|
|
101
|
+
/** Live-control: clear a pause (→ active). */
|
|
102
|
+
readonly RESUME: "reticle_resume";
|
|
103
|
+
/** Live-control: drain the human→agent inbox (explicit poll). */
|
|
104
|
+
readonly MESSAGES: "reticle_messages";
|
|
105
|
+
/** Human review: list the mistakes the human pinned to elements, and resolve them once fixed. */
|
|
106
|
+
readonly REVIEW: "reticle_review";
|
|
107
|
+
/** First-run readiness: block briefly until the app's SDK connects (smooths the init→connect race). */
|
|
108
|
+
readonly WAIT_READY: "reticle_wait_ready";
|
|
109
|
+
/** Navigate the connected browser tab to a URL. */
|
|
110
|
+
readonly NAVIGATE: "reticle_navigate";
|
|
111
|
+
/** Reload the connected browser tab (soft or hard). */
|
|
112
|
+
readonly REFRESH: "reticle_refresh";
|
|
113
|
+
/** Export a verification-run artifact (.reticle/runs/<id>.json) — the OEM/CI-consumable verdict. */
|
|
114
|
+
readonly RUN_EXPORT: "reticle_run_export";
|
|
115
|
+
/** Consolidated families — one action-dispatched tool per family; members below stay
|
|
116
|
+
* defined (handlers intact) but are no longer advertised separately. */
|
|
117
|
+
readonly BASELINE: "reticle_baseline";
|
|
118
|
+
readonly SESSION: "reticle_session";
|
|
119
|
+
readonly RECORD: "reticle_record";
|
|
120
|
+
readonly FLOW: "reticle_flow";
|
|
121
|
+
readonly LEASE: "reticle_lease";
|
|
122
|
+
/** Lease a fresh isolated headless context from the shared browser pool (one per flow). */
|
|
123
|
+
readonly LEASE_ACQUIRE: "reticle_lease_acquire";
|
|
124
|
+
/** Release a previously leased context, freeing the pool slot. */
|
|
125
|
+
readonly LEASE_RELEASE: "reticle_lease_release";
|
|
126
|
+
/** Meta: discover tool definitions on demand instead of paying for all of them every turn. */
|
|
127
|
+
readonly TOOLS: "reticle_tools";
|
|
128
|
+
/** Meta: invoke any tool by name — the escape hatch that keeps a trimmed profile a trim, not a removal. */
|
|
129
|
+
readonly RUN: "reticle_run";
|
|
130
|
+
/** Report that Reticle itself failed — the agent's only way to tell us what to fix. */
|
|
131
|
+
readonly FEEDBACK: "reticle_feedback";
|
|
132
|
+
};
|
|
133
|
+
export type ReticleTool = (typeof ReticleTool)[keyof typeof ReticleTool];
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* From the LEAF, not from `flow-types`.
|
|
3
|
+
*
|
|
4
|
+
* Every file in the browser SDK imports `ReticleTool` from here. `flow-types` builds eleven zod
|
|
5
|
+
* schemas at module scope, so importing one constant through it loaded all of them into every page
|
|
6
|
+
* Reticle instruments — and a browser never validates a flow FILE. Measured: the schemas were
|
|
7
|
+
* reachable from the SDK entry, and three separate additions to them moved the first-load ceiling
|
|
8
|
+
* in a single week.
|
|
9
|
+
*/
|
|
10
|
+
import { FlowStepTool } from '../artifacts/flow-step-tool.js';
|
|
11
|
+
/**
|
|
12
|
+
* The names an agent calls Reticle by.
|
|
13
|
+
*
|
|
14
|
+
* Wire strings, and this package is where wire strings live: a name here crosses the boundary between
|
|
15
|
+
* an agent and the daemon exactly as an event type crosses the one between the page and the bridge.
|
|
16
|
+
* It sat under the server's tool directory because that is where the handlers are, and the result was
|
|
17
|
+
* that every feature wanting to name a tool -- flows naming the steps it replays, crawl, runs -- had
|
|
18
|
+
* to import from the tool surface to get at a string. Thirty-three of those imports were this one
|
|
19
|
+
* table.
|
|
20
|
+
*
|
|
21
|
+
* MCP tool names exposed to the coding agent. No free strings. The three that appear in a persisted
|
|
22
|
+
* flow (ACT / ACT_SEQUENCE / ACT_AND_WAIT) come from core's FlowStepTool — one source shared with the
|
|
23
|
+
* browser recorder and the flow schema, so a rename can't desync the recorder from the replayer. */
|
|
24
|
+
export const ReticleTool = {
|
|
25
|
+
SESSIONS: 'reticle_sessions',
|
|
26
|
+
/**
|
|
27
|
+
* The merged read family — snapshot/query/inspect/state under one name, on the `merged` surface.
|
|
28
|
+
*
|
|
29
|
+
* A name of its own rather than reusing `reticle_snapshot`, because the merged tool answers four
|
|
30
|
+
* different questions and calling it "snapshot" would make three of them undiscoverable.
|
|
31
|
+
*/
|
|
32
|
+
LOOK: 'reticle_look',
|
|
33
|
+
SNAPSHOT: 'reticle_snapshot',
|
|
34
|
+
QUERY: 'reticle_query',
|
|
35
|
+
INSPECT: 'reticle_inspect',
|
|
36
|
+
ACT: FlowStepTool.ACT,
|
|
37
|
+
ACT_SEQUENCE: FlowStepTool.ACT_SEQUENCE,
|
|
38
|
+
ACT_AND_WAIT: FlowStepTool.ACT_AND_WAIT,
|
|
39
|
+
OBSERVE: 'reticle_observe',
|
|
40
|
+
LINEAGE: 'reticle_lineage',
|
|
41
|
+
WAIT_FOR: 'reticle_wait_for',
|
|
42
|
+
NETWORK: 'reticle_network',
|
|
43
|
+
CONSOLE: 'reticle_console',
|
|
44
|
+
ANIMATIONS: 'reticle_animations',
|
|
45
|
+
ASSERT: 'reticle_assert',
|
|
46
|
+
RECONCILE: 'reticle_reconcile',
|
|
47
|
+
BASELINE_SAVE: 'reticle_baseline_save',
|
|
48
|
+
BASELINE_LIST: 'reticle_baseline_list',
|
|
49
|
+
DIFF: 'reticle_diff',
|
|
50
|
+
RECORD_START: 'reticle_record_start',
|
|
51
|
+
RECORD_STOP: 'reticle_record_stop',
|
|
52
|
+
REPLAY: 'reticle_replay',
|
|
53
|
+
EXPLORE: 'reticle_explore',
|
|
54
|
+
NARRATE: 'reticle_narrate',
|
|
55
|
+
CLOCK: 'reticle_clock',
|
|
56
|
+
STATE: 'reticle_state',
|
|
57
|
+
STORAGE: 'reticle_storage',
|
|
58
|
+
CAPABILITIES: 'reticle_capabilities',
|
|
59
|
+
CONTRACT_SAVE: 'reticle_contract_save',
|
|
60
|
+
DOMAIN: 'reticle_domain',
|
|
61
|
+
FLOW_SAVE: 'reticle_flow_save',
|
|
62
|
+
FLOW_LIST: 'reticle_flow_list',
|
|
63
|
+
FLOW_LOAD: 'reticle_flow_load',
|
|
64
|
+
FLOW_DELETE: 'reticle_flow_delete',
|
|
65
|
+
FLOW_REPLAY: 'reticle_flow_replay',
|
|
66
|
+
/** replay EVERY saved flow → one consolidated suite verdict + prioritized fixes (the loop closer). */
|
|
67
|
+
FLOW_VERIFY: 'reticle_flow_verify',
|
|
68
|
+
/** persist the human-recorded flow from the live tab. */
|
|
69
|
+
FLOW_SAVE_RECORDED: 'reticle_flow_save_recorded',
|
|
70
|
+
/** propose (+ opt-in apply) a nearest-match rebind for a drifted flow. */
|
|
71
|
+
FLOW_HEAL: 'reticle_flow_heal',
|
|
72
|
+
/** Does this flow notice when the thing it depends on breaks? See flow-mutate-tools.ts. */
|
|
73
|
+
FLOW_MUTATE: 'reticle_flow_mutate',
|
|
74
|
+
/** structured annotation → compiles into the recording's expect/dynamic/success. */
|
|
75
|
+
ANNOTATE: 'reticle_annotate',
|
|
76
|
+
AFFECTED: 'reticle_affected',
|
|
77
|
+
COVERAGE: 'reticle_coverage',
|
|
78
|
+
VERIFY_CHANGE: 'reticle_verify_change',
|
|
79
|
+
/** drive the app with a model and SAVE what it drove, for a project with nothing to replay yet. */
|
|
80
|
+
VERIFY_EXPLORE: 'reticle_verify_explore',
|
|
81
|
+
/** Merged: change/flows/affected/coverage/crawl — "what is proved, and what is not". */
|
|
82
|
+
INTENT: 'reticle_intent',
|
|
83
|
+
/** what THIS run has established, proved, and not yet discharged — pulled when memory is gone. */
|
|
84
|
+
CONTEXT: 'reticle_context',
|
|
85
|
+
VERIFY: 'reticle_verify',
|
|
86
|
+
/** read cross-run history (.reticle/project.json) + diff-vs-last for a name. */
|
|
87
|
+
PROJECT: 'reticle_project',
|
|
88
|
+
/** The team's shared memory, read on demand — see memory/memory-tools.ts. */
|
|
89
|
+
MEMORY: 'reticle_memory',
|
|
90
|
+
/** explicitly record a run outcome (the manual companion to auto-recording). */
|
|
91
|
+
RUN_RECORD: 'reticle_run_record',
|
|
92
|
+
/** capture a pixel screenshot (CDP/driven browser) →.reticle/visual/<name>.png. */
|
|
93
|
+
SCREENSHOT: 'reticle_screenshot',
|
|
94
|
+
/** stub/intercept network on the driven page (500, offline, delay) for error/edge-state testing. */
|
|
95
|
+
NETWORK_MOCK: 'reticle_network_mock',
|
|
96
|
+
/** pin the driven page's viewport to fixed pixels for reproducible visual baselines. */
|
|
97
|
+
VIEWPORT: 'reticle_viewport',
|
|
98
|
+
/** perceptual-diff the live page against a saved visual baseline. */
|
|
99
|
+
VISUAL_DIFF: 'reticle_visual_diff',
|
|
100
|
+
/** autonomously click every reachable control + report anomalies (no script). */
|
|
101
|
+
CRAWL: 'reticle_crawl',
|
|
102
|
+
/** scroll a virtualized list until a queried row mounts, then return it. */
|
|
103
|
+
SCROLL_TO: 'reticle_scroll_to',
|
|
104
|
+
/** Session lifecycle: tune the presenter session (e.g. idle-end window) for the app's needs.
|
|
105
|
+
* Member of the consolidated reticle_session {action:"tune"} — no longer advertised alone. */
|
|
106
|
+
SESSION_TUNE: 'reticle_session_tune',
|
|
107
|
+
/** Live-control: end the session (→ ended + push PRESENTER). Handlers live in the tools facet. */
|
|
108
|
+
END_SESSION: 'reticle_end_session',
|
|
109
|
+
/** Live-control: hand the session back to the human between turns (→ waiting/ask, revivable). */
|
|
110
|
+
YIELD: 'reticle_yield',
|
|
111
|
+
/** Live-control: clear a pause (→ active). */
|
|
112
|
+
RESUME: 'reticle_resume',
|
|
113
|
+
/** Live-control: drain the human→agent inbox (explicit poll). */
|
|
114
|
+
MESSAGES: 'reticle_messages',
|
|
115
|
+
/** Human review: list the mistakes the human pinned to elements, and resolve them once fixed. */
|
|
116
|
+
REVIEW: 'reticle_review',
|
|
117
|
+
/** First-run readiness: block briefly until the app's SDK connects (smooths the init→connect race). */
|
|
118
|
+
WAIT_READY: 'reticle_wait_ready',
|
|
119
|
+
/** Navigate the connected browser tab to a URL. */
|
|
120
|
+
NAVIGATE: 'reticle_navigate',
|
|
121
|
+
/** Reload the connected browser tab (soft or hard). */
|
|
122
|
+
REFRESH: 'reticle_refresh',
|
|
123
|
+
/** Export a verification-run artifact (.reticle/runs/<id>.json) — the OEM/CI-consumable verdict. */
|
|
124
|
+
RUN_EXPORT: 'reticle_run_export',
|
|
125
|
+
/** Consolidated families — one action-dispatched tool per family; members below stay
|
|
126
|
+
* defined (handlers intact) but are no longer advertised separately. */
|
|
127
|
+
BASELINE: 'reticle_baseline',
|
|
128
|
+
SESSION: 'reticle_session',
|
|
129
|
+
RECORD: 'reticle_record',
|
|
130
|
+
FLOW: 'reticle_flow',
|
|
131
|
+
LEASE: 'reticle_lease',
|
|
132
|
+
/** Lease a fresh isolated headless context from the shared browser pool (one per flow). */
|
|
133
|
+
LEASE_ACQUIRE: 'reticle_lease_acquire',
|
|
134
|
+
/** Release a previously leased context, freeing the pool slot. */
|
|
135
|
+
LEASE_RELEASE: 'reticle_lease_release',
|
|
136
|
+
/** Meta: discover tool definitions on demand instead of paying for all of them every turn. */
|
|
137
|
+
TOOLS: 'reticle_tools',
|
|
138
|
+
/** Meta: invoke any tool by name — the escape hatch that keeps a trimmed profile a trim, not a removal. */
|
|
139
|
+
RUN: 'reticle_run',
|
|
140
|
+
/** Report that Reticle itself failed — the agent's only way to tell us what to fix. */
|
|
141
|
+
FEEDBACK: 'reticle_feedback',
|
|
142
|
+
};
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* count=N child count (for containers, replaces expanding children)
|
|
26
26
|
* ph="..." placeholder text
|
|
27
27
|
*/
|
|
28
|
-
import { ElementState } from './constants.js';
|
|
28
|
+
import { ElementState } from './constants/constants.js';
|
|
29
29
|
const ROLE_MAP = {
|
|
30
30
|
button: 'btn',
|
|
31
31
|
textbox: 'inp',
|