@onkernel/cua-ai 0.3.0 → 0.3.1
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/CHANGELOG.md +6 -0
- package/README.md +4 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +19 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.1 - 2026-06-23
|
|
4
|
+
|
|
5
|
+
- Add the `playwright_execute` tool definition: `CuaPlaywrightSchema`,
|
|
6
|
+
`CUA_PLAYWRIGHT_TOOL_NAME`, `CUA_PLAYWRIGHT_TOOL_DESCRIPTION`,
|
|
7
|
+
`createCuaPlaywrightToolDefinition()`, and the `CuaPlaywrightInput` type.
|
|
8
|
+
|
|
3
9
|
## 0.3.0 - 2026-06-12
|
|
4
10
|
|
|
5
11
|
- Add `CuaSimpleStreamOptions`: pi-ai `SimpleStreamOptions` plus the
|
package/README.md
CHANGED
|
@@ -309,12 +309,15 @@ definitions and executors; it is forwarded to the provider module's
|
|
|
309
309
|
- `createCuaNavigationToolDefinition()`, `CuaNavigationSchema`,
|
|
310
310
|
`CUA_NAVIGATION_TOOL_NAME` (`"computer_use_extra"`),
|
|
311
311
|
`CUA_NAVIGATION_TOOL_DESCRIPTION`
|
|
312
|
+
- `createCuaPlaywrightToolDefinition()`, `CuaPlaywrightSchema`,
|
|
313
|
+
`CUA_PLAYWRIGHT_TOOL_NAME` (`"playwright_execute"`),
|
|
314
|
+
`CUA_PLAYWRIGHT_TOOL_DESCRIPTION`
|
|
312
315
|
- `canonicalToolCallName(action)`, `canonicalToolCallArguments(action)` — map
|
|
313
316
|
a normalized `CuaAction` back to its tool-call name/arguments
|
|
314
317
|
- `normalizeGotoUrl(value)` — prefix bare hostnames with `https://`
|
|
315
318
|
- Types: `CuaAction` (plus the 16 per-action interfaces), `CuaActionType`,
|
|
316
319
|
`CuaMouseButton`, `CuaDragMouseButton`, `CuaBatchInput`,
|
|
317
|
-
`CuaNavigationInput`, `CuaToolExecutorSpec`, `ComputerToolsOptions`,
|
|
320
|
+
`CuaNavigationInput`, `CuaPlaywrightInput`, `CuaToolExecutorSpec`, `ComputerToolsOptions`,
|
|
318
321
|
`ComputerToolCoordinateSystem`
|
|
319
322
|
|
|
320
323
|
### Provider registration
|
package/dist/index.d.ts
CHANGED
|
@@ -191,10 +191,15 @@ declare const CuaNavigationSchema: Type.TObject<{
|
|
|
191
191
|
action: Type.TUnion<[Type.TLiteral<"goto">, Type.TLiteral<"back">, Type.TLiteral<"forward">, Type.TLiteral<"url">]>;
|
|
192
192
|
url: Type.TOptional<Type.TString>;
|
|
193
193
|
}>;
|
|
194
|
+
declare const CuaPlaywrightSchema: Type.TObject<{
|
|
195
|
+
code: Type.TString;
|
|
196
|
+
timeout_sec: Type.TOptional<Type.TNumber>;
|
|
197
|
+
}>;
|
|
194
198
|
interface CuaBatchInput {
|
|
195
199
|
actions: CuaAction[];
|
|
196
200
|
}
|
|
197
201
|
type CuaNavigationInput = Static<typeof CuaNavigationSchema>;
|
|
202
|
+
type CuaPlaywrightInput = Static<typeof CuaPlaywrightSchema>;
|
|
198
203
|
/** Tool schema plus execution adapter for a browser computer-use tool. */
|
|
199
204
|
interface CuaToolExecutorSpec {
|
|
200
205
|
/** Tool schema installed by CuaAgent/CuaAgentHarness. The name must match the provider tool call name. */
|
|
@@ -209,8 +214,10 @@ interface CuaToolExecutorSpec {
|
|
|
209
214
|
*/
|
|
210
215
|
declare const CUA_BATCH_TOOL_NAME = "computer_batch";
|
|
211
216
|
declare const CUA_NAVIGATION_TOOL_NAME = "computer_use_extra";
|
|
217
|
+
declare const CUA_PLAYWRIGHT_TOOL_NAME = "playwright_execute";
|
|
212
218
|
declare const CUA_BATCH_TOOL_DESCRIPTION: string;
|
|
213
219
|
declare const CUA_NAVIGATION_TOOL_DESCRIPTION = "High-level browser navigation helpers for goto, back, forward, and url.";
|
|
220
|
+
declare const CUA_PLAYWRIGHT_TOOL_DESCRIPTION: string;
|
|
214
221
|
interface ComputerToolsOptions {
|
|
215
222
|
actions?: readonly CuaActionType[];
|
|
216
223
|
}
|
|
@@ -248,6 +255,7 @@ declare function createCuaBatchToolExecutor(actions?: readonly CuaActionType[],
|
|
|
248
255
|
/** Build the provider's default CUA tool execution adapters. */
|
|
249
256
|
declare function computerToolExecutors(options?: ComputerToolsOptions): CuaToolExecutorSpec[];
|
|
250
257
|
declare function createCuaNavigationToolDefinition(): Tool;
|
|
258
|
+
declare function createCuaPlaywrightToolDefinition(): Tool;
|
|
251
259
|
interface CuaScreenshotTransformSpec {
|
|
252
260
|
width: number;
|
|
253
261
|
height: number;
|
|
@@ -582,4 +590,4 @@ declare const providerModule: {
|
|
|
582
590
|
};
|
|
583
591
|
};
|
|
584
592
|
//#endregion
|
|
585
|
-
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, CuaSimpleStreamOptions, 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 };
|
|
593
|
+
export { CUA_ACTION_TYPES, CUA_BATCH_TOOL_DESCRIPTION, CUA_BATCH_TOOL_NAME, CUA_MODEL_ANNOTATIONS, CUA_NAVIGATION_TOOL_DESCRIPTION, CUA_NAVIGATION_TOOL_NAME, CUA_PLAYWRIGHT_TOOL_DESCRIPTION, CUA_PLAYWRIGHT_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, CuaPlaywrightInput, CuaPlaywrightSchema, CuaProvider, CuaProviderModule, CuaRuntimeSpec, CuaRuntimeSpecInput, CuaScreenshotSpec, CuaScreenshotTransformSpec, CuaSimpleStreamOptions, CuaToolExecutorSpec, index_d_exports as anthropic, canonicalToolCallArguments, canonicalToolCallName, computerToolExecutors, computerTools, createCuaActionSchema, createCuaActionToolDefinitions, createCuaActionToolExecutors, createCuaBatchSchema, createCuaBatchToolDefinition, createCuaBatchToolExecutor, createCuaNavigationToolDefinition, createCuaPlaywrightToolDefinition, 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 };
|
package/dist/index.js
CHANGED
|
@@ -126,6 +126,10 @@ const CuaNavigationSchema = Type.Object({
|
|
|
126
126
|
]),
|
|
127
127
|
url: Type.Optional(Type.String())
|
|
128
128
|
}, { additionalProperties: false });
|
|
129
|
+
const CuaPlaywrightSchema = Type.Object({
|
|
130
|
+
code: Type.String({ description: "Playwright/TypeScript to run against the live browser. `page`, `context`, and `browser` are in scope; end with a `return` to send a JSON-serializable value back. Example: \"await page.goto('https://example.com'); return await page.title();\"" }),
|
|
131
|
+
timeout_sec: Type.Optional(Type.Number({ description: "Optional execution timeout in seconds. Default 60, max 300." }))
|
|
132
|
+
}, { additionalProperties: false });
|
|
129
133
|
/**
|
|
130
134
|
* Default name for batch computer-action tools created by
|
|
131
135
|
* {@link createCuaBatchToolDefinition} and the name Anthropic's batch tool
|
|
@@ -133,12 +137,19 @@ const CuaNavigationSchema = Type.Object({
|
|
|
133
137
|
*/
|
|
134
138
|
const CUA_BATCH_TOOL_NAME = "computer_batch";
|
|
135
139
|
const CUA_NAVIGATION_TOOL_NAME = "computer_use_extra";
|
|
140
|
+
const CUA_PLAYWRIGHT_TOOL_NAME = "playwright_execute";
|
|
136
141
|
const CUA_BATCH_TOOL_DESCRIPTION = [
|
|
137
142
|
"Execute multiple computer actions in sequence, including ordered read steps like url(), cursor_position(), and screenshot().",
|
|
138
143
|
"Prefer this tool for predictable browser interaction sequences such as click-then-type, typing a URL, keyboard navigation, drag paths, and mixed write/read batches.",
|
|
139
144
|
"If no explicit read step is included, the tool returns one fresh screenshot after execution."
|
|
140
145
|
].join("\n");
|
|
141
146
|
const CUA_NAVIGATION_TOOL_DESCRIPTION = "High-level browser navigation helpers for goto, back, forward, and url.";
|
|
147
|
+
const CUA_PLAYWRIGHT_TOOL_DESCRIPTION = [
|
|
148
|
+
"Run Playwright/TypeScript directly against the live browser session for steps that are awkward as raw pointer/keyboard actions: precise DOM reads, form fills, data extraction, and waiting on selectors.",
|
|
149
|
+
"`page`, `context`, and `browser` are in scope and the code may `return` a JSON-serializable value, which comes back as the result.",
|
|
150
|
+
"Each call runs in a fresh JS context — local variables do not persist across calls, but the browser session does (navigation, cookies, DOM state carry over via `page`/`context`/`browser`).",
|
|
151
|
+
"No screenshot is returned automatically; request one with a follow-up screenshot action when you need to see the page, rather than calling page.screenshot() inside the code."
|
|
152
|
+
].join("\n");
|
|
142
153
|
/**
|
|
143
154
|
* Build the provider's CUA computer-use tools.
|
|
144
155
|
*
|
|
@@ -211,6 +222,13 @@ function createCuaNavigationToolDefinition() {
|
|
|
211
222
|
parameters: CuaNavigationSchema
|
|
212
223
|
};
|
|
213
224
|
}
|
|
225
|
+
function createCuaPlaywrightToolDefinition() {
|
|
226
|
+
return {
|
|
227
|
+
name: CUA_PLAYWRIGHT_TOOL_NAME,
|
|
228
|
+
description: CUA_PLAYWRIGHT_TOOL_DESCRIPTION,
|
|
229
|
+
parameters: CuaPlaywrightSchema
|
|
230
|
+
};
|
|
231
|
+
}
|
|
214
232
|
//#endregion
|
|
215
233
|
//#region src/providers/tzafon/provider.ts
|
|
216
234
|
const TZAFON_RESPONSES_API = "tzafon-responses";
|
|
@@ -2028,4 +2046,4 @@ function resolveCuaRuntimeSpec(input, options) {
|
|
|
2028
2046
|
//#region src/index.ts
|
|
2029
2047
|
registerCuaProviders();
|
|
2030
2048
|
//#endregion
|
|
2031
|
-
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, CuaActionSchema, CuaBatchSchema, CuaNavigationSchema, anthropic_exports as anthropic, canonicalToolCallArguments, canonicalToolCallName, computerToolExecutors, computerTools, createCuaActionSchema, createCuaActionToolDefinitions, createCuaActionToolExecutors, createCuaBatchSchema, createCuaBatchToolDefinition, createCuaBatchToolExecutor, createCuaNavigationToolDefinition, cuaApiKeyEnvVarsForProvider, findCuaAnnotation, formatCuaModelRef, gemini_exports as gemini, getCuaEnvApiKey, getCuaEnvApiKeyForModel, getCuaModel, isCuaProvider, listCuaModels, normalizeGotoUrl, openai_exports as openai, parseCuaModelRef, providerForModel, registerCuaProviders, requireCuaEnvApiKey, requireCuaEnvApiKeyForModel, resolveCuaRuntimeSpec, tzafon_exports as tzafon, yutori_exports as yutori };
|
|
2049
|
+
export { CUA_ACTION_TYPES, CUA_BATCH_TOOL_DESCRIPTION, CUA_BATCH_TOOL_NAME, CUA_MODEL_ANNOTATIONS, CUA_NAVIGATION_TOOL_DESCRIPTION, CUA_NAVIGATION_TOOL_NAME, CUA_PLAYWRIGHT_TOOL_DESCRIPTION, CUA_PLAYWRIGHT_TOOL_NAME, CUA_PROVIDERS, CuaActionSchema, CuaBatchSchema, CuaNavigationSchema, CuaPlaywrightSchema, anthropic_exports as anthropic, canonicalToolCallArguments, canonicalToolCallName, computerToolExecutors, computerTools, createCuaActionSchema, createCuaActionToolDefinitions, createCuaActionToolExecutors, createCuaBatchSchema, createCuaBatchToolDefinition, createCuaBatchToolExecutor, createCuaNavigationToolDefinition, createCuaPlaywrightToolDefinition, cuaApiKeyEnvVarsForProvider, findCuaAnnotation, formatCuaModelRef, gemini_exports as gemini, getCuaEnvApiKey, getCuaEnvApiKeyForModel, getCuaModel, isCuaProvider, listCuaModels, normalizeGotoUrl, openai_exports as openai, parseCuaModelRef, providerForModel, registerCuaProviders, requireCuaEnvApiKey, requireCuaEnvApiKeyForModel, resolveCuaRuntimeSpec, tzafon_exports as tzafon, yutori_exports as yutori };
|