@trusty-squire/mcp 1.1.28 → 1.1.29-rc.2

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 (86) hide show
  1. package/dist/api-client.d.ts +6 -0
  2. package/dist/api-client.d.ts.map +1 -1
  3. package/dist/api-client.js.map +1 -1
  4. package/dist/bot/act/act.d.ts.map +1 -1
  5. package/dist/bot/act/act.js +15 -11
  6. package/dist/bot/act/act.js.map +1 -1
  7. package/dist/bot/browser.d.ts +0 -29
  8. package/dist/bot/browser.d.ts.map +1 -1
  9. package/dist/bot/browser.js +2 -747
  10. package/dist/bot/browser.js.map +1 -1
  11. package/dist/bot/capture/capture.d.ts +7 -15
  12. package/dist/bot/capture/capture.d.ts.map +1 -1
  13. package/dist/bot/capture/capture.js +71 -253
  14. package/dist/bot/capture/capture.js.map +1 -1
  15. package/dist/bot/card-release-approval.d.ts.map +1 -1
  16. package/dist/bot/card-release-approval.js +11 -2
  17. package/dist/bot/card-release-approval.js.map +1 -1
  18. package/dist/bot/credential-capture.d.ts +10 -0
  19. package/dist/bot/credential-capture.d.ts.map +1 -1
  20. package/dist/bot/credential-capture.js +5 -0
  21. package/dist/bot/credential-capture.js.map +1 -1
  22. package/dist/bot/credential-shape.d.ts +0 -5
  23. package/dist/bot/credential-shape.d.ts.map +1 -1
  24. package/dist/bot/credential-shape.js +8 -132
  25. package/dist/bot/credential-shape.js.map +1 -1
  26. package/dist/bot/drive-feedback.d.ts +2 -8
  27. package/dist/bot/drive-feedback.d.ts.map +1 -1
  28. package/dist/bot/drive-feedback.js +7 -49
  29. package/dist/bot/drive-feedback.js.map +1 -1
  30. package/dist/bot/jev-client.d.ts +3 -0
  31. package/dist/bot/jev-client.d.ts.map +1 -1
  32. package/dist/bot/jev-client.js +14 -5
  33. package/dist/bot/jev-client.js.map +1 -1
  34. package/dist/bot/operate-drive.d.ts +13 -63
  35. package/dist/bot/operate-drive.d.ts.map +1 -1
  36. package/dist/bot/operate-drive.js +136 -592
  37. package/dist/bot/operate-drive.js.map +1 -1
  38. package/dist/bot/page-driver.js +1 -1
  39. package/dist/bot/page-driver.js.map +1 -1
  40. package/dist/bot/provision-session.d.ts +3 -1
  41. package/dist/bot/provision-session.d.ts.map +1 -1
  42. package/dist/bot/provision-session.js +1 -1
  43. package/dist/bot/provision-session.js.map +1 -1
  44. package/dist/bot/session/lifecycle.d.ts.map +1 -1
  45. package/dist/bot/session/lifecycle.js +14 -13
  46. package/dist/bot/session/lifecycle.js.map +1 -1
  47. package/dist/bot/skill-hint.d.ts.map +1 -1
  48. package/dist/bot/skill-hint.js +4 -3
  49. package/dist/bot/skill-hint.js.map +1 -1
  50. package/dist/install/broker-service.d.ts.map +1 -1
  51. package/dist/install/broker-service.js +13 -15
  52. package/dist/install/broker-service.js.map +1 -1
  53. package/dist/install/cli.d.ts.map +1 -1
  54. package/dist/install/cli.js +43 -32
  55. package/dist/install/cli.js.map +1 -1
  56. package/dist/install/connect-report.d.ts +7 -7
  57. package/dist/install/connect-report.d.ts.map +1 -1
  58. package/dist/install/connect-report.js +31 -25
  59. package/dist/install/connect-report.js.map +1 -1
  60. package/dist/server.d.ts.map +1 -1
  61. package/dist/server.js +42 -3
  62. package/dist/server.js.map +1 -1
  63. package/dist/tools/fetch-credential.d.ts.map +1 -1
  64. package/dist/tools/fetch-credential.js +3 -1
  65. package/dist/tools/fetch-credential.js.map +1 -1
  66. package/dist/tools/provision-drive-schema.d.ts +0 -1
  67. package/dist/tools/provision-drive-schema.d.ts.map +1 -1
  68. package/dist/tools/provision-drive-schema.js +125 -238
  69. package/dist/tools/provision-drive-schema.js.map +1 -1
  70. package/dist/tools/provision-drive.d.ts +217 -73
  71. package/dist/tools/provision-drive.d.ts.map +1 -1
  72. package/dist/tools/provision-drive.js +133 -180
  73. package/dist/tools/provision-drive.js.map +1 -1
  74. package/dist/tools/store-credential.d.ts.map +1 -1
  75. package/dist/tools/store-credential.js +5 -1
  76. package/dist/tools/store-credential.js.map +1 -1
  77. package/dist/tools/use-credential.js +2 -2
  78. package/package.json +1 -1
  79. package/dist/bot/credential-text.d.ts +0 -4
  80. package/dist/bot/credential-text.d.ts.map +0 -1
  81. package/dist/bot/credential-text.js +0 -296
  82. package/dist/bot/credential-text.js.map +0 -1
  83. package/dist/bot/extraction.d.ts +0 -18
  84. package/dist/bot/extraction.d.ts.map +0 -1
  85. package/dist/bot/extraction.js +0 -54
  86. package/dist/bot/extraction.js.map +0 -1
