@tangle-network/agent-provider-tangle 4.3.0 → 4.3.1

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
@@ -95,9 +95,6 @@ Keep the stored secret available and valid throughout execution and recovery.
95
95
  The exact profile chooses access through `model.metadata.credentialSource`.
96
96
  Use `"subscription"` to request an enrolled account.
97
97
  Omitting this field or using `"managed"` preserves managed access.
98
- Use `"cli"` when the harness CLI authenticates its own provider, such as OpenCode's keyless free tier (`opencode/glm-5.3-flash-free`).
99
- Sandbox then runs OpenCode in CLI mode: no managed key is minted, no subscription is selected, and the model never reaches the Router.
100
- A `"cli"` profile runs only on the `opencode` backend and refuses `modelCredentials`; the box still needs egress to the provider's endpoint.
101
98
  Unknown or malformed intent fails before provisioning.
102
99
  `profileCredentialSource(profile)` exports this strict intent reader.
103
100
 
@@ -41,7 +41,7 @@ export function createCommandModelCredentialResolver(options) {
41
41
  return (input) => {
42
42
  if (typeof input.profile === "string")
43
43
  throw new Error("Tangle credential command requires an inline profile");
44
- if (profileCredentialSource(input.profile) !== "subscription")
44
+ if (profileCredentialSource(input.profile) === "managed")
45
45
  return undefined;
46
46
  if (typeof input.idempotencyKey !== "string" || input.idempotencyKey.length === 0) {
47
47
  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) !== "subscription")
77
+ if (profileCredentialSource(input.profile) === "managed")
78
78
  return undefined;
79
79
  input.signal?.throwIfAborted();
80
80
  const { signal, ...data } = input;
@@ -1,11 +1,4 @@
1
1
  import type { AgentProfile } from "@tangle-network/agent-interface";
2
- /**
3
- * Who authenticates the profile's model.
4
- * - `managed`: Tangle mints the model credential (the default).
5
- * - `subscription`: a selected stored subscription credential.
6
- * - `cli`: the harness CLI resolves and authenticates its own provider, such as OpenCode's
7
- * keyless free tier. No managed key, no subscription seat, no credential resolver.
8
- */
9
- export type ProfileCredentialSource = "managed" | "subscription" | "cli";
2
+ export type ProfileCredentialSource = "managed" | "subscription";
10
3
  /** Authored profile intent is independent of the harness, vendor, and available accounts. */
11
4
  export declare function profileCredentialSource(profile: AgentProfile): ProfileCredentialSource;
@@ -14,7 +14,7 @@ export function profileCredentialSource(profile) {
14
14
  const source = metadata?.credentialSource;
15
15
  if (source === undefined || source === "managed")
16
16
  return "managed";
17
- if (source === "subscription" || source === "cli")
18
- return source;
19
- throw new Error('Tangle profile model.metadata.credentialSource must be "managed", "subscription" or "cli"');
17
+ if (source === "subscription")
18
+ return "subscription";
19
+ throw new Error('Tangle profile model.metadata.credentialSource must be "managed" or "subscription"');
20
20
  }
@@ -71,15 +71,6 @@ export function sandboxOptionsFromCreateInput(input, defaultBackend, parsedWorks
71
71
  }
72
72
  assertCliAuthReferenceSupported(backend, modelCredentials);
73
73
  }
74
- // A cli profile's harness authenticates itself (OpenCode's keyless free tier). Sandbox runs that
75
- // as OpenCode CLI mode: no Router key is minted and the model never reaches the Router.
76
- const cliOwned = profileCredentialSource(profile) === "cli";
77
- if (cliOwned && modelCredentials !== undefined) {
78
- throw new Error("Tangle cli profile takes no modelCredentials; its harness CLI authenticates itself");
79
- }
80
- if (cliOwned && backend !== "opencode") {
81
- throw new Error(`Tangle cli profile runs only on the opencode backend, not ${backend}`);
82
- }
83
74
  if (selectedSecret !== undefined && Object.hasOwn(input.env ?? {}, selectedSecret)) {
84
75
  throw new Error("Tangle modelCredentials cannot shadow a stored secret with inline environment data");
85
76
  }
@@ -168,7 +159,6 @@ export function sandboxOptionsFromCreateInput(input, defaultBackend, parsedWorks
168
159
  ...(base.backend ?? {}),
169
160
  type: backend,
170
161
  profile,
171
- ...(cliOwned ? { model: cliOwnedModel(profile) } : {}),
172
162
  ...(modelCredentials === undefined ? {} : {
173
163
  model: "cliAuth" in modelCredentials
174
164
  ? { cliAuth: modelCredentials.cliAuth, authMode: "oauth" } : modelCredentials,
@@ -318,27 +308,10 @@ export function assertCreateInputShape(input, parsedWorkspace) {
318
308
  workspaceCwdPathForBase(workspace.cwd, "repository", "Tangle");
319
309
  return workspace;
320
310
  }
321
- /** Sandbox's OpenCode CLI mode on the profile's own provider and model, with no credential. */
322
- function cliOwnedModel(profile) {
323
- const provider = profile.model?.provider;
324
- const model = profile.model?.default;
325
- return {
326
- mode: "cli",
327
- ...(provider === undefined ? {} : { provider: boundedIdentifier(provider, "Tangle cli profile provider") }),
328
- ...(model === undefined ? {} : { model: boundedString(model, "Tangle cli profile model") }),
329
- };
330
- }
331
311
  export function assertMappedCreateOptions(options) {
332
312
  if (!options || typeof options !== "object" || Array.isArray(options)) {
333
313
  throw new Error("Tangle mapped create options must be an object");
334
314
  }
335
- if (options.backend?.profile !== undefined && profileCredentialSource(options.backend.profile) === "cli") {
336
- const model = options.backend.model;
337
- if (model?.mode !== "cli" || model.apiKey !== undefined || model.apiKeyEnv !== undefined ||
338
- model.cliAuth !== undefined || model.authFiles !== undefined) {
339
- throw new Error("Tangle mapped cli profile must run in CLI mode with no model credential");
340
- }
341
- }
342
315
  assertBoundedJson(options, "Tangle mapped create options", PROFILE_AT_BACKEND_PROFILE);
343
316
  const proxySecrets = options.proxySecrets === undefined ? undefined : captureProxySecrets(options.proxySecrets);
344
317
  assertProxySecretAliases(proxySecrets, options.env, options.secrets);
@@ -167,13 +167,9 @@ function sandboxPromptBackend(value) {
167
167
  ? {}
168
168
  : { metadata: sandboxPromptBackendMetadata(present.metadata) }),
169
169
  };
170
- const explicitSource = backend.profile?.model?.metadata?.credentialSource;
171
- if ((explicitSource === "managed" || explicitSource === "cli") &&
170
+ if (backend.profile?.model?.metadata?.credentialSource === "managed" &&
172
171
  (backend.model?.cliAuth !== undefined || backend.model?.authFiles !== undefined || backend.model?.authMode === "oauth")) {
173
- throw new Error(`Tangle explicit ${explicitSource} profile cannot receive native subscription credentials`);
174
- }
175
- if (explicitSource === "cli" && (backend.model?.apiKey !== undefined || backend.model?.apiKeyEnv !== undefined)) {
176
- throw new Error("Tangle cli profile cannot receive a model API key");
172
+ throw new Error("Tangle explicit managed profile cannot receive native subscription credentials");
177
173
  }
178
174
  if (backend.profile !== undefined)
179
175
  profileCredentialSource(backend.profile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-provider-tangle",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
5
5
  "type": "module",
6
6
  "license": "MIT",