@tangle-network/agent-provider-tangle 4.2.1 → 4.3.0
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 +11 -0
- package/dist/capture-harness-list.d.ts +7 -0
- package/dist/capture-harness-list.js +29 -0
- package/dist/command-model-credentials.js +8 -7
- package/dist/http-model-credentials.js +6 -2
- package/dist/model-credential-capacity.d.ts +9 -0
- package/dist/model-credential-capacity.js +28 -0
- package/dist/model-credential-source.d.ts +8 -1
- package/dist/model-credential-source.js +3 -3
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/dist/tangle-create-options.js +27 -0
- package/dist/tangle-native-capture-proof.d.ts +5 -1
- package/dist/tangle-native-capture-proof.js +7 -6
- package/dist/tangle-prompt.js +6 -2
- package/package.json +5 -102
package/README.md
CHANGED
|
@@ -95,6 +95,9 @@ 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.
|
|
98
101
|
Unknown or malformed intent fails before provisioning.
|
|
99
102
|
`profileCredentialSource(profile)` exports this strict intent reader.
|
|
100
103
|
|
|
@@ -710,6 +713,14 @@ The command transport accepts the same public capacity body only with exit code
|
|
|
710
713
|
Its typed error has no HTTP status.
|
|
711
714
|
The caller's execution owner decides whether and when to retry.
|
|
712
715
|
|
|
716
|
+
A deterministic unsupported subscription route returns only
|
|
717
|
+
`{ error: { code: "model_credential_refused", reason: "unsupported_route" } }`.
|
|
718
|
+
The command transport accepts this fixed envelope only with exit code 78; the HTTP transport
|
|
719
|
+
accepts it only with an actual HTTP 400 response. Both expose `TangleCredentialRefusalError`
|
|
720
|
+
before provisioning, with a fixed public message and no private command diagnostics.
|
|
721
|
+
The command error has no HTTP status. Unknown fields or reasons are rejected; generic
|
|
722
|
+
command failures, network failures and held account capacity do not become this refusal.
|
|
723
|
+
|
|
713
724
|
### Completion and native evidence
|
|
714
725
|
|
|
715
726
|
The provider projects terminal results and terminal stream events into bounded completion summaries.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate the whole capability list, then project the IDs this client knows.
|
|
3
|
+
* A newer server may advertise additional harnesses without breaking a known
|
|
4
|
+
* selection. An unknown ID never grants support; selected-harness admission is
|
|
5
|
+
* still required. Malformed, sparse, duplicate and unbounded lists fail closed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function recognizedCaptureHarnesses<H extends string>(raw: unknown, knownHarnesses: readonly H[]): readonly H[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Bound the wire document independently of this client's known vocabulary. */
|
|
2
|
+
const MAX_HARNESS_ENTRIES = 256;
|
|
3
|
+
const MAX_HARNESS_ID_LENGTH = 128;
|
|
4
|
+
const INVALID_ID_CHARACTER = /[\s\u0000-\u001f\u007f]/u;
|
|
5
|
+
/**
|
|
6
|
+
* Validate the whole capability list, then project the IDs this client knows.
|
|
7
|
+
* A newer server may advertise additional harnesses without breaking a known
|
|
8
|
+
* selection. An unknown ID never grants support; selected-harness admission is
|
|
9
|
+
* still required. Malformed, sparse, duplicate and unbounded lists fail closed.
|
|
10
|
+
*/
|
|
11
|
+
export function recognizedCaptureHarnesses(raw, knownHarnesses) {
|
|
12
|
+
const fail = () => {
|
|
13
|
+
throw new Error("Tangle deployment has not proven native session capture with a valid harness list");
|
|
14
|
+
};
|
|
15
|
+
if (!Array.isArray(raw) || raw.length > MAX_HARNESS_ENTRIES)
|
|
16
|
+
return fail();
|
|
17
|
+
const known = new Set(knownHarnesses);
|
|
18
|
+
const seen = new Set();
|
|
19
|
+
const recognized = [];
|
|
20
|
+
for (const id of raw) {
|
|
21
|
+
if (typeof id !== "string" || id.length === 0 || id.length > MAX_HARNESS_ID_LENGTH ||
|
|
22
|
+
INVALID_ID_CHARACTER.test(id) || seen.has(id))
|
|
23
|
+
return fail();
|
|
24
|
+
seen.add(id);
|
|
25
|
+
if (known.has(id))
|
|
26
|
+
recognized.push(id);
|
|
27
|
+
}
|
|
28
|
+
return Object.freeze(recognized);
|
|
29
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseCredentialCapacity } from "./model-credential-capacity.js";
|
|
1
|
+
import { parseCredentialCapacity, parseCredentialRefusal } from "./model-credential-capacity.js";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
import { profileCredentialSource } from "./model-credential-source.js";
|
|
4
4
|
import { captureModelCredentials } from "./tangle-create-options.js";
|
|
@@ -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)
|
|
44
|
+
if (profileCredentialSource(input.profile) !== "subscription")
|
|
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");
|
|
@@ -96,14 +96,15 @@ export function createCommandModelCredentialResolver(options) {
|
|
|
96
96
|
if (settled)
|
|
97
97
|
return;
|
|
98
98
|
if (code !== 0) {
|
|
99
|
-
if (code === 75) {
|
|
100
|
-
let
|
|
99
|
+
if (code === 75 || code === 78) {
|
|
100
|
+
let refusal;
|
|
101
101
|
try {
|
|
102
|
-
|
|
102
|
+
const payload = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
103
|
+
refusal = code === 75 ? parseCredentialCapacity(payload) : parseCredentialRefusal(payload);
|
|
103
104
|
}
|
|
104
105
|
catch { /* Malformed command output stays a sanitized generic refusal. */ }
|
|
105
|
-
if (
|
|
106
|
-
fail(
|
|
106
|
+
if (refusal !== undefined) {
|
|
107
|
+
fail(refusal);
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
110
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseCredentialCapacity } from "./model-credential-capacity.js";
|
|
1
|
+
import { parseCredentialCapacity, parseCredentialRefusal } from "./model-credential-capacity.js";
|
|
2
2
|
import { profileCredentialSource } from "./model-credential-source.js";
|
|
3
3
|
import { parseModelCredentialResolverRequest } from "./model-credential-request.js";
|
|
4
4
|
import { captureModelCredentials } from "./tangle-create-options.js";
|
|
@@ -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)
|
|
77
|
+
if (profileCredentialSource(input.profile) !== "subscription")
|
|
78
78
|
return undefined;
|
|
79
79
|
input.signal?.throwIfAborted();
|
|
80
80
|
const { signal, ...data } = input;
|
|
@@ -102,9 +102,11 @@ export function createHttpModelCredentialResolver(options) {
|
|
|
102
102
|
if (!response.ok) {
|
|
103
103
|
let exitCode;
|
|
104
104
|
let capacity;
|
|
105
|
+
let refusal;
|
|
105
106
|
try {
|
|
106
107
|
const payload = await publicResponse(response);
|
|
107
108
|
capacity = parseCredentialCapacity(payload, response.status);
|
|
109
|
+
refusal = parseCredentialRefusal(payload, response.status);
|
|
108
110
|
const detail = payload && typeof payload === "object" && "error" in payload ? payload.error : undefined;
|
|
109
111
|
if (detail && typeof detail === "object" && "exitCode" in detail &&
|
|
110
112
|
typeof detail.exitCode === "number" && Number.isSafeInteger(detail.exitCode) && detail.exitCode >= 0 && detail.exitCode <= 255) {
|
|
@@ -116,6 +118,8 @@ export function createHttpModelCredentialResolver(options) {
|
|
|
116
118
|
}
|
|
117
119
|
if (capacity !== undefined)
|
|
118
120
|
throw capacity;
|
|
121
|
+
if (refusal !== undefined)
|
|
122
|
+
throw refusal;
|
|
119
123
|
throw Object.assign(new Error(`Tangle credential broker refused resolution (HTTP ${response.status}${exitCode === undefined ? "" : `, owner exit ${exitCode}`})`), {
|
|
120
124
|
status: response.status, ...(exitCode === undefined ? {} : { exitCode }),
|
|
121
125
|
});
|
|
@@ -8,5 +8,14 @@ export declare class TangleCredentialCapacityError extends Error {
|
|
|
8
8
|
readonly status?: number;
|
|
9
9
|
constructor(code: CredentialCapacityCode, reason: CredentialCapacityReason, resetAt?: string, httpStatus?: number);
|
|
10
10
|
}
|
|
11
|
+
/** A deterministic credential route refusal, before dispatch or account admission. */
|
|
12
|
+
export declare class TangleCredentialRefusalError extends Error {
|
|
13
|
+
readonly code = "model_credential_refused";
|
|
14
|
+
readonly reason = "unsupported_route";
|
|
15
|
+
readonly status?: number;
|
|
16
|
+
constructor(httpStatus?: number);
|
|
17
|
+
}
|
|
18
|
+
/** The fixed public route refusal shares the bounded capacity transport, never private diagnostics. */
|
|
19
|
+
export declare function parseCredentialRefusal(value: unknown, httpStatus?: number): TangleCredentialRefusalError | undefined;
|
|
11
20
|
/** Only fixed public fields survive parsing; upstream messages and private diagnostics do not. */
|
|
12
21
|
export declare function parseCredentialCapacity(value: unknown, httpStatus?: number): TangleCredentialCapacityError | undefined;
|
|
@@ -17,10 +17,38 @@ export class TangleCredentialCapacityError extends Error {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
/** A deterministic credential route refusal, before dispatch or account admission. */
|
|
21
|
+
export class TangleCredentialRefusalError extends Error {
|
|
22
|
+
code = "model_credential_refused";
|
|
23
|
+
reason = "unsupported_route";
|
|
24
|
+
constructor(httpStatus) {
|
|
25
|
+
super("Subscription credential route is unsupported");
|
|
26
|
+
this.name = "TangleCredentialRefusalError";
|
|
27
|
+
if (httpStatus !== undefined) {
|
|
28
|
+
if (httpStatus !== 400)
|
|
29
|
+
throw new Error("Credential refusal requires a real client-error response");
|
|
30
|
+
Object.defineProperty(this, "status", { value: httpStatus, enumerable: true });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
20
34
|
function record(value) {
|
|
21
35
|
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
22
36
|
? value : undefined;
|
|
23
37
|
}
|
|
38
|
+
/** The fixed public route refusal shares the bounded capacity transport, never private diagnostics. */
|
|
39
|
+
export function parseCredentialRefusal(value, httpStatus) {
|
|
40
|
+
if (httpStatus !== undefined && httpStatus !== 400)
|
|
41
|
+
return undefined;
|
|
42
|
+
const envelope = record(value);
|
|
43
|
+
if (!envelope || Object.keys(envelope).some((key) => key !== "error"))
|
|
44
|
+
return undefined;
|
|
45
|
+
const error = record(envelope.error);
|
|
46
|
+
if (!error || Object.keys(error).some((key) => key !== "code" && key !== "reason"))
|
|
47
|
+
return undefined;
|
|
48
|
+
if (error.code !== "model_credential_refused" || error.reason !== "unsupported_route")
|
|
49
|
+
return undefined;
|
|
50
|
+
return new TangleCredentialRefusalError(httpStatus);
|
|
51
|
+
}
|
|
24
52
|
/** Only fixed public fields survive parsing; upstream messages and private diagnostics do not. */
|
|
25
53
|
export function parseCredentialCapacity(value, httpStatus) {
|
|
26
54
|
if (httpStatus !== undefined && httpStatus !== 429 && httpStatus !== 503)
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { AgentProfile } from "@tangle-network/agent-interface";
|
|
2
|
-
|
|
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";
|
|
3
10
|
/** Authored profile intent is independent of the harness, vendor, and available accounts. */
|
|
4
11
|
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")
|
|
18
|
-
return
|
|
19
|
-
throw new Error('Tangle profile model.metadata.credentialSource must be "managed" or "
|
|
17
|
+
if (source === "subscription" || source === "cli")
|
|
18
|
+
return source;
|
|
19
|
+
throw new Error('Tangle profile model.metadata.credentialSource must be "managed", "subscription" or "cli"');
|
|
20
20
|
}
|
package/dist/node.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { createHttpModelCredentialResolver } from "./http-model-credentials.js";
|
|
|
4
4
|
export type { HttpModelCredentialResolverOptions } from "./http-model-credentials.js";
|
|
5
5
|
export { parseModelCredentialResolverRequest } from "./model-credential-request.js";
|
|
6
6
|
export type { ModelCredentialResolverRequest } from "./model-credential-request.js";
|
|
7
|
-
export { TangleCredentialCapacityError } from "./model-credential-capacity.js";
|
|
7
|
+
export { TangleCredentialCapacityError, TangleCredentialRefusalError } from "./model-credential-capacity.js";
|
|
8
8
|
export type { CredentialCapacityCode, CredentialCapacityReason } from "./model-credential-capacity.js";
|
|
9
9
|
export { captureTangleEnvironmentEvidenceToDirectory, captureTangleSandboxEvidenceToDirectory } from "./tangle-evidence.js";
|
|
10
10
|
export type { TangleDirectoryEvidence } from "./tangle-evidence.js";
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createCommandModelCredentialResolver } from "./command-model-credentials.js";
|
|
2
2
|
export { createHttpModelCredentialResolver } from "./http-model-credentials.js";
|
|
3
3
|
export { parseModelCredentialResolverRequest } from "./model-credential-request.js";
|
|
4
|
-
export { TangleCredentialCapacityError } from "./model-credential-capacity.js";
|
|
4
|
+
export { TangleCredentialCapacityError, TangleCredentialRefusalError } from "./model-credential-capacity.js";
|
|
5
5
|
export { captureTangleEnvironmentEvidenceToDirectory, captureTangleSandboxEvidenceToDirectory } from "./tangle-evidence.js";
|
|
@@ -71,6 +71,15 @@ 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
|
+
}
|
|
74
83
|
if (selectedSecret !== undefined && Object.hasOwn(input.env ?? {}, selectedSecret)) {
|
|
75
84
|
throw new Error("Tangle modelCredentials cannot shadow a stored secret with inline environment data");
|
|
76
85
|
}
|
|
@@ -159,6 +168,7 @@ export function sandboxOptionsFromCreateInput(input, defaultBackend, parsedWorks
|
|
|
159
168
|
...(base.backend ?? {}),
|
|
160
169
|
type: backend,
|
|
161
170
|
profile,
|
|
171
|
+
...(cliOwned ? { model: cliOwnedModel(profile) } : {}),
|
|
162
172
|
...(modelCredentials === undefined ? {} : {
|
|
163
173
|
model: "cliAuth" in modelCredentials
|
|
164
174
|
? { cliAuth: modelCredentials.cliAuth, authMode: "oauth" } : modelCredentials,
|
|
@@ -308,10 +318,27 @@ export function assertCreateInputShape(input, parsedWorkspace) {
|
|
|
308
318
|
workspaceCwdPathForBase(workspace.cwd, "repository", "Tangle");
|
|
309
319
|
return workspace;
|
|
310
320
|
}
|
|
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
|
+
}
|
|
311
331
|
export function assertMappedCreateOptions(options) {
|
|
312
332
|
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
|
313
333
|
throw new Error("Tangle mapped create options must be an object");
|
|
314
334
|
}
|
|
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
|
+
}
|
|
315
342
|
assertBoundedJson(options, "Tangle mapped create options", PROFILE_AT_BACKEND_PROFILE);
|
|
316
343
|
const proxySecrets = options.proxySecrets === undefined ? undefined : captureProxySecrets(options.proxySecrets);
|
|
317
344
|
assertProxySecretAliases(proxySecrets, options.env, options.secrets);
|
|
@@ -2,7 +2,11 @@ import { type HarnessType } from "@tangle-network/agent-interface";
|
|
|
2
2
|
import type { NativeCaptureProofLike, SandboxInstanceLike, SandboxRuntimeCapabilityDocument } from "./tangle-types.js";
|
|
3
3
|
/** Require a current host proof; a create must also prove its receipt names that same container. */
|
|
4
4
|
export declare function requireNativeCaptureProof(box: SandboxInstanceLike, create?: boolean): NativeCaptureProofLike;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Read the known subset of a valid deployment list. Newer-server entries neither
|
|
7
|
+
* break a known selection nor grant this client support for an unknown harness.
|
|
8
|
+
* Admission below still requires a recognized, explicitly advertised identity.
|
|
9
|
+
*/
|
|
6
10
|
export declare function nativeCaptureHarnesses(raw: unknown): readonly HarnessType[];
|
|
7
11
|
/** Require the selected container's native protocol and exact agent backend before dispatch. */
|
|
8
12
|
export declare function requireNativeCaptureCapability(box: SandboxInstanceLike, harness: string): Promise<SandboxRuntimeCapabilityDocument>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { harnessTypeSchema } from "@tangle-network/agent-interface";
|
|
2
|
+
import { recognizedCaptureHarnesses } from "./capture-harness-list.js";
|
|
2
3
|
const imageId = /^sha256:[0-9a-f]{64}$/;
|
|
3
4
|
const containerId = /^[0-9a-f]{64}$/;
|
|
4
5
|
const revision = /^[0-9a-f]{40}$/;
|
|
@@ -25,13 +26,13 @@ export function requireNativeCaptureProof(box, create = false) {
|
|
|
25
26
|
}
|
|
26
27
|
return proof;
|
|
27
28
|
}
|
|
28
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Read the known subset of a valid deployment list. Newer-server entries neither
|
|
31
|
+
* break a known selection nor grant this client support for an unknown harness.
|
|
32
|
+
* Admission below still requires a recognized, explicitly advertised identity.
|
|
33
|
+
*/
|
|
29
34
|
export function nativeCaptureHarnesses(raw) {
|
|
30
|
-
|
|
31
|
-
if (!parsed.success || new Set(parsed.data).size !== parsed.data.length) {
|
|
32
|
-
throw new Error("Tangle deployment has not proven native session capture with a valid harness list");
|
|
33
|
-
}
|
|
34
|
-
return Object.freeze(parsed.data);
|
|
35
|
+
return recognizedCaptureHarnesses(raw, harnessTypeSchema.options);
|
|
35
36
|
}
|
|
36
37
|
/** Require the selected container's native protocol and exact agent backend before dispatch. */
|
|
37
38
|
export async function requireNativeCaptureCapability(box, harness) {
|
package/dist/tangle-prompt.js
CHANGED
|
@@ -167,9 +167,13 @@ function sandboxPromptBackend(value) {
|
|
|
167
167
|
? {}
|
|
168
168
|
: { metadata: sandboxPromptBackendMetadata(present.metadata) }),
|
|
169
169
|
};
|
|
170
|
-
|
|
170
|
+
const explicitSource = backend.profile?.model?.metadata?.credentialSource;
|
|
171
|
+
if ((explicitSource === "managed" || explicitSource === "cli") &&
|
|
171
172
|
(backend.model?.cliAuth !== undefined || backend.model?.authFiles !== undefined || backend.model?.authMode === "oauth")) {
|
|
172
|
-
throw new Error(
|
|
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");
|
|
173
177
|
}
|
|
174
178
|
if (backend.profile !== undefined)
|
|
175
179
|
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
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,109 +28,12 @@
|
|
|
28
28
|
"registry": "https://registry.npmjs.org"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
|
-
"dist
|
|
32
|
-
"dist/index.js",
|
|
33
|
-
"dist/exact-process.d.ts",
|
|
34
|
-
"dist/exact-process.js",
|
|
35
|
-
"dist/tangle-exact-process-environment.d.ts",
|
|
36
|
-
"dist/tangle-exact-process-environment.js",
|
|
37
|
-
"dist/tangle-contract-safety.d.ts",
|
|
38
|
-
"dist/tangle-contract-safety.js",
|
|
39
|
-
"dist/tangle-failure-reason.d.ts",
|
|
40
|
-
"dist/tangle-failure-reason.js",
|
|
41
|
-
"dist/tangle-exact-process-runtime.d.ts",
|
|
42
|
-
"dist/tangle-exact-process-runtime.js",
|
|
43
|
-
"dist/tangle-exact-process-validation.d.ts",
|
|
44
|
-
"dist/tangle-exact-process-validation.js",
|
|
45
|
-
"dist/tangle-capabilities.d.ts",
|
|
46
|
-
"dist/tangle-capabilities.js",
|
|
47
|
-
"dist/tangle-deployment-capabilities.d.ts",
|
|
48
|
-
"dist/tangle-deployment-capabilities.js",
|
|
49
|
-
"dist/tangle-create-options.d.ts",
|
|
50
|
-
"dist/tangle-create-options.js",
|
|
51
|
-
"dist/tangle-runtime-attachments.d.ts",
|
|
52
|
-
"dist/tangle-runtime-attachments.js",
|
|
53
|
-
"dist/tangle-environment-values.d.ts",
|
|
54
|
-
"dist/tangle-environment-values.js",
|
|
55
|
-
"dist/tangle-environment.d.ts",
|
|
56
|
-
"dist/tangle-environment.js",
|
|
57
|
-
"dist/tangle-evidence.d.ts",
|
|
58
|
-
"dist/tangle-evidence.js",
|
|
59
|
-
"dist/tangle-evidence-writer.js",
|
|
60
|
-
"dist/tangle-evidence-writer.d.ts",
|
|
61
|
-
"dist/tangle-evidence-json.js",
|
|
62
|
-
"dist/tangle-evidence-json.d.ts",
|
|
63
|
-
"dist/tangle-evidence-native-files.js",
|
|
64
|
-
"dist/tangle-evidence-native-files.d.ts",
|
|
65
|
-
"dist/tangle-retained-attribution.js",
|
|
66
|
-
"dist/tangle-retained-attribution.d.ts",
|
|
67
|
-
"dist/tangle-native-capture-proof.d.ts",
|
|
68
|
-
"dist/tangle-native-capture-proof.js",
|
|
69
|
-
"dist/tangle-environment-dispatch.d.ts",
|
|
70
|
-
"dist/tangle-environment-dispatch.js",
|
|
71
|
-
"dist/tangle-environment-session.d.ts",
|
|
72
|
-
"dist/tangle-environment-session.js",
|
|
73
|
-
"dist/tangle-interaction-response.d.ts",
|
|
74
|
-
"dist/tangle-interaction-response.js",
|
|
75
|
-
"dist/tangle-interactive.d.ts",
|
|
76
|
-
"dist/tangle-interactive.js",
|
|
77
|
-
"dist/tangle-environment-control.d.ts",
|
|
78
|
-
"dist/tangle-environment-control.js",
|
|
79
|
-
"dist/tangle-environment-validation.d.ts",
|
|
80
|
-
"dist/tangle-environment-validation.js",
|
|
81
|
-
"dist/tangle-events.d.ts",
|
|
82
|
-
"dist/tangle-events.js",
|
|
83
|
-
"dist/tangle-observation.d.ts",
|
|
84
|
-
"dist/tangle-observation.js",
|
|
85
|
-
"dist/tangle-resources.d.ts",
|
|
86
|
-
"dist/tangle-resources.js",
|
|
87
|
-
"dist/tangle-terminal.d.ts",
|
|
88
|
-
"dist/tangle-terminal.js",
|
|
89
|
-
"dist/tangle-terminal-frames.d.ts",
|
|
90
|
-
"dist/tangle-terminal-frames.js",
|
|
91
|
-
"dist/tangle-usage-log.d.ts",
|
|
92
|
-
"dist/tangle-usage-log.js",
|
|
93
|
-
"dist/tangle-prompt.d.ts",
|
|
94
|
-
"dist/tangle-prompt.js",
|
|
95
|
-
"dist/tangle-proxy-secrets.d.ts",
|
|
96
|
-
"dist/tangle-proxy-secrets.js",
|
|
97
|
-
"dist/tangle-provider.d.ts",
|
|
98
|
-
"dist/tangle-provider.js",
|
|
99
|
-
"dist/tangle-readiness.d.ts",
|
|
100
|
-
"dist/tangle-readiness.js",
|
|
101
|
-
"dist/tangle-result-values.d.ts",
|
|
102
|
-
"dist/tangle-result-values.js",
|
|
103
|
-
"dist/tangle-session-control.d.ts",
|
|
104
|
-
"dist/tangle-session-control.js",
|
|
105
|
-
"dist/tangle-step-usage.d.ts",
|
|
106
|
-
"dist/tangle-step-usage.js",
|
|
107
|
-
"dist/tangle-types.d.ts",
|
|
108
|
-
"dist/tangle-types.js",
|
|
109
|
-
"dist/tangle-workspace-branching.d.ts",
|
|
110
|
-
"dist/tangle-workspace-branching.js",
|
|
111
|
-
"dist/tangle-confidential-attestation.d.ts",
|
|
112
|
-
"dist/tangle-confidential-attestation.js",
|
|
113
|
-
"dist/tangle-workspace-markers.d.ts",
|
|
114
|
-
"dist/tangle-workspace-markers.js",
|
|
115
|
-
"dist/tangle-workspace-recovery.d.ts",
|
|
116
|
-
"dist/tangle-workspace-recovery.js",
|
|
31
|
+
"dist",
|
|
117
32
|
"README.md",
|
|
118
|
-
"LICENSE"
|
|
119
|
-
"dist/node.js",
|
|
120
|
-
"dist/node.d.ts",
|
|
121
|
-
"dist/command-model-credentials.js",
|
|
122
|
-
"dist/command-model-credentials.d.ts",
|
|
123
|
-
"dist/model-credential-source.js",
|
|
124
|
-
"dist/model-credential-source.d.ts",
|
|
125
|
-
"dist/http-model-credentials.js",
|
|
126
|
-
"dist/http-model-credentials.d.ts",
|
|
127
|
-
"dist/model-credential-request.js",
|
|
128
|
-
"dist/model-credential-request.d.ts",
|
|
129
|
-
"dist/model-credential-capacity.js",
|
|
130
|
-
"dist/model-credential-capacity.d.ts"
|
|
33
|
+
"LICENSE"
|
|
131
34
|
],
|
|
132
35
|
"dependencies": {
|
|
133
|
-
"@tangle-network/agent-interface": "^5.
|
|
36
|
+
"@tangle-network/agent-interface": "^5.6.1"
|
|
134
37
|
},
|
|
135
38
|
"peerDependencies": {
|
|
136
39
|
"@tangle-network/sandbox": ">=0.60.27 <1.0.0"
|
|
@@ -149,7 +52,7 @@
|
|
|
149
52
|
"vitest": "5.0.2"
|
|
150
53
|
},
|
|
151
54
|
"scripts": {
|
|
152
|
-
"build": "tsc -p tsconfig.json",
|
|
55
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json",
|
|
153
56
|
"check-types": "tsc --noEmit",
|
|
154
57
|
"clean": "rm -rf dist",
|
|
155
58
|
"test": "vitest run src"
|