@withgateway/sdk 0.3.1 → 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 (129) hide show
  1. package/README.md +4 -3
  2. package/dist/cli.js +2880 -2032
  3. package/dist/cli.js.map +1 -1
  4. package/dist/cli.mjs +2982 -2135
  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 +180 -41
  9. package/dist/files/index.js.map +1 -1
  10. package/dist/files/index.mjs +172 -35
  11. package/dist/files/index.mjs.map +1 -1
  12. package/dist/{index-CBqbB_0J.d.ts → index-DUHmS74p.d.ts} +1 -1
  13. package/dist/{index-D-AMnAMa.d.mts → index-mJhG3vZU.d.mts} +1 -1
  14. package/dist/index.d.mts +4 -4
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.js +1309 -540
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +1287 -532
  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 +177 -38
  25. package/dist/traces/index.js.map +1 -1
  26. package/dist/traces/index.mjs +169 -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 +69 -13
  31. package/dist/tracing/index.js.map +1 -1
  32. package/dist/tracing/index.mjs +69 -13
  33. package/dist/tracing/index.mjs.map +1 -1
  34. package/dist/worlds/index.d.mts +249 -120
  35. package/dist/worlds/index.d.ts +249 -120
  36. package/dist/worlds/index.js +1240 -484
  37. package/dist/worlds/index.js.map +1 -1
  38. package/dist/worlds/index.mjs +1231 -476
  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 -514
  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/compiler.py +334 -158
  57. package/runtime/gatewaysdk/environment/schema/conform.py +8 -12
  58. package/runtime/gatewaysdk/environment/schema/connector.py +27 -62
  59. package/runtime/gatewaysdk/environment/schema/data.py +50 -207
  60. package/runtime/gatewaysdk/environment/schema/database/__init__.py +24 -0
  61. package/runtime/gatewaysdk/environment/schema/database/audit.py +121 -0
  62. package/runtime/gatewaysdk/environment/schema/database/base.py +995 -0
  63. package/runtime/gatewaysdk/environment/schema/database/budget.py +33 -0
  64. package/runtime/gatewaysdk/environment/schema/database/connections.py +101 -0
  65. package/runtime/gatewaysdk/environment/schema/database/engines.py +8 -0
  66. package/runtime/gatewaysdk/environment/schema/database/guard.py +208 -0
  67. package/runtime/gatewaysdk/environment/schema/database/ingest.py +154 -0
  68. package/runtime/gatewaysdk/environment/schema/database/matching.py +58 -0
  69. package/runtime/gatewaysdk/environment/schema/database/provenance.py +30 -0
  70. package/runtime/gatewaysdk/environment/schema/database/rows.py +53 -0
  71. package/runtime/gatewaysdk/environment/schema/database/runtime_rows.py +39 -0
  72. package/runtime/gatewaysdk/environment/schema/database/sqlite.py +367 -0
  73. package/runtime/gatewaysdk/environment/schema/domain_migration.py +236 -0
  74. package/runtime/gatewaysdk/environment/schema/envelope.py +169 -0
  75. package/runtime/gatewaysdk/environment/schema/extract.py +6 -13
  76. package/runtime/gatewaysdk/environment/schema/grading.py +45 -30
  77. package/runtime/gatewaysdk/environment/schema/handler_errors.py +142 -12
  78. package/runtime/gatewaysdk/environment/schema/host.py +158 -250
  79. package/runtime/gatewaysdk/environment/schema/lanes.py +53 -0
  80. package/runtime/gatewaysdk/environment/schema/local.py +44 -71
  81. package/runtime/gatewaysdk/environment/schema/mapping.py +5 -25
  82. package/runtime/gatewaysdk/environment/schema/openapi_import.py +112 -73
  83. package/runtime/gatewaysdk/environment/schema/openapi_paging.py +147 -0
  84. package/runtime/gatewaysdk/environment/schema/openapi_payloads.py +288 -0
  85. package/runtime/gatewaysdk/environment/schema/openapi_routes.py +97 -102
  86. package/runtime/gatewaysdk/environment/schema/openapi_schemas.py +113 -30
  87. package/runtime/gatewaysdk/environment/schema/platform.py +123 -171
  88. package/runtime/gatewaysdk/environment/schema/platform_import.py +2 -3
  89. package/runtime/gatewaysdk/environment/schema/platform_query.py +61 -5
  90. package/runtime/gatewaysdk/environment/schema/primary_key.py +61 -0
  91. package/runtime/gatewaysdk/environment/schema/proof.py +19 -12
  92. package/runtime/gatewaysdk/environment/schema/runtime.py +77 -160
  93. package/runtime/gatewaysdk/environment/schema/served_names.py +58 -0
  94. package/runtime/gatewaysdk/environment/schema/session_files.py +166 -0
  95. package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +2 -2
  96. package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +19 -11
  97. package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +29 -3
  98. package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +14 -14
  99. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +12 -12
  100. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +3 -2
  101. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +15 -0
  102. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/openapi-import.md +50 -21
  103. package/runtime/gatewaysdk/environment/schema/slack.py +4 -8
  104. package/runtime/gatewaysdk/environment/schema/snapshot.py +385 -129
  105. package/runtime/gatewaysdk/environment/schema/store_contract.py +8 -14
  106. package/runtime/gatewaysdk/environment/schema/tasks.py +140 -55
  107. package/runtime/gatewaysdk/environment/schema/tools_world.py +110 -87
  108. package/runtime/gatewaysdk/environment/schema/ui.py +24 -5
  109. package/runtime/gatewaysdk/environment/schema/ui_static/app.js +100 -130
  110. package/runtime/gatewaysdk/environment/schema/ui_static/index.html +1 -8
  111. package/runtime/gatewaysdk/environment/schema/validation.py +166 -40
  112. package/runtime/gatewaysdk/environment/schema/workers.py +142 -57
  113. package/runtime/gatewaysdk/environment/schema/world_sql.py +81 -0
  114. package/runtime/gatewaysdk/environment/schema/world_tests.py +71 -39
  115. package/runtime/gatewaysdk/environment/score.py +57 -0
  116. package/runtime/gatewaysdk/environment/secret_values.py +36 -0
  117. package/runtime/gatewaysdk/environment/world.py +42 -3
  118. package/runtime/gatewaysdk/environment/world_session_contract.py +32 -5
  119. package/skills/benchmarks-getting-started/SKILL.md +2 -2
  120. package/skills/connector-schema-authoring/SKILL.md +19 -11
  121. package/skills/connector-schema-authoring/connector-worlds.md +13 -4
  122. package/skills/connector-schema-authoring/world-schema.md +103 -51
  123. package/skills/world-data-ingestion/ROWS.md +29 -3
  124. package/skills/world-data-ingestion/SKILL.md +14 -14
  125. package/skills/worlds-getting-started/SKILL.md +12 -12
  126. package/skills/worlds-getting-started/references/cli-mcp-map.md +3 -2
  127. package/skills/worlds-getting-started/references/gotchas.md +15 -0
  128. package/skills/worlds-getting-started/references/openapi-import.md +50 -21
  129. package/runtime/gatewaysdk/environment/schema/store.py +0 -1013
