@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.
Files changed (94) hide show
  1. package/dist/cli.js +1128 -783
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +1130 -785
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/files/index.js +47 -18
  6. package/dist/files/index.js.map +1 -1
  7. package/dist/files/index.mjs +47 -18
  8. package/dist/files/index.mjs.map +1 -1
  9. package/dist/{index-mJhG3vZU.d.mts → index-Di9nNqOY.d.mts} +26 -3
  10. package/dist/{index-DUHmS74p.d.ts → index-LA-PMRJT.d.ts} +26 -3
  11. package/dist/index.d.mts +3 -3
  12. package/dist/index.d.ts +3 -3
  13. package/dist/index.js +179 -43
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +176 -43
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/replay/index.d.mts +1 -1
  18. package/dist/replay/index.d.ts +1 -1
  19. package/dist/replay/index.js.map +1 -1
  20. package/dist/replay/index.mjs.map +1 -1
  21. package/dist/traces/index.js +47 -18
  22. package/dist/traces/index.js.map +1 -1
  23. package/dist/traces/index.mjs +47 -18
  24. package/dist/traces/index.mjs.map +1 -1
  25. package/dist/tracing/index.d.mts +1 -1
  26. package/dist/tracing/index.d.ts +1 -1
  27. package/dist/tracing/index.js +1 -1
  28. package/dist/tracing/index.js.map +1 -1
  29. package/dist/tracing/index.mjs +1 -1
  30. package/dist/tracing/index.mjs.map +1 -1
  31. package/dist/worlds/index.d.mts +184 -85
  32. package/dist/worlds/index.d.ts +184 -85
  33. package/dist/worlds/index.js +176 -43
  34. package/dist/worlds/index.js.map +1 -1
  35. package/dist/worlds/index.mjs +176 -43
  36. package/dist/worlds/index.mjs.map +1 -1
  37. package/package.json +1 -1
  38. package/runtime/gatewaysdk/environment/_bundle.py +4 -6
  39. package/runtime/gatewaysdk/environment/_world.py +24 -1
  40. package/runtime/gatewaysdk/environment/runtime.py +45 -2
  41. package/runtime/gatewaysdk/environment/schema/api.py +24 -3
  42. package/runtime/gatewaysdk/environment/schema/bundle_runtime.py +1 -0
  43. package/runtime/gatewaysdk/environment/schema/call_capture.py +13 -1
  44. package/runtime/gatewaysdk/environment/schema/call_log.py +46 -0
  45. package/runtime/gatewaysdk/environment/schema/call_redaction.py +6 -0
  46. package/runtime/gatewaysdk/environment/schema/compiler.py +4 -1
  47. package/runtime/gatewaysdk/environment/schema/conform.py +32 -8
  48. package/runtime/gatewaysdk/environment/schema/connector.py +5 -0
  49. package/runtime/gatewaysdk/environment/schema/connectors/custom/handlers.py +2 -1
  50. package/runtime/gatewaysdk/environment/schema/connectors/github/api/handlers.py +217 -58
  51. package/runtime/gatewaysdk/environment/schema/connectors/github/connector.toml +9 -19
  52. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_webhooks.json +10 -2
  53. package/runtime/gatewaysdk/environment/schema/connectors/github/tests/webhooks.json +47 -0
  54. package/runtime/gatewaysdk/environment/schema/connectors/github/world.json +21 -0
  55. package/runtime/gatewaysdk/environment/schema/connectors/jamf/api/handlers.py +185 -18
  56. package/runtime/gatewaysdk/environment/schema/connectors/jamf/connector.toml +29 -14
  57. package/runtime/gatewaysdk/environment/schema/connectors/jamf/provenance.json +43 -12
  58. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_webhooks.json +2 -2
  59. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scope.toml +4 -17
  60. package/runtime/gatewaysdk/environment/schema/connectors/jamf/tests/webhooks.json +107 -0
  61. package/runtime/gatewaysdk/environment/schema/connectors/jamf/vendor-openapi.json +1 -1
  62. package/runtime/gatewaysdk/environment/schema/connectors/linear/api/handlers.py +85 -1
  63. package/runtime/gatewaysdk/environment/schema/connectors/linear/connector.toml +19 -31
  64. package/runtime/gatewaysdk/environment/schema/connectors/linear/provenance.json +18 -8
  65. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/webhooks.json +19 -3
  66. package/runtime/gatewaysdk/environment/schema/connectors/linear/tests/test_webhooks.py +71 -0
  67. package/runtime/gatewaysdk/environment/schema/database/guard.py +2 -1
  68. package/runtime/gatewaysdk/environment/schema/handler_errors.py +27 -1
  69. package/runtime/gatewaysdk/environment/schema/journal.py +4 -3
  70. package/runtime/gatewaysdk/environment/schema/local.py +1 -0
  71. package/runtime/gatewaysdk/environment/schema/openapi_schemas.py +20 -5
  72. package/runtime/gatewaysdk/environment/schema/platform.py +16 -219
  73. package/runtime/gatewaysdk/environment/schema/runtime.py +7 -0
  74. package/runtime/gatewaysdk/environment/schema/scaffold.py +2 -1
  75. package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/CONNECTORS.md +3 -3
  76. package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +19 -22
  77. package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +7 -9
  78. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +3 -3
  79. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +14 -11
  80. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +36 -5
  81. package/runtime/gatewaysdk/environment/schema/snapshot.py +2 -2
  82. package/runtime/gatewaysdk/environment/schema/tools_world.py +19 -0
  83. package/runtime/gatewaysdk/environment/schema/verbs.py +6 -0
  84. package/runtime/gatewaysdk/environment/schema/webhooks.py +687 -0
  85. package/runtime/gatewaysdk/environment/schema/world_host.py +20 -3
  86. package/runtime/gatewaysdk/environment/schema/world_tests.py +74 -0
  87. package/skills/connector-schema-authoring/CONNECTORS.md +3 -3
  88. package/skills/connector-schema-authoring/SKILL.md +19 -22
  89. package/skills/connector-schema-authoring/connector-worlds.md +153 -11
  90. package/skills/connector-schema-authoring/world-schema.md +7 -6
  91. package/skills/world-data-ingestion/SKILL.md +7 -9
  92. package/skills/worlds-getting-started/SKILL.md +3 -3
  93. package/skills/worlds-getting-started/references/cli-mcp-map.md +14 -11
  94. package/skills/worlds-getting-started/references/gotchas.md +36 -5
