@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.mjs
CHANGED
|
@@ -113,11 +113,11 @@ var init_transport = __esm({
|
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
115
|
UnreachableError = class extends Error {
|
|
116
|
-
constructor(host, method,
|
|
117
|
-
super(`${method} ${
|
|
116
|
+
constructor(host, method, route2, failure) {
|
|
117
|
+
super(`${method} ${route2}: no answer from ${host}: ${failure.describe()}. ${failure.next}`);
|
|
118
118
|
this.host = host;
|
|
119
119
|
this.method = method;
|
|
120
|
-
this.route =
|
|
120
|
+
this.route = route2;
|
|
121
121
|
this.failure = failure;
|
|
122
122
|
this.name = "UnreachableError";
|
|
123
123
|
}
|
|
@@ -187,16 +187,16 @@ var init_transport = __esm({
|
|
|
187
187
|
budget(ownMs) {
|
|
188
188
|
return Math.max(ownMs ?? 0, this.timeoutMs);
|
|
189
189
|
}
|
|
190
|
-
async send(method,
|
|
190
|
+
async send(method, route2, body, opts = {}) {
|
|
191
191
|
const timeoutMs = this.budget(opts.timeoutMs);
|
|
192
|
-
return (opts.retry ?? RetryPolicy.NONE).run(() => this.once(method,
|
|
192
|
+
return (opts.retry ?? RetryPolicy.NONE).run(() => this.once(method, route2, body, timeoutMs));
|
|
193
193
|
}
|
|
194
|
-
async once(method,
|
|
194
|
+
async once(method, route2, body, timeoutMs) {
|
|
195
195
|
const payload = body === void 0 ? {} : { body: JSON.stringify(body) };
|
|
196
196
|
const controller = new AbortController();
|
|
197
197
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
198
198
|
try {
|
|
199
|
-
const res = await fetch(`${this.endpoint.host}${
|
|
199
|
+
const res = await fetch(`${this.endpoint.host}${route2}`, {
|
|
200
200
|
method,
|
|
201
201
|
headers: {
|
|
202
202
|
"content-type": "application/json",
|
|
@@ -209,7 +209,7 @@ var init_transport = __esm({
|
|
|
209
209
|
return { status: res.status, ok: res.ok, text: await res.text() };
|
|
210
210
|
} catch (error) {
|
|
211
211
|
const cause = controller.signal.aborted ? TransportCause.timeout(timeoutMs) : TransportCause.of(error);
|
|
212
|
-
throw new UnreachableError(this.endpoint.host, method,
|
|
212
|
+
throw new UnreachableError(this.endpoint.host, method, route2, cause);
|
|
213
213
|
} finally {
|
|
214
214
|
clearTimeout(timer);
|
|
215
215
|
}
|
|
@@ -1471,11 +1471,11 @@ var init_media = __esm({
|
|
|
1471
1471
|
status
|
|
1472
1472
|
);
|
|
1473
1473
|
}
|
|
1474
|
-
async send(method,
|
|
1475
|
-
const reply = await this.transport.send(method,
|
|
1474
|
+
async send(method, route2, body) {
|
|
1475
|
+
const reply = await this.transport.send(method, route2, body);
|
|
1476
1476
|
if (!reply.ok)
|
|
1477
1477
|
throw new MediaUploadError(
|
|
1478
|
-
`${method} ${
|
|
1478
|
+
`${method} ${route2} -> ${reply.status}`,
|
|
1479
1479
|
reply.status
|
|
1480
1480
|
);
|
|
1481
1481
|
return reply.text ? JSON.parse(reply.text) : {};
|
|
@@ -1828,7 +1828,7 @@ function click(button, count) {
|
|
|
1828
1828
|
modifiers: modifierChord(raw.text)
|
|
1829
1829
|
});
|
|
1830
1830
|
}
|
|
1831
|
-
var SCROLL_STEP_PX, NOT_EXECUTED, MAX_ERROR2, SCROLL_DIRECTIONS, MEMBERS, AnthropicComputer, AnthropicComputer20251124;
|
|
1831
|
+
var SCROLL_STEP_PX, NOT_EXECUTED, MAX_ERROR2, SCROLL_DIRECTIONS, IMAGE_PARTS, MEMBERS, AnthropicComputer, AnthropicComputer20251124;
|
|
1832
1832
|
var init_anthropic = __esm({
|
|
1833
1833
|
"src/worlds/nativeComputer/anthropic.ts"() {
|
|
1834
1834
|
"use strict";
|
|
@@ -1844,6 +1844,14 @@ var init_anthropic = __esm({
|
|
|
1844
1844
|
left: [-1, 0],
|
|
1845
1845
|
right: [1, 0]
|
|
1846
1846
|
};
|
|
1847
|
+
IMAGE_PARTS = {
|
|
1848
|
+
6: (data) => ({ type: "image-data", data, mediaType: "image/png" }),
|
|
1849
|
+
7: (data) => ({
|
|
1850
|
+
type: "file",
|
|
1851
|
+
mediaType: "image/png",
|
|
1852
|
+
data: { type: "data", data }
|
|
1853
|
+
})
|
|
1854
|
+
};
|
|
1847
1855
|
MEMBERS = {
|
|
1848
1856
|
screenshot: () => new ComputerAction("screenshot"),
|
|
1849
1857
|
zoom: (raw) => new ComputerAction("zoom", {
|
|
@@ -1953,15 +1961,17 @@ var init_anthropic = __esm({
|
|
|
1953
1961
|
];
|
|
1954
1962
|
return [{ type: "text", text: result.text ?? "OK" }];
|
|
1955
1963
|
}
|
|
1956
|
-
/** For `anthropic.tools.computerToolset_20260801(
|
|
1957
|
-
* (or `computer_20251124` with the legacy kind
|
|
1958
|
-
* and returns `{ type: "image", data }` or
|
|
1959
|
-
* into the tool result
|
|
1964
|
+
/** For `anthropic.tools.computerToolset_20260801(computer.aiSdk({ version: 7 }))`
|
|
1965
|
+
* (AI SDK 7 only), or `computer_20251124` with the legacy kind (AI SDK 6
|
|
1966
|
+
* and 7): `execute` runs one action and returns `{ type: "image", data }` or
|
|
1967
|
+
* text; `toModelOutput` turns that into the tool result in the part shape
|
|
1968
|
+
* of `options.version`. Calls run one at a time, and once a call fails the
|
|
1960
1969
|
* rest of that step's calls answer as not executed. */
|
|
1961
|
-
aiSdk() {
|
|
1970
|
+
aiSdk(options = {}) {
|
|
1971
|
+
const imagePart = _AnthropicComputer.imagePart(options);
|
|
1962
1972
|
let failedStep;
|
|
1963
|
-
const execute = (input,
|
|
1964
|
-
const step =
|
|
1973
|
+
const execute = (input, options2) => this.serial(async () => {
|
|
1974
|
+
const step = options2?.messages?.length;
|
|
1965
1975
|
if (step !== void 0 && step === failedStep)
|
|
1966
1976
|
throw new Error(NOT_EXECUTED);
|
|
1967
1977
|
try {
|
|
@@ -1973,7 +1983,7 @@ var init_anthropic = __esm({
|
|
|
1973
1983
|
});
|
|
1974
1984
|
return {
|
|
1975
1985
|
execute,
|
|
1976
|
-
toModelOutput: ({ output }) => _AnthropicComputer.
|
|
1986
|
+
toModelOutput: ({ output }) => _AnthropicComputer.modelOutput(output, imagePart)
|
|
1977
1987
|
};
|
|
1978
1988
|
}
|
|
1979
1989
|
static aiSdkOutput(result) {
|
|
@@ -1981,16 +1991,26 @@ var init_anthropic = __esm({
|
|
|
1981
1991
|
return { type: "image", data: result.image.toString("base64") };
|
|
1982
1992
|
return result.text ?? "OK";
|
|
1983
1993
|
}
|
|
1984
|
-
/**
|
|
1985
|
-
*
|
|
1986
|
-
|
|
1994
|
+
/** A screenshot as the image part of AI SDK `options.version`:
|
|
1995
|
+
* `image-data` for 6 (the default), `file` with `{ type: "data", data }`
|
|
1996
|
+
* for 7. */
|
|
1997
|
+
static aiSdkModelOutput(output, options = {}) {
|
|
1998
|
+
return _AnthropicComputer.modelOutput(
|
|
1999
|
+
output,
|
|
2000
|
+
_AnthropicComputer.imagePart(options)
|
|
2001
|
+
);
|
|
2002
|
+
}
|
|
2003
|
+
static imagePart({
|
|
2004
|
+
version = 6
|
|
2005
|
+
}) {
|
|
2006
|
+
if (Object.hasOwn(IMAGE_PARTS, version)) return IMAGE_PARTS[version];
|
|
2007
|
+
throw new Error(
|
|
2008
|
+
`unsupported AI SDK version ${version}; choose ${Object.keys(IMAGE_PARTS).join(" or ")}`
|
|
2009
|
+
);
|
|
2010
|
+
}
|
|
2011
|
+
static modelOutput(output, imagePart) {
|
|
1987
2012
|
if (typeof output === "string") return { type: "text", value: output };
|
|
1988
|
-
return {
|
|
1989
|
-
type: "content",
|
|
1990
|
-
value: [
|
|
1991
|
-
{ type: "image-data", data: output.data, mediaType: "image/png" }
|
|
1992
|
-
]
|
|
1993
|
-
};
|
|
2013
|
+
return { type: "content", value: [imagePart(output.data)] };
|
|
1994
2014
|
}
|
|
1995
2015
|
envelope(block, content, isError = false) {
|
|
1996
2016
|
return {
|
|
@@ -2398,7 +2418,7 @@ var init_requestLedger = __esm({
|
|
|
2398
2418
|
"use strict";
|
|
2399
2419
|
init_worlds();
|
|
2400
2420
|
init_sessionContract();
|
|
2401
|
-
WORLD_REQUEST_VIAS = ["api", "ui", "tool"];
|
|
2421
|
+
WORLD_REQUEST_VIAS = ["api", "ui", "tool", "webhook"];
|
|
2402
2422
|
WorldRequestFilterError = class extends Error {
|
|
2403
2423
|
};
|
|
2404
2424
|
NOT_RECORDED = "This session's engine records no requests; only hosted World Host sessions do.";
|
|
@@ -3330,13 +3350,13 @@ var init_session2 = __esm({
|
|
|
3330
3350
|
WorldRequestQuery.parse({ cursor: opts.cursor, limit: opts.limit ?? REQUEST_LOG_PAGE_MAX })
|
|
3331
3351
|
);
|
|
3332
3352
|
}
|
|
3333
|
-
page(
|
|
3353
|
+
page(route2, limit, cursor) {
|
|
3334
3354
|
const query = new URLSearchParams({ limit: String(limit) });
|
|
3335
3355
|
if (cursor) query.set("cursor", cursor);
|
|
3336
3356
|
return apiRequest(
|
|
3337
3357
|
this.options,
|
|
3338
3358
|
"GET",
|
|
3339
|
-
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/${
|
|
3359
|
+
`/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/${route2}?${query.toString()}`
|
|
3340
3360
|
);
|
|
3341
3361
|
}
|
|
3342
3362
|
/** The session's call log, oldest first: every tool call, seed, reset,
|
|
@@ -5004,7 +5024,7 @@ var require_package = __commonJS({
|
|
|
5004
5024
|
"package.json"(exports, module) {
|
|
5005
5025
|
module.exports = {
|
|
5006
5026
|
name: "@withgateway/sdk",
|
|
5007
|
-
version: "0.
|
|
5027
|
+
version: "0.6.0",
|
|
5008
5028
|
description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
|
|
5009
5029
|
main: "./dist/index.js",
|
|
5010
5030
|
module: "./dist/index.mjs",
|
|
@@ -6279,6 +6299,112 @@ var init_requestLog = __esm({
|
|
|
6279
6299
|
}
|
|
6280
6300
|
});
|
|
6281
6301
|
|
|
6302
|
+
// src/worlds/webhooks.ts
|
|
6303
|
+
async function listWebhooks(options, sessionId, page = {}) {
|
|
6304
|
+
const query = new URLSearchParams({
|
|
6305
|
+
after: String(page.after ?? 0),
|
|
6306
|
+
limit: String(page.limit ?? WORLD_WEBHOOK_PAGE_MAX),
|
|
6307
|
+
tail: String(page.tail ?? false)
|
|
6308
|
+
});
|
|
6309
|
+
if (page.epoch) query.set("epoch", page.epoch);
|
|
6310
|
+
return apiRequest(options, "GET", `${route(sessionId)}?${query.toString()}`);
|
|
6311
|
+
}
|
|
6312
|
+
var WORLD_WEBHOOK_PAGE_MAX, FORWARD_TIMEOUT_MS, ERROR_CHARS, route, WorldWebhookForwarder;
|
|
6313
|
+
var init_webhooks = __esm({
|
|
6314
|
+
"src/worlds/webhooks.ts"() {
|
|
6315
|
+
"use strict";
|
|
6316
|
+
init_worlds();
|
|
6317
|
+
WORLD_WEBHOOK_PAGE_MAX = 100;
|
|
6318
|
+
FORWARD_TIMEOUT_MS = 1e4;
|
|
6319
|
+
ERROR_CHARS = 500;
|
|
6320
|
+
route = (sessionId) => `/api/public/world-sessions/${encodeURIComponent(sessionId)}/webhooks`;
|
|
6321
|
+
WorldWebhookForwarder = class {
|
|
6322
|
+
constructor(options, sessionId, forwardTo, opts = {}) {
|
|
6323
|
+
this.options = options;
|
|
6324
|
+
this.sessionId = sessionId;
|
|
6325
|
+
this.forwardTo = forwardTo;
|
|
6326
|
+
this.send = opts.fetch ?? fetch;
|
|
6327
|
+
}
|
|
6328
|
+
options;
|
|
6329
|
+
sessionId;
|
|
6330
|
+
forwardTo;
|
|
6331
|
+
after = 0;
|
|
6332
|
+
epoch = null;
|
|
6333
|
+
answers = [];
|
|
6334
|
+
send;
|
|
6335
|
+
get cursor() {
|
|
6336
|
+
return this.after;
|
|
6337
|
+
}
|
|
6338
|
+
/** Where forwarding begins: the deliveries the session still holds (`replay`), or only those it sends from now. */
|
|
6339
|
+
async start(replay) {
|
|
6340
|
+
if (replay) return null;
|
|
6341
|
+
const page = await this.poll([], { tail: true, limit: 1 });
|
|
6342
|
+
this.follow(page);
|
|
6343
|
+
return page;
|
|
6344
|
+
}
|
|
6345
|
+
/** One poll: the answers held so far sent, the next page forwarded. A poll that fails keeps its answers for the next. */
|
|
6346
|
+
async round() {
|
|
6347
|
+
const page = await this.withAnswers((answers) => this.poll(answers));
|
|
6348
|
+
const forwarded = [];
|
|
6349
|
+
for (const delivery of page.deliveries) {
|
|
6350
|
+
const answer = await this.forward(delivery);
|
|
6351
|
+
this.answers.push(answer);
|
|
6352
|
+
forwarded.push({ delivery, answer });
|
|
6353
|
+
}
|
|
6354
|
+
this.follow(page);
|
|
6355
|
+
return { page, forwarded };
|
|
6356
|
+
}
|
|
6357
|
+
/** Sends the answers still held; the cursor stays, so a delivery this poll returns is forwarded by the next round. */
|
|
6358
|
+
async settle() {
|
|
6359
|
+
if (this.answers.length === 0) return 0;
|
|
6360
|
+
const page = await this.withAnswers((answers) => this.poll(answers, { limit: 1 }));
|
|
6361
|
+
return page.answered;
|
|
6362
|
+
}
|
|
6363
|
+
follow(page) {
|
|
6364
|
+
this.after = page.next;
|
|
6365
|
+
this.epoch = page.epoch;
|
|
6366
|
+
}
|
|
6367
|
+
async withAnswers(poll) {
|
|
6368
|
+
const answers = this.answers.splice(0, WORLD_WEBHOOK_PAGE_MAX);
|
|
6369
|
+
try {
|
|
6370
|
+
return await poll(answers);
|
|
6371
|
+
} catch (error) {
|
|
6372
|
+
this.answers.unshift(...answers);
|
|
6373
|
+
throw error;
|
|
6374
|
+
}
|
|
6375
|
+
}
|
|
6376
|
+
poll(answers, opts = {}) {
|
|
6377
|
+
return apiRequest(this.options, "POST", route(this.sessionId), {
|
|
6378
|
+
after: this.after,
|
|
6379
|
+
epoch: this.epoch,
|
|
6380
|
+
tail: opts.tail ?? false,
|
|
6381
|
+
limit: opts.limit ?? WORLD_WEBHOOK_PAGE_MAX,
|
|
6382
|
+
subscriptions: false,
|
|
6383
|
+
answers
|
|
6384
|
+
});
|
|
6385
|
+
}
|
|
6386
|
+
async forward(delivery) {
|
|
6387
|
+
const started = Date.now();
|
|
6388
|
+
try {
|
|
6389
|
+
const reply = await this.send(this.forwardTo, {
|
|
6390
|
+
method: "POST",
|
|
6391
|
+
headers: delivery.headers,
|
|
6392
|
+
body: delivery.payload,
|
|
6393
|
+
redirect: "manual",
|
|
6394
|
+
signal: AbortSignal.timeout(FORWARD_TIMEOUT_MS)
|
|
6395
|
+
});
|
|
6396
|
+
await reply.arrayBuffer().catch(() => void 0);
|
|
6397
|
+
if (reply.status < 100 || reply.status > 599) throw new Error("the receiver answered an invalid HTTP status");
|
|
6398
|
+
return { id: delivery.id, status: reply.status, durationMs: Date.now() - started, error: null };
|
|
6399
|
+
} catch (error) {
|
|
6400
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6401
|
+
return { id: delivery.id, status: 0, durationMs: Date.now() - started, error: message.slice(0, ERROR_CHARS) };
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6404
|
+
};
|
|
6405
|
+
}
|
|
6406
|
+
});
|
|
6407
|
+
|
|
6282
6408
|
// src/worlds/checkoutTarget.ts
|
|
6283
6409
|
import * as fs2 from "fs";
|
|
6284
6410
|
import * as path3 from "path";
|
|
@@ -8080,9 +8206,9 @@ var init_router = __esm({
|
|
|
8080
8206
|
import * as fs6 from "fs";
|
|
8081
8207
|
import * as os from "os";
|
|
8082
8208
|
import * as path7 from "path";
|
|
8083
|
-
async function api(creds, method,
|
|
8084
|
-
const reply = await new PlatformTransport(creds).send(method,
|
|
8085
|
-
if (!reply.ok) throw new ApiError2(reply.status, method,
|
|
8209
|
+
async function api(creds, method, route2, body, init2 = {}) {
|
|
8210
|
+
const reply = await new PlatformTransport(creds).send(method, route2, body, init2);
|
|
8211
|
+
if (!reply.ok) throw new ApiError2(reply.status, method, route2, reply.text);
|
|
8086
8212
|
return reply.text ? JSON.parse(reply.text) : {};
|
|
8087
8213
|
}
|
|
8088
8214
|
var ApiError2;
|
|
@@ -8093,12 +8219,12 @@ var init_config = __esm({
|
|
|
8093
8219
|
init_worlds();
|
|
8094
8220
|
init_transport();
|
|
8095
8221
|
ApiError2 = class extends CliError {
|
|
8096
|
-
constructor(status, method,
|
|
8222
|
+
constructor(status, method, route2, text2) {
|
|
8097
8223
|
const body = parseErrorBody(text2, status);
|
|
8098
|
-
super(`${method} ${
|
|
8224
|
+
super(`${method} ${route2} -> ${status}: ${body.detail}`, 1);
|
|
8099
8225
|
this.status = status;
|
|
8100
8226
|
this.method = method;
|
|
8101
|
-
this.route =
|
|
8227
|
+
this.route = route2;
|
|
8102
8228
|
this.text = text2;
|
|
8103
8229
|
this.code = body.code;
|
|
8104
8230
|
}
|
|
@@ -8451,8 +8577,8 @@ async function runtime(creds, request, opts = {}) {
|
|
|
8451
8577
|
throw new CliError(
|
|
8452
8578
|
"This needs the schema runtime (the CLI bundles it) or platform credentials (`gateway auth login`). " + localRuntimeReason()
|
|
8453
8579
|
);
|
|
8454
|
-
const
|
|
8455
|
-
const res = await new PlatformTransport(creds).send("POST",
|
|
8580
|
+
const route2 = "/api/public/worlds/runtime";
|
|
8581
|
+
const res = await new PlatformTransport(creds).send("POST", route2, request, {
|
|
8456
8582
|
timeoutMs: opts.timeoutMs ?? RUNTIME_TIMEOUT_MS
|
|
8457
8583
|
});
|
|
8458
8584
|
let payload = null;
|
|
@@ -8464,8 +8590,8 @@ async function runtime(creds, request, opts = {}) {
|
|
|
8464
8590
|
const detail = detailFrom(payload);
|
|
8465
8591
|
if (detail) throw new BridgeRejected(detail);
|
|
8466
8592
|
if (!res.ok)
|
|
8467
|
-
throw new CliError(`POST ${
|
|
8468
|
-
if (payload === null) throw new CliError(`POST ${
|
|
8593
|
+
throw new CliError(`POST ${route2} (${request.command}) -> ${res.status}: ${res.text.slice(0, 600)}`, 1);
|
|
8594
|
+
if (payload === null) throw new CliError(`POST ${route2} (${request.command}) returned non-JSON`, 1);
|
|
8469
8595
|
return payload;
|
|
8470
8596
|
}
|
|
8471
8597
|
var MAX_WORLD_FILES, RUNTIME_TIMEOUT_MS, SKIP_DIRS, BridgeRejected, YAML_NAME, YAML_NEEDS_PYYAML, YAML_NOT_ON_PLATFORM, RuntimeRoute;
|
|
@@ -9746,6 +9872,7 @@ __export(worlds_exports, {
|
|
|
9746
9872
|
VERIFIER_REWARD_PREFIX: () => VERIFIER_REWARD_PREFIX,
|
|
9747
9873
|
WHITESPACE: () => WHITESPACE,
|
|
9748
9874
|
WORLD_REQUEST_VIAS: () => WORLD_REQUEST_VIAS,
|
|
9875
|
+
WORLD_WEBHOOK_PAGE_MAX: () => WORLD_WEBHOOK_PAGE_MAX,
|
|
9749
9876
|
WorldBrowser: () => WorldBrowser,
|
|
9750
9877
|
WorldCallTooLarge: () => WorldCallTooLarge,
|
|
9751
9878
|
WorldEditClient: () => WorldEditClient,
|
|
@@ -9764,6 +9891,7 @@ __export(worlds_exports, {
|
|
|
9764
9891
|
WorldSurfaceUnavailable: () => WorldSurfaceUnavailable,
|
|
9765
9892
|
WorldTask: () => WorldTask,
|
|
9766
9893
|
WorldToolsUnread: () => WorldToolsUnread,
|
|
9894
|
+
WorldWebhookForwarder: () => WorldWebhookForwarder,
|
|
9767
9895
|
WriteTreeFilter: () => WriteTreeFilter,
|
|
9768
9896
|
aggregateTaskGrade: () => aggregateTaskGrade,
|
|
9769
9897
|
apiRequest: () => apiRequest,
|
|
@@ -9811,6 +9939,7 @@ __export(worlds_exports, {
|
|
|
9811
9939
|
listSessions: () => listSessions,
|
|
9812
9940
|
listTaskSessions: () => listTaskSessions,
|
|
9813
9941
|
listTasks: () => listTasks,
|
|
9942
|
+
listWebhooks: () => listWebhooks,
|
|
9814
9943
|
localTreeState: () => localTreeState,
|
|
9815
9944
|
messageOf: () => messageOf,
|
|
9816
9945
|
migrateProjectWorlds: () => migrateProjectWorlds,
|
|
@@ -10112,6 +10241,7 @@ var init_worlds = __esm({
|
|
|
10112
10241
|
init_surfaceDescriptor();
|
|
10113
10242
|
init_requestLog();
|
|
10114
10243
|
init_requestLedger();
|
|
10244
|
+
init_webhooks();
|
|
10115
10245
|
init_browserReconnect();
|
|
10116
10246
|
init_nativeComputer();
|
|
10117
10247
|
init_hub();
|
|
@@ -10294,6 +10424,7 @@ export {
|
|
|
10294
10424
|
VERIFIER_REWARD_PREFIX,
|
|
10295
10425
|
WHITESPACE,
|
|
10296
10426
|
WORLD_REQUEST_VIAS,
|
|
10427
|
+
WORLD_WEBHOOK_PAGE_MAX,
|
|
10297
10428
|
WorldBrowser,
|
|
10298
10429
|
WorldCallTooLarge,
|
|
10299
10430
|
WorldEditClient,
|
|
@@ -10312,6 +10443,7 @@ export {
|
|
|
10312
10443
|
WorldSurfaceUnavailable,
|
|
10313
10444
|
WorldTask,
|
|
10314
10445
|
WorldToolsUnread,
|
|
10446
|
+
WorldWebhookForwarder,
|
|
10315
10447
|
WriteTreeFilter,
|
|
10316
10448
|
aggregateTaskGrade,
|
|
10317
10449
|
apiRequest,
|
|
@@ -10359,6 +10491,7 @@ export {
|
|
|
10359
10491
|
listSessions,
|
|
10360
10492
|
listTaskSessions,
|
|
10361
10493
|
listTasks,
|
|
10494
|
+
listWebhooks,
|
|
10362
10495
|
localTreeState,
|
|
10363
10496
|
messageOf,
|
|
10364
10497
|
migrateProjectWorlds,
|