@withgateway/sdk 0.3.3 → 0.4.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 +4 -3
- package/dist/cli.js +2221 -962
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2212 -953
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.js +81 -19
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +79 -17
- package/dist/files/index.mjs.map +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +124 -11
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +124 -11
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/{index-C3UzD0G3.d.mts → index-CDPQBsU5.d.mts} +19 -3
- package/dist/{index-C3UzD0G3.d.ts → index-CDPQBsU5.d.ts} +19 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +903 -221
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +868 -212
- package/dist/index.mjs.map +1 -1
- package/dist/traces/index.js +78 -16
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +76 -14
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.js +7 -1
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +7 -1
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +692 -410
- package/dist/worlds/index.d.ts +692 -410
- package/dist/worlds/index.js +740 -197
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +736 -193
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/gatewaysdk/environment/_materialize.py +5 -25
- package/runtime/gatewaysdk/environment/_world.py +58 -65
- package/runtime/gatewaysdk/environment/backing.py +20 -24
- package/runtime/gatewaysdk/environment/core.py +1 -16
- package/runtime/gatewaysdk/environment/legacy_sqlite.py +14 -27
- package/runtime/gatewaysdk/environment/schema/admission.py +174 -0
- package/runtime/gatewaysdk/environment/schema/api.py +174 -471
- package/runtime/gatewaysdk/environment/schema/assertions.py +458 -0
- package/runtime/gatewaysdk/environment/schema/batch.py +3 -3
- package/runtime/gatewaysdk/environment/schema/cache_layout.py +5 -0
- package/runtime/gatewaysdk/environment/schema/call_capture.py +309 -0
- package/runtime/gatewaysdk/environment/schema/call_log.py +230 -18
- package/runtime/gatewaysdk/environment/schema/call_redaction.py +201 -19
- package/runtime/gatewaysdk/environment/schema/cast.py +15 -35
- package/runtime/gatewaysdk/environment/schema/conform.py +6 -27
- package/runtime/gatewaysdk/environment/schema/connector.py +89 -152
- package/runtime/gatewaysdk/environment/schema/connectors/confluence/connector.toml +1 -12
- package/runtime/gatewaysdk/environment/schema/connectors/github/connector.toml +1 -0
- package/runtime/gatewaysdk/environment/schema/connectors/servicenow/connector.toml +2 -5
- package/runtime/gatewaysdk/environment/schema/cors.py +54 -0
- package/runtime/gatewaysdk/environment/schema/credentials.py +313 -8
- package/runtime/gatewaysdk/environment/schema/data.py +14 -13
- package/runtime/gatewaysdk/environment/schema/database/base.py +106 -165
- package/runtime/gatewaysdk/environment/schema/database/guard.py +43 -36
- package/runtime/gatewaysdk/environment/schema/database/reads.py +169 -0
- package/runtime/gatewaysdk/environment/schema/database/sqlite.py +57 -31
- package/runtime/gatewaysdk/environment/schema/declared_routes.py +210 -0
- package/runtime/gatewaysdk/environment/schema/door.py +899 -0
- package/runtime/gatewaysdk/environment/schema/envelope.py +86 -28
- package/runtime/gatewaysdk/environment/schema/grading.py +58 -86
- package/runtime/gatewaysdk/environment/schema/handler_errors.py +25 -4
- package/runtime/gatewaysdk/environment/schema/host.py +229 -1695
- package/runtime/gatewaysdk/environment/schema/host_control.py +144 -0
- package/runtime/gatewaysdk/environment/schema/host_handoff.py +370 -0
- package/runtime/gatewaysdk/environment/schema/host_loops.py +97 -0
- package/runtime/gatewaysdk/environment/schema/host_owners.py +121 -0
- package/runtime/gatewaysdk/environment/schema/host_proxy.py +111 -0
- package/runtime/gatewaysdk/environment/schema/host_requests.py +6 -0
- package/runtime/gatewaysdk/environment/schema/host_session.py +126 -0
- package/runtime/gatewaysdk/environment/schema/host_surfaces.py +79 -21
- package/runtime/gatewaysdk/environment/schema/host_transfers.py +127 -0
- package/runtime/gatewaysdk/environment/schema/host_versions.py +242 -0
- package/runtime/gatewaysdk/environment/schema/host_workers.py +577 -0
- package/runtime/gatewaysdk/environment/schema/journal.py +437 -0
- package/runtime/gatewaysdk/environment/schema/ledger_spill.py +828 -0
- package/runtime/gatewaysdk/environment/schema/local.py +31 -116
- package/runtime/gatewaysdk/environment/schema/platform.py +15 -17
- package/runtime/gatewaysdk/environment/schema/request_body.py +238 -0
- package/runtime/gatewaysdk/environment/schema/request_ledger.py +958 -0
- package/runtime/gatewaysdk/environment/schema/route_bindings.py +25 -3
- package/runtime/gatewaysdk/environment/schema/route_miss.py +54 -0
- package/runtime/gatewaysdk/environment/schema/runtime.py +129 -176
- package/runtime/gatewaysdk/environment/schema/session_files.py +133 -24
- package/runtime/gatewaysdk/environment/schema/session_move.py +275 -0
- package/runtime/gatewaysdk/environment/schema/skills/agents/connector-template-author.md +5 -1
- package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +8 -9
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +31 -6
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +12 -8
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +13 -13
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +23 -23
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +11 -6
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +35 -2
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/journal-checks.md +182 -0
- package/runtime/gatewaysdk/environment/schema/snapshot.py +149 -29
- package/runtime/gatewaysdk/environment/schema/spill_files.py +228 -0
- package/runtime/gatewaysdk/environment/schema/tasks.py +229 -323
- package/runtime/gatewaysdk/environment/schema/tools_world.py +84 -203
- package/runtime/gatewaysdk/environment/schema/validation.py +69 -1
- package/runtime/gatewaysdk/environment/schema/verbs.py +32 -36
- package/runtime/gatewaysdk/environment/schema/worker.py +6 -4
- package/runtime/gatewaysdk/environment/schema/workers.py +203 -39
- package/runtime/gatewaysdk/environment/schema/world_host.py +953 -0
- package/runtime/gatewaysdk/environment/schema/world_tests.py +9 -11
- package/runtime/gatewaysdk/environment/world.py +1 -1
- package/runtime/gatewaysdk/environment/world_session_contract.py +14 -0
- package/skills/agents/connector-template-author.md +5 -1
- package/skills/benchmarks-getting-started/SKILL.md +8 -9
- package/skills/connector-schema-authoring/SKILL.md +31 -6
- package/skills/connector-schema-authoring/connector-worlds.md +129 -7
- package/skills/world-data-ingestion/ROWS.md +12 -8
- package/skills/world-data-ingestion/SKILL.md +13 -13
- package/skills/worlds-getting-started/SKILL.md +23 -23
- package/skills/worlds-getting-started/references/cli-mcp-map.md +11 -6
- package/skills/worlds-getting-started/references/gotchas.md +35 -2
- package/skills/worlds-getting-started/references/journal-checks.md +182 -0
package/dist/index.js
CHANGED
|
@@ -494,7 +494,7 @@ function platformTimeoutMs(env = process.env) {
|
|
|
494
494
|
if (Number.isInteger(value) && value > 0) return value;
|
|
495
495
|
throw new Error(`${PLATFORM_TIMEOUT_ENV} must be a positive whole number of milliseconds, not \`${raw}\`.`);
|
|
496
496
|
}
|
|
497
|
-
var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, sleep2, RetryPolicy, Attempt, PlatformTransport;
|
|
497
|
+
var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, FETCH_LIMIT, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, sleep2, RetryPolicy, Attempt, PlatformTransport;
|
|
498
498
|
var init_transport = __esm({
|
|
499
499
|
"src/worlds/transport.ts"() {
|
|
500
500
|
"use strict";
|
|
@@ -502,7 +502,13 @@ var init_transport = __esm({
|
|
|
502
502
|
PLATFORM_TIMEOUT_DEFAULT_MS = 12e4;
|
|
503
503
|
CHECK_HOST = "Check GATEWAY_HOST (or --host) points at a running platform, then retry.";
|
|
504
504
|
RETRY = "Retry; if it repeats, check the network between here and the platform.";
|
|
505
|
+
FETCH_LIMIT = {
|
|
506
|
+
reason: "Node's fetch stopped waiting after 300 s",
|
|
507
|
+
next: "The platform may still be running it: check what it changed before you retry."
|
|
508
|
+
};
|
|
505
509
|
CAUSES = {
|
|
510
|
+
UND_ERR_HEADERS_TIMEOUT: FETCH_LIMIT,
|
|
511
|
+
UND_ERR_BODY_TIMEOUT: FETCH_LIMIT,
|
|
506
512
|
ECONNREFUSED: { reason: "connection refused", next: CHECK_HOST },
|
|
507
513
|
ENOTFOUND: { reason: "DNS lookup failed", next: CHECK_HOST },
|
|
508
514
|
EAI_AGAIN: { reason: "DNS lookup failed", next: CHECK_HOST },
|
|
@@ -802,6 +808,12 @@ var init_browserReconnect = __esm({
|
|
|
802
808
|
});
|
|
803
809
|
|
|
804
810
|
// src/worlds/browser.ts
|
|
811
|
+
function assertSessionAuthMode(value) {
|
|
812
|
+
if (SESSION_AUTH_MODES.includes(value)) return;
|
|
813
|
+
throw new Error(
|
|
814
|
+
`Unknown session auth: ${String(value)}; choose from ${SESSION_AUTH_MODES.join(", ")}`
|
|
815
|
+
);
|
|
816
|
+
}
|
|
805
817
|
function assertBrowserTier(value) {
|
|
806
818
|
if (BROWSER_TIERS.includes(value)) return;
|
|
807
819
|
throw new Error(
|
|
@@ -838,6 +850,15 @@ function splitHash(url) {
|
|
|
838
850
|
const h = url.indexOf("#");
|
|
839
851
|
return h < 0 ? [url, ""] : [url.slice(0, h), url.slice(h)];
|
|
840
852
|
}
|
|
853
|
+
function capabilityLabel(url) {
|
|
854
|
+
let host = "";
|
|
855
|
+
try {
|
|
856
|
+
host = url ? new URL(url).hostname : "";
|
|
857
|
+
} catch {
|
|
858
|
+
return null;
|
|
859
|
+
}
|
|
860
|
+
return CAPABILITY_HOST.exec(host)?.[1] ?? null;
|
|
861
|
+
}
|
|
841
862
|
function redactActionArgs(action, args) {
|
|
842
863
|
const secretField = action === "browser_type" && SECRET_KEY.test(String(args.selector ?? ""));
|
|
843
864
|
const out = {};
|
|
@@ -897,7 +918,9 @@ async function openBrowser(surfaces, opts = {}) {
|
|
|
897
918
|
};
|
|
898
919
|
const scrubber = new SecretScrubber([
|
|
899
920
|
surfaces.browser?.wsUrl,
|
|
900
|
-
surfaces.ui?.token
|
|
921
|
+
surfaces.ui?.token,
|
|
922
|
+
capabilityLabel(surfaces.ui?.url),
|
|
923
|
+
capabilityLabel(surfaces.api?.url)
|
|
901
924
|
]);
|
|
902
925
|
const reconnector = mode === "hosted" && surfaces.browser.protocol === "cdp" && opts.repair ? new BrowserReconnector(opts.repair, reattach, {
|
|
903
926
|
scrub: (text2) => scrubber.scrub(text2)
|
|
@@ -962,13 +985,15 @@ function computerUseToolkit(browser, opts = {}) {
|
|
|
962
985
|
specs
|
|
963
986
|
};
|
|
964
987
|
}
|
|
965
|
-
var SURFACE_KINDS, BROWSER_TIERS, 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;
|
|
988
|
+
var SURFACE_KINDS, PLATFORM_SESSION_HEADER, SESSION_AUTH_MODES, BROWSER_TIERS, 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, CAPABILITY_HOST, BrowserActionRecorder, WorldBrowser, COMPUTER_USE_SPECS, str;
|
|
966
989
|
var init_browser = __esm({
|
|
967
990
|
"src/worlds/browser.ts"() {
|
|
968
991
|
"use strict";
|
|
969
992
|
init_session2();
|
|
970
993
|
init_browserReconnect();
|
|
971
994
|
SURFACE_KINDS = ["tools", "api", "ui", "browser"];
|
|
995
|
+
PLATFORM_SESSION_HEADER = "X-World-Session";
|
|
996
|
+
SESSION_AUTH_MODES = ["vendor", "open"];
|
|
972
997
|
BROWSER_TIERS = ["standard", "premium"];
|
|
973
998
|
DEFAULT_VIEWPORT = { width: 1280, height: 800 };
|
|
974
999
|
SETTLE_TIMEOUT_MS = 5e3;
|
|
@@ -989,6 +1014,7 @@ var init_browser = __esm({
|
|
|
989
1014
|
surface;
|
|
990
1015
|
};
|
|
991
1016
|
UI_TOKEN_QUERY = "token";
|
|
1017
|
+
CAPABILITY_HOST = /^o-[a-z0-9]+-([a-z2-7]{26})(?:-api)?\./;
|
|
992
1018
|
BrowserActionRecorder = class {
|
|
993
1019
|
constructor(post, agentId, opts = {}) {
|
|
994
1020
|
this.post = post;
|
|
@@ -1081,7 +1107,10 @@ var init_browser = __esm({
|
|
|
1081
1107
|
}
|
|
1082
1108
|
};
|
|
1083
1109
|
WorldBrowser = class {
|
|
1084
|
-
constructor(page, ui, mode, teardown, viewport = DEFAULT_VIEWPORT, recorder = null, reconnector = null, scrubber = new SecretScrubber([
|
|
1110
|
+
constructor(page, ui, mode, teardown, viewport = DEFAULT_VIEWPORT, recorder = null, reconnector = null, scrubber = new SecretScrubber([
|
|
1111
|
+
ui?.token,
|
|
1112
|
+
capabilityLabel(ui?.url)
|
|
1113
|
+
])) {
|
|
1085
1114
|
this.ui = ui;
|
|
1086
1115
|
this.mode = mode;
|
|
1087
1116
|
this.teardown = teardown;
|
|
@@ -1218,7 +1247,15 @@ var init_browser = __esm({
|
|
|
1218
1247
|
seq: recorder.nextSeq(),
|
|
1219
1248
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1220
1249
|
action,
|
|
1221
|
-
args: redactActionArgs(
|
|
1250
|
+
args: redactActionArgs(
|
|
1251
|
+
action,
|
|
1252
|
+
Object.fromEntries(
|
|
1253
|
+
Object.entries(args).map(([key2, value]) => [
|
|
1254
|
+
key2,
|
|
1255
|
+
typeof value === "string" ? this.scrubber.scrub(value) : value
|
|
1256
|
+
])
|
|
1257
|
+
)
|
|
1258
|
+
),
|
|
1222
1259
|
ok: failure === null,
|
|
1223
1260
|
error,
|
|
1224
1261
|
durationMs: Date.now() - started,
|
|
@@ -1234,8 +1271,8 @@ var init_browser = __esm({
|
|
|
1234
1271
|
screenshot: null
|
|
1235
1272
|
};
|
|
1236
1273
|
try {
|
|
1237
|
-
out.url = this.page.url();
|
|
1238
|
-
out.title = await this.page.title();
|
|
1274
|
+
out.url = this.scrubber.scrub(this.page.url());
|
|
1275
|
+
out.title = this.scrubber.scrub(await this.page.title());
|
|
1239
1276
|
const jpeg = await this.page.screenshot({
|
|
1240
1277
|
type: "jpeg",
|
|
1241
1278
|
quality: EVENT_SCREENSHOT_QUALITY
|
|
@@ -2679,13 +2716,16 @@ function idleWarning(idleExpiresAt, now = /* @__PURE__ */ new Date()) {
|
|
|
2679
2716
|
const minutes = Math.max(0, Math.floor(leftMs / 6e4));
|
|
2680
2717
|
return `warning: session expires in ${minutes}m (idle TTL); call a tool to extend it or \`gateway worlds session pin\` to keep it`;
|
|
2681
2718
|
}
|
|
2682
|
-
var CALL_BODY_LIMIT_BYTES, CALL_BODY_LIMIT_LABEL, IDLE_WARNING_MINUTES, EXPLORATORY_TASK, EXPLORATORY_TASK_SOURCE, NO_GRADER_REASON, WorldCallTooLarge, stillStartingHint;
|
|
2719
|
+
var CALL_BODY_LIMIT_BYTES, CALL_BODY_LIMIT_LABEL, IDLE_WARNING_MINUTES, REQUEST_LOG_PAGE_MAX, REQUEST_BODY_CAPTURE_BYTES, REQUESTS_NOT_RECORDED, EXPLORATORY_TASK, EXPLORATORY_TASK_SOURCE, NO_GRADER_REASON, WorldCallTooLarge, stillStartingHint;
|
|
2683
2720
|
var init_sessionContract = __esm({
|
|
2684
2721
|
"src/worlds/sessionContract.ts"() {
|
|
2685
2722
|
"use strict";
|
|
2686
2723
|
CALL_BODY_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
2687
2724
|
CALL_BODY_LIMIT_LABEL = "4mb";
|
|
2688
2725
|
IDLE_WARNING_MINUTES = 5;
|
|
2726
|
+
REQUEST_LOG_PAGE_MAX = 200;
|
|
2727
|
+
REQUEST_BODY_CAPTURE_BYTES = 64 * 1024;
|
|
2728
|
+
REQUESTS_NOT_RECORDED = "requests_not_recorded";
|
|
2689
2729
|
EXPLORATORY_TASK = Object.freeze({
|
|
2690
2730
|
instruction: "exploratory session"
|
|
2691
2731
|
});
|
|
@@ -2719,6 +2759,217 @@ var init_sessionContract = __esm({
|
|
|
2719
2759
|
}
|
|
2720
2760
|
});
|
|
2721
2761
|
|
|
2762
|
+
// src/worlds/toolSchema.ts
|
|
2763
|
+
function schemaFromSignature(spec) {
|
|
2764
|
+
if (spec.inputSchema)
|
|
2765
|
+
return {
|
|
2766
|
+
type: "function",
|
|
2767
|
+
function: {
|
|
2768
|
+
name: modelToolName(spec.name),
|
|
2769
|
+
description: spec.doc ?? spec.name,
|
|
2770
|
+
parameters: spec.inputSchema
|
|
2771
|
+
}
|
|
2772
|
+
};
|
|
2773
|
+
const inside = /\(([\s\S]*)\)\s*$/.exec(spec.signature.trim())?.[1] ?? "";
|
|
2774
|
+
const properties = {};
|
|
2775
|
+
const required2 = [];
|
|
2776
|
+
const params = [];
|
|
2777
|
+
let depth = 0;
|
|
2778
|
+
let current = "";
|
|
2779
|
+
for (const ch of inside) {
|
|
2780
|
+
if ("([{".includes(ch)) depth++;
|
|
2781
|
+
if (")]}".includes(ch)) depth--;
|
|
2782
|
+
if (ch === "," && depth === 0) {
|
|
2783
|
+
params.push(current);
|
|
2784
|
+
current = "";
|
|
2785
|
+
} else current += ch;
|
|
2786
|
+
}
|
|
2787
|
+
if (current.trim()) params.push(current);
|
|
2788
|
+
for (const raw of params) {
|
|
2789
|
+
const param = raw.trim();
|
|
2790
|
+
if (!param || param.startsWith("*") || param === "self") continue;
|
|
2791
|
+
const eq = param.indexOf("=");
|
|
2792
|
+
const name = (eq === -1 ? param : param.slice(0, eq)).split(":")[0].trim();
|
|
2793
|
+
if (!name) continue;
|
|
2794
|
+
if (eq === -1) {
|
|
2795
|
+
properties[name] = { type: "string" };
|
|
2796
|
+
required2.push(name);
|
|
2797
|
+
continue;
|
|
2798
|
+
}
|
|
2799
|
+
const value = param.slice(eq + 1).trim();
|
|
2800
|
+
if (/^-?\d+(\.\d+)?$/.test(value)) properties[name] = { type: "number" };
|
|
2801
|
+
else if (value === "True" || value === "False")
|
|
2802
|
+
properties[name] = { type: "boolean" };
|
|
2803
|
+
else properties[name] = { type: "string" };
|
|
2804
|
+
}
|
|
2805
|
+
return {
|
|
2806
|
+
type: "function",
|
|
2807
|
+
function: {
|
|
2808
|
+
name: modelToolName(spec.name),
|
|
2809
|
+
description: spec.doc ?? spec.name,
|
|
2810
|
+
parameters: { type: "object", properties, required: required2 }
|
|
2811
|
+
}
|
|
2812
|
+
};
|
|
2813
|
+
}
|
|
2814
|
+
var modelToolName;
|
|
2815
|
+
var init_toolSchema = __esm({
|
|
2816
|
+
"src/worlds/toolSchema.ts"() {
|
|
2817
|
+
"use strict";
|
|
2818
|
+
modelToolName = (name) => name.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 64) || "tool";
|
|
2819
|
+
}
|
|
2820
|
+
});
|
|
2821
|
+
|
|
2822
|
+
// src/worlds/requestLedger.ts
|
|
2823
|
+
function platformMessage(text2) {
|
|
2824
|
+
try {
|
|
2825
|
+
const { message } = JSON.parse(text2);
|
|
2826
|
+
return typeof message === "string" ? message : null;
|
|
2827
|
+
} catch {
|
|
2828
|
+
return null;
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
var WORLD_REQUEST_VIAS, WorldRequestFilterError, NOT_RECORDED, WorldRequestsNotRecorded, STATUS, INSTANT, WORLDS, SESSIONS, Instant, WorldRequestQuery, WorldRequestLedger;
|
|
2832
|
+
var init_requestLedger = __esm({
|
|
2833
|
+
"src/worlds/requestLedger.ts"() {
|
|
2834
|
+
"use strict";
|
|
2835
|
+
init_worlds();
|
|
2836
|
+
init_sessionContract();
|
|
2837
|
+
WORLD_REQUEST_VIAS = ["api", "ui", "tool"];
|
|
2838
|
+
WorldRequestFilterError = class extends Error {
|
|
2839
|
+
};
|
|
2840
|
+
NOT_RECORDED = "This session's engine records no requests; only hosted World Host sessions do.";
|
|
2841
|
+
WorldRequestsNotRecorded = class _WorldRequestsNotRecorded extends Error {
|
|
2842
|
+
static from(error) {
|
|
2843
|
+
if (!(error instanceof ApiError) || error.code !== REQUESTS_NOT_RECORDED) return error;
|
|
2844
|
+
return new _WorldRequestsNotRecorded(platformMessage(error.text) || NOT_RECORDED);
|
|
2845
|
+
}
|
|
2846
|
+
static async mapped(read) {
|
|
2847
|
+
try {
|
|
2848
|
+
return await read;
|
|
2849
|
+
} catch (error) {
|
|
2850
|
+
throw _WorldRequestsNotRecorded.from(error);
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
};
|
|
2854
|
+
STATUS = /^(?:[1-5]\d\d|[1-5]xx)$/;
|
|
2855
|
+
INSTANT = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(Z|[+-]\d{2}:\d{2})?)?$/;
|
|
2856
|
+
WORLDS = "/api/public/worlds";
|
|
2857
|
+
SESSIONS = "/api/public/world-sessions";
|
|
2858
|
+
Instant = class _Instant {
|
|
2859
|
+
static parse(flag, raw) {
|
|
2860
|
+
const match = INSTANT.exec(raw);
|
|
2861
|
+
const millis = match ? _Instant.fromParts(match) : null;
|
|
2862
|
+
if (millis === null)
|
|
2863
|
+
throw new WorldRequestFilterError(
|
|
2864
|
+
`--${flag} must be an ISO 8601 date or time (2026-10-05, 2026-10-05T14:30:00Z), not \`${raw}\`.`
|
|
2865
|
+
);
|
|
2866
|
+
return millis;
|
|
2867
|
+
}
|
|
2868
|
+
static fromParts(match) {
|
|
2869
|
+
const [year, month, day, hour, minute, second] = [1, 2, 3, 4, 5, 6].map((i) => Number(match[i] ?? 0));
|
|
2870
|
+
const offset = _Instant.offsetMinutes(match[8]);
|
|
2871
|
+
if (offset === null || year < 1 || hour > 23 || minute > 59 || second > 59) return null;
|
|
2872
|
+
const date = /* @__PURE__ */ new Date(0);
|
|
2873
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
2874
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) return null;
|
|
2875
|
+
date.setUTCHours(hour, minute, second, Number((match[7] ?? "").padEnd(3, "0")));
|
|
2876
|
+
const utc = date.getTime() - offset * 6e4;
|
|
2877
|
+
const utcYear = new Date(utc).getUTCFullYear();
|
|
2878
|
+
return utcYear < 1 || utcYear > 9999 ? null : utc;
|
|
2879
|
+
}
|
|
2880
|
+
static offsetMinutes(zone) {
|
|
2881
|
+
if (zone === void 0 || zone === "Z") return 0;
|
|
2882
|
+
const hours = Number(zone.slice(1, 3));
|
|
2883
|
+
const minutes = Number(zone.slice(4, 6));
|
|
2884
|
+
if (hours > 23 || minutes > 59) return null;
|
|
2885
|
+
return (zone.startsWith("-") ? -1 : 1) * (hours * 60 + minutes);
|
|
2886
|
+
}
|
|
2887
|
+
};
|
|
2888
|
+
WorldRequestQuery = class _WorldRequestQuery {
|
|
2889
|
+
constructor(entries) {
|
|
2890
|
+
this.entries = entries;
|
|
2891
|
+
}
|
|
2892
|
+
entries;
|
|
2893
|
+
static parse(filter = {}) {
|
|
2894
|
+
const via = _WorldRequestQuery.via(filter.via);
|
|
2895
|
+
const status = _WorldRequestQuery.status(filter.status);
|
|
2896
|
+
const since = filter.since === void 0 ? void 0 : Instant.parse("since", filter.since);
|
|
2897
|
+
const until = filter.until === void 0 ? void 0 : Instant.parse("until", filter.until);
|
|
2898
|
+
if (since !== void 0 && until !== void 0 && since > until)
|
|
2899
|
+
throw new WorldRequestFilterError("--since must not be after --until.");
|
|
2900
|
+
const values = [
|
|
2901
|
+
["session", filter.session],
|
|
2902
|
+
["version", filter.version],
|
|
2903
|
+
["via", via],
|
|
2904
|
+
["operation", filter.operation],
|
|
2905
|
+
["status", status],
|
|
2906
|
+
["since", since === void 0 ? void 0 : new Date(since).toISOString()],
|
|
2907
|
+
["until", until === void 0 ? void 0 : new Date(until).toISOString()],
|
|
2908
|
+
["limit", filter.limit === void 0 ? void 0 : String(filter.limit)],
|
|
2909
|
+
["cursor", filter.cursor]
|
|
2910
|
+
];
|
|
2911
|
+
return new _WorldRequestQuery(values.filter((entry) => entry[1] !== void 0));
|
|
2912
|
+
}
|
|
2913
|
+
static via(value) {
|
|
2914
|
+
if (value === void 0) return void 0;
|
|
2915
|
+
const lower = value.toLowerCase();
|
|
2916
|
+
if (WORLD_REQUEST_VIAS.includes(lower)) return lower;
|
|
2917
|
+
throw new WorldRequestFilterError(`--via must be one of ${WORLD_REQUEST_VIAS.join(", ")}, not \`${value}\`.`);
|
|
2918
|
+
}
|
|
2919
|
+
static status(value) {
|
|
2920
|
+
if (value === void 0) return void 0;
|
|
2921
|
+
const lower = value.toLowerCase();
|
|
2922
|
+
if (STATUS.test(lower)) return lower;
|
|
2923
|
+
throw new WorldRequestFilterError(`--status must be a code (200) or a class (2xx), not \`${value}\`.`);
|
|
2924
|
+
}
|
|
2925
|
+
get filtered() {
|
|
2926
|
+
return this.entries.some(([key2]) => key2 !== "limit");
|
|
2927
|
+
}
|
|
2928
|
+
params() {
|
|
2929
|
+
return this.entries.map(([key2, value]) => [key2, value]);
|
|
2930
|
+
}
|
|
2931
|
+
search() {
|
|
2932
|
+
return this.entries.length ? `?${new URLSearchParams(this.entries).toString()}` : "";
|
|
2933
|
+
}
|
|
2934
|
+
};
|
|
2935
|
+
WorldRequestLedger = class {
|
|
2936
|
+
constructor(options = {}) {
|
|
2937
|
+
this.options = options;
|
|
2938
|
+
}
|
|
2939
|
+
options;
|
|
2940
|
+
/** A page of the world's requests, newest first; `nextCursor` reads the page after it. Narrowed to a session
|
|
2941
|
+
* whose engine records none: `WorldRequestsNotRecorded`. */
|
|
2942
|
+
list(slug, query = WorldRequestQuery.parse()) {
|
|
2943
|
+
return WorldRequestsNotRecorded.mapped(
|
|
2944
|
+
apiRequest(
|
|
2945
|
+
this.options,
|
|
2946
|
+
"GET",
|
|
2947
|
+
`${WORLDS}/${encodeURIComponent(slug)}/requests${query.search()}`
|
|
2948
|
+
)
|
|
2949
|
+
);
|
|
2950
|
+
}
|
|
2951
|
+
/** One of the world's requests, with its headers and bodies. */
|
|
2952
|
+
get(slug, requestId) {
|
|
2953
|
+
return apiRequest(
|
|
2954
|
+
this.options,
|
|
2955
|
+
"GET",
|
|
2956
|
+
`${WORLDS}/${encodeURIComponent(slug)}/requests/${encodeURIComponent(requestId)}`
|
|
2957
|
+
);
|
|
2958
|
+
}
|
|
2959
|
+
/** A page of one session's requests, newest first; `WorldRequestsNotRecorded` when its engine records none. */
|
|
2960
|
+
forSession(sessionId, query = WorldRequestQuery.parse()) {
|
|
2961
|
+
return WorldRequestsNotRecorded.mapped(
|
|
2962
|
+
apiRequest(
|
|
2963
|
+
this.options,
|
|
2964
|
+
"GET",
|
|
2965
|
+
`${SESSIONS}/${encodeURIComponent(sessionId)}/requests${query.search()}`
|
|
2966
|
+
)
|
|
2967
|
+
);
|
|
2968
|
+
}
|
|
2969
|
+
};
|
|
2970
|
+
}
|
|
2971
|
+
});
|
|
2972
|
+
|
|
2722
2973
|
// src/worlds/sessionReadiness.ts
|
|
2723
2974
|
var READY_TIMEOUT_MS, READY_POLL_MS, sleep3, WorldSessionTimeout, WorldSessionCallError, WorldSessionOpenFailed, ENDED, SessionReadiness;
|
|
2724
2975
|
var init_sessionReadiness = __esm({
|
|
@@ -3057,57 +3308,6 @@ __export(session_exports2, {
|
|
|
3057
3308
|
schemaFromSignature: () => schemaFromSignature,
|
|
3058
3309
|
taskLabel: () => taskLabel
|
|
3059
3310
|
});
|
|
3060
|
-
function schemaFromSignature(spec) {
|
|
3061
|
-
if (spec.inputSchema)
|
|
3062
|
-
return {
|
|
3063
|
-
type: "function",
|
|
3064
|
-
function: {
|
|
3065
|
-
name: modelToolName(spec.name),
|
|
3066
|
-
description: spec.doc ?? spec.name,
|
|
3067
|
-
parameters: spec.inputSchema
|
|
3068
|
-
}
|
|
3069
|
-
};
|
|
3070
|
-
const inside = /\(([\s\S]*)\)\s*$/.exec(spec.signature.trim())?.[1] ?? "";
|
|
3071
|
-
const properties = {};
|
|
3072
|
-
const required2 = [];
|
|
3073
|
-
const params = [];
|
|
3074
|
-
let depth = 0;
|
|
3075
|
-
let current = "";
|
|
3076
|
-
for (const ch of inside) {
|
|
3077
|
-
if ("([{".includes(ch)) depth++;
|
|
3078
|
-
if (")]}".includes(ch)) depth--;
|
|
3079
|
-
if (ch === "," && depth === 0) {
|
|
3080
|
-
params.push(current);
|
|
3081
|
-
current = "";
|
|
3082
|
-
} else current += ch;
|
|
3083
|
-
}
|
|
3084
|
-
if (current.trim()) params.push(current);
|
|
3085
|
-
for (const raw of params) {
|
|
3086
|
-
const param = raw.trim();
|
|
3087
|
-
if (!param || param.startsWith("*") || param === "self") continue;
|
|
3088
|
-
const eq = param.indexOf("=");
|
|
3089
|
-
const name = (eq === -1 ? param : param.slice(0, eq)).split(":")[0].trim();
|
|
3090
|
-
if (!name) continue;
|
|
3091
|
-
if (eq === -1) {
|
|
3092
|
-
properties[name] = { type: "string" };
|
|
3093
|
-
required2.push(name);
|
|
3094
|
-
continue;
|
|
3095
|
-
}
|
|
3096
|
-
const value = param.slice(eq + 1).trim();
|
|
3097
|
-
if (/^-?\d+(\.\d+)?$/.test(value)) properties[name] = { type: "number" };
|
|
3098
|
-
else if (value === "True" || value === "False")
|
|
3099
|
-
properties[name] = { type: "boolean" };
|
|
3100
|
-
else properties[name] = { type: "string" };
|
|
3101
|
-
}
|
|
3102
|
-
return {
|
|
3103
|
-
type: "function",
|
|
3104
|
-
function: {
|
|
3105
|
-
name: modelToolName(spec.name),
|
|
3106
|
-
description: spec.doc ?? spec.name,
|
|
3107
|
-
parameters: { type: "object", properties, required: required2 }
|
|
3108
|
-
}
|
|
3109
|
-
};
|
|
3110
|
-
}
|
|
3111
3311
|
async function attachSession(sessionId, options = {}) {
|
|
3112
3312
|
const state2 = await apiRequest(
|
|
3113
3313
|
options,
|
|
@@ -3128,6 +3328,7 @@ async function openSession(slugOrRef, taskOrOpts = {}, positionalOpts = {}) {
|
|
|
3128
3328
|
`Unknown world surfaces: ${unknown.join(", ")}; choose from ${SURFACE_KINDS.join(", ")}`
|
|
3129
3329
|
);
|
|
3130
3330
|
if (opts.browserTier !== void 0) assertBrowserTier(opts.browserTier);
|
|
3331
|
+
if (opts.auth !== void 0) assertSessionAuthMode(opts.auth);
|
|
3131
3332
|
const at = slugOrRef.indexOf("@");
|
|
3132
3333
|
const slug = at === -1 ? slugOrRef : slugOrRef.slice(0, at);
|
|
3133
3334
|
const ref = at === -1 ? "" : slugOrRef.slice(at + 1);
|
|
@@ -3140,7 +3341,8 @@ async function openSession(slugOrRef, taskOrOpts = {}, positionalOpts = {}) {
|
|
|
3140
3341
|
...task === void 0 ? {} : { task },
|
|
3141
3342
|
...opts.reuseWarm === void 0 ? {} : { reuseWarm: opts.reuseWarm },
|
|
3142
3343
|
...opts.surfaces?.length ? { surfaces: opts.surfaces } : {},
|
|
3143
|
-
...opts.browserTier === void 0 ? {} : { browserTier: opts.browserTier }
|
|
3344
|
+
...opts.browserTier === void 0 ? {} : { browserTier: opts.browserTier },
|
|
3345
|
+
...opts.auth === void 0 ? {} : { auth: opts.auth }
|
|
3144
3346
|
}
|
|
3145
3347
|
);
|
|
3146
3348
|
return new WorldSession(state2.sessionId, state2, options);
|
|
@@ -3221,7 +3423,7 @@ async function runSessions(opts) {
|
|
|
3221
3423
|
passed: failed === 0 && (opts.failUnder === void 0 || mean >= opts.failUnder)
|
|
3222
3424
|
};
|
|
3223
3425
|
}
|
|
3224
|
-
var import_node_crypto2, CALL_TIMEOUT_MS, CALL_POLL_MS, JUDGED_GRADE_TIMEOUT_MS, JUDGED_GRADE_POLL_MS, EXPORT_PAGE, sleep4,
|
|
3426
|
+
var import_node_crypto2, CALL_TIMEOUT_MS, CALL_POLL_MS, JUDGED_GRADE_TIMEOUT_MS, JUDGED_GRADE_POLL_MS, EXPORT_PAGE, sleep4, WorldSession, OPEN_SESSION_OPTION_KEYS, isOpenSessionOptions;
|
|
3225
3427
|
var init_session2 = __esm({
|
|
3226
3428
|
"src/worlds/session.ts"() {
|
|
3227
3429
|
"use strict";
|
|
@@ -3230,6 +3432,8 @@ var init_session2 = __esm({
|
|
|
3230
3432
|
init_browser();
|
|
3231
3433
|
init_nativeComputer();
|
|
3232
3434
|
init_sessionContract();
|
|
3435
|
+
init_toolSchema();
|
|
3436
|
+
init_requestLedger();
|
|
3233
3437
|
init_sessionReadiness();
|
|
3234
3438
|
init_session();
|
|
3235
3439
|
init_taskRef();
|
|
@@ -3243,7 +3447,6 @@ var init_session2 = __esm({
|
|
|
3243
3447
|
JUDGED_GRADE_POLL_MS = 2e3;
|
|
3244
3448
|
EXPORT_PAGE = 500;
|
|
3245
3449
|
sleep4 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
3246
|
-
modelToolName = (name) => name.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 64) || "tool";
|
|
3247
3450
|
WorldSession = class {
|
|
3248
3451
|
constructor(sessionId, current, options) {
|
|
3249
3452
|
this.sessionId = sessionId;
|
|
@@ -3313,12 +3516,12 @@ var init_session2 = __esm({
|
|
|
3313
3516
|
);
|
|
3314
3517
|
return api2.url;
|
|
3315
3518
|
}
|
|
3316
|
-
/** Headers every request to `api()` needs
|
|
3317
|
-
*
|
|
3318
|
-
* world's own declared auth
|
|
3519
|
+
/** Headers every request to `api()` needs: a World Host session's token in the
|
|
3520
|
+
* platform's `X-World-Session` header, which every world takes; `{}` for a pod
|
|
3521
|
+
* or hosted twin, which answers with the world's own declared auth. */
|
|
3319
3522
|
async apiHeaders() {
|
|
3320
3523
|
const { api: api2 } = await this.surfaces();
|
|
3321
|
-
return api2?.token ? {
|
|
3524
|
+
return api2?.token ? { [PLATFORM_SESSION_HEADER]: api2.token } : {};
|
|
3322
3525
|
}
|
|
3323
3526
|
/** URL of the world's UI entry page for this session. */
|
|
3324
3527
|
async ui() {
|
|
@@ -3389,11 +3592,28 @@ var init_session2 = __esm({
|
|
|
3389
3592
|
}
|
|
3390
3593
|
/** The session's latest platform state (one request, no waiting). */
|
|
3391
3594
|
async status() {
|
|
3595
|
+
return this.refresh(
|
|
3596
|
+
await apiRequest(
|
|
3597
|
+
this.options,
|
|
3598
|
+
"GET",
|
|
3599
|
+
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}`
|
|
3600
|
+
)
|
|
3601
|
+
);
|
|
3602
|
+
}
|
|
3603
|
+
/** The world started over under the same id, URLs and token, on what its pin (or `version`, which becomes
|
|
3604
|
+
* its pin) resolves to now: base data plus the task's seed. A grade then reads only the new world's requests. */
|
|
3605
|
+
async restart(opts = {}) {
|
|
3392
3606
|
const fresh = await apiRequest(
|
|
3393
3607
|
this.options,
|
|
3394
|
-
"
|
|
3395
|
-
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}
|
|
3608
|
+
"POST",
|
|
3609
|
+
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/restart`,
|
|
3610
|
+
opts.version ? { version: opts.version } : {}
|
|
3396
3611
|
);
|
|
3612
|
+
this.refresh(fresh);
|
|
3613
|
+
return fresh;
|
|
3614
|
+
}
|
|
3615
|
+
// A status read carries neither the objective nor the open's notices; keep the ones we opened with.
|
|
3616
|
+
refresh(fresh) {
|
|
3397
3617
|
this.current = {
|
|
3398
3618
|
instruction: this.current.instruction,
|
|
3399
3619
|
tools: this.current.tools,
|
|
@@ -3428,7 +3648,7 @@ var init_session2 = __esm({
|
|
|
3428
3648
|
const { callId } = enqueued;
|
|
3429
3649
|
const judged = enqueued.pending === true;
|
|
3430
3650
|
const budgetMs = timeoutMs ?? (judged ? JUDGED_GRADE_TIMEOUT_MS : CALL_TIMEOUT_MS);
|
|
3431
|
-
const
|
|
3651
|
+
const pollMs = judged ? JUDGED_GRADE_POLL_MS : CALL_POLL_MS;
|
|
3432
3652
|
const deadline = Date.now() + budgetMs;
|
|
3433
3653
|
for (; ; ) {
|
|
3434
3654
|
const call = await apiRequest(
|
|
@@ -3444,7 +3664,7 @@ var init_session2 = __esm({
|
|
|
3444
3664
|
throw new WorldSessionTimeout(
|
|
3445
3665
|
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.`
|
|
3446
3666
|
);
|
|
3447
|
-
await sleep4(
|
|
3667
|
+
await sleep4(pollMs);
|
|
3448
3668
|
}
|
|
3449
3669
|
}
|
|
3450
3670
|
/**
|
|
@@ -3537,19 +3757,31 @@ var init_session2 = __esm({
|
|
|
3537
3757
|
async reset(opts = {}) {
|
|
3538
3758
|
await this.exchange({ kind: "reset" }, opts.timeoutMs);
|
|
3539
3759
|
}
|
|
3760
|
+
/** One page of the session's entries in its world's request ledger, newest
|
|
3761
|
+
* first and without bodies: at most `limit` after `cursor` (the last page's
|
|
3762
|
+
* `nextCursor`). Reading it records nothing in the session. */
|
|
3763
|
+
async requests(opts = {}) {
|
|
3764
|
+
return new WorldRequestLedger(this.options).forSession(
|
|
3765
|
+
this.sessionId,
|
|
3766
|
+
WorldRequestQuery.parse({ cursor: opts.cursor, limit: opts.limit ?? REQUEST_LOG_PAGE_MAX })
|
|
3767
|
+
);
|
|
3768
|
+
}
|
|
3769
|
+
page(route, limit, cursor) {
|
|
3770
|
+
const query = new URLSearchParams({ limit: String(limit) });
|
|
3771
|
+
if (cursor) query.set("cursor", cursor);
|
|
3772
|
+
return apiRequest(
|
|
3773
|
+
this.options,
|
|
3774
|
+
"GET",
|
|
3775
|
+
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/${route}?${query.toString()}`
|
|
3776
|
+
);
|
|
3777
|
+
}
|
|
3540
3778
|
/** The session's call log, oldest first: every tool call, seed, reset,
|
|
3541
3779
|
* grade with its result — the record of the episode. */
|
|
3542
3780
|
async export() {
|
|
3543
3781
|
const calls = [];
|
|
3544
3782
|
let cursor;
|
|
3545
3783
|
do {
|
|
3546
|
-
const
|
|
3547
|
-
if (cursor) params.set("cursor", cursor);
|
|
3548
|
-
const page = await apiRequest(
|
|
3549
|
-
this.options,
|
|
3550
|
-
"GET",
|
|
3551
|
-
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/calls?${params.toString()}`
|
|
3552
|
-
);
|
|
3784
|
+
const page = await this.page("calls", EXPORT_PAGE, cursor);
|
|
3553
3785
|
for (const call of page.calls) {
|
|
3554
3786
|
calls.push({
|
|
3555
3787
|
seq: Number(call.seq),
|
|
@@ -3631,6 +3863,7 @@ var init_session2 = __esm({
|
|
|
3631
3863
|
"reuseWarm",
|
|
3632
3864
|
"surfaces",
|
|
3633
3865
|
"browserTier",
|
|
3866
|
+
"auth",
|
|
3634
3867
|
"options"
|
|
3635
3868
|
]);
|
|
3636
3869
|
isOpenSessionOptions = (value) => typeof value === "object" && value !== null && Object.keys(value).every((key2) => OPEN_SESSION_OPTION_KEYS.has(key2));
|
|
@@ -3745,11 +3978,50 @@ var init_tasks = __esm({
|
|
|
3745
3978
|
}
|
|
3746
3979
|
});
|
|
3747
3980
|
|
|
3981
|
+
// src/worlds/taskGrades.ts
|
|
3982
|
+
var TASKS2, compact2, TaskGrades;
|
|
3983
|
+
var init_taskGrades = __esm({
|
|
3984
|
+
"src/worlds/taskGrades.ts"() {
|
|
3985
|
+
"use strict";
|
|
3986
|
+
init_worlds();
|
|
3987
|
+
TASKS2 = "/api/public/world-tasks";
|
|
3988
|
+
compact2 = (body) => Object.fromEntries(Object.entries(body).filter(([, v]) => v !== void 0));
|
|
3989
|
+
TaskGrades = class {
|
|
3990
|
+
constructor(options = {}) {
|
|
3991
|
+
this.options = options;
|
|
3992
|
+
}
|
|
3993
|
+
options;
|
|
3994
|
+
try(sessionId, target) {
|
|
3995
|
+
return apiRequest(
|
|
3996
|
+
this.options,
|
|
3997
|
+
"POST",
|
|
3998
|
+
`${TASKS2}/try`,
|
|
3999
|
+
compact2({ sessionId, ...target })
|
|
4000
|
+
);
|
|
4001
|
+
}
|
|
4002
|
+
regrade(taskId, scope = {}) {
|
|
4003
|
+
return apiRequest(
|
|
4004
|
+
this.options,
|
|
4005
|
+
"POST",
|
|
4006
|
+
`${TASKS2}/${encodeURIComponent(taskId)}/regrade`,
|
|
4007
|
+
compact2({ ...scope })
|
|
4008
|
+
);
|
|
4009
|
+
}
|
|
4010
|
+
};
|
|
4011
|
+
}
|
|
4012
|
+
});
|
|
4013
|
+
|
|
3748
4014
|
// src/worlds/surfaceDescriptor.ts
|
|
3749
4015
|
function surfaceDescriptor(s) {
|
|
3750
4016
|
return {
|
|
3751
4017
|
surfaces: surfaceKinds(s),
|
|
3752
|
-
...s.api ? {
|
|
4018
|
+
...s.api ? {
|
|
4019
|
+
api: {
|
|
4020
|
+
url: s.api.url,
|
|
4021
|
+
...s.api.token ? { token: s.api.token } : {},
|
|
4022
|
+
...s.api.auth ? { auth: s.api.auth } : {}
|
|
4023
|
+
}
|
|
4024
|
+
} : {},
|
|
3753
4025
|
...s.ui ? { ui: { url: s.ui.url, entry: uiEntryUrl(s.ui), apiPath: s.ui.apiPath ?? null } } : {},
|
|
3754
4026
|
...s.browser ? {
|
|
3755
4027
|
browser: {
|
|
@@ -3799,8 +4071,7 @@ function fromResponse(answer, options) {
|
|
|
3799
4071
|
sessions2[alias] = new WorldSession(state2.sessionId, state2, options);
|
|
3800
4072
|
worlds[alias] = {
|
|
3801
4073
|
slug: state2.slug,
|
|
3802
|
-
ref: state2.ref
|
|
3803
|
-
private: state2.private ?? null
|
|
4074
|
+
ref: state2.ref
|
|
3804
4075
|
};
|
|
3805
4076
|
}
|
|
3806
4077
|
return new TaskSessions(
|
|
@@ -3875,7 +4146,6 @@ async function attachTask(taskId, options = {}) {
|
|
|
3875
4146
|
{
|
|
3876
4147
|
slug: row.slug ?? "",
|
|
3877
4148
|
ref: null,
|
|
3878
|
-
private: null,
|
|
3879
4149
|
versionId: row.versionId,
|
|
3880
4150
|
sessionId: row.sessionId,
|
|
3881
4151
|
ready: row.ready,
|
|
@@ -3905,7 +4175,7 @@ async function attachManifest(manifest, options = {}) {
|
|
|
3905
4175
|
Object.fromEntries(
|
|
3906
4176
|
Object.entries(manifest.sessions).map(([alias, entry]) => [
|
|
3907
4177
|
alias,
|
|
3908
|
-
{ slug: entry.slug, ref: entry.ref
|
|
4178
|
+
{ slug: entry.slug, ref: entry.ref }
|
|
3909
4179
|
])
|
|
3910
4180
|
)
|
|
3911
4181
|
);
|
|
@@ -3927,7 +4197,6 @@ var init_taskSessions = __esm({
|
|
|
3927
4197
|
manifestSession = (s, state2, world) => ({
|
|
3928
4198
|
slug: world.slug,
|
|
3929
4199
|
ref: world.ref,
|
|
3930
|
-
private: world.private,
|
|
3931
4200
|
versionId: state2.versionId,
|
|
3932
4201
|
sessionId: state2.sessionId,
|
|
3933
4202
|
ready: state2.ready,
|
|
@@ -3984,7 +4253,7 @@ var init_taskSessions = __esm({
|
|
|
3984
4253
|
/** This alias's world as recorded at open/attach — what a `TaskRun`
|
|
3985
4254
|
* filing needs to name, without exposing the whole map. */
|
|
3986
4255
|
worldRef(alias) {
|
|
3987
|
-
return this.worlds[alias] ?? { slug: "", ref: null
|
|
4256
|
+
return this.worlds[alias] ?? { slug: "", ref: null };
|
|
3988
4257
|
}
|
|
3989
4258
|
/** The aliases, in the spec's order. */
|
|
3990
4259
|
get aliases() {
|
|
@@ -4309,16 +4578,12 @@ var init_taskRunOutcome = __esm({
|
|
|
4309
4578
|
evaluationId;
|
|
4310
4579
|
evaluationStatus = null;
|
|
4311
4580
|
started = Date.now();
|
|
4312
|
-
/** The run stopped short of a grade; the first reason stands. */
|
|
4313
4581
|
stopped(error) {
|
|
4314
4582
|
this.runError ??= messageOf(error).slice(0, 2e3);
|
|
4315
4583
|
}
|
|
4316
4584
|
agentRaised(error) {
|
|
4317
4585
|
this.agentError = messageOf(error).slice(0, 2e3);
|
|
4318
4586
|
}
|
|
4319
|
-
/** Every reason the run failed, on one line: the evaluation's
|
|
4320
|
-
* `metrics.error`. A run that never reached a grade has failed whatever
|
|
4321
|
-
* its reasons say. */
|
|
4322
4587
|
failure() {
|
|
4323
4588
|
const reasons = [
|
|
4324
4589
|
this.agentError === null ? null : `agent raised: ${this.agentError}`,
|
|
@@ -4414,6 +4679,7 @@ var init_taskRunOutcome = __esm({
|
|
|
4414
4679
|
])
|
|
4415
4680
|
),
|
|
4416
4681
|
ungraded: this.grade?.ungraded ?? live.aliases,
|
|
4682
|
+
verifierVersion: live.taskVersion,
|
|
4417
4683
|
traced: this.traced,
|
|
4418
4684
|
runDir: this.runDir,
|
|
4419
4685
|
...this.agentError ? { agentError: this.agentError } : {},
|
|
@@ -4791,7 +5057,7 @@ var require_package = __commonJS({
|
|
|
4791
5057
|
"package.json"(exports2, module2) {
|
|
4792
5058
|
module2.exports = {
|
|
4793
5059
|
name: "@withgateway/sdk",
|
|
4794
|
-
version: "0.
|
|
5060
|
+
version: "0.4.0",
|
|
4795
5061
|
description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
|
|
4796
5062
|
main: "./dist/index.js",
|
|
4797
5063
|
module: "./dist/index.mjs",
|
|
@@ -6070,45 +6336,83 @@ var init_setRun = __esm({
|
|
|
6070
6336
|
});
|
|
6071
6337
|
|
|
6072
6338
|
// src/worlds/requestLog.ts
|
|
6073
|
-
|
|
6339
|
+
function worldRequestsUnrecorded(counts) {
|
|
6340
|
+
const parts2 = UNRECORDED.map(([field2, one, many]) => [counted(counts[field2]), one, many]).filter(([count]) => count > 0).map(([count, one, many]) => (count === 1 ? one : many).replace("{n}", String(count)));
|
|
6341
|
+
return parts2.length > 0 ? `Not recorded: ${parts2.join(", ")}` : null;
|
|
6342
|
+
}
|
|
6343
|
+
function counted(value) {
|
|
6344
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : 0;
|
|
6345
|
+
}
|
|
6346
|
+
var UNRECORDED, WorldRequestLog;
|
|
6074
6347
|
var init_requestLog = __esm({
|
|
6075
6348
|
"src/worlds/requestLog.ts"() {
|
|
6076
6349
|
"use strict";
|
|
6350
|
+
init_requestLedger();
|
|
6351
|
+
UNRECORDED = [
|
|
6352
|
+
["lost", "{n} request", "{n} requests"],
|
|
6353
|
+
["shed", "{n} request's headers and bodies", "{n} requests' headers and bodies"],
|
|
6354
|
+
["hostsLost", "the requests {n} lost host held", "the requests {n} lost hosts held"]
|
|
6355
|
+
];
|
|
6077
6356
|
WorldRequestLog = class _WorldRequestLog {
|
|
6078
|
-
constructor(requests) {
|
|
6357
|
+
constructor(requests, notRecorded = null, unrecorded = null) {
|
|
6079
6358
|
this.requests = requests;
|
|
6359
|
+
this.notRecorded = notRecorded;
|
|
6360
|
+
this.unrecorded = unrecorded;
|
|
6080
6361
|
}
|
|
6081
6362
|
requests;
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6363
|
+
notRecorded;
|
|
6364
|
+
unrecorded;
|
|
6365
|
+
/** Every entry the ledger holds for the session, oldest first, and the line for what it did not record;
|
|
6366
|
+
* for a session the World Host did not serve, none, and `notRecorded` says why. */
|
|
6367
|
+
static async load(session) {
|
|
6368
|
+
try {
|
|
6369
|
+
return await _WorldRequestLog.pages(session);
|
|
6370
|
+
} catch (error) {
|
|
6371
|
+
const refused = WorldRequestsNotRecorded.from(error);
|
|
6372
|
+
if (!(refused instanceof WorldRequestsNotRecorded)) throw error;
|
|
6373
|
+
return new _WorldRequestLog([], refused.message);
|
|
6374
|
+
}
|
|
6375
|
+
}
|
|
6376
|
+
static async pages(session) {
|
|
6377
|
+
const requests = [];
|
|
6378
|
+
let cursor;
|
|
6379
|
+
for (; ; ) {
|
|
6380
|
+
const page = await session.requests(cursor ? { cursor } : {});
|
|
6381
|
+
requests.push(...page.requests);
|
|
6382
|
+
if (!page.nextCursor || page.requests.length === 0)
|
|
6383
|
+
return new _WorldRequestLog(requests.reverse(), null, worldRequestsUnrecorded(page));
|
|
6384
|
+
cursor = page.nextCursor;
|
|
6385
|
+
}
|
|
6386
|
+
}
|
|
6387
|
+
/** Each entry in the shape of a ledger line, `kind: "request"`, so one JSONL
|
|
6388
|
+
* file holds both: `args` what was asked, `result` what came back under the
|
|
6389
|
+
* entry's `requestId`. */
|
|
6096
6390
|
asCalls() {
|
|
6097
6391
|
return this.requests.map((r) => ({
|
|
6098
|
-
seq:
|
|
6392
|
+
seq: r.seq,
|
|
6099
6393
|
kind: "request",
|
|
6100
|
-
tool: r.operation
|
|
6394
|
+
tool: r.operation,
|
|
6101
6395
|
args: {
|
|
6102
|
-
method: r.method
|
|
6103
|
-
path: r.path
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6396
|
+
method: r.method,
|
|
6397
|
+
path: r.path,
|
|
6398
|
+
query: r.query,
|
|
6399
|
+
via: r.via,
|
|
6400
|
+
contentType: r.request.contentType,
|
|
6401
|
+
bodyBytes: r.request.bodyBytes,
|
|
6402
|
+
truncated: r.request.truncated
|
|
6403
|
+
},
|
|
6404
|
+
result: {
|
|
6405
|
+
requestId: r.id,
|
|
6406
|
+
status: r.response.status,
|
|
6407
|
+
rows: r.rows,
|
|
6408
|
+
found: r.found,
|
|
6409
|
+
durationMs: r.durationMs,
|
|
6410
|
+
contentType: r.response.contentType,
|
|
6411
|
+
bodyBytes: r.response.bodyBytes,
|
|
6412
|
+
truncated: r.response.truncated
|
|
6108
6413
|
},
|
|
6109
|
-
result: { status: r.status ?? null, rows: r.rows ?? null, found: r.found ?? null },
|
|
6110
6414
|
error: null,
|
|
6111
|
-
completedAt: r.at
|
|
6415
|
+
completedAt: r.at
|
|
6112
6416
|
}));
|
|
6113
6417
|
}
|
|
6114
6418
|
};
|
|
@@ -6799,7 +7103,8 @@ function checkoutIdentity(ref, resolved) {
|
|
|
6799
7103
|
async function pull(slugRef, target, options = {}, opts = {}) {
|
|
6800
7104
|
const at = slugRef.indexOf("@");
|
|
6801
7105
|
const slug = at === -1 ? slugRef : slugRef.slice(0, at);
|
|
6802
|
-
const
|
|
7106
|
+
const asked = at === -1 ? void 0 : slugRef.slice(at + 1);
|
|
7107
|
+
const ref = asked ?? "latest";
|
|
6803
7108
|
const landing = CheckoutTarget.resolve(slug, target, {
|
|
6804
7109
|
cwd: process.cwd(),
|
|
6805
7110
|
force: opts.force ?? false,
|
|
@@ -6807,7 +7112,7 @@ async function pull(slugRef, target, options = {}, opts = {}) {
|
|
|
6807
7112
|
});
|
|
6808
7113
|
const details = await apiRequest(options, "POST", "/api/public/benchmark-containers/resolve-version", {
|
|
6809
7114
|
slug,
|
|
6810
|
-
ref
|
|
7115
|
+
...asked ? { ref: asked } : {}
|
|
6811
7116
|
});
|
|
6812
7117
|
if (!details.downloadUrl) {
|
|
6813
7118
|
throw new Error(`${slug}@${ref} resolved but has no uploaded bundle`);
|
|
@@ -6997,7 +7302,7 @@ async function validateWorld(dir, opts) {
|
|
|
6997
7302
|
options,
|
|
6998
7303
|
"POST",
|
|
6999
7304
|
"/api/public/benchmark-containers/resolve-version",
|
|
7000
|
-
{ slug, ref: branch }
|
|
7305
|
+
{ slug, ...branch === DEFAULT_BRANCH ? {} : { ref: branch } }
|
|
7001
7306
|
);
|
|
7002
7307
|
tipVersionId = tip.versionId ?? null;
|
|
7003
7308
|
} catch {
|
|
@@ -7109,6 +7414,10 @@ function parseSlugRef(slugRef) {
|
|
|
7109
7414
|
if (at === -1) return { slug: slugRef };
|
|
7110
7415
|
return { slug: slugRef.slice(0, at), ref: slugRef.slice(at + 1) };
|
|
7111
7416
|
}
|
|
7417
|
+
function nameGlob(pattern) {
|
|
7418
|
+
const literal = (part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
7419
|
+
return new RegExp(`^${pattern.split("*").map(literal).join(".*")}$`);
|
|
7420
|
+
}
|
|
7112
7421
|
function rebaseConflicts(error) {
|
|
7113
7422
|
if (!(error instanceof ApiError) || error.status !== 409) return null;
|
|
7114
7423
|
let body;
|
|
@@ -7126,7 +7435,8 @@ function isConflictPath(value) {
|
|
|
7126
7435
|
return typeof entry?.path === "string" && typeof entry.reason === "string";
|
|
7127
7436
|
}
|
|
7128
7437
|
function uncommittedPaths(error) {
|
|
7129
|
-
if (!(error instanceof ApiError) || error.status !== 409 || error.code !== "sandbox_uncommitted")
|
|
7438
|
+
if (!(error instanceof ApiError) || error.status !== 409 || error.code !== "sandbox_uncommitted")
|
|
7439
|
+
return null;
|
|
7130
7440
|
let body;
|
|
7131
7441
|
try {
|
|
7132
7442
|
body = JSON.parse(error.text);
|
|
@@ -7137,6 +7447,53 @@ function uncommittedPaths(error) {
|
|
|
7137
7447
|
if (!Array.isArray(uncommitted)) return null;
|
|
7138
7448
|
return uncommitted.filter((p) => typeof p === "string");
|
|
7139
7449
|
}
|
|
7450
|
+
function carriedWarnings(error) {
|
|
7451
|
+
const kept = typeof error === "object" && error !== null ? carried.get(error) ?? [] : [];
|
|
7452
|
+
const shown = error instanceof Error ? error.message : "";
|
|
7453
|
+
return unique([...kept, ...bodyWarnings(error)]).filter((warning) => !shown.includes(warning));
|
|
7454
|
+
}
|
|
7455
|
+
function carrying(error, warnings) {
|
|
7456
|
+
if (warnings.length > 0 && typeof error === "object" && error !== null)
|
|
7457
|
+
carried.set(error, unique([...carried.get(error) ?? [], ...warnings]));
|
|
7458
|
+
return error;
|
|
7459
|
+
}
|
|
7460
|
+
function unique(warnings) {
|
|
7461
|
+
return [...new Set(warnings)];
|
|
7462
|
+
}
|
|
7463
|
+
function bodyWarnings(error) {
|
|
7464
|
+
if (!(error instanceof ApiError)) return [];
|
|
7465
|
+
let body;
|
|
7466
|
+
try {
|
|
7467
|
+
body = JSON.parse(error.text);
|
|
7468
|
+
} catch {
|
|
7469
|
+
return [];
|
|
7470
|
+
}
|
|
7471
|
+
const warnings = body?.warnings;
|
|
7472
|
+
if (!Array.isArray(warnings)) return [];
|
|
7473
|
+
return warnings.filter((w) => typeof w === "string");
|
|
7474
|
+
}
|
|
7475
|
+
function deferredWarnings(error) {
|
|
7476
|
+
if (!(error instanceof ApiError) || error.status !== 409 || error.code !== "sandbox_exec_deferred") return null;
|
|
7477
|
+
return bodyWarnings(error);
|
|
7478
|
+
}
|
|
7479
|
+
function rowsRefusal(error) {
|
|
7480
|
+
if (!(error instanceof ApiError) || error.status !== 400 || error.code !== "rows_refused") return null;
|
|
7481
|
+
let body;
|
|
7482
|
+
try {
|
|
7483
|
+
body = JSON.parse(error.text);
|
|
7484
|
+
} catch {
|
|
7485
|
+
return null;
|
|
7486
|
+
}
|
|
7487
|
+
const { message, batchId, refusalCount, refusals, reportUrl } = body;
|
|
7488
|
+
if (typeof batchId !== "string" || typeof refusalCount !== "number" || !Array.isArray(refusals)) return null;
|
|
7489
|
+
return {
|
|
7490
|
+
message: typeof message === "string" ? message : "",
|
|
7491
|
+
batchId,
|
|
7492
|
+
refusalCount,
|
|
7493
|
+
refusals: refusals.filter((r) => typeof r === "object" && r !== null),
|
|
7494
|
+
reportUrl: typeof reportUrl === "string" ? reportUrl : null
|
|
7495
|
+
};
|
|
7496
|
+
}
|
|
7140
7497
|
function listQuery(filter) {
|
|
7141
7498
|
const params = new URLSearchParams();
|
|
7142
7499
|
if (filter.status) params.set("status", filter.status);
|
|
@@ -7145,15 +7502,52 @@ function listQuery(filter) {
|
|
|
7145
7502
|
const qs3 = params.toString();
|
|
7146
7503
|
return qs3 ? `?${qs3}` : "";
|
|
7147
7504
|
}
|
|
7148
|
-
var isSandboxImportPending, sid, SANDBOXES, SANDBOX_REQUEST_TIMEOUT_MS, WorldSandboxClient;
|
|
7505
|
+
var import_node_crypto7, isSandboxCommitPending, isSandboxImportPending, sid, SANDBOXES, SANDBOX_REQUEST_TIMEOUT_MS, SANDBOX_WRITE_CHUNK_BYTES, SANDBOX_FILE_MAX_BYTES, SANDBOX_WRITE_SKIPPED, WriteTreeFilter, SANDBOX_EXEC_WAIT_MS, SANDBOX_EXEC_TIMEOUT_MAX_S, SANDBOX_EXEC_REPORT_MARGIN_MS, SANDBOX_EXEC_START_ATTEMPTS, carried, WorldSandboxClient;
|
|
7149
7506
|
var init_sandbox = __esm({
|
|
7150
7507
|
"src/worlds/sandbox.ts"() {
|
|
7151
7508
|
"use strict";
|
|
7509
|
+
import_node_crypto7 = require("crypto");
|
|
7152
7510
|
init_worlds();
|
|
7511
|
+
isSandboxCommitPending = (answer) => !("versionId" in answer);
|
|
7153
7512
|
isSandboxImportPending = (answer) => !("versionId" in answer);
|
|
7154
7513
|
sid = encodeURIComponent;
|
|
7155
7514
|
SANDBOXES = "/api/public/benchmark-containers/sandboxes";
|
|
7156
|
-
SANDBOX_REQUEST_TIMEOUT_MS =
|
|
7515
|
+
SANDBOX_REQUEST_TIMEOUT_MS = 29e4;
|
|
7516
|
+
SANDBOX_WRITE_CHUNK_BYTES = 4 * 1024 * 1024;
|
|
7517
|
+
SANDBOX_FILE_MAX_BYTES = 256 * 1024 * 1024;
|
|
7518
|
+
SANDBOX_WRITE_SKIPPED = [
|
|
7519
|
+
".git/",
|
|
7520
|
+
".gateway/",
|
|
7521
|
+
"scratch/",
|
|
7522
|
+
".scratch/",
|
|
7523
|
+
"__pycache__/",
|
|
7524
|
+
"*.pyc",
|
|
7525
|
+
".pytest_cache/",
|
|
7526
|
+
".mypy_cache/",
|
|
7527
|
+
".ruff_cache/",
|
|
7528
|
+
"node_modules/",
|
|
7529
|
+
".venv/",
|
|
7530
|
+
"venv/",
|
|
7531
|
+
".DS_Store",
|
|
7532
|
+
"*.swp"
|
|
7533
|
+
];
|
|
7534
|
+
WriteTreeFilter = class {
|
|
7535
|
+
directories = new Set(
|
|
7536
|
+
SANDBOX_WRITE_SKIPPED.filter((pattern) => pattern.endsWith("/")).map((pattern) => pattern.slice(0, -1))
|
|
7537
|
+
);
|
|
7538
|
+
files = SANDBOX_WRITE_SKIPPED.filter((pattern) => !pattern.endsWith("/")).map(nameGlob);
|
|
7539
|
+
skipsDirectory(name) {
|
|
7540
|
+
return this.directories.has(name);
|
|
7541
|
+
}
|
|
7542
|
+
skipsFile(name) {
|
|
7543
|
+
return this.files.some((glob) => glob.test(name));
|
|
7544
|
+
}
|
|
7545
|
+
};
|
|
7546
|
+
SANDBOX_EXEC_WAIT_MS = 4e4;
|
|
7547
|
+
SANDBOX_EXEC_TIMEOUT_MAX_S = 600;
|
|
7548
|
+
SANDBOX_EXEC_REPORT_MARGIN_MS = 35e3;
|
|
7549
|
+
SANDBOX_EXEC_START_ATTEMPTS = 3;
|
|
7550
|
+
carried = /* @__PURE__ */ new WeakMap();
|
|
7157
7551
|
WorldSandboxClient = class {
|
|
7158
7552
|
constructor(options = {}) {
|
|
7159
7553
|
this.options = options;
|
|
@@ -7178,7 +7572,10 @@ var init_sandbox = __esm({
|
|
|
7178
7572
|
}
|
|
7179
7573
|
/** The project's sandboxes, newest first — how an agent finds one it left open. */
|
|
7180
7574
|
async list(filter = {}) {
|
|
7181
|
-
const res = await this.request(
|
|
7575
|
+
const res = await this.request(
|
|
7576
|
+
"GET",
|
|
7577
|
+
`${SANDBOXES}${listQuery(filter)}`
|
|
7578
|
+
);
|
|
7182
7579
|
return res.sandboxes;
|
|
7183
7580
|
}
|
|
7184
7581
|
async read(sandboxId, filePath) {
|
|
@@ -7186,16 +7583,72 @@ var init_sandbox = __esm({
|
|
|
7186
7583
|
"GET",
|
|
7187
7584
|
`${SANDBOXES}/${sid(sandboxId)}/file?path=${encodeURIComponent(filePath)}`
|
|
7188
7585
|
);
|
|
7189
|
-
return {
|
|
7586
|
+
return {
|
|
7587
|
+
path: res.path,
|
|
7588
|
+
size: res.size,
|
|
7589
|
+
bytes: Buffer.from(res.contentBase64, "base64")
|
|
7590
|
+
};
|
|
7190
7591
|
}
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7592
|
+
/** A file past one chunk goes up in parts under one upload id; the platform lands it whole once the last part's
|
|
7593
|
+
* size and SHA-256 check out. */
|
|
7594
|
+
async write(sandboxId, filePath, bytes) {
|
|
7595
|
+
if (bytes.length <= SANDBOX_WRITE_CHUNK_BYTES)
|
|
7596
|
+
return this.putFile(sandboxId, { path: filePath, contentBase64: bytes.toString("base64") });
|
|
7597
|
+
const whole = { upload: (0, import_node_crypto7.randomUUID)(), size: bytes.length, sha256: (0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex") };
|
|
7598
|
+
let answer = { path: filePath, received: 0 };
|
|
7599
|
+
for (let offset = 0; offset < bytes.length; offset += SANDBOX_WRITE_CHUNK_BYTES) {
|
|
7600
|
+
const part = bytes.subarray(offset, offset + SANDBOX_WRITE_CHUNK_BYTES);
|
|
7601
|
+
answer = await this.putFile(sandboxId, {
|
|
7602
|
+
path: filePath,
|
|
7603
|
+
contentBase64: part.toString("base64"),
|
|
7604
|
+
...whole,
|
|
7605
|
+
offset,
|
|
7606
|
+
last: offset + part.length === bytes.length
|
|
7607
|
+
});
|
|
7608
|
+
}
|
|
7609
|
+
return answer;
|
|
7610
|
+
}
|
|
7611
|
+
putFile(sandboxId, body) {
|
|
7612
|
+
return this.request("PUT", `${SANDBOXES}/${sid(sandboxId)}/file`, body);
|
|
7196
7613
|
}
|
|
7197
|
-
|
|
7198
|
-
|
|
7614
|
+
/** Runs as a job on the platform: a command that outlasts one request is waited on again until its result. */
|
|
7615
|
+
async exec(sandboxId, input) {
|
|
7616
|
+
const budgetMs = (input.timeoutMs ?? SANDBOX_EXEC_TIMEOUT_MAX_S * 1e3) + SANDBOX_EXEC_REPORT_MARGIN_MS;
|
|
7617
|
+
let answer = await this.startExec(sandboxId, { ...input, waitMs: SANDBOX_EXEC_WAIT_MS });
|
|
7618
|
+
const deadline = Date.now() + budgetMs;
|
|
7619
|
+
const warnings = [...answer.warnings ?? []];
|
|
7620
|
+
try {
|
|
7621
|
+
while ("state" in answer) {
|
|
7622
|
+
if (Date.now() >= deadline)
|
|
7623
|
+
throw new Error(
|
|
7624
|
+
`exec ${answer.execId} in sandbox ${sandboxId} has not reported back within ${budgetMs / 1e3} s, past its timeout: the sandbox may have restarted. Check the sandbox's status, then run the command again.`
|
|
7625
|
+
);
|
|
7626
|
+
answer = await this.execStep(sandboxId, { execId: answer.execId, waitMs: SANDBOX_EXEC_WAIT_MS });
|
|
7627
|
+
warnings.push(...answer.warnings ?? []);
|
|
7628
|
+
}
|
|
7629
|
+
} catch (error) {
|
|
7630
|
+
throw carrying(error, warnings);
|
|
7631
|
+
}
|
|
7632
|
+
return { ...answer, warnings };
|
|
7633
|
+
}
|
|
7634
|
+
// A deferred start ran nothing (the platform was still getting the sandbox ready), so starting again is safe. What
|
|
7635
|
+
// getting ready found rides on the deferral alone (no later call reports it), so it is kept for the answer, or for
|
|
7636
|
+
// the error when a later attempt fails.
|
|
7637
|
+
async startExec(sandboxId, body) {
|
|
7638
|
+
const kept = [];
|
|
7639
|
+
for (let attempt = 1; ; attempt += 1) {
|
|
7640
|
+
try {
|
|
7641
|
+
const answer = await this.execStep(sandboxId, body);
|
|
7642
|
+
return { ...answer, warnings: unique([...kept, ...answer.warnings ?? []]) };
|
|
7643
|
+
} catch (error) {
|
|
7644
|
+
const warnings = deferredWarnings(error);
|
|
7645
|
+
if (warnings === null || attempt === SANDBOX_EXEC_START_ATTEMPTS) throw carrying(error, kept);
|
|
7646
|
+
kept.push(...warnings);
|
|
7647
|
+
}
|
|
7648
|
+
}
|
|
7649
|
+
}
|
|
7650
|
+
execStep(sandboxId, body) {
|
|
7651
|
+
return this.request("POST", `${SANDBOXES}/${sid(sandboxId)}/exec`, body);
|
|
7199
7652
|
}
|
|
7200
7653
|
check(sandboxId) {
|
|
7201
7654
|
return this.request("POST", `${SANDBOXES}/${sid(sandboxId)}/check`, {});
|
|
@@ -7203,7 +7656,11 @@ var init_sandbox = __esm({
|
|
|
7203
7656
|
/** With `rebase`, a moved base is replayed onto; a 409 then names the conflicting paths (`rebaseConflicts`). */
|
|
7204
7657
|
commit(sandboxId, input) {
|
|
7205
7658
|
const { rebase, ...rest } = input;
|
|
7206
|
-
return this.request(
|
|
7659
|
+
return this.request(
|
|
7660
|
+
"POST",
|
|
7661
|
+
`${SANDBOXES}/${sid(sandboxId)}/commit`,
|
|
7662
|
+
rebase ? { ...rest, rebase: true } : rest
|
|
7663
|
+
);
|
|
7207
7664
|
}
|
|
7208
7665
|
/**
|
|
7209
7666
|
* A rows file already in the sandbox tree into the PLATFORM world the
|
|
@@ -7216,7 +7673,11 @@ var init_sandbox = __esm({
|
|
|
7216
7673
|
}
|
|
7217
7674
|
/** Uncommitted work is a 409 (`uncommittedPaths`) unless `force` discards it. */
|
|
7218
7675
|
close(sandboxId, opts = {}) {
|
|
7219
|
-
return this.request(
|
|
7676
|
+
return this.request(
|
|
7677
|
+
"DELETE",
|
|
7678
|
+
`${SANDBOXES}/${sid(sandboxId)}`,
|
|
7679
|
+
opts.force ? { force: true } : void 0
|
|
7680
|
+
);
|
|
7220
7681
|
}
|
|
7221
7682
|
};
|
|
7222
7683
|
}
|
|
@@ -7552,11 +8013,11 @@ function applyTransforms(value, chain) {
|
|
|
7552
8013
|
for (const step of steps) out = step(out);
|
|
7553
8014
|
return out;
|
|
7554
8015
|
}
|
|
7555
|
-
var
|
|
8016
|
+
var import_node_crypto8, WHITESPACE, WHITESPACE_EDGES, WHITESPACE_RUN, NOT_DIGIT, STRIP_PREFIX, trim, emailLocalPart, emailDomain, stripPrefix, hex, SIMPLE, TRANSFORMS, text;
|
|
7556
8017
|
var init_transforms = __esm({
|
|
7557
8018
|
"src/worlds/transforms.ts"() {
|
|
7558
8019
|
"use strict";
|
|
7559
|
-
|
|
8020
|
+
import_node_crypto8 = require("crypto");
|
|
7560
8021
|
init_json();
|
|
7561
8022
|
WHITESPACE = " \n\r\f\v";
|
|
7562
8023
|
WHITESPACE_EDGES = new RegExp(`^[${WHITESPACE}]+|[${WHITESPACE}]+$`, "g");
|
|
@@ -7573,7 +8034,7 @@ var init_transforms = __esm({
|
|
|
7573
8034
|
return at === -1 ? "" : value.slice(at + 1).toLowerCase();
|
|
7574
8035
|
};
|
|
7575
8036
|
stripPrefix = (prefix) => (value) => value.startsWith(prefix) ? value.slice(prefix.length) : value;
|
|
7576
|
-
hex = (algorithm, value) => (0,
|
|
8037
|
+
hex = (algorithm, value) => (0, import_node_crypto8.createHash)(algorithm).update(value, "utf8").digest("hex");
|
|
7577
8038
|
SIMPLE = {
|
|
7578
8039
|
lower: (value) => value.toLowerCase(),
|
|
7579
8040
|
upper: (value) => value.toUpperCase(),
|
|
@@ -7605,7 +8066,7 @@ function pyText(value) {
|
|
|
7605
8066
|
return pyFloatRepr(value);
|
|
7606
8067
|
}
|
|
7607
8068
|
function hashForm(slug, plaintext) {
|
|
7608
|
-
return "sha256:" + (0,
|
|
8069
|
+
return "sha256:" + (0, import_node_crypto9.createHash)("sha256").update(`${slug}:${pyText(plaintext)}`, "utf8").digest("hex");
|
|
7609
8070
|
}
|
|
7610
8071
|
function preserveForm(slug, plaintext) {
|
|
7611
8072
|
const kind = typeof plaintext === "string" ? "str" : isInt(plaintext) ? "int" : "float";
|
|
@@ -7614,12 +8075,12 @@ function preserveForm(slug, plaintext) {
|
|
|
7614
8075
|
}
|
|
7615
8076
|
function shapeText(slug, text2, kind) {
|
|
7616
8077
|
const seed = Buffer.from(`${slug}:${text2}`, "utf8");
|
|
7617
|
-
let digest = (0,
|
|
8078
|
+
let digest = (0, import_node_crypto9.createHash)("sha256").update(seed).digest();
|
|
7618
8079
|
let cursor = 0;
|
|
7619
8080
|
const out = [];
|
|
7620
8081
|
for (const char of text2) {
|
|
7621
8082
|
if (cursor === digest.length) {
|
|
7622
|
-
digest = (0,
|
|
8083
|
+
digest = (0, import_node_crypto9.createHash)("sha256").update(Buffer.concat([digest, seed])).digest();
|
|
7623
8084
|
cursor = 0;
|
|
7624
8085
|
}
|
|
7625
8086
|
const byte = digest[cursor];
|
|
@@ -7656,11 +8117,11 @@ function storedForms(world, field2, plaintext, transform) {
|
|
|
7656
8117
|
if (policy !== null) return [roundForm(plaintext, world.redact.round[field2])];
|
|
7657
8118
|
return [plaintext];
|
|
7658
8119
|
}
|
|
7659
|
-
var
|
|
8120
|
+
var import_node_crypto9, isInt;
|
|
7660
8121
|
var init_redaction = __esm({
|
|
7661
8122
|
"src/worlds/redaction.ts"() {
|
|
7662
8123
|
"use strict";
|
|
7663
|
-
|
|
8124
|
+
import_node_crypto9 = require("crypto");
|
|
7664
8125
|
init_json();
|
|
7665
8126
|
init_transforms();
|
|
7666
8127
|
isInt = (value) => typeof value === "number" && Number.isInteger(value);
|
|
@@ -7773,7 +8234,7 @@ var init_config = __esm({
|
|
|
7773
8234
|
init_transport();
|
|
7774
8235
|
ApiError2 = class extends CliError {
|
|
7775
8236
|
constructor(status, method, route, text2) {
|
|
7776
|
-
const body = parseErrorBody(text2);
|
|
8237
|
+
const body = parseErrorBody(text2, status);
|
|
7777
8238
|
super(`${method} ${route} -> ${status}: ${body.detail}`, 1);
|
|
7778
8239
|
this.status = status;
|
|
7779
8240
|
this.method = method;
|
|
@@ -7791,6 +8252,14 @@ var init_config = __esm({
|
|
|
7791
8252
|
});
|
|
7792
8253
|
|
|
7793
8254
|
// src/cli/runtime/local.ts
|
|
8255
|
+
function forwardedEnv() {
|
|
8256
|
+
return Object.fromEntries(
|
|
8257
|
+
FORWARDED_ENV.flatMap((name) => {
|
|
8258
|
+
const value = process.env[name];
|
|
8259
|
+
return value ? [[name, value]] : [];
|
|
8260
|
+
})
|
|
8261
|
+
);
|
|
8262
|
+
}
|
|
7794
8263
|
function tailOf(output) {
|
|
7795
8264
|
return output.length > DIAGNOSTIC_TAIL ? `\u2026${output.slice(-DIAGNOSTIC_TAIL)}` : output;
|
|
7796
8265
|
}
|
|
@@ -7908,7 +8377,7 @@ async function localBridge(request, local, opts = {}) {
|
|
|
7908
8377
|
PATH: process.env.PATH ?? "",
|
|
7909
8378
|
HOME: process.env.HOME ?? "",
|
|
7910
8379
|
TMPDIR: process.env.TMPDIR ?? "",
|
|
7911
|
-
...
|
|
8380
|
+
...forwardedEnv(),
|
|
7912
8381
|
GATEWAY_RUNTIME_EXECUTE: "1"
|
|
7913
8382
|
}
|
|
7914
8383
|
}
|
|
@@ -7954,7 +8423,7 @@ async function localBridge(request, local, opts = {}) {
|
|
|
7954
8423
|
child.stdin.end(input);
|
|
7955
8424
|
});
|
|
7956
8425
|
}
|
|
7957
|
-
var import_node_child_process2, fs7, net, path8, MIN_PYTHON, MIN_PYTHON_LABEL, DIAGNOSTIC_TAIL, BRIDGE_BOOTSTRAP, pythonCache, pythonProbes, PYTHON_CANDIDATES, UV_FIND;
|
|
8426
|
+
var import_node_child_process2, fs7, net, path8, MIN_PYTHON, MIN_PYTHON_LABEL, DIAGNOSTIC_TAIL, FORWARDED_ENV, BRIDGE_BOOTSTRAP, pythonCache, pythonProbes, PYTHON_CANDIDATES, UV_FIND;
|
|
7958
8427
|
var init_local = __esm({
|
|
7959
8428
|
"src/cli/runtime/local.ts"() {
|
|
7960
8429
|
"use strict";
|
|
@@ -7967,6 +8436,7 @@ var init_local = __esm({
|
|
|
7967
8436
|
MIN_PYTHON = [3, 12];
|
|
7968
8437
|
MIN_PYTHON_LABEL = MIN_PYTHON.join(".");
|
|
7969
8438
|
DIAGNOSTIC_TAIL = 600;
|
|
8439
|
+
FORWARDED_ENV = ["VIRTUAL_ENV", "GATEWAY_SNAPSHOT_STORE"];
|
|
7970
8440
|
BRIDGE_BOOTSTRAP = `import sys,runpy,types,os
|
|
7971
8441
|
root=sys.argv[1]
|
|
7972
8442
|
package=types.ModuleType('gatewaysdk')
|
|
@@ -8602,11 +9072,15 @@ function isSettled(status) {
|
|
|
8602
9072
|
if (status.state !== "applied") return true;
|
|
8603
9073
|
return status.dryRun === true || status.publish !== "now" || !status.snapshotId;
|
|
8604
9074
|
}
|
|
9075
|
+
function worldDataPollMs() {
|
|
9076
|
+
const raw = Number(process.env.GATEWAY_WORLD_DATA_POLL_MS ?? 1e3);
|
|
9077
|
+
return Number.isFinite(raw) && raw >= 0 ? raw : 1e3;
|
|
9078
|
+
}
|
|
8605
9079
|
function uploadHeadersFor(gz) {
|
|
8606
9080
|
return {
|
|
8607
9081
|
"content-type": "application/gzip",
|
|
8608
9082
|
"content-length": String(gz.length),
|
|
8609
|
-
"x-amz-checksum-sha256": (0,
|
|
9083
|
+
"x-amz-checksum-sha256": (0, import_node_crypto10.createHash)("sha256").update(gz).digest("base64")
|
|
8610
9084
|
};
|
|
8611
9085
|
}
|
|
8612
9086
|
async function forEachLimited(items, limit, fn) {
|
|
@@ -8644,6 +9118,8 @@ async function waitForBatch(client2, batchId, opts = {}) {
|
|
|
8644
9118
|
last = phase;
|
|
8645
9119
|
}
|
|
8646
9120
|
if (isSettled(status)) return status;
|
|
9121
|
+
if (opts.deadlineMs !== void 0 && (opts.now ?? Date.now)() >= opts.deadlineMs)
|
|
9122
|
+
return status;
|
|
8647
9123
|
await sleep5(delay);
|
|
8648
9124
|
delay = Math.min(1e4, Math.round(delay * 1.5));
|
|
8649
9125
|
}
|
|
@@ -8652,11 +9128,11 @@ function phaseLine(status) {
|
|
|
8652
9128
|
const phase = status.progress?.phase;
|
|
8653
9129
|
return phase ? `${status.state} (${phase})` : status.state;
|
|
8654
9130
|
}
|
|
8655
|
-
var
|
|
9131
|
+
var import_node_crypto10, fs11, TERMINAL_STATES, sleepMs, WorldDataApi;
|
|
8656
9132
|
var init_batches = __esm({
|
|
8657
9133
|
"src/cli/platform/worldData/batches.ts"() {
|
|
8658
9134
|
"use strict";
|
|
8659
|
-
|
|
9135
|
+
import_node_crypto10 = require("crypto");
|
|
8660
9136
|
fs11 = __toESM(require("fs"));
|
|
8661
9137
|
init_config();
|
|
8662
9138
|
init_router();
|
|
@@ -8695,11 +9171,6 @@ var init_batches = __esm({
|
|
|
8695
9171
|
}
|
|
8696
9172
|
);
|
|
8697
9173
|
}
|
|
8698
|
-
/**
|
|
8699
|
-
* Stage a project-drive rows file as one chunk, on the platform: the server
|
|
8700
|
-
* streams it out of drive storage into chunk storage and answers with the
|
|
8701
|
-
* digest and gzipped size it derived. No bytes pass through this process.
|
|
8702
|
-
*/
|
|
8703
9174
|
async stageDrive(batchId, chunk) {
|
|
8704
9175
|
const staged = await api(this.creds, "POST", `${this.base}/batches/${batchId}/chunks`, {
|
|
8705
9176
|
ordinal: chunk.ordinal,
|
|
@@ -8753,11 +9224,6 @@ var init_batches = __esm({
|
|
|
8753
9224
|
message ? { message } : {}
|
|
8754
9225
|
);
|
|
8755
9226
|
}
|
|
8756
|
-
/**
|
|
8757
|
-
* PUT the gzipped chunk to its presigned URL with exactly the headers the
|
|
8758
|
-
* URL was signed for (the platform's `uploadHeaders`; the same three when it
|
|
8759
|
-
* sends none), with backoff on a dropped connection or a 5xx.
|
|
8760
|
-
*/
|
|
8761
9227
|
async put(uploadUrl, gz, signed) {
|
|
8762
9228
|
const headers = signed ?? uploadHeadersFor(gz);
|
|
8763
9229
|
const delays = [500, 1500, 4e3];
|
|
@@ -8784,7 +9250,6 @@ var init_batches = __esm({
|
|
|
8784
9250
|
await this.sleep(delays[attempt]);
|
|
8785
9251
|
}
|
|
8786
9252
|
}
|
|
8787
|
-
/** Register, upload unless the server already holds the content, confirm. */
|
|
8788
9253
|
async upload(batchId, chunk) {
|
|
8789
9254
|
const registered = await this.register(batchId, chunk);
|
|
8790
9255
|
if (!registered.uploaded) {
|
|
@@ -8850,12 +9315,12 @@ function finishChunk(ordinal, raw, rows, entity, firstRow = 0) {
|
|
|
8850
9315
|
const gz = gzipDeterministic(raw, { name: chunkName(ordinal) });
|
|
8851
9316
|
return {
|
|
8852
9317
|
ordinal,
|
|
8853
|
-
digest: (0,
|
|
9318
|
+
digest: (0, import_node_crypto11.createHash)("sha256").update(gz).digest("hex"),
|
|
8854
9319
|
bytes: gz.length,
|
|
8855
9320
|
rows,
|
|
8856
9321
|
entity,
|
|
8857
9322
|
rawBytes: raw.length,
|
|
8858
|
-
contentSha256: (0,
|
|
9323
|
+
contentSha256: (0, import_node_crypto11.createHash)("sha256").update(raw).digest("hex"),
|
|
8859
9324
|
firstRow,
|
|
8860
9325
|
gz
|
|
8861
9326
|
};
|
|
@@ -8895,11 +9360,11 @@ function crc32(data) {
|
|
|
8895
9360
|
crc = table[(crc ^ data[i]) & 255] ^ crc >>> 8;
|
|
8896
9361
|
return (crc ^ 4294967295) >>> 0;
|
|
8897
9362
|
}
|
|
8898
|
-
var
|
|
9363
|
+
var import_node_crypto11, import_node_zlib3, DEFAULT_CHUNK_BYTES, GZIP_LEVEL, chunkName, table;
|
|
8899
9364
|
var init_chunker = __esm({
|
|
8900
9365
|
"src/cli/platform/worldData/chunker.ts"() {
|
|
8901
9366
|
"use strict";
|
|
8902
|
-
|
|
9367
|
+
import_node_crypto11 = require("crypto");
|
|
8903
9368
|
import_node_zlib3 = require("zlib");
|
|
8904
9369
|
init_json();
|
|
8905
9370
|
DEFAULT_CHUNK_BYTES = 64 * 1024 * 1024;
|
|
@@ -8925,22 +9390,33 @@ async function pushRows(creds, slug, rows, opts = {}) {
|
|
|
8925
9390
|
publish: opts.publish ?? "now",
|
|
8926
9391
|
...opts.message ? { message: opts.message } : {}
|
|
8927
9392
|
});
|
|
8928
|
-
if (!opened.batchId)
|
|
9393
|
+
if (!opened.batchId)
|
|
9394
|
+
throw new Error("the platform opened no batch (no batchId in the answer)");
|
|
8929
9395
|
const tagged = (async function* () {
|
|
8930
9396
|
for (const [entity, listed] of Object.entries(rows))
|
|
8931
9397
|
for (let index2 = 0; index2 < listed.length; index2++)
|
|
8932
|
-
yield {
|
|
9398
|
+
yield {
|
|
9399
|
+
entity,
|
|
9400
|
+
row: parseJson(JSON.stringify(listed[index2])),
|
|
9401
|
+
where: `${entity}[${index2}]`
|
|
9402
|
+
};
|
|
8933
9403
|
})();
|
|
8934
|
-
const chunks = buildChunks(tagged, {
|
|
8935
|
-
|
|
8936
|
-
|
|
9404
|
+
const chunks = buildChunks(tagged, {
|
|
9405
|
+
chunkBytes: opts.chunkBytes ?? DEFAULT_CHUNK_BYTES,
|
|
9406
|
+
chunkRows: null,
|
|
9407
|
+
entity: null
|
|
8937
9408
|
});
|
|
9409
|
+
await forEachLimited(
|
|
9410
|
+
chunks,
|
|
9411
|
+
Math.max(1, opts.parallel ?? 4),
|
|
9412
|
+
async (chunk) => {
|
|
9413
|
+
await client2.upload(opened.batchId, chunk);
|
|
9414
|
+
}
|
|
9415
|
+
);
|
|
8938
9416
|
await client2.complete(opened.batchId);
|
|
8939
|
-
return waitForBatch(client2, opened.batchId, {
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
const raw = Number(process.env.GATEWAY_WORLD_DATA_POLL_MS ?? 1e3);
|
|
8943
|
-
return Number.isFinite(raw) && raw >= 0 ? raw : 1e3;
|
|
9417
|
+
return waitForBatch(client2, opened.batchId, {
|
|
9418
|
+
initialDelayMs: worldDataPollMs()
|
|
9419
|
+
});
|
|
8944
9420
|
}
|
|
8945
9421
|
var init_push = __esm({
|
|
8946
9422
|
"src/cli/platform/worldData/push.ts"() {
|
|
@@ -9189,12 +9665,12 @@ var init_ingest = __esm({
|
|
|
9189
9665
|
});
|
|
9190
9666
|
|
|
9191
9667
|
// src/worlds/editSessions.ts
|
|
9192
|
-
var
|
|
9668
|
+
var WORLDS2, WorldEditClient, TASK_EDITS, TaskEditClient;
|
|
9193
9669
|
var init_editSessions = __esm({
|
|
9194
9670
|
"src/worlds/editSessions.ts"() {
|
|
9195
9671
|
"use strict";
|
|
9196
9672
|
init_worlds();
|
|
9197
|
-
|
|
9673
|
+
WORLDS2 = "/api/public/worlds";
|
|
9198
9674
|
WorldEditClient = class {
|
|
9199
9675
|
constructor(options = {}) {
|
|
9200
9676
|
this.options = options;
|
|
@@ -9206,19 +9682,19 @@ var init_editSessions = __esm({
|
|
|
9206
9682
|
if (query.status) qs3.set("status", query.status);
|
|
9207
9683
|
if (query.limit !== void 0) qs3.set("limit", String(query.limit));
|
|
9208
9684
|
const suffix = qs3.size ? `?${qs3.toString()}` : "";
|
|
9209
|
-
return apiRequest(this.options, "GET", `${
|
|
9685
|
+
return apiRequest(this.options, "GET", `${WORLDS2}/${encodeURIComponent(slug)}/edits${suffix}`);
|
|
9210
9686
|
}
|
|
9211
9687
|
/** Seal a session into a version on main (the credential's current one when `sessionId` is omitted). */
|
|
9212
9688
|
close(slug, input = {}) {
|
|
9213
|
-
return apiRequest(this.options, "POST", `${
|
|
9689
|
+
return apiRequest(this.options, "POST", `${WORLDS2}/${encodeURIComponent(slug)}/edits/close`, input);
|
|
9214
9690
|
}
|
|
9215
9691
|
/** Drop the session's private branch without making a version. */
|
|
9216
9692
|
discard(slug, input = {}) {
|
|
9217
|
-
return apiRequest(this.options, "POST", `${
|
|
9693
|
+
return apiRequest(this.options, "POST", `${WORLDS2}/${encodeURIComponent(slug)}/edits/discard`, input);
|
|
9218
9694
|
}
|
|
9219
9695
|
/** Undo a sealed session (source and data) as a new sealed session. */
|
|
9220
9696
|
rollback(slug, input) {
|
|
9221
|
-
return apiRequest(this.options, "POST", `${
|
|
9697
|
+
return apiRequest(this.options, "POST", `${WORLDS2}/${encodeURIComponent(slug)}/edits/rollback`, input);
|
|
9222
9698
|
}
|
|
9223
9699
|
};
|
|
9224
9700
|
TASK_EDITS = "/api/public/world-task-edits";
|
|
@@ -9372,15 +9848,27 @@ __export(worlds_exports, {
|
|
|
9372
9848
|
NativeComputer: () => NativeComputer,
|
|
9373
9849
|
OpenAIComputer: () => OpenAIComputer,
|
|
9374
9850
|
OpenAIPreviewComputer: () => OpenAIPreviewComputer,
|
|
9851
|
+
PLATFORM_SESSION_HEADER: () => PLATFORM_SESSION_HEADER,
|
|
9375
9852
|
PLATFORM_TIMEOUT_DEFAULT_MS: () => PLATFORM_TIMEOUT_DEFAULT_MS,
|
|
9376
9853
|
PLATFORM_TIMEOUT_ENV: () => PLATFORM_TIMEOUT_ENV,
|
|
9377
9854
|
PendingSafetyChecks: () => PendingSafetyChecks,
|
|
9378
9855
|
PlatformTransport: () => PlatformTransport,
|
|
9379
9856
|
PushSlugConflict: () => PushSlugConflict,
|
|
9380
9857
|
RECOVER_BUDGET_MS: () => RECOVER_BUDGET_MS,
|
|
9858
|
+
REQUESTS_NOT_RECORDED: () => REQUESTS_NOT_RECORDED,
|
|
9859
|
+
REQUEST_BODY_CAPTURE_BYTES: () => REQUEST_BODY_CAPTURE_BYTES,
|
|
9860
|
+
REQUEST_LOG_PAGE_MAX: () => REQUEST_LOG_PAGE_MAX,
|
|
9381
9861
|
RetryPolicy: () => RetryPolicy,
|
|
9862
|
+
SANDBOX_EXEC_REPORT_MARGIN_MS: () => SANDBOX_EXEC_REPORT_MARGIN_MS,
|
|
9863
|
+
SANDBOX_EXEC_START_ATTEMPTS: () => SANDBOX_EXEC_START_ATTEMPTS,
|
|
9864
|
+
SANDBOX_EXEC_TIMEOUT_MAX_S: () => SANDBOX_EXEC_TIMEOUT_MAX_S,
|
|
9865
|
+
SANDBOX_EXEC_WAIT_MS: () => SANDBOX_EXEC_WAIT_MS,
|
|
9866
|
+
SANDBOX_FILE_MAX_BYTES: () => SANDBOX_FILE_MAX_BYTES,
|
|
9382
9867
|
SANDBOX_REQUEST_TIMEOUT_MS: () => SANDBOX_REQUEST_TIMEOUT_MS,
|
|
9868
|
+
SANDBOX_WRITE_CHUNK_BYTES: () => SANDBOX_WRITE_CHUNK_BYTES,
|
|
9869
|
+
SANDBOX_WRITE_SKIPPED: () => SANDBOX_WRITE_SKIPPED,
|
|
9383
9870
|
SECRET_KEY: () => SECRET_KEY,
|
|
9871
|
+
SESSION_AUTH_MODES: () => SESSION_AUTH_MODES,
|
|
9384
9872
|
SESSION_STATES: () => SESSION_STATES,
|
|
9385
9873
|
SPAN_PREFIX: () => SPAN_PREFIX,
|
|
9386
9874
|
STATUS_WAIT_CAP_SECONDS: () => STATUS_WAIT_CAP_SECONDS,
|
|
@@ -9392,17 +9880,23 @@ __export(worlds_exports, {
|
|
|
9392
9880
|
TOOL_CONTRACT_UNREAD: () => TOOL_CONTRACT_UNREAD,
|
|
9393
9881
|
TRANSFORMS: () => TRANSFORMS,
|
|
9394
9882
|
TaskEditClient: () => TaskEditClient,
|
|
9883
|
+
TaskGrades: () => TaskGrades,
|
|
9395
9884
|
TaskRun: () => TaskRun,
|
|
9396
9885
|
TaskSessions: () => TaskSessions,
|
|
9397
9886
|
TransportCause: () => TransportCause,
|
|
9398
9887
|
UnreachableError: () => UnreachableError,
|
|
9399
9888
|
VERIFIER_REWARD_PREFIX: () => VERIFIER_REWARD_PREFIX,
|
|
9400
9889
|
WHITESPACE: () => WHITESPACE,
|
|
9890
|
+
WORLD_REQUEST_VIAS: () => WORLD_REQUEST_VIAS,
|
|
9401
9891
|
WorldBrowser: () => WorldBrowser,
|
|
9402
9892
|
WorldCallTooLarge: () => WorldCallTooLarge,
|
|
9403
9893
|
WorldEditClient: () => WorldEditClient,
|
|
9404
9894
|
WorldNotice: () => WorldNotice,
|
|
9895
|
+
WorldRequestFilterError: () => WorldRequestFilterError,
|
|
9896
|
+
WorldRequestLedger: () => WorldRequestLedger,
|
|
9405
9897
|
WorldRequestLog: () => WorldRequestLog,
|
|
9898
|
+
WorldRequestQuery: () => WorldRequestQuery,
|
|
9899
|
+
WorldRequestsNotRecorded: () => WorldRequestsNotRecorded,
|
|
9406
9900
|
WorldSandboxClient: () => WorldSandboxClient,
|
|
9407
9901
|
WorldSession: () => WorldSession,
|
|
9408
9902
|
WorldSessionCallError: () => WorldSessionCallError,
|
|
@@ -9412,18 +9906,22 @@ __export(worlds_exports, {
|
|
|
9412
9906
|
WorldSurfaceUnavailable: () => WorldSurfaceUnavailable,
|
|
9413
9907
|
WorldTask: () => WorldTask,
|
|
9414
9908
|
WorldToolsUnread: () => WorldToolsUnread,
|
|
9909
|
+
WriteTreeFilter: () => WriteTreeFilter,
|
|
9415
9910
|
aggregateTaskGrade: () => aggregateTaskGrade,
|
|
9416
9911
|
apiRequest: () => apiRequest,
|
|
9417
9912
|
applyTransforms: () => applyTransforms,
|
|
9418
9913
|
archiveMode: () => archiveMode,
|
|
9419
9914
|
assertBrowserTier: () => assertBrowserTier,
|
|
9915
|
+
assertSessionAuthMode: () => assertSessionAuthMode,
|
|
9420
9916
|
assertTaskRef: () => assertTaskRef,
|
|
9421
9917
|
attachManifest: () => attachManifest,
|
|
9422
9918
|
attachSession: () => attachSession,
|
|
9423
9919
|
attachTask: () => attachTask,
|
|
9424
9920
|
buildFileManifest: () => buildFileManifest,
|
|
9425
9921
|
buildSourceTarball: () => buildSourceTarball,
|
|
9922
|
+
capabilityLabel: () => capabilityLabel,
|
|
9426
9923
|
captureToolCalls: () => captureToolCalls,
|
|
9924
|
+
carriedWarnings: () => carriedWarnings,
|
|
9427
9925
|
checkoutIdentity: () => checkoutIdentity,
|
|
9428
9926
|
closeConnection: () => closeConnection,
|
|
9429
9927
|
collectArchiveRelPaths: () => collectArchiveRelPaths,
|
|
@@ -9442,7 +9940,9 @@ __export(worlds_exports, {
|
|
|
9442
9940
|
idleWarning: () => idleWarning,
|
|
9443
9941
|
ingest: () => ingest,
|
|
9444
9942
|
ingestToolCalls: () => ingestToolCalls,
|
|
9943
|
+
invalidFields: () => invalidFields,
|
|
9445
9944
|
isBrowserGone: () => isBrowserGone,
|
|
9945
|
+
isSandboxCommitPending: () => isSandboxCommitPending,
|
|
9446
9946
|
isSandboxImportPending: () => isSandboxImportPending,
|
|
9447
9947
|
isTaskIdRef: () => isTaskIdRef,
|
|
9448
9948
|
isTaskManifest: () => isTaskManifest,
|
|
@@ -9489,6 +9989,7 @@ __export(worlds_exports, {
|
|
|
9489
9989
|
resolveBrowserMode: () => resolveBrowserMode,
|
|
9490
9990
|
resolvePushSlug: () => resolvePushSlug,
|
|
9491
9991
|
roundForm: () => roundForm,
|
|
9992
|
+
rowsRefusal: () => rowsRefusal,
|
|
9492
9993
|
runSessions: () => runSessions,
|
|
9493
9994
|
runSet: () => runSet,
|
|
9494
9995
|
runTask: () => runTask,
|
|
@@ -9517,27 +10018,42 @@ __export(worlds_exports, {
|
|
|
9517
10018
|
validateWorld: () => validateWorld,
|
|
9518
10019
|
waitForRun: () => waitForRun,
|
|
9519
10020
|
withoutUiToken: () => withoutUiToken,
|
|
10021
|
+
worldRequestsUnrecorded: () => worldRequestsUnrecorded,
|
|
9520
10022
|
writeLocalMeta: () => writeLocalMeta
|
|
9521
10023
|
});
|
|
9522
|
-
function
|
|
9523
|
-
|
|
10024
|
+
function edgeAnswer(text2, status) {
|
|
10025
|
+
if (status !== void 0 && status >= 500) return EDGE_ANSWERS[status] ?? EDGE_FAILURE;
|
|
10026
|
+
return /^\s*</.test(text2) ? EDGE_PAGE : null;
|
|
10027
|
+
}
|
|
10028
|
+
function parseErrorBody(text2, status) {
|
|
10029
|
+
const raw = { detail: text2.slice(0, DETAIL_LIMIT), code: null };
|
|
9524
10030
|
let parsed;
|
|
9525
10031
|
try {
|
|
9526
10032
|
parsed = JSON.parse(text2);
|
|
9527
10033
|
} catch {
|
|
9528
|
-
return
|
|
10034
|
+
return { detail: (edgeAnswer(text2, status) ?? text2).slice(0, DETAIL_LIMIT), code: null };
|
|
9529
10035
|
}
|
|
9530
10036
|
if (parsed === null || typeof parsed !== "object") return raw;
|
|
9531
|
-
const { message, code } = parsed;
|
|
10037
|
+
const { message, code, error } = parsed;
|
|
9532
10038
|
const stableCode = typeof code === "string" ? code : null;
|
|
9533
10039
|
if (typeof message !== "string") return { ...raw, code: stableCode };
|
|
9534
|
-
|
|
9535
|
-
|
|
10040
|
+
const fields = invalidFields(error);
|
|
10041
|
+
const said = fields ? `${message}: ${fields}` : message;
|
|
10042
|
+
if (stableCode === null) return { detail: said.slice(0, DETAIL_LIMIT), code: null };
|
|
9536
10043
|
return {
|
|
9537
|
-
detail: `${
|
|
10044
|
+
detail: `${said} (${stableCode})`.slice(0, DETAIL_LIMIT),
|
|
9538
10045
|
code: stableCode
|
|
9539
10046
|
};
|
|
9540
10047
|
}
|
|
10048
|
+
function invalidFields(error) {
|
|
10049
|
+
const issues = Array.isArray(error) ? error : [];
|
|
10050
|
+
return issues.filter(
|
|
10051
|
+
(issue) => issue !== null && typeof issue === "object" && typeof issue.message === "string"
|
|
10052
|
+
).map((issue) => {
|
|
10053
|
+
const path17 = Array.isArray(issue.path) ? issue.path.map(String).join(".") : "";
|
|
10054
|
+
return path17 ? `${path17}: ${issue.message}` : issue.message;
|
|
10055
|
+
}).join("; ");
|
|
10056
|
+
}
|
|
9541
10057
|
async function apiRequest(options, method, path17, body, init3 = {}) {
|
|
9542
10058
|
const reply = await new PlatformTransport(requirePlatformEndpoint(options)).send(method, path17, body, init3);
|
|
9543
10059
|
if (!reply.ok) throw new ApiError(reply.status, method, path17, reply.text);
|
|
@@ -9716,7 +10232,7 @@ async function resolveWorld(slugRef, slug, ref, pin, options) {
|
|
|
9716
10232
|
}
|
|
9717
10233
|
return world;
|
|
9718
10234
|
}
|
|
9719
|
-
var ApiError, WorldTask, WorldSet;
|
|
10235
|
+
var ApiError, DETAIL_LIMIT, EDGE_ANSWERS, EDGE_FAILURE, EDGE_PAGE, WorldTask, WorldSet;
|
|
9720
10236
|
var init_worlds = __esm({
|
|
9721
10237
|
"src/worlds/index.ts"() {
|
|
9722
10238
|
"use strict";
|
|
@@ -9729,6 +10245,7 @@ var init_worlds = __esm({
|
|
|
9729
10245
|
init_sessionContract();
|
|
9730
10246
|
init_taskRef();
|
|
9731
10247
|
init_tasks();
|
|
10248
|
+
init_taskGrades();
|
|
9732
10249
|
init_taskSessions();
|
|
9733
10250
|
init_taskRun();
|
|
9734
10251
|
init_setRun();
|
|
@@ -9737,6 +10254,7 @@ var init_worlds = __esm({
|
|
|
9737
10254
|
init_browser();
|
|
9738
10255
|
init_surfaceDescriptor();
|
|
9739
10256
|
init_requestLog();
|
|
10257
|
+
init_requestLedger();
|
|
9740
10258
|
init_browserReconnect();
|
|
9741
10259
|
init_nativeComputer();
|
|
9742
10260
|
init_hub();
|
|
@@ -9753,7 +10271,7 @@ var init_worlds = __esm({
|
|
|
9753
10271
|
init_worldNotice();
|
|
9754
10272
|
ApiError = class extends Error {
|
|
9755
10273
|
constructor(status, method, path17, text2) {
|
|
9756
|
-
const parsed = parseErrorBody(text2);
|
|
10274
|
+
const parsed = parseErrorBody(text2, status);
|
|
9757
10275
|
super(`${method} ${path17} -> ${status}: ${parsed.detail}`);
|
|
9758
10276
|
this.status = status;
|
|
9759
10277
|
this.text = text2;
|
|
@@ -9764,6 +10282,14 @@ var init_worlds = __esm({
|
|
|
9764
10282
|
text;
|
|
9765
10283
|
code;
|
|
9766
10284
|
};
|
|
10285
|
+
DETAIL_LIMIT = 600;
|
|
10286
|
+
EDGE_ANSWERS = {
|
|
10287
|
+
502: "Bad Gateway from the load balancer in front of the platform, not the platform's answer: the web server dropped the connection or restarted mid-request. Retry; if it repeats, the platform is restarting or overloaded.",
|
|
10288
|
+
503: "Service Unavailable from the load balancer in front of the platform, not the platform's answer: no web server was ready to take the request (a deploy or a restart). Retry in a minute.",
|
|
10289
|
+
504: "Gateway Time-out from the load balancer in front of the platform, not the platform's answer: the request sent nothing back within the load balancer's idle timeout (60 s unless the deployment raises it: Helm ingress.idleTimeoutSeconds) and was cut there, though the platform may still be running it. Check what it changed before you retry."
|
|
10290
|
+
};
|
|
10291
|
+
EDGE_FAILURE = "The platform failed without its JSON error body: a proxy in front of it answered, or the server stopped before its error handler ran. Retry; if it repeats, report the request and the time.";
|
|
10292
|
+
EDGE_PAGE = "An HTML page answered instead of the platform's JSON: a proxy in front of the platform, or the configured host is not the platform.";
|
|
9767
10293
|
WorldTask = class {
|
|
9768
10294
|
constructor(world, name, variant) {
|
|
9769
10295
|
this.world = world;
|
|
@@ -9799,12 +10325,7 @@ var init_worlds = __esm({
|
|
|
9799
10325
|
}
|
|
9800
10326
|
return hit;
|
|
9801
10327
|
}
|
|
9802
|
-
/**
|
|
9803
|
-
* Open a LIVE session against one of this world's tasks — a bundled task's
|
|
9804
|
-
* name or an inline `WorldTaskSpec`: the platform boots (or reuses) a warm
|
|
9805
|
-
* container, and your agent calls its tools through the platform. See
|
|
9806
|
-
* worlds/session.ts.
|
|
9807
|
-
*/
|
|
10328
|
+
/** Open a live session on a bundled task's name or an inline `WorldTaskSpec`; the platform boots or reuses a warm container. */
|
|
9808
10329
|
async open(task, opts = {}) {
|
|
9809
10330
|
const { openSession: openSession2 } = await Promise.resolve().then(() => (init_session2(), session_exports2));
|
|
9810
10331
|
return openSession2(this.slug, {
|
|
@@ -9816,11 +10337,7 @@ var init_worlds = __esm({
|
|
|
9816
10337
|
options: this.options
|
|
9817
10338
|
});
|
|
9818
10339
|
}
|
|
9819
|
-
/**
|
|
9820
|
-
* Start a HOSTED run of a run config against this world — the platform
|
|
9821
|
-
* executes the (Python) world in parallel containers per the config's
|
|
9822
|
-
* `parallelism` and files one graded run per model. Returns those runs.
|
|
9823
|
-
*/
|
|
10340
|
+
/** Start a hosted run of a run config on this version (or `opts.versionId`): one graded run per model, provenance detected unless given. */
|
|
9824
10341
|
async dispatch(runConfigId, opts = {}) {
|
|
9825
10342
|
const provenance = opts.provenance ?? detectProvenance();
|
|
9826
10343
|
return apiRequest(
|
|
@@ -9902,6 +10419,7 @@ __export(src_exports, {
|
|
|
9902
10419
|
NativeComputer: () => NativeComputer,
|
|
9903
10420
|
OpenAIComputer: () => OpenAIComputer,
|
|
9904
10421
|
OpenAIPreviewComputer: () => OpenAIPreviewComputer,
|
|
10422
|
+
PLATFORM_SESSION_HEADER: () => PLATFORM_SESSION_HEADER,
|
|
9905
10423
|
PLATFORM_TIMEOUT_DEFAULT_MS: () => PLATFORM_TIMEOUT_DEFAULT_MS,
|
|
9906
10424
|
PLATFORM_TIMEOUT_ENV: () => PLATFORM_TIMEOUT_ENV,
|
|
9907
10425
|
PendingSafetyChecks: () => PendingSafetyChecks,
|
|
@@ -9912,6 +10430,9 @@ __export(src_exports, {
|
|
|
9912
10430
|
PushSlugConflict: () => PushSlugConflict,
|
|
9913
10431
|
RECOVER_BUDGET_MS: () => RECOVER_BUDGET_MS,
|
|
9914
10432
|
REPLAY_ENVIRONMENT: () => REPLAY_ENVIRONMENT,
|
|
10433
|
+
REQUESTS_NOT_RECORDED: () => REQUESTS_NOT_RECORDED,
|
|
10434
|
+
REQUEST_BODY_CAPTURE_BYTES: () => REQUEST_BODY_CAPTURE_BYTES,
|
|
10435
|
+
REQUEST_LOG_PAGE_MAX: () => REQUEST_LOG_PAGE_MAX,
|
|
9915
10436
|
ReplayCase: () => ReplayCase,
|
|
9916
10437
|
ReplayCheck: () => ReplayCheck,
|
|
9917
10438
|
ReplayError: () => ReplayError,
|
|
@@ -9919,8 +10440,16 @@ __export(src_exports, {
|
|
|
9919
10440
|
ReplaySuite: () => ReplaySuite,
|
|
9920
10441
|
ReplayTask: () => ReplayTask,
|
|
9921
10442
|
RetryPolicy: () => RetryPolicy,
|
|
10443
|
+
SANDBOX_EXEC_REPORT_MARGIN_MS: () => SANDBOX_EXEC_REPORT_MARGIN_MS,
|
|
10444
|
+
SANDBOX_EXEC_START_ATTEMPTS: () => SANDBOX_EXEC_START_ATTEMPTS,
|
|
10445
|
+
SANDBOX_EXEC_TIMEOUT_MAX_S: () => SANDBOX_EXEC_TIMEOUT_MAX_S,
|
|
10446
|
+
SANDBOX_EXEC_WAIT_MS: () => SANDBOX_EXEC_WAIT_MS,
|
|
10447
|
+
SANDBOX_FILE_MAX_BYTES: () => SANDBOX_FILE_MAX_BYTES,
|
|
9922
10448
|
SANDBOX_REQUEST_TIMEOUT_MS: () => SANDBOX_REQUEST_TIMEOUT_MS,
|
|
10449
|
+
SANDBOX_WRITE_CHUNK_BYTES: () => SANDBOX_WRITE_CHUNK_BYTES,
|
|
10450
|
+
SANDBOX_WRITE_SKIPPED: () => SANDBOX_WRITE_SKIPPED,
|
|
9923
10451
|
SECRET_KEY: () => SECRET_KEY,
|
|
10452
|
+
SESSION_AUTH_MODES: () => SESSION_AUTH_MODES,
|
|
9924
10453
|
SESSION_STATES: () => SESSION_STATES,
|
|
9925
10454
|
SPAN_PREFIX: () => SPAN_PREFIX,
|
|
9926
10455
|
STATUS_WAIT_CAP_SECONDS: () => STATUS_WAIT_CAP_SECONDS,
|
|
@@ -9940,6 +10469,7 @@ __export(src_exports, {
|
|
|
9940
10469
|
TOOL_CONTRACT_UNREAD: () => TOOL_CONTRACT_UNREAD,
|
|
9941
10470
|
TRANSFORMS: () => TRANSFORMS,
|
|
9942
10471
|
TaskEditClient: () => TaskEditClient,
|
|
10472
|
+
TaskGrades: () => TaskGrades,
|
|
9943
10473
|
TaskRun: () => TaskRun,
|
|
9944
10474
|
TaskSessions: () => TaskSessions,
|
|
9945
10475
|
ToolStubRegistry: () => ToolStubRegistry,
|
|
@@ -9950,11 +10480,16 @@ __export(src_exports, {
|
|
|
9950
10480
|
UsersClient: () => UsersClient,
|
|
9951
10481
|
VERIFIER_REWARD_PREFIX: () => VERIFIER_REWARD_PREFIX,
|
|
9952
10482
|
WHITESPACE: () => WHITESPACE,
|
|
10483
|
+
WORLD_REQUEST_VIAS: () => WORLD_REQUEST_VIAS,
|
|
9953
10484
|
WorldBrowser: () => WorldBrowser,
|
|
9954
10485
|
WorldCallTooLarge: () => WorldCallTooLarge,
|
|
9955
10486
|
WorldEditClient: () => WorldEditClient,
|
|
9956
10487
|
WorldNotice: () => WorldNotice,
|
|
10488
|
+
WorldRequestFilterError: () => WorldRequestFilterError,
|
|
10489
|
+
WorldRequestLedger: () => WorldRequestLedger,
|
|
9957
10490
|
WorldRequestLog: () => WorldRequestLog,
|
|
10491
|
+
WorldRequestQuery: () => WorldRequestQuery,
|
|
10492
|
+
WorldRequestsNotRecorded: () => WorldRequestsNotRecorded,
|
|
9958
10493
|
WorldSandboxClient: () => WorldSandboxClient,
|
|
9959
10494
|
WorldSession: () => WorldSession,
|
|
9960
10495
|
WorldSessionCallError: () => WorldSessionCallError,
|
|
@@ -9964,6 +10499,7 @@ __export(src_exports, {
|
|
|
9964
10499
|
WorldSurfaceUnavailable: () => WorldSurfaceUnavailable,
|
|
9965
10500
|
WorldTask: () => WorldTask,
|
|
9966
10501
|
WorldToolsUnread: () => WorldToolsUnread,
|
|
10502
|
+
WriteTreeFilter: () => WriteTreeFilter,
|
|
9967
10503
|
addExperimentAttributes: () => addExperimentAttributes,
|
|
9968
10504
|
aggregateTaskGrade: () => aggregateTaskGrade,
|
|
9969
10505
|
apiRequest: () => apiRequest,
|
|
@@ -9971,6 +10507,7 @@ __export(src_exports, {
|
|
|
9971
10507
|
archiveMode: () => archiveMode,
|
|
9972
10508
|
assembleManifest: () => assembleManifest,
|
|
9973
10509
|
assertBrowserTier: () => assertBrowserTier,
|
|
10510
|
+
assertSessionAuthMode: () => assertSessionAuthMode,
|
|
9974
10511
|
assertTaskRef: () => assertTaskRef,
|
|
9975
10512
|
assignVariant: () => assignVariant,
|
|
9976
10513
|
attachManifest: () => attachManifest,
|
|
@@ -9980,7 +10517,9 @@ __export(src_exports, {
|
|
|
9980
10517
|
buildFileManifest: () => buildFileManifest,
|
|
9981
10518
|
buildSourceTarball: () => buildSourceTarball,
|
|
9982
10519
|
canonicalJson: () => canonicalJson,
|
|
10520
|
+
capabilityLabel: () => capabilityLabel,
|
|
9983
10521
|
captureToolCalls: () => captureToolCalls,
|
|
10522
|
+
carriedWarnings: () => carriedWarnings,
|
|
9984
10523
|
checkoutIdentity: () => checkoutIdentity,
|
|
9985
10524
|
clearExperimentContext: () => clearExperimentContext,
|
|
9986
10525
|
closeConnection: () => closeConnection,
|
|
@@ -10016,7 +10555,9 @@ __export(src_exports, {
|
|
|
10016
10555
|
idleWarning: () => idleWarning,
|
|
10017
10556
|
ingest: () => ingest,
|
|
10018
10557
|
ingestToolCalls: () => ingestToolCalls,
|
|
10558
|
+
invalidFields: () => invalidFields,
|
|
10019
10559
|
isBrowserGone: () => isBrowserGone,
|
|
10560
|
+
isSandboxCommitPending: () => isSandboxCommitPending,
|
|
10020
10561
|
isSandboxImportPending: () => isSandboxImportPending,
|
|
10021
10562
|
isTaskIdRef: () => isTaskIdRef,
|
|
10022
10563
|
isTaskManifest: () => isTaskManifest,
|
|
@@ -10073,6 +10614,7 @@ __export(src_exports, {
|
|
|
10073
10614
|
resolvePushSlug: () => resolvePushSlug,
|
|
10074
10615
|
resolveUserId: () => resolveUserId,
|
|
10075
10616
|
roundForm: () => roundForm,
|
|
10617
|
+
rowsRefusal: () => rowsRefusal,
|
|
10076
10618
|
runSessions: () => runSessions,
|
|
10077
10619
|
runSet: () => runSet,
|
|
10078
10620
|
runSuite: () => runSuite,
|
|
@@ -10112,6 +10654,7 @@ __export(src_exports, {
|
|
|
10112
10654
|
validateWorld: () => validateWorld,
|
|
10113
10655
|
waitForRun: () => waitForRun,
|
|
10114
10656
|
withoutUiToken: () => withoutUiToken,
|
|
10657
|
+
worldRequestsUnrecorded: () => worldRequestsUnrecorded,
|
|
10115
10658
|
writeLocalMeta: () => writeLocalMeta
|
|
10116
10659
|
});
|
|
10117
10660
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -12534,7 +13077,7 @@ __export(files_exports, {
|
|
|
12534
13077
|
uploadBytes: () => uploadBytes,
|
|
12535
13078
|
uploadFile: () => uploadFile
|
|
12536
13079
|
});
|
|
12537
|
-
var
|
|
13080
|
+
var import_node_crypto12 = require("crypto");
|
|
12538
13081
|
var fs13 = __toESM(require("fs"));
|
|
12539
13082
|
var path13 = __toESM(require("path"));
|
|
12540
13083
|
var import_node_stream = require("stream");
|
|
@@ -12600,7 +13143,7 @@ async function confirmUpload(options = {}, fileId, ok = true) {
|
|
|
12600
13143
|
return apiRequest(options, "POST", `${BASE}/confirm`, { fileId, ok });
|
|
12601
13144
|
}
|
|
12602
13145
|
async function sha256Base64(localPath) {
|
|
12603
|
-
const hash = (0,
|
|
13146
|
+
const hash = (0, import_node_crypto12.createHash)("sha256");
|
|
12604
13147
|
for await (const chunk of fs13.createReadStream(localPath)) hash.update(chunk);
|
|
12605
13148
|
return hash.digest("base64");
|
|
12606
13149
|
}
|
|
@@ -12685,7 +13228,7 @@ async function uploadBytes(options = {}, bytes, targetPath, upload = {}) {
|
|
|
12685
13228
|
if (!bytes.length) throw new Error("nothing to upload: the content is empty");
|
|
12686
13229
|
const target = drivePath(targetPath);
|
|
12687
13230
|
const contentType = upload.contentType ?? contentTypeFor(target);
|
|
12688
|
-
const sha2562 = (0,
|
|
13231
|
+
const sha2562 = (0, import_node_crypto12.createHash)("sha256").update(bytes).digest("base64");
|
|
12689
13232
|
const granted = await requestUpload(options, { path: target, contentLength: bytes.length, contentType, sha256: sha2562, ...upload.overwrite ? { overwrite: true } : {} });
|
|
12690
13233
|
try {
|
|
12691
13234
|
await putPresigned(granted.uploadUrl, new Uint8Array(bytes), { contentType, contentLength: bytes.length, sha256: sha2562 });
|
|
@@ -12938,10 +13481,10 @@ function swapValue(text2, needle, replacement) {
|
|
|
12938
13481
|
}
|
|
12939
13482
|
|
|
12940
13483
|
// src/hooks/standInDigits.ts
|
|
12941
|
-
var
|
|
13484
|
+
var import_node_crypto13 = require("crypto");
|
|
12942
13485
|
function standInDigits(realDigits, identityName) {
|
|
12943
13486
|
if (!realDigits) return "";
|
|
12944
|
-
const digest = (0,
|
|
13487
|
+
const digest = (0, import_node_crypto13.createHash)("sha256").update(`${identityName}:${realDigits}`).digest("hex");
|
|
12945
13488
|
let digits = "";
|
|
12946
13489
|
for (let i = 0; i < realDigits.length; i++)
|
|
12947
13490
|
digits += String(parseInt(digest[i % digest.length], 16) % 10);
|
|
@@ -12975,7 +13518,7 @@ var DeclaredStandIn = class _DeclaredStandIn {
|
|
|
12975
13518
|
};
|
|
12976
13519
|
|
|
12977
13520
|
// src/hooks/alias.ts
|
|
12978
|
-
var
|
|
13521
|
+
var import_node_crypto14 = require("crypto");
|
|
12979
13522
|
var GIVEN = [
|
|
12980
13523
|
"John",
|
|
12981
13524
|
"Mary",
|
|
@@ -13166,7 +13709,7 @@ function findKind(kind, text2) {
|
|
|
13166
13709
|
return out;
|
|
13167
13710
|
}
|
|
13168
13711
|
function newRunKey() {
|
|
13169
|
-
return (0,
|
|
13712
|
+
return (0, import_node_crypto14.randomBytes)(32).toString("hex");
|
|
13170
13713
|
}
|
|
13171
13714
|
function canonical(kind, value) {
|
|
13172
13715
|
const text2 = String(value).normalize("NFKC").trim();
|
|
@@ -13223,7 +13766,7 @@ function explodeIp(text2) {
|
|
|
13223
13766
|
return groups.map((g) => g.padStart(4, "0")).join(":") + zone;
|
|
13224
13767
|
}
|
|
13225
13768
|
function index(runKey, kind, value, salt = "") {
|
|
13226
|
-
const digest = (0,
|
|
13769
|
+
const digest = (0, import_node_crypto14.createHmac)("sha256", Buffer.from(runKey, "hex")).update(`${kind}:${value}:${salt}`, "utf8").digest();
|
|
13227
13770
|
return digest.readBigUInt64BE(0);
|
|
13228
13771
|
}
|
|
13229
13772
|
var pick = (pool, n) => pool[Number(n % BigInt(pool.length))];
|
|
@@ -13757,7 +14300,7 @@ var AliasMap = class _AliasMap {
|
|
|
13757
14300
|
const existing = this.aliases.get(key2);
|
|
13758
14301
|
if (existing) return existing.display;
|
|
13759
14302
|
if (this.aliasDigests.has(digest.toLowerCase())) return digest;
|
|
13760
|
-
const standIn = "sha256:" + (0,
|
|
14303
|
+
const standIn = "sha256:" + (0, import_node_crypto14.createHmac)("sha256", Buffer.from(this.runKey, "hex")).update(digest, "utf8").digest("hex");
|
|
13761
14304
|
this.aliasDigests.add(standIn.toLowerCase());
|
|
13762
14305
|
const alias = {
|
|
13763
14306
|
kind: "digest",
|
|
@@ -13796,9 +14339,9 @@ var AliasMap = class _AliasMap {
|
|
|
13796
14339
|
});
|
|
13797
14340
|
if (alias.role === "private") {
|
|
13798
14341
|
for (const slug of this.slugs) {
|
|
13799
|
-
const standIn = "sha256:" + (0,
|
|
14342
|
+
const standIn = "sha256:" + (0, import_node_crypto14.createHash)("sha256").update(`${slug}:${canonical(alias.kind, alias.display)}`, "utf8").digest("hex");
|
|
13800
14343
|
alias.variants.push([
|
|
13801
|
-
"sha256:" + (0,
|
|
14344
|
+
"sha256:" + (0, import_node_crypto14.createHash)("sha256").update(`${slug}:${alias.canonical}`, "utf8").digest("hex"),
|
|
13802
14345
|
standIn
|
|
13803
14346
|
]);
|
|
13804
14347
|
this.aliasDigests.add(standIn.toLowerCase());
|
|
@@ -15815,6 +16358,120 @@ async function buildHandler(spec, aliases, opts) {
|
|
|
15815
16358
|
// src/hooks/live.ts
|
|
15816
16359
|
var fs16 = __toESM(require("fs"));
|
|
15817
16360
|
var path15 = __toESM(require("path"));
|
|
16361
|
+
|
|
16362
|
+
// src/hooks/vendorAuth.ts
|
|
16363
|
+
var bearer = (auth, value) => ({
|
|
16364
|
+
headers: { authorization: `${prefixesOf(auth)[0]} ${value}` },
|
|
16365
|
+
query: []
|
|
16366
|
+
});
|
|
16367
|
+
var CARRIERS = /* @__PURE__ */ new Map([
|
|
16368
|
+
[
|
|
16369
|
+
"header",
|
|
16370
|
+
(auth, value) => ({
|
|
16371
|
+
headers: {
|
|
16372
|
+
[String(auth.name ?? "").trim().toLowerCase()]: value
|
|
16373
|
+
},
|
|
16374
|
+
query: []
|
|
16375
|
+
})
|
|
16376
|
+
],
|
|
16377
|
+
["bearer", bearer],
|
|
16378
|
+
[
|
|
16379
|
+
"basic",
|
|
16380
|
+
(auth, value) => ({
|
|
16381
|
+
headers: {
|
|
16382
|
+
authorization: `Basic ${Buffer.from(basicPair(auth, value)).toString("base64")}`
|
|
16383
|
+
},
|
|
16384
|
+
query: []
|
|
16385
|
+
})
|
|
16386
|
+
],
|
|
16387
|
+
[
|
|
16388
|
+
"query",
|
|
16389
|
+
(auth, value) => ({
|
|
16390
|
+
headers: {},
|
|
16391
|
+
query: [[String(auth.name ?? "").trim(), value]]
|
|
16392
|
+
})
|
|
16393
|
+
],
|
|
16394
|
+
["oauth2", bearer],
|
|
16395
|
+
["none", () => ({ headers: {}, query: [] })]
|
|
16396
|
+
]);
|
|
16397
|
+
var AUTH_WORD = /^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,64}$/;
|
|
16398
|
+
var OWNERS = [
|
|
16399
|
+
["client_id_env", ["oauth2"]],
|
|
16400
|
+
["credential", ["basic"]],
|
|
16401
|
+
["prefixes", ["bearer", "oauth2"]],
|
|
16402
|
+
["scope", ["oauth2"]],
|
|
16403
|
+
["token_url", ["oauth2"]],
|
|
16404
|
+
["ttl_seconds", ["oauth2"]]
|
|
16405
|
+
];
|
|
16406
|
+
var AUTH_MODES = ["vendor", "open"];
|
|
16407
|
+
var positiveSeconds = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1;
|
|
16408
|
+
var NAMED = /* @__PURE__ */ new Set(["header", "query"]);
|
|
16409
|
+
function prefixesOf(auth) {
|
|
16410
|
+
const words2 = auth.prefixes ?? ["Bearer"];
|
|
16411
|
+
const valid = Array.isArray(words2) && words2.length > 0 && words2.every((word) => typeof word === "string" && AUTH_WORD.test(word)) && new Set(words2.map((word) => word.toLowerCase())).size === words2.length;
|
|
16412
|
+
if (!valid)
|
|
16413
|
+
throw new Error(
|
|
16414
|
+
"auth.prefixes lists the distinct words the vendor takes before the key in Authorization"
|
|
16415
|
+
);
|
|
16416
|
+
return words2;
|
|
16417
|
+
}
|
|
16418
|
+
function basicHalf(auth) {
|
|
16419
|
+
const half = auth.credential ?? "user";
|
|
16420
|
+
if (half !== "user" && half !== "password")
|
|
16421
|
+
throw new Error(
|
|
16422
|
+
"auth.credential is the half of the Basic pair the key is: user or password"
|
|
16423
|
+
);
|
|
16424
|
+
return half;
|
|
16425
|
+
}
|
|
16426
|
+
function basicPair(auth, value) {
|
|
16427
|
+
if (value.includes(":")) return value;
|
|
16428
|
+
return basicHalf(auth) === "password" ? `:${value}` : `${value}:`;
|
|
16429
|
+
}
|
|
16430
|
+
var GRAMMAR = /* @__PURE__ */ new Map([
|
|
16431
|
+
["bearer", prefixesOf],
|
|
16432
|
+
["oauth2", prefixesOf],
|
|
16433
|
+
["basic", basicHalf]
|
|
16434
|
+
]);
|
|
16435
|
+
function authScheme(value) {
|
|
16436
|
+
if (value === void 0) throw new Error("Missing scheme");
|
|
16437
|
+
if (value === "open")
|
|
16438
|
+
throw new Error(
|
|
16439
|
+
'auth.scheme is how the vendor takes its key; a world whose sessions ask for none is auth.mode = "open"'
|
|
16440
|
+
);
|
|
16441
|
+
if (typeof value !== "string" || !CARRIERS.has(value))
|
|
16442
|
+
throw new Error(
|
|
16443
|
+
`auth.scheme must be one of ${[...CARRIERS.keys()].join(", ")}`
|
|
16444
|
+
);
|
|
16445
|
+
return value;
|
|
16446
|
+
}
|
|
16447
|
+
function vendorAuth(auth) {
|
|
16448
|
+
const scheme = authScheme(auth.scheme);
|
|
16449
|
+
const stray = OWNERS.find(
|
|
16450
|
+
([key2, owners]) => auth[key2] !== void 0 && !owners.includes(scheme)
|
|
16451
|
+
);
|
|
16452
|
+
if (stray)
|
|
16453
|
+
throw new Error(
|
|
16454
|
+
`${stray[0]} belongs to auth.scheme ${stray[1].join(" or ")}`
|
|
16455
|
+
);
|
|
16456
|
+
if (scheme === "none" && (auth.name ?? auth.secret_env) !== void 0)
|
|
16457
|
+
throw new Error("auth.scheme none takes no name or secret_env");
|
|
16458
|
+
if (NAMED.has(scheme) && auth.name === void 0)
|
|
16459
|
+
throw new Error("Missing name");
|
|
16460
|
+
if (auth.name !== void 0 && (typeof auth.name !== "string" || !auth.name.trim()))
|
|
16461
|
+
throw new Error("name must be a non-empty string");
|
|
16462
|
+
GRAMMAR.get(scheme)?.(auth);
|
|
16463
|
+
if (auth.mode !== void 0 && !AUTH_MODES.includes(auth.mode))
|
|
16464
|
+
throw new Error(`auth.mode is one of ${AUTH_MODES.join(", ")}`);
|
|
16465
|
+
if (auth.ttl_seconds !== void 0 && !positiveSeconds(auth.ttl_seconds))
|
|
16466
|
+
throw new Error("ttl_seconds is a positive whole number of seconds");
|
|
16467
|
+
return { ...auth, scheme };
|
|
16468
|
+
}
|
|
16469
|
+
function carryCredential(auth, value) {
|
|
16470
|
+
const checked = vendorAuth(auth);
|
|
16471
|
+
return CARRIERS.get(checked.scheme)(checked, value);
|
|
16472
|
+
}
|
|
16473
|
+
|
|
16474
|
+
// src/hooks/live.ts
|
|
15818
16475
|
var USER_AGENT = "gateway-hooks/1 (+https://withgateway.ai)";
|
|
15819
16476
|
var TAGS = /<(script|style)[^>]*>.*?<\/\1>/gis;
|
|
15820
16477
|
var STRIP = /<[^>]+>/g;
|
|
@@ -16135,7 +16792,9 @@ var HttpTool = class _HttpTool {
|
|
|
16135
16792
|
const okStatus = o.ok_status ?? [
|
|
16136
16793
|
[200, 200]
|
|
16137
16794
|
];
|
|
16138
|
-
if (!okStatus.some(
|
|
16795
|
+
if (!okStatus.some(
|
|
16796
|
+
([low, high]) => response.status >= low && response.status <= high
|
|
16797
|
+
)) {
|
|
16139
16798
|
const expected = okStatus.map(([low, high]) => low === high ? String(low) : `${low}-${high}`).join(", ");
|
|
16140
16799
|
throw new LiveToolError(
|
|
16141
16800
|
`${this.spec.name}: ${url} answered HTTP ${response.status} (ok_status ${expected}): ${JSON.stringify(body.slice(0, 200))}`,
|
|
@@ -16186,7 +16845,8 @@ function readConnection(root) {
|
|
|
16186
16845
|
if (!fs16.existsSync(file)) throw new Error(`no connector.toml at ${root}`);
|
|
16187
16846
|
const raw = parseToml(fs16.readFileSync(file, "utf8"));
|
|
16188
16847
|
const connector = raw.connector ?? {};
|
|
16189
|
-
const auth = raw.auth ?? {};
|
|
16848
|
+
const auth = raw.auth ?? { scheme: "none" };
|
|
16849
|
+
const carrier = vendorAuth(auth);
|
|
16190
16850
|
const operations = {};
|
|
16191
16851
|
for (const op of raw.operations ?? []) {
|
|
16192
16852
|
operations[op.name] = {
|
|
@@ -16200,8 +16860,8 @@ function readConnection(root) {
|
|
|
16200
16860
|
return {
|
|
16201
16861
|
slug: connector.slug ?? path15.basename(root),
|
|
16202
16862
|
baseUrl: (connector.base_url ?? "").replace(/\/+$/, ""),
|
|
16203
|
-
scheme:
|
|
16204
|
-
|
|
16863
|
+
scheme: carrier.scheme,
|
|
16864
|
+
carrier,
|
|
16205
16865
|
...typeof auth.secret_env === "string" ? { secretEnv: auth.secret_env } : {},
|
|
16206
16866
|
...typeof auth.client_id_env === "string" ? { clientIdEnv: auth.client_id_env } : {},
|
|
16207
16867
|
...typeof auth.token_url === "string" ? { tokenUrl: auth.token_url } : {},
|
|
@@ -16313,13 +16973,9 @@ var ConnectorTool = class {
|
|
|
16313
16973
|
};
|
|
16314
16974
|
for (const [header, variable] of Object.entries(c.extraHeaders))
|
|
16315
16975
|
headers[header] = this.env(variable, `the ${header} header`);
|
|
16316
|
-
const
|
|
16317
|
-
|
|
16318
|
-
|
|
16319
|
-
headers.authorization = `Bearer ${secret}`;
|
|
16320
|
-
else if (c.scheme === "basic")
|
|
16321
|
-
headers.authorization = "Basic " + Buffer.from(secret ?? "").toString("base64");
|
|
16322
|
-
else if (c.scheme === "query") query.append(c.authName ?? "", secret ?? "");
|
|
16976
|
+
const carried2 = carryCredential(c.carrier, await this.credential() ?? "");
|
|
16977
|
+
Object.assign(headers, carried2.headers);
|
|
16978
|
+
for (const [key2, value] of carried2.query) query.append(key2, value);
|
|
16323
16979
|
const url = c.baseUrl + pathText + (query.toString() ? `?${query.toString()}` : "");
|
|
16324
16980
|
const response = await fetch(url, {
|
|
16325
16981
|
method: this.operation.method,
|
|
@@ -16794,7 +17450,7 @@ var RedactionAudit = class _RedactionAudit {
|
|
|
16794
17450
|
};
|
|
16795
17451
|
|
|
16796
17452
|
// src/hooks/run.ts
|
|
16797
|
-
var
|
|
17453
|
+
var import_node_crypto15 = require("crypto");
|
|
16798
17454
|
var fs17 = __toESM(require("fs"));
|
|
16799
17455
|
var path16 = __toESM(require("path"));
|
|
16800
17456
|
var BLOCKING_EVENTS = [
|
|
@@ -16838,7 +17494,7 @@ var HookRun = class _HookRun {
|
|
|
16838
17494
|
source;
|
|
16839
17495
|
constructor(config, options) {
|
|
16840
17496
|
this.config = config;
|
|
16841
|
-
this.runId = options.runId ?? `run-${(0,
|
|
17497
|
+
this.runId = options.runId ?? `run-${(0, import_node_crypto15.randomBytes)(6).toString("hex")}`;
|
|
16842
17498
|
this.runKey = options.runKey ?? newRunKey();
|
|
16843
17499
|
this.alias = new AliasMap(this.runKey, options.slugs ?? config.aliasSlugs, {
|
|
16844
17500
|
publicLayerWins: config.aliasPublicLayerWins,
|
|
@@ -17846,6 +18502,7 @@ var tracing = {
|
|
|
17846
18502
|
NativeComputer,
|
|
17847
18503
|
OpenAIComputer,
|
|
17848
18504
|
OpenAIPreviewComputer,
|
|
18505
|
+
PLATFORM_SESSION_HEADER,
|
|
17849
18506
|
PLATFORM_TIMEOUT_DEFAULT_MS,
|
|
17850
18507
|
PLATFORM_TIMEOUT_ENV,
|
|
17851
18508
|
PendingSafetyChecks,
|
|
@@ -17856,6 +18513,9 @@ var tracing = {
|
|
|
17856
18513
|
PushSlugConflict,
|
|
17857
18514
|
RECOVER_BUDGET_MS,
|
|
17858
18515
|
REPLAY_ENVIRONMENT,
|
|
18516
|
+
REQUESTS_NOT_RECORDED,
|
|
18517
|
+
REQUEST_BODY_CAPTURE_BYTES,
|
|
18518
|
+
REQUEST_LOG_PAGE_MAX,
|
|
17859
18519
|
ReplayCase,
|
|
17860
18520
|
ReplayCheck,
|
|
17861
18521
|
ReplayError,
|
|
@@ -17863,8 +18523,16 @@ var tracing = {
|
|
|
17863
18523
|
ReplaySuite,
|
|
17864
18524
|
ReplayTask,
|
|
17865
18525
|
RetryPolicy,
|
|
18526
|
+
SANDBOX_EXEC_REPORT_MARGIN_MS,
|
|
18527
|
+
SANDBOX_EXEC_START_ATTEMPTS,
|
|
18528
|
+
SANDBOX_EXEC_TIMEOUT_MAX_S,
|
|
18529
|
+
SANDBOX_EXEC_WAIT_MS,
|
|
18530
|
+
SANDBOX_FILE_MAX_BYTES,
|
|
17866
18531
|
SANDBOX_REQUEST_TIMEOUT_MS,
|
|
18532
|
+
SANDBOX_WRITE_CHUNK_BYTES,
|
|
18533
|
+
SANDBOX_WRITE_SKIPPED,
|
|
17867
18534
|
SECRET_KEY,
|
|
18535
|
+
SESSION_AUTH_MODES,
|
|
17868
18536
|
SESSION_STATES,
|
|
17869
18537
|
SPAN_PREFIX,
|
|
17870
18538
|
STATUS_WAIT_CAP_SECONDS,
|
|
@@ -17884,6 +18552,7 @@ var tracing = {
|
|
|
17884
18552
|
TOOL_CONTRACT_UNREAD,
|
|
17885
18553
|
TRANSFORMS,
|
|
17886
18554
|
TaskEditClient,
|
|
18555
|
+
TaskGrades,
|
|
17887
18556
|
TaskRun,
|
|
17888
18557
|
TaskSessions,
|
|
17889
18558
|
ToolStubRegistry,
|
|
@@ -17894,11 +18563,16 @@ var tracing = {
|
|
|
17894
18563
|
UsersClient,
|
|
17895
18564
|
VERIFIER_REWARD_PREFIX,
|
|
17896
18565
|
WHITESPACE,
|
|
18566
|
+
WORLD_REQUEST_VIAS,
|
|
17897
18567
|
WorldBrowser,
|
|
17898
18568
|
WorldCallTooLarge,
|
|
17899
18569
|
WorldEditClient,
|
|
17900
18570
|
WorldNotice,
|
|
18571
|
+
WorldRequestFilterError,
|
|
18572
|
+
WorldRequestLedger,
|
|
17901
18573
|
WorldRequestLog,
|
|
18574
|
+
WorldRequestQuery,
|
|
18575
|
+
WorldRequestsNotRecorded,
|
|
17902
18576
|
WorldSandboxClient,
|
|
17903
18577
|
WorldSession,
|
|
17904
18578
|
WorldSessionCallError,
|
|
@@ -17908,6 +18582,7 @@ var tracing = {
|
|
|
17908
18582
|
WorldSurfaceUnavailable,
|
|
17909
18583
|
WorldTask,
|
|
17910
18584
|
WorldToolsUnread,
|
|
18585
|
+
WriteTreeFilter,
|
|
17911
18586
|
addExperimentAttributes,
|
|
17912
18587
|
aggregateTaskGrade,
|
|
17913
18588
|
apiRequest,
|
|
@@ -17915,6 +18590,7 @@ var tracing = {
|
|
|
17915
18590
|
archiveMode,
|
|
17916
18591
|
assembleManifest,
|
|
17917
18592
|
assertBrowserTier,
|
|
18593
|
+
assertSessionAuthMode,
|
|
17918
18594
|
assertTaskRef,
|
|
17919
18595
|
assignVariant,
|
|
17920
18596
|
attachManifest,
|
|
@@ -17924,7 +18600,9 @@ var tracing = {
|
|
|
17924
18600
|
buildFileManifest,
|
|
17925
18601
|
buildSourceTarball,
|
|
17926
18602
|
canonicalJson,
|
|
18603
|
+
capabilityLabel,
|
|
17927
18604
|
captureToolCalls,
|
|
18605
|
+
carriedWarnings,
|
|
17928
18606
|
checkoutIdentity,
|
|
17929
18607
|
clearExperimentContext,
|
|
17930
18608
|
closeConnection,
|
|
@@ -17960,7 +18638,9 @@ var tracing = {
|
|
|
17960
18638
|
idleWarning,
|
|
17961
18639
|
ingest,
|
|
17962
18640
|
ingestToolCalls,
|
|
18641
|
+
invalidFields,
|
|
17963
18642
|
isBrowserGone,
|
|
18643
|
+
isSandboxCommitPending,
|
|
17964
18644
|
isSandboxImportPending,
|
|
17965
18645
|
isTaskIdRef,
|
|
17966
18646
|
isTaskManifest,
|
|
@@ -18017,6 +18697,7 @@ var tracing = {
|
|
|
18017
18697
|
resolvePushSlug,
|
|
18018
18698
|
resolveUserId,
|
|
18019
18699
|
roundForm,
|
|
18700
|
+
rowsRefusal,
|
|
18020
18701
|
runSessions,
|
|
18021
18702
|
runSet,
|
|
18022
18703
|
runSuite,
|
|
@@ -18056,6 +18737,7 @@ var tracing = {
|
|
|
18056
18737
|
validateWorld,
|
|
18057
18738
|
waitForRun,
|
|
18058
18739
|
withoutUiToken,
|
|
18740
|
+
worldRequestsUnrecorded,
|
|
18059
18741
|
writeLocalMeta
|
|
18060
18742
|
});
|
|
18061
18743
|
//# sourceMappingURL=index.js.map
|