package/dist/index.mjs CHANGED
@@ -535,11 +535,11 @@ var init_transport = __esm({
535
535
  }
536
536
  };
537
537
  UnreachableError = class extends Error {
538
- constructor(host, method, route, failure) {
539
- super(`${method} ${route}: no answer from ${host}: ${failure.describe()}. ${failure.next}`);
538
+ constructor(host, method, route2, failure) {
539
+ super(`${method} ${route2}: no answer from ${host}: ${failure.describe()}. ${failure.next}`);
540
540
  this.host = host;
541
541
  this.method = method;
542
- this.route = route;
542
+ this.route = route2;
543
543
  this.failure = failure;
544
544
  this.name = "UnreachableError";
545
545
  }
@@ -609,16 +609,16 @@ var init_transport = __esm({
609
609
  budget(ownMs) {
610
610
  return Math.max(ownMs ?? 0, this.timeoutMs);
611
611
  }
612
- async send(method, route, body, opts = {}) {
612
+ async send(method, route2, body, opts = {}) {
613
613
  const timeoutMs = this.budget(opts.timeoutMs);
614
- return (opts.retry ?? RetryPolicy.NONE).run(() => this.once(method, route, body, timeoutMs));
614
+ return (opts.retry ?? RetryPolicy.NONE).run(() => this.once(method, route2, body, timeoutMs));
615
615
  }
616
- async once(method, route, body, timeoutMs) {
616
+ async once(method, route2, body, timeoutMs) {
617
617
  const payload = body === void 0 ? {} : { body: JSON.stringify(body) };
618
618
  const controller = new AbortController();
619
619
  const timer = setTimeout(() => controller.abort(), timeoutMs);
620
620
  try {
621
- const res = await fetch(`${this.endpoint.host}${route}`, {
621
+ const res = await fetch(`${this.endpoint.host}${route2}`, {
622
622
  method,
623
623
  headers: {
624
624
  "content-type": "application/json",
@@ -631,7 +631,7 @@ var init_transport = __esm({
631
631
  return { status: res.status, ok: res.ok, text: await res.text() };
632
632
  } catch (error) {
633
633
  const cause = controller.signal.aborted ? TransportCause.timeout(timeoutMs) : TransportCause.of(error);
634
- throw new UnreachableError(this.endpoint.host, method, route, cause);
634
+ throw new UnreachableError(this.endpoint.host, method, route2, cause);
635
635
  } finally {
636
636
  clearTimeout(timer);
637
637
  }
@@ -1893,11 +1893,11 @@ var init_media = __esm({
1893
1893
  status
1894
1894
  );
1895
1895
  }
1896
- async send(method, route, body) {
1897
- const reply = await this.transport.send(method, route, body);
1896
+ async send(method, route2, body) {
1897
+ const reply = await this.transport.send(method, route2, body);
1898
1898
  if (!reply.ok)
1899
1899
  throw new MediaUploadError(
1900
- `${method} ${route} -> ${reply.status}`,
1900
+ `${method} ${route2} -> ${reply.status}`,
1901
1901
  reply.status
1902
1902
  );
1903
1903
  return reply.text ? JSON.parse(reply.text) : {};
@@ -2250,7 +2250,7 @@ function click(button, count) {
2250
2250
  modifiers: modifierChord(raw.text)
2251
2251
  });
2252
2252
  }
2253
- var SCROLL_STEP_PX, NOT_EXECUTED, MAX_ERROR2, SCROLL_DIRECTIONS, MEMBERS, AnthropicComputer, AnthropicComputer20251124;
2253
+ var SCROLL_STEP_PX, NOT_EXECUTED, MAX_ERROR2, SCROLL_DIRECTIONS, IMAGE_PARTS, MEMBERS, AnthropicComputer, AnthropicComputer20251124;
2254
2254
  var init_anthropic = __esm({
2255
2255
  "src/worlds/nativeComputer/anthropic.ts"() {
2256
2256
  "use strict";
@@ -2266,6 +2266,14 @@ var init_anthropic = __esm({
2266
2266
  left: [-1, 0],
2267
2267
  right: [1, 0]
2268
2268
  };
2269
+ IMAGE_PARTS = {
2270
+ 6: (data) => ({ type: "image-data", data, mediaType: "image/png" }),
2271
+ 7: (data) => ({
2272
+ type: "file",
2273
+ mediaType: "image/png",
2274
+ data: { type: "data", data }
2275
+ })
2276
+ };
2269
2277
  MEMBERS = {
2270
2278
  screenshot: () => new ComputerAction("screenshot"),
2271
2279
  zoom: (raw) => new ComputerAction("zoom", {
@@ -2375,15 +2383,17 @@ var init_anthropic = __esm({
2375
2383
  ];
2376
2384
  return [{ type: "text", text: result.text ?? "OK" }];
2377
2385
  }
2378
- /** For `anthropic.tools.computerToolset_20260801({ ...computer.aiSdk() })`
2379
- * (or `computer_20251124` with the legacy kind): `execute` runs one action
2380
- * and returns `{ type: "image", data }` or text; `toModelOutput` turns that
2381
- * into the tool result. Calls run one at a time, and once a call fails the
2386
+ /** For `anthropic.tools.computerToolset_20260801(computer.aiSdk({ version: 7 }))`
2387
+ * (AI SDK 7 only), or `computer_20251124` with the legacy kind (AI SDK 6
2388
+ * and 7): `execute` runs one action and returns `{ type: "image", data }` or
2389
+ * text; `toModelOutput` turns that into the tool result in the part shape
2390
+ * of `options.version`. Calls run one at a time, and once a call fails the
2382
2391
  * rest of that step's calls answer as not executed. */
2383
- aiSdk() {
2392
+ aiSdk(options = {}) {
2393
+ const imagePart = _AnthropicComputer.imagePart(options);
2384
2394
  let failedStep;
2385
- const execute = (input, options) => this.serial(async () => {
2386
- const step = options?.messages?.length;
2395
+ const execute = (input, options2) => this.serial(async () => {
2396
+ const step = options2?.messages?.length;
2387
2397
  if (step !== void 0 && step === failedStep)
2388
2398
  throw new Error(NOT_EXECUTED);
2389
2399
  try {
@@ -2395,7 +2405,7 @@ var init_anthropic = __esm({
2395
2405
  });
2396
2406
  return {
2397
2407
  execute,
2398
- toModelOutput: ({ output }) => _AnthropicComputer.aiSdkModelOutput(output)
2408
+ toModelOutput: ({ output }) => _AnthropicComputer.modelOutput(output, imagePart)
2399
2409
  };
2400
2410
  }
2401
2411
  static aiSdkOutput(result) {
@@ -2403,16 +2413,26 @@ var init_anthropic = __esm({
2403
2413
  return { type: "image", data: result.image.toString("base64") };
2404
2414
  return result.text ?? "OK";
2405
2415
  }
2406
- /** `image-data` is what AI SDK 6's Anthropic provider turns into an image
2407
- * block; AI SDK 7 still accepts it (and converts it to a `file` part). */
2408
- static aiSdkModelOutput(output) {
2416
+ /** A screenshot as the image part of AI SDK `options.version`:
2417
+ * `image-data` for 6 (the default), `file` with `{ type: "data", data }`
2418
+ * for 7. */
2419
+ static aiSdkModelOutput(output, options = {}) {
2420
+ return _AnthropicComputer.modelOutput(
2421
+ output,
2422
+ _AnthropicComputer.imagePart(options)
2423
+ );
2424
+ }
2425
+ static imagePart({
2426
+ version = 6
2427
+ }) {
2428
+ if (Object.hasOwn(IMAGE_PARTS, version)) return IMAGE_PARTS[version];
2429
+ throw new Error(
2430
+ `unsupported AI SDK version ${version}; choose ${Object.keys(IMAGE_PARTS).join(" or ")}`
2431
+ );
2432
+ }
2433
+ static modelOutput(output, imagePart) {
2409
2434
  if (typeof output === "string") return { type: "text", value: output };
2410
- return {
2411
- type: "content",
2412
- value: [
2413
- { type: "image-data", data: output.data, mediaType: "image/png" }
2414
- ]
2415
- };
2435
+ return { type: "content", value: [imagePart(output.data)] };
2416
2436
  }
2417
2437
  envelope(block, content, isError = false) {
2418
2438
  return {
@@ -2820,7 +2840,7 @@ var init_requestLedger = __esm({
2820
2840
  "use strict";
2821
2841
  init_worlds();
2822
2842
  init_sessionContract();
2823
- WORLD_REQUEST_VIAS = ["api", "ui", "tool"];
2843
+ WORLD_REQUEST_VIAS = ["api", "ui", "tool", "webhook"];
2824
2844
  WorldRequestFilterError = class extends Error {
2825
2845
  };
2826
2846
  NOT_RECORDED = "This session's engine records no requests; only hosted World Host sessions do.";
@@ -3752,13 +3772,13 @@ var init_session2 = __esm({
3752
3772
  WorldRequestQuery.parse({ cursor: opts.cursor, limit: opts.limit ?? REQUEST_LOG_PAGE_MAX })
3753
3773
  );
3754
3774
  }
3755
- page(route, limit, cursor) {
3775
+ page(route2, limit, cursor) {
3756
3776
  const query = new URLSearchParams({ limit: String(limit) });
3757
3777
  if (cursor) query.set("cursor", cursor);
3758
3778
  return apiRequest(
3759
3779
  this.options,
3760
3780
  "GET",
3761
- `/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/${route}?${query.toString()}`
3781
+ `/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/${route2}?${query.toString()}`
3762
3782
  );
3763
3783
  }
3764
3784
  /** The session's call log, oldest first: every tool call, seed, reset,
@@ -5043,7 +5063,7 @@ var require_package = __commonJS({
5043
5063
  "package.json"(exports, module) {
5044
5064
  module.exports = {
5045
5065
  name: "@withgateway/sdk",
5046
- version: "0.4.0",
5066
+ version: "0.6.0",
5047
5067
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
5048
5068
  main: "./dist/index.js",
5049
5069
  module: "./dist/index.mjs",
@@ -6405,6 +6425,112 @@ var init_requestLog = __esm({
6405
6425
  }
6406
6426
  });
6407
6427
 
6428
+ // src/worlds/webhooks.ts
6429
+ async function listWebhooks(options, sessionId, page = {}) {
6430
+ const query = new URLSearchParams({
6431
+ after: String(page.after ?? 0),
6432
+ limit: String(page.limit ?? WORLD_WEBHOOK_PAGE_MAX),
6433
+ tail: String(page.tail ?? false)
6434
+ });
6435
+ if (page.epoch) query.set("epoch", page.epoch);
6436
+ return apiRequest(options, "GET", `${route(sessionId)}?${query.toString()}`);
6437
+ }
6438
+ var WORLD_WEBHOOK_PAGE_MAX, FORWARD_TIMEOUT_MS, ERROR_CHARS, route, WorldWebhookForwarder;
6439
+ var init_webhooks = __esm({
6440
+ "src/worlds/webhooks.ts"() {
6441
+ "use strict";
6442
+ init_worlds();
6443
+ WORLD_WEBHOOK_PAGE_MAX = 100;
6444
+ FORWARD_TIMEOUT_MS = 1e4;
6445
+ ERROR_CHARS = 500;
6446
+ route = (sessionId) => `/api/public/world-sessions/${encodeURIComponent(sessionId)}/webhooks`;
6447
+ WorldWebhookForwarder = class {
6448
+ constructor(options, sessionId, forwardTo, opts = {}) {
6449
+ this.options = options;
6450
+ this.sessionId = sessionId;
6451
+ this.forwardTo = forwardTo;
6452
+ this.send = opts.fetch ?? fetch;
6453
+ }
6454
+ options;
6455
+ sessionId;
6456
+ forwardTo;
6457
+ after = 0;
6458
+ epoch = null;
6459
+ answers = [];
6460
+ send;
6461
+ get cursor() {
6462
+ return this.after;
6463
+ }
6464
+ /** Where forwarding begins: the deliveries the session still holds (`replay`), or only those it sends from now. */
6465
+ async start(replay2) {
6466
+ if (replay2) return null;
6467
+ const page = await this.poll([], { tail: true, limit: 1 });
6468
+ this.follow(page);
6469
+ return page;
6470
+ }
6471
+ /** One poll: the answers held so far sent, the next page forwarded. A poll that fails keeps its answers for the next. */
6472
+ async round() {
6473
+ const page = await this.withAnswers((answers) => this.poll(answers));
6474
+ const forwarded = [];
6475
+ for (const delivery of page.deliveries) {
6476
+ const answer = await this.forward(delivery);
6477
+ this.answers.push(answer);
6478
+ forwarded.push({ delivery, answer });
6479
+ }
6480
+ this.follow(page);
6481
+ return { page, forwarded };
6482
+ }
6483
+ /** Sends the answers still held; the cursor stays, so a delivery this poll returns is forwarded by the next round. */
6484
+ async settle() {
6485
+ if (this.answers.length === 0) return 0;
6486
+ const page = await this.withAnswers((answers) => this.poll(answers, { limit: 1 }));
6487
+ return page.answered;
6488
+ }
6489
+ follow(page) {
6490
+ this.after = page.next;
6491
+ this.epoch = page.epoch;
6492
+ }
6493
+ async withAnswers(poll) {
6494
+ const answers = this.answers.splice(0, WORLD_WEBHOOK_PAGE_MAX);
6495
+ try {
6496
+ return await poll(answers);
6497
+ } catch (error) {
6498
+ this.answers.unshift(...answers);
6499
+ throw error;
6500
+ }
6501
+ }
6502
+ poll(answers, opts = {}) {
6503
+ return apiRequest(this.options, "POST", route(this.sessionId), {
6504
+ after: this.after,
6505
+ epoch: this.epoch,
6506
+ tail: opts.tail ?? false,
6507
+ limit: opts.limit ?? WORLD_WEBHOOK_PAGE_MAX,
6508
+ subscriptions: false,
6509
+ answers
6510
+ });
6511
+ }
6512
+ async forward(delivery) {
6513
+ const started = Date.now();
6514
+ try {
6515
+ const reply = await this.send(this.forwardTo, {
6516
+ method: "POST",
6517
+ headers: delivery.headers,
6518
+ body: delivery.payload,
6519
+ redirect: "manual",
6520
+ signal: AbortSignal.timeout(FORWARD_TIMEOUT_MS)
6521
+ });
6522
+ await reply.arrayBuffer().catch(() => void 0);
6523
+ if (reply.status < 100 || reply.status > 599) throw new Error("the receiver answered an invalid HTTP status");
6524
+ return { id: delivery.id, status: reply.status, durationMs: Date.now() - started, error: null };
6525
+ } catch (error) {
6526
+ const message = error instanceof Error ? error.message : String(error);
6527
+ return { id: delivery.id, status: 0, durationMs: Date.now() - started, error: message.slice(0, ERROR_CHARS) };
6528
+ }
6529
+ }
6530
+ };
6531
+ }
6532
+ });
6533
+
6408
6534
  // src/worlds/checkoutTarget.ts
6409
6535
  import * as fs2 from "fs";
6410
6536
  import * as path3 from "path";
@@ -8206,9 +8332,9 @@ var init_router = __esm({
8206
8332
  import * as fs6 from "fs";
8207
8333
  import * as os from "os";
8208
8334
  import * as path7 from "path";
8209
- async function api(creds, method, route, body, init3 = {}) {
8210
- const reply = await new PlatformTransport(creds).send(method, route, body, init3);
8211
- if (!reply.ok) throw new ApiError2(reply.status, method, route, reply.text);
8335
+ async function api(creds, method, route2, body, init3 = {}) {
8336
+ const reply = await new PlatformTransport(creds).send(method, route2, body, init3);
8337
+ if (!reply.ok) throw new ApiError2(reply.status, method, route2, reply.text);
8212
8338
  return reply.text ? JSON.parse(reply.text) : {};
8213
8339
  }
8214
8340
  var ApiError2;
@@ -8219,12 +8345,12 @@ var init_config = __esm({
8219
8345
  init_worlds();
8220
8346
  init_transport();
8221
8347
  ApiError2 = class extends CliError {
8222
- constructor(status, method, route, text2) {
8348
+ constructor(status, method, route2, text2) {
8223
8349
  const body = parseErrorBody(text2, status);
8224
- super(`${method} ${route} -> ${status}: ${body.detail}`, 1);
8350
+ super(`${method} ${route2} -> ${status}: ${body.detail}`, 1);
8225
8351
  this.status = status;
8226
8352
  this.method = method;
8227
- this.route = route;
8353
+ this.route = route2;
8228
8354
  this.text = text2;
8229
8355
  this.code = body.code;
8230
8356
  }
@@ -8577,8 +8703,8 @@ async function runtime(creds, request, opts = {}) {
8577
8703
  throw new CliError(
8578
8704
  "This needs the schema runtime (the CLI bundles it) or platform credentials (`gateway auth login`). " + localRuntimeReason()
8579
8705
  );
8580
- const route = "/api/public/worlds/runtime";
8581
- const res = await new PlatformTransport(creds).send("POST", route, request, {
8706
+ const route2 = "/api/public/worlds/runtime";
8707
+ const res = await new PlatformTransport(creds).send("POST", route2, request, {
8582
8708
  timeoutMs: opts.timeoutMs ?? RUNTIME_TIMEOUT_MS
8583
8709
  });
8584
8710
  let payload = null;
@@ -8590,8 +8716,8 @@ async function runtime(creds, request, opts = {}) {
8590
8716
  const detail = detailFrom(payload);
8591
8717
  if (detail) throw new BridgeRejected(detail);
8592
8718
  if (!res.ok)
8593
- throw new CliError(`POST ${route} (${request.command}) -> ${res.status}: ${res.text.slice(0, 600)}`, 1);
8594
- if (payload === null) throw new CliError(`POST ${route} (${request.command}) returned non-JSON`, 1);
8719
+ throw new CliError(`POST ${route2} (${request.command}) -> ${res.status}: ${res.text.slice(0, 600)}`, 1);
8720
+ if (payload === null) throw new CliError(`POST ${route2} (${request.command}) returned non-JSON`, 1);
8595
8721
  return payload;
8596
8722
  }
8597
8723
  var MAX_WORLD_FILES, RUNTIME_TIMEOUT_MS, SKIP_DIRS, BridgeRejected, YAML_NAME, YAML_NEEDS_PYYAML, YAML_NOT_ON_PLATFORM, RuntimeRoute;
@@ -9872,6 +9998,7 @@ __export(worlds_exports, {
9872
9998
  VERIFIER_REWARD_PREFIX: () => VERIFIER_REWARD_PREFIX,
9873
9999
  WHITESPACE: () => WHITESPACE,
9874
10000
  WORLD_REQUEST_VIAS: () => WORLD_REQUEST_VIAS,
10001
+ WORLD_WEBHOOK_PAGE_MAX: () => WORLD_WEBHOOK_PAGE_MAX,
9875
10002
  WorldBrowser: () => WorldBrowser,
9876
10003
  WorldCallTooLarge: () => WorldCallTooLarge,
9877
10004
  WorldEditClient: () => WorldEditClient,
@@ -9890,6 +10017,7 @@ __export(worlds_exports, {
9890
10017
  WorldSurfaceUnavailable: () => WorldSurfaceUnavailable,
9891
10018
  WorldTask: () => WorldTask,
9892
10019
  WorldToolsUnread: () => WorldToolsUnread,
10020
+ WorldWebhookForwarder: () => WorldWebhookForwarder,
9893
10021
  WriteTreeFilter: () => WriteTreeFilter,
9894
10022
  aggregateTaskGrade: () => aggregateTaskGrade,
9895
10023
  apiRequest: () => apiRequest,
@@ -9937,6 +10065,7 @@ __export(worlds_exports, {
9937
10065
  listSessions: () => listSessions,
9938
10066
  listTaskSessions: () => listTaskSessions,
9939
10067
  listTasks: () => listTasks,
10068
+ listWebhooks: () => listWebhooks,
9940
10069
  localTreeState: () => localTreeState,
9941
10070
  messageOf: () => messageOf,
9942
10071
  migrateProjectWorlds: () => migrateProjectWorlds,
@@ -10239,6 +10368,7 @@ var init_worlds = __esm({
10239
10368
  init_surfaceDescriptor();
10240
10369
  init_requestLog();
10241
10370
  init_requestLedger();
10371
+ init_webhooks();
10242
10372
  init_browserReconnect();
10243
10373
  init_nativeComputer();
10244
10374
  init_hub();
@@ -18248,6 +18378,7 @@ export {
18248
18378
  VERIFIER_REWARD_PREFIX,
18249
18379
  WHITESPACE,
18250
18380
  WORLD_REQUEST_VIAS,
18381
+ WORLD_WEBHOOK_PAGE_MAX,
18251
18382
  WorldBrowser,
18252
18383
  WorldCallTooLarge,
18253
18384
  WorldEditClient,
@@ -18266,6 +18397,7 @@ export {
18266
18397
  WorldSurfaceUnavailable,
18267
18398
  WorldTask,
18268
18399
  WorldToolsUnread,
18400
+ WorldWebhookForwarder,
18269
18401
  WriteTreeFilter,
18270
18402
  addExperimentAttributes,
18271
18403
  aggregateTaskGrade,
@@ -18335,6 +18467,7 @@ export {
18335
18467
  listSessions,
18336
18468
  listTaskSessions,
18337
18469
  listTasks,
18470
+ listWebhooks,
18338
18471
  loadSession,
18339
18472
  localTreeState,
18340
18473
  memory,