@opengeni/codemode 3.0.1-canary.38874404583001 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +143 -36
- package/package.json +4 -4
- package/src/interaction.ts +79 -31
package/dist/interaction.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AttachedBrowserDevice, AuthRun, AuthRunListResponse, AuthRunMutationResponse, BrowserAction, BrowserActionReceipt, BrowserClipboard, BrowserDiagnosticBatch, BrowserDiagnosticKind, BrowserDownload, BrowserDownloadListResponse, BrowserDownloadSaveResponse, BrowserDomReadLocator, BrowserDomReadResponse, BrowserDomSafeAttribute, BrowserIdentity, BrowserIdentityListResponse, BrowserIdentityMutationResponse, BrowserLocator, BrowserObservation, BrowserPermission, BrowserPermissionSetting, BrowserRevisionListResponse, BrowserSession, BrowserSessionMutationResponse, BrowserTarget, ComputerAction, ComputerActionReceipt, ComputerClipboard, ComputerLocator, ComputerObservation, ComputerSession, ComputerSessionMutationResponse, ComputerTargetListResponse, ExternalAuthRunRequest, ExternalAuthRunResponse, InteractionPlacement, PublishBrowserRevisionResponse, ReportAuthRunRequest, RequestHumanInteractionToolInput, RequestHumanInteractionToolOutput, SiteAuthConnection, SiteAuthConnectionListResponse, StartAuthRunRequest, UpdateBrowserIdentityRequest, VerifyAuthRunRequest } from "@opengeni/contracts";
|
|
2
2
|
import type { CodemodeCallOptions, CodemodeClient } from "./index.js";
|
|
3
3
|
import { type CodemodeClientProvider } from "./environment.js";
|
|
4
4
|
import { CodemodeArtifactCollection } from "./artifacts.js";
|
|
@@ -12,8 +12,23 @@ export type InteractionDiscovery = {
|
|
|
12
12
|
browsers: BrowserSession[];
|
|
13
13
|
computers: ComputerSession[];
|
|
14
14
|
identities: BrowserIdentity[];
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/** Online machines ready for the extension; listed only when no attached
|
|
16
|
+
* profile is connected. */
|
|
17
|
+
attachedBrowserBridges: Array<{
|
|
18
|
+
enrollmentId: string;
|
|
19
|
+
connectedProfileCount: number;
|
|
20
|
+
}>;
|
|
21
|
+
attachedBrowsers: Array<{
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
profileLabel?: string;
|
|
25
|
+
browserName: string;
|
|
26
|
+
platform: AttachedBrowserDevice["platform"];
|
|
27
|
+
state: AttachedBrowserDevice["state"];
|
|
28
|
+
tabCount: number;
|
|
29
|
+
/** Capabilities this profile lacks; absent when it supports all of them. */
|
|
30
|
+
unsupported?: string[];
|
|
31
|
+
}>;
|
|
17
32
|
};
|
|
18
33
|
export type CodemodeBrowserOpenOptions = {
|
|
19
34
|
browserSessionId?: string | undefined;
|
|
@@ -21,7 +36,11 @@ export type CodemodeBrowserOpenOptions = {
|
|
|
21
36
|
name?: string | undefined;
|
|
22
37
|
initialUrl?: string | undefined;
|
|
23
38
|
headless?: boolean | undefined;
|
|
24
|
-
|
|
39
|
+
/** `{ kind: "attached_device" }` without a deviceId opens the person's own
|
|
40
|
+
* connected Chrome (the only, or most recently active, profile). */
|
|
41
|
+
placement?: InteractionPlacement | {
|
|
42
|
+
kind: "attached_device";
|
|
43
|
+
} | undefined;
|
|
25
44
|
identityId?: string | undefined;
|
|
26
45
|
baseRevisionId?: string | undefined;
|
|
27
46
|
linkedComputerSessionId?: string | undefined;
|
|
@@ -75,27 +94,61 @@ export type CodemodeBrowserAgentNode = Readonly<{
|
|
|
75
94
|
redacted: true;
|
|
76
95
|
reason: string;
|
|
77
96
|
};
|
|
78
|
-
|
|
79
|
-
|
|
97
|
+
/** Omitted when empty. */
|
|
98
|
+
states?: readonly string[];
|
|
99
|
+
/** Omitted when empty. */
|
|
100
|
+
actions?: readonly string[];
|
|
80
101
|
}>;
|
|
81
102
|
export type CodemodeBrowserAgentView = Readonly<{
|
|
82
|
-
kind: "compact";
|
|
83
103
|
sourceKind: "snapshot" | "diff" | "none";
|
|
84
104
|
nodes: readonly CodemodeBrowserAgentNode[];
|
|
85
|
-
|
|
86
|
-
omittedNodeCount
|
|
87
|
-
removedRefCount
|
|
88
|
-
clippedFieldCount
|
|
89
|
-
|
|
90
|
-
|
|
105
|
+
/** Nodes left out by the output budget; absent when nothing was left out. */
|
|
106
|
+
omittedNodeCount?: number;
|
|
107
|
+
removedRefCount?: number;
|
|
108
|
+
clippedFieldCount?: number;
|
|
109
|
+
}>;
|
|
110
|
+
/** A tab with the identity, page, selection and fences a next call needs. */
|
|
111
|
+
export type CodemodeBrowserTarget = Readonly<{
|
|
112
|
+
id: string;
|
|
113
|
+
kind: BrowserTarget["kind"];
|
|
114
|
+
title: string;
|
|
115
|
+
url: string;
|
|
116
|
+
selected: boolean;
|
|
117
|
+
controllerGeneration: string;
|
|
118
|
+
targetGeneration: string;
|
|
119
|
+
documentGeneration: string | null;
|
|
120
|
+
}>;
|
|
121
|
+
export type CodemodeBrowserTargetList = Readonly<{
|
|
122
|
+
browserSessionId: string;
|
|
123
|
+
targets: readonly CodemodeBrowserTarget[];
|
|
124
|
+
}>;
|
|
125
|
+
/** The compact default observation. Empty, zero and default fields are
|
|
126
|
+
* omitted; use observeFull() for the complete BrowserObservation. */
|
|
127
|
+
export type CodemodeBrowserAgentObservation = Readonly<{
|
|
128
|
+
target: CodemodeBrowserTarget;
|
|
129
|
+
frameId?: string;
|
|
130
|
+
viewport?: Readonly<{
|
|
131
|
+
width: number;
|
|
132
|
+
height: number;
|
|
133
|
+
deviceScaleFactor?: number;
|
|
134
|
+
maxTouchPoints?: number;
|
|
135
|
+
}>;
|
|
136
|
+
focusedRef?: string;
|
|
137
|
+
changedRegions?: BrowserObservation["changedRegions"];
|
|
138
|
+
diagnostics?: BrowserObservation["diagnostics"];
|
|
139
|
+
dialog?: NonNullable<BrowserObservation["dialog"]>;
|
|
140
|
+
screenshot?: NonNullable<BrowserObservation["screenshot"]>;
|
|
141
|
+
agentView: CodemodeBrowserAgentView;
|
|
142
|
+
}>;
|
|
143
|
+
/** The compact default receipt; pass view "full" for the complete
|
|
144
|
+
* BrowserActionReceipt with operation id and timestamps. */
|
|
145
|
+
export type CodemodeBrowserActionReceipt = Readonly<{
|
|
146
|
+
targetId: string;
|
|
147
|
+
state: BrowserActionReceipt["state"];
|
|
148
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
149
|
+
targets?: BrowserActionReceipt["targets"];
|
|
150
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
91
151
|
}>;
|
|
92
|
-
export type CodemodeBrowserAgentObservation = BrowserObservation & {
|
|
93
|
-
/** Present on the compact default; absent when the full tree was requested. */
|
|
94
|
-
agentView?: CodemodeBrowserAgentView;
|
|
95
|
-
};
|
|
96
|
-
export type CodemodeBrowserActionReceipt = Omit<BrowserActionReceipt, "observation"> & {
|
|
97
|
-
observation: CodemodeBrowserAgentObservation | null;
|
|
98
|
-
};
|
|
99
152
|
export type CodemodeBrowserActionOptions = BrowserActionFences & {
|
|
100
153
|
view?: "compact" | "full" | "none" | undefined;
|
|
101
154
|
};
|
|
@@ -243,32 +296,32 @@ export declare class CodemodeBrowserClipboard {
|
|
|
243
296
|
read(callOptions?: CodemodeCallOptions): Promise<BrowserClipboard>;
|
|
244
297
|
write(text: string, options?: BrowserActionFences & {
|
|
245
298
|
targetId?: string | undefined;
|
|
246
|
-
}, callOptions?: CodemodeCallOptions): Promise<
|
|
299
|
+
}, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserActionReceipt>;
|
|
247
300
|
clear(options?: BrowserActionFences & {
|
|
248
301
|
targetId?: string | undefined;
|
|
249
|
-
}, callOptions?: CodemodeCallOptions): Promise<
|
|
302
|
+
}, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserActionReceipt>;
|
|
250
303
|
copy(options?: BrowserActionFences & {
|
|
251
304
|
targetId?: string | undefined;
|
|
252
305
|
locator?: BrowserLocator | undefined;
|
|
253
306
|
content?: "selection" | "value" | "text" | undefined;
|
|
254
|
-
}, callOptions?: CodemodeCallOptions): Promise<
|
|
307
|
+
}, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserActionReceipt>;
|
|
255
308
|
paste(options?: BrowserActionFences & {
|
|
256
309
|
targetId?: string | undefined;
|
|
257
310
|
locator?: BrowserLocator | undefined;
|
|
258
311
|
text?: string | undefined;
|
|
259
|
-
}, callOptions?: CodemodeCallOptions): Promise<
|
|
312
|
+
}, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserActionReceipt>;
|
|
260
313
|
private act;
|
|
261
314
|
}
|
|
262
315
|
export declare class CodemodeBrowserTabCollection {
|
|
263
316
|
private readonly client;
|
|
264
317
|
private readonly browserSessionId;
|
|
265
318
|
constructor(client: CodemodeClientProvider, browserSessionId: string);
|
|
266
|
-
list(callOptions?: CodemodeCallOptions): Promise<
|
|
319
|
+
list(callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserTargetList>;
|
|
267
320
|
selected(callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserTab>;
|
|
268
321
|
use(targetId: string): CodemodeBrowserTab;
|
|
269
322
|
open(url?: string, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserTab>;
|
|
270
323
|
select(targetId: string, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserTab>;
|
|
271
|
-
close(targetId: string, callOptions?: CodemodeCallOptions): Promise<
|
|
324
|
+
close(targetId: string, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserTargetList>;
|
|
272
325
|
resolveId(targetId: string | undefined, callOptions: CodemodeCallOptions): Promise<string>;
|
|
273
326
|
}
|
|
274
327
|
export declare class CodemodeBrowserTab {
|
|
@@ -281,8 +334,14 @@ export declare class CodemodeBrowserTab {
|
|
|
281
334
|
read(options?: CodemodeBrowserReadOptions, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserReadResult>;
|
|
282
335
|
screenshot(options?: CodemodeBrowserScreenshotOptions, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserScreenshot>;
|
|
283
336
|
act(action: BrowserAction, fences?: CodemodeBrowserActionOptions, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserActionReceipt>;
|
|
284
|
-
navigate(url: string, callOptions?: CodemodeCallOptions): Promise<
|
|
285
|
-
|
|
337
|
+
navigate(url: string, callOptions?: CodemodeCallOptions): Promise<Readonly<{
|
|
338
|
+
targetId: string;
|
|
339
|
+
state: BrowserActionReceipt["state"];
|
|
340
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
341
|
+
targets?: BrowserActionReceipt["targets"];
|
|
342
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
343
|
+
}>>;
|
|
344
|
+
setPermission(permission: BrowserPermission, setting: BrowserPermissionSetting, fences?: BrowserActionFences, callOptions?: CodemodeCallOptions): Promise<CodemodeBrowserActionReceipt>;
|
|
286
345
|
requestHuman(reason: string, options?: {
|
|
287
346
|
kind?: "manual_login" | "mfa" | "external_action" | "confirmation" | "other";
|
|
288
347
|
authRunId?: string | undefined;
|
|
@@ -305,14 +364,62 @@ export declare class CodemodeBrowserLocator {
|
|
|
305
364
|
constructor(tab: CodemodeBrowserTab, locator: BrowserLocator);
|
|
306
365
|
click(options?: {
|
|
307
366
|
button?: "left" | "right" | "middle";
|
|
308
|
-
}, callOptions?: CodemodeCallOptions): Promise<
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
367
|
+
}, callOptions?: CodemodeCallOptions): Promise<Readonly<{
|
|
368
|
+
targetId: string;
|
|
369
|
+
state: BrowserActionReceipt["state"];
|
|
370
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
371
|
+
targets?: BrowserActionReceipt["targets"];
|
|
372
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
373
|
+
}>>;
|
|
374
|
+
doubleClick(callOptions?: CodemodeCallOptions): Promise<Readonly<{
|
|
375
|
+
targetId: string;
|
|
376
|
+
state: BrowserActionReceipt["state"];
|
|
377
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
378
|
+
targets?: BrowserActionReceipt["targets"];
|
|
379
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
380
|
+
}>>;
|
|
381
|
+
hover(callOptions?: CodemodeCallOptions): Promise<Readonly<{
|
|
382
|
+
targetId: string;
|
|
383
|
+
state: BrowserActionReceipt["state"];
|
|
384
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
385
|
+
targets?: BrowserActionReceipt["targets"];
|
|
386
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
387
|
+
}>>;
|
|
388
|
+
fill(value: string, callOptions?: CodemodeCallOptions): Promise<Readonly<{
|
|
389
|
+
targetId: string;
|
|
390
|
+
state: BrowserActionReceipt["state"];
|
|
391
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
392
|
+
targets?: BrowserActionReceipt["targets"];
|
|
393
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
394
|
+
}>>;
|
|
395
|
+
type(text: string, callOptions?: CodemodeCallOptions): Promise<Readonly<{
|
|
396
|
+
targetId: string;
|
|
397
|
+
state: BrowserActionReceipt["state"];
|
|
398
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
399
|
+
targets?: BrowserActionReceipt["targets"];
|
|
400
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
401
|
+
}>>;
|
|
402
|
+
press(key: string, callOptions?: CodemodeCallOptions): Promise<Readonly<{
|
|
403
|
+
targetId: string;
|
|
404
|
+
state: BrowserActionReceipt["state"];
|
|
405
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
406
|
+
targets?: BrowserActionReceipt["targets"];
|
|
407
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
408
|
+
}>>;
|
|
409
|
+
select(values: string[], callOptions?: CodemodeCallOptions): Promise<Readonly<{
|
|
410
|
+
targetId: string;
|
|
411
|
+
state: BrowserActionReceipt["state"];
|
|
412
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
413
|
+
targets?: BrowserActionReceipt["targets"];
|
|
414
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
415
|
+
}>>;
|
|
416
|
+
check(checked?: boolean, callOptions?: CodemodeCallOptions): Promise<Readonly<{
|
|
417
|
+
targetId: string;
|
|
418
|
+
state: BrowserActionReceipt["state"];
|
|
419
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
420
|
+
targets?: BrowserActionReceipt["targets"];
|
|
421
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
422
|
+
}>>;
|
|
316
423
|
}
|
|
317
424
|
export declare class CodemodeAuth {
|
|
318
425
|
private readonly client;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/codemode",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Attempt-frozen programmatic tool catalog and execution authority for Opengeni.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@opengeni/contracts": "3.
|
|
38
|
-
"@opengeni/sdk": "3.
|
|
39
|
-
"@opengeni/tool-gateway": "3.
|
|
37
|
+
"@opengeni/contracts": "3.1.2",
|
|
38
|
+
"@opengeni/sdk": "3.1.2",
|
|
39
|
+
"@opengeni/tool-gateway": "3.1.2"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=18"
|
package/src/interaction.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
AttemptToolResult,
|
|
3
|
-
AttachedBrowserBridge,
|
|
4
3
|
AttachedBrowserDevice,
|
|
5
4
|
AuthRun,
|
|
6
5
|
AuthRunListResponse,
|
|
@@ -27,7 +26,6 @@ import type {
|
|
|
27
26
|
BrowserSession,
|
|
28
27
|
BrowserSessionMutationResponse,
|
|
29
28
|
BrowserTarget,
|
|
30
|
-
BrowserTargetListResponse,
|
|
31
29
|
ComputerAction,
|
|
32
30
|
ComputerActionReceipt,
|
|
33
31
|
ComputerClipboard,
|
|
@@ -91,8 +89,20 @@ export type InteractionDiscovery = {
|
|
|
91
89
|
browsers: BrowserSession[];
|
|
92
90
|
computers: ComputerSession[];
|
|
93
91
|
identities: BrowserIdentity[];
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
/** Online machines ready for the extension; listed only when no attached
|
|
93
|
+
* profile is connected. */
|
|
94
|
+
attachedBrowserBridges: Array<{ enrollmentId: string; connectedProfileCount: number }>;
|
|
95
|
+
attachedBrowsers: Array<{
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
profileLabel?: string;
|
|
99
|
+
browserName: string;
|
|
100
|
+
platform: AttachedBrowserDevice["platform"];
|
|
101
|
+
state: AttachedBrowserDevice["state"];
|
|
102
|
+
tabCount: number;
|
|
103
|
+
/** Capabilities this profile lacks; absent when it supports all of them. */
|
|
104
|
+
unsupported?: string[];
|
|
105
|
+
}>;
|
|
96
106
|
};
|
|
97
107
|
|
|
98
108
|
export type CodemodeBrowserOpenOptions = {
|
|
@@ -101,7 +111,9 @@ export type CodemodeBrowserOpenOptions = {
|
|
|
101
111
|
name?: string | undefined;
|
|
102
112
|
initialUrl?: string | undefined;
|
|
103
113
|
headless?: boolean | undefined;
|
|
104
|
-
|
|
114
|
+
/** `{ kind: "attached_device" }` without a deviceId opens the person's own
|
|
115
|
+
* connected Chrome (the only, or most recently active, profile). */
|
|
116
|
+
placement?: InteractionPlacement | { kind: "attached_device" } | undefined;
|
|
105
117
|
identityId?: string | undefined;
|
|
106
118
|
baseRevisionId?: string | undefined;
|
|
107
119
|
linkedComputerSessionId?: string | undefined;
|
|
@@ -159,30 +171,66 @@ export type CodemodeBrowserAgentNode = Readonly<{
|
|
|
159
171
|
name?: string;
|
|
160
172
|
description?: string;
|
|
161
173
|
value?: string | { redacted: true; reason: string };
|
|
162
|
-
|
|
163
|
-
|
|
174
|
+
/** Omitted when empty. */
|
|
175
|
+
states?: readonly string[];
|
|
176
|
+
/** Omitted when empty. */
|
|
177
|
+
actions?: readonly string[];
|
|
164
178
|
}>;
|
|
165
179
|
|
|
166
180
|
export type CodemodeBrowserAgentView = Readonly<{
|
|
167
|
-
kind: "compact";
|
|
168
181
|
sourceKind: "snapshot" | "diff" | "none";
|
|
169
182
|
nodes: readonly CodemodeBrowserAgentNode[];
|
|
170
|
-
|
|
171
|
-
omittedNodeCount
|
|
172
|
-
removedRefCount
|
|
173
|
-
clippedFieldCount
|
|
174
|
-
maxNodes: number;
|
|
175
|
-
maxNodeBytes: number;
|
|
183
|
+
/** Nodes left out by the output budget; absent when nothing was left out. */
|
|
184
|
+
omittedNodeCount?: number;
|
|
185
|
+
removedRefCount?: number;
|
|
186
|
+
clippedFieldCount?: number;
|
|
176
187
|
}>;
|
|
177
188
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
189
|
+
/** A tab with the identity, page, selection and fences a next call needs. */
|
|
190
|
+
export type CodemodeBrowserTarget = Readonly<{
|
|
191
|
+
id: string;
|
|
192
|
+
kind: BrowserTarget["kind"];
|
|
193
|
+
title: string;
|
|
194
|
+
url: string;
|
|
195
|
+
selected: boolean;
|
|
196
|
+
controllerGeneration: string;
|
|
197
|
+
targetGeneration: string;
|
|
198
|
+
documentGeneration: string | null;
|
|
199
|
+
}>;
|
|
182
200
|
|
|
183
|
-
export type
|
|
184
|
-
|
|
185
|
-
|
|
201
|
+
export type CodemodeBrowserTargetList = Readonly<{
|
|
202
|
+
browserSessionId: string;
|
|
203
|
+
targets: readonly CodemodeBrowserTarget[];
|
|
204
|
+
}>;
|
|
205
|
+
|
|
206
|
+
/** The compact default observation. Empty, zero and default fields are
|
|
207
|
+
* omitted; use observeFull() for the complete BrowserObservation. */
|
|
208
|
+
export type CodemodeBrowserAgentObservation = Readonly<{
|
|
209
|
+
target: CodemodeBrowserTarget;
|
|
210
|
+
frameId?: string;
|
|
211
|
+
viewport?: Readonly<{
|
|
212
|
+
width: number;
|
|
213
|
+
height: number;
|
|
214
|
+
deviceScaleFactor?: number;
|
|
215
|
+
maxTouchPoints?: number;
|
|
216
|
+
}>;
|
|
217
|
+
focusedRef?: string;
|
|
218
|
+
changedRegions?: BrowserObservation["changedRegions"];
|
|
219
|
+
diagnostics?: BrowserObservation["diagnostics"];
|
|
220
|
+
dialog?: NonNullable<BrowserObservation["dialog"]>;
|
|
221
|
+
screenshot?: NonNullable<BrowserObservation["screenshot"]>;
|
|
222
|
+
agentView: CodemodeBrowserAgentView;
|
|
223
|
+
}>;
|
|
224
|
+
|
|
225
|
+
/** The compact default receipt; pass view "full" for the complete
|
|
226
|
+
* BrowserActionReceipt with operation id and timestamps. */
|
|
227
|
+
export type CodemodeBrowserActionReceipt = Readonly<{
|
|
228
|
+
targetId: string;
|
|
229
|
+
state: BrowserActionReceipt["state"];
|
|
230
|
+
error?: NonNullable<BrowserActionReceipt["error"]>;
|
|
231
|
+
targets?: BrowserActionReceipt["targets"];
|
|
232
|
+
observation?: CodemodeBrowserAgentObservation;
|
|
233
|
+
}>;
|
|
186
234
|
|
|
187
235
|
export type CodemodeBrowserActionOptions = BrowserActionFences & {
|
|
188
236
|
view?: "compact" | "full" | "none" | undefined;
|
|
@@ -586,14 +634,14 @@ export class CodemodeBrowserClipboard {
|
|
|
586
634
|
text: string,
|
|
587
635
|
options: BrowserActionFences & { targetId?: string | undefined } = {},
|
|
588
636
|
callOptions: CodemodeCallOptions = {},
|
|
589
|
-
): Promise<
|
|
637
|
+
): Promise<CodemodeBrowserActionReceipt> {
|
|
590
638
|
return await this.act({ type: "clipboard", operation: "write", text }, options, callOptions);
|
|
591
639
|
}
|
|
592
640
|
|
|
593
641
|
async clear(
|
|
594
642
|
options: BrowserActionFences & { targetId?: string | undefined } = {},
|
|
595
643
|
callOptions: CodemodeCallOptions = {},
|
|
596
|
-
): Promise<
|
|
644
|
+
): Promise<CodemodeBrowserActionReceipt> {
|
|
597
645
|
return await this.act({ type: "clipboard", operation: "clear" }, options, callOptions);
|
|
598
646
|
}
|
|
599
647
|
|
|
@@ -604,7 +652,7 @@ export class CodemodeBrowserClipboard {
|
|
|
604
652
|
content?: "selection" | "value" | "text" | undefined;
|
|
605
653
|
} = {},
|
|
606
654
|
callOptions: CodemodeCallOptions = {},
|
|
607
|
-
): Promise<
|
|
655
|
+
): Promise<CodemodeBrowserActionReceipt> {
|
|
608
656
|
const {
|
|
609
657
|
targetId,
|
|
610
658
|
expectedTargetGeneration,
|
|
@@ -631,7 +679,7 @@ export class CodemodeBrowserClipboard {
|
|
|
631
679
|
text?: string | undefined;
|
|
632
680
|
} = {},
|
|
633
681
|
callOptions: CodemodeCallOptions = {},
|
|
634
|
-
): Promise<
|
|
682
|
+
): Promise<CodemodeBrowserActionReceipt> {
|
|
635
683
|
const {
|
|
636
684
|
targetId,
|
|
637
685
|
expectedTargetGeneration,
|
|
@@ -655,7 +703,7 @@ export class CodemodeBrowserClipboard {
|
|
|
655
703
|
action: BrowserAction,
|
|
656
704
|
options: BrowserActionFences & { targetId?: string | undefined },
|
|
657
705
|
callOptions: CodemodeCallOptions,
|
|
658
|
-
): Promise<
|
|
706
|
+
): Promise<CodemodeBrowserActionReceipt> {
|
|
659
707
|
const { targetId, ...fences } = options;
|
|
660
708
|
return await this.tabs
|
|
661
709
|
.use(await this.tabs.resolveId(targetId, callOptions))
|
|
@@ -669,7 +717,7 @@ export class CodemodeBrowserTabCollection {
|
|
|
669
717
|
private readonly browserSessionId: string,
|
|
670
718
|
) {}
|
|
671
719
|
|
|
672
|
-
async list(callOptions: CodemodeCallOptions = {}): Promise<
|
|
720
|
+
async list(callOptions: CodemodeCallOptions = {}): Promise<CodemodeBrowserTargetList> {
|
|
673
721
|
return await callStructured(
|
|
674
722
|
this.client,
|
|
675
723
|
PATH.browserTabs,
|
|
@@ -688,7 +736,7 @@ export class CodemodeBrowserTabCollection {
|
|
|
688
736
|
|
|
689
737
|
async open(url?: string, callOptions: CodemodeCallOptions = {}): Promise<CodemodeBrowserTab> {
|
|
690
738
|
const before = await this.list(callOptions);
|
|
691
|
-
const after = await callStructured<
|
|
739
|
+
const after = await callStructured<CodemodeBrowserTargetList>(
|
|
692
740
|
this.client,
|
|
693
741
|
PATH.browserTabs,
|
|
694
742
|
{
|
|
@@ -710,7 +758,7 @@ export class CodemodeBrowserTabCollection {
|
|
|
710
758
|
targetId: string,
|
|
711
759
|
callOptions: CodemodeCallOptions = {},
|
|
712
760
|
): Promise<CodemodeBrowserTab> {
|
|
713
|
-
const after = await callStructured<
|
|
761
|
+
const after = await callStructured<CodemodeBrowserTargetList>(
|
|
714
762
|
this.client,
|
|
715
763
|
PATH.browserTabs,
|
|
716
764
|
{ operation: "select", browserSessionId: this.browserSessionId, targetId },
|
|
@@ -725,7 +773,7 @@ export class CodemodeBrowserTabCollection {
|
|
|
725
773
|
async close(
|
|
726
774
|
targetId: string,
|
|
727
775
|
callOptions: CodemodeCallOptions = {},
|
|
728
|
-
): Promise<
|
|
776
|
+
): Promise<CodemodeBrowserTargetList> {
|
|
729
777
|
return await callStructured(
|
|
730
778
|
this.client,
|
|
731
779
|
PATH.browserTabs,
|
|
@@ -828,7 +876,7 @@ export class CodemodeBrowserTab {
|
|
|
828
876
|
setting: BrowserPermissionSetting,
|
|
829
877
|
fences: BrowserActionFences = {},
|
|
830
878
|
callOptions: CodemodeCallOptions = {},
|
|
831
|
-
): Promise<
|
|
879
|
+
): Promise<CodemodeBrowserActionReceipt> {
|
|
832
880
|
return await this.act({ type: "permission", permission, setting }, fences, callOptions);
|
|
833
881
|
}
|
|
834
882
|
|