@tangle-network/sandbox 0.55.1 → 0.55.2

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.
@@ -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>;
@@ -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
  };
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.2",
4
4
  "description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -138,8 +138,8 @@
138
138
  "ws": "^8.20.0",
139
139
  "yjs": "13.6.30",
140
140
  "@repo/shared": "0.0.0",
141
- "@tangle-network/cli-agent-registry": "0.4.10",
142
141
  "@tangle-network/agent-profile-materialize": "0.20.3",
142
+ "@tangle-network/cli-agent-registry": "0.4.10",
143
143
  "@tangle-network/sse-core": "0.0.0",
144
144
  "@tangle-network/runtime-contracts": "0.8.2"
145
145
  },