@roll-agent/browser-use-agent 0.7.1 → 0.7.3

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.
@@ -0,0 +1,47 @@
1
+ import type { Page } from "@roll-agent/browser";
2
+ export declare const ZHIPIN_RECOMMEND_GENDER_VALUES: readonly ["不限", "男", "女"];
3
+ export type ZhipinRecommendGender = (typeof ZHIPIN_RECOMMEND_GENDER_VALUES)[number];
4
+ export declare const ZHIPIN_RECOMMEND_ACTIVITY_VALUES: readonly ["不限", "刚刚活跃", "今日活跃", "3日内活跃", "本周活跃", "本月活跃"];
5
+ export type ZhipinRecommendActivity = (typeof ZHIPIN_RECOMMEND_ACTIVITY_VALUES)[number];
6
+ export declare const ZHIPIN_RECOMMEND_FILTER_STATUS_VALUES: readonly ["applied", "recommend_not_ready", "filter_not_found", "requires_vip", "age_not_applied", "submit_failed", "error"];
7
+ export type ZhipinRecommendFilterStatus = (typeof ZHIPIN_RECOMMEND_FILTER_STATUS_VALUES)[number];
8
+ export type RecommendTarget = Page | NonNullable<ReturnType<Page["frame"]>>;
9
+ type PageLocator = ReturnType<Page["locator"]>;
10
+ export type ZhipinRecommendFilterRequest = {
11
+ readonly ageMin?: number;
12
+ readonly ageMax?: number;
13
+ readonly gender: ZhipinRecommendGender;
14
+ readonly activity: ZhipinRecommendActivity;
15
+ };
16
+ export type ZhipinRecommendFilterApplied = {
17
+ readonly ageMin?: number;
18
+ readonly ageMax?: number;
19
+ readonly gender: string;
20
+ readonly activity: string;
21
+ };
22
+ export type ZhipinRecommendFilterApplyResult = {
23
+ readonly status: ZhipinRecommendFilterStatus;
24
+ readonly requested: ZhipinRecommendFilterRequest;
25
+ readonly applied?: ZhipinRecommendFilterApplied;
26
+ readonly filterButtonText?: string;
27
+ readonly error?: string;
28
+ };
29
+ export type RecommendFilterVisualFeedback = {
30
+ readonly moveToLocator: (page: Page, locator: PageLocator, options?: {
31
+ readonly durationMs?: number;
32
+ readonly settleMs?: number;
33
+ readonly target?: RecommendTarget;
34
+ }) => Promise<boolean>;
35
+ readonly showClickOnLocator: (page: Page, locator: PageLocator, options?: {
36
+ readonly pulseDurationMs?: number;
37
+ readonly target?: RecommendTarget;
38
+ }) => Promise<boolean>;
39
+ };
40
+ type RecommendAgeState = {
41
+ readonly ageMin?: number;
42
+ readonly ageMax?: number;
43
+ };
44
+ export declare function parseRecommendAgeStateText(text: string): RecommendAgeState;
45
+ export declare function waitForRecommendFilterSurface(target: RecommendTarget, timeout?: number): Promise<boolean>;
46
+ export declare function applyRecommendFilter(page: Page, target: RecommendTarget, requested: ZhipinRecommendFilterRequest, visualFeedback?: RecommendFilterVisualFeedback): Promise<ZhipinRecommendFilterApplyResult>;
47
+ export {};
@@ -87,9 +87,16 @@ export declare const ZHIPIN_SELECTORS: {
87
87
  readonly primary: ".nav-item.nav-logout .user-name";
88
88
  readonly fallbacks: readonly string[];
89
89
  };
