@theokit/agents 6.0.0 → 6.1.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.
@@ -3,6 +3,7 @@ import { SystemPromptResolver, InlineSkill, SettingSource, MemorySettings, Skill
3
3
  import { z } from 'zod';
4
4
  import { UIMessageChunk } from 'ai';
5
5
  import { RetryOptions } from '@theokit/sdk/retry';
6
+ import { TheokitAgentError } from '@theokit/sdk/errors';
6
7
 
7
8
  /**
8
9
  * Provider-agnostic extended-thinking knob (M1 reasoning-visibility). The common set autocompletes;
@@ -1150,9 +1151,27 @@ declare function toAgentFactory(def: DefinicaoOuThunk, opts: {
1150
1151
  /**
1151
1152
  * Build the SDK `ModelSelection` for a model id + optional reasoning effort. With no (or empty)
1152
1153
  * effort it returns the bare `{ id }` — byte-identical to the prior behavior (backward-compat). With
1153
- * an effort it adds the canonical reasoning param `{ id: 'thinking', value: effort }`. Pure.
1154
+ * an effort it adds the canonical reasoning param `{ id: PARAM_THINKING, value: effort }`. Pure.
1154
1155
  */
1155
1156
  declare function buildModelSelection(model: string | ModelSelection, effort?: ReasoningEffort): ModelSelection;
1157
+ /**
1158
+ * Read the reasoning effort back out of a model selection — the inverse of
1159
+ * {@link buildModelSelection}, and the reason this module owns the param key.
1160
+ *
1161
+ * Returns `undefined` when there is no effort to read: a bare-string model id (no params to carry
1162
+ * one), a selection without `params`, or params that do not include the reasoning key. Absence is a
1163
+ * DECLARED state, not an exceptional one, so none of those throw.
1164
+ *
1165
+ * A present-but-unrecognised value is returned VERBATIM. Validating it belongs to the caller (which
1166
+ * already has its own parser); hijacking that here would widen the layer's responsibility with
1167
+ * nobody asking. Pure.
1168
+ *
1169
+ * The return is `string`, not {@link ReasoningEffort}, precisely BECAUSE the value is unvalidated:
1170
+ * whatever is in the document comes back, and typing it as the semi-closed union would promise a
1171
+ * check this function deliberately does not perform. Assigning the result to a `ReasoningEffort` is
1172
+ * the caller's decision, after the caller's own parse.
1173
+ */
1174
+ declare function reasoningEffortOf(model: string | ModelSelection): string | undefined;
1156
1175
 
1157
1176
  /**
1158
1177
  * `<think>`-tag reasoning extractor (M2 reasoning-visibility) — bridge middleware.
@@ -2073,6 +2092,30 @@ type McpApprovalSpec = HumanInTheLoopOptions | string;
2073
2092
  */
2074
2093
  declare function mcpToolApprovals(specs: Record<string, McpApprovalSpec>): Record<string, HumanInTheLoopOptions>;
2075
2094
 
2095
+ /**
2096
+ * Raised when `<cwd>/.mcp.json` exists but cannot be read, is not valid JSON, or does not match the
2097
+ * expected shape — never swallowed.
2098
+ *
2099
+ * It descends from {@link TheokitAgentError} rather than bare `Error` on purpose: `isTransientError`
2100
+ * requires that hierarchy, so a parallel one would make the predicate that separates recoverable
2101
+ * from unrecoverable useless for this error. `isRetryable` stays `false` — a malformed config file
2102
+ * does not get better by trying again.
2103
+ */
2104
+ declare class McpFileError extends TheokitAgentError {
2105
+ readonly name = "McpFileError";
2106
+ constructor(message: string);
2107
+ }
2108
+ /**
2109
+ * Load the MCP servers declared in `<cwd>/.mcp.json`.
2110
+ *
2111
+ * Returns an empty map when the file is absent (MCP is opt-in) and when the document is a valid JSON
2112
+ * object without an `mcpServers` key (a project that declares no server). Throws {@link McpFileError}
2113
+ * on a read failure, invalid JSON, or any shape violation.
2114
+ *
2115
+ * Reading is explicit — this module has no import-time side effect.
2116
+ */
2117
+ declare function loadMcpJson(cwd: string): McpServersMap;
2118
+
2076
2119
  /**
2077
2120
  * Agent manifest generator — build-time JSON describing all agents, tools, guards, policies.
2078
2121
  *
@@ -2218,4 +2261,4 @@ declare function agentsPlugin(opts: AgentsPluginOptions): {
2218
2261
  register(app: PluginApp): void;
2219
2262
  };
2220
2263
 
2221
- export { type DelegateOptions as $, type ApprovalOptions as A, type ApiErrorDecision as B, type CompiledAgentOptions as C, type DelegationResult as D, type ApiErrorPolicy as E, type ApprovalRequiredEvent as F, type Guardrail as G, type HumanInTheLoopOptions as H, type ArtifactChunkEvent as I, type ArtifactStartEvent as J, type BackgroundDelegation as K, type LoopStrategy as L, type MainLoopMeta as M, type BeforeToolCallContext as N, BudgetExceededError as O, type BudgetOptions as P, type CheckpointSavedEvent as Q, type ReflectionStrategy as R, type StreamEvent as S, type ToolOptions as T, type CompiledContextWindow as U, ContextualTool as V, CostBudgetExceededError as W, DEFAULT_MAX_ITERATIONS as X, type DefineAgentConfig as Y, type DefinicaoOuThunk as Z, type DelegateFn as _, type CompiledTool as a, createToolHooksPlugin as a$, DelegationBudgetExceededError as a0, DelegationError as a1, type DoneEvent as a2, type ErrorEvent as a3, type FileEditEvent as a4, type GuardrailAction as a5, type GuardrailPhase as a6, type GuardrailResult as a7, GuardrailViolationError as a8, type HookHandlers as a9, type Segment as aA, type SkillsRequestContext as aB, type SkillsSelection as aC, type StateUpdateEvent as aD, type TextDeltaEvent as aE, type ThinkingEvent as aF, type TimeoutAction as aG, type ToolCallEvent as aH, type ToolCallVeto as aI, type ToolHooks as aJ, type ToolHooksPlugin as aK, type ToolResultEvent as aL, type ToolWalkResult as aM, type ToolboxOptions as aN, type ToolboxWalkResult as aO, agentsPlugin as aP, buildModelSelection as aQ, compileAgentDefinition as aR, compileAgentModule as aS, compileContextWindow as aT, compileProjectContext as aU, compileSkills as aV, compileTools as aW, createAgentExecutionContext as aX, createApiErrorHandler as aY, createSdkAgentStream as aZ, createThinkTagExtractor as a_, type InferAgentInput as aa, type InferAgentToolNames as ab, type IterationEvent as ac, type LLMCallContext as ad, type LoopFinishReason as ae, type LoopOutcome as af, type LoopStrategyConfig as ag, type MainLoopOptions as ah, type McpApprovalSpec as ai, type McpRegistryConfig as aj, type McpRequestContext as ak, type McpSelection as al, type PartialToolCallEvent as am, type PolicyHandler as an, type ProcessInputContext as ao, type ReflectionContext as ap, type ReflectionResult as aq, type ReflectionStrategyConfig as ar, type RunStartedEvent as as, type ScoreVerdict as at, type ScoredDelegation as au, type Scorer as av, type SdkAgentHandle as aw, type SdkMessage as ax, type SdkSendOptions as ay, type SdkTurnHandle as az, type ReasoningEffort as b, delegate as b0, delegateBackground as b1, delegateWithScoring as b2, extractThinkTagStream as b3, generateAgentManifest as b4, generateAgentRoutes as b5, isAgentContext as b6, isAgentDefinition as b7, isApprovalRequired as b8, isDone as b9, isError as ba, isPartialToolCall as bb, isTextDelta as bc, isToolCall as bd, isToolResult as be, ladderReflectionStrategy as bf, loopStrategyConfigSchema as bg, mcpRegistry as bh, mcpToolApprovals as bi, noopReflectionStrategy as bj, presentUIMessageStream as bk, projectContextMetadataOnlyKnobs as bl, reflectionStrategyConfigSchema as bm, resolveEnabledSkills as bn, resolveLoopStrategy as bo, resolveMcpServers as bp, runWithApiErrorHandling as bq, streamAgentResponse as br, toAgentFactory as bs, translateSdkEvent as bt, type RoundStreamFactory as c, type ContextWindowOptions as d, type SkillsOptions as e, type AgentManifestEntry as f, type HitlDecision as g, type ApprovalPosture as h, AGENT_BRAND as i, type AfterToolCallContext as j, AgentBuilder as k, type AgentDefinition as l, AgentDefinitionError as m, type AgentExecutionContext as n, type AgentManifest as o, type AgentManifestSource as p, type AgentManifestTool as q, type AgentOptions as r, streamAgentUIMessages as s, type AgentRoute as t, type AgentRouteContext as u, type AgentRunInfo as v, type AgentStreamEvent as w, type AgentTurnMetadata as x, type AgentsPluginOptions as y, type ApiErrorContext as z };
2264
+ export { type DelegateOptions as $, type ApprovalOptions as A, type ApiErrorDecision as B, type CompiledAgentOptions as C, type DelegationResult as D, type ApiErrorPolicy as E, type ApprovalRequiredEvent as F, type Guardrail as G, type HumanInTheLoopOptions as H, type ArtifactChunkEvent as I, type ArtifactStartEvent as J, type BackgroundDelegation as K, type LoopStrategy as L, type MainLoopMeta as M, type BeforeToolCallContext as N, BudgetExceededError as O, type BudgetOptions as P, type CheckpointSavedEvent as Q, type ReflectionStrategy as R, type StreamEvent as S, type ToolOptions as T, type CompiledContextWindow as U, ContextualTool as V, CostBudgetExceededError as W, DEFAULT_MAX_ITERATIONS as X, type DefineAgentConfig as Y, type DefinicaoOuThunk as Z, type DelegateFn as _, type CompiledTool as a, createThinkTagExtractor as a$, DelegationBudgetExceededError as a0, DelegationError as a1, type DoneEvent as a2, type ErrorEvent as a3, type FileEditEvent as a4, type GuardrailAction as a5, type GuardrailPhase as a6, type GuardrailResult as a7, GuardrailViolationError as a8, type HookHandlers as a9, type SdkTurnHandle as aA, type Segment as aB, type SkillsRequestContext as aC, type SkillsSelection as aD, type StateUpdateEvent as aE, type TextDeltaEvent as aF, type ThinkingEvent as aG, type TimeoutAction as aH, type ToolCallEvent as aI, type ToolCallVeto as aJ, type ToolHooks as aK, type ToolHooksPlugin as aL, type ToolResultEvent as aM, type ToolWalkResult as aN, type ToolboxOptions as aO, type ToolboxWalkResult as aP, agentsPlugin as aQ, buildModelSelection as aR, compileAgentDefinition as aS, compileAgentModule as aT, compileContextWindow as aU, compileProjectContext as aV, compileSkills as aW, compileTools as aX, createAgentExecutionContext as aY, createApiErrorHandler as aZ, createSdkAgentStream as a_, type InferAgentInput as aa, type InferAgentToolNames as ab, type IterationEvent as ac, type LLMCallContext as ad, type LoopFinishReason as ae, type LoopOutcome as af, type LoopStrategyConfig as ag, type MainLoopOptions as ah, type McpApprovalSpec as ai, McpFileError as aj, type McpRegistryConfig as ak, type McpRequestContext as al, type McpSelection as am, type PartialToolCallEvent as an, type PolicyHandler as ao, type ProcessInputContext as ap, type ReflectionContext as aq, type ReflectionResult as ar, type ReflectionStrategyConfig as as, type RunStartedEvent as at, type ScoreVerdict as au, type ScoredDelegation as av, type Scorer as aw, type SdkAgentHandle as ax, type SdkMessage as ay, type SdkSendOptions as az, type ReasoningEffort as b, createToolHooksPlugin as b0, delegate as b1, delegateBackground as b2, delegateWithScoring as b3, extractThinkTagStream as b4, generateAgentManifest as b5, generateAgentRoutes as b6, isAgentContext as b7, isAgentDefinition as b8, isApprovalRequired as b9, isDone as ba, isError as bb, isPartialToolCall as bc, isTextDelta as bd, isToolCall as be, isToolResult as bf, ladderReflectionStrategy as bg, loadMcpJson as bh, loopStrategyConfigSchema as bi, mcpRegistry as bj, mcpToolApprovals as bk, noopReflectionStrategy as bl, presentUIMessageStream as bm, projectContextMetadataOnlyKnobs as bn, reasoningEffortOf as bo, reflectionStrategyConfigSchema as bp, resolveEnabledSkills as bq, resolveLoopStrategy as br, resolveMcpServers as bs, runWithApiErrorHandling as bt, streamAgentResponse as bu, toAgentFactory as bv, translateSdkEvent as bw, type RoundStreamFactory as c, type ContextWindowOptions as d, type SkillsOptions as e, type AgentManifestEntry as f, type HitlDecision as g, type ApprovalPosture as h, AGENT_BRAND as i, type AfterToolCallContext as j, AgentBuilder as k, type AgentDefinition as l, AgentDefinitionError as m, type AgentExecutionContext as n, type AgentManifest as o, type AgentManifestSource as p, type AgentManifestTool as q, type AgentOptions as r, streamAgentUIMessages as s, type AgentRoute as t, type AgentRouteContext as u, type AgentRunInfo as v, type AgentStreamEvent as w, type AgentTurnMetadata as x, type AgentsPluginOptions as y, type ApiErrorContext as z };
package/dist/bridge.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export { i as AGENT_BRAND, j as AfterToolCallContext, k as AgentBuilder, l as AgentDefinition, m as AgentDefinitionError, n as AgentExecutionContext, o as AgentManifest, f as AgentManifestEntry, p as AgentManifestSource, q as AgentManifestTool, t as AgentRoute, u as AgentRouteContext, v as AgentRunInfo, w as AgentStreamEvent, x as AgentTurnMetadata, y as AgentsPluginOptions, z as ApiErrorContext, B as ApiErrorDecision, E as ApiErrorPolicy, h as ApprovalPosture, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, Q as CheckpointSavedEvent, C as CompiledAgentOptions, U as CompiledContextWindow, a as CompiledTool, V as ContextualTool, Y as DefineAgentConfig, Z as DefinicaoOuThunk, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationBudgetExceededError, a1 as DelegationError, D as DelegationResult, a2 as DoneEvent, a3 as ErrorEvent, a4 as FileEditEvent, aa as InferAgentInput, ab as InferAgentToolNames, ac as IterationEvent, ad as LLMCallContext, ai as McpApprovalSpec, aj as McpRegistryConfig, ak as McpRequestContext, al as McpSelection, am as PartialToolCallEvent, ao as ProcessInputContext, as as RunStartedEvent, at as ScoreVerdict, au as ScoredDelegation, av as Scorer, aw as SdkAgentHandle, ax as SdkMessage, ay as SdkSendOptions, az as SdkTurnHandle, aA as Segment, aD as StateUpdateEvent, S as StreamEvent, aE as TextDeltaEvent, aF as ThinkingEvent, aH as ToolCallEvent, aI as ToolCallVeto, aJ as ToolHooks, aK as ToolHooksPlugin, aL as ToolResultEvent, aM as ToolWalkResult, aO as ToolboxWalkResult, aP as agentsPlugin, aQ as buildModelSelection, aR as compileAgentDefinition, aS as compileAgentModule, aT as compileContextWindow, aU as compileProjectContext, aV as compileSkills, aW as compileTools, aX as createAgentExecutionContext, aY as createApiErrorHandler, aZ as createSdkAgentStream, a_ as createThinkTagExtractor, a$ as createToolHooksPlugin, b0 as delegate, b1 as delegateBackground, b2 as delegateWithScoring, b3 as extractThinkTagStream, b4 as generateAgentManifest, b5 as generateAgentRoutes, b6 as isAgentContext, b7 as isAgentDefinition, b8 as isApprovalRequired, b9 as isDone, ba as isError, bb as isPartialToolCall, bc as isTextDelta, bd as isToolCall, be as isToolResult, bh as mcpRegistry, bi as mcpToolApprovals, bk as presentUIMessageStream, bl as projectContextMetadataOnlyKnobs, bp as resolveMcpServers, bq as runWithApiErrorHandling, br as streamAgentResponse, s as streamAgentUIMessages, bs as toAgentFactory, bt as translateSdkEvent } from './bridge-entry-DD_j60GX.js';
1
+ export { i as AGENT_BRAND, j as AfterToolCallContext, k as AgentBuilder, l as AgentDefinition, m as AgentDefinitionError, n as AgentExecutionContext, o as AgentManifest, f as AgentManifestEntry, p as AgentManifestSource, q as AgentManifestTool, t as AgentRoute, u as AgentRouteContext, v as AgentRunInfo, w as AgentStreamEvent, x as AgentTurnMetadata, y as AgentsPluginOptions, z as ApiErrorContext, B as ApiErrorDecision, E as ApiErrorPolicy, h as ApprovalPosture, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, Q as CheckpointSavedEvent, C as CompiledAgentOptions, U as CompiledContextWindow, a as CompiledTool, V as ContextualTool, Y as DefineAgentConfig, Z as DefinicaoOuThunk, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationBudgetExceededError, a1 as DelegationError, D as DelegationResult, a2 as DoneEvent, a3 as ErrorEvent, a4 as FileEditEvent, aa as InferAgentInput, ab as InferAgentToolNames, ac as IterationEvent, ad as LLMCallContext, ai as McpApprovalSpec, aj as McpFileError, ak as McpRegistryConfig, al as McpRequestContext, am as McpSelection, an as PartialToolCallEvent, ap as ProcessInputContext, at as RunStartedEvent, au as ScoreVerdict, av as ScoredDelegation, aw as Scorer, ax as SdkAgentHandle, ay as SdkMessage, az as SdkSendOptions, aA as SdkTurnHandle, aB as Segment, aE as StateUpdateEvent, S as StreamEvent, aF as TextDeltaEvent, aG as ThinkingEvent, aI as ToolCallEvent, aJ as ToolCallVeto, aK as ToolHooks, aL as ToolHooksPlugin, aM as ToolResultEvent, aN as ToolWalkResult, aP as ToolboxWalkResult, aQ as agentsPlugin, aR as buildModelSelection, aS as compileAgentDefinition, aT as compileAgentModule, aU as compileContextWindow, aV as compileProjectContext, aW as compileSkills, aX as compileTools, aY as createAgentExecutionContext, aZ as createApiErrorHandler, a_ as createSdkAgentStream, a$ as createThinkTagExtractor, b0 as createToolHooksPlugin, b1 as delegate, b2 as delegateBackground, b3 as delegateWithScoring, b4 as extractThinkTagStream, b5 as generateAgentManifest, b6 as generateAgentRoutes, b7 as isAgentContext, b8 as isAgentDefinition, b9 as isApprovalRequired, ba as isDone, bb as isError, bc as isPartialToolCall, bd as isTextDelta, be as isToolCall, bf as isToolResult, bh as loadMcpJson, bj as mcpRegistry, bk as mcpToolApprovals, bm as presentUIMessageStream, bn as projectContextMetadataOnlyKnobs, bo as reasoningEffortOf, bs as resolveMcpServers, bt as runWithApiErrorHandling, bu as streamAgentResponse, s as streamAgentUIMessages, bv as toAgentFactory, bw as translateSdkEvent } from './bridge-entry-BlKfMDWb.js';
2
2
  import '@theokit/http';
3
3
  import '@theokit/sdk';
4
4
  import 'zod';
5
5
  import 'ai';
6
6
  import '@theokit/sdk/retry';
7
+ import '@theokit/sdk/errors';
package/dist/bridge.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  ContextualTool,
7
7
  DelegationBudgetExceededError,
8
8
  DelegationError,
9
+ McpFileError,
9
10
  agentsPlugin,
10
11
  buildModelSelection,
11
12
  compileAgentDefinition,
@@ -34,17 +35,19 @@ import {
34
35
  isTextDelta,
35
36
  isToolCall,
36
37
  isToolResult,
38
+ loadMcpJson,
37
39
  mcpRegistry,
38
40
  mcpToolApprovals,
39
41
  presentUIMessageStream,
40
42
  projectContextMetadataOnlyKnobs,
43
+ reasoningEffortOf,
41
44
  resolveMcpServers,
42
45
  runWithApiErrorHandling,
43
46
  streamAgentResponse,
44
47
  streamAgentUIMessages,
45
48
  toAgentFactory,
46
49
  translateSdkEvent
47
- } from "./chunk-JXR45RAW.js";
50
+ } from "./chunk-MDFEPVAN.js";
48
51
  import "./chunk-7QVYU63E.js";
49
52
  export {
50
53
  AGENT_BRAND,
@@ -54,6 +57,7 @@ export {
54
57
  ContextualTool,
55
58
  DelegationBudgetExceededError,
56
59
  DelegationError,
60
+ McpFileError,
57
61
  agentsPlugin,
58
62
  buildModelSelection,
59
63
  compileAgentDefinition,
@@ -82,10 +86,12 @@ export {
82
86
  isTextDelta,
83
87
  isToolCall,
84
88
  isToolResult,
89
+ loadMcpJson,
85
90
  mcpRegistry,
86
91
  mcpToolApprovals,
87
92
  presentUIMessageStream,
88
93
  projectContextMetadataOnlyKnobs,
94
+ reasoningEffortOf,
89
95
  resolveMcpServers,
90
96
  runWithApiErrorHandling,
91
97
  streamAgentResponse,
@@ -705,6 +705,7 @@ function translateInteractionUpdate(update) {
705
705
  __name(translateInteractionUpdate, "translateInteractionUpdate");
706
706
 
707
707
  // src/bridge/model-selection.ts
708
+ var PARAM_THINKING = "thinking";
708
709
  function buildModelSelection(model, effort) {
709
710
  const base = typeof model === "string" ? {
710
711
  id: model
@@ -717,13 +718,18 @@ function buildModelSelection(model, effort) {
717
718
  params: [
718
719
  ...base.params ?? [],
719
720
  {
720
- id: "thinking",
721
+ id: PARAM_THINKING,
721
722
  value: effort
722
723
  }
723
724
  ]
724
725
  };
725
726
  }
726
727
  __name(buildModelSelection, "buildModelSelection");
728
+ function reasoningEffortOf(model) {
729
+ const params = typeof model === "string" ? void 0 : model.params;
730
+ return params?.find((p) => p.id === PARAM_THINKING)?.value;
731
+ }
732
+ __name(reasoningEffortOf, "reasoningEffortOf");
727
733
 
728
734
  // src/bridge/think-tag-extractor.ts
729
735
  var TAG = "think";
@@ -3405,6 +3411,93 @@ function mcpToolApprovals(specs) {
3405
3411
  }
3406
3412
  __name(mcpToolApprovals, "mcpToolApprovals");
3407
3413
 
3414
+ // src/bridge/mcp-file.ts
3415
+ import { existsSync, readFileSync } from "fs";
3416
+ import { join } from "path";
3417
+ import { TheokitAgentError } from "@theokit/sdk/errors";
3418
+ var McpFileError = class extends TheokitAgentError {
3419
+ static {
3420
+ __name(this, "McpFileError");
3421
+ }
3422
+ name = "McpFileError";
3423
+ constructor(message) {
3424
+ super(`[@theokit/agents] ${message}`);
3425
+ }
3426
+ };
3427
+ var MCP_FILENAME = ".mcp.json";
3428
+ function loadMcpJson(cwd) {
3429
+ const path = join(cwd, MCP_FILENAME);
3430
+ if (!existsSync(path)) return {};
3431
+ let text;
3432
+ try {
3433
+ text = readFileSync(path, "utf8");
3434
+ } catch (err) {
3435
+ throw new McpFileError(`failed to read ${path}: ${descrever(err)}`);
3436
+ }
3437
+ let parsed;
3438
+ try {
3439
+ parsed = JSON.parse(text);
3440
+ } catch (err) {
3441
+ throw new McpFileError(`${path} is not valid JSON: ${descrever(err)}`);
3442
+ }
3443
+ return parseMcpJson(parsed, path);
3444
+ }
3445
+ __name(loadMcpJson, "loadMcpJson");
3446
+ function parseMcpJson(raw, source) {
3447
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
3448
+ throw new McpFileError(`${source}: root must be a JSON object with an "mcpServers" key.`);
3449
+ }
3450
+ const serversRaw = raw.mcpServers;
3451
+ if (serversRaw === void 0) return {};
3452
+ if (typeof serversRaw !== "object" || serversRaw === null || Array.isArray(serversRaw)) {
3453
+ throw new McpFileError(`${source}: "mcpServers" must be an object keyed by server name.`);
3454
+ }
3455
+ const out = {};
3456
+ for (const [name, entryRaw] of Object.entries(serversRaw)) {
3457
+ out[name] = parseServerEntry(name, entryRaw, source);
3458
+ }
3459
+ return out;
3460
+ }
3461
+ __name(parseMcpJson, "parseMcpJson");
3462
+ function parseServerEntry(name, entryRaw, source) {
3463
+ if (typeof entryRaw !== "object" || entryRaw === null || Array.isArray(entryRaw)) {
3464
+ throw new McpFileError(`${source}: server "${name}" must be an object.`);
3465
+ }
3466
+ const entry = entryRaw;
3467
+ if (typeof entry.command !== "string" || entry.command.length === 0) {
3468
+ throw new McpFileError(`${source}: server "${name}" requires a non-empty "command" string.`);
3469
+ }
3470
+ if (entry.args !== void 0 && !isStringArray(entry.args)) {
3471
+ throw new McpFileError(`${source}: server "${name}" field "args" must be a string array.`);
3472
+ }
3473
+ if (entry.env !== void 0 && !isStringRecord(entry.env)) {
3474
+ throw new McpFileError(`${source}: server "${name}" field "env" must be a string map.`);
3475
+ }
3476
+ if (entry.cwd !== void 0 && typeof entry.cwd !== "string") {
3477
+ throw new McpFileError(`${source}: server "${name}" field "cwd" must be a string.`);
3478
+ }
3479
+ const built = {
3480
+ command: entry.command
3481
+ };
3482
+ if (entry.args !== void 0) built.args = entry.args;
3483
+ if (entry.env !== void 0) built.env = entry.env;
3484
+ if (entry.cwd !== void 0) built.cwd = entry.cwd;
3485
+ return built;
3486
+ }
3487
+ __name(parseServerEntry, "parseServerEntry");
3488
+ function descrever(err) {
3489
+ return err instanceof Error ? err.message : String(err);
3490
+ }
3491
+ __name(descrever, "descrever");
3492
+ function isStringArray(v) {
3493
+ return Array.isArray(v) && v.every((x) => typeof x === "string");
3494
+ }
3495
+ __name(isStringArray, "isStringArray");
3496
+ function isStringRecord(v) {
3497
+ return typeof v === "object" && v !== null && !Array.isArray(v) && Object.values(v).every((x) => typeof x === "string");
3498
+ }
3499
+ __name(isStringRecord, "isStringRecord");
3500
+
3408
3501
  // src/manifest/agent-manifest.ts
3409
3502
  function generateAgentManifest(sources) {
3410
3503
  return {
@@ -3565,6 +3658,7 @@ export {
3565
3658
  createToolHooksPlugin,
3566
3659
  translateSdkEvent,
3567
3660
  buildModelSelection,
3661
+ reasoningEffortOf,
3568
3662
  createThinkTagExtractor,
3569
3663
  extractThinkTagStream,
3570
3664
  createSdkAgentStream,
@@ -3611,7 +3705,9 @@ export {
3611
3705
  resolveMcpServers,
3612
3706
  mcpRegistry,
3613
3707
  mcpToolApprovals,
3708
+ McpFileError,
3709
+ loadMcpJson,
3614
3710
  generateAgentManifest,
3615
3711
  agentsPlugin
3616
3712
  };
3617
- //# sourceMappingURL=chunk-JXR45RAW.js.map
3713
+ //# sourceMappingURL=chunk-MDFEPVAN.js.map