@@ -32,6 +32,23 @@ declare class UnreachableError extends Error {
32
32
  readonly failure: TransportCause;
33
33
  constructor(host: string, method: string, route: string, failure: TransportCause);
34
34
  }
35
+ /**
36
+ * Another attempt after a gateway 5xx (502, 503, 504) or no answer at all, for a request whose repeat is harmless: a
37
+ * keyed filing step, which the platform answers with the first filing. Every other request gets one attempt (`NONE`).
38
+ */
39
+ declare class RetryPolicy {
40
+ readonly delaysMs: readonly number[];
41
+ private readonly wait;
42
+ readonly budgetMs: number;
43
+ private readonly now;
44
+ static readonly NONE: RetryPolicy;
45
+ /** A platform restart or a short edge outage: no wait starts that would end past five minutes, so a step ends
46
+ * within the budget plus one request timeout. */
47
+ static readonly FILING: RetryPolicy;
48
+ static readonly TRANSIENT_STATUSES: ReadonlySet<number>;
49
+ constructor(delaysMs: readonly number[], wait?: (ms: number) => Promise<void>, budgetMs?: number, now?: () => number);
50
+ run(attempt: () => Promise<PlatformReply>): Promise<PlatformReply>;
51
+ }
35
52
  /** The one door every CLI and SDK request to the platform goes through: Basic auth with the project key, a per-request timeout, and a transport failure turned into an `UnreachableError`. */
