@tangle-network/agent-provider-tangle 5.0.3 → 5.0.4

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.
@@ -5,7 +5,7 @@ import { assertCliAuthReferenceSupported, cliAuthReferenceSchema, } from "@tangl
5
5
  import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, boundedEventContentRecordSchema, AgentExactRunControlRefSchema, AgentTurnInputSchema, ContextTransferReceiptSchema, ProxySecretReceiptSchema, deepFreeze, isProxySecretScopeAttenuation, proxySecretPresentationsEqual, contextTransferResultMatchesRequest, } from "@tangle-network/agent-interface";
6
6
  import { tokenUsageFromData } from "./tangle-result-values.js";
7
7
  import { TangleCredentialCapacityError } from "./model-credential-capacity.js";
8
- import { assertBoundedJson, awaitWithSignal, boundedString, PROFILE_AT_PROFILE, } from "./tangle-contract-safety.js";
8
+ import { assertBoundedJson, awaitWithSignal, boundedString, MAX_INLINE_PAYLOAD_BYTES, PROFILE_AT_PROFILE, } from "./tangle-contract-safety.js";
9
9
  import { profileCredentialSource } from "./model-credential-source.js";
10
10
  import { tangleRuntimeAttachments } from "./tangle-runtime-attachments.js";
11
11
  import { sessionPromptSessionId } from "./tangle-session-control.js";
@@ -118,6 +118,9 @@ export async function preparePromptOptions(box, options, provider, bindings) {
118
118
  const sessionId = options.sessionId ?? sessionPromptSessionId(provider, box.id, options.turnId ?? options.executionId) ?? randomUUID();
119
119
  const backend = isolated ? { ...options.backend, metadata: { ...options.backend?.metadata, profileSecretIsolation: true } } : options.backend ?? {};
120
120
  const { runtimeSecrets: _turnOnly, ...persisted } = backend;
121
+ // createSession posts the whole backend unprimed, so a native turn whose profile exceeds the gateway bound cannot be prepared: it launches unprepared, and the SDK stages the profile's files like create-time mounts.
122
+ if (!isolated && new TextEncoder().encode(JSON.stringify(persisted)).length > MAX_INLINE_PAYLOAD_BYTES)
123
+ return options;
121
124
  const created = await awaitWithSignal(box.createSession({ sessionId, retention: "workspace", backend: persisted }), options.signal);
122
125
  if (created.session.id !== sessionId || created.info.id !== sessionId)
123
126
  throw new Error("Tangle profile preparation changed its exact session identity");
@@ -270,9 +273,8 @@ function sandboxPromptBackendModel(value) {
270
273
  model.maxThinkingTokens = present.maxThinkingTokens;
271
274
  }
272
275
  if (present.mode !== undefined) {
273
- if (present.mode !== "api" && present.mode !== "cli") {
276
+ if (present.mode !== "api" && present.mode !== "cli")
274
277
  throw new Error('Tangle prompt backend model mode must be "api" or "cli"');
275
- }
276
278
  model.mode = present.mode;
277
279
  }
278
280
  if (present.authMode !== undefined) {
@@ -301,9 +303,8 @@ function sandboxPromptBackendServer(value) {
301
303
  server.port = present.port;
302
304
  }
303
305
  if (present.hostname !== undefined) {
304
- if (typeof present.hostname !== "string" || present.hostname === "") {
306
+ if (typeof present.hostname !== "string" || present.hostname === "")
305
307
  throw new Error("Tangle prompt backend server hostname must be a non-empty string");
306
- }
307
308
  server.hostname = boundedString(present.hostname, "Tangle prompt backend server hostname");
308
309
  }
309
310
  return server;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-provider-tangle",
3
- "version": "5.0.3",
3
+ "version": "5.0.4",
4
4
  "description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  }
45
45
  },
46
46
  "devDependencies": {
47
- "@tangle-network/agent-provider-testkit": "0.12.2",
47
+ "@tangle-network/agent-provider-testkit": "0.12.3",
48
48
  "@tangle-network/agent-runtime": "0.349.0",
49
49
  "@tangle-network/sandbox": "1.0.141",
50
50
  "@types/node": "26.6.5",