@tangle-network/sandbox 0.10.5-develop.20260715160027.ce8a7df → 0.10.5-develop.20260715163306.7ca6a55

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.
@@ -1,6 +1,6 @@
1
+ import { i as SANDBOX_PROXY_REQUEST_MAX_BYTES } from "./runtime-api-DDOueAzd.js";
1
2
  import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, o as PartialFailureError, p as parseErrorResponse, t as AuthError } from "./errors-wd266B9Q.js";
2
- import { d as exportTraceBundle, g as parseSSEStream, h as encodeTextForWire, l as normalizeConnection, m as encodePromptForWire, n as normalizeStartupDiagnostics, t as SandboxInstance } from "./sandbox-KiKLRbR_.js";
3
- import { FILE_DECODED_WRITE_MAX_BYTES, SANDBOX_PROXY_REQUEST_MAX_BYTES } from "@tangle-network/runtime-contracts";
3
+ import { d as exportTraceBundle, g as parseSSEStream, h as encodeTextForWire, l as normalizeConnection, m as encodePromptForWire, n as normalizeStartupDiagnostics, t as SandboxInstance } from "./sandbox-C8qQicxF.js";
4
4
  //#region src/resources.ts
5
5
  /**
6
6
  * Compute tiers, ordered smallest → largest. Defined HERE (not imported from
@@ -969,7 +969,7 @@ const PROFILE_BIN_DIR_RE = /(^|\/)(s?bin)\//;
969
969
  */
970
970
  const PROFILE_FILE_WRITE_WIRE_BUDGET_BYTES = SANDBOX_PROXY_REQUEST_MAX_BYTES - 8 * 1024;
971
971
  function fitsSingleShotWrite(content, contentBytes) {
972
- if (contentBytes > FILE_DECODED_WRITE_MAX_BYTES) return false;
972
+ if (contentBytes > 5242880) return false;
973
973
  if (contentBytes * 6 <= PROFILE_FILE_WRITE_WIRE_BUDGET_BYTES) return true;
974
974
  return new TextEncoder().encode(JSON.stringify(content)).byteLength <= PROFILE_FILE_WRITE_WIRE_BUDGET_BYTES;
975
975
  }
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
2
- import { t as SandboxInstance } from "./sandbox-KiKLRbR_.js";
3
- import { n as SandboxClient } from "./client-_OBj4sNO.js";
2
+ import { t as SandboxInstance } from "./sandbox-C8qQicxF.js";
3
+ import { n as SandboxClient } from "./client-0Zp62AKL.js";
4
4
  export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxClient as Sandbox, SandboxClient, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { a as serializeForSidecar, i as normalizeRuntimeBackendConfig } from "./runtime-api-BWq4XSrb.js";
1
+ import { o as normalizeRuntimeBackendConfig, s as serializeForSidecar } from "./runtime-api-DDOueAzd.js";
2
2
  import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
3
- import { a as InteractiveSessionHandle, c as getSandboxEventText, d as exportTraceBundle, f as otelTraceIdForTangleTrace, g as parseSSEStream, i as SandboxSession, o as applySandboxEventText, p as toOtelJson, r as SandboxTaskSession, s as collectAgentResponseText, t as SandboxInstance, u as buildTraceExportPayload } from "./sandbox-KiKLRbR_.js";
4
- import { a as validateDeferredProfileFileMounts, c as DEFAULT_SANDBOX_SIZE, d as resolveSandboxResources, f as sandboxResourcesForSize, i as splitInlineProfileFileMounts, l as SANDBOX_SIZE_PRESETS, n as SandboxClient, o as SandboxFleet, r as materializeProfileFileMounts, s as SandboxFleetClient, t as IntelligenceClient, u as SANDBOX_SIZE_PRESET_NAMES } from "./client-_OBj4sNO.js";
3
+ import { a as InteractiveSessionHandle, c as getSandboxEventText, d as exportTraceBundle, f as otelTraceIdForTangleTrace, g as parseSSEStream, i as SandboxSession, o as applySandboxEventText, p as toOtelJson, r as SandboxTaskSession, s as collectAgentResponseText, t as SandboxInstance, u as buildTraceExportPayload } from "./sandbox-C8qQicxF.js";
4
+ import { a as validateDeferredProfileFileMounts, c as DEFAULT_SANDBOX_SIZE, d as resolveSandboxResources, f as sandboxResourcesForSize, i as splitInlineProfileFileMounts, l as SANDBOX_SIZE_PRESETS, n as SandboxClient, o as SandboxFleet, r as materializeProfileFileMounts, s as SandboxFleetClient, t as IntelligenceClient, u as SANDBOX_SIZE_PRESET_NAMES } from "./client-0Zp62AKL.js";
5
5
  import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-CcZE2xMl.js";