36
53
  declare class PlatformTransport {
37
54
  private readonly endpoint;
@@ -41,7 +58,9 @@ declare class PlatformTransport {
41
58
  budget(ownMs?: number): number;
42
59
  send(method: PlatformMethod, route: string, body?: unknown, opts?: {
43
60
  timeoutMs?: number;
61
+ retry?: RetryPolicy;
44
62
  }): Promise<PlatformReply>;
63
+ private once;
45
64
  }
46
65
 
47
66
  declare const MAX_MEDIA_BYTES: number;
@@ -67,7 +86,7 @@ declare class MediaUploader {
67
86
  maxBytes: number;
68
87
  constructor(transport: PlatformTransport, put?: PutBytes, maxBytes?: number);
69
88
  /** The uploader for `GATEWAY_HOST` / `GATEWAY_PUBLIC_KEY` /
70
- * `GATEWAY_SECRET_KEY` (the keys tracing exports with); null when any is unset. */
89
+ * `GATEWAY_SECRET_KEY` only; null when any is unset, so a run traced with a saved login uploads none. */
71
90
  static fromEnv(env?: NodeJS.ProcessEnv): MediaUploader | null;
72
91
  /** Store `data` linked to the trace (and observation) and return its reference. */
73
92
  upload(data: Buffer, link: {
@@ -80,4 +99,4 @@ declare class MediaUploader {
80
99
  private send;
81
100
  }
82
101
 
83
- export { MAX_MEDIA_BYTES as M, PLATFORM_TIMEOUT_DEFAULT_MS as P, TransportCause as T, UnreachableError as U, PLATFORM_TIMEOUT_ENV as a, type PlatformEndpoint as b, type PlatformMethod as c, type PlatformReply as d, PlatformTransport as e, type MediaField as f, MediaReference as g, MediaUploadError as h, MediaUploader as i, platformTimeoutMs as p };
102
+ export { MAX_MEDIA_BYTES as M, PLATFORM_TIMEOUT_DEFAULT_MS as P, RetryPolicy as R, TransportCause as T, UnreachableError as U, PLATFORM_TIMEOUT_ENV as a, type PlatformEndpoint as b, type PlatformMethod as c, type PlatformReply as d, PlatformTransport as e, type MediaField as f, MediaReference as g, MediaUploadError as h, MediaUploader as i, platformTimeoutMs as p };
@@ -32,6 +32,23 @@ declare class UnreachableError extends Error {
32
32
  readonly failure: TransportCause;
33
33
  constructor(host: string, method: string, route: string, failure: TransportCause);
34
34
  }
35
+ /**
36
+ * Another attempt after a gateway 5xx (502, 503, 504) or no answer at all, for a request whose repeat is harmless: a
37
+ * keyed filing step, which the platform answers with the first filing. Every other request gets one attempt (`NONE`).
38
+ */
39
+ declare class RetryPolicy {
40
+ readonly delaysMs: readonly number[];
41
+ private readonly wait;
42
+ readonly budgetMs: number;
43
+ private readonly now;
44
+ static readonly NONE: RetryPolicy;
45
+ /** A platform restart or a short edge outage: no wait starts that would end past five minutes, so a step ends
46
+ * within the budget plus one request timeout. */
47
+ static readonly FILING: RetryPolicy;
48
+ static readonly TRANSIENT_STATUSES: ReadonlySet<number>;
49
+ constructor(delaysMs: readonly number[], wait?: (ms: number) => Promise<void>, budgetMs?: number, now?: () => number);
50
+ run(attempt: () => Promise<PlatformReply>): Promise<PlatformReply>;
51
+ }
35
52
  /** The one door every CLI and SDK request to the platform goes through: Basic auth with the project key, a per-request timeout, and a transport failure turned into an `UnreachableError`. */
36
53
  declare class PlatformTransport {
37
54
  private readonly endpoint;
@@ -41,7 +58,9 @@ declare class PlatformTransport {
41
58
  budget(ownMs?: number): number;
42
59
  send(method: PlatformMethod, route: string, body?: unknown, opts?: {
43
60
  timeoutMs?: number;
61
+ retry?: RetryPolicy;
44
62
  }): Promise<PlatformReply>;
63
+ private once;
45
64
  }
46
65
 
47
66
  declare const MAX_MEDIA_BYTES: number;
@@ -67,7 +86,7 @@ declare class MediaUploader {
67
86
  maxBytes: number;
68
87
  constructor(transport: PlatformTransport, put?: PutBytes, maxBytes?: number);
69
88
  /** The uploader for `GATEWAY_HOST` / `GATEWAY_PUBLIC_KEY` /
70
- * `GATEWAY_SECRET_KEY` (the keys tracing exports with); null when any is unset. */
89
+ * `GATEWAY_SECRET_KEY` only; null when any is unset, so a run traced with a saved login uploads none. */
71
90
  static fromEnv(env?: NodeJS.ProcessEnv): MediaUploader | null;
72
91
  /** Store `data` linked to the trace (and observation) and return its reference. */
73
92
  upload(data: Buffer, link: {
@@ -80,4 +99,4 @@ declare class MediaUploader {
80
99
  private send;
81
100
  }
82
101
 
83
- export { MAX_MEDIA_BYTES as M, PLATFORM_TIMEOUT_DEFAULT_MS as P, TransportCause as T, UnreachableError as U, PLATFORM_TIMEOUT_ENV as a, type PlatformEndpoint as b, type PlatformMethod as c, type PlatformReply as d, PlatformTransport as e, type MediaField as f, MediaReference as g, MediaUploadError as h, MediaUploader as i, platformTimeoutMs as p };
102
+ export { MAX_MEDIA_BYTES as M, PLATFORM_TIMEOUT_DEFAULT_MS as P, RetryPolicy as R, TransportCause as T, UnreachableError as U, PLATFORM_TIMEOUT_ENV as a, type PlatformEndpoint as b, type PlatformMethod as c, type PlatformReply as d, PlatformTransport as e, type MediaField as f, MediaReference as g, MediaUploadError as h, MediaUploader as i, platformTimeoutMs as p };
@@ -1,3 +1,3 @@
1
1
  import '../worlds/index.mjs';
2
2
  export { E as ExportOptions, a as ExportSummary, O as Observation, b as ObservationFilters, P as PAGE_LIMIT, c as Page, d as PageMeta, S as SessionFilters, T as Trace, e as TraceDetail, f as TraceFilters, g as TraceSession, h as TraceSessionDetail, j as exportTraces, k as getSession, l as getTrace, m as iterateObservations, n as iterateSessions, o as iterateTraces, p as listObservations, q as listSessions, r as listTraces } from '../index-CiKWoroJ.mjs';
3
- import '../media-CbcAfQvd.mjs';
3
+ import '../media-BIApiPzS.mjs';
@@ -1,3 +1,3 @@
1
1
  import '../worlds/index.js';
2
2
  export { E as ExportOptions, a as ExportSummary, O as Observation, b as ObservationFilters, P as PAGE_LIMIT, c as Page, d as PageMeta, S as SessionFilters, T as Trace, e as TraceDetail, f as TraceFilters, g as TraceSession, h as TraceSessionDetail, j as exportTraces, k as getSession, l as getTrace, m as iterateObservations, n as iterateSessions, o as iterateTraces, p as listObservations, q as listSessions, r as listTraces } from '../index-BgvvQ3BC.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((resolve3) => setTimeout(resolve3, 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 path7 = action.args.path ?? [];
494
- if (path7.length < 2) throw new Error("a drag needs at least two points");
568
+ const path8 = action.args.path ?? [];
569
+ if (path8.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(path7[0]);
571
+ await this.moveTo(path8[0]);
497
572
  await this.page.mouse.down({ button: "left" });
498
573
  try {
499
- for (const point2 of path7.slice(1)) await this.moveTo(point2, DRAG_STEPS);
574
+ for (const point2 of path8.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
  }
@@ -1528,6 +1629,7 @@ var init_taskSessions = __esm({
1528
1629
  "use strict";
1529
1630
  init_worlds();
1530
1631
  init_browser();
1632
+ init_grade();
1531
1633
  init_surfaceDescriptor();
1532
1634
  init_session2();
1533
1635
  }
@@ -1538,13 +1640,52 @@ var init_evals = __esm({
1538
1640
  "src/worlds/evals.ts"() {
1539
1641
  "use strict";
1540
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();
1541
1673
  }
1542
1674
  });
1543
1675
 
1544
1676
  // src/tracing/prerequisites.ts
1677
+ var OPENTELEMETRY_PEERS, PINNED_PEERS;
1545
1678
  var init_prerequisites = __esm({
1546
1679
  "src/tracing/prerequisites.ts"() {
1547
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(" ");
1548
1689
  }
1549
1690
  });
1550
1691
 
@@ -1553,22 +1694,26 @@ var init_taskTracing = __esm({
1553
1694
  "src/worlds/taskTracing.ts"() {
1554
1695
  "use strict";
1555
1696
  init_prerequisites();
1697
+ init_platformEndpoint();
1556
1698
  }
1557
1699
  });
1558
1700
 
1559
1701
  // src/worlds/taskRun.ts
1560
- var import_node_crypto3, fs, path;
1702
+ var import_node_crypto3, path2;
1561
1703
  var init_taskRun = __esm({
1562
1704
  "src/worlds/taskRun.ts"() {
1563
1705
  "use strict";
1564
1706
  import_node_crypto3 = require("crypto");
1565
- fs = __toESM(require("fs"));
1566
- path = __toESM(require("path"));
1707
+ path2 = __toESM(require("path"));
1567
1708
  init_browser();
1568
1709
  init_evals();
1710
+ init_runSignals();
1569
1711
  init_session2();
1570
1712
  init_taskSessions();
1713
+ init_taskRunDir();
1714
+ init_taskRunOutcome();
1571
1715
  init_taskTracing();
1716
+ init_worldNotice();
1572
1717
  }
1573
1718
  });
1574
1719
 
@@ -1587,6 +1732,7 @@ var init_setRun = __esm({
1587
1732
  "use strict";
1588
1733
  init_worlds();
1589
1734
  init_checkoutProvenance();
1735
+ init_runSignals();
1590
1736
  init_taskRun();
1591
1737
  }
1592
1738
  });
@@ -1599,23 +1745,23 @@ var init_requestLog = __esm({
1599
1745
  });
1600
1746
 
1601
1747
  // src/worlds/checkoutTarget.ts
1602
- var fs2, path2;
1748
+ var fs2, path3;
1603
1749
  var init_checkoutTarget = __esm({
1604
1750
  "src/worlds/checkoutTarget.ts"() {
1605
1751
  "use strict";
1606
1752
  fs2 = __toESM(require("fs"));
1607
- path2 = __toESM(require("path"));
1753
+ path3 = __toESM(require("path"));
1608
1754
  }
1609
1755
  });
1610
1756
 
1611
1757
  // src/worlds/worldDir.ts
1612
- 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;
1613
1759
  var init_worldDir = __esm({
1614
1760
  "src/worlds/worldDir.ts"() {
1615
1761
  "use strict";
1616
1762
  import_node_crypto4 = require("crypto");
1617
1763
  fs3 = __toESM(require("fs"));
1618
- path3 = __toESM(require("path"));
1764
+ path4 = __toESM(require("path"));
1619
1765
  CONNECTOR_SPEC = "connector.toml";
1620
1766
  WORLD_SCHEMA_MARKERS = ["schema/world.json", "schema/runtime.json", "schema/lock.json"];
1621
1767
  WORLD_ROOT_MARKERS = [CONNECTOR_SPEC, ...WORLD_SCHEMA_MARKERS];
@@ -1623,30 +1769,30 @@ var init_worldDir = __esm({
1623
1769
  });
1624
1770
 
1625
1771
  // src/worlds/tar.ts
1626
- var fs4, path4, import_node_zlib;
1772
+ var fs4, path5, import_node_zlib;
1627
1773
  var init_tar = __esm({
1628
1774
  "src/worlds/tar.ts"() {
1629
1775
  "use strict";
1630
1776
  fs4 = __toESM(require("fs"));
1631
- path4 = __toESM(require("path"));
1777
+ path5 = __toESM(require("path"));
1632
1778
  import_node_zlib = require("zlib");
1633
1779
  }
1634
1780
  });
1635
1781
 
1636
1782
  // src/worlds/hub.ts
1637
- var import_node_crypto5, import_node_zlib2, fs5, path5, META_RELPATH;
1783
+ var import_node_crypto5, import_node_zlib2, fs5, path6, META_RELPATH;
1638
1784
  var init_hub = __esm({
1639
1785
  "src/worlds/hub.ts"() {
1640
1786
  "use strict";
1641
1787
  import_node_crypto5 = require("crypto");
1642
1788
  import_node_zlib2 = require("zlib");
1643
1789
  fs5 = __toESM(require("fs"));
1644
- path5 = __toESM(require("path"));
1790
+ path6 = __toESM(require("path"));
1645
1791
  init_worlds();
1646
1792
  init_checkoutTarget();
1647
1793
  init_worldDir();
1648
1794
  init_tar();
1649
- META_RELPATH = path5.join(".gateway", ".env-metadata.json");
1795
+ META_RELPATH = path6.join(".gateway", ".env-metadata.json");
1650
1796
  }
1651
1797
  });
1652
1798
 
@@ -1751,14 +1897,15 @@ var init_migrate = __esm({
1751
1897
  });
1752
1898
 
1753
1899
  // src/worlds/ingest.ts
1754
- var fs6, os, path6;
1900
+ var fs6, os, path7;
1755
1901
  var init_ingest = __esm({
1756
1902
  "src/worlds/ingest.ts"() {
1757
1903
  "use strict";
1758
1904
  fs6 = __toESM(require("fs"));
1759
1905
  os = __toESM(require("os"));
1760
- path6 = __toESM(require("path"));
1906
+ path7 = __toESM(require("path"));
1761
1907
  init_worlds();
1908
+ init_platformEndpoint();
1762
1909
  }
1763
1910
  });
1764
1911
 
@@ -1779,17 +1926,6 @@ var init_dryRun = __esm({
1779
1926
  });
1780
1927
 
1781
1928
  // src/worlds/index.ts
1782
- function resolveEnv(options) {
1783
- const host = options.host ?? process.env.GATEWAY_HOST ?? "https://withgateway.ai";
1784
- const publicKey = options.publicKey ?? process.env.GATEWAY_PUBLIC_KEY;
1785
- const secretKey = options.secretKey ?? process.env.GATEWAY_SECRET_KEY;
1786
- if (!publicKey || !secretKey) {
1787
- throw new Error(
1788
- "Gateway keys missing: set GATEWAY_PUBLIC_KEY / GATEWAY_SECRET_KEY (or pass publicKey/secretKey)."
1789
- );
1790
- }
1791
- return { host: host.replace(/\/+$/, ""), publicKey, secretKey };
1792
- }
1793
1929
  function parseErrorBody(text, limit = 600) {
1794
1930
  const raw = { detail: text.slice(0, limit), code: null };
1795
1931
  let parsed;
@@ -1809,18 +1945,20 @@ function parseErrorBody(text, limit = 600) {
1809
1945
  code: stableCode
1810
1946
  };
1811
1947
  }
1812
- async function apiRequest(options, method, path7, body, init = {}) {
1813
- const reply = await new PlatformTransport(resolveEnv(options)).send(method, path7, body, init);
1814
- if (!reply.ok) throw new ApiError(reply.status, method, path7, reply.text);
1948
+ async function apiRequest(options, method, path8, body, init = {}) {
1949
+ const reply = await new PlatformTransport(requirePlatformEndpoint(options)).send(method, path8, body, init);
1950
+ if (!reply.ok) throw new ApiError(reply.status, method, path8, reply.text);
1815
1951
  return JSON.parse(reply.text);
1816
1952
  }
1817
1953
  var ApiError;
1818
1954
  var init_worlds = __esm({
1819
1955
  "src/worlds/index.ts"() {
1820
1956
  "use strict";
1957
+ init_platformEndpoint();
1821
1958
  init_transport();
1822
1959
  init_transport();
1823
1960
  init_session2();
1961
+ init_grade();
1824
1962
  init_sessionList();
1825
1963
  init_sessionContract();
1826
1964
  init_taskRef();
@@ -1846,10 +1984,11 @@ var init_worlds = __esm({
1846
1984
  init_sandbox();
1847
1985
  init_editSessions();
1848
1986
  init_dryRun();
1987
+ init_worldNotice();
1849
1988
  ApiError = class extends Error {
1850
- constructor(status, method, path7, text) {
1989
+ constructor(status, method, path8, text) {
1851
1990
  const parsed = parseErrorBody(text);
1852
- super(`${method} ${path7} -> ${status}: ${parsed.detail}`);
1991
+ super(`${method} ${path8} -> ${status}: ${parsed.detail}`);
1853
1992
  this.status = status;
1854
1993
  this.text = text;
1855
1994
  this.name = "ApiError";