@onkernel/cua-ai 0.0.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +229 -0
  3. package/dist/api-keys.d.ts +8 -0
  4. package/dist/api-keys.d.ts.map +1 -0
  5. package/dist/api-keys.js +48 -0
  6. package/dist/api-keys.js.map +1 -0
  7. package/dist/index.d.ts +11 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +13 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/models.d.ts +33 -0
  12. package/dist/models.d.ts.map +1 -0
  13. package/dist/models.js +159 -0
  14. package/dist/models.js.map +1 -0
  15. package/dist/providers/anthropic/index.d.ts +10 -0
  16. package/dist/providers/anthropic/index.d.ts.map +1 -0
  17. package/dist/providers/anthropic/index.js +16 -0
  18. package/dist/providers/anthropic/index.js.map +1 -0
  19. package/dist/providers/common.d.ts +111 -0
  20. package/dist/providers/common.d.ts.map +1 -0
  21. package/dist/providers/common.js +138 -0
  22. package/dist/providers/common.js.map +1 -0
  23. package/dist/providers/gemini/index.d.ts +11 -0
  24. package/dist/providers/gemini/index.d.ts.map +1 -0
  25. package/dist/providers/gemini/index.js +14 -0
  26. package/dist/providers/gemini/index.js.map +1 -0
  27. package/dist/providers/openai/index.d.ts +8 -0
  28. package/dist/providers/openai/index.d.ts.map +1 -0
  29. package/dist/providers/openai/index.js +22 -0
  30. package/dist/providers/openai/index.js.map +1 -0
  31. package/dist/providers/tzafon/index.d.ts +12 -0
  32. package/dist/providers/tzafon/index.d.ts.map +1 -0
  33. package/dist/providers/tzafon/index.js +18 -0
  34. package/dist/providers/tzafon/index.js.map +1 -0
  35. package/dist/providers/tzafon/provider.d.ts +8 -0
  36. package/dist/providers/tzafon/provider.d.ts.map +1 -0
  37. package/dist/providers/tzafon/provider.js +234 -0
  38. package/dist/providers/tzafon/provider.js.map +1 -0
  39. package/dist/providers/yutori/index.d.ts +12 -0
  40. package/dist/providers/yutori/index.d.ts.map +1 -0
  41. package/dist/providers/yutori/index.js +23 -0
  42. package/dist/providers/yutori/index.js.map +1 -0
  43. package/dist/providers/yutori/provider.d.ts +9 -0
  44. package/dist/providers/yutori/provider.d.ts.map +1 -0
  45. package/dist/providers/yutori/provider.js +307 -0
  46. package/dist/providers/yutori/provider.js.map +1 -0
  47. package/dist/providers.d.ts +6 -0
  48. package/dist/providers.d.ts.map +1 -0
  49. package/dist/providers.js +26 -0
  50. package/dist/providers.js.map +1 -0
  51. package/dist/runtime-spec.d.ts +29 -0
  52. package/dist/runtime-spec.d.ts.map +1 -0
  53. package/dist/runtime-spec.js +58 -0
  54. package/dist/runtime-spec.js.map +1 -0
  55. package/examples/quickstart.ts +59 -0
  56. package/examples/screenshot.png +0 -0
  57. package/package.json +48 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Provider-qualified CUA model catalog with support annotations and curated overrides.
