@tangle-network/agent-provider-tangle 5.0.17 → 5.0.19
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.
|
@@ -2,4 +2,4 @@ import type { AgentProfile } from "@tangle-network/agent-interface";
|
|
|
2
2
|
/** The credential intent a profile can declare. `managed` is the deprecated spelling of `router`. */
|
|
3
3
|
export type ProfileCredentialSource = "router" | "api-key" | "subscription";
|
|
4
4
|
/** Authored profile intent is independent of the harness, vendor, and available accounts. */
|
|
5
|
-
export declare function profileCredentialSource(profile: AgentProfile): ProfileCredentialSource;
|
|
5
|
+
export declare function profileCredentialSource(profile: AgentProfile | Pick<AgentProfile, "model">): ProfileCredentialSource;
|
package/dist/tangle-events.js
CHANGED
|
@@ -184,14 +184,27 @@ export function environmentEventFromSandboxEvent(event, expected = {}) {
|
|
|
184
184
|
}
|
|
185
185
|
const usage = tokenUsageFromData(data);
|
|
186
186
|
const declaredModes = [record.usageMode, data.usageMode].filter((mode) => mode !== undefined);
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
const unreported = declaredModes[0] === "unreported";
|
|
188
|
+
const validUsageModes = unreported
|
|
189
|
+
? terminal &&
|
|
190
|
+
data.tokensKnown === false &&
|
|
191
|
+
usage === undefined &&
|
|
192
|
+
data.usage === undefined &&
|
|
193
|
+
data.tokenUsage === undefined &&
|
|
194
|
+
data.costUsd === undefined &&
|
|
195
|
+
data.totalCostUsd === undefined &&
|
|
196
|
+
declaredModes.every((mode) => mode === "unreported")
|
|
197
|
+
: declaredModes.every((mode) => mode === "delta" || mode === "cumulative") &&
|
|
198
|
+
(declaredModes.length !== 2 || declaredModes[0] === declaredModes[1]);
|
|
199
|
+
if (!validUsageModes) {
|
|
189
200
|
throw new Error("Tangle Sandbox event contained invalid or conflicting usage modes");
|
|
190
201
|
}
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
const usageMode =
|
|
194
|
-
|
|
202
|
+
// Agent Container's unreported terminal carries no measured usage and has no
|
|
203
|
+
// delta/cumulative semantics. Other terminal receipts default to cumulative.
|
|
204
|
+
const usageMode = unreported
|
|
205
|
+
? undefined
|
|
206
|
+
: declaredModes[0] ??
|
|
207
|
+
(terminal ? "cumulative" : undefined);
|
|
195
208
|
// Preserve the public resume key without promoting it to native attribution.
|
|
196
209
|
const normalized = normalizeSandboxEvent(record.type, data, identity);
|
|
197
210
|
return {
|
package/dist/tangle-prompt.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BackendConfig, PromptOptions, PromptResult } from "@tangle-network/sandbox";
|
|
2
2
|
import type { AgentTurnInput, AgentTurnResult } from "@tangle-network/agent-interface/environment-provider";
|
|
3
|
-
import type { AgentExactRunControlRef, InputPart } from "@tangle-network/agent-interface";
|
|
3
|
+
import type { AgentProfile, AgentExactRunControlRef, InputPart } from "@tangle-network/agent-interface";
|
|
4
4
|
import { type ProxySecretReceipt, type ProxySecretBinding } from "@tangle-network/agent-interface";
|
|
5
5
|
import type { SandboxInstanceLike } from "./tangle-types.js";
|
|
6
6
|
export declare function promptFromTurnInput(input: AgentTurnInput): string | InputPart[];
|
|
@@ -9,7 +9,9 @@ export declare function promptOptionsFromTurnInput(input: AgentTurnInput, target
|
|
|
9
9
|
provider: string;
|
|
10
10
|
environmentId: string;
|
|
11
11
|
sessionId?: string;
|
|
12
|
-
}): PromptOptions
|
|
12
|
+
}): Omit<PromptOptions, "backend"> & {
|
|
13
|
+
backend?: SandboxPromptBackend;
|
|
14
|
+
};
|
|
13
15
|
export declare function proxySecretReceiptFromSandbox(box: SandboxInstanceLike): ProxySecretReceipt | undefined;
|
|
14
16
|
/** Prepare one exact launch; legacy and cursor replay retain their existing path. */
|
|
15
17
|
export declare function preparePromptOptions(box: SandboxInstanceLike, options: PromptOptions, provider: string, bindings?: readonly ProxySecretBinding[]): Promise<PromptOptions>;
|
|
@@ -21,12 +23,14 @@ declare const SANDBOX_AUTH_FILE_FIELD_LIST: readonly ["path", "content", "mode"]
|
|
|
21
23
|
type SandboxAuthFile = NonNullable<SandboxBackendModel["authFiles"]>[number];
|
|
22
24
|
type FieldDifference<T, Fields extends readonly PropertyKey[]> = Exclude<keyof T, Fields[number]> | Exclude<Fields[number], keyof T>;
|
|
23
25
|
export type SandboxBackendFieldCoverage = Exhaustive<FieldDifference<Omit<BackendConfig, Exclude<(typeof SANDBOX_BACKEND_MODEL_FIELD_LIST)[number], "model"> | "modelId">, typeof SANDBOX_BACKEND_FIELD_LIST> | FieldDifference<SandboxBackendModel, typeof SANDBOX_BACKEND_MODEL_FIELD_LIST> | FieldDifference<SandboxAuthFile, typeof SANDBOX_AUTH_FILE_FIELD_LIST>>;
|
|
24
|
-
type SandboxPromptBackend = NonNullable<PromptOptions["backend"]
|
|
26
|
+
type SandboxPromptBackend = Omit<NonNullable<PromptOptions["backend"]>, "profile"> & {
|
|
27
|
+
profile?: AgentProfile;
|
|
28
|
+
};
|
|
25
29
|
/** Validate the exact per-turn backend projection. */
|
|
26
30
|
export declare function backendFromTurnProviderOptions(providerOptions: Record<string, unknown> | undefined): SandboxPromptBackend | undefined;
|
|
27
31
|
export declare function normalizeTangleBackend(value: unknown, allowRouting?: boolean): BackendConfig | undefined;
|
|
28
32
|
/** Request identity excludes bearer bytes; auth files contribute only paths and modes. */
|
|
29
|
-
export declare function backendRequestIdentity(backend:
|
|
33
|
+
export declare function backendRequestIdentity(backend: PromptOptions["backend"]): Record<string, unknown> | undefined;
|
|
30
34
|
export declare function backendFromTurnInput(input: AgentTurnInput): SandboxPromptBackend | undefined;
|
|
31
35
|
type SandboxRunStatus = "success" | "failed" | "blocked_on_approval" | "awaiting_question" | "awaiting_interaction" | "awaiting_plan_decision";
|
|
32
36
|
type ValidatedSandboxPromptResult = Record<string, unknown> & {
|
package/dist/tangle-provider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AgentEnvironmentCapabilitiesSchema, AgentEnvironmentGetOptionsSchema, createAgentEnvironmentWithIdempotency, } from "@tangle-network/agent-interface/environment-provider";
|
|
2
|
-
import { canonicalCandidateDigest, deepFreeze, harnessTypeSchema } from "@tangle-network/agent-interface";
|
|
2
|
+
import { agentProfileSchema, canonicalCandidateDigest, deepFreeze, harnessTypeSchema } from "@tangle-network/agent-interface";
|
|
3
3
|
import { createTangleExactProcessProvider } from "./exact-process.js";
|
|
4
4
|
import { capabilitiesForClient, defaultTangleSandboxCapabilities, narrowTangleCapabilitiesToBackend, } from "./tangle-capabilities.js";
|
|
5
5
|
import { sandboxInstanceAsEnvironment } from "./tangle-environment.js";
|
|
@@ -140,7 +140,7 @@ export function createTangleProvider(options) {
|
|
|
140
140
|
const mappedInput = mapCreateInput?.(input) ??
|
|
141
141
|
(subscription && resolveModelCredentials !== undefined ? sandboxOptionsFromCreateInput(input, options.defaultBackend, parsedWorkspace, selectedCredentials, true) : defaultOptions);
|
|
142
142
|
const selectedProxySecrets = mergeProxySecrets(requestedProxySecrets, selectedCredentials?.proxySecrets);
|
|
143
|
-
const mappedProxySecrets = mergeProxySecrets(selectedProxySecrets, proxySecretsFromInput({ profile: mappedInput.backend?.profile ?? {}, proxySecrets: mappedInput.proxySecrets }));
|
|
143
|
+
const mappedProxySecrets = mergeProxySecrets(selectedProxySecrets, proxySecretsFromInput({ profile: agentProfileSchema.parse(mappedInput.backend?.profile ?? {}), proxySecrets: mappedInput.proxySecrets }));
|
|
144
144
|
if (canonicalCandidateDigest(mappedProxySecrets ?? []) !== canonicalCandidateDigest(selectedProxySecrets ?? []))
|
|
145
145
|
throw new Error("Tangle mapped proxy-secret declarations differ from the requested bindings");
|
|
146
146
|
const mappedOptions = { ...mappedInput, backend: normalizeTangleBackend(mappedInput.backend, true), ...(selectedProxySecrets === undefined ? {} : { proxySecrets: selectedProxySecrets }) };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type AgentProfile, type AgentRuntimeAttachments } from "@tangle-network/agent-interface";
|
|
2
2
|
/** Runtime bindings retain their own identity and cannot replace profile tools. */
|
|
3
|
-
export declare function tangleRuntimeAttachments(value: unknown, profile?: AgentProfile): AgentRuntimeAttachments;
|
|
3
|
+
export declare function tangleRuntimeAttachments(value: unknown, profile?: Pick<AgentProfile, "mcp">): AgentRuntimeAttachments;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-tangle",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.19",
|
|
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.
|
|
36
|
+
"@tangle-network/agent-interface": "^5.10.28"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@tangle-network/sandbox": ">=1.0.393 <2.0.0"
|