@tangle-network/agent-provider-tangle 5.0.8 → 5.0.9

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.
@@ -66,7 +66,7 @@ export function createCommandModelCredentialResolver(options) {
66
66
  return (input) => {
67
67
  if (typeof input.profile === "string")
68
68
  throw new Error("Tangle credential command requires an inline profile");
69
- if (profileCredentialSource(input.profile) === "managed")
69
+ if (profileCredentialSource(input.profile) === "router")
70
70
  return undefined;
71
71
  if (typeof input.idempotencyKey !== "string" || input.idempotencyKey.length === 0) {
72
72
  throw new Error("Tangle credential command requires a stable create idempotencyKey");
@@ -74,7 +74,7 @@ export function createHttpModelCredentialResolver(options) {
74
74
  return async (input) => {
75
75
  if (typeof input.profile === "string")
76
76
  throw new Error("Tangle credential broker requires an inline profile");
77
- if (profileCredentialSource(input.profile) === "managed")
77
+ if (profileCredentialSource(input.profile) === "router")
78
78
  return undefined;
79
79
  input.signal?.throwIfAborted();
80
80
  const { signal, ...data } = input;
@@ -1,4 +1,5 @@
1
1
  import type { AgentProfile } from "@tangle-network/agent-interface";
2
- export type ProfileCredentialSource = "managed" | "subscription";
2
+ /** The credential intent a profile can declare. `managed` is the deprecated spelling of `router`. */
3
+ export type ProfileCredentialSource = "router" | "api-key" | "subscription";
3
4
  /** Authored profile intent is independent of the harness, vendor, and available accounts. */
4
5
  export declare function profileCredentialSource(profile: AgentProfile): ProfileCredentialSource;
@@ -12,9 +12,11 @@ export function profileCredentialSource(profile) {
12
12
  throw new Error("Tangle profile model metadata must be an object");
13
13
  }
14
14
  const source = metadata?.credentialSource;
15
- if (source === undefined || source === "managed")
16
- return "managed";
15
+ if (source === undefined || source === "managed" || source === "router")
16
+ return "router";
17
+ if (source === "api-key")
18
+ return "api-key";
17
19
  if (source === "subscription")
18
20
  return "subscription";
19
- throw new Error('Tangle profile model.metadata.credentialSource must be "managed" or "subscription"');
21
+ throw new Error('Tangle profile model.metadata.credentialSource must be "router", "api-key", or "subscription"');
20
22
  }
@@ -64,7 +64,7 @@ export async function sandboxInstanceAsEnvironment(box, providerName, client, de
64
64
  const nativeReference = request?.nativeAuth?.cliAuth ?? persistedReference;
65
65
  const credentialHarness = request?.nativeAuth?.harness ?? request?.credentialHarness;
66
66
  const boundCredentialSource = request?.credentialSource ??
67
- (recordedCredentials !== undefined ? "subscription" : "managed");
67
+ (recordedCredentials !== undefined ? "subscription" : "router");
68
68
  const capabilities = frozenCapabilityDocument(AgentEnvironmentCapabilitiesSchema.parse(capabilitiesForSandbox(declaredCapabilities, support, deployment, confidentialVerifierOption(request?.confidentialAttestationVerifier))));
69
69
  const workspaceBranching = capabilities.branching.checkpoint &&
70
70
  capabilities.branching.fork &&
@@ -219,7 +219,7 @@ function environmentTurnPreparation(box, providerName, environmentId, request, d
219
219
  throw new Error("Tangle turn credential source differs from its environment; create a separate environment for that profile");
220
220
  }
221
221
  if (backend?.model?.cliAuth !== undefined && boundCredentialSource !== "subscription") {
222
- throw new Error("Tangle managed environment cannot inherit native subscription credentials");
222
+ throw new Error("Tangle router environment cannot inherit native subscription credentials");
223
223
  }
224
224
  if (backend?.model?.cliAuth !== undefined && !deployment.cliAuthReferences) {
225
225
  throw new Error("Tangle selected sandbox does not prove native credential reference support");
@@ -226,9 +226,9 @@ function sandboxPromptBackend(value) {
226
226
  ? {}
227
227
  : { metadata: sandboxPromptBackendMetadata(present.metadata) }),
228
228
  };
229
- if (backend.profile?.model?.metadata?.credentialSource === "managed" &&
229
+ if (backend.profile !== undefined && profileCredentialSource(backend.profile) === "router" &&
230
230
  (backend.model?.cliAuth !== undefined || backend.model?.authFiles !== undefined || backend.model?.authMode === "oauth")) {
231
- throw new Error("Tangle explicit managed profile cannot receive native subscription credentials");
231
+ throw new Error("Tangle explicit router profile cannot receive native subscription credentials");
232
232
  }
233
233
  if (backend.profile !== undefined)
234
234
  profileCredentialSource(backend.profile);
@@ -112,7 +112,7 @@ export function createTangleProvider(options) {
112
112
  assertProxySecretAliases(requestedProxySecrets, input.env, input.secrets);
113
113
  const requestedSecrets = structuredClone(Array.isArray(input.secrets) ? input.secrets : undefined);
114
114
  const requestedReason = requestedSecrets?.some((entry) => typeof entry !== "string" && "exposeInBox" in entry) ? input.metadata?.reason : undefined;
115
- const credentialSource = typeof input.profile === "string" ? "managed" : profileCredentialSource(input.profile);
115
+ const credentialSource = typeof input.profile === "string" ? "router" : profileCredentialSource(input.profile);
116
116
  const subscription = credentialSource === "subscription";
117
117
  if (Object.hasOwn(input.metadata ?? {}, "modelCredentials")) {
118
118
  throw new Error("Tangle credential selection owns metadata.modelCredentials");
@@ -169,7 +169,7 @@ export function createTangleProvider(options) {
169
169
  throw new Error("Tangle mapped create options must preserve the exact profile credential source");
170
170
  }
171
171
  if (!subscription && mappedOptions.backend?.model?.cliAuth !== undefined) {
172
- throw new Error("Tangle managed profile cannot provision native subscription credentials");
172
+ throw new Error("Tangle router profile cannot provision native subscription credentials");
173
173
  }
174
174
  const createOptions = deepFreeze(structuredClone({
175
175
  ...mappedOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-provider-tangle",
3
- "version": "5.0.8",
3
+ "version": "5.0.9",
4
4
  "description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "LICENSE"
34
34
  ],
35
35
  "dependencies": {
36
- "@tangle-network/agent-interface": "^5.10.17"
36
+ "@tangle-network/agent-interface": "^5.10.18"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@tangle-network/sandbox": ">=1.0.151 <2.0.0"