@withgateway/sdk 0.1.13 → 0.1.14

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/index.mjs CHANGED
@@ -8,6 +8,9 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
8
8
  if (typeof require !== "undefined") return require.apply(this, arguments);
9
9
  throw Error('Dynamic require of "' + x + '" is not supported');
10
10
  });
11
+ var __esm = (fn, res) => function __init() {
12
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ };
11
14
  var __commonJS = (cb, mod) => function __require2() {
12
15
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
16
  };
@@ -16,12 +19,552 @@ var __export = (target, all) => {
16
19
  __defProp(target, name, { get: all[name], enumerable: true });
17
20
  };
18
21
 
22
+ // src/worlds/session.ts
23
+ var session_exports = {};
24
+ __export(session_exports, {
25
+ WorldSession: () => WorldSession,
26
+ WorldSessionCallError: () => WorldSessionCallError,
27
+ WorldSessionTimeout: () => WorldSessionTimeout,
28
+ attachSession: () => attachSession,
29
+ openSession: () => openSession,
30
+ runSessions: () => runSessions,
31
+ schemaFromSignature: () => schemaFromSignature
32
+ });
33
+ function schemaFromSignature(spec) {
34
+ const inside = /\(([\s\S]*)\)\s*$/.exec(spec.signature.trim())?.[1] ?? "";
35
+ const properties = {};
36
+ const required = [];
37
+ const params = [];
38
+ let depth = 0;
39
+ let current = "";
40
+ for (const ch of inside) {
41
+ if ("([{".includes(ch)) depth++;
42
+ if (")]}".includes(ch)) depth--;
43
+ if (ch === "," && depth === 0) {
44
+ params.push(current);
45
+ current = "";
46
+ } else current += ch;
47
+ }
48
+ if (current.trim()) params.push(current);
49
+ for (const raw of params) {
50
+ const param = raw.trim();
51
+ if (!param || param.startsWith("*") || param === "self") continue;
52
+ const eq = param.indexOf("=");
53
+ const name = (eq === -1 ? param : param.slice(0, eq)).split(":")[0].trim();
54
+ if (!name) continue;
55
+ if (eq === -1) {
56
+ properties[name] = { type: "string" };
57
+ required.push(name);
58
+ continue;
59
+ }
60
+ const value = param.slice(eq + 1).trim();
61
+ if (/^-?\d+(\.\d+)?$/.test(value)) properties[name] = { type: "number" };
62
+ else if (value === "True" || value === "False")
63
+ properties[name] = { type: "boolean" };
64
+ else properties[name] = { type: "string" };
65
+ }
66
+ return {
67
+ type: "function",
68
+ function: {
69
+ name: spec.name,
70
+ description: spec.doc ?? spec.name,
71
+ parameters: { type: "object", properties, required }
72
+ }
73
+ };
74
+ }
75
+ async function attachSession(sessionId, options = {}) {
76
+ const state2 = await apiRequest(
77
+ options,
78
+ "GET",
79
+ `/api/public/world-sessions/${encodeURIComponent(sessionId)}`
80
+ );
81
+ return new WorldSession(sessionId, state2, options);
82
+ }
83
+ async function openSession(slugOrRef, task, opts = {}) {
84
+ const options = opts.options ?? {};
85
+ const at = slugOrRef.indexOf("@");
86
+ const slug = at === -1 ? slugOrRef : slugOrRef.slice(0, at);
87
+ const state2 = await apiRequest(
88
+ options,
89
+ "POST",
90
+ "/api/public/world-sessions",
91
+ {
92
+ ...opts.versionId ? { versionId: opts.versionId } : { slug },
93
+ task,
94
+ ...opts.reuseWarm === void 0 ? {} : { reuseWarm: opts.reuseWarm }
95
+ }
96
+ );
97
+ return new WorldSession(state2.sessionId, state2, options);
98
+ }
99
+ async function runSessions(opts) {
100
+ const options = opts.options ?? {};
101
+ const concurrency = Math.max(1, opts.concurrency ?? 3);
102
+ let tasks = opts.tasks;
103
+ let versionId = opts.versionId;
104
+ if (!tasks || !versionId) {
105
+ const { openWorld: openWorld2 } = await Promise.resolve().then(() => (init_worlds(), worlds_exports));
106
+ const world = await openWorld2(opts.world, options);
107
+ tasks = tasks ?? world.tasks.map((t) => t.name);
108
+ versionId = versionId ?? world.version.versionId;
109
+ }
110
+ const results = [];
111
+ let next = 0;
112
+ await Promise.all(
113
+ Array.from({ length: Math.min(concurrency, tasks.length) }, async () => {
114
+ while (next < tasks.length) {
115
+ const task = tasks[next++];
116
+ let session = null;
117
+ try {
118
+ session = await openSession(opts.world, task, {
119
+ versionId,
120
+ options
121
+ });
122
+ await session.ready();
123
+ const toolkit = await session.toolkit();
124
+ await opts.agent({
125
+ session,
126
+ toolkit,
127
+ instruction: session.instruction ?? task,
128
+ task
129
+ });
130
+ const graded = await session.grade();
131
+ const result = {
132
+ task,
133
+ sessionId: session.sessionId,
134
+ reward: graded.reward,
135
+ rewards: graded.rewards
136
+ };
137
+ results.push(result);
138
+ opts.onResult?.(result);
139
+ } catch (error) {
140
+ const result = {
141
+ task,
142
+ sessionId: session?.sessionId ?? "",
143
+ reward: 0,
144
+ rewards: {},
145
+ // An Error with an empty message would read as "no error" to any
146
+ // caller checking truthiness; name the type instead.
147
+ error: (error instanceof Error ? error.message : String(error)) || (error instanceof Error ? error.name : "Unknown error")
148
+ };
149
+ results.push(result);
150
+ opts.onResult?.(result);
151
+ } finally {
152
+ await session?.close({ keepWarm: opts.keepWarm ?? true }).catch(() => void 0);
153
+ }
154
+ }
155
+ })
156
+ );
157
+ const mean = results.reduce((sum, r) => sum + (r.reward ?? 0), 0) / (results.length || 1);
158
+ return {
159
+ results: results.sort((a, b) => a.task.localeCompare(b.task)),
160
+ mean,
161
+ passed: opts.failUnder === void 0 ? true : mean >= opts.failUnder
162
+ };
163
+ }
164
+ var READY_TIMEOUT_MS, READY_POLL_MS, CALL_TIMEOUT_MS, CALL_POLL_MS, sleep2, WorldSessionTimeout, WorldSessionCallError, WorldSession;
165
+ var init_session = __esm({
166
+ "src/worlds/session.ts"() {
167
+ "use strict";
168
+ init_worlds();
169
+ READY_TIMEOUT_MS = 10 * 6e4;
170
+ READY_POLL_MS = 2e3;
171
+ CALL_TIMEOUT_MS = 3 * 6e4;
172
+ CALL_POLL_MS = 400;
173
+ sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
174
+ WorldSessionTimeout = class extends Error {
175
+ };
176
+ WorldSessionCallError = class extends Error {
177
+ };
178
+ WorldSession = class {
179
+ constructor(sessionId, state2, options) {
180
+ this.sessionId = sessionId;
181
+ this.state = state2;
182
+ this.options = options;
183
+ }
184
+ get task() {
185
+ return this.state.taskName;
186
+ }
187
+ /** What this task asks for — the bundle's own instruction.md. */
188
+ get instruction() {
189
+ return this.state.instruction ?? null;
190
+ }
191
+ get versionId() {
192
+ return this.state.versionId;
193
+ }
194
+ /** The session's latest platform state (one request, no waiting). */
195
+ async status() {
196
+ const fresh = await apiRequest(
197
+ this.options,
198
+ "GET",
199
+ `/api/public/world-sessions/${encodeURIComponent(this.sessionId)}`
200
+ );
201
+ this.state = {
202
+ instruction: this.state.instruction,
203
+ tools: this.state.tools,
204
+ ...fresh
205
+ };
206
+ return this.state;
207
+ }
208
+ /**
209
+ * Wait until the container is warm — meaning the process inside it has
210
+ * asked the platform for work, not merely that a job was accepted.
211
+ */
212
+ async ready(opts = {}) {
213
+ const deadline = Date.now() + (opts.timeoutMs ?? READY_TIMEOUT_MS);
214
+ for (; ; ) {
215
+ const state2 = await this.status();
216
+ if (state2.ready) return state2;
217
+ if (state2.state === "FAILED" || state2.state === "STOPPED")
218
+ throw new WorldSessionCallError(
219
+ `World session ${state2.state.toLowerCase()} before it was ready.`
220
+ );
221
+ if (Date.now() > deadline)
222
+ throw new WorldSessionTimeout(
223
+ `World session still ${state2.state} after ${Math.round((opts.timeoutMs ?? READY_TIMEOUT_MS) / 1e3)}s.`
224
+ );
225
+ await sleep2(READY_POLL_MS);
226
+ }
227
+ }
228
+ /** Enqueue one interaction and wait for the container's answer. */
229
+ async exchange(body, timeoutMs = CALL_TIMEOUT_MS) {
230
+ const { callId } = await apiRequest(
231
+ this.options,
232
+ "POST",
233
+ `/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/calls`,
234
+ body
235
+ );
236
+ const deadline = Date.now() + timeoutMs;
237
+ for (; ; ) {
238
+ const call = await apiRequest(
239
+ this.options,
240
+ "GET",
241
+ `/api/public/world-sessions/${encodeURIComponent(this.sessionId)}/calls/${encodeURIComponent(callId)}`
242
+ );
243
+ if (call.done) {
244
+ if (call.error) throw new WorldSessionCallError(call.error);
245
+ return call.result;
246
+ }
247
+ if (Date.now() > deadline)
248
+ throw new WorldSessionTimeout(
249
+ `Call ${callId} still ${call.state} after ${Math.round(timeoutMs / 1e3)}s \u2014 the container may have died.`
250
+ );
251
+ await sleep2(CALL_POLL_MS);
252
+ }
253
+ }
254
+ /**
255
+ * Run one of the world's tools INSIDE the container. The arguments and the
256
+ * result are the world's own contract — this layer neither validates nor
257
+ * reshapes them, so a tool error reads exactly as it would in a hosted run.
258
+ */
259
+ async call(tool, args = {}, opts = {}) {
260
+ return this.exchange({ kind: "call", tool, args }, opts.timeoutMs);
261
+ }
262
+ /**
263
+ * THE WORLD'S TOOLS, READY TO HAND TO A MODEL. Schemas come from the
264
+ * world's own signatures and implementations call into this session, so a
265
+ * caller never writes — and never has to re-sync — a tool map of their own:
266
+ *
267
+ * const { schemas, impls } = await session.toolkit();
268
+ * await runMyAgent(impls, schemas, session.instruction);
269
+ *
270
+ * A tool added to the world shows up here on the next run; a tool renamed
271
+ * in the world renames here too, instead of failing at call time against a
272
+ * hand-written map that still remembers the old name.
273
+ */
274
+ async toolkit() {
275
+ let specs = this.state.tools;
276
+ if (!specs) specs = (await this.status()).tools ?? [];
277
+ const impls = {};
278
+ for (const spec of specs) {
279
+ impls[spec.name] = (args = {}) => this.call(spec.name, args);
280
+ }
281
+ return { schemas: specs.map(schemaFromSignature), impls, specs };
282
+ }
283
+ /** Run the task's grader against the container's END STATE. */
284
+ async grade(opts = {}) {
285
+ const raw = await this.exchange(
286
+ { kind: "grade" },
287
+ opts.timeoutMs
288
+ );
289
+ const record = raw && typeof raw === "object" ? raw : {};
290
+ const rewards = {};
291
+ for (const [key, value] of Object.entries(record)) {
292
+ if (key !== "reward" && typeof value === "number") rewards[key] = value;
293
+ }
294
+ return {
295
+ reward: typeof record.reward === "number" ? record.reward : null,
296
+ rewards,
297
+ raw
298
+ };
299
+ }
300
+ /**
301
+ * End the session. `keepWarm` hands the container back to the pool instead
302
+ * of tearing it down, so the next session for the same task starts warm —
303
+ * the pooled instance still obeys the fleet's idle TTL and pinning.
304
+ */
305
+ async close(opts = {}) {
306
+ return apiRequest(
307
+ this.options,
308
+ "DELETE",
309
+ `/api/public/world-sessions/${encodeURIComponent(this.sessionId)}`,
310
+ { keepWarm: opts.keepWarm ?? false }
311
+ );
312
+ }
313
+ };
314
+ }
315
+ });
316
+
317
+ // src/worlds/index.ts
318
+ var worlds_exports = {};
319
+ __export(worlds_exports, {
320
+ WorldSession: () => WorldSession,
321
+ WorldSessionCallError: () => WorldSessionCallError,
322
+ WorldSessionTimeout: () => WorldSessionTimeout,
323
+ WorldSet: () => WorldSet,
324
+ WorldTask: () => WorldTask,
325
+ apiRequest: () => apiRequest,
326
+ attachSession: () => attachSession,
327
+ deleteEnvSecret: () => deleteEnvSecret,
328
+ detectProvenance: () => detectProvenance,
329
+ getRun: () => getRun,
330
+ listEnvSecretKeys: () => listEnvSecretKeys,
331
+ listRunConfigs: () => listRunConfigs,
332
+ openSession: () => openSession,
333
+ openWorld: () => openWorld,
334
+ runSessions: () => runSessions,
335
+ schemaFromSignature: () => schemaFromSignature,
336
+ setEnvSecret: () => setEnvSecret,
337
+ waitForRun: () => waitForRun
338
+ });
339
+ function resolveEnv(options) {
340
+ const host = options.host ?? process.env.GATEWAY_HOST ?? "https://withgateway.ai";
341
+ const publicKey = options.publicKey ?? process.env.GATEWAY_PUBLIC_KEY;
342
+ const secretKey = options.secretKey ?? process.env.GATEWAY_SECRET_KEY;
343
+ if (!publicKey || !secretKey) {
344
+ throw new Error(
345
+ "Gateway keys missing: set GATEWAY_PUBLIC_KEY / GATEWAY_SECRET_KEY (or pass publicKey/secretKey)."
346
+ );
347
+ }
348
+ return { host: host.replace(/\/+$/, ""), publicKey, secretKey };
349
+ }
350
+ async function apiRequest(options, method, path, body) {
351
+ const { host, publicKey, secretKey } = resolveEnv(options);
352
+ const res = await fetch(`${host}${path}`, {
353
+ method,
354
+ headers: {
355
+ "content-type": "application/json",
356
+ authorization: "Basic " + Buffer.from(`${publicKey}:${secretKey}`).toString("base64")
357
+ },
358
+ ...body === void 0 ? {} : { body: JSON.stringify(body) }
359
+ });
360
+ const text = await res.text();
361
+ if (!res.ok) {
362
+ throw new Error(
363
+ `${method} ${path} -> ${res.status}: ${text.slice(0, 400)}`
364
+ );
365
+ }
366
+ return JSON.parse(text);
367
+ }
368
+ async function setEnvSecret(slug, key, value, options = {}) {
369
+ return apiRequest(
370
+ options,
371
+ "PUT",
372
+ "/api/public/benchmark-containers/secrets",
373
+ {
374
+ slug,
375
+ key,
376
+ value
377
+ }
378
+ );
379
+ }
380
+ async function listEnvSecretKeys(slug, options = {}) {
381
+ const res = await apiRequest(
382
+ options,
383
+ "GET",
384
+ `/api/public/benchmark-containers/secrets?slug=${encodeURIComponent(slug)}`
385
+ );
386
+ return res.secrets;
387
+ }
388
+ async function deleteEnvSecret(slug, key, options = {}) {
389
+ await apiRequest(
390
+ options,
391
+ "DELETE",
392
+ "/api/public/benchmark-containers/secrets",
393
+ {
394
+ slug,
395
+ key
396
+ }
397
+ );
398
+ }
399
+ async function listRunConfigs(options = {}) {
400
+ const res = await apiRequest(
401
+ options,
402
+ "GET",
403
+ "/api/public/benchmark-containers/run-configs"
404
+ );
405
+ return res.runConfigs;
406
+ }
407
+ async function getRun(runId, options = {}) {
408
+ return apiRequest(
409
+ options,
410
+ "GET",
411
+ `/api/public/benchmark-containers/runs/${encodeURIComponent(runId)}`
412
+ );
413
+ }
414
+ async function waitForRun(runId, opts = {}) {
415
+ const deadline = Date.now() + (opts.timeoutMinutes ?? 45) * 6e4;
416
+ for (; ; ) {
417
+ const run = await getRun(runId, opts.options ?? {});
418
+ if (run.terminal) return run;
419
+ if (Date.now() > deadline)
420
+ throw new Error(
421
+ `Run ${runId} still ${run.status} after the wait timeout.`
422
+ );
423
+ opts.onTick?.(run);
424
+ await new Promise(
425
+ (resolve) => setTimeout(resolve, (opts.intervalSeconds ?? 20) * 1e3)
426
+ );
427
+ }
428
+ }
429
+ function detectProvenance() {
430
+ const env = globalThis.process?.env ?? {};
431
+ const out = {};
432
+ const ref = env.GITHUB_HEAD_REF || env.GITHUB_REF_NAME;
433
+ if (ref) out.branch = ref;
434
+ if (env.GITHUB_SHA) out.commit = env.GITHUB_SHA;
435
+ const server = env.GITHUB_SERVER_URL ?? "https://github.com";
436
+ if (env.GITHUB_REPOSITORY) out.repoUrl = `${server}/${env.GITHUB_REPOSITORY}`;
437
+ if (env.GITHUB_ACTOR) {
438
+ out.actor = {
439
+ kind: "ci",
440
+ id: env.GITHUB_ACTOR,
441
+ name: env.GITHUB_ACTOR,
442
+ // GitHub serves every account's avatar at /<login>.png.
443
+ imageUrl: `${server}/${env.GITHUB_ACTOR}.png`
444
+ };
445
+ }
446
+ if (!out.branch || !out.commit) {
447
+ try {
448
+ const { execFileSync } = __require("child_process");
449
+ const git = (args) => execFileSync("git", args, {
450
+ encoding: "utf-8",
451
+ stdio: ["ignore", "pipe", "ignore"]
452
+ }).toString().trim();
453
+ out.branch = out.branch ?? git(["rev-parse", "--abbrev-ref", "HEAD"]);
454
+ out.commit = out.commit ?? git(["rev-parse", "HEAD"]);
455
+ if (!out.repoUrl) {
456
+ const remote = git(["config", "--get", "remote.origin.url"]);
457
+ if (remote) out.repoUrl = remote.replace(/\.git$/, "");
458
+ }
459
+ if (!out.actor) {
460
+ const name = git(["config", "--get", "user.name"]);
461
+ if (name) out.actor = { kind: "user", name };
462
+ }
463
+ } catch {
464
+ }
465
+ }
466
+ return out;
467
+ }
468
+ async function openWorld(slugRef, options = {}) {
469
+ const at = slugRef.indexOf("@");
470
+ const slug = at === -1 ? slugRef : slugRef.slice(0, at);
471
+ const ref = at === -1 ? null : slugRef.slice(at + 1);
472
+ const version = await apiRequest(options, "POST", "/api/public/benchmark-containers/resolve-version", {
473
+ slug,
474
+ ...ref ? { ref } : {}
475
+ });
476
+ const world = new WorldSet(
477
+ slugRef,
478
+ slug,
479
+ ref,
480
+ {
481
+ versionId: version.versionId,
482
+ semanticVersion: version.semanticVersion ?? null,
483
+ contentHash: version.contentHash,
484
+ state: version.state
485
+ },
486
+ [],
487
+ options
488
+ );
489
+ for (const name of version.taskNames ?? []) {
490
+ const variant = /^[a-z0-9]+-([a-z0-9]+)-/.exec(name)?.[1] ?? null;
491
+ world.tasks.push(new WorldTask(world, name, variant));
492
+ }
493
+ return world;
494
+ }
495
+ var WorldTask, WorldSet;
496
+ var init_worlds = __esm({
497
+ "src/worlds/index.ts"() {
498
+ "use strict";
499
+ init_session();
500
+ WorldTask = class {
501
+ constructor(world, name, variant) {
502
+ this.world = world;
503
+ this.name = name;
504
+ this.variant = variant;
505
+ }
506
+ };
507
+ WorldSet = class {
508
+ constructor(slugRef, slug, ref, version, tasks, options) {
509
+ this.slugRef = slugRef;
510
+ this.slug = slug;
511
+ this.ref = ref;
512
+ this.version = version;
513
+ this.tasks = tasks;
514
+ this.options = options;
515
+ }
516
+ task(variant) {
517
+ const hit = this.tasks.find(
518
+ (t) => t.variant === variant || t.name.includes(variant)
519
+ );
520
+ if (!hit) {
521
+ const known = this.tasks.map((t) => t.variant ?? t.name).join(", ");
522
+ throw new Error(`no task matches ${variant}; have: ${known}`);
523
+ }
524
+ return hit;
525
+ }
526
+ /**
527
+ * Open a LIVE session against one of this world's tasks: the platform boots
528
+ * (or reuses) a warm container, and your agent calls its tools through the
529
+ * platform. See worlds/session.ts.
530
+ */
531
+ async open(task, opts = {}) {
532
+ const { openSession: openSession2 } = await Promise.resolve().then(() => (init_session(), session_exports));
533
+ return openSession2(this.slug, task, {
534
+ versionId: this.version.versionId,
535
+ reuseWarm: opts.reuseWarm,
536
+ options: this.options
537
+ });
538
+ }
539
+ /**
540
+ * Start a HOSTED run of a run config against this world — the platform
541
+ * executes the (Python) world in parallel containers per the config's
542
+ * `parallelism` and files one graded run per model. Returns those runs.
543
+ */
544
+ async dispatch(runConfigId, opts = {}) {
545
+ const provenance = opts.provenance ?? detectProvenance();
546
+ return apiRequest(
547
+ this.options,
548
+ "POST",
549
+ "/api/public/benchmark-containers/run-configs/dispatch",
550
+ {
551
+ runConfigId,
552
+ ...opts.containerId ? { containerId: opts.containerId } : {},
553
+ versionId: opts.versionId ?? this.version.versionId,
554
+ ...provenance
555
+ }
556
+ );
557
+ }
558
+ };
559
+ }
560
+ });
561
+
19
562
  // package.json
