@onkernel/cua-ai 0.0.1 → 0.2.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 (58) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +341 -65
  3. package/dist/chunk-D7D4PA-g.js +13 -0
  4. package/dist/index.d.ts +576 -10
  5. package/dist/index.js +1992 -11
  6. package/docs/supported-models.md +76 -0
  7. package/examples/quickstart.ts +28 -22
  8. package/package.json +10 -6
  9. package/dist/api-keys.d.ts +0 -8
  10. package/dist/api-keys.d.ts.map +0 -1
  11. package/dist/api-keys.js +0 -48
  12. package/dist/api-keys.js.map +0 -1
  13. package/dist/index.d.ts.map +0 -1
  14. package/dist/index.js.map +0 -1
  15. package/dist/models.d.ts +0 -33
  16. package/dist/models.d.ts.map +0 -1
  17. package/dist/models.js +0 -159
  18. package/dist/models.js.map +0 -1
  19. package/dist/providers/anthropic/index.d.ts +0 -10
  20. package/dist/providers/anthropic/index.d.ts.map +0 -1
  21. package/dist/providers/anthropic/index.js +0 -16
  22. package/dist/providers/anthropic/index.js.map +0 -1
  23. package/dist/providers/common.d.ts +0 -111
  24. package/dist/providers/common.d.ts.map +0 -1
  25. package/dist/providers/common.js +0 -138
  26. package/dist/providers/common.js.map +0 -1
  27. package/dist/providers/gemini/index.d.ts +0 -11
  28. package/dist/providers/gemini/index.d.ts.map +0 -1
  29. package/dist/providers/gemini/index.js +0 -14
  30. package/dist/providers/gemini/index.js.map +0 -1
  31. package/dist/providers/openai/index.d.ts +0 -8
  32. package/dist/providers/openai/index.d.ts.map +0 -1
  33. package/dist/providers/openai/index.js +0 -22
  34. package/dist/providers/openai/index.js.map +0 -1
  35. package/dist/providers/tzafon/index.d.ts +0 -12
  36. package/dist/providers/tzafon/index.d.ts.map +0 -1
  37. package/dist/providers/tzafon/index.js +0 -18
  38. package/dist/providers/tzafon/index.js.map +0 -1
  39. package/dist/providers/tzafon/provider.d.ts +0 -8
  40. package/dist/providers/tzafon/provider.d.ts.map +0 -1
  41. package/dist/providers/tzafon/provider.js +0 -234
  42. package/dist/providers/tzafon/provider.js.map +0 -1
  43. package/dist/providers/yutori/index.d.ts +0 -12
  44. package/dist/providers/yutori/index.d.ts.map +0 -1
  45. package/dist/providers/yutori/index.js +0 -23
  46. package/dist/providers/yutori/index.js.map +0 -1
  47. package/dist/providers/yutori/provider.d.ts +0 -9
  48. package/dist/providers/yutori/provider.d.ts.map +0 -1
  49. package/dist/providers/yutori/provider.js +0 -307
  50. package/dist/providers/yutori/provider.js.map +0 -1
  51. package/dist/providers.d.ts +0 -6
  52. package/dist/providers.d.ts.map +0 -1
  53. package/dist/providers.js +0 -26
  54. package/dist/providers.js.map +0 -1
  55. package/dist/runtime-spec.d.ts +0 -29
  56. package/dist/runtime-spec.d.ts.map +0 -1
  57. package/dist/runtime-spec.js +0 -58
  58. package/dist/runtime-spec.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,11 +1,577 @@
1
+ import { Api, Model, SimpleStreamOptions, Static, StreamFunction, StreamOptions, TSchema, Tool, Type } from "@earendil-works/pi-ai";
1
2
  export * from "@earendil-works/pi-ai";
