@tangle-network/agent-runtime 0.131.4 → 0.131.6

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.
Files changed (47) hide show
  1. package/README.md +2 -2
  2. package/dist/{activation-Dj_M4QiT.js → activation-D-gsrgSq.js} +2 -2
  3. package/dist/{activation-Dj_M4QiT.js.map → activation-D-gsrgSq.js.map} +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{authoring-Bxlrj57J.js → authoring-DI778qK7.js} +2 -2
  6. package/dist/{authoring-Bxlrj57J.js.map → authoring-DI778qK7.js.map} +1 -1
  7. package/dist/{conversation-DNtxaJ1Z.js → conversation-9ZmilKp8.js} +3 -3
  8. package/dist/{conversation-DNtxaJ1Z.js.map → conversation-9ZmilKp8.js.map} +1 -1
  9. package/dist/conversation.js +1 -1
  10. package/dist/{graph-2jIp3YIw.js → graph-CoN60QtH.js} +2 -2
  11. package/dist/{graph-2jIp3YIw.js.map → graph-CoN60QtH.js.map} +1 -1
  12. package/dist/{improvement-cycle-DPXRULfN.js → improvement-cycle-BGF0osPC.js} +5 -5
  13. package/dist/{improvement-cycle-DPXRULfN.js.map → improvement-cycle-BGF0osPC.js.map} +1 -1
  14. package/dist/index.js +10 -10
  15. package/dist/index.js.map +1 -1
  16. package/dist/intelligence.js +3 -3
  17. package/dist/kernel.js +8 -8
  18. package/dist/{knowledge-C7Gly1cw.js → knowledge-D4zNvxw5.js} +5 -5
  19. package/dist/{knowledge-C7Gly1cw.js.map → knowledge-D4zNvxw5.js.map} +1 -1
  20. package/dist/knowledge.js +1 -1
  21. package/dist/{loop-runner-bin-Bt9qFNkq.js → loop-runner-bin-CI9Y0sxT.js} +3 -3
  22. package/dist/{loop-runner-bin-Bt9qFNkq.js.map → loop-runner-bin-CI9Y0sxT.js.map} +1 -1
  23. package/dist/loop-runner-bin.js +1 -1
  24. package/dist/{materialization-COJ1UYQ-.js → materialization-DBXuH34A.js} +2 -2
  25. package/dist/{materialization-COJ1UYQ-.js.map → materialization-DBXuH34A.js.map} +1 -1
  26. package/dist/mcp/bin.js +3 -3
  27. package/dist/mcp/index.js +5 -5
  28. package/dist/{model-policy-CqziaqS1.js → model-policy-mWSoToiQ.js} +3 -2
  29. package/dist/model-policy-mWSoToiQ.js.map +1 -0
  30. package/dist/{openai-tools-U-hmk_yS.js → openai-tools-CupeHJEv.js} +2 -2
  31. package/dist/{openai-tools-U-hmk_yS.js.map → openai-tools-CupeHJEv.js.map} +1 -1
  32. package/dist/profiles.js +1 -1
  33. package/dist/{researcher-Skz5-Uc8.js → researcher-CYmr4VJy.js} +2 -2
  34. package/dist/{researcher-Skz5-Uc8.js.map → researcher-CYmr4VJy.js.map} +1 -1
  35. package/dist/{runtime-BG6VzXf0.js → runtime-ZNVnT8h1.js} +9 -9
  36. package/dist/{runtime-BG6VzXf0.js.map → runtime-ZNVnT8h1.js.map} +1 -1
  37. package/dist/{stream-agent-turn-rYgaOLO0.js → stream-agent-turn-DE8_alvm.js} +3 -3
  38. package/dist/{stream-agent-turn-rYgaOLO0.js.map → stream-agent-turn-DE8_alvm.js.map} +1 -1
  39. package/dist/{structural-rollout-C5iljirr.js → structural-rollout-n089ZP33.js} +5 -5
  40. package/dist/{structural-rollout-C5iljirr.js.map → structural-rollout-n089ZP33.js.map} +1 -1
  41. package/dist/{supervise-eOjGprUt.js → supervise-msTRhTN7.js} +4 -4
  42. package/dist/{supervise-eOjGprUt.js.map → supervise-msTRhTN7.js.map} +1 -1
  43. package/dist/{supervisor-BHS7T4HN.js → supervisor-C16p9KqO.js} +3 -3
  44. package/dist/{supervisor-BHS7T4HN.js.map → supervisor-C16p9KqO.js.map} +1 -1
  45. package/dist/testing.js +11 -11
  46. package/package.json +4 -4
  47. package/dist/model-policy-CqziaqS1.js.map +0 -1
