@tangle-network/agent-app 0.53.7 → 0.53.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.
@@ -137,4 +137,4 @@ export {
137
137
  createTangleRouterModelConfig,
138
138
  resolveTangleModelConfig
139
139
  };
140
- //# sourceMappingURL=chunk-JML7WKWU.js.map
140
+ //# sourceMappingURL=chunk-CP36C5LZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/runtime/model.ts"],"sourcesContent":["/**\n * Resolve the model config a Tangle agent's sandbox/runtime runs on.\n *\n * Every Tangle agent product resolves the SAME thing from env: the Tangle Router\n * (OpenAI-compatible, metered at the platform markup against a single\n * `TANGLE_API_KEY`) by default, with a direct-Anthropic BYOK escape hatch. The\n * shape feeds the sandbox backend's role-named model fields (see\n * `backendModelFields`). Lifted here so no product\n * hand-rolls the env parsing + the router default.\n */\n\nexport interface TangleModelConfig {\n /** The Tangle Router is OpenAI-compatible → driven via `openai-compat`.\n * `anthropic` is the BYOK escape hatch. */\n provider: 'openai-compat' | 'anthropic'\n model: string\n apiKey: string\n baseUrl: string\n}\n\n/** Define the environment context for executing Tangle operations */\nexport type TangleExecutionEnvironment = 'development' | 'staging' | 'production' | 'test'\n/** Resolve the source of the Tangle execution key as either local environment or user input */\nexport type TangleExecutionKeySource = 'local-env' | 'user'\n/** Define error codes for Tangle execution key issues related to API key and account connection */\nexport type TangleExecutionKeyErrorCode =\n | 'local_tangle_api_key_required'\n | 'tangle_account_not_connected'\n\n/** Resolve options for model configuration including environment variables and default router base URL */\nexport interface ResolveModelOptions {\n /** Env to read (defaults to process.env). */\n env?: Record<string, string | undefined>\n /** Router base URL default when `TANGLE_ROUTER_BASE_URL` is unset. */\n defaultRouterBaseUrl?: string\n}\n\n/** Resolve options for retrieving user API keys within a specific Tangle execution environment */\nexport interface ResolveUserTangleExecutionKeyOptions {\n /** Deployment context. Only local development may fall back to env keys. */\n environment?: TangleExecutionEnvironment\n /** Env to read for the local-development fallback. */\n env?: Record<string, string | undefined>\n /** App-owned lookup for the caller's linked platform API key. */\n getUserApiKey: () => string | null | undefined | Promise<string | null | undefined>\n}\n\n/** Resolve options for retrieving a user's Tangle execution key with environment and API key access parameters */\nexport interface ResolveUserTangleExecutionKeyForUserOptions<UserId = string> {\n userId: UserId\n environment?: TangleExecutionEnvironment\n env?: Record<string, string | undefined>\n getUserApiKey: (userId: UserId) => string | null | undefined | Promise<string | null | undefined>\n}\n\n/** Define a resolved key combining an API key with its Tangle execution source */\nexport interface ResolvedTangleExecutionKey {\n apiKey: string\n source: TangleExecutionKeySource\n}\n\n/** Resolve options for retrieving a Tangle developer or user API key based on environment and context */\nexport interface ResolveTangleDevOrUserKeyOptions {\n /** Deployment context. Only local development may use the env key. */\n environment?: TangleExecutionEnvironment\n /** Env to read for the local-development fallback. */\n env?: Record<string, string | undefined>\n /** App-owned lookup for the caller's linked platform API key. */\n getUserApiKey: () => string | null | undefined | Promise<string | null | undefined>\n}\n\n/** Represent HTTP error response containing status, error message, and specific error code */\nexport interface TangleExecutionKeyHttpError {\n status: number\n body: {\n error: string\n code: TangleExecutionKeyErrorCode\n }\n}\n\n/** Define configuration options for creating a Tangle router model including API key and model details */\nexport interface CreateTangleRouterModelConfigOptions {\n apiKey: string\n model: string\n baseUrl?: string\n}\n\n/** Define options for configuring billing enforcement environment variables and overrides */\nexport interface TangleBillingEnforcementOptions {\n /** Env to read (defaults to process.env). */\n env?: Record<string, string | undefined>\n /**\n * Optional app-specific override flag, e.g. `GTM_BILLING_ENFORCEMENT`.\n * Defaults to the shared `TANGLE_BILLING_ENFORCEMENT`.\n */\n enforcementEnvVar?: string\n}\n\n/** Provide the default base URL for the Tangle router API endpoint */\nexport const DEFAULT_TANGLE_ROUTER_BASE_URL = 'https://router.tangle.tools/v1'\n/** Define the default environment variable name for Tangle billing enforcement */\nexport const DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR = 'TANGLE_BILLING_ENFORCEMENT'\n\nfunction requireEnv(env: Record<string, string | undefined>, name: string): string {\n const value = env[name]?.trim()\n if (!value) throw new Error(`${name} is required`)\n return value\n}\n\n/** Resolve a string by trimming whitespace or returning null if empty or undefined */\nexport function trimOrNull(value: string | null | undefined): string | null {\n const trimmed = value?.trim()\n return trimmed ? trimmed : null\n}\n\nfunction isTangleExecutionKeyErrorCode(value: unknown): value is TangleExecutionKeyErrorCode {\n return value === 'local_tangle_api_key_required' || value === 'tangle_account_not_connected'\n}\n\n/** Represent execution key errors with specific codes and HTTP status information */\nexport class TangleExecutionKeyError extends Error {\n readonly code: TangleExecutionKeyErrorCode\n readonly status: number\n\n constructor(code: TangleExecutionKeyErrorCode, message: string, status: number) {\n super(message)\n this.name = 'TangleExecutionKeyError'\n this.code = code\n this.status = status\n }\n}\n\n/** Identify whether an error is a TangleExecutionKeyError based on its properties and type */\nexport function isTangleExecutionKeyError(error: unknown): error is TangleExecutionKeyError {\n return error instanceof TangleExecutionKeyError\n || (\n typeof error === 'object'\n && error !== null\n && (error as { name?: unknown }).name === 'TangleExecutionKeyError'\n && typeof (error as { message?: unknown }).message === 'string'\n && isTangleExecutionKeyErrorCode((error as { code?: unknown }).code)\n && typeof (error as { status?: unknown }).status === 'number'\n )\n}\n\n/** Resolve the current Tangle execution environment based on provided or process environment variables */\nexport function resolveTangleExecutionEnvironment(\n env: Record<string, string | undefined> = process.env as Record<string, string | undefined>,\n): TangleExecutionEnvironment {\n const raw = (env.APP_ENV ?? env.NODE_ENV ?? '').trim().toLowerCase()\n if (raw === 'development' || raw === 'dev' || raw === 'local') return 'development'\n if (raw === 'staging') return 'staging'\n if (raw === 'test') return 'test'\n return 'production'\n}\n\n/**\n * Shared policy for agent products that bill through the Tangle Platform.\n *\n * Local development defaults billing enforcement off so apps can use a local\n * `TANGLE_API_KEY` without requiring a browser-linked platform account. Any\n * non-development environment defaults enforcement on. Apps may pass their own\n * override flag (`FOO_BILLING_ENFORCEMENT`) while new apps can use the shared\n * `TANGLE_BILLING_ENFORCEMENT`.\n */\nexport function isTangleBillingEnforcementDisabled(\n opts: TangleBillingEnforcementOptions = {},\n): boolean {\n const env = opts.env ?? (process.env as Record<string, string | undefined>)\n const enforcementEnvVar = opts.enforcementEnvVar ?? DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR\n const override = env[enforcementEnvVar]?.trim().toLowerCase()\n\n if (override === 'disabled') return true\n if (override === 'enabled') return false\n\n return resolveTangleExecutionEnvironment(env) === 'development'\n}\n\n/** Resolve and format TangleExecutionKey HTTP errors into a standardized error object or return null */\nexport function tangleExecutionKeyHttpError(error: unknown): TangleExecutionKeyHttpError | null {\n if (!isTangleExecutionKeyError(error)) return null\n return {\n status: error.status,\n body: {\n error: error.message,\n code: error.code,\n },\n }\n}\n\n/**\n * Shared dev-aware Tangle key resolution. Local development may use a server\n * `TANGLE_API_KEY`; otherwise the caller's linked platform key is used. Returns\n * null when neither resolves, so each caller can throw its own domain error\n * (e.g. model-execution 503/401 vs hub `tangle_link_required` 412).\n */\nexport async function resolveTangleDevOrUserKey(\n opts: ResolveTangleDevOrUserKeyOptions,\n): Promise<ResolvedTangleExecutionKey | null> {\n const env = opts.env ?? (process.env as Record<string, string | undefined>)\n const environment = opts.environment ?? resolveTangleExecutionEnvironment(env)\n\n if (environment === 'development') {\n const apiKey = trimOrNull(env.TANGLE_API_KEY)\n if (apiKey) return { apiKey, source: 'local-env' }\n }\n\n const apiKey = trimOrNull(await opts.getUserApiKey())\n if (apiKey) return { apiKey, source: 'user' }\n\n return null\n}\n\n/**\n * Resolve the user-facing Tangle API key for model execution.\n *\n * Local development may use a server env key so apps remain easy to run.\n * Deployed contexts must use the caller's linked platform key; this keeps\n * model execution, billing, and account ownership aligned across products.\n */\nexport async function resolveUserTangleExecutionKey(\n opts: ResolveUserTangleExecutionKeyOptions,\n): Promise<ResolvedTangleExecutionKey> {\n const env = opts.env ?? (process.env as Record<string, string | undefined>)\n const environment = opts.environment ?? resolveTangleExecutionEnvironment(env)\n\n const resolved = await resolveTangleDevOrUserKey({ environment, env, getUserApiKey: opts.getUserApiKey })\n if (resolved) return resolved\n\n if (environment === 'development') {\n throw new TangleExecutionKeyError(\n 'local_tangle_api_key_required',\n 'TANGLE_API_KEY or a linked Tangle account is required for local Tangle model execution.',\n 503,\n )\n }\n\n throw new TangleExecutionKeyError(\n 'tangle_account_not_connected',\n 'Connect your Tangle account before invoking this agent.',\n 401,\n )\n}\n\n/** Resolve the Tangle execution key for a specified user using provided environment and API key options */\nexport async function resolveUserTangleExecutionKeyForUser<UserId = string>(\n opts: ResolveUserTangleExecutionKeyForUserOptions<UserId>,\n): Promise<ResolvedTangleExecutionKey> {\n return resolveUserTangleExecutionKey({\n environment: opts.environment,\n env: opts.env,\n getUserApiKey: () => opts.getUserApiKey(opts.userId),\n })\n}\n\n/**\n * Build an OpenAI-compatible Tangle Router model config from an already\n * resolved execution key. This intentionally does not read TANGLE_API_KEY.\n */\nexport function createTangleRouterModelConfig(\n opts: CreateTangleRouterModelConfigOptions,\n): TangleModelConfig {\n const apiKey = opts.apiKey.trim()\n if (!apiKey) throw new Error('apiKey is required')\n const model = opts.model.trim()\n if (!model) throw new Error('model is required')\n return {\n provider: 'openai-compat',\n model,\n apiKey,\n baseUrl: (opts.baseUrl?.trim() || DEFAULT_TANGLE_ROUTER_BASE_URL).replace(/\\/+$/, ''),\n }\n}\n\n/**\n * Resolve the model config from env. DEFAULT path (`MODEL_PROVIDER` unset or\n * `openai-compat`/`tangle-router`/`tcloud`): the Tangle Router, authenticated\n * with `TANGLE_API_KEY`, model from `MODEL_NAME`. BYOK path\n * (`MODEL_PROVIDER=anthropic`): direct Anthropic with `ANTHROPIC_API_KEY` +\n * `ANTHROPIC_BASE_URL`. Throws (fail-loud) on a missing required var so a\n * misconfigured deploy fails at boot, not mid-turn.\n */\nexport function resolveTangleModelConfig(opts: ResolveModelOptions = {}): TangleModelConfig {\n const env = opts.env ?? (process.env as Record<string, string | undefined>)\n const provider = env.MODEL_PROVIDER?.trim() || 'openai-compat'\n const model = requireEnv(env, 'MODEL_NAME')\n\n if (provider === 'openai-compat' || provider === 'tangle-router' || provider === 'tcloud') {\n return {\n provider: 'openai-compat',\n model,\n apiKey: requireEnv(env, 'TANGLE_API_KEY'),\n baseUrl: (env.TANGLE_ROUTER_BASE_URL?.trim() || opts.defaultRouterBaseUrl || DEFAULT_TANGLE_ROUTER_BASE_URL).replace(/\\/+$/, ''),\n }\n }\n\n if (provider === 'anthropic') {\n return {\n provider,\n model,\n apiKey: requireEnv(env, 'ANTHROPIC_API_KEY'),\n baseUrl: requireEnv(env, 'ANTHROPIC_BASE_URL'),\n }\n }\n\n throw new Error(`Unsupported MODEL_PROVIDER: ${provider} (use openai-compat for the Tangle Router, or anthropic for BYOK)`)\n}\n"],"mappings":";AAmGO,IAAM,iCAAiC;AAEvC,IAAM,6CAA6C;AAE1D,SAAS,WAAW,KAAyC,MAAsB;AACjF,QAAM,QAAQ,IAAI,IAAI,GAAG,KAAK;AAC9B,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,GAAG,IAAI,cAAc;AACjD,SAAO;AACT;AAGO,SAAS,WAAW,OAAiD;AAC1E,QAAM,UAAU,OAAO,KAAK;AAC5B,SAAO,UAAU,UAAU;AAC7B;AAEA,SAAS,8BAA8B,OAAsD;AAC3F,SAAO,UAAU,mCAAmC,UAAU;AAChE;AAGO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EACxC;AAAA,EACA;AAAA,EAET,YAAY,MAAmC,SAAiB,QAAgB;AAC9E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AAAA,EAChB;AACF;AAGO,SAAS,0BAA0B,OAAkD;AAC1F,SAAO,iBAAiB,2BAEpB,OAAO,UAAU,YACd,UAAU,QACT,MAA6B,SAAS,6BACvC,OAAQ,MAAgC,YAAY,YACpD,8BAA+B,MAA6B,IAAI,KAChE,OAAQ,MAA+B,WAAW;AAE3D;AAGO,SAAS,kCACd,MA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,WAAW,KAAK,oBAAoB;AAAA,IAC/C;AAAA,EACF;AAEA,QAAM,IAAI,MAAM,+BAA+B,QAAQ,mEAAmE;AAC5H;","names":["apiKey"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isTangleBillingEnforcementDisabled
3
- } from "./chunk-JML7WKWU.js";
3
+ } from "./chunk-CP36C5LZ.js";
4
4
  import {
5
5
  clearCookieHeader,
6
6
  readCookieValue,
@@ -494,4 +494,4 @@ export {
494
494
  createAdminGuard,
495
495
  assertBillableBalance
496
496
  };
497
- //# sourceMappingURL=chunk-SMRF4UMN.js.map
497
+ //# sourceMappingURL=chunk-L57CYCXN.js.map
@@ -13,10 +13,10 @@ import {
13
13
  resolveTangleSsoAccount,
14
14
  signSessionCookieValue,
15
15
  verifySignedSsoState
16
- } from "../chunk-SMRF4UMN.js";
16
+ } from "../chunk-L57CYCXN.js";
17
17
  import {
18
18
  resolveTangleExecutionEnvironment
19
- } from "../chunk-JML7WKWU.js";
19
+ } from "../chunk-CP36C5LZ.js";
20
20
  import "../chunk-YNSPVKMS.js";