2
- export * from "./models.js";
3
- export * from "./api-keys.js";
4
- export * from "./runtime-spec.js";
5
- export * from "./providers/common.js";
6
- export * as anthropic from "./providers/anthropic/index.js";
7
- export * as gemini from "./providers/gemini/index.js";
8
- export * as openai from "./providers/openai/index.js";
9
- export * as tzafon from "./providers/tzafon/index.js";
10
- export * as yutori from "./providers/yutori/index.js";
11
- //# sourceMappingURL=index.d.ts.map
3
+
4
+ //#region src/models.d.ts
5
+ /** Providers with curated computer-use model support. */
6
+ type CuaProvider = "openai" | "anthropic" | "google" | "tzafon" | "yutori";
7
+ /** Provider-qualified model reference, e.g. `"openai:gpt-5.5"` or `"google:gemini-3-flash-preview"`. */
8
+ type CuaModelRef = `${CuaProvider}:${string}`;
9
+ /** One entry returned by {@link listCuaModels}. */
10
+ interface CuaModelInfo {
11
+ /** Provider-qualified ref accepted by {@link getCuaModel}. */
12
+ ref: CuaModelRef;
13
+ provider: CuaProvider;
14
+ /** Provider-native model id (the part after the colon). */
15
+ model: string;
16
+ /** Human-readable model name. */
17
+ name: string;
18
+ }
19
+ /** All providers this package curates computer-use models for. */
20
+ declare const CUA_PROVIDERS: readonly CuaProvider[];
21
+ /**
22
+ * How a {@link CuaModelAnnotation} matches model ids.
23
+ *
24
+ * - `exact`: `id === match.id`
25
+ * - `family`: `id === match.family`, or `match.family` plus hyphen-separated
26
+ * numeric segments (revisions and dated snapshots, e.g. "claude-opus-4-7",
27
+ * "gpt-5.5-2026-04-23"). Named variants like "gpt-5.4-mini" are distinct
28
+ * models and need their own entry.
29
+ */
30
+ type CuaModelMatch = {
31
+ readonly kind: "exact";
32
+ readonly id: string;
33
+ } | {
34
+ readonly kind: "family";
35
+ readonly family: string;
36
+ };
37
+ /** One CUA-support annotation: a model-id match plus the official source documenting support. */
38
+ interface CuaModelAnnotation {
39
+ readonly match: CuaModelMatch;
40
+ /** URL of the provider documentation establishing computer-use support. */
41
+ readonly source: string;
42
+ }
43
+ /**
44
+ * Per-provider computer-use support annotations.
45
+ *
46
+ * pi-ai's model registry is generated from models.dev (see
47
+ * node_modules/@earendil-works/pi-ai/scripts/generate-models.ts) and lists every
48
+ * model a provider offers. Only some of those models support computer-use, so
49
+ * this table layers per-provider CUA-support annotations on top of the
50
+ * registry. Each entry cites the official source documenting CUA support.
51
+ *
52
+ * To verify support and add new entries, follow the `update-models` skill at
53
+ * .agents/skills/update-models/SKILL.md.
54
+ */
55
+ declare const CUA_MODEL_ANNOTATIONS: Record<CuaProvider, readonly CuaModelAnnotation[]>;
56
+ /**
57
+ * Split a provider-qualified ref like `"openai:gpt-5.5"` into its parts.
58
+ *
59
+ * `"gemini:"` is accepted as an alias for the canonical `"google:"` prefix
60
+ * and normalizes to provider `"google"`. Throws when the ref is unqualified
61
+ * or names an unsupported provider.
62
+ */
63
+ declare function parseCuaModelRef(ref: string): {
64
+ provider: CuaProvider;
65
+ model: string;
66
+ };
67
+ /** Join a provider and model id into a {@link CuaModelRef}. */
68
+ declare function formatCuaModelRef(provider: CuaProvider, model: string): CuaModelRef;
69
+ /**
70
+ * List the computer-use-capable models this package curates, optionally
71
+ * filtered to one provider. Merges pi-ai's registry with local overrides and
72
+ * keeps only models annotated in {@link CUA_MODEL_ANNOTATIONS}.
73
+ */
74
+ declare function listCuaModels(provider?: CuaProvider): CuaModelInfo[];
75
+ /**
76
+ * Resolve a {@link CuaModelRef} to a concrete pi-ai model.
77
+ *
78
+ * Throws when the ref is unqualified, names an unsupported provider, or names
79
+ * a model without a CUA-support annotation. `"gemini:"` refs are accepted as
80
+ * an alias for `"google:"` (see {@link parseCuaModelRef}).
81
+ */
82
+ declare function getCuaModel(ref: CuaModelRef): Model<Api>;
83
+ /** Return the {@link CuaProvider} for a concrete model, or throw when it is not a CUA provider. */
84
+ declare function providerForModel(model: Model<Api>): CuaProvider;
85
+ /** Narrow an arbitrary string to {@link CuaProvider}. */
86
+ declare function isCuaProvider(value: string): value is CuaProvider;
87
+ /** Find the CUA-support annotation covering a model id, if any. */
88
+ declare function findCuaAnnotation(provider: CuaProvider, modelId: string): CuaModelAnnotation | undefined;
89
+ //#endregion
90
+ //#region src/providers/common.d.ts
91
+ declare const CUA_ACTION_TYPES: readonly ["click", "double_click", "mouse_down", "mouse_up", "type", "keypress", "scroll", "move", "drag", "wait", "screenshot", "goto", "back", "forward", "url", "cursor_position"];
92
+ type CuaActionType = (typeof CUA_ACTION_TYPES)[number];
93
+ /**
94
+ * Mouse buttons accepted by click, mouse_down, and mouse_up actions. The
95
+ * executor coerces anything outside this set to "left".
96
+ */
97
+ type CuaMouseButton = "left" | "right" | "middle" | "back" | "forward";
98
+ /**
99
+ * Mouse buttons accepted by drag actions. The executor coerces anything
100
+ * outside this set to "left".
101
+ */
102
+ type CuaDragMouseButton = "left" | "right" | "middle";
103
+ interface CuaActionClick {
104
+ type: "click";
105
+ x: number;
106
+ y: number;
107
+ button?: CuaMouseButton;
108
+ hold_keys?: string[];
109
+ }
110
+ interface CuaActionDoubleClick {
111
+ type: "double_click";
112
+ x: number;
113
+ y: number;
114
+ hold_keys?: string[];
115
+ }
116
+ interface CuaActionMouseDown {
117
+ type: "mouse_down";
118
+ x: number;
119
+ y: number;
120
+ button?: CuaMouseButton;
121
+ hold_keys?: string[];
122
+ }
123
+ interface CuaActionMouseUp {
124
+ type: "mouse_up";
125
+ x: number;
126
+ y: number;
127
+ button?: CuaMouseButton;
128
+ hold_keys?: string[];
129
+ }
130
+ interface CuaActionTypeText {
131
+ type: "type";
132
+ text: string;
133
+ }
134
+ interface CuaActionKeypress {
135
+ type: "keypress";
136
+ keys: string[];
137
+ duration?: number;
138
+ }
139
+ interface CuaActionScroll {
140
+ type: "scroll";
141
+ x?: number;
142
+ y?: number;
143
+ scroll_x?: number;
144
+ scroll_y?: number;
145
+ hold_keys?: string[];
146
+ }
147
+ interface CuaActionMove {
148
+ type: "move";
149
+ x: number;
150
+ y: number;
151
+ }
152
+ interface CuaActionDrag {
153
+ type: "drag";
154
+ path: Array<{
155
+ x: number;
156
+ y: number;
157
+ }>;
158
+ button?: CuaDragMouseButton;
159
+ hold_keys?: string[];
160
+ }
161
+ interface CuaActionWait {
162
+ type: "wait";
163
+ ms?: number;
164
+ }
165
+ interface CuaActionScreenshot {
166
+ type: "screenshot";
167
+ }
168
+ interface CuaActionGoto {
169
+ type: "goto";
170
+ url: string;
171
+ }
172
+ interface CuaActionBack {
173
+ type: "back";
174
+ }
175
+ interface CuaActionForward {
176
+ type: "forward";
177
+ }
178
+ interface CuaActionUrl {
179
+ type: "url";
180
+ }
181
+ interface CuaActionCursorPosition {
182
+ type: "cursor_position";
183
+ }
184
+ type CuaAction = CuaActionClick | CuaActionDoubleClick | CuaActionMouseDown | CuaActionMouseUp | CuaActionTypeText | CuaActionKeypress | CuaActionScroll | CuaActionMove | CuaActionDrag | CuaActionWait | CuaActionScreenshot | CuaActionGoto | CuaActionBack | CuaActionForward | CuaActionUrl | CuaActionCursorPosition;
185
+ declare function createCuaActionSchema(actions?: readonly CuaActionType[]): TSchema;
186
+ declare function createCuaActionToolDefinitions(actions?: readonly CuaActionType[]): Tool[];
187
+ declare const CuaActionSchema: Type.TSchema;
188
+ declare function createCuaBatchSchema(actions?: readonly CuaActionType[]): TSchema;
189
+ declare const CuaBatchSchema: Type.TSchema;
190
+ declare const CuaNavigationSchema: Type.TObject<{
191
+ action: Type.TUnion<[Type.TLiteral<"goto">, Type.TLiteral<"back">, Type.TLiteral<"forward">, Type.TLiteral<"url">]>;
192
+ url: Type.TOptional<Type.TString>;
193
+ }>;
194
+ interface CuaBatchInput {
195
+ actions: CuaAction[];
196
+ }
197
+ type CuaNavigationInput = Static<typeof CuaNavigationSchema>;
198
+ /** Tool schema plus execution adapter for a browser computer-use tool. */
199
+ interface CuaToolExecutorSpec {
200
+ /** Tool schema installed by CuaAgent/CuaAgentHarness. The name must match the provider tool call name. */
201
+ definition: Tool;
202
+ /** Convert that tool's arguments into canonical CUA actions for browser execution. */
203
+ toActions(args: unknown): CuaAction[];
204
+ }
205
+ /**
206
+ * Default name for batch computer-action tools created by
207
+ * {@link createCuaBatchToolDefinition} and the name Anthropic's batch tool
208
+ * ships under (the only provider that includes one by default).
209
+ */
210
+ declare const CUA_BATCH_TOOL_NAME = "computer_batch";
211
+ declare const CUA_NAVIGATION_TOOL_NAME = "computer_use_extra";
212
+ declare const CUA_BATCH_TOOL_DESCRIPTION: string;
213
+ declare const CUA_NAVIGATION_TOOL_DESCRIPTION = "High-level browser navigation helpers for goto, back, forward, and url.";
214
+ interface ComputerToolsOptions {
215
+ actions?: readonly CuaActionType[];
216
+ }
217
+ type ComputerToolCoordinateSystem = {
218
+ type: "pixel";
219
+ } | {
220
+ type: "normalized";
221
+ range: readonly [number, number];
222
+ };
223
+ /**
224
+ * Build the provider's CUA computer-use tools.
225
+ *
226
+ * Use this when calling `complete()` or `stream()` directly and you need an
227
+ * array of `Tool` objects for browser actions. Pass `actions` to expose only a
228
+ * smaller set, such as `["click"]`.
229
+ */
230
+ declare function computerTools(options?: ComputerToolsOptions): Tool[];
231
+ /** Build execution adapters for individual canonical CUA action tools. */
232
+ declare function createCuaActionToolExecutors(actions?: readonly CuaActionType[]): CuaToolExecutorSpec[];
233
+ /** Return the canonical tool name that should execute a normalized CUA action. */
234
+ declare function canonicalToolCallName(action: CuaAction): CuaActionType;
235
+ /** Convert a normalized CUA action into tool-call arguments by removing its `type` tag. */
236
+ declare function canonicalToolCallArguments(action: CuaAction): Record<string, unknown>;
237
+ /** Prefix bare hostnames/paths with `https://` before browser navigation. */
238
+ declare function normalizeGotoUrl(value: unknown): string | undefined;
239
+ declare function createCuaBatchToolDefinition(actions?: readonly CuaActionType[], options?: {
240
+ name?: string;
241
+ description?: string;
242
+ }): Tool;
243
+ /** Build an execution adapter for a batch tool whose input is `{ actions }`. */
244
+ declare function createCuaBatchToolExecutor(actions?: readonly CuaActionType[], options?: {
245
+ name?: string;
246
+ description?: string;
247
+ }): CuaToolExecutorSpec;
248
+ /** Build the provider's default CUA tool execution adapters. */
249
+ declare function computerToolExecutors(options?: ComputerToolsOptions): CuaToolExecutorSpec[];
250
+ declare function createCuaNavigationToolDefinition(): Tool;
251
+ interface CuaScreenshotTransformSpec {
252
+ width: number;
253
+ height: number;
254
+ format: "png" | "jpeg" | "webp";
255
+ quality?: number;
256
+ }
257
+ interface CuaScreenshotSpec {
258
+ /** Append a provider-prepared screenshot to the latest user/tool message before each request. */
259
+ appendToLatestMessage?: boolean;
260
+ /** Optional image transform applied to Kernel screenshots before they are sent to the provider. */
261
+ transform?: CuaScreenshotTransformSpec;
262
+ }
263
+ interface CuaPayloadContext {
264
+ /** Tool names that should remain in the outbound provider payload even if the provider strips local CUA executors. */
265
+ keepToolNames?: readonly string[];
266
+ /** Capture a fresh browser screenshot, already transformed per the provider's screenshot spec. */
267
+ getScreenshot?: () => Promise<{
268
+ data: Buffer;
269
+ mimeType: string;
270
+ }>;
271
+ }
272
+ type CuaPayloadHook = (payload: unknown, model: Model<Api>, context?: CuaPayloadContext) => unknown | Promise<unknown>;
273
+ /**
274
+ * Runtime configuration for a supported CUA model.
275
+ *
276
+ * Use this to pair a model with the agent tool definitions, baseline prompt,
277
+ * coordinate convention, screenshot policy, and request payload middleware
278
+ * expected by its provider.
279
+ */
280
+ interface CuaRuntimeSpec {
281
+ model: Model<Api>;
282
+ provider: CuaProvider;
283
+ /** Provider-facing CUA tool definitions used for model requests. */
284
+ toolDefinitions: Tool[];
285
+ /** Local execution adapters that turn provider tool calls into canonical CUA actions. */
286
+ toolExecutors: CuaToolExecutorSpec[];
287
+ /** Provider-tuned baseline prompt for browser control behavior. */
288
+ defaultSystemPrompt: string;
289
+ /** Coordinate convention emitted by provider tool calls. */
290
+ coordinateSystem: ComputerToolCoordinateSystem;
291
+ /** Optional provider screenshot input policy used by CuaAgent/CuaAgentHarness. */
292
+ screenshot?: CuaScreenshotSpec;
293
+ /** Optional provider middleware for request payload adaptation. */
294
+ onPayload?: CuaPayloadHook;
295
+ }
296
+ type CuaRuntimeSpecInput = CuaModelRef | Model<Api>;
297
+ /** Uniform provider contract resolved by the CUA runtime registry. */
298
+ interface CuaProviderModule {
299
+ /** Model-facing CUA tool definitions sent in provider requests. */
300
+ toolDefinitions(options?: ComputerToolsOptions): Tool[];
301
+ /** Local execution adapters (provider tool-call name -> canonical CUA actions). */
302
+ toolExecutors(options?: ComputerToolsOptions): CuaToolExecutorSpec[];
303
+ /** Coordinate convention emitted by this provider's tool calls. */
304
+ coordinateSystem(): ComputerToolCoordinateSystem;
305
+ /** Provider-tuned baseline browser-control system prompt. */
306
+ buildSystemPrompt(opts?: {
307
+ suffix?: string;
308
+ }): string;
309
+ /** Optional request-payload middleware for provider protocol quirks. */
310
+ onPayload?: CuaPayloadHook;
311
+ /** Optional provider screenshot input policy. */
312
+ screenshot?: CuaScreenshotSpec;
313
+ }
314
+ //#endregion
315
+ //#region src/providers/tzafon/provider.d.ts
316
+ declare const TZAFON_RESPONSES_API = "tzafon-responses";
317
+ /** Stream options accepted by {@link streamTzafonResponses}. */
318
+ interface TzafonResponsesOptions extends StreamOptions {
319
+ /** Tool names to keep in the outbound payload even though they collide with local CUA action tool names. */
320
+ keepToolNames?: readonly string[];
321
+ }
322
+ declare const streamSimpleTzafonResponses: StreamFunction<typeof TZAFON_RESPONSES_API, SimpleStreamOptions>;
323
+ declare const streamTzafonResponses: StreamFunction<typeof TZAFON_RESPONSES_API, TzafonResponsesOptions>;
324
+ declare function tzafonComputerUseOnPayload(payload: unknown, _model?: Model<Api>, context?: CuaPayloadContext): unknown | undefined;
325
+ /** Derive a unique canonical tool-call id for a Tzafon computer action. */
326
+ declare function tzafonToolCallId(callId: string, actionIndex: number): string;
327
+ /** A canonical CUA action, or the terminal `answer` text Tzafon emits when it is done. */
328
+ type TzafonCanonicalAction = CuaAction | {
329
+ type: "answer";
330
+ text: string;
331
+ };
332
+ /** Normalize one Tzafon `computer_call.action` payload into canonical CUA actions. */
333
+ declare function toCanonicalActions$1(action: unknown): TzafonCanonicalAction[];
334
+ //#endregion
335
+ //#region src/providers/yutori/provider.d.ts
336
+ declare const YUTORI_CHAT_COMPLETIONS_API = "yutori-chat-completions";
337
+ /** Stream options accepted by {@link streamYutori}. */
338
+ interface YutoriOptions extends StreamOptions {
339
+ /** Tool names to keep in the outbound payload even though they collide with local CUA action tool names. */
340
+ keepToolNames?: readonly string[];
341
+ }
342
+ declare const streamYutori: StreamFunction<typeof YUTORI_CHAT_COMPLETIONS_API, YutoriOptions>;
343
+ declare const streamSimpleYutori: StreamFunction<typeof YUTORI_CHAT_COMPLETIONS_API, SimpleStreamOptions>;
344
+ declare function yutoriNativeToolSetOnPayload(payload: unknown, model?: Model<Api>, context?: CuaPayloadContext): unknown | undefined;
345
+ /**
346
+ * CUA payload middleware for yutori: map local executor tools onto the native
347
+ * tool set, then append a fresh screenshot to the latest user/tool message per
348
+ * yutori's screenshot policy.
349
+ */
350
+ declare function yutoriCuaOnPayload(payload: unknown, model?: Model<Api>, context?: CuaPayloadContext): Promise<unknown | undefined>;
351
+ //#endregion
352
+ //#region src/providers.d.ts
353
+ /**
354
+ * Register the Yutori and Tzafon stream providers with pi-ai's global API
355
+ * registry. Importing `@onkernel/cua-ai` calls this automatically.
356
+ *
357
+ * The pi-ai registry mutators this package re-exports (`clearApiProviders`,
358
+ * `resetApiProviders`, `unregisterApiProviders`) deregister these providers,
359
+ * after which Yutori/Tzafon streaming fails until they are registered again.
360
+ * Call this to restore them; it is idempotent and safe to call repeatedly.
361
+ */
362
+ declare function registerCuaProviders(): void;
363
+ //#endregion
364
+ //#region src/api-keys.d.ts
365
+ /**
366
+ * List the environment variables checked for a provider's API key, in
367
+ * precedence order. Accepts `"gemini"` as an alias for `"google"`; returns an
368
+ * empty list for unknown providers.
369
+ */
370
+ declare function cuaApiKeyEnvVarsForProvider(provider: string): readonly string[];
371
+ /** Read a provider's API key from the environment, or return undefined when unset. */
372
+ declare function getCuaEnvApiKey(provider: string): string | undefined;
373
+ /** Read a provider's API key from the environment, or throw naming the variables to set. */
374
+ declare function requireCuaEnvApiKey(provider: string): string;
375
+ /** {@link getCuaEnvApiKey} keyed by a model ref or concrete model instead of a provider name. */
376
+ declare function getCuaEnvApiKeyForModel(input: CuaModelRef | Model<Api>): string | undefined;
377
+ /** {@link requireCuaEnvApiKey} keyed by a model ref or concrete model instead of a provider name. */
378
+ declare function requireCuaEnvApiKeyForModel(input: CuaModelRef | Model<Api>): string;
379
+ //#endregion
380
+ //#region src/runtime-spec.d.ts
381
+ /**
382
+ * Resolve provider defaults from either a CUA model ref or a concrete model.
383
+ *
384
+ * Use the returned spec to build computer-use requests without hard-coding
385
+ * model-provider rules in your application. Pass `options` (e.g.
386
+ * `{ actions: ["click"] }`) to narrow the resolved tool definitions and
387
+ * executors to a supported subset.
388
+ */
389
+ declare function resolveCuaRuntimeSpec(input: CuaRuntimeSpecInput, options?: ComputerToolsOptions): CuaRuntimeSpec;
390
+ //#endregion
391
+ //#region src/providers/anthropic/actions.d.ts
392
+ /**
393
+ * Canonical CUA action types Anthropic browser computer-use tools support.
394
+ *
395
+ * Source of truth: Anthropic's computer-use best-practices quickstart
396
+ * computer/browser tool action enums. These are the browser actions Anthropic
397
+ * currently accepts under CUA's canonical individual tool names.
398
+ * https://github.com/anthropics/claude-quickstarts/blob/main/computer-use-best-practices/computer_use/tools/computer.py
399
+ * https://github.com/anthropics/claude-quickstarts/blob/main/computer-use-best-practices/computer_use/tools/browser.py
400
+ */
401
+ declare const ANTHROPIC_CUA_ACTION_TYPES: readonly ["click", "double_click", "mouse_down", "mouse_up", "type", "keypress", "scroll", "move", "drag", "wait", "screenshot", "goto", "cursor_position"];
402
+ type AnthropicCanonicalActionType = (typeof ANTHROPIC_CUA_ACTION_TYPES)[number];
403
+ /** Name of the batch tool included by default in Anthropic computer-use tools. */
404
+ declare const ANTHROPIC_BATCH_TOOL_NAME = "computer_batch";
405
+ /** Options for building Anthropic browser computer-use tools. */
406
+ interface AnthropicComputerToolsOptions extends ComputerToolsOptions {
407
+ /** Exclude the batch computer action tool from the returned tools. */
408
+ excludeBatch?: boolean;
409
+ }
410
+ /** Canonical CUA action shape supported by Anthropic browser computer-use tools. */
411
+ type AnthropicAction = Extract<CuaAction, {
412
+ type: AnthropicCanonicalActionType;
413
+ }>;
414
+ /** Build the TypeBox schema for Anthropic-supported canonical browser actions. */
415
+ declare function createActionSchema$1(actions?: readonly CuaActionType[]): TSchema;
416
+ /**
417
+ * Build Anthropic CUA computer-use tools.
418
+ *
419
+ * Use this when calling `complete()` or `stream()` directly and you need an
420
+ * array of `Tool` objects for Anthropic browser actions. Pass `actions` to
421
+ * expose only a supported subset, such as `["click"]`. Anthropic includes a
422
+ * batch tool by default; pass `excludeBatch: true` to omit it.
423
+ */
424
+ declare function computerTools$2(options?: AnthropicComputerToolsOptions): Tool[];
425
+ /** Build the local execution adapters used by CuaAgent and CuaAgentHarness. */
426
+ declare function computerToolExecutors$2(options?: AnthropicComputerToolsOptions): CuaToolExecutorSpec[];
427
+ declare namespace index_d_exports {
428
+ export { ANTHROPIC_BATCH_TOOL_NAME, ANTHROPIC_COMPUTER_INSTRUCTIONS, ANTHROPIC_CUA_ACTION_TYPES, AnthropicAction, AnthropicComputerToolsOptions, AnthropicComputerToolsOptions as ComputerToolsOptions, buildAnthropicSystemPrompt, computerToolExecutors$2 as computerToolExecutors, computerTools$2 as computerTools, coordinateSystem$4 as coordinateSystem, createActionSchema$1 as createActionSchema, providerModule$4 as providerModule };
429
+ }
430
+ declare function coordinateSystem$4(): ComputerToolCoordinateSystem;
431
+ declare const ANTHROPIC_COMPUTER_INSTRUCTIONS = "You control a Kernel cloud browser through individual browser tools. Use keyboard navigation where possible, and request screenshots when you need to inspect state.";
432
+ declare function buildAnthropicSystemPrompt(opts?: {
433
+ suffix?: string;
434
+ }): string;
435
+ declare const providerModule$4: {
436
+ toolDefinitions: typeof computerTools$2;
437
+ toolExecutors: typeof computerToolExecutors$2;
438
+ coordinateSystem: typeof coordinateSystem$4;
439
+ buildSystemPrompt: typeof buildAnthropicSystemPrompt;
440
+ };
441
+ declare namespace index_d_exports$1 {
442
+ export { ComputerToolsOptions, GEMINI_COMPUTER_INSTRUCTIONS, CUA_ACTION_TYPES as GEMINI_CUA_ACTION_TYPES, CuaAction as GeminiAction, buildGeminiSystemPrompt, computerToolExecutors, computerTools, coordinateSystem$3 as coordinateSystem, createCuaActionSchema as createActionSchema, providerModule$3 as providerModule };
443
+ }
444
+ declare function coordinateSystem$3(): ComputerToolCoordinateSystem;
445
+ declare const GEMINI_COMPUTER_INSTRUCTIONS = "You control a Kernel cloud browser through individual browser tools. Use the provider coordinate system for tool calls, and request screenshots or URL reads when state changes.";
446
+ declare function buildGeminiSystemPrompt(opts?: {
447
+ suffix?: string;
448
+ }): string;
449
+ declare const providerModule$3: {
450
+ toolDefinitions: typeof computerTools;
451
+ toolExecutors: typeof computerToolExecutors;
452
+ coordinateSystem: typeof coordinateSystem$3;
453
+ buildSystemPrompt: typeof buildGeminiSystemPrompt;
454
+ };
455
+ declare namespace index_d_exports$2 {
456
+ export { ComputerToolsOptions, OPENAI_COMPUTER_INSTRUCTIONS, CUA_ACTION_TYPES as OPENAI_CUA_ACTION_TYPES, CUA_NAVIGATION_TOOL_DESCRIPTION as OPENAI_EXTRA_TOOL_DESCRIPTION, CUA_NAVIGATION_TOOL_NAME as OPENAI_EXTRA_TOOL_NAME, CuaAction as OpenAIAction, CuaNavigationInput as OpenAIExtraInput, CuaNavigationSchema as OpenAIExtraSchema, buildOpenAISystemPrompt, computerToolExecutors, computerTools, coordinateSystem$2 as coordinateSystem, createCuaActionSchema as createActionSchema, openaiResponsesStoreOnPayload, providerModule$2 as providerModule };
457
+ }
458
+ declare function coordinateSystem$2(): ComputerToolCoordinateSystem;
459
+ declare const OPENAI_COMPUTER_INSTRUCTIONS = "You control a Kernel cloud browser through individual browser tools. Use the available tools for browser interaction and request explicit url, cursor_position, or screenshot reads when you need updated state.";
460
+ declare function buildOpenAISystemPrompt(opts?: {
461
+ suffix?: string;
462
+ }): string;
463
+ declare function openaiResponsesStoreOnPayload(payload: unknown): unknown | undefined;
464
+ declare const providerModule$2: {
465
+ toolDefinitions: typeof computerTools;
466
+ toolExecutors: typeof computerToolExecutors;
467
+ coordinateSystem: typeof coordinateSystem$2;
468
+ buildSystemPrompt: typeof buildOpenAISystemPrompt;
469
+ onPayload: typeof openaiResponsesStoreOnPayload;
470
+ };
471
+ declare namespace index_d_exports$3 {
472
+ export { ComputerToolsOptions, TZAFON_COMPUTER_INSTRUCTIONS, CUA_ACTION_TYPES as TZAFON_CUA_ACTION_TYPES, TZAFON_RESPONSES_API, CuaAction as TzafonAction, TzafonCanonicalAction, TzafonResponsesOptions, buildTzafonSystemPrompt, computerToolExecutors, computerTools, coordinateSystem$1 as coordinateSystem, createCuaActionSchema as createActionSchema, providerModule$1 as providerModule, streamSimpleTzafonResponses, streamTzafonResponses, toCanonicalActions$1 as toCanonicalActions, tzafonComputerUseOnPayload, tzafonToolCallId };
473
+ }
474
+ declare function coordinateSystem$1(): ComputerToolCoordinateSystem;
475
+ declare const TZAFON_COMPUTER_INSTRUCTIONS = "You control a Kernel cloud browser through individual browser tools. Include screenshot or URL reads when you need updated state.";
476
+ /** Build the default system prompt used with Tzafon CUA models. */
477
+ declare function buildTzafonSystemPrompt(opts?: {
478
+ suffix?: string;
479
+ }): string;
480
+ declare const providerModule$1: {
481
+ toolDefinitions: typeof computerTools;
482
+ toolExecutors: typeof computerToolExecutors;
483
+ coordinateSystem: typeof coordinateSystem$1;
484
+ buildSystemPrompt: typeof buildTzafonSystemPrompt;
485
+ onPayload: typeof tzafonComputerUseOnPayload;
486
+ };
487
+ //#endregion
488
+ //#region src/providers/yutori/actions.d.ts
489
+ /**
490
+ * Native Yutori Navigator n1.5 tool-set ids.
491
+ *
492
+ * Source of truth:
493
+ * - https://docs.yutori.com/reference/n1-5
494
+ * - https://docs.yutori.com/llm-quickstart.md
495
+ */
496
+ declare const YUTORI_N15_CORE_TOOL_SET = "browser_tools_core-20260403";
497
+ declare const YUTORI_N15_EXPANDED_TOOL_SET = "browser_tools_expanded-20260403";
498
+ /**
499
+ * DOM/ref-backed Navigator n1.5 actions. We intentionally disable these until
500
+ * CuaAgent has the ref/DOM execution path that Yutori documents for the
501
+ * expanded tool set.
502
+ */
503
+ declare const YUTORI_N15_EXPANDED_ACTION_TYPES: readonly ["extract_elements", "find", "set_element_value", "execute_js"];
504
+ /**
505
+ * Navigator n1's fixed legacy browser action space.
506
+ *
507
+ * Source of truth: https://docs.yutori.com/reference/n1
508
+ */
509
+ declare const YUTORI_N1_ACTION_TYPES: readonly ["left_click", "double_click", "right_click", "triple_click", "type", "key_press", "scroll", "hover", "drag", "goto_url", "go_back", "refresh", "wait"];
510
+ /**
511
+ * Navigator n1.5 core visual action space. These are the actions available
512
+ * when `tool_set` is `browser_tools_core-20260403`, which keeps CuaAgent in the
513
+ * pure screenshot/coordinate path and avoids DOM refs.
514
+ *
515
+ * Source of truth: https://docs.yutori.com/reference/n1-5
516
+ */
517
+ declare const YUTORI_N15_CORE_ACTION_TYPES: readonly ["left_click", "double_click", "triple_click", "middle_click", "right_click", "mouse_move", "mouse_down", "mouse_up", "drag", "scroll", "type", "key_press", "hold_key", "goto_url", "go_back", "go_forward", "refresh", "wait"];
518
+ declare const YUTORI_N15_ACTION_TYPES: readonly ["left_click", "double_click", "triple_click", "middle_click", "right_click", "mouse_move", "mouse_down", "mouse_up", "drag", "scroll", "type", "key_press", "hold_key", "goto_url", "go_back", "go_forward", "refresh", "wait", "extract_elements", "find", "set_element_value", "execute_js"];
519
+ /**
520
+ * Canonical CUA action types Yutori's native actions normalize into. These are
521
+ * the tool-call names {@link streamYutori} emits and the local executors
522
+ * CuaAgent installs for Yutori models.
523
+ */
524
+ declare const YUTORI_CUA_ACTION_TYPES: readonly ["click", "double_click", "mouse_down", "mouse_up", "type", "keypress", "scroll", "move", "drag", "wait", "goto", "back", "forward"];
525
+ type YutoriCanonicalActionType = (typeof YUTORI_CUA_ACTION_TYPES)[number];
526
+ /** Canonical CUA action shape emitted for Yutori models. */
527
+ type YutoriAction = Extract<CuaAction, {
528
+ type: YutoriCanonicalActionType;
529
+ }>;
530
+ type YutoriN1ActionType = (typeof YUTORI_N1_ACTION_TYPES)[number];
531
+ type YutoriN15CoreActionType = (typeof YUTORI_N15_CORE_ACTION_TYPES)[number];
532
+ type YutoriN15ExpandedActionType = (typeof YUTORI_N15_EXPANDED_ACTION_TYPES)[number];
533
+ type YutoriNativeActionType = YutoriN1ActionType | YutoriN15CoreActionType | YutoriN15ExpandedActionType;
534
+ /** Build the TypeBox schema for Yutori-supported canonical browser actions. */
535
+ declare function createActionSchema(actions?: readonly CuaActionType[]): TSchema;
536
+ /**
537
+ * Build local mirrors of the canonical action tools Yutori models call.
538
+ *
539
+ * These definitions are never sent to the API: `streamYutori` strips them from
540
+ * the outbound payload and selects Yutori's native `tool_set` instead, then
541
+ * normalizes the model's native tool calls back into these canonical names.
542
+ * Install them locally so the normalized calls have matching executors —
543
+ * `providerModule.toolDefinitions()` is intentionally `[]`. Pass `actions` to
544
+ * mirror only a supported subset, such as `["click"]`.
545
+ */
546
+ declare function computerTools$1(options?: ComputerToolsOptions): Tool[];
547
+ /** Build the local execution adapters used by CuaAgent and CuaAgentHarness. */
548
+ declare function computerToolExecutors$1(options?: ComputerToolsOptions): CuaToolExecutorSpec[];
549
+ declare function yutoriToolSetForModel(modelId: string): typeof YUTORI_N15_CORE_TOOL_SET | undefined;
550
+ declare function yutoriNativeActionsForModel(modelId: string): readonly YutoriNativeActionType[];
551
+ declare function toCanonicalActions(name: string, args: Record<string, unknown>): CuaAction[] | undefined;
552
+ declare namespace index_d_exports$4 {
553
+ export { ComputerToolsOptions, YUTORI_CHAT_COMPLETIONS_API, YUTORI_COMPUTER_INSTRUCTIONS, YUTORI_CUA_ACTION_TYPES, YUTORI_N15_ACTION_TYPES, YUTORI_N15_CORE_ACTION_TYPES, YUTORI_N15_CORE_TOOL_SET, YUTORI_N15_EXPANDED_ACTION_TYPES, YUTORI_N15_EXPANDED_TOOL_SET, YUTORI_N1_ACTION_TYPES, YutoriAction, YutoriN15CoreActionType, YutoriN15ExpandedActionType, YutoriN1ActionType, YutoriNativeActionType, YutoriOptions, buildYutoriSystemPrompt, computerToolExecutors$1 as computerToolExecutors, computerTools$1 as computerTools, coordinateSystem, createActionSchema, providerModule, streamSimpleYutori, streamYutori, toCanonicalActions, yutoriCuaOnPayload, yutoriNativeActionsForModel, yutoriNativeToolSetOnPayload, yutoriToolSetForModel };
554
+ }
555
+ declare function coordinateSystem(): ComputerToolCoordinateSystem;
556
+ declare const YUTORI_COMPUTER_INSTRUCTIONS = "";
557
+ declare function buildYutoriSystemPrompt(opts?: {
558
+ suffix?: string;
559
+ }): string;
560
+ declare const providerModule: {
561
+ toolDefinitions: () => never[];
562
+ toolExecutors: typeof computerToolExecutors$1;
563
+ coordinateSystem: typeof coordinateSystem;
564
+ buildSystemPrompt: typeof buildYutoriSystemPrompt;
565
+ onPayload: typeof yutoriCuaOnPayload;
566
+ screenshot: {
567
+ appendToLatestMessage: true;
568
+ transform: {
569
+ width: number;
570
+ height: number;
571
+ format: "webp";
572
+ quality: number;
573
+ };
574
+ };
575
+ };
576
+ //#endregion
577
+ export { CUA_ACTION_TYPES, CUA_BATCH_TOOL_DESCRIPTION, CUA_BATCH_TOOL_NAME, CUA_MODEL_ANNOTATIONS, CUA_NAVIGATION_TOOL_DESCRIPTION, CUA_NAVIGATION_TOOL_NAME, CUA_PROVIDERS, ComputerToolCoordinateSystem, ComputerToolsOptions, CuaAction, CuaActionBack, CuaActionClick, CuaActionCursorPosition, CuaActionDoubleClick, CuaActionDrag, CuaActionForward, CuaActionGoto, CuaActionKeypress, CuaActionMouseDown, CuaActionMouseUp, CuaActionMove, CuaActionSchema, CuaActionScreenshot, CuaActionScroll, CuaActionType, CuaActionTypeText, CuaActionUrl, CuaActionWait, CuaBatchInput, CuaBatchSchema, CuaDragMouseButton, CuaModelAnnotation, CuaModelInfo, CuaModelMatch, CuaModelRef, CuaMouseButton, CuaNavigationInput, CuaNavigationSchema, CuaPayloadContext, CuaPayloadHook, CuaProvider, CuaProviderModule, CuaRuntimeSpec, CuaRuntimeSpecInput, CuaScreenshotSpec, CuaScreenshotTransformSpec, CuaToolExecutorSpec, index_d_exports as anthropic, canonicalToolCallArguments, canonicalToolCallName, computerToolExecutors, computerTools, createCuaActionSchema, createCuaActionToolDefinitions, createCuaActionToolExecutors, createCuaBatchSchema, createCuaBatchToolDefinition, createCuaBatchToolExecutor, createCuaNavigationToolDefinition, cuaApiKeyEnvVarsForProvider, findCuaAnnotation, formatCuaModelRef, index_d_exports$1 as gemini, getCuaEnvApiKey, getCuaEnvApiKeyForModel, getCuaModel, isCuaProvider, listCuaModels, normalizeGotoUrl, index_d_exports$2 as openai, parseCuaModelRef, providerForModel, registerCuaProviders, requireCuaEnvApiKey, requireCuaEnvApiKeyForModel, resolveCuaRuntimeSpec, index_d_exports$3 as tzafon, index_d_exports$4 as yutori };