@tangle-network/sandbox 0.9.4-develop.20260710200846.ca3d375 → 0.9.4-develop.20260711011249.9d3b3b3

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.
@@ -33,7 +33,8 @@ function normalizeRuntimeBackendConfig(backend, options = {}) {
33
33
  ...inlineProfile ? { inlineProfile } : callerInlineProfile ? { inlineProfile: callerInlineProfile } : {},
34
34
  ...backend?.model ? { model: backend.model } : options.model ? { model: parseModelString(options.model) } : {},
35
35
  ...backend?.server ? { server: backend.server } : {},
36
- ...backend?.interactions !== void 0 ? { interactions: backend.interactions } : {}
36
+ ...backend?.interactions !== void 0 ? { interactions: backend.interactions } : {},
37
+ ...backend?.metadata !== void 0 ? { metadata: backend.metadata } : {}
37
38
  };
38
39
  }
39
40
  /**
@@ -100,19 +101,42 @@ function toBackendProfile(profile) {
100
101
  ...timeout !== void 0 ? { timeout } : {}
101
102
  }];
102
103
  })) : void 0;
104
+ const openCodeExtension = profile.extensions?.opencode;
105
+ const plugins = openCodeExtension?.plugins;
106
+ if (plugins !== void 0 && (!Array.isArray(plugins) || plugins.some((plugin) => typeof plugin !== "string" || !plugin.trim()))) throw new Error("backend.profile.extensions.opencode.plugins must be an array of non-empty package names");
107
+ const commands = openCodeExtension?.commands;
108
+ if (commands !== void 0 && (commands === null || typeof commands !== "object" || Array.isArray(commands))) throw new Error("backend.profile.extensions.opencode.commands must be an object");
109
+ const profileExtends = openCodeExtension?.extends;
110
+ if (profileExtends !== void 0 && typeof profileExtends !== "string" && (!Array.isArray(profileExtends) || profileExtends.some((entry) => typeof entry !== "string" || !entry.trim()))) throw new Error("backend.profile.extensions.opencode.extends must be a profile name or array of profile names");
111
+ const agents = profile.subagents ? Object.fromEntries(Object.entries(profile.subagents).map(([name, subagent]) => [name, {
112
+ description: subagent.description,
113
+ prompt: subagent.prompt,
114
+ model: subagent.model,
115
+ tools: subagent.tools,
116
+ permission: subagent.permissions,
117
+ maxSteps: subagent.maxSteps,
118
+ ...subagent.metadata ?? {}
119
+ }])) : void 0;
103
120
  return {
104
121
  name: profile.name,
122
+ description: profile.description,
123
+ version: profile.version,
124
+ tags: profile.tags,
125
+ ...profileExtends ? { extends: profileExtends } : {},
105
126
  model: profile.model?.default,
127
+ small_model: profile.model?.small,
106
128
  ...profile.prompt?.systemPrompt ? { systemPrompt: profile.prompt.systemPrompt } : {},
107
129
  ...Object.keys(tools).length > 0 ? { tools } : {},
108
130
  ...profile.prompt?.instructions?.length ? { instructions: profile.prompt.instructions } : {},
109
131
  ...Object.keys(permission).length > 0 ? { permission } : {},
110
132
  ...mcp ? { mcp } : {},
111
133
  ...profile.connections?.length ? { connections: profile.connections } : {},
112
- ...profile.subagents ? { subagents: profile.subagents } : {},
134
+ ...agents ? { agent: agents } : {},
113
135
  ...profile.resources && hasAnyProfileResource(profile.resources) ? { resources: profile.resources } : {},
114
136
  ...profile.hooks ? { hooks: profile.hooks } : {},
115
137
  ...profile.modes ? { modes: profile.modes } : {},
138
+ ...commands ? { command: commands } : {},
139
+ ...plugins?.length ? { plugin: plugins } : {},
116
140
  ...profile.extensions ? { extensions: profile.extensions } : {}
117
141
  };
118
142
  }
@@ -575,6 +599,244 @@ function collectAgentResponseText(events) {
575
599
  return responseText && responseText.trim().length > 0 ? responseText : void 0;
576
600
  }
577
601
  //#endregion
602
+ //#region src/runtime-api.ts
603
+ /** Internal typed client for routes served by a sandbox runtime. */
604
+ var SandboxRuntimeApi = class {
605
+ terminals;
606
+ constructor(transport) {
607
+ this.transport = transport;
608
+ this.terminals = {
609
+ create: (options, request) => this.createTerminal(options, request),
610
+ input: (terminalId, data, request) => this.writeTerminal(terminalId, data, request),
611
+ list: () => this.listTerminals(),
612
+ get: (terminalId) => this.getTerminal(terminalId)
613
+ };
614
+ }
615
+ async health() {
616
+ await this.transport.ensureRunning();
617
+ return this.json("/health", { method: "GET" });
618
+ }
619
+ async ports() {
620
+ await this.transport.ensureRunning();
621
+ return (await this.json("/ports", { method: "GET" })).data?.ports ?? [];
622
+ }
623
+ async profiles() {
624
+ await this.transport.ensureRunning();
625
+ return this.json("/profiles", { method: "GET" });
626
+ }
627
+ async readFiles(paths, options = {}) {
628
+ if (paths.length === 0) return {
629
+ files: [],
630
+ errors: [],
631
+ stats: {
632
+ requested: 0,
633
+ succeeded: 0,
634
+ failed: 0
635
+ }
636
+ };
637
+ await this.transport.ensureRunning();
638
+ const files = [];
639
+ const errors = [];
640
+ let requested = 0;
641
+ let succeeded = 0;
642
+ let failed = 0;
643
+ for (let offset = 0; offset < paths.length; offset += 100) {
644
+ const chunk = paths.slice(offset, offset + 100);
645
+ const params = new URLSearchParams();
646
+ if (options.sessionId) params.set("sessionId", options.sessionId);
647
+ const query = params.toString();
648
+ const payload = await this.json(`/files/read-batch${query ? `?${query}` : ""}`, {
649
+ method: "POST",
650
+ body: JSON.stringify({
651
+ paths: chunk,
652
+ ...options.encoding ? { encoding: options.encoding } : {}
653
+ })
654
+ });
655
+ for (const [path, result] of Object.entries(payload.data.files)) if (result.success) files.push({
656
+ path,
657
+ content: result.content,
658
+ encoding: result.encoding,
659
+ hash: result.hash,
660
+ size: result.size,
661
+ mtime: result.mtime
662
+ });
663
+ else errors.push({
664
+ path,
665
+ error: result.error,
666
+ code: result.code
667
+ });
668
+ const results = Object.values(payload.data.files);
669
+ requested += payload.data.stats?.requested ?? chunk.length;
670
+ succeeded += payload.data.stats?.succeeded ?? results.filter((entry) => entry.success).length;
671
+ failed += payload.data.stats?.failed ?? results.filter((entry) => !entry.success).length;
672
+ }
673
+ return {
674
+ files,
675
+ errors,
676
+ stats: {
677
+ requested,
678
+ succeeded,
679
+ failed
680
+ }
681
+ };
682
+ }
683
+ async fileTree(path, options = {}) {
684
+ if (options.maxDepth !== void 0 && (!Number.isInteger(options.maxDepth) || options.maxDepth < 1 || options.maxDepth > 20)) throw new ValidationError("maxDepth must be an integer between 1 and 20");
685
+ await this.transport.ensureRunning();
686
+ const params = new URLSearchParams({ path });
687
+ if (options.maxDepth !== void 0) params.set("maxDepth", String(options.maxDepth));
688
+ if (options.sessionId) params.set("sessionId", options.sessionId);
689
+ return (await this.json(`/files/tree?${params}`, { method: "GET" })).data;
690
+ }
691
+ async createSession(options) {
692
+ await this.transport.ensureRunning();
693
+ const info = normalizeSessionInfo(await this.json("/agents/sessions", {
694
+ method: "POST",
695
+ body: JSON.stringify({
696
+ ...options.title !== void 0 ? { title: options.title } : {},
697
+ ...options.parentId !== void 0 ? { parentID: options.parentId } : {},
698
+ backend: normalizeRuntimeBackendConfig(options.backend)
699
+ })
700
+ }));
701
+ if (!info) throw new ServerError("Session creation response missing session id", 502, {
702
+ endpoint: "/agents/sessions",
703
+ origin: "runtime"
704
+ });
705
+ return info;
706
+ }
707
+ async createTaskSession(options) {
708
+ await this.transport.ensureRunning();
709
+ const info = await this.json("/tasks", {
710
+ method: "POST",
711
+ body: JSON.stringify({
712
+ sessionId: options.sessionId,
713
+ backend: normalizeRuntimeBackendConfig(options.backend),
714
+ title: options.title,
715
+ ...options.parentSessionId !== void 0 ? { parentSessionId: options.parentSessionId } : {},
716
+ ...options.profile !== void 0 ? { profile: options.profile } : {},
717
+ ...options.isolateFileWrites !== void 0 ? { isolateFileWrites: options.isolateFileWrites } : {}
718
+ })
719
+ });
720
+ if (!info.id) throw new ServerError("Task session creation response missing session id", 502, {
721
+ endpoint: "/tasks",
722
+ origin: "runtime"
723
+ });
724
+ return info;
725
+ }
726
+ async sendSessionMessage(id, request, options = {}) {
727
+ if (options.timeoutMs !== void 0 && options.timeoutMs <= 0) throw new ValidationError("timeoutMs must be greater than zero");
728
+ await this.transport.ensureRunning();
729
+ const headers = new Headers({ "x-no-retry": "true" });
730
+ if (options.credentials?.apiKey) headers.set("X-Backend-Api-Key", options.credentials.apiKey);
731
+ if (options.credentials?.baseUrl) headers.set("X-Backend-Base-Url", options.credentials.baseUrl);
732
+ const timeoutSignal = options.timeoutMs !== void 0 ? AbortSignal.timeout(options.timeoutMs) : void 0;
733
+ const signal = options.signal && timeoutSignal ? AbortSignal.any([options.signal, timeoutSignal]) : options.signal ?? timeoutSignal;
734
+ return this.json(`/agents/sessions/${encodeURIComponent(id)}/messages`, {
735
+ method: "POST",
736
+ headers,
737
+ signal,
738
+ body: JSON.stringify({
739
+ ...request.messageId !== void 0 ? { messageID: request.messageId } : {},
740
+ parts: request.parts,
741
+ ...request.system !== void 0 ? { system: request.system } : {},
742
+ ...request.agent !== void 0 ? { agent: request.agent } : {},
743
+ ...request.model !== void 0 ? { model: {
744
+ providerID: request.model.providerId,
745
+ modelID: request.model.modelId
746
+ } } : {},
747
+ ...request.reasoningEffort !== void 0 ? { reasoningEffort: request.reasoningEffort } : {},
748
+ ...request.turnId !== void 0 ? { turnId: request.turnId } : {},
749
+ ...request.interactions !== void 0 ? { interactions: request.interactions } : {}
750
+ })
751
+ });
752
+ }
753
+ async deleteSession(id) {
754
+ await this.transport.ensureRunning();
755
+ await this.request(`/agents/sessions/${encodeURIComponent(id)}`, { method: "DELETE" });
756
+ }
757
+ async taskSessionChanges(id) {
758
+ await this.transport.ensureRunning();
759
+ return this.json(`/tasks/${encodeURIComponent(id)}/changes`, { method: "GET" });
760
+ }
761
+ async commitTaskSession(id, options = {}) {
762
+ await this.transport.ensureRunning();
763
+ return this.json(`/tasks/${encodeURIComponent(id)}/changes`, {
764
+ method: "POST",
765
+ body: JSON.stringify({
766
+ ...options.message !== void 0 ? { message: options.message } : {},
767
+ ...options.files !== void 0 ? { files: options.files } : {}
768
+ })
769
+ });
770
+ }
771
+ async createTerminal(options = {}, request = {}) {
772
+ await this.transport.ensureRunning();
773
+ const params = new URLSearchParams();
774
+ if (request.sessionId) params.set("sessionId", request.sessionId);
775
+ const query = params.toString();
776
+ return (await this.json(`/terminals${query ? `?${query}` : ""}`, {
777
+ method: "POST",
778
+ body: JSON.stringify(options)
779
+ })).data;
780
+ }
781
+ async writeTerminal(terminalId, data, request = {}) {
782
+ await this.transport.ensureRunning();
783
+ const params = new URLSearchParams();
784
+ if (request.sessionId) params.set("sessionId", request.sessionId);
785
+ const query = params.toString();
786
+ await this.request(`/terminals/${encodeURIComponent(terminalId)}/input${query ? `?${query}` : ""}`, {
787
+ method: "POST",
788
+ body: JSON.stringify({ data })
789
+ });
790
+ }
791
+ async listTerminals() {
792
+ await this.transport.ensureRunning();
793
+ return (await this.json("/terminals", { method: "GET" })).data ?? [];
794
+ }
795
+ async getTerminal(terminalId) {
796
+ await this.transport.ensureRunning();
797
+ const response = await this.transport.fetch(`/terminals/${encodeURIComponent(terminalId)}`, { method: "GET" });
798
+ if (response.status === 404) return null;
799
+ await this.assertOk(response);
800
+ return (await response.json()).data;
801
+ }
802
+ async json(path, init) {
803
+ return await (await this.request(path, init)).json();
804
+ }
805
+ async request(path, init) {
806
+ const response = await this.transport.fetch(path, init);
807
+ await this.assertOk(response);
808
+ return response;
809
+ }
810
+ async assertOk(response) {
811
+ if (response.ok) return;
812
+ const body = await response.text();
813
+ throw parseErrorResponse(response.status, body, void 0, response.headers);
814
+ }
815
+ };
816
+ function normalizeSessionInfo(raw) {
817
+ const id = raw.id;
818
+ if (typeof id !== "string") return null;
819
+ const status = raw.status || "running";
820
+ return {
821
+ id,
822
+ parentId: typeof raw.parentID === "string" ? raw.parentID : typeof raw.parentId === "string" ? raw.parentId : void 0,
823
+ status: [
824
+ "queued",
825
+ "running",
826
+ "completed",
827
+ "failed",
828
+ "cancelled"
829
+ ].includes(status) ? status : "running",
830
+ backend: typeof raw.backendType === "string" ? raw.backendType : typeof raw.backend === "string" ? raw.backend : void 0,
831
+ model: typeof raw.model === "string" ? raw.model : void 0,
832
+ promptCount: typeof raw.promptCount === "number" ? raw.promptCount : void 0,
833
+ createdAt: raw.createdAt ? new Date(raw.createdAt) : void 0,
834
+ startedAt: raw.startedAt ? new Date(raw.startedAt) : void 0,
835
+ endedAt: raw.endedAt ? new Date(raw.endedAt) : void 0,
836
+ raw
837
+ };
838
+ }
839
+ //#endregion
578
840
  //#region src/interactive.ts