6
+ - Unified runtime-spec resolution for provider defaults (tools, prompts, payload middleware).
7
+ - Registers CUA provider adapters and exports canonical computer-use schemas/tool definitions.
package/README.md ADDED
@@ -0,0 +1,229 @@
1
+ # `@onkernel/cua-ai`
2
+
3
+ Extension of [`@earendil-works/pi-ai`](https://www.npmjs.com/package/@earendil-works/pi-ai)'s
4
+ unified LLM API with computer-use specific models, providers, and tool schemas
5
+ for building CUA agents on Kernel.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @onkernel/cua-ai
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```ts
16
+ import { readFile } from "node:fs/promises";
17
+ import { complete, getCuaModel, openai } from "@onkernel/cua-ai";
18
+
19
+ const screenshot = await readFile("examples/screenshot.png");
20
+
21
+ const model = getCuaModel("openai:gpt-5.5");
22
+
23
+ const response = await complete(model, {
24
+ systemPrompt: "You are a browser automation agent.",
25
+ messages: [
26
+ {
27
+ role: "user",
28
+ content: [
29
+ { type: "text", text: "Click the Login button in this screenshot." },
30
+ { type: "image", data: screenshot.toString("base64"), mimeType: "image/png" },
31
+ ],
32
+ timestamp: Date.now(),
33
+ },
34
+ ],
35
+ tools: openai.createComputerToolDefinitions({ actions: ["click"] }),
36
+ });
37
+
38
+ for (const block of response.content) {
39
+ if (block.type === "toolCall" && block.name === "click_mouse") {
40
+ console.log("click:", block.arguments);
41
+ }
42
+ }
43
+ ```
44
+
45
+ ## Core Concepts
46
+
47
+ `@onkernel/cua-ai` re-exports the core primitives of
48
+ [`@earendil-works/pi-ai`](https://github.com/earendil-works/pi/tree/main/packages/ai):
49
+ `Model`, `Context`, `Message`, `Tool`, `complete`, `stream`, `completeSimple`,
50
+ `streamSimple`, `Type`, `Static`, `TSchema`, and the event/validation helpers
51
+ that pi-ai exposes. Some familiarity with pi-ai is assumed; Kernel adds the
52
+ computer-use model catalog and provider/tool metadata.
53
+
54
+ ### Model Refs
55
+
56
+ `getCuaModel()` accepts only provider-qualified model refs of the form
57
+ `<provider>:<model-id>`:
58
+
59
+ ```ts
60
+ getCuaModel("openai:gpt-5.5");
61
+ getCuaModel("anthropic:claude-opus-4-7");
62
+ getCuaModel("google:gemini-2.5-computer-use-preview-10-2025");
63
+ getCuaModel("tzafon:tzafon.northstar-cua-fast");
64
+ getCuaModel("yutori:n1.5-latest");
65
+ ```
66
+
67
+ `getCuaModel(ref)` returns a pi-ai `Model<Api>` you can pass to `complete()`
68
+ or `stream()`.
69
+
70
+ See [`docs/supported-models.md`](./docs/supported-models.md) for the current
71
+ list of CUA-supporting models per provider.
72
+
73
+ ### CuaProvider
74
+
75
+ `CuaProvider` is the string union of provider IDs this package targets:
76
+
77
+ ```ts
78
+ type CuaProvider = "openai" | "anthropic" | "google" | "tzafon" | "yutori";
79
+ ```
80
+
81
+ The IDs match pi-ai's `Model.provider` values exactly. `providerForModel(model)`
82
+ narrows a pi-ai `Model<Api>` to a `CuaProvider`.
83
+
84
+ ### Listing Models
85
+
86
+ `listCuaModels(provider?)` returns every CUA-supporting model, optionally
87
+ filtered to one provider:
88
+
89
+ ```ts
90
+ interface CuaModelInfo {
91
+ ref: CuaModelRef;
92
+ provider: CuaProvider;
93
+ model: string;
94
+ name: string;
95
+ }
96
+ ```
97
+
98
+ ### Exports
99
+
100
+ Top-level exports:
101
+
102
+ - `getCuaModel(ref: CuaModelRef): Model<Api>`
103
+ - `listCuaModels(provider?: CuaProvider): CuaModelInfo[]`
104
+ - `providerForModel(model: Model<Api>): CuaProvider`
105
+ - `resolveCuaRuntimeSpec(input: CuaModelRef | Model<Api>): CuaRuntimeSpec`
106
+ - `CUA_PROVIDERS: readonly CuaProvider[]`
107
+ - `CuaBatchSchema`, `CuaActionSchema`, `CuaNavigationSchema` TypeBox schemas
108
+ - `createCuaActionSchema(actions?)`, `createCuaBatchSchema(actions?)`
109
+
110
+ `resolveCuaRuntimeSpec()` centralizes provider-specific defaults for
111
+ runtime consumers:
112
+
113
+ - canonical provider id
114
+ - canonical CUA tool definitions
115
+ - default system prompt text
116
+ - optional provider payload middleware (for protocol quirks)
117
+
118
+ Provider namespaces expose `createComputerToolDefinitions({ actions? })` for
119
+ building model-facing pi-ai `Tool[]` definitions. Omit `actions` for the
120
+ provider's default computer tool set, or pass an action subset to narrow the
121
+ schema for a single `complete()` call:
122
+
123
+ ```ts
124
+ import { openai } from "@onkernel/cua-ai";
125
+
126
+ const allComputerTools = openai.createComputerToolDefinitions();
127
+ const clickOnlyTools = openai.createComputerToolDefinitions({ actions: ["click"] });
128
+ ```
129
+
130
+ Every provider namespace synthesizes a `batch_computer_actions` tool definition.
131
+ That gives models a consistent way to plan ordered browser actions even when the
132
+ provider's native computer-use API has a different shape. Provider namespaces
133
+ are still used so the definitions can diverge over time where provider protocol
134
+ differences matter.
135
+
136
+ Provider namespaces also expose `COMPUTER_TOOL_COORDINATES`, which describes
137
+ the coordinates the provider's computer tool calls are expected to emit:
138
+
139
+ ```ts
140
+ openai.COMPUTER_TOOL_COORDINATES
141
+ // { type: "pixel" }
142
+
143
+ gemini.COMPUTER_TOOL_COORDINATES
144
+ // { type: "normalized", range: [0, 999] }
145
+ ```
146
+
147
+ Current coordinate contracts:
148
+
149
+ - `openai`: pixel coordinates
150
+ - `anthropic`: pixel coordinates
151
+ - `gemini`: normalized coordinates in the 0-999 range ([source](https://ai.google.dev/gemini-api/docs/computer-use))
152
+ - `yutori`: normalized coordinates in the 0-1000 range ([source](https://docs.yutori.com/reference/navigator), [SDK helper](https://github.com/yutori-ai/yutori-sdk-python/blob/main/yutori/navigator/coordinates.py))
153
+ - `tzafon`: normalized coordinates in the 0-999 range ([source](https://docs.lightcone.ai/guides/coordinates/), [model card](https://huggingface.co/Tzafon/Northstar-CUA-Fast))
154
+
155
+ The action vocabulary is intentionally provider-neutral and OpenAI-shaped
156
+ because it maps cleanly to most browser computer-use APIs:
157
+
158
+ ```ts
159
+ type CuaAction =
160
+ | CuaActionClick
161
+ | CuaActionDoubleClick
162
+ | CuaActionMouseDown
163
+ | CuaActionMouseUp
164
+ | CuaActionTypeText
165
+ | CuaActionKeypress
166
+ | CuaActionScroll
167
+ | CuaActionMove
168
+ | CuaActionDrag
169
+ | CuaActionWait
170
+ | CuaActionScreenshot
171
+ | CuaActionGoto
172
+ | CuaActionBack
173
+ | CuaActionForward
174
+ | CuaActionUrl
175
+ | CuaActionCursorPosition;
176
+ ```
177
+
178
+ For example:
179
+
180
+ ```ts
181
+ type CuaActionClick = {
182
+ type: "click";
183
+ x: number;
184
+ y: number;
185
+ button?: string;
186
+ hold_keys?: string[];
187
+ };
188
+
189
+ type CuaActionGoto = {
190
+ type: "goto";
191
+ url: string;
192
+ };
193
+ ```
194
+
195
+ The provider namespace `createComputerToolDefinitions()` emits a
196
+ `batch_computer_actions` tool whose input is:
197
+
198
+ ```ts
199
+ type CuaBatchInput = {
200
+ actions: CuaAction[];
201
+ };
202
+ ```
203
+
204
+ The model can plan several writes and reads in one call. Read actions such as
205
+ `screenshot`, `url`, and `cursor_position` can be interleaved with writes so
206
+ your executor can return fresh state in the same order.
207
+
208
+ When `actions` is omitted, the OpenAI namespace also emits a `computer_use_extra`
209
+ navigation tool whose input is:
210
+
211
+ ```ts
212
+ type CuaNavigationInput = {
213
+ action: "goto" | "back" | "forward" | "url";
214
+ url?: string;
215
+ };
216
+ ```
217
+
218
+ Provider namespaces:
219
+
220
+ - `openai`: `createComputerToolDefinitions`, `COMPUTER_TOOL_COORDINATES`, OpenAI CUA action schemas, and `OPENAI_BATCH_INSTRUCTIONS`
221
+ - `anthropic`: `createComputerToolDefinitions`, `COMPUTER_TOOL_COORDINATES`, prompt helpers, and CUA batch schema aliases
222
+ - `gemini`: `createComputerToolDefinitions`, `COMPUTER_TOOL_COORDINATES`, prompt helpers, and CUA batch schema aliases
223
+ - `tzafon`: `createComputerToolDefinitions`, `COMPUTER_TOOL_COORDINATES`, prompt helpers, and local `tzafon-responses` stream adapter
224
+ - `yutori`: Yutori prompt helpers, local `yutori-chat-completions` stream
225
+ adapter, `createComputerToolDefinitions`, `COMPUTER_TOOL_COORDINATES`, and
226
+ `yutoriBuiltinToolsOnPayload`
227
+
228
+ This package does not execute browser actions. Use `@onkernel/cua-agent` when
229
+ you want model tool calls executed against a Kernel browser.
@@ -0,0 +1,8 @@
1
+ import type { Api, Model } from "@earendil-works/pi-ai";
2
+ import { type CuaModelRef } from "./models.js";
3
+ export declare function cuaApiKeyEnvVarsForProvider(provider: string): readonly string[];
4
+ export declare function getCuaEnvApiKey(provider: string): string | undefined;
5
+ export declare function requireCuaEnvApiKey(provider: string): string;
6
+ export declare function getCuaEnvApiKeyForModel(input: CuaModelRef | Model<Api>): string | undefined;
7
+ export declare function requireCuaEnvApiKeyForModel(input: CuaModelRef | Model<Api>): string;
8
+ //# sourceMappingURL=api-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../src/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAsC,KAAK,WAAW,EAAoB,MAAM,UAAU,CAAC;AAiBlG,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAK/E;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMpE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,SAAS,CAG3F;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAGnF"}
@@ -0,0 +1,48 @@
1
+ import { parseCuaModelRef, providerForModel } from "./models";
2
+ /**
3
+ * Environment variables accepted for each CUA provider.
4
+ *
5
+ * This mirrors pi-ai's approach: model lookup is pure, while auth is resolved
6
+ * when streaming. These helpers let callers share one readable convention for
7
+ * explicit `getApiKey` wiring (especially useful for `google` vs `gemini`).
8
+ */
9
+ const CUA_PROVIDER_API_KEY_ENV_VARS = {
10
+ openai: ["OPENAI_API_KEY"],
11
+ anthropic: ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
12
+ google: ["GOOGLE_API_KEY", "GEMINI_API_KEY"],
13
+ tzafon: ["TZAFON_API_KEY"],
14
+ yutori: ["YUTORI_API_KEY"],
15
+ };
16
+ export function cuaApiKeyEnvVarsForProvider(provider) {
17
+ if (provider === "gemini") {
18
+ return CUA_PROVIDER_API_KEY_ENV_VARS.google;
19
+ }
20
+ return CUA_PROVIDER_API_KEY_ENV_VARS[provider] ?? [];
21
+ }
22
+ export function getCuaEnvApiKey(provider) {
23
+ for (const envVar of cuaApiKeyEnvVarsForProvider(provider)) {
24
+ const value = process.env[envVar];
25
+ if (value?.trim())
26
+ return value;
27
+ }
28
+ return undefined;
29
+ }
30
+ export function requireCuaEnvApiKey(provider) {
31
+ const apiKey = getCuaEnvApiKey(provider);
32
+ if (apiKey)
33
+ return apiKey;
34
+ const envVars = cuaApiKeyEnvVarsForProvider(provider);
35
+ if (envVars.length === 0) {
36
+ throw new Error(`No known API key environment variables for provider "${provider}"`);
37
+ }
38
+ throw new Error(`Missing API key for "${provider}". Set one of: ${envVars.join(", ")}`);
39
+ }
40
+ export function getCuaEnvApiKeyForModel(input) {
41
+ const provider = typeof input === "string" ? parseCuaModelRef(input).provider : providerForModel(input);
42
+ return getCuaEnvApiKey(provider);
43
+ }
44
+ export function requireCuaEnvApiKeyForModel(input) {
45
+ const provider = typeof input === "string" ? parseCuaModelRef(input).provider : providerForModel(input);
46
+ return requireCuaEnvApiKey(provider);
47
+ }
48
+ //# sourceMappingURL=api-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../src/api-keys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAsC,MAAM,UAAU,CAAC;AAElG;;;;;;GAMG;AACH,MAAM,6BAA6B,GAA2C;IAC7E,MAAM,EAAE,CAAC,gBAAgB,CAAC;IAC1B,SAAS,EAAE,CAAC,uBAAuB,EAAE,mBAAmB,CAAC;IACzD,MAAM,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,MAAM,EAAE,CAAC,gBAAgB,CAAC;IAC1B,MAAM,EAAE,CAAC,gBAAgB,CAAC;CAC1B,CAAC;AAEF,MAAM,UAAU,2BAA2B,CAAC,QAAgB;IAC3D,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,6BAA6B,CAAC,MAAM,CAAC;IAC7C,CAAC;IACD,OAAO,6BAA6B,CAAC,QAAsD,CAAC,IAAI,EAAE,CAAC;AACpG,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC/C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/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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,uBAAuB,CAAC;AAEtC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,SAAS,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import { registerCuaProviders } from "./providers";
2
+ export * from "@earendil-works/pi-ai";
3
+ export * from "./models";
4
+ export * from "./api-keys";
5
+ export * from "./runtime-spec";
6
+ export * from "./providers/common";
7
+ export * as anthropic from "./providers/anthropic/index";
8
+ export * as gemini from "./providers/gemini/index";
9
+ export * as openai from "./providers/openai/index";
10
+ export * as tzafon from "./providers/tzafon/index";
11
+ export * as yutori from "./providers/yutori/index";
12
+ registerCuaProviders();
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AAEtC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,SAAS,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAEnD,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { type Api, type Model } from "@earendil-works/pi-ai";
2
+ export type CuaProvider = "openai" | "anthropic" | "google" | "tzafon" | "yutori";
3
+ export type CuaModelRef = `${CuaProvider}:${string}`;
4
+ export interface CuaModelInfo {
5
+ ref: CuaModelRef;
6
+ provider: CuaProvider;
7
+ model: string;
8
+ name: string;
9
+ }
10
+ export declare const CUA_PROVIDERS: readonly CuaProvider[];
11
+ export type CuaModelMatch = {
12
+ readonly kind: "exact";
13
+ readonly id: string;
14
+ } | {
15
+ readonly kind: "family";
16
+ readonly family: string;
17
+ };
18
+ export interface CuaModelAnnotation {
19
+ readonly match: CuaModelMatch;
20
+ readonly source: string;
21
+ }
22
+ export declare const CUA_MODEL_ANNOTATIONS: Record<CuaProvider, readonly CuaModelAnnotation[]>;
23
+ export declare function parseCuaModelRef(ref: string): {
24
+ provider: CuaProvider;
25
+ model: string;
26
+ };
27
+ export declare function formatCuaModelRef(provider: CuaProvider, model: string): CuaModelRef;
28
+ export declare function listCuaModels(provider?: CuaProvider): CuaModelInfo[];
29
+ export declare function getCuaModel(ref: CuaModelRef): Model<Api>;
30
+ export declare function providerForModel(model: Model<Api>): CuaProvider;
31
+ export declare function isCuaProvider(value: string): value is CuaProvider;
32
+ export declare function findCuaAnnotation(provider: CuaProvider, modelId: string): CuaModelAnnotation | undefined;
33
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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BAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,CAUxD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,WAAW,CAK/D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,WAAW,CAEjE;AAMD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAWxG"}
package/dist/models.js ADDED
@@ -0,0 +1,159 @@
1
+ import { getModel, getModels, } from "@earendil-works/pi-ai";
2
+ export const CUA_PROVIDERS = ["openai", "anthropic", "google", "tzafon", "yutori"];
3
+ export const CUA_MODEL_ANNOTATIONS = {
4
+ openai: [
5
+ { match: { kind: "family", family: "gpt-5.4" }, source: "https://developers.openai.com/api/docs/models/gpt-5.4" },
6
+ { match: { kind: "family", family: "gpt-5.5" }, source: "https://developers.openai.com/api/docs/models/gpt-5.5" },
7
+ ],
8
+ anthropic: [
9
+ { match: { kind: "family", family: "claude-3-7-sonnet" }, source: "https://docs.anthropic.com/en/docs/build-with-claude/computer-use" },
10
+ { match: { kind: "family", family: "claude-opus-4" }, source: "https://docs.anthropic.com/en/docs/build-with-claude/computer-use" },
11
+ { match: { kind: "family", family: "claude-sonnet-4" }, source: "https://docs.anthropic.com/en/docs/build-with-claude/computer-use" },
12
+ { match: { kind: "family", family: "claude-haiku-4" }, source: "https://docs.anthropic.com/en/docs/build-with-claude/computer-use" },
13
+ ],
14
+ google: [
15
+ { match: { kind: "exact", id: "gemini-3-flash-preview" }, source: "https://ai.google.dev/gemini-api/docs/computer-use" },
16
+ { match: { kind: "exact", id: "gemini-3-pro-preview" }, source: "https://ai.google.dev/gemini-api/docs/computer-use" },
17
+ { match: { kind: "exact", id: "gemini-2.5-computer-use-preview-10-2025" }, source: "https://ai.google.dev/gemini-api/docs/computer-use" },
18
+ ],
19
+ tzafon: [
20
+ { match: { kind: "exact", id: "tzafon.northstar-cua-fast" }, source: "https://huggingface.co/Tzafon/Northstar-CUA-Fast" },
21
+ ],
22
+ yutori: [
23
+ { match: { kind: "exact", id: "n1-latest" }, source: "https://docs.yutori.com/reference/navigator" },
24
+ { match: { kind: "exact", id: "n1-20260203" }, source: "https://docs.yutori.com/reference/navigator" },
25
+ { match: { kind: "exact", id: "n1.5-latest" }, source: "https://docs.yutori.com/reference/navigator" },
26
+ { match: { kind: "exact", id: "n1.5-20260428" }, source: "https://docs.yutori.com/reference/navigator" },
27
+ ],
28
+ };
29
+ // Models that CUA supports which pi-ai's registry does not yet carry. Each
30
+ // entry is a complete Model<Api> so getCuaModel() can return it directly
31
+ // without synthesizing fields at call time. Add an entry here when a provider
32
+ // ships a new model before pi-ai picks it up — and add a matching annotation
33
+ // in CUA_MODEL_ANNOTATIONS above so the support filter recognizes it.
34
+ const CUA_MODEL_OVERRIDES = {
35
+ openai: [
36
+ cuaModel("openai", "gpt-5.5", "GPT-5.5"),
37
+ cuaModel("openai", "gpt-5.5-2026-04-23", "GPT-5.5 (2026-04-23)"),
38
+ ],
39
+ anthropic: [],
40
+ google: [
41
+ cuaModel("google", "gemini-2.5-computer-use-preview-10-2025", "Gemini 2.5 Computer Use Preview"),
42
+ ],
43
+ tzafon: [
44
+ cuaModel("tzafon", "tzafon.northstar-cua-fast", "Tzafon Northstar CUA Fast"),
45
+ ],
46
+ yutori: [
47
+ cuaModel("yutori", "n1.5-latest", "Yutori Navigator n1.5"),
48
+ cuaModel("yutori", "n1.5-20260428", "Yutori Navigator n1.5 (2026-04-28)"),
49
+ cuaModel("yutori", "n1-latest", "Yutori Navigator n1"),
50
+ cuaModel("yutori", "n1-20260203", "Yutori Navigator n1 (2026-02-03)"),
51
+ ],
52
+ };
53
+ export function parseCuaModelRef(ref) {
54
+ const idx = ref.indexOf(":");
55
+ if (idx <= 0 || idx === ref.length - 1) {
56
+ throw new Error(`CUA model ref must be provider-qualified as "<provider>:<model>"; got "${ref}"`);
57
+ }
58
+ const provider = ref.slice(0, idx);
59
+ const model = ref.slice(idx + 1);
60
+ if (!isCuaProvider(provider)) {
61
+ throw new Error(`unsupported CUA provider "${provider}"`);
62
+ }
63
+ return { provider, model };
64
+ }
65
+ export function formatCuaModelRef(provider, model) {
66
+ return `${provider}:${model}`;
67
+ }
68
+ export function listCuaModels(provider) {
69
+ const providers = provider ? [provider] : [...CUA_PROVIDERS];
70
+ const byRef = new Map();
71
+ for (const p of providers) {
72
+ for (const model of CUA_MODEL_OVERRIDES[p]) {
73
+ const ref = formatCuaModelRef(p, model.id);
74
+ byRef.set(ref, { ref, provider: p, model: model.id, name: model.name });
75
+ }
76
+ for (const model of getModels(p)) {
77
+ if (!supportsCuaProvider(p, model.id))
78
+ continue;
79
+ const ref = formatCuaModelRef(p, model.id);
80
+ if (byRef.has(ref))
81
+ continue;
82
+ byRef.set(ref, {
83
+ ref,
84
+ provider: p,
85
+ model: model.id,
86
+ name: model.name,
87
+ });
88
+ }
89
+ }
90
+ return [...byRef.values()].sort(compareCuaModels);
91
+ }
92
+ export function getCuaModel(ref) {
93
+ const { provider, model: modelId } = parseCuaModelRef(ref);
94
+ if (!supportsCuaProvider(provider, modelId)) {
95
+ throw new Error(`unsupported CUA model "${ref}"`);
96
+ }
97
+ const fromRegistry = getModel(provider, modelId);
98
+ if (fromRegistry)
99
+ return fromRegistry;
100
+ const override = CUA_MODEL_OVERRIDES[provider].find((m) => m.id === modelId);
101
+ if (override)
102
+ return override;
103
+ throw new Error(`CUA model "${ref}" is supported but not registered. Add it to pi-ai (models.dev) or CUA_MODEL_OVERRIDES.`);
104
+ }
105
+ export function providerForModel(model) {
106
+ if (!isCuaProvider(model.provider)) {
107
+ throw new Error(`unsupported CUA model provider "${model.provider}"`);
108
+ }
109
+ return model.provider;
110
+ }
111
+ export function isCuaProvider(value) {
112
+ return CUA_PROVIDERS.includes(value);
113
+ }
114
+ function supportsCuaProvider(provider, modelId) {
115
+ return findCuaAnnotation(provider, modelId) !== undefined;
116
+ }
117
+ export function findCuaAnnotation(provider, modelId) {
118
+ const id = modelId.toLowerCase();
119
+ for (const annotation of CUA_MODEL_ANNOTATIONS[provider]) {
120
+ if (annotation.match.kind === "exact") {
121
+ if (id === annotation.match.id.toLowerCase())
122
+ return annotation;
123
+ }
124
+ else {
125
+ const family = annotation.match.family.toLowerCase();
126
+ if (id === family || id.startsWith(`${family}-`))
127
+ return annotation;
128
+ }
129
+ }
130
+ return undefined;
131
+ }
132
+ function cuaModel(provider, id, name) {
133
+ const base = {
134
+ id,
135
+ name,
136
+ provider,
137
+ reasoning: provider === "openai" || provider === "anthropic" || provider === "google",
138
+ input: ["text", "image"],
139
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
140
+ };
141
+ switch (provider) {
142
+ case "openai":
143
+ return { ...base, api: "openai-responses", baseUrl: "https://api.openai.com/v1", contextWindow: 400_000, maxTokens: 32_768 };
144
+ case "anthropic":
145
+ return { ...base, api: "anthropic-messages", baseUrl: "https://api.anthropic.com", contextWindow: 200_000, maxTokens: 64_000 };
146
+ case "google":
147
+ return { ...base, api: "google-generative-ai", baseUrl: "https://generativelanguage.googleapis.com/v1beta", contextWindow: 1_048_576, maxTokens: 65_536 };
148
+ case "tzafon":
149
+ return { ...base, api: "tzafon-responses", baseUrl: "https://api.lightcone.ai", contextWindow: 128_000, maxTokens: 4_096 };
150
+ case "yutori":
151
+ return { ...base, api: "yutori-chat-completions", baseUrl: "https://api.yutori.com/v1", contextWindow: 128_000, maxTokens: 4_096 };
152
+ }
153
+ }
154
+ function compareCuaModels(a, b) {
155
+ if (a.provider !== b.provider)
156
+ return CUA_PROVIDERS.indexOf(a.provider) - CUA_PROVIDERS.indexOf(b.provider);
157
+ return a.model.localeCompare(b.model);
158
+ }
159
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OA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E,GAAG,EAAE,yBAAyB,EAAE,OAAO,EAAE,2BAA2B,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC;IACnJ,CAAC;AACF,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAe,EAAE,CAAe;IACzD,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;QAAE,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC5G,OAAO,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { CUA_ACTION_TYPES as ANTHROPIC_CUA_ACTION_TYPES, CUA_BATCH_TOOL_DESCRIPTION as ANTHROPIC_BATCH_DESCRIPTION, CUA_BATCH_TOOL_NAME as ANTHROPIC_BATCH_TOOL_NAME, createComputerToolDefinitions, createCuaActionSchema as createActionSchema, createCuaBatchSchema as createBatchSchema, CuaBatchSchema as AnthropicBatchSchema, } from "../common.js";
2
+ export type { CuaAction as AnthropicAction, CreateComputerToolDefinitionsOptions, CuaBatchInput as AnthropicBatchInput, } from "../common.js";
3
+ export declare const COMPUTER_TOOL_COORDINATES: {
4
+ readonly type: "pixel";
5
+ };
6
+ export declare const ANTHROPIC_COMPUTER_INSTRUCTIONS = "You control a Kernel cloud browser through computer-use tools. Use batched actions for predictable browser interaction, keyboard navigation where possible, and explicit screenshot or url reads when you need to inspect state.";
7
+ export declare function buildAnthropicSystemPrompt(opts?: {
8
+ suffix?: string;
9
+ }): string;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/anthropic/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,gBAAgB,IAAI,0BAA0B,EAC9C,0BAA0B,IAAI,2BAA2B,EACzD,mBAAmB,IAAI,yBAAyB,EAChD,6BAA6B,EAC7B,qBAAqB,IAAI,kBAAkB,EAC3C,oBAAoB,IAAI,iBAAiB,EACzC,cAAc,IAAI,oBAAoB,GACtC,MAAM,WAAW,CAAC;AACnB,YAAY,EACX,SAAS,IAAI,eAAe,EAC5B,oCAAoC,EACpC,aAAa,IAAI,mBAAmB,GACpC,MAAM,WAAW,CAAC;AAWnB,eAAO,MAAM,yBAAyB;;CAAoE,CAAC;AAE3G,eAAO,MAAM,+BAA+B,qOAAqO,CAAC;AAElR,wBAAgB,0BAA0B,CAAC,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAEjF"}
@@ -0,0 +1,16 @@
1
+ export { CUA_ACTION_TYPES as ANTHROPIC_CUA_ACTION_TYPES, CUA_BATCH_TOOL_DESCRIPTION as ANTHROPIC_BATCH_DESCRIPTION, CUA_BATCH_TOOL_NAME as ANTHROPIC_BATCH_TOOL_NAME, createComputerToolDefinitions, createCuaActionSchema as createActionSchema, createCuaBatchSchema as createBatchSchema, CuaBatchSchema as AnthropicBatchSchema, } from "../common.js";
2
+ // Provider-native action vocabulary emitted on `tool_use.input.action`. Latest
3
+ // tool version is `computer_20251124`, which extends earlier dated versions:
4
+ // computer_20241022: key, type, mouse_move, left_click, left_click_drag,
5
+ // right_click, middle_click, double_click, screenshot,
6
+ // cursor_position
7
+ // computer_20250124: + left_mouse_down, left_mouse_up, scroll, hold_key,
8
+ // wait, triple_click
9
+ // computer_20251124: + zoom
10
+ // Source: https://github.com/anthropics/anthropic-quickstarts/blob/main/computer-use-demo/computer_use_demo/tools/computer.py
11
+ export const COMPUTER_TOOL_COORDINATES = { type: "pixel" };
12
+ export const ANTHROPIC_COMPUTER_INSTRUCTIONS = `You control a Kernel cloud browser through computer-use tools. Use batched actions for predictable browser interaction, keyboard navigation where possible, and explicit screenshot or url reads when you need to inspect state.`;
13
+ export function buildAnthropicSystemPrompt(opts = {}) {
14
+ return [ANTHROPIC_COMPUTER_INSTRUCTIONS, opts.suffix].filter(Boolean).join("\n\n");
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/anthropic/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,gBAAgB,IAAI,0BAA0B,EAC9C,0BAA0B,IAAI,2BAA2B,EACzD,mBAAmB,IAAI,yBAAyB,EAChD,6BAA6B,EAC7B,qBAAqB,IAAI,kBAAkB,EAC3C,oBAAoB,IAAI,iBAAiB,EACzC,cAAc,IAAI,oBAAoB,GACtC,MAAM,WAAW,CAAC;AAOnB,+EAA+E;AAC/E,6EAA6E;AAC7E,2EAA2E;AAC3E,4EAA4E;AAC5E,uCAAuC;AACvC,2EAA2E;AAC3E,4CAA4C;AAC5C,8BAA8B;AAC9B,8HAA8H;AAC9H,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkD,CAAC;AAE3G,MAAM,CAAC,MAAM,+BAA+B,GAAG,kOAAkO,CAAC;AAElR,MAAM,UAAU,0BAA0B,CAAC,OAA4B,EAAE;IACxE,OAAO,CAAC,+BAA+B,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACpF,CAAC"}