@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
@@ -17,8 +17,7 @@ const proxySchema = z
17
17
  });
18
18
  return;
19
19
  }
20
- if (parsed.hostname.length === 0 ||
21
- !["http:", "https:", "socks5:"].includes(parsed.protocol)) {
20
+ if (parsed.hostname.length === 0 || !["http:", "https:", "socks5:"].includes(parsed.protocol)) {
22
21
  ctx.addIssue({
23
22
  code: z.ZodIssueCode.custom,
24
23
  message: "proxy must be a valid HTTP, HTTPS, or SOCKS5 URL",
@@ -63,32 +62,19 @@ const startSchema = z.object({
63
62
  // account) set this so start fails closed to a connect hand-back if no live
64
63
  // Google session exists — rather than driving into a mid-task login wall.
65
64
  });
66
- const DOM_OBSERVATION_CONTRACT = 'With `format:"full"`, the response format is `browser-use-dom`: `session_id` continues the session, `url` is the live page URL, ' +
67
- "and `stage` identifies the page stage. `dom` is a tab-indented tree with interleaved visible text: " +
68
- "`[@e:...]<tag attributes />` identifies a control; attributes may include field values and state. " +
69
- "`|SHADOW(open)|` / `|SHADOW(closed)|` mark shadow hosts, with Open/Closed Shadow and Shadow End boundaries. " +
70
- "`not-targetable=true` marks display-only refs that cannot be acted on. `*` before a ref marks a new " +
71
- "element or compound control. `more_above` / `more_below` indicate content beyond the viewport; use operate_scroll. " +
72
- "`delta:true` means the same document: when `dom` is present it replaces the entire prior tree; " +
73
- "when omitted retain the prior tree. `removed` lists refs that left the rendered view. " +
74
- "Without delta:true, reset the prior view. Refs stay usable on the same document; on stale_ref, " +
75
- "call operate_observe and choose a current ref. ";
76
- const CONTROL_QUERY_CONTRACT = 'The default `format:"compact"` response is `browser-use-control-query`. It contains every actionable control ' +
77
- "(button, link, textbox, select, checkbox, radio, tab, menuitem, and file), including off-viewport controls; " +
78
- "non-control markup and arbitrary page text are absent by construction, not redacted. Query or role filters this same map. " +
79
- "Its `safe_table` is a paged control map: each row is `[ref,role,facts?]`; role is " +
80
- "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). " +
81
- "facts is a `|`-joined `@label` alias followed by present s=state (c=checked, u=unchecked, d=disabled, r=required), " +
82
- "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. " +
83
- "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. " +
84
- "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. " +
85
- "semantic.blocked=true and semantic.blockers report what blocks the task independently of stage; stage=browse does not mean unblocked. " +
86
- "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). " +
87
- "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. " +
88
- "Cursors page an immutable snapshot and require the same query and role; document changes invalidate them. A cursorless query captures fresh controls and semantics. " +
89
- "Use overflow.next_cursor to page safe_table. A cursor from hint_overflow returns `hint` and pages with hint_overflow.next_cursor. ";
90
- 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. " +
91
- '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. ';
65
+ const DOM_OBSERVATION_CONTRACT = 'With `format:"full"`, `browser-use-dom` returns a tab-indented `dom` tree with text and `[@e:...]` controls. ' +
66
+ "`|SHADOW(open)|` / `|SHADOW(closed)|` mark shadow hosts; `not-targetable=true` refs are display-only. " +
67
+ "`*` marks a new control; `more_above` / `more_below` signal offscreen content. " +
68
+ "On `delta:true`, a present `dom` replaces the prior tree; otherwise keep it and remove refs in `removed`. " +
69
+ "Without delta, reset the view. Refs stay usable on the same document; on stale_ref, observe again. ";
70
+ 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?]`. ' +
71
+ "Arbitrary page text is absent from this control map; use full format when text matters. " +
72
+ "Roles b/l/t/s/c/r/tb/m/f mean button/link/textbox/select/checkbox/radio/tab/menuitem/file; other roles are literal. " +
73
+ "`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. " +
74
+ "Query or role filters controls; `m=n/r/t/c` marks name/role/text/context matches. " +
75
+ "`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. " +
76
+ "Use `overflow.next_cursor` to page with the same query and role; `hint_overflow.next_cursor` pages hints. Document changes invalidate cursors. ";
77
+ 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. ';
92
78
  const ACTION_FORMATS = ["compact", "full"];
93
79
  const actionFormatSchema = z.enum(ACTION_FORMATS);
94
80
  const actionFormatJson = { type: "string", enum: [...ACTION_FORMATS] };
@@ -155,6 +141,13 @@ const captureSchema = z
155
141
  .optional(),
156
142
  })
157
143
  .strict();
144
+ const captureClickSchema = captureSchema.omit({ write_id: true });
145
+ const captureActionSchema = captureClickSchema.extend({
146
+ source: captureSourceSchema.refine((source) => !("clipboard" in source), "capture.source.clipboard is only valid on operate_click"),
147
+ });
148
+ const captureExtractSchema = captureSchema.extend({
149
+ source: captureActionSchema.shape.source,
150
+ });
158
151
  const captureJson = {
159
152
  type: "object",
160
153
  additionalProperties: false,
@@ -181,8 +174,20 @@ const captureJson = {
181
174
  required: ["selector"],
182
175
  not: { anyOf: [{ required: ["role"] }, { required: ["name"] }] },
183
176
  },
177
+ {
178
+ required: ["clipboard"],
179
+ not: {
180
+ anyOf: [
181
+ { required: ["role"] },
182
+ { required: ["name"] },
183
+ { required: ["selector"] },
184
+ { required: ["container"] },
185
+ ],
186
+ },
187
+ },
184
188
  ],
185
189
  properties: {
190
+ clipboard: { type: "boolean", const: true },
186
191
  selector: { type: "string", minLength: 1, maxLength: 2000 },
187
192
  role: { type: "string", enum: ["textbox", "code"] },
188
193
  name: { type: "string", maxLength: 200 },
@@ -197,14 +202,33 @@ const captureJson = {
197
202
  },
198
203
  },
199
204
  },
