@otto-code/protocol 0.6.2 → 0.6.4
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/agent-types.d.ts +37 -0
- package/dist/browser-automation/capabilities.d.ts +1 -1
- package/dist/browser-automation/rpc-schemas.d.ts +199 -1
- package/dist/browser-automation/rpc-schemas.js +71 -0
- package/dist/generated/validation/ws-outbound.aot.js +31906 -28601
- package/dist/messages.d.ts +2690 -15
- package/dist/messages.js +500 -6
- package/dist/observed-subagent-title.d.ts +26 -0
- package/dist/observed-subagent-title.js +63 -0
- package/dist/provider-config.d.ts +12 -0
- package/dist/provider-config.js +15 -0
- package/dist/provider-manifest.js +13 -0
- package/dist/tool-call-display.d.ts +9 -0
- package/dist/tool-call-display.js +60 -15
- package/dist/tool-name-normalization.d.ts +16 -0
- package/dist/tool-name-normalization.js +26 -0
- package/dist/validation/ws-outbound-schema-metadata.d.ts +464 -1
- package/package.json +2 -1
package/dist/agent-types.d.ts
CHANGED
|
@@ -172,13 +172,50 @@ export interface AgentRunOptions {
|
|
|
172
172
|
resumeFrom?: AgentPersistenceHandle;
|
|
173
173
|
maxThinkingTokens?: number;
|
|
174
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* How the tokens currently occupying an agent's context window break down by
|
|
177
|
+
* origin. Powers the visualizer's context ring/bar colored segments (the same
|
|
178
|
+
* five categories the vendored render layer draws). Every field is optional and
|
|
179
|
+
* a token count: a provider fills as many categories as it can attribute and
|
|
180
|
+
* omits the rest, so richness degrades gracefully per provider — Claude
|
|
181
|
+
* attributes the most; a provider that can attribute nothing omits the whole
|
|
182
|
+
* object and consumers fall back to occupancy-only (no colored segments, the
|
|
183
|
+
* pre-composition behavior). Counts are best-effort estimates, not billed usage;
|
|
184
|
+
* they need not sum exactly to `contextWindowUsedTokens` (the consumer scales).
|
|
185
|
+
*/
|
|
186
|
+
export interface ContextComposition {
|
|
187
|
+
/** System prompt + tool/function definitions — the fixed base cost. */
|
|
188
|
+
systemPrompt?: number;
|
|
189
|
+
/** User-authored input messages. */
|
|
190
|
+
userMessages?: number;
|
|
191
|
+
/** Tool results — file contents, search output, command output (usually the
|
|
192
|
+
* largest and most volatile category). */
|
|
193
|
+
toolResults?: number;
|
|
194
|
+
/** The agent's own reasoning / thinking blocks. */
|
|
195
|
+
reasoning?: number;
|
|
196
|
+
/** Content returned by child / observed sub-agents. */
|
|
197
|
+
subagentResults?: number;
|
|
198
|
+
}
|
|
175
199
|
export interface AgentUsage {
|
|
176
200
|
inputTokens?: number;
|
|
177
201
|
cachedInputTokens?: number;
|
|
202
|
+
/**
|
|
203
|
+
* Prompt tokens spent writing (not reading) the prompt cache this turn —
|
|
204
|
+
* Anthropic's `cache_creation_input_tokens`, billed above normal input.
|
|
205
|
+
* Disjoint from `inputTokens`/`cachedInputTokens`. Claude-specific today;
|
|
206
|
+
* other providers omit it. Optional/additive.
|
|
207
|
+
*/
|
|
208
|
+
cacheCreationInputTokens?: number;
|
|
178
209
|
outputTokens?: number;
|
|
179
210
|
totalCostUsd?: number;
|
|
180
211
|
contextWindowMaxTokens?: number;
|
|
181
212
|
contextWindowUsedTokens?: number;
|
|
213
|
+
/**
|
|
214
|
+
* Best-effort breakdown of what fills the context window, by origin. Optional
|
|
215
|
+
* and provider-graded (see {@link ContextComposition}); absent ⇒ the consumer
|
|
216
|
+
* shows occupancy only. Added for the visualizer context ring/bar.
|
|
217
|
+
*/
|
|
218
|
+
contextComposition?: ContextComposition;
|
|
182
219
|
}
|
|
183
220
|
export declare const TOOL_CALL_ICON_NAMES: readonly ["wrench", "square_terminal", "eye", "pencil", "search", "bot", "sparkles", "brain", "mic_vocal"];
|
|
184
221
|
export type ToolCallIconName = (typeof TOOL_CALL_ICON_NAMES)[number];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const BrowserAutomationHostCapabilitySchema: z.ZodObject<{
|
|
3
|
-
supportedCommands: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<("type" | "select" | "fill" | "logs" | "list_tabs" | "new_tab" | "snapshot" | "click" | "wait" | "keypress" | "navigate" | "back" | "forward" | "reload" | "screenshot" | "upload" | "hover" | "drag" | "evaluate" | "inspect" | "network" | "scroll" | "resize" | "close_tab")[], string[]>>;
|
|
3
|
+
supportedCommands: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<("type" | "select" | "fill" | "logs" | "list_tabs" | "new_tab" | "snapshot" | "click" | "wait" | "keypress" | "navigate" | "back" | "forward" | "reload" | "screenshot" | "upload" | "hover" | "drag" | "evaluate" | "inspect" | "network" | "scroll" | "resize" | "close_tab" | "focus_tab" | "page_text" | "set_color_scheme" | "screenshot_element")[], string[]>>;
|
|
4
4
|
hostKind: z.ZodDefault<z.ZodString>;
|
|
5
5
|
}, z.core.$loose>;
|
|
6
6
|
export type BrowserAutomationHostCapability = z.infer<typeof BrowserAutomationHostCapabilitySchema>;
|
|
@@ -12,7 +12,7 @@ export declare const BrowserAutomationErrorCodeSchema: z.ZodEnum<{
|
|
|
12
12
|
browser_element_not_found: "browser_element_not_found";
|
|
13
13
|
browser_unknown_error: "browser_unknown_error";
|
|
14
14
|
}>;
|
|
15
|
-
export declare const BROWSER_AUTOMATION_COMMAND_NAMES: readonly ["list_tabs", "new_tab", "snapshot", "click", "fill", "wait", "type", "keypress", "navigate", "back", "forward", "reload", "screenshot", "upload", "select", "hover", "drag", "logs", "evaluate", "inspect", "network", "scroll", "resize", "close_tab"];
|
|
15
|
+
export declare const BROWSER_AUTOMATION_COMMAND_NAMES: readonly ["list_tabs", "new_tab", "snapshot", "click", "fill", "wait", "type", "keypress", "navigate", "back", "forward", "reload", "screenshot", "upload", "select", "hover", "drag", "logs", "evaluate", "inspect", "network", "scroll", "resize", "close_tab", "focus_tab", "page_text", "set_color_scheme", "screenshot_element"];
|
|
16
16
|
export declare const BrowserAutomationCommandNameSchema: z.ZodEnum<{
|
|
17
17
|
type: "type";
|
|
18
18
|
select: "select";
|
|
@@ -38,6 +38,10 @@ export declare const BrowserAutomationCommandNameSchema: z.ZodEnum<{
|
|
|
38
38
|
scroll: "scroll";
|
|
39
39
|
resize: "resize";
|
|
40
40
|
close_tab: "close_tab";
|
|
41
|
+
focus_tab: "focus_tab";
|
|
42
|
+
page_text: "page_text";
|
|
43
|
+
set_color_scheme: "set_color_scheme";
|
|
44
|
+
screenshot_element: "screenshot_element";
|
|
41
45
|
}>;
|
|
42
46
|
export declare const BrowserAutomationBrowserIdSchema: z.ZodString;
|
|
43
47
|
export declare const BrowserAutomationListTabsCommandSchema: z.ZodObject<{
|
|
@@ -238,6 +242,42 @@ export declare const BrowserAutomationCloseTabCommandSchema: z.ZodObject<{
|
|
|
238
242
|
browserId: z.ZodString;
|
|
239
243
|
}, z.core.$strict>;
|
|
240
244
|
}, z.core.$strip>;
|
|
245
|
+
export declare const BrowserAutomationFocusTabCommandSchema: z.ZodObject<{
|
|
246
|
+
command: z.ZodLiteral<"focus_tab">;
|
|
247
|
+
args: z.ZodObject<{
|
|
248
|
+
browserId: z.ZodString;
|
|
249
|
+
}, z.core.$strict>;
|
|
250
|
+
}, z.core.$strip>;
|
|
251
|
+
export declare const BrowserAutomationPageTextCommandSchema: z.ZodObject<{
|
|
252
|
+
command: z.ZodLiteral<"page_text">;
|
|
253
|
+
args: z.ZodObject<{
|
|
254
|
+
browserId: z.ZodString;
|
|
255
|
+
maxChars: z.ZodDefault<z.ZodNumber>;
|
|
256
|
+
}, z.core.$strict>;
|
|
257
|
+
}, z.core.$strip>;
|
|
258
|
+
export declare const BrowserAutomationColorSchemeSchema: z.ZodEnum<{
|
|
259
|
+
auto: "auto";
|
|
260
|
+
light: "light";
|
|
261
|
+
dark: "dark";
|
|
262
|
+
}>;
|
|
263
|
+
export declare const BrowserAutomationSetColorSchemeCommandSchema: z.ZodObject<{
|
|
264
|
+
command: z.ZodLiteral<"set_color_scheme">;
|
|
265
|
+
args: z.ZodObject<{
|
|
266
|
+
browserId: z.ZodString;
|
|
267
|
+
colorScheme: z.ZodEnum<{
|
|
268
|
+
auto: "auto";
|
|
269
|
+
light: "light";
|
|
270
|
+
dark: "dark";
|
|
271
|
+
}>;
|
|
272
|
+
}, z.core.$strict>;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
export declare const BrowserAutomationScreenshotElementCommandSchema: z.ZodObject<{
|
|
275
|
+
command: z.ZodLiteral<"screenshot_element">;
|
|
276
|
+
args: z.ZodObject<{
|
|
277
|
+
browserId: z.ZodString;
|
|
278
|
+
ref: z.ZodString;
|
|
279
|
+
}, z.core.$strict>;
|
|
280
|
+
}, z.core.$strip>;
|
|
241
281
|
export declare const BrowserAutomationCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
242
282
|
command: z.ZodLiteral<"list_tabs">;
|
|
243
283
|
args: z.ZodDefault<z.ZodObject<{}, z.core.$strict>>;
|
|
@@ -412,6 +452,33 @@ export declare const BrowserAutomationCommandSchema: z.ZodDiscriminatedUnion<[z.
|
|
|
412
452
|
args: z.ZodObject<{
|
|
413
453
|
browserId: z.ZodString;
|
|
414
454
|
}, z.core.$strict>;
|
|
455
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
456
|
+
command: z.ZodLiteral<"focus_tab">;
|
|
457
|
+
args: z.ZodObject<{
|
|
458
|
+
browserId: z.ZodString;
|
|
459
|
+
}, z.core.$strict>;
|
|
460
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
461
|
+
command: z.ZodLiteral<"page_text">;
|
|
462
|
+
args: z.ZodObject<{
|
|
463
|
+
browserId: z.ZodString;
|
|
464
|
+
maxChars: z.ZodDefault<z.ZodNumber>;
|
|
465
|
+
}, z.core.$strict>;
|
|
466
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
467
|
+
command: z.ZodLiteral<"set_color_scheme">;
|
|
468
|
+
args: z.ZodObject<{
|
|
469
|
+
browserId: z.ZodString;
|
|
470
|
+
colorScheme: z.ZodEnum<{
|
|
471
|
+
auto: "auto";
|
|
472
|
+
light: "light";
|
|
473
|
+
dark: "dark";
|
|
474
|
+
}>;
|
|
475
|
+
}, z.core.$strict>;
|
|
476
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
477
|
+
command: z.ZodLiteral<"screenshot_element">;
|
|
478
|
+
args: z.ZodObject<{
|
|
479
|
+
browserId: z.ZodString;
|
|
480
|
+
ref: z.ZodString;
|
|
481
|
+
}, z.core.$strict>;
|
|
415
482
|
}, z.core.$strip>], "command">;
|
|
416
483
|
export declare const BrowserAutomationTabInfoSchema: z.ZodObject<{
|
|
417
484
|
browserId: z.ZodString;
|
|
@@ -525,6 +592,17 @@ export declare const BrowserAutomationScreenshotResultSchema: z.ZodObject<{
|
|
|
525
592
|
dataBase64: z.ZodString;
|
|
526
593
|
width: z.ZodNumber;
|
|
527
594
|
height: z.ZodNumber;
|
|
595
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
596
|
+
}, z.core.$strip>;
|
|
597
|
+
export declare const BrowserAutomationScreenshotElementResultSchema: z.ZodObject<{
|
|
598
|
+
command: z.ZodLiteral<"screenshot_element">;
|
|
599
|
+
browserId: z.ZodString;
|
|
600
|
+
ref: z.ZodString;
|
|
601
|
+
mimeType: z.ZodLiteral<"image/png">;
|
|
602
|
+
dataBase64: z.ZodString;
|
|
603
|
+
width: z.ZodNumber;
|
|
604
|
+
height: z.ZodNumber;
|
|
605
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
528
606
|
}, z.core.$strip>;
|
|
529
607
|
export declare const BrowserAutomationUploadResultSchema: z.ZodObject<{
|
|
530
608
|
command: z.ZodLiteral<"upload">;
|
|
@@ -668,6 +746,32 @@ export declare const BrowserAutomationCloseTabResultSchema: z.ZodObject<{
|
|
|
668
746
|
command: z.ZodLiteral<"close_tab">;
|
|
669
747
|
browserId: z.ZodString;
|
|
670
748
|
}, z.core.$strip>;
|
|
749
|
+
export declare const BrowserAutomationFocusTabResultSchema: z.ZodObject<{
|
|
750
|
+
command: z.ZodLiteral<"focus_tab">;
|
|
751
|
+
browserId: z.ZodString;
|
|
752
|
+
}, z.core.$strip>;
|
|
753
|
+
export declare const BrowserAutomationPageTextResultSchema: z.ZodObject<{
|
|
754
|
+
command: z.ZodLiteral<"page_text">;
|
|
755
|
+
browserId: z.ZodString;
|
|
756
|
+
url: z.ZodString;
|
|
757
|
+
title: z.ZodString;
|
|
758
|
+
source: z.ZodEnum<{
|
|
759
|
+
body: "body";
|
|
760
|
+
article: "article";
|
|
761
|
+
main: "main";
|
|
762
|
+
}>;
|
|
763
|
+
text: z.ZodString;
|
|
764
|
+
truncated: z.ZodBoolean;
|
|
765
|
+
}, z.core.$strip>;
|
|
766
|
+
export declare const BrowserAutomationSetColorSchemeResultSchema: z.ZodObject<{
|
|
767
|
+
command: z.ZodLiteral<"set_color_scheme">;
|
|
768
|
+
browserId: z.ZodString;
|
|
769
|
+
colorScheme: z.ZodEnum<{
|
|
770
|
+
auto: "auto";
|
|
771
|
+
light: "light";
|
|
772
|
+
dark: "dark";
|
|
773
|
+
}>;
|
|
774
|
+
}, z.core.$strip>;
|
|
671
775
|
export declare const BrowserAutomationResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
672
776
|
command: z.ZodLiteral<"list_tabs">;
|
|
673
777
|
tabs: z.ZodArray<z.ZodObject<{
|
|
@@ -751,6 +855,7 @@ export declare const BrowserAutomationResultSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
751
855
|
dataBase64: z.ZodString;
|
|
752
856
|
width: z.ZodNumber;
|
|
753
857
|
height: z.ZodNumber;
|
|
858
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
754
859
|
}, z.core.$strip>, z.ZodObject<{
|
|
755
860
|
command: z.ZodLiteral<"upload">;
|
|
756
861
|
browserId: z.ZodString;
|
|
@@ -854,6 +959,38 @@ export declare const BrowserAutomationResultSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
854
959
|
}, z.core.$strip>, z.ZodObject<{
|
|
855
960
|
command: z.ZodLiteral<"close_tab">;
|
|
856
961
|
browserId: z.ZodString;
|
|
962
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
963
|
+
command: z.ZodLiteral<"focus_tab">;
|
|
964
|
+
browserId: z.ZodString;
|
|
965
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
966
|
+
command: z.ZodLiteral<"page_text">;
|
|
967
|
+
browserId: z.ZodString;
|
|
968
|
+
url: z.ZodString;
|
|
969
|
+
title: z.ZodString;
|
|
970
|
+
source: z.ZodEnum<{
|
|
971
|
+
body: "body";
|
|
972
|
+
article: "article";
|
|
973
|
+
main: "main";
|
|
974
|
+
}>;
|
|
975
|
+
text: z.ZodString;
|
|
976
|
+
truncated: z.ZodBoolean;
|
|
977
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
978
|
+
command: z.ZodLiteral<"set_color_scheme">;
|
|
979
|
+
browserId: z.ZodString;
|
|
980
|
+
colorScheme: z.ZodEnum<{
|
|
981
|
+
auto: "auto";
|
|
982
|
+
light: "light";
|
|
983
|
+
dark: "dark";
|
|
984
|
+
}>;
|
|
985
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
986
|
+
command: z.ZodLiteral<"screenshot_element">;
|
|
987
|
+
browserId: z.ZodString;
|
|
988
|
+
ref: z.ZodString;
|
|
989
|
+
mimeType: z.ZodLiteral<"image/png">;
|
|
990
|
+
dataBase64: z.ZodString;
|
|
991
|
+
width: z.ZodNumber;
|
|
992
|
+
height: z.ZodNumber;
|
|
993
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
857
994
|
}, z.core.$strip>], "command">;
|
|
858
995
|
export declare const BrowserAutomationErrorSchema: z.ZodObject<{
|
|
859
996
|
code: z.ZodEnum<{
|
|
@@ -1068,6 +1205,33 @@ export declare const BrowserAutomationExecuteRequestSchema: z.ZodObject<{
|
|
|
1068
1205
|
args: z.ZodObject<{
|
|
1069
1206
|
browserId: z.ZodString;
|
|
1070
1207
|
}, z.core.$strict>;
|
|
1208
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1209
|
+
command: z.ZodLiteral<"focus_tab">;
|
|
1210
|
+
args: z.ZodObject<{
|
|
1211
|
+
browserId: z.ZodString;
|
|
1212
|
+
}, z.core.$strict>;
|
|
1213
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1214
|
+
command: z.ZodLiteral<"page_text">;
|
|
1215
|
+
args: z.ZodObject<{
|
|
1216
|
+
browserId: z.ZodString;
|
|
1217
|
+
maxChars: z.ZodDefault<z.ZodNumber>;
|
|
1218
|
+
}, z.core.$strict>;
|
|
1219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1220
|
+
command: z.ZodLiteral<"set_color_scheme">;
|
|
1221
|
+
args: z.ZodObject<{
|
|
1222
|
+
browserId: z.ZodString;
|
|
1223
|
+
colorScheme: z.ZodEnum<{
|
|
1224
|
+
auto: "auto";
|
|
1225
|
+
light: "light";
|
|
1226
|
+
dark: "dark";
|
|
1227
|
+
}>;
|
|
1228
|
+
}, z.core.$strict>;
|
|
1229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1230
|
+
command: z.ZodLiteral<"screenshot_element">;
|
|
1231
|
+
args: z.ZodObject<{
|
|
1232
|
+
browserId: z.ZodString;
|
|
1233
|
+
ref: z.ZodString;
|
|
1234
|
+
}, z.core.$strict>;
|
|
1071
1235
|
}, z.core.$strip>], "command">;
|
|
1072
1236
|
}, z.core.$strict>;
|
|
1073
1237
|
export declare const BrowserAutomationExecuteResponseSchema: z.ZodObject<{
|
|
@@ -1158,6 +1322,7 @@ export declare const BrowserAutomationExecuteResponseSchema: z.ZodObject<{
|
|
|
1158
1322
|
dataBase64: z.ZodString;
|
|
1159
1323
|
width: z.ZodNumber;
|
|
1160
1324
|
height: z.ZodNumber;
|
|
1325
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
1161
1326
|
}, z.core.$strip>, z.ZodObject<{
|
|
1162
1327
|
command: z.ZodLiteral<"upload">;
|
|
1163
1328
|
browserId: z.ZodString;
|
|
@@ -1261,6 +1426,38 @@ export declare const BrowserAutomationExecuteResponseSchema: z.ZodObject<{
|
|
|
1261
1426
|
}, z.core.$strip>, z.ZodObject<{
|
|
1262
1427
|
command: z.ZodLiteral<"close_tab">;
|
|
1263
1428
|
browserId: z.ZodString;
|
|
1429
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1430
|
+
command: z.ZodLiteral<"focus_tab">;
|
|
1431
|
+
browserId: z.ZodString;
|
|
1432
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1433
|
+
command: z.ZodLiteral<"page_text">;
|
|
1434
|
+
browserId: z.ZodString;
|
|
1435
|
+
url: z.ZodString;
|
|
1436
|
+
title: z.ZodString;
|
|
1437
|
+
source: z.ZodEnum<{
|
|
1438
|
+
body: "body";
|
|
1439
|
+
article: "article";
|
|
1440
|
+
main: "main";
|
|
1441
|
+
}>;
|
|
1442
|
+
text: z.ZodString;
|
|
1443
|
+
truncated: z.ZodBoolean;
|
|
1444
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1445
|
+
command: z.ZodLiteral<"set_color_scheme">;
|
|
1446
|
+
browserId: z.ZodString;
|
|
1447
|
+
colorScheme: z.ZodEnum<{
|
|
1448
|
+
auto: "auto";
|
|
1449
|
+
light: "light";
|
|
1450
|
+
dark: "dark";
|
|
1451
|
+
}>;
|
|
1452
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1453
|
+
command: z.ZodLiteral<"screenshot_element">;
|
|
1454
|
+
browserId: z.ZodString;
|
|
1455
|
+
ref: z.ZodString;
|
|
1456
|
+
mimeType: z.ZodLiteral<"image/png">;
|
|
1457
|
+
dataBase64: z.ZodString;
|
|
1458
|
+
width: z.ZodNumber;
|
|
1459
|
+
height: z.ZodNumber;
|
|
1460
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
1264
1461
|
}, z.core.$strip>], "command">;
|
|
1265
1462
|
dialogs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1266
1463
|
type: z.ZodEnum<{
|
|
@@ -1317,6 +1514,7 @@ export declare const BrowserAutomationExecuteResponseSchema: z.ZodObject<{
|
|
|
1317
1514
|
}, z.core.$strip>], "ok">;
|
|
1318
1515
|
}, z.core.$strip>;
|
|
1319
1516
|
export type BrowserAutomationErrorCode = z.infer<typeof BrowserAutomationErrorCodeSchema>;
|
|
1517
|
+
export type BrowserAutomationColorScheme = z.infer<typeof BrowserAutomationColorSchemeSchema>;
|
|
1320
1518
|
export type BrowserAutomationCommandName = z.infer<typeof BrowserAutomationCommandNameSchema>;
|
|
1321
1519
|
export type BrowserAutomationCommand = z.infer<typeof BrowserAutomationCommandSchema>;
|
|
1322
1520
|
export type BrowserAutomationResult = z.infer<typeof BrowserAutomationResultSchema>;
|
|
@@ -41,6 +41,10 @@ export const BROWSER_AUTOMATION_COMMAND_NAMES = [
|
|
|
41
41
|
"scroll",
|
|
42
42
|
"resize",
|
|
43
43
|
"close_tab",
|
|
44
|
+
"focus_tab",
|
|
45
|
+
"page_text",
|
|
46
|
+
"set_color_scheme",
|
|
47
|
+
"screenshot_element",
|
|
44
48
|
];
|
|
45
49
|
export const BrowserAutomationCommandNameSchema = z.enum(BROWSER_AUTOMATION_COMMAND_NAMES);
|
|
46
50
|
export const BrowserAutomationBrowserIdSchema = z
|
|
@@ -240,6 +244,29 @@ export const BrowserAutomationCloseTabCommandSchema = z.object({
|
|
|
240
244
|
command: z.literal("close_tab"),
|
|
241
245
|
args: BrowserAutomationTabTargetSchema,
|
|
242
246
|
});
|
|
247
|
+
export const BrowserAutomationFocusTabCommandSchema = z.object({
|
|
248
|
+
command: z.literal("focus_tab"),
|
|
249
|
+
args: BrowserAutomationTabTargetSchema,
|
|
250
|
+
});
|
|
251
|
+
export const BrowserAutomationPageTextCommandSchema = z.object({
|
|
252
|
+
command: z.literal("page_text"),
|
|
253
|
+
args: BrowserAutomationTabTargetSchema.extend({
|
|
254
|
+
maxChars: z.number().int().positive().max(100000).default(20000),
|
|
255
|
+
}),
|
|
256
|
+
});
|
|
257
|
+
export const BrowserAutomationColorSchemeSchema = z.enum(["light", "dark", "auto"]);
|
|
258
|
+
export const BrowserAutomationSetColorSchemeCommandSchema = z.object({
|
|
259
|
+
command: z.literal("set_color_scheme"),
|
|
260
|
+
args: BrowserAutomationTabTargetSchema.extend({
|
|
261
|
+
colorScheme: BrowserAutomationColorSchemeSchema,
|
|
262
|
+
}),
|
|
263
|
+
});
|
|
264
|
+
export const BrowserAutomationScreenshotElementCommandSchema = z.object({
|
|
265
|
+
command: z.literal("screenshot_element"),
|
|
266
|
+
args: BrowserAutomationTabTargetSchema.extend({
|
|
267
|
+
ref: BrowserAutomationRefSchema,
|
|
268
|
+
}),
|
|
269
|
+
});
|
|
243
270
|
export const BrowserAutomationCommandSchema = z.discriminatedUnion("command", [
|
|
244
271
|
BrowserAutomationListTabsCommandSchema,
|
|
245
272
|
BrowserAutomationNewTabCommandSchema,
|
|
@@ -265,6 +292,10 @@ export const BrowserAutomationCommandSchema = z.discriminatedUnion("command", [
|
|
|
265
292
|
BrowserAutomationScrollCommandSchema,
|
|
266
293
|
BrowserAutomationResizeCommandSchema,
|
|
267
294
|
BrowserAutomationCloseTabCommandSchema,
|
|
295
|
+
BrowserAutomationFocusTabCommandSchema,
|
|
296
|
+
BrowserAutomationPageTextCommandSchema,
|
|
297
|
+
BrowserAutomationSetColorSchemeCommandSchema,
|
|
298
|
+
BrowserAutomationScreenshotElementCommandSchema,
|
|
268
299
|
]);
|
|
269
300
|
export const BrowserAutomationTabInfoSchema = z.object({
|
|
270
301
|
browserId: BrowserAutomationBrowserIdSchema,
|
|
@@ -362,6 +393,23 @@ export const BrowserAutomationScreenshotResultSchema = z.object({
|
|
|
362
393
|
dataBase64: z.string().min(1),
|
|
363
394
|
width: z.number().int().nonnegative(),
|
|
364
395
|
height: z.number().int().nonnegative(),
|
|
396
|
+
/**
|
|
397
|
+
* CSS-pixel → image-pixel ratio when the capture was scaled to fit the
|
|
398
|
+
* vision-model legibility budget. Absent when captured 1:1 (or from hosts
|
|
399
|
+
* older than this field).
|
|
400
|
+
*/
|
|
401
|
+
scale: z.number().positive().optional(),
|
|
402
|
+
});
|
|
403
|
+
export const BrowserAutomationScreenshotElementResultSchema = z.object({
|
|
404
|
+
command: z.literal("screenshot_element"),
|
|
405
|
+
browserId: BrowserAutomationBrowserIdSchema,
|
|
406
|
+
ref: BrowserAutomationRefSchema,
|
|
407
|
+
mimeType: z.literal("image/png"),
|
|
408
|
+
dataBase64: z.string().min(1),
|
|
409
|
+
width: z.number().int().nonnegative(),
|
|
410
|
+
height: z.number().int().nonnegative(),
|
|
411
|
+
/** Render scale used for the clip — above 1 means the element was re-rendered zoomed in. */
|
|
412
|
+
scale: z.number().positive().optional(),
|
|
365
413
|
});
|
|
366
414
|
export const BrowserAutomationUploadResultSchema = z.object({
|
|
367
415
|
command: z.literal("upload"),
|
|
@@ -486,6 +534,25 @@ export const BrowserAutomationCloseTabResultSchema = z.object({
|
|
|
486
534
|
command: z.literal("close_tab"),
|
|
487
535
|
browserId: BrowserAutomationBrowserIdSchema,
|
|
488
536
|
});
|
|
537
|
+
export const BrowserAutomationFocusTabResultSchema = z.object({
|
|
538
|
+
command: z.literal("focus_tab"),
|
|
539
|
+
browserId: BrowserAutomationBrowserIdSchema,
|
|
540
|
+
});
|
|
541
|
+
export const BrowserAutomationPageTextResultSchema = z.object({
|
|
542
|
+
command: z.literal("page_text"),
|
|
543
|
+
browserId: BrowserAutomationBrowserIdSchema,
|
|
544
|
+
url: z.string(),
|
|
545
|
+
title: z.string(),
|
|
546
|
+
/** Which container the text came from: reader-mode article/main first, body fallback. */
|
|
547
|
+
source: z.enum(["article", "main", "body"]),
|
|
548
|
+
text: z.string(),
|
|
549
|
+
truncated: z.boolean(),
|
|
550
|
+
});
|
|
551
|
+
export const BrowserAutomationSetColorSchemeResultSchema = z.object({
|
|
552
|
+
command: z.literal("set_color_scheme"),
|
|
553
|
+
browserId: BrowserAutomationBrowserIdSchema,
|
|
554
|
+
colorScheme: BrowserAutomationColorSchemeSchema,
|
|
555
|
+
});
|
|
489
556
|
export const BrowserAutomationResultSchema = z.discriminatedUnion("command", [
|
|
490
557
|
BrowserAutomationListTabsResultSchema,
|
|
491
558
|
BrowserAutomationNewTabResultSchema,
|
|
@@ -511,6 +578,10 @@ export const BrowserAutomationResultSchema = z.discriminatedUnion("command", [
|
|
|
511
578
|
BrowserAutomationScrollResultSchema,
|
|
512
579
|
BrowserAutomationResizeResultSchema,
|
|
513
580
|
BrowserAutomationCloseTabResultSchema,
|
|
581
|
+
BrowserAutomationFocusTabResultSchema,
|
|
582
|
+
BrowserAutomationPageTextResultSchema,
|
|
583
|
+
BrowserAutomationSetColorSchemeResultSchema,
|
|
584
|
+
BrowserAutomationScreenshotElementResultSchema,
|
|
514
585
|
]);
|
|
515
586
|
export const BrowserAutomationErrorSchema = z.object({
|
|
516
587
|
code: BrowserAutomationErrorCodeSchema,
|