@withgateway/sdk 0.4.0 → 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/dist/cli.js +1128 -783
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1130 -785
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.js +47 -18
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +47 -18
- package/dist/files/index.mjs.map +1 -1
- 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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +179 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +176 -43
- 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 +47 -18
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +47 -18
- 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 +1 -1
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +1 -1
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +184 -85
- package/dist/worlds/index.d.ts +184 -85
- package/dist/worlds/index.js +176 -43
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +176 -43
- 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/_world.py +24 -1
- package/runtime/gatewaysdk/environment/runtime.py +45 -2
- package/runtime/gatewaysdk/environment/schema/api.py +24 -3
- package/runtime/gatewaysdk/environment/schema/bundle_runtime.py +1 -0
- package/runtime/gatewaysdk/environment/schema/call_capture.py +13 -1
- package/runtime/gatewaysdk/environment/schema/call_log.py +46 -0
- package/runtime/gatewaysdk/environment/schema/call_redaction.py +6 -0
- package/runtime/gatewaysdk/environment/schema/compiler.py +4 -1
- package/runtime/gatewaysdk/environment/schema/conform.py +32 -8
- package/runtime/gatewaysdk/environment/schema/connector.py +5 -0
- 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 +9 -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/database/guard.py +2 -1
- package/runtime/gatewaysdk/environment/schema/handler_errors.py +27 -1
- package/runtime/gatewaysdk/environment/schema/journal.py +4 -3
- package/runtime/gatewaysdk/environment/schema/local.py +1 -0
- package/runtime/gatewaysdk/environment/schema/openapi_schemas.py +20 -5
- package/runtime/gatewaysdk/environment/schema/platform.py +16 -219
- package/runtime/gatewaysdk/environment/schema/runtime.py +7 -0
- package/runtime/gatewaysdk/environment/schema/scaffold.py +2 -1
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/CONNECTORS.md +3 -3
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +19 -22
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +7 -9
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +3 -3
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +14 -11
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +36 -5
- package/runtime/gatewaysdk/environment/schema/snapshot.py +2 -2
- package/runtime/gatewaysdk/environment/schema/tools_world.py +19 -0
- package/runtime/gatewaysdk/environment/schema/verbs.py +6 -0
- package/runtime/gatewaysdk/environment/schema/webhooks.py +687 -0
- package/runtime/gatewaysdk/environment/schema/world_host.py +20 -3
- package/runtime/gatewaysdk/environment/schema/world_tests.py +74 -0
- package/skills/connector-schema-authoring/CONNECTORS.md +3 -3
- package/skills/connector-schema-authoring/SKILL.md +19 -22
- package/skills/connector-schema-authoring/connector-worlds.md +153 -11
- package/skills/connector-schema-authoring/world-schema.md +7 -6
- package/skills/world-data-ingestion/SKILL.md +7 -9
- package/skills/worlds-getting-started/SKILL.md +3 -3
- package/skills/worlds-getting-started/references/cli-mcp-map.md +14 -11
- package/skills/worlds-getting-started/references/gotchas.md +36 -5
package/dist/worlds/index.js
CHANGED
|
@@ -127,11 +127,11 @@ var init_transport = __esm({
|
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
UnreachableError = class extends Error {
|
|
130
|
-
constructor(host, method,
|
|
131
|
-
super(`${method} ${
|
|
130
|
+
constructor(host, method, route2, failure) {
|
|
131
|
+
super(`${method} ${route2}: no answer from ${host}: ${failure.describe()}. ${failure.next}`);
|
|
132
132
|
this.host = host;
|
|
133
133
|
this.method = method;
|
|
134
|
-
this.route =
|
|
134
|
+
this.route = route2;
|
|
135
135
|
this.failure = failure;
|
|
136
136
|
this.name = "UnreachableError";
|
|
137
137
|
}
|
|
@@ -201,16 +201,16 @@ var init_transport = __esm({
|
|
|
201
201
|
budget(ownMs) {
|
|
202
202
|
return Math.max(ownMs ?? 0, this.timeoutMs);
|
|
203
203
|
}
|
|
204
|
-
async send(method,
|
|
204
|
+
async send(method, route2, body, opts = {}) {
|
|
205
205
|
const timeoutMs = this.budget(opts.timeoutMs);
|
|
206
|
-
return (opts.retry ?? RetryPolicy.NONE).run(() => this.once(method,
|
|
206
|
+
return (opts.retry ?? RetryPolicy.NONE).run(() => this.once(method, route2, body, timeoutMs));
|
|
207
207
|
}
|
|
208
|
-
async once(method,
|
|
208
|
+
async once(method, route2, body, timeoutMs) {
|
|
209
209
|
const payload = body === void 0 ? {} : { body: JSON.stringify(body) };
|
|
210
210
|
const controller = new AbortController();
|
|
211
211
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
212
212
|
try {
|
|
213
|
-
const res = await fetch(`${this.endpoint.host}${
|
|
213
|
+
const res = await fetch(`${this.endpoint.host}${route2}`, {
|
|
214
214
|
method,
|
|
215
215
|
headers: {
|
|
216
216
|
"content-type": "application/json",
|
|
@@ -223,7 +223,7 @@ var init_transport = __esm({
|
|
|
223
223
|
return { status: res.status, ok: res.ok, text: await res.text() };
|
|
224
224
|
} catch (error) {
|
|
225
225
|
const cause = controller.signal.aborted ? TransportCause.timeout(timeoutMs) : TransportCause.of(error);
|
|
226
|
-
throw new UnreachableError(this.endpoint.host, method,
|
|
226
|
+
throw new UnreachableError(this.endpoint.host, method, route2, cause);
|
|
227
227
|
} finally {
|
|
228
228
|
clearTimeout(timer);
|
|
229
229
|
}
|
|
@@ -1485,11 +1485,11 @@ var init_media = __esm({
|
|
|
1485
1485
|
status
|
|
1486
1486
|
);
|
|
1487
1487
|
}
|
|
1488
|
-
async send(method,
|
|
1489
|
-
const reply = await this.transport.send(method,
|
|
1488
|
+
async send(method, route2, body) {
|
|
1489
|
+
const reply = await this.transport.send(method, route2, body);
|
|
1490
1490
|
if (!reply.ok)
|
|
1491
1491
|
throw new MediaUploadError(
|
|
1492
|
-
`${method} ${
|
|
1492
|
+
`${method} ${route2} -> ${reply.status}`,
|
|
1493
1493
|
reply.status
|
|
1494
1494
|
);
|
|
1495
1495
|
return reply.text ? JSON.parse(reply.text) : {};
|
|
@@ -1842,7 +1842,7 @@ function click(button, count) {
|
|
|
1842
1842
|
modifiers: modifierChord(raw.text)
|
|
1843
1843
|
});
|
|
1844
1844
|
}
|
|
1845
|
-
var SCROLL_STEP_PX, NOT_EXECUTED, MAX_ERROR2, SCROLL_DIRECTIONS, MEMBERS, AnthropicComputer, AnthropicComputer20251124;
|
|
1845
|
+
var SCROLL_STEP_PX, NOT_EXECUTED, MAX_ERROR2, SCROLL_DIRECTIONS, IMAGE_PARTS, MEMBERS, AnthropicComputer, AnthropicComputer20251124;
|
|
1846
1846
|
var init_anthropic = __esm({
|
|
1847
1847
|
"src/worlds/nativeComputer/anthropic.ts"() {
|
|
1848
1848
|
"use strict";
|
|
@@ -1858,6 +1858,14 @@ var init_anthropic = __esm({
|
|
|
1858
1858
|
left: [-1, 0],
|
|
1859
1859
|
right: [1, 0]
|
|
1860
1860
|
};
|
|
1861
|
+
IMAGE_PARTS = {
|
|
1862
|
+
6: (data) => ({ type: "image-data", data, mediaType: "image/png" }),
|
|
1863
|
+
7: (data) => ({
|
|
1864
|
+
type: "file",
|
|
1865
|
+
mediaType: "image/png",
|
|
1866
|
+
data: { type: "data", data }
|
|
1867
|
+
})
|
|
1868
|
+
};
|
|
1861
1869
|
MEMBERS = {
|
|
1862
1870
|
screenshot: () => new ComputerAction("screenshot"),
|
|
1863
1871
|
zoom: (raw) => new ComputerAction("zoom", {
|
|
@@ -1967,15 +1975,17 @@ var init_anthropic = __esm({
|
|
|
1967
1975
|
];
|
|
1968
1976
|
return [{ type: "text", text: result.text ?? "OK" }];
|
|
1969
1977
|
}
|
|
1970
|
-
/** For `anthropic.tools.computerToolset_20260801(
|
|
1971
|
-
* (or `computer_20251124` with the legacy kind
|
|
1972
|
-
* and returns `{ type: "image", data }` or
|
|
1973
|
-
* into the tool result
|
|
1978
|
+
/** For `anthropic.tools.computerToolset_20260801(computer.aiSdk({ version: 7 }))`
|
|
1979
|
+
* (AI SDK 7 only), or `computer_20251124` with the legacy kind (AI SDK 6
|
|
1980
|
+
* and 7): `execute` runs one action and returns `{ type: "image", data }` or
|
|
1981
|
+
* text; `toModelOutput` turns that into the tool result in the part shape
|
|
1982
|
+
* of `options.version`. Calls run one at a time, and once a call fails the
|
|
1974
1983
|
* rest of that step's calls answer as not executed. */
|
|
1975
|
-
aiSdk() {
|
|
1984
|
+
aiSdk(options = {}) {
|
|
1985
|
+
const imagePart = _AnthropicComputer.imagePart(options);
|
|
1976
1986
|
let failedStep;
|
|
1977
|
-
const execute = (input,
|
|
1978
|
-
const step =
|
|
1987
|
+
const execute = (input, options2) => this.serial(async () => {
|
|
1988
|
+
const step = options2?.messages?.length;
|
|
1979
1989
|
if (step !== void 0 && step === failedStep)
|
|
1980
1990
|
throw new Error(NOT_EXECUTED);
|
|
1981
1991
|
try {
|
|
@@ -1987,7 +1997,7 @@ var init_anthropic = __esm({
|
|
|
1987
1997
|
});
|
|
1988
1998
|
return {
|
|
1989
1999
|
execute,
|
|
1990
|
-
toModelOutput: ({ output }) => _AnthropicComputer.
|
|
2000
|
+
toModelOutput: ({ output }) => _AnthropicComputer.modelOutput(output, imagePart)
|
|
1991
2001
|
};
|
|
1992
2002
|
}
|
|
1993
2003
|
static aiSdkOutput(result) {
|
|
@@ -1995,16 +2005,26 @@ var init_anthropic = __esm({
|
|
|
1995
2005
|
return { type: "image", data: result.image.toString("base64") };
|
|
1996
2006
|
return result.text ?? "OK";
|
|
1997
2007
|
}
|
|
1998
|
-
/**
|
|
1999
|
-
*
|
|
2000
|
-
|
|
2008
|
+
/** A screenshot as the image part of AI SDK `options.version`:
|
|
2009
|
+
* `image-data` for 6 (the default), `file` with `{ type: "data", data }`
|
|
2010
|
+
* for 7. */
|
|
2011
|
+
static aiSdkModelOutput(output, options = {}) {
|
|
2012
|
+
return _AnthropicComputer.modelOutput(
|
|
2013
|
+
output,
|
|
2014
|
+
_AnthropicComputer.imagePart(options)
|
|
2015
|
+
);
|
|
2016
|
+
}
|
|
2017
|
+
static imagePart({
|
|
2018
|
+
version = 6
|
|
2019
|
+
}) {
|
|
2020
|
+
if (Object.hasOwn(IMAGE_PARTS, version)) return IMAGE_PARTS[version];
|
|
2021
|
+
throw new Error(
|
|
2022
|
+
`unsupported AI SDK version ${version}; choose ${Object.keys(IMAGE_PARTS).join(" or ")}`
|
|
2023
|
+
);
|
|
2024
|
+
}
|
|
2025
|
+
static modelOutput(output, imagePart) {
|
|
2001
2026
|
if (typeof output === "string") return { type: "text", value: output };
|
|
2002
|
-
return {
|
|
2003
|
-
type: "content",
|
|
2004
|
-
value: [
|
|
2005
|
-
{ type: "image-data", data: output.data, mediaType: "image/png" }
|
|
2006
|
-
]
|
|
2007
|
-
};
|
|
2027
|
+
return { type: "content", value: [imagePart(output.data)] };
|
|
2008
2028
|
}
|
|
2009
2029
|
envelope(block, content, isError = false) {
|
|
2010
2030
|
return {
|
|
@@ -2412,7 +2432,7 @@ var init_requestLedger = __esm({
|
|
|
2412
2432
|
"use strict";
|
|
2413
2433
|
init_worlds();
|
|
2414
2434
|
init_sessionContract();
|
|
2415
|
-
WORLD_REQUEST_VIAS = ["api", "ui", "tool"];
|
|
2435
|
+
WORLD_REQUEST_VIAS = ["api", "ui", "tool", "webhook"];
|
|
2416
2436
|
WorldRequestFilterError = class extends Error {
|
|
2417
2437
|
};
|
|
2418
2438
|
NOT_RECORDED = "This session's engine records no requests; only hosted World Host sessions do.";
|
|
@@ -3344,13 +3364,13 @@ var init_session2 = __esm({
|
|
|
3344
3364
|
WorldRequestQuery.parse({ cursor: opts.cursor, limit: opts.limit ?? REQUEST_LOG_PAGE_MAX })
|
|
3345
3365
|
);
|
|
3346
3366
|
}
|
|
3347
|
-
page(
|
|
3367
|
+
page(route2, limit, cursor) {
|
|
3348
3368
|
const query = new URLSearchParams({ limit: String(limit) });
|
|
3349
3369
|
if (cursor) query.set("cursor", cursor);
|
|
3350
3370
|
return apiRequest(
|
|
3351
3371
|
this.options,
|
|
3352
3372
|
"GET",
|
|
3353
|
-
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/${
|
|
3373
|
+
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/${route2}?${query.toString()}`
|
|
3354
3374
|
);
|
|
3355
3375
|
}
|
|
3356
3376
|
/** The session's call log, oldest first: every tool call, seed, reset,
|
|
@@ -5018,7 +5038,7 @@ var require_package = __commonJS({
|
|
|
5018
5038
|
"package.json"(exports2, module2) {
|
|
5019
5039
|
module2.exports = {
|
|
5020
5040
|
name: "@withgateway/sdk",
|
|
5021
|
-
version: "0.
|
|
5041
|
+
version: "0.6.0",
|
|
5022
5042
|
description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
|
|
5023
5043
|
main: "./dist/index.js",
|
|
5024
5044
|
module: "./dist/index.mjs",
|
|
@@ -6293,6 +6313,112 @@ var init_requestLog = __esm({
|
|
|
6293
6313
|
}
|
|
6294
6314
|
});
|
|
6295
6315
|
|
|
6316
|
+
// src/worlds/webhooks.ts
|
|
6317
|
+
async function listWebhooks(options, sessionId, page = {}) {
|
|
6318
|
+
const query = new URLSearchParams({
|
|
6319
|
+
after: String(page.after ?? 0),
|
|
6320
|
+
limit: String(page.limit ?? WORLD_WEBHOOK_PAGE_MAX),
|
|
6321
|
+
tail: String(page.tail ?? false)
|
|
6322
|
+
});
|
|
6323
|
+
if (page.epoch) query.set("epoch", page.epoch);
|
|
6324
|
+
return apiRequest(options, "GET", `${route(sessionId)}?${query.toString()}`);
|
|
6325
|
+
}
|
|
6326
|
+
var WORLD_WEBHOOK_PAGE_MAX, FORWARD_TIMEOUT_MS, ERROR_CHARS, route, WorldWebhookForwarder;
|
|
6327
|
+
var init_webhooks = __esm({
|
|
6328
|
+
"src/worlds/webhooks.ts"() {
|
|
6329
|
+
"use strict";
|
|
6330
|
+
init_worlds();
|
|
6331
|
+
WORLD_WEBHOOK_PAGE_MAX = 100;
|
|
6332
|
+
FORWARD_TIMEOUT_MS = 1e4;
|
|
6333
|
+
ERROR_CHARS = 500;
|
|
6334
|
+
route = (sessionId) => `/api/public/world-sessions/${encodeURIComponent(sessionId)}/webhooks`;
|
|
6335
|
+
WorldWebhookForwarder = class {
|
|
6336
|
+
constructor(options, sessionId, forwardTo, opts = {}) {
|
|
6337
|
+
this.options = options;
|
|
6338
|
+
this.sessionId = sessionId;
|
|
6339
|
+
this.forwardTo = forwardTo;
|
|
6340
|
+
this.send = opts.fetch ?? fetch;
|
|
6341
|
+
}
|
|
6342
|
+
options;
|
|
6343
|
+
sessionId;
|
|
6344
|
+
forwardTo;
|
|
6345
|
+
after = 0;
|
|
6346
|
+
epoch = null;
|
|
6347
|
+
answers = [];
|
|
6348
|
+
send;
|
|
6349
|
+
get cursor() {
|
|
6350
|
+
return this.after;
|
|
6351
|
+
}
|
|
6352
|
+
/** Where forwarding begins: the deliveries the session still holds (`replay`), or only those it sends from now. */
|
|
6353
|
+
async start(replay) {
|
|
6354
|
+
if (replay) return null;
|
|
6355
|
+
const page = await this.poll([], { tail: true, limit: 1 });
|
|
6356
|
+
this.follow(page);
|
|
6357
|
+
return page;
|
|
6358
|
+
}
|
|
6359
|
+
/** One poll: the answers held so far sent, the next page forwarded. A poll that fails keeps its answers for the next. */
|
|
6360
|
+
async round() {
|
|
6361
|
+
const page = await this.withAnswers((answers) => this.poll(answers));
|
|
6362
|
+
const forwarded = [];
|
|
6363
|
+
for (const delivery of page.deliveries) {
|
|
6364
|
+
const answer = await this.forward(delivery);
|
|
6365
|
+
this.answers.push(answer);
|
|
6366
|
+
forwarded.push({ delivery, answer });
|
|
6367
|
+
}
|
|
6368
|
+
this.follow(page);
|
|
6369
|
+
return { page, forwarded };
|
|
6370
|
+
}
|
|
6371
|
+
/** Sends the answers still held; the cursor stays, so a delivery this poll returns is forwarded by the next round. */
|
|
6372
|
+
async settle() {
|
|
6373
|
+
if (this.answers.length === 0) return 0;
|
|
6374
|
+
const page = await this.withAnswers((answers) => this.poll(answers, { limit: 1 }));
|
|
6375
|
+
return page.answered;
|
|
6376
|
+
}
|
|
6377
|
+
follow(page) {
|
|
6378
|
+
this.after = page.next;
|
|
6379
|
+
this.epoch = page.epoch;
|
|
6380
|
+
}
|
|
6381
|
+
async withAnswers(poll) {
|
|
6382
|
+
const answers = this.answers.splice(0, WORLD_WEBHOOK_PAGE_MAX);
|
|
6383
|
+
try {
|
|
6384
|
+
return await poll(answers);
|
|
6385
|
+
} catch (error) {
|
|
6386
|
+
this.answers.unshift(...answers);
|
|
6387
|
+
throw error;
|
|
6388
|
+
}
|
|
6389
|
+
}
|
|
6390
|
+
poll(answers, opts = {}) {
|
|
6391
|
+
return apiRequest(this.options, "POST", route(this.sessionId), {
|
|
6392
|
+
after: this.after,
|
|
6393
|
+
epoch: this.epoch,
|
|
6394
|
+
tail: opts.tail ?? false,
|
|
6395
|
+
limit: opts.limit ?? WORLD_WEBHOOK_PAGE_MAX,
|
|
6396
|
+
subscriptions: false,
|
|
6397
|
+
answers
|
|
6398
|
+
});
|
|
6399
|
+
}
|
|
6400
|
+
async forward(delivery) {
|
|
6401
|
+
const started = Date.now();
|
|
6402
|
+
try {
|
|
6403
|
+
const reply = await this.send(this.forwardTo, {
|
|
6404
|
+
method: "POST",
|
|
6405
|
+
headers: delivery.headers,
|
|
6406
|
+
body: delivery.payload,
|
|
6407
|
+
redirect: "manual",
|
|
6408
|
+
signal: AbortSignal.timeout(FORWARD_TIMEOUT_MS)
|
|
6409
|
+
});
|
|
6410
|
+
await reply.arrayBuffer().catch(() => void 0);
|
|
6411
|
+
if (reply.status < 100 || reply.status > 599) throw new Error("the receiver answered an invalid HTTP status");
|
|
6412
|
+
return { id: delivery.id, status: reply.status, durationMs: Date.now() - started, error: null };
|
|
6413
|
+
} catch (error) {
|
|
6414
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6415
|
+
return { id: delivery.id, status: 0, durationMs: Date.now() - started, error: message.slice(0, ERROR_CHARS) };
|
|
6416
|
+
}
|
|
6417
|
+
}
|
|
6418
|
+
};
|
|
6419
|
+
}
|
|
6420
|
+
});
|
|
6421
|
+
|
|
6296
6422
|
// src/worlds/checkoutTarget.ts
|
|
6297
6423
|
var fs2, path3, CheckoutRefusedError, NAMED_EDITS, CheckoutTarget;
|
|
6298
6424
|
var init_checkoutTarget = __esm({
|
|
@@ -8091,9 +8217,9 @@ var init_router = __esm({
|
|
|
8091
8217
|
});
|
|
8092
8218
|
|
|
8093
8219
|
// src/cli/config.ts
|
|
8094
|
-
async function api(creds, method,
|
|
8095
|
-
const reply = await new PlatformTransport(creds).send(method,
|
|
8096
|
-
if (!reply.ok) throw new ApiError2(reply.status, method,
|
|
8220
|
+
async function api(creds, method, route2, body, init2 = {}) {
|
|
8221
|
+
const reply = await new PlatformTransport(creds).send(method, route2, body, init2);
|
|
8222
|
+
if (!reply.ok) throw new ApiError2(reply.status, method, route2, reply.text);
|
|
8097
8223
|
return reply.text ? JSON.parse(reply.text) : {};
|
|
8098
8224
|
}
|
|
8099
8225
|
var fs6, os, path7, ApiError2;
|
|
@@ -8107,12 +8233,12 @@ var init_config = __esm({
|
|
|
8107
8233
|
init_worlds();
|
|
8108
8234
|
init_transport();
|
|
8109
8235
|
ApiError2 = class extends CliError {
|
|
8110
|
-
constructor(status, method,
|
|
8236
|
+
constructor(status, method, route2, text2) {
|
|
8111
8237
|
const body = parseErrorBody(text2, status);
|
|
8112
|
-
super(`${method} ${
|
|
8238
|
+
super(`${method} ${route2} -> ${status}: ${body.detail}`, 1);
|
|
8113
8239
|
this.status = status;
|
|
8114
8240
|
this.method = method;
|
|
8115
|
-
this.route =
|
|
8241
|
+
this.route = route2;
|
|
8116
8242
|
this.text = text2;
|
|
8117
8243
|
this.code = body.code;
|
|
8118
8244
|
}
|
|
@@ -8463,8 +8589,8 @@ async function runtime(creds, request, opts = {}) {
|
|
|
8463
8589
|
throw new CliError(
|
|
8464
8590
|
"This needs the schema runtime (the CLI bundles it) or platform credentials (`gateway auth login`). " + localRuntimeReason()
|
|
8465
8591
|
);
|
|
8466
|
-
const
|
|
8467
|
-
const res = await new PlatformTransport(creds).send("POST",
|
|
8592
|
+
const route2 = "/api/public/worlds/runtime";
|
|
8593
|
+
const res = await new PlatformTransport(creds).send("POST", route2, request, {
|
|
8468
8594
|
timeoutMs: opts.timeoutMs ?? RUNTIME_TIMEOUT_MS
|
|
8469
8595
|
});
|
|
8470
8596
|
let payload = null;
|
|
@@ -8476,8 +8602,8 @@ async function runtime(creds, request, opts = {}) {
|
|
|
8476
8602
|
const detail = detailFrom(payload);
|
|
8477
8603
|
if (detail) throw new BridgeRejected(detail);
|
|
8478
8604
|
if (!res.ok)
|
|
8479
|
-
throw new CliError(`POST ${
|
|
8480
|
-
if (payload === null) throw new CliError(`POST ${
|
|
8605
|
+
throw new CliError(`POST ${route2} (${request.command}) -> ${res.status}: ${res.text.slice(0, 600)}`, 1);
|
|
8606
|
+
if (payload === null) throw new CliError(`POST ${route2} (${request.command}) returned non-JSON`, 1);
|
|
8481
8607
|
return payload;
|
|
8482
8608
|
}
|
|
8483
8609
|
var fs8, path9, MAX_WORLD_FILES, RUNTIME_TIMEOUT_MS, SKIP_DIRS, BridgeRejected, YAML_NAME, YAML_NEEDS_PYYAML, YAML_NOT_ON_PLATFORM, RuntimeRoute;
|
|
@@ -9762,6 +9888,7 @@ __export(worlds_exports, {
|
|
|
9762
9888
|
VERIFIER_REWARD_PREFIX: () => VERIFIER_REWARD_PREFIX,
|
|
9763
9889
|
WHITESPACE: () => WHITESPACE,
|
|
9764
9890
|
WORLD_REQUEST_VIAS: () => WORLD_REQUEST_VIAS,
|
|
9891
|
+
WORLD_WEBHOOK_PAGE_MAX: () => WORLD_WEBHOOK_PAGE_MAX,
|
|
9765
9892
|
WorldBrowser: () => WorldBrowser,
|
|
9766
9893
|
WorldCallTooLarge: () => WorldCallTooLarge,
|
|
9767
9894
|
WorldEditClient: () => WorldEditClient,
|
|
@@ -9780,6 +9907,7 @@ __export(worlds_exports, {
|
|
|
9780
9907
|
WorldSurfaceUnavailable: () => WorldSurfaceUnavailable,
|
|
9781
9908
|
WorldTask: () => WorldTask,
|
|
9782
9909
|
WorldToolsUnread: () => WorldToolsUnread,
|
|
9910
|
+
WorldWebhookForwarder: () => WorldWebhookForwarder,
|
|
9783
9911
|
WriteTreeFilter: () => WriteTreeFilter,
|
|
9784
9912
|
aggregateTaskGrade: () => aggregateTaskGrade,
|
|
9785
9913
|
apiRequest: () => apiRequest,
|
|
@@ -9827,6 +9955,7 @@ __export(worlds_exports, {
|
|
|
9827
9955
|
listSessions: () => listSessions,
|
|
9828
9956
|
listTaskSessions: () => listTaskSessions,
|
|
9829
9957
|
listTasks: () => listTasks,
|
|
9958
|
+
listWebhooks: () => listWebhooks,
|
|
9830
9959
|
localTreeState: () => localTreeState,
|
|
9831
9960
|
messageOf: () => messageOf,
|
|
9832
9961
|
migrateProjectWorlds: () => migrateProjectWorlds,
|
|
@@ -10129,6 +10258,7 @@ var init_worlds = __esm({
|
|
|
10129
10258
|
init_surfaceDescriptor();
|
|
10130
10259
|
init_requestLog();
|
|
10131
10260
|
init_requestLedger();
|
|
10261
|
+
init_webhooks();
|
|
10132
10262
|
init_browserReconnect();
|
|
10133
10263
|
init_nativeComputer();
|
|
10134
10264
|
init_hub();
|
|
@@ -10312,6 +10442,7 @@ init_worlds();
|
|
|
10312
10442
|
VERIFIER_REWARD_PREFIX,
|
|
10313
10443
|
WHITESPACE,
|
|
10314
10444
|
WORLD_REQUEST_VIAS,
|
|
10445
|
+
WORLD_WEBHOOK_PAGE_MAX,
|
|
10315
10446
|
WorldBrowser,
|
|
10316
10447
|
WorldCallTooLarge,
|
|
10317
10448
|
WorldEditClient,
|
|
@@ -10330,6 +10461,7 @@ init_worlds();
|
|
|
10330
10461
|
WorldSurfaceUnavailable,
|
|
10331
10462
|
WorldTask,
|
|
10332
10463
|
WorldToolsUnread,
|
|
10464
|
+
WorldWebhookForwarder,
|
|
10333
10465
|
WriteTreeFilter,
|
|
10334
10466
|
aggregateTaskGrade,
|
|
10335
10467
|
apiRequest,
|
|
@@ -10377,6 +10509,7 @@ init_worlds();
|
|
|
10377
10509
|
listSessions,
|
|
10378
10510
|
listTaskSessions,
|
|
10379
10511
|
listTasks,
|
|
10512
|
+
listWebhooks,
|
|
10380
10513
|
localTreeState,
|
|
10381
10514
|
messageOf,
|
|
10382
10515
|
migrateProjectWorlds,
|