200
- write_id: {
201
- type: "string",
202
- minLength: 1,
203
- maxLength: 128,
204
- pattern: "^[a-zA-Z0-9:_-]+$",
205
- },
205
+ write_id: { type: "string", minLength: 1, maxLength: 128, pattern: "^[a-zA-Z0-9:_-]+$" },
206
206
  },
207
207
  };
208
+ const captureJsonFor = (toolName) => {
209
+ const { write_id: _writeId, ...actionProperties } = captureJson.properties;
210
+ if (toolName === "operate_click")
211
+ return { ...captureJson, properties: actionProperties };
212
+ const { clipboard: _clipboard, ...sourceProperties } = captureJson.properties.source.properties;
213
+ return {
214
+ ...captureJson,
215
+ properties: {
216
+ ...(toolName === "operate_extract" ? captureJson.properties : actionProperties),
217
+ source: {
218
+ ...captureJson.properties.source,
219
+ oneOf: captureJson.properties.source.oneOf.slice(0, 2),
220
+ properties: sourceProperties,
221
+ },
222
+ },
223
+ };
224
+ };
225
+ 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. " +
226
+ "Role and value-free CSS selector sources can cross open shadow roots; a unique secret-shaped textbox can match without an id. " +
227
+ "capture_unresolved returns candidate_count 0 and found roles/names; capture_ambiguous means several matches. " +
228
+ "An unresolved capture does not block unrelated actions. Never paste a secret into a page field to read it.";
229
+ const CLICK_CAPTURE_NOTE = " On operate_click, source:{clipboard:true} stores only a new clipboard value written by that click; " +
230
+ "an unchanged or empty clipboard stores nothing and reports capture_clipboard_unchanged or capture_clipboard_empty.";
231
+ const EXTRACT_CAPTURE_NOTE = " Only operate_extract accepts capture.write_id to retry storage after an unresolved capture.";
208
232
  const storeJsonProps = {
209
233
  service: { type: "string" },
210
234
  label: { type: "string" },
@@ -217,12 +241,11 @@ const formSelectionsSchema = z
217
241
  .record(z.string().min(1).max(200), z.string().min(1).max(4096))
218
242
  .refine((value) => Object.keys(value).length > 0, "Provide at least one selection")
219
243
  .refine((value) => Object.keys(value).length <= 12, "At most 12 selections per call")
220
- .describe("Map each current browser-use DOM @e: ref or @label, or V1 observed label/ref, to its visible option text.");
244
+ .describe("Map each current control ref or @label to its visible option text.");
221
245
  const extractSchema = z.object({
222
- capture: captureSchema.optional(),
246
+ capture: captureExtractSchema.optional(),
223
247
  session_id: z.string().min(1),
224
248
  into_slot: z.string().min(1).max(60).optional(),
225
- secret_label: z.string().min(1).max(60).optional(),
226
249
  store: storeShape.optional(),
227
250
  });
228
251
  const finishDataSchema = z.record(z.union([z.string().max(4000), z.number(), z.boolean()]));
@@ -264,9 +287,6 @@ const sealVaultCredentialBaseSchema = z.object({
264
287
  .describe(vaultCredentialFieldsDescription),
265
288
  slot_prefix: z.string().min(1).max(60).default("vault"),
266
289
  });
267
- const sealVaultCredentialSchema = sealVaultCredentialBaseSchema.refine((b) => b.reference !== undefined || b.service !== undefined, {
268
- message: "one of reference or service is required",
269
- });
270
290
  const loginPrepareSignupSchema = prepareLoginSchema.extend({
271
291
  action: z.literal("prepare_signup"),
272
292
  });
@@ -307,7 +327,7 @@ const clickSchema = z
307
327
  ...sessionShape,
308
328
  ref: refSchema.optional(),
309
329
  screenshot: screenshotPointSchema.optional(),
310
- capture: captureSchema.optional(),
330
+ capture: captureClickSchema.optional(),
311
331
  format: actionFormatSchema.optional(),
312
332
  })
