@kodax-ai/kodax 0.7.46 → 0.7.48

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 (37) hide show
  1. package/CHANGELOG.md +37 -1
  2. package/dist/chunks/{chunk-2GEKCIIW.js → chunk-66B6ZOU7.js} +13 -13
  3. package/dist/chunks/{chunk-K4RBLNSY.js → chunk-6Z75SHX3.js} +1 -1
  4. package/dist/chunks/{chunk-Z4UT32NN.js → chunk-DEODZG6Q.js} +1 -1
  5. package/dist/chunks/chunk-EP46H5P3.js +415 -0
  6. package/dist/chunks/{chunk-XUEINS3X.js → chunk-LNJNRREL.js} +317 -263
  7. package/dist/chunks/{chunk-JRT447X5.js → chunk-UHAP234X.js} +244 -242
  8. package/dist/chunks/{compaction-config-PFTBIGQT.js → compaction-config-YWCHOP2U.js} +1 -1
  9. package/dist/chunks/{construction-bootstrap-2FKNOZZE.js → construction-bootstrap-AIWATBWW.js} +1 -1
  10. package/dist/chunks/dist-4WABQRJU.js +2 -0
  11. package/dist/chunks/{dist-QTV5M2JW.js → dist-IDNOAB4M.js} +1 -1
  12. package/dist/chunks/{utils-LY3LB65Z.js → utils-OG57XTPC.js} +1 -1
  13. package/dist/index.d.ts +10 -7
  14. package/dist/index.js +5 -5
  15. package/dist/kodax_cli.js +765 -719
  16. package/dist/provider-capabilities.json +3 -8
  17. package/dist/sdk-agent.d.ts +38 -7
  18. package/dist/sdk-agent.js +1 -1
  19. package/dist/sdk-coding.d.ts +102 -11
  20. package/dist/sdk-coding.js +1 -1
  21. package/dist/sdk-llm.js +1 -1
  22. package/dist/sdk-mcp.d.ts +3 -3
  23. package/dist/sdk-mcp.js +1 -1
  24. package/dist/sdk-repl.d.ts +10 -9
  25. package/dist/sdk-repl.js +1 -1
  26. package/dist/sdk-session.js +1 -1
  27. package/dist/sdk-skills.js +1 -1
  28. package/dist/types-chunks/{bash-prefix-extractor.d-BICYx8pt.d.ts → bash-prefix-extractor.d-DNO2-ycp.d.ts} +283 -31
  29. package/dist/types-chunks/{config.d-BfJUXxC0.d.ts → config.d-CJy1WENT.d.ts} +17 -7
  30. package/dist/types-chunks/{file-tracker.d-BNTIvsdb.d.ts → file-tracker.d-D7L_SbRm.d.ts} +1 -1
  31. package/dist/types-chunks/manager.d-DLmDhX3i.d.ts +696 -0
  32. package/dist/types-chunks/{types.d-D2RNa5Y7.d.ts → types.d-BCnbYG_A.d.ts} +68 -2
  33. package/dist/types-chunks/{utils.d-pzHPkrb8.d.ts → utils.d-Dgy5SVrq.d.ts} +1 -1
  34. package/package.json +2 -1
  35. package/dist/chunks/chunk-VBIVZOSD.js +0 -425
  36. package/dist/chunks/dist-JLMKDPEL.js +0 -2
  37. package/dist/types-chunks/manager.d-87belpiS.d.ts +0 -370
