@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.
- package/dist/api-client.d.ts +6 -0
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js.map +1 -1
- package/dist/bot/act/act.d.ts.map +1 -1
- package/dist/bot/act/act.js +15 -11
- package/dist/bot/act/act.js.map +1 -1
- package/dist/bot/browser.d.ts +0 -29
- package/dist/bot/browser.d.ts.map +1 -1
- package/dist/bot/browser.js +2 -747
- package/dist/bot/browser.js.map +1 -1
- package/dist/bot/capture/capture.d.ts +7 -15
- package/dist/bot/capture/capture.d.ts.map +1 -1
- package/dist/bot/capture/capture.js +71 -253
- package/dist/bot/capture/capture.js.map +1 -1
- package/dist/bot/card-release-approval.d.ts.map +1 -1
- package/dist/bot/card-release-approval.js +11 -2
- package/dist/bot/card-release-approval.js.map +1 -1
- package/dist/bot/credential-capture.d.ts +10 -0
- package/dist/bot/credential-capture.d.ts.map +1 -1
- package/dist/bot/credential-capture.js +5 -0
- package/dist/bot/credential-capture.js.map +1 -1
- package/dist/bot/credential-shape.d.ts +0 -5
- package/dist/bot/credential-shape.d.ts.map +1 -1
- package/dist/bot/credential-shape.js +8 -132
- package/dist/bot/credential-shape.js.map +1 -1
- package/dist/bot/drive-feedback.d.ts +2 -8
- package/dist/bot/drive-feedback.d.ts.map +1 -1
- package/dist/bot/drive-feedback.js +7 -49
- package/dist/bot/drive-feedback.js.map +1 -1
- package/dist/bot/jev-client.d.ts +3 -0
- package/dist/bot/jev-client.d.ts.map +1 -1
- package/dist/bot/jev-client.js +14 -5
- package/dist/bot/jev-client.js.map +1 -1
- package/dist/bot/operate-drive.d.ts +13 -63
- package/dist/bot/operate-drive.d.ts.map +1 -1
- package/dist/bot/operate-drive.js +136 -592
- package/dist/bot/operate-drive.js.map +1 -1
- package/dist/bot/page-driver.js +1 -1
- package/dist/bot/page-driver.js.map +1 -1
- package/dist/bot/provision-session.d.ts +3 -1
- package/dist/bot/provision-session.d.ts.map +1 -1
- package/dist/bot/provision-session.js +1 -1
- package/dist/bot/provision-session.js.map +1 -1
- package/dist/bot/session/lifecycle.d.ts.map +1 -1
- package/dist/bot/session/lifecycle.js +14 -13
- package/dist/bot/session/lifecycle.js.map +1 -1
- package/dist/bot/skill-hint.d.ts.map +1 -1
- package/dist/bot/skill-hint.js +4 -3
- package/dist/bot/skill-hint.js.map +1 -1
- package/dist/install/broker-service.d.ts.map +1 -1
- package/dist/install/broker-service.js +13 -15
- package/dist/install/broker-service.js.map +1 -1
- package/dist/install/cli.d.ts.map +1 -1
- package/dist/install/cli.js +43 -32
- package/dist/install/cli.js.map +1 -1
- package/dist/install/connect-report.d.ts +7 -7
- package/dist/install/connect-report.d.ts.map +1 -1
- package/dist/install/connect-report.js +31 -25
- package/dist/install/connect-report.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +42 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/fetch-credential.d.ts.map +1 -1
- package/dist/tools/fetch-credential.js +3 -1
- package/dist/tools/fetch-credential.js.map +1 -1
- package/dist/tools/provision-drive-schema.d.ts +0 -1
- package/dist/tools/provision-drive-schema.d.ts.map +1 -1
- package/dist/tools/provision-drive-schema.js +125 -238
- package/dist/tools/provision-drive-schema.js.map +1 -1
- package/dist/tools/provision-drive.d.ts +217 -73
- package/dist/tools/provision-drive.d.ts.map +1 -1
- package/dist/tools/provision-drive.js +133 -180
- package/dist/tools/provision-drive.js.map +1 -1
- package/dist/tools/store-credential.d.ts.map +1 -1
- package/dist/tools/store-credential.js +5 -1
- package/dist/tools/store-credential.js.map +1 -1
- package/dist/tools/use-credential.js +2 -2
- package/package.json +1 -1
- package/dist/bot/credential-text.d.ts +0 -4
- package/dist/bot/credential-text.d.ts.map +0 -1
- package/dist/bot/credential-text.js +0 -296
- package/dist/bot/credential-text.js.map +0 -1
- package/dist/bot/extraction.d.ts +0 -18
- package/dist/bot/extraction.d.ts.map +0 -1
- package/dist/bot/extraction.js +0 -54
- package/dist/bot/extraction.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provision-drive.d.ts","sourceRoot":"","sources":["../../src/tools/provision-drive.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,
|
|
1
|
+
{"version":3,"file":"provision-drive.d.ts","sourceRoot":"","sources":["../../src/tools/provision-drive.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAyBL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AAsFrC,QAAA,MAAM,WAAW;;;;;;;;;;;;EASf,CAAC;AAyBH,eAAO,MAAM,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CA2ChE,CAAC;AAEF,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;EAcjB,CAAC;AAEH,eAAO,MAAM,oBAAoB,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAoCpE,CAAC;AAEF,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;EAcpB,CAAC;AAEH,eAAO,MAAM,uBAAuB,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CA8C1E,CAAC;AAEF,QAAA,MAAM,aAAa;;;;;;;;;;;;EAIjB,CAAC;AAEH,eAAO,MAAM,oBAAoB,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAkBpE,CAAC;AA+SF,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBpB,CAAC;AACL,eAAO,MAAM,iBAAiB,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CA+CtE,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBb,CAAC;AAEL,eAAO,MAAM,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAiD9D,CAAC;AAIF,eAAO,MAAM,aAAa,EAAE,IAAI,EAiBrB,CAAC"}
|
|
@@ -11,8 +11,7 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { getDomain } from "tldts";
|
|
13
13
|
import { constants, generateKeyPairSync, privateDecrypt } from "node:crypto";
|
|
14
|
-
import { startProvisionSession, observe, captureScreenshot, readOperatorEvidence, observeSubtree, observeQuery, act, formSelectMany, TargetStaleError, extractCredentials, captureCredentialSource, probeCaptureSource, finishProvisionSession, finishProvisionSessionWithPreparation, observedHostsForSession, currentProvisionUrl, stashSecretSlot, readSecretSlotValue, getSessionUserEmail, awaitVerification, generatePassword, } from "../bot/provision-session.js";
|
|
15
|
-
import { isMaskedDisplay } from "../bot/credential-shape.js";
|
|
14
|
+
import { startProvisionSession, observe, captureScreenshot, readOperatorEvidence, observeSubtree, observeQuery, act, formSelectMany, TargetStaleError, extractCredentials, storableCredentials, captureCredentialSource, probeCaptureSource, finishProvisionSession, finishProvisionSessionWithPreparation, observedHostsForSession, currentProvisionUrl, stashSecretSlot, readSecretSlotValue, getSessionUserEmail, awaitVerification, generatePassword, } from "../bot/provision-session.js";
|
|
16
15
|
import { openSessionStorage } from "../session.js";
|
|
17
16
|
import { servingAccountId } from "../session-guard.js";
|
|
18
17
|
import { googleSessionGateForSession, sessionForCall } from "../bot/session/lifecycle.js";
|
|
@@ -102,32 +101,19 @@ const startSchema = z.object({
|
|
|
102
101
|
// account) set this so start fails closed to a connect hand-back if no live
|
|
103
102
|
// Google session exists — rather than driving into a mid-task login wall.
|
|
104
103
|
});
|
|
105
|
-
const DOM_OBSERVATION_CONTRACT = 'With `format:"full"`,
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
"Its `safe_table` is a paged control map: each row is `[ref,role,facts?]`; role is " +
|
|
119
|
-
"b=button, l=link, t=textbox, s=select, c=checkbox, r=radio, tb=tab, m=menuitem, or f=file; other roles are literal (e.g. slider or generic for a listener container). " +
|
|
120
|
-
"facts is a `|`-joined `@label` alias followed by present s=state (c=checked, u=unchecked, d=disabled, r=required), " +
|
|
121
|
-
"v=offscreen when outside the viewport, a=action, f=field, q=choice-position/total, and x=s same-origin or x=x cross-origin frame; absent x means main frame. " +
|
|
122
|
-
"nf=1 marks a listener container that carries a field name but is not itself fillable — its fillable field is emitted separately; fill that one. " +
|
|
123
|
-
"Query matches include m=n (exact name), m=r (exact role), m=t (local text), or m=c (explicit form/fieldset/dialog context), ranked in that order. " +
|
|
124
|
-
"semantic.blocked=true and semantic.blockers report what blocks the task independently of stage; stage=browse does not mean unblocked. " +
|
|
125
|
-
"Blocker kind is challenge (verification instructions), validation (a structurally identified field error), dialog (an open modal), or error_page (a CDN/gateway block wall named from the title/headings, so a blocked body is not read as a normal page). " +
|
|
126
|
-
"A dialog blocker also carries options — a bounded list of its rendered controls in DOM order, including the close path that keeps what was entered whenever the dialog renders one; when more controls exist than fit, that dismiss path and the controls that resolve the dialog are kept ahead of anchors, so query the control map for the rest. ref names the dialog's exit, matched on a control's whole label, or is absent with target=unavailable when the dialog renders none — act on an option rather than assuming one dismisses it. A bounded detail carries the dialog's own prose. " +
|
|
127
|
-
"Cursors page an immutable snapshot and require the same query and role; document changes invalidate them. A cursorless query captures fresh controls and semantics. " +
|
|
128
|
-
"Use overflow.next_cursor to page safe_table. A cursor from hint_overflow returns `hint` and pages with hint_overflow.next_cursor. ";
|
|
129
|
-
const ACTION_FORMAT_NOTE = "The action response is the compact `browser-use-control-query` control map by default: after a compact map on the same document, `delta:true` carries changed/new controls in `safe_table` and departed refs in `removed`, never the verbatim DOM. The acted control's own current row is always included, marked `w=acted`, so a write is confirmable from its own result. " +
|
|
130
|
-
'Pass `format:"full"` to receive the `browser-use-dom` tree instead. After inject_card releases a card, its PAN (complete ordinary spellings and prefixes of at least eight digits) and security code are replaced in every normal observation; all other emitted content stays verbatim. ';
|
|
104
|
+
const DOM_OBSERVATION_CONTRACT = 'With `format:"full"`, `browser-use-dom` returns a tab-indented `dom` tree with text and `[@e:...]` controls. ' +
|
|
105
|
+
"`|SHADOW(open)|` / `|SHADOW(closed)|` mark shadow hosts; `not-targetable=true` refs are display-only. " +
|
|
106
|
+
"`*` marks a new control; `more_above` / `more_below` signal offscreen content. " +
|
|
107
|
+
"On `delta:true`, a present `dom` replaces the prior tree; otherwise keep it and remove refs in `removed`. " +
|
|
108
|
+
"Without delta, reset the view. Refs stay usable on the same document; on stale_ref, observe again. ";
|
|
109
|
+
const CONTROL_QUERY_CONTRACT = 'The default `format:"compact"` response is `browser-use-control-query`: `safe_table` pages controls, including offscreen ones, as `[ref,role,facts?]`. ' +
|
|
110
|
+
"Arbitrary page text is absent from this control map; use full format when text matters. " +
|
|
111
|
+
"Roles b/l/t/s/c/r/tb/m/f mean button/link/textbox/select/checkbox/radio/tab/menuitem/file; other roles are literal. " +
|
|
112
|
+
"`facts` joins an `@label` alias with hints: s=c/u/d/r means checked/unchecked/disabled/required, v=offscreen, a=action, f=field, q=choice-position/total, and x=s/x for same/cross-origin frame (absent x means main frame). `nf=1` is a non-fillable listener; use its separately listed field. " +
|
|
113
|
+
"Query or role filters controls; `m=n/r/t/c` marks name/role/text/context matches. " +
|
|
114
|
+
"`semantic.blocked` and `semantic.blockers` report challenges, validation, dialogs, and error pages regardless of stage. Dialog options include actionable exits; an absent exit ref has target=unavailable. " +
|
|
115
|
+
"Use `overflow.next_cursor` to page with the same query and role; `hint_overflow.next_cursor` pages hints. Document changes invalidate cursors. ";
|
|
116
|
+
const ACTION_FORMAT_NOTE = 'Returns a compact control map; `delta:true` lists changed rows in `safe_table` and departed refs in `removed`. `w=acted` marks the acted row. Use `format:"full"` for the DOM tree. ';
|
|
131
117
|
const ACTION_FORMATS = ["compact", "full"];
|
|
132
118
|
const actionFormatSchema = z.enum(ACTION_FORMATS);
|
|
133
119
|
const actionFormatJson = { type: "string", enum: [...ACTION_FORMATS] };
|
|
@@ -138,12 +124,9 @@ export const provisionStartTool = {
|
|
|
138
124
|
CONTROL_QUERY_CONTRACT +
|
|
139
125
|
'Use `format:"full"` only when the page DOM and text are needed. A released card\'s PAN (complete ordinary spellings and prefixes of at least eight digits) and security code are masked; all other emitted content stays verbatim. ' +
|
|
140
126
|
DOM_OBSERVATION_CONTRACT +
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"answer and/or added facts if it hands back. The primitives " +
|
|
145
|
-
"(operate_click, operate_type, operate_select, operate_navigate, operate_scroll, operate_login) " +
|
|
146
|
-
"remain for a single step the drive handed back or a task that is not a goal. " +
|
|
127
|
+
"Use operate_start when you want to inspect the first page before choosing steps. For a known multi-step goal, call operate_drive with url, goal, and facts directly. " +
|
|
128
|
+
"operate_click, operate_type, operate_select, operate_navigate, operate_scroll, and operate_login " +
|
|
129
|
+
"complete individual steps. Resume a drive handoff on the same session with answer or added facts. " +
|
|
147
130
|
"inject_card releases a saved card into pan/cvv refs and exposes masked {{pan}}/{{cvv}} per-digit tokens for operate_type placement. " +
|
|
148
131
|
"Call operate_extract when you reach the credentials. Always operate_finish when done. The " +
|
|
149
132
|
"browser has unrestricted egress.",
|
|
@@ -244,19 +227,13 @@ const screenshotSchema = z.object({
|
|
|
244
227
|
});
|
|
245
228
|
export const provisionScreenshotTool = {
|
|
246
229
|
name: "operate_screenshot",
|
|
247
|
-
description: "
|
|
248
|
-
"
|
|
249
|
-
"
|
|
250
|
-
"
|
|
251
|
-
"
|
|
252
|
-
"
|
|
253
|
-
"
|
|
254
|
-
"3-D Secure ACS frame, a captcha) can be captured on its own even when it won't show clearly inside " +
|
|
255
|
-
"a full-page shot. Use this when the DOM tree from an explicitly " +
|
|
256
|
-
"selected full observation isn't enough to tell what state " +
|
|
257
|
-
"a stuck page is actually in — a challenge that never advances, an unexpected layout, a captcha you " +
|
|
258
|
-
"need to SEE. Read-only: never navigates, clicks, types, submits, or steals focus; it only reads " +
|
|
259
|
-
"pixels. After inject_card releases a card, pixels containing that card's PAN (complete ordinary spellings or prefixes of at least eight digits) or security code in injected controls and identified ordinary displayed copies are covered in the returned image; surrounding borders, labels, and errors remain visible. An active mask is never bypassed: if the mask cannot scan or composite the capture, the screenshot call fails rather than returning the unmasked image. When click_binding is present, its screenshot_id and original image width/height authorize one operate_click screenshot point for 60 seconds. Navigation, viewport/scroll or frame geometry changes invalidate it. An absent binding means this image is read-only; capture again for a coordinate click.",
|
|
230
|
+
description: "Capture rendered pixels from the viewport (or full_page:true) or one frame via frame_index or frame_url_contains. " +
|
|
231
|
+
"A screenshot costs more context than operate_observe; use it when visual state or a coordinate click matters, " +
|
|
232
|
+
"including a captcha or 3-D Secure ACS frame. During bank approval, short, non-blocking screenshots or observations " +
|
|
233
|
+
"can watch for a change. This read does not interact with the page. Released PAN and security code in injected " +
|
|
234
|
+
"controls and identified displayed copies are covered; if masking fails, capture fails. " +
|
|
235
|
+
"A click_binding authorizes one dispatched operate_click point in original image pixels for 60 seconds; " +
|
|
236
|
+
"navigation, scroll, viewport, or frame changes invalidate it. Without a binding, capture again before a coordinate click.",
|
|
260
237
|
inputSchema: screenshotSchema,
|
|
261
238
|
jsonInputSchema: {
|
|
262
239
|
type: "object",
|
|
@@ -347,6 +324,13 @@ const captureSchema = z
|
|
|
347
324
|
.optional(),
|
|
348
325
|
})
|
|
349
326
|
.strict();
|
|
327
|
+
const captureClickSchema = captureSchema.omit({ write_id: true });
|
|
328
|
+
const captureActionSchema = captureClickSchema.extend({
|
|
329
|
+
source: captureSourceSchema.refine((source) => !("clipboard" in source), "capture.source.clipboard is only valid on operate_click"),
|
|
330
|
+
});
|
|
331
|
+
const captureExtractSchema = captureSchema.extend({
|
|
332
|
+
source: captureActionSchema.shape.source,
|
|
333
|
+
});
|
|
350
334
|
const captureJson = {
|
|
351
335
|
type: "object",
|
|
352
336
|
additionalProperties: false,
|
|
@@ -373,8 +357,20 @@ const captureJson = {
|
|
|
373
357
|
required: ["selector"],
|
|
374
358
|
not: { anyOf: [{ required: ["role"] }, { required: ["name"] }] },
|
|
375
359
|
},
|
|
360
|
+
{
|
|
361
|
+
required: ["clipboard"],
|
|
362
|
+
not: {
|
|
363
|
+
anyOf: [
|
|
364
|
+
{ required: ["role"] },
|
|
365
|
+
{ required: ["name"] },
|
|
366
|
+
{ required: ["selector"] },
|
|
367
|
+
{ required: ["container"] },
|
|
368
|
+
],
|
|
369
|
+
},
|
|
370
|
+
},
|
|
376
371
|
],
|
|
377
372
|
properties: {
|
|
373
|
+
clipboard: { type: "boolean", const: true },
|
|
378
374
|
selector: { type: "string", minLength: 1, maxLength: 2000 },
|
|
379
375
|
role: { type: "string", enum: ["textbox", "code"] },
|
|
380
376
|
name: { type: "string", maxLength: 200 },
|
|
@@ -392,6 +388,30 @@ const captureJson = {
|
|
|
392
388
|
write_id: { type: "string", minLength: 1, maxLength: 128, pattern: "^[a-zA-Z0-9:_-]+$" },
|
|
393
389
|
},
|
|
394
390
|
};
|
|
391
|
+
const captureJsonFor = (toolName) => {
|
|
392
|
+
const { write_id: _writeId, ...actionProperties } = captureJson.properties;
|
|
393
|
+
if (toolName === "operate_click")
|
|
394
|
+
return { ...captureJson, properties: actionProperties };
|
|
395
|
+
const { clipboard: _clipboard, ...sourceProperties } = captureJson.properties.source.properties;
|
|
396
|
+
return {
|
|
397
|
+
...captureJson,
|
|
398
|
+
properties: {
|
|
399
|
+
...(toolName === "operate_extract" ? captureJson.properties : actionProperties),
|
|
400
|
+
source: {
|
|
401
|
+
...captureJson.properties.source,
|
|
402
|
+
oneOf: captureJson.properties.source.oneOf.slice(0, 2),
|
|
403
|
+
properties: sourceProperties,
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
const CAPTURE_NOTE = " Optional capture:{store,source:{role,name?,container?}|{selector,container?}} stores one revealed value after the action and returns metadata, not the value; resolved_source names the element. " +
|
|
409
|
+
"Role and value-free CSS selector sources can cross open shadow roots; a unique secret-shaped textbox can match without an id. " +
|
|
410
|
+
"capture_unresolved returns candidate_count 0 and found roles/names; capture_ambiguous means several matches. " +
|
|
411
|
+
"An unresolved capture does not block unrelated actions. Never paste a secret into a page field to read it.";
|
|
412
|
+
const CLICK_CAPTURE_NOTE = " On operate_click, source:{clipboard:true} stores only a new clipboard value written by that click; " +
|
|
413
|
+
"an unchanged or empty clipboard stores nothing and reports capture_clipboard_unchanged or capture_clipboard_empty.";
|
|
414
|
+
const EXTRACT_CAPTURE_NOTE = " Only operate_extract accepts capture.write_id to retry storage after an unresolved capture.";
|
|
395
415
|
async function captureIntoVault(sessionId, capture, api, afterAction) {
|
|
396
416
|
const writeId = capture.write_id;
|
|
397
417
|
const binding = createHash("sha256")
|
|
@@ -416,6 +436,18 @@ async function captureIntoVault(sessionId, capture, api, afterAction) {
|
|
|
416
436
|
? await captureCredentialSource(sessionId, capture.source)
|
|
417
437
|
: await captureCredentialSource(sessionId, capture.source, afterAction);
|
|
418
438
|
candidateCount = extracted.candidate_count;
|
|
439
|
+
if (extracted.clipboard_error !== undefined)
|
|
440
|
+
// The click wrote nothing new to the clipboard (or it could not be
|
|
441
|
+
// read). Never store the pre-click clipboard.
|
|
442
|
+
return {
|
|
443
|
+
...base,
|
|
444
|
+
execution: "completed",
|
|
445
|
+
stored: false,
|
|
446
|
+
storage: "unknown",
|
|
447
|
+
error: extracted.clipboard_error,
|
|
448
|
+
candidate_count: 0,
|
|
449
|
+
retry: "extract_only",
|
|
450
|
+
};
|
|
419
451
|
if (extracted.resolved_from === "pre_action_only")
|
|
420
452
|
// The source still resolves only as it did BEFORE the action — the
|
|
421
453
|
// mutation has not rendered a changed source. Never store the pre-action
|
|
@@ -488,7 +520,7 @@ const formSelectionsSchema = z
|
|
|
488
520
|
.record(z.string().min(1).max(200), z.string().min(1).max(4096))
|
|
489
521
|
.refine((value) => Object.keys(value).length > 0, "Provide at least one selection")
|
|
490
522
|
.refine((value) => Object.keys(value).length <= 12, "At most 12 selections per call")
|
|
491
|
-
.describe("Map each current
|
|
523
|
+
.describe("Map each current control ref or @label to its visible option text.");
|
|
492
524
|
async function handleExtract(args, api) {
|
|
493
525
|
const extracted = await extractCredentials(args.session_id);
|
|
494
526
|
// Slot transfer: capture the primary secret into a session-local slot so a
|
|
@@ -496,37 +528,20 @@ async function handleExtract(args, api) {
|
|
|
496
528
|
// having to relay it. Mutually exclusive with store (a slotted secret is
|
|
497
529
|
// being shuttled, not vaulted, in this call).
|
|
498
530
|
if (args.into_slot !== undefined) {
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
const candidates = Object.entries(values).filter(([k, v]) => !k.endsWith("_truncated") && typeof v === "string" && v.length >= 8);
|
|
502
|
-
// A value that still LOOKS masked is never refused — it is simply ranked
|
|
503
|
-
// last, so a fully revealed sibling wins when the page shows both.
|
|
504
|
-
const ranked = [
|
|
505
|
-
...candidates.filter(([, v]) => !isMaskedDisplay(v)),
|
|
506
|
-
...candidates.filter(([, v]) => isMaskedDisplay(v)),
|
|
507
|
-
];
|
|
508
|
-
// When the page shows several credentials (Google's client ID + secret),
|
|
509
|
-
// a secret_label picks the right one by field name; otherwise take the
|
|
510
|
-
// first full value. Falling back avoids a hard fail when the label misses.
|
|
511
|
-
const wantKey = args.secret_label !== undefined ? norm(args.secret_label) : null;
|
|
512
|
-
const matched = wantKey !== null ? ranked.find(([k]) => norm(k).includes(wantKey)) : undefined;
|
|
513
|
-
const full = (matched ?? ranked[0])?.[1];
|
|
514
|
-
if (typeof full !== "string" || full.length === 0) {
|
|
531
|
+
const full = extracted.credentials.api_key;
|
|
532
|
+
if (full === undefined) {
|
|
515
533
|
return {
|
|
516
534
|
session_id: extracted.session_id,
|
|
517
535
|
url: extracted.url,
|
|
518
|
-
candidate_count: extracted.candidate_count,
|
|
519
536
|
sealed: false,
|
|
520
537
|
slot: null,
|
|
521
|
-
blocked_reason:
|
|
522
|
-
"page, then operate_extract again",
|
|
538
|
+
blocked_reason: extracted.error,
|
|
523
539
|
};
|
|
524
540
|
}
|
|
525
541
|
const handle = stashSecretSlot(args.session_id, args.into_slot, full);
|
|
526
542
|
return {
|
|
527
543
|
session_id: extracted.session_id,
|
|
528
544
|
url: extracted.url,
|
|
529
|
-
candidate_count: extracted.candidate_count,
|
|
530
545
|
sealed: true,
|
|
531
546
|
slot: handle,
|
|
532
547
|
};
|
|
@@ -541,26 +556,21 @@ async function handleExtract(args, api) {
|
|
|
541
556
|
return storedExtractResult(extracted, stored);
|
|
542
557
|
}
|
|
543
558
|
const extractSchema = z.object({
|
|
544
|
-
capture:
|
|
559
|
+
capture: captureExtractSchema.optional(),
|
|
545
560
|
session_id: z.string().min(1),
|
|
546
561
|
into_slot: z.string().min(1).max(60).optional(),
|
|
547
|
-
secret_label: z.string().min(1).max(60).optional(),
|
|
548
562
|
store: storeShape.optional(),
|
|
549
563
|
});
|
|
550
564
|
export const provisionExtractTool = {
|
|
551
565
|
name: "operate_extract",
|
|
552
|
-
description: "
|
|
553
|
-
"
|
|
554
|
-
"
|
|
555
|
-
"
|
|
556
|
-
"
|
|
557
|
-
"observed hosts as allowed_hosts seed; when
|
|
558
|
-
"credential values and returns only vault
|
|
559
|
-
"
|
|
560
|
-
"With `into_slot`, a value that still looks masked is ranked behind a fully " +
|
|
561
|
-
"revealed sibling but never refused; pass " +
|
|
562
|
-
'`secret_label` (e.g. "client secret") to pick the right one when the page ' +
|
|
563
|
-
"shows several credentials.",
|
|
566
|
+
description: "Store a key by its source, never by its shape. Without capture, clicks the Copy " +
|
|
567
|
+
"button in an open key dialog and returns what it writes to the clipboard as " +
|
|
568
|
+
"{credentials: {api_key}}; page text is never scanned. When no Copy click yields a " +
|
|
569
|
+
"value, nothing is stored and `error` says to read the page with operate_observe " +
|
|
570
|
+
"and point capture at the key. Pass `store` to immediately save the value into the " +
|
|
571
|
+
"Trusty Squire vault with the session's observed hosts as allowed_hosts seed; when " +
|
|
572
|
+
"`store` is used, the response omits credential values and returns only vault " +
|
|
573
|
+
"metadata. With `into_slot`, the copied value goes into a session slot instead.",
|
|
564
574
|
inputSchema: extractSchema,
|
|
565
575
|
jsonInputSchema: {
|
|
566
576
|
type: "object",
|
|
@@ -568,7 +578,6 @@ export const provisionExtractTool = {
|
|
|
568
578
|
properties: {
|
|
569
579
|
session_id: { type: "string" },
|
|
570
580
|
into_slot: { type: "string" },
|
|
571
|
-
secret_label: { type: "string" },
|
|
572
581
|
store: {
|
|
573
582
|
type: "object",
|
|
574
583
|
required: ["service"],
|
|
@@ -586,10 +595,10 @@ export const provisionExtractTool = {
|
|
|
586
595
|
handler: handleExtract,
|
|
587
596
|
};
|
|
588
597
|
async function persistExtracted(sessionId, captureUrl, credentials, store, api, writeId) {
|
|
589
|
-
|
|
590
|
-
if (
|
|
598
|
+
const storable = storableCredentials(credentials);
|
|
599
|
+
if (storable === null)
|
|
591
600
|
return null;
|
|
592
|
-
|
|
601
|
+
credentials = storable;
|
|
593
602
|
const captureDomain = getDomain(captureUrl, { allowPrivateDomains: true });
|
|
594
603
|
const observedHosts = [
|
|
595
604
|
...new Set([
|
|
@@ -634,11 +643,7 @@ export function storedExtractResult(extracted, stored) {
|
|
|
634
643
|
return {
|
|
635
644
|
session_id: extracted.session_id,
|
|
636
645
|
url: extracted.url,
|
|
637
|
-
candidate_count: extracted.candidate_count,
|
|
638
646
|
stored_credential: stored,
|
|
639
|
-
...(extracted.masked_remaining !== undefined
|
|
640
|
-
? { masked_remaining: extracted.masked_remaining }
|
|
641
|
-
: {}),
|
|
642
647
|
};
|
|
643
648
|
}
|
|
644
649
|
// Change 2 — the pluggable terminal. Two outcome kinds: `credentials` (the
|
|
@@ -675,8 +680,8 @@ async function handleFinishOutcome(sessionId, outcome, api) {
|
|
|
675
680
|
successfulOutcome = stored !== null;
|
|
676
681
|
return {
|
|
677
682
|
kind: "credentials",
|
|
678
|
-
candidate_count: extracted.candidate_count,
|
|
679
683
|
stored_credential: stored,
|
|
684
|
+
...(extracted.error !== undefined ? { error: extracted.error } : {}),
|
|
680
685
|
};
|
|
681
686
|
}
|
|
682
687
|
successfulOutcome = true;
|
|
@@ -800,12 +805,9 @@ const sealVaultCredentialBaseSchema = z.object({
|
|
|
800
805
|
.describe(vaultCredentialFieldsDescription),
|
|
801
806
|
slot_prefix: z.string().min(1).max(60).default("vault"),
|
|
802
807
|
});
|
|
803
|
-
const sealVaultCredentialSchema = sealVaultCredentialBaseSchema.refine((b) => b.reference !== undefined || b.service !== undefined, {
|
|
804
|
-
message: "one of reference or service is required",
|
|
805
|
-
});
|
|
806
808
|
async function handleSealVaultCredential(args, api) {
|
|
807
809
|
if (api === null) {
|
|
808
|
-
throw new Error("
|
|
810
|
+
throw new Error("operate_login load_saved requires an active Trusty Squire session");
|
|
809
811
|
}
|
|
810
812
|
const current = currentProvisionUrl(args.session_id);
|
|
811
813
|
const { publicKey, privateKey } = generateKeyPairSync("rsa", {
|
|
@@ -835,27 +837,6 @@ async function handleSealVaultCredential(args, api) {
|
|
|
835
837
|
slots,
|
|
836
838
|
};
|
|
837
839
|
}
|
|
838
|
-
export const operateFillCredentialTool = {
|
|
839
|
-
name: "operate_fill_credential",
|
|
840
|
-
description: "For a sign-in page, retrieve a username/password credential only if the " +
|
|
841
|
-
"current browser host is allowed for login, then seal requested fields into " +
|
|
842
|
-
"session slots. Raw values are never returned; use operate_type with slot " +
|
|
843
|
-
"with the returned slot names to fill the page.",
|
|
844
|
-
inputSchema: sealVaultCredentialSchema,
|
|
845
|
-
jsonInputSchema: {
|
|
846
|
-
type: "object",
|
|
847
|
-
required: ["session_id"],
|
|
848
|
-
anyOf: [{ required: ["reference"] }, { required: ["service"] }],
|
|
849
|
-
properties: {
|
|
850
|
-
session_id: { type: "string" },
|
|
851
|
-
reference: { type: "string" },
|
|
852
|
-
service: { type: "string" },
|
|
853
|
-
fields: vaultCredentialFieldsJson,
|
|
854
|
-
slot_prefix: { type: "string" },
|
|
855
|
-
},
|
|
856
|
-
},
|
|
857
|
-
handler: handleSealVaultCredential,
|
|
858
|
-
};
|
|
859
840
|
const loginPrepareSignupSchema = prepareLoginSchema.extend({
|
|
860
841
|
action: z.literal("prepare_signup"),
|
|
861
842
|
});
|
|
@@ -974,7 +955,7 @@ const refJson = { ref: { type: "string" } };
|
|
|
974
955
|
const navigateSchema = z.object({ ...sessionShape, url: z.string().url() });
|
|
975
956
|
export const operateNavigateTool = {
|
|
976
957
|
name: "operate_navigate",
|
|
977
|
-
description: "Navigate to a URL without session host restrictions.
|
|
958
|
+
description: "Navigate the session to a URL without session host restrictions.",
|
|
978
959
|
inputSchema: navigateSchema,
|
|
979
960
|
jsonInputSchema: {
|
|
980
961
|
type: "object",
|
|
@@ -995,7 +976,7 @@ const clickSchema = z
|
|
|
995
976
|
...sessionShape,
|
|
996
977
|
ref: refSchema.optional(),
|
|
997
978
|
screenshot: screenshotPointSchema.optional(),
|
|
998
|
-
capture:
|
|
979
|
+
capture: captureClickSchema.optional(),
|
|
999
980
|
format: actionFormatSchema.optional(),
|
|
1000
981
|
})
|
|
1001
982
|
.refine((args) => (args.ref !== undefined) !== (args.screenshot !== undefined), {
|
|
@@ -1083,7 +1064,7 @@ const typeSchema = z
|
|
|
1083
1064
|
text: z.string().max(4096).optional(),
|
|
1084
1065
|
slot: z.string().min(1).max(60).optional(),
|
|
1085
1066
|
submit: z.boolean().optional(),
|
|
1086
|
-
capture:
|
|
1067
|
+
capture: captureActionSchema.optional(),
|
|
1087
1068
|
format: actionFormatSchema.optional(),
|
|
1088
1069
|
})
|
|
1089
1070
|
.refine((args) => (args.text !== undefined) !== (args.slot !== undefined), {
|
|
@@ -1092,7 +1073,7 @@ const typeSchema = z
|
|
|
1092
1073
|
export const operateTypeTool = {
|
|
1093
1074
|
name: "operate_type",
|
|
1094
1075
|
description: ACTION_FORMAT_NOTE +
|
|
1095
|
-
"Fill a control with text, or a session slot returned by operate_login
|
|
1076
|
+
"Fill a control with text, or a session slot returned by operate_login or operate_extract. Provide exactly one of text or slot. submit presses Enter after a successful fill.",
|
|
1096
1077
|
inputSchema: typeSchema,
|
|
1097
1078
|
jsonInputSchema: {
|
|
1098
1079
|
type: "object",
|
|
@@ -1111,18 +1092,13 @@ export const operateTypeTool = {
|
|
|
1111
1092
|
},
|
|
1112
1093
|
},
|
|
1113
1094
|
async handler(args) {
|
|
1114
|
-
|
|
1095
|
+
return await runAction(args.session_id, {
|
|
1115
1096
|
target: args.ref,
|
|
1116
1097
|
...(args.slot !== undefined
|
|
1117
1098
|
? { kind: "type_secret", slot: args.slot }
|
|
1118
1099
|
: { kind: "type", text: args.text }),
|
|
1100
|
+
...(args.submit === true ? { submit: true } : {}),
|
|
1119
1101
|
}, args.format ?? "compact", args.submit !== true);
|
|
1120
|
-
if (args.submit !== true ||
|
|
1121
|
-
(typeof result === "object" &&
|
|
1122
|
-
result !== null &&
|
|
1123
|
-
("status" in result || "needs_user" in result)))
|
|
1124
|
-
return result;
|
|
1125
|
-
return await runAction(args.session_id, { kind: "press", key: "Enter" }, args.format ?? "compact");
|
|
1126
1102
|
},
|
|
1127
1103
|
};
|
|
1128
1104
|
const selectSchema = z
|
|
@@ -1131,7 +1107,7 @@ const selectSchema = z
|
|
|
1131
1107
|
ref: refSchema.optional(),
|
|
1132
1108
|
values: z.array(z.string().min(1).max(4096)).length(1).optional(),
|
|
1133
1109
|
selections: formSelectionsSchema.optional(),
|
|
1134
|
-
capture:
|
|
1110
|
+
capture: captureActionSchema.optional(),
|
|
1135
1111
|
country: z.string().min(1).max(60).optional(),
|
|
1136
1112
|
format: actionFormatSchema.optional(),
|
|
1137
1113
|
})
|
|
@@ -1197,7 +1173,7 @@ export const operateSelectTool = {
|
|
|
1197
1173
|
const pressSchema = z.object({
|
|
1198
1174
|
...sessionShape,
|
|
1199
1175
|
key: z.string().min(1).max(40),
|
|
1200
|
-
capture:
|
|
1176
|
+
capture: captureActionSchema.optional(),
|
|
1201
1177
|
format: actionFormatSchema.optional(),
|
|
1202
1178
|
});
|
|
1203
1179
|
export const operatePressTool = {
|
|
@@ -1283,32 +1259,12 @@ const readInboxSchema = z.object({
|
|
|
1283
1259
|
});
|
|
1284
1260
|
export const operateReadInboxTool = {
|
|
1285
1261
|
name: "operate_read_inbox",
|
|
1286
|
-
description: "Read
|
|
1287
|
-
"
|
|
1288
|
-
"
|
|
1289
|
-
"
|
|
1290
|
-
"a code
|
|
1291
|
-
"
|
|
1292
|
-
"(drive fact `email`, or `recipient`) and the service host from the session " +
|
|
1293
|
-
"start URL. A verification mail that matches neither is not a candidate — " +
|
|
1294
|
-
"returning another service's newest mail is worse than returning nothing. " +
|
|
1295
|
-
"An IP or localhost start URL is the exception: no From address can ever " +
|
|
1296
|
-
"contain it, so host scoping there would drop every mail and protect " +
|
|
1297
|
-
"nothing — such a read is NOT host-scoped and the newest mail after the " +
|
|
1298
|
-
"session start wins, so cross-check `source_from` before using the code. " +
|
|
1299
|
-
"`sender` and `recipient` override those defaults when the caller has a " +
|
|
1300
|
-
"narrower hint. The newest matching mail is the one read, cross-checked " +
|
|
1301
|
-
"across the search listing AND the real-time All Mail listing (Gmail's " +
|
|
1302
|
-
"search index can lag fresh mail by minutes — found:false means the mail is " +
|
|
1303
|
-
"not in the mailbox, not that the search was stale). A miss reports the " +
|
|
1304
|
-
"query it searched. `into_slot` " +
|
|
1305
|
-
"seals a found OTP into a session slot so it is typed with operate_type slot and " +
|
|
1306
|
-
"never crosses the MCP boundary; `grant_inbox_consent` overrides the session's " +
|
|
1307
|
-
"inbox-read consent for this call. Returns needs_user when nothing is found yet " +
|
|
1308
|
-
"— retry after a few seconds or ask the user (the session stays live). A " +
|
|
1309
|
-
"needs_user carrying wall:google_session is the opposite case: the operator " +
|
|
1310
|
-
"cannot read the inbox until the user runs `connect`, so retrying cannot clear " +
|
|
1311
|
-
"it — don't poll and don't ask the user for a code.",
|
|
1262
|
+
description: "Read verification mail in a separate tab without changing the live form. Returns {code, link, source_from} or needs_user. " +
|
|
1263
|
+
"The default search uses the session recipient and service host; sender and recipient narrow it. " +
|
|
1264
|
+
"For an IP or localhost start URL, host scoping is unavailable: check source_from before using the result. " +
|
|
1265
|
+
"It checks search and All Mail because Gmail search can lag. A miss reports the query; retry after a few seconds. " +
|
|
1266
|
+
"into_slot keeps a found code in a session slot for operate_type; grant_inbox_consent overrides consent for this call. " +
|
|
1267
|
+
"If needs_user reports wall:google_session, ask the user to run connect; polling will not clear it.",
|
|
1312
1268
|
inputSchema: readInboxSchema,
|
|
1313
1269
|
jsonInputSchema: {
|
|
1314
1270
|
type: "object",
|
|
@@ -1419,27 +1375,17 @@ const driveSchema = z
|
|
|
1419
1375
|
});
|
|
1420
1376
|
export const operateDriveTool = {
|
|
1421
1377
|
name: "operate_drive",
|
|
1422
|
-
description: "Drive a signup, checkout, or other website goal
|
|
1423
|
-
"
|
|
1424
|
-
"
|
|
1425
|
-
"
|
|
1426
|
-
"
|
|
1427
|
-
"
|
|
1428
|
-
"
|
|
1429
|
-
"
|
|
1430
|
-
"
|
|
1431
|
-
"
|
|
1432
|
-
"
|
|
1433
|
-
"a budget handoff is partial progress — call again on the same session to continue. " +
|
|
1434
|
-
"Resume with answer (one option key from a previous handoff: a readable action slug, done, or stuck) and/or added " +
|
|
1435
|
-
"facts; the loop continues from the current page. Returns a handoff, never a bare page: status, " +
|
|
1436
|
-
"the current compact observation with the same stable refs, trajectory, done/remaining, and " +
|
|
1437
|
-
"step/time counters. Status complete means the goal is done; needs_value names the missing field's label; " +
|
|
1438
|
-
"stuck means no listed element advances the goal; " +
|
|
1439
|
-
"low_confidence includes the question, options, probabilities, and confidence; " +
|
|
1440
|
-
"invalid_answer is a malformed Jev choice (reason + confidence) after one same-observation retry; no_progress, budget, " +
|
|
1441
|
-
"jev_unavailable, evaluate_timeout (an in-page evaluate was aborted so the broker stays serving), pending_approval (card approval URL), and card_incomplete (the card released but not every requested field landed; resume to retry the fill against the same approval_id) are resumable. Google sign-in, " +
|
|
1442
|
-
"verification-email read, captcha, and card release run inside the loop. Always operate_finish when done.",
|
|
1378
|
+
description: "Drive a multi-step signup, checkout, or other website goal and hand back when complete, blocked, or out of budget. " +
|
|
1379
|
+
"For a known multi-step goal, pass url, goal, and all known facts directly; this skips the initial general observation. Use session_id to resume the same session. " +
|
|
1380
|
+
"Identity and payment values must come from facts; a search phrase may come from the goal. " +
|
|
1381
|
+
"Amount_cents is in the currency's smallest unit: USD $12.34 -> 1234; JPY ¥65,800 -> 65800 (do not multiply by 100); KRW works like JPY. " +
|
|
1382
|
+
"The loop can handle Google sign-in, verification mail, captcha, and card release. " +
|
|
1383
|
+
"max_steps (default 60) and max_seconds (default 45) bound a call. Resume a budget or other partial handoff on the " +
|
|
1384
|
+
"same session with added facts and/or answer from its options. The handoff includes status, current compact observation, " +
|
|
1385
|
+
"trajectory, done/remaining, and counters. complete means done; needs_value names a missing field; stuck and low_confidence " +
|
|
1386
|
+
"need a decision. invalid_answer, no_progress, budget, evaluate_timeout, pending_approval, and " +
|
|
1387
|
+
"card_incomplete are resumable. After a card_incomplete handoff, retry against the same approval_id. " +
|
|
1388
|
+
"Always operate_finish when done.",
|
|
1443
1389
|
inputSchema: driveSchema,
|
|
1444
1390
|
jsonInputSchema: {
|
|
1445
1391
|
type: "object",
|
|
@@ -1490,7 +1436,6 @@ export const OPERATE_TOOLS = [
|
|
|
1490
1436
|
operateWaitTool,
|
|
1491
1437
|
operateReadInboxTool,
|
|
1492
1438
|
operateLoginTool,
|
|
1493
|
-
operateFillCredentialTool,
|
|
1494
1439
|
provisionExtractTool,
|
|
1495
1440
|
];
|
|
1496
1441
|
const captureOutputSchema = {
|
|
@@ -1545,9 +1490,11 @@ for (const tool of OPERATE_TOOLS) {
|
|
|
1545
1490
|
continue;
|
|
1546
1491
|
const properties = tool.jsonInputSchema.properties;
|
|
1547
1492
|
if (properties !== null && typeof properties === "object")
|
|
1548
|
-
Object.assign(properties, { capture:
|
|
1493
|
+
Object.assign(properties, { capture: captureJsonFor(tool.name) });
|
|
1549
1494
|
tool.description +=
|
|
1550
|
-
|
|
1495
|
+
CAPTURE_NOTE +
|
|
1496
|
+
(tool.name === "operate_click" ? CLICK_CAPTURE_NOTE : "") +
|
|
1497
|
+
(tool.name === "operate_extract" ? EXTRACT_CAPTURE_NOTE : "");
|
|
1551
1498
|
tool.jsonOutputSchema = captureOutputSchema;
|
|
1552
1499
|
const handler = tool.handler;
|
|
1553
1500
|
tool.handler = async (args, api, context) => {
|
|
@@ -1555,12 +1502,18 @@ for (const tool of OPERATE_TOOLS) {
|
|
|
1555
1502
|
return await handler(args, api, context);
|
|
1556
1503
|
if (api === null)
|
|
1557
1504
|
throw new Error("capture requires an active Trusty Squire session");
|
|
1558
|
-
const capture =
|
|
1505
|
+
const capture = tool.name === "operate_extract"
|
|
1506
|
+
? captureExtractSchema.parse(args.capture)
|
|
1507
|
+
: tool.name === "operate_click"
|
|
1508
|
+
? captureClickSchema.parse(args.capture)
|
|
1509
|
+
: captureActionSchema.parse(args.capture);
|
|
1559
1510
|
if (typeof args.session_id !== "string")
|
|
1560
1511
|
throw new Error("capture requires a session");
|
|
1561
1512
|
const recovery = capture.write_id !== undefined;
|
|
1562
1513
|
if (tool.name !== "operate_extract" && recovery)
|
|
1563
1514
|
throw new Error("capture.write_id is for extraction-only recovery, not another mutation");
|
|
1515
|
+
if ("clipboard" in capture.source && tool.name !== "operate_click")
|
|
1516
|
+
throw new Error("capture.source.clipboard is only valid on operate_click");
|
|
1564
1517
|
const writeId = capture.write_id ?? currentOperatorOperationId() ?? randomUUID();
|
|
1565
1518
|
capture.write_id = writeId;
|
|
1566
1519
|
const binding = createHash("sha256")
|