90
+ readonly nav: {
91
+ readonly sidebar: ".side-wrap.side-wrap-v2";
92
+ readonly chatLink: ".side-wrap.side-wrap-v2 a[href*=\"/web/chat/index\"]";
93
+ readonly recommendLink: ".side-wrap.side-wrap-v2 a[href*=\"/web/geek/recommend\"]";
94
+ };
90
95
  readonly recommend: {
91
96
  readonly iframe: "#recommendFrame";
92
97
  readonly resumeIframe: "iframe[src*=\"c-resume\"]";
98
+ readonly filterButton: ".recommend-filter .filter-label, .filter-label-wrap .filter-label, .filter-label";
99
+ readonly filterPanel: ".filter-panel";
93
100
  readonly candidateItem: "[data-geek], .geek-item";
94
101
  readonly candidateName: ".name";
95
102
  readonly candidateBaseInfo: ".base-info";
@@ -0,0 +1,14 @@
1
+ import type { Page } from "@roll-agent/browser";
2
+ declare const ZHIPIN_SIDEBAR_SECTION_LABELS: {
3
+ readonly chat: "沟通";
4
+ readonly recommend: "推荐牛人";
5
+ };
6
+ export type ZhipinSidebarSection = keyof typeof ZHIPIN_SIDEBAR_SECTION_LABELS;
7
+ type Locator = ReturnType<Page["locator"]>;
8
+ export declare function getZhipinSidebarSectionLabel(section: ZhipinSidebarSection): string;
9
+ export declare function findZhipinSidebarSectionLink(page: Page, section: ZhipinSidebarSection): Promise<Locator | null>;
10
+ export declare function isZhipinRecommendSurfaceOpen(page: Page): boolean;
11
+ export declare function isZhipinChatSurfaceOpen(page: Page): Promise<boolean>;
12
+ export declare function waitForZhipinRecommendSurface(page: Page, timeout?: number, pollInterval?: number): Promise<boolean>;
13
+ export declare function waitForZhipinChatSurface(page: Page, timeout?: number, pollInterval?: number): Promise<boolean>;
14
+ export {};
@@ -10,6 +10,8 @@ export declare const browserStatus: import("@roll-agent/sdk").ToolDefinition<{},
10
10
  currentUrl?: string | undefined;
11
11
  }[];
12
12
  replyAuthorityKeysLoaded: boolean;
13
+ visualCursorEnabled: boolean;
14
+ visualActivityEnabled: boolean;
13
15
  effectiveEnvSources: Record<string, {
14
16
  present: boolean;
15
17
  fingerprint?: string | undefined;
@@ -1,3 +1,15 @@
1
+ import { findTrackedPlatformPage } from "../pages/platform-page.ts";
2
+ import { getContextManager } from "../runtime-holder.ts";
3
+ import { detectPlatformFromUrl, matchesPlatformHost } from "../platforms.ts";
4
+ import { toAttachedPageInfo } from "../page-info.ts";
5
+ type NavigateActiveTabDeps = {
6
+ readonly getContextManager: typeof getContextManager;
7
+ readonly detectPlatformFromUrl: typeof detectPlatformFromUrl;
8
+ readonly matchesPlatformHost: typeof matchesPlatformHost;
9
+ readonly findTrackedPlatformPage: typeof findTrackedPlatformPage;
10
+ readonly toAttachedPageInfo: typeof toAttachedPageInfo;
11
+ };
12
+ export declare function setNavigateActiveTabDepsForTests(override: Partial<NavigateActiveTabDeps> | undefined): void;
1
13
  export declare const navigateActiveTab: import("@roll-agent/sdk").ToolDefinition<{
2
14
  url: string;
3
15
  }, {
@@ -11,3 +23,4 @@ export declare const navigateActiveTab: import("@roll-agent/sdk").ToolDefinition
11
23
  isSelectedForPlatform: boolean;
12
24
  };
13
25
  }>;
