@withgateway/sdk 0.3.0 → 0.3.3

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 (130) hide show
  1. package/README.md +6 -1
  2. package/dist/cli.js +3971 -2338
  3. package/dist/cli.js.map +1 -1
  4. package/dist/cli.mjs +3950 -2318
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/files/index.d.mts +1 -1
  7. package/dist/files/index.d.ts +1 -1
  8. package/dist/files/index.js +214 -41
  9. package/dist/files/index.js.map +1 -1
  10. package/dist/files/index.mjs +206 -35
  11. package/dist/files/index.mjs.map +1 -1
  12. package/dist/{index-DAb-FCMg.d.ts → index-DUHmS74p.d.ts} +3 -13
  13. package/dist/{index-D6oi1TWE.d.mts → index-mJhG3vZU.d.mts} +3 -13
  14. package/dist/index.d.mts +4 -4
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.js +1456 -564
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +1433 -557
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/{media-CbcAfQvd.d.mts → media-BIApiPzS.d.mts} +21 -2
  21. package/dist/{media-CbcAfQvd.d.ts → media-BIApiPzS.d.ts} +21 -2
  22. package/dist/traces/index.d.mts +1 -1
  23. package/dist/traces/index.d.ts +1 -1
  24. package/dist/traces/index.js +211 -38
  25. package/dist/traces/index.js.map +1 -1
  26. package/dist/traces/index.mjs +203 -32
  27. package/dist/traces/index.mjs.map +1 -1
  28. package/dist/tracing/index.d.mts +2 -2
  29. package/dist/tracing/index.d.ts +2 -2
  30. package/dist/tracing/index.js +96 -21
  31. package/dist/tracing/index.js.map +1 -1
  32. package/dist/tracing/index.mjs +96 -21
  33. package/dist/tracing/index.mjs.map +1 -1
  34. package/dist/worlds/index.d.mts +300 -123
  35. package/dist/worlds/index.d.ts +300 -123
  36. package/dist/worlds/index.js +1385 -508
  37. package/dist/worlds/index.js.map +1 -1
  38. package/dist/worlds/index.mjs +1377 -501
  39. package/dist/worlds/index.mjs.map +1 -1
  40. package/package.json +1 -1
  41. package/runtime/gatewaysdk/environment/_bundle.py +2 -27
  42. package/runtime/gatewaysdk/environment/_materialize.py +49 -69
  43. package/runtime/gatewaysdk/environment/_world.py +122 -197
  44. package/runtime/gatewaysdk/environment/backing.py +137 -0
  45. package/runtime/gatewaysdk/environment/core.py +1 -1
  46. package/runtime/gatewaysdk/environment/legacy_sqlite.py +301 -0
  47. package/runtime/gatewaysdk/environment/reward_keys.py +25 -0
  48. package/runtime/gatewaysdk/environment/runtime.py +8 -13
  49. package/runtime/gatewaysdk/environment/schema/__init__.py +4 -4
  50. package/runtime/gatewaysdk/environment/schema/admin_routes.py +86 -0
  51. package/runtime/gatewaysdk/environment/schema/api.py +266 -515
  52. package/runtime/gatewaysdk/environment/schema/batch.py +42 -37
  53. package/runtime/gatewaysdk/environment/schema/bundle_runtime.py +17 -5
  54. package/runtime/gatewaysdk/environment/schema/call_log.py +291 -0
  55. package/runtime/gatewaysdk/environment/schema/call_redaction.py +344 -0
  56. package/runtime/gatewaysdk/environment/schema/cast.py +31 -4
  57. package/runtime/gatewaysdk/environment/schema/compiler.py +334 -158
  58. package/runtime/gatewaysdk/environment/schema/conform.py +8 -12
  59. package/runtime/gatewaysdk/environment/schema/connector.py +27 -62
  60. package/runtime/gatewaysdk/environment/schema/data.py +50 -207
  61. package/runtime/gatewaysdk/environment/schema/database/__init__.py +24 -0
  62. package/runtime/gatewaysdk/environment/schema/database/audit.py +121 -0
  63. package/runtime/gatewaysdk/environment/schema/database/base.py +995 -0
  64. package/runtime/gatewaysdk/environment/schema/database/budget.py +33 -0
  65. package/runtime/gatewaysdk/environment/schema/database/connections.py +101 -0
  66. package/runtime/gatewaysdk/environment/schema/database/engines.py +8 -0
  67. package/runtime/gatewaysdk/environment/schema/database/guard.py +208 -0
  68. package/runtime/gatewaysdk/environment/schema/database/ingest.py +154 -0
  69. package/runtime/gatewaysdk/environment/schema/database/matching.py +58 -0
  70. package/runtime/gatewaysdk/environment/schema/database/provenance.py +30 -0
  71. package/runtime/gatewaysdk/environment/schema/database/rows.py +53 -0
  72. package/runtime/gatewaysdk/environment/schema/database/runtime_rows.py +39 -0
  73. package/runtime/gatewaysdk/environment/schema/database/sqlite.py +367 -0
  74. package/runtime/gatewaysdk/environment/schema/domain_migration.py +236 -0
  75. package/runtime/gatewaysdk/environment/schema/envelope.py +169 -0
  76. package/runtime/gatewaysdk/environment/schema/extract.py +6 -13
  77. package/runtime/gatewaysdk/environment/schema/grading.py +45 -30
  78. package/runtime/gatewaysdk/environment/schema/handler_errors.py +142 -12
  79. package/runtime/gatewaysdk/environment/schema/host.py +158 -250
  80. package/runtime/gatewaysdk/environment/schema/lanes.py +53 -0
  81. package/runtime/gatewaysdk/environment/schema/local.py +44 -71
  82. package/runtime/gatewaysdk/environment/schema/mapping.py +5 -25
  83. package/runtime/gatewaysdk/environment/schema/openapi_import.py +112 -73
  84. package/runtime/gatewaysdk/environment/schema/openapi_paging.py +147 -0
  85. package/runtime/gatewaysdk/environment/schema/openapi_payloads.py +288 -0
  86. package/runtime/gatewaysdk/environment/schema/openapi_routes.py +97 -102
  87. package/runtime/gatewaysdk/environment/schema/openapi_schemas.py +113 -30
  88. package/runtime/gatewaysdk/environment/schema/platform.py +124 -178
  89. package/runtime/gatewaysdk/environment/schema/platform_import.py +2 -3
  90. package/runtime/gatewaysdk/environment/schema/platform_query.py +61 -5
  91. package/runtime/gatewaysdk/environment/schema/primary_key.py +61 -0
  92. package/runtime/gatewaysdk/environment/schema/proof.py +19 -12
  93. package/runtime/gatewaysdk/environment/schema/runtime.py +77 -160
  94. package/runtime/gatewaysdk/environment/schema/served_names.py +58 -0
  95. package/runtime/gatewaysdk/environment/schema/session_files.py +166 -0
  96. package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +2 -2
  97. package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +22 -14
  98. package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +29 -3
  99. package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +16 -16
  100. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +18 -18
  101. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +3 -2
  102. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +15 -0
  103. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/openapi-import.md +50 -21
  104. package/runtime/gatewaysdk/environment/schema/slack.py +4 -8
  105. package/runtime/gatewaysdk/environment/schema/snapshot.py +385 -129
  106. package/runtime/gatewaysdk/environment/schema/store_contract.py +8 -14
  107. package/runtime/gatewaysdk/environment/schema/tasks.py +140 -55
  108. package/runtime/gatewaysdk/environment/schema/tools_world.py +110 -87
  109. package/runtime/gatewaysdk/environment/schema/ui.py +24 -5
  110. package/runtime/gatewaysdk/environment/schema/ui_static/app.js +100 -130
  111. package/runtime/gatewaysdk/environment/schema/ui_static/index.html +1 -8
  112. package/runtime/gatewaysdk/environment/schema/validation.py +166 -40
  113. package/runtime/gatewaysdk/environment/schema/workers.py +142 -57
  114. package/runtime/gatewaysdk/environment/schema/world_sql.py +81 -0
  115. package/runtime/gatewaysdk/environment/schema/world_tests.py +71 -39
  116. package/runtime/gatewaysdk/environment/score.py +57 -0
  117. package/runtime/gatewaysdk/environment/secret_values.py +36 -0
  118. package/runtime/gatewaysdk/environment/world.py +42 -3
  119. package/runtime/gatewaysdk/environment/world_session_contract.py +32 -5
  120. package/skills/benchmarks-getting-started/SKILL.md +2 -2
  121. package/skills/connector-schema-authoring/SKILL.md +22 -14
  122. package/skills/connector-schema-authoring/connector-worlds.md +26 -10
  123. package/skills/connector-schema-authoring/world-schema.md +111 -51
  124. package/skills/world-data-ingestion/ROWS.md +29 -3
  125. package/skills/world-data-ingestion/SKILL.md +16 -16
  126. package/skills/worlds-getting-started/SKILL.md +18 -18
  127. package/skills/worlds-getting-started/references/cli-mcp-map.md +3 -2
  128. package/skills/worlds-getting-started/references/gotchas.md +15 -0
  129. package/skills/worlds-getting-started/references/openapi-import.md +50 -21
  130. package/runtime/gatewaysdk/environment/schema/store.py +0 -1013
