@withgateway/sdk 0.3.0 → 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 +6 -1
- package/dist/cli.js +3971 -2338
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +3950 -2318
- 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 +214 -41
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +206 -35
- package/dist/files/index.mjs.map +1 -1
- package/dist/{index-DAb-FCMg.d.ts → index-DUHmS74p.d.ts} +3 -13
- package/dist/{index-D6oi1TWE.d.mts → index-mJhG3vZU.d.mts} +3 -13
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1456 -564
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1433 -557
- 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 +211 -38
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +203 -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 +96 -21
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +96 -21
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +300 -123
- package/dist/worlds/index.d.ts +300 -123
- package/dist/worlds/index.js +1385 -508
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +1377 -501
- 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 -515
- 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/cast.py +31 -4
- 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 +124 -178
- 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 +22 -14
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +29 -3
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +16 -16
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +18 -18
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +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 +22 -14
- package/skills/connector-schema-authoring/connector-worlds.md +26 -10
- package/skills/connector-schema-authoring/world-schema.md +111 -51
- package/skills/world-data-ingestion/ROWS.md +29 -3
- package/skills/world-data-ingestion/SKILL.md +16 -16
- package/skills/worlds-getting-started/SKILL.md +18 -18
- 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/traces/index.mjs
CHANGED
|
@@ -16,6 +16,28 @@ var __esm = (fn, res, err) => function __init() {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
// src/worlds/platformEndpoint.ts
|
|
20
|
+
function platformEndpoint(options) {
|
|
21
|
+
const publicKey = options.publicKey ?? process.env.GATEWAY_PUBLIC_KEY;
|
|
22
|
+
const secretKey = options.secretKey ?? process.env.GATEWAY_SECRET_KEY;
|
|
23
|
+
if (!publicKey || !secretKey) return null;
|
|
24
|
+
const host = options.host ?? process.env.GATEWAY_HOST ?? DEFAULT_HOST;
|
|
25
|
+
return { host: host.replace(/\/+$/, ""), publicKey, secretKey };
|
|
26
|
+
}
|
|
27
|
+
function requirePlatformEndpoint(options) {
|
|
28
|
+
const endpoint = platformEndpoint(options);
|
|
29
|
+
if (!endpoint) throw new Error(GATEWAY_KEYS_MISSING);
|
|
30
|
+
return endpoint;
|
|
31
|
+
}
|
|
32
|
+
var DEFAULT_HOST, GATEWAY_KEYS_MISSING;
|
|
33
|
+
var init_platformEndpoint = __esm({
|
|
34
|
+
"src/worlds/platformEndpoint.ts"() {
|
|
35
|
+
"use strict";
|
|
36
|
+
DEFAULT_HOST = "https://withgateway.ai";
|
|
37
|
+
GATEWAY_KEYS_MISSING = "Gateway keys missing: set GATEWAY_PUBLIC_KEY / GATEWAY_SECRET_KEY (or pass publicKey/secretKey).";
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
19
41
|
// src/worlds/transport.ts
|
|
20
42
|
function platformTimeoutMs(env = process.env) {
|
|
21
43
|
const raw = env[PLATFORM_TIMEOUT_ENV];
|
|
@@ -24,7 +46,7 @@ function platformTimeoutMs(env = process.env) {
|
|
|
24
46
|
if (Number.isInteger(value) && value > 0) return value;
|
|
25
47
|
throw new Error(`${PLATFORM_TIMEOUT_ENV} must be a positive whole number of milliseconds, not \`${raw}\`.`);
|
|
26
48
|
}
|
|
27
|
-
var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, PlatformTransport;
|
|
49
|
+
var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, sleep, RetryPolicy, Attempt, PlatformTransport;
|
|
28
50
|
var init_transport = __esm({
|
|
29
51
|
"src/worlds/transport.ts"() {
|
|
30
52
|
"use strict";
|
|
@@ -86,6 +108,56 @@ var init_transport = __esm({
|
|
|
86
108
|
route;
|
|
87
109
|
failure;
|
|
88
110
|
};
|
|
111
|
+
sleep = (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
112
|
+
RetryPolicy = class _RetryPolicy {
|
|
113
|
+
constructor(delaysMs, wait = sleep, budgetMs = Number.POSITIVE_INFINITY, now = Date.now) {
|
|
114
|
+
this.delaysMs = delaysMs;
|
|
115
|
+
this.wait = wait;
|
|
116
|
+
this.budgetMs = budgetMs;
|
|
117
|
+
this.now = now;
|
|
118
|
+
}
|
|
119
|
+
delaysMs;
|
|
120
|
+
wait;
|
|
121
|
+
budgetMs;
|
|
122
|
+
now;
|
|
123
|
+
static NONE = new _RetryPolicy([]);
|
|
124
|
+
/** A platform restart or a short edge outage: no wait starts that would end past five minutes, so a step ends
|
|
125
|
+
* within the budget plus one request timeout. */
|
|
126
|
+
static FILING = new _RetryPolicy([250, 500, 1e3, 2e3, 4e3, 8e3, 16e3, 3e4], sleep, 3e5);
|
|
127
|
+
static TRANSIENT_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
128
|
+
async run(attempt) {
|
|
129
|
+
const started = this.now();
|
|
130
|
+
for (let tries = 0; ; tries += 1) {
|
|
131
|
+
const outcome = await Attempt.of(attempt);
|
|
132
|
+
const delayMs = this.delaysMs[tries];
|
|
133
|
+
const spent = delayMs === void 0 || this.now() - started + delayMs >= this.budgetMs;
|
|
134
|
+
if (!outcome.transient || spent) return outcome.settle();
|
|
135
|
+
await this.wait(delayMs);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
Attempt = class _Attempt {
|
|
140
|
+
constructor(reply, error, transient) {
|
|
141
|
+
this.reply = reply;
|
|
142
|
+
this.error = error;
|
|
143
|
+
this.transient = transient;
|
|
144
|
+
}
|
|
145
|
+
reply;
|
|
146
|
+
error;
|
|
147
|
+
transient;
|
|
148
|
+
static async of(attempt) {
|
|
149
|
+
try {
|
|
150
|
+
const reply = await attempt();
|
|
151
|
+
return new _Attempt(reply, null, RetryPolicy.TRANSIENT_STATUSES.has(reply.status));
|
|
152
|
+
} catch (error) {
|
|
153
|
+
return new _Attempt(null, error, error instanceof UnreachableError);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
settle() {
|
|
157
|
+
if (this.reply) return this.reply;
|
|
158
|
+
throw this.error;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
89
161
|
PlatformTransport = class {
|
|
90
162
|
constructor(endpoint, timeoutMs = platformTimeoutMs()) {
|
|
91
163
|
this.endpoint = endpoint;
|
|
@@ -99,6 +171,9 @@ var init_transport = __esm({
|
|
|
99
171
|
}
|
|
100
172
|
async send(method, route, body, opts = {}) {
|
|
101
173
|
const timeoutMs = this.budget(opts.timeoutMs);
|
|
174
|
+
return (opts.retry ?? RetryPolicy.NONE).run(() => this.once(method, route, body, timeoutMs));
|
|
175
|
+
}
|
|
176
|
+
async once(method, route, body, timeoutMs) {
|
|
102
177
|
const payload = body === void 0 ? {} : { body: JSON.stringify(body) };
|
|
103
178
|
const controller = new AbortController();
|
|
104
179
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -471,13 +546,13 @@ var init_screen = __esm({
|
|
|
471
546
|
});
|
|
472
547
|
}
|
|
473
548
|
async drag(action) {
|
|
474
|
-
const
|
|
475
|
-
if (
|
|
549
|
+
const path8 = action.args.path ?? [];
|
|
550
|
+
if (path8.length < 2) throw new Error("a drag needs at least two points");
|
|
476
551
|
return this.held(action.args.modifiers ?? [], async () => {
|
|
477
|
-
await this.moveTo(
|
|
552
|
+
await this.moveTo(path8[0]);
|
|
478
553
|
await this.page.mouse.down({ button: "left" });
|
|
479
554
|
try {
|
|
480
|
-
for (const point2 of
|
|
555
|
+
for (const point2 of path8.slice(1)) await this.moveTo(point2, DRAG_STEPS);
|
|
481
556
|
} finally {
|
|
482
557
|
await this.page.mouse.up({ button: "left" });
|
|
483
558
|
}
|
|
@@ -568,7 +643,7 @@ var init_media = __esm({
|
|
|
568
643
|
put;
|
|
569
644
|
maxBytes;
|
|
570
645
|
/** The uploader for `GATEWAY_HOST` / `GATEWAY_PUBLIC_KEY` /
|
|
571
|
-
* `GATEWAY_SECRET_KEY`
|
|
646
|
+
* `GATEWAY_SECRET_KEY` only; null when any is unset, so a run traced with a saved login uploads none. */
|
|
572
647
|
static fromEnv(env = process.env) {
|
|
573
648
|
const host = env.GATEWAY_HOST;
|
|
574
649
|
const publicKey = env.GATEWAY_PUBLIC_KEY;
|
|
@@ -1436,6 +1511,15 @@ var init_sessionContract = __esm({
|
|
|
1436
1511
|
}
|
|
1437
1512
|
});
|
|
1438
1513
|
|
|
1514
|
+
// src/worlds/sessionReadiness.ts
|
|
1515
|
+
var READY_TIMEOUT_MS;
|
|
1516
|
+
var init_sessionReadiness = __esm({
|
|
1517
|
+
"src/worlds/sessionReadiness.ts"() {
|
|
1518
|
+
"use strict";
|
|
1519
|
+
READY_TIMEOUT_MS = 10 * 6e4;
|
|
1520
|
+
}
|
|
1521
|
+
});
|
|
1522
|
+
|
|
1439
1523
|
// src/tracing/session.ts
|
|
1440
1524
|
import { AsyncLocalStorage } from "async_hooks";
|
|
1441
1525
|
var processStorage, currentSessionStorage, currentWorldSessionStorage;
|
|
@@ -1460,9 +1544,23 @@ var init_taskRef = __esm({
|
|
|
1460
1544
|
}
|
|
1461
1545
|
});
|
|
1462
1546
|
|
|
1547
|
+
// src/worlds/worldNotice.ts
|
|
1548
|
+
var init_worldNotice = __esm({
|
|
1549
|
+
"src/worlds/worldNotice.ts"() {
|
|
1550
|
+
"use strict";
|
|
1551
|
+
}
|
|
1552
|
+
});
|
|
1553
|
+
|
|
1554
|
+
// src/worlds/grade.ts
|
|
1555
|
+
var init_grade = __esm({
|
|
1556
|
+
"src/worlds/grade.ts"() {
|
|
1557
|
+
"use strict";
|
|
1558
|
+
}
|
|
1559
|
+
});
|
|
1560
|
+
|
|
1463
1561
|
// src/worlds/session.ts
|
|
1464
1562
|
import { randomUUID } from "crypto";
|
|
1465
|
-
var
|
|
1563
|
+
var CALL_TIMEOUT_MS, JUDGED_GRADE_TIMEOUT_MS;
|
|
1466
1564
|
var init_session2 = __esm({
|
|
1467
1565
|
"src/worlds/session.ts"() {
|
|
1468
1566
|
"use strict";
|
|
@@ -1470,10 +1568,13 @@ var init_session2 = __esm({
|
|
|
1470
1568
|
init_browser();
|
|
1471
1569
|
init_nativeComputer();
|
|
1472
1570
|
init_sessionContract();
|
|
1571
|
+
init_sessionReadiness();
|
|
1473
1572
|
init_session();
|
|
1474
1573
|
init_taskRef();
|
|
1574
|
+
init_worldNotice();
|
|
1575
|
+
init_grade();
|
|
1475
1576
|
init_taskRef();
|
|
1476
|
-
|
|
1577
|
+
init_sessionReadiness();
|
|
1477
1578
|
CALL_TIMEOUT_MS = 3 * 6e4;
|
|
1478
1579
|
JUDGED_GRADE_TIMEOUT_MS = 15 * 6e4;
|
|
1479
1580
|
}
|
|
@@ -1495,12 +1596,22 @@ var init_tasks = __esm({
|
|
|
1495
1596
|
}
|
|
1496
1597
|
});
|
|
1497
1598
|
|
|
1599
|
+
// src/worlds/surfaceDescriptor.ts
|
|
1600
|
+
var init_surfaceDescriptor = __esm({
|
|
1601
|
+
"src/worlds/surfaceDescriptor.ts"() {
|
|
1602
|
+
"use strict";
|
|
1603
|
+
init_browser();
|
|
1604
|
+
}
|
|
1605
|
+
});
|
|
1606
|
+
|
|
1498
1607
|
// src/worlds/taskSessions.ts
|
|
1499
1608
|
var init_taskSessions = __esm({
|
|
1500
1609
|
"src/worlds/taskSessions.ts"() {
|
|
1501
1610
|
"use strict";
|
|
1502
1611
|
init_worlds();
|
|
1503
1612
|
init_browser();
|
|
1613
|
+
init_grade();
|
|
1614
|
+
init_surfaceDescriptor();
|
|
1504
1615
|
init_session2();
|
|
1505
1616
|
}
|
|
1506
1617
|
});
|
|
@@ -1510,20 +1621,77 @@ var init_evals = __esm({
|
|
|
1510
1621
|
"src/worlds/evals.ts"() {
|
|
1511
1622
|
"use strict";
|
|
1512
1623
|
init_worlds();
|
|
1624
|
+
init_transport();
|
|
1513
1625
|
}
|
|
1514
1626
|
});
|
|
1515
1627
|
|
|
1516
|
-
// src/worlds/
|
|
1517
|
-
import {
|
|
1628
|
+
// src/worlds/runSignals.ts
|
|
1629
|
+
import { constants } from "os";
|
|
1630
|
+
var init_runSignals = __esm({
|
|
1631
|
+
"src/worlds/runSignals.ts"() {
|
|
1632
|
+
"use strict";
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
|
|
1636
|
+
// src/worlds/taskRunDir.ts
|
|
1518
1637
|
import * as fs from "fs";
|
|
1519
1638
|
import * as path from "path";
|
|
1639
|
+
var init_taskRunDir = __esm({
|
|
1640
|
+
"src/worlds/taskRunDir.ts"() {
|
|
1641
|
+
"use strict";
|
|
1642
|
+
init_browser();
|
|
1643
|
+
}
|
|
1644
|
+
});
|
|
1645
|
+
|
|
1646
|
+
// src/worlds/taskRunOutcome.ts
|
|
1647
|
+
var init_taskRunOutcome = __esm({
|
|
1648
|
+
"src/worlds/taskRunOutcome.ts"() {
|
|
1649
|
+
"use strict";
|
|
1650
|
+
init_grade();
|
|
1651
|
+
init_taskSessions();
|
|
1652
|
+
}
|
|
1653
|
+
});
|
|
1654
|
+
|
|
1655
|
+
// src/tracing/prerequisites.ts
|
|
1656
|
+
var OPENTELEMETRY_PEERS, PINNED_PEERS;
|
|
1657
|
+
var init_prerequisites = __esm({
|
|
1658
|
+
"src/tracing/prerequisites.ts"() {
|
|
1659
|
+
"use strict";
|
|
1660
|
+
OPENTELEMETRY_PEERS = {
|
|
1661
|
+
"@opentelemetry/api": "1.9.0",
|
|
1662
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.222.0",
|
|
1663
|
+
"@opentelemetry/resources": "2.11.0",
|
|
1664
|
+
"@opentelemetry/sdk-trace-base": "2.11.0",
|
|
1665
|
+
"@opentelemetry/sdk-trace-node": "2.11.0"
|
|
1666
|
+
};
|
|
1667
|
+
PINNED_PEERS = Object.entries(OPENTELEMETRY_PEERS).map(([name, version]) => `${name}@${version}`).join(" ");
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
|
|
1671
|
+
// src/worlds/taskTracing.ts
|
|
1672
|
+
var init_taskTracing = __esm({
|
|
1673
|
+
"src/worlds/taskTracing.ts"() {
|
|
1674
|
+
"use strict";
|
|
1675
|
+
init_prerequisites();
|
|
1676
|
+
init_platformEndpoint();
|
|
1677
|
+
}
|
|
1678
|
+
});
|
|
1679
|
+
|
|
1680
|
+
// src/worlds/taskRun.ts
|
|
1681
|
+
import { randomBytes } from "crypto";
|
|
1682
|
+
import * as path2 from "path";
|
|
1520
1683
|
var init_taskRun = __esm({
|
|
1521
1684
|
"src/worlds/taskRun.ts"() {
|
|
1522
1685
|
"use strict";
|
|
1523
1686
|
init_browser();
|
|
1524
1687
|
init_evals();
|
|
1688
|
+
init_runSignals();
|
|
1525
1689
|
init_session2();
|
|
1526
1690
|
init_taskSessions();
|
|
1691
|
+
init_taskRunDir();
|
|
1692
|
+
init_taskRunOutcome();
|
|
1693
|
+
init_taskTracing();
|
|
1694
|
+
init_worldNotice();
|
|
1527
1695
|
}
|
|
1528
1696
|
});
|
|
1529
1697
|
|
|
@@ -1541,13 +1709,21 @@ var init_setRun = __esm({
|
|
|
1541
1709
|
"use strict";
|
|
1542
1710
|
init_worlds();
|
|
1543
1711
|
init_checkoutProvenance();
|
|
1712
|
+
init_runSignals();
|
|
1544
1713
|
init_taskRun();
|
|
1545
1714
|
}
|
|
1546
1715
|
});
|
|
1547
1716
|
|
|
1717
|
+
// src/worlds/requestLog.ts
|
|
1718
|
+
var init_requestLog = __esm({
|
|
1719
|
+
"src/worlds/requestLog.ts"() {
|
|
1720
|
+
"use strict";
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
|
|
1548
1724
|
// src/worlds/checkoutTarget.ts
|
|
1549
1725
|
import * as fs2 from "fs";
|
|
1550
|
-
import * as
|
|
1726
|
+
import * as path3 from "path";
|
|
1551
1727
|
var init_checkoutTarget = __esm({
|
|
1552
1728
|
"src/worlds/checkoutTarget.ts"() {
|
|
1553
1729
|
"use strict";
|
|
@@ -1557,7 +1733,7 @@ var init_checkoutTarget = __esm({
|
|
|
1557
1733
|
// src/worlds/worldDir.ts
|
|
1558
1734
|
import { createHash as createHash2 } from "crypto";
|
|
1559
1735
|
import * as fs3 from "fs";
|
|
1560
|
-
import * as
|
|
1736
|
+
import * as path4 from "path";
|
|
1561
1737
|
var CONNECTOR_SPEC, WORLD_SCHEMA_MARKERS, WORLD_ROOT_MARKERS;
|
|
1562
1738
|
var init_worldDir = __esm({
|
|
1563
1739
|
"src/worlds/worldDir.ts"() {
|
|
@@ -1570,7 +1746,7 @@ var init_worldDir = __esm({
|
|
|
1570
1746
|
|
|
1571
1747
|
// src/worlds/tar.ts
|
|
1572
1748
|
import * as fs4 from "fs";
|
|
1573
|
-
import * as
|
|
1749
|
+
import * as path5 from "path";
|
|
1574
1750
|
import { gunzipSync } from "zlib";
|
|
1575
1751
|
var init_tar = __esm({
|
|
1576
1752
|
"src/worlds/tar.ts"() {
|
|
@@ -1582,7 +1758,7 @@ var init_tar = __esm({
|
|
|
1582
1758
|
import { createHash as createHash3 } from "crypto";
|
|
1583
1759
|
import { gzipSync } from "zlib";
|
|
1584
1760
|
import * as fs5 from "fs";
|
|
1585
|
-
import * as
|
|
1761
|
+
import * as path6 from "path";
|
|
1586
1762
|
var META_RELPATH;
|
|
1587
1763
|
var init_hub = __esm({
|
|
1588
1764
|
"src/worlds/hub.ts"() {
|
|
@@ -1591,7 +1767,7 @@ var init_hub = __esm({
|
|
|
1591
1767
|
init_checkoutTarget();
|
|
1592
1768
|
init_worldDir();
|
|
1593
1769
|
init_tar();
|
|
1594
|
-
META_RELPATH =
|
|
1770
|
+
META_RELPATH = path6.join(".gateway", ".env-metadata.json");
|
|
1595
1771
|
}
|
|
1596
1772
|
});
|
|
1597
1773
|
|
|
@@ -1697,11 +1873,12 @@ var init_migrate = __esm({
|
|
|
1697
1873
|
// src/worlds/ingest.ts
|
|
1698
1874
|
import * as fs6 from "fs";
|
|
1699
1875
|
import * as os from "os";
|
|
1700
|
-
import * as
|
|
1876
|
+
import * as path7 from "path";
|
|
1701
1877
|
var init_ingest = __esm({
|
|
1702
1878
|
"src/worlds/ingest.ts"() {
|
|
1703
1879
|
"use strict";
|
|
1704
1880
|
init_worlds();
|
|
1881
|
+
init_platformEndpoint();
|
|
1705
1882
|
}
|
|
1706
1883
|
});
|
|
1707
1884
|
|
|
@@ -1722,17 +1899,6 @@ var init_dryRun = __esm({
|
|
|
1722
1899
|
});
|
|
1723
1900
|
|
|
1724
1901
|
// src/worlds/index.ts
|
|
1725
|
-
function resolveEnv(options) {
|
|
1726
|
-
const host = options.host ?? process.env.GATEWAY_HOST ?? "https://withgateway.ai";
|
|
1727
|
-
const publicKey = options.publicKey ?? process.env.GATEWAY_PUBLIC_KEY;
|
|
1728
|
-
const secretKey = options.secretKey ?? process.env.GATEWAY_SECRET_KEY;
|
|
1729
|
-
if (!publicKey || !secretKey) {
|
|
1730
|
-
throw new Error(
|
|
1731
|
-
"Gateway keys missing: set GATEWAY_PUBLIC_KEY / GATEWAY_SECRET_KEY (or pass publicKey/secretKey)."
|
|
1732
|
-
);
|
|
1733
|
-
}
|
|
1734
|
-
return { host: host.replace(/\/+$/, ""), publicKey, secretKey };
|
|
1735
|
-
}
|
|
1736
1902
|
function parseErrorBody(text, limit = 600) {
|
|
1737
1903
|
const raw = { detail: text.slice(0, limit), code: null };
|
|
1738
1904
|
let parsed;
|
|
@@ -1752,18 +1918,20 @@ function parseErrorBody(text, limit = 600) {
|
|
|
1752
1918
|
code: stableCode
|
|
1753
1919
|
};
|
|
1754
1920
|
}
|
|
1755
|
-
async function apiRequest(options, method,
|
|
1756
|
-
const reply = await new PlatformTransport(
|
|
1757
|
-
if (!reply.ok) throw new ApiError(reply.status, method,
|
|
1921
|
+
async function apiRequest(options, method, path8, body, init = {}) {
|
|
1922
|
+
const reply = await new PlatformTransport(requirePlatformEndpoint(options)).send(method, path8, body, init);
|
|
1923
|
+
if (!reply.ok) throw new ApiError(reply.status, method, path8, reply.text);
|
|
1758
1924
|
return JSON.parse(reply.text);
|
|
1759
1925
|
}
|
|
1760
1926
|
var ApiError;
|
|
1761
1927
|
var init_worlds = __esm({
|
|
1762
1928
|
"src/worlds/index.ts"() {
|
|
1763
1929
|
"use strict";
|
|
1930
|
+
init_platformEndpoint();
|
|
1764
1931
|
init_transport();
|
|
1765
1932
|
init_transport();
|
|
1766
1933
|
init_session2();
|
|
1934
|
+
init_grade();
|
|
1767
1935
|
init_sessionList();
|
|
1768
1936
|
init_sessionContract();
|
|
1769
1937
|
init_taskRef();
|
|
@@ -1774,6 +1942,8 @@ var init_worlds = __esm({
|
|
|
1774
1942
|
init_checkoutProvenance();
|
|
1775
1943
|
init_evals();
|
|
1776
1944
|
init_browser();
|
|
1945
|
+
init_surfaceDescriptor();
|
|
1946
|
+
init_requestLog();
|
|
1777
1947
|
init_browserReconnect();
|
|
1778
1948
|
init_nativeComputer();
|
|
1779
1949
|
init_hub();
|
|
@@ -1787,10 +1957,11 @@ var init_worlds = __esm({
|
|
|
1787
1957
|
init_sandbox();
|
|
1788
1958
|
init_editSessions();
|
|
1789
1959
|
init_dryRun();
|
|
1960
|
+
init_worldNotice();
|
|
1790
1961
|
ApiError = class extends Error {
|
|
1791
|
-
constructor(status, method,
|
|
1962
|
+
constructor(status, method, path8, text) {
|
|
1792
1963
|
const parsed = parseErrorBody(text);
|
|
1793
|
-
super(`${method} ${
|
|
1964
|
+
super(`${method} ${path8} -> ${status}: ${parsed.detail}`);
|
|
1794
1965
|
this.status = status;
|
|
1795
1966
|
this.text = text;
|
|
1796
1967
|
this.name = "ApiError";
|