6
- import { t as TangleSandboxClient } from "./tangle-Os9sH-ms.js";
6
+ import { t as TangleSandboxClient } from "./tangle-Bx0V6Nt5.js";
7
7
  import { defineAgentProfile, defineGitHubResource, defineInlineResource, mergeAgentProfiles } from "@tangle-network/agent-interface";
8
8
  //#region src/confidential.ts
9
9
  function generateAttestationNonce(bytes = 32) {
@@ -1,5 +1,4 @@
1
1
  import { c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, p as parseErrorResponse, s as QuotaError } from "./errors-wd266B9Q.js";
2
- import { FILE_UPLOAD_SESSION_MAX_BYTES, isFileTooLargeErrorBody, isPayloadTooLargeErrorBody } from "@tangle-network/runtime-contracts";
3
2
  //#region src/backend-config.ts
4
3
  const LEGACY_QUESTION_ALIAS_KEY = ["question", "Channel"].join("");
5
4
  function parseModelString(model) {
@@ -154,6 +153,63 @@ function serializeForSidecar(profile) {
154
153
  return toBackendProfile(profile);
155
154
  }
156
155
  //#endregion
156
+ //#region ../../../packages/runtime-contracts/dist/file-limits.js
157
+ const MEBIBYTE$1 = 1024 * 1024;
158
+ 10 * MEBIBYTE$1;
159
+ const FILE_DECODED_WRITE_MAX_BYTES = 5 * MEBIBYTE$1;
160
+ 5 * MEBIBYTE$1;
161
+ 10 * MEBIBYTE$1;
162
+ 5 * MEBIBYTE$1;
163
+ //#endregion
164
+ //#region ../../../packages/runtime-contracts/dist/request-limits.js
165
+ /**
166
+ * Raw WIRE/TRANSPORT caps: request-byte limits checked while the body
167
+ * streams in (bodyLimit middleware, Content-Length, encoded proxy bodies),
168
+ * before anything is parsed or decoded. Rejections against these carry
169
+ * code `PAYLOAD_TOO_LARGE` (`payload-too-large.ts`) — the remedy is to
170
+ * split the delivery. Decoded/parsed-content caps (code `FILE_TOO_LARGE`)
171
+ * live in `file-io.ts`.
172
+ */
173
+ const MEBIBYTE = 1024 * 1024;
174
+ /**
175
+ * Gateway (CF Worker) proxy cap on any request body it forwards — both
176
+ * pass-through requests and route-constructed (`options.body`) proxy
177
+ * payloads. Workers buffer forwarded bodies (streaming upstream stalls),
178
+ * so this bounds Worker memory per request.
179
+ */
180
+ const SANDBOX_PROXY_REQUEST_MAX_BYTES = MEBIBYTE;
181
+ 32 * MEBIBYTE;
182
+ /**
183
+ * Max assembled size of one chunked-upload session — the ceiling of the
184
+ * sanctioned >1 MiB delivery path. Parts stage in sidecar memory until
185
+ * commit, so this bounds per-session memory, not the destination
186
+ * filesystem.
187
+ */
188
+ const FILE_UPLOAD_SESSION_MAX_BYTES = 64 * MEBIBYTE;
189
+ 128 * MEBIBYTE;
190
+ //#endregion
191
+ //#region ../../../packages/runtime-contracts/dist/size-limit-errors.js
192
+ /** Canonical error codes for wire-size and decoded-content rejections. */
193
+ const PAYLOAD_TOO_LARGE_CODE = "PAYLOAD_TOO_LARGE";
194
+ const FILE_TOO_LARGE_CODE = "FILE_TOO_LARGE";
195
+ function isRecord(value) {
196
+ return value !== null && typeof value === "object" && !Array.isArray(value);
197
+ }
198
+ function isPositiveInteger(value) {
199
+ return typeof value === "number" && Number.isInteger(value) && value > 0;
200
+ }
201
+ function isSizeLimitErrorBodyFor(value, code) {
202
+ if (!isRecord(value) || value.success !== false || !isRecord(value.error)) return false;
203
+ const error = value.error;
204
+ return error.code === code && typeof error.message === "string" && typeof error.surface === "string" && isPositiveInteger(error.limitBytes) && (error.actualBytes === void 0 || isPositiveInteger(error.actualBytes));
205
+ }
206
+ function isPayloadTooLargeErrorBody(value) {
207
+ return isSizeLimitErrorBodyFor(value, PAYLOAD_TOO_LARGE_CODE);
208
+ }
209
+ function isFileTooLargeErrorBody(value) {
210
+ return isSizeLimitErrorBodyFor(value, FILE_TOO_LARGE_CODE);
211
+ }
212
+ //#endregion
157
213
  //#region src/lib/chunked-upload.ts
158
214
  /**
159
215
  * Chunked upload — the sanctioned SDK path for delivering payloads larger
@@ -364,7 +420,7 @@ async function abortSession(transport, uploadId) {
364
420
  */
365
421
  async function uploadChunked(transport, remotePath, data, options = {}) {
366
422
  const estimatedSize = sizeOfInput(data);
367
- if (estimatedSize > FILE_UPLOAD_SESSION_MAX_BYTES) throw new SandboxError(`Payload for ${remotePath} is ${estimatedSize} bytes, over the ${FILE_UPLOAD_SESSION_MAX_BYTES} byte chunked-upload session cap`, "PAYLOAD_TOO_LARGE", 413);
423
+ if (estimatedSize > 67108864) throw new SandboxError(`Payload for ${remotePath} is ${estimatedSize} bytes, over the ${FILE_UPLOAD_SESSION_MAX_BYTES} byte chunked-upload session cap`, "PAYLOAD_TOO_LARGE", 413);
368
424
  options.signal?.throwIfAborted();
369
425
  const bytes = await normalizeToBytes(data);
370
426
  options.signal?.throwIfAborted();
@@ -697,4 +753,4 @@ function normalizeSessionInfo(raw) {
697
753
  };
698
754
  }
699
755
  //#endregion
700
- export { serializeForSidecar as a, normalizeRuntimeBackendConfig as i, normalizeSessionInfo as n, uploadChunked as r, SandboxRuntimeApi as t };
756
+ export { FILE_DECODED_WRITE_MAX_BYTES as a, SANDBOX_PROXY_REQUEST_MAX_BYTES as i, normalizeSessionInfo as n, normalizeRuntimeBackendConfig as o, uploadChunked as r, serializeForSidecar as s, SandboxRuntimeApi as t };
package/dist/runtime.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as uploadChunked, t as SandboxRuntimeApi } from "./runtime-api-BWq4XSrb.js";
1
+ import { r as uploadChunked, t as SandboxRuntimeApi } from "./runtime-api-DDOueAzd.js";
2
2
  import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
3
3
  //#region src/runtime-client.ts
4
4
  const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
@@ -1,4 +1,4 @@
1
- import { i as normalizeRuntimeBackendConfig, n as normalizeSessionInfo, r as uploadChunked, t as SandboxRuntimeApi } from "./runtime-api-BWq4XSrb.js";
1
+ import { n as normalizeSessionInfo, o as normalizeRuntimeBackendConfig, r as uploadChunked, t as SandboxRuntimeApi } from "./runtime-api-DDOueAzd.js";
2
2
  import { c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, p as parseErrorResponse, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
3
3
  import { addTokenUsage, readTokenCostUsd, readTokenUsage } from "@tangle-network/agent-core";
4
4
  //#region src/lib/sse-parser.ts
@@ -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-Os9sH-ms.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-Bx0V6Nt5.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,5 +1,5 @@
1
1
  import { p as parseErrorResponse } from "./errors-wd266B9Q.js";
2
- import { t as SandboxInstance } from "./sandbox-KiKLRbR_.js";
2
+ import { t as SandboxInstance } from "./sandbox-C8qQicxF.js";
3
3
  //#region src/tangle/abi.ts
4
4
  /**
5
5
  * Tangle Contract ABI Definitions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "0.10.5-develop.20260715160027.ce8a7df",
3
+ "version": "0.10.5-develop.20260715163306.7ca6a55",
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",
@@ -88,8 +88,7 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@tangle-network/agent-core": "^0.4.0",
91
- "@tangle-network/agent-interface": "^0.21.0",
92
- "@tangle-network/runtime-contracts": "0.1.0"
91
+ "@tangle-network/agent-interface": "^0.21.0"
93
92
  },
94
93
  "peerDependencies": {
95
94
  "@mastra/core": "^1.36.0",
@@ -125,7 +124,8 @@
125
124
  "typescript": "^6.0.3",
126
125
  "vitest": "^4.1.5",
127
126
  "ws": "^8.20.0",
128
- "yjs": "13.6.30"
127
+ "yjs": "13.6.30",
128
+ "@tangle-network/runtime-contracts": "0.1.0"
129
129
  },
130
130
  "scripts": {
131
131
  "build": "tsdown",