@withgateway/sdk 0.2.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -8
- package/dist/cli.js +2695 -657
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2675 -637
- 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 +1443 -36
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +1441 -28
- package/dist/files/index.mjs.map +1 -1
- package/dist/{index-Cz8Q6Keo.d.mts → index-D6oi1TWE.d.mts} +93 -34
- package/dist/{index-BO2SNSgy.d.ts → index-DAb-FCMg.d.ts} +93 -34
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1986 -235
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1941 -218
- 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 +1440 -33
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +1438 -25
- 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 +512 -11
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +501 -10
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +614 -25
- package/dist/worlds/index.d.ts +614 -25
- package/dist/worlds/index.js +1923 -214
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +1910 -201
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/gatewaysdk/environment/_toml.py +3 -10
- package/runtime/gatewaysdk/environment/schema/api.py +38 -56
- 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/runtime.py +9 -9
- package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +3 -3
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +1 -1
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +18 -18
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +4 -2
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +5 -1
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/new-world-sandbox.md +5 -3
- package/runtime/gatewaysdk/environment/schema/store.py +15 -6
- package/runtime/gatewaysdk/environment/schema/tasks.py +25 -1
- package/skills/benchmarks-getting-started/SKILL.md +3 -3
- package/skills/connector-schema-authoring/SKILL.md +1 -1
- package/skills/connector-schema-authoring/world-schema.md +1 -1
- package/skills/worlds-getting-started/SKILL.md +18 -18
- package/skills/worlds-getting-started/references/cli-mcp-map.md +4 -2
- package/skills/worlds-getting-started/references/gotchas.md +5 -1
- package/skills/worlds-getting-started/references/new-world-sandbox.md +5 -3
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>;
|
|
@@ -1264,13 +1748,24 @@ type WorldTaskWorld = {
|
|
|
1264
1748
|
grader?: WorldTaskSpec["grader"];
|
|
1265
1749
|
tools?: string[];
|
|
1266
1750
|
};
|
|
1267
|
-
/** One world's session as the platform answered it at up.
|
|
1751
|
+
/** One world's session as the platform answered it at up. `private`: the
|
|
1752
|
+
* world came up on the caller's own unsealed edits (its edit session's tip
|
|
1753
|
+
* answered `main`). */
|
|
1268
1754
|
type TaskWorldSessionState = WorldSessionState & {
|
|
1269
1755
|
alias: string;
|
|
1270
1756
|
slug: string;
|
|
1271
1757
|
ref: string;
|
|
1758
|
+
private: boolean;
|
|
1272
1759
|
reusedWarm: boolean;
|
|
1273
1760
|
};
|
|
1761
|
+
/** Which world an alias is, as recorded at up or attach. `private` is null
|
|
1762
|
+
* when it is not known (attached by task id, or a manifest written before
|
|
1763
|
+
* the platform reported it). */
|
|
1764
|
+
type TaskWorldRef = {
|
|
1765
|
+
slug: string;
|
|
1766
|
+
ref: string | null;
|
|
1767
|
+
private: boolean | null;
|
|
1768
|
+
};
|
|
1274
1769
|
/** What `POST /world-task-sessions` answers. */
|
|
1275
1770
|
type TaskSessionsResponse = {
|
|
1276
1771
|
taskId: string | null;
|
|
@@ -1285,6 +1780,7 @@ type TaskSessionsResponse = {
|
|
|
1285
1780
|
type TaskManifestSession = {
|
|
1286
1781
|
slug: string;
|
|
1287
1782
|
ref: string | null;
|
|
1783
|
+
private: boolean | null;
|
|
1288
1784
|
versionId: string;
|
|
1289
1785
|
sessionId: string;
|
|
1290
1786
|
ready: boolean;
|
|
@@ -1368,20 +1864,14 @@ declare class TaskSessions {
|
|
|
1368
1864
|
/** The instruction every world's session shares. */
|
|
1369
1865
|
instruction: string | null,
|
|
1370
1866
|
/** One live session per alias, in the spec's order. */
|
|
1371
|
-
sessions: Record<string, WorldSession>, worlds: Record<string,
|
|
1372
|
-
slug: string;
|
|
1373
|
-
ref: string | null;
|
|
1374
|
-
}>,
|
|
1867
|
+
sessions: Record<string, WorldSession>, worlds: Record<string, TaskWorldRef>,
|
|
1375
1868
|
/** The spec's content hash — set only by `openTask` (the raw platform
|
|
1376
1869
|
* response carries it); null for a `TaskSessions` rebuilt with
|
|
1377
1870
|
* `attachManifest`/`attachTask`, which have no spec to hash. */
|
|
1378
1871
|
hash?: string | null);
|
|
1379
|
-
/** This alias's
|
|
1380
|
-
*
|
|
1381
|
-
worldRef(alias: string):
|
|
1382
|
-
slug: string;
|
|
1383
|
-
ref: string | null;
|
|
1384
|
-
};
|
|
1872
|
+
/** This alias's world as recorded at open/attach — what a `TaskRun`
|
|
1873
|
+
* filing needs to name, without exposing the whole map. */
|
|
1874
|
+
worldRef(alias: string): TaskWorldRef;
|
|
1385
1875
|
/** The aliases, in the spec's order. */
|
|
1386
1876
|
get aliases(): string[];
|
|
1387
1877
|
/** The alias's session, or a clear error naming the aliases there are. */
|
|
@@ -2669,6 +3159,23 @@ type SandboxOpenNew = {
|
|
|
2669
3159
|
type SandboxOpenTarget = SandboxOpenExisting | SandboxOpenNew;
|
|
2670
3160
|
/** `slug` or `slug@ref` → the open body; a bare slug opens the latest READY version. */
|
|
2671
3161
|
declare function parseSlugRef(slugRef: string): SandboxOpenExisting;
|
|
3162
|
+
/** One sandbox request may run the platform's longest exec (600 s) plus the answer; the Python twin waits the same 660 s. */
|
|
3163
|
+
declare const SANDBOX_REQUEST_TIMEOUT_MS = 660000;
|
|
3164
|
+
/** Mirrors `PostSandboxCommitBody`: `rebase` replays the sandbox's edits onto the branch head when the base moved. */
|
|
3165
|
+
type SandboxCommitInput = {
|
|
3166
|
+
message: string;
|
|
3167
|
+
branch?: string;
|
|
3168
|
+
rebase?: boolean;
|
|
3169
|
+
};
|
|
3170
|
+
/** One path a rebase refused, as the 409 body's `conflicts[]` names it. */
|
|
3171
|
+
type RebaseConflictPath = {
|
|
3172
|
+
path: string;
|
|
3173
|
+
reason: string;
|
|
3174
|
+
};
|
|
3175
|
+
/** A 409 from `commit --rebase`: the paths both sides changed and why each was refused. Null for any other failure. */
|
|
3176
|
+
declare function rebaseConflicts(error: unknown): RebaseConflictPath[] | null;
|
|
3177
|
+
/** A 409 `sandbox_uncommitted` from `close`: the paths a commit would keep. Null for any other failure. */
|
|
3178
|
+
declare function uncommittedPaths(error: unknown): string[] | null;
|
|
2672
3179
|
/** `sandbox list` narrows: status, world, count (newest first). */
|
|
2673
3180
|
type SandboxListFilter = {
|
|
2674
3181
|
status?: "open" | "closed";
|
|
@@ -2678,6 +3185,7 @@ type SandboxListFilter = {
|
|
|
2678
3185
|
declare class WorldSandboxClient {
|
|
2679
3186
|
private readonly options;
|
|
2680
3187
|
constructor(options?: WorldsClientOptions);
|
|
3188
|
+
private request;
|
|
2681
3189
|
/**
|
|
2682
3190
|
* `{ slug, ref? }` opens a READY version; `{ new, from }` opens a sandbox on
|
|
2683
3191
|
* a world that does not exist yet (409 `world_exists` if the slug is taken,
|
|
@@ -2703,10 +3211,8 @@ declare class WorldSandboxClient {
|
|
|
2703
3211
|
timeoutMs?: number;
|
|
2704
3212
|
}): Promise<SandboxExecResult>;
|
|
2705
3213
|
check(sandboxId: string): Promise<SandboxCheckResult>;
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
branch?: string;
|
|
2709
|
-
}): Promise<SandboxCommitResult>;
|
|
3214
|
+
/** With `rebase`, a moved base is replayed onto; a 409 then names the conflicting paths (`rebaseConflicts`). */
|
|
3215
|
+
commit(sandboxId: string, input: SandboxCommitInput): Promise<SandboxCommitResult>;
|
|
2710
3216
|
/**
|
|
2711
3217
|
* A rows file already in the sandbox tree into the PLATFORM world the
|
|
2712
3218
|
* sandbox was opened on (201 with the version, 202 with the batch to poll,
|
|
@@ -2714,7 +3220,10 @@ declare class WorldSandboxClient {
|
|
|
2714
3220
|
* tree and never carries data.
|
|
2715
3221
|
*/
|
|
2716
3222
|
importData(sandboxId: string, input: SandboxImportInput): Promise<SandboxImportResult | SandboxImportPending>;
|
|
2717
|
-
|
|
3223
|
+
/** Uncommitted work is a 409 (`uncommittedPaths`) unless `force` discards it. */
|
|
3224
|
+
close(sandboxId: string, opts?: {
|
|
3225
|
+
force?: boolean;
|
|
3226
|
+
}): Promise<SandboxSummary>;
|
|
2718
3227
|
}
|
|
2719
3228
|
|
|
2720
3229
|
/**
|
|
@@ -2749,6 +3258,8 @@ type EditSessionSummary = {
|
|
|
2749
3258
|
conflictPaths: string[] | null;
|
|
2750
3259
|
rollbackOfId: string | null;
|
|
2751
3260
|
message: string | null;
|
|
3261
|
+
/** Set when `task edit close` sealed this session together with a task's other worlds. */
|
|
3262
|
+
sealGroupId: string | null;
|
|
2752
3263
|
};
|
|
2753
3264
|
type EditSessionList = {
|
|
2754
3265
|
slug: string;
|
|
@@ -2790,6 +3301,80 @@ declare class WorldEditClient {
|
|
|
2790
3301
|
/** Undo a sealed session (source and data) as a new sealed session. */
|
|
2791
3302
|
rollback(slug: string, input: EditSessionRollbackInput): Promise<EditSessionResult>;
|
|
2792
3303
|
}
|
|
3304
|
+
/** A stored task (`{id, version?}`) or a spec with `worlds`, as `task up` takes it. */
|
|
3305
|
+
type TaskEditTarget = WorldTaskIdRef | WorldTaskSpec;
|
|
3306
|
+
/** The task the platform resolved: stored id and version, or the spec's hash. */
|
|
3307
|
+
type TaskEditTaskRef = {
|
|
3308
|
+
taskId: string | null;
|
|
3309
|
+
taskVersion: number | null;
|
|
3310
|
+
name: string | null;
|
|
3311
|
+
hash: string;
|
|
3312
|
+
};
|
|
3313
|
+
/** Mirrors `TaskEditStatusResponseSchema` (web/features/public-api/types/world-task-edits.ts). */
|
|
3314
|
+
type TaskEditStatus = {
|
|
3315
|
+
task: TaskEditTaskRef;
|
|
3316
|
+
worlds: Record<string, {
|
|
3317
|
+
slug: string;
|
|
3318
|
+
ref: string;
|
|
3319
|
+
problem: string | null;
|
|
3320
|
+
session: EditSessionSummary | null;
|
|
3321
|
+
/** This credential's sessions parked in `conflict` on the world: unsealed too. */
|
|
3322
|
+
parked: EditSessionSummary[];
|
|
3323
|
+
mainVersionId: string | null;
|
|
3324
|
+
sealNow: "fast-forward" | "rebase" | "conflict" | null;
|
|
3325
|
+
conflictPaths: string[];
|
|
3326
|
+
}>;
|
|
3327
|
+
/** Aliases whose world holds edits only this credential sees. */
|
|
3328
|
+
unsealed: string[];
|
|
3329
|
+
hint: string | null;
|
|
3330
|
+
};
|
|
3331
|
+
type TaskEditSealed = {
|
|
3332
|
+
slug: string;
|
|
3333
|
+
session: EditSessionSummary;
|
|
3334
|
+
};
|
|
3335
|
+
type TaskEditCloseResult = {
|
|
3336
|
+
task: TaskEditTaskRef;
|
|
3337
|
+
groupId: string | null;
|
|
3338
|
+
worlds: Record<string, TaskEditSealed>;
|
|
3339
|
+
skipped: Record<string, {
|
|
3340
|
+
slug: string;
|
|
3341
|
+
reason: string;
|
|
3342
|
+
}>;
|
|
3343
|
+
};
|
|
3344
|
+
type TaskEditRollbackResult = {
|
|
3345
|
+
task: TaskEditTaskRef;
|
|
3346
|
+
groupId: string;
|
|
3347
|
+
rollbackOf: string;
|
|
3348
|
+
worlds: Record<string, TaskEditSealed>;
|
|
3349
|
+
/** Members whose seal left `main` where it was: nothing to undo there. */
|
|
3350
|
+
skipped: Record<string, {
|
|
3351
|
+
slug: string;
|
|
3352
|
+
reason: string;
|
|
3353
|
+
}>;
|
|
3354
|
+
};
|
|
3355
|
+
type TaskEditCloseInput = {
|
|
3356
|
+
requireAll?: boolean;
|
|
3357
|
+
force?: boolean;
|
|
3358
|
+
message?: string;
|
|
3359
|
+
};
|
|
3360
|
+
type TaskEditRollbackInput = {
|
|
3361
|
+
groupId: string;
|
|
3362
|
+
force?: boolean;
|
|
3363
|
+
message?: string;
|
|
3364
|
+
};
|
|
3365
|
+
/**
|
|
3366
|
+
* This credential's edit sessions on every world a task names, together:
|
|
3367
|
+
* `close` seals them onto their mains in ONE platform transaction (all or
|
|
3368
|
+
* none), `rollback` undoes the seal group as one. Python twin:
|
|
3369
|
+
* `gatewaysdk.benchmark_hub.edit_sessions.TaskEditClient`.
|
|
3370
|
+
*/
|
|
3371
|
+
declare class TaskEditClient {
|
|
3372
|
+
private readonly options;
|
|
3373
|
+
constructor(options?: WorldsClientOptions);
|
|
3374
|
+
status(task: TaskEditTarget): Promise<TaskEditStatus>;
|
|
3375
|
+
close(task: TaskEditTarget, input?: TaskEditCloseInput): Promise<TaskEditCloseResult>;
|
|
3376
|
+
rollback(task: TaskEditTarget, input: TaskEditRollbackInput): Promise<TaskEditRollbackResult>;
|
|
3377
|
+
}
|
|
2793
3378
|
|
|
2794
3379
|
/**
|
|
2795
3380
|
* The hosted one-task dry run: `POST /api/public/environments/{id}/dry-run`
|
|
@@ -2921,8 +3506,9 @@ type DispatchedRun = {
|
|
|
2921
3506
|
* server's error class name. */
|
|
2922
3507
|
declare class ApiError extends Error {
|
|
2923
3508
|
readonly status: number;
|
|
3509
|
+
readonly text: string;
|
|
2924
3510
|
readonly code: string | null;
|
|
2925
|
-
constructor(status: number, method: string, path: string,
|
|
3511
|
+
constructor(status: number, method: string, path: string, text: string);
|
|
2926
3512
|
}
|
|
2927
3513
|
/** What a client shows for one non-2xx body and the stable code it carries.
|
|
2928
3514
|
* Python twin: `gatewaysdk.api_errors.error_detail`. */
|
|
@@ -2931,8 +3517,11 @@ declare function parseErrorBody(text: string, limit?: number): {
|
|
|
2931
3517
|
code: string | null;
|
|
2932
3518
|
};
|
|
2933
3519
|
/** Authenticated JSON request against the platform API — the primitive the
|
|
2934
|
-
* worlds helpers and the TS CLI share.
|
|
2935
|
-
|
|
3520
|
+
* worlds helpers and the TS CLI share. `init.timeoutMs` is the request's own
|
|
3521
|
+
* budget when it legitimately outlasts `GATEWAY_TIMEOUT_MS`. */
|
|
3522
|
+
declare function apiRequest<T>(options: WorldsClientOptions, method: PlatformMethod, path: string, body?: unknown, init?: {
|
|
3523
|
+
timeoutMs?: number;
|
|
3524
|
+
}): Promise<T>;
|
|
2936
3525
|
/** Set (or rotate) one environment secret — write-only: no API returns it. */
|
|
2937
3526
|
declare function setEnvSecret(slug: string, key: string, value: string, options?: WorldsClientOptions): Promise<{
|
|
2938
3527
|
key: string;
|
|
@@ -3123,4 +3712,4 @@ declare function openWorld(slugRef: string, options?: WorldsClientOptions): Prom
|
|
|
3123
3712
|
*/
|
|
3124
3713
|
declare function openWorldVersion(slug: string, versionId: string, options?: WorldsClientOptions): Promise<WorldSet>;
|
|
3125
3714
|
|
|
3126
|
-
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 ObservationConversion, type ObservationLike, type OpenSessionOptions, type OpenTaskOptions, type ParsedToolCall, type Plaintext, type PlaywrightBrowserLike, type PlaywrightLike, PushSlugConflict, type PushSlugResolution, RECOVER_BUDGET_MS, 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, SESSION_STATES, STATUS_WAIT_CAP_SECONDS, STRIP_PREFIX, SURFACE_KINDS, type SandboxChanges, type SandboxCheckResult, type SandboxCommitResult, type SandboxExecResult, type SandboxImportInput, type SandboxImportPending, type SandboxImportResult, type SandboxListFilter, type SandboxOpenExisting, type SandboxOpenNew, type SandboxOpenTarget, type SandboxOpened, type SandboxSummary, SecretScrubber, type SeedResult, type SessionRunReport, type SessionRunResult, type SessionSurfaces, type SetRunDoc, type SettleOptions, type SlugDeclaration, TRANSFORMS, type TaskExport, type TaskGrade, type TaskManifest, type TaskManifestSession, TaskRun, type TaskRunResult, TaskSessions, type TaskSessionsResponse, 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, 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, preserveForm, propose, pull, push, pushBranch, pushSlug, pyText, queryRows, queryRowsSearch, readLocalMeta, readToolCallRecords, redactActionArgs, redactionOf, releaseConnection, resolveBrowserMode, resolvePushSlug, roundForm, runSessions, runSet, runTask, schemaFromSignature, serializeCallBody, sessionToolObservations, setEnvSecret, shapeText, snapshotTreeHashes, storedForms, surfaceKinds, taskLabel, toolCallRecordsIn, toolCallsFromObservations, uiEntryUrl, uiUrl, updateTask, upsertRunConfig, validateTask, validateWorld, waitForRun, withoutUiToken, writeLocalMeta };
|
|
3715
|
+
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, 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, 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, surfaceKinds, taskLabel, toolCallRecordsIn, toolCallsFromObservations, uiEntryUrl, uiUrl, uncommittedPaths, updateTask, upsertRunConfig, validateTask, validateWorld, waitForRun, withoutUiToken, writeLocalMeta };
|