@roll-agent/browser-use-agent 0.26.1 → 0.27.0

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 (39) hide show
  1. package/SKILL.md +36 -8
  2. package/dist/browser-observation.d.ts +1 -0
  3. package/dist/execution-visual-feedback.d.ts +61 -0
  4. package/dist/goal/compact-request.d.ts +5 -0
  5. package/dist/goal/contracts.d.ts +1732 -0
  6. package/dist/goal/decisions.d.ts +55 -0
  7. package/dist/goal/dependency-observation.d.ts +7 -0
  8. package/dist/goal/execution-context.d.ts +593 -0
  9. package/dist/goal/form-context.d.ts +639 -0
  10. package/dist/goal/form-handoff.d.ts +152 -0
  11. package/dist/goal/form-loop-progress.d.ts +9 -0
  12. package/dist/goal/form-policy.d.ts +13 -0
  13. package/dist/goal/host.d.ts +6 -0
  14. package/dist/goal/interaction-feedback.d.ts +82 -0
  15. package/dist/goal/loop.d.ts +12 -0
  16. package/dist/goal/observation-retry.d.ts +3 -0
  17. package/dist/goal/observation.d.ts +981 -0
  18. package/dist/goal/operate-handoff.d.ts +3 -0
  19. package/dist/goal/picker-observation.d.ts +56 -0
  20. package/dist/goal/picker-state.d.ts +96 -0
  21. package/dist/goal/reachability.d.ts +2 -0
  22. package/dist/goal/task-evidence.d.ts +33 -0
  23. package/dist/goal/task-freshness.d.ts +86 -0
  24. package/dist/goal/task-loop.d.ts +5 -0
  25. package/dist/goal/task-observation.d.ts +5 -0
  26. package/dist/goal/task-policy.d.ts +174 -0
  27. package/dist/goal/task-progress-policy.d.ts +25 -0
  28. package/dist/goal/task-progress.d.ts +353 -0
  29. package/dist/goal/task-sources.d.ts +13 -0
  30. package/dist/index.js +1 -1
  31. package/dist/native-visual-activity-session.d.ts +38 -1
  32. package/dist/tools/browser-operate.d.ts +252 -0
  33. package/dist/tools/zhipin-diagnose-browser-state.d.ts +4 -4
  34. package/dist/tools/zhipin-generate-reply-preview.d.ts +1 -1
  35. package/dist/tools/zhipin-get-candidate-info.d.ts +1 -1
  36. package/dist/tools/zhipin-scroll-view.d.ts +5 -5
  37. package/package.json +3 -3
  38. package/references/browser-exploration.md +52 -0
  39. package/references/env.yaml +11 -0
