@withgateway/sdk 0.3.3 → 0.6.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 +3005 -1401
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2996 -1392
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.js +128 -37
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +126 -35
- 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-mJhG3vZU.d.mts → index-Di9nNqOY.d.mts} +26 -3
- package/dist/{index-DUHmS74p.d.ts → index-LA-PMRJT.d.ts} +26 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1078 -260
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1040 -251
- package/dist/index.mjs.map +1 -1
- package/dist/replay/index.d.mts +1 -1
- package/dist/replay/index.d.ts +1 -1
- package/dist/replay/index.js.map +1 -1
- package/dist/replay/index.mjs.map +1 -1
- package/dist/traces/index.js +125 -34
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +123 -32
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.d.mts +1 -1
- package/dist/tracing/index.d.ts +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 +819 -438
- package/dist/worlds/index.d.ts +819 -438
- package/dist/worlds/index.js +912 -236
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +908 -232
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/gatewaysdk/environment/_bundle.py +4 -6
- package/runtime/gatewaysdk/environment/_materialize.py +5 -25
- package/runtime/gatewaysdk/environment/_world.py +82 -66
- 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/runtime.py +45 -2
- package/runtime/gatewaysdk/environment/schema/admission.py +174 -0
- package/runtime/gatewaysdk/environment/schema/api.py +198 -474
- package/runtime/gatewaysdk/environment/schema/assertions.py +458 -0
- package/runtime/gatewaysdk/environment/schema/batch.py +3 -3
- package/runtime/gatewaysdk/environment/schema/bundle_runtime.py +1 -0
- package/runtime/gatewaysdk/environment/schema/cache_layout.py +5 -0
- package/runtime/gatewaysdk/environment/schema/call_capture.py +321 -0
- package/runtime/gatewaysdk/environment/schema/call_log.py +276 -18
- package/runtime/gatewaysdk/environment/schema/call_redaction.py +207 -19
- package/runtime/gatewaysdk/environment/schema/cast.py +15 -35
- package/runtime/gatewaysdk/environment/schema/compiler.py +4 -1
- package/runtime/gatewaysdk/environment/schema/conform.py +38 -35
- package/runtime/gatewaysdk/environment/schema/connector.py +94 -152
- package/runtime/gatewaysdk/environment/schema/connectors/confluence/connector.toml +1 -12
- package/runtime/gatewaysdk/environment/schema/connectors/custom/handlers.py +2 -1
- package/runtime/gatewaysdk/environment/schema/connectors/github/api/handlers.py +217 -58
- package/runtime/gatewaysdk/environment/schema/connectors/github/connector.toml +10 -19
- package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_webhooks.json +10 -2
- package/runtime/gatewaysdk/environment/schema/connectors/github/tests/webhooks.json +47 -0
- package/runtime/gatewaysdk/environment/schema/connectors/github/world.json +21 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/api/handlers.py +185 -18
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/connector.toml +29 -14
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/provenance.json +43 -12
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_webhooks.json +2 -2
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/scope.toml +4 -17
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/tests/webhooks.json +107 -0
- package/runtime/gatewaysdk/environment/schema/connectors/jamf/vendor-openapi.json +1 -1
- package/runtime/gatewaysdk/environment/schema/connectors/linear/api/handlers.py +85 -1
- package/runtime/gatewaysdk/environment/schema/connectors/linear/connector.toml +19 -31
- package/runtime/gatewaysdk/environment/schema/connectors/linear/provenance.json +18 -8
- package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/webhooks.json +19 -3
- package/runtime/gatewaysdk/environment/schema/connectors/linear/tests/test_webhooks.py +71 -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 +45 -37
- 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 +52 -5
- 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 +438 -0
- package/runtime/gatewaysdk/environment/schema/ledger_spill.py +828 -0
- package/runtime/gatewaysdk/environment/schema/local.py +32 -116
- package/runtime/gatewaysdk/environment/schema/openapi_schemas.py +20 -5
- package/runtime/gatewaysdk/environment/schema/platform.py +29 -234
- 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 +136 -176
- package/runtime/gatewaysdk/environment/schema/scaffold.py +2 -1
- 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/CONNECTORS.md +3 -3
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +50 -28
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +12 -8
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +20 -22
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +25 -25
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +24 -16
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +71 -7
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/journal-checks.md +182 -0
- package/runtime/gatewaysdk/environment/schema/snapshot.py +150 -30
- 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 +103 -203
- package/runtime/gatewaysdk/environment/schema/validation.py +69 -1
- package/runtime/gatewaysdk/environment/schema/verbs.py +38 -36
- package/runtime/gatewaysdk/environment/schema/webhooks.py +687 -0
- 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 +970 -0
- package/runtime/gatewaysdk/environment/schema/world_tests.py +83 -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/CONNECTORS.md +3 -3
- package/skills/connector-schema-authoring/SKILL.md +50 -28
- package/skills/connector-schema-authoring/connector-worlds.md +282 -18
- package/skills/connector-schema-authoring/world-schema.md +7 -6
- package/skills/world-data-ingestion/ROWS.md +12 -8
- package/skills/world-data-ingestion/SKILL.md +20 -22
- package/skills/worlds-getting-started/SKILL.md +25 -25
- package/skills/worlds-getting-started/references/cli-mcp-map.md +24 -16
- package/skills/worlds-getting-started/references/gotchas.md +71 -7
- package/skills/worlds-getting-started/references/journal-checks.md +182 -0
package/dist/traces/index.js
CHANGED
|
@@ -65,7 +65,7 @@ function platformTimeoutMs(env = process.env) {
|
|
|
65
65
|
if (Number.isInteger(value) && value > 0) return value;
|
|
66
66
|
throw new Error(`${PLATFORM_TIMEOUT_ENV} must be a positive whole number of milliseconds, not \`${raw}\`.`);
|
|
67
67
|
}
|
|
68
|
-
var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, sleep, RetryPolicy, Attempt, PlatformTransport;
|
|
68
|
+
var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, FETCH_LIMIT, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, sleep, RetryPolicy, Attempt, PlatformTransport;
|
|
69
69
|
var init_transport = __esm({
|
|
70
70
|
"src/worlds/transport.ts"() {
|
|
71
71
|
"use strict";
|
|
@@ -73,7 +73,13 @@ var init_transport = __esm({
|
|
|
73
73
|
PLATFORM_TIMEOUT_DEFAULT_MS = 12e4;
|
|
74
74
|
CHECK_HOST = "Check GATEWAY_HOST (or --host) points at a running platform, then retry.";
|
|
75
75
|
RETRY = "Retry; if it repeats, check the network between here and the platform.";
|
|
76
|
+
FETCH_LIMIT = {
|
|
77
|
+
reason: "Node's fetch stopped waiting after 300 s",
|
|
78
|
+
next: "The platform may still be running it: check what it changed before you retry."
|
|
79
|
+
};
|
|
76
80
|
CAUSES = {
|
|
81
|
+
UND_ERR_HEADERS_TIMEOUT: FETCH_LIMIT,
|
|
82
|
+
UND_ERR_BODY_TIMEOUT: FETCH_LIMIT,
|
|
77
83
|
ECONNREFUSED: { reason: "connection refused", next: CHECK_HOST },
|
|
78
84
|
ENOTFOUND: { reason: "DNS lookup failed", next: CHECK_HOST },
|
|
79
85
|
EAI_AGAIN: { reason: "DNS lookup failed", next: CHECK_HOST },
|
|
@@ -1080,7 +1086,7 @@ function click(button, count) {
|
|
|
1080
1086
|
modifiers: modifierChord(raw.text)
|
|
1081
1087
|
});
|
|
1082
1088
|
}
|
|
1083
|
-
var SCROLL_STEP_PX, NOT_EXECUTED, MAX_ERROR2, SCROLL_DIRECTIONS, MEMBERS, AnthropicComputer, AnthropicComputer20251124;
|
|
1089
|
+
var SCROLL_STEP_PX, NOT_EXECUTED, MAX_ERROR2, SCROLL_DIRECTIONS, IMAGE_PARTS, MEMBERS, AnthropicComputer, AnthropicComputer20251124;
|
|
1084
1090
|
var init_anthropic = __esm({
|
|
1085
1091
|
"src/worlds/nativeComputer/anthropic.ts"() {
|
|
1086
1092
|
"use strict";
|
|
@@ -1096,6 +1102,14 @@ var init_anthropic = __esm({
|
|
|
1096
1102
|
left: [-1, 0],
|
|
1097
1103
|
right: [1, 0]
|
|
1098
1104
|
};
|
|
1105
|
+
IMAGE_PARTS = {
|
|
1106
|
+
6: (data) => ({ type: "image-data", data, mediaType: "image/png" }),
|
|
1107
|
+
7: (data) => ({
|
|
1108
|
+
type: "file",
|
|
1109
|
+
mediaType: "image/png",
|
|
1110
|
+
data: { type: "data", data }
|
|
1111
|
+
})
|
|
1112
|
+
};
|
|
1099
1113
|
MEMBERS = {
|
|
1100
1114
|
screenshot: () => new ComputerAction("screenshot"),
|
|
1101
1115
|
zoom: (raw) => new ComputerAction("zoom", {
|
|
@@ -1205,15 +1219,17 @@ var init_anthropic = __esm({
|
|
|
1205
1219
|
];
|
|
1206
1220
|
return [{ type: "text", text: result.text ?? "OK" }];
|
|
1207
1221
|
}
|
|
1208
|
-
/** For `anthropic.tools.computerToolset_20260801(
|
|
1209
|
-
* (or `computer_20251124` with the legacy kind
|
|
1210
|
-
* and returns `{ type: "image", data }` or
|
|
1211
|
-
* into the tool result
|
|
1222
|
+
/** For `anthropic.tools.computerToolset_20260801(computer.aiSdk({ version: 7 }))`
|
|
1223
|
+
* (AI SDK 7 only), or `computer_20251124` with the legacy kind (AI SDK 6
|
|
1224
|
+
* and 7): `execute` runs one action and returns `{ type: "image", data }` or
|
|
1225
|
+
* text; `toModelOutput` turns that into the tool result in the part shape
|
|
1226
|
+
* of `options.version`. Calls run one at a time, and once a call fails the
|
|
1212
1227
|
* rest of that step's calls answer as not executed. */
|
|
1213
|
-
aiSdk() {
|
|
1228
|
+
aiSdk(options = {}) {
|
|
1229
|
+
const imagePart = _AnthropicComputer.imagePart(options);
|
|
1214
1230
|
let failedStep;
|
|
1215
|
-
const execute = (input,
|
|
1216
|
-
const step =
|
|
1231
|
+
const execute = (input, options2) => this.serial(async () => {
|
|
1232
|
+
const step = options2?.messages?.length;
|
|
1217
1233
|
if (step !== void 0 && step === failedStep)
|
|
1218
1234
|
throw new Error(NOT_EXECUTED);
|
|
1219
1235
|
try {
|
|
@@ -1225,7 +1241,7 @@ var init_anthropic = __esm({
|
|
|
1225
1241
|
});
|
|
1226
1242
|
return {
|
|
1227
1243
|
execute,
|
|
1228
|
-
toModelOutput: ({ output }) => _AnthropicComputer.
|
|
1244
|
+
toModelOutput: ({ output }) => _AnthropicComputer.modelOutput(output, imagePart)
|
|
1229
1245
|
};
|
|
1230
1246
|
}
|
|
1231
1247
|
static aiSdkOutput(result) {
|
|
@@ -1233,16 +1249,26 @@ var init_anthropic = __esm({
|
|
|
1233
1249
|
return { type: "image", data: result.image.toString("base64") };
|
|
1234
1250
|
return result.text ?? "OK";
|
|
1235
1251
|
}
|
|
1236
|
-
/**
|
|
1237
|
-
*
|
|
1238
|
-
|
|
1252
|
+
/** A screenshot as the image part of AI SDK `options.version`:
|
|
1253
|
+
* `image-data` for 6 (the default), `file` with `{ type: "data", data }`
|
|
1254
|
+
* for 7. */
|
|
1255
|
+
static aiSdkModelOutput(output, options = {}) {
|
|
1256
|
+
return _AnthropicComputer.modelOutput(
|
|
1257
|
+
output,
|
|
1258
|
+
_AnthropicComputer.imagePart(options)
|
|
1259
|
+
);
|
|
1260
|
+
}
|
|
1261
|
+
static imagePart({
|
|
1262
|
+
version = 6
|
|
1263
|
+
}) {
|
|
1264
|
+
if (Object.hasOwn(IMAGE_PARTS, version)) return IMAGE_PARTS[version];
|
|
1265
|
+
throw new Error(
|
|
1266
|
+
`unsupported AI SDK version ${version}; choose ${Object.keys(IMAGE_PARTS).join(" or ")}`
|
|
1267
|
+
);
|
|
1268
|
+
}
|
|
1269
|
+
static modelOutput(output, imagePart) {
|
|
1239
1270
|
if (typeof output === "string") return { type: "text", value: output };
|
|
1240
|
-
return {
|
|
1241
|
-
type: "content",
|
|
1242
|
-
value: [
|
|
1243
|
-
{ type: "image-data", data: output.data, mediaType: "image/png" }
|
|
1244
|
-
]
|
|
1245
|
-
};
|
|
1271
|
+
return { type: "content", value: [imagePart(output.data)] };
|
|
1246
1272
|
}
|
|
1247
1273
|
envelope(block, content, isError = false) {
|
|
1248
1274
|
return {
|
|
@@ -1519,17 +1545,34 @@ var init_nativeComputer = __esm({
|
|
|
1519
1545
|
});
|
|
1520
1546
|
|
|
1521
1547
|
// src/worlds/sessionContract.ts
|
|
1522
|
-
var CALL_BODY_LIMIT_BYTES, EXPLORATORY_TASK;
|
|
1548
|
+
var CALL_BODY_LIMIT_BYTES, REQUEST_BODY_CAPTURE_BYTES, EXPLORATORY_TASK;
|
|
1523
1549
|
var init_sessionContract = __esm({
|
|
1524
1550
|
"src/worlds/sessionContract.ts"() {
|
|
1525
1551
|
"use strict";
|
|
1526
1552
|
CALL_BODY_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
1553
|
+
REQUEST_BODY_CAPTURE_BYTES = 64 * 1024;
|
|
1527
1554
|
EXPLORATORY_TASK = Object.freeze({
|
|
1528
1555
|
instruction: "exploratory session"
|
|
1529
1556
|
});
|
|
1530
1557
|
}
|
|
1531
1558
|
});
|
|
1532
1559
|
|
|
1560
|
+
// src/worlds/toolSchema.ts
|
|
1561
|
+
var init_toolSchema = __esm({
|
|
1562
|
+
"src/worlds/toolSchema.ts"() {
|
|
1563
|
+
"use strict";
|
|
1564
|
+
}
|
|
1565
|
+
});
|
|
1566
|
+
|
|
1567
|
+
// src/worlds/requestLedger.ts
|
|
1568
|
+
var init_requestLedger = __esm({
|
|
1569
|
+
"src/worlds/requestLedger.ts"() {
|
|
1570
|
+
"use strict";
|
|
1571
|
+
init_worlds();
|
|
1572
|
+
init_sessionContract();
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
|
|
1533
1576
|
// src/worlds/sessionReadiness.ts
|
|
1534
1577
|
var READY_TIMEOUT_MS;
|
|
1535
1578
|
var init_sessionReadiness = __esm({
|
|
@@ -1587,6 +1630,8 @@ var init_session2 = __esm({
|
|
|
1587
1630
|
init_browser();
|
|
1588
1631
|
init_nativeComputer();
|
|
1589
1632
|
init_sessionContract();
|
|
1633
|
+
init_toolSchema();
|
|
1634
|
+
init_requestLedger();
|
|
1590
1635
|
init_sessionReadiness();
|
|
1591
1636
|
init_session();
|
|
1592
1637
|
init_taskRef();
|
|
@@ -1615,6 +1660,14 @@ var init_tasks = __esm({
|
|
|
1615
1660
|
}
|
|
1616
1661
|
});
|
|
1617
1662
|
|
|
1663
|
+
// src/worlds/taskGrades.ts
|
|
1664
|
+
var init_taskGrades = __esm({
|
|
1665
|
+
"src/worlds/taskGrades.ts"() {
|
|
1666
|
+
"use strict";
|
|
1667
|
+
init_worlds();
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
|
|
1618
1671
|
// src/worlds/surfaceDescriptor.ts
|
|
1619
1672
|
var init_surfaceDescriptor = __esm({
|
|
1620
1673
|
"src/worlds/surfaceDescriptor.ts"() {
|
|
@@ -1741,6 +1794,15 @@ var init_setRun = __esm({
|
|
|
1741
1794
|
var init_requestLog = __esm({
|
|
1742
1795
|
"src/worlds/requestLog.ts"() {
|
|
1743
1796
|
"use strict";
|
|
1797
|
+
init_requestLedger();
|
|
1798
|
+
}
|
|
1799
|
+
});
|
|
1800
|
+
|
|
1801
|
+
// src/worlds/webhooks.ts
|
|
1802
|
+
var init_webhooks = __esm({
|
|
1803
|
+
"src/worlds/webhooks.ts"() {
|
|
1804
|
+
"use strict";
|
|
1805
|
+
init_worlds();
|
|
1744
1806
|
}
|
|
1745
1807
|
});
|
|
1746
1808
|
|
|
@@ -1806,10 +1868,14 @@ var init_validate = __esm({
|
|
|
1806
1868
|
});
|
|
1807
1869
|
|
|
1808
1870
|
// src/worlds/sandbox.ts
|
|
1871
|
+
var import_node_crypto6, SANDBOX_WRITE_CHUNK_BYTES, SANDBOX_FILE_MAX_BYTES;
|
|
1809
1872
|
var init_sandbox = __esm({
|
|
1810
1873
|
"src/worlds/sandbox.ts"() {
|
|
1811
1874
|
"use strict";
|
|
1875
|
+
import_node_crypto6 = require("crypto");
|
|
1812
1876
|
init_worlds();
|
|
1877
|
+
SANDBOX_WRITE_CHUNK_BYTES = 4 * 1024 * 1024;
|
|
1878
|
+
SANDBOX_FILE_MAX_BYTES = 256 * 1024 * 1024;
|
|
1813
1879
|
}
|
|
1814
1880
|
});
|
|
1815
1881
|
|
|
@@ -1830,11 +1896,11 @@ var init_json = __esm({
|
|
|
1830
1896
|
});
|
|
1831
1897
|
|
|
1832
1898
|
// src/worlds/transforms.ts
|
|
1833
|
-
var
|
|
1899
|
+
var import_node_crypto7, WHITESPACE, WHITESPACE_EDGES, WHITESPACE_RUN, NOT_DIGIT, STRIP_PREFIX, trim, emailLocalPart, emailDomain, hex, SIMPLE, TRANSFORMS;
|
|
1834
1900
|
var init_transforms = __esm({
|
|
1835
1901
|
"src/worlds/transforms.ts"() {
|
|
1836
1902
|
"use strict";
|
|
1837
|
-
|
|
1903
|
+
import_node_crypto7 = require("crypto");
|
|
1838
1904
|
init_json();
|
|
1839
1905
|
WHITESPACE = " \n\r\f\v";
|
|
1840
1906
|
WHITESPACE_EDGES = new RegExp(`^[${WHITESPACE}]+|[${WHITESPACE}]+$`, "g");
|
|
@@ -1850,7 +1916,7 @@ var init_transforms = __esm({
|
|
|
1850
1916
|
const at = value.lastIndexOf("@");
|
|
1851
1917
|
return at === -1 ? "" : value.slice(at + 1).toLowerCase();
|
|
1852
1918
|
};
|
|
1853
|
-
hex = (algorithm, value) => (0,
|
|
1919
|
+
hex = (algorithm, value) => (0, import_node_crypto7.createHash)(algorithm).update(value, "utf8").digest("hex");
|
|
1854
1920
|
SIMPLE = {
|
|
1855
1921
|
lower: (value) => value.toLowerCase(),
|
|
1856
1922
|
upper: (value) => value.toUpperCase(),
|
|
@@ -1870,11 +1936,11 @@ var init_transforms = __esm({
|
|
|
1870
1936
|
});
|
|
1871
1937
|
|
|
1872
1938
|
// src/worlds/redaction.ts
|
|
1873
|
-
var
|
|
1939
|
+
var import_node_crypto8;
|
|
1874
1940
|
var init_redaction = __esm({
|
|
1875
1941
|
"src/worlds/redaction.ts"() {
|
|
1876
1942
|
"use strict";
|
|
1877
|
-
|
|
1943
|
+
import_node_crypto8 = require("crypto");
|
|
1878
1944
|
init_json();
|
|
1879
1945
|
init_transforms();
|
|
1880
1946
|
}
|
|
@@ -1926,31 +1992,45 @@ var init_dryRun = __esm({
|
|
|
1926
1992
|
});
|
|
1927
1993
|
|
|
1928
1994
|
// src/worlds/index.ts
|
|
1929
|
-
function
|
|
1930
|
-
|
|
1995
|
+
function edgeAnswer(text, status) {
|
|
1996
|
+
if (status !== void 0 && status >= 500) return EDGE_ANSWERS[status] ?? EDGE_FAILURE;
|
|
1997
|
+
return /^\s*</.test(text) ? EDGE_PAGE : null;
|
|
1998
|
+
}
|
|
1999
|
+
function parseErrorBody(text, status) {
|
|
2000
|
+
const raw = { detail: text.slice(0, DETAIL_LIMIT), code: null };
|
|
1931
2001
|
let parsed;
|
|
1932
2002
|
try {
|
|
1933
2003
|
parsed = JSON.parse(text);
|
|
1934
2004
|
} catch {
|
|
1935
|
-
return
|
|
2005
|
+
return { detail: (edgeAnswer(text, status) ?? text).slice(0, DETAIL_LIMIT), code: null };
|
|
1936
2006
|
}
|
|
1937
2007
|
if (parsed === null || typeof parsed !== "object") return raw;
|
|
1938
|
-
const { message, code } = parsed;
|
|
2008
|
+
const { message, code, error } = parsed;
|
|
1939
2009
|
const stableCode = typeof code === "string" ? code : null;
|
|
1940
2010
|
if (typeof message !== "string") return { ...raw, code: stableCode };
|
|
1941
|
-
|
|
1942
|
-
|
|
2011
|
+
const fields = invalidFields(error);
|
|
2012
|
+
const said = fields ? `${message}: ${fields}` : message;
|
|
2013
|
+
if (stableCode === null) return { detail: said.slice(0, DETAIL_LIMIT), code: null };
|
|
1943
2014
|
return {
|
|
1944
|
-
detail: `${
|
|
2015
|
+
detail: `${said} (${stableCode})`.slice(0, DETAIL_LIMIT),
|
|
1945
2016
|
code: stableCode
|
|
1946
2017
|
};
|
|
1947
2018
|
}
|
|
2019
|
+
function invalidFields(error) {
|
|
2020
|
+
const issues = Array.isArray(error) ? error : [];
|
|
2021
|
+
return issues.filter(
|
|
2022
|
+
(issue) => issue !== null && typeof issue === "object" && typeof issue.message === "string"
|
|
2023
|
+
).map((issue) => {
|
|
2024
|
+
const path8 = Array.isArray(issue.path) ? issue.path.map(String).join(".") : "";
|
|
2025
|
+
return path8 ? `${path8}: ${issue.message}` : issue.message;
|
|
2026
|
+
}).join("; ");
|
|
2027
|
+
}
|
|
1948
2028
|
async function apiRequest(options, method, path8, body, init = {}) {
|
|
1949
2029
|
const reply = await new PlatformTransport(requirePlatformEndpoint(options)).send(method, path8, body, init);
|
|
1950
2030
|
if (!reply.ok) throw new ApiError(reply.status, method, path8, reply.text);
|
|
1951
2031
|
return JSON.parse(reply.text);
|
|
1952
2032
|
}
|
|
1953
|
-
var ApiError;
|
|
2033
|
+
var ApiError, DETAIL_LIMIT, EDGE_ANSWERS, EDGE_FAILURE, EDGE_PAGE;
|
|
1954
2034
|
var init_worlds = __esm({
|
|
1955
2035
|
"src/worlds/index.ts"() {
|
|
1956
2036
|
"use strict";
|
|
@@ -1963,6 +2043,7 @@ var init_worlds = __esm({
|
|
|
1963
2043
|
init_sessionContract();
|
|
1964
2044
|
init_taskRef();
|
|
1965
2045
|
init_tasks();
|
|
2046
|
+
init_taskGrades();
|
|
1966
2047
|
init_taskSessions();
|
|
1967
2048
|
init_taskRun();
|
|
1968
2049
|
init_setRun();
|
|
@@ -1971,6 +2052,8 @@ var init_worlds = __esm({
|
|
|
1971
2052
|
init_browser();
|
|
1972
2053
|
init_surfaceDescriptor();
|
|
1973
2054
|
init_requestLog();
|
|
2055
|
+
init_requestLedger();
|
|
2056
|
+
init_webhooks();
|
|
1974
2057
|
init_browserReconnect();
|
|
1975
2058
|
init_nativeComputer();
|
|
1976
2059
|
init_hub();
|
|
@@ -1987,7 +2070,7 @@ var init_worlds = __esm({
|
|
|
1987
2070
|
init_worldNotice();
|
|
1988
2071
|
ApiError = class extends Error {
|
|
1989
2072
|
constructor(status, method, path8, text) {
|
|
1990
|
-
const parsed = parseErrorBody(text);
|
|
2073
|
+
const parsed = parseErrorBody(text, status);
|
|
1991
2074
|
super(`${method} ${path8} -> ${status}: ${parsed.detail}`);
|
|
1992
2075
|
this.status = status;
|
|
1993
2076
|
this.text = text;
|
|
@@ -1998,6 +2081,14 @@ var init_worlds = __esm({
|
|
|
1998
2081
|
text;
|
|
1999
2082
|
code;
|
|
2000
2083
|
};
|
|
2084
|
+
DETAIL_LIMIT = 600;
|
|
2085
|
+
EDGE_ANSWERS = {
|
|
2086
|
+
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.",
|
|
2087
|
+
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.",
|
|
2088
|
+
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."
|
|
2089
|
+
};
|
|
2090
|
+
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.";
|
|
2091
|
+
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.";
|
|
2001
2092
|
}
|
|
2002
2093
|
});
|
|
2003
2094
|
|