@tangle-network/agent-provider-tangle 5.0.12 → 5.0.13
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.
|
@@ -36,5 +36,5 @@ export declare function assertMappedSecretNames(options: {
|
|
|
36
36
|
env?: Record<string, string>;
|
|
37
37
|
}): void;
|
|
38
38
|
export declare function assertCreateInputShape(input: CreateAgentEnvironmentInput, parsedWorkspace?: WorkspaceRequest): WorkspaceRequest | undefined;
|
|
39
|
-
export declare function assertMappedCreateOptions(options: TangleCreateSandboxOptions): void;
|
|
39
|
+
export declare function assertMappedCreateOptions(options: TangleCreateSandboxOptions, input?: CreateAgentEnvironmentInput): void;
|
|
40
40
|
export {};
|
|
@@ -5,7 +5,7 @@ import { assertBoundedJson, boundedIdentifier, boundedString, MAX_ARRAY_LENGTH,
|
|
|
5
5
|
import { profileCredentialSource } from "./model-credential-source.js";
|
|
6
6
|
import { sandboxResourcesFromResourceRequest } from "./tangle-resources.js";
|
|
7
7
|
import { tangleRuntimeAttachments } from "./tangle-runtime-attachments.js";
|
|
8
|
-
import { deepFreeze } from "@tangle-network/agent-interface";
|
|
8
|
+
import { canonicalCandidateDigest, deepFreeze } from "@tangle-network/agent-interface";
|
|
9
9
|
import { assertProxySecretAliases, captureProxySecrets, mergeProxySecrets, proxySecretsFromInput, sandboxSecretBindingIdentity } from "./tangle-proxy-secrets.js";
|
|
10
10
|
/** Immutable create evidence used to bind a later native resume to its restored snapshot. */
|
|
11
11
|
export const NATIVE_RESUME_CHECKPOINT_METADATA_KEY = "tangleNativeResumeCheckpointId";
|
|
@@ -175,10 +175,6 @@ export function sandboxOptionsFromCreateInput(input, defaultBackend, parsedWorks
|
|
|
175
175
|
const idleTimeoutSeconds = wholeSecondsOf(input.idleTimeoutMs, "idleTimeoutMs");
|
|
176
176
|
const deleteAfterStoppedSeconds = wholeSecondsOf(input.deleteAfterStoppedMs, "deleteAfterStoppedMs");
|
|
177
177
|
const retain = input.retain;
|
|
178
|
-
if (retain !== undefined && (!retain || typeof retain !== "object" ||
|
|
179
|
-
Object.keys(retain).some(key => key !== "paths") || !Array.isArray(retain.paths) ||
|
|
180
|
-
retain.paths.length > MAX_ARRAY_LENGTH || retain.paths.some(path => typeof path !== "string" || !path || path.length > 4096 || path.includes("\0"))))
|
|
181
|
-
throw new Error("Tangle retain must contain bounded paths");
|
|
182
178
|
const resources = sandboxResourcesFromResourceRequest(input.resources);
|
|
183
179
|
// Sandbox injects secrets by name from its own store. Accepting a name/value
|
|
184
180
|
// record and dropping it would create an environment with no credentials and
|
|
@@ -352,17 +348,26 @@ export function assertCreateInputShape(input, parsedWorkspace) {
|
|
|
352
348
|
if (resourceKeys.size > 0)
|
|
353
349
|
throw new Error("Tangle resources contain unsupported fields");
|
|
354
350
|
}
|
|
351
|
+
const retain = input.retain;
|
|
352
|
+
if (retain !== undefined && (!retain || typeof retain !== "object" ||
|
|
353
|
+
Object.keys(retain).some(key => key !== "paths") || !Array.isArray(retain.paths) ||
|
|
354
|
+
retain.paths.length > MAX_ARRAY_LENGTH || retain.paths.some(path => typeof path !== "string" || !path || path.length > 4096 || path.includes("\0"))))
|
|
355
|
+
throw new Error("Tangle retain must contain bounded paths");
|
|
355
356
|
if (input.workspace === undefined)
|
|
356
357
|
return undefined;
|
|
357
358
|
const workspace = parsedWorkspace ?? WorkspaceRequestSchema.parse(input.workspace);
|
|
358
359
|
workspaceCwdPathForBase(workspace.cwd, "repository", "Tangle");
|
|
359
360
|
return workspace;
|
|
360
361
|
}
|
|
361
|
-
export function assertMappedCreateOptions(options) {
|
|
362
|
+
export function assertMappedCreateOptions(options, input) {
|
|
362
363
|
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
|
363
364
|
throw new Error("Tangle mapped create options must be an object");
|
|
364
365
|
}
|
|
365
366
|
assertBoundedJson(options, "Tangle mapped create options", PROFILE_AT_BACKEND_PROFILE);
|
|
367
|
+
if (input?.deleteAfterStoppedMs !== undefined && options.deleteAfterStoppedSeconds !== wholeSecondsOf(input.deleteAfterStoppedMs, "deleteAfterStoppedMs"))
|
|
368
|
+
throw new Error("Tangle mapped create options must preserve requested deleteAfterStoppedMs");
|
|
369
|
+
if (input?.retain !== undefined && canonicalCandidateDigest(options.retain ?? null) !== canonicalCandidateDigest(input.retain))
|
|
370
|
+
throw new Error("Tangle mapped create options must preserve requested retain");
|
|
366
371
|
if (options.backend?.model?.cliAuth !== undefined) {
|
|
367
372
|
if (options.backend.type === undefined) {
|
|
368
373
|
throw new Error("Tangle mapped native credentials require the selected backend type");
|
package/dist/tangle-provider.js
CHANGED
|
@@ -155,7 +155,7 @@ export function createTangleProvider(options) {
|
|
|
155
155
|
}
|
|
156
156
|
if (requestedReason !== undefined && canonicalCandidateDigest(mappedOptions.metadata?.reason ?? null) !== canonicalCandidateDigest(requestedReason))
|
|
157
157
|
throw new Error("Tangle mapped raw consent must preserve its named reason");
|
|
158
|
-
assertMappedCreateOptions(mappedOptions);
|
|
158
|
+
assertMappedCreateOptions(mappedOptions, input);
|
|
159
159
|
const mappedRouting = mappedOptions.backend?.model?.routing;
|
|
160
160
|
if (canonicalCandidateDigest(mappedRouting ?? null) !== canonicalCandidateDigest(requestedRouting ?? null)) {
|
|
161
161
|
throw new Error("Tangle mapped create options must carry exactly the requested providerOptions.routing");
|