@@ -0,0 +1,152 @@
1
+ import { z } from "zod";
2
+ /** A summary is not a fresh locator or an independent certification of completion. */
3
+ export declare const FormHandoffSchema: z.ZodObject<{
4
+ observationFresh: z.ZodBoolean;
5
+ diagnosticsOmitted: z.ZodLiteral<true>;
6
+ totalSteps: z.ZodNumber;
7
+ omittedSteps: z.ZodNumber;
8
+ fields: z.ZodArray<z.ZodObject<Pick<{
9
+ id: z.ZodString;
10
+ name: z.ZodString;
11
+ intent: z.ZodEnum<["set", "preserve"]>;
12
+ comparison: z.ZodEnum<["auto", "literal", "semantic"]>;
13
+ expected: z.ZodOptional<z.ZodString>;
14
+ binding: z.ZodOptional<z.ZodObject<{
15
+ identity: z.ZodString;
16
+ readOnlyDisplay: z.ZodOptional<z.ZodLiteral<true>>;
17
+ key: z.ZodOptional<z.ZodString>;
18
+ name: z.ZodString;
19
+ role: z.ZodString;
20
+ fieldLabel: z.ZodOptional<z.ZodString>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ role: string;
23
+ name: string;
24
+ identity: string;
25
+ key?: string | undefined;
26
+ fieldLabel?: string | undefined;
27
+ readOnlyDisplay?: true | undefined;
28
+ }, {
29
+ role: string;
30
+ name: string;
31
+ identity: string;
32
+ key?: string | undefined;
33
+ fieldLabel?: string | undefined;
34
+ readOnlyDisplay?: true | undefined;
35
+ }>>;
36
+ entry: z.ZodOptional<z.ZodObject<{
37
+ identity: z.ZodString;
38
+ readOnlyDisplay: z.ZodOptional<z.ZodLiteral<true>>;
39
+ key: z.ZodOptional<z.ZodString>;
40
+ name: z.ZodString;
41
+ role: z.ZodString;
42
+ fieldLabel: z.ZodOptional<z.ZodString>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ role: string;
45
+ name: string;
46
+ identity: string;
47
+ key?: string | undefined;
48
+ fieldLabel?: string | undefined;
49
+ readOnlyDisplay?: true | undefined;
50
+ }, {
51
+ role: string;
52
+ name: string;
53
+ identity: string;
54
+ key?: string | undefined;
55
+ fieldLabel?: string | undefined;
56
+ readOnlyDisplay?: true | undefined;
57
+ }>>;
58
+ entryProof: z.ZodOptional<z.ZodObject<{
59
+ fingerprint: z.ZodString;
60
+ status: z.ZodEnum<["satisfied", "unsatisfied", "unknown"]>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ status: "unknown" | "satisfied" | "unsatisfied";
63
+ fingerprint: string;
64
+ }, {
65
+ status: "unknown" | "satisfied" | "unsatisfied";
66
+ fingerprint: string;
67
+ }>>;
68
+ initial: z.ZodOptional<z.ZodString>;
69
+ current: z.ZodOptional<z.ZodString>;
70
+ status: z.ZodEnum<["unknown", "unsatisfied", "satisfied"]>;
71
+ reason: z.ZodString;
72
+ fingerprint: z.ZodOptional<z.ZodString>;
73
+ target: z.ZodOptional<z.ZodObject<{
74
+ key: z.ZodString;
75
+ label: z.ZodString;
76
+ optionsKey: z.ZodString;
77
+ }, "strip", z.ZodTypeAny, {
78
+ label: string;
79
+ key: string;
80
+ optionsKey: string;
81
+ }, {
82
+ label: string;
83
+ key: string;
84
+ optionsKey: string;
85
+ }>>;
86
+ semanticProof: z.ZodOptional<z.ZodObject<{
87
+ fingerprint: z.ZodString;
88
+ status: z.ZodEnum<["satisfied", "unsatisfied"]>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ status: "satisfied" | "unsatisfied";
91
+ fingerprint: string;
92
+ }, {
93
+ status: "satisfied" | "unsatisfied";
94
+ fingerprint: string;
95
+ }>>;
96
+ }, "status" | "id" | "name" | "reason" | "intent"> & {
97
+ expected: z.ZodOptional<z.ZodString>;
98
+ current: z.ZodOptional<z.ZodString>;
99
+ valueTruncated: z.ZodBoolean;
100
+ }, "strip", z.ZodTypeAny, {
101
+ status: "unknown" | "satisfied" | "unsatisfied";
102
+ id: string;
103
+ name: string;
104
+ reason: string;
105
+ intent: "set" | "preserve";
106
+ valueTruncated: boolean;
107
+ expected?: string | undefined;
108
+ current?: string | undefined;
109
+ }, {
110
+ status: "unknown" | "satisfied" | "unsatisfied";
111
+ id: string;
112
+ name: string;
113
+ reason: string;
114
+ intent: "set" | "preserve";
115
+ valueTruncated: boolean;
116
+ expected?: string | undefined;
117
+ current?: string | undefined;
118
+ }>, "many">;
119
+ next: z.ZodString;
120
+ }, "strip", z.ZodTypeAny, {
121
+ fields: {
122
+ status: "unknown" | "satisfied" | "unsatisfied";
123
+ id: string;
124
+ name: string;
125
+ reason: string;
126
+ intent: "set" | "preserve";
127
+ valueTruncated: boolean;
128
+ expected?: string | undefined;
129
+ current?: string | undefined;
130
+ }[];
131
+ observationFresh: boolean;
132
+ diagnosticsOmitted: true;
133
+ totalSteps: number;
134
+ omittedSteps: number;
135
+ next: string;
136
+ }, {
137
+ fields: {
138
+ status: "unknown" | "satisfied" | "unsatisfied";
139
+ id: string;
140
+ name: string;
141
+ reason: string;
142
+ intent: "set" | "preserve";
143
+ valueTruncated: boolean;
144
+ expected?: string | undefined;
145
+ current?: string | undefined;
146
+ }[];
147
+ observationFresh: boolean;
148
+ diagnosticsOmitted: true;
149
+ totalSteps: number;
150
+ omittedSteps: number;
151
+ next: string;
152
+ }>;
@@ -0,0 +1,9 @@
1
+ import type { GoalSnapshot } from "./observation.ts";
2
+ import type { BrowserOperateOutput } from "./contracts.ts";
3
+ import type { FormState } from "./form-context.ts";
4
+ export declare function createFormLoopProgress(): {
5
+ documentId: string;
6
+ visits: Map<string, number>;
7
+ };
8
+ /** Detect revisiting the same form/option state, not merely a long sequence of actions. */
9
+ export declare function observeFormLoopProgress(memory: ReturnType<typeof createFormLoopProgress>, snapshot: GoalSnapshot, form: FormState, previousAction?: Pick<BrowserOperateOutput["steps"][number], "operation" | "executed" | "error">): boolean;
@@ -0,0 +1,13 @@
1
+ import type { DecisionRequest } from "./decisions.ts";
2
+ import type { GoalSnapshot } from "./observation.ts";
3
+ import type { PickerState } from "./picker-state.ts";
4
+ import type { ExecutionContext } from "./execution-context.ts";
5
+ import type { FormControl } from "./form-context.ts";
6
+ export declare function formReady(context: ExecutionContext, snapshot: GoalSnapshot, pickers: PickerState): boolean;
7
+ export declare function formActionOwner(context: ExecutionContext, ref: string, controls: readonly FormControl[], pickers: PickerState): string | undefined;
8
+ export declare function withFormContext(request: DecisionRequest, context: ExecutionContext | undefined, snapshot: GoalSnapshot, controls: readonly FormControl[], pickers: PickerState, entryCandidates: readonly FormControl[]): DecisionRequest;
9
+ /** Commit only current-observation bindings/judgments; a change invalidates the old action branch. */
10
+ export declare function acceptFormDecisions(context: ExecutionContext, snapshot: GoalSnapshot, controls: readonly FormControl[], choices: Record<string, string>): {
11
+ changed: boolean;
12
+ error?: string;
13
+ };
@@ -0,0 +1,6 @@
1
+ import type { AgentContext } from "@roll-agent/sdk";
2
+ import type { NativeCdpFrameTree } from "@roll-agent/browser";
3
+ import type { BrowserOperateInput, BrowserOperateOutput } from "./contracts.ts";
4
+ export declare function permittedFrames(tree: NativeCdpFrameTree, origins: readonly string[]): Set<string>;
5
+ export declare function resolveOperateEngine(requested: BrowserOperateInput["engine"], env: NodeJS.ProcessEnv): NonNullable<BrowserOperateInput["engine"]>;
6
+ export declare function operateBrowser(rawInput: BrowserOperateInput, ctx: AgentContext): Promise<BrowserOperateOutput>;
@@ -0,0 +1,82 @@
1
+ import { z } from "zod";
2
+ import type { GoalSnapshot } from "./observation.ts";
3
+ import type { ExecutionContext } from "./execution-context.ts";
4
+ import type { DecisionRequest } from "./decisions.ts";
5
+ declare const AttemptSchema: z.ZodObject<{
6
+ identity: z.ZodString;
7
+ operation: z.ZodEnum<["CLICK", "TYPE_TEXT", "SELECT"]>;
8
+ target: z.ZodString;
9
+ epoch: z.ZodString;
10
+ attempts: z.ZodNumber;
11
+ feedback: z.ZodArray<z.ZodString, "many">;
12
+ judged: z.ZodBoolean;
13
+ prerequisite: z.ZodOptional<z.ZodObject<{
14
+ fieldId: z.ZodString;
15
+ signature: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ fieldId: string;
18
+ signature: string;
19
+ }, {
20
+ fieldId: string;
21
+ signature: string;
22
+ }>>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ target: string;
25
+ epoch: string;
26
+ attempts: number;
27
+ identity: string;
28
+ operation: "CLICK" | "TYPE_TEXT" | "SELECT";
29
+ feedback: string[];
30
+ judged: boolean;
31
+ prerequisite?: {
32
+ fieldId: string;
33
+ signature: string;
34
+ } | undefined;
35
+ }, {
36
+ target: string;
37
+ epoch: string;
38
+ attempts: number;
39
+ identity: string;
40
+ operation: "CLICK" | "TYPE_TEXT" | "SELECT";
41
+ feedback: string[];
42
+ judged: boolean;
43
+ prerequisite?: {
44
+ fieldId: string;
45
+ signature: string;
46
+ } | undefined;
47
+ }>;
48
+ type Attempt = z.infer<typeof AttemptSchema>;
49
+ export declare function createInteractionFeedback(): {
50
+ documentId: string;
51
+ attempts: Map<string, {
52
+ target: string;
53
+ epoch: string;
54
+ attempts: number;
55
+ identity: string;
56
+ operation: "CLICK" | "TYPE_TEXT" | "SELECT";
57
+ feedback: string[];
58
+ judged: boolean;
59
+ prerequisite?: {
60
+ fieldId: string;
61
+ signature: string;
62
+ } | undefined;
63
+ }>;
64
+ pending: {
65
+ attempt: Attempt;
66
+ beforeText: string[];
67
+ beforeEffect: string;
68
+ } | undefined;
69
+ questionKey: string | undefined;
70
+ };
71
+ export type InteractionFeedback = ReturnType<typeof createInteractionFeedback>;
72
+ export declare function observeInteractionFeedback(memory: InteractionFeedback, snapshot: GoalSnapshot, context: ExecutionContext): void;
73
+ export declare function recordInteractionAttempt(memory: InteractionFeedback, snapshot: GoalSnapshot, action: {
74
+ operation: string;
75
+ identity: string;
76
+ target: string;
77
+ executed: boolean;
78
+ error?: string;
79
+ }): void;
80
+ export declare function withInteractionFeedback(request: DecisionRequest, memory: InteractionFeedback, snapshot: GoalSnapshot, context: ExecutionContext): DecisionRequest;
81
+ export declare function acceptInteractionFeedback(memory: InteractionFeedback, context: ExecutionContext, choices: Record<string, string>): boolean;
82
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { BrowserElementRef } from "@roll-agent/browser";
2
+ import type { GoalSnapshot } from "./observation.ts";
3
+ import type { BrowserOperateInput, BrowserOperateOutput } from "./contracts.ts";
4
+ import type { DecisionProvider, DecisionRequest } from "./decisions.ts";
5
+ export type GoalDriver = {
6
+ observe: (dependencyIdentities?: readonly string[]) => Promise<GoalSnapshot>;
7
+ invoke: (method: string, params: unknown[]) => Promise<unknown>;
8
+ actionExecuted: () => boolean;
9
+ checkTarget?: (snapshot: GoalSnapshot, ref: BrowserElementRef) => Promise<boolean>;
10
+ };
11
+ export declare function buildDecisionRequest(input: BrowserOperateInput, snapshot: GoalSnapshot, history: BrowserOperateOutput["steps"], requirementIndex?: number, suppressedClicks?: ReadonlySet<string>, pendingDialogs?: readonly string[]): DecisionRequest;
12
+ export declare function runBrowserGoal(input: BrowserOperateInput, driver: GoalDriver, decide: DecisionProvider, signal: AbortSignal): Promise<BrowserOperateOutput>;
@@ -0,0 +1,3 @@
1
+ import type { GoalDriver } from "./loop.ts";
2
+ /** Retry only a complete readonly observation, never a browser action. */
3
+ export declare function createRetryingGoalObserver(read: GoalDriver["observe"], signal: AbortSignal, discardPartial?: () => void): GoalDriver["observe"];