579
841
  /**
580
842
  * Handle for one session's interactive harness. Obtained via
@@ -696,6 +958,13 @@ var SandboxSession = class SandboxSession {
696
958
  });
697
959
  }
698
960
  /**
961
+ * Send a structured message through the session message endpoint. Model and
962
+ * message identifiers are translated to the runtime's wire names by the SDK.
963
+ */
964
+ async sendMessage(request, options) {
965
+ return this.box._sessionSendMessage(this.id, request, options);
966
+ }
967
+ /**
699
968
  * Abort the session's in-flight execution; the session and its messages
700
969
  * are preserved (this does not delete the session). Void-returning alias
701
970
  * of `interrupt()` — use `interrupt()` when you need to know whether an
@@ -706,6 +975,10 @@ var SandboxSession = class SandboxSession {
706
975
  async cancel() {
707
976
  return this.box._sessionCancel(this.id);
708
977
  }
978
+ /** Delete this session and its persisted runtime state. */
979
+ async delete() {
980
+ return this.box._sessionDelete(this.id);
981
+ }
709
982
  /**
710
983
  * Fork this session into a new queued session. The fork shares the
711
984
  * parent workspace and copies conversation history up to `messageId`
@@ -755,6 +1028,24 @@ var SandboxSession = class SandboxSession {
755
1028
  }
756
1029
  };
757
1030
  //#endregion
1031
+ //#region src/task-session.ts
1032
+ /** A background task session with isolated changeset operations. */
1033
+ var SandboxTaskSession = class extends SandboxSession {
1034
+ /** @internal Apps should call `box.taskSession(id)`. */
1035
+ constructor(taskBox, id) {
1036
+ super(taskBox, id);
1037
+ this.taskBox = taskBox;
1038
+ }
1039
+ /** Read the task's isolated file changes. */
1040
+ async changes() {
1041
+ return this.taskBox._taskSessionChanges(this.id);
1042
+ }
1043
+ /** Apply all or a selected subset of the task's isolated file changes. */
1044
+ async commit(options) {
1045
+ return this.taskBox._taskSessionCommit(this.id, options);
1046
+ }
1047
+ };
1048
+ //#endregion
758
1049
  //#region src/sandbox.ts