@@ -1,2 +0,0 @@
1
- // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{$ as Vb,$a as Vc,$b as Vd,$c as Ve,A as ub,Aa as uc,Ab as ud,Ac as ue,Ad as vf,B as vb,Ba as vc,Bb as vd,Bc as ve,Bd as wf,C as wb,Ca as wc,Cb as wd,Cc as we,Cd as xf,D as xb,Da as xc,Db as xd,Dc as xe,Dd as yf,E as yb,Ea as yc,Eb as yd,Ec as ye,Ed as zf,F as zb,Fa as zc,Fb as zd,Fc as ze,Fd as Af,G as Ab,Ga as Ac,Gb as Ad,Gc as Ae,Gd as Bf,H as Bb,Ha as Bc,Hb as Bd,Hc as Be,Hd as Cf,I as Cb,Ia as Cc,Ib as Cd,Ic as Ce,Id as Df,J as Db,Ja as Dc,Jb as Dd,Jc as De,Jd as Ef,K as Eb,Ka as Ec,Kb as Ed,Kc as Ee,Kd as Ff,L as Fb,La as Fc,Lb as Fd,Lc as Fe,Ld as Gf,M as Gb,Ma as Gc,Mb as Gd,Mc as Ge,Md as Hf,N as Hb,Na as Hc,Nb as Hd,Nc as He,Nd as If,O as Ib,Oa as Ic,Ob as Id,Oc as Ie,Od as Jf,P as Jb,Pa as Jc,Pb as Jd,Pc as Je,Pd as Kf,Q as Kb,Qa as Kc,Qb as Kd,Qc as Ke,Qd as Lf,R as Lb,Ra as Lc,Rb as Ld,Rc as Le,Rd as Mf,S as Mb,Sa as Mc,Sb as Md,Sc as Me,Sd as Nf,T as Nb,Ta as Nc,Tb as Nd,Tc as Ne,Td as Of,U as Ob,Ua as Oc,Ub as Od,Uc as Oe,Ud as Pf,V as Pb,Va as Pc,Vb as Pd,Vc as Pe,Vd as Qf,W as Qb,Wa as Qc,Wb as Qd,Wc as Qe,Wd as Rf,X as Rb,Xa as Rc,Xb as Rd,Xc as Re,Xd as Sf,Y as Sb,Ya as Sc,Yb as Sd,Yc as Se,Yd as Tf,Z as Tb,Za as Tc,Zb as Td,Zc as Te,Zd as Uf,_ as Ub,_a as Uc,_b as Ud,_c as Ue,_d as Vf,a as X,aa as Wb,ab as Wc,ac as Wd,ad as We,b as Y,ba as Xb,bb as Xc,bc as Xd,bd as Xe,c as Z,ca as Yb,cb as Yc,cc as Yd,cd as Ye,d as _,da as Zb,db as Zc,dc as Zd,dd as Ze,e as $,ea as _b,eb as _c,ec as _d,ed as _e,f as $a,fa as $b,fb as $c,fc as $d,fd as $e,g as ab,ga as ac,gb as ad,gc as ae,gd as af,h as bb,ha as bc,hb as bd,hc as be,hd as bf,i as cb,ia as cc,ib as cd,ic as ce,id as cf,j as db,ja as dc,jb as dd,jc as de,jd as df,k as eb,ka as ec,kb as ed,kc as ee,kd as ef,l as fb,la as fc,lb as fd,lc as fe,ld as ff,m as gb,ma as gc,mb as gd,mc as ge,md as gf,n as hb,na as hc,nb as hd,nc as he,nd as hf,o as ib,oa as ic,ob as id,oc as ie,od as jf,p as jb,pa as jc,pb as jd,pc as je,pd as kf,q as kb,qa as kc,qb as kd,qc as ke,qd as lf,r as lb,ra as lc,rb as ld,rc as le,rd as mf,s as mb,sa as mc,sb as md,sc as me,sd as nf,t as nb,ta as nc,tb as nd,tc as ne,td as of,u as ob,ua as oc,ub as od,uc as oe,ud as pf,v as pb,va as pc,vb as pd,vc as pe,vd as qf,w as qb,wa as qc,wb as qd,wc as qe,wd as rf,x as rb,xa as rc,xb as rd,xc as re,xd as sf,y as sb,ya as sc,yb as sd,yc as se,yd as tf,z as tb,za as tc,zb as td,zc as te,zd as uf}from"./chunk-XUEINS3X.js";import{$ as y,C as k,K as l,L as m,Q as n,R as o,S as p,T as q,U as r,V as s,W as t,X as u,Y as v,Z as w,_ as x,a,aa as z,b,ba as A,c,ca as B,da as C,ea as D,fa as E,ga as F,ha as G,ia as H,j as d,ja as I,ka as J,la as K,ma as L,na as M,oa as N,pa as O,qa as P,ra as Q,sa as R,t as e,ta as S,u as f,ua as T,v as g,va as U,w as h,wa as V,x as i,xa as W,y as j}from"./chunk-2GEKCIIW.js";import{$a as va,Fc as Za,Gc as _a,a as aa,ab as wa,ac as Ha,b as ba,bc as Ia,c as ca,cc as Ja,d as da,dc as Ka,e as ea,ec as La,f as fa,h as ga,i as ha,j as ia,k as ja,ka as pa,l as ka,lc as Ma,m as la,mc as Na,n as ma,na as qa,nc as Oa,o as na,ob as xa,oc as Pa,p as oa,pb as ya,pc as Qa,qb as za,qc as Ra,rb as Aa,rc as Sa,sb as Ba,tb as Ca,tc as Ta,ua as ra,ub as Da,uc as Ua,va as sa,vb as Ea,vc as Va,wa as ta,wb as Fa,wc as Wa,xa as ua,xb as Ga,xc as Xa,yc as Ya}from"./chunk-VBIVZOSD.js";import"./chunk-V4WSBIXB.js";export{wf as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD,xf as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD,Rf as BASH_POLICY_SPEC,Oe as BLOCKER_REQUIRED_CONSECUTIVE_TURNS,Cf as BREAKER_ERROR_THRESHOLD,Df as BREAKER_WINDOW_MS,ab as CANCELLED_TOOL_RESULT_MESSAGE,$a as CANCELLED_TOOL_RESULT_PREFIX,mf as CODING_AGENT_MARKER,ze as CODING_INVARIANTS,oe as CODING_SUMMARY_PROMPT,pe as CODING_UPDATE_SUMMARY_PROMPT,Lc as CapabilityDeniedError,Be as Client,Mc as ConstructionManifestError,qe as DEFAULT_CODING_AGENT_NAME,af as DEFAULT_DANGEROUS_PATTERNS,Jc as DEFAULT_HANDLER_TIMEOUT_MS,Yd as DEFAULT_RESILIENCE_CONFIG,$e as DEFAULT_SAFE_PATTERNS,Wc as DEFAULT_SELF_MODIFY_BUDGET,Nf as DEFAULT_SPECULATIVE_WINDOW_MS,cb as DEFAULT_TOOL_OUTPUT_MAX_BYTES,bb as DEFAULT_TOOL_OUTPUT_MAX_LINES,oa as DefaultSummaryCompaction,jf as EMIT_VERDICT_TOOL_NAME,_ as ErrorCategory,pc as GENERATOR_AGENT_NAME,ha as KODAX_API_MIN_INTERVAL,p as KODAX_DEFAULT_PROVIDER,ba as KODAX_DEFAULT_TIMEOUT,ca as KODAX_HARD_TIMEOUT,fa as KODAX_MAX_INCOMPLETE_RETRIES,da as KODAX_MAX_RETRIES,aa as KODAX_MAX_TOKENS,o as KODAX_PROVIDERS,n as KODAX_PROVIDER_SNAPSHOTS,d as KODAX_REASONING_MODE_SEQUENCE,ea as KODAX_RETRY_BASE_DELAY,ga as KODAX_STAGGER_DELAY,td as KODAX_TOOLS,l as KodaXAnthropicCompatProvider,k as KodaXBaseProvider,Be as KodaXClient,a as KodaXError,pd as KodaXExtensionRuntime,m as KodaXOpenAICompatProvider,b as KodaXProviderError,c as KodaXRateLimitError,Y as KodaXSessionError,Z as KodaXTerminalError,X as KodaXToolError,Ha as LINEAGE_ENTRY_TYPES,Ja as LineageCompaction,Ia as LineageExtension,Ea as McpCapabilityProvider,Fa as McpManager,Da as McpServerRuntime,oc as PLANNER_AGENT_NAME,ia as PROMISE_PATTERN,Md as PROMPT_SECTION_REGISTRY,lf as PROTOCOL_EMITTER_TOOLS,be as ProviderRecoveryCoordinator,db as READ_DEFAULT_LIMIT,fb as READ_MAX_LINE_CHARS,eb as READ_PREFLIGHT_SIZE_BYTES,Jb as REPOINTEL_DEFAULT_ENDPOINT,qa as Runner,nc as SCOUT_AGENT_NAME,Ld as SYSTEM_PROMPT,$d as StableBoundaryTracker,sc as TASK_ENGINE_ROLE_AGENTS,Ke as TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME,Uf as TRACING_ENV,qc as WORKER_AGENT_NAME,bd as _resetRuntimeForTesting,ed as activate,Ab as analyzeChangedScope,Uc as appendAuditEntry,Ra as appendSessionLineageLabel,Bc as applyAccountingDelta,Ge as applyFanoutBranchTransition,Sa as applySessionCompaction,$b as applyToolResultGuardrail,Ya as archiveOldIslands,He as assignFanoutBranchWorker,Bf as autoModeDenialShouldFallback,Kf as bashSignalCollector,Vf as bootstrapTracing,ve as boundedRevise,Gf as breakerShouldFallback,we as budgetCeiling,ke as buildAmaControllerDecision,Ec as buildBlockedGoal,Rd as buildCapabilityContextSections,nf as buildClassifierPrompt,Fc as buildCompleteGoal,Ac as buildCreatedGoal,ie as buildFallbackRoutingDecision,De as buildFanoutSchedulerPlan,Se as buildGoalRuntimeBinding,Rc as buildLlmReviewPrompt,Cc as buildPausedGoal,Vd as buildPromptMessageContent,le as buildPromptOverlay,Qd as buildPromptSnapshot,ce as buildProviderCapabilitySnapshot,je as buildProviderPolicyHintsForDecision,de as buildProviderPolicyPromptNotes,g as buildReasoningOverrideKey,zb as buildRepoIntelligenceContext,Ob as buildRepoIntelligenceIndex,wb as buildRepoOverview,Dc as buildResumedGoal,Wa as buildSessionTree,Td as buildSystemPrompt,Sd as buildSystemPromptSnapshot,Jf as checkAbsoluteDeny,Ud as checkIncompleteToolCalls,ne as checkPromiseSignal,pf as classify,cf as classifyBashCommand,$ as classifyError,_d as classifyResilienceError,wa as cleanupIncompleteToolCalls,j as clearReasoningOverride,Q as clearRuntimeModelProviders,Mf as collectAllSignals,ef as computeInputSignature,qf as computeRulesFingerprint,ad as configureRuntime,dc as convertCapabilityReadResult,cc as convertProviderSearchResults,Fe as countActiveFanoutBranches,Xa as countActiveLineageMessages,ka as countTokens,la as createAgent,yf as createAutoModeDenialTracker,Qf as createAutoModeToolGuardrail,bf as createBashClassifierConfig,Tf as createBashPrefixExtractor,Bd as createBuiltinToolDefinition,Ef as createCircuitBreaker,Nc as createCtxProxy,C as createCustomProvider,re as createDefaultCodingAgent,df as createDenialTracker,qd as createExtensionRuntime,Ce as createFanoutSchedulerInput,ma as createHandoff,na as createInMemorySession,Xe as createKodaXTaskRunner,ya as createMcpCapabilityId,Ga as createMcpManager,Ca as createMcpTransport,Nd as createPromptSection,me as createReasoningPlan,te as createSessionControl,Ma as createSessionLineage,Le as createToolResultTruncationGuardrail,xa as defaultMcpCacheDir,Kc as defaultPolicy,$c as disableSelfModify,nd as discoverMarkdownAgents,vc as drainPendingSwaps,kf as emitVerdict,ja as estimateTokens,ee as evaluateProviderPolicy,Hc as exec,Kd as executeTool,Za as extractArtifactLedger,Sf as extractCommandPrefix,Xd as extractComparableUserMessageText,bc as extractHtmlTitle,Wd as extractPromptComparableText,La as extractTitleFromMessages,Lf as fileSignalCollector,fc as finalizeRetrievalResult,kd as findByVersion,Ta as findPreviousUserEntryId,Va as forkSessionLineage,mc as formatAgentsForPrompt,Ze as formatParallelDispatchResult,gb as formatSize,Ka as generateSessionId,sd as getActiveExtensionRuntime,sa as getAgentConfigHome,ta as getAgentConfigPath,Dd as getAllRegisteredTools,ua as getAppDataDir,T as getAvailableProviderNames,Ad as getBuiltinRegisteredToolDefinition,zd as getBuiltinToolDefinition,K as getCustomModelCapabilities,E as getCustomProvider,H as getCustomProviderList,J as getCustomProviderModelDescriptors,I as getCustomProviderModels,G as getCustomProviderNames,hf as getDenialContext,Ee as getFanoutBranch,Tb as getImpactEstimate,kc as getKodaxGlobalDir,Ba as getMcpCachePaths,z as getModelCapabilities,Qb as getModuleContext,Sb as getProcessContext,q as getProvider,u as getProviderConfiguredCapabilityProfile,t as getProviderConfiguredReasoningCapability,v as getProviderList,s as getProviderModel,y as getProviderModelDescriptors,w as getProviderModels,xd as getRegisteredToolDefinition,Pb as getRepoIntelligenceIndex,xb as getRepoOverview,Ub as getRepoRoutingSignals,Hd as getRequiredToolParams,N as getRuntimeModelProvider,P as getRuntimeModelProviderNames,Na as getSessionLineagePath,Oa as getSessionMessagesFromLineage,Rb as getSymbolContext,vd as getTool,wd as getToolDefinition,yd as getToolRegistrations,_b as getToolResultPolicy,xc as goalTokenDelta,uc as hasPendingSwap,he as inferTaskType,pb as inspectEditFailure,Mb as inspectRepoIntelligenceRuntime,F as isCustomProviderName,gf as isDeniedRecently,S as isKnownProvider,Ye as isParallelDispatchDirective,r as isProviderConfigured,x as isProviderName,O as isRuntimeModelProviderName,Fd as isToolFileMutation,Gd as isToolMutation,Ed as isToolPlanModeAllowed,Gc as isValidTokenBudget,ld as listAll,W as listAllModelCapabilities,hd as listArtifacts,A as listBuiltinModelCapabilities,Cd as listBuiltinToolDefinitions,jd as listConstructed,L as listCustomProviderModelCapabilities,Jd as listToolDefinitions,Id as listTools,lc as loadAgentsFiles,md as loadAgentsFromMarkdown,uf as loadAutoRules,Oc as loadHandler,h as loadReasoningOverride,wc as makeDisabledGoalToolsContext,Je as markFanoutBranchCancelled,Ie as markFanoutBranchCompleted,_a as mergeArtifactLedger,Od as orderPromptSections,tf as parseAutoRules,of as parseClassifierOutput,ob as parseEditToolError,Sc as parseLlmReviewVerdict,za as parseMcpCapabilityId,Hf as parseModelSpec,kb as persistToolOutput,Vb as prewarmRepoIntelligenceCaches,id as readArtifact,Vc as readAuditEntries,Xc as readBudget,_c as readDisableState,Of as readSpeculativeWindowFromEnv,rf as readTrustState,e as reasoningCapabilityToOverride,ge as reasoningModeToDepth,f as reasoningOverrideToCapability,ae as reconstructMessagesWithToolGuard,Af as recordAutoModeAllow,zf as recordAutoModeBlock,Me as recordBlockerAttempt,Ff as recordBreakerError,ff as recordDenial,Ae as registerCodingInvariants,Ue as registerConfiguredMcpCapabilityProvider,D as registerCustomProviders,M as registerModelProvider,Ve as registerOfficialSandboxExtension,pa as registerPresetDispatcher,ud as registerTool,fd as rehydrateActiveArtifacts,Yc as remainingSelfModifyBudget,Bb as renderChangedScope,Ib as renderImpactEstimate,Fb as renderModuleContext,Hb as renderProcessContext,Pd as renderPromptSections,yb as renderRepoOverview,ec as renderRetrievalResult,Gb as renderSymbolContext,Ne as resetBlockerCounter,Zc as resetBudget,If as resolveClassifierModel,tc as resolveConstructedAgent,V as resolveModelCapabilities,R as resolveProvider,U as resolveProviderModelDescriptors,fe as resolveReasoningMode,Lb as resolveRepoIntelligenceMode,Kb as resolveRepoIntelligenceRuntimeConfig,Zd as resolveResilienceConfig,Pa as resolveSessionLineageTarget,xe as resolveToolCapability,gd as revoke,Ua as rewindSessionLineage,od as rollbackSelfModify,Pc as runAstRules,se as runKodaX,Tc as runLlmReview,Te as runManagedTask,We as runOrchestration,i as saveReasoningOverride,Aa as searchMcpCatalog,rd as setActiveExtensionRuntime,ra as setAgentConfigHome,Qa as setSessionLineageActiveEntry,zc as shouldFlipBudgetLimited,Pf as speculativeRace,cd as stage,ue as startKodaX,vf as stripAssistantText,ac as stripHtmlToText,dd as testArtifact,vb as toolAskUserQuestion,rb as toolBash,Eb as toolChangedDiff,Db as toolChangedScope,ic as toolCodeSearch,nb as toolEdit,sb as toolGlob,tb as toolGrep,Zb as toolImpactEstimate,qb as toolInsertAfterAnchor,Wb as toolModuleContext,ye as toolPermission,Yb as toolProcessContext,lb as toolRead,Cb as toolRepoOverview,jc as toolSemanticLookup,Xb as toolSymbolContext,ub as toolUndo,hc as toolWebFetch,gc as toolWebSearch,mb as toolWrite,hb as truncateHead,jb as truncateLine,ib as truncateTail,sf as trustProjectRules,yc as turnWallTimeDelta,va as validateAndFixToolHistory,B as validateCustomProviderConfig,_e as validateSubtaskIndependence,Qc as validateToolSchemaForProvider,Re as verifyGoalCompletion,Nb as warmRepoIntelligenceRuntime,Ic as webhook,Pe as withGoalBeforeNextTurn,Qe as withGoalStopHook,rc as workerAgent};
@@ -1,370 +0,0 @@
1
- import { a as McpServerConfig, b as McpServersConfig, M as McpConnectMode } from './config.d-BfJUXxC0.js';
2
- import { a as CapabilityProvider, C as CapabilityKind, b as CapabilityResult } from './capability.d-3C62G8Eq.js';
3
-
4
- type McpCapabilityKind = 'tool' | 'resource' | 'prompt';
5
- type McpCapabilityRisk = 'read' | 'write' | 'network' | 'exec';
6
- interface McpCatalogItem {
7
- id: string;
8
- serverId: string;
9
- kind: McpCapabilityKind;
10
- name: string;
11
- title?: string;
12
- summary: string;
13
- tags?: string[];
14
- risk?: McpCapabilityRisk;
15
- annotations?: Record<string, unknown>;
16
- cachedAt: string;
17
- }
18
- interface McpCapabilityDescriptor extends McpCatalogItem {
19
- inputSchema?: unknown;
20
- outputSchema?: unknown;
21
- promptArgsSchema?: unknown;
22
- uri?: string;
23
- mimeType?: string;
24
- }
25
- interface McpServerCatalogSnapshot {
26
- serverId: string;
27
- items: McpCatalogItem[];
28
- descriptors: McpCapabilityDescriptor[];
29
- updatedAt: string;
30
- }
31
- interface McpCatalogSearchOptions {
32
- kind?: McpCapabilityKind;
33
- limit?: number;
34
- }
35
- declare function defaultMcpCacheDir(): string;
36
- declare function createMcpCapabilityId(serverId: string, kind: McpCapabilityKind, name: string): string;
37
- declare function parseMcpCapabilityId(id: string): {
38
- serverId: string;
39
- kind: McpCapabilityKind;
40
- name: string;
41
- };
42
- declare function searchMcpCatalog(items: readonly McpCatalogItem[], query: string, options?: McpCatalogSearchOptions): McpCatalogItem[];
43
- declare function getMcpCachePaths(cacheDir: string, serverId: string): {
44
- catalogDir: string;
45
- indexPath: string;
46
- itemsPath: string;
47
- };
48
-
49
- interface McpServerRuntimeDiagnostics {
50
- serverId: string;
51
- connect: 'lazy' | 'prewarm' | 'disabled';
52
- status: 'idle' | 'connecting' | 'ready' | 'error' | 'disabled';
53
- dirty: boolean;
54
- lastError?: string;
55
- cachedAt?: string;
56
- tools: number;
57
- resources: number;
58
- prompts: number;
59
- }
60
- declare class McpServerRuntime {
61
- private readonly serverId;
62
- private readonly config;
63
- private readonly cacheDir;
64
- private transport?;
65
- private readonly pending;
66
- private nextRequestId;
67
- private initialized;
68
- private connectPromise?;
69
- private catalog?;
70
- private diagnostics;
71
- constructor(serverId: string, config: McpServerConfig, cacheDir: string);
72
- getDiagnostics(): McpServerRuntimeDiagnostics;
73
- prewarmIfNeeded(): Promise<void>;
74
- /** Load catalog from memory or disk only — never triggers a lazy connection. */
75
- getCachedCatalog(): Promise<McpServerCatalogSnapshot | undefined>;
76
- getCatalog(forceRefresh?: boolean): Promise<McpServerCatalogSnapshot>;
77
- describeCapability(capabilityId: string): Promise<McpCapabilityDescriptor | undefined>;
78
- callTool(name: string, args: Record<string, unknown>): Promise<{
79
- content?: string;
80
- structuredContent?: unknown;
81
- metadata?: Record<string, unknown>;
82
- }>;
83
- readResource(name: string, options: Record<string, unknown>): Promise<{
84
- content?: string;
85
- structuredContent?: unknown;
86
- metadata?: Record<string, unknown>;
87
- }>;
88
- getPrompt(name: string, args: Record<string, unknown>): Promise<unknown>;
89
- refreshCatalog(forceReconnect?: boolean): Promise<void>;
90
- /** Public teardown — clears everything including the connect lock. */
91
- dispose(): Promise<void>;
92
- /** Internal transport teardown — does NOT clear connectPromise so the
93
- * retry loop inside doConnect() can safely call it between attempts. */
94
- private resetTransport;
95
- private connect;
96
- private doConnect;
97
- private listDescriptors;
98
- private request;
99
- private notify;
100
- private handleMessage;
101
- private failPending;
102
- private applyCatalogSnapshot;
103
- }
104
-
105
- /**
106
- * `McpCapabilityProvider` — implements the Layer A `CapabilityProvider`
107
- * contract for an MCP server fleet.
108
- *
109
- * FEATURE_082 (v0.7.24): moved from
110
- * `@kodax-ai/coding/src/capabilities/providers/mcp/provider.ts` to this package.
111
- * The coding-specific `registerConfiguredMcpCapabilityProvider` adapter (which
112
- * pulls in `KodaXExtensionRuntime`) lives in
113
- * `@kodax-ai/coding/src/capabilities/providers/mcp-adapter.ts`.
114
- */
115
-
116
- interface McpProviderOptions {
117
- cacheDir?: string;
118
- }
119
- declare class McpCapabilityProvider implements CapabilityProvider {
120
- readonly id = "mcp";
121
- readonly kinds: CapabilityProvider['kinds'];
122
- private readonly runtimes;
123
- private readonly cacheDir;
124
- /**
125
- * Construct an MCP capability provider.
126
- *
127
- * **Cache-dir capture warning (v0.7.35.1 FEATURE_145)** — when
128
- * `options.cacheDir` is omitted, this constructor resolves
129
- * `defaultMcpCacheDir()` ONCE at instantiation time and threads the
130
- * result into every `McpServerRuntime` it spawns. If a substrate
131
- * consumer plans to redirect the agent config home via
132
- * `setAgentConfigHome()` from `@kodax-ai/agent`, that call MUST happen
133
- * BEFORE constructing this provider. Late calls have no effect on
134
- * already-constructed runtimes.
135
- *
136
- * To bypass the agent-home resolver entirely, pass
137
- * `options.cacheDir` explicitly — that path wins unconditionally.
138
- */
139
- constructor(servers: McpServersConfig | undefined, options?: McpProviderOptions);
140
- hasActiveServers(): boolean;
141
- /**
142
- * v0.7.42 — read-only accessor for the enabled server id list.
143
- * Used by {@link McpManager} to drive popout-shape `listServers /
144
- * startServer / stopServer / logs / tools` operations without
145
- * exposing the internal runtimes Map.
146
- */
147
- getServerIds(): readonly string[];
148
- /**
149
- * v0.7.42 — single-server runtime accessor. Returns `undefined`
150
- * for unknown / disabled servers. Use {@link McpManager} for
151
- * higher-level lifecycle control.
152
- */
153
- getRuntime(serverId: string): McpServerRuntime | undefined;
154
- prewarm(): Promise<void>;
155
- search(query: string, options?: {
156
- kind?: CapabilityKind;
157
- limit?: number;
158
- server?: string;
159
- }): Promise<unknown[]>;
160
- describe(id: string): Promise<unknown>;
161
- execute(id: string, input: Record<string, unknown>): Promise<CapabilityResult>;
162
- read(id: string, options?: Record<string, unknown>): Promise<CapabilityResult>;
163
- getPrompt(id: string, args?: Record<string, unknown>): Promise<unknown>;
164
- getPromptContext(): Promise<string | undefined>;
165
- getDiagnostics(): Record<string, unknown> | undefined;
166
- refresh(): Promise<void>;
167
- dispose(): Promise<void>;
168
- private collectCatalogItems;
169
- private listServerDiagnostics;
170
- private requireRuntime;
171
- }
172
-
173
- interface McpTransportEvents {
174
- /** Called with a complete JSON-RPC message (raw JSON string). */
175
- onMessage(raw: string): void;
176
- onError(error: Error): void;
177
- onClose(reason: string): void;
178
- }
179
- interface McpTransport {
180
- open(events: McpTransportEvents): Promise<void>;
181
- /** Send a JSON string. The transport handles framing. */
182
- send(json: string): Promise<void>;
183
- close(): Promise<void>;
184
- readonly connected: boolean;
185
- }
186
- type StdioFraming = 'content-length' | 'ndjson';
187
- interface McpTransportOptions {
188
- stdioFraming?: StdioFraming;
189
- }
190
- declare function createMcpTransport(config: McpServerConfig, options?: McpTransportOptions): McpTransport;
191
-
192
- /**
193
- * McpManager — v0.7.42 (extends FEATURE_186 MCP popout surface).
194
- *
195
- * `McpCapabilityProvider` (`./provider.ts`) is the capability-provider-
196
- * shaped object KodaX uses internally to plug MCP into the agent runtime
197
- * — its public methods are `search` / `describe` / `execute` / `read` /
198
- * `getPrompt` / `getDiagnostics` / `refresh` / `dispose`, which is the
199
- * shape the substrate consumes but NOT the shape a popout UI wants.
200
- *
201
- * KodaX Space reported that `@kodax-ai/kodax/mcp` only exposed "types +
202
- * helpers, no manager-shape API" — concretely they wanted a thin
203
- * `listServers / startServer / stopServer / getServerLogs / listTools`
204
- * surface to drive a popout panel:
205
- *
206
- * - One row per configured MCP server with live status
207
- * - "Start" / "Stop" buttons that map to refreshCatalog(true) / dispose
208
- * - Server logs (last error + status) so users can debug failures
209
- * - Per-server tool list (filtered descriptors) for the "what does
210
- * this MCP server expose" pane
211
- *
212
- * `McpManager` is the thin wrapper. It owns one `McpCapabilityProvider`
213
- * instance internally, so all the existing lifecycle invariants
214
- * (cache-dir capture, refresh, dispose, server-config validation) are
215
- * preserved verbatim. The capability-provider-shaped methods stay
216
- * available via `manager.provider()` as an escape hatch.
217
- *
218
- * Trust boundary: same as the rest of FEATURE_186 — KodaX is a
219
- * single-user CLI, last-write-wins on the server-config-vs-active-
220
- * runtime path; a Space popout that swaps configs hot would still need
221
- * to construct a fresh `McpManager` (or call `dispose()` then
222
- * `createMcpManager` again) to pick up the new wire.
223
- */
224
-
225
- interface McpServerStatus {
226
- readonly serverId: string;
227
- readonly config: McpServerConfig;
228
- readonly connect: McpConnectMode;
229
- readonly status: McpServerRuntimeDiagnostics['status'];
230
- readonly tools: number;
231
- readonly resources: number;
232
- readonly prompts: number;
233
- readonly dirty: boolean;
234
- readonly cachedAt?: string;
235
- readonly lastError?: string;
236
- }
237
- interface McpServerLogs {
238
- readonly serverId: string;
239
- readonly status: McpServerRuntimeDiagnostics['status'];
240
- readonly connect: McpConnectMode;
241
- readonly lastError?: string;
242
- readonly cachedAt?: string;
243
- }
244
- interface McpServerToolList {
245
- readonly serverId: string;
246
- readonly tools: readonly McpCapabilityDescriptor[];
247
- readonly cachedAt?: string;
248
- }
249
- /**
250
- * Full catalog snapshot for a server — tools + resources + prompts.
251
- * Use {@link McpManager.getCatalog} when the popout needs to render
252
- * all three capability kinds (not just tools).
253
- *
254
- * `cachedAt` matches the naming used by {@link McpServerStatus},
255
- * {@link McpServerLogs}, and {@link McpServerToolList} for consistency
256
- * across the manager surface (all are renames of the underlying
257
- * `McpServerCatalogSnapshot.updatedAt` field).
258
- */
259
- interface McpServerCatalog {
260
- readonly serverId: string;
261
- readonly items: readonly McpCatalogItem[];
262
- readonly descriptors: readonly McpCapabilityDescriptor[];
263
- readonly cachedAt: string;
264
- }
265
- /**
266
- * Manager-shape facade over {@link McpCapabilityProvider}. Construct
267
- * via the {@link createMcpManager} factory or `new McpManager(...)`
268
- * directly.
269
- */
270
- declare class McpManager {
271
- private readonly capabilityProvider;
272
- private readonly serversConfig;
273
- constructor(servers: McpServersConfig | undefined, options?: McpProviderOptions);
274
- /**
275
- * Escape hatch — returns the underlying {@link McpCapabilityProvider}
276
- * for callers that need the search / describe / execute / read /
277
- * getPrompt API (e.g. embedding into a custom agent runtime).
278
- */
279
- provider(): McpCapabilityProvider;
280
- /**
281
- * One status row per configured server (lazy / prewarm / disabled
282
- * all included). Returned objects are plain readonly snapshots —
283
- * mutating them does NOT affect runtime state.
284
- */
285
- listServers(): McpServerStatus[];
286
- /**
287
- * Force a connection + catalog refresh for `serverId`. Returns the
288
- * post-start status row. Throws if `serverId` is not configured.
289
- *
290
- * For lazy servers, this is the explicit "connect now" trigger —
291
- * useful when a popout user clicks "Start" before any tool call has
292
- * forced the lazy connection.
293
- */
294
- startServer(serverId: string): Promise<McpServerStatus>;
295
- /**
296
- * Disconnect `serverId` — closes the transport, drops the pending
297
- * request queue, but keeps the server in the config so a subsequent
298
- * `startServer` / `listTools` can reconnect. Returns the post-stop
299
- * status (`status: 'idle'`).
300
- */
301
- stopServer(serverId: string): Promise<McpServerStatus>;
302
- /**
303
- * Return the most recent runtime diagnostic envelope for `serverId`
304
- * — status, last error, last cached timestamp. Designed as the data
305
- * source for a popout "Logs" pane.
306
- *
307
- * Logs API is intentionally conservative in v0.7.42: only the last
308
- * error message + status are exposed. A future iteration may add a
309
- * ring buffer of recent events; the field shape will extend (add
310
- * fields), never break (rename / remove).
311
- */
312
- getServerLogs(serverId: string): McpServerLogs;
313
- /**
314
- * Return the tool descriptors for `serverId`. Triggers a lazy
315
- * connect + catalog fetch if the catalog has not yet been built;
316
- * pass `{ forceRefresh: true }` to force a fresh catalog regardless
317
- * of cache state.
318
- *
319
- * Only `kind === 'tool'` descriptors are returned (filters out
320
- * resources + prompts so popout consumers can render a clean
321
- * "tools" table). Use the underlying `provider().describe(id)` for
322
- * full descriptor introspection including resources + prompts.
323
- */
324
- listTools(serverId: string, options?: {
325
- forceRefresh?: boolean;
326
- }): Promise<McpServerToolList>;
327
- /**
328
- * Return the full catalog snapshot for `serverId` — every tool,
329
- * resource, and prompt the server exposes — plus lightweight catalog
330
- * items for menu rendering. `listTools` is the tools-only fast path;
331
- * use this when the popout needs to render resources / prompts panes
332
- * alongside tools.
333
- *
334
- * Triggers a lazy connect + catalog fetch if the catalog has not yet
335
- * been built; pass `{ forceRefresh: true }` to force a fresh catalog
336
- * regardless of cache state.
337
- */
338
- getCatalog(serverId: string, options?: {
339
- forceRefresh?: boolean;
340
- }): Promise<McpServerCatalog>;
341
- /**
342
- * Dispose all runtimes. After calling, the manager is no longer
343
- * usable for `startServer` / `listTools` (they would reconnect, but
344
- * the consumer should construct a fresh manager instead).
345
- */
346
- dispose(): Promise<void>;
347
- /** v0.7.42 — escape hatch for advanced uses; usually consumers use the typed methods above. */
348
- search(query: string, options?: {
349
- kind?: CapabilityKind;
350
- limit?: number;
351
- server?: string;
352
- }): Promise<readonly McpCatalogItem[]>;
353
- /** v0.7.42 — escape hatch for advanced uses; usually consumers use {@link listTools}. */
354
- describe(id: string): Promise<McpCapabilityDescriptor | undefined>;
355
- /** v0.7.42 — invoke a tool by capability id (`mcp://<serverId>/<kind>/<name>`). */
356
- execute(id: string, input: Record<string, unknown>): Promise<CapabilityResult>;
357
- /** v0.7.42 — read a resource by capability id. */
358
- read(id: string, options?: Record<string, unknown>): Promise<CapabilityResult>;
359
- private requireRuntime;
360
- private buildStatus;
361
- }
362
- /**
363
- * Convenience factory matching the rest of the FEATURE_186 surface
364
- * naming (`createSessionControl`, etc.). Equivalent to
365
- * `new McpManager(servers, options)`.
366
- */
367
- declare function createMcpManager(servers: McpServersConfig | undefined, options?: McpProviderOptions): McpManager;
368
-
369
- export { McpCapabilityProvider as b, McpManager as e, McpServerRuntime as j, createMcpCapabilityId as p, createMcpManager as q, createMcpTransport as r, defaultMcpCacheDir as s, getMcpCachePaths as t, parseMcpCapabilityId as u, searchMcpCatalog as v };
370
- export type { McpCapabilityDescriptor as M, McpCapabilityKind as a, McpCapabilityRisk as c, McpCatalogItem as d, McpProviderOptions as f, McpServerCatalog as g, McpServerCatalogSnapshot as h, McpServerLogs as i, McpServerRuntimeDiagnostics as k, McpServerStatus as l, McpServerToolList as m, McpTransport as n, McpTransportEvents as o };