@@ -1,3 +1,3 @@
1
1
  import '../worlds/index.mjs';
2
2
  export { D as DRIVE_PREFIX, a as DriveDownload, b as DriveFile, c as DriveFolder, d as DriveListing, F as FetchHeader, e as FetchToDriveOptions, f as FetchToDriveResult, g as FileConnector, U as UploadOptions, h as UploadResult, j as confirmUpload, k as contentTypeFor, l as createFolder, m as deleteFile, n as downloadFile, o as drivePath, p as fetchToDrive, q as getFile, r as isDriveRef, s as iterateFiles, t as listFileConnectors, u as listFiles, v as moveFile, w as readFile, x as requestUpload, y as sha256Base64, z as syncFileConnector, A as uploadBytes, B as uploadFile } from '../index-FfK4Nump.mjs';
3
- import '../media-CbcAfQvd.mjs';
3
+ import '../media-BIApiPzS.mjs';
@@ -1,3 +1,3 @@
1
1
  import '../worlds/index.js';
2
2
  export { D as DRIVE_PREFIX, a as DriveDownload, b as DriveFile, c as DriveFolder, d as DriveListing, F as FetchHeader, e as FetchToDriveOptions, f as FetchToDriveResult, g as FileConnector, U as UploadOptions, h as UploadResult, j as confirmUpload, k as contentTypeFor, l as createFolder, m as deleteFile, n as downloadFile, o as drivePath, p as fetchToDrive, q as getFile, r as isDriveRef, s as iterateFiles, t as listFileConnectors, u as listFiles, v as moveFile, w as readFile, x as requestUpload, y as sha256Base64, z as syncFileConnector, A as uploadBytes, B as uploadFile } from '../index-D-_4Ibcn.js';
