@withgateway/sdk 0.2.9 → 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/README.md +5 -1
- package/dist/cli.js +3812 -1158
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +3796 -1142
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.d.mts +1 -0
- package/dist/files/index.d.ts +1 -0
- package/dist/files/index.js +1358 -21
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +1356 -13
- package/dist/files/index.mjs.map +1 -1
- package/dist/{index-BO2SNSgy.d.ts → index-CBqbB_0J.d.ts} +95 -46
- package/dist/{index-Cz8Q6Keo.d.mts → index-D-AMnAMa.d.mts} +95 -46
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1942 -177
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1890 -146
- package/dist/index.mjs.map +1 -1
- package/dist/media-CbcAfQvd.d.mts +83 -0
- package/dist/media-CbcAfQvd.d.ts +83 -0
- package/dist/traces/index.d.mts +1 -0
- package/dist/traces/index.d.ts +1 -0
- package/dist/traces/index.js +1355 -18
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +1353 -10
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.d.mts +2 -1
- package/dist/tracing/index.d.ts +2 -1
- package/dist/tracing/index.js +550 -30
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +539 -29
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +648 -80
- package/dist/worlds/index.d.ts +648 -80
- package/dist/worlds/index.js +1875 -145
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +1861 -131
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/gatewaysdk/environment/schema/api.py +43 -62
- package/runtime/gatewaysdk/environment/schema/cast.py +31 -4
- package/runtime/gatewaysdk/environment/schema/grading.py +1 -5
- package/runtime/gatewaysdk/environment/schema/host.py +53 -90
- package/runtime/gatewaysdk/environment/schema/local.py +15 -7
- package/runtime/gatewaysdk/environment/schema/platform.py +1 -7
- package/runtime/gatewaysdk/environment/schema/runtime.py +9 -9
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +3 -3
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +2 -2
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +13 -13
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +2 -1
- package/runtime/gatewaysdk/environment/schema/tasks.py +25 -1
- package/skills/connector-schema-authoring/SKILL.md +3 -3
- package/skills/connector-schema-authoring/connector-worlds.md +12 -5
- package/skills/connector-schema-authoring/world-schema.md +8 -0
- package/skills/world-data-ingestion/SKILL.md +2 -2
- package/skills/worlds-getting-started/SKILL.md +13 -13
- package/skills/worlds-getting-started/references/cli-mcp-map.md +2 -1
package/dist/worlds/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { i as MediaUploader, c as PlatformMethod } from '../media-CbcAfQvd.js';
|
|
2
|
+
export { P as PLATFORM_TIMEOUT_DEFAULT_MS, a as PLATFORM_TIMEOUT_ENV, b as PlatformEndpoint, d as PlatformReply, e as PlatformTransport, T as TransportCause, U as UnreachableError, p as platformTimeoutMs } from '../media-CbcAfQvd.js';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* A HOSTED BROWSER THAT COMES BACK. A World Host session's browser is a pool
|
|
3
6
|
* pod; on the `standard` tier it runs on spot capacity and can be reclaimed
|
|
@@ -90,6 +93,453 @@ declare class BrowserReconnector {
|
|
|
90
93
|
private attempt;
|
|
91
94
|
}
|
|
92
95
|
|
|
96
|
+
/**
|
|
97
|
+
* The provider-neutral action vocabulary every native computer executes.
|
|
98
|
+
* Coordinates are in the MODEL's pixel space; the screen maps them to the page.
|
|
99
|
+
* Twin of `gatewaysdk/native_computer/actions.py`.
|
|
100
|
+
*/
|
|
101
|
+
declare const ACTION_NAMES: readonly ["screenshot", "zoom", "click", "move", "mouse_down", "mouse_up", "drag", "scroll", "type", "key", "hold_key", "wait", "cursor_position", "history"];
|
|
102
|
+
type ActionName = (typeof ACTION_NAMES)[number];
|
|
103
|
+
type Point = [number, number];
|
|
104
|
+
type MouseButton = "left" | "right" | "middle";
|
|
105
|
+
/** Arguments by action:
|
|
106
|
+
* `click` x?, y?, button, count, modifiers · `move` x, y, modifiers? ·
|
|
107
|
+
* `mouse_down`/`mouse_up` button · `drag` path, modifiers ·
|
|
108
|
+
* `scroll` x?, y?, dx, dy, modifiers · `type` text · `key` keys, repeat ·
|
|
109
|
+
* `hold_key` keys, seconds · `wait` seconds · `zoom` region ·
|
|
110
|
+
* `history` direction · `screenshot`/`cursor_position` none. */
|
|
111
|
+
type ActionArgs = {
|
|
112
|
+
x?: number;
|
|
113
|
+
y?: number;
|
|
114
|
+
button?: MouseButton;
|
|
115
|
+
count?: number;
|
|
116
|
+
modifiers?: string[];
|
|
117
|
+
path?: Point[];
|
|
118
|
+
dx?: number;
|
|
119
|
+
dy?: number;
|
|
120
|
+
text?: string;
|
|
121
|
+
keys?: string[];
|
|
122
|
+
repeat?: number;
|
|
123
|
+
seconds?: number;
|
|
124
|
+
region?: [number, number, number, number];
|
|
125
|
+
direction?: "back" | "forward";
|
|
126
|
+
};
|
|
127
|
+
declare class ComputerAction {
|
|
128
|
+
readonly name: ActionName;
|
|
129
|
+
readonly args: ActionArgs;
|
|
130
|
+
constructor(name: ActionName, args?: ActionArgs);
|
|
131
|
+
/** Flat arguments for the browser timeline and the trace: lists become
|
|
132
|
+
* `"x,y"` strings, and typed text is withheld when it went into a
|
|
133
|
+
* credential field. */
|
|
134
|
+
recordArgs(secretText: boolean): Record<string, unknown>;
|
|
135
|
+
}
|
|
136
|
+
/** What an action gave back: a PNG (`screenshot`, `zoom`), a line of text
|
|
137
|
+
* (`cursor_position`), or neither. */
|
|
138
|
+
type ActionResult = {
|
|
139
|
+
image?: Buffer;
|
|
140
|
+
text?: string;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The model's pixel space versus the page's. Unscaled by default; when a
|
|
145
|
+
* provider's image limits (or the caller) ask for a smaller display,
|
|
146
|
+
* screenshots are captured downscaled and coordinates mapped back.
|
|
147
|
+
* Twin of `gatewaysdk/native_computer/display.py`.
|
|
148
|
+
*/
|
|
149
|
+
type Fits = (width: number, height: number) => boolean;
|
|
150
|
+
declare class Display {
|
|
151
|
+
readonly width: number;
|
|
152
|
+
readonly height: number;
|
|
153
|
+
readonly viewportWidth: number;
|
|
154
|
+
readonly viewportHeight: number;
|
|
155
|
+
constructor(width: number, height: number, viewportWidth: number, viewportHeight: number);
|
|
156
|
+
/** `size` when the caller names one; otherwise the largest downscale of the
|
|
157
|
+
* viewport (at most 1:1) that `fits` the provider's limits. */
|
|
158
|
+
static forViewport(viewport: {
|
|
159
|
+
width: number;
|
|
160
|
+
height: number;
|
|
161
|
+
}, size?: [number, number], fits?: Fits): Display;
|
|
162
|
+
/** A caller's display keeps the viewport's shape: screenshots are scaled
|
|
163
|
+
* uniformly, so another aspect ratio would map clicks off the image. */
|
|
164
|
+
private static sized;
|
|
165
|
+
get scaled(): boolean;
|
|
166
|
+
get scale(): number;
|
|
167
|
+
toPage(x: number, y: number): [number, number];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Pixels and keys on a `WorldBrowser` page. Every provider's actions land here
|
|
172
|
+
* as `ComputerAction` values and run as Playwright mouse and keyboard calls.
|
|
173
|
+
* The cursor is tracked in the model's pixel space so a click without
|
|
174
|
+
* coordinates lands where the pointer is. Twin of `native_computer/screen.py`.
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
type CdpSession = {
|
|
178
|
+
send(method: string, params: Record<string, unknown>): Promise<{
|
|
179
|
+
data: string;
|
|
180
|
+
}>;
|
|
181
|
+
detach(): Promise<void>;
|
|
182
|
+
};
|
|
183
|
+
/** The Playwright page surface pixel-level control needs, beyond `BrowserPage`. */
|
|
184
|
+
type NativePage = {
|
|
185
|
+
mouse: {
|
|
186
|
+
move(x: number, y: number, opts?: {
|
|
187
|
+
steps?: number;
|
|
188
|
+
}): Promise<void>;
|
|
189
|
+
click(x: number, y: number, opts?: {
|
|
190
|
+
button?: string;
|
|
191
|
+
clickCount?: number;
|
|
192
|
+
}): Promise<void>;
|
|
193
|
+
down(opts?: {
|
|
194
|
+
button?: string;
|
|
195
|
+
}): Promise<void>;
|
|
196
|
+
up(opts?: {
|
|
197
|
+
button?: string;
|
|
198
|
+
}): Promise<void>;
|
|
199
|
+
wheel(dx: number, dy: number): Promise<void>;
|
|
200
|
+
};
|
|
201
|
+
keyboard: {
|
|
202
|
+
down(key: string): Promise<void>;
|
|
203
|
+
up(key: string): Promise<void>;
|
|
204
|
+
press(key: string): Promise<void>;
|
|
205
|
+
type(text: string): Promise<void>;
|
|
206
|
+
};
|
|
207
|
+
screenshot(opts?: {
|
|
208
|
+
type?: "png";
|
|
209
|
+
}): Promise<Buffer>;
|
|
210
|
+
waitForTimeout(ms: number): Promise<void>;
|
|
211
|
+
goBack(): Promise<unknown>;
|
|
212
|
+
goForward(): Promise<unknown>;
|
|
213
|
+
evaluate(expression: string): Promise<unknown>;
|
|
214
|
+
context(): {
|
|
215
|
+
newCDPSession(page: unknown): Promise<CdpSession>;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
/** The slice of `WorldBrowser` a native computer drives. */
|
|
219
|
+
type ScreenBrowser = {
|
|
220
|
+
readonly page: BrowserPage;
|
|
221
|
+
readonly viewport: {
|
|
222
|
+
width: number;
|
|
223
|
+
height: number;
|
|
224
|
+
};
|
|
225
|
+
act<T>(action: string, args: Record<string, unknown>, fn: () => Promise<T>, onLoss?: "retry" | "report"): Promise<T>;
|
|
226
|
+
settle(): Promise<void>;
|
|
227
|
+
scrub(text: string): string;
|
|
228
|
+
};
|
|
229
|
+
declare class Screen {
|
|
230
|
+
readonly browser: ScreenBrowser;
|
|
231
|
+
readonly display: Display;
|
|
232
|
+
cursor: Point;
|
|
233
|
+
private pixelRatio;
|
|
234
|
+
private readonly handlers;
|
|
235
|
+
constructor(browser: ScreenBrowser, display: Display);
|
|
236
|
+
/** The live page (a new object after a reconnect), as pixel-level Playwright. */
|
|
237
|
+
get page(): NativePage;
|
|
238
|
+
run(action: ComputerAction): Promise<ActionResult>;
|
|
239
|
+
/** A PNG of the viewport at the model's display size. */
|
|
240
|
+
screenshot(): Promise<Buffer>;
|
|
241
|
+
/** Whether keystrokes go to a credential field (a password input, or one
|
|
242
|
+
* named like a token, key or PIN), looking through shadow roots and
|
|
243
|
+
* same-origin frames. An unreadable page, a cross-origin frame or a focus
|
|
244
|
+
* that is not a text field (a closed shadow root's host) counts as one. */
|
|
245
|
+
focusedFieldIsSecret(): Promise<boolean>;
|
|
246
|
+
/** CDP renders a clip at the page's device pixel ratio as well as its
|
|
247
|
+
* `scale` (a Retina host doubles it), so a capture of the wrong width
|
|
248
|
+
* measures that ratio and is taken once more, corrected. */
|
|
249
|
+
private capture;
|
|
250
|
+
private cdpCapture;
|
|
251
|
+
private point;
|
|
252
|
+
private moveTo;
|
|
253
|
+
private held;
|
|
254
|
+
private zoom;
|
|
255
|
+
private click;
|
|
256
|
+
private drag;
|
|
257
|
+
private scroll;
|
|
258
|
+
private key;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
declare const SPAN_PREFIX = "computer.";
|
|
262
|
+
declare class ActionTracer {
|
|
263
|
+
readonly media: MediaUploader | null;
|
|
264
|
+
private readonly warn;
|
|
265
|
+
private failures;
|
|
266
|
+
private warned;
|
|
267
|
+
constructor(media: MediaUploader | null, warn?: (message: string) => void);
|
|
268
|
+
static fromEnv(): ActionTracer;
|
|
269
|
+
/** `args` are already redacted. A failure's status goes through `scrub`:
|
|
270
|
+
* browser errors quote the session's ws URL and UI token. */
|
|
271
|
+
span(action: ComputerAction, args: Record<string, unknown>, run: () => Promise<ActionResult>, capture: () => Promise<Buffer>, scrub: (text: string) => string): Promise<ActionResult>;
|
|
272
|
+
private finish;
|
|
273
|
+
private screenshot;
|
|
274
|
+
private reference;
|
|
275
|
+
private failed;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
type NativeComputerOptions = {
|
|
279
|
+
/** The pixel size the model sees; default the viewport, or the largest
|
|
280
|
+
* downscale that fits the provider's image limits. */
|
|
281
|
+
display?: [number, number];
|
|
282
|
+
/** Records one span per action with the screen after it; default uploads
|
|
283
|
+
* screenshots with the `GATEWAY_*` keys when tracing is initialized. */
|
|
284
|
+
tracer?: ActionTracer;
|
|
285
|
+
};
|
|
286
|
+
type Kind = new (browser: ScreenBrowser, options?: NativeComputerOptions) => NativeComputer;
|
|
287
|
+
/** `item[name]` for the first spelling that is set (`scroll_x`, `scrollX`). */
|
|
288
|
+
declare function readField(item: unknown, ...names: string[]): unknown;
|
|
289
|
+
declare abstract class NativeComputer {
|
|
290
|
+
readonly browser: ScreenBrowser;
|
|
291
|
+
private static readonly kinds;
|
|
292
|
+
readonly display: Display;
|
|
293
|
+
readonly screen: Screen;
|
|
294
|
+
readonly tracer: ActionTracer;
|
|
295
|
+
private queue;
|
|
296
|
+
static register(provider: string, kind: Kind): void;
|
|
297
|
+
static get providers(): string[];
|
|
298
|
+
static forProvider(provider: string, browser: ScreenBrowser, options?: NativeComputerOptions): NativeComputer;
|
|
299
|
+
constructor(browser: ScreenBrowser, options?: NativeComputerOptions);
|
|
300
|
+
/** Whether a screenshot of this size is within the provider's limits. */
|
|
301
|
+
static fits(_width: number, _height: number): boolean;
|
|
302
|
+
/** The tool definition to send the model. */
|
|
303
|
+
abstract tool(): Record<string, unknown>;
|
|
304
|
+
/** One action in the provider's own shape, as a `ComputerAction`. */
|
|
305
|
+
abstract parse(raw: unknown): ComputerAction;
|
|
306
|
+
/** The options to spread into the Vercel AI SDK's provider-defined computer
|
|
307
|
+
* tool (`execute` and its companions), backed by this computer. */
|
|
308
|
+
abstract aiSdk(): object;
|
|
309
|
+
/** Run one provider-shaped action (an OpenAI action object, or an Anthropic
|
|
310
|
+
* `{ action: "left_click", ... }` input) and return what it produced: the
|
|
311
|
+
* door for any agent framework that hands actions over one at a time. */
|
|
312
|
+
executeAction(raw: unknown): Promise<ActionResult>;
|
|
313
|
+
/** Run one action on the page: reported on the session's browser timeline
|
|
314
|
+
* and, when tracing is on, as a span with the screen after. */
|
|
315
|
+
perform(action: ComputerAction): Promise<ActionResult>;
|
|
316
|
+
performAll(actions: readonly ComputerAction[]): Promise<ActionResult[]>;
|
|
317
|
+
/** The screen as the model sees it, as a traced `screenshot` action. */
|
|
318
|
+
screenshot(): Promise<Buffer>;
|
|
319
|
+
/** Run `fn` after every earlier call made through here: the AI SDK starts a
|
|
320
|
+
* step's tool calls concurrently, but one screen takes one action at a time. */
|
|
321
|
+
protected serial<T>(fn: () => Promise<T>): Promise<T>;
|
|
322
|
+
private runOnScreen;
|
|
323
|
+
private onLoss;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Key names from each provider's vocabulary, mapped once to Playwright's.
|
|
328
|
+
* Anthropic sends xdotool-style chords (`ctrl+a`, `Return`); OpenAI sends
|
|
329
|
+
* arrays of upper-case names (`["CTRL", "A"]`). Twin of
|
|
330
|
+
* `gatewaysdk/native_computer/keys.py`; `conformance/native-computer.json` pins both.
|
|
331
|
+
*/
|
|
332
|
+
declare const KEY_NAMES: Readonly<Record<string, string>>;
|
|
333
|
+
/** One provider key name as Playwright names it; an unknown name passes through. */
|
|
334
|
+
declare function playwrightKey(token: string): string;
|
|
335
|
+
/** Keys pressed together, in Playwright's names (`["Control", "a"]`). */
|
|
336
|
+
declare class KeyChord {
|
|
337
|
+
readonly keys: readonly string[];
|
|
338
|
+
private constructor();
|
|
339
|
+
/** `ctrl+shift+t` / `Return`: Anthropic's vocabulary, case kept. */
|
|
340
|
+
static fromXdotool(text: string): KeyChord;
|
|
341
|
+
/** `["CTRL", "A"]`: OpenAI's vocabulary. A lone letter is the unshifted key. */
|
|
342
|
+
static fromKeys(keys: readonly string[]): KeyChord;
|
|
343
|
+
/** What `page.keyboard.press` takes: `Control+a`. */
|
|
344
|
+
get combo(): string;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Anthropic's computer use: the `computer_toolset_20260801` toolset (GA, no
|
|
349
|
+
* beta header) and the older `computer_20251124` tool as a second kind.
|
|
350
|
+
* With the toolset each action is its own `tool_use` block named after the
|
|
351
|
+
* action and marked `"toolset_name": "computer"`; a turn may carry several.
|
|
352
|
+
* They run in order; the first failure is reported with `is_error` and every
|
|
353
|
+
* later block in the turn is answered as not executed.
|
|
354
|
+
* Docs: https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool
|
|
355
|
+
* Twin of `gatewaysdk/native_computer/anthropic.py`.
|
|
356
|
+
*/
|
|
357
|
+
|
|
358
|
+
declare const NOT_EXECUTED = "Not executed: an earlier computer action in this turn failed.";
|
|
359
|
+
type Raw = Record<string, unknown>;
|
|
360
|
+
type AiSdkAnthropicOutput = {
|
|
361
|
+
type: "image";
|
|
362
|
+
data: string;
|
|
363
|
+
} | string;
|
|
364
|
+
type AiSdkModelOutput = {
|
|
365
|
+
type: "text";
|
|
366
|
+
value: string;
|
|
367
|
+
} | {
|
|
368
|
+
type: "content";
|
|
369
|
+
value: {
|
|
370
|
+
type: "image-data";
|
|
371
|
+
data: string;
|
|
372
|
+
mediaType: "image/png";
|
|
373
|
+
}[];
|
|
374
|
+
};
|
|
375
|
+
type AnthropicContent = {
|
|
376
|
+
type: "text";
|
|
377
|
+
text: string;
|
|
378
|
+
} | {
|
|
379
|
+
type: "image";
|
|
380
|
+
source: {
|
|
381
|
+
type: "base64";
|
|
382
|
+
media_type: "image/png";
|
|
383
|
+
data: string;
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
type AnthropicToolResult = {
|
|
387
|
+
type: "tool_result";
|
|
388
|
+
tool_use_id: string;
|
|
389
|
+
toolset_name?: string;
|
|
390
|
+
content: AnthropicContent[] | string;
|
|
391
|
+
is_error?: true;
|
|
392
|
+
};
|
|
393
|
+
/** `computer_toolset_20260801` for Claude 5-family models (claude-sonnet-5-5,
|
|
394
|
+
* claude-opus-5-5, ...): send `tool()` in `tools`, pass each response's
|
|
395
|
+
* `content` to `execute`, and send the returned blocks back as the next user
|
|
396
|
+
* message. */
|
|
397
|
+
declare class AnthropicComputer extends NativeComputer {
|
|
398
|
+
static readonly TOOL_TYPE: string;
|
|
399
|
+
static readonly TOOLSET = "computer";
|
|
400
|
+
static readonly BETA: string | null;
|
|
401
|
+
static readonly MAX_LONG_EDGE: number;
|
|
402
|
+
static readonly MAX_VISUAL_TOKENS = 4784;
|
|
403
|
+
static readonly PATCH_PX = 28;
|
|
404
|
+
static fits(width: number, height: number): boolean;
|
|
405
|
+
tool(): Record<string, unknown>;
|
|
406
|
+
/** Whether a content block is a call to this computer. */
|
|
407
|
+
owns(block: unknown): boolean;
|
|
408
|
+
member(block: unknown): [string, Raw];
|
|
409
|
+
parse(raw: unknown): ComputerAction;
|
|
410
|
+
/** Run every computer `tool_use` in a response's content, in order, and
|
|
411
|
+
* return one `tool_result` per block. Other blocks are skipped. */
|
|
412
|
+
execute(content: Iterable<unknown>): Promise<AnthropicToolResult[]>;
|
|
413
|
+
/** The content an `ActionResult` goes back to the model as. */
|
|
414
|
+
static content(result: ActionResult): AnthropicContent[];
|
|
415
|
+
/** For `anthropic.tools.computerToolset_20260801({ ...computer.aiSdk() })`
|
|
416
|
+
* (or `computer_20251124` with the legacy kind): `execute` runs one action
|
|
417
|
+
* and returns `{ type: "image", data }` or text; `toModelOutput` turns that
|
|
418
|
+
* into the tool result. Calls run one at a time, and once a call fails the
|
|
419
|
+
* rest of that step's calls answer as not executed. */
|
|
420
|
+
aiSdk(): {
|
|
421
|
+
execute: (input: unknown, options?: {
|
|
422
|
+
messages?: readonly unknown[];
|
|
423
|
+
}) => Promise<AiSdkAnthropicOutput>;
|
|
424
|
+
toModelOutput: (options: {
|
|
425
|
+
output: AiSdkAnthropicOutput;
|
|
426
|
+
}) => AiSdkModelOutput;
|
|
427
|
+
};
|
|
428
|
+
static aiSdkOutput(result: ActionResult): AiSdkAnthropicOutput;
|
|
429
|
+
/** `image-data` is what AI SDK 6's Anthropic provider turns into an image
|
|
430
|
+
* block; AI SDK 7 still accepts it (and converts it to a `file` part). */
|
|
431
|
+
static aiSdkModelOutput(output: AiSdkAnthropicOutput): AiSdkModelOutput;
|
|
432
|
+
protected envelope(block: unknown, content: AnthropicContent[] | string, isError?: boolean): AnthropicToolResult;
|
|
433
|
+
private runBlock;
|
|
434
|
+
}
|
|
435
|
+
/** The `computer_20251124` tool (beta header `computer-use-2025-11-24`) for
|
|
436
|
+
* models before the toolset, and Claude 5.5 on Amazon Bedrock: one tool named
|
|
437
|
+
* `computer` whose input carries `action`. */
|
|
438
|
+
declare class AnthropicComputer20251124 extends AnthropicComputer {
|
|
439
|
+
static readonly TOOL_TYPE = "computer_20251124";
|
|
440
|
+
static readonly BETA = "computer-use-2025-11-24";
|
|
441
|
+
static readonly MAX_LONG_EDGE = 1568;
|
|
442
|
+
static readonly MAX_PIXELS = 1150000;
|
|
443
|
+
static fits(width: number, height: number): boolean;
|
|
444
|
+
tool(): Record<string, unknown>;
|
|
445
|
+
owns(block: unknown): boolean;
|
|
446
|
+
member(block: unknown): [string, Raw];
|
|
447
|
+
protected envelope(block: unknown, content: AnthropicContent[] | string, isError?: boolean): AnthropicToolResult;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* OpenAI's computer use: the Responses API `computer` tool (GA), and the
|
|
452
|
+
* legacy `computer_use_preview` tool as a second kind. Each `computer_call`
|
|
453
|
+
* carries an ordered batch of `actions` (the preview carried one `action`);
|
|
454
|
+
* they run in order, then the screen goes back as a `computer_call_output`.
|
|
455
|
+
* A call with `pending_safety_checks` is not executed until the caller passes
|
|
456
|
+
* them back as `acknowledged`.
|
|
457
|
+
* Docs: https://developers.openai.com/api/docs/guides/tools-computer-use
|
|
458
|
+
* Twin of `gatewaysdk/native_computer/openai.py`.
|
|
459
|
+
*/
|
|
460
|
+
|
|
461
|
+
type SafetyCheck = {
|
|
462
|
+
id: string;
|
|
463
|
+
code?: string;
|
|
464
|
+
message?: string;
|
|
465
|
+
};
|
|
466
|
+
type ComputerCallOutput = {
|
|
467
|
+
type: "computer_call_output";
|
|
468
|
+
call_id: string;
|
|
469
|
+
output: {
|
|
470
|
+
type: "computer_screenshot";
|
|
471
|
+
image_url: string;
|
|
472
|
+
detail: "original";
|
|
473
|
+
};
|
|
474
|
+
acknowledged_safety_checks?: SafetyCheck[];
|
|
475
|
+
};
|
|
476
|
+
type AiSdkComputerCall = {
|
|
477
|
+
actions?: unknown[];
|
|
478
|
+
pendingSafetyChecks?: unknown[];
|
|
479
|
+
};
|
|
480
|
+
type AiSdkComputerOutput = {
|
|
481
|
+
output: {
|
|
482
|
+
type: "computer_screenshot";
|
|
483
|
+
imageUrl: string;
|
|
484
|
+
};
|
|
485
|
+
acknowledgedSafetyChecks?: SafetyCheck[];
|
|
486
|
+
};
|
|
487
|
+
/** The model flagged this call; nothing ran. Show `checks` to a person, then
|
|
488
|
+
* `execute(call, checks)` to run it anyway. */
|
|
489
|
+
declare class PendingSafetyChecks extends Error {
|
|
490
|
+
readonly callId: string;
|
|
491
|
+
readonly checks: SafetyCheck[];
|
|
492
|
+
constructor(callId: string, checks: SafetyCheck[]);
|
|
493
|
+
}
|
|
494
|
+
/** The GA `computer` tool (gpt-5.5, gpt-5.6-sol and the other models whose
|
|
495
|
+
* page lists computer use): send `tool()` in `tools`, pass each
|
|
496
|
+
* `computer_call` item to `execute`, and send the returned
|
|
497
|
+
* `computer_call_output` back with `previous_response_id`. */
|
|
498
|
+
declare class OpenAIComputer extends NativeComputer {
|
|
499
|
+
tool(): Record<string, unknown>;
|
|
500
|
+
owns(item: unknown): boolean;
|
|
501
|
+
parse(raw: unknown): ComputerAction;
|
|
502
|
+
static actionsOf(call: unknown): unknown[];
|
|
503
|
+
/** Run a `computer_call`'s actions and return its `computer_call_output`.
|
|
504
|
+
* Throws `PendingSafetyChecks` (before anything runs) while a check the
|
|
505
|
+
* model raised is not in `acknowledged`. */
|
|
506
|
+
execute(call: unknown, acknowledged?: readonly unknown[]): Promise<ComputerCallOutput>;
|
|
507
|
+
/** For `openai.tools.computer({ ...computer.aiSdk() })`: `execute` runs a
|
|
508
|
+
* call's `actions` and returns the screenshot output. A call with pending
|
|
509
|
+
* safety checks asks for approval first (`needsApproval`), so the AI SDK's
|
|
510
|
+
* approval flow puts them in front of a person; once approved, `execute`
|
|
511
|
+
* acknowledges them. */
|
|
512
|
+
aiSdk(): {
|
|
513
|
+
execute: (input: AiSdkComputerCall) => Promise<AiSdkComputerOutput>;
|
|
514
|
+
needsApproval: (input: AiSdkComputerCall) => boolean;
|
|
515
|
+
};
|
|
516
|
+
/** The batch's actions, run after the safety checks clear; the screen after them. */
|
|
517
|
+
runCall(callId: string, rawActions: readonly unknown[], checks: readonly SafetyCheck[], acknowledged: readonly unknown[]): Promise<Buffer>;
|
|
518
|
+
}
|
|
519
|
+
/** The legacy `computer_use_preview` tool for the `computer-use-preview`
|
|
520
|
+
* model: it declares the display size and `environment: "browser"`. */
|
|
521
|
+
declare class OpenAIPreviewComputer extends OpenAIComputer {
|
|
522
|
+
tool(): Record<string, unknown>;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Native computer use: Anthropic's and OpenAI's pixel-based computer-use
|
|
527
|
+
* tools served by a world session's browser. Kinds: `anthropic`
|
|
528
|
+
* (`computer_toolset_20260801`), `anthropic-computer-20251124`, `openai`
|
|
529
|
+
* (Responses `computer`) and `openai-preview` (`computer_use_preview`).
|
|
530
|
+
* Python twin: `gatewaysdk/native_computer/`.
|
|
531
|
+
*/
|
|
532
|
+
|
|
533
|
+
/** The class each provider name builds, so a caller gets the kind's own
|
|
534
|
+
* `execute` without a cast. */
|
|
535
|
+
type NativeComputerKinds = {
|
|
536
|
+
anthropic: AnthropicComputer;
|
|
537
|
+
"anthropic-computer-20251124": AnthropicComputer20251124;
|
|
538
|
+
openai: OpenAIComputer;
|
|
539
|
+
"openai-preview": OpenAIPreviewComputer;
|
|
540
|
+
};
|
|
541
|
+
type NativeComputerProvider = keyof NativeComputerKinds;
|
|
542
|
+
|
|
93
543
|
/**
|
|
94
544
|
* STORED WORLD TASKS: a task spec kept by the project, outside any bundle.
|
|
95
545
|
*
|
|
@@ -172,6 +622,10 @@ type WorldTaskWorldValidation = {
|
|
|
172
622
|
slug: string;
|
|
173
623
|
ref: string;
|
|
174
624
|
versionId: string;
|
|
625
|
+
/** True when the caller's open edit session's tip stood in for `main`;
|
|
626
|
+
* null when the alias did not resolve; absent from a platform that does
|
|
627
|
+
* not report it. */
|
|
628
|
+
private?: boolean | null;
|
|
175
629
|
ok: boolean;
|
|
176
630
|
checked: "entities" | "none";
|
|
177
631
|
problems: string[];
|
|
@@ -183,6 +637,10 @@ type WorldTaskValidation = {
|
|
|
183
637
|
/** The world version the task was checked against; null for a task with
|
|
184
638
|
* `worlds`, whose versions are per alias under `worlds`. */
|
|
185
639
|
versionId: string | null;
|
|
640
|
+
/** True when the caller's open edit session's tip stood in for `main`;
|
|
641
|
+
* null for a task with `worlds` (per alias there); absent from a platform
|
|
642
|
+
* that does not report it. */
|
|
643
|
+
private?: boolean | null;
|
|
186
644
|
ok: boolean;
|
|
187
645
|
/** `entities` when the world's contract was read and every seed and check
|
|
188
646
|
* entity was matched against it; `none` when the version has no contract
|
|
@@ -272,6 +730,7 @@ declare const assertTaskRef: (task: WorldTaskRef) => void;
|
|
|
272
730
|
* const session = await openSession(world.slug, { task: "revops-mara-dedupe-contacts" });
|
|
273
731
|
* await session.ready(); // wait for the container
|
|
274
732
|
* await session.call("crm_search", { entity: "deals" });
|
|
733
|
+
* await session.withTraceContext(() => myAgent(session)); // traced under session.sessionId
|
|
275
734
|
* const { reward, rewards } = await session.grade();
|
|
276
735
|
* await session.close({ keepWarm: true }); // hand it back to the pool
|
|
277
736
|
*
|
|
@@ -610,6 +1069,10 @@ declare class WorldSession {
|
|
|
610
1069
|
browserRecorder(agentId?: string): BrowserActionRecorder;
|
|
611
1070
|
/** Browser actions as model tools, in the same shape as `toolkit()`. */
|
|
612
1071
|
computerUseTools(browser: WorldBrowser): WorldToolkit;
|
|
1072
|
+
/** The browser as a provider's own pixel-based computer-use tool: `anthropic`
|
|
1073
|
+
* (`computer_toolset_20260801`), `openai` (Responses `computer`),
|
|
1074
|
+
* `anthropic-computer-20251124` or `openai-preview`. See `nativeComputer/`. */
|
|
1075
|
+
nativeComputer<P extends NativeComputerProvider = "anthropic">(browser: WorldBrowser, provider?: P, options?: NativeComputerOptions): NativeComputerKinds[P];
|
|
613
1076
|
/** The session's latest platform state (one request, no waiting). */
|
|
614
1077
|
status(): Promise<WorldSessionState>;
|
|
615
1078
|
/**
|
|
@@ -713,6 +1176,19 @@ declare class WorldSession {
|
|
|
713
1176
|
}): Promise<{
|
|
714
1177
|
state: string;
|
|
715
1178
|
}>;
|
|
1179
|
+
/**
|
|
1180
|
+
* Run `fn` as work inside this session: spans it records take `sessionId`
|
|
1181
|
+
* as their session id and carry `world_session_id` trace metadata, so the
|
|
1182
|
+
* agent's traces land in the same session as the platform's traces of this
|
|
1183
|
+
* session's tool calls. A `withSession()` block inside still wins for the
|
|
1184
|
+
* session id. No effect before `tracing.init()`. `runSessions` wraps each
|
|
1185
|
+
* agent call in it.
|
|
1186
|
+
*
|
|
1187
|
+
* ```typescript
|
|
1188
|
+
* await session.withTraceContext(() => myAgent(toolkit, session.instruction));
|
|
1189
|
+
* ```
|
|
1190
|
+
*/
|
|
1191
|
+
withTraceContext<T>(fn: () => T | Promise<T>): Promise<T>;
|
|
716
1192
|
}
|
|
717
1193
|
/**
|
|
718
1194
|
* Attach to a session that already exists — resuming after a crash, or
|
|
@@ -785,9 +1261,10 @@ type SessionRunReport = {
|
|
|
785
1261
|
* myAgent(toolkit.impls, toolkit.schemas, instruction),
|
|
786
1262
|
* });
|
|
787
1263
|
*
|
|
788
|
-
* The handler gets a ready session with its toolkit already bound
|
|
789
|
-
* closing (warm) and aggregation
|
|
790
|
-
* and records why — the tasks that
|
|
1264
|
+
* The handler gets a ready session with its toolkit already bound, and runs
|
|
1265
|
+
* inside `session.withTraceContext`; grading, closing (warm) and aggregation
|
|
1266
|
+
* are handled. A task that throws scores 0 and records why — the tasks that
|
|
1267
|
+
* passed keep their results.
|
|
791
1268
|
*/
|
|
792
1269
|
declare function runSessions(opts: {
|
|
793
1270
|
world: string;
|
|
@@ -878,6 +1355,11 @@ declare const DEFAULT_VIEWPORT: {
|
|
|
878
1355
|
declare const EVENT_BATCH_SIZE = 10;
|
|
879
1356
|
declare const EVENT_FLUSH_INTERVAL_MS = 1000;
|
|
880
1357
|
declare const EVENT_MAX_RETRIES = 3;
|
|
1358
|
+
declare const SECRET_KEY: RegExp;
|
|
1359
|
+
/** What a call that lost its browser does once the browser is back: a read or
|
|
1360
|
+
* a navigation runs again (`retry`); an action that may already have reached
|
|
1361
|
+
* the world is not replayed, and the agent is told (`report`). */
|
|
1362
|
+
type OnBrowserLoss = "retry" | "report";
|
|
881
1363
|
/** The `surfaces` block of a session descriptor, as the platform sends it. */
|
|
882
1364
|
type SessionSurfaces = {
|
|
883
1365
|
tools: {
|
|
@@ -1059,6 +1541,8 @@ declare class WorldBrowser {
|
|
|
1059
1541
|
/** The live Playwright page; a new object after a reconnect. */
|
|
1060
1542
|
get page(): BrowserPage;
|
|
1061
1543
|
get agentId(): string | null;
|
|
1544
|
+
/** `text` with this session's credentials (UI token, browser address) removed. */
|
|
1545
|
+
scrub(text: string): string;
|
|
1062
1546
|
private watchNetwork;
|
|
1063
1547
|
/** Run `fn` against the page. If it fails because the browser is gone,
|
|
1064
1548
|
* recover; then `retry` runs it ONCE more and `report` throws
|
|
@@ -1077,7 +1561,7 @@ declare class WorldBrowser {
|
|
|
1077
1561
|
/** Run one action and report it: the event carries what was asked,
|
|
1078
1562
|
* whether it worked, and the screen after — for failures too, so a
|
|
1079
1563
|
* reviewer sees what the agent saw when the selector did not match. */
|
|
1080
|
-
|
|
1564
|
+
act<T>(action: string, args: Record<string, unknown>, fn: () => Promise<T>, onLoss?: OnBrowserLoss): Promise<T>;
|
|
1081
1565
|
/** One event on the recorder, if there is one; `failure` null means ok. */
|
|
1082
1566
|
private report;
|
|
1083
1567
|
private observeForEvent;
|
|
@@ -1092,7 +1576,7 @@ declare class WorldBrowser {
|
|
|
1092
1576
|
* the first one, so this tracks requests itself: done when nothing is in
|
|
1093
1577
|
* flight and the network has been quiet for `SETTLE_QUIET_MS`, bounded so
|
|
1094
1578
|
* long-polling UIs cannot hang us. */
|
|
1095
|
-
|
|
1579
|
+
settle(): Promise<void>;
|
|
1096
1580
|
click(selector: string): Promise<void>;
|
|
1097
1581
|
type(selector: string, text: string): Promise<void>;
|
|
1098
1582
|
press(key: string): Promise<void>;
|
|
@@ -1181,52 +1665,6 @@ declare function computerUseToolkit(browser: WorldBrowser, opts?: {
|
|
|
1181
1665
|
maxText?: number;
|
|
1182
1666
|
}): WorldToolkit;
|
|
1183
1667
|
|
|
1184
|
-
declare const PLATFORM_TIMEOUT_ENV = "GATEWAY_TIMEOUT_MS";
|
|
1185
|
-
/** How long one platform request may go unanswered before it is abandoned; `GATEWAY_TIMEOUT_MS` overrides it. */
|
|
1186
|
-
declare const PLATFORM_TIMEOUT_DEFAULT_MS = 120000;
|
|
1187
|
-
type PlatformEndpoint = {
|
|
1188
|
-
host: string;
|
|
1189
|
-
publicKey: string;
|
|
1190
|
-
secretKey: string;
|
|
1191
|
-
};
|
|
1192
|
-
type PlatformMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
1193
|
-
type PlatformReply = {
|
|
1194
|
-
status: number;
|
|
1195
|
-
ok: boolean;
|
|
1196
|
-
text: string;
|
|
1197
|
-
};
|
|
1198
|
-
/** The request budget in force: `GATEWAY_TIMEOUT_MS` when set, else the default. */
|
|
1199
|
-
declare function platformTimeoutMs(env?: NodeJS.ProcessEnv): number;
|
|
1200
|
-
/** Why a request got no answer, from the socket-level error undici hides under `fetch failed`. */
|
|
1201
|
-
declare class TransportCause {
|
|
1202
|
-
readonly reason: string;
|
|
1203
|
-
readonly detail: string | null;
|
|
1204
|
-
readonly next: string;
|
|
1205
|
-
private constructor();
|
|
1206
|
-
static timeout(timeoutMs: number): TransportCause;
|
|
1207
|
-
static of(error: unknown): TransportCause;
|
|
1208
|
-
describe(): string;
|
|
1209
|
-
}
|
|
1210
|
-
/** A platform request that never got an answer: one line naming the request, the host, the cause and the next step. */
|
|
1211
|
-
declare class UnreachableError extends Error {
|
|
1212
|
-
readonly host: string;
|
|
1213
|
-
readonly method: string;
|
|
1214
|
-
readonly route: string;
|
|
1215
|
-
readonly failure: TransportCause;
|
|
1216
|
-
constructor(host: string, method: string, route: string, failure: TransportCause);
|
|
1217
|
-
}
|
|
1218
|
-
/** The one door every CLI and SDK request to the platform goes through: Basic auth with the project key, a per-request timeout, and a transport failure turned into an `UnreachableError`. */
|
|
1219
|
-
declare class PlatformTransport {
|
|
1220
|
-
private readonly endpoint;
|
|
1221
|
-
private readonly timeoutMs;
|
|
1222
|
-
constructor(endpoint: PlatformEndpoint, timeoutMs?: number);
|
|
1223
|
-
/** A request that legitimately takes longer (a sandbox exec, a world create) waits its own budget; every other one waits the default. */
|
|
1224
|
-
budget(ownMs?: number): number;
|
|
1225
|
-
send(method: PlatformMethod, route: string, body?: unknown, opts?: {
|
|
1226
|
-
timeoutMs?: number;
|
|
1227
|
-
}): Promise<PlatformReply>;
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
1668
|
/** Mirrors `WorldSessionListItemSchema` (web/features/public-api/types/world-sessions.ts). */
|
|
1231
1669
|
type WorldSessionListItem = {
|
|
1232
1670
|
sessionId: string;
|
|
@@ -1251,7 +1689,7 @@ type ListSessionsFilter = {
|
|
|
1251
1689
|
slug?: string;
|
|
1252
1690
|
limit?: number;
|
|
1253
1691
|
};
|
|
1254
|
-
/** The project's
|
|
1692
|
+
/** The project's sessions in every state, newest first; `state` narrows to one. */
|
|
1255
1693
|
declare function listSessions(filter?: ListSessionsFilter, options?: WorldsClientOptions): Promise<WorldSessionListItem[]>;
|
|
1256
1694
|
|
|
1257
1695
|
/**
|
|
@@ -1302,6 +1740,27 @@ declare function serializeCallBody(body: unknown): string;
|
|
|
1302
1740
|
* `IDLE_WARNING_MINUTES` left, else null. `now` is for tests. */
|
|
1303
1741
|
declare function idleWarning(idleExpiresAt: string | null | undefined, now?: Date): string | null;
|
|
1304
1742
|
|
|
1743
|
+
/** Where a session answers, in the shape `session open` prints and a
|
|
1744
|
+
* `task up` manifest keeps per world. */
|
|
1745
|
+
type SurfaceDescriptor = {
|
|
1746
|
+
surfaces: WorldSurfaceKind[];
|
|
1747
|
+
api?: {
|
|
1748
|
+
url: string;
|
|
1749
|
+
token?: string;
|
|
1750
|
+
};
|
|
1751
|
+
ui?: {
|
|
1752
|
+
url: string;
|
|
1753
|
+
entry: string;
|
|
1754
|
+
apiPath: string | null;
|
|
1755
|
+
};
|
|
1756
|
+
browser?: {
|
|
1757
|
+
wsUrl: string;
|
|
1758
|
+
viewport?: unknown;
|
|
1759
|
+
tier?: BrowserTier;
|
|
1760
|
+
};
|
|
1761
|
+
};
|
|
1762
|
+
declare function surfaceDescriptor(s: SessionSurfaces): SurfaceDescriptor;
|
|
1763
|
+
|
|
1305
1764
|
/** The per-world entry of a `WorldTaskSpec.worlds` table. */
|
|
1306
1765
|
type WorldTaskWorld = {
|
|
1307
1766
|
slug: string;
|
|
@@ -1310,13 +1769,24 @@ type WorldTaskWorld = {
|
|
|
1310
1769
|
grader?: WorldTaskSpec["grader"];
|
|
1311
1770
|
tools?: string[];
|
|
1312
1771
|
};
|
|
1313
|
-
/** One world's session as the platform answered it at up.
|
|
1772
|
+
/** One world's session as the platform answered it at up. `private`: the
|
|
1773
|
+
* world came up on the caller's own unsealed edits (its edit session's tip
|
|
1774
|
+
* answered `main`). */
|
|
1314
1775
|
type TaskWorldSessionState = WorldSessionState & {
|
|
1315
1776
|
alias: string;
|
|
1316
1777
|
slug: string;
|
|
1317
1778
|
ref: string;
|
|
1779
|
+
private: boolean;
|
|
1318
1780
|
reusedWarm: boolean;
|
|
1319
1781
|
};
|
|
1782
|
+
/** Which world an alias is, as recorded at up or attach. `private` is null
|
|
1783
|
+
* when it is not known (attached by task id, or a manifest written before
|
|
1784
|
+
* the platform reported it). */
|
|
1785
|
+
type TaskWorldRef = {
|
|
1786
|
+
slug: string;
|
|
1787
|
+
ref: string | null;
|
|
1788
|
+
private: boolean | null;
|
|
1789
|
+
};
|
|
1320
1790
|
/** What `POST /world-task-sessions` answers. */
|
|
1321
1791
|
type TaskSessionsResponse = {
|
|
1322
1792
|
taskId: string | null;
|
|
@@ -1331,25 +1801,12 @@ type TaskSessionsResponse = {
|
|
|
1331
1801
|
type TaskManifestSession = {
|
|
1332
1802
|
slug: string;
|
|
1333
1803
|
ref: string | null;
|
|
1804
|
+
private: boolean | null;
|
|
1334
1805
|
versionId: string;
|
|
1335
1806
|
sessionId: string;
|
|
1336
1807
|
ready: boolean;
|
|
1337
1808
|
state: string;
|
|
1338
|
-
|
|
1339
|
-
api?: {
|
|
1340
|
-
url: string;
|
|
1341
|
-
token?: string;
|
|
1342
|
-
};
|
|
1343
|
-
ui?: {
|
|
1344
|
-
url: string;
|
|
1345
|
-
entry: string;
|
|
1346
|
-
apiPath: string | null;
|
|
1347
|
-
};
|
|
1348
|
-
browser?: {
|
|
1349
|
-
wsUrl: string;
|
|
1350
|
-
viewport?: unknown;
|
|
1351
|
-
};
|
|
1352
|
-
};
|
|
1809
|
+
} & SurfaceDescriptor;
|
|
1353
1810
|
/** The manifest: every session of the task, keyed by alias. The file
|
|
1354
1811
|
* `task up --out` writes and `task down|status|grade|export` read. */
|
|
1355
1812
|
type TaskManifest = {
|
|
@@ -1414,20 +1871,14 @@ declare class TaskSessions {
|
|
|
1414
1871
|
/** The instruction every world's session shares. */
|
|
1415
1872
|
instruction: string | null,
|
|
1416
1873
|
/** One live session per alias, in the spec's order. */
|
|
1417
|
-
sessions: Record<string, WorldSession>, worlds: Record<string,
|
|
1418
|
-
slug: string;
|
|
1419
|
-
ref: string | null;
|
|
1420
|
-
}>,
|
|
1874
|
+
sessions: Record<string, WorldSession>, worlds: Record<string, TaskWorldRef>,
|
|
1421
1875
|
/** The spec's content hash — set only by `openTask` (the raw platform
|
|
1422
1876
|
* response carries it); null for a `TaskSessions` rebuilt with
|
|
1423
1877
|
* `attachManifest`/`attachTask`, which have no spec to hash. */
|
|
1424
1878
|
hash?: string | null);
|
|
1425
|
-
/** This alias's
|
|
1426
|
-
*
|
|
1427
|
-
worldRef(alias: string):
|
|
1428
|
-
slug: string;
|
|
1429
|
-
ref: string | null;
|
|
1430
|
-
};
|
|
1879
|
+
/** This alias's world as recorded at open/attach — what a `TaskRun`
|
|
1880
|
+
* filing needs to name, without exposing the whole map. */
|
|
1881
|
+
worldRef(alias: string): TaskWorldRef;
|
|
1431
1882
|
/** The aliases, in the spec's order. */
|
|
1432
1883
|
get aliases(): string[];
|
|
1433
1884
|
/** The alias's session, or a clear error naming the aliases there are. */
|
|
@@ -1525,7 +1976,11 @@ type RunTaskOptions = {
|
|
|
1525
1976
|
surfaces?: WorldSurfaceKind[];
|
|
1526
1977
|
/** Directory the run's own `<runId>/` folder is created under. Default `"runs"`. */
|
|
1527
1978
|
outDir?: string;
|
|
1528
|
-
/**
|
|
1979
|
+
/**
|
|
1980
|
+
* Initialize tracing when GATEWAY_* credentials are configured. Default `true`.
|
|
1981
|
+
* When it cannot start (e.g. the optional `@opentelemetry/*` peers are missing),
|
|
1982
|
+
* the run goes on untraced and the process warns once.
|
|
1983
|
+
*/
|
|
1529
1984
|
trace?: boolean;
|
|
1530
1985
|
/** File one rollout when the run ends. Default `true`. */
|
|
1531
1986
|
file?: boolean;
|
|
@@ -1682,6 +2137,41 @@ declare class GatewayEvalsClient {
|
|
|
1682
2137
|
finalizeEvaluation(evaluationId: string, opts?: FinalizeEvaluationOptions): Promise<string>;
|
|
1683
2138
|
}
|
|
1684
2139
|
|
|
2140
|
+
/** One vendor-route request the world answered, as its own log keeps it: the
|
|
2141
|
+
* `calls` a grader reads, with the door it came in by (`via`: api, ui, tool). */
|
|
2142
|
+
type WorldRequest = {
|
|
2143
|
+
seq: number;
|
|
2144
|
+
at?: string;
|
|
2145
|
+
operation?: string;
|
|
2146
|
+
method?: string;
|
|
2147
|
+
path?: string;
|
|
2148
|
+
args?: unknown;
|
|
2149
|
+
query?: unknown;
|
|
2150
|
+
body?: unknown;
|
|
2151
|
+
via?: string;
|
|
2152
|
+
status?: number;
|
|
2153
|
+
rows?: number | null;
|
|
2154
|
+
found?: boolean;
|
|
2155
|
+
};
|
|
2156
|
+
/**
|
|
2157
|
+
* The world's own request log, read from a live session's state. The platform's
|
|
2158
|
+
* call ledger (`export()`) holds what it brokered — tool calls, seeds, grades;
|
|
2159
|
+
* this holds the requests the world answered on its routes, the browser's and a
|
|
2160
|
+
* direct `api.url` client's included. A world without HTTP routes, or not on the
|
|
2161
|
+
* World Host, keeps none.
|
|
2162
|
+
*/
|
|
2163
|
+
declare class WorldRequestLog {
|
|
2164
|
+
readonly requests: WorldRequest[];
|
|
2165
|
+
private constructor();
|
|
2166
|
+
static read(session: WorldSession): Promise<WorldRequestLog | null>;
|
|
2167
|
+
/** How many older requests the world no longer keeps (its log is bounded): the gap
|
|
2168
|
+
* before the first entry it still holds. */
|
|
2169
|
+
get dropped(): number;
|
|
2170
|
+
/** Each request in the shape of a ledger line, `kind: "request"`, so one JSONL
|
|
2171
|
+
* file holds both. */
|
|
2172
|
+
asCalls(): WorldSessionCall[];
|
|
2173
|
+
}
|
|
2174
|
+
|
|
1685
2175
|
/** One entry the archive rules dropped: a whole directory (`name/`, `files`
|
|
1686
2176
|
* counted) or a single file. */
|
|
1687
2177
|
type Exclusion = {
|
|
@@ -2011,6 +2501,8 @@ type WorldField = {
|
|
|
2011
2501
|
required: boolean;
|
|
2012
2502
|
/** How the store holds it; null means in the clear (queryable by plaintext as given). */
|
|
2013
2503
|
redaction: Redaction | null;
|
|
2504
|
+
/** The values the schema allows; absent when it lists none. */
|
|
2505
|
+
enum?: unknown[];
|
|
2014
2506
|
};
|
|
2015
2507
|
type WorldRelationship = {
|
|
2016
2508
|
fields: string[];
|
|
@@ -2814,6 +3306,8 @@ type EditSessionSummary = {
|
|
|
2814
3306
|
conflictPaths: string[] | null;
|
|
2815
3307
|
rollbackOfId: string | null;
|
|
2816
3308
|
message: string | null;
|
|
3309
|
+
/** Set when `task edit close` sealed this session together with a task's other worlds. */
|
|
3310
|
+
sealGroupId: string | null;
|
|
2817
3311
|
};
|
|
2818
3312
|
type EditSessionList = {
|
|
2819
3313
|
slug: string;
|
|
@@ -2855,6 +3349,80 @@ declare class WorldEditClient {
|
|
|
2855
3349
|
/** Undo a sealed session (source and data) as a new sealed session. */
|
|
2856
3350
|
rollback(slug: string, input: EditSessionRollbackInput): Promise<EditSessionResult>;
|
|
2857
3351
|
}
|
|
3352
|
+
/** A stored task (`{id, version?}`) or a spec with `worlds`, as `task up` takes it. */
|
|
3353
|
+
type TaskEditTarget = WorldTaskIdRef | WorldTaskSpec;
|
|
3354
|
+
/** The task the platform resolved: stored id and version, or the spec's hash. */
|
|
3355
|
+
type TaskEditTaskRef = {
|
|
3356
|
+
taskId: string | null;
|
|
3357
|
+
taskVersion: number | null;
|
|
3358
|
+
name: string | null;
|
|
3359
|
+
hash: string;
|
|
3360
|
+
};
|
|
3361
|
+
/** Mirrors `TaskEditStatusResponseSchema` (web/features/public-api/types/world-task-edits.ts). */
|
|
3362
|
+
type TaskEditStatus = {
|
|
3363
|
+
task: TaskEditTaskRef;
|
|
3364
|
+
worlds: Record<string, {
|
|
3365
|
+
slug: string;
|
|
3366
|
+
ref: string;
|
|
3367
|
+
problem: string | null;
|
|
3368
|
+
session: EditSessionSummary | null;
|
|
3369
|
+
/** This credential's sessions parked in `conflict` on the world: unsealed too. */
|
|
3370
|
+
parked: EditSessionSummary[];
|
|
3371
|
+
mainVersionId: string | null;
|
|
3372
|
+
sealNow: "fast-forward" | "rebase" | "conflict" | null;
|
|
3373
|
+
conflictPaths: string[];
|
|
3374
|
+
}>;
|
|
3375
|
+
/** Aliases whose world holds edits only this credential sees. */
|
|
3376
|
+
unsealed: string[];
|
|
3377
|
+
hint: string | null;
|
|
3378
|
+
};
|
|
3379
|
+
type TaskEditSealed = {
|
|
3380
|
+
slug: string;
|
|
3381
|
+
session: EditSessionSummary;
|
|
3382
|
+
};
|
|
3383
|
+
type TaskEditCloseResult = {
|
|
3384
|
+
task: TaskEditTaskRef;
|
|
3385
|
+
groupId: string | null;
|
|
3386
|
+
worlds: Record<string, TaskEditSealed>;
|
|
3387
|
+
skipped: Record<string, {
|
|
3388
|
+
slug: string;
|
|
3389
|
+
reason: string;
|
|
3390
|
+
}>;
|
|
3391
|
+
};
|
|
3392
|
+
type TaskEditRollbackResult = {
|
|
3393
|
+
task: TaskEditTaskRef;
|
|
3394
|
+
groupId: string;
|
|
3395
|
+
rollbackOf: string;
|
|
3396
|
+
worlds: Record<string, TaskEditSealed>;
|
|
3397
|
+
/** Members whose seal left `main` where it was: nothing to undo there. */
|
|
3398
|
+
skipped: Record<string, {
|
|
3399
|
+
slug: string;
|
|
3400
|
+
reason: string;
|
|
3401
|
+
}>;
|
|
3402
|
+
};
|
|
3403
|
+
type TaskEditCloseInput = {
|
|
3404
|
+
requireAll?: boolean;
|
|
3405
|
+
force?: boolean;
|
|
3406
|
+
message?: string;
|
|
3407
|
+
};
|
|
3408
|
+
type TaskEditRollbackInput = {
|
|
3409
|
+
groupId: string;
|
|
3410
|
+
force?: boolean;
|
|
3411
|
+
message?: string;
|
|
3412
|
+
};
|
|
3413
|
+
/**
|
|
3414
|
+
* This credential's edit sessions on every world a task names, together:
|
|
3415
|
+
* `close` seals them onto their mains in ONE platform transaction (all or
|
|
3416
|
+
* none), `rollback` undoes the seal group as one. Python twin:
|
|
3417
|
+
* `gatewaysdk.benchmark_hub.edit_sessions.TaskEditClient`.
|
|
3418
|
+
*/
|
|
3419
|
+
declare class TaskEditClient {
|
|
3420
|
+
private readonly options;
|
|
3421
|
+
constructor(options?: WorldsClientOptions);
|
|
3422
|
+
status(task: TaskEditTarget): Promise<TaskEditStatus>;
|
|
3423
|
+
close(task: TaskEditTarget, input?: TaskEditCloseInput): Promise<TaskEditCloseResult>;
|
|
3424
|
+
rollback(task: TaskEditTarget, input: TaskEditRollbackInput): Promise<TaskEditRollbackResult>;
|
|
3425
|
+
}
|
|
2858
3426
|
|
|
2859
3427
|
/**
|
|
2860
3428
|
* The hosted one-task dry run: `POST /api/public/environments/{id}/dry-run`
|
|
@@ -3192,4 +3760,4 @@ declare function openWorld(slugRef: string, options?: WorldsClientOptions): Prom
|
|
|
3192
3760
|
*/
|
|
3193
3761
|
declare function openWorldVersion(slug: string, versionId: string, options?: WorldsClientOptions): Promise<WorldSet>;
|
|
3194
3762
|
|
|
3195
|
-
export { ApiError, BROWSER_GONE_PATTERNS, BROWSER_TIERS, type BrowserActionEvent, BrowserActionRecorder, type BrowserConnection, type BrowserMode, type BrowserPage, BrowserReconnected, BrowserReconnector, type BrowserTier, BrowserUnrecoverable, CALL_BODY_LIMIT_BYTES, CALL_BODY_LIMIT_LABEL, COMPUTER_USE_SPECS, type Checkout, CheckoutProvenance, type CreateEvaluationOptions, DEFAULT_BRANCH, DEFAULT_VIEWPORT, DRY_RUN_AGENT, DRY_RUN_KIND, DetachedPushError, type DispatchedRun, type DryRunImageDecision, DryRunOutcome, type DryRunSettlement, EVENT_BATCH_SIZE, EVENT_FLUSH_INTERVAL_MS, EVENT_MAX_RETRIES, EXPLORATORY_TASK, EXPLORATORY_TASK_SOURCE, type EditSessionCloseInput, type EditSessionList, type EditSessionListQuery, type EditSessionResult, type EditSessionRollbackInput, type EditSessionSummary, type EvalSample, type FinalizeEvaluationOptions, GatewayEvalsClient, type GradeResult, HostedDryRunClient, type HostedDryRunDispatch, type HostedDryRunStatus, type HostedDryRunVerdict, IDLE_WARNING_MINUTES, type IngestExplode, type IngestFieldSpec, type IngestMapping, type IngestMode, type IngestOptions, type IngestRefusal, type IngestReport, type IngestSource, type IngestSourceReport, type IngestToolCallsOptions, type IngestToolCallsReport, type ListRunsFilter, type ListSessionsFilter, type LiveTaskSession, type LocalMeta, type MigrateWorldOptions, NO_GRADER_REASON, type
|
|
3763
|
+
export { ACTION_NAMES, type ActionArgs, type ActionResult, ActionTracer, type AiSdkAnthropicOutput, type AiSdkComputerCall, type AiSdkComputerOutput, type AiSdkModelOutput, AnthropicComputer, AnthropicComputer20251124, type AnthropicToolResult, ApiError, BROWSER_GONE_PATTERNS, BROWSER_TIERS, type BrowserActionEvent, BrowserActionRecorder, type BrowserConnection, type BrowserMode, type BrowserPage, BrowserReconnected, BrowserReconnector, type BrowserTier, BrowserUnrecoverable, CALL_BODY_LIMIT_BYTES, CALL_BODY_LIMIT_LABEL, COMPUTER_USE_SPECS, type Checkout, CheckoutProvenance, ComputerAction, type ComputerCallOutput, type CreateEvaluationOptions, DEFAULT_BRANCH, DEFAULT_VIEWPORT, DRY_RUN_AGENT, DRY_RUN_KIND, DetachedPushError, type DispatchedRun, Display, type DryRunImageDecision, DryRunOutcome, type DryRunSettlement, EVENT_BATCH_SIZE, EVENT_FLUSH_INTERVAL_MS, EVENT_MAX_RETRIES, EXPLORATORY_TASK, EXPLORATORY_TASK_SOURCE, type EditSessionCloseInput, type EditSessionList, type EditSessionListQuery, type EditSessionResult, type EditSessionRollbackInput, type EditSessionSummary, type EvalSample, type FinalizeEvaluationOptions, GatewayEvalsClient, type GradeResult, HostedDryRunClient, type HostedDryRunDispatch, type HostedDryRunStatus, type HostedDryRunVerdict, IDLE_WARNING_MINUTES, type IngestExplode, type IngestFieldSpec, type IngestMapping, type IngestMode, type IngestOptions, type IngestRefusal, type IngestReport, type IngestSource, type IngestSourceReport, type IngestToolCallsOptions, type IngestToolCallsReport, KEY_NAMES, KeyChord, type ListRunsFilter, type ListSessionsFilter, type LiveTaskSession, type LocalMeta, type MigrateWorldOptions, NOT_EXECUTED, NO_GRADER_REASON, NativeComputer, type NativeComputerKinds, type NativeComputerOptions, type NativeComputerProvider, type NativePage, type ObservationConversion, type ObservationLike, OpenAIComputer, OpenAIPreviewComputer, type OpenSessionOptions, type OpenTaskOptions, type ParsedToolCall, PendingSafetyChecks, type Plaintext, PlatformMethod, type PlaywrightBrowserLike, type PlaywrightLike, PushSlugConflict, type PushSlugResolution, RECOVER_BUDGET_MS, type RebaseConflictPath, type RecoveryResult, type RedactMode, type RedactPolicy, type Redaction, type RepairAnswer, type ResolvedWorldVersion, type RunConfigInput, type RunConfigSummary, type RunProvenance, type RunReport, type RunSetOptions, type RunSetResult, type RunSummary, type RunTaskOptions, type RunTaskSummary, SANDBOX_REQUEST_TIMEOUT_MS, SECRET_KEY, SESSION_STATES, SPAN_PREFIX, STATUS_WAIT_CAP_SECONDS, STRIP_PREFIX, SURFACE_KINDS, type SafetyCheck, type SandboxChanges, type SandboxCheckResult, type SandboxCommitInput, type SandboxCommitResult, type SandboxExecResult, type SandboxImportInput, type SandboxImportPending, type SandboxImportResult, type SandboxListFilter, type SandboxOpenExisting, type SandboxOpenNew, type SandboxOpenTarget, type SandboxOpened, type SandboxSummary, Screen, type ScreenBrowser, SecretScrubber, type SeedResult, type SessionRunReport, type SessionRunResult, type SessionSurfaces, type SetRunDoc, type SettleOptions, type SlugDeclaration, type SurfaceDescriptor, TRANSFORMS, TaskEditClient, type TaskEditCloseInput, type TaskEditCloseResult, type TaskEditRollbackInput, type TaskEditRollbackResult, type TaskEditSealed, type TaskEditStatus, type TaskEditTarget, type TaskEditTaskRef, type TaskExport, type TaskGrade, type TaskManifest, type TaskManifestSession, TaskRun, type TaskRunResult, TaskSessions, type TaskSessionsResponse, type TaskWorldRef, type TaskWorldSessionState, type ToolCallRecord, type ToolCallSink, type ToolFunctions, type Transform, VERIFIER_REWARD_PREFIX, type ValidateReport, type ValidatedRun, type VerifierGrade, WHITESPACE, WorldBrowser, WorldCallTooLarge, type WorldDependency, type WorldDeprecation, type WorldDescription, WorldEditClient, type WorldEntity, type WorldEntityMapping, type WorldField, type WorldMigrationRefusal, type WorldMigrationReport, type WorldQueryAcrossOptions, type WorldQueryAcrossResult, type WorldQueryCompare, type WorldQueryCompareStatus, type WorldQueryGroup, type WorldQueryOptions, type WorldQueryResult, type WorldQuerySnapshot, type WorldQueryWhere, type WorldRelationship, type WorldRequest, WorldRequestLog, WorldSandboxClient, WorldSession, type WorldSessionCall, WorldSessionCallError, type WorldSessionListItem, type WorldSessionState, type WorldSessionTask, WorldSessionTimeout, WorldSet, type WorldSurfaceKind, WorldSurfaceUnavailable, WorldTask, type WorldTaskCheck, type WorldTaskDetail, type WorldTaskFieldOp, type WorldTaskGrader, type WorldTaskIdRef, type WorldTaskInfo, type WorldTaskPage, type WorldTaskRef, type WorldTaskRubricCriterion, type WorldTaskRubricGrader, type WorldTaskScalar, type WorldTaskSeed, type WorldTaskSpec, type WorldTaskSummary, type WorldTaskValidation, type WorldTaskVerifier, type WorldTaskVerifierRow, type WorldTaskVersionSummary, type WorldTaskWorld, type WorldTaskWorldValidation, type WorldToolSpec, type WorldToolkit, type WorldsClientOptions, aggregateTaskGrade, apiRequest, applyTransforms, archiveMode, assertBrowserTier, assertTaskRef, attachManifest, attachSession, attachTask, buildFileManifest, buildSourceTarball, captureToolCalls, checkoutIdentity, closeConnection, collectArchiveRelPaths, computeContentHash, computerUseToolkit, createRef, createTask, deleteEnvSecret, deleteTask, describeWorld, detectProvenance, extractBundle, getRun, getTask, hashForm, idleWarning, ingest, ingestToolCalls, isBrowserGone, isSandboxImportPending, isTaskIdRef, isTaskManifest, isTaskSpec, listEnvSecretKeys, listRunConfigs, listRuns, listSessions, listTaskSessions, listTasks, localTreeState, migrateProjectWorlds, migrateWorld, modelToolName, openBrowser, openSession, openTask, openWorld, openWorldVersion, parseErrorBody, parseSlugRef, parseToolCallRecord, parseTransform, parseWorldTaskRefs, playwrightKey, preserveForm, propose, pull, push, pushBranch, pushSlug, pyText, queryRows, queryRowsSearch, readField, readLocalMeta, readToolCallRecords, rebaseConflicts, redactActionArgs, redactionOf, releaseConnection, resolveBrowserMode, resolvePushSlug, roundForm, runSessions, runSet, runTask, schemaFromSignature, serializeCallBody, sessionToolObservations, setEnvSecret, shapeText, snapshotTreeHashes, storedForms, surfaceDescriptor, surfaceKinds, taskLabel, toolCallRecordsIn, toolCallsFromObservations, uiEntryUrl, uiUrl, uncommittedPaths, updateTask, upsertRunConfig, validateTask, validateWorld, waitForRun, withoutUiToken, writeLocalMeta };
|