759
1050
  /**
760
1051
  * Sandbox Instance
@@ -1027,10 +1318,15 @@ var SandboxInstance = class SandboxInstance {
1027
1318
  client;
1028
1319
  info;
1029
1320
  defaultRuntimeBackend;
1321
+ runtime;
1030
1322
  constructor(client, info, defaultRuntimeBackend) {
1031
1323
  this.client = client;
1032
1324
  this.info = info;
1033
1325
  this.defaultRuntimeBackend = defaultRuntimeBackend;
1326
+ this.runtime = new SandboxRuntimeApi({
1327
+ ensureRunning: () => this.ensureRunning(),
1328
+ fetch: (path, init) => this.runtimeFetch(path, init)
1329
+ });
1034
1330
  }
1035
1331
  /** Unique sandbox identifier */
1036
1332
  get id() {
@@ -1447,11 +1743,15 @@ var SandboxInstance = class SandboxInstance {
1447
1743
  */
1448
1744
  async write(path, content, options) {
1449
1745
  await this.ensureRunning();
1450
- const response = await this.runtimeFetch("/files/write", {
1746
+ const params = new URLSearchParams();
1747
+ if (options?.sessionId) params.set("sessionId", options.sessionId);
1748
+ const query = params.toString();
1749
+ const response = await this.runtimeFetch(`/files/write${query ? `?${query}` : ""}`, {
1451
1750
  method: "POST",
1452
1751
  body: JSON.stringify({
1453
1752
  path,
1454
1753
  content,
1754
+ encoding: options?.encoding,
1455
1755
  mode: options?.mode
1456
1756
  })
1457
1757
  });
@@ -1459,6 +1759,7 @@ var SandboxInstance = class SandboxInstance {
1459
1759
  const body = await response.text();
1460
1760
  throw parseErrorResponse(response.status, body, void 0, response.headers);
1461
1761
  }
1762
+ return (await response.json()).data;
1462
1763
  }
1463
1764
  /**
1464
1765
  * Write many files in one paced, retry-aware batch — see
@@ -2149,6 +2450,22 @@ var SandboxInstance = class SandboxInstance {
2149
2450
  after: match.after
2150
2451
  };
2151
2452
  }
2453
+ /** Basic health reported by the runtime inside this sandbox. */
2454
+ async runtimeHealth() {
2455
+ return this.runtime.health();
2456
+ }
2457
+ /** Return the runtime's current listening-port snapshot. */
2458
+ async ports() {
2459
+ return this.runtime.ports();
2460
+ }
2461
+ /** Interactive terminal operations for this runtime. */
2462
+ get terminals() {
2463
+ return this.runtime.terminals;
2464
+ }
2465
+ /** List profiles installed in this sandbox runtime. */
2466
+ async listProfiles() {
2467
+ return this.runtime.profiles();
2468
+ }
2152
2469
  /**
2153
2470
  * Live whole-sandbox resource usage (memory + CPU) from the container cgroup.
2154
2471
  *
@@ -2383,6 +2700,8 @@ var SandboxInstance = class SandboxInstance {
2383
2700
  return {
2384
2701
  supportsWriteMode: true,
2385
2702
  read: (path) => this.read(path),
2703
+ readBatch: (paths, options) => this.fsReadBatch(paths, options),
2704
+ tree: (path, options) => this.fsTree(path, options),
2386
2705
  write: (path, content, options) => this.write(path, content, options),
2387
2706
  writeMany: (files, options) => this.writeMany(files, options),
2388
2707
  search: (query, options) => this.search(query, options),
@@ -2397,6 +2716,12 @@ var SandboxInstance = class SandboxInstance {
2397
2716
  exists: (path) => this.fsExists(path)
2398
2717
  };
2399
2718
  }
2719
+ async fsReadBatch(paths, options = {}) {
2720
+ return this.runtime.readFiles(paths, options);
2721
+ }
2722
+ async fsTree(path, options = {}) {
2723
+ return this.runtime.fileTree(path, options);
2724
+ }
2400
2725
  async fsUpload(localPath, remotePath, options) {
2401
2726
  await this.ensureRunning();
2402
2727
  const fs = await import("node:fs/promises");
@@ -2549,8 +2874,21 @@ var SandboxInstance = class SandboxInstance {
2549
2874
  }
2550
2875
  async fsDelete(path, options) {
2551
2876
  await this.ensureRunning();
2877
+ if (options?.sessionId && !options.recursive) {
2878
+ const params = new URLSearchParams({ sessionId: options.sessionId });
2879
+ const response = await this.runtimeFetch(`/files/delete?${params}`, {
2880
+ method: "POST",
2881
+ body: JSON.stringify({ path })
2882
+ });
2883
+ if (!response.ok) {
2884
+ const body = await response.text();
2885
+ throw parseErrorResponse(response.status, body, void 0, response.headers);
2886
+ }
2887
+ return;
2888
+ }
2552
2889
  const params = new URLSearchParams();
2553
2890
  if (options?.recursive) params.set("recursive", "true");
2891
+ if (options?.sessionId) params.set("sessionId", options.sessionId);
2554
2892
  const query = params.toString();
2555
2893
  const url = query ? `/fs${path}?${query}` : `/fs${path}`;
2556
2894
  const response = await this.runtimeFetch(url, { method: "DELETE" });
@@ -4132,6 +4470,30 @@ var SandboxInstance = class SandboxInstance {
4132
4470
  session(id) {
4133
4471
  return new SandboxSession(this, id);
4134
4472
  }
4473
+ /** Create an agent session and return both its handle and initial metadata. */
4474
+ async createSession(options) {
4475
+ const info = await this.runtime.createSession(options);
4476
+ return {
4477
+ session: this.session(info.id),
4478
+ info
4479
+ };
4480
+ }
4481
+ /** Delete an agent session by id. */
4482
+ async deleteSession(id) {
4483
+ return this._sessionDelete(id);
4484
+ }
4485
+ /** Get a lazy background-task session reference. */
4486
+ taskSession(id) {
4487
+ return new SandboxTaskSession(this, id);
4488
+ }
4489
+ /** Create a background task session. Dispatch work with `session.sendMessage()`. */
4490
+ async createTaskSession(options) {
4491
+ const info = await this.runtime.createTaskSession(options);
4492
+ return {
4493
+ session: this.taskSession(info.id),
4494
+ info
4495
+ };
4496
+ }
4135
4497
  /**
4136
4498
  * List sessions on this sandbox, optionally filtering by status. Returns
4137
4499
  * `SandboxSession` instances paired with their last-known
@@ -4239,6 +4601,22 @@ var SandboxInstance = class SandboxInstance {
4239
4601
  metadata: m.info.metadata
4240
4602
  }));
4241
4603
  }
4604
+ /** @internal — invoked by SandboxSession.sendMessage(). */
4605
+ async _sessionSendMessage(id, request, options = {}) {
4606
+ return this.runtime.sendSessionMessage(id, request, options);
4607
+ }
4608
+ /** @internal — invoked by SandboxSession.delete(). */
4609
+ async _sessionDelete(id) {
4610
+ return this.runtime.deleteSession(id);
4611
+ }
4612
+ /** @internal — invoked by SandboxTaskSession.changes(). */
4613
+ async _taskSessionChanges(id) {
4614
+ return this.runtime.taskSessionChanges(id);
4615
+ }
4616
+ /** @internal — invoked by SandboxTaskSession.commit(). */
4617
+ async _taskSessionCommit(id, options = {}) {
4618
+ return this.runtime.commitTaskSession(id, options);
4619
+ }
4242
4620
  async _sessionFork(id, opts = {}) {
4243
4621
  await this.ensureRunning();
4244
4622
  const body = {};
@@ -4603,29 +4981,6 @@ function settleTurnDrive(result) {
4603
4981
  result
4604
4982
  };
4605
4983
  }
4606
- function normalizeSessionInfo(raw) {
4607
- const id = raw.id;
4608
- if (typeof id !== "string") return null;
4609
- const status = raw.status || "running";
4610
- return {
4611
- id,
4612
- parentId: typeof raw.parentID === "string" ? raw.parentID : typeof raw.parentId === "string" ? raw.parentId : void 0,
4613
- status: [
4614
- "queued",
4615
- "running",
4616
- "completed",
4617
- "failed",
4618
- "cancelled"
4619
- ].includes(status) ? status : "running",
4620
- backend: typeof raw.backendType === "string" ? raw.backendType : typeof raw.backend === "string" ? raw.backend : void 0,
4621
- model: typeof raw.model === "string" ? raw.model : void 0,
4622
- promptCount: typeof raw.promptCount === "number" ? raw.promptCount : void 0,
4623
- createdAt: raw.createdAt ? new Date(raw.createdAt) : void 0,
4624
- startedAt: raw.startedAt ? new Date(raw.startedAt) : void 0,
4625
- endedAt: raw.endedAt ? new Date(raw.endedAt) : void 0,
4626
- raw
4627
- };
4628
- }
4629
4984
  var DirectRuntimeHttpClient = class {
4630
4985
  baseClient;
4631
4986
  sandboxId;
@@ -4692,4 +5047,4 @@ function quoteForShell(value) {
4692
5047
  return `'${value.replace(/'/g, "'\\''")}'`;
4693
5048
  }
4694
5049
  //#endregion
4695
- export { serializeForSidecar as _, applySandboxEventText as a, normalizeConnection as c, otelTraceIdForTangleTrace as d, toOtelJson as f, normalizeRuntimeBackendConfig as g, parseSSEStream as h, InteractiveSessionHandle as i, buildTraceExportPayload as l, encodeTextForWire as m, normalizeStartupDiagnostics as n, collectAgentResponseText as o, encodePromptForWire as p, SandboxSession as r, getSandboxEventText as s, SandboxInstance as t, exportTraceBundle as u };
5050
+ export { normalizeRuntimeBackendConfig as _, InteractiveSessionHandle as a, getSandboxEventText as c, exportTraceBundle as d, otelTraceIdForTangleTrace as f, parseSSEStream as g, encodeTextForWire as h, SandboxSession as i, normalizeConnection as l, encodePromptForWire as m, normalizeStartupDiagnostics as n, applySandboxEventText as o, toOtelJson as p, SandboxTaskSession as r, collectAgentResponseText as s, SandboxInstance as t, buildTraceExportPayload as u, serializeForSidecar as v };
@@ -1,2 +1,2 @@
1
- import { a as TANGLE_JOBS_CONTRACT, c as AgentSandboxBlueprintAbi, d as SandboxCreateParamTypes, f as SandboxCreateResponseParamTypes, i as TANGLE_CHAIN_ID, l as ITangleJobsAbi, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, p as SandboxIdParamTypes, r as JOB_SANDBOX_DELETE, s as TangleSandboxClientConfig, t as TangleSandboxClient, u as JsonResponseParamTypes } from "../index-CuwpLz65.js";
1
+ import { a as TANGLE_JOBS_CONTRACT, c as AgentSandboxBlueprintAbi, d as SandboxCreateParamTypes, f as SandboxCreateResponseParamTypes, i as TANGLE_CHAIN_ID, l as ITangleJobsAbi, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, p as SandboxIdParamTypes, r as JOB_SANDBOX_DELETE, s as TangleSandboxClientConfig, t as TangleSandboxClient, u as JsonResponseParamTypes } from "../index-DS4SOkKG.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TANGLE_MAINNET_RPC, TangleSandboxClient, TangleSandboxClientConfig };
@@ -1,2 +1,2 @@
1
- import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-sPZOYZkz.js";
1
+ import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-DayyZe-i.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TANGLE_MAINNET_RPC, TangleSandboxClient };
@@ -1,4 +1,4 @@
1
- import { t as SandboxInstance } from "./sandbox-BZ33qVxk.js";
1
+ import { t as SandboxInstance } from "./sandbox-CeimsfC8.js";
2
2
  import { p as parseErrorResponse } from "./errors-DSz87Rkk.js";
3
3
  //#region src/tangle/abi.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "0.9.4-develop.20260710200846.ca3d375",
3
+ "version": "0.9.4-develop.20260711011249.9d3b3b3",
4
4
  "description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",