26
+ export {};
@@ -1,6 +1,7 @@
1
1
  export declare const zhipinExchangeWechat: import("@roll-agent/sdk").ToolDefinition<{
2
- index?: number | undefined;
2
+ conversationId?: string | undefined;
3
3
  candidateName?: string | undefined;
4
+ index?: number | undefined;
4
5
  }, {
5
6
  success: boolean;
6
7
  exchanged: boolean;
@@ -0,0 +1,40 @@
1
+ import { getContextManager } from "../runtime-holder.ts";
2
+ import { applyRecommendFilter, waitForRecommendFilterSurface, type RecommendTarget } from "../pages/zhipin/recommend-filter.ts";
3
+ import { getRecommendTarget } from "../pages/zhipin/recommend-list.ts";
4
+ import { VisualActivitySession } from "../visual-activity-session.ts";
5
+ import { moveVisualCursorToLocator, showVisualClickOnLocator } from "../visual-cursor.ts";
6
+ type VisualActivitySessionLike = Pick<VisualActivitySession, "begin" | "highlightSelector" | "retarget" | "succeed" | "fail">;
7
+ type ZhipinFilterRecommendCandidatesDeps = {
8
+ readonly getContextManager: typeof getContextManager;
9
+ readonly getRecommendTarget: typeof getRecommendTarget;
10
+ readonly waitForRecommendFilterSurface: typeof waitForRecommendFilterSurface;
11
+ readonly applyRecommendFilter: typeof applyRecommendFilter;
12
+ readonly moveVisualCursorToLocator: typeof moveVisualCursorToLocator;
13
+ readonly showVisualClickOnLocator: typeof showVisualClickOnLocator;
14
+ readonly createVisualActivitySession: (target: RecommendTarget) => VisualActivitySessionLike;
15
+ };
16
+ export declare function setZhipinFilterRecommendCandidatesDepsForTests(override: Partial<ZhipinFilterRecommendCandidatesDeps> | undefined): void;
17
+ export declare const zhipinFilterRecommendCandidates: import("@roll-agent/sdk").ToolDefinition<{
18
+ activity?: "不限" | "刚刚活跃" | "今日活跃" | "3日内活跃" | "本周活跃" | "本月活跃" | undefined;
19
+ ageMin?: number | undefined;
20
+ ageMax?: number | undefined;
21
+ gender?: "不限" | "男" | "女" | undefined;
22
+ }, {
23
+ status: "error" | "applied" | "recommend_not_ready" | "filter_not_found" | "requires_vip" | "age_not_applied" | "submit_failed";
24
+ success: boolean;
25
+ requested: {
26
+ activity: "不限" | "刚刚活跃" | "今日活跃" | "3日内活跃" | "本周活跃" | "本月活跃";
27
+ gender: "不限" | "男" | "女";
28
+ ageMin?: number | undefined;
29
+ ageMax?: number | undefined;
30
+ };
31
+ error?: string | undefined;
32
+ applied?: {
33
+ activity: string;
34
+ gender: string;
35
+ ageMin?: number | undefined;
36
+ ageMax?: number | undefined;
37
+ } | undefined;
38
+ filterButtonText?: string | undefined;
39
+ }>;
40
+ export {};
@@ -1,6 +1,7 @@
1
1
  export declare const zhipinGetCandidateInfo: import("@roll-agent/sdk").ToolDefinition<{
2
- index?: number | undefined;
2
+ conversationId?: string | undefined;
3
3
  candidateName?: string | undefined;
4
+ index?: number | undefined;
4
5
  maxMessages?: number | undefined;
5
6
  }, {
6
7
  success: boolean;
@@ -1,11 +1,25 @@
1
+ import { getRecommendTarget, waitForRecommendList } from "../pages/zhipin/recommend-list.ts";
2
+ import { getContextManager } from "../runtime-holder.ts";
3
+ import { VisualActivitySession } from "../visual-activity-session.ts";
4
+ type RecommendTarget = ReturnType<typeof getRecommendTarget>;
5
+ type VisualActivitySessionLike = Pick<VisualActivitySession, "begin" | "highlightSelector" | "succeed" | "fail" | "retarget">;
6
+ type ZhipinGetCandidateListDeps = {
7
+ readonly getContextManager: typeof getContextManager;
8
+ readonly getRecommendTarget: typeof getRecommendTarget;
9
+ readonly waitForRecommendList: typeof waitForRecommendList;
10
+ readonly createVisualActivitySession: (target: RecommendTarget) => VisualActivitySessionLike;
11
+ };
12
+ export declare function setZhipinGetCandidateListDepsForTests(override: Partial<ZhipinGetCandidateListDeps> | undefined): void;
1
13
  export declare const zhipinGetCandidateList: import("@roll-agent/sdk").ToolDefinition<{
14
+ autoScroll?: boolean | undefined;
15
+ maxScrolls?: number | undefined;
2
16
  maxResults?: number | undefined;
3
17
  }, {
4
18
  success: boolean;
5
19
  candidates: {
6
20
  name: string;
7
- index: number;
8
21
  candidateId: string;
22
+ index: number;
9
23
  expectedLocation: string;
10
24
  expectedPosition: string;
11
25
  age: string;
@@ -20,4 +34,19 @@ export declare const zhipinGetCandidateList: import("@roll-agent/sdk").ToolDefin
20
34
  }[];
21
35
  total: number;
22
36
  error?: string | undefined;
37
+ scrollStats?: {
38
+ stopReason: "target-count" | "boundary" | "no-new-items" | "max-steps";
39
+ containerLabel: string;
40
+ stepsRequested: number;
41
+ stepsCompleted: number;
42
+ reachedBoundary: boolean;
43
+ uniqueCount: number;
44
+ duplicateCount: number;
45
+ noNewRounds: number;
46
+ beforeItemCount: number;
47
+ afterItemCount: number;
48
+ beforeScrollHeight: number;
49
+ afterScrollHeight: number;
50
+ } | undefined;
23
51
  }>;
52
+ export {};
@@ -1,3 +1,15 @@
1
+ import type { Page } from "@roll-agent/browser";
2
+ import { getCurrentZhipinRecruiterIdentity } from "../pages/zhipin/recruiter-identity.ts";
3
+ import { findHeaderScope } from "../pages/zhipin/username.ts";
4
+ import { getContextManager } from "../runtime-holder.ts";
5
+ import { VisualActivitySession } from "../visual-activity-session.ts";
6
+ type ZhipinGetUsernameDeps = {
7
+ readonly getContextManager: typeof getContextManager;
8
+ readonly findHeaderScope: typeof findHeaderScope;
9
+ readonly getCurrentZhipinRecruiterIdentity: typeof getCurrentZhipinRecruiterIdentity;
10
+ readonly createVisualActivitySession: (page: Page) => VisualActivitySession;
11
+ };
12
+ export declare function setZhipinGetUsernameDepsForTests(override: Partial<ZhipinGetUsernameDeps> | undefined): void;
1
13
  export declare const zhipinGetUsername: import("@roll-agent/sdk").ToolDefinition<{}, {
2
14
  success: boolean;
3
15
  username: string;
@@ -6,3 +18,4 @@ export declare const zhipinGetUsername: import("@roll-agent/sdk").ToolDefinition
6
18
  usedSelector?: string | undefined;
7
19
  usedStrategy?: string | undefined;
8
20
  }>;
21
+ export {};
@@ -0,0 +1,36 @@
1
+ import type { Page } from "@roll-agent/browser";
2
+ import { randomDelay } from "../pages/zhipin/anti-detection.ts";
3
+ import { findZhipinSidebarSectionLink, isZhipinChatSurfaceOpen, waitForZhipinChatSurface } from "../pages/zhipin/sidebar-navigation.ts";
4
+ import { toAttachedPageInfo } from "../page-info.ts";
5
+ import { getContextManager } from "../runtime-holder.ts";
6
+ import { VisualActivitySession } from "../visual-activity-session.ts";
7
+ import { moveVisualCursorToLocator, showVisualClickOnLocator } from "../visual-cursor.ts";
8
+ type VisualActivitySessionLike = Pick<VisualActivitySession, "begin" | "highlightSelector" | "succeed" | "fail">;
9
+ type ZhipinOpenChatPageDeps = {
10
+ readonly getContextManager: typeof getContextManager;
11
+ readonly findZhipinSidebarSectionLink: typeof findZhipinSidebarSectionLink;
12
+ readonly isZhipinChatSurfaceOpen: typeof isZhipinChatSurfaceOpen;
13
+ readonly waitForZhipinChatSurface: typeof waitForZhipinChatSurface;
14
+ readonly moveVisualCursorToLocator: typeof moveVisualCursorToLocator;
15
+ readonly showVisualClickOnLocator: typeof showVisualClickOnLocator;
16
+ readonly randomDelay: typeof randomDelay;
17
+ readonly toAttachedPageInfo: typeof toAttachedPageInfo;
18
+ readonly createVisualActivitySession: (page: Page) => VisualActivitySessionLike;
19
+ };
20
+ export declare function setZhipinOpenChatPageDepsForTests(override: Partial<ZhipinOpenChatPageDeps> | undefined): void;
21
+ export declare const zhipinOpenChatPage: import("@roll-agent/sdk").ToolDefinition<{}, {
22
+ success: boolean;
23
+ alreadyOnChat: boolean;
24
+ usedSidebarClick: boolean;
25
+ chatReady: boolean;
26
+ error?: string | undefined;
27
+ page?: {
28
+ url: string;
29
+ title: string;
30
+ pageId: string;
31
+ boundPlatform: "zhipin" | "yupao" | null;
32
+ detectedPlatform: "zhipin" | "yupao" | null;
33
+ isSelectedForPlatform: boolean;
34
+ } | undefined;
35
+ }>;
36
+ export {};
@@ -1,14 +1,17 @@
1
1
  export declare const zhipinOpenChat: import("@roll-agent/sdk").ToolDefinition<{
2
- index?: number | undefined;
2
+ conversationId?: string | undefined;
3
3
  candidateName?: string | undefined;
4
+ index?: number | undefined;
4
5
  preferUnread?: boolean | undefined;
5
6
  }, {
6
7
  success: boolean;
8
+ conversationId: string;
9
+ candidateId: string;
10
+ candidateName: string;
11
+ index: number;
7
12
  hasUnread: boolean;
8
13
  unreadCount: number;
9
14
  lastMessageTime: string;
10
15
  messagePreview: string;
11
- index: number;
12
- candidateName: string;
13
16
  error?: string | undefined;
14
17
  }>;
@@ -0,0 +1,38 @@
1
+ import { randomDelay } from "../pages/zhipin/anti-detection.ts";
2
+ import { getRecommendTarget } from "../pages/zhipin/recommend-list.ts";
3
+ import { findZhipinSidebarSectionLink, isZhipinRecommendSurfaceOpen, waitForZhipinRecommendSurface } from "../pages/zhipin/sidebar-navigation.ts";
4
+ import { toAttachedPageInfo } from "../page-info.ts";
5
+ import { getContextManager } from "../runtime-holder.ts";
6
+ import { VisualActivitySession } from "../visual-activity-session.ts";
7
+ import { moveVisualCursorToLocator, showVisualClickOnLocator } from "../visual-cursor.ts";
8
+ type RecommendTarget = ReturnType<typeof getRecommendTarget>;
9
+ type VisualActivitySessionLike = Pick<VisualActivitySession, "begin" | "highlightSelector" | "retarget" | "succeed" | "fail">;
10
+ type ZhipinOpenRecommendPageDeps = {
11
+ readonly getContextManager: typeof getContextManager;
12
+ readonly getRecommendTarget: typeof getRecommendTarget;
13
+ readonly findZhipinSidebarSectionLink: typeof findZhipinSidebarSectionLink;
14
+ readonly isZhipinRecommendSurfaceOpen: typeof isZhipinRecommendSurfaceOpen;
15
+ readonly waitForZhipinRecommendSurface: typeof waitForZhipinRecommendSurface;
16
+ readonly moveVisualCursorToLocator: typeof moveVisualCursorToLocator;
17
+ readonly showVisualClickOnLocator: typeof showVisualClickOnLocator;
18
+ readonly randomDelay: typeof randomDelay;
19
+ readonly toAttachedPageInfo: typeof toAttachedPageInfo;
20
+ readonly createVisualActivitySession: (target: RecommendTarget) => VisualActivitySessionLike;
21
+ };
22
+ export declare function setZhipinOpenRecommendPageDepsForTests(override: Partial<ZhipinOpenRecommendPageDeps> | undefined): void;
23
+ export declare const zhipinOpenRecommendPage: import("@roll-agent/sdk").ToolDefinition<{}, {
24
+ success: boolean;
25
+ usedSidebarClick: boolean;
26
+ alreadyOnRecommend: boolean;
27
+ recommendReady: boolean;
28
+ error?: string | undefined;
29
+ page?: {
30
+ url: string;
31
+ title: string;
32
+ pageId: string;
33
+ boundPlatform: "zhipin" | "yupao" | null;
34
+ detectedPlatform: "zhipin" | "yupao" | null;
35
+ isSelectedForPlatform: boolean;
36
+ } | undefined;
37
+ }>;
38
+ export {};
@@ -2,6 +2,8 @@ export declare const zhipinReadMessages: import("@roll-agent/sdk").ToolDefinitio
2
2
  limit?: number | undefined;
3
3
  onlyUnread?: boolean | undefined;
4
4
  sortBy?: "name" | "time" | "unreadCount" | undefined;
5
+ autoScroll?: boolean | undefined;
6
+ maxScrolls?: number | undefined;
5
7
  }, {
6
8
  success: boolean;
7
9
  candidates: {
@@ -1,3 +1,23 @@
1
+ import { getContextManager } from "../runtime-holder.ts";
2
+ import { humanDelay, shouldAddRandomBehavior, performRandomScroll } from "../pages/zhipin/anti-detection.ts";
3
+ import { getRecommendTarget, inspectRecommendCard, waitForRecommendList } from "../pages/zhipin/recommend-list.ts";
4
+ import { VisualActivitySession } from "../visual-activity-session.ts";
5
+ import { moveVisualCursorToLocator, showVisualClickOnLocator } from "../visual-cursor.ts";
6
+ type RecommendTarget = ReturnType<typeof getRecommendTarget>;
7
+ type VisualActivitySessionLike = Pick<VisualActivitySession, "begin" | "highlightSelector" | "highlightLocator" | "succeed" | "fail" | "retarget">;
8
+ type ZhipinSayHelloDeps = {
9
+ readonly getContextManager: typeof getContextManager;
10
+ readonly getRecommendTarget: typeof getRecommendTarget;
11
+ readonly waitForRecommendList: typeof waitForRecommendList;
12
+ readonly inspectRecommendCard: typeof inspectRecommendCard;
13
+ readonly moveVisualCursorToLocator: typeof moveVisualCursorToLocator;
14
+ readonly showVisualClickOnLocator: typeof showVisualClickOnLocator;
15
+ readonly humanDelay: typeof humanDelay;
16
+ readonly shouldAddRandomBehavior: typeof shouldAddRandomBehavior;
17
+ readonly performRandomScroll: typeof performRandomScroll;
18
+ readonly createVisualActivitySession: (target: RecommendTarget) => VisualActivitySessionLike;
19
+ };
20
+ export declare function setZhipinSayHelloDepsForTests(override: Partial<ZhipinSayHelloDeps> | undefined): void;
1
21
  export declare const zhipinSayHello: import("@roll-agent/sdk").ToolDefinition<{
2
22
  indices: number[];
3
23
  }, {
@@ -9,9 +29,10 @@ export declare const zhipinSayHello: import("@roll-agent/sdk").ToolDefinition<{
9
29
  success: boolean;
10
30
  results: {
11
31
  success: boolean;
12
- index: number;
13
32
  candidateId: string;
14
33
  candidateName: string;
34
+ index: number;
15
35
  error?: string | undefined;
16
36
  }[];
17
37
  }>;
38
+ export {};
@@ -0,0 +1,35 @@
1
+ export declare const zhipinScrollView: import("@roll-agent/sdk").ToolDefinition<{
2
+ surface: "chat-list" | "chat-history" | "recommend-list";
3
+ direction?: "up" | "down" | undefined;
4
+ distance?: number | undefined;
5
+ steps?: number | undefined;
6
+ settleMs?: number | undefined;
7
+ }, {
8
+ success: boolean;
9
+ direction: "up" | "down";
10
+ stepsRequested: number;
11
+ stepsCompleted: number;
12
+ before: {
13
+ containerFound: boolean;
14
+ containerLabel: string;
15
+ scrollTop: number;
16
+ scrollHeight: number;
17
+ clientHeight: number;
18
+ atStart: boolean;
19
+ atEnd: boolean;
20
+ itemCount: number;
21
+ };
22
+ after: {
23
+ containerFound: boolean;
24
+ containerLabel: string;
25
+ scrollTop: number;
26
+ scrollHeight: number;
27
+ clientHeight: number;
28
+ atStart: boolean;
29
+ atEnd: boolean;
30
+ itemCount: number;
31
+ };
32
+ reachedBoundary: boolean;
33
+ surface: "chat-list" | "chat-history" | "recommend-list";
34
+ error?: string | undefined;
35
+ }>;
@@ -1,7 +1,7 @@
1
1
  export declare const zhipinSendReply: import("@roll-agent/sdk").ToolDefinition<{
2
2
  signedEnvelope: string;
3
- index?: number | undefined;
4
3
  candidateName?: string | undefined;
4
+ index?: number | undefined;
5
5
  }, {
6
6
  success: boolean;
7
7
  sentMessage: string;
@@ -0,0 +1,21 @@
1
+ import type { Page } from "@roll-agent/browser";
2
+ import type { VisualActivityTone, VisualTarget } from "./visual-activity.ts";
3
+ type PageLocator = ReturnType<Page["locator"]>;
4
+ type VisualActivityHighlightOptions = {
5
+ readonly label?: string;
6
+ readonly padding?: number;
7
+ readonly tone?: VisualActivityTone;
8
+ };
9
+ export declare class VisualActivitySession {
10
+ page: Page;
11
+ target: VisualTarget;
12
+ constructor(initialTarget: VisualTarget);
13
+ retarget(nextTarget: VisualTarget): Promise<boolean>;
14
+ begin(label: string, tone?: VisualActivityTone): Promise<boolean>;
15
+ highlightSelector(selector: string, options?: VisualActivityHighlightOptions): Promise<boolean>;
16
+ highlightLocator(locator: PageLocator, options?: VisualActivityHighlightOptions): Promise<boolean>;
17
+ succeed(label: string, lingerMs?: number): Promise<boolean>;
18
+ fail(label: string, lingerMs?: number): Promise<boolean>;
19
+ clear(): Promise<boolean>;
20
+ }
21
+ export {};
@@ -0,0 +1,60 @@
1
+ import type { Page } from "@roll-agent/browser";
2
+ type PageLocator = ReturnType<Page["locator"]>;
3
+ export type VisualTarget = Page | NonNullable<ReturnType<Page["frame"]>>;
4
+ type VisualActivityOptions = {
5
+ readonly label: string;
6
+ readonly target?: VisualTarget;
7
+ readonly tone?: VisualActivityTone;
8
+ };
9
+ type VisualHighlightOptions = {
10
+ readonly label?: string;
11
+ readonly padding?: number;
12
+ readonly target?: VisualTarget;
13
+ readonly tone?: VisualActivityTone;
14
+ };
15
+ type VisualCompletionOptions = {
16
+ readonly label: string;
17
+ readonly lingerMs?: number;
18
+ readonly status?: "success" | "error";
19
+ readonly target?: VisualTarget;
20
+ };
21
+ declare const VISUAL_ACTIVITY_THEMES: {
22
+ readonly info: {
23
+ readonly accent: "#14b8a6";
24
+ readonly accentSoft: "rgba(20, 184, 166, 0.42)";
25
+ readonly accentGlow: "rgba(20, 184, 166, 0.18)";
26
+ readonly capsuleBg: "rgba(15, 23, 42, 0.82)";
27
+ readonly capsuleBorder: "rgba(45, 212, 191, 0.38)";
28
+ readonly text: "#F8FAFC";
29
+ readonly dot: "#2DD4BF";
30
+ };
31
+ readonly success: {
32
+ readonly accent: "#22c55e";
33
+ readonly accentSoft: "rgba(34, 197, 94, 0.42)";
34
+ readonly accentGlow: "rgba(34, 197, 94, 0.18)";
35
+ readonly capsuleBg: "rgba(10, 24, 16, 0.86)";
36
+ readonly capsuleBorder: "rgba(74, 222, 128, 0.38)";
37
+ readonly text: "#F0FDF4";
38
+ readonly dot: "#4ADE80";
39
+ };
40
+ readonly error: {
41
+ readonly accent: "#f59e0b";
42
+ readonly accentSoft: "rgba(245, 158, 11, 0.42)";
43
+ readonly accentGlow: "rgba(245, 158, 11, 0.2)";
44
+ readonly capsuleBg: "rgba(41, 24, 10, 0.88)";
45
+ readonly capsuleBorder: "rgba(251, 191, 36, 0.4)";
46
+ readonly text: "#FFFBEB";
47
+ readonly dot: "#FBBF24";
48
+ };
49
+ };
50
+ export type VisualActivityTone = keyof typeof VISUAL_ACTIVITY_THEMES;
51
+ export declare function isVisualActivityEnabled(): boolean;
52
+ export declare function setVisualActivityEnabledForTests(value: boolean | undefined): void;
53
+ export declare function beginVisualActivity(page: Page, options: VisualActivityOptions): Promise<boolean>;
54
+ export declare function highlightVisualRegionForLocator(page: Page, locator: PageLocator, options?: VisualHighlightOptions): Promise<boolean>;
55
+ export declare function highlightVisualRegionForSelector(page: Page, selector: string, options?: VisualHighlightOptions): Promise<boolean>;
56
+ export declare function completeVisualActivity(page: Page, options: VisualCompletionOptions): Promise<boolean>;
57
+ export declare function clearVisualActivity(page: Page, options?: {
58
+ readonly target?: VisualTarget;
59
+ }): Promise<boolean>;
60
+ export {};
@@ -0,0 +1,22 @@
1
+ import type { Page } from "@roll-agent/browser";
2
+ type PageLocator = ReturnType<Page["locator"]>;
3
+ type VisualTarget = Page | NonNullable<ReturnType<Page["frame"]>>;
4
+ type CursorMoveOptions = {
5
+ readonly durationMs?: number;
6
+ readonly settleMs?: number;
7
+ readonly target?: VisualTarget;
8
+ };
9
+ type CursorClickOptions = {
10
+ readonly pulseDurationMs?: number;
11
+ readonly target?: VisualTarget;
12
+ };
13
+ export declare function isVisualCursorEnabled(): boolean;
14
+ export declare function setVisualCursorEnabledForTests(value: boolean | undefined): void;
15
+ export declare function clearVisualCursor(page: Page, options?: {
16
+ readonly preserveTarget?: VisualTarget;
17
+ }): Promise<boolean>;
18
+ export declare function moveVisualCursorToLocator(page: Page, locator: PageLocator, options?: CursorMoveOptions): Promise<boolean>;
19
+ export declare function showVisualClickOnLocator(page: Page, locator: PageLocator, options?: CursorClickOptions): Promise<boolean>;
20
+ export declare function moveVisualCursorToSelector(page: Page, selector: string, options?: CursorMoveOptions): Promise<boolean>;
21
+ export declare function showVisualClickOnSelector(page: Page, selector: string): Promise<boolean>;
22
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roll-agent/browser-use-agent",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,3 +2,12 @@ required:
2
2
  - name: REPLY_AUTHORITY_KEYS_URL
3
3
  purpose: Reply Authority Service 公钥分发端点;`zhipin_send_reply` 启动预热和本地 Ed25519 验签都依赖它
4
4
  example: https://reply-authority.duliday.com/.well-known/reply-authority-keys
5
+ optional:
6
+ - name: BROWSER_VISUAL_CURSOR
7
+ purpose: 在可见浏览器页面内显示 browser-use 的页内虚拟指针和点击波纹;默认开启,设为 `"false"` 可关闭
8
+ default: "true"
9
+ example: "false"
10
+ - name: BROWSER_VISUAL_ACTIVITY
11
+ purpose: 在消息读取、账号识别、聊天详情提取等非点击型操作期间显示页内状态胶囊、区域柔光和完成态反馈;默认开启,设为 `"false"` 可关闭
12
+ default: "true"
13
+ example: "true"