313
333
  .refine((args) => (args.ref !== undefined) !== (args.screenshot !== undefined), {
@@ -320,7 +340,7 @@ const typeSchema = z
320
340
  text: z.string().max(4096).optional(),
321
341
  slot: z.string().min(1).max(60).optional(),
322
342
  submit: z.boolean().optional(),
323
- capture: captureSchema.optional(),
343
+ capture: captureActionSchema.optional(),
324
344
  format: actionFormatSchema.optional(),
325
345
  })
326
346
  .refine((args) => (args.text !== undefined) !== (args.slot !== undefined), {
@@ -332,7 +352,7 @@ const selectSchema = z
332
352
  ref: refSchema.optional(),
333
353
  values: z.array(z.string().min(1).max(4096)).length(1).optional(),
334
354
  selections: formSelectionsSchema.optional(),
335
- capture: captureSchema.optional(),
355
+ capture: captureActionSchema.optional(),
336
356
  country: z.string().min(1).max(60).optional(),
337
357
  format: actionFormatSchema.optional(),
338
358
  })
@@ -340,8 +360,7 @@ const selectSchema = z
340
360
  const modes = Number(args.ref !== undefined || args.values !== undefined) +
341
361
  Number(args.selections !== undefined) +
342
362
  Number(args.country !== undefined);