20
563
  var require_package = __commonJS({
21
564
  "package.json"(exports, module) {
22
565
  module.exports = {
23
566
  name: "@withgateway/sdk",
24
- version: "0.1.13",
567
+ version: "0.1.14",
25
568
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
26
569
  main: "./dist/index.js",
27
570
  module: "./dist/index.mjs",
@@ -81,6 +624,11 @@ var require_package = __commonJS({
81
624
  types: "./dist/scores/index.d.ts",
82
625
  import: "./dist/scores/index.mjs",
83
626
  require: "./dist/scores/index.js"
627
+ },
628
+ "./worlds": {
629
+ types: "./dist/worlds/index.d.ts",
630
+ import: "./dist/worlds/index.mjs",
631
+ require: "./dist/worlds/index.js"
84
632
  }
85
633
  },
86
634
  files: [
@@ -94,6 +642,7 @@ var require_package = __commonJS({
94
642
  build: "tsup",
95
643
  dev: "tsup --watch",
96
644
  typecheck: "tsc --noEmit",
645
+ "typecheck:examples": "tsc -p tsconfig.examples.json --noEmit",
97
646
  test: "vitest",
98
647
  "test:run": "vitest run",
99
648
  lint: "eslint src --ext .ts",
@@ -154,10 +703,29 @@ var require_package = __commonJS({
154
703
  "@opentelemetry/sdk-trace-node": "^2.6.0",
155
704
  "@opentelemetry/semantic-conventions": "^1.40.0",
156
705
  "@types/node": "^20.0.0",
706
+ openai: "^4.70.0",
157
707
  tsup: "^8.0.0",
158
708
  tsx: "^4.0.0",
159
709
  typescript: "^5.0.0",
160
- vitest: "^2.0.0"
710
+ vitest: "^3.2.6"
711
+ },
712
+ overrides: {
713
+ protobufjs: "^8.4.1",
714
+ "vite@6": "^6.4.3",
715
+ postcss: "^8.5.18",
716
+ "picomatch@4": "^4.0.4"
717
+ },
718
+ pnpm: {
719
+ overrides: {
720
+ protobufjs: "^8.4.1",
721
+ vitest: "^3.2.6",
722
+ "vite@6": "^6.4.3",
723
+ postcss: "^8.5.18",
724
+ "picomatch@4": "^4.0.4"
725
+ }
726
+ },
727
+ bin: {
728
+ gateway: "./dist/cli.js"
161
729
  }
162
730
  };
163
731
  }
@@ -2961,6 +3529,10 @@ var scores = {
2961
3529
  success
2962
3530
  };
2963
3531
 
3532
+ // src/index.ts
3533
+ init_worlds();
3534
+ init_session();
3535
+
2964
3536
  // src/build/index.ts
2965
3537
  import { createHash as createHash2 } from "crypto";
2966
3538
  function canonicalJson(value) {
@@ -3887,9 +4459,16 @@ export {
3887
4459
  TraceDiff,
3888
4460
  UserProfileError,
3889
4461
  UsersClient,
4462
+ WorldSession,
4463
+ WorldSessionCallError,
4464
+ WorldSessionTimeout,
4465
+ WorldSet,
4466
+ WorldTask,
3890
4467
  addExperimentAttributes,
4468
+ apiRequest,
3891
4469
  assembleManifest,
3892
4470
  assignVariant,
4471
+ attachSession,
3893
4472
  basicAuthHeader,
3894
4473
  canonicalJson,
3895
4474
  clearExperimentContext,
@@ -3898,6 +4477,8 @@ export {
3898
4477
  context,
3899
4478
  currentTraceId,
3900
4479
  defineTool,
4480
+ deleteEnvSecret,
4481
+ detectProvenance,
3901
4482
  experimentContextStorage,
3902
4483
  singleton_exports as experiments,
3903
4484
  gateway,
@@ -3906,9 +4487,14 @@ export {
3906
4487
  getRegisteredPrompts,
3907
4488
  getRegisteredSkills,
3908
4489
  getRegisteredTools,
4490
+ getRun,
3909
4491
  identify,
4492
+ listEnvSecretKeys,
4493
+ listRunConfigs,
3910
4494
  loadSession,
3911
4495
  memory,
4496
+ openSession,
4497
+ openWorld,
3912
4498
  personas,
3913
4499
  registerArtifact,
3914
4500
  registerPrompt,
@@ -3917,15 +4503,19 @@ export {
3917
4503
  replay,
3918
4504
  resetBuildRegistry,
3919
4505
  resolveUserId,
4506
+ runSessions,
3920
4507
  runSuite,
3921
4508
  runWithExperimentContext,
4509
+ schemaFromSignature,
3922
4510
  scores,
3923
4511
  sessionObservationFromApi,
3924
4512
  sessions,
4513
+ setEnvSecret,
3925
4514
  setExperimentContext,
3926
4515
  success,
3927
4516
  suite,
3928
4517
  tracing,
3929
- users
4518
+ users,
4519
+ waitForRun
3930
4520
  };
3931
4521
  //# sourceMappingURL=index.mjs.map