yunti-browser-runtime 0.1.3 → 0.2.1
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/README.md +41 -9
- package/bin/yunti-browser-runtime.js +6 -0
- package/docs/ACTION_RESULT_COVERAGE.md +41 -0
- package/docs/AGENT_WORKFLOW_CONTRACT.md +108 -0
- package/docs/EXECUTION_PLAN.md +1433 -5
- package/docs/EXTENSION_DISTRIBUTION.md +146 -0
- package/docs/EXTENSION_PERMISSION_STRATEGY.md +167 -0
- package/docs/EXTENSION_STORE_COPY.md +213 -0
- package/docs/INSTALL.md +13 -7
- package/docs/NEXT_MAJOR_PLAN.md +808 -0
- package/docs/PROJECT_STATUS.md +1037 -7
- package/docs/PUBLISHING_BLOCKERS.md +1 -1
- package/docs/RELEASE.md +6 -2
- package/docs/RELEASE_0_2_0_CHECKLIST.md +827 -0
- package/docs/ROADMAP.md +44 -0
- package/docs/SECURITY.md +34 -0
- package/docs/TOOL_GUIDE.md +290 -5
- package/extension/background.js +20 -0
- package/extension/cdp.js +4 -0
- package/extension/content.js +167 -16
- package/extension/dom-observer.js +588 -0
- package/extension/manifest.json +3 -2
- package/extension/popup.js +2 -2
- package/extension/session-manager.js +106 -4
- package/extension/tool-handlers.js +1090 -156
- package/mcp/bridge-hub.js +257 -3
- package/mcp/http-server.js +213 -0
- package/mcp/memory.js +5 -5
- package/mcp/redaction.js +52 -3
- package/mcp/server.js +2 -0
- package/mcp/tools.js +421 -38
- package/package.json +4 -2
- package/scripts/check-action-result-coverage.js +145 -0
- package/scripts/doctor.js +6 -1
- package/scripts/package-extension.js +1 -0
- package/scripts/release-check.js +3 -0
- package/skills/yunti-browser-runtime/SKILL.md +128 -3
package/mcp/tools.js
CHANGED
|
@@ -13,7 +13,7 @@ export const TOOLS = [
|
|
|
13
13
|
},
|
|
14
14
|
topic: {
|
|
15
15
|
type: "string",
|
|
16
|
-
enum: ["all", "browser", "cdp", "tabs", "memory", "network", "console"],
|
|
16
|
+
enum: ["all", "browser", "cdp", "tabs", "memory", "network", "console", "workflow"],
|
|
17
17
|
description: "Optional topic filter. Defaults to all.",
|
|
18
18
|
},
|
|
19
19
|
},
|
|
@@ -51,6 +51,57 @@ export const TOOLS = [
|
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
name: "yunti_observe_page",
|
|
56
|
+
description:
|
|
57
|
+
"Observe the current browser page for agentic operation. Returns an observationId, page/viewport/scroll metadata, a compact interactive text tree, structured elements with fresh uids, scrollable container metadata, redaction metadata, and next-step hints. Prefer this for observe -> act by uid -> verify workflows once available. Sensitive credential-like values are redacted by default; strict redaction also hides likely email, phone, payment-card, and address text surfaces.",
|
|
58
|
+
inputSchema: {
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: {
|
|
61
|
+
browserSessionId: {
|
|
62
|
+
type: "string",
|
|
63
|
+
description:
|
|
64
|
+
"Optional target Yunti browser session. Use the returned browserSessionId for follow-up actions on the same tab.",
|
|
65
|
+
},
|
|
66
|
+
mode: {
|
|
67
|
+
type: "string",
|
|
68
|
+
enum: ["viewport", "fullPage"],
|
|
69
|
+
description:
|
|
70
|
+
"Observation scope. Defaults to viewport; fullPage is bounded by maxElements and maxTextLength.",
|
|
71
|
+
},
|
|
72
|
+
maxElements: {
|
|
73
|
+
type: "integer",
|
|
74
|
+
minimum: 1,
|
|
75
|
+
maximum: 500,
|
|
76
|
+
description: "Maximum interactive elements to return. Defaults to a bounded runtime value.",
|
|
77
|
+
},
|
|
78
|
+
maxTextLength: {
|
|
79
|
+
type: "integer",
|
|
80
|
+
minimum: 0,
|
|
81
|
+
maximum: 60000,
|
|
82
|
+
description: "Maximum textTree/visible text characters to return.",
|
|
83
|
+
},
|
|
84
|
+
includeHidden: {
|
|
85
|
+
type: "boolean",
|
|
86
|
+
description: "Include hidden or invisible elements. Defaults to false.",
|
|
87
|
+
},
|
|
88
|
+
includeTextTree: {
|
|
89
|
+
type: "boolean",
|
|
90
|
+
description: "Include the compact agent-facing interactive text tree. Defaults to true.",
|
|
91
|
+
},
|
|
92
|
+
includeRects: {
|
|
93
|
+
type: "boolean",
|
|
94
|
+
description: "Include viewport-relative element rectangles. Defaults to true.",
|
|
95
|
+
},
|
|
96
|
+
redaction: {
|
|
97
|
+
type: "string",
|
|
98
|
+
enum: ["balanced", "strict", "off"],
|
|
99
|
+
description:
|
|
100
|
+
"DOM observation redaction mode. Defaults to balanced. Use off only for explicit local debugging; it is not recommended for agent workflows.",
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
54
105
|
{
|
|
55
106
|
name: "yunti_get_selected_context",
|
|
56
107
|
description:
|
|
@@ -155,7 +206,7 @@ export const TOOLS = [
|
|
|
155
206
|
{
|
|
156
207
|
name: "yunti_remember_learning",
|
|
157
208
|
description:
|
|
158
|
-
"Store an auditable Yunti learning memory such as an API pattern, workflow step, selector, field mapping, or gotcha.
|
|
209
|
+
"Store an auditable Yunti learning memory such as an API pattern, workflow step, selector, field mapping, or gotcha. Memory input is sanitized before storage, but agents should still avoid storing secrets, raw cookies, or personal data.",
|
|
159
210
|
inputSchema: {
|
|
160
211
|
type: "object",
|
|
161
212
|
required: ["title", "detail"],
|
|
@@ -177,7 +228,7 @@ export const TOOLS = [
|
|
|
177
228
|
},
|
|
178
229
|
{
|
|
179
230
|
name: "yunti_get_learning_memory",
|
|
180
|
-
description: "Search auditable Yunti learning memories recorded by agents.",
|
|
231
|
+
description: "Search sanitized auditable Yunti learning memories recorded by agents.",
|
|
181
232
|
inputSchema: {
|
|
182
233
|
type: "object",
|
|
183
234
|
properties: {
|
|
@@ -245,7 +296,7 @@ export const TOOLS = [
|
|
|
245
296
|
{
|
|
246
297
|
name: "yunti_capture_visible_tab",
|
|
247
298
|
description:
|
|
248
|
-
"Capture a PNG screenshot of the visible area of the active Yunti browser tab through the extension.
|
|
299
|
+
"Capture a PNG screenshot of the visible area of the active Yunti browser tab through the extension. Screenshots are real visible pixels and are not DOM-redacted; use only when visual evidence is needed.",
|
|
249
300
|
inputSchema: {
|
|
250
301
|
type: "object",
|
|
251
302
|
properties: {
|
|
@@ -348,7 +399,7 @@ export const TOOLS = [
|
|
|
348
399
|
{
|
|
349
400
|
name: "yunti_get_cdp_events",
|
|
350
401
|
description:
|
|
351
|
-
"Read raw low-level browser protocol events forwarded by the browser extension for the active tab.
|
|
402
|
+
"Read raw low-level browser protocol events forwarded by the browser extension for the active tab. This diagnostic stream intentionally does not redact event payloads; use only for low-level debugging and clear it after debugging.",
|
|
352
403
|
inputSchema: {
|
|
353
404
|
type: "object",
|
|
354
405
|
properties: {
|
|
@@ -363,7 +414,7 @@ export const TOOLS = [
|
|
|
363
414
|
{
|
|
364
415
|
name: "yunti_clear_cdp_events",
|
|
365
416
|
description:
|
|
366
|
-
"Clear raw CDP events for the active tab, a selected session, or all sessions.",
|
|
417
|
+
"Clear raw CDP diagnostic events for the active tab, a selected session, or all sessions.",
|
|
367
418
|
inputSchema: {
|
|
368
419
|
type: "object",
|
|
369
420
|
properties: {
|
|
@@ -390,13 +441,13 @@ export const TOOLS = [
|
|
|
390
441
|
{
|
|
391
442
|
name: "yunti_type_text",
|
|
392
443
|
description:
|
|
393
|
-
"Type or set text in the focused element, a selector target, a uid target (from yunti_take_snapshot), or a coordinate target on the current browser page.",
|
|
444
|
+
"Type or set text in the focused element, a selector target, a uid target (from yunti_observe_page or yunti_take_snapshot), or a coordinate target on the current browser page.",
|
|
394
445
|
inputSchema: {
|
|
395
446
|
type: "object",
|
|
396
447
|
required: ["text"],
|
|
397
448
|
properties: {
|
|
398
449
|
browserSessionId: { type: "string" },
|
|
399
|
-
uid: { type: "string", description: "
|
|
450
|
+
uid: { type: "string", description: "Fresh uid from yunti_observe_page or yunti_take_snapshot." },
|
|
400
451
|
text: { type: "string" },
|
|
401
452
|
selector: { type: "string" },
|
|
402
453
|
x: { type: "number" },
|
|
@@ -408,13 +459,13 @@ export const TOOLS = [
|
|
|
408
459
|
{
|
|
409
460
|
name: "yunti_press_key",
|
|
410
461
|
description:
|
|
411
|
-
"Send a keyboard key event to the focused element, a uid target (from yunti_take_snapshot), a selector target, or a coordinate target on the current browser page.",
|
|
462
|
+
"Send a keyboard key event to the focused element, a uid target (from yunti_observe_page or yunti_take_snapshot), a selector target, or a coordinate target on the current browser page.",
|
|
412
463
|
inputSchema: {
|
|
413
464
|
type: "object",
|
|
414
465
|
required: ["key"],
|
|
415
466
|
properties: {
|
|
416
467
|
browserSessionId: { type: "string" },
|
|
417
|
-
uid: { type: "string", description: "
|
|
468
|
+
uid: { type: "string", description: "Fresh uid from yunti_observe_page or yunti_take_snapshot." },
|
|
418
469
|
key: { type: "string", description: "Examples: Enter, Escape, Tab, ArrowDown, Backspace." },
|
|
419
470
|
selector: { type: "string" },
|
|
420
471
|
x: { type: "number" },
|
|
@@ -425,11 +476,12 @@ export const TOOLS = [
|
|
|
425
476
|
{
|
|
426
477
|
name: "yunti_scroll",
|
|
427
478
|
description:
|
|
428
|
-
"Scroll the current browser page or the scrollable container under a viewport coordinate through the extension.",
|
|
479
|
+
"Scroll the current browser page, a scrollable container by fresh uid, or the scrollable container under a viewport coordinate through the extension.",
|
|
429
480
|
inputSchema: {
|
|
430
481
|
type: "object",
|
|
431
482
|
properties: {
|
|
432
483
|
browserSessionId: { type: "string" },
|
|
484
|
+
uid: { type: "string", description: "Fresh scrollable container uid from yunti_observe_page. Takes precedence over x/y." },
|
|
433
485
|
x: { type: "number" },
|
|
434
486
|
y: { type: "number" },
|
|
435
487
|
deltaX: { type: "number", default: 0 },
|
|
@@ -457,13 +509,13 @@ export const TOOLS = [
|
|
|
457
509
|
{
|
|
458
510
|
name: "yunti_upload_file",
|
|
459
511
|
description:
|
|
460
|
-
"Set files on a file input element by uid (from yunti_take_snapshot) or selector. Uses CDP DOM.setFileInputFiles. Paths must be accessible to the browser.",
|
|
512
|
+
"Set files on a file input element by uid (from yunti_observe_page or yunti_take_snapshot) or selector. Uses CDP DOM.setFileInputFiles. Paths must be accessible to the browser.",
|
|
461
513
|
inputSchema: {
|
|
462
514
|
type: "object",
|
|
463
515
|
required: ["filePaths"],
|
|
464
516
|
properties: {
|
|
465
517
|
browserSessionId: { type: "string" },
|
|
466
|
-
uid: { type: "string", description: "
|
|
518
|
+
uid: { type: "string", description: "Fresh uid from yunti_observe_page or yunti_take_snapshot for the file input." },
|
|
467
519
|
selector: { type: "string", description: "CSS selector for the file input element." },
|
|
468
520
|
filePaths: { type: "array", items: { type: "string" }, description: "Absolute file paths to upload." },
|
|
469
521
|
},
|
|
@@ -484,12 +536,12 @@ export const TOOLS = [
|
|
|
484
536
|
{
|
|
485
537
|
name: "yunti_click",
|
|
486
538
|
description:
|
|
487
|
-
"Click an element on the current browser page using a uid from yunti_take_snapshot, a CSS selector, or viewport coordinates. Prefer uid for reliability. For coordinate-only clicks, yunti_click_at is the clearer dedicated tool. Dangerous labels require user confirmation.",
|
|
539
|
+
"Click an element on the current browser page using a uid from yunti_observe_page or yunti_take_snapshot, a CSS selector, or viewport coordinates. Prefer a fresh uid for reliability. For coordinate-only clicks, yunti_click_at is the clearer dedicated tool. Dangerous labels require user confirmation.",
|
|
488
540
|
inputSchema: {
|
|
489
541
|
type: "object",
|
|
490
542
|
properties: {
|
|
491
543
|
browserSessionId: { type: "string" },
|
|
492
|
-
uid: { type: "string", description: "
|
|
544
|
+
uid: { type: "string", description: "Fresh uid from yunti_observe_page or yunti_take_snapshot (e.g. yunti-1). Takes precedence over selector." },
|
|
493
545
|
selector: { type: "string", description: "CSS selector. Used when uid is not provided." },
|
|
494
546
|
x: { type: "number", description: "Viewport x coordinate fallback. Use together with y; yunti_click_at is preferred for coordinate-only clicks." },
|
|
495
547
|
y: { type: "number", description: "Viewport y coordinate fallback. Use together with x; yunti_click_at is preferred for coordinate-only clicks." },
|
|
@@ -500,12 +552,12 @@ export const TOOLS = [
|
|
|
500
552
|
{
|
|
501
553
|
name: "yunti_hover",
|
|
502
554
|
description:
|
|
503
|
-
"Hover over an element on the current browser page using a uid from yunti_take_snapshot, a CSS selector, or viewport coordinates. Useful for triggering tooltips, dropdowns, and hover menus.",
|
|
555
|
+
"Hover over an element on the current browser page using a uid from yunti_observe_page or yunti_take_snapshot, a CSS selector, or viewport coordinates. Useful for triggering tooltips, dropdowns, and hover menus.",
|
|
504
556
|
inputSchema: {
|
|
505
557
|
type: "object",
|
|
506
558
|
properties: {
|
|
507
559
|
browserSessionId: { type: "string" },
|
|
508
|
-
uid: { type: "string", description: "
|
|
560
|
+
uid: { type: "string", description: "Fresh uid from yunti_observe_page or yunti_take_snapshot (e.g. yunti-1). Takes precedence over selector." },
|
|
509
561
|
selector: { type: "string", description: "CSS selector fallback. The element center is resolved and hovered through CDP." },
|
|
510
562
|
x: { type: "number", description: "Viewport x coordinate fallback. Use together with y." },
|
|
511
563
|
y: { type: "number", description: "Viewport y coordinate fallback. Use together with x." },
|
|
@@ -515,13 +567,13 @@ export const TOOLS = [
|
|
|
515
567
|
{
|
|
516
568
|
name: "yunti_fill",
|
|
517
569
|
description:
|
|
518
|
-
"Fill an input, textarea, select, or contenteditable element using a uid from yunti_take_snapshot or a CSS selector. Prefer uid for reliability.",
|
|
570
|
+
"Fill an input, textarea, select, or contenteditable element using a uid from yunti_observe_page or yunti_take_snapshot, or a CSS selector. Prefer a fresh uid for reliability.",
|
|
519
571
|
inputSchema: {
|
|
520
572
|
type: "object",
|
|
521
573
|
required: ["value"],
|
|
522
574
|
properties: {
|
|
523
575
|
browserSessionId: { type: "string" },
|
|
524
|
-
uid: { type: "string", description: "
|
|
576
|
+
uid: { type: "string", description: "Fresh uid from yunti_observe_page or yunti_take_snapshot (e.g. yunti-3). Takes precedence over selector." },
|
|
525
577
|
selector: { type: "string", description: "CSS selector. Used when uid is not provided." },
|
|
526
578
|
value: { type: "string" },
|
|
527
579
|
},
|
|
@@ -530,7 +582,7 @@ export const TOOLS = [
|
|
|
530
582
|
{
|
|
531
583
|
name: "yunti_list_console_messages",
|
|
532
584
|
description:
|
|
533
|
-
"List console messages (console.log, console.error, console.warn, etc.) captured from the active browser page via CDP Runtime/Log events. Supports filtering by level and pagination.",
|
|
585
|
+
"List sanitized console messages (console.log, console.error, console.warn, etc.) captured from the active browser page via CDP Runtime/Log events. Supports filtering by level and pagination.",
|
|
534
586
|
inputSchema: {
|
|
535
587
|
type: "object",
|
|
536
588
|
properties: {
|
|
@@ -546,7 +598,7 @@ export const TOOLS = [
|
|
|
546
598
|
{
|
|
547
599
|
name: "yunti_get_console_message",
|
|
548
600
|
description:
|
|
549
|
-
"Get a single console message by its msgid from yunti_list_console_messages. Returns
|
|
601
|
+
"Get a single sanitized console message by its msgid from yunti_list_console_messages. Returns detail including stack trace.",
|
|
550
602
|
inputSchema: {
|
|
551
603
|
type: "object",
|
|
552
604
|
required: ["msgId"],
|
|
@@ -570,21 +622,46 @@ export const TOOLS = [
|
|
|
570
622
|
},
|
|
571
623
|
{
|
|
572
624
|
name: "yunti_select",
|
|
573
|
-
description:
|
|
625
|
+
description:
|
|
626
|
+
"Select an option in a select element on the current browser page. Supports selector/value plus uid/value or uid/text while keeping selector/value compatible.",
|
|
574
627
|
inputSchema: {
|
|
575
628
|
type: "object",
|
|
576
|
-
|
|
629
|
+
anyOf: [
|
|
630
|
+
{ required: ["selector", "value"] },
|
|
631
|
+
{ required: ["uid", "value"] },
|
|
632
|
+
{ required: ["uid", "text"] },
|
|
633
|
+
],
|
|
577
634
|
properties: {
|
|
578
|
-
browserSessionId: {
|
|
579
|
-
|
|
580
|
-
|
|
635
|
+
browserSessionId: {
|
|
636
|
+
type: "string",
|
|
637
|
+
description: "Optional target Yunti browser session.",
|
|
638
|
+
},
|
|
639
|
+
selector: {
|
|
640
|
+
type: "string",
|
|
641
|
+
description: "Compatible CSS selector path for the select element.",
|
|
642
|
+
},
|
|
643
|
+
uid: {
|
|
644
|
+
type: "string",
|
|
645
|
+
description:
|
|
646
|
+
"Fresh uid path from yunti_observe_page or yunti_take_snapshot. Supports option value or visible text matching.",
|
|
647
|
+
},
|
|
648
|
+
value: {
|
|
649
|
+
type: "string",
|
|
650
|
+
description:
|
|
651
|
+
"Option value to select. Supported with selector or uid.",
|
|
652
|
+
},
|
|
653
|
+
text: {
|
|
654
|
+
type: "string",
|
|
655
|
+
description:
|
|
656
|
+
"Visible option text to select. Supported with uid when the user-facing label is clearer than the value.",
|
|
657
|
+
},
|
|
581
658
|
},
|
|
582
659
|
},
|
|
583
660
|
},
|
|
584
661
|
{
|
|
585
662
|
name: "yunti_fill_form",
|
|
586
663
|
description:
|
|
587
|
-
"Fill multiple form fields at once. Each field specifies a uid (from yunti_take_snapshot) or a selector, and its value. More efficient than calling yunti_fill repeatedly.",
|
|
664
|
+
"Fill multiple form fields at once. Each field specifies a uid (from yunti_observe_page or yunti_take_snapshot) or a selector, and its value. More efficient than calling yunti_fill repeatedly.",
|
|
588
665
|
inputSchema: {
|
|
589
666
|
type: "object",
|
|
590
667
|
required: ["fields"],
|
|
@@ -596,7 +673,7 @@ export const TOOLS = [
|
|
|
596
673
|
type: "object",
|
|
597
674
|
required: ["value"],
|
|
598
675
|
properties: {
|
|
599
|
-
uid: { type: "string", description: "
|
|
676
|
+
uid: { type: "string", description: "Fresh uid from yunti_observe_page or yunti_take_snapshot." },
|
|
600
677
|
selector: { type: "string", description: "CSS selector fallback." },
|
|
601
678
|
value: { type: "string", description: "Value to fill." },
|
|
602
679
|
},
|
|
@@ -700,7 +777,7 @@ export const TOOLS = [
|
|
|
700
777
|
{
|
|
701
778
|
name: "yunti_wait_for",
|
|
702
779
|
description:
|
|
703
|
-
"Wait for a condition to be met on the page: text appears, a selector becomes visible, the URL changes
|
|
780
|
+
"Wait for a condition to be met on the page: text appears, a selector becomes visible, or the URL changes. Returns compatibility fields such as found/text/selector/waitedMs plus structured action fields when available.",
|
|
704
781
|
inputSchema: {
|
|
705
782
|
type: "object",
|
|
706
783
|
properties: {
|
|
@@ -768,7 +845,7 @@ export const TOOLS = [
|
|
|
768
845
|
{
|
|
769
846
|
name: "yunti_take_screenshot",
|
|
770
847
|
description:
|
|
771
|
-
"Capture a
|
|
848
|
+
"Capture a screenshot of the selected browser page. Supports viewport and full-page modes via CDP Page.captureScreenshot. Screenshots are real visible pixels and are not DOM-redacted.",
|
|
772
849
|
inputSchema: {
|
|
773
850
|
type: "object",
|
|
774
851
|
properties: {
|
|
@@ -897,6 +974,32 @@ export function toolUsageHints(args = {}) {
|
|
|
897
974
|
"If an old browserSessionId fails, call yunti_list_browser_targets to refresh the live route inventory.",
|
|
898
975
|
],
|
|
899
976
|
},
|
|
977
|
+
yunti_observe_page: {
|
|
978
|
+
purpose: "Observe the current page for observe -> act by uid -> verify workflows.",
|
|
979
|
+
required: [],
|
|
980
|
+
recommended: ["browserSessionId", "mode", "redaction"],
|
|
981
|
+
examples: [
|
|
982
|
+
{
|
|
983
|
+
browserSessionId: "yunti-...",
|
|
984
|
+
mode: "viewport",
|
|
985
|
+
includeTextTree: true,
|
|
986
|
+
redaction: "balanced",
|
|
987
|
+
},
|
|
988
|
+
],
|
|
989
|
+
notes: [
|
|
990
|
+
"Use this as the default page-operation refresh step once available.",
|
|
991
|
+
"Returned uids are fresh for the latest observation in the current browserSessionId; observe again after navigation, DOM changes, or stale uid errors.",
|
|
992
|
+
"Input-like elements may include editable, fillable, readOnly, fillBlockReason, selectedIndex/selectedValue/selectedText, and select options[] summaries so agents can inspect field state before filling or selecting.",
|
|
993
|
+
"Default balanced redaction hides credential-like values. Strict redaction additionally hides likely email, phone, Luhn-valid payment-card-like values, address-like text, page titles, labels, names, visible text, placeholders, value previews, and select option text.",
|
|
994
|
+
"Screenshots are separate and may still contain visible sensitive content.",
|
|
995
|
+
"Use yunti_get_page_snapshot for lightweight route/title/text overview and yunti_take_snapshot for compatibility with older uid workflows.",
|
|
996
|
+
],
|
|
997
|
+
commonMistakes: [
|
|
998
|
+
"Do not treat observation uids as permanent selectors across refreshes or tabs.",
|
|
999
|
+
"Do not use redaction=off unless the user explicitly wants local debugging.",
|
|
1000
|
+
"Do not blindly retry an action after no page change; observe, wait, scroll, or switch tabs based on hints.",
|
|
1001
|
+
],
|
|
1002
|
+
},
|
|
900
1003
|
yunti_list_browser_targets: {
|
|
901
1004
|
purpose: "Canonical live Chrome/Edge tab and target inventory.",
|
|
902
1005
|
required: [],
|
|
@@ -941,6 +1044,62 @@ export function toolUsageHints(args = {}) {
|
|
|
941
1044
|
"If browserSessionId is stale, refresh with yunti_list_browser_targets before retrying.",
|
|
942
1045
|
],
|
|
943
1046
|
},
|
|
1047
|
+
yunti_get_cdp_events: {
|
|
1048
|
+
purpose: "Inspect raw low-level CDP events for debugging transport, protocol, or extension behavior.",
|
|
1049
|
+
required: [],
|
|
1050
|
+
recommended: ["browserSessionId", "method", "limit"],
|
|
1051
|
+
notes: [
|
|
1052
|
+
"This tool intentionally returns raw CDP event payloads and does not apply network, console, DOM, or learning-memory sanitization.",
|
|
1053
|
+
"Use sanitized network and console tools first when they can answer the question.",
|
|
1054
|
+
"Filter by method and keep limit small to reduce sensitive payload exposure.",
|
|
1055
|
+
"Clear raw CDP events after debugging with yunti_clear_cdp_events.",
|
|
1056
|
+
],
|
|
1057
|
+
recovery: [
|
|
1058
|
+
"After reading raw CDP diagnostics, call yunti_clear_cdp_events for the same browserSessionId or allSessions when appropriate.",
|
|
1059
|
+
"If you need to keep a durable note, summarize the safe conclusion with yunti_remember_learning instead of copying raw event payloads.",
|
|
1060
|
+
],
|
|
1061
|
+
commonMistakes: [
|
|
1062
|
+
"Do not copy raw CDP params into chat, logs, learning memory, or documentation.",
|
|
1063
|
+
"Do not use raw CDP events as the default page observation path; prefer yunti_observe_page, sanitized network tools, and sanitized console tools.",
|
|
1064
|
+
],
|
|
1065
|
+
},
|
|
1066
|
+
yunti_clear_cdp_events: {
|
|
1067
|
+
purpose: "Delete raw CDP diagnostic events after low-level debugging.",
|
|
1068
|
+
required: [],
|
|
1069
|
+
recommended: ["browserSessionId"],
|
|
1070
|
+
notes: [
|
|
1071
|
+
"Use browserSessionId to clear one tab's raw diagnostics, or allSessions=true with the current userId when ending a broader debugging session.",
|
|
1072
|
+
"Clearing raw CDP events does not clear sanitized network or console diagnostics.",
|
|
1073
|
+
],
|
|
1074
|
+
},
|
|
1075
|
+
yunti_take_screenshot: {
|
|
1076
|
+
purpose: "Capture visual page evidence for layout, rendering, or user-visible verification.",
|
|
1077
|
+
required: [],
|
|
1078
|
+
recommended: ["browserSessionId", "fullPage"],
|
|
1079
|
+
notes: [
|
|
1080
|
+
"Screenshots are real visible pixels and are not DOM-redacted.",
|
|
1081
|
+
"Use yunti_observe_page with redaction=strict first when structured text is enough.",
|
|
1082
|
+
"Prefer viewport screenshots over fullPage when a smaller visual proof is sufficient.",
|
|
1083
|
+
"Do not store screenshots in learning memory; summarize only safe visual findings.",
|
|
1084
|
+
],
|
|
1085
|
+
commonMistakes: [
|
|
1086
|
+
"Do not assume DOM redaction hides sensitive content in screenshots.",
|
|
1087
|
+
"Do not use screenshots as the default data extraction path when observe, snapshot, network, console, or evaluate can provide a safer answer.",
|
|
1088
|
+
],
|
|
1089
|
+
},
|
|
1090
|
+
yunti_capture_visible_tab: {
|
|
1091
|
+
purpose: "Capture the active visible tab for visual verification through the extension fallback path.",
|
|
1092
|
+
required: [],
|
|
1093
|
+
recommended: ["browserSessionId"],
|
|
1094
|
+
notes: [
|
|
1095
|
+
"Like yunti_take_screenshot, this returns real visible pixels and is not DOM-redacted.",
|
|
1096
|
+
"Use it only when visual state matters and structured observations are insufficient.",
|
|
1097
|
+
"Do not store raw screenshot data in learning memory.",
|
|
1098
|
+
],
|
|
1099
|
+
commonMistakes: [
|
|
1100
|
+
"Do not expose visible secrets from the screenshot; describe only the safe conclusion.",
|
|
1101
|
+
],
|
|
1102
|
+
},
|
|
944
1103
|
yunti_evaluate_script: {
|
|
945
1104
|
purpose: "Evaluate JavaScript in the selected browser page.",
|
|
946
1105
|
required: ["expression"],
|
|
@@ -993,49 +1152,186 @@ export function toolUsageHints(args = {}) {
|
|
|
993
1152
|
],
|
|
994
1153
|
commonMistakes: ["Use id, not title."],
|
|
995
1154
|
},
|
|
1155
|
+
yunti_remember_learning: {
|
|
1156
|
+
purpose: "Persist a sanitized local learning memory for future agent runs.",
|
|
1157
|
+
required: ["title", "detail"],
|
|
1158
|
+
recommended: ["kind", "tags", "confidence", "source"],
|
|
1159
|
+
notes: [
|
|
1160
|
+
"Learning memory sanitizes likely secrets and PII-like text before writing to disk.",
|
|
1161
|
+
"Do not intentionally store raw cookies, authorization headers, tokens, passwords, private keys, payment data, or personal contact details.",
|
|
1162
|
+
"Use relatedNetworkEventIds to reference sanitized network observations instead of copying raw payloads into memory.",
|
|
1163
|
+
],
|
|
1164
|
+
commonMistakes: [
|
|
1165
|
+
"Do not use learning memory as task history or a transcript store.",
|
|
1166
|
+
"Do not store raw CDP event payloads in memory.",
|
|
1167
|
+
],
|
|
1168
|
+
},
|
|
1169
|
+
yunti_wait_for: {
|
|
1170
|
+
purpose: "Wait for expected text, a visible selector, or a URL substring before observing and continuing with fresh uids.",
|
|
1171
|
+
required: [],
|
|
1172
|
+
recommended: ["browserSessionId", "text or selector or urlContains", "timeoutMs"],
|
|
1173
|
+
notes: [
|
|
1174
|
+
"Use this when the page is rendering asynchronously, loading select options, validating a field, navigating, or appending scroll content.",
|
|
1175
|
+
"At least one of text, selector, or urlContains is required.",
|
|
1176
|
+
"Successful results preserve compatibility fields such as found, text, selector, condition, value, waitedMs, and browserSessionId.",
|
|
1177
|
+
"P6.2.6 structured fields are additive: action=wait_for, target, ok, recoverable, and nextStepHint.",
|
|
1178
|
+
"Timeout results return found=false, ok=false, recoverable=true, code=WAIT_TIMEOUT, recoveryHint, and nextStepHint.",
|
|
1179
|
+
"After a successful wait, call yunti_observe_page before using uids for newly rendered content.",
|
|
1180
|
+
],
|
|
1181
|
+
recovery: [
|
|
1182
|
+
"WAIT_TIMEOUT: observe the current page, inspect whether the expected condition changed, or adjust text/selector/urlContains before retrying.",
|
|
1183
|
+
"Async form/select work: wait for the expected text/selector/state, observe again, then fill/select with a fresh uid.",
|
|
1184
|
+
"Async scroll work: wait for the next expected text/selector, observe again, then choose a fresh scrollable container uid.",
|
|
1185
|
+
"Wrong tab or stale route: refresh targets with yunti_list_browser_targets and route through the intended browserSessionId.",
|
|
1186
|
+
],
|
|
1187
|
+
commonMistakes: [
|
|
1188
|
+
"Do not treat WAIT_TIMEOUT as proof the task failed; inspect the page state before deciding.",
|
|
1189
|
+
"Do not keep repeating the same wait condition without observing or adjusting it.",
|
|
1190
|
+
"Do not reuse old uids after waiting for new async content; observe again first.",
|
|
1191
|
+
],
|
|
1192
|
+
},
|
|
996
1193
|
yunti_click: {
|
|
997
|
-
purpose: "Click by snapshot uid, CSS selector, or viewport coordinates.",
|
|
1194
|
+
purpose: "Click by observe/snapshot uid, CSS selector, or viewport coordinates.",
|
|
998
1195
|
required: [],
|
|
999
1196
|
recommended: ["browserSessionId", "uid"],
|
|
1000
1197
|
notes: [
|
|
1001
|
-
"Prefer uid from yunti_take_snapshot for reliability.",
|
|
1198
|
+
"Prefer a fresh uid from yunti_observe_page or yunti_take_snapshot for reliability.",
|
|
1002
1199
|
"Use selector when uid is unavailable.",
|
|
1003
1200
|
"Coordinate mode requires both x and y; yunti_click_at is clearer for coordinate-only clicks.",
|
|
1201
|
+
"After clicking, observe again or read page state before deciding whether the action succeeded.",
|
|
1202
|
+
"If the target is missing or stale, observe again; if it may be below the fold, scroll first; if the page is changing, wait before retrying.",
|
|
1203
|
+
"Current results are compatibility-shaped and may include clicked, uid, selector/coordinate, method, and browserSessionId; P6.2 will converge action outputs toward action, target, ok/code, recoverable, nextStepHint, and before/after summaries.",
|
|
1204
|
+
],
|
|
1205
|
+
recovery: [
|
|
1206
|
+
"Stale or missing uid: call yunti_observe_page again for the current browserSessionId, or yunti_take_snapshot for compatibility workflows.",
|
|
1207
|
+
"Element not visible: use observe scroll hints, yunti_scroll, or a screenshot before falling back to coordinates.",
|
|
1208
|
+
"No visible page change: call yunti_observe_page or yunti_get_page_snapshot to verify, then wait, scroll, switch tabs, or ask the user instead of repeating the same click.",
|
|
1209
|
+
"Wrong page: call yunti_list_browser_targets and switch to the intended browserSessionId.",
|
|
1210
|
+
],
|
|
1211
|
+
commonMistakes: [
|
|
1212
|
+
"Do not treat a successful dispatch as proof that the page changed.",
|
|
1213
|
+
"Do not repeat the same uid click after a stale uid error; refresh the observation first.",
|
|
1004
1214
|
],
|
|
1005
1215
|
},
|
|
1006
1216
|
yunti_hover: {
|
|
1007
|
-
purpose: "Hover by snapshot uid, CSS selector, or viewport coordinates.",
|
|
1217
|
+
purpose: "Hover by observe/snapshot uid, CSS selector, or viewport coordinates.",
|
|
1008
1218
|
required: [],
|
|
1009
1219
|
recommended: ["browserSessionId", "uid"],
|
|
1010
1220
|
notes: [
|
|
1011
|
-
"Prefer uid from yunti_take_snapshot for reliability.",
|
|
1221
|
+
"Prefer a fresh uid from yunti_observe_page or yunti_take_snapshot for reliability.",
|
|
1012
1222
|
"Selector mode resolves the element center and dispatches CDP mouse move.",
|
|
1013
1223
|
"Coordinate mode requires both x and y.",
|
|
1224
|
+
"Observe again after hover when menus, tooltips, or hover-only controls are expected to appear.",
|
|
1225
|
+
"Current results are compatibility-shaped and may include hovered, uid, selector/coordinate, method, and browserSessionId; P6.2 will converge action outputs toward action, target, ok/code, recoverable, nextStepHint, and before/after summaries.",
|
|
1226
|
+
],
|
|
1227
|
+
recovery: [
|
|
1228
|
+
"Stale or missing uid: observe again before retrying the hover.",
|
|
1229
|
+
"Expected menu did not appear: wait briefly, observe again, or use screenshot before switching to coordinate fallback.",
|
|
1014
1230
|
],
|
|
1015
1231
|
},
|
|
1016
1232
|
yunti_fill: {
|
|
1017
|
-
purpose: "Fill an input-like element by snapshot uid or CSS selector.",
|
|
1233
|
+
purpose: "Fill an input-like element by observe/snapshot uid or CSS selector.",
|
|
1018
1234
|
required: ["value"],
|
|
1019
1235
|
recommended: ["browserSessionId", "uid", "value"],
|
|
1020
1236
|
notes: [
|
|
1021
1237
|
"value is required and may be an empty string when intentionally clearing a field.",
|
|
1022
|
-
"Prefer uid from yunti_take_snapshot for reliability.",
|
|
1238
|
+
"Prefer a fresh uid from yunti_observe_page or yunti_take_snapshot for reliability.",
|
|
1023
1239
|
"Use selector when uid is unavailable.",
|
|
1024
1240
|
"Coordinate-only fill is not supported; use uid or selector.",
|
|
1241
|
+
"Uid-targeted contenteditable fills now report method=contenteditable with before/after textLength summaries; still verify the rendered text after the action.",
|
|
1242
|
+
"Failed uid/selector fills may return structured filled=false diagnostics with ok=false, recoverable=true, code, recoveryHint, and nextStepHint instead of only a generic tool error.",
|
|
1243
|
+
"Non-editable, hidden, disabled, or readonly fill targets should return TARGET_NOT_EDITABLE diagnostics instead of being treated as successful fills.",
|
|
1244
|
+
"Uid keyboard/contenteditable fills verify the post-fill value when possible; if the value does not remain, they return VALUE_NOT_APPLIED with expectedValueLength/actualValueLength instead of exposing the raw field value.",
|
|
1245
|
+
"When yunti_fill_form uses yunti_fill internally, failed per-field results may preserve code, recoveryHint, availableValues/availableTexts, and nextStepHint for field-level recovery.",
|
|
1246
|
+
"After filling, verify through yunti_observe_page, yunti_get_page_snapshot, or yunti_evaluate_script when exact field value matters.",
|
|
1247
|
+
"If the input is hidden, disabled, or no longer present, observe again, scroll, wait for rendering, or switch tabs before retrying.",
|
|
1248
|
+
"Current results are compatibility-shaped and may include filled, uid, selector, method, value/valueLength, before/after, code, recoveryHint, and browserSessionId; P6.2 will converge action outputs toward action, target, ok/code, recoverable, nextStepHint, and richer before/after summaries.",
|
|
1249
|
+
],
|
|
1250
|
+
recovery: [
|
|
1251
|
+
"Stale or missing uid: call yunti_observe_page again and use a fresh editable uid.",
|
|
1252
|
+
"Structured fill failure: follow recoveryHint.nextAction / recoveryHint.decision before retrying the same fill.",
|
|
1253
|
+
"Batch fill partial failure: inspect each yunti_fill_form results[] item; failed fields may carry the same structured recovery details as yunti_fill.",
|
|
1254
|
+
"Async render or validation changed the field: use yunti_wait_for for the expected text/selector/state, then call yunti_observe_page and retry with a fresh editable uid.",
|
|
1255
|
+
"Field not editable: check disabled/editable fields from the observation, then wait, scroll, or ask the user if the control is gated.",
|
|
1256
|
+
"Select option not found: inspect availableValues / availableTexts, then retry with an available option value/text or use yunti_select.",
|
|
1257
|
+
"VALUE_NOT_APPLIED / value did not stick: inspect whether the target is contenteditable, masked, controlled by framework state, or requires typing/press_key semantics before retrying.",
|
|
1258
|
+
"Wrong page: refresh targets with yunti_list_browser_targets and route the fill through the intended browserSessionId.",
|
|
1025
1259
|
],
|
|
1026
1260
|
commonMistakes: [
|
|
1027
1261
|
"Do not omit value.",
|
|
1028
1262
|
"Do not pass only x/y coordinates to yunti_fill.",
|
|
1263
|
+
"Do not keep retrying a fill without observing whether the field exists and is editable.",
|
|
1264
|
+
],
|
|
1265
|
+
},
|
|
1266
|
+
yunti_scroll: {
|
|
1267
|
+
purpose: "Scroll the document, a fresh observed scrollable container uid, or the scrollable container under viewport coordinates.",
|
|
1268
|
+
required: [],
|
|
1269
|
+
recommended: ["browserSessionId", "uid", "deltaY"],
|
|
1270
|
+
notes: [
|
|
1271
|
+
"Prefer a fresh scrollable container uid from yunti_observe_page when the observation exposes scrollableContainers[].",
|
|
1272
|
+
"Uid scroll resolves the observed container center and reuses the existing coordinate/container scroll path.",
|
|
1273
|
+
"Coordinate scroll remains compatible for recovery and debugging when uid is unavailable.",
|
|
1274
|
+
"Coordinate scroll results may include coordinateTarget, scrollContainerFound, coordinateScrollFallback=document, and coordinateFallbackHint so agents can tell whether the coordinate hit a scrollable container or fell back to document scrolling.",
|
|
1275
|
+
"Current results preserve scrolled, deltaX/deltaY, target, before/after, browserSessionId, action, ok, recoverable, and nextStepHint; uid path also adds uid, method=uid, and scrollTarget without replacing target.",
|
|
1276
|
+
"When before/after positions are comparable, results include moved; no movement returns code=NO_SCROLL_MOVEMENT, ok=false, recoverable=true, edgeHint such as possible-bottom-edge when direction can be inferred, and recoveryHint with nextAction/recommendedTools, decision, plus suggestedRetry when an opposite delta can be derived.",
|
|
1277
|
+
"Partial movement returns partialMovement with requested/actual delta summaries, axes, edgeHint, decision=observe-before-continuing-scroll, and an observe-again next action while keeping ok=true.",
|
|
1278
|
+
"Uid scroll failures can return structured scrolled=false diagnostics with code, recoveryHint, and nextStepHint when the uid is missing, stale, hidden, or cannot resolve coordinates.",
|
|
1279
|
+
],
|
|
1280
|
+
recovery: [
|
|
1281
|
+
"Stale or missing uid: follow recoveryHint.decision, call yunti_observe_page again, and use a fresh scrollable container uid from scrollableContainers[].",
|
|
1282
|
+
"Wrong container moved or did not move: observe again and compare scrollableContainers before/after positions.",
|
|
1283
|
+
"Coordinate fallback moved document instead of a nested panel: inspect coordinateTarget, coordinateScrollFallback, and coordinateFallbackHint; observe again and prefer a fresh scrollable container uid.",
|
|
1284
|
+
"No movement: read recoveryHint.decision, edgeHint, and suggestedRetry; observe again, inspect likely scroll boundaries, try the nearest observed scrollable container uid, or stop repeating the same scroll.",
|
|
1285
|
+
"Partial movement: read partialMovement, observe again, and compare scroll positions before repeating the same scroll.",
|
|
1286
|
+
"Async content is still loading: use yunti_wait_for for the next expected text/selector, then observe again and choose a fresh scrollable container uid before retrying.",
|
|
1287
|
+
"Element still outside viewport: scroll the nearest scrollable container first, then observe and act by fresh uid.",
|
|
1288
|
+
"Wrong tab or stale route: refresh targets with yunti_list_browser_targets and route through the intended browserSessionId.",
|
|
1289
|
+
],
|
|
1290
|
+
commonMistakes: [
|
|
1291
|
+
"Do not assume document scroll will move nested app panels; use observed scrollable container uids when available.",
|
|
1292
|
+
"Do not overwrite or reinterpret the existing target field; uid scroll adds scrollTarget while preserving target compatibility.",
|
|
1293
|
+
"Do not blindly repeat scroll when moved=false or NO_SCROLL_MOVEMENT appears; read recoveryHint/edgeHint, observe, or inspect boundaries first.",
|
|
1294
|
+
"Do not blindly repeat uid scroll when code=UID_NOT_FOUND or UID_COORDINATES_UNAVAILABLE appears; refresh observation first.",
|
|
1295
|
+
"Do not blindly repeat partial scrolls without observing whether the target container hit an edge.",
|
|
1296
|
+
],
|
|
1297
|
+
},
|
|
1298
|
+
yunti_select: {
|
|
1299
|
+
purpose: "Select an option in a select element by selector/value, fresh uid/value, or fresh uid/visible text while preserving the current selector/value path.",
|
|
1300
|
+
required: [],
|
|
1301
|
+
recommended: ["browserSessionId", "uid", "value"],
|
|
1302
|
+
notes: [
|
|
1303
|
+
"Current runtime behavior supports selector/value, uid/value, and uid/text; selector/value remains compatible for existing workflows.",
|
|
1304
|
+
"Prefer a fresh uid from yunti_observe_page or yunti_take_snapshot when available, then verify the selected option afterward.",
|
|
1305
|
+
"Use visible option text when the user-facing label is clearer than the option value.",
|
|
1306
|
+
"Current successful results preserve selected, element, value, text, uid/selector, browserSessionId, action, target, ok, recoverable, and nextStepHint.",
|
|
1307
|
+
"Uid and selector option misses, disabled options, and non-select targets now return structured selected=false diagnostics with code, matchMode, targetOption, availableValues/availableTexts when available, disabledValue/disabledText for disabled options, and recoveryHint.",
|
|
1308
|
+
],
|
|
1309
|
+
recovery: [
|
|
1310
|
+
"Selector path fails: observe again, inspect the select element, then retry with a stable selector or wait for the form to render.",
|
|
1311
|
+
"Selector value does not match: read recoveryHint, inspect available options, then retry with the correct selector/value or fresh uid/value fallback.",
|
|
1312
|
+
"Uid path fails: refresh with yunti_observe_page before retrying the same uid.",
|
|
1313
|
+
"Option is not found: read recoveryHint, inspect available options via availableValues/availableTexts, then retry with the correct uid/text, uid/value, or selector/value fallback.",
|
|
1314
|
+
"Option is disabled: read recoveryHint.disabledValue / disabledText, choose an enabled option, wait for the field to unlock, or ask the user before retrying.",
|
|
1315
|
+
"Options are populated asynchronously: use yunti_wait_for for the expected option text or form state, then observe again and select with a fresh uid/text or uid/value.",
|
|
1316
|
+
"Uid target is not a select element: read recoveryHint.decision, observe again, target the actual select uid, or use selector/value fallback.",
|
|
1317
|
+
"Wrong tab or stale route: refresh targets with yunti_list_browser_targets and route through the intended browserSessionId.",
|
|
1318
|
+
],
|
|
1319
|
+
commonMistakes: [
|
|
1320
|
+
"Do not pass text without uid; selector path remains selector/value compatible.",
|
|
1321
|
+
"Do not remove selector/value compatibility while adding uid support.",
|
|
1322
|
+
"Do not treat a selected=true result as final proof when the workflow depends on the changed page state; observe or evaluate the field value.",
|
|
1323
|
+
"Do not blindly retry the same selector if the page is still rendering or the option list is dynamic.",
|
|
1029
1324
|
],
|
|
1030
1325
|
},
|
|
1031
1326
|
}
|
|
1032
1327
|
const topicMap = {
|
|
1033
|
-
browser: ["yunti_get_page_snapshot", "yunti_list_browser_targets", "yunti_list_pages"],
|
|
1328
|
+
browser: ["yunti_observe_page", "yunti_wait_for", "yunti_get_page_snapshot", "yunti_list_browser_targets", "yunti_list_pages"],
|
|
1034
1329
|
cdp: ["yunti_cdp_send_command", "yunti_evaluate_script"],
|
|
1035
1330
|
tabs: ["yunti_new_page", "yunti_close_page", "yunti_select_page", "yunti_list_browser_targets"],
|
|
1036
1331
|
memory: ["yunti_get_learning_memory", "yunti_remember_learning", "yunti_forget_learning_memory"],
|
|
1037
1332
|
network: ["yunti_get_network_log", "yunti_list_network_requests", "yunti_get_network_request", "yunti_clear_network_requests"],
|
|
1038
1333
|
console: ["yunti_list_console_messages", "yunti_get_console_message", "yunti_clear_console_messages"],
|
|
1334
|
+
workflow: ["yunti_get_tool_usage_hints", "yunti_list_browser_targets", "yunti_observe_page", "yunti_wait_for"],
|
|
1039
1335
|
}
|
|
1040
1336
|
const selectedNames = requestedTool
|
|
1041
1337
|
? [requestedTool]
|
|
@@ -1052,16 +1348,20 @@ export function toolUsageHints(args = {}) {
|
|
|
1052
1348
|
}
|
|
1053
1349
|
}
|
|
1054
1350
|
return {
|
|
1055
|
-
version: "2026-07-
|
|
1351
|
+
version: "2026-07-05",
|
|
1056
1352
|
coreRules: [
|
|
1057
1353
|
"Every browser-facing yunti_* tool call requires userId.",
|
|
1058
1354
|
"browserSessionId is the current user's browser route; tabId and targetId are selectors, not permissions.",
|
|
1059
1355
|
"yunti_list_browser_targets is the canonical live browser inventory.",
|
|
1060
1356
|
"yunti_list_pages is a compatibility alias for the same live target inventory.",
|
|
1357
|
+
"For page operations, prefer observe -> act by fresh uid -> observe/verify once yunti_observe_page is available.",
|
|
1061
1358
|
"If an old browserSessionId is disconnected or stale, call yunti_list_browser_targets with the current userId to recover the latest browserSessionId and live targets.",
|
|
1062
1359
|
"After yunti_new_page, use the returned browserSessionId for follow-up calls on the new tab.",
|
|
1063
1360
|
"Sessions expire quickly when the extension stops polling; stale-session errors include the reason and recovery hint.",
|
|
1064
1361
|
"If a tool call fails due to parameters, inspect this hint output and the tool schema before retrying.",
|
|
1362
|
+
"In 0.2.1+, default observe-first page actions avoid automatic Chrome debugger attachment; prefer yunti_observe_page plus fresh-uid yunti_click/yunti_hover/yunti_fill/yunti_select/yunti_scroll/yunti_type_text/yunti_press_key on anti-debug-sensitive pages.",
|
|
1363
|
+
"Chrome debugger banners may still appear for explicit low-level or advanced tools such as yunti_cdp_send_command, raw CDP diagnostics, performance tracing, screenshot fallback paths, drag, upload, emulation, resize, or legacy snapshot compatibility.",
|
|
1364
|
+
"Prefer sanitized diagnostics before raw CDP events; screenshots are visible pixels and are not DOM-redacted.",
|
|
1065
1365
|
],
|
|
1066
1366
|
workflows: {
|
|
1067
1367
|
newPage: [
|
|
@@ -1086,6 +1386,89 @@ export function toolUsageHints(args = {}) {
|
|
|
1086
1386
|
"Call yunti_get_learning_memory to find the id.",
|
|
1087
1387
|
"Call yunti_forget_learning_memory with that id.",
|
|
1088
1388
|
],
|
|
1389
|
+
actionRecovery: [
|
|
1390
|
+
"For page actions, prefer observe -> act by fresh uid -> observe/verify.",
|
|
1391
|
+
"If an action fails with a stale or missing uid, refresh with yunti_observe_page before retrying.",
|
|
1392
|
+
"If the element may be outside the viewport, use observe scroll hints and yunti_scroll before falling back to coordinates.",
|
|
1393
|
+
"If the page is loading or changing, use yunti_wait_for or observe again instead of blind retries.",
|
|
1394
|
+
"For async UI transitions, use yunti_wait_for for expected text/selector/state, read ok/code/nextStepHint, then yunti_observe_page, then continue with a fresh uid instead of reusing the old target.",
|
|
1395
|
+
"If the target tab is uncertain, call yunti_list_browser_targets and switch to the intended browserSessionId.",
|
|
1396
|
+
"Use selector or coordinate fallbacks only as recovery/debugging paths, not as the default when fresh uids are available.",
|
|
1397
|
+
],
|
|
1398
|
+
defaultPageOperation: [
|
|
1399
|
+
"Call yunti_get_tool_usage_hints when tool usage is uncertain.",
|
|
1400
|
+
"Call yunti_list_browser_targets and choose the intended browserSessionId.",
|
|
1401
|
+
"Call yunti_observe_page before page actions and use fresh uids whenever possible.",
|
|
1402
|
+
"On anti-debug-sensitive pages, stay on the default observe-first action tools; do not switch to CDP unless explicitly needed.",
|
|
1403
|
+
"After every action, verify by observing again or using snapshot, evaluate, screenshot, network, or console tools.",
|
|
1404
|
+
"For async rendering, validation, navigation, option loading, or infinite scroll, call yunti_wait_for, then yunti_observe_page, then continue with a fresh uid.",
|
|
1405
|
+
"If a result has ok=false, code, recoveryHint, or nextStepHint, follow that guidance before retrying.",
|
|
1406
|
+
"Use selector or coordinate fallback only when fresh uids are unavailable or as an explicit recovery/debugging path.",
|
|
1407
|
+
],
|
|
1408
|
+
confirmationBoundary: [
|
|
1409
|
+
"Ask the user before submitting forms that change production data.",
|
|
1410
|
+
"Ask the user before deleting, approving, purchasing, publishing, or sending messages.",
|
|
1411
|
+
"Ask the user before uploading sensitive files.",
|
|
1412
|
+
"Ask the user before exposing or copying secrets, credentials, cookies, auth headers, tokens, or private keys.",
|
|
1413
|
+
"Ask the user before taking an action whose effect cannot be verified from page state.",
|
|
1414
|
+
],
|
|
1415
|
+
copyableAgentPrompt: [
|
|
1416
|
+
"Please operate my browser through Yunti Browser Runtime.",
|
|
1417
|
+
"Call yunti_list_browser_targets, choose the intended browserSessionId, then use yunti_observe_page before page actions.",
|
|
1418
|
+
"Prefer fresh uids for click, hover, fill, select, scroll, type, press, upload, and drag operations.",
|
|
1419
|
+
"After each action or wait, observe again and verify the result before continuing.",
|
|
1420
|
+
"For async UI, call yunti_wait_for, then yunti_observe_page, then continue with a fresh uid.",
|
|
1421
|
+
"If ok=false, code, recoveryHint, or nextStepHint appears, follow that guidance before retrying.",
|
|
1422
|
+
"Use selector or coordinate fallback only as recovery/debugging paths.",
|
|
1423
|
+
"Ask me before submitting, deleting, approving, purchasing, publishing, uploading sensitive files, or changing production data.",
|
|
1424
|
+
"Do not expose raw cookies, passwords, auth headers, tokens, private keys, or other secrets.",
|
|
1425
|
+
"Prefer sanitized diagnostics; use raw CDP or screenshots only when needed, and summarize safe findings.",
|
|
1426
|
+
"On anti-debug-sensitive pages, use observe-first page actions because 0.2.1+ avoids automatic Chrome debugger attachment on the default action path.",
|
|
1427
|
+
],
|
|
1428
|
+
minimalUseCases: {
|
|
1429
|
+
clickByUid: [
|
|
1430
|
+
"Call yunti_list_browser_targets and select the intended browserSessionId.",
|
|
1431
|
+
"Call yunti_observe_page and choose the target element uid from the fresh observation.",
|
|
1432
|
+
"Call yunti_click with browserSessionId and uid.",
|
|
1433
|
+
"Read ok, code, recoverable, recoveryHint, and nextStepHint; if recoverable, follow the hint before retrying.",
|
|
1434
|
+
"Call yunti_observe_page again or use screenshot/evaluate to verify the expected page change.",
|
|
1435
|
+
],
|
|
1436
|
+
fillForm: [
|
|
1437
|
+
"Call yunti_observe_page and inspect field state: fillable, readOnly, disabled, fillBlockReason, selectedValue, selectedText, and options[].",
|
|
1438
|
+
"Fill editable fields with yunti_fill using fresh uids; select options with yunti_select using uid/value or uid/text.",
|
|
1439
|
+
"For multiple fields, use yunti_fill_form when fields are known and inspect per-field results[].",
|
|
1440
|
+
"If async validation or option loading occurs, call yunti_wait_for, then yunti_observe_page, then continue with fresh uids.",
|
|
1441
|
+
"Before submitting or changing production data, ask the user for confirmation.",
|
|
1442
|
+
],
|
|
1443
|
+
scrollToFind: [
|
|
1444
|
+
"Call yunti_observe_page and inspect scrollableContainers[].",
|
|
1445
|
+
"Prefer yunti_scroll with a fresh scrollable container uid instead of document scroll for nested panels.",
|
|
1446
|
+
"After scrolling, call yunti_observe_page and search the new textTree/elements for the target.",
|
|
1447
|
+
"If moved=false, partialMovement, edgeHint, or recoveryHint appears, follow that guidance before repeating the same scroll.",
|
|
1448
|
+
"When async content loads after scrolling, call yunti_wait_for, then yunti_observe_page, then continue with a fresh scroll container uid.",
|
|
1449
|
+
],
|
|
1450
|
+
switchTab: [
|
|
1451
|
+
"Call yunti_list_browser_targets to inspect current tabs and browser targets.",
|
|
1452
|
+
"Choose the intended browserSessionId for Yunti page tools.",
|
|
1453
|
+
"Use yunti_select_page when switching to a registered Yunti page route.",
|
|
1454
|
+
"Use yunti_cdp_send_command with Target.activateTarget only for raw targetId/tabId browser target activation.",
|
|
1455
|
+
"After switching, call yunti_observe_page or yunti_get_page_snapshot to verify the active page before acting.",
|
|
1456
|
+
],
|
|
1457
|
+
waitForAsyncResult: [
|
|
1458
|
+
"Call yunti_wait_for with expected text, selector, or urlContains.",
|
|
1459
|
+
"If ok=true, call yunti_observe_page and use fresh uids for follow-up actions.",
|
|
1460
|
+
"If code=WAIT_TIMEOUT, observe or inspect current page state before adjusting the condition or retrying.",
|
|
1461
|
+
"Do not reuse pre-wait uids for newly rendered content.",
|
|
1462
|
+
"Verify the final result with observe, snapshot, evaluate, screenshot, network, or console tools.",
|
|
1463
|
+
],
|
|
1464
|
+
},
|
|
1465
|
+
actionResultContract: [
|
|
1466
|
+
"Current action outputs are compatibility-shaped: click/hover/fill/scroll/wait may return clicked, hovered, filled, scrolled, found, uid, selector, x/y, method, valueLength, waitedMs, before/after, and browserSessionId depending on the tool path.",
|
|
1467
|
+
"P6.2 target shape should be additive and structured: action, browserSessionId, target, ok, code, recoverable, nextStepHint, and before/after summaries where useful.",
|
|
1468
|
+
"Do not remove existing success booleans or selector/coordinate fields while converging on the structured result contract.",
|
|
1469
|
+
"Treat successful dispatch as transport/action execution evidence, then verify page state with yunti_observe_page, yunti_get_page_snapshot, yunti_evaluate_script, screenshot, or CDP when the workflow needs proof.",
|
|
1470
|
+
"Recoverable failures should clearly point to observe, scroll, wait, switch tabs, selector/coordinate fallback, or asking the user.",
|
|
1471
|
+
],
|
|
1089
1472
|
},
|
|
1090
1473
|
tools: selectedTools,
|
|
1091
1474
|
}
|