package/dist/testing.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { $ as parseExactAgentProfile, K as applyExactAgentProfileDiff, rt as canonicalCandidateDigest$1, st as immutableCandidateValue } from "./prepare-DYWjVcPx.js";
2
- import { f as verifyAgentImprovementProposal } from "./improvement-cycle-DPXRULfN.js";
3
- import { c as supervisorAgentWithTestBrain, dt as driverAgent, r as superviseWithTestBrain } from "./supervise-eOjGprUt.js";
4
- import { i as runGraphWithTestBrain } from "./graph-2jIp3YIw.js";
2
+ import { f as verifyAgentImprovementProposal } from "./improvement-cycle-BGF0osPC.js";
3
+ import { c as supervisorAgentWithTestBrain, dt as driverAgent, r as superviseWithTestBrain } from "./supervise-msTRhTN7.js";
4
+ import { i as runGraphWithTestBrain } from "./graph-CoN60QtH.js";
5
5
  import { SANDBOX_SIZE_PRESET_NAMES } from "@tangle-network/agent-interface";
6
6
  //#region src/testing/fixtures/agent-improvement-proposal.json
7
7
  var agent_improvement_proposal_default = {
8
8
  changedSurfaces: ["prompt"],
9
- digest: "sha256:412a4548f087493c4dcedc1888e565cde1fa7f8749035f80bfcf07a5f2df3dcf",
9
+ digest: "sha256:ea2264c3958b513429fdc9aedac1908755ab6c9ba23f6bfcae6e9d5286f62a1f",
10
10
  evaluation: {
11
11
  "decision": {
12
12
  "contributingChecks": [
@@ -4565,7 +4565,7 @@ var agent_improvement_proposal_default = {
4565
4565
  ],
4566
4566
  "metadata": {
4567
4567
  "fixture": "agent-improvement-proposal",
4568
- "runtimeVersion": "0.131.4"
4568
+ "runtimeVersion": "0.131.6"
4569
4569
  },
4570
4570
  "objectives": [
4571
4571
  {
@@ -4676,8 +4676,8 @@ var agent_improvement_proposal_default = {
4676
4676
  "baselineContentHash": "sha256:5c21ee53e513fc604cb09754e21c392b24a424da0ef37dbf8f1ee4a8a0b08f09",
4677
4677
  "candidateContentHash": "sha256:60fcbb1c728194bd51d7d19cb732d1c3f1881dce7e0a6266b41c8b98cfd65693",
4678
4678
  "kind": "agent-eval-loop",
4679
- "recordDigest": "sha256:42d2b8a2030ee02b698d3e8a70e96a7f6e224360f8ffa499040e570fc1bd6cb3",
4680
- "runId": "agent-runtime-0.131.4-proposal-fixture",
4679
+ "recordDigest": "sha256:e7b3f7a45005bc6ebf9e387b020998aa5c0c4757157062aafc99d21c27fce45e",
4680
+ "runId": "agent-runtime-0.131.6-proposal-fixture",
4681
4681
  "schema": "agent-candidate-experiment"
4682
4682
  }
4683
4683
  },
@@ -4700,13 +4700,13 @@ var agent_improvement_proposal_default = {
4700
4700
  }],
4701
4701
  kind: "agent-improvement-proposal",
4702
4702
  proposedAt: "2026-07-10T01:00:00.000Z",
4703
- runId: "agent-runtime-0.131.4-proposal-fixture"
4703
+ runId: "agent-runtime-0.131.6-proposal-fixture"
4704
4704
  };
4705
4705
  //#endregion
4706
4706
  //#region src/testing/fixtures/agent-profile-improvement-proposal.json
4707
4707
  var agent_profile_improvement_proposal_default = {
4708
4708
  changedSurfaces: ["prompt", "skills"],
4709
- digest: "sha256:20928b389353905bf2a5eab122c82be293eb422aff4051070dc18f15dff30214",
4709
+ digest: "sha256:d26535ffd6c9a75d66d3eacf1b034436f7b0e6bed06e969b06556f54bb1b7794",
4710
4710
  evaluation: {
4711
4711
  "decision": {
4712
4712
  "contributingChecks": [
@@ -6340,7 +6340,7 @@ var agent_profile_improvement_proposal_default = {
6340
6340
  ],
6341
6341
  "metadata": {
6342
6342
  "fixture": "agent-profile-improvement-proposal",
6343
- "runtimeVersion": "0.131.4"
6343
+ "runtimeVersion": "0.131.6"
6344
6344
  },
6345
6345
  "objectives": [
6346
6346
  {
@@ -6451,7 +6451,7 @@ var agent_profile_improvement_proposal_default = {
6451
6451
  "baselineContentHash": "sha256:21c495a37c418c10bde64fbaa188beddeed31f1f051ea60a6a6582a9ee0db704",
6452
6452
  "candidateContentHash": "sha256:103f77bc8481601eef1ad5fe6ba84a40dffabc3a44f421f8c8559121edab84e9",
6453
6453
  "kind": "agent-eval-loop",
6454
- "recordDigest": "sha256:a9f90751d28a16e1862e4aa15585fbe828eeb8ec89369579592d769667c1647b",
6454
+ "recordDigest": "sha256:c32575ab9a595a298f30fb24e87d6081c67c9da04fdc11753b4bd169f9b00b96",
6455
6455
  "runId": "profile-improvement-1",
6456
6456
  "schema": "agent-profile-improvement-experiment"
6457
6457
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-runtime",
3
- "version": "0.131.4",
3
+ "version": "0.131.6",
4
4
  "description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
5
5
  "homepage": "https://github.com/tangle-network/agent-runtime#readme",
6
6
  "repository": {
@@ -118,7 +118,7 @@
118
118
  "@arethetypeswrong/cli": "0.18.5",
119
119
  "@modelcontextprotocol/sdk": "1.30.0",
120
120
  "@biomejs/biome": "^2.5.5",
121
- "@tangle-network/agent-eval": "0.144.6",
121
+ "@tangle-network/agent-eval": "0.144.8",
122
122
  "@tangle-network/agent-interface": "0.46.1",
123
123
  "@tangle-network/sandbox": "0.19.4",
124
124
  "@types/node": "26.1.1",
@@ -139,7 +139,7 @@
139
139
  },
140
140
  "license": "MIT",
141
141
  "peerDependencies": {
142
- "@tangle-network/agent-eval": ">=0.144.6 <0.145.0",
142
+ "@tangle-network/agent-eval": ">=0.144.8 <0.145.0",
143
143
  "@tangle-network/agent-interface": ">=0.46.1 <0.47.0",
144
144
  "@tangle-network/sandbox": ">=0.19.4 <0.20.0"
145
145
  },
@@ -150,7 +150,7 @@
150
150
  },
151
151
  "dependencies": {
152
152
  "@tangle-network/agent-core": "0.5.4",
153
- "@tangle-network/agent-knowledge": "7.1.2",
153
+ "@tangle-network/agent-knowledge": "7.1.3",
154
154
  "@tangle-network/agent-profile-materialize": "0.13.1",
155
155
  "@tangle-network/agent-trace-contract": "^1.0.2",
156
156
  "tar-stream": "3.2.0"
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-policy-CqziaqS1.js","names":["positiveInteger"],"sources":["../src/runtime/harness-role.ts","../src/runtime/router-retry-policy.ts","../src/runtime/supervise/model-policy.ts"],"sourcesContent":["/**\n * Which `HarnessType` values name a real coding-agent runtime, and which name a MODE that has no\n * agent behind it.\n *\n * `cli-base` is the router-backed mode — a plain multi-turn router call with no coding-agent\n * harness (`@tangle-network/agent-interface`'s `HarnessType` doc, and the same table's\n * `harnessReasoningCeiling['cli-base'] = 'none'` commented \"cli-base has no agent\"). The\n * distinction is REAL; what was accidental is that three call sites each spelled the test\n * themselves, so a second no-agent mode would have to be remembered in three places.\n *\n * SHOULD UPSTREAM: this belongs next to `harnessHonorsEffort` in agent-interface's\n * `harness-capabilities.ts`, which already encodes the fact but exports no predicate for it.\n * Until it does, this is the one local copy — extend the set here, never re-test the name.\n */\n\nimport type { HarnessType } from '@tangle-network/agent-interface'\n\n/**\n * Harness ids that select a router/no-agent mode rather than a coding-agent runtime.\n *\n * `nanoclaw` is deliberately ABSENT: the shared capability table clamps its reasoning ceiling the\n * same way it clamps `cli-base`, but nanoclaw does run an agent (a socket-bridge runner to the\n * NanoClaw daemon) and every caller here treats it as a full harness. Add a row only with the\n * behavior change stated, never to make the two clamps look symmetric.\n */\nconst NO_AGENT_HARNESSES: ReadonlySet<string> = new Set<string>(['cli-base' satisfies HarnessType])\n\n/** Whether this profile harness selects a real coding-agent runtime (vs. the router/no-agent mode\n * or no preference at all). Accepts the looser `string` some local profile shapes declare, and\n * preserves the caller's own harness type when it is narrower. */\nexport function harnessRunsAgent<T extends string>(harness: T | null | undefined): harness is T {\n return harness != null && !NO_AGENT_HARNESSES.has(harness)\n}\n\n/** The coding-agent harness this profile selects, or `undefined` when it selects none — the shape\n * callers want when a no-agent mode must fall through to the router arm. */\nexport function agentHarness<T extends string>(harness: T | null | undefined): T | undefined {\n return harnessRunsAgent(harness) ? harness : undefined\n}\n","import { ValidationError } from '../errors'\n\n/** Exact retry controls accepted at `AgentProfile.model.metadata.retry`. */\nexport interface RouterRetryPolicy {\n /** Total attempts, including the first request. */\n readonly maxAttempts?: number\n /** Delay before the second attempt. Later delays grow exponentially. */\n readonly initialBackoffMs?: number\n /** Maximum delay between attempts. */\n readonly maxBackoffMs?: number\n /** Symmetric random variation around each delay, from 0 through 1. */\n readonly jitter?: number\n /** HTTP statuses that may be retried. */\n readonly retryStatuses?: ReadonlyArray<number>\n /** Deadline for receiving one attempt's response headers. Zero disables it. */\n readonly requestTimeoutMs?: number\n}\n\nexport interface ResolvedRouterRetryPolicy {\n readonly maxAttempts: number\n readonly initialBackoffMs: number\n readonly maxBackoffMs: number\n readonly jitter: number\n readonly retryStatuses: ReadonlyArray<number>\n readonly requestTimeoutMs: number\n}\n\nconst maximumTimerMs = 2_147_483_647\nconst defaultRetryStatuses = Object.freeze([408, 425, 429, 500, 502, 503, 504, 520, 522, 524])\nconst retryPolicyKeys = new Set([\n 'initialBackoffMs',\n 'jitter',\n 'maxAttempts',\n 'maxBackoffMs',\n 'requestTimeoutMs',\n 'retryStatuses',\n])\n\n/** Parse untrusted profile/config data once and return an immutable complete policy. */\nexport function resolveRouterRetryPolicy(\n input: unknown,\n context: string,\n): ResolvedRouterRetryPolicy {\n if (\n input !== undefined &&\n (typeof input !== 'object' || input === null || Array.isArray(input))\n ) {\n throw new ValidationError(`${context} must be an object`)\n }\n const policy = input === undefined ? {} : Object.fromEntries(Object.entries(input))\n const unknown = Object.keys(policy).filter((key) => !retryPolicyKeys.has(key))\n if (unknown.length > 0) {\n throw new ValidationError(`${context} has unsupported fields: ${unknown.join(', ')}`)\n }\n const maxAttempts = positiveInteger(policy.maxAttempts, 5, `${context}.maxAttempts`)\n const initialBackoffMs = timerInteger(\n policy.initialBackoffMs,\n 1_000,\n `${context}.initialBackoffMs`,\n )\n const maxBackoffMs = timerInteger(policy.maxBackoffMs, 30_000, `${context}.maxBackoffMs`)\n const requestTimeoutMs = timerInteger(policy.requestTimeoutMs, 0, `${context}.requestTimeoutMs`)\n const jitter = policy.jitter ?? 0.25\n if (typeof jitter !== 'number' || !Number.isFinite(jitter) || jitter < 0 || jitter > 1) {\n throw new ValidationError(`${context}.jitter must be a finite number from 0 through 1`)\n }\n const retryStatuses = parseRetryStatuses(policy.retryStatuses, context)\n return Object.freeze({\n maxAttempts,\n initialBackoffMs,\n maxBackoffMs,\n jitter,\n retryStatuses,\n requestTimeoutMs,\n })\n}\n\nfunction parseRetryStatuses(value: unknown, context: string): ReadonlyArray<number> {\n if (value === undefined) return defaultRetryStatuses\n if (!Array.isArray(value)) {\n throw new ValidationError(`${context}.retryStatuses must be an array of HTTP statuses`)\n }\n const statuses: number[] = []\n const seen = new Set<number>()\n for (const status of value) {\n if (!Number.isSafeInteger(status) || status < 100 || status > 599) {\n throw new ValidationError(\n `${context}.retryStatuses must contain integer HTTP statuses from 100 through 599`,\n )\n }\n if (seen.has(status)) {\n throw new ValidationError(`${context}.retryStatuses must not contain duplicates`)\n }\n seen.add(status)\n statuses.push(status)\n }\n return Object.freeze(statuses)\n}\n\nfunction positiveInteger(value: unknown, fallback: number, context: string): number {\n const parsed = value ?? fallback\n if (typeof parsed !== 'number' || !Number.isSafeInteger(parsed) || parsed < 1) {\n throw new ValidationError(`${context} must be a positive safe integer`)\n }\n return parsed\n}\n\nfunction timerInteger(value: unknown, fallback: number, context: string): number {\n const parsed = value ?? fallback\n if (\n typeof parsed !== 'number' ||\n !Number.isSafeInteger(parsed) ||\n parsed < 0 ||\n parsed > maximumTimerMs\n ) {\n throw new ValidationError(\n `${context} must be a nonnegative safe integer no greater than ${maximumTimerMs}`,\n )\n }\n return parsed\n}\n","/**\n * `assertModelAllowed` — a fail-loud guard that restricts a run to a chosen subset of\n * models. The two front doors (`supervise()` / `improve()`) call it once per configured\n * model at resolve time, so a run that names a model outside the allowed set throws before\n * any compute is spent — never silently swapped or silently allowed.\n */\nimport { HARNESS_NATIVE_MODEL } from '@tangle-network/agent-eval'\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport { ConfigError } from '../../errors'\nimport { agentHarness } from '../harness-role'\nimport { type ResolvedRouterRetryPolicy, resolveRouterRetryPolicy } from '../router-retry-policy'\n\n/**\n * Return the model id an executor may send to a provider.\n *\n * Eval stamps {@link HARNESS_NATIVE_MODEL} into a profile when model selection is deliberately\n * delegated to the configured runtime. That marker belongs in experiment identity and cost\n * admission; it is not a provider model id.\n */\nexport function concreteModelId(model: string | undefined): string | undefined {\n if (model === undefined) return undefined\n const id = model.trim()\n return id.length > 0 && !isHarnessNativeModel(id) ? id : undefined\n}\n\n/** Whether a model value delegates selection to the chosen execution system. */\nexport function isHarnessNativeModel(model: string | undefined): boolean {\n return model?.trim() === HARNESS_NATIVE_MODEL\n}\n\n/** Return a profile's explicitly selected provider model, if it has one. */\nexport function concreteProfileModel(profile: Pick<AgentProfile, 'model'>): string | undefined {\n return concreteModelId(profile.model?.default)\n}\n\n/** The provider-facing model id declared by a profile. Direct Router execution uses this form:\n * the endpoint already selects the provider, so the model id itself is not harness-prefixed. */\nexport function profileProviderModel(profile: Pick<AgentProfile, 'model'>): string | undefined {\n return concreteProfileModel(profile)\n}\n\n/** The full cli-bridge wire id declared by a profile: harness/provider/model. */\nexport function profileBridgeWireModel(\n profile: Pick<AgentProfile, 'harness' | 'model'>,\n): string | undefined {\n const model = concreteProfileModel(profile)\n const provider = profile.model?.provider\n const providerModel = model\n ? provider && !model.includes('/')\n ? `${provider}/${model}`\n : model\n : undefined\n const harness = agentHarness(profile.harness)\n if (!harness) return providerModel\n if (!providerModel) return harness\n return providerModel.startsWith(`${harness}/`) ? providerModel : `${harness}/${providerModel}`\n}\n\n/**\n * Refuse an incomplete execution identity before any backend may fill it from ambient config.\n * `AgentProfile` is the sole behavioral authority: harness, provider, and concrete model all\n * participate in its digest. Eval's runtime-selected marker is a matrix-planning value, never an\n * executable model.\n */\nexport function assertExecutableAgentProfile(profile: AgentProfile, context: string): void {\n if (profile.harness === undefined) {\n throw new ConfigError(`${context}: AgentProfile.harness must be explicit before execution`)\n }\n const declared = profile.model?.default\n const model = concreteModelId(declared)\n if (!model) {\n const reason = isHarnessNativeModel(declared) ? 'runtime-selected' : 'missing'\n throw new ConfigError(\n `${context}: AgentProfile.model.default is ${reason}; execution requires a concrete model`,\n )\n }\n if (!profile.model?.provider?.trim()) {\n throw new ConfigError(\n `${context}: AgentProfile.model.provider must be explicit before execution`,\n )\n }\n}\n\n/** Generation and loop controls that may affect one model execution. */\nexport interface ProfileModelExecutionSettings {\n readonly temperature?: number\n readonly maxTokens?: number\n readonly retry?: ResolvedRouterRetryPolicy\n readonly seed?: number\n readonly toolChoice?: 'auto' | 'required' | 'none'\n readonly extraBody?: Readonly<Record<string, unknown>>\n /** Zero means no turn-count cap; conserved budgets and deadlines still apply. */\n readonly maxTurns?: number\n readonly stream?: boolean\n}\n\nconst PROFILE_MODEL_METADATA_KEYS = new Set([\n 'extraBody',\n 'maxTokens',\n 'maxTurns',\n 'retry',\n 'seed',\n 'stream',\n 'temperature',\n 'toolChoice',\n])\n\n/**\n * Read every Router-affecting control from the exact profile and reject unknown controls.\n * Backends receive endpoint/auth and executable ports only; they cannot silently alter behavior.\n */\nexport function profileModelExecutionSettings(\n profile: Pick<AgentProfile, 'model'>,\n context: string,\n): ProfileModelExecutionSettings {\n const metadata = profile.model?.metadata ?? {}\n const unknown = Object.keys(metadata).filter((key) => !PROFILE_MODEL_METADATA_KEYS.has(key))\n if (unknown.length > 0) {\n throw new ConfigError(\n `${context}: unsupported AgentProfile.model.metadata fields: ${unknown.join(', ')}`,\n )\n }\n const temperature = finiteNumber(metadata.temperature, `${context}: temperature`)\n const maxTokens = positiveInteger(metadata.maxTokens, `${context}: maxTokens`)\n const retryInput = metadata.retry\n const retry =\n retryInput === undefined\n ? undefined\n : resolveRouterRetryPolicy(retryInput, `${context}: AgentProfile.model.metadata.retry`)\n const seed = safeInteger(metadata.seed, `${context}: seed`)\n const maxTurns = nonnegativeInteger(metadata.maxTurns, `${context}: maxTurns`)\n const stream = optionalBoolean(metadata.stream, `${context}: stream`)\n const toolChoice = metadata.toolChoice\n if (\n toolChoice !== undefined &&\n toolChoice !== 'auto' &&\n toolChoice !== 'required' &&\n toolChoice !== 'none'\n ) {\n throw new ConfigError(`${context}: toolChoice must be auto, required, or none`)\n }\n const extraBody = metadata.extraBody\n if (\n extraBody !== undefined &&\n (typeof extraBody !== 'object' || extraBody === null || Array.isArray(extraBody))\n ) {\n throw new ConfigError(`${context}: extraBody must be an object`)\n }\n return {\n ...(temperature !== undefined ? { temperature } : {}),\n ...(maxTokens !== undefined ? { maxTokens } : {}),\n ...(retry !== undefined ? { retry } : {}),\n ...(seed !== undefined ? { seed } : {}),\n ...(toolChoice !== undefined ? { toolChoice } : {}),\n ...(extraBody !== undefined\n ? { extraBody: Object.freeze({ ...(extraBody as Record<string, unknown>) }) }\n : {}),\n ...(maxTurns !== undefined ? { maxTurns } : {}),\n ...(stream !== undefined ? { stream } : {}),\n }\n}\n\nfunction finiteNumber(value: unknown, context: string): number | undefined {\n if (value === undefined) return undefined\n if (typeof value !== 'number' || !Number.isFinite(value)) {\n throw new ConfigError(`${context} must be a finite number`)\n }\n return value\n}\n\nfunction safeInteger(value: unknown, context: string): number | undefined {\n if (value === undefined) return undefined\n if (!Number.isSafeInteger(value)) throw new ConfigError(`${context} must be a safe integer`)\n return value as number\n}\n\nfunction positiveInteger(value: unknown, context: string): number | undefined {\n const parsed = safeInteger(value, context)\n if (parsed !== undefined && parsed < 1) {\n throw new ConfigError(`${context} must be positive`)\n }\n return parsed\n}\n\nfunction nonnegativeInteger(value: unknown, context: string): number | undefined {\n const parsed = safeInteger(value, context)\n if (parsed !== undefined && parsed < 0) {\n throw new ConfigError(`${context} must be nonnegative`)\n }\n return parsed\n}\n\nfunction optionalBoolean(value: unknown, context: string): boolean | undefined {\n if (value === undefined) return undefined\n if (typeof value !== 'boolean') throw new ConfigError(`${context} must be boolean`)\n return value\n}\n\n/**\n * Throw a `ConfigError` when `allowed` is set, `model` is defined, and `model` is not a\n * member of `allowed`. No-op when `allowed` is unset (the unrestricted default) or when\n * `model` is undefined (nothing was configured to check).\n */\nexport function assertModelAllowed(\n model: string | undefined,\n allowed: readonly string[] | undefined,\n): void {\n if (!allowed || model === undefined) return\n if (!allowed.includes(model)) {\n throw new ConfigError(\n `model ${JSON.stringify(model)} is not in the allowed set ${JSON.stringify([...allowed])}`,\n )\n }\n}\n\n/** Check every canonical model-bearing field in a complete profile, including the models a\n * backend may select for cheap work, named subagents, or modes. */\nexport function assertProfileModelsAllowed(\n profile: AgentProfile,\n allowed: readonly string[] | undefined,\n): void {\n assertModelAllowed(profile.model?.default, allowed)\n assertModelAllowed(profile.model?.small, allowed)\n for (const subagent of Object.values(profile.subagents ?? {})) {\n assertModelAllowed(subagent.model, allowed)\n }\n for (const mode of Object.values(profile.modes ?? {})) {\n assertModelAllowed(mode.model, allowed)\n }\n}\n"],"mappings":";;;;;;;;;;;AAyBA,MAAM,qCAA0C,IAAI,IAAY,CAAC,UAAgC,CAAC;;;;AAKlG,SAAgB,iBAAmC,SAA6C;CAC9F,OAAO,WAAW,QAAQ,CAAC,mBAAmB,IAAI,OAAO;AAC3D;;;AAIA,SAAgB,aAA+B,SAA8C;CAC3F,OAAO,iBAAiB,OAAO,IAAI,UAAU,KAAA;AAC/C;;;ACXA,MAAM,iBAAiB;AACvB,MAAM,uBAAuB,OAAO,OAAO;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG,CAAC;AAC7F,MAAM,kCAAkB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAGD,SAAgB,yBACd,OACA,SAC2B;CAC3B,IACE,UAAU,KAAA,MACT,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,IAEnE,MAAM,IAAI,gBAAgB,GAAG,QAAQ,mBAAmB;CAE1D,MAAM,SAAS,UAAU,KAAA,IAAY,CAAC,IAAI,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC;CAClF,MAAM,UAAU,OAAO,KAAK,MAAM,CAAC,CAAC,QAAQ,QAAQ,CAAC,gBAAgB,IAAI,GAAG,CA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