3
- import '../media-CbcAfQvd.js';
3
+ import '../media-BIApiPzS.js';
@@ -35,6 +35,28 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
35
35
  ));
36
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
37
 
38
+ // src/worlds/platformEndpoint.ts
39
+ function platformEndpoint(options) {
40
+ const publicKey = options.publicKey ?? process.env.GATEWAY_PUBLIC_KEY;
41
+ const secretKey = options.secretKey ?? process.env.GATEWAY_SECRET_KEY;
42
+ if (!publicKey || !secretKey) return null;
43
+ const host = options.host ?? process.env.GATEWAY_HOST ?? DEFAULT_HOST;
44
+ return { host: host.replace(/\/+$/, ""), publicKey, secretKey };
45
+ }
46
+ function requirePlatformEndpoint(options) {
47
+ const endpoint = platformEndpoint(options);
48
+ if (!endpoint) throw new Error(GATEWAY_KEYS_MISSING);
49
+ return endpoint;
50
+ }
51
+ var DEFAULT_HOST, GATEWAY_KEYS_MISSING;
52
+ var init_platformEndpoint = __esm({
53
+ "src/worlds/platformEndpoint.ts"() {
54
+ "use strict";
55
+ DEFAULT_HOST = "https://withgateway.ai";
56
+ GATEWAY_KEYS_MISSING = "Gateway keys missing: set GATEWAY_PUBLIC_KEY / GATEWAY_SECRET_KEY (or pass publicKey/secretKey).";
57
+ }
58
+ });
59
+
38
60
  // src/worlds/transport.ts
