@withgateway/sdk 0.3.1 → 0.3.3
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 +2880 -2032
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2982 -2135
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.d.mts +1 -1
- package/dist/files/index.d.ts +1 -1
- package/dist/files/index.js +180 -41
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +172 -35
- package/dist/files/index.mjs.map +1 -1
- package/dist/{index-CBqbB_0J.d.ts → index-DUHmS74p.d.ts} +1 -1
- package/dist/{index-D-AMnAMa.d.mts → index-mJhG3vZU.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1309 -540
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1287 -532
- package/dist/index.mjs.map +1 -1
- package/dist/{media-CbcAfQvd.d.mts → media-BIApiPzS.d.mts} +21 -2
- package/dist/{media-CbcAfQvd.d.ts → media-BIApiPzS.d.ts} +21 -2
- package/dist/traces/index.d.mts +1 -1
- package/dist/traces/index.d.ts +1 -1
- package/dist/traces/index.js +177 -38
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +169 -32
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.d.mts +2 -2
- package/dist/tracing/index.d.ts +2 -2
- package/dist/tracing/index.js +69 -13
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +69 -13
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +249 -120
- package/dist/worlds/index.d.ts +249 -120
- package/dist/worlds/index.js +1240 -484
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +1231 -476
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/gatewaysdk/environment/_bundle.py +2 -27
- package/runtime/gatewaysdk/environment/_materialize.py +49 -69
- package/runtime/gatewaysdk/environment/_world.py +122 -197
- package/runtime/gatewaysdk/environment/backing.py +137 -0
- package/runtime/gatewaysdk/environment/core.py +1 -1
- package/runtime/gatewaysdk/environment/legacy_sqlite.py +301 -0
- package/runtime/gatewaysdk/environment/reward_keys.py +25 -0
- package/runtime/gatewaysdk/environment/runtime.py +8 -13
- package/runtime/gatewaysdk/environment/schema/__init__.py +4 -4
- package/runtime/gatewaysdk/environment/schema/admin_routes.py +86 -0
- package/runtime/gatewaysdk/environment/schema/api.py +266 -514
- package/runtime/gatewaysdk/environment/schema/batch.py +42 -37
- package/runtime/gatewaysdk/environment/schema/bundle_runtime.py +17 -5
- package/runtime/gatewaysdk/environment/schema/call_log.py +291 -0
- package/runtime/gatewaysdk/environment/schema/call_redaction.py +344 -0
- package/runtime/gatewaysdk/environment/schema/compiler.py +334 -158
- package/runtime/gatewaysdk/environment/schema/conform.py +8 -12
- package/runtime/gatewaysdk/environment/schema/connector.py +27 -62
- package/runtime/gatewaysdk/environment/schema/data.py +50 -207
- package/runtime/gatewaysdk/environment/schema/database/__init__.py +24 -0
- package/runtime/gatewaysdk/environment/schema/database/audit.py +121 -0
- package/runtime/gatewaysdk/environment/schema/database/base.py +995 -0
- package/runtime/gatewaysdk/environment/schema/database/budget.py +33 -0
- package/runtime/gatewaysdk/environment/schema/database/connections.py +101 -0
- package/runtime/gatewaysdk/environment/schema/database/engines.py +8 -0
- package/runtime/gatewaysdk/environment/schema/database/guard.py +208 -0
- package/runtime/gatewaysdk/environment/schema/database/ingest.py +154 -0
- package/runtime/gatewaysdk/environment/schema/database/matching.py +58 -0
- package/runtime/gatewaysdk/environment/schema/database/provenance.py +30 -0
- package/runtime/gatewaysdk/environment/schema/database/rows.py +53 -0
- package/runtime/gatewaysdk/environment/schema/database/runtime_rows.py +39 -0
- package/runtime/gatewaysdk/environment/schema/database/sqlite.py +367 -0
- package/runtime/gatewaysdk/environment/schema/domain_migration.py +236 -0
- package/runtime/gatewaysdk/environment/schema/envelope.py +169 -0
- package/runtime/gatewaysdk/environment/schema/extract.py +6 -13
- package/runtime/gatewaysdk/environment/schema/grading.py +45 -30
- package/runtime/gatewaysdk/environment/schema/handler_errors.py +142 -12
- package/runtime/gatewaysdk/environment/schema/host.py +158 -250
- package/runtime/gatewaysdk/environment/schema/lanes.py +53 -0
- package/runtime/gatewaysdk/environment/schema/local.py +44 -71
- package/runtime/gatewaysdk/environment/schema/mapping.py +5 -25
- package/runtime/gatewaysdk/environment/schema/openapi_import.py +112 -73
- package/runtime/gatewaysdk/environment/schema/openapi_paging.py +147 -0
- package/runtime/gatewaysdk/environment/schema/openapi_payloads.py +288 -0
- package/runtime/gatewaysdk/environment/schema/openapi_routes.py +97 -102
- package/runtime/gatewaysdk/environment/schema/openapi_schemas.py +113 -30
- package/runtime/gatewaysdk/environment/schema/platform.py +123 -171
- package/runtime/gatewaysdk/environment/schema/platform_import.py +2 -3
- package/runtime/gatewaysdk/environment/schema/platform_query.py +61 -5
- package/runtime/gatewaysdk/environment/schema/primary_key.py +61 -0
- package/runtime/gatewaysdk/environment/schema/proof.py +19 -12
- package/runtime/gatewaysdk/environment/schema/runtime.py +77 -160
- package/runtime/gatewaysdk/environment/schema/served_names.py +58 -0
- package/runtime/gatewaysdk/environment/schema/session_files.py +166 -0
- package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +2 -2
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +19 -11
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +29 -3
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +14 -14
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +12 -12
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +3 -2
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +15 -0
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/openapi-import.md +50 -21
- package/runtime/gatewaysdk/environment/schema/slack.py +4 -8
- package/runtime/gatewaysdk/environment/schema/snapshot.py +385 -129
- package/runtime/gatewaysdk/environment/schema/store_contract.py +8 -14
- package/runtime/gatewaysdk/environment/schema/tasks.py +140 -55
- package/runtime/gatewaysdk/environment/schema/tools_world.py +110 -87
- package/runtime/gatewaysdk/environment/schema/ui.py +24 -5
- package/runtime/gatewaysdk/environment/schema/ui_static/app.js +100 -130
- package/runtime/gatewaysdk/environment/schema/ui_static/index.html +1 -8
- package/runtime/gatewaysdk/environment/schema/validation.py +166 -40
- package/runtime/gatewaysdk/environment/schema/workers.py +142 -57
- package/runtime/gatewaysdk/environment/schema/world_sql.py +81 -0
- package/runtime/gatewaysdk/environment/schema/world_tests.py +71 -39
- package/runtime/gatewaysdk/environment/score.py +57 -0
- package/runtime/gatewaysdk/environment/secret_values.py +36 -0
- package/runtime/gatewaysdk/environment/world.py +42 -3
- package/runtime/gatewaysdk/environment/world_session_contract.py +32 -5
- package/skills/benchmarks-getting-started/SKILL.md +2 -2
- package/skills/connector-schema-authoring/SKILL.md +19 -11
- package/skills/connector-schema-authoring/connector-worlds.md +13 -4
- package/skills/connector-schema-authoring/world-schema.md +103 -51
- package/skills/world-data-ingestion/ROWS.md +29 -3
- package/skills/world-data-ingestion/SKILL.md +14 -14
- package/skills/worlds-getting-started/SKILL.md +12 -12
- package/skills/worlds-getting-started/references/cli-mcp-map.md +3 -2
- package/skills/worlds-getting-started/references/gotchas.md +15 -0
- package/skills/worlds-getting-started/references/openapi-import.md +50 -21
- package/runtime/gatewaysdk/environment/schema/store.py +0 -1013
package/dist/files/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '../worlds/index.mjs';
|
|
2
2
|
export { D as DRIVE_PREFIX, a as DriveDownload, b as DriveFile, c as DriveFolder, d as DriveListing, F as FetchHeader, e as FetchToDriveOptions, f as FetchToDriveResult, g as FileConnector, U as UploadOptions, h as UploadResult, j as confirmUpload, k as contentTypeFor, l as createFolder, m as deleteFile, n as downloadFile, o as drivePath, p as fetchToDrive, q as getFile, r as isDriveRef, s as iterateFiles, t as listFileConnectors, u as listFiles, v as moveFile, w as readFile, x as requestUpload, y as sha256Base64, z as syncFileConnector, A as uploadBytes, B as uploadFile } from '../index-FfK4Nump.mjs';
|
|
3
|
-
import '../media-
|
|
3
|
+
import '../media-BIApiPzS.mjs';
|
package/dist/files/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '../worlds/index.js';
|
|
2
2
|
export { D as DRIVE_PREFIX, a as DriveDownload, b as DriveFile, c as DriveFolder, d as DriveListing, F as FetchHeader, e as FetchToDriveOptions, f as FetchToDriveResult, g as FileConnector, U as UploadOptions, h as UploadResult, j as confirmUpload, k as contentTypeFor, l as createFolder, m as deleteFile, n as downloadFile, o as drivePath, p as fetchToDrive, q as getFile, r as isDriveRef, s as iterateFiles, t as listFileConnectors, u as listFiles, v as moveFile, w as readFile, x as requestUpload, y as sha256Base64, z as syncFileConnector, A as uploadBytes, B as uploadFile } from '../index-D-_4Ibcn.js';
|
|
3
|
-
import '../media-
|
|
3
|
+
import '../media-BIApiPzS.js';
|
package/dist/files/index.js
CHANGED
|
@@ -35,6 +35,28 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
35
|
));
|
|
36
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
37
|
|
|
38
|
+
// src/worlds/platformEndpoint.ts
|
|
39
|
+
function platformEndpoint(options) {
|
|
40
|
+
const publicKey = options.publicKey ?? process.env.GATEWAY_PUBLIC_KEY;
|
|
41
|
+
const secretKey = options.secretKey ?? process.env.GATEWAY_SECRET_KEY;
|
|
42
|
+
if (!publicKey || !secretKey) return null;
|
|
43
|
+
const host = options.host ?? process.env.GATEWAY_HOST ?? DEFAULT_HOST;
|
|
44
|
+
return { host: host.replace(/\/+$/, ""), publicKey, secretKey };
|
|
45
|
+
}
|
|
46
|
+
function requirePlatformEndpoint(options) {
|
|
47
|
+
const endpoint = platformEndpoint(options);
|
|
48
|
+
if (!endpoint) throw new Error(GATEWAY_KEYS_MISSING);
|
|
49
|
+
return endpoint;
|
|
50
|
+
}
|
|
51
|
+
var DEFAULT_HOST, GATEWAY_KEYS_MISSING;
|
|
52
|
+
var init_platformEndpoint = __esm({
|
|
53
|
+
"src/worlds/platformEndpoint.ts"() {
|
|
54
|
+
"use strict";
|
|
55
|
+
DEFAULT_HOST = "https://withgateway.ai";
|
|
56
|
+
GATEWAY_KEYS_MISSING = "Gateway keys missing: set GATEWAY_PUBLIC_KEY / GATEWAY_SECRET_KEY (or pass publicKey/secretKey).";
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
38
60
|
// src/worlds/transport.ts
|
|
39
61
|
function platformTimeoutMs(env = process.env) {
|
|
40
62
|
const raw = env[PLATFORM_TIMEOUT_ENV];
|
|
@@ -43,7 +65,7 @@ function platformTimeoutMs(env = process.env) {
|
|
|
43
65
|
if (Number.isInteger(value) && value > 0) return value;
|
|
44
66
|
throw new Error(`${PLATFORM_TIMEOUT_ENV} must be a positive whole number of milliseconds, not \`${raw}\`.`);
|
|
45
67
|
}
|
|
46
|
-
var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, PlatformTransport;
|
|
68
|
+
var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, sleep, RetryPolicy, Attempt, PlatformTransport;
|
|
47
69
|
var init_transport = __esm({
|
|
48
70
|
"src/worlds/transport.ts"() {
|
|
49
71
|
"use strict";
|
|
@@ -105,6 +127,56 @@ var init_transport = __esm({
|
|
|
105
127
|
route;
|
|
106
128
|
failure;
|
|
107
129
|
};
|
|
130
|
+
sleep = (ms) => new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
131
|
+
RetryPolicy = class _RetryPolicy {
|
|
132
|
+
constructor(delaysMs, wait = sleep, budgetMs = Number.POSITIVE_INFINITY, now = Date.now) {
|
|
133
|
+
this.delaysMs = delaysMs;
|
|
134
|
+
this.wait = wait;
|
|
135
|
+
this.budgetMs = budgetMs;
|
|
136
|
+
this.now = now;
|
|
137
|
+
}
|
|
138
|
+
delaysMs;
|
|
139
|
+
wait;
|
|
140
|
+
budgetMs;
|
|
141
|
+
now;
|
|
142
|
+
static NONE = new _RetryPolicy([]);
|
|
143
|
+
/** A platform restart or a short edge outage: no wait starts that would end past five minutes, so a step ends
|
|
144
|
+
* within the budget plus one request timeout. */
|
|
145
|
+
static FILING = new _RetryPolicy([250, 500, 1e3, 2e3, 4e3, 8e3, 16e3, 3e4], sleep, 3e5);
|
|
146
|
+
static TRANSIENT_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
147
|
+
async run(attempt) {
|
|
148
|
+
const started = this.now();
|
|
149
|
+
for (let tries = 0; ; tries += 1) {
|
|
150
|
+
const outcome = await Attempt.of(attempt);
|
|
151
|
+
const delayMs = this.delaysMs[tries];
|
|
152
|
+
const spent = delayMs === void 0 || this.now() - started + delayMs >= this.budgetMs;
|
|
153
|
+
if (!outcome.transient || spent) return outcome.settle();
|
|
154
|
+
await this.wait(delayMs);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
Attempt = class _Attempt {
|
|
159
|
+
constructor(reply, error, transient) {
|
|
160
|
+
this.reply = reply;
|
|
161
|
+
this.error = error;
|
|
162
|
+
this.transient = transient;
|
|
163
|
+
}
|
|
164
|
+
reply;
|
|
165
|
+
error;
|
|
166
|
+
transient;
|
|
167
|
+
static async of(attempt) {
|
|
168
|
+
try {
|
|
169
|
+
const reply = await attempt();
|
|
170
|
+
return new _Attempt(reply, null, RetryPolicy.TRANSIENT_STATUSES.has(reply.status));
|
|
171
|
+
} catch (error) {
|
|
172
|
+
return new _Attempt(null, error, error instanceof UnreachableError);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
settle() {
|
|
176
|
+
if (this.reply) return this.reply;
|
|
177
|
+
throw this.error;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
108
180
|
PlatformTransport = class {
|
|
109
181
|
constructor(endpoint, timeoutMs = platformTimeoutMs()) {
|
|
110
182
|
this.endpoint = endpoint;
|
|
@@ -118,6 +190,9 @@ var init_transport = __esm({
|
|
|
118
190
|
}
|
|
119
191
|
async send(method, route, body, opts = {}) {
|
|
120
192
|
const timeoutMs = this.budget(opts.timeoutMs);
|
|
193
|
+
return (opts.retry ?? RetryPolicy.NONE).run(() => this.once(method, route, body, timeoutMs));
|
|
194
|
+
}
|
|
195
|
+
async once(method, route, body, timeoutMs) {
|
|
121
196
|
const payload = body === void 0 ? {} : { body: JSON.stringify(body) };
|
|
122
197
|
const controller = new AbortController();
|
|
123
198
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -490,13 +565,13 @@ var init_screen = __esm({
|
|
|
490
565
|
});
|
|
491
566
|
}
|
|
492
567
|
async drag(action) {
|
|
493
|
-
const
|
|
494
|
-
if (
|
|
568
|
+
const path9 = action.args.path ?? [];
|
|
569
|
+
if (path9.length < 2) throw new Error("a drag needs at least two points");
|
|
495
570
|
return this.held(action.args.modifiers ?? [], async () => {
|
|
496
|
-
await this.moveTo(
|
|
571
|
+
await this.moveTo(path9[0]);
|
|
497
572
|
await this.page.mouse.down({ button: "left" });
|
|
498
573
|
try {
|
|
499
|
-
for (const point2 of
|
|
574
|
+
for (const point2 of path9.slice(1)) await this.moveTo(point2, DRAG_STEPS);
|
|
500
575
|
} finally {
|
|
501
576
|
await this.page.mouse.up({ button: "left" });
|
|
502
577
|
}
|
|
@@ -587,7 +662,7 @@ var init_media = __esm({
|
|
|
587
662
|
put;
|
|
588
663
|
maxBytes;
|
|
589
664
|
/** The uploader for `GATEWAY_HOST` / `GATEWAY_PUBLIC_KEY` /
|
|
590
|
-
* `GATEWAY_SECRET_KEY`
|
|
665
|
+
* `GATEWAY_SECRET_KEY` only; null when any is unset, so a run traced with a saved login uploads none. */
|
|
591
666
|
static fromEnv(env = process.env) {
|
|
592
667
|
const host = env.GATEWAY_HOST;
|
|
593
668
|
const publicKey = env.GATEWAY_PUBLIC_KEY;
|
|
@@ -1455,6 +1530,15 @@ var init_sessionContract = __esm({
|
|
|
1455
1530
|
}
|
|
1456
1531
|
});
|
|
1457
1532
|
|
|
1533
|
+
// src/worlds/sessionReadiness.ts
|
|
1534
|
+
var READY_TIMEOUT_MS;
|
|
1535
|
+
var init_sessionReadiness = __esm({
|
|
1536
|
+
"src/worlds/sessionReadiness.ts"() {
|
|
1537
|
+
"use strict";
|
|
1538
|
+
READY_TIMEOUT_MS = 10 * 6e4;
|
|
1539
|
+
}
|
|
1540
|
+
});
|
|
1541
|
+
|
|
1458
1542
|
// src/tracing/session.ts
|
|
1459
1543
|
var import_async_hooks, processStorage, currentSessionStorage, currentWorldSessionStorage;
|
|
1460
1544
|
var init_session = __esm({
|
|
@@ -1479,8 +1563,22 @@ var init_taskRef = __esm({
|
|
|
1479
1563
|
}
|
|
1480
1564
|
});
|
|
1481
1565
|
|
|
1566
|
+
// src/worlds/worldNotice.ts
|
|
1567
|
+
var init_worldNotice = __esm({
|
|
1568
|
+
"src/worlds/worldNotice.ts"() {
|
|
1569
|
+
"use strict";
|
|
1570
|
+
}
|
|
1571
|
+
});
|
|
1572
|
+
|
|
1573
|
+
// src/worlds/grade.ts
|
|
1574
|
+
var init_grade = __esm({
|
|
1575
|
+
"src/worlds/grade.ts"() {
|
|
1576
|
+
"use strict";
|
|
1577
|
+
}
|
|
1578
|
+
});
|
|
1579
|
+
|
|
1482
1580
|
// src/worlds/session.ts
|
|
1483
|
-
var import_node_crypto2,
|
|
1581
|
+
var import_node_crypto2, CALL_TIMEOUT_MS, JUDGED_GRADE_TIMEOUT_MS;
|
|
1484
1582
|
var init_session2 = __esm({
|
|
1485
1583
|
"src/worlds/session.ts"() {
|
|
1486
1584
|
"use strict";
|
|
@@ -1489,10 +1587,13 @@ var init_session2 = __esm({
|
|
|
1489
1587
|
init_browser();
|
|
1490
1588
|
init_nativeComputer();
|
|
1491
1589
|
init_sessionContract();
|
|
1590
|
+
init_sessionReadiness();
|
|
1492
1591
|
init_session();
|
|
1493
1592
|
init_taskRef();
|
|
1593
|
+
init_worldNotice();
|
|
1594
|
+
init_grade();
|
|
1494
1595
|
init_taskRef();
|
|
1495
|
-
|
|
1596
|
+
init_sessionReadiness();
|
|
1496
1597
|
CALL_TIMEOUT_MS = 3 * 6e4;
|
|
1497
1598
|
JUDGED_GRADE_TIMEOUT_MS = 15 * 6e4;
|
|
1498
1599
|
}
|
|
@@ -1528,6 +1629,7 @@ var init_taskSessions = __esm({
|
|
|
1528
1629
|
"use strict";
|
|
1529
1630
|
init_worlds();
|
|
1530
1631
|
init_browser();
|
|
1632
|
+
init_grade();
|
|
1531
1633
|
init_surfaceDescriptor();
|
|
1532
1634
|
init_session2();
|
|
1533
1635
|
}
|
|
@@ -1538,13 +1640,52 @@ var init_evals = __esm({
|
|
|
1538
1640
|
"src/worlds/evals.ts"() {
|
|
1539
1641
|
"use strict";
|
|
1540
1642
|
init_worlds();
|
|
1643
|
+
init_transport();
|
|
1644
|
+
}
|
|
1645
|
+
});
|
|
1646
|
+
|
|
1647
|
+
// src/worlds/runSignals.ts
|
|
1648
|
+
var import_node_os;
|
|
1649
|
+
var init_runSignals = __esm({
|
|
1650
|
+
"src/worlds/runSignals.ts"() {
|
|
1651
|
+
"use strict";
|
|
1652
|
+
import_node_os = require("os");
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
|
|
1656
|
+
// src/worlds/taskRunDir.ts
|
|
1657
|
+
var fs, path;
|
|
1658
|
+
var init_taskRunDir = __esm({
|
|
1659
|
+
"src/worlds/taskRunDir.ts"() {
|
|
1660
|
+
"use strict";
|
|
1661
|
+
fs = __toESM(require("fs"));
|
|
1662
|
+
path = __toESM(require("path"));
|
|
1663
|
+
init_browser();
|
|
1664
|
+
}
|
|
1665
|
+
});
|
|
1666
|
+
|
|
1667
|
+
// src/worlds/taskRunOutcome.ts
|
|
1668
|
+
var init_taskRunOutcome = __esm({
|
|
1669
|
+
"src/worlds/taskRunOutcome.ts"() {
|
|
1670
|
+
"use strict";
|
|
1671
|
+
init_grade();
|
|
1672
|
+
init_taskSessions();
|
|
1541
1673
|
}
|
|
1542
1674
|
});
|
|
1543
1675
|
|
|
1544
1676
|
// src/tracing/prerequisites.ts
|
|
1677
|
+
var OPENTELEMETRY_PEERS, PINNED_PEERS;
|
|
1545
1678
|
var init_prerequisites = __esm({
|
|
1546
1679
|
"src/tracing/prerequisites.ts"() {
|
|
1547
1680
|
"use strict";
|
|
1681
|
+
OPENTELEMETRY_PEERS = {
|
|
1682
|
+
"@opentelemetry/api": "1.9.0",
|
|
1683
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.222.0",
|
|
1684
|
+
"@opentelemetry/resources": "2.11.0",
|
|
1685
|
+
"@opentelemetry/sdk-trace-base": "2.11.0",
|
|
1686
|
+
"@opentelemetry/sdk-trace-node": "2.11.0"
|
|
1687
|
+
};
|
|
1688
|
+
PINNED_PEERS = Object.entries(OPENTELEMETRY_PEERS).map(([name, version]) => `${name}@${version}`).join(" ");
|
|
1548
1689
|
}
|
|
1549
1690
|
});
|
|
1550
1691
|
|
|
@@ -1553,22 +1694,26 @@ var init_taskTracing = __esm({
|
|
|
1553
1694
|
"src/worlds/taskTracing.ts"() {
|
|
1554
1695
|
"use strict";
|
|
1555
1696
|
init_prerequisites();
|
|
1697
|
+
init_platformEndpoint();
|
|
1556
1698
|
}
|
|
1557
1699
|
});
|
|
1558
1700
|
|
|
1559
1701
|
// src/worlds/taskRun.ts
|
|
1560
|
-
var import_node_crypto3,
|
|
1702
|
+
var import_node_crypto3, path2;
|
|
1561
1703
|
var init_taskRun = __esm({
|
|
1562
1704
|
"src/worlds/taskRun.ts"() {
|
|
1563
1705
|
"use strict";
|
|
1564
1706
|
import_node_crypto3 = require("crypto");
|
|
1565
|
-
|
|
1566
|
-
path = __toESM(require("path"));
|
|
1707
|
+
path2 = __toESM(require("path"));
|
|
1567
1708
|
init_browser();
|
|
1568
1709
|
init_evals();
|
|
1710
|
+
init_runSignals();
|
|
1569
1711
|
init_session2();
|
|
1570
1712
|
init_taskSessions();
|
|
1713
|
+
init_taskRunDir();
|
|
1714
|
+
init_taskRunOutcome();
|
|
1571
1715
|
init_taskTracing();
|
|
1716
|
+
init_worldNotice();
|
|
1572
1717
|
}
|
|
1573
1718
|
});
|
|
1574
1719
|
|
|
@@ -1587,6 +1732,7 @@ var init_setRun = __esm({
|
|
|
1587
1732
|
"use strict";
|
|
1588
1733
|
init_worlds();
|
|
1589
1734
|
init_checkoutProvenance();
|
|
1735
|
+
init_runSignals();
|
|
1590
1736
|
init_taskRun();
|
|
1591
1737
|
}
|
|
1592
1738
|
});
|
|
@@ -1599,23 +1745,23 @@ var init_requestLog = __esm({
|
|
|
1599
1745
|
});
|
|
1600
1746
|
|
|
1601
1747
|
// src/worlds/checkoutTarget.ts
|
|
1602
|
-
var fs2,
|
|
1748
|
+
var fs2, path3;
|
|
1603
1749
|
var init_checkoutTarget = __esm({
|
|
1604
1750
|
"src/worlds/checkoutTarget.ts"() {
|
|
1605
1751
|
"use strict";
|
|
1606
1752
|
fs2 = __toESM(require("fs"));
|
|
1607
|
-
|
|
1753
|
+
path3 = __toESM(require("path"));
|
|
1608
1754
|
}
|
|
1609
1755
|
});
|
|
1610
1756
|
|
|
1611
1757
|
// src/worlds/worldDir.ts
|
|
1612
|
-
var import_node_crypto4, fs3,
|
|
1758
|
+
var import_node_crypto4, fs3, path4, CONNECTOR_SPEC, WORLD_SCHEMA_MARKERS, WORLD_ROOT_MARKERS;
|
|
1613
1759
|
var init_worldDir = __esm({
|
|
1614
1760
|
"src/worlds/worldDir.ts"() {
|
|
1615
1761
|
"use strict";
|
|
1616
1762
|
import_node_crypto4 = require("crypto");
|
|
1617
1763
|
fs3 = __toESM(require("fs"));
|
|
1618
|
-
|
|
1764
|
+
path4 = __toESM(require("path"));
|
|
1619
1765
|
CONNECTOR_SPEC = "connector.toml";
|
|
1620
1766
|
WORLD_SCHEMA_MARKERS = ["schema/world.json", "schema/runtime.json", "schema/lock.json"];
|
|
1621
1767
|
WORLD_ROOT_MARKERS = [CONNECTOR_SPEC, ...WORLD_SCHEMA_MARKERS];
|
|
@@ -1623,30 +1769,30 @@ var init_worldDir = __esm({
|
|
|
1623
1769
|
});
|
|
1624
1770
|
|
|
1625
1771
|
// src/worlds/tar.ts
|
|
1626
|
-
var fs4,
|
|
1772
|
+
var fs4, path5, import_node_zlib;
|
|
1627
1773
|
var init_tar = __esm({
|
|
1628
1774
|
"src/worlds/tar.ts"() {
|
|
1629
1775
|
"use strict";
|
|
1630
1776
|
fs4 = __toESM(require("fs"));
|
|
1631
|
-
|
|
1777
|
+
path5 = __toESM(require("path"));
|
|
1632
1778
|
import_node_zlib = require("zlib");
|
|
1633
1779
|
}
|
|
1634
1780
|
});
|
|
1635
1781
|
|
|
1636
1782
|
// src/worlds/hub.ts
|
|
1637
|
-
var import_node_crypto5, import_node_zlib2, fs5,
|
|
1783
|
+
var import_node_crypto5, import_node_zlib2, fs5, path6, META_RELPATH;
|
|
1638
1784
|
var init_hub = __esm({
|
|
1639
1785
|
"src/worlds/hub.ts"() {
|
|
1640
1786
|
"use strict";
|
|
1641
1787
|
import_node_crypto5 = require("crypto");
|
|
1642
1788
|
import_node_zlib2 = require("zlib");
|
|
1643
1789
|
fs5 = __toESM(require("fs"));
|
|
1644
|
-
|
|
1790
|
+
path6 = __toESM(require("path"));
|
|
1645
1791
|
init_worlds();
|
|
1646
1792
|
init_checkoutTarget();
|
|
1647
1793
|
init_worldDir();
|
|
1648
1794
|
init_tar();
|
|
1649
|
-
META_RELPATH =
|
|
1795
|
+
META_RELPATH = path6.join(".gateway", ".env-metadata.json");
|
|
1650
1796
|
}
|
|
1651
1797
|
});
|
|
1652
1798
|
|
|
@@ -1751,14 +1897,15 @@ var init_migrate = __esm({
|
|
|
1751
1897
|
});
|
|
1752
1898
|
|
|
1753
1899
|
// src/worlds/ingest.ts
|
|
1754
|
-
var fs6, os,
|
|
1900
|
+
var fs6, os, path7;
|
|
1755
1901
|
var init_ingest = __esm({
|
|
1756
1902
|
"src/worlds/ingest.ts"() {
|
|
1757
1903
|
"use strict";
|
|
1758
1904
|
fs6 = __toESM(require("fs"));
|
|
1759
1905
|
os = __toESM(require("os"));
|
|
1760
|
-
|
|
1906
|
+
path7 = __toESM(require("path"));
|
|
1761
1907
|
init_worlds();
|
|
1908
|
+
init_platformEndpoint();
|
|
1762
1909
|
}
|
|
1763
1910
|
});
|
|
1764
1911
|
|
|
@@ -1779,17 +1926,6 @@ var init_dryRun = __esm({
|
|
|
1779
1926
|
});
|
|
1780
1927
|
|
|
1781
1928
|
// src/worlds/index.ts
|
|
1782
|
-
function resolveEnv(options) {
|
|
1783
|
-
const host = options.host ?? process.env.GATEWAY_HOST ?? "https://withgateway.ai";
|
|
1784
|
-
const publicKey = options.publicKey ?? process.env.GATEWAY_PUBLIC_KEY;
|
|
1785
|
-
const secretKey = options.secretKey ?? process.env.GATEWAY_SECRET_KEY;
|
|
1786
|
-
if (!publicKey || !secretKey) {
|
|
1787
|
-
throw new Error(
|
|
1788
|
-
"Gateway keys missing: set GATEWAY_PUBLIC_KEY / GATEWAY_SECRET_KEY (or pass publicKey/secretKey)."
|
|
1789
|
-
);
|
|
1790
|
-
}
|
|
1791
|
-
return { host: host.replace(/\/+$/, ""), publicKey, secretKey };
|
|
1792
|
-
}
|
|
1793
1929
|
function parseErrorBody(text, limit = 600) {
|
|
1794
1930
|
const raw = { detail: text.slice(0, limit), code: null };
|
|
1795
1931
|
let parsed;
|
|
@@ -1809,18 +1945,20 @@ function parseErrorBody(text, limit = 600) {
|
|
|
1809
1945
|
code: stableCode
|
|
1810
1946
|
};
|
|
1811
1947
|
}
|
|
1812
|
-
async function apiRequest(options, method,
|
|
1813
|
-
const reply = await new PlatformTransport(
|
|
1814
|
-
if (!reply.ok) throw new ApiError(reply.status, method,
|
|
1948
|
+
async function apiRequest(options, method, path9, body, init = {}) {
|
|
1949
|
+
const reply = await new PlatformTransport(requirePlatformEndpoint(options)).send(method, path9, body, init);
|
|
1950
|
+
if (!reply.ok) throw new ApiError(reply.status, method, path9, reply.text);
|
|
1815
1951
|
return JSON.parse(reply.text);
|
|
1816
1952
|
}
|
|
1817
1953
|
var ApiError;
|
|
1818
1954
|
var init_worlds = __esm({
|
|
1819
1955
|
"src/worlds/index.ts"() {
|
|
1820
1956
|
"use strict";
|
|
1957
|
+
init_platformEndpoint();
|
|
1821
1958
|
init_transport();
|
|
1822
1959
|
init_transport();
|
|
1823
1960
|
init_session2();
|
|
1961
|
+
init_grade();
|
|
1824
1962
|
init_sessionList();
|
|
1825
1963
|
init_sessionContract();
|
|
1826
1964
|
init_taskRef();
|
|
@@ -1846,10 +1984,11 @@ var init_worlds = __esm({
|
|
|
1846
1984
|
init_sandbox();
|
|
1847
1985
|
init_editSessions();
|
|
1848
1986
|
init_dryRun();
|
|
1987
|
+
init_worldNotice();
|
|
1849
1988
|
ApiError = class extends Error {
|
|
1850
|
-
constructor(status, method,
|
|
1989
|
+
constructor(status, method, path9, text) {
|
|
1851
1990
|
const parsed = parseErrorBody(text);
|
|
1852
|
-
super(`${method} ${
|
|
1991
|
+
super(`${method} ${path9} -> ${status}: ${parsed.detail}`);
|
|
1853
1992
|
this.status = status;
|
|
1854
1993
|
this.text = text;
|
|
1855
1994
|
this.name = "ApiError";
|
|
@@ -1889,7 +2028,7 @@ __export(files_exports, {
|
|
|
1889
2028
|
module.exports = __toCommonJS(files_exports);
|
|
1890
2029
|
var import_node_crypto8 = require("crypto");
|
|
1891
2030
|
var fs7 = __toESM(require("fs"));
|
|
1892
|
-
var
|
|
2031
|
+
var path8 = __toESM(require("path"));
|
|
1893
2032
|
var import_node_stream = require("stream");
|
|
1894
2033
|
var import_promises = require("stream/promises");
|
|
1895
2034
|
init_worlds();
|
|
@@ -1941,7 +2080,7 @@ async function readFile(options = {}, filePath, limits = {}) {
|
|
|
1941
2080
|
async function downloadFile(options = {}, filePath, outPath, onProgress) {
|
|
1942
2081
|
const file = await getFile(options, filePath);
|
|
1943
2082
|
const res = await openDownload(file.url);
|
|
1944
|
-
fs7.mkdirSync(
|
|
2083
|
+
fs7.mkdirSync(path8.dirname(path8.resolve(outPath)), { recursive: true });
|
|
1945
2084
|
const source = import_node_stream.Readable.fromWeb(res.body);
|
|
1946
2085
|
await (0, import_promises.pipeline)(source, counting((n) => onProgress?.(n, file.sizeBytes)), fs7.createWriteStream(outPath));
|
|
1947
2086
|
return { ...file, out: outPath };
|
|
@@ -1990,7 +2129,7 @@ var CONTENT_TYPES = {
|
|
|
1990
2129
|
".mp4": "video/mp4"
|
|
1991
2130
|
};
|
|
1992
2131
|
function contentTypeFor(name) {
|
|
1993
|
-
return CONTENT_TYPES[
|
|
2132
|
+
return CONTENT_TYPES[path8.extname(name).toLowerCase()] ?? "application/octet-stream";
|
|
1994
2133
|
}
|
|
1995
2134
|
function counting(report) {
|
|
1996
2135
|
let seen = 0;
|