343
- if (modes !== 1 ||
344
- (args.ref !== undefined) !== (args.values !== undefined)) {
363
+ if (modes !== 1 || (args.ref !== undefined) !== (args.values !== undefined)) {
345
364
  ctx.addIssue({
346
365
  code: z.ZodIssueCode.custom,
347
366
  message: "Provide ref + values, selections, or country",
@@ -351,7 +370,7 @@ const selectSchema = z
351
370
  const pressSchema = z.object({
352
371
  ...sessionShape,
353
372
  key: z.string().min(1).max(40),
354
- capture: captureSchema.optional(),
373
+ capture: captureActionSchema.optional(),
355
374
  format: actionFormatSchema.optional(),
356
375
  });
357
376
  const scrollSchema = z.object({
@@ -381,13 +400,8 @@ const publicFinishSchema = z
381
400
  })
382
401
  .superRefine((args, ctx) => {
383
402
  if (args.outcome === "credentials" && args.store === undefined)
384
- ctx.addIssue({
385
- code: z.ZodIssueCode.custom,
386
- message: "credentials outcome requires store",
387
- });
388
- if (args.outcome === "result" &&
389
- args.summary === undefined &&
390
- args.data === undefined)
403
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: "credentials outcome requires store" });
404
+ if (args.outcome === "result" && args.summary === undefined && args.data === undefined)
391
405
  ctx.addIssue({
392
406
  code: z.ZodIssueCode.custom,
393
407
  message: "result outcome requires summary or data",
@@ -420,12 +434,9 @@ export const provisionStartTool = {
420
434
  CONTROL_QUERY_CONTRACT +
421
435
  '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. ' +
422
436
  DOM_OBSERVATION_CONTRACT +
423
- "For a signup, checkout, or other goal-shaped task, call operate_drive " +
424
- "with the goal and facts (or pass url to operate_drive to open and drive in one call) " +
425
- "instead of planning each click and type yourself; resume the same session with " +
426
- "answer and/or added facts if it hands back. The primitives " +
427
- "(operate_click, operate_type, operate_select, operate_navigate, operate_scroll, operate_login) " +
428
- "remain for a single step the drive handed back or a task that is not a goal. " +
437
+ "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. " +
438
+ "operate_click, operate_type, operate_select, operate_navigate, operate_scroll, and operate_login " +
439
+ "complete individual steps. Resume a drive handoff on the same session with answer or added facts. " +
429
440
  "inject_card releases a saved card into pan/cvv refs and exposes masked {{pan}}/{{cvv}} per-digit tokens for operate_type placement. " +
430
441
  "Call operate_extract when you reach the credentials. Always operate_finish when done. The " +
431
442
  "browser has unrestricted egress.",
@@ -478,19 +489,13 @@ export const provisionObserveTool = {
478
489
  };
479
490
  export const provisionScreenshotTool = {
480
491
  name: "operate_screenshot",
481
- description: "WARNING: EXPENSIVE — a screenshot is a full image and costs far more context than any " +
482
- "observation. Reach for it ONLY when the DOM tree or control search (" +
483
- "operate_observe with query/cursor) is NOT sufficient to determine the page state; " +
484
- "if the observation already tells you what the page is doing, do not take one. " +
485
- "Debugging tool: capture a screenshot of what the operate session's browser actually RENDERS — " +
486
- "the whole page (default: viewport; full_page:true for the whole scrollable page) or ONE specific " +
487
- "frame in isolation via frame_index or frame_url_contains, so a cross-origin challenge iframe (a " +
488
- "3-D Secure ACS frame, a captcha) can be captured on its own even when it won't show clearly inside " +
489
- "a full-page shot. Use this when the DOM tree from an explicitly " +
490
- "selected full observation isn't enough to tell what state " +
491
- "a stuck page is actually in — a challenge that never advances, an unexpected layout, a captcha you " +
492
- "need to SEE. Read-only: never navigates, clicks, types, submits, or steals focus; it only reads " +
493
- "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.",
492
+ description: "Capture rendered pixels from the viewport (or full_page:true) or one frame via frame_index or frame_url_contains. " +
493
+ "A screenshot costs more context than operate_observe; use it when visual state or a coordinate click matters, " +
494
+ "including a captcha or 3-D Secure ACS frame. During bank approval, short, non-blocking screenshots or observations " +
495
+ "can watch for a change. This read does not interact with the page. Released PAN and security code in injected " +
496
+ "controls and identified displayed copies are covered; if masking fails, capture fails. " +
497
+ "A click_binding authorizes one dispatched operate_click point in original image pixels for 60 seconds; " +
498
+ "navigation, scroll, viewport, or frame changes invalidate it. Without a binding, capture again before a coordinate click.",
494
499
  inputSchema: screenshotSchema,
495
500
  jsonInputSchema: {
496
501
  type: "object",
@@ -542,18 +547,14 @@ export const provisionNetworkTool = {
542
547
  };
543
548
  export const provisionExtractTool = {
544
549
  name: "operate_extract",
545
- description: "Reveal masked keys and extract credentials from the current page: returns " +
546
- "{credentials, candidate_count}. credentials may include " +
547
- "`api_key` (or `api_key_truncated` if only a masked display was reachable) " +
548
- "plus named fields for multi-credential services. Pass `store` to immediately " +
549
- "save the extracted credential into the Trusty Squire vault with the session's " +
550
- "observed hosts as allowed_hosts seed; when `store` is used, the response omits " +
551
- "credential values and returns only vault metadata. " +
552
- "Call when you have navigated to the keys page. " +
553
- "With `into_slot`, a value that still looks masked is ranked behind a fully " +
554
- "revealed sibling but never refused; pass " +
555
- '`secret_label` (e.g. "client secret") to pick the right one when the page ' +
556
- "shows several credentials.",
550
+ description: "Store a key by its source, never by its shape. Without capture, clicks the Copy " +
551
+ "button in an open key dialog and returns what it writes to the clipboard as " +
552
+ "{credentials: {api_key}}; page text is never scanned. When no Copy click yields a " +
553
+ "value, nothing is stored and `error` says to read the page with operate_observe " +
554
+ "and point capture at the key. Pass `store` to immediately save the value into the " +
555
+ "Trusty Squire vault with the session's observed hosts as allowed_hosts seed; when " +
556
+ "`store` is used, the response omits credential values and returns only vault " +
557
+ "metadata. With `into_slot`, the copied value goes into a session slot instead.",
557
558
  inputSchema: extractSchema,
558
559
  jsonInputSchema: {
559
560
  type: "object",
@@ -561,7 +562,6 @@ export const provisionExtractTool = {
561
562
  properties: {
562
563
  session_id: { type: "string" },
563
564
  into_slot: { type: "string" },
564
- secret_label: { type: "string" },
565
565
  store: {
566
566
  type: "object",
567
567
  required: ["service"],
@@ -580,29 +580,6 @@ export const provisionExtractTool = {
580
580
  return await (await import("./provision-drive.js")).provisionExtractTool.handler(args, api, context);
581
581
  },
582
582
  };
583
- export const operateFillCredentialTool = {
584
- name: "operate_fill_credential",
585
- description: "For a sign-in page, retrieve a username/password credential only if the " +
586
- "current browser host is allowed for login, then seal requested fields into " +
587
- "session slots. Raw values are never returned; use operate_type with slot " +
588
- "with the returned slot names to fill the page.",
589
- inputSchema: sealVaultCredentialSchema,
590
- jsonInputSchema: {
591
- type: "object",
592
- required: ["session_id"],
593
- anyOf: [{ required: ["reference"] }, { required: ["service"] }],
594
- properties: {
595
- session_id: { type: "string" },
596
- reference: { type: "string" },
597
- service: { type: "string" },
598
- fields: vaultCredentialFieldsJson,
599
- slot_prefix: { type: "string" },
600
- },
601
- },
602
- async handler(args, api, context) {
603
- return await (await import("./provision-drive.js")).operateFillCredentialTool.handler(args, api, context);
604
- },
605
- };
606
583
  export const operateLoginTool = {
607
584
  name: "operate_login",
608
585
  description: "Log in with provider + ref using the atomic OAuth flow; awaiting-human state is returned in this call. After a dispatched timeout or error, completion may be unknown: retain session_id and call operate_observe before another action; do not repeat OAuth blindly. " +
@@ -667,7 +644,7 @@ export const operateLoginTool = {
667
644
  };
668
645
  export const operateNavigateTool = {
669
646
  name: "operate_navigate",
670
- description: "Navigate to a URL without session host restrictions. Squire control-plane destinations remain refused.",
647
+ description: "Navigate the session to a URL without session host restrictions.",
671
648
  inputSchema: navigateSchema,
672
649
  jsonInputSchema: {
673
650
  type: "object",
@@ -713,7 +690,7 @@ export const operateClickTool = {
713
690
  export const operateTypeTool = {
714
691
  name: "operate_type",
715
692
  description: ACTION_FORMAT_NOTE +
716
- "Fill a control with text, or a session slot returned by operate_login, operate_fill_credential, or operate_extract. Provide exactly one of text or slot. submit presses Enter after a successful fill.",
693
+ "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.",
717
694
  inputSchema: typeSchema,
718
695
  jsonInputSchema: {
719
696
  type: "object",
@@ -746,40 +723,25 @@ export const operateSelectTool = {
746
723
  oneOf: [
747
724
  {
748
725
  required: ["ref", "values"],
749
- not: {
750
- anyOf: [{ required: ["selections"] }, { required: ["country"] }],
751
- },
726
+ not: { anyOf: [{ required: ["selections"] }, { required: ["country"] }] },
752
727
  },
753
728
  {
754
729
  required: ["selections"],
755
730
  not: {
756
- anyOf: [
757
- { required: ["ref"] },
758
- { required: ["values"] },
759
- { required: ["country"] },
760
- ],
731
+ anyOf: [{ required: ["ref"] }, { required: ["values"] }, { required: ["country"] }],
761
732
  },
762
733
  },
763
734
  {
764
735
  required: ["country"],
765
736
  not: {
766
- anyOf: [
767
- { required: ["ref"] },
768
- { required: ["values"] },
769
- { required: ["selections"] },
770
- ],
737
+ anyOf: [{ required: ["ref"] }, { required: ["values"] }, { required: ["selections"] }],
771
738
  },
772
739
  },
773
740
  ],
774
741
  properties: {
775
742
  ...sessionJson,
776
743
  ...refJson,
777
- values: {
778
- type: "array",
779
- items: { type: "string" },
780
- minItems: 1,
781
- maxItems: 1,
782
- },
744
+ values: { type: "array", items: { type: "string" }, minItems: 1, maxItems: 1 },
783
745
  selections: { type: "object", additionalProperties: { type: "string" } },
784
746
  country: { type: "string" },
785
747
  format: actionFormatJson,
@@ -817,11 +779,7 @@ export const operateScrollTool = {
817
779
  required: ["session_id"],
818
780
  properties: {
819
781
  ...sessionJson,
820
- direction: {
821
- type: "string",
822
- enum: ["down", "up", "bottom", "top"],
823
- default: "down",
824
- },
782
+ direction: { type: "string", enum: ["down", "up", "bottom", "top"], default: "down" },
825
783
  format: actionFormatJson,
826
784
  },
827
785
  },
@@ -839,12 +797,7 @@ export const operateWaitTool = {
839
797
  required: ["session_id"],
840
798
  properties: {
841
799
  ...sessionJson,
842
- milliseconds: {
843
- type: "integer",
844
- minimum: 0,
845
- maximum: 30_000,
846
- default: 1_000,
847
- },
800
+ milliseconds: { type: "integer", minimum: 0, maximum: 30_000, default: 1_000 },
848
801
  format: actionFormatJson,
849
802
  },
850
803
  },
@@ -854,32 +807,12 @@ export const operateWaitTool = {
854
807
  };
855
808
  export const operateReadInboxTool = {
856
809
  name: "operate_read_inbox",
857
- description: "Read the session's signed-in Gmail inbox for a verification email and return " +
858
- "{code, link, source_from} WITHOUT touching the live page: the read runs in a " +
859
- "dedicated tab that is closed when done, so a signup form or dialog waiting for " +
860
- "the code stays exactly as it is. NEVER navigate the session to the mailbox for " +
861
- "a code or link — navigating away and back resets the form and closes the " +
862
- "waiting dialog. The read is scoped to this session: the signup recipient " +
863
- "(drive fact `email`, or `recipient`) and the service host from the session " +
864
- "start URL. A verification mail that matches neither is not a candidate — " +
865
- "returning another service's newest mail is worse than returning nothing. " +
866
- "An IP or localhost start URL is the exception: no From address can ever " +
867
- "contain it, so host scoping there would drop every mail and protect " +
868
- "nothing — such a read is NOT host-scoped and the newest mail after the " +
869
- "session start wins, so cross-check `source_from` before using the code. " +
870
- "`sender` and `recipient` override those defaults when the caller has a " +
871
- "narrower hint. The newest matching mail is the one read, cross-checked " +
872
- "across the search listing AND the real-time All Mail listing (Gmail's " +
873
- "search index can lag fresh mail by minutes — found:false means the mail is " +
874
- "not in the mailbox, not that the search was stale). A miss reports the " +
875
- "query it searched. `into_slot` " +
876
- "seals a found OTP into a session slot so it is typed with operate_type slot and " +
877
- "never crosses the MCP boundary; `grant_inbox_consent` overrides the session's " +
878
- "inbox-read consent for this call. Returns needs_user when nothing is found yet " +
879
- "— retry after a few seconds or ask the user (the session stays live). A " +
880
- "needs_user carrying wall:google_session is the opposite case: the operator " +
881
- "cannot read the inbox until the user runs `connect`, so retrying cannot clear " +
882
- "it — don't poll and don't ask the user for a code.",
810
+ description: "Read verification mail in a separate tab without changing the live form. Returns {code, link, source_from} or needs_user. " +
811
+ "The default search uses the session recipient and service host; sender and recipient narrow it. " +
812
+ "For an IP or localhost start URL, host scoping is unavailable: check source_from before using the result. " +
813
+ "It checks search and All Mail because Gmail search can lag. A miss reports the query; retry after a few seconds. " +
814
+ "into_slot keeps a found code in a session slot for operate_type; grant_inbox_consent overrides consent for this call. " +
815
+ "If needs_user reports wall:google_session, ask the user to run connect; polling will not clear it.",
883
816
  inputSchema: readInboxSchema,
884
817
  jsonInputSchema: {
885
818
  type: "object",
@@ -901,34 +834,15 @@ export const operateFinishTool = {
901
834
  name: "operate_finish",
902
835
  jsonOutputSchema: {
903
836
  type: "object",
904
- required: [
905
- "session_id",
906
- "operation_id",
907
- "execution",
908
- "mutation",
909
- "cleanup",
910
- "closed",
911
- ],
837
+ required: ["session_id", "operation_id", "execution", "mutation", "cleanup", "closed"],
912
838
  properties: {
913
839
  session_id: { type: "string" },
914
840
  operation_id: { type: "string" },
915
- execution: {
916
- type: "string",
917
- enum: ["completed", "cancelled", "pending", "unknown"],
918
- },
919
- mutation: {
920
- type: "string",
921
- enum: ["not_dispatched", "dispatched", "unknown"],
922
- },
923
- cleanup: {
924
- type: "string",
925
- enum: ["open", "closing", "closed", "already_closed", "unknown"],
926
- },
841
+ execution: { type: "string", enum: ["completed", "cancelled", "pending", "unknown"] },
842
+ mutation: { type: "string", enum: ["not_dispatched", "dispatched", "unknown"] },
843
+ cleanup: { type: "string", enum: ["open", "closing", "closed", "already_closed", "unknown"] },
927
844
  closed: { type: "boolean" },
928
- data: {
929
- type: "object",
930
- additionalProperties: { type: ["string", "number", "boolean"] },
931
- },
845
+ data: { type: "object", additionalProperties: { type: ["string", "number", "boolean"] } },
932
846
  },
933
847
  additionalProperties: true,
934
848
  },
@@ -939,32 +853,18 @@ export const operateFinishTool = {
939
853
  required: ["session_id"],
940
854
  properties: {
941
855
  ...sessionJson,
942
- outcome: {
943
- type: "string",
944
- enum: ["none", "credentials", "result"],
945
- default: "none",
946
- },
947
- store: {
948
- type: "object",
949
- required: ["service"],
950
- properties: storeJsonProps,
951
- },
856
+ outcome: { type: "string", enum: ["none", "credentials", "result"], default: "none" },
857
+ store: { type: "object", required: ["service"], properties: storeJsonProps },
952
858
  summary: { type: "string" },
953
859
  data: { type: "object" },
954
860
  },
955
861
  allOf: [
956
862
  {
957
- if: {
958
- required: ["outcome"],
959
- properties: { outcome: { const: "credentials" } },
960
- },
863
+ if: { required: ["outcome"], properties: { outcome: { const: "credentials" } } },
961
864
  then: { required: ["store"] },
962
865
  },
963
866
  {
964
- if: {
965
- required: ["outcome"],
966
- properties: { outcome: { const: "result" } },
967
- },
867
+ if: { required: ["outcome"], properties: { outcome: { const: "result" } } },
968
868
  then: { anyOf: [{ required: ["summary"] }, { required: ["data"] }] },
969
869
  },
970
870
  ],
@@ -975,27 +875,17 @@ export const operateFinishTool = {
975
875
  };
976
876
  export const operateDriveTool = {
977
877
  name: "operate_drive",
978
- description: "Drive a signup, checkout, or other website goal to completion. This is the tool to reach for " +
979
- "when the user asked to create an account, complete a purchase, or provision a service — " +
980
- "prefer it over calling operate_click / operate_type / operate_observe yourself. " +
981
- "Pass session_id of an open operate_start session, or url to open the page (same start path as " +
982
- "operate_start, with no blanket sign-in wall) and drive in one call. goal is the task in words. " +
983
- "facts is the key/value bag of values the loop may type (email, first_name, last_name, company, " +
984
- "address, city, state, zip, password, card_ref, merchant, amount_cents, currency, …); it never " +
985
- "invents a value. 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. A search or query field may receive a phrase Jev assigns from the goal's own " +
986
- "words or the facts; identity and payment fields still require a fact. Each step asks Jev for one operation (CLICK, TYPE_TEXT, SELECT, SCROLL, WAIT, DONE, BLOCKED) " +
987
- "and a matching per-operation target; unused target heads cannot act. It reads verification mail " +
988
- "when a verification field is chosen or the page is stuck after a click. Optional max_steps (default 60) and max_seconds (default 45) bound this call; " +
989
- "a budget handoff is partial progress — call again on the same session to continue. " +
990
- "Resume with answer (one option key from a previous handoff: a readable action slug, done, or stuck) and/or added " +
991
- "facts; the loop continues from the current page. Returns a handoff, never a bare page: status, " +
992
- "the current compact observation with the same stable refs, trajectory, done/remaining, and " +
993
- "step/time counters. Status complete means the goal is done; needs_value names the missing field's label; " +
994
- "stuck means no listed element advances the goal; " +
995
- "low_confidence includes the question, options, probabilities, and confidence; " +
996
- "invalid_answer is a malformed Jev choice (reason + confidence) after one same-observation retry; no_progress, budget, " +
997
- "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, " +
998
- "verification-email read, captcha, and card release run inside the loop. Always operate_finish when done.",
878
+ description: "Drive a multi-step signup, checkout, or other website goal and hand back when complete, blocked, or out of budget. " +
879
+ "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. " +
880
+ "Identity and payment values must come from facts; a search phrase may come from the goal. " +
881
+ "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. " +
882
+ "The loop can handle Google sign-in, verification mail, captcha, and card release. " +
883
+ "max_steps (default 60) and max_seconds (default 45) bound a call. Resume a budget or other partial handoff on the " +
884
+ "same session with added facts and/or answer from its options. The handoff includes status, current compact observation, " +
885
+ "trajectory, done/remaining, and counters. complete means done; needs_value names a missing field; stuck and low_confidence " +
886
+ "need a decision. invalid_answer, no_progress, budget, evaluate_timeout, pending_approval, and " +
887
+ "card_incomplete are resumable. After a card_incomplete handoff, retry against the same approval_id. " +
888
+ "Always operate_finish when done.",
999
889
  inputSchema: driveSchema,
1000
890
  jsonInputSchema: {
1001
891
  type: "object",
@@ -1031,7 +921,6 @@ export const OPERATE_TOOLS = [
1031
921
  operateWaitTool,
1032
922
  operateReadInboxTool,
1033
923
  operateLoginTool,
1034
- operateFillCredentialTool,
1035
924
  provisionExtractTool,
1036
925
  ];
1037
926
  const captureOutputSchema = {
@@ -1042,9 +931,7 @@ const captureOutputSchema = {
1042
931
  write_id: { type: "string" },
1043
932
  execution: { enum: ["completed", "cancelled", "pending", "unknown"] },
1044
933
  mutation: { enum: ["not_dispatched", "dispatched", "unknown"] },
1045
- cleanup: {
1046
- enum: ["open", "closing", "closed", "already_closed", "unknown"],
1047
- },
934
+ cleanup: { enum: ["open", "closing", "closed", "already_closed", "unknown"] },
1048
935
  closed: { type: "boolean" },
1049
936
  stored: { type: "boolean" },
1050
937
  storage: { enum: ["stored", "unknown", "not_attempted"] },
@@ -1088,9 +975,11 @@ for (const tool of OPERATE_TOOLS) {
1088
975
  continue;
1089
976
  const properties = tool.jsonInputSchema.properties;
1090
977
  if (properties !== null && typeof properties === "object")
1091
- Object.assign(properties, { capture: captureJson });
978
+ Object.assign(properties, { capture: captureJsonFor(tool.name) });
1092
979
  tool.description +=
1093
- " Optional capture:{store,source:{role,name?,container?}|{selector,container?}} vaults exactly one revealed source and returns metadata only; the source is resolved against the document AFTER the action's mutation settles, and a stored result names the resolved element in resolved_source. Use a value-free CSS selector for a plain-text copy field without a textbox/code role. Resolution pierces open shadow roots: a bare selector, a role, or a cross-shadow [container] descendant selector all reach shadow-hosted fields (e.g. Groq's id-less created-key <input> inside an open shadow root); when the role is textbox, an id-less text input whose value looks secret-shaped also matches if it is the only textbox in the container/document. A source matching nothing returns error capture_unresolved with candidate_count 0 and a found list of the roles/names that DID render (never values) — use it to pick the next source; capture_ambiguous is reserved for more than one match. If storage is unresolved, retry operate_extract with capture.write_id. An unresolved capture does not block unrelated actions.";
980
+ CAPTURE_NOTE +
981
+ (tool.name === "operate_click" ? CLICK_CAPTURE_NOTE : "") +
982
+ (tool.name === "operate_extract" ? EXTRACT_CAPTURE_NOTE : "");
1094
983
  tool.jsonOutputSchema = captureOutputSchema;
1095
984
  }
1096
985
  // Keep the additive click receipt discoverable alongside the shared capture result.
@@ -1104,9 +993,7 @@ operateClickTool.jsonOutputSchema = {
1104
993
  properties: {
1105
994
  dispatch: { enum: ["dispatched", "not_dispatched", "unknown"] },
1106
995
  outcome: { const: "unknown" },
1107
- retry_policy: {
1108
- enum: ["observe_before_new_action", "capture_new_screenshot"],
1109
- },
996
+ retry_policy: { enum: ["observe_before_new_action", "capture_new_screenshot"] },
1110
997
  },
1111
998
  },
1112
999
  },