@tangle-network/sandbox 0.55.1 → 0.55.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.
package/README.md CHANGED
@@ -566,6 +566,11 @@ try {
566
566
 
567
567
  Fleet policies are checked before provisioning and do not replace account quotas.
568
568
 
569
+ Agent fleets retain the default harness, model, and profile in each agent's specification.
570
+ Per-agent declarations override those defaults.
571
+ Fetched fleets preserve these settings when they run agent turns.
572
+ Model API keys and authentication files stay outside fleet metadata.
573
+
569
574
  ## Batch jobs
570
575
 
571
576
  Use `runBatch()` for parallel tasks that do not need stable fleet membership.
@@ -340,6 +340,7 @@ declare const FLEET_TOOL_SPECS: {
340
340
  }>;
341
341
  agents_per_sandbox?: number;
342
342
  model?: string;
343
+ max_total_output_tokens?: number;
343
344
  max_spend_usd: number;
344
345
  timeout_ms?: number;
345
346
  }, unknown>;
@@ -1,6 +1,6 @@
1
1
  import { x as assertCurrentBackendType } from "../runtime-api-DoZsOiOR.js";
2
2
  import { c as NotFoundError, g as ValidationError, m as StateError } from "../errors-CmYPVl-k.js";
3
- import { n as Sandbox } from "../client-Bd8nskJA.js";
3
+ import { n as Sandbox } from "../client-B6Jo-v5w.js";
4
4
  import { t as SandboxInstance } from "../sandbox-DzSE1u7d.js";
5
5
  import { createRequire } from "node:module";
6
6
  import { z } from "zod";
@@ -613,6 +613,11 @@ const FLEET_TOOL_SPECS = {
613
613
  type: "string",
614
614
  description: "Model for agents that name none, e.g. gpt-4.1-mini."
615
615
  },