39
61
  function platformTimeoutMs(env = process.env) {
40
62
  const raw = env[PLATFORM_TIMEOUT_ENV];
@@ -43,7 +65,7 @@ function platformTimeoutMs(env = process.env) {
43
65
  if (Number.isInteger(value) && value > 0) return value;
44
66
  throw new Error(`${PLATFORM_TIMEOUT_ENV} must be a positive whole number of milliseconds, not \`${raw}\`.`);
45
67
  }
46
- var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, PlatformTransport;
68
+ var PLATFORM_TIMEOUT_ENV, PLATFORM_TIMEOUT_DEFAULT_MS, CHECK_HOST, RETRY, CAUSES, UNKNOWN_CAUSE, TransportCause, UnreachableError, sleep, RetryPolicy, Attempt, PlatformTransport;
47
69
  var init_transport = __esm({
48
70
  "src/worlds/transport.ts"() {
49
71
  "use strict";
@@ -105,6 +127,56 @@ var init_transport = __esm({
105
127
  route;
106
128
  failure;
107
129
  };
130
+ sleep = (ms) => new Promise((resolve4) => setTimeout(resolve4, ms));
131
+ RetryPolicy = class _RetryPolicy {
132
+ constructor(delaysMs, wait = sleep, budgetMs = Number.POSITIVE_INFINITY, now = Date.now) {
133
+ this.delaysMs = delaysMs;
134
+ this.wait = wait;
135
+ this.budgetMs = budgetMs;
136
+ this.now = now;
137
+ }
138
+ delaysMs;
139
+ wait;
140
+ budgetMs;
141
+ now;
142
+ static NONE = new _RetryPolicy([]);
143
+ /** A platform restart or a short edge outage: no wait starts that would end past five minutes, so a step ends
144
+ * within the budget plus one request timeout. */
145
+ static FILING = new _RetryPolicy([250, 500, 1e3, 2e3, 4e3, 8e3, 16e3, 3e4], sleep, 3e5);
146
+ static TRANSIENT_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
147
+ async run(attempt) {
148
+ const started = this.now();
149
+ for (let tries = 0; ; tries += 1) {
150
+ const outcome = await Attempt.of(attempt);
151
+ const delayMs = this.delaysMs[tries];
152
+ const spent = delayMs === void 0 || this.now() - started + delayMs >= this.budgetMs;
153
+ if (!outcome.transient || spent) return outcome.settle();
154
+ await this.wait(delayMs);
155
+ }
156
+ }
157
+ };
158
+ Attempt = class _Attempt {
159
+ constructor(reply, error, transient) {
160
+ this.reply = reply;
161
+ this.error = error;
162
+ this.transient = transient;
163
+ }
164
+ reply;
165
+ error;
166
+ transient;
167
+ static async of(attempt) {
168
+ try {
169
+ const reply = await attempt();
170
+ return new _Attempt(reply, null, RetryPolicy.TRANSIENT_STATUSES.has(reply.status));
171
+ } catch (error) {
172
+ return new _Attempt(null, error, error instanceof UnreachableError);
173
+ }
174
+ }
175
+ settle() {
176
+ if (this.reply) return this.reply;
177
+ throw this.error;
178
+ }
179
+ };
108
180
  PlatformTransport = class {
109
181
  constructor(endpoint, timeoutMs = platformTimeoutMs()) {
110
182
  this.endpoint = endpoint;
@@ -118,6 +190,9 @@ var init_transport = __esm({
118
190
  }
119
191
  async send(method, route, body, opts = {}) {
120
192
  const timeoutMs = this.budget(opts.timeoutMs);
193
+ return (opts.retry ?? RetryPolicy.NONE).run(() => this.once(method, route, body, timeoutMs));
194
+ }
195
+ async once(method, route, body, timeoutMs) {
121
196
  const payload = body === void 0 ? {} : { body: JSON.stringify(body) };
122
197
  const controller = new AbortController();
123
198
  const timer = setTimeout(() => controller.abort(), timeoutMs);
@@ -490,13 +565,13 @@ var init_screen = __esm({
490
565
  });
491
566
  }
492
567
  async drag(action) {
493
- const path8 = action.args.path ?? [];
494
- if (path8.length < 2) throw new Error("a drag needs at least two points");
568
+ const path9 = action.args.path ?? [];
569
+ if (path9.length < 2) throw new Error("a drag needs at least two points");
495
570
  return this.held(action.args.modifiers ?? [], async () => {
496
- await this.moveTo(path8[0]);
571
+ await this.moveTo(path9[0]);
497
572
  await this.page.mouse.down({ button: "left" });
498
573
  try {
499
- for (const point2 of path8.slice(1)) await this.moveTo(point2, DRAG_STEPS);
574
+ for (const point2 of path9.slice(1)) await this.moveTo(point2, DRAG_STEPS);
500
575
  } finally {
501
576
  await this.page.mouse.up({ button: "left" });
502
577
  }
@@ -587,7 +662,7 @@ var init_media = __esm({
587
662
  put;
588
663
  maxBytes;
589
664
  /** The uploader for `GATEWAY_HOST` / `GATEWAY_PUBLIC_KEY` /
590
- * `GATEWAY_SECRET_KEY` (the keys tracing exports with); null when any is unset. */
665
+ * `GATEWAY_SECRET_KEY` only; null when any is unset, so a run traced with a saved login uploads none. */
591
666
  static fromEnv(env = process.env) {
592
667
  const host = env.GATEWAY_HOST;
593
668
  const publicKey = env.GATEWAY_PUBLIC_KEY;
@@ -1455,6 +1530,15 @@ var init_sessionContract = __esm({
1455
1530
  }
1456
1531
  });
1457
1532
 
1533
+ // src/worlds/sessionReadiness.ts
1534
+ var READY_TIMEOUT_MS;
1535
+ var init_sessionReadiness = __esm({
1536
+ "src/worlds/sessionReadiness.ts"() {
1537
+ "use strict";
1538
+ READY_TIMEOUT_MS = 10 * 6e4;
1539
+ }
1540
+ });
1541
+
1458
1542
  // src/tracing/session.ts
1459
1543
  var import_async_hooks, processStorage, currentSessionStorage, currentWorldSessionStorage;
1460
1544
  var init_session = __esm({
@@ -1479,8 +1563,22 @@ var init_taskRef = __esm({
1479
1563
  }
1480
1564
  });
1481
1565
 
1566
+ // src/worlds/worldNotice.ts
1567
+ var init_worldNotice = __esm({
1568
+ "src/worlds/worldNotice.ts"() {
1569
+ "use strict";
1570
+ }
1571
+ });
1572
+
1573
+ // src/worlds/grade.ts
1574
+ var init_grade = __esm({
1575
+ "src/worlds/grade.ts"() {
1576
+ "use strict";
1577
+ }
1578
+ });
1579
+
1482
1580
  // src/worlds/session.ts
1483
- var import_node_crypto2, READY_TIMEOUT_MS, CALL_TIMEOUT_MS, JUDGED_GRADE_TIMEOUT_MS;
1581
+ var import_node_crypto2, CALL_TIMEOUT_MS, JUDGED_GRADE_TIMEOUT_MS;
1484
1582
  var init_session2 = __esm({
1485
1583
  "src/worlds/session.ts"() {
1486
1584
  "use strict";
@@ -1489,10 +1587,13 @@ var init_session2 = __esm({
1489
1587
  init_browser();
1490
1588
  init_nativeComputer();
1491
1589
  init_sessionContract();
1590
+ init_sessionReadiness();
1492
1591
  init_session();
1493
1592
  init_taskRef();
1593
+ init_worldNotice();
1594
+ init_grade();
1494
1595
  init_taskRef();
1495
- READY_TIMEOUT_MS = 10 * 6e4;
1596
+ init_sessionReadiness();
1496
1597
  CALL_TIMEOUT_MS = 3 * 6e4;
1497
1598
  JUDGED_GRADE_TIMEOUT_MS = 15 * 6e4;
1498
1599
  }
@@ -1514,12 +1615,22 @@ var init_tasks = __esm({
1514
1615
  }
1515
1616
  });
1516
1617
 
1618
+ // src/worlds/surfaceDescriptor.ts
1619
+ var init_surfaceDescriptor = __esm({
1620
+ "src/worlds/surfaceDescriptor.ts"() {
1621
+ "use strict";
1622
+ init_browser();
1623
+ }
1624
+ });
1625
+
1517
1626
  // src/worlds/taskSessions.ts
1518
1627
  var init_taskSessions = __esm({
1519
1628
  "src/worlds/taskSessions.ts"() {
1520
1629
  "use strict";
1521
1630
  init_worlds();
1522
1631
  init_browser();
1632
+ init_grade();
1633
+ init_surfaceDescriptor();
1523
1634
  init_session2();
1524
1635
  }
1525
1636
  });
@@ -1529,21 +1640,80 @@ var init_evals = __esm({
1529
1640
  "src/worlds/evals.ts"() {
1530
1641
  "use strict";
1531
1642
  init_worlds();
1643
+ init_transport();
1644
+ }
1645
+ });
1646
+
1647
+ // src/worlds/runSignals.ts
1648
+ var import_node_os;
1649
+ var init_runSignals = __esm({
1650
+ "src/worlds/runSignals.ts"() {
1651
+ "use strict";
1652
+ import_node_os = require("os");
1653
+ }
1654
+ });
1655
+
1656
+ // src/worlds/taskRunDir.ts
1657
+ var fs, path;
1658
+ var init_taskRunDir = __esm({
1659
+ "src/worlds/taskRunDir.ts"() {
1660
+ "use strict";
1661
+ fs = __toESM(require("fs"));
1662
+ path = __toESM(require("path"));
1663
+ init_browser();
1664
+ }
1665
+ });
1666
+
1667
+ // src/worlds/taskRunOutcome.ts
1668
+ var init_taskRunOutcome = __esm({
1669
+ "src/worlds/taskRunOutcome.ts"() {
1670
+ "use strict";
1671
+ init_grade();
1672
+ init_taskSessions();
1673
+ }
1674
+ });
1675
+
1676
+ // src/tracing/prerequisites.ts
1677
+ var OPENTELEMETRY_PEERS, PINNED_PEERS;
1678
+ var init_prerequisites = __esm({
1679
+ "src/tracing/prerequisites.ts"() {
1680
+ "use strict";
1681
+ OPENTELEMETRY_PEERS = {
1682
+ "@opentelemetry/api": "1.9.0",
1683
+ "@opentelemetry/exporter-trace-otlp-http": "0.222.0",
1684
+ "@opentelemetry/resources": "2.11.0",
1685
+ "@opentelemetry/sdk-trace-base": "2.11.0",
1686
+ "@opentelemetry/sdk-trace-node": "2.11.0"
1687
+ };
1688
+ PINNED_PEERS = Object.entries(OPENTELEMETRY_PEERS).map(([name, version]) => `${name}@${version}`).join(" ");
1689
+ }
1690
+ });
1691
+
1692
+ // src/worlds/taskTracing.ts
1693
+ var init_taskTracing = __esm({
1694
+ "src/worlds/taskTracing.ts"() {
1695
+ "use strict";
1696
+ init_prerequisites();
1697
+ init_platformEndpoint();
1532
1698
  }
1533
1699
  });
1534
1700
 
1535
1701
  // src/worlds/taskRun.ts
1536
- var import_node_crypto3, fs, path;
1702
+ var import_node_crypto3, path2;
1537
1703
  var init_taskRun = __esm({
1538
1704
  "src/worlds/taskRun.ts"() {
1539
1705
  "use strict";
1540
1706
  import_node_crypto3 = require("crypto");
1541
- fs = __toESM(require("fs"));
1542
- path = __toESM(require("path"));
1707
+ path2 = __toESM(require("path"));
1543
1708
  init_browser();
1544
1709
  init_evals();
1710
+ init_runSignals();
1545
1711
  init_session2();
1546
1712
  init_taskSessions();
1713
+ init_taskRunDir();
1714
+ init_taskRunOutcome();
1715
+ init_taskTracing();
1716
+ init_worldNotice();
1547
1717
  }
1548
1718
  });
1549
1719
 
@@ -1562,28 +1732,36 @@ var init_setRun = __esm({
1562
1732
  "use strict";
1563
1733
  init_worlds();
1564
1734
  init_checkoutProvenance();
1735
+ init_runSignals();
1565
1736
  init_taskRun();
1566
1737
  }
1567
1738
  });
1568
1739
 
1740
+ // src/worlds/requestLog.ts
1741
+ var init_requestLog = __esm({
1742
+ "src/worlds/requestLog.ts"() {
1743
+ "use strict";
1744
+ }
1745
+ });
1746
+
1569
1747
  // src/worlds/checkoutTarget.ts
1570
- var fs2, path2;
1748
+ var fs2, path3;
1571
1749
  var init_checkoutTarget = __esm({
1572
1750
  "src/worlds/checkoutTarget.ts"() {
1573
1751
  "use strict";
1574
1752
  fs2 = __toESM(require("fs"));
1575
- path2 = __toESM(require("path"));
1753
+ path3 = __toESM(require("path"));
1576
1754
  }
1577
1755
  });
1578
1756
 
1579
1757
  // src/worlds/worldDir.ts
1580
- var import_node_crypto4, fs3, path3, CONNECTOR_SPEC, WORLD_SCHEMA_MARKERS, WORLD_ROOT_MARKERS;
1758
+ var import_node_crypto4, fs3, path4, CONNECTOR_SPEC, WORLD_SCHEMA_MARKERS, WORLD_ROOT_MARKERS;
1581
1759
  var init_worldDir = __esm({
1582
1760
  "src/worlds/worldDir.ts"() {
1583
1761
  "use strict";
1584
1762
  import_node_crypto4 = require("crypto");
1585
1763
  fs3 = __toESM(require("fs"));
1586
- path3 = __toESM(require("path"));
1764
+ path4 = __toESM(require("path"));
1587
1765
  CONNECTOR_SPEC = "connector.toml";
1588
1766
  WORLD_SCHEMA_MARKERS = ["schema/world.json", "schema/runtime.json", "schema/lock.json"];
1589
1767
  WORLD_ROOT_MARKERS = [CONNECTOR_SPEC, ...WORLD_SCHEMA_MARKERS];
@@ -1591,30 +1769,30 @@ var init_worldDir = __esm({
1591
1769
  });
1592
1770
 
1593
1771
  // src/worlds/tar.ts
1594
- var fs4, path4, import_node_zlib;
1772
+ var fs4, path5, import_node_zlib;
1595
1773
  var init_tar = __esm({
1596
1774
  "src/worlds/tar.ts"() {
1597
1775
  "use strict";
1598
1776
  fs4 = __toESM(require("fs"));
1599
- path4 = __toESM(require("path"));
1777
+ path5 = __toESM(require("path"));
1600
1778
  import_node_zlib = require("zlib");
1601
1779
  }
1602
1780
  });
1603
1781
 
1604
1782
  // src/worlds/hub.ts
1605
- var import_node_crypto5, import_node_zlib2, fs5, path5, META_RELPATH;
1783
+ var import_node_crypto5, import_node_zlib2, fs5, path6, META_RELPATH;
1606
1784
  var init_hub = __esm({
1607
1785
  "src/worlds/hub.ts"() {
1608
1786
  "use strict";
1609
1787
  import_node_crypto5 = require("crypto");
1610
1788
  import_node_zlib2 = require("zlib");
1611
1789
  fs5 = __toESM(require("fs"));
1612
- path5 = __toESM(require("path"));
1790
+ path6 = __toESM(require("path"));
1613
1791
  init_worlds();
1614
1792
  init_checkoutTarget();
1615
1793
  init_worldDir();
1616
1794
  init_tar();
1617
- META_RELPATH = path5.join(".gateway", ".env-metadata.json");
1795
+ META_RELPATH = path6.join(".gateway", ".env-metadata.json");
1618
1796
  }
1619
1797
  });
1620
1798
 
@@ -1719,14 +1897,15 @@ var init_migrate = __esm({
1719
1897
  });
1720
1898
 
1721
1899
  // src/worlds/ingest.ts
1722
- var fs6, os, path6;
1900
+ var fs6, os, path7;
1723
1901
  var init_ingest = __esm({
1724
1902
  "src/worlds/ingest.ts"() {
1725
1903
  "use strict";
1726
1904
  fs6 = __toESM(require("fs"));
1727
1905
  os = __toESM(require("os"));
1728
- path6 = __toESM(require("path"));
1906
+ path7 = __toESM(require("path"));
1729
1907
  init_worlds();
1908
+ init_platformEndpoint();
1730
1909
  }
1731
1910
  });
1732
1911
 
@@ -1747,17 +1926,6 @@ var init_dryRun = __esm({
1747
1926
  });
1748
1927
 
1749
1928
  // src/worlds/index.ts
1750
- function resolveEnv(options) {
1751
- const host = options.host ?? process.env.GATEWAY_HOST ?? "https://withgateway.ai";
1752
- const publicKey = options.publicKey ?? process.env.GATEWAY_PUBLIC_KEY;
1753
- const secretKey = options.secretKey ?? process.env.GATEWAY_SECRET_KEY;
1754
- if (!publicKey || !secretKey) {
1755
- throw new Error(
1756
- "Gateway keys missing: set GATEWAY_PUBLIC_KEY / GATEWAY_SECRET_KEY (or pass publicKey/secretKey)."
1757
- );
1758
- }
1759
- return { host: host.replace(/\/+$/, ""), publicKey, secretKey };
1760
- }
1761
1929
  function parseErrorBody(text, limit = 600) {
1762
1930
  const raw = { detail: text.slice(0, limit), code: null };
1763
1931
  let parsed;
@@ -1777,18 +1945,20 @@ function parseErrorBody(text, limit = 600) {
1777
1945
  code: stableCode
1778
1946
  };
1779
1947
  }
1780
- async function apiRequest(options, method, path8, body, init = {}) {
1781
- const reply = await new PlatformTransport(resolveEnv(options)).send(method, path8, body, init);
1782
- if (!reply.ok) throw new ApiError(reply.status, method, path8, reply.text);
1948
+ async function apiRequest(options, method, path9, body, init = {}) {
1949
+ const reply = await new PlatformTransport(requirePlatformEndpoint(options)).send(method, path9, body, init);
1950
+ if (!reply.ok) throw new ApiError(reply.status, method, path9, reply.text);
1783
1951
  return JSON.parse(reply.text);
1784
1952
  }
1785
1953
  var ApiError;
1786
1954
  var init_worlds = __esm({
1787
1955
  "src/worlds/index.ts"() {
1788
1956
  "use strict";
1957
+ init_platformEndpoint();
1789
1958
  init_transport();
1790
1959
  init_transport();
1791
1960
  init_session2();
1961
+ init_grade();
1792
1962
  init_sessionList();
1793
1963
  init_sessionContract();
1794
1964
  init_taskRef();
@@ -1799,6 +1969,8 @@ var init_worlds = __esm({
1799
1969
  init_checkoutProvenance();
1800
1970
  init_evals();
1801
1971
  init_browser();
1972
+ init_surfaceDescriptor();
1973
+ init_requestLog();
1802
1974
  init_browserReconnect();
1803
1975
  init_nativeComputer();
1804
1976
  init_hub();
@@ -1812,10 +1984,11 @@ var init_worlds = __esm({
1812
1984
  init_sandbox();
1813
1985
  init_editSessions();
1814
1986
  init_dryRun();
1987
+ init_worldNotice();
1815
1988
  ApiError = class extends Error {
1816
- constructor(status, method, path8, text) {
1989
+ constructor(status, method, path9, text) {
1817
1990
  const parsed = parseErrorBody(text);
1818
- super(`${method} ${path8} -> ${status}: ${parsed.detail}`);
1991
+ super(`${method} ${path9} -> ${status}: ${parsed.detail}`);
1819
1992
  this.status = status;
1820
1993
  this.text = text;
1821
1994
  this.name = "ApiError";
@@ -1855,7 +2028,7 @@ __export(files_exports, {
1855
2028
  module.exports = __toCommonJS(files_exports);
1856
2029
  var import_node_crypto8 = require("crypto");
1857
2030
  var fs7 = __toESM(require("fs"));
1858
- var path7 = __toESM(require("path"));
2031
+ var path8 = __toESM(require("path"));
1859
2032
  var import_node_stream = require("stream");
1860
2033
  var import_promises = require("stream/promises");
1861
2034
  init_worlds();
@@ -1907,7 +2080,7 @@ async function readFile(options = {}, filePath, limits = {}) {
1907
2080
  async function downloadFile(options = {}, filePath, outPath, onProgress) {
1908
2081
  const file = await getFile(options, filePath);
1909
2082
  const res = await openDownload(file.url);
1910
- fs7.mkdirSync(path7.dirname(path7.resolve(outPath)), { recursive: true });
2083
+ fs7.mkdirSync(path8.dirname(path8.resolve(outPath)), { recursive: true });
1911
2084
  const source = import_node_stream.Readable.fromWeb(res.body);
1912
2085
  await (0, import_promises.pipeline)(source, counting((n) => onProgress?.(n, file.sizeBytes)), fs7.createWriteStream(outPath));
1913
2086
  return { ...file, out: outPath };
@@ -1956,7 +2129,7 @@ var CONTENT_TYPES = {
1956
2129
  ".mp4": "video/mp4"
1957
2130
  };
1958
2131
  function contentTypeFor(name) {
1959
- return CONTENT_TYPES[path7.extname(name).toLowerCase()] ?? "application/octet-stream";
2132
+ return CONTENT_TYPES[path8.extname(name).toLowerCase()] ?? "application/octet-stream";
1960
2133
  }
1961
2134
  function counting(report) {
1962
2135
  let seen = 0;