@@ -1,296 +0,0 @@
1
- // credential-text.ts — pull a credential VALUE out of a blob of visible page
2
- // text, and reject candidates that are truncated displays or password-manager
3
- // UI noise. These are the browser-free, regex-driven extraction predicates the
4
- // provision session + skill replay paths share.
5
- //
6
- // Distinct from credential-shape.ts: that module answers "is this string
7
- // shaped like a credential" (a tight host-side gate); this one answers "given a
8
- // page of text, WHICH substring is the credential" (service-prefix + labeled
9
- // regex library) plus the two candidate-rejection helpers replay uses.
10
- // Real API keys / bearer tokens are short (Stripe ~32, JWT ~hundreds
11
- // but our labeled patterns don't target JWTs). Captcha challenge
12
- // tokens are very long: g-recaptcha-response runs ~500-2000 chars and
13
- // cf-turnstile-response is similar. A 100-char ceiling cleanly admits
14
- // real keys and rejects every captcha token shape we've seen.
15
- const MAX_CREDENTIAL_LENGTH = 100;
16
- // Substrings that, if present in a candidate, mark it as a
17
- // challenge/cookie token rather than a credential. Cloudflare clearance
18
- // cookies (`__cf`, `cf_clearance`), CDN challenge paths (`cdn-cgi`),
19
- // and the visible field/param names of the two captcha widgets.
20
- const CAPTCHA_TOKEN_MARKERS = [
21
- "__cf",
22
- "cf_clearance",
23
- "cdn-cgi",
24
- "cf-turnstile-response",
25
- "g-recaptcha-response",
26
- "h-captcha-response",
27
- ];
28
- // Distinctive service key prefixes. If a *labeled* match's value
29
- // embeds one of these NOT at its start, the regex straddled glued UI
30
- // text on a dense dashboard (e.g. Render's API-keys list rendered as
31
- // "...Name bot-key Menu Key rnd_xxxx" with no separators) — the real
32
- // key starts at the prefix, so the labeled match is contaminated and
33
- // must be rejected. A clean labeled key either starts with its prefix
34
- // (then the prefixed patterns above already caught it) or carries no
35
- // known prefix at all.
36
- const EMBEDDED_KEY_PREFIXES = [
37
- "rnd_",
38
- "phc_",
39
- "sk_live_",
40
- "sk_test_",
41
- "pk_live_",
42
- "pk_test_",
43
- ];
44
- // True when `capturedKey` is followed by a truncation marker (`...`
45
- // or the Unicode ellipsis `…`) in `sourceText`. That marker is the
46
- // signal that the visible display masked the full secret — the
47
- // regex captured everything up to but not including the marker, so
48
- // the value LOOKS valid but is short. Used by F10's
49
- // extract-via-Copy-button recovery path; without this check, the
50
- // bot accepts the truncated value, stores it, and the user discovers
51
- // the failure only when their next API call returns 401.
52
- export function isTruncatedCapture(sourceText, capturedKey) {
53
- const idx = sourceText.indexOf(capturedKey);
54
- if (idx < 0)
55
- return false;
56
- const after = sourceText.slice(idx + capturedKey.length, idx + capturedKey.length + 10);
57
- // Whitespace OK between key and ellipsis (some modals render as
58
- // "sk-or-v1-xxxx ..."). Three OR MORE dots; two dots are ordinary
59
- // punctuation and would false-positive on e.g. "key value.." in
60
- // help text.
61
- return /^\s*(?:\.{3,}|…)/.test(after);
62
- }
63
- // Pull an API key out of the *visible* page text.
64
- //
65
- // Two strategies, in priority order:
66
- // 1. Known service-specific prefixes (re_, sk_live_, …) — high
67
- // confidence, the prefix itself is the proof.
68
- // 2. Labeled patterns ("api key: <value>") — lower confidence, so
69
- // they carry guard rails: the value must sit IMMEDIATELY after
70
- // the label (a small bounded gap of spaces/colon/equals, NOT
71
- // arbitrary whitespace that could span unrelated page sections),
72
- // must be under MAX_CREDENTIAL_LENGTH, and must not look like a
73
- // captcha/cookie token. Without these, a `g-recaptcha-response`
74
- // value or a session token elsewhere in the body could be
75
- // mistaken for `credentials.api_key`.
76
- export function extractApiKeyFromText(text) {
77
- const prefixed = [
78
- /\bre_[a-zA-Z0-9_]{20,}\b/, // Resend (key body contains underscores)
79
- /\bsk_(?:live|test)_[a-zA-Z0-9]{20,}\b/, // Stripe secret
80
- // NOTE: client-embedded PUBLIC keys are deliberately NOT matched —
81
- // Stripe publishable (pk_live_/pk_test_) and PostHog project
82
- // (phc_) keys ship in the client-side JS of every site that uses
83
- // those vendors, so finding one on a page means "this service
84
- // embeds Stripe/PostHog", not "here is the user's credential".
85
- // Each produced a false success on Mistral (its billing pk_live_,
86
- // then its analytics phc_, surfaced as the api_key).
87
- // Plunk is the EXCEPTION: its API key is `pk_<hex>` (e.g.
88
- // pk_e063df9b5…) and IS the user's credential, shown in plaintext on
89
- // the dashboard under an "API Key" label. The pure-hex body after the
90
- // prefix distinguishes it from Stripe publishable keys (pk_live_/
91
- // pk_test_ — a "live"/"test" segment, not hex), so this can't re-open
92
- // the embedded-public-key false-positive the note above warns about.
93
- /\bpk_[a-f0-9]{24,}\b/, // Plunk (hex public/API key — NOT Stripe pk_live_/pk_test_)
94
- /\bkey-[a-f0-9]{32}\b/, // Mailgun
95
- /\bSG\.[a-zA-Z0-9_\-]{20,}\.[a-zA-Z0-9_\-]{20,}\b/, // SendGrid
96
- /\brnd_[a-zA-Z0-9]{20,}\b/, // Render
97
- /\bsntry[su]_[A-Za-z0-9_=\-]{20,}/, // Sentry org/user auth token
98
- // Neon serverless Postgres. Modal renders `napi_<48-char-alnum>` and
99
- // also shows a truncated `napi_xxx…` in the visible text below the
100
- // input field. Without the prefix here, the bot saw the truncated
101
- // display, isTruncatedCapture rejected the partial value, every
102
- // pass returned null, and the planner gave up despite the full key
103
- // being in the input field's `value` attribute. rc.14 — surfaced
104
- // during the harvester rc.13 pass on Neon.
105
- /\bnapi_[a-zA-Z0-9]{30,80}\b/, // Neon
106
- // 0.8.3-rc.1 — typeform personal access tokens. Shape
107
- // `tfp_<alnum-with-underscore>` length 40-80. Surfaced during the
108
- // 2026-05-29 retest where the planner SAW the token (quoted in
109
- // reason) but no regex matched, so extractCredentials returned
110
- // null and the bot bailed `oauth_onboarding_failed`.
111
- /\btfp_[A-Za-z0-9_]{40,80}\b/, // Typeform
112
- // Replicate API tokens. `r8_<40-char alnum>` per their docs. Shown
113
- // in the table row after Create. The post-verify loop iterates,
114
- // adds rows, but extractCredentials returned null every round
115
- // until rc.20 because no regex matched. Added defensively after
116
- // the rc.13 verification pass showed Replicate burning the full
117
- // 12-round budget filling-creating tokens nobody could extract.
118
- /\br8_[a-zA-Z0-9]{30,60}\b/, // Replicate
119
- // rc.23 — added after the post-rc.22 registry-snapshot review of
120
- // 200 failed signups. Each pattern matches a token shape the
121
- // bot's planner had already QUOTED in its `reason` field (i.e.
122
- // the credential was visible on the page, just not in a shape
123
- // any prior regex recognised). The redact.{ts,mjs} pattern set
124
- // stays in lockstep with these.
125
- /\bpscale_tkn_[A-Za-z0-9]{30,60}\b/, // PlanetScale Service Token
126
- /\bsbp_[a-zA-Z0-9]{30,80}\b/, // Supabase Personal Access Token
127
- // Baseten: `<6-12 alnum>.<30+ alnum>`. The dot separator + length
128
- // bounds on both sides distinguish it from version strings (too
129
- // short on either side). rc.35 — relaxed the prefix to mixed-case
130
- // after the rc.33 broad sweep showed a Baseten key whose prefix
131
- // had uppercase letters: `HP9tFTtm.txDl4vv7ayYsTwx9dQea47ylRdN4Brk3`.
132
- /\b[A-Za-z0-9]{6,12}\.[A-Za-z0-9]{30,50}\b/, // Baseten
133
- // Qdrant Cloud: `<UUID>|<55-char opaque>` — a literal pipe between
134
- // a key id and the secret body. Unique enough that no false-
135
- // positive guard is needed.
136
- //
137
- // rc.34/rc.36 — extended the secret-body character class to
138
- // include underscore + hyphen. rc.35 broad sweep surfaced
139
- // another Qdrant shape with mid-body hyphens:
140
- // `<UUID>|e8L7oyi-5fHa327u7x-IQN6WivtPlpIVjT-giIsrXDZW7P-8i2G9Pw`.
141
- // [A-Za-z0-9_-] covers both observed shapes; the {30,80} length
142
- // bound + UUID prefix keep false-positive risk near zero.
143
- /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\|[A-Za-z0-9_\-]{30,80}\b/i, // Qdrant
144
- // JWT (eyJ...eyJ...sig) — Convex's API "token" is a JWT. Other
145
- // services may emit JWTs as bearer secrets too. Three-segment
146
- // base64url with literal dots. Conservative bounds — under 20
147
- // chars per segment is almost never a real JWT.
148
- /\beyJ[A-Za-z0-9_\-]{20,}\.eyJ[A-Za-z0-9_\-]{20,}\.[A-Za-z0-9_\-]{20,}\b/, // JWT
149
- // Zeabur's API key — `sk-<28-40 lowercase alnum>`. Shorter than
150
- // OpenAI legacy (which is 40+ mixed-case). The lowercase-only
151
- // character class differentiates from OpenAI legacy so this
152
- // pattern only fires on Zeabur-style keys. Surfaced from the
153
- // rc.23 snapshot review.
154
- /\bsk-[a-z0-9]{28,38}\b/, // Zeabur
155
- // PostHog PERSONAL API key — `phx_<43+ alnum>`. MEASURED 2026-06-24: the
156
- // post-OAuth create-personal-api-key flow mints a `phx_`-prefixed secret —
157
- // the planner SAW it (and even OCR-transcribed it with errors), but no regex
158
- // matched so the DOM extractor stored nothing and the run bailed
159
- // oauth_onboarding_failed while a real key sat on the page. The {40,60}
160
- // bound keeps it clear of short prefixed noise. Deliberately NOT matching
161
- // the `phc_` PROJECT key —
162
- // that's a PUBLIC analytics key embedded in client JS on every PostHog site
163
- // (see extract-credentials.test "ignores a PostHog project key").
164
- /\bphx_[A-Za-z0-9]{40,60}\b/, // PostHog personal API key
165
- // OpenRouter, Anthropic, OpenAI — these are the dominant
166
- // OAuth-completed-then-copy-needed services. Specific-prefix
167
- // patterns first so a labeled-pattern fallback isn't load-
168
- // bearing for them. Putting `sk-or-v1-` before `sk-` so it wins
169
- // when both could match (cosmetic; both capture the same value).
170
- // 0.6.15-rc.8 — character-class anchored so the greedy match
171
- // doesn't glue trailing modal text. extractText() returns body
172
- // as one concatenated string, so a key followed by "Please copy
173
- // this" with no separator looked like `sk-or-v1-<64hex>Please…`.
174
- // The hex-only class terminates at the first non-hex char.
175
- /\bsk-or-v1-[a-f0-9]{40,80}/i, // OpenRouter (sk-or-v1-<64hex>)
176
- /\bsk-ant-[a-zA-Z0-9_-]{40,120}/, // Anthropic (sk-ant-<urlsafe-b64>)
177
- /\bsk-proj-[a-zA-Z0-9_-]{40,200}/, // OpenAI project key
178
- /\bsk-[a-zA-Z0-9]{40,60}/, // OpenAI legacy (`sk-` + ~48 chars, no dashes)
179
- ];
180
- for (const pattern of prefixed) {
181
- const match = text.match(pattern);
182
- if (match !== null)
183
- return match[0];
184
- }
185
- // Labeled patterns. The label and value MUST be separated by a real
186
- // separator — a colon/equals, or whitespace — `(?:[ \t]*[:=][ \t]*|[ \t]+)`,
187
- // never a newline. A MANDATORY separator is what keeps the regex from
188
- // latching the label onto glued dashboard nav text: a sidebar
189
- // rendering "API Keys" "Webhooks" "Settings" as adjacent links
190
- // concatenates in textContent to "API KeysWebhooksSettings…", and an
191
- // optional-gap regex would capture "sWebhooksSettings…" as the key
192
- // (Resend false-positive). Requiring `:`/`=`/space means "API Key"
193
- // followed immediately by a letter does not match.
194
- const labeled = [
195
- /(?:api[_\s-]?key|access[_\s-]?token|secret[_\s-]?key)(?:[ \t]*[:=][ \t]*|[ \t]+)([a-zA-Z0-9_\-]{20,})/i,
196
- /\b[Bb]earer[ \t]+([a-zA-Z0-9_\-.]{30,})/,
197
- // UUID-style tokens (Railway uses bare UUIDs for API tokens; some
198
- // smaller services do too). MUST be labeled — bare UUIDs appear all
199
- // over dashboards as trace IDs, project IDs, and request IDs, so an
200
- // unlabeled UUID regex would false-positive on the first error page
201
- // the bot lands on. The label set is broader than the prefix-style
202
- // labeled regex above because Railway specifically renders "Token"
203
- // (not "API key") next to the value.
204
- /(?:api[_\s-]?token|api[_\s-]?key|access[_\s-]?token|new[_\s-]?token|\btoken|\bsecret)(?:[ \t\n]*[:=][ \t\n]*|[ \t\n]+)([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\b/i,
205
- ];
206
- for (const pattern of labeled) {
207
- const match = text.match(pattern);
208
- const candidate = match?.[1];
209
- if (candidate === undefined)
210
- continue;
211
- // A captcha challenge token: too long for a real key, and/or
212
- // carries a known cookie/widget marker.
213
- if (candidate.length > MAX_CREDENTIAL_LENGTH)
214
- continue;
215
- const lower = candidate.toLowerCase();
216
- if (CAPTCHA_TOKEN_MARKERS.some((marker) => lower.includes(marker)))
217
- continue;
218
- // Contaminated: the labeled match straddled glued dashboard text
219
- // onto a real key (the key prefix sits mid-candidate, not at 0).
220
- if (EMBEDDED_KEY_PREFIXES.some((p) => lower.indexOf(p) > 0))
221
- continue;
222
- return candidate;
223
- }
224
- return null;
225
- }
226
- // Password-manager / autofill UI affordances that render as short
227
- // word-tokens on credential pages. A render API-keys page ships a
228
- // "Save to 1Password" / "1Password" autofill button next to the real
229
- // `rnd_…` key; LastPass, Bitwarden, and Dashlane do the same. These
230
- // strings are alphanumeric, often carry a digit ("1Password"), and sit
231
- // EARLIER in DOM order than the credential — so the validator-blind
232
- // candidate-scan tiers used to return them as the
233
- // "credential" and the downstream length validator then rejected them
234
- // (the 0DTW2V66 render skill: `got="1Password" length 9 below min 32`).
235
- // They are never credentials; reject them at the candidate layer so the
236
- // scan moves on to the real key instead of the right key being shadowed
237
- // by a UI word. Matched case-insensitively as a whole token (the
238
- // candidates the scan tiers feed in are already whitespace-trimmed
239
- // single tokens).
240
- const CREDENTIAL_NOISE_TOKENS = [
241
- "1password",
242
- "lastpass",
243
- "bitwarden",
244
- "dashlane",
245
- "keepass",
246
- "keeper",
247
- "nordpass",
248
- "proton pass",
249
- "protonpass",
250
- "autofill",
251
- "passwords",
252
- // Cookie-consent widget vocabulary (CookieScript/OneTrust-class banners
253
- // render these as checkbox values and category labels on EVERY page,
254
- // earlier in DOM order than any credential — zilliz's banner fed
255
- // "personalization" to the validator-shaped scan tier as the "key").
256
- // Whole-token equality with a generic English word is never a real
257
- // credential, so rejecting these costs nothing.
258
- "necessary",
259
- "analytics",
260
- "personalization",
261
- "personalisation",
262
- "advertising",
263
- "advertisement",
264
- "marketing",
265
- "functional",
266
- "preferences",
267
- "statistics",
268
- "performance",
269
- "targeting",
270
- "unclassified",
271
- "security",
272
- ];
273
- // Verb-prefixed UI affordances ("Save to 1Password", "Copy to
274
- // clipboard", "Add to vault"). The candidate-scan tiers tokenize on
275
- // whitespace so a multi-word affordance rarely survives as one
276
- // candidate — but extractText()/innerText passes glue it together, so
277
- // guard the leading verbs too.
278
- const CREDENTIAL_NOISE_PREFIXES = [
279
- "save to ",
280
- "copy to ",
281
- "add to ",
282
- "store in ",
283
- ];
284
- // True when a candidate string is a password-manager / autofill UI
285
- // affordance rather than a real credential value. Used by the replay
286
- // engine's raw-candidate scan tiers to keep "1Password"-class words
287
- // out of the credential slot.
288
- export function isCredentialNoiseCandidate(candidate) {
289
- const lower = candidate.trim().toLowerCase();
290
- if (lower.length === 0)
291
- return false;
292
- if (CREDENTIAL_NOISE_TOKENS.includes(lower))
293
- return true;
294
- return CREDENTIAL_NOISE_PREFIXES.some((p) => lower.startsWith(p));
295
- }
296
- //# sourceMappingURL=credential-text.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credential-text.js","sourceRoot":"","sources":["../../src/bot/credential-text.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,gDAAgD;AAChD,EAAE;AACF,yEAAyE;AACzE,gFAAgF;AAChF,6EAA6E;AAC7E,uEAAuE;AAEvE,qEAAqE;AACrE,iEAAiE;AACjE,sEAAsE;AACtE,sEAAsE;AACtE,8DAA8D;AAC9D,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,2DAA2D;AAC3D,wEAAwE;AACxE,qEAAqE;AACrE,gEAAgE;AAChE,MAAM,qBAAqB,GAAsB;IAC/C,MAAM;IACN,cAAc;IACd,SAAS;IACT,uBAAuB;IACvB,sBAAsB;IACtB,oBAAoB;CACrB,CAAC;AAEF,iEAAiE;AACjE,qEAAqE;AACrE,qEAAqE;AACrE,qEAAqE;AACrE,qEAAqE;AACrE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,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,IAAI,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzD,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC"}
@@ -1,18 +0,0 @@
1
- export type CandidateClass = {
2
- kind: "full";
3
- value: string;
4
- } | {
5
- kind: "truncated";
6
- value: string;
7
- } | {
8
- kind: "none";
9
- };
10
- export interface ExtractionState {
11
- apiKey: string | null;
12
- truncatedHit: string | null;
13
- }
14
- export declare function initialExtractionState(): ExtractionState;
15
- export declare function accumulateCandidate(state: ExtractionState, c: CandidateClass): ExtractionState;
16
- export declare function hasFullHit(state: ExtractionState): boolean;
17
- export declare function resolveExtraction(state: ExtractionState): Record<string, string>;
18
- //# sourceMappingURL=extraction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../src/bot/extraction.ts"],"names":[],"mappings":"AAqBA,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAKrB,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,wBAAgB,sBAAsB,IAAI,eAAe,CAExD;AAMD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,EAAE,CAAC,EAAE,cAAc,GAAG,eAAe,CAO9F;AAID,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAE1D;AAOD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIhF"}
@@ -1,54 +0,0 @@
1
- // extraction.ts — pure decision primitives of the credential-EXTRACTION phase,
2
- // carved out of the credential-extraction phase as strangler slice 4 (the A4
3
- // order: nav-search → OAuth/consent → form-fill → EXTRACTION → capture-chain).
4
- // Browser-free + unit-tested.
5
- //
6
- // BOUNDARY (the slice-2/3 lesson — model the decision, executor owns I/O): the
7
- // executor runs the FIVE candidate sources (visible candidates, body text,
8
- // copy-button/clipboard, hidden inputs, copy-button colocation) AND the regex
9
- // classification of each candidate (extractApiKeyFromText + isTruncatedCapture +
10
- // the pass-4 UUID accept). This module decides only the cross-pass POLICY:
11
- // • accumulation — the first FULL hit wins and ends the scan; a TRUNCATED hit
12
- // (a masked display like "sk-or-v1-1687…" whose full secret is only on the
13
- // clipboard) is remembered as a fallback, first-wins, never overriding a full.
14
- // • resolution — after every pass: a full key → {api_key}; else the truncated
15
- // stub → {api_key_truncated} (an honest partial beats "no key" when the bot
16
- // demonstrably reached the modal); else {} (keep navigating).
17
- //
18
- // This is the highest-value, most self-contained pure piece (the truncated-vs-full
19
- // priority is a recurring brittleness source — the S3 masked-key trap).
20
- export function initialExtractionState() {
21
- return { apiKey: null, truncatedHit: null };
22
- }
23
- // Fold one classified candidate into the state. PURE. First FULL hit wins and is
24
- // sticky (a later candidate cannot override it). A TRUNCATED hit is recorded only
25
- // when no full hit exists yet AND no truncated hit is recorded yet (first-wins),
26
- // mirroring extractCredentials' `truncatedHit = truncatedHit ?? hit`.
27
- export function accumulateCandidate(state, c) {
28
- if (state.apiKey !== null)
29
- return state; // already resolved to a full key
30
- if (c.kind === "full")
31
- return { ...state, apiKey: c.value };
32
- if (c.kind === "truncated") {
33
- return state.truncatedHit === null ? { ...state, truncatedHit: c.value } : state;
34
- }
35
- return state;
36
- }
37
- // Has a terminal full hit been found? The executor stops scanning candidates (and
38
- // skips the remaining passes) once this is true. Pure.
39
- export function hasFullHit(state) {
40
- return state.apiKey !== null;
41
- }
42
- // Final resolution after the passes run. PURE. Faithful to extractCredentials'
43
- // tail: a full key → {api_key}; else a truncated stub → {api_key_truncated} (the
44
- // host agent surfaces the partial — better than "no key found" when the modal was
45
- // demonstrably reached); else {} (no credential — the post-verify loop keeps
46
- // navigating to the real keys surface).
47
- export function resolveExtraction(state) {
48
- if (state.apiKey !== null)
49
- return { api_key: state.apiKey };
50
- if (state.truncatedHit !== null)
51
- return { api_key_truncated: state.truncatedHit };
52
- return {};
53
- }
54
- //# sourceMappingURL=extraction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extraction.js","sourceRoot":"","sources":["../../src/bot/extraction.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,8BAA8B;AAC9B,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,8EAA8E;AAC9E,iFAAiF;AACjF,2EAA2E;AAC3E,gFAAgF;AAChF,+EAA+E;AAC/E,mFAAmF;AACnF,gFAAgF;AAChF,gFAAgF;AAChF,kEAAkE;AAClE,EAAE;AACF,mFAAmF;AACnF,wEAAwE;AAgBxE,MAAM,UAAU,sBAAsB;IACpC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED,iFAAiF;AACjF,kFAAkF;AAClF,iFAAiF;AACjF,sEAAsE;AACtE,MAAM,UAAU,mBAAmB,CAAC,KAAsB,EAAE,CAAiB;IAC3E,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,CAAC,iCAAiC;IAC1E,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IAC5D,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,EAAE,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