616
+ max_total_output_tokens: {
617
+ type: "integer",
618
+ minimum: 1,
619
+ description: "Per-completion visible and reasoning output cap for warm OpenCode text turns through the platform-managed Router. CLI-only, attachment, and interaction fallbacks reject this cap, as do saved profiles and other harnesses."
620
+ },
616
621
  max_spend_usd: {
617
622
  type: "number",
618
623
  description: "Budget for the fleet in USD, enforced by the Platform."
@@ -626,19 +631,24 @@ const FLEET_TOOL_SPECS = {
626
631
  additionalProperties: false
627
632
  },
628
633
  makeHandler: ({ client, parent }) => async (args) => {
634
+ const outputCap = args.max_total_output_tokens;
635
+ if (outputCap !== void 0 && (!Number.isSafeInteger(outputCap) || outputCap <= 0)) throw new Error("max_total_output_tokens must be a positive safe integer");
636
+ if (outputCap !== void 0 && args.agent_specs?.some((spec) => spec.profile_id !== void 0)) throw new Error("max_total_output_tokens cannot overlay a saved profile_id");
637
+ if (outputCap !== void 0 && args.agent_specs?.some((spec) => spec.harness !== void 0 && spec.harness !== "opencode")) throw new Error("max_total_output_tokens requires the opencode harness through the platform-managed Router");
629
638
  const agents = args.agent_specs ? args.agent_specs.map((spec) => ({
630
639
  ...spec.agent_id ? { agentId: spec.agent_id } : {},
631
- ...spec.harness ? { harness: spec.harness } : {},
640
+ ...outputCap !== void 0 ? { harness: "opencode" } : spec.harness ? { harness: spec.harness } : {},
632
641
  ...spec.model ? { model: spec.model } : {},
633
- ...spec.profile_id ? { profile: { profileId: spec.profile_id } } : {},
642
+ ...outputCap !== void 0 ? { profile: { model: { maxTotalOutputTokens: outputCap } } } : spec.profile_id ? { profile: { profileId: spec.profile_id } } : {},
634
643
  ...spec.task ? { task: spec.task } : {}
635
644
  })) : args.agents ?? 0;
636
645
  const fleet = await client.fleets.create({
637
646
  agents,
638
647
  placement: args.agents_per_sandbox ? { agentsPerSandbox: args.agents_per_sandbox } : "auto",
639
- defaults: args.model ? { backend: {
648
+ defaults: args.model || outputCap !== void 0 ? { backend: {
640
649
  type: "opencode",
641
- model: { model: args.model }
650
+ ...args.model ? { model: { model: args.model } } : {},
651
+ ...outputCap !== void 0 && !args.agent_specs ? { profile: { model: { maxTotalOutputTokens: outputCap } } } : {}
642
652
  } } : {},
643
653
  budgetUsd: args.max_spend_usd,
644
654
  ...parent ? { parent } : {}
@@ -655,6 +665,7 @@ const FLEET_TOOL_SPECS = {
655
665
  status: result.status,
656
666
  response: result.result?.response,
657
667
  error: result.error,
668
+ ...result.result?.traceId ? { traceId: result.result.traceId } : {},
658
669
  costUsd: result.costUsd
659
670
  }))
660
671
  };
@@ -2339,12 +2339,11 @@ var SandboxFleetClient = class {
2339
2339
  if (!saved.has(key)) saved.set(key, this.savedProfile(profileRef));
2340
2340
  profile = await saved.get(key);
2341
2341
  } else profile = agent.profile;
2342
- const own = agent.harness !== void 0 || agent.model !== void 0 || agent.profile !== void 0 || agent.runtimeAttachments !== void 0;
2343
- const harness = agent.harness ?? profile?.harness ?? (own ? fallback?.type : void 0);
2342
+ const harness = agent.harness ?? profile?.harness ?? fallback?.type;
2344
2343
  const requested = typeof agent.model === "string" ? { model: agent.model } : agent.model && withoutModelSecrets(agent.model, agent.agentId);
2345
2344
  const profileModel = profile?.model?.default;
2346
- const model = requested ?? (profileModel ? { model: profileModel } : void 0) ?? (own && fallback?.model ? withoutModelSecrets(fallback.model) : void 0);
2347
- profile ??= own ? fallback?.profile : void 0;
2345
+ const model = requested ?? (profileModel ? { model: profileModel } : void 0) ?? (fallback?.model ? withoutModelSecrets(fallback.model) : void 0);
2346
+ profile ??= fallback?.profile;
2348
2347
  agentSpecs.set(agent.agentId, {
2349
2348
  ...harness ? { harness } : {},
2350
2349
  ...model ? { model } : {},
package/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as FileWriteConflictError, c as NotFoundError, f as SandboxError, g as ValidationError, h as TimeoutError, l as PartialFailureError, m as StateError, n as CapabilityError, p as ServerError, s as NetworkError, t as AuthError, u as QuotaError } from "./errors-CmYPVl-k.js";
2
- import { _ as backendRegistryInteractionKindSchema, b as parseBackendRegistryResponse, c as InstanceRestartingError, g as backendRegistryEntrySchema, h as backendRegistryCapabilitiesSchema, l as InstancesClient, n as Sandbox, s as HostedInstance, v as backendRegistryResponseSchema, x as parseBackendRegistryResponseBody, y as isBackendRegistryInteractionKind } from "./client-Bd8nskJA.js";
2
+ import { _ as backendRegistryInteractionKindSchema, b as parseBackendRegistryResponse, c as InstanceRestartingError, g as backendRegistryEntrySchema, h as backendRegistryCapabilitiesSchema, l as InstancesClient, n as Sandbox, s as HostedInstance, v as backendRegistryResponseSchema, x as parseBackendRegistryResponseBody, y as isBackendRegistryInteractionKind } from "./client-B6Jo-v5w.js";
3
3
  import { A as lineInstanceKey, O as LinesClient, a as WorkspaceImages, t as SandboxInstance } from "./sandbox-DzSE1u7d.js";
4
4
  //#region src/core.ts
5
5
  /** Local SDK protocol support only, not a deployed-host readiness assertion.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { C as normalizeRuntimeBackendConfig, D as ALL_BACKEND_TYPES, E as deriveAgentRunOutcome, O as backendTypeSchema, T as deriveAgentResultOutcome, k as parseBackendType, w as createAgentRunOutcomeTracker, y as parseSSEStream } from "./runtime-api-DoZsOiOR.js";
2
2
  import { a as FileWriteConflictError, c as NotFoundError, d as ResumeEnvRequiredError, f as SandboxError, g as ValidationError, h as TimeoutError, i as EgressProxyRecoveryError, l as PartialFailureError, m as StateError, n as CapabilityError, o as KeyBudgetExhaustedError, p as ServerError, r as EdgeNotReadyError, s as NetworkError, t as AuthError, u as QuotaError } from "./errors-CmYPVl-k.js";
3
- import { _ as backendRegistryInteractionKindSchema, a as splitInlineProfileSkills, b as parseBackendRegistryResponse, c as InstanceRestartingError, d as SandboxFleetClient, f as runtimeWorkspaceCwdSchema, g as backendRegistryEntrySchema, h as backendRegistryCapabilitiesSchema, i as splitInlineProfileFileMounts, l as InstancesClient, m as validateBatchRunRequest, n as Sandbox, o as validateDeferredProfileFileMounts, p as createBatchResultAccumulator, r as materializeProfileFileMounts, s as HostedInstance, t as IntelligenceClient, u as SandboxFleet, v as backendRegistryResponseSchema, x as parseBackendRegistryResponseBody, y as isBackendRegistryInteractionKind } from "./client-Bd8nskJA.js";
3
+ import { _ as backendRegistryInteractionKindSchema, a as splitInlineProfileSkills, b as parseBackendRegistryResponse, c as InstanceRestartingError, d as SandboxFleetClient, f as runtimeWorkspaceCwdSchema, g as backendRegistryEntrySchema, h as backendRegistryCapabilitiesSchema, i as splitInlineProfileFileMounts, l as InstancesClient, m as validateBatchRunRequest, n as Sandbox, o as validateDeferredProfileFileMounts, p as createBatchResultAccumulator, r as materializeProfileFileMounts, s as HostedInstance, t as IntelligenceClient, u as SandboxFleet, v as backendRegistryResponseSchema, x as parseBackendRegistryResponseBody, y as isBackendRegistryInteractionKind } from "./client-B6Jo-v5w.js";
4
4
  import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, c as createInteractiveControlHolderId, l as interactiveSessionIdentityDigest, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-Dv0gbFMu.js";
5
5
  import { A as lineInstanceKey, C as collectAgentResponseText, F as toOtelJson, M as buildTraceExportPayload, N as exportTraceBundle, O as LinesClient, P as otelTraceIdForTangleTrace, S as collectAgentFinalMessageText, T as isToolBearingEvent, _ as TerminalStream, a as WorkspaceImages, c as SandboxTaskSession, d as agentInteractiveSessionPromptRequestDigest, f as InteractiveTerminalFrameLog, g as InteractiveSessionController, h as BrowserInteractiveSessionController, k as SandboxLines, l as SandboxSession, m as createInteractiveTerminalSession, o as GPU_LEASE_PROVIDER_NAMES, p as createInteractiveTerminalCapture, s as MAX_EGRESS_DENIALS_LIMIT, t as SandboxInstance, u as InteractiveSessionHandle, v as TerminalStreamError, w as getSandboxEventText, x as applySandboxEventText, y as TERMINAL_WS_ECHO_SUBPROTOCOL } from "./sandbox-DzSE1u7d.js";
6
6
  import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-DLPFc9-W.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "0.55.1",
3
+ "version": "0.55.3",
4
4
  "description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -137,11 +137,11 @@
137
137
  "vitest": "^4.1.5",
138
138
  "ws": "^8.20.0",
139
139
  "yjs": "13.6.30",
140
- "@repo/shared": "0.0.0",
141
- "@tangle-network/cli-agent-registry": "0.4.10",
142
140
  "@tangle-network/agent-profile-materialize": "0.20.3",
141
+ "@tangle-network/runtime-contracts": "0.8.2",
143
142
  "@tangle-network/sse-core": "0.0.0",
144
- "@tangle-network/runtime-contracts": "0.8.2"
143
+ "@tangle-network/cli-agent-registry": "0.4.10",
144
+ "@repo/shared": "0.0.0"
145
145
  },
146
146
  "scripts": {
147
147
  "build": "node scripts/build-dist.mjs",