21
21
  import {
22
22
  parseJsonObjectBody
@@ -16,7 +16,7 @@ import {
16
16
  resolveUserTangleExecutionKeyForUser,
17
17
  tangleExecutionKeyHttpError,
18
18
  trimOrNull
19
- } from "../chunk-JML7WKWU.js";
19
+ } from "../chunk-CP36C5LZ.js";
20
20
  import {
21
21
  MAX_RECOMMENDED_MODELS,
22
22
  __resetCatalogCache,
@@ -4,7 +4,8 @@
4
4
  * Every Tangle agent product resolves the SAME thing from env: the Tangle Router
5
5
  * (OpenAI-compatible, metered at the platform markup against a single
6
6
  * `TANGLE_API_KEY`) by default, with a direct-Anthropic BYOK escape hatch. The
7
- * shape feeds the sandbox SDK's `backend.model`. Lifted here so no product
7
+ * shape feeds the sandbox backend's role-named model fields (see
8
+ * `backendModelFields`). Lifted here so no product
8
9
  * hand-rolls the env parsing + the router default.
9
10
  */
10
11
  export interface TangleModelConfig {
@@ -7,10 +7,10 @@ import { type TangleExecutionEnvironment } from '../runtime/model';
7
7
  import { type Outcome } from './outcome';
8
8
  import { type ProfileFingerprint } from '../profile/fingerprint';
9
9
  import { type ComposeProfileBudget } from '../profile/budget';
10
- import { resolveModel, resolveModelSelection, requireTransportableModel, SandboxModelResolutionError, type ProviderResolutionConfig, type ResolvedModel, type ModelSelection, type ModelSelectionFailure, type ModelSelectionError, type ModelSelectionSource } from './model';
10
+ import { resolveModel, resolveModelSelection, backendModelFields, requireTransportableModel, SandboxModelResolutionError, type ProviderResolutionConfig, type ResolvedModel, type ModelSelection, type ModelSelectionFailure, type ModelSelectionError, type ModelSelectionSource } from './model';
11
11
  export type { Outcome } from './outcome';
12
12
  export * from './binary-read';
13
- export { resolveModel, resolveModelSelection, requireTransportableModel, SandboxModelResolutionError, };
13
+ export { resolveModel, resolveModelSelection, backendModelFields, requireTransportableModel, SandboxModelResolutionError, };
14
14
  export type { ProviderResolutionConfig, ResolvedModel, ModelSelection, ModelSelectionFailure, ModelSelectionError, ModelSelectionSource, };
15
15
  /** Define client credentials for accessing the sandbox environment with API key and base URL */
16
16
  export interface SandboxClientCredentials {
@@ -706,9 +706,18 @@ export type SandboxPromptConfig = Pick<SandboxRuntimeConfig, 'provider' | 'defer
706
706
  * Reuse the returned backend for preflight and dispatch so they inspect identical configuration.
707
707
  */
708
708
  export declare function resolveSandboxPromptBackend(shell: SandboxPromptConfig, options: StreamSandboxPromptOptions, operation?: string): Promise<{
709
+ modelId?: string | undefined;
710
+ provider?: string | undefined;
711
+ apiKey?: string;
712
+ baseUrl?: string;
713
+ model?: {
714
+ model: string;
715
+ provider: string;
716
+ apiKey?: string;
717
+ baseUrl?: string;
718
+ } | undefined;
709
719
  type: Harness;
710
720
  profile: AgentProfile;
711
- model?: ResolvedModel | undefined;
712
721
  interactions?: {
713
722
  question?: boolean;
714
723
  permission?: boolean;
@@ -31,6 +31,7 @@ import {
31
31
  assertProvisionPayloadWithinCap,
32
32
  assessWorkspaceSandboxSnapshot,
33
33
  attachReasoningEffort,
34
+ backendModelFields,
34
35
  buildAppToolMcpServers,
35
36
  buildProductEgressPolicy,
36
37
  buildSandboxToolBinDirScript,
@@ -99,7 +100,7 @@ import {
99
100
  workspaceSandboxRecoveryMessage,
100
101
  workspaceSandboxRecoveryRecommendedActions,
101
102
  writeProfileFilesToBox
102
- } from "../chunk-2TZLCQ5U.js";
103
+ } from "../chunk-4KFM7VTH.js";
103
104
  import "../chunk-MCYJON3F.js";
104
105
  import "../chunk-LWSJK546.js";
105
106
  import "../chunk-P2GXQRFR.js";
@@ -109,7 +110,7 @@ import "../chunk-UGWQLQDS.js";
109
110
  import "../chunk-S5SRJJQG.js";
110
111
  import "../chunk-LFMP73W3.js";
111
112
  import "../chunk-T52MKPHE.js";
112
- import "../chunk-JML7WKWU.js";
113
+ import "../chunk-CP36C5LZ.js";
113
114
  export {
114
115
  DEFAULT_FOREGROUND_PROVISION_CLAIM_TTL_SECONDS,
115
116
  DEFAULT_FOREGROUND_PROVISION_POLL_INTERVAL_MS,
@@ -143,6 +144,7 @@ export {
143
144
  assertProvisionPayloadWithinCap,
144
145
  assessWorkspaceSandboxSnapshot,
145
146
  attachReasoningEffort,
147
+ backendModelFields,
146
148
  buildAppToolMcpServers,
147
149
  buildProductEgressPolicy,
148
150
  buildSandboxToolBinDirScript,
@@ -9,6 +9,29 @@ export interface ProviderResolutionConfig {
9
9
  allowKeylessModel?: boolean;
10
10
  }
11
11
  /** Represent a fully configured model with optional API key and base URL for sandbox platform integration */
12
+ /**
13
+ * Spread a {@link ResolvedModel} onto a sandbox backend config as role-named
14
+ * fields. The model id's home on a standalone backend is `modelId`; routing
15
+ * rides `provider`/`apiKey`/`baseUrl` flat — the SDK folds them onto the wire.
16
+ *
17
+ * The deprecated nested `model` object rides along while agent-app's peer
18
+ * range still admits pre-fold SDK versions (< the 0.60.14 develop train):
19
+ * old SDKs forward only the nested object and drop the unknown flat fields,
20
+ * fold-aware SDKs see two AGREEING spellings and fold them. Delete the
21
+ * nested half when the peer floor moves past the fold.
22
+ */
23
+ export declare function backendModelFields(model: ResolvedModel): {
24
+ modelId: string;
25
+ provider: string;
26
+ apiKey?: string;
27
+ baseUrl?: string;
28
+ model: {
29
+ model: string;
30
+ provider: string;
31
+ apiKey?: string;
32
+ baseUrl?: string;
33
+ };
34
+ };
12
35
  export interface ResolvedModel {
13
36
  model: string;
14
37
  provider: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.53.7",
3
+ "version": "0.53.9",
4
4
  "packageManager": "pnpm@11.24.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [