@withgateway/sdk 0.2.6 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -8
- package/dist/cli.js +15468 -11263
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +15233 -11028
- 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 +291 -40
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +284 -37
- 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 +203 -47
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +198 -42
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/{index-BaKu5ZSU.d.mts → index-C3UzD0G3.d.mts} +75 -1
- package/dist/{index-BaKu5ZSU.d.ts → index-C3UzD0G3.d.ts} +75 -1
- package/dist/{index-CLkMr6VG.d.ts → index-D-_4Ibcn.d.ts} +36 -4
- package/dist/{index-CdbmO4aX.d.mts → index-FfK4Nump.d.mts} +36 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2149 -615
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2053 -566
- package/dist/index.mjs.map +1 -1
- package/dist/traces/index.js +268 -31
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +262 -28
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.js +19 -11
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +19 -11
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +886 -117
- package/dist/worlds/index.d.ts +886 -117
- package/dist/worlds/index.js +1770 -452
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +1752 -434
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +14 -10
- package/runtime/gatewaysdk/environment/_toml.py +3 -10
- package/runtime/gatewaysdk/environment/_world.py +95 -28
- package/runtime/gatewaysdk/environment/runtime.py +10 -6
- package/runtime/gatewaysdk/environment/schema/__main__.py +35 -0
- package/runtime/gatewaysdk/environment/schema/api.py +19 -23
- package/runtime/gatewaysdk/environment/schema/batch.py +68 -14
- package/runtime/gatewaysdk/environment/schema/bundle_runtime.py +4 -2
- package/runtime/gatewaysdk/environment/schema/cast.py +264 -0
- package/runtime/gatewaysdk/environment/schema/compiler.py +35 -1
- package/runtime/gatewaysdk/environment/schema/conform.py +28 -10
- package/runtime/gatewaysdk/environment/schema/connector.py +59 -14
- package/runtime/gatewaysdk/environment/schema/connectors/custom/handlers.py +38 -1
- package/runtime/gatewaysdk/environment/schema/connectors/google-drive/readers/merge.toml +3 -1
- package/runtime/gatewaysdk/environment/schema/credentials.py +20 -0
- package/runtime/gatewaysdk/environment/schema/csv_rows.py +117 -0
- package/runtime/gatewaysdk/environment/schema/cycles.py +121 -0
- package/runtime/gatewaysdk/environment/schema/data.py +21 -5
- package/runtime/gatewaysdk/environment/schema/grading.py +95 -13
- package/runtime/gatewaysdk/environment/schema/handler_errors.py +44 -0
- package/runtime/gatewaysdk/environment/schema/handler_scan.py +175 -0
- package/runtime/gatewaysdk/environment/schema/host.py +68 -115
- package/runtime/gatewaysdk/environment/schema/host_requests.py +78 -0
- package/runtime/gatewaysdk/environment/schema/host_surfaces.py +12 -0
- package/runtime/gatewaysdk/environment/schema/ingest.py +5 -18
- package/runtime/gatewaysdk/environment/schema/local.py +7 -10
- package/runtime/gatewaysdk/environment/schema/openapi_document.py +322 -0
- package/runtime/gatewaysdk/environment/schema/openapi_import.py +382 -0
- package/runtime/gatewaysdk/environment/schema/openapi_routes.py +441 -0
- package/runtime/gatewaysdk/environment/schema/openapi_schemas.py +629 -0
- package/runtime/gatewaysdk/environment/schema/openapi_source.py +210 -0
- package/runtime/gatewaysdk/environment/schema/platform.py +110 -299
- package/runtime/gatewaysdk/environment/schema/platform_import.py +182 -0
- package/runtime/gatewaysdk/environment/schema/platform_query.py +95 -0
- package/runtime/gatewaysdk/environment/schema/route_bindings.py +176 -0
- package/runtime/gatewaysdk/environment/schema/runtime.py +56 -7
- package/runtime/gatewaysdk/environment/schema/scaffold.py +64 -5
- package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +70 -22
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +54 -4
- package/runtime/gatewaysdk/environment/schema/skills/hooks-getting-started/SKILL.md +27 -2
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +62 -0
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +91 -54
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +146 -146
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +11 -7
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +30 -0
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/new-world-sandbox.md +43 -0
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/openapi-import.md +90 -0
- package/runtime/gatewaysdk/environment/schema/store.py +15 -6
- package/runtime/gatewaysdk/environment/schema/store_contract.py +119 -0
- package/runtime/gatewaysdk/environment/schema/tasks.py +121 -32
- package/runtime/gatewaysdk/environment/schema/tools_world.py +32 -10
- package/runtime/gatewaysdk/environment/schema/tree_import.py +228 -0
- package/runtime/gatewaysdk/environment/schema/ui.py +18 -2
- package/runtime/gatewaysdk/environment/schema/validation.py +35 -0
- package/runtime/gatewaysdk/environment/schema/verbs.py +8 -2
- package/runtime/gatewaysdk/environment/world.py +42 -3
- package/runtime/gatewaysdk/environment/world_session_contract.py +57 -0
- package/skills/benchmarks-getting-started/SKILL.md +70 -22
- package/skills/connector-schema-authoring/SKILL.md +54 -4
- package/skills/connector-schema-authoring/connector-worlds.md +21 -7
- package/skills/connector-schema-authoring/world-schema.md +144 -83
- package/skills/hooks-getting-started/SKILL.md +27 -2
- package/skills/world-data-ingestion/ROWS.md +62 -0
- package/skills/world-data-ingestion/SKILL.md +91 -54
- package/skills/worlds-getting-started/SKILL.md +146 -146
- package/skills/worlds-getting-started/references/cli-mcp-map.md +11 -7
- package/skills/worlds-getting-started/references/gotchas.md +30 -0
- package/skills/worlds-getting-started/references/new-world-sandbox.md +43 -0
- package/skills/worlds-getting-started/references/openapi-import.md +90 -0
package/dist/traces/index.mjs
CHANGED
|
@@ -1,15 +1,156 @@
|
|
|
1
1
|
import { createRequire as __gatewayCreateRequire } from "module";
|
|
2
2
|
const require = __gatewayCreateRequire(import.meta.url);
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __esm = (fn, res) => function __init() {
|
|
5
|
-
|
|
4
|
+
var __esm = (fn, res, err) => function __init() {
|
|
5
|
+
if (err) throw err[0];
|
|
6
|
+
try {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
} catch (e) {
|
|
9
|
+
throw err = [e], e;
|
|
10
|
+
}
|
|
6
11
|
};
|
|
7
12
|
|
|
13
|
+
// src/worlds/transport.ts
|
|
14
|
+
function platformTimeoutMs(env = process.env) {
|
|
15
|
+
const raw = env[PLATFORM_TIMEOUT_ENV];
|
|
16
|
+
if (raw === void 0 || raw === "") return PLATFORM_TIMEOUT_DEFAULT_MS;
|
|
17
|
+
const value = Number(raw);
|
|
18
|
+
if (Number.isInteger(value) && value > 0) return value;
|
|
19
|
+
throw new Error(`${PLATFORM_TIMEOUT_ENV} must be a positive whole number of milliseconds, not \`${raw}\`.`);
|
|
20
|
+
}
|
|
21
|
+
var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, PlatformTransport;
|
|
22
|
+
var init_transport = __esm({
|
|
23
|
+
"src/worlds/transport.ts"() {
|
|
24
|
+
"use strict";
|
|
25
|
+
PLATFORM_TIMEOUT_ENV = "GATEWAY_TIMEOUT_MS";
|
|
26
|
+
PLATFORM_TIMEOUT_DEFAULT_MS = 12e4;
|
|
27
|
+
CHECK_HOST = "Check GATEWAY_HOST (or --host) points at a running platform, then retry.";
|
|
28
|
+
RETRY = "Retry; if it repeats, check the network between here and the platform.";
|
|
29
|
+
CAUSES = {
|
|
30
|
+
ECONNREFUSED: { reason: "connection refused", next: CHECK_HOST },
|
|
31
|
+
ENOTFOUND: { reason: "DNS lookup failed", next: CHECK_HOST },
|
|
32
|
+
EAI_AGAIN: { reason: "DNS lookup failed", next: CHECK_HOST },
|
|
33
|
+
ETIMEDOUT: { reason: "connect timed out", next: CHECK_HOST },
|
|
34
|
+
UND_ERR_CONNECT_TIMEOUT: { reason: "connect timed out", next: CHECK_HOST },
|
|
35
|
+
EHOSTUNREACH: { reason: "host unreachable", next: CHECK_HOST },
|
|
36
|
+
ENETUNREACH: { reason: "network unreachable", next: RETRY },
|
|
37
|
+
ECONNRESET: { reason: "connection dropped", next: RETRY },
|
|
38
|
+
UND_ERR_SOCKET: { reason: "connection dropped", next: RETRY },
|
|
39
|
+
EPIPE: { reason: "connection dropped", next: RETRY }
|
|
40
|
+
};
|
|
41
|
+
UNKNOWN_CAUSE = { reason: "network error", next: CHECK_HOST };
|
|
42
|
+
TransportCause = class _TransportCause {
|
|
43
|
+
constructor(reason, detail, next) {
|
|
44
|
+
this.reason = reason;
|
|
45
|
+
this.detail = detail;
|
|
46
|
+
this.next = next;
|
|
47
|
+
}
|
|
48
|
+
reason;
|
|
49
|
+
detail;
|
|
50
|
+
next;
|
|
51
|
+
static timeout(timeoutMs) {
|
|
52
|
+
return new _TransportCause(
|
|
53
|
+
`timed out after ${timeoutMs / 1e3}s`,
|
|
54
|
+
null,
|
|
55
|
+
`Retry; if the platform is slow, raise ${PLATFORM_TIMEOUT_ENV} (milliseconds per request).`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
static of(error) {
|
|
59
|
+
const cause = error instanceof Error && error.cause instanceof Error ? error.cause : void 0;
|
|
60
|
+
const code = cause && "code" in cause && typeof cause.code === "string" ? cause.code : null;
|
|
61
|
+
const message = cause?.message ?? (error instanceof Error ? error.message : String(error));
|
|
62
|
+
const known = code && CAUSES[code] || UNKNOWN_CAUSE;
|
|
63
|
+
return new _TransportCause(known.reason, code ? `${code}: ${message}` : message, known.next);
|
|
64
|
+
}
|
|
65
|
+
describe() {
|
|
66
|
+
return this.detail === null ? this.reason : `${this.reason} (${this.detail})`;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
UnreachableError = class extends Error {
|
|
70
|
+
constructor(host, method, route, failure) {
|
|
71
|
+
super(`${method} ${route}: no answer from ${host}: ${failure.describe()}. ${failure.next}`);
|
|
72
|
+
this.host = host;
|
|
73
|
+
this.method = method;
|
|
74
|
+
this.route = route;
|
|
75
|
+
this.failure = failure;
|
|
76
|
+
this.name = "UnreachableError";
|
|
77
|
+
}
|
|
78
|
+
host;
|
|
79
|
+
method;
|
|
80
|
+
route;
|
|
81
|
+
failure;
|
|
82
|
+
};
|
|
83
|
+
PlatformTransport = class {
|
|
84
|
+
constructor(endpoint, timeoutMs = platformTimeoutMs()) {
|
|
85
|
+
this.endpoint = endpoint;
|
|
86
|
+
this.timeoutMs = timeoutMs;
|
|
87
|
+
}
|
|
88
|
+
endpoint;
|
|
89
|
+
timeoutMs;
|
|
90
|
+
/** A request that legitimately takes longer (a sandbox exec, a world create) waits its own budget; every other one waits the default. */
|
|
91
|
+
budget(ownMs) {
|
|
92
|
+
return Math.max(ownMs ?? 0, this.timeoutMs);
|
|
93
|
+
}
|
|
94
|
+
async send(method, route, body, opts = {}) {
|
|
95
|
+
const timeoutMs = this.budget(opts.timeoutMs);
|
|
96
|
+
const payload = body === void 0 ? {} : { body: JSON.stringify(body) };
|
|
97
|
+
const controller = new AbortController();
|
|
98
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
99
|
+
try {
|
|
100
|
+
const res = await fetch(`${this.endpoint.host}${route}`, {
|
|
101
|
+
method,
|
|
102
|
+
headers: {
|
|
103
|
+
"content-type": "application/json",
|
|
104
|
+
accept: "application/json",
|
|
105
|
+
authorization: "Basic " + Buffer.from(`${this.endpoint.publicKey}:${this.endpoint.secretKey}`).toString("base64")
|
|
106
|
+
},
|
|
107
|
+
...payload,
|
|
108
|
+
signal: controller.signal
|
|
109
|
+
});
|
|
110
|
+
return { status: res.status, ok: res.ok, text: await res.text() };
|
|
111
|
+
} catch (error) {
|
|
112
|
+
const cause = controller.signal.aborted ? TransportCause.timeout(timeoutMs) : TransportCause.of(error);
|
|
113
|
+
throw new UnreachableError(this.endpoint.host, method, route, cause);
|
|
114
|
+
} finally {
|
|
115
|
+
clearTimeout(timer);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// src/worlds/browserReconnect.ts
|
|
123
|
+
var init_browserReconnect = __esm({
|
|
124
|
+
"src/worlds/browserReconnect.ts"() {
|
|
125
|
+
"use strict";
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
8
129
|
// src/worlds/browser.ts
|
|
9
130
|
var init_browser = __esm({
|
|
10
131
|
"src/worlds/browser.ts"() {
|
|
11
132
|
"use strict";
|
|
12
133
|
init_session();
|
|
134
|
+
init_browserReconnect();
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// src/worlds/sessionContract.ts
|
|
139
|
+
var CALL_BODY_LIMIT_BYTES, EXPLORATORY_TASK;
|
|
140
|
+
var init_sessionContract = __esm({
|
|
141
|
+
"src/worlds/sessionContract.ts"() {
|
|
142
|
+
"use strict";
|
|
143
|
+
CALL_BODY_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
144
|
+
EXPLORATORY_TASK = Object.freeze({
|
|
145
|
+
instruction: "exploratory session"
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// src/worlds/taskRef.ts
|
|
151
|
+
var init_taskRef = __esm({
|
|
152
|
+
"src/worlds/taskRef.ts"() {
|
|
153
|
+
"use strict";
|
|
13
154
|
}
|
|
14
155
|
});
|
|
15
156
|
|
|
@@ -21,12 +162,23 @@ var init_session = __esm({
|
|
|
21
162
|
"use strict";
|
|
22
163
|
init_worlds();
|
|
23
164
|
init_browser();
|
|
165
|
+
init_sessionContract();
|
|
166
|
+
init_taskRef();
|
|
167
|
+
init_taskRef();
|
|
24
168
|
READY_TIMEOUT_MS = 10 * 6e4;
|
|
25
169
|
CALL_TIMEOUT_MS = 3 * 6e4;
|
|
26
170
|
JUDGED_GRADE_TIMEOUT_MS = 15 * 6e4;
|
|
27
171
|
}
|
|
28
172
|
});
|
|
29
173
|
|
|
174
|
+
// src/worlds/sessionList.ts
|
|
175
|
+
var init_sessionList = __esm({
|
|
176
|
+
"src/worlds/sessionList.ts"() {
|
|
177
|
+
"use strict";
|
|
178
|
+
init_worlds();
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
30
182
|
// src/worlds/tasks.ts
|
|
31
183
|
var init_tasks = __esm({
|
|
32
184
|
"src/worlds/tasks.ts"() {
|
|
@@ -67,10 +219,37 @@ var init_taskRun = __esm({
|
|
|
67
219
|
}
|
|
68
220
|
});
|
|
69
221
|
|
|
70
|
-
// src/worlds/
|
|
71
|
-
import {
|
|
222
|
+
// src/worlds/checkoutProvenance.ts
|
|
223
|
+
import { execFileSync } from "child_process";
|
|
224
|
+
var init_checkoutProvenance = __esm({
|
|
225
|
+
"src/worlds/checkoutProvenance.ts"() {
|
|
226
|
+
"use strict";
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// src/worlds/setRun.ts
|
|
231
|
+
var init_setRun = __esm({
|
|
232
|
+
"src/worlds/setRun.ts"() {
|
|
233
|
+
"use strict";
|
|
234
|
+
init_worlds();
|
|
235
|
+
init_checkoutProvenance();
|
|
236
|
+
init_taskRun();
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// src/worlds/checkoutTarget.ts
|
|
72
241
|
import * as fs2 from "fs";
|
|
73
242
|
import * as path2 from "path";
|
|
243
|
+
var init_checkoutTarget = __esm({
|
|
244
|
+
"src/worlds/checkoutTarget.ts"() {
|
|
245
|
+
"use strict";
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// src/worlds/worldDir.ts
|
|
250
|
+
import { createHash } from "crypto";
|
|
251
|
+
import * as fs3 from "fs";
|
|
252
|
+
import * as path3 from "path";
|
|
74
253
|
var CONNECTOR_SPEC, WORLD_SCHEMA_MARKERS, WORLD_ROOT_MARKERS;
|
|
75
254
|
var init_worldDir = __esm({
|
|
76
255
|
"src/worlds/worldDir.ts"() {
|
|
@@ -81,18 +260,30 @@ var init_worldDir = __esm({
|
|
|
81
260
|
}
|
|
82
261
|
});
|
|
83
262
|
|
|
263
|
+
// src/worlds/tar.ts
|
|
264
|
+
import * as fs4 from "fs";
|
|
265
|
+
import * as path4 from "path";
|
|
266
|
+
import { gunzipSync } from "zlib";
|
|
267
|
+
var init_tar = __esm({
|
|
268
|
+
"src/worlds/tar.ts"() {
|
|
269
|
+
"use strict";
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
|
|
84
273
|
// src/worlds/hub.ts
|
|
85
274
|
import { createHash as createHash2 } from "crypto";
|
|
86
|
-
import { gzipSync
|
|
87
|
-
import * as
|
|
88
|
-
import * as
|
|
275
|
+
import { gzipSync } from "zlib";
|
|
276
|
+
import * as fs5 from "fs";
|
|
277
|
+
import * as path5 from "path";
|
|
89
278
|
var META_RELPATH;
|
|
90
279
|
var init_hub = __esm({
|
|
91
280
|
"src/worlds/hub.ts"() {
|
|
92
281
|
"use strict";
|
|
93
282
|
init_worlds();
|
|
283
|
+
init_checkoutTarget();
|
|
94
284
|
init_worldDir();
|
|
95
|
-
|
|
285
|
+
init_tar();
|
|
286
|
+
META_RELPATH = path5.join(".gateway", ".env-metadata.json");
|
|
96
287
|
}
|
|
97
288
|
});
|
|
98
289
|
|
|
@@ -105,11 +296,20 @@ var init_validate = __esm({
|
|
|
105
296
|
}
|
|
106
297
|
});
|
|
107
298
|
|
|
299
|
+
// src/worlds/sandbox.ts
|
|
300
|
+
var init_sandbox = __esm({
|
|
301
|
+
"src/worlds/sandbox.ts"() {
|
|
302
|
+
"use strict";
|
|
303
|
+
init_worlds();
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
|
|
108
307
|
// src/worlds/describe.ts
|
|
109
308
|
var init_describe = __esm({
|
|
110
309
|
"src/worlds/describe.ts"() {
|
|
111
310
|
"use strict";
|
|
112
311
|
init_worlds();
|
|
312
|
+
init_sandbox();
|
|
113
313
|
}
|
|
114
314
|
});
|
|
115
315
|
|
|
@@ -187,9 +387,9 @@ var init_migrate = __esm({
|
|
|
187
387
|
});
|
|
188
388
|
|
|
189
389
|
// src/worlds/ingest.ts
|
|
190
|
-
import * as
|
|
390
|
+
import * as fs6 from "fs";
|
|
191
391
|
import * as os from "os";
|
|
192
|
-
import * as
|
|
392
|
+
import * as path6 from "path";
|
|
193
393
|
var init_ingest = __esm({
|
|
194
394
|
"src/worlds/ingest.ts"() {
|
|
195
395
|
"use strict";
|
|
@@ -197,9 +397,17 @@ var init_ingest = __esm({
|
|
|
197
397
|
}
|
|
198
398
|
});
|
|
199
399
|
|
|
200
|
-
// src/worlds/
|
|
201
|
-
var
|
|
202
|
-
"src/worlds/
|
|
400
|
+
// src/worlds/editSessions.ts
|
|
401
|
+
var init_editSessions = __esm({
|
|
402
|
+
"src/worlds/editSessions.ts"() {
|
|
403
|
+
"use strict";
|
|
404
|
+
init_worlds();
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
// src/worlds/dryRun.ts
|
|
409
|
+
var init_dryRun = __esm({
|
|
410
|
+
"src/worlds/dryRun.ts"() {
|
|
203
411
|
"use strict";
|
|
204
412
|
init_worlds();
|
|
205
413
|
}
|
|
@@ -217,30 +425,48 @@ function resolveEnv(options) {
|
|
|
217
425
|
}
|
|
218
426
|
return { host: host.replace(/\/+$/, ""), publicKey, secretKey };
|
|
219
427
|
}
|
|
220
|
-
|
|
221
|
-
const {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
const
|
|
231
|
-
if (
|
|
232
|
-
|
|
428
|
+
function parseErrorBody(text, limit = 600) {
|
|
429
|
+
const raw = { detail: text.slice(0, limit), code: null };
|
|
430
|
+
let parsed;
|
|
431
|
+
try {
|
|
432
|
+
parsed = JSON.parse(text);
|
|
433
|
+
} catch {
|
|
434
|
+
return raw;
|
|
435
|
+
}
|
|
436
|
+
if (parsed === null || typeof parsed !== "object") return raw;
|
|
437
|
+
const { message, code } = parsed;
|
|
438
|
+
const stableCode = typeof code === "string" ? code : null;
|
|
439
|
+
if (typeof message !== "string") return { ...raw, code: stableCode };
|
|
440
|
+
if (stableCode === null)
|
|
441
|
+
return { detail: message.slice(0, limit), code: null };
|
|
442
|
+
return {
|
|
443
|
+
detail: `${message} (${stableCode})`.slice(0, limit),
|
|
444
|
+
code: stableCode
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
async function apiRequest(options, method, path7, body, init = {}) {
|
|
448
|
+
const reply = await new PlatformTransport(resolveEnv(options)).send(method, path7, body, init);
|
|
449
|
+
if (!reply.ok) throw new ApiError(reply.status, method, path7, reply.text);
|
|
450
|
+
return JSON.parse(reply.text);
|
|
233
451
|
}
|
|
234
452
|
var ApiError;
|
|
235
453
|
var init_worlds = __esm({
|
|
236
454
|
"src/worlds/index.ts"() {
|
|
237
455
|
"use strict";
|
|
456
|
+
init_transport();
|
|
457
|
+
init_transport();
|
|
238
458
|
init_session();
|
|
459
|
+
init_sessionList();
|
|
460
|
+
init_sessionContract();
|
|
461
|
+
init_taskRef();
|
|
239
462
|
init_tasks();
|
|
240
463
|
init_taskSessions();
|
|
241
464
|
init_taskRun();
|
|
465
|
+
init_setRun();
|
|
466
|
+
init_checkoutProvenance();
|
|
242
467
|
init_evals();
|
|
243
468
|
init_browser();
|
|
469
|
+
init_browserReconnect();
|
|
244
470
|
init_hub();
|
|
245
471
|
init_validate();
|
|
246
472
|
init_describe();
|
|
@@ -250,12 +476,20 @@ var init_worlds = __esm({
|
|
|
250
476
|
init_migrate();
|
|
251
477
|
init_ingest();
|
|
252
478
|
init_sandbox();
|
|
479
|
+
init_editSessions();
|
|
480
|
+
init_dryRun();
|
|
253
481
|
ApiError = class extends Error {
|
|
254
|
-
constructor(status, method,
|
|
255
|
-
|
|
482
|
+
constructor(status, method, path7, text) {
|
|
483
|
+
const parsed = parseErrorBody(text);
|
|
484
|
+
super(`${method} ${path7} -> ${status}: ${parsed.detail}`);
|
|
256
485
|
this.status = status;
|
|
486
|
+
this.text = text;
|
|
257
487
|
this.name = "ApiError";
|
|
488
|
+
this.code = parsed.code;
|
|
258
489
|
}
|
|
490
|
+
status;
|
|
491
|
+
text;
|
|
492
|
+
code;
|
|
259
493
|
};
|
|
260
494
|
}
|
|
261
495
|
});
|