@withgateway/sdk 0.1.20 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -2
- package/dist/cli.js +8683 -1343
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +8683 -1344
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +979 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +943 -38
- package/dist/index.mjs.map +1 -1
- package/dist/tracing/index.js +9 -2
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +9 -2
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +738 -28
- package/dist/worlds/index.d.ts +738 -28
- package/dist/worlds/index.js +940 -42
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +934 -36
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +9 -2
- package/runtime/gatewaysdk/__init__.py +0 -0
- package/runtime/gatewaysdk/environment/__init__.py +108 -0
- package/runtime/gatewaysdk/environment/_bundle.py +281 -0
- package/runtime/gatewaysdk/environment/_harbor.py +276 -0
- package/runtime/gatewaysdk/environment/_materialize.py +97 -0
- package/runtime/gatewaysdk/environment/_tar.py +33 -0
- package/runtime/gatewaysdk/environment/_world.py +346 -0
- package/runtime/gatewaysdk/environment/core.py +527 -0
- package/runtime/gatewaysdk/environment/errors.py +58 -0
- package/runtime/gatewaysdk/environment/runtime.py +150 -0
- package/runtime/gatewaysdk/environment/schema/__init__.py +35 -0
- package/runtime/gatewaysdk/environment/schema/__main__.py +225 -0
- package/runtime/gatewaysdk/environment/schema/_slack_fidelity.py +116 -0
- package/runtime/gatewaysdk/environment/schema/_slack_scenario.py +183 -0
- package/runtime/gatewaysdk/environment/schema/api.py +1628 -0
- package/runtime/gatewaysdk/environment/schema/batch.py +755 -0
- package/runtime/gatewaysdk/environment/schema/compiler.py +615 -0
- package/runtime/gatewaysdk/environment/schema/conform.py +428 -0
- package/runtime/gatewaysdk/environment/schema/connector.py +777 -0
- package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/handlers.py +17 -0
- package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/parity.json +28 -0
- package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/provenance.json +233 -0
- package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scope.toml +112 -0
- package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/world.json +1380 -0
- package/runtime/gatewaysdk/environment/schema/connectors/base.json +28 -0
- package/runtime/gatewaysdk/environment/schema/connectors/custom/handlers.py +18 -0
- package/runtime/gatewaysdk/environment/schema/connectors/custom/world.json +123 -0
- package/runtime/gatewaysdk/environment/schema/connectors/github/handlers.py +81 -0
- package/runtime/gatewaysdk/environment/schema/connectors/github/parity.json +37 -0
- package/runtime/gatewaysdk/environment/schema/connectors/github/provenance.json +134 -0
- package/runtime/gatewaysdk/environment/schema/connectors/github/scope.toml +158 -0
- package/runtime/gatewaysdk/environment/schema/connectors/github/world.json +5869 -0
- package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/handlers.py +23 -0
- package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/world.json +209 -0
- package/runtime/gatewaysdk/environment/schema/connectors/google-drive/handlers.py +18 -0
- package/runtime/gatewaysdk/environment/schema/connectors/google-drive/world.json +286 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/handlers.py +34 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/parity.json +49 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/provenance.json +181 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/scope.toml +128 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/world.json +2218 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jira/handlers.py +28 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jira/world.json +389 -0
- package/runtime/gatewaysdk/environment/schema/connectors/kandji/handlers.py +38 -0
- package/runtime/gatewaysdk/environment/schema/connectors/kandji/parity.json +29 -0
- package/runtime/gatewaysdk/environment/schema/connectors/kandji/provenance.json +152 -0
- package/runtime/gatewaysdk/environment/schema/connectors/kandji/scope.toml +120 -0
- package/runtime/gatewaysdk/environment/schema/connectors/kandji/world.json +765 -0
- package/runtime/gatewaysdk/environment/schema/connectors/linear/handlers.py +20 -0
- package/runtime/gatewaysdk/environment/schema/connectors/linear/world.json +363 -0
- package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/fidelity.json +45 -0
- package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/handlers.py +1 -0
- package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/provenance.json +851 -0
- package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scope.md +231 -0
- package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/teams-types.json +1710 -0
- package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/world.json +858 -0
- package/runtime/gatewaysdk/environment/schema/connectors/netsuite/handlers.py +32 -0
- package/runtime/gatewaysdk/environment/schema/connectors/netsuite/parity.json +50 -0
- package/runtime/gatewaysdk/environment/schema/connectors/netsuite/provenance.json +137 -0
- package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scope.toml +78 -0
- package/runtime/gatewaysdk/environment/schema/connectors/netsuite/world.json +16243 -0
- package/runtime/gatewaysdk/environment/schema/connectors/salesforce/handlers.py +806 -0
- package/runtime/gatewaysdk/environment/schema/connectors/salesforce/parity.json +46 -0
- package/runtime/gatewaysdk/environment/schema/connectors/salesforce/provenance.json +143 -0
- package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scope.toml +174 -0
- package/runtime/gatewaysdk/environment/schema/connectors/salesforce/world.json +4695 -0
- package/runtime/gatewaysdk/environment/schema/connectors/slack/MODEL.md +236 -0
- package/runtime/gatewaysdk/environment/schema/connectors/slack/capabilities.json +1039 -0
- package/runtime/gatewaysdk/environment/schema/connectors/slack/handlers.py +762 -0
- package/runtime/gatewaysdk/environment/schema/connectors/slack/parity.json +65 -0
- package/runtime/gatewaysdk/environment/schema/connectors/slack/provenance.json +294 -0
- package/runtime/gatewaysdk/environment/schema/connectors/slack/scope.toml +44 -0
- package/runtime/gatewaysdk/environment/schema/connectors/slack/world.json +4993 -0
- package/runtime/gatewaysdk/environment/schema/connectors/workday/handlers.py +75 -0
- package/runtime/gatewaysdk/environment/schema/connectors/workday/parity.json +36 -0
- package/runtime/gatewaysdk/environment/schema/connectors/workday/provenance.json +179 -0
- package/runtime/gatewaysdk/environment/schema/connectors/workday/scope.toml +180 -0
- package/runtime/gatewaysdk/environment/schema/connectors/workday/world.json +806 -0
- package/runtime/gatewaysdk/environment/schema/data.py +593 -0
- package/runtime/gatewaysdk/environment/schema/extract.py +263 -0
- package/runtime/gatewaysdk/environment/schema/host.py +2407 -0
- package/runtime/gatewaysdk/environment/schema/host_surfaces.py +275 -0
- package/runtime/gatewaysdk/environment/schema/platform.py +1272 -0
- package/runtime/gatewaysdk/environment/schema/scaffold.py +250 -0
- package/runtime/gatewaysdk/environment/schema/skill.py +118 -0
- package/runtime/gatewaysdk/environment/schema/skills/agents/connector-template-author.md +202 -0
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/CONNECTORS.md +331 -0
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/CONVENTIONS.md +100 -0
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +313 -0
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +223 -0
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +293 -0
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +390 -0
- package/runtime/gatewaysdk/environment/schema/slack.py +757 -0
- package/runtime/gatewaysdk/environment/schema/snapshot.py +479 -0
- package/runtime/gatewaysdk/environment/schema/store.py +904 -0
- package/runtime/gatewaysdk/environment/schema/tasks.py +525 -0
- package/runtime/gatewaysdk/environment/schema/tools_world.py +322 -0
- package/runtime/gatewaysdk/environment/schema/validation.py +577 -0
- package/runtime/gatewaysdk/environment/schema/worker.py +78 -0
- package/runtime/gatewaysdk/environment/schema/workers.py +500 -0
- package/runtime/gatewaysdk/environment/schema/world_tests.py +336 -0
- package/skills/agents/connector-template-author.md +202 -0
- package/skills/connector-schema-authoring/CONNECTORS.md +331 -0
- package/skills/connector-schema-authoring/CONVENTIONS.md +100 -0
- package/skills/connector-schema-authoring/SKILL.md +313 -0
- package/skills/world-data-ingestion/ROWS.md +223 -0
- package/skills/world-data-ingestion/SKILL.md +293 -0
- package/skills/worlds-getting-started/SKILL.md +390 -0
package/dist/index.js
CHANGED
|
@@ -33,6 +33,483 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
+
// src/worlds/browser.ts
|
|
37
|
+
function surfaceKinds(s) {
|
|
38
|
+
const kinds = ["tools"];
|
|
39
|
+
if (s.api) kinds.push("api");
|
|
40
|
+
if (s.ui) kinds.push("ui");
|
|
41
|
+
if (s.browser) kinds.push("browser");
|
|
42
|
+
return kinds;
|
|
43
|
+
}
|
|
44
|
+
function uiUrl(ui, path2) {
|
|
45
|
+
const base = ui.url.replace(/\/+$/, "");
|
|
46
|
+
const rel = path2.startsWith("/") ? path2 : `/${path2}`;
|
|
47
|
+
if (!ui.token) return base + rel;
|
|
48
|
+
const [beforeHash, hash] = splitHash(rel);
|
|
49
|
+
const joiner = beforeHash.includes("?") ? "&" : "?";
|
|
50
|
+
const query = `${UI_TOKEN_QUERY}=${encodeURIComponent(ui.token)}`;
|
|
51
|
+
return base + beforeHash + joiner + query + hash;
|
|
52
|
+
}
|
|
53
|
+
function uiEntryUrl(ui) {
|
|
54
|
+
return uiUrl(ui, ui.entry || "/");
|
|
55
|
+
}
|
|
56
|
+
function withoutUiToken(url) {
|
|
57
|
+
const [beforeHash, hash] = splitHash(url);
|
|
58
|
+
const q = beforeHash.indexOf("?");
|
|
59
|
+
if (q < 0) return url;
|
|
60
|
+
const kept = beforeHash.slice(q + 1).split("&").filter((pair) => pair !== "" && pair.split("=")[0] !== UI_TOKEN_QUERY);
|
|
61
|
+
return beforeHash.slice(0, q) + (kept.length ? `?${kept.join("&")}` : "") + hash;
|
|
62
|
+
}
|
|
63
|
+
function splitHash(url) {
|
|
64
|
+
const h = url.indexOf("#");
|
|
65
|
+
return h < 0 ? [url, ""] : [url.slice(0, h), url.slice(h)];
|
|
66
|
+
}
|
|
67
|
+
function redactActionArgs(action, args) {
|
|
68
|
+
const secretField = action === "browser_type" && SECRET_KEY.test(String(args.selector ?? ""));
|
|
69
|
+
const out = {};
|
|
70
|
+
for (const [key, value] of Object.entries(args)) {
|
|
71
|
+
if (value === null || value === void 0) out[key] = null;
|
|
72
|
+
else if (typeof value === "boolean" || typeof value === "number")
|
|
73
|
+
out[key] = value;
|
|
74
|
+
else if (typeof value === "string") {
|
|
75
|
+
if (SECRET_KEY.test(key) || SECRET_VALUE.test(value) || secretField && key === "text")
|
|
76
|
+
out[key] = "[redacted]";
|
|
77
|
+
else
|
|
78
|
+
out[key] = value.length <= EVENT_MAX_STRING ? value : value.slice(0, EVENT_MAX_STRING) + "\u2026";
|
|
79
|
+
} else out[key] = "[omitted]";
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
async function loadPlaywright() {
|
|
84
|
+
try {
|
|
85
|
+
const name = "playwright";
|
|
86
|
+
return await import(name);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
"Driving a world UI needs Playwright: npm install playwright (and `npx playwright install chromium` for local mode).",
|
|
90
|
+
{ cause: error }
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function resolveBrowserMode(surfaces, mode) {
|
|
95
|
+
if (!surfaces.ui && !surfaces.browser)
|
|
96
|
+
throw new WorldSurfaceUnavailable(
|
|
97
|
+
"ui",
|
|
98
|
+
"open the session with surfaces: ['ui'] on a world that declares [ui]"
|
|
99
|
+
);
|
|
100
|
+
const resolved = mode === "auto" ? surfaces.browser ? "hosted" : "local" : mode;
|
|
101
|
+
if (resolved === "hosted" && !surfaces.browser)
|
|
102
|
+
throw new WorldSurfaceUnavailable(
|
|
103
|
+
"browser",
|
|
104
|
+
"open the session with surfaces: ['browser'] to get a hosted browser"
|
|
105
|
+
);
|
|
106
|
+
return resolved;
|
|
107
|
+
}
|
|
108
|
+
async function openBrowser(surfaces, opts = {}) {
|
|
109
|
+
const mode = resolveBrowserMode(surfaces, opts.mode ?? "auto");
|
|
110
|
+
const pw = opts.playwright ?? await loadPlaywright();
|
|
111
|
+
const viewport = surfaces.browser?.viewport ?? DEFAULT_VIEWPORT;
|
|
112
|
+
const browser = mode === "hosted" ? surfaces.browser.protocol === "playwright" ? await pw.chromium.connect(surfaces.browser.wsUrl) : await pw.chromium.connectOverCDP(surfaces.browser.wsUrl) : await pw.chromium.launch({ headless: opts.headless ?? true });
|
|
113
|
+
const context4 = await browser.newContext({ viewport });
|
|
114
|
+
const page = await context4.newPage();
|
|
115
|
+
return new WorldBrowser(
|
|
116
|
+
page,
|
|
117
|
+
surfaces.ui,
|
|
118
|
+
mode,
|
|
119
|
+
async () => {
|
|
120
|
+
await context4.close();
|
|
121
|
+
await browser.close();
|
|
122
|
+
},
|
|
123
|
+
viewport,
|
|
124
|
+
opts.recorder ?? null
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
function computerUseToolkit(browser, opts = {}) {
|
|
128
|
+
const maxText = opts.maxText ?? 2e4;
|
|
129
|
+
const observe2 = async (selector = "body") => {
|
|
130
|
+
const text = await browser.text(selector);
|
|
131
|
+
return {
|
|
132
|
+
url: browser.url,
|
|
133
|
+
title: await browser.title(),
|
|
134
|
+
text: text.slice(0, maxText),
|
|
135
|
+
truncated: text.length > maxText
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
const impls = {
|
|
139
|
+
browser_goto: async (a) => {
|
|
140
|
+
await browser.goto(typeof a.path === "string" ? a.path : void 0);
|
|
141
|
+
return observe2();
|
|
142
|
+
},
|
|
143
|
+
browser_click: async (a) => {
|
|
144
|
+
await browser.click(str(a.selector, ""));
|
|
145
|
+
return observe2();
|
|
146
|
+
},
|
|
147
|
+
browser_type: async (a) => {
|
|
148
|
+
await browser.type(str(a.selector, ""), String(a.text ?? ""));
|
|
149
|
+
return { ok: true, url: browser.url };
|
|
150
|
+
},
|
|
151
|
+
browser_press: async (a) => {
|
|
152
|
+
await browser.press(str(a.key, "Enter"));
|
|
153
|
+
return observe2();
|
|
154
|
+
},
|
|
155
|
+
browser_scroll: async (a) => {
|
|
156
|
+
await browser.scroll(typeof a.dy === "number" ? a.dy : 600);
|
|
157
|
+
return { ok: true, url: browser.url };
|
|
158
|
+
},
|
|
159
|
+
browser_screenshot: async (a) => ({
|
|
160
|
+
image_base64: await browser.screenshotBase64(a.full_page === true),
|
|
161
|
+
url: browser.url
|
|
162
|
+
}),
|
|
163
|
+
browser_read: async (a) => observe2(str(a.selector, "body")),
|
|
164
|
+
browser_back: async () => {
|
|
165
|
+
await browser.back();
|
|
166
|
+
return observe2();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const specs = COMPUTER_USE_SPECS.map((s) => ({ ...s }));
|
|
170
|
+
return {
|
|
171
|
+
schemas: specs.map((spec) => schemaFromSignature(spec)),
|
|
172
|
+
impls,
|
|
173
|
+
specs
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
var SURFACE_KINDS, DEFAULT_VIEWPORT, SETTLE_TIMEOUT_MS, SETTLE_QUIET_MS, SETTLE_POLL_MS, EVENT_BATCH_SIZE, EVENT_FLUSH_INTERVAL_MS, EVENT_MAX_RETRIES, EVENT_SCREENSHOT_QUALITY, EVENT_MAX_STRING, SECRET_KEY, SECRET_VALUE, WorldSurfaceUnavailable, UI_TOKEN_QUERY, BrowserActionRecorder, WorldBrowser, COMPUTER_USE_SPECS, str;
|
|
177
|
+
var init_browser = __esm({
|
|
178
|
+
"src/worlds/browser.ts"() {
|
|
179
|
+
"use strict";
|
|
180
|
+
init_session();
|
|
181
|
+
SURFACE_KINDS = ["tools", "api", "ui", "browser"];
|
|
182
|
+
DEFAULT_VIEWPORT = { width: 1280, height: 800 };
|
|
183
|
+
SETTLE_TIMEOUT_MS = 5e3;
|
|
184
|
+
SETTLE_QUIET_MS = 150;
|
|
185
|
+
SETTLE_POLL_MS = 25;
|
|
186
|
+
EVENT_BATCH_SIZE = 10;
|
|
187
|
+
EVENT_FLUSH_INTERVAL_MS = 1e3;
|
|
188
|
+
EVENT_MAX_RETRIES = 3;
|
|
189
|
+
EVENT_SCREENSHOT_QUALITY = 60;
|
|
190
|
+
EVENT_MAX_STRING = 500;
|
|
191
|
+
SECRET_KEY = /pass(word|wd)?|secret|token|api[-_]?key|authorization|cookie|(^|[-_ #.\["'=])(otp|pin|cvv|ssn)([-_ \]"']|$)/i;
|
|
192
|
+
SECRET_VALUE = /^((sk|pk|ghp|xox[abp])[-_][-_A-Za-z0-9]{8,}|AKIA[0-9A-Z]{12,}|Bearer [-_.A-Za-z0-9]{8,})/;
|
|
193
|
+
WorldSurfaceUnavailable = class extends Error {
|
|
194
|
+
constructor(surface, reason) {
|
|
195
|
+
super(`World surface '${surface}' is unavailable: ${reason}`);
|
|
196
|
+
this.surface = surface;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
UI_TOKEN_QUERY = "token";
|
|
200
|
+
BrowserActionRecorder = class {
|
|
201
|
+
constructor(post, agentId, opts = {}) {
|
|
202
|
+
this.post = post;
|
|
203
|
+
this.agentId = agentId;
|
|
204
|
+
this.opts = opts;
|
|
205
|
+
}
|
|
206
|
+
seq = 0;
|
|
207
|
+
base = null;
|
|
208
|
+
queue = [];
|
|
209
|
+
timer = null;
|
|
210
|
+
inflight = Promise.resolve();
|
|
211
|
+
sent = 0;
|
|
212
|
+
dropped = 0;
|
|
213
|
+
/** This recorder's next position; the wire seq is `resumeFrom() + this`. */
|
|
214
|
+
nextSeq() {
|
|
215
|
+
return this.seq++;
|
|
216
|
+
}
|
|
217
|
+
resolveBase() {
|
|
218
|
+
if (this.base === null) {
|
|
219
|
+
const resolve2 = this.opts.resumeFrom ?? (async () => 0);
|
|
220
|
+
this.base = resolve2().then((n) => {
|
|
221
|
+
if (!Number.isInteger(n) || n < 0)
|
|
222
|
+
throw new Error(
|
|
223
|
+
`browser event base seq must be a non-negative integer, got ${String(n)}`
|
|
224
|
+
);
|
|
225
|
+
return n;
|
|
226
|
+
});
|
|
227
|
+
this.base.catch(() => {
|
|
228
|
+
this.base = null;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return this.base;
|
|
232
|
+
}
|
|
233
|
+
record(event) {
|
|
234
|
+
this.queue.push(event);
|
|
235
|
+
if (this.queue.length >= (this.opts.batchSize ?? EVENT_BATCH_SIZE)) {
|
|
236
|
+
this.drain();
|
|
237
|
+
} else if (this.timer === null) {
|
|
238
|
+
this.timer = setTimeout(
|
|
239
|
+
() => this.drain(),
|
|
240
|
+
this.opts.flushIntervalMs ?? EVENT_FLUSH_INTERVAL_MS
|
|
241
|
+
);
|
|
242
|
+
if (typeof this.timer === "object" && "unref" in this.timer)
|
|
243
|
+
this.timer.unref();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/** Resolve once everything recorded so far has been posted (or dropped). */
|
|
247
|
+
async flush() {
|
|
248
|
+
this.drain();
|
|
249
|
+
await this.inflight;
|
|
250
|
+
}
|
|
251
|
+
async close() {
|
|
252
|
+
await this.flush();
|
|
253
|
+
}
|
|
254
|
+
drain() {
|
|
255
|
+
if (this.timer !== null) {
|
|
256
|
+
clearTimeout(this.timer);
|
|
257
|
+
this.timer = null;
|
|
258
|
+
}
|
|
259
|
+
if (this.queue.length === 0) return;
|
|
260
|
+
const batch = this.queue;
|
|
261
|
+
this.queue = [];
|
|
262
|
+
this.inflight = this.inflight.then(() => this.send(batch));
|
|
263
|
+
}
|
|
264
|
+
async send(batch) {
|
|
265
|
+
const retries = this.opts.maxRetries ?? EVENT_MAX_RETRIES;
|
|
266
|
+
const sleep3 = this.opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
267
|
+
for (let attempt = 0; attempt < retries; attempt++) {
|
|
268
|
+
try {
|
|
269
|
+
const base = await this.resolveBase();
|
|
270
|
+
await this.post(
|
|
271
|
+
base === 0 ? batch : batch.map((e) => ({ ...e, seq: base + e.seq }))
|
|
272
|
+
);
|
|
273
|
+
this.sent += batch.length;
|
|
274
|
+
return;
|
|
275
|
+
} catch (error) {
|
|
276
|
+
if (attempt + 1 === retries) {
|
|
277
|
+
this.dropped += batch.length;
|
|
278
|
+
(this.opts.warn ?? console.warn)(
|
|
279
|
+
`dropping ${batch.length} browser events after ${attempt + 1} attempts: ${String(error)}`
|
|
280
|
+
);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
await sleep3(500 * 2 ** attempt);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
WorldBrowser = class {
|
|
289
|
+
constructor(page, ui, mode, teardown, viewport = DEFAULT_VIEWPORT, recorder = null) {
|
|
290
|
+
this.page = page;
|
|
291
|
+
this.ui = ui;
|
|
292
|
+
this.mode = mode;
|
|
293
|
+
this.teardown = teardown;
|
|
294
|
+
this.viewport = viewport;
|
|
295
|
+
this.recorder = recorder;
|
|
296
|
+
page.on("request", () => {
|
|
297
|
+
this.inflight += 1;
|
|
298
|
+
this.lastNetwork = Date.now();
|
|
299
|
+
});
|
|
300
|
+
const done = () => {
|
|
301
|
+
this.inflight = Math.max(0, this.inflight - 1);
|
|
302
|
+
this.lastNetwork = Date.now();
|
|
303
|
+
};
|
|
304
|
+
page.on("requestfinished", done);
|
|
305
|
+
page.on("requestfailed", done);
|
|
306
|
+
}
|
|
307
|
+
inflight = 0;
|
|
308
|
+
lastNetwork = Date.now();
|
|
309
|
+
get agentId() {
|
|
310
|
+
return this.recorder?.agentId ?? null;
|
|
311
|
+
}
|
|
312
|
+
/** Run one action and report it: the event carries what was asked,
|
|
313
|
+
* whether it worked, and the screen after — for failures too, so a
|
|
314
|
+
* reviewer sees what the agent saw when the selector did not match. */
|
|
315
|
+
async act(action, args, fn) {
|
|
316
|
+
const recorder = this.recorder;
|
|
317
|
+
if (!recorder) return fn();
|
|
318
|
+
const started = Date.now();
|
|
319
|
+
let ok = true;
|
|
320
|
+
let error = null;
|
|
321
|
+
try {
|
|
322
|
+
return await fn();
|
|
323
|
+
} catch (err) {
|
|
324
|
+
ok = false;
|
|
325
|
+
error = (err instanceof Error ? `${err.name}: ${err.message}` : String(err)).slice(0, 4e3);
|
|
326
|
+
throw err;
|
|
327
|
+
} finally {
|
|
328
|
+
recorder.record({
|
|
329
|
+
agentId: recorder.agentId,
|
|
330
|
+
seq: recorder.nextSeq(),
|
|
331
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
332
|
+
action,
|
|
333
|
+
args: redactActionArgs(action, args),
|
|
334
|
+
ok,
|
|
335
|
+
error,
|
|
336
|
+
durationMs: Date.now() - started,
|
|
337
|
+
mode: this.mode,
|
|
338
|
+
viewport: { ...this.viewport },
|
|
339
|
+
...await this.observeForEvent()
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
async observeForEvent() {
|
|
344
|
+
const out = {
|
|
345
|
+
url: null,
|
|
346
|
+
title: null,
|
|
347
|
+
screenshot: null
|
|
348
|
+
};
|
|
349
|
+
try {
|
|
350
|
+
out.url = this.page.url();
|
|
351
|
+
out.title = await this.page.title();
|
|
352
|
+
const jpeg = await this.page.screenshot({
|
|
353
|
+
type: "jpeg",
|
|
354
|
+
quality: EVENT_SCREENSHOT_QUALITY
|
|
355
|
+
});
|
|
356
|
+
out.screenshot = jpeg.toString("base64");
|
|
357
|
+
} catch {
|
|
358
|
+
}
|
|
359
|
+
return out;
|
|
360
|
+
}
|
|
361
|
+
/** Open a UI path (`/customers`), a full URL, or — with no argument — the
|
|
362
|
+
* UI's declared entry page. */
|
|
363
|
+
async goto(pathOrUrl) {
|
|
364
|
+
let target;
|
|
365
|
+
if (pathOrUrl === void 0) {
|
|
366
|
+
if (!this.ui)
|
|
367
|
+
throw new WorldSurfaceUnavailable(
|
|
368
|
+
"ui",
|
|
369
|
+
"this session has no UI to navigate to"
|
|
370
|
+
);
|
|
371
|
+
target = uiEntryUrl(this.ui);
|
|
372
|
+
} else if (/^https?:\/\//.test(pathOrUrl)) {
|
|
373
|
+
target = pathOrUrl;
|
|
374
|
+
} else {
|
|
375
|
+
if (!this.ui)
|
|
376
|
+
throw new WorldSurfaceUnavailable(
|
|
377
|
+
"ui",
|
|
378
|
+
"relative paths need a UI surface"
|
|
379
|
+
);
|
|
380
|
+
target = uiUrl(this.ui, pathOrUrl);
|
|
381
|
+
}
|
|
382
|
+
return this.act(
|
|
383
|
+
"browser_goto",
|
|
384
|
+
{ path: pathOrUrl ?? null, url: withoutUiToken(target) },
|
|
385
|
+
async () => {
|
|
386
|
+
await this.page.goto(target, { waitUntil: "load" });
|
|
387
|
+
await this.settle();
|
|
388
|
+
return this.page.url();
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
async back() {
|
|
393
|
+
return this.act("browser_back", {}, async () => {
|
|
394
|
+
await this.page.goBack({ waitUntil: "load" });
|
|
395
|
+
await this.settle();
|
|
396
|
+
return this.page.url();
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
/** Wait for the page to finish reacting to an action. `load` alone is not
|
|
400
|
+
* enough for client-rendered UIs (React et al.): a click returns before the
|
|
401
|
+
* fetch that re-renders the page, so an agent would read stale text.
|
|
402
|
+
* Playwright's `networkidle` is per navigation and resolves at once after
|
|
403
|
+
* the first one, so this tracks requests itself: done when nothing is in
|
|
404
|
+
* flight and the network has been quiet for `SETTLE_QUIET_MS`, bounded so
|
|
405
|
+
* long-polling UIs cannot hang us. */
|
|
406
|
+
async settle() {
|
|
407
|
+
await this.page.waitForLoadState("load");
|
|
408
|
+
const deadline = Date.now() + SETTLE_TIMEOUT_MS;
|
|
409
|
+
while (Date.now() < deadline) {
|
|
410
|
+
const quiet = Date.now() - this.lastNetwork >= SETTLE_QUIET_MS;
|
|
411
|
+
if (this.inflight === 0 && quiet) return;
|
|
412
|
+
await this.page.waitForTimeout(SETTLE_POLL_MS);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
async click(selector) {
|
|
416
|
+
await this.act("browser_click", { selector }, async () => {
|
|
417
|
+
await this.page.click(selector);
|
|
418
|
+
await this.settle();
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
async type(selector, text) {
|
|
422
|
+
await this.act(
|
|
423
|
+
"browser_type",
|
|
424
|
+
{ selector, text },
|
|
425
|
+
() => this.page.fill(selector, text)
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
async press(key) {
|
|
429
|
+
await this.act("browser_press", { key }, async () => {
|
|
430
|
+
await this.page.keyboard.press(key);
|
|
431
|
+
await this.settle();
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
async scroll(dy) {
|
|
435
|
+
await this.act(
|
|
436
|
+
"browser_scroll",
|
|
437
|
+
{ dy },
|
|
438
|
+
() => this.page.mouse.wheel(0, dy)
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
async screenshot(fullPage = false) {
|
|
442
|
+
return this.page.screenshot({ type: "png", fullPage });
|
|
443
|
+
}
|
|
444
|
+
async screenshotBase64(fullPage = false) {
|
|
445
|
+
return (await this.screenshot(fullPage)).toString("base64");
|
|
446
|
+
}
|
|
447
|
+
async text(selector = "body") {
|
|
448
|
+
return this.page.innerText(selector);
|
|
449
|
+
}
|
|
450
|
+
async html() {
|
|
451
|
+
return this.page.content();
|
|
452
|
+
}
|
|
453
|
+
get url() {
|
|
454
|
+
return this.page.url();
|
|
455
|
+
}
|
|
456
|
+
async title() {
|
|
457
|
+
return this.page.title();
|
|
458
|
+
}
|
|
459
|
+
async close() {
|
|
460
|
+
try {
|
|
461
|
+
await this.teardown();
|
|
462
|
+
} finally {
|
|
463
|
+
await this.recorder?.close();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
COMPUTER_USE_SPECS = [
|
|
468
|
+
{
|
|
469
|
+
name: "browser_goto",
|
|
470
|
+
signature: "browser_goto(path=None)",
|
|
471
|
+
doc: "Open a page of the world's UI. `path` is a UI path like /customers, a full URL, or omitted for the entry page. Returns the URL and page text."
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
name: "browser_click",
|
|
475
|
+
signature: "browser_click(selector)",
|
|
476
|
+
doc: "Click an element by Playwright selector (CSS, `text=Refund`, `role=button[name=Save]`). Returns the page text after the click."
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: "browser_type",
|
|
480
|
+
signature: "browser_type(selector, text)",
|
|
481
|
+
doc: "Replace the value of an input/textarea found by selector with `text`."
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
name: "browser_press",
|
|
485
|
+
signature: "browser_press(key)",
|
|
486
|
+
doc: "Press a key (Enter, Tab, Escape, ArrowDown, ...). Returns the page text after."
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
name: "browser_scroll",
|
|
490
|
+
signature: "browser_scroll(dy=600)",
|
|
491
|
+
doc: "Scroll the page vertically by `dy` pixels (negative scrolls up)."
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
name: "browser_screenshot",
|
|
495
|
+
signature: "browser_screenshot(full_page=False)",
|
|
496
|
+
doc: "Take a PNG screenshot; returns {image_base64, url}."
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
name: "browser_read",
|
|
500
|
+
signature: "browser_read(selector='body')",
|
|
501
|
+
doc: "Return the visible text of an element (default: whole page) plus the URL and title."
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
name: "browser_back",
|
|
505
|
+
signature: "browser_back()",
|
|
506
|
+
doc: "Go back one page in history."
|
|
507
|
+
}
|
|
508
|
+
];
|
|
509
|
+
str = (v, fallback) => typeof v === "string" && v.length > 0 ? v : fallback;
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
|
|
36
513
|
// src/worlds/session.ts
|
|
37
514
|
var session_exports = {};
|
|
38
515
|
__export(session_exports, {
|
|
@@ -40,11 +517,23 @@ __export(session_exports, {
|
|
|
40
517
|
WorldSessionCallError: () => WorldSessionCallError,
|
|
41
518
|
WorldSessionTimeout: () => WorldSessionTimeout,
|
|
42
519
|
attachSession: () => attachSession,
|
|
520
|
+
isTaskIdRef: () => isTaskIdRef,
|
|
521
|
+
isTaskSpec: () => isTaskSpec,
|
|
43
522
|
openSession: () => openSession,
|
|
44
523
|
runSessions: () => runSessions,
|
|
45
|
-
schemaFromSignature: () => schemaFromSignature
|
|
524
|
+
schemaFromSignature: () => schemaFromSignature,
|
|
525
|
+
taskLabel: () => taskLabel
|
|
46
526
|
});
|
|
47
527
|
function schemaFromSignature(spec) {
|
|
528
|
+
if (spec.inputSchema)
|
|
529
|
+
return {
|
|
530
|
+
type: "function",
|
|
531
|
+
function: {
|
|
532
|
+
name: modelToolName(spec.name),
|
|
533
|
+
description: spec.doc ?? spec.name,
|
|
534
|
+
parameters: spec.inputSchema
|
|
535
|
+
}
|
|
536
|
+
};
|
|
48
537
|
const inside = /\(([\s\S]*)\)\s*$/.exec(spec.signature.trim())?.[1] ?? "";
|
|
49
538
|
const properties = {};
|
|
50
539
|
const required = [];
|
|
@@ -80,7 +569,7 @@ function schemaFromSignature(spec) {
|
|
|
80
569
|
return {
|
|
81
570
|
type: "function",
|
|
82
571
|
function: {
|
|
83
|
-
name: spec.name,
|
|
572
|
+
name: modelToolName(spec.name),
|
|
84
573
|
description: spec.doc ?? spec.name,
|
|
85
574
|
parameters: { type: "object", properties, required }
|
|
86
575
|
}
|
|
@@ -94,8 +583,20 @@ async function attachSession(sessionId, options = {}) {
|
|
|
94
583
|
);
|
|
95
584
|
return new WorldSession(sessionId, state2, options);
|
|
96
585
|
}
|
|
97
|
-
async function openSession(slugOrRef,
|
|
586
|
+
async function openSession(slugOrRef, taskOrOpts, positionalOpts = {}) {
|
|
587
|
+
const { task, ...opts } = typeof taskOrOpts === "object" && "task" in taskOrOpts ? taskOrOpts : { task: taskOrOpts, ...positionalOpts };
|
|
588
|
+
if (task === void 0 || task === null || typeof task === "string" && !task || isTaskIdRef(task) && !task.id || isTaskSpec(task) && !task.instruction || typeof task === "object" && !isTaskIdRef(task) && !isTaskSpec(task))
|
|
589
|
+
throw new Error(
|
|
590
|
+
"openSession needs a task: a bundled task name, a stored task { id, version? } or { instruction, seed?, grader?, metadata? }"
|
|
591
|
+
);
|
|
98
592
|
const options = opts.options ?? {};
|
|
593
|
+
const unknown = (opts.surfaces ?? []).filter(
|
|
594
|
+
(s) => !SURFACE_KINDS.includes(s)
|
|
595
|
+
);
|
|
596
|
+
if (unknown.length)
|
|
597
|
+
throw new Error(
|
|
598
|
+
`Unknown world surfaces: ${unknown.join(", ")}; choose from ${SURFACE_KINDS.join(", ")}`
|
|
599
|
+
);
|
|
99
600
|
const at = slugOrRef.indexOf("@");
|
|
100
601
|
const slug = at === -1 ? slugOrRef : slugOrRef.slice(0, at);
|
|
101
602
|
const state2 = await apiRequest(
|
|
@@ -105,7 +606,8 @@ async function openSession(slugOrRef, task, opts = {}) {
|
|
|
105
606
|
{
|
|
106
607
|
...opts.versionId ? { versionId: opts.versionId } : { slug },
|
|
107
608
|
task,
|
|
108
|
-
...opts.reuseWarm === void 0 ? {} : { reuseWarm: opts.reuseWarm }
|
|
609
|
+
...opts.reuseWarm === void 0 ? {} : { reuseWarm: opts.reuseWarm },
|
|
610
|
+
...opts.surfaces?.length ? { surfaces: opts.surfaces } : {}
|
|
109
611
|
}
|
|
110
612
|
);
|
|
111
613
|
return new WorldSession(state2.sessionId, state2, options);
|
|
@@ -126,20 +628,24 @@ async function runSessions(opts) {
|
|
|
126
628
|
await Promise.all(
|
|
127
629
|
Array.from({ length: Math.min(concurrency, tasks.length) }, async () => {
|
|
128
630
|
while (next < tasks.length) {
|
|
129
|
-
const
|
|
631
|
+
const taskRef = tasks[next++];
|
|
632
|
+
let task = taskLabel(taskRef);
|
|
130
633
|
let session = null;
|
|
131
634
|
try {
|
|
132
|
-
session = await openSession(opts.world,
|
|
635
|
+
session = await openSession(opts.world, {
|
|
636
|
+
task: taskRef,
|
|
133
637
|
versionId,
|
|
134
638
|
options
|
|
135
639
|
});
|
|
640
|
+
task = taskLabel(taskRef, session.taskInfo);
|
|
136
641
|
await session.ready();
|
|
137
642
|
const toolkit = await session.toolkit();
|
|
138
643
|
await opts.agent({
|
|
139
644
|
session,
|
|
140
645
|
toolkit,
|
|
141
|
-
instruction: session.instruction ?? task,
|
|
142
|
-
task
|
|
646
|
+
instruction: session.instruction ?? (isTaskSpec(taskRef) ? taskRef.instruction : task),
|
|
647
|
+
task,
|
|
648
|
+
taskRef
|
|
143
649
|
});
|
|
144
650
|
const graded = await session.grade();
|
|
145
651
|
const result = {
|
|
@@ -175,35 +681,143 @@ async function runSessions(opts) {
|
|
|
175
681
|
passed: opts.failUnder === void 0 ? true : mean >= opts.failUnder
|
|
176
682
|
};
|
|
177
683
|
}
|
|
178
|
-
var READY_TIMEOUT_MS, READY_POLL_MS, CALL_TIMEOUT_MS, CALL_POLL_MS, sleep2, WorldSessionTimeout, WorldSessionCallError, WorldSession;
|
|
684
|
+
var import_node_crypto, isTaskIdRef, isTaskSpec, taskLabel, READY_TIMEOUT_MS, READY_POLL_MS, CALL_TIMEOUT_MS, CALL_POLL_MS, JUDGED_GRADE_TIMEOUT_MS, JUDGED_GRADE_POLL_MS, EXPORT_PAGE, sleep2, modelToolName, WorldSessionTimeout, WorldSessionCallError, WorldSession;
|
|
179
685
|
var init_session = __esm({
|
|
180
686
|
"src/worlds/session.ts"() {
|
|
181
687
|
"use strict";
|
|
688
|
+
import_node_crypto = require("crypto");
|
|
182
689
|
init_worlds();
|
|
690
|
+
init_browser();
|
|
691
|
+
isTaskIdRef = (task) => typeof task === "object" && task !== null && "id" in task;
|
|
692
|
+
isTaskSpec = (task) => typeof task === "object" && task !== null && "instruction" in task;
|
|
693
|
+
taskLabel = (task, info) => {
|
|
694
|
+
if (typeof task === "string") return task;
|
|
695
|
+
if (isTaskIdRef(task)) return info?.name ?? task.id;
|
|
696
|
+
if (task.name) return task.name;
|
|
697
|
+
return info?.hash ? `inline:${info.hash.slice(0, 12)}` : "inline";
|
|
698
|
+
};
|
|
183
699
|
READY_TIMEOUT_MS = 10 * 6e4;
|
|
184
700
|
READY_POLL_MS = 2e3;
|
|
185
701
|
CALL_TIMEOUT_MS = 3 * 6e4;
|
|
186
702
|
CALL_POLL_MS = 400;
|
|
703
|
+
JUDGED_GRADE_TIMEOUT_MS = 15 * 6e4;
|
|
704
|
+
JUDGED_GRADE_POLL_MS = 2e3;
|
|
705
|
+
EXPORT_PAGE = 500;
|
|
187
706
|
sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
707
|
+
modelToolName = (name) => name.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 64) || "tool";
|
|
188
708
|
WorldSessionTimeout = class extends Error {
|
|
189
709
|
};
|
|
190
710
|
WorldSessionCallError = class extends Error {
|
|
191
711
|
};
|
|
192
712
|
WorldSession = class {
|
|
193
|
-
constructor(sessionId,
|
|
713
|
+
constructor(sessionId, current, options) {
|
|
194
714
|
this.sessionId = sessionId;
|
|
195
|
-
this.
|
|
715
|
+
this.current = current;
|
|
196
716
|
this.options = options;
|
|
197
717
|
}
|
|
718
|
+
/** The task's display name: a bundled scenario's, or the inline spec's
|
|
719
|
+
* `name` (null when the spec was unnamed). Same as `taskName`. */
|
|
198
720
|
get task() {
|
|
199
|
-
return this.
|
|
721
|
+
return this.current.taskName;
|
|
722
|
+
}
|
|
723
|
+
/** The task's display name: a bundled scenario's, or the inline spec's
|
|
724
|
+
* `name` (null when the spec was unnamed). */
|
|
725
|
+
get taskName() {
|
|
726
|
+
return this.current.taskName;
|
|
200
727
|
}
|
|
201
|
-
/**
|
|
728
|
+
/** The task this session runs: bundled scenario, stored task or inline
|
|
729
|
+
* spec, its name, hash and the caller's metadata. */
|
|
730
|
+
get taskInfo() {
|
|
731
|
+
return this.current.task ?? {
|
|
732
|
+
source: "bundled",
|
|
733
|
+
name: this.current.taskName,
|
|
734
|
+
hash: null,
|
|
735
|
+
metadata: {}
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
/** What this task asks for — the bundle's instruction.md, or the inline
|
|
739
|
+
* spec's `instruction`. */
|
|
202
740
|
get instruction() {
|
|
203
|
-
return this.
|
|
741
|
+
return this.current.instruction ?? null;
|
|
204
742
|
}
|
|
205
743
|
get versionId() {
|
|
206
|
-
return this.
|
|
744
|
+
return this.current.versionId;
|
|
745
|
+
}
|
|
746
|
+
/** Whether the session answered ready as of the last state read (the open,
|
|
747
|
+
* a `status()`, or the poll inside `ready()`); no request is made. */
|
|
748
|
+
get isReady() {
|
|
749
|
+
return this.current.ready;
|
|
750
|
+
}
|
|
751
|
+
/** `api` / `ui` / `browser` are present exactly when the world declares
|
|
752
|
+
* them AND the session was opened asking for them. */
|
|
753
|
+
async surfaces() {
|
|
754
|
+
if (!this.current.surfaces) await this.status();
|
|
755
|
+
return this.current.surfaces ?? { tools: { kind: "rendezvous" } };
|
|
756
|
+
}
|
|
757
|
+
/** Base URL of the world's own HTTP API for this session. */
|
|
758
|
+
async api() {
|
|
759
|
+
const { api } = await this.surfaces();
|
|
760
|
+
if (!api)
|
|
761
|
+
throw new WorldSurfaceUnavailable(
|
|
762
|
+
"api",
|
|
763
|
+
"open the session with surfaces: ['api'] on an api-type world"
|
|
764
|
+
);
|
|
765
|
+
return api.url;
|
|
766
|
+
}
|
|
767
|
+
/** Headers every request to `api()` needs. A World Host session gates its
|
|
768
|
+
* api surface on a per-session token; a pod or hosted twin answers with the
|
|
769
|
+
* world's own declared auth and this is `{}`. */
|
|
770
|
+
async apiHeaders() {
|
|
771
|
+
const { api } = await this.surfaces();
|
|
772
|
+
return api?.token ? { Authorization: `Bearer ${api.token}` } : {};
|
|
773
|
+
}
|
|
774
|
+
/** URL of the world's UI entry page for this session. */
|
|
775
|
+
async ui() {
|
|
776
|
+
const { ui } = await this.surfaces();
|
|
777
|
+
if (!ui)
|
|
778
|
+
throw new WorldSurfaceUnavailable(
|
|
779
|
+
"ui",
|
|
780
|
+
"open the session with surfaces: ['ui'] on a world that declares [ui]"
|
|
781
|
+
);
|
|
782
|
+
return uiEntryUrl(ui);
|
|
783
|
+
}
|
|
784
|
+
/** A Playwright browser on this session's UI: `hosted` drives the one the
|
|
785
|
+
* platform runs next to the world, `local` launches one here, `auto`
|
|
786
|
+
* prefers hosted. Call `close()` when done.
|
|
787
|
+
*
|
|
788
|
+
* Every action is reported to the platform under `agentId` (default:
|
|
789
|
+
* `GATEWAY_AGENT_ID` or a fresh `agent-<hex>`) so the session page shows
|
|
790
|
+
* this agent's own timeline — several agents may share one session and
|
|
791
|
+
* one hosted browser. `record: false` opts out. */
|
|
792
|
+
async browser(opts = {}) {
|
|
793
|
+
const { agentId, record = true, ...rest } = opts;
|
|
794
|
+
return openBrowser(await this.surfaces(), {
|
|
795
|
+
...rest,
|
|
796
|
+
recorder: record ? this.browserRecorder(agentId) : null
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
/** The reporter `browser()` uses; exposed for a page you drive yourself. */
|
|
800
|
+
browserRecorder(agentId) {
|
|
801
|
+
const path2 = `/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/browser-events`;
|
|
802
|
+
const id = agentId ?? process.env.GATEWAY_AGENT_ID ?? `agent-${(0, import_node_crypto.randomUUID)().replace(/-/g, "").slice(0, 8)}`;
|
|
803
|
+
return new BrowserActionRecorder(
|
|
804
|
+
async (events) => {
|
|
805
|
+
await apiRequest(this.options, "POST", path2, { events });
|
|
806
|
+
},
|
|
807
|
+
id,
|
|
808
|
+
{
|
|
809
|
+
// Continue this agent's timeline where the platform has it, so the
|
|
810
|
+
// same id reopened later never re-numbers from zero.
|
|
811
|
+
resumeFrom: async () => {
|
|
812
|
+
const summary = await apiRequest(this.options, "GET", path2);
|
|
813
|
+
return summary.agents.find((a) => a.agentId === id)?.nextSeq ?? 0;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
/** Browser actions as model tools, in the same shape as `toolkit()`. */
|
|
819
|
+
computerUseTools(browser) {
|
|
820
|
+
return computerUseToolkit(browser);
|
|
207
821
|
}
|
|
208
822
|
/** The session's latest platform state (one request, no waiting). */
|
|
209
823
|
async status() {
|
|
@@ -212,12 +826,14 @@ var init_session = __esm({
|
|
|
212
826
|
"GET",
|
|
213
827
|
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}`
|
|
214
828
|
);
|
|
215
|
-
this.
|
|
216
|
-
instruction: this.
|
|
217
|
-
tools: this.
|
|
829
|
+
this.current = {
|
|
830
|
+
instruction: this.current.instruction,
|
|
831
|
+
tools: this.current.tools,
|
|
832
|
+
surfaces: this.current.surfaces,
|
|
833
|
+
task: this.current.task,
|
|
218
834
|
...fresh
|
|
219
835
|
};
|
|
220
|
-
return this.
|
|
836
|
+
return this.current;
|
|
221
837
|
}
|
|
222
838
|
/**
|
|
223
839
|
* Wait until the container is warm — meaning the process inside it has
|
|
@@ -240,14 +856,18 @@ var init_session = __esm({
|
|
|
240
856
|
}
|
|
241
857
|
}
|
|
242
858
|
/** Enqueue one interaction and wait for the container's answer. */
|
|
243
|
-
async exchange(body, timeoutMs
|
|
244
|
-
const
|
|
859
|
+
async exchange(body, timeoutMs) {
|
|
860
|
+
const enqueued = await apiRequest(
|
|
245
861
|
this.options,
|
|
246
862
|
"POST",
|
|
247
863
|
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/calls`,
|
|
248
864
|
body
|
|
249
865
|
);
|
|
250
|
-
const
|
|
866
|
+
const { callId } = enqueued;
|
|
867
|
+
const judged = enqueued.pending === true;
|
|
868
|
+
const budgetMs = timeoutMs ?? (judged ? JUDGED_GRADE_TIMEOUT_MS : CALL_TIMEOUT_MS);
|
|
869
|
+
const pollMs = judged ? JUDGED_GRADE_POLL_MS : CALL_POLL_MS;
|
|
870
|
+
const deadline = Date.now() + budgetMs;
|
|
251
871
|
for (; ; ) {
|
|
252
872
|
const call = await apiRequest(
|
|
253
873
|
this.options,
|
|
@@ -260,9 +880,9 @@ var init_session = __esm({
|
|
|
260
880
|
}
|
|
261
881
|
if (Date.now() > deadline)
|
|
262
882
|
throw new WorldSessionTimeout(
|
|
263
|
-
`Call ${callId} still ${call.state} after ${Math.round(
|
|
883
|
+
judged ? `Grade ${callId} still ${call.state} after ${Math.round(budgetMs / 1e3)}s \u2014 the judge has not answered; the platform finalizes the call on its own, read it back with export().` : `Call ${callId} still ${call.state} after ${Math.round(budgetMs / 1e3)}s \u2014 the container may have died.`
|
|
264
884
|
);
|
|
265
|
-
await sleep2(
|
|
885
|
+
await sleep2(pollMs);
|
|
266
886
|
}
|
|
267
887
|
}
|
|
268
888
|
/**
|
|
@@ -286,15 +906,27 @@ var init_session = __esm({
|
|
|
286
906
|
* hand-written map that still remembers the old name.
|
|
287
907
|
*/
|
|
288
908
|
async toolkit() {
|
|
289
|
-
let specs = this.
|
|
909
|
+
let specs = this.current.tools;
|
|
290
910
|
if (!specs) specs = (await this.status()).tools ?? [];
|
|
291
|
-
const impls =
|
|
911
|
+
const impls = /* @__PURE__ */ Object.create(null);
|
|
292
912
|
for (const spec of specs) {
|
|
293
|
-
|
|
913
|
+
const alias = modelToolName(spec.name);
|
|
914
|
+
if (Object.hasOwn(impls, alias))
|
|
915
|
+
throw new WorldSessionCallError(`Model tool name collision: ${alias}`);
|
|
916
|
+
impls[alias] = (args = {}) => this.call(spec.name, args);
|
|
294
917
|
}
|
|
295
918
|
return { schemas: specs.map(schemaFromSignature), impls, specs };
|
|
296
919
|
}
|
|
297
|
-
/** Run the task's grader against the container's END STATE.
|
|
920
|
+
/** Run the task's grader against the container's END STATE. Graders answer
|
|
921
|
+
* in one of two shapes: the scalar with named rewards beside it
|
|
922
|
+
* (`{reward, check_a, check_b}`, a task's own `grade.py`), or the named
|
|
923
|
+
* rewards nested under `rewards` (the api, mock-tools and World Host
|
|
924
|
+
* runners). Both land in `rewards`.
|
|
925
|
+
*
|
|
926
|
+
* A rubric grade is finalized by the platform's judge, not the container:
|
|
927
|
+
* the platform answers the enqueue with `pending: true`, and this waits on
|
|
928
|
+
* the judge's budget (15 min) instead of a call's. `timeoutMs` overrides
|
|
929
|
+
* either. */
|
|
298
930
|
async grade(opts = {}) {
|
|
299
931
|
const raw = await this.exchange(
|
|
300
932
|
{ kind: "grade" },
|
|
@@ -302,6 +934,12 @@ var init_session = __esm({
|
|
|
302
934
|
);
|
|
303
935
|
const record = raw && typeof raw === "object" ? raw : {};
|
|
304
936
|
const rewards = {};
|
|
937
|
+
const nested = record.rewards;
|
|
938
|
+
if (nested && typeof nested === "object") {
|
|
939
|
+
for (const [key, value] of Object.entries(nested)) {
|
|
940
|
+
if (typeof value === "number") rewards[key] = value;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
305
943
|
for (const [key, value] of Object.entries(record)) {
|
|
306
944
|
if (key !== "reward" && typeof value === "number") rewards[key] = value;
|
|
307
945
|
}
|
|
@@ -311,6 +949,91 @@ var init_session = __esm({
|
|
|
311
949
|
raw
|
|
312
950
|
};
|
|
313
951
|
}
|
|
952
|
+
/**
|
|
953
|
+
* Put rows into the LIVE world through its contract, in one batch:
|
|
954
|
+
* `append` (default) upserts by primary key, `replace` makes the named
|
|
955
|
+
* entities hold exactly these rows. Atomic — a refused row leaves the
|
|
956
|
+
* session unchanged and the error names the entity, row and field.
|
|
957
|
+
*/
|
|
958
|
+
async seed(rows, opts = {}) {
|
|
959
|
+
const mode = opts.mode ?? "append";
|
|
960
|
+
return await this.exchange(
|
|
961
|
+
{ kind: "seed", args: { mode, rows } },
|
|
962
|
+
opts.timeoutMs
|
|
963
|
+
);
|
|
964
|
+
}
|
|
965
|
+
/** Every entity's rows as the world holds them now — the same dump a
|
|
966
|
+
* grader reads. The shape is the world runtime's: a schema world answers
|
|
967
|
+
* `{<entity>: {<key>: row}, snapshot}`, a mock-tools world
|
|
968
|
+
* `{entities: {<entity>: [row]}}`. */
|
|
969
|
+
async state(opts = {}) {
|
|
970
|
+
return this.exchange({ kind: "state" }, opts.timeoutMs);
|
|
971
|
+
}
|
|
972
|
+
/** Back to the opening state: the version's data plus the bundled
|
|
973
|
+
* scenario's or the inline task's seed. Rows written since are gone; the
|
|
974
|
+
* call log stays. */
|
|
975
|
+
async reset(opts = {}) {
|
|
976
|
+
await this.exchange({ kind: "reset" }, opts.timeoutMs);
|
|
977
|
+
}
|
|
978
|
+
/** The session's call log, oldest first: every tool call, seed, reset,
|
|
979
|
+
* grade with its result — the record of the episode. */
|
|
980
|
+
async export() {
|
|
981
|
+
const calls = [];
|
|
982
|
+
let cursor;
|
|
983
|
+
do {
|
|
984
|
+
const params = new URLSearchParams({ limit: String(EXPORT_PAGE) });
|
|
985
|
+
if (cursor) params.set("cursor", cursor);
|
|
986
|
+
const page = await apiRequest(
|
|
987
|
+
this.options,
|
|
988
|
+
"GET",
|
|
989
|
+
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/calls?${params.toString()}`
|
|
990
|
+
);
|
|
991
|
+
for (const call of page.calls) {
|
|
992
|
+
calls.push({
|
|
993
|
+
seq: Number(call.seq),
|
|
994
|
+
kind: String(call.kind ?? "call"),
|
|
995
|
+
tool: typeof call.tool === "string" ? call.tool : null,
|
|
996
|
+
args: call.args ?? null,
|
|
997
|
+
result: call.result ?? null,
|
|
998
|
+
error: typeof call.error === "string" ? call.error : null,
|
|
999
|
+
completedAt: typeof call.completedAt === "string" ? call.completedAt : null
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
cursor = page.nextCursor ?? void 0;
|
|
1003
|
+
} while (cursor);
|
|
1004
|
+
return calls;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Promote this session's inline task into a stored task of the project
|
|
1008
|
+
* (version 1, pinned to the session's world unless `world` says otherwise),
|
|
1009
|
+
* so a task written for one end user can be reused and its grades
|
|
1010
|
+
* compared. The session then records the new task's id. A session on a
|
|
1011
|
+
* bundled task has nothing to save; one on a stored task is already saved.
|
|
1012
|
+
*/
|
|
1013
|
+
async saveTask(opts = {}) {
|
|
1014
|
+
const task = await apiRequest(
|
|
1015
|
+
this.options,
|
|
1016
|
+
"POST",
|
|
1017
|
+
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/task`,
|
|
1018
|
+
{
|
|
1019
|
+
...opts.name !== void 0 ? { name: opts.name } : {},
|
|
1020
|
+
...opts.world !== void 0 ? { world: opts.world } : {},
|
|
1021
|
+
...opts.message !== void 0 ? { message: opts.message } : {}
|
|
1022
|
+
}
|
|
1023
|
+
);
|
|
1024
|
+
this.current = {
|
|
1025
|
+
...this.current,
|
|
1026
|
+
taskName: task.name,
|
|
1027
|
+
task: {
|
|
1028
|
+
...this.taskInfo,
|
|
1029
|
+
source: "stored",
|
|
1030
|
+
name: task.name,
|
|
1031
|
+
id: task.id,
|
|
1032
|
+
version: task.version
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
return task;
|
|
1036
|
+
}
|
|
314
1037
|
/**
|
|
315
1038
|
* End the session. `keepWarm` hands the container back to the pool instead
|
|
316
1039
|
* of tearing it down, so the next session for the same task starts warm —
|
|
@@ -328,6 +1051,83 @@ var init_session = __esm({
|
|
|
328
1051
|
}
|
|
329
1052
|
});
|
|
330
1053
|
|
|
1054
|
+
// src/worlds/tasks.ts
|
|
1055
|
+
async function createTask(input, options = {}) {
|
|
1056
|
+
return apiRequest(
|
|
1057
|
+
options,
|
|
1058
|
+
"POST",
|
|
1059
|
+
TASKS,
|
|
1060
|
+
compact({
|
|
1061
|
+
spec: input.spec,
|
|
1062
|
+
name: input.name,
|
|
1063
|
+
world: input.world,
|
|
1064
|
+
message: input.message
|
|
1065
|
+
})
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
async function updateTask(taskId, input, options = {}) {
|
|
1069
|
+
if (input.spec === void 0 && input.name === void 0 && input.world === void 0)
|
|
1070
|
+
throw new Error("updateTask: nothing to update \u2014 pass spec, name or world");
|
|
1071
|
+
return apiRequest(
|
|
1072
|
+
options,
|
|
1073
|
+
"PATCH",
|
|
1074
|
+
taskRoute(taskId),
|
|
1075
|
+
compact({
|
|
1076
|
+
spec: input.spec,
|
|
1077
|
+
name: input.name,
|
|
1078
|
+
world: input.world,
|
|
1079
|
+
message: input.message
|
|
1080
|
+
})
|
|
1081
|
+
);
|
|
1082
|
+
}
|
|
1083
|
+
async function listTasks(filter = {}, options = {}) {
|
|
1084
|
+
const params = new URLSearchParams();
|
|
1085
|
+
if (filter.world) params.set("world", filter.world);
|
|
1086
|
+
if (filter.page !== void 0) params.set("page", String(filter.page));
|
|
1087
|
+
if (filter.limit !== void 0) params.set("limit", String(filter.limit));
|
|
1088
|
+
for (const [key, value] of Object.entries(filter.metadata ?? {}))
|
|
1089
|
+
params.set(`metadata.${key}`, value);
|
|
1090
|
+
const query = params.toString();
|
|
1091
|
+
return apiRequest(
|
|
1092
|
+
options,
|
|
1093
|
+
"GET",
|
|
1094
|
+
query ? `${TASKS}?${query}` : TASKS
|
|
1095
|
+
);
|
|
1096
|
+
}
|
|
1097
|
+
async function getTask(taskId, opts = {}, options = {}) {
|
|
1098
|
+
const query = opts.version === void 0 ? "" : `?version=${String(opts.version)}`;
|
|
1099
|
+
return apiRequest(
|
|
1100
|
+
options,
|
|
1101
|
+
"GET",
|
|
1102
|
+
`${taskRoute(taskId)}${query}`
|
|
1103
|
+
);
|
|
1104
|
+
}
|
|
1105
|
+
async function deleteTask(taskId, options = {}) {
|
|
1106
|
+
return apiRequest(options, "DELETE", taskRoute(taskId));
|
|
1107
|
+
}
|
|
1108
|
+
async function validateTask(taskId, target = {}, options = {}) {
|
|
1109
|
+
return apiRequest(
|
|
1110
|
+
options,
|
|
1111
|
+
"POST",
|
|
1112
|
+
`${taskRoute(taskId)}/validate`,
|
|
1113
|
+
compact({
|
|
1114
|
+
version: target.version,
|
|
1115
|
+
slug: target.slug,
|
|
1116
|
+
versionId: target.versionId
|
|
1117
|
+
})
|
|
1118
|
+
);
|
|
1119
|
+
}
|
|
1120
|
+
var TASKS, taskRoute, compact;
|
|
1121
|
+
var init_tasks = __esm({
|
|
1122
|
+
"src/worlds/tasks.ts"() {
|
|
1123
|
+
"use strict";
|
|
1124
|
+
init_worlds();
|
|
1125
|
+
TASKS = "/api/public/world-tasks";
|
|
1126
|
+
taskRoute = (id) => `${TASKS}/${encodeURIComponent(id)}`;
|
|
1127
|
+
compact = (body) => Object.fromEntries(Object.entries(body).filter(([, v]) => v !== void 0));
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
|
|
331
1131
|
// src/worlds/hub.ts
|
|
332
1132
|
function isExcludedDirComponent(component) {
|
|
333
1133
|
return component.startsWith(".") || ROOT_EXCLUDED_DIRS.has(component) || component.endsWith(".egg-info");
|
|
@@ -370,7 +1170,7 @@ function collectArchiveRelPaths(dir) {
|
|
|
370
1170
|
return out.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
371
1171
|
}
|
|
372
1172
|
function computeContentHash(dir) {
|
|
373
|
-
const hasher = (0,
|
|
1173
|
+
const hasher = (0, import_node_crypto2.createHash)("sha256");
|
|
374
1174
|
for (const relPath of collectArchiveRelPaths(dir)) {
|
|
375
1175
|
hasher.update(Buffer.from(`file:${relPath}`, "utf-8"));
|
|
376
1176
|
hasher.update(fs.readFileSync(path.join(dir, relPath)));
|
|
@@ -444,7 +1244,7 @@ function writeLocalMeta(dir, meta) {
|
|
|
444
1244
|
function snapshotTreeHashes(dir) {
|
|
445
1245
|
const out = {};
|
|
446
1246
|
for (const relPath of collectArchiveRelPaths(dir)) {
|
|
447
|
-
out[relPath] = (0,
|
|
1247
|
+
out[relPath] = (0, import_node_crypto2.createHash)("sha256").update(fs.readFileSync(path.join(dir, relPath))).digest("hex");
|
|
448
1248
|
}
|
|
449
1249
|
return out;
|
|
450
1250
|
}
|
|
@@ -487,7 +1287,7 @@ function buildFileManifest(dir) {
|
|
|
487
1287
|
path: childRel,
|
|
488
1288
|
isDirectory: false,
|
|
489
1289
|
size: payload.length,
|
|
490
|
-
sha256: (0,
|
|
1290
|
+
sha256: (0, import_node_crypto2.createHash)("sha256").update(payload).digest("hex")
|
|
491
1291
|
});
|
|
492
1292
|
}
|
|
493
1293
|
}
|
|
@@ -521,7 +1321,13 @@ async function push(dir, opts = {}) {
|
|
|
521
1321
|
options,
|
|
522
1322
|
"POST",
|
|
523
1323
|
"/api/public/benchmark-containers/resolve",
|
|
524
|
-
{
|
|
1324
|
+
{
|
|
1325
|
+
slug,
|
|
1326
|
+
name: opts.name ?? pyproject.name ?? slug,
|
|
1327
|
+
...opts.description ? { description: opts.description } : {},
|
|
1328
|
+
...opts.tags?.length ? { tags: opts.tags } : {},
|
|
1329
|
+
...opts.visibility ? { visibility: opts.visibility } : {}
|
|
1330
|
+
}
|
|
525
1331
|
);
|
|
526
1332
|
const tarball = buildSourceTarball(dir);
|
|
527
1333
|
const bundleSha256 = sha256b64(tarball);
|
|
@@ -537,10 +1343,11 @@ async function push(dir, opts = {}) {
|
|
|
537
1343
|
baseVersionId,
|
|
538
1344
|
...opts.force ? { force: true } : {},
|
|
539
1345
|
...opts.message ? { changeReason: opts.message } : {},
|
|
540
|
-
...opts.author ? { author: opts.author } : {}
|
|
1346
|
+
...opts.author ? { author: opts.author } : {},
|
|
1347
|
+
...opts.imageRef ? { imageRef: opts.imageRef } : {}
|
|
541
1348
|
});
|
|
542
1349
|
if (version.uploadUrl) await putObject(version.uploadUrl, tarball, bundleSha256);
|
|
543
|
-
await apiRequest(
|
|
1350
|
+
const final = await apiRequest(
|
|
544
1351
|
options,
|
|
545
1352
|
"POST",
|
|
546
1353
|
`/api/public/benchmark-containers/versions/${version.versionId}/finalize`,
|
|
@@ -557,7 +1364,15 @@ async function push(dir, opts = {}) {
|
|
|
557
1364
|
forkedFromVersionId: baseVersionId,
|
|
558
1365
|
baseFiles: snapshotTreeHashes(dir)
|
|
559
1366
|
});
|
|
560
|
-
return {
|
|
1367
|
+
return {
|
|
1368
|
+
containerId: resolve2.containerId,
|
|
1369
|
+
slug,
|
|
1370
|
+
versionId: version.versionId,
|
|
1371
|
+
contentHash,
|
|
1372
|
+
branch: final.branch ?? branch,
|
|
1373
|
+
state: final.state ?? null,
|
|
1374
|
+
alreadyUploaded: Boolean(version.alreadyUploaded)
|
|
1375
|
+
};
|
|
561
1376
|
}
|
|
562
1377
|
function extractBundle(bundle, dir) {
|
|
563
1378
|
const tar = (0, import_node_zlib.gunzipSync)(bundle);
|
|
@@ -666,11 +1481,11 @@ async function createRef(slug, name, kind, versionId, options = {}) {
|
|
|
666
1481
|
...versionId ? { versionId } : {}
|
|
667
1482
|
});
|
|
668
1483
|
}
|
|
669
|
-
var
|
|
1484
|
+
var import_node_crypto2, import_node_zlib, fs, path, DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, BROAD_ROOT_MARKERS, sha256b64;
|
|
670
1485
|
var init_hub = __esm({
|
|
671
1486
|
"src/worlds/hub.ts"() {
|
|
672
1487
|
"use strict";
|
|
673
|
-
|
|
1488
|
+
import_node_crypto2 = require("crypto");
|
|
674
1489
|
import_node_zlib = require("zlib");
|
|
675
1490
|
fs = __toESM(require("fs"));
|
|
676
1491
|
path = __toESM(require("path"));
|
|
@@ -689,7 +1504,7 @@ var init_hub = __esm({
|
|
|
689
1504
|
]);
|
|
690
1505
|
ROOT_EXCLUDED_DIRS = /* @__PURE__ */ new Set(["dist", "build", "outputs", "__pycache__"]);
|
|
691
1506
|
BROAD_ROOT_MARKERS = ["gateway-env.toml", "gateway-api-world.toml"];
|
|
692
|
-
sha256b64 = (data) => (0,
|
|
1507
|
+
sha256b64 = (data) => (0, import_node_crypto2.createHash)("sha256").update(data).digest("base64");
|
|
693
1508
|
}
|
|
694
1509
|
});
|
|
695
1510
|
|
|
@@ -880,37 +1695,65 @@ var init_validate = __esm({
|
|
|
880
1695
|
// src/worlds/index.ts
|
|
881
1696
|
var worlds_exports = {};
|
|
882
1697
|
__export(worlds_exports, {
|
|
1698
|
+
BrowserActionRecorder: () => BrowserActionRecorder,
|
|
1699
|
+
COMPUTER_USE_SPECS: () => COMPUTER_USE_SPECS,
|
|
883
1700
|
DEFAULT_BRANCH: () => DEFAULT_BRANCH,
|
|
1701
|
+
DEFAULT_VIEWPORT: () => DEFAULT_VIEWPORT,
|
|
1702
|
+
EVENT_BATCH_SIZE: () => EVENT_BATCH_SIZE,
|
|
1703
|
+
EVENT_FLUSH_INTERVAL_MS: () => EVENT_FLUSH_INTERVAL_MS,
|
|
1704
|
+
EVENT_MAX_RETRIES: () => EVENT_MAX_RETRIES,
|
|
1705
|
+
SURFACE_KINDS: () => SURFACE_KINDS,
|
|
1706
|
+
WorldBrowser: () => WorldBrowser,
|
|
884
1707
|
WorldSession: () => WorldSession,
|
|
885
1708
|
WorldSessionCallError: () => WorldSessionCallError,
|
|
886
1709
|
WorldSessionTimeout: () => WorldSessionTimeout,
|
|
887
1710
|
WorldSet: () => WorldSet,
|
|
1711
|
+
WorldSurfaceUnavailable: () => WorldSurfaceUnavailable,
|
|
888
1712
|
WorldTask: () => WorldTask,
|
|
889
1713
|
apiRequest: () => apiRequest,
|
|
890
1714
|
attachSession: () => attachSession,
|
|
891
1715
|
buildSourceTarball: () => buildSourceTarball,
|
|
892
1716
|
collectArchiveRelPaths: () => collectArchiveRelPaths,
|
|
893
1717
|
computeContentHash: () => computeContentHash,
|
|
1718
|
+
computerUseToolkit: () => computerUseToolkit,
|
|
894
1719
|
createRef: () => createRef,
|
|
1720
|
+
createTask: () => createTask,
|
|
895
1721
|
deleteEnvSecret: () => deleteEnvSecret,
|
|
1722
|
+
deleteTask: () => deleteTask,
|
|
896
1723
|
detectProvenance: () => detectProvenance,
|
|
897
1724
|
getRun: () => getRun,
|
|
1725
|
+
getTask: () => getTask,
|
|
898
1726
|
isIncludedInContentHash: () => isIncludedInContentHash,
|
|
1727
|
+
isTaskIdRef: () => isTaskIdRef,
|
|
1728
|
+
isTaskSpec: () => isTaskSpec,
|
|
899
1729
|
listEnvSecretKeys: () => listEnvSecretKeys,
|
|
900
1730
|
listRunConfigs: () => listRunConfigs,
|
|
1731
|
+
listTasks: () => listTasks,
|
|
901
1732
|
localTreeState: () => localTreeState,
|
|
1733
|
+
openBrowser: () => openBrowser,
|
|
902
1734
|
openSession: () => openSession,
|
|
903
1735
|
openWorld: () => openWorld,
|
|
1736
|
+
parseWorldTaskRefs: () => parseWorldTaskRefs,
|
|
904
1737
|
propose: () => propose,
|
|
905
1738
|
pull: () => pull,
|
|
906
1739
|
push: () => push,
|
|
907
1740
|
readLocalMeta: () => readLocalMeta,
|
|
1741
|
+
redactActionArgs: () => redactActionArgs,
|
|
1742
|
+
resolveBrowserMode: () => resolveBrowserMode,
|
|
908
1743
|
runSessions: () => runSessions,
|
|
909
1744
|
schemaFromSignature: () => schemaFromSignature,
|
|
910
1745
|
setEnvSecret: () => setEnvSecret,
|
|
911
1746
|
snapshotTreeHashes: () => snapshotTreeHashes,
|
|
1747
|
+
surfaceKinds: () => surfaceKinds,
|
|
1748
|
+
taskLabel: () => taskLabel,
|
|
1749
|
+
uiEntryUrl: () => uiEntryUrl,
|
|
1750
|
+
uiUrl: () => uiUrl,
|
|
1751
|
+
updateTask: () => updateTask,
|
|
1752
|
+
upsertRunConfig: () => upsertRunConfig,
|
|
1753
|
+
validateTask: () => validateTask,
|
|
912
1754
|
validateWorld: () => validateWorld,
|
|
913
1755
|
waitForRun: () => waitForRun,
|
|
1756
|
+
withoutUiToken: () => withoutUiToken,
|
|
914
1757
|
writeLocalMeta: () => writeLocalMeta
|
|
915
1758
|
});
|
|
916
1759
|
function resolveEnv(options) {
|
|
@@ -981,6 +1824,28 @@ async function listRunConfigs(options = {}) {
|
|
|
981
1824
|
);
|
|
982
1825
|
return res.runConfigs;
|
|
983
1826
|
}
|
|
1827
|
+
async function upsertRunConfig(input, options = {}) {
|
|
1828
|
+
return apiRequest(
|
|
1829
|
+
options,
|
|
1830
|
+
"POST",
|
|
1831
|
+
"/api/public/benchmark-containers/run-configs",
|
|
1832
|
+
input
|
|
1833
|
+
);
|
|
1834
|
+
}
|
|
1835
|
+
function parseWorldTaskRefs(spec) {
|
|
1836
|
+
const items = (Array.isArray(spec) ? spec : spec.split(",")).map((s) => s.trim()).filter(Boolean);
|
|
1837
|
+
return items.map((item) => {
|
|
1838
|
+
const at = item.lastIndexOf("@");
|
|
1839
|
+
if (at < 0) return { id: item };
|
|
1840
|
+
const id = item.slice(0, at);
|
|
1841
|
+
const version = Number(item.slice(at + 1));
|
|
1842
|
+
if (!id || !Number.isInteger(version) || version < 1)
|
|
1843
|
+
throw new Error(
|
|
1844
|
+
`stored task ref '${item}' is not <id> or <id>@<version> (version a positive integer)`
|
|
1845
|
+
);
|
|
1846
|
+
return { id, version };
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
984
1849
|
async function getRun(runId, options = {}) {
|
|
985
1850
|
return apiRequest(
|
|
986
1851
|
options,
|
|
@@ -1074,6 +1939,8 @@ var init_worlds = __esm({
|
|
|
1074
1939
|
"src/worlds/index.ts"() {
|
|
1075
1940
|
"use strict";
|
|
1076
1941
|
init_session();
|
|
1942
|
+
init_tasks();
|
|
1943
|
+
init_browser();
|
|
1077
1944
|
init_hub();
|
|
1078
1945
|
init_validate();
|
|
1079
1946
|
WorldTask = class {
|
|
@@ -1103,15 +1970,18 @@ var init_worlds = __esm({
|
|
|
1103
1970
|
return hit;
|
|
1104
1971
|
}
|
|
1105
1972
|
/**
|
|
1106
|
-
* Open a LIVE session against one of this world's tasks
|
|
1107
|
-
*
|
|
1108
|
-
* platform. See
|
|
1973
|
+
* Open a LIVE session against one of this world's tasks — a bundled task's
|
|
1974
|
+
* name or an inline `WorldTaskSpec`: the platform boots (or reuses) a warm
|
|
1975
|
+
* container, and your agent calls its tools through the platform. See
|
|
1976
|
+
* worlds/session.ts.
|
|
1109
1977
|
*/
|
|
1110
1978
|
async open(task, opts = {}) {
|
|
1111
1979
|
const { openSession: openSession2 } = await Promise.resolve().then(() => (init_session(), session_exports));
|
|
1112
|
-
return openSession2(this.slug,
|
|
1980
|
+
return openSession2(this.slug, {
|
|
1981
|
+
task,
|
|
1113
1982
|
versionId: this.version.versionId,
|
|
1114
1983
|
reuseWarm: opts.reuseWarm,
|
|
1984
|
+
surfaces: opts.surfaces,
|
|
1115
1985
|
options: this.options
|
|
1116
1986
|
});
|
|
1117
1987
|
}
|
|
@@ -1143,7 +2013,7 @@ var require_package = __commonJS({
|
|
|
1143
2013
|
"package.json"(exports2, module2) {
|
|
1144
2014
|
module2.exports = {
|
|
1145
2015
|
name: "@withgateway/sdk",
|
|
1146
|
-
version: "0.
|
|
2016
|
+
version: "0.2.0",
|
|
1147
2017
|
description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
|
|
1148
2018
|
main: "./dist/index.js",
|
|
1149
2019
|
module: "./dist/index.mjs",
|
|
@@ -1212,12 +2082,15 @@ var require_package = __commonJS({
|
|
|
1212
2082
|
},
|
|
1213
2083
|
files: [
|
|
1214
2084
|
"dist",
|
|
2085
|
+
"skills",
|
|
2086
|
+
"runtime",
|
|
1215
2087
|
"README.md"
|
|
1216
2088
|
],
|
|
1217
2089
|
publishConfig: {
|
|
1218
2090
|
access: "public"
|
|
1219
2091
|
},
|
|
1220
2092
|
scripts: {
|
|
2093
|
+
prebuild: "node scripts/copy-skills.mjs && node scripts/copy-runtime.mjs",
|
|
1221
2094
|
build: "tsup",
|
|
1222
2095
|
dev: "tsup --watch",
|
|
1223
2096
|
typecheck: "tsc --noEmit",
|
|
@@ -1250,7 +2123,8 @@ var require_package = __commonJS({
|
|
|
1250
2123
|
"@opentelemetry/exporter-trace-otlp-http": ">=0.50.0",
|
|
1251
2124
|
"@opentelemetry/resources": ">=1.0.0",
|
|
1252
2125
|
"@opentelemetry/sdk-trace-base": ">=1.0.0",
|
|
1253
|
-
"@opentelemetry/sdk-trace-node": ">=1.0.0"
|
|
2126
|
+
"@opentelemetry/sdk-trace-node": ">=1.0.0",
|
|
2127
|
+
playwright: ">=1.40.0"
|
|
1254
2128
|
},
|
|
1255
2129
|
peerDependenciesMeta: {
|
|
1256
2130
|
"@opentelemetry/api": {
|
|
@@ -1267,6 +2141,9 @@ var require_package = __commonJS({
|
|
|
1267
2141
|
},
|
|
1268
2142
|
"@opentelemetry/resources": {
|
|
1269
2143
|
optional: true
|
|
2144
|
+
},
|
|
2145
|
+
playwright: {
|
|
2146
|
+
optional: true
|
|
1270
2147
|
}
|
|
1271
2148
|
},
|
|
1272
2149
|
optionalDependencies: {
|
|
@@ -1314,12 +2191,18 @@ var require_package = __commonJS({
|
|
|
1314
2191
|
var src_exports = {};
|
|
1315
2192
|
__export(src_exports, {
|
|
1316
2193
|
AGENT_ID_KEY: () => AGENT_ID_KEY,
|
|
2194
|
+
BrowserActionRecorder: () => BrowserActionRecorder,
|
|
2195
|
+
COMPUTER_USE_SPECS: () => COMPUTER_USE_SPECS,
|
|
1317
2196
|
DEFAULT_BRANCH: () => DEFAULT_BRANCH,
|
|
1318
2197
|
DEFAULT_TIMEOUT_SECONDS: () => DEFAULT_TIMEOUT_SECONDS,
|
|
2198
|
+
DEFAULT_VIEWPORT: () => DEFAULT_VIEWPORT,
|
|
1319
2199
|
DriftError: () => DriftError,
|
|
1320
2200
|
ENV_GATEWAY_HOST: () => ENV_GATEWAY_HOST,
|
|
1321
2201
|
ENV_GATEWAY_PUBLIC_KEY: () => ENV_GATEWAY_PUBLIC_KEY,
|
|
1322
2202
|
ENV_GATEWAY_SECRET_KEY: () => ENV_GATEWAY_SECRET_KEY,
|
|
2203
|
+
EVENT_BATCH_SIZE: () => EVENT_BATCH_SIZE,
|
|
2204
|
+
EVENT_FLUSH_INTERVAL_MS: () => EVENT_FLUSH_INTERVAL_MS,
|
|
2205
|
+
EVENT_MAX_RETRIES: () => EVENT_MAX_RETRIES,
|
|
1323
2206
|
EXPERIMENT_ATTRIBUTES: () => EXPERIMENT_ATTRIBUTES,
|
|
1324
2207
|
ExperimentClient: () => ExperimentClient,
|
|
1325
2208
|
ExperimentSpanProcessor: () => ExperimentSpanProcessor,
|
|
@@ -1346,6 +2229,7 @@ __export(src_exports, {
|
|
|
1346
2229
|
ReplayTask: () => ReplayTask,
|
|
1347
2230
|
SUCCESS_METRIC_NAME_KEY: () => SUCCESS_METRIC_NAME_KEY,
|
|
1348
2231
|
SUCCESS_SIGNAL_KEY: () => SUCCESS_SIGNAL_KEY,
|
|
2232
|
+
SURFACE_KINDS: () => SURFACE_KINDS,
|
|
1349
2233
|
ScoreError: () => ScoreError,
|
|
1350
2234
|
ScoresClient: () => ScoresClient,
|
|
1351
2235
|
SessionLoadError: () => SessionLoadError,
|
|
@@ -1356,10 +2240,12 @@ __export(src_exports, {
|
|
|
1356
2240
|
TraceDiff: () => TraceDiff,
|
|
1357
2241
|
UserProfileError: () => UserProfileError,
|
|
1358
2242
|
UsersClient: () => UsersClient,
|
|
2243
|
+
WorldBrowser: () => WorldBrowser,
|
|
1359
2244
|
WorldSession: () => WorldSession,
|
|
1360
2245
|
WorldSessionCallError: () => WorldSessionCallError,
|
|
1361
2246
|
WorldSessionTimeout: () => WorldSessionTimeout,
|
|
1362
2247
|
WorldSet: () => WorldSet,
|
|
2248
|
+
WorldSurfaceUnavailable: () => WorldSurfaceUnavailable,
|
|
1363
2249
|
WorldTask: () => WorldTask,
|
|
1364
2250
|
addExperimentAttributes: () => addExperimentAttributes,
|
|
1365
2251
|
apiRequest: () => apiRequest,
|
|
@@ -1374,11 +2260,14 @@ __export(src_exports, {
|
|
|
1374
2260
|
computeBuildHash: () => computeBuildHash,
|
|
1375
2261
|
computeContentHash: () => computeContentHash,
|
|
1376
2262
|
computeHash: () => computeHash,
|
|
2263
|
+
computerUseToolkit: () => computerUseToolkit,
|
|
1377
2264
|
context: () => context,
|
|
1378
2265
|
createRef: () => createRef,
|
|
2266
|
+
createTask: () => createTask,
|
|
1379
2267
|
currentTraceId: () => currentTraceId,
|
|
1380
2268
|
defineTool: () => defineTool,
|
|
1381
2269
|
deleteEnvSecret: () => deleteEnvSecret,
|
|
2270
|
+
deleteTask: () => deleteTask,
|
|
1382
2271
|
detectProvenance: () => detectProvenance,
|
|
1383
2272
|
experimentContextStorage: () => experimentContextStorage,
|
|
1384
2273
|
experiments: () => singleton_exports,
|
|
@@ -1389,26 +2278,34 @@ __export(src_exports, {
|
|
|
1389
2278
|
getRegisteredSkills: () => getRegisteredSkills,
|
|
1390
2279
|
getRegisteredTools: () => getRegisteredTools,
|
|
1391
2280
|
getRun: () => getRun,
|
|
2281
|
+
getTask: () => getTask,
|
|
1392
2282
|
identify: () => identify,
|
|
1393
2283
|
isIncludedInContentHash: () => isIncludedInContentHash,
|
|
2284
|
+
isTaskIdRef: () => isTaskIdRef,
|
|
2285
|
+
isTaskSpec: () => isTaskSpec,
|
|
1394
2286
|
listEnvSecretKeys: () => listEnvSecretKeys,
|
|
1395
2287
|
listRunConfigs: () => listRunConfigs,
|
|
2288
|
+
listTasks: () => listTasks,
|
|
1396
2289
|
loadSession: () => loadSession,
|
|
1397
2290
|
localTreeState: () => localTreeState,
|
|
1398
2291
|
memory: () => memory,
|
|
2292
|
+
openBrowser: () => openBrowser,
|
|
1399
2293
|
openSession: () => openSession,
|
|
1400
2294
|
openWorld: () => openWorld,
|
|
2295
|
+
parseWorldTaskRefs: () => parseWorldTaskRefs,
|
|
1401
2296
|
personas: () => personas,
|
|
1402
2297
|
propose: () => propose,
|
|
1403
2298
|
pull: () => pull,
|
|
1404
2299
|
push: () => push,
|
|
1405
2300
|
readLocalMeta: () => readLocalMeta,
|
|
2301
|
+
redactActionArgs: () => redactActionArgs,
|
|
1406
2302
|
registerArtifact: () => registerArtifact,
|
|
1407
2303
|
registerPrompt: () => registerPrompt,
|
|
1408
2304
|
registerSkill: () => registerSkill,
|
|
1409
2305
|
renderAgentSystem: () => renderAgentSystem,
|
|
1410
2306
|
replay: () => replay,
|
|
1411
2307
|
resetBuildRegistry: () => resetBuildRegistry,
|
|
2308
|
+
resolveBrowserMode: () => resolveBrowserMode,
|
|
1412
2309
|
resolveUserId: () => resolveUserId,
|
|
1413
2310
|
runSessions: () => runSessions,
|
|
1414
2311
|
runSuite: () => runSuite,
|
|
@@ -1422,10 +2319,18 @@ __export(src_exports, {
|
|
|
1422
2319
|
snapshotTreeHashes: () => snapshotTreeHashes,
|
|
1423
2320
|
success: () => success,
|
|
1424
2321
|
suite: () => suite,
|
|
2322
|
+
surfaceKinds: () => surfaceKinds,
|
|
2323
|
+
taskLabel: () => taskLabel,
|
|
1425
2324
|
tracing: () => tracing,
|
|
2325
|
+
uiEntryUrl: () => uiEntryUrl,
|
|
2326
|
+
uiUrl: () => uiUrl,
|
|
2327
|
+
updateTask: () => updateTask,
|
|
2328
|
+
upsertRunConfig: () => upsertRunConfig,
|
|
1426
2329
|
users: () => users,
|
|
2330
|
+
validateTask: () => validateTask,
|
|
1427
2331
|
validateWorld: () => validateWorld,
|
|
1428
2332
|
waitForRun: () => waitForRun,
|
|
2333
|
+
withoutUiToken: () => withoutUiToken,
|
|
1429
2334
|
writeLocalMeta: () => writeLocalMeta
|
|
1430
2335
|
});
|
|
1431
2336
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -4233,7 +5138,7 @@ init_worlds();
|
|
|
4233
5138
|
init_session();
|
|
4234
5139
|
|
|
4235
5140
|
// src/build/index.ts
|
|
4236
|
-
var
|
|
5141
|
+
var import_node_crypto3 = require("crypto");
|
|
4237
5142
|
function canonicalJson(value) {
|
|
4238
5143
|
if (value === null || typeof value !== "object") {
|
|
4239
5144
|
return JSON.stringify(value);
|
|
@@ -4245,7 +5150,7 @@ function canonicalJson(value) {
|
|
|
4245
5150
|
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
|
|
4246
5151
|
}
|
|
4247
5152
|
function sha256(text) {
|
|
4248
|
-
return `sha256:${(0,
|
|
5153
|
+
return `sha256:${(0, import_node_crypto3.createHash)("sha256").update(text).digest("hex")}`;
|
|
4249
5154
|
}
|
|
4250
5155
|
var registeredTools = /* @__PURE__ */ new Map();
|
|
4251
5156
|
var registeredPrompts = /* @__PURE__ */ new Map();
|
|
@@ -5114,12 +6019,18 @@ var tracing = {
|
|
|
5114
6019
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5115
6020
|
0 && (module.exports = {
|
|
5116
6021
|
AGENT_ID_KEY,
|
|
6022
|
+
BrowserActionRecorder,
|
|
6023
|
+
COMPUTER_USE_SPECS,
|
|
5117
6024
|
DEFAULT_BRANCH,
|
|
5118
6025
|
DEFAULT_TIMEOUT_SECONDS,
|
|
6026
|
+
DEFAULT_VIEWPORT,
|
|
5119
6027
|
DriftError,
|
|
5120
6028
|
ENV_GATEWAY_HOST,
|
|
5121
6029
|
ENV_GATEWAY_PUBLIC_KEY,
|
|
5122
6030
|
ENV_GATEWAY_SECRET_KEY,
|
|
6031
|
+
EVENT_BATCH_SIZE,
|
|
6032
|
+
EVENT_FLUSH_INTERVAL_MS,
|
|
6033
|
+
EVENT_MAX_RETRIES,
|
|
5123
6034
|
EXPERIMENT_ATTRIBUTES,
|
|
5124
6035
|
ExperimentClient,
|
|
5125
6036
|
ExperimentSpanProcessor,
|
|
@@ -5146,6 +6057,7 @@ var tracing = {
|
|
|
5146
6057
|
ReplayTask,
|
|
5147
6058
|
SUCCESS_METRIC_NAME_KEY,
|
|
5148
6059
|
SUCCESS_SIGNAL_KEY,
|
|
6060
|
+
SURFACE_KINDS,
|
|
5149
6061
|
ScoreError,
|
|
5150
6062
|
ScoresClient,
|
|
5151
6063
|
SessionLoadError,
|
|
@@ -5156,10 +6068,12 @@ var tracing = {
|
|
|
5156
6068
|
TraceDiff,
|
|
5157
6069
|
UserProfileError,
|
|
5158
6070
|
UsersClient,
|
|
6071
|
+
WorldBrowser,
|
|
5159
6072
|
WorldSession,
|
|
5160
6073
|
WorldSessionCallError,
|
|
5161
6074
|
WorldSessionTimeout,
|
|
5162
6075
|
WorldSet,
|
|
6076
|
+
WorldSurfaceUnavailable,
|
|
5163
6077
|
WorldTask,
|
|
5164
6078
|
addExperimentAttributes,
|
|
5165
6079
|
apiRequest,
|
|
@@ -5174,11 +6088,14 @@ var tracing = {
|
|
|
5174
6088
|
computeBuildHash,
|
|
5175
6089
|
computeContentHash,
|
|
5176
6090
|
computeHash,
|
|
6091
|
+
computerUseToolkit,
|
|
5177
6092
|
context,
|
|
5178
6093
|
createRef,
|
|
6094
|
+
createTask,
|
|
5179
6095
|
currentTraceId,
|
|
5180
6096
|
defineTool,
|
|
5181
6097
|
deleteEnvSecret,
|
|
6098
|
+
deleteTask,
|
|
5182
6099
|
detectProvenance,
|
|
5183
6100
|
experimentContextStorage,
|
|
5184
6101
|
experiments,
|
|
@@ -5189,26 +6106,34 @@ var tracing = {
|
|
|
5189
6106
|
getRegisteredSkills,
|
|
5190
6107
|
getRegisteredTools,
|
|
5191
6108
|
getRun,
|
|
6109
|
+
getTask,
|
|
5192
6110
|
identify,
|
|
5193
6111
|
isIncludedInContentHash,
|
|
6112
|
+
isTaskIdRef,
|
|
6113
|
+
isTaskSpec,
|
|
5194
6114
|
listEnvSecretKeys,
|
|
5195
6115
|
listRunConfigs,
|
|
6116
|
+
listTasks,
|
|
5196
6117
|
loadSession,
|
|
5197
6118
|
localTreeState,
|
|
5198
6119
|
memory,
|
|
6120
|
+
openBrowser,
|
|
5199
6121
|
openSession,
|
|
5200
6122
|
openWorld,
|
|
6123
|
+
parseWorldTaskRefs,
|
|
5201
6124
|
personas,
|
|
5202
6125
|
propose,
|
|
5203
6126
|
pull,
|
|
5204
6127
|
push,
|
|
5205
6128
|
readLocalMeta,
|
|
6129
|
+
redactActionArgs,
|
|
5206
6130
|
registerArtifact,
|
|
5207
6131
|
registerPrompt,
|
|
5208
6132
|
registerSkill,
|
|
5209
6133
|
renderAgentSystem,
|
|
5210
6134
|
replay,
|
|
5211
6135
|
resetBuildRegistry,
|
|
6136
|
+
resolveBrowserMode,
|
|
5212
6137
|
resolveUserId,
|
|
5213
6138
|
runSessions,
|
|
5214
6139
|
runSuite,
|
|
@@ -5222,10 +6147,18 @@ var tracing = {
|
|
|
5222
6147
|
snapshotTreeHashes,
|
|
5223
6148
|
success,
|
|
5224
6149
|
suite,
|
|
6150
|
+
surfaceKinds,
|
|
6151
|
+
taskLabel,
|
|
5225
6152
|
tracing,
|
|
6153
|
+
uiEntryUrl,
|
|
6154
|
+
uiUrl,
|
|
6155
|
+
updateTask,
|
|
6156
|
+
upsertRunConfig,
|
|
5226
6157
|
users,
|
|
6158
|
+
validateTask,
|
|
5227
6159
|
validateWorld,
|
|
5228
6160
|
waitForRun,
|
|
6161
|
+
withoutUiToken,
|
|
5229
6162
|
writeLocalMeta
|
|
5230
6163
|
});
|
|
5231
6164
|
//# sourceMappingURL=index.js.map
|