@kodax-ai/kodax 0.7.40 → 0.7.41

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/CHANGELOG.md +57 -0
  2. package/dist/chunks/{chunk-NDNILSTR.js → chunk-5TFLMGER.js} +1 -1
  3. package/dist/chunks/{chunk-FAVPT4P7.js → chunk-6OB4AJOM.js} +1 -1
  4. package/dist/chunks/chunk-HYWVRTFA.js +1233 -0
  5. package/dist/chunks/chunk-SX2IS5JP.js +16 -0
  6. package/dist/chunks/chunk-ZPJPNLBK.js +462 -0
  7. package/dist/chunks/{compaction-config-A7XZ6H5Y.js → compaction-config-LT5PEXPT.js} +1 -1
  8. package/dist/chunks/{construction-bootstrap-OFPUZTXQ.js → construction-bootstrap-HBCWJFHC.js} +1 -1
  9. package/dist/chunks/dist-V3BS2NKB.js +2 -0
  10. package/dist/chunks/{utils-DFMYJUTE.js → utils-FAFUQJ2A.js} +1 -1
  11. package/dist/index.d.ts +232 -7
  12. package/dist/index.js +2 -2
  13. package/dist/kodax_cli.js +922 -912
  14. package/dist/sdk-agent.d.ts +1459 -10
  15. package/dist/sdk-agent.js +1 -1
  16. package/dist/sdk-coding.d.ts +4543 -14
  17. package/dist/sdk-coding.js +1 -1
  18. package/dist/sdk-llm.d.ts +209 -10
  19. package/dist/sdk-repl.d.ts +2694 -13
  20. package/dist/sdk-repl.js +1 -1
  21. package/dist/sdk-skills.d.ts +487 -11
  22. package/dist/types-chunks/bash-prefix-extractor.d-B2iliwdi.d.ts +2432 -0
  23. package/dist/types-chunks/capability.d-BxNgd1-c.d.ts +368 -0
  24. package/dist/types-chunks/cost-tracker.d-C4dMlQuV.d.ts +342 -0
  25. package/dist/types-chunks/history-cleanup.d-q1vAvCss.d.ts +1266 -0
  26. package/dist/types-chunks/instance-discovery.d-DZhp77vb.d.ts +1217 -0
  27. package/dist/types-chunks/resolver.d-BwD6TKz7.d.ts +262 -0
  28. package/dist/types-chunks/storage.d-Bv9T99Qu.d.ts +584 -0
  29. package/dist/types-chunks/types.d-C5mHR87z.d.ts +119 -0
  30. package/package.json +8 -3
  31. package/dist/acp_events.d.ts +0 -109
  32. package/dist/acp_logger.d.ts +0 -20
  33. package/dist/acp_server.d.ts +0 -92
  34. package/dist/chunks/chunk-CLS57NPX.js +0 -460
  35. package/dist/chunks/chunk-QZEDWITG.js +0 -1226
  36. package/dist/chunks/chunk-Z5EBDA6R.js +0 -15
  37. package/dist/chunks/dist-OTUF22DA.js +0 -2
  38. package/dist/cli_commands.d.ts +0 -17
  39. package/dist/cli_option_helpers.d.ts +0 -49
  40. package/dist/cli_option_helpers.test.d.ts +0 -1
  41. package/dist/constructed_cli.d.ts +0 -82
  42. package/dist/constructed_cli.test.d.ts +0 -1
  43. package/dist/kodax_cli.d.ts +0 -7
  44. package/dist/self_modify_cli.d.ts +0 -81
  45. package/dist/self_modify_cli.test.d.ts +0 -9
  46. package/dist/skill_cli.d.ts +0 -15
  47. package/dist/skill_cli.test.d.ts +0 -1
@@ -1,2 +1,2 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{$ as mr,$a as me,$b as ff,$c as mm,$d as mp,A as Fo,Aa as Fr,Ab as Fe,Ac as Ff,Ad as Fm,B as Go,Ba as Gr,Bb as Ge,Bc as Gf,Bd as Gm,C as Ho,Ca as Hr,Cb as He,Cc as Hf,Cd as Hm,D as Io,Da as Ir,Db as Ie,Dc as If,Dd as Im,E as Jo,Ea as Jr,Eb as Je,Ec as Jf,Ed as Jm,F as Ko,Fa as Kr,Fb as Ke,Fc as Kf,Fd as Km,G as Lo,Ga as Lr,Gb as Le,Gc as Lf,Gd as Lm,H as Mo,Ha as Mr,Hb as Me,Hc as Mf,Hd as Mm,I as No,Ia as Nr,Ib as Ne,Ic as Nf,Id as Nm,J as Oo,Ja as Or,Jb as Oe,Jc as Of,Jd as Om,K as Po,Ka as Pr,Kb as Pe,Kc as Pf,Kd as Pm,L as Qo,La as Qr,Lb as Qe,Lc as Qf,Ld as Qm,M as Ro,Ma as Rr,Mb as Re,Mc as Rf,Md as Rm,N as So,Na as Sr,Nb as Se,Nc as Sf,Nd as Sm,O as To,Oa as Tr,Ob as Te,Oc as Tf,Od as Tm,P as Uo,Pa as Ur,Pb as Ue,Pc as Uf,Pd as Um,Q as Vo,Qa as Vr,Qb as Ve,Qc as Vf,Qd as Vm,R as Wo,Ra as Wr,Rb as We,Rc as Wf,Rd as Wm,S as Xo,Sa as Xr,Sb as Xe,Sc as Xf,Sd as Xm,T as Yo,Ta as Yr,Tb as Ye,Tc as Yf,Td as Ym,U as Zo,Ua as Zr,Ub as Ze,Uc as Zf,Ud as Zm,V as _o,Va as _r,Vb as _e,Vc as _f,Vd as _m,W as $o,Wa as $r,Wb as $e,Wc as $f,Wd as $m,X as or,Xa as oe,Xb as of,Xc as om,Xd as op,Y as rr,Ya as re,Yb as rf,Yc as rm,Yd as rp,Z as er,Za as ee,Zc as em,Zd as ep,_ as fr,_a as fe,_b as ef,_c as fm,_d as fp,a as N,aa as pr,ab as pe,ac as mf,ad as pm,ae as pp,b as O,ba as tr,bb as te,bc as pf,bd as tm,be as tp,c as P,ca as xr,cb as xe,cc as tf,cd as xm,ce as xp,d as Q,da as ar,db as ae,dc as xf,dd as am,de as ap,e as R,ea as br,eb as be,ec as af,ed as bm,ee as bp,f as bo,fa as cr,fb as ce,fc as bf,fd as cm,fe as cp,g as co,ga as dr,gb as de,gc as cf,gd as dm,ge as dp,h as go,ha as gr,hb as ge,hc as df,hd as gm,he as gp,i as ho,ia as hr,ib as he,ic as gf,id as hm,ie as hp,j as io,ja as ir,jb as ie,jc as hf,jd as im,je as ip,k as jo,ka as jr,kb as je,kc as jf,kd as jm,ke as jp,l as ko,la as kr,lb as ke,lc as kf,ld as km,le as kp,m as lo,ma as lr,mb as le,mc as lf,md as lm,me as lp,n as no,na as nr,nb as ne,nc as nf,nd as nm,ne as np,o as qo,oa as qr,ob as qe,oc as qf,od as qm,p as so,pa as sr,pb as se,pc as sf,pd as sm,q as uo,qa as ur,qb as ue,qc as uf,qd as um,r as vo,ra as vr,rb as ve,rc as vf,rd as vm,s as wo,sa as wr,sb as we,sc as wf,sd as wm,t as yo,ta as yr,tb as ye,tc as yf,td as ym,u as zo,ua as zr,ub as ze,uc as zf,ud as zm,v as Ao,va as Ar,vb as Ae,vc as Af,vd as Am,w as Bo,wa as Br,wb as Be,wc as Bf,wd as Bm,x as Co,xa as Cr,xb as Ce,xc as Cf,xd as Cm,y as Do,ya as Dr,yb as De,yc as Df,yd as Dm,z as Eo,za as Er,zb as Ee,zc as Ef,zd as Em}from"./chunks/chunk-QZEDWITG.js";import{Da as xo,Ea as ao,Z as po,a as S,aa as to,b as T,c as U,d as V,e as W,f as X,h as Y,i as Z,j as _,k as $,l as oo,m as ro,n as eo,o as fo,p as mo}from"./chunks/chunk-Z5EBDA6R.js";import"./chunks/chunk-EQ5DGS2W.js";import{$ as A,C as c,I as d,J as g,O as h,P as i,Q as j,R as k,S as l,T as n,U as q,V as s,W as u,X as v,Y as w,Z as y,_ as z,a as o,aa as B,b as r,ba as C,c as e,ca as D,da as E,ea as F,fa as G,ga as H,ha as I,ia as J,j as f,ja as K,ka as L,la as M,t as m,u as p,v as t,w as x,x as a,y as b}from"./chunks/chunk-6QO6HWGU.js";import"./chunks/chunk-V4WSBIXB.js";export{Xm as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD,Ym as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD,kp as BASH_POLICY_SPEC,rp as BREAKER_ERROR_THRESHOLD,ep as BREAKER_WINDOW_MS,co as CANCELLED_TOOL_RESULT_MESSAGE,bo as CANCELLED_TOOL_RESULT_PREFIX,Nm as CODING_AGENTS,Im as CODING_AGENT_MARKER,Pf as CODING_INVARIANTS,Ff as CODING_SUMMARY_PROMPT,Gf as CODING_UPDATE_SUMMARY_PROMPT,zr as CapabilityDeniedError,Rf as Client,Ar as ConstructionManifestError,Hf as DEFAULT_CODING_AGENT_NAME,Am as DEFAULT_DANGEROUS_PATTERNS,wr as DEFAULT_HANDLER_TIMEOUT_MS,tf as DEFAULT_RESILIENCE_CONFIG,zm as DEFAULT_SAFE_PATTERNS,Wr as DEFAULT_SELF_MODIFY_BUDGET,gp as DEFAULT_SPECULATIVE_WINDOW_MS,ho as DEFAULT_TOOL_OUTPUT_MAX_BYTES,go as DEFAULT_TOOL_OUTPUT_MAX_LINES,mo as DefaultSummaryCompaction,$f as EMIT_CONTRACT_TOOL_NAME,om as EMIT_HANDOFF_TOOL_NAME,_f as EMIT_SCOUT_VERDICT_TOOL_NAME,rm as EMIT_VERDICT_TOOL_NAME,Er as EVALUATOR_AGENT_NAME,Q as ErrorCategory,Dr as GENERATOR_AGENT_NAME,Z as KODAX_API_MIN_INTERVAL,j as KODAX_DEFAULT_PROVIDER,T as KODAX_DEFAULT_TIMEOUT,U as KODAX_HARD_TIMEOUT,X as KODAX_MAX_INCOMPLETE_RETRIES,V as KODAX_MAX_RETRIES,S as KODAX_MAX_TOKENS,i as KODAX_PROVIDERS,h as KODAX_PROVIDER_SNAPSHOTS,f as KODAX_REASONING_MODE_SEQUENCE,W as KODAX_RETRY_BASE_DELAY,Y as KODAX_STAGGER_DELAY,he as KODAX_TOOLS,d as KodaXAnthropicCompatProvider,c as KodaXBaseProvider,Rf as KodaXClient,o as KodaXError,Bf as KodaXExtensionRuntime,g as KodaXOpenAICompatProvider,r as KodaXProviderError,e as KodaXRateLimitError,O as KodaXSessionError,P as KodaXTerminalError,N as KodaXToolError,Ke as LINEAGE_ENTRY_TYPES,Me as LineageCompaction,Le as LineageExtension,lm as McpCapabilityProvider,km as McpServerRuntime,Cr as PLANNER_AGENT_NAME,_ as PROMISE_PATTERN,Ce as PROMPT_SECTION_REGISTRY,tm as PROTOCOL_EMITTER_TOOLS,df as ProviderRecoveryCoordinator,io as READ_DEFAULT_LIMIT,ko as READ_MAX_LINE_CHARS,jo as READ_PREFLIGHT_SIZE_BYTES,Uo as REPOINTEL_DEFAULT_ENDPOINT,to as Runner,Br as SCOUT_AGENT_NAME,Be as SYSTEM_PROMPT,bf as StableBoundaryTracker,Jr as TASK_ENGINE_ROLE_AGENTS,xm as TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME,re as _resetRuntimeForTesting,me as activate,Lo as analyzeChangedScope,Ur as appendAuditEntry,Ue as appendSessionLineageLabel,Wf as applyFanoutBranchTransition,Ve as applySessionCompaction,br as applyToolResultGuardrail,$e as archiveOldIslands,Xf as assignFanoutBranchWorker,op as autoModeDenialShouldFallback,bp as bashSignalCollector,Kf as boundedRevise,pp as breakerShouldFallback,Lf as budgetCeiling,uf as buildAmaControllerDecision,He as buildCapabilityContextSections,Om as buildClassifierPrompt,qf as buildFallbackRoutingDecision,Tf as buildFanoutSchedulerPlan,Rr as buildLlmReviewPrompt,ff as buildPromptMessageContent,vf as buildPromptOverlay,Ge as buildPromptSnapshot,gf as buildProviderCapabilitySnapshot,sf as buildProviderPolicyHintsForDecision,hf as buildProviderPolicyPromptNotes,t as buildReasoningOverrideKey,Ko as buildRepoIntelligenceContext,Zo as buildRepoIntelligenceIndex,Ho as buildRepoOverview,Ze as buildSessionTree,Je as buildSystemPrompt,Ie as buildSystemPromptSnapshot,ap as checkAbsoluteDeny,ef as checkIncompleteToolCalls,yf as checkPromiseSignal,Qm as classify,Cm as classifyBashCommand,R as classifyError,af as classifyResilienceError,ao as cleanupIncompleteToolCalls,b as clearReasoningOverride,J as clearRuntimeModelProviders,dp as collectAllSignals,Em as computeInputSignature,Rm as computeRulesFingerprint,oe as configureRuntime,hr as convertCapabilityReadResult,gr as convertProviderSearchResults,Vf as countActiveFanoutBranches,_e as countActiveLineageMessages,oo as countTokens,ro as createAgent,Zm as createAutoModeDenialTracker,jp as createAutoModeToolGuardrail,Bm as createBashClassifierConfig,np as createBashPrefixExtractor,ue as createBuiltinToolDefinition,fp as createCircuitBreaker,Nr as createCtxProxy,y as createCustomProvider,If as createDefaultCodingAgent,Dm as createDenialTracker,Cf as createExtensionRuntime,Sf as createFanoutSchedulerInput,eo as createHandoff,fo as createInMemorySession,um as createKodaXTaskRunner,dm as createMcpCapabilityId,jm as createMcpTransport,De as createPromptSection,wf as createReasoningPlan,Pe as createSessionLineage,am as createToolResultTruncationGuardrail,cm as defaultMcpCacheDir,yr as defaultPolicy,$r as disableSelfModify,Mr as drainPendingSwaps,fm as emitContract,mm as emitHandoff,em as emitScoutVerdict,pm as emitVerdict,$ as estimateTokens,jf as evaluateProviderPolicy,Ir as evaluatorAgent,Mm as evaluatorCodingAgent,zf as exec,Ae as executeTool,of as extractArtifactLedger,lp as extractCommandPrefix,pf as extractComparableUserMessageText,dr as extractHtmlTitle,mf as extractPromptComparableText,Oe as extractTitleFromMessages,cp as fileSignalCollector,jr as finalizeRetrievalResult,ce as findByVersion,We as findPreviousUserEntryId,Ye as forkSessionLineage,vr as formatAgentsForPrompt,wm as formatParallelDispatchResult,lo as formatSize,Ne as generateSessionId,Hr as generatorAgent,Lm as generatorCodingAgent,Ef as getActiveExtensionRuntime,M as getAvailableProviderNames,se as getBuiltinRegisteredToolDefinition,qe as getBuiltinToolDefinition,A as getCustomProvider,D as getCustomProviderList,E as getCustomProviderModels,C as getCustomProviderNames,Hm as getDenialContext,Uf as getFanoutBranch,er as getImpactEstimate,sr as getKodaxGlobalDir,im as getMcpCachePaths,$o as getModuleContext,rr as getProcessContext,k as getProvider,s as getProviderConfiguredCapabilityProfile,q as getProviderConfiguredReasoningCapability,u as getProviderList,n as getProviderModel,v as getProviderModels,le as getRegisteredToolDefinition,_o as getRepoIntelligenceIndex,Io as getRepoOverview,fr as getRepoRoutingSignals,we as getRequiredToolParams,G as getRuntimeModelProvider,I as getRuntimeModelProviderNames,Qe as getSessionLineagePath,Re as getSessionMessagesFromLineage,or as getSymbolContext,je as getTool,ke as getToolDefinition,ne as getToolRegistrations,ar as getToolResultPolicy,Lr as hasPendingSwap,Mf as independentReview,nf as inferTaskType,Ao as inspectEditFailure,Xo as inspectRepoIntelligenceRuntime,B as isCustomProviderName,Gm as isDeniedRecently,L as isKnownProvider,vm as isParallelDispatchDirective,l as isProviderConfigured,w as isProviderName,H as isRuntimeModelProviderName,de as listAll,xe as listArtifacts,ve as listBuiltinToolDefinitions,be as listConstructed,ze as listToolDefinitions,ye as listTools,ur as loadAgentsFiles,Vm as loadAutoRules,Or as loadHandler,x as loadReasoningOverride,Zf as markFanoutBranchCancelled,Yf as markFanoutBranchCompleted,rf as mergeArtifactLedger,Ee as orderPromptSections,Um as parseAutoRules,Pm as parseClassifierOutput,zo as parseEditToolError,Sr as parseLlmReviewVerdict,gm as parseMcpCapabilityId,tp as parseModelSpec,uo as persistToolOutput,Gr as plannerAgent,Km as plannerCodingAgent,ae as readArtifact,Vr as readAuditEntries,Xr as readBudget,_r as readDisableState,hp as readSpeculativeWindowFromEnv,Sm as readTrustState,m as reasoningCapabilityToOverride,lf as reasoningModeToDepth,p as reasoningOverrideToCapability,cf as reconstructMessagesWithToolGuard,$m as recordAutoModeAllow,_m as recordAutoModeBlock,mp as recordBreakerError,Fm as recordDenial,Qf as registerCodingInvariants,nm as registerConfiguredMcpCapabilityProvider,z as registerCustomProviders,F as registerModelProvider,qm as registerOfficialSandboxExtension,po as registerPresetDispatcher,ie as registerTool,pe as rehydrateActiveArtifacts,Yr as remainingSelfModifyBudget,Mo as renderChangedScope,To as renderImpactEstimate,Qo as renderModuleContext,So as renderProcessContext,Fe as renderPromptSections,Jo as renderRepoOverview,ir as renderRetrievalResult,Ro as renderSymbolContext,Zr as resetBudget,xp as resolveClassifierModel,Kr as resolveConstructedAgent,K as resolveProvider,kf as resolveReasoningMode,Wo as resolveRepoIntelligenceMode,Vo as resolveRepoIntelligenceRuntimeConfig,xf as resolveResilienceConfig,Se as resolveSessionLineageTarget,Nf as resolveToolCapability,te as revoke,Xe as rewindSessionLineage,ge as rollbackSelfModify,Pr as runAstRules,Jf as runKodaX,Tr as runLlmReview,bm as runManagedTask,sm as runOrchestration,a as saveReasoningOverride,Fr as scoutAgent,Jm as scoutCodingAgent,hm as searchMcpCatalog,Df as setActiveExtensionRuntime,Te as setSessionLineageActiveEntry,ip as speculativeRace,ee as stage,Wm as stripAssistantText,cr as stripHtmlToText,fe as testArtifact,Go as toolAskUserQuestion,Co as toolBash,Po as toolChangedDiff,Oo as toolChangedScope,nr as toolCodeSearch,yo as toolEdit,Do as toolGlob,Eo as toolGrep,xr as toolImpactEstimate,Bo as toolInsertAfterAnchor,mr as toolModuleContext,Of as toolPermission,tr as toolProcessContext,vo as toolRead,No as toolRepoOverview,qr as toolSemanticLookup,pr as toolSymbolContext,Fo as toolUndo,lr as toolWebFetch,kr as toolWebSearch,wo as toolWrite,no as truncateHead,so as truncateLine,qo as truncateTail,Tm as trustProjectRules,xo as validateAndFixToolHistory,ym as validateSubtaskIndependence,Qr as validateToolSchemaForProvider,Yo as warmRepoIntelligenceRuntime,Af as webhook};
2
+ import{$ as mr,$a as fe,$b as ff,$c as mm,$d as mp,A as Fo,Aa as Fr,Ab as Ee,Ac as Ff,Ad as Fm,B as Go,Ba as Gr,Bb as Fe,Bc as Gf,Bd as Gm,C as Ho,Ca as Hr,Cb as Ge,Cc as Hf,Cd as Hm,D as Io,Da as Ir,Db as He,Dc as If,Dd as Im,E as Jo,Ea as Jr,Eb as Ie,Ec as Jf,Ed as Jm,F as Ko,Fa as Kr,Fb as Je,Fc as Kf,Fd as Km,G as Lo,Ga as Lr,Gb as Ke,Gc as Lf,Gd as Lm,H as Mo,Ha as Mr,Hb as Le,Hc as Mf,Hd as Mm,I as No,Ia as Nr,Ib as Me,Ic as Nf,Id as Nm,J as Oo,Ja as Or,Jb as Ne,Jc as Of,Jd as Om,K as Po,Ka as Pr,Kb as Oe,Kc as Pf,Kd as Pm,L as Qo,La as Qr,Lb as Pe,Lc as Qf,Ld as Qm,M as Ro,Ma as Rr,Mb as Qe,Mc as Rf,Md as Rm,N as So,Na as Sr,Nb as Re,Nc as Sf,Nd as Sm,O as To,Oa as Tr,Ob as Se,Oc as Tf,Od as Tm,P as Uo,Pb as Te,Pc as Uf,Pd as Um,Q as Vo,Qa as Ur,Qb as Ue,Qc as Vf,Qd as Vm,R as Wo,Ra as Vr,Rb as Ve,Rc as Wf,Rd as Wm,S as Xo,Sa as Wr,Sb as We,Sc as Xf,Sd as Xm,T as Yo,Ta as Xr,Tb as Xe,Tc as Yf,Td as Ym,U as Zo,Ua as Yr,Ub as Ye,Uc as Zf,Ud as Zm,V as _o,Va as Zr,Vb as Ze,Vc as _f,Vd as _m,W as $o,Wa as _r,Wb as _e,Wc as $f,Wd as $m,X as or,Xa as $r,Xb as $e,Xc as om,Xd as op,Y as rr,Ya as oe,Yb as of,Yc as rm,Yd as rp,Z as er,Za as re,Zb as rf,Zc as em,Zd as ep,_ as fr,_a as ee,_b as ef,_c as fm,_d as fp,a as N,aa as pr,ab as me,ac as mf,ad as pm,ae as pp,b as O,ba as tr,bb as pe,bc as pf,bd as tm,be as tp,c as P,ca as xr,cb as te,cc as tf,cd as xm,ce as xp,d as Q,da as ar,db as xe,dc as xf,dd as am,de as ap,e as R,ea as br,eb as ae,ec as af,ed as bm,ee as bp,f as bo,fa as cr,fb as be,fc as bf,fd as cm,fe as cp,g as co,ga as dr,gb as ce,gc as cf,gd as dm,ge as dp,h as go,ha as gr,hb as de,hc as df,hd as gm,he as gp,i as ho,ia as hr,ib as ge,ic as gf,id as hm,ie as hp,j as io,ja as ir,jb as he,jc as hf,jd as im,je as ip,k as jo,ka as jr,kb as ie,kc as jf,kd as jm,ke as jp,l as ko,la as kr,lb as je,lc as kf,ld as km,le as kp,m as lo,ma as lr,mb as ke,mc as lf,md as lm,me as lp,n as no,na as nr,nb as le,nc as nf,nd as nm,ne as np,o as qo,oa as qr,ob as ne,oc as qf,od as qm,oe as qp,p as so,pa as sr,pb as qe,pc as sf,pd as sm,q as uo,qa as ur,qb as se,qc as uf,qd as um,r as vo,ra as vr,rb as ue,rc as vf,rd as vm,s as wo,sa as wr,sb as ve,sc as wf,sd as wm,t as yo,ta as yr,tb as we,tc as yf,td as ym,u as zo,ua as zr,ub as ye,uc as zf,ud as zm,v as Ao,va as Ar,vb as ze,vc as Af,vd as Am,w as Bo,wa as Br,wb as Ae,wc as Bf,wd as Bm,x as Co,xa as Cr,xb as Be,xc as Cf,xd as Cm,y as Do,ya as Dr,yb as Ce,yc as Df,yd as Dm,z as Eo,za as Er,zb as De,zc as Ef,zd as Em}from"./chunks/chunk-HYWVRTFA.js";import{Ka as xo,La as ao,Z as po,a as S,aa as to,b as T,c as U,d as V,e as W,f as X,h as Y,i as Z,j as _,k as $,l as oo,m as ro,n as eo,o as fo,p as mo}from"./chunks/chunk-SX2IS5JP.js";import"./chunks/chunk-EQ5DGS2W.js";import{$ as A,C as c,I as d,J as g,O as h,P as i,Q as j,R as k,S as l,T as n,U as q,V as s,W as u,X as v,Y as w,Z as y,_ as z,a as o,aa as B,b as r,ba as C,c as e,ca as D,da as E,ea as F,fa as G,ga as H,ha as I,ia as J,j as f,ja as K,ka as L,la as M,t as m,u as p,v as t,w as x,x as a,y as b}from"./chunks/chunk-6QO6HWGU.js";import"./chunks/chunk-V4WSBIXB.js";export{Ym as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD,Zm as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD,lp as BASH_POLICY_SPEC,ep as BREAKER_ERROR_THRESHOLD,fp as BREAKER_WINDOW_MS,co as CANCELLED_TOOL_RESULT_MESSAGE,bo as CANCELLED_TOOL_RESULT_PREFIX,Om as CODING_AGENTS,Jm as CODING_AGENT_MARKER,Qf as CODING_INVARIANTS,Gf as CODING_SUMMARY_PROMPT,Hf as CODING_UPDATE_SUMMARY_PROMPT,_r as CapabilityDeniedError,Sf as Client,$r as ConstructionManifestError,If as DEFAULT_CODING_AGENT_NAME,Bm as DEFAULT_DANGEROUS_PATTERNS,Yr as DEFAULT_HANDLER_TIMEOUT_MS,hf as DEFAULT_RESILIENCE_CONFIG,Am as DEFAULT_SAFE_PATTERNS,ue as DEFAULT_SELF_MODIFY_BUDGET,hp as DEFAULT_SPECULATIVE_WINDOW_MS,ho as DEFAULT_TOOL_OUTPUT_MAX_BYTES,go as DEFAULT_TOOL_OUTPUT_MAX_LINES,mo as DefaultSummaryCompaction,em as EMIT_CONTRACT_TOOL_NAME,fm as EMIT_HANDOFF_TOOL_NAME,rm as EMIT_SCOUT_VERDICT_TOOL_NAME,mm as EMIT_VERDICT_TOOL_NAME,fe as EVALUATOR_AGENT_NAME,Q as ErrorCategory,ee as GENERATOR_AGENT_NAME,Z as KODAX_API_MIN_INTERVAL,j as KODAX_DEFAULT_PROVIDER,T as KODAX_DEFAULT_TIMEOUT,U as KODAX_HARD_TIMEOUT,X as KODAX_MAX_INCOMPLETE_RETRIES,V as KODAX_MAX_RETRIES,S as KODAX_MAX_TOKENS,i as KODAX_PROVIDERS,h as KODAX_PROVIDER_SNAPSHOTS,f as KODAX_REASONING_MODE_SEQUENCE,W as KODAX_RETRY_BASE_DELAY,Y as KODAX_STAGGER_DELAY,Oe as KODAX_TOOLS,d as KodaXAnthropicCompatProvider,c as KodaXBaseProvider,Sf as KodaXClient,o as KodaXError,Ur as KodaXExtensionRuntime,g as KodaXOpenAICompatProvider,r as KodaXProviderError,e as KodaXRateLimitError,O as KodaXSessionError,P as KodaXTerminalError,N as KodaXToolError,Ar as LINEAGE_ENTRY_TYPES,Cr as LineageCompaction,Br as LineageExtension,nm as McpCapabilityProvider,lm as McpServerRuntime,re as PLANNER_AGENT_NAME,_ as PROMISE_PATTERN,rf as PROMPT_SECTION_REGISTRY,bm as PROTOCOL_EMITTER_TOOLS,qf as ProviderRecoveryCoordinator,io as READ_DEFAULT_LIMIT,ko as READ_MAX_LINE_CHARS,jo as READ_PREFLIGHT_SIZE_BYTES,Uo as REPOINTEL_DEFAULT_ENDPOINT,to as Runner,oe as SCOUT_AGENT_NAME,of as SYSTEM_PROMPT,lf as StableBoundaryTracker,ae as TASK_ENGINE_ROLE_AGENTS,$f as TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME,Ce as _resetRuntimeForTesting,Fe as activate,Lo as analyzeChangedScope,qe as appendAuditEntry,Kr as appendSessionLineageLabel,Xf as applyFanoutBranchTransition,Lr as applySessionCompaction,cr as applyToolResultGuardrail,Rr as archiveOldIslands,Yf as assignFanoutBranchWorker,rp as autoModeDenialShouldFallback,cp as bashSignalCollector,Lf as boundedRevise,tp as breakerShouldFallback,Mf as budgetCeiling,Cf as buildAmaControllerDecision,tf as buildCapabilityContextSections,Pm as buildClassifierPrompt,Af as buildFallbackRoutingDecision,Uf as buildFanoutSchedulerPlan,ke as buildLlmReviewPrompt,cf as buildPromptMessageContent,Df as buildPromptOverlay,pf as buildPromptSnapshot,sf as buildProviderCapabilitySnapshot,Bf as buildProviderPolicyHintsForDecision,uf as buildProviderPolicyPromptNotes,t as buildReasoningOverrideKey,Ko as buildRepoIntelligenceContext,Zo as buildRepoIntelligenceIndex,Ho as buildRepoOverview,Pr as buildSessionTree,af as buildSystemPrompt,xf as buildSystemPromptSnapshot,bp as checkAbsoluteDeny,bf as checkIncompleteToolCalls,Ff as checkPromiseSignal,Rm as classify,Dm as classifyBashCommand,R as classifyError,kf as classifyResilienceError,ao as cleanupIncompleteToolCalls,b as clearReasoningOverride,J as clearRuntimeModelProviders,gp as collectAllSignals,Fm as computeInputSignature,Sm as computeRulesFingerprint,Be as configureRuntime,ir as convertCapabilityReadResult,hr as convertProviderSearchResults,Wf as countActiveFanoutBranches,Qr as countActiveLineageMessages,oo as countTokens,ro as createAgent,_m as createAutoModeDenialTracker,kp as createAutoModeToolGuardrail,Cm as createBashClassifierConfig,qp as createBashPrefixExtractor,We as createBuiltinToolDefinition,mp as createCircuitBreaker,ge as createCtxProxy,y as createCustomProvider,Jf as createDefaultCodingAgent,Em as createDenialTracker,Vr as createExtensionRuntime,Tf as createFanoutSchedulerInput,eo as createHandoff,fo as createInMemorySession,vm as createKodaXTaskRunner,gm as createMcpCapabilityId,km as createMcpTransport,ef as createPromptSection,Ef as createReasoningPlan,Fr as createSessionLineage,om as createToolResultTruncationGuardrail,dm as defaultMcpCacheDir,Zr as defaultPolicy,Ae as disableSelfModify,de as drainPendingSwaps,tm as emitContract,xm as emitHandoff,pm as emitScoutVerdict,am as emitVerdict,$ as estimateTokens,vf as evaluateProviderPolicy,xe as evaluatorAgent,Nm as evaluatorCodingAgent,yr as exec,$e as executeTool,Sr as extractArtifactLedger,np as extractCommandPrefix,gf as extractComparableUserMessageText,gr as extractHtmlTitle,df as extractPromptComparableText,Er as extractTitleFromMessages,dp as fileSignalCollector,kr as finalizeRetrievalResult,Le as findByVersion,Mr as findPreviousUserEntryId,Or as forkSessionLineage,wr as formatAgentsForPrompt,ym as formatParallelDispatchResult,lo as formatSize,Dr as generateSessionId,te as generatorAgent,Mm as generatorCodingAgent,Xr as getActiveExtensionRuntime,M as getAvailableProviderNames,Ve as getBuiltinRegisteredToolDefinition,Ue as getBuiltinToolDefinition,A as getCustomProvider,D as getCustomProviderList,E as getCustomProviderModels,C as getCustomProviderNames,Im as getDenialContext,Vf as getFanoutBranch,er as getImpactEstimate,ur as getKodaxGlobalDir,jm as getMcpCachePaths,$o as getModuleContext,rr as getProcessContext,k as getProvider,s as getProviderConfiguredCapabilityProfile,q as getProviderConfiguredReasoningCapability,u as getProviderList,n as getProviderModel,v as getProviderModels,Se as getRegisteredToolDefinition,_o as getRepoIntelligenceIndex,Io as getRepoOverview,fr as getRepoRoutingSignals,Ye as getRequiredToolParams,G as getRuntimeModelProvider,I as getRuntimeModelProviderNames,Gr as getSessionLineagePath,Hr as getSessionMessagesFromLineage,or as getSymbolContext,Qe as getTool,Re as getToolDefinition,Te as getToolRegistrations,br as getToolResultPolicy,ce as hasPendingSwap,Nf as independentReview,zf as inferTaskType,Ao as inspectEditFailure,Xo as inspectRepoIntelligenceRuntime,B as isCustomProviderName,Hm as isDeniedRecently,L as isKnownProvider,wm as isParallelDispatchDirective,l as isProviderConfigured,w as isProviderName,H as isRuntimeModelProviderName,Me as listAll,Ie as listArtifacts,Xe as listBuiltinToolDefinitions,Ke as listConstructed,_e as listToolDefinitions,Ze as listTools,vr as loadAgentsFiles,Wm as loadAutoRules,he as loadHandler,x as loadReasoningOverride,_f as markFanoutBranchCancelled,Zf as markFanoutBranchCompleted,Tr as mergeArtifactLedger,ff as orderPromptSections,Vm as parseAutoRules,Qm as parseClassifierOutput,zo as parseEditToolError,le as parseLlmReviewVerdict,hm as parseMcpCapabilityId,xp as parseModelSpec,uo as persistToolOutput,pe as plannerAgent,Lm as plannerCodingAgent,mr as prewarmRepoIntelligenceCaches,Je as readArtifact,se as readAuditEntries,ve as readBudget,ze as readDisableState,ip as readSpeculativeWindowFromEnv,Tm as readTrustState,m as reasoningCapabilityToOverride,yf as reasoningModeToDepth,p as reasoningOverrideToCapability,nf as reconstructMessagesWithToolGuard,op as recordAutoModeAllow,$m as recordAutoModeBlock,pp as recordBreakerError,Gm as recordDenial,Rf as registerCodingInvariants,qm as registerConfiguredMcpCapabilityProvider,z as registerCustomProviders,F as registerModelProvider,sm as registerOfficialSandboxExtension,po as registerPresetDispatcher,Pe as registerTool,Ge as rehydrateActiveArtifacts,we as remainingSelfModifyBudget,Mo as renderChangedScope,To as renderImpactEstimate,Qo as renderModuleContext,So as renderProcessContext,mf as renderPromptSections,Jo as renderRepoOverview,jr as renderRetrievalResult,Ro as renderSymbolContext,ye as resetBudget,ap as resolveClassifierModel,be as resolveConstructedAgent,K as resolveProvider,wf as resolveReasoningMode,Wo as resolveRepoIntelligenceMode,Vo as resolveRepoIntelligenceRuntimeConfig,jf as resolveResilienceConfig,Ir as resolveSessionLineageTarget,Of as resolveToolCapability,He as revoke,Nr as rewindSessionLineage,Ne as rollbackSelfModify,ie as runAstRules,Kf as runKodaX,ne as runLlmReview,cm as runManagedTask,um as runOrchestration,a as saveReasoningOverride,me as scoutAgent,Km as scoutCodingAgent,im as searchMcpCatalog,Wr as setActiveExtensionRuntime,Jr as setSessionLineageActiveEntry,jp as speculativeRace,De as stage,Xm as stripAssistantText,dr as stripHtmlToText,Ee as testArtifact,Go as toolAskUserQuestion,Co as toolBash,Po as toolChangedDiff,Oo as toolChangedScope,qr as toolCodeSearch,yo as toolEdit,Do as toolGlob,Eo as toolGrep,ar as toolImpactEstimate,Bo as toolInsertAfterAnchor,pr as toolModuleContext,Pf as toolPermission,xr as toolProcessContext,vo as toolRead,No as toolRepoOverview,sr as toolSemanticLookup,tr as toolSymbolContext,Fo as toolUndo,nr as toolWebFetch,lr as toolWebSearch,wo as toolWrite,no as truncateHead,so as truncateLine,qo as truncateTail,Um as trustProjectRules,xo as validateAndFixToolHistory,zm as validateSubtaskIndependence,je as validateToolSchemaForProvider,Yo as warmRepoIntelligenceRuntime,zr as webhook};
package/dist/sdk-llm.d.ts CHANGED
@@ -1,15 +1,214 @@
1
+ import { s as KodaXProviderCapabilityProfile, o as KodaXMessage, I as KodaXReasoningRequest, Z as KodaXTokenUsage, i as KodaXContentBlock, h as KodaXCacheBoundary } from './types-chunks/capability.d-BxNgd1-c.js';
2
+ export { C as CapabilityKind, a as CapabilityProvider, b as CapabilityResult, K as KodaXAmaControllerDecision, c as KodaXAmaFanoutClass, d as KodaXAmaFanoutPolicy, e as KodaXAmaProfile, f as KodaXAmaTactic, g as KodaXAssuranceIntent, j as KodaXCustomProviderConfig, k as KodaXExecutionMode, l as KodaXExecutionPattern, m as KodaXHarnessProfile, n as KodaXImageBlock, p as KodaXModelDescriptor, q as KodaXMutationSurface, r as KodaXProtocolFamily, t as KodaXProviderConfig, u as KodaXProviderContextFidelity, v as KodaXProviderConversationSemantics, w as KodaXProviderEvidenceSupport, x as KodaXProviderLongRunningSupport, y as KodaXProviderMcpSupport, z as KodaXProviderMultimodalSupport, A as KodaXProviderSessionSupport, B as KodaXProviderStreamOptions, D as KodaXProviderToolCallingFidelity, E as KodaXProviderTransport, F as KodaXReasoningCapability, G as KodaXReasoningMode, H as KodaXReasoningOverride, J as KodaXRedactedThinkingBlock, L as KodaXReviewScale, M as KodaXRiskLevel, N as KodaXStreamResult, O as KodaXTaskActionability, P as KodaXTaskBudgetOverrides, Q as KodaXTaskComplexity, R as KodaXTaskFamily, S as KodaXTaskRoutingDecision, T as KodaXTaskType, U as KodaXTaskWorkIntent, V as KodaXTextBlock, W as KodaXThinkingBlock, X as KodaXThinkingBudgetMap, Y as KodaXThinkingDepth, _ as KodaXToolDefinition, $ as KodaXToolResultBlock, a0 as KodaXToolUseBlock } from './types-chunks/capability.d-BxNgd1-c.js';
3
+ export { K as KODAX_DEFAULT_PROVIDER, a as KODAX_DEFAULT_THINKING_BUDGETS, b as KODAX_PROVIDERS, c as KODAX_PROVIDER_SNAPSHOTS, d as KODAX_REASONING_MODE_SEQUENCE, e as KODAX_REASONING_SAFETY_RESERVE, f as KodaXAnthropicCompatProvider, g as KodaXError, h as KodaXNetworkError, i as KodaXOpenAICompatProvider, j as KodaXProviderError, k as KodaXRateLimitError, l as KodaXToolCallIdError, P as ProviderName, m as buildReasoningOverrideKey, n as clampThinkingBudget, o as clearReasoningOverride, p as clearRuntimeModelProviders, q as createCustomProvider, r as getAvailableProviderNames, s as getCustomProvider, t as getCustomProviderList, u as getCustomProviderModels, v as getCustomProviderNames, w as getDefaultThinkingDepthForMode, x as getProvider, y as getProviderConfiguredCapabilityProfile, z as getProviderConfiguredReasoningCapability, A as getProviderList, B as getProviderModel, C as getProviderModels, D as getReasoningCapability, E as getRuntimeModelProvider, F as getRuntimeModelProviderNames, G as isCustomProviderName, H as isKnownProvider, I as isProviderConfigured, J as isProviderName, L as isReasoningEnabled, M as isRuntimeModelProviderName, N as loadReasoningOverride, O as mapDepthToOpenAIReasoningEffort, Q as normalizeReasoningRequest, R as reasoningCapabilityToOverride, S as reasoningOverrideToCapability, T as registerCustomProviders, U as registerModelProvider, V as resolveProvider, W as resolveThinkingBudget, X as saveReasoningOverride } from './types-chunks/resolver.d-BwD6TKz7.js';
4
+ import { K as KodaXBaseProvider, a as CostTracker } from './types-chunks/cost-tracker.d-C4dMlQuV.js';
5
+ export { C as CostRate, D as DEFAULT_COST_RATES, b as KodaXOnRetryAfterCallback, c as KodaXRetryAfterEvent, P as ParseRetryAfterOptions, d as ProviderCostSummary, R as RetryAfterResult, e as RetryAfterSource, f as RetryRecord, S as SessionCostSummary, T as TokenUsageRecord, g as calculateCost, h as createCostTracker, i as extractHeadersFromError, j as formatCost, k as formatCostReport, l as getCostRate, m as getSummary, p as parseRetryAfter, r as recordRetry, n as recordUsage } from './types-chunks/cost-tracker.d-C4dMlQuV.js';
6
+ import '@anthropic-ai/sdk';
7
+ import 'openai';
8
+
1
9
  /**
2
- * SDK subpath entry — `@kodax-ai/kodax/llm`
10
+ * KodaX AI Constants
3
11
  *
4
- * Re-exports the entire `@kodax-ai/llm` public API — LLM provider
5
- * abstraction layer covering 12 providers (Anthropic / OpenAI / DeepSeek /
6
- * Kimi / Qwen / Zhipu / MiniMax / MiMo / Gemini / Codex / etc.).
12
+ * AI 层常量配置 - Provider 模块共享的常量
13
+ */
14
+ declare const KODAX_MAX_TOKENS = 32768;
15
+ /**
16
+ * Capped default output token budget for long-output-prone providers
17
+ * (e.g. zhipu-coding). Providers using this value request a modest budget
18
+ * on every turn so generation finishes well under server-side kill
19
+ * windows (Zhipu reportedly terminates streams around 8 minutes). If
20
+ * the model hits `stop_reason: max_tokens` at this cap, the agent loop
21
+ * escalates the same turn once to `KODAX_ESCALATED_MAX_OUTPUT_TOKENS`
22
+ * (see `coding/src/agent.ts` max_tokens handler).
23
+ */
24
+ declare const KODAX_CAPPED_MAX_OUTPUT_TOKENS = 32000;
25
+ /**
26
+ * One-shot escalated budget used by the agent loop when a capped turn
27
+ * returns `stop_reason: max_tokens`. The next stream call in the same
28
+ * logical turn is issued with this value. Set once per turn via the
29
+ * provider's public `setMaxOutputTokensOverride`; auto-cleared on the
30
+ * next successful response in `base.ts withRateLimit`.
31
+ */
32
+ declare const KODAX_ESCALATED_MAX_OUTPUT_TOKENS = 64000;
33
+ declare const KODAX_API_MIN_INTERVAL = 0.5;
34
+
35
+ interface NormalizedKodaXProviderCapabilityProfile extends KodaXProviderCapabilityProfile {
36
+ contextFidelity: NonNullable<KodaXProviderCapabilityProfile['contextFidelity']>;
37
+ toolCallingFidelity: NonNullable<KodaXProviderCapabilityProfile['toolCallingFidelity']>;
38
+ sessionSupport: NonNullable<KodaXProviderCapabilityProfile['sessionSupport']>;
39
+ longRunningSupport: NonNullable<KodaXProviderCapabilityProfile['longRunningSupport']>;
40
+ multimodalSupport: NonNullable<KodaXProviderCapabilityProfile['multimodalSupport']>;
41
+ evidenceSupport: NonNullable<KodaXProviderCapabilityProfile['evidenceSupport']>;
42
+ }
43
+ declare function normalizeCapabilityProfile(profile: KodaXProviderCapabilityProfile): NormalizedKodaXProviderCapabilityProfile;
44
+
45
+ declare function getCodexCliDefaultModel(): string;
46
+ declare function getGeminiCliDefaultModel(): string;
47
+ declare function getCodexCliKnownModels(): string[];
48
+ declare function getGeminiCliKnownModels(): string[];
49
+
50
+ /**
51
+ * Shared parser for streamed tool_use input across all provider transports.
52
+ *
53
+ * Why this exists: when a provider hits `stop_reason: max_tokens`
54
+ * (Anthropic) or `finish_reason: length` (OpenAI-compat) during a
55
+ * tool_use turn, the accumulated `arguments` / `input_json_delta`
56
+ * buffer is truncated mid-JSON. Two compat paths previously diverged:
57
+ *
58
+ * - anthropic.ts: strict → partial-json salvage → {}
59
+ * - openai.ts: strict → {} (lost the partial work)
7
60
  *
8
- * Usage:
9
- * ```ts
10
- * import { createProvider, resolveProvider } from '@kodax-ai/kodax/llm';
11
- * ```
61
+ * Centralising in one helper means the OpenAI path (deepseek-v4,
62
+ * pay-as-you-go kimi/qwen/zhipu, plus any custom provider extending
63
+ * KodaXOpenAICompatProvider) gets the same recovery as Anthropic-compat.
64
+ *
65
+ * Salvage strategy verified by deepseek-v4 bench (flash + pro, 6
66
+ * truncation runs at 800-8000 max_tokens): all real-world truncations
67
+ * land mid-string in the largest field with clean byte boundaries (no
68
+ * mid-multibyte, no mid-`\uXXXX` escape, no lone backslash). partial-json
69
+ * recovers a usable Record in 100% of observed cases.
70
+ */
71
+ /**
72
+ * Parse a tool_use input buffer with three-stage recovery.
73
+ *
74
+ * Stages:
75
+ * 1. strict `JSON.parse` — fast path for the 99% complete case.
76
+ * 2. `partial-json` salvage — closes open strings/brackets and
77
+ * returns whatever prefix was parseable. Lets the agent loop
78
+ * surface concrete partial work (e.g. half a `write` payload)
79
+ * to the model on the next turn instead of pretending the call
80
+ * had no input.
81
+ * 3. empty `{}` — last-resort fallback for total garbage.
82
+ *
83
+ * Always returns a plain object so the caller can construct a valid
84
+ * `KodaXToolUseBlock` without further type guards.
85
+ */
86
+ declare function parseToolInputWithSalvage(raw: string | undefined | null): Record<string, unknown>;
87
+
88
+ /**
89
+ * sideQuery — independent one-shot LLM invocation.
90
+ *
91
+ * Used by features that need a clean LLM call outside the main agent loop.
92
+ * The auto mode classifier (FEATURE_092) is the first consumer; future
93
+ * users include compaction, title generation, and SA mutation reflection.
94
+ *
95
+ * Constraints (deliberate):
96
+ * - tools=[] hardcoded — sideQuery is single-turn, no tool loop
97
+ * - text-only output — tool_use blocks from the model produce stopReason='error'
98
+ * - independent timeout (default 30s; classifier overrides to ~8s)
99
+ * - independent cost bucket via querySource (mapped to TokenUsageRecord.role)
100
+ *
101
+ * Failure handling: never throws. Timeout, abort, provider error, and
102
+ * unexpected tool_use all produce a result with stopReason='timeout' /
103
+ * 'aborted' / 'error' so callers implement their own degradation.
104
+ */
105
+
106
+ type SideQueryStopReason = 'end_turn' | 'max_tokens' | 'timeout' | 'aborted' | 'error';
107
+ interface SideQueryRequest {
108
+ readonly provider: KodaXBaseProvider;
109
+ readonly model: string;
110
+ readonly system: string;
111
+ readonly messages: readonly KodaXMessage[];
112
+ readonly reasoning?: KodaXReasoningRequest;
113
+ readonly timeoutMs?: number;
114
+ readonly abortSignal?: AbortSignal;
115
+ readonly querySource: string;
116
+ readonly costTracker?: CostTracker;
117
+ }
118
+ interface SideQueryResult {
119
+ readonly text: string;
120
+ readonly usage: KodaXTokenUsage;
121
+ readonly costTracker?: CostTracker;
122
+ readonly stopReason: SideQueryStopReason;
123
+ readonly error?: Error;
124
+ }
125
+ declare function sideQuery(req: SideQueryRequest): Promise<SideQueryResult>;
126
+
127
+ /**
128
+ * KodaX Cache Control — FEATURE_116 (v0.7.37)
129
+ *
130
+ * Helpers for inserting and lowering `KodaXCacheBoundary` markers across
131
+ * the prompt assembly path. The two halves of the contract:
132
+ *
133
+ * producer side — `insertCacheBoundary(blocks, hint)` appends a
134
+ * boundary to the end of any stable prefix (system
135
+ * prompt blocks, role prompt blocks, …).
136
+ * consumer side — `lowerCacheBoundaries(blocks, mode)` is called by
137
+ * a provider base class right before serialisation:
138
+ * - `attach`: write `cache_control` onto the block
139
+ * immediately before each boundary, then drop the
140
+ * boundaries (Anthropic-compat path).
141
+ * - `strip`: drop the boundaries with no further
142
+ * action (OpenAI-compat / ACP CLI bridge path).
143
+ *
144
+ * The boundary marker is purely client-side and MUST be removed before
145
+ * a request is sent over the wire. Provider subclasses do nothing —
146
+ * lowering happens once per base class in `KodaXAnthropicCompatProvider`,
147
+ * `KodaXOpenAICompatProvider`, and `KodaXAcpProvider`.
148
+ */
149
+
150
+ /**
151
+ * Block shape Anthropic accepts where a `cache_control` field can be
152
+ * legally attached. Used in `lowerCacheBoundaries` mode `'attach'` to
153
+ * mark the preceding block as a cache prefix.
154
+ */
155
+ interface KodaXAnthropicCacheableBlock {
156
+ type: string;
157
+ cache_control?: {
158
+ type: 'ephemeral';
159
+ };
160
+ [key: string]: unknown;
161
+ }
162
+ type KodaXCacheLowerMode = 'attach' | 'strip';
163
+ /**
164
+ * Append a cache-boundary marker to a block array. Idempotent: if the
165
+ * last block is already a boundary with the same hint, the array is
166
+ * returned unchanged (avoids accidental double-marking when the same
167
+ * stable prefix is composed twice).
168
+ */
169
+ declare function insertCacheBoundary<T extends KodaXContentBlock>(blocks: readonly T[], hint?: KodaXCacheBoundary['hint']): readonly (T | KodaXCacheBoundary)[];
170
+ /**
171
+ * Type-guard. Cheap to call repeatedly during lowering.
172
+ *
173
+ * Structural narrowing rather than just `type === 'cache-boundary'`:
174
+ * the block must carry no fields beyond `type` and the optional `hint`.
175
+ * This prevents an external wire payload that happens to carry
176
+ * `type: 'cache-boundary'` plus other fields (a coincidental name
177
+ * collision) from being silently stripped during lowering.
178
+ */
179
+ declare function isCacheBoundary(block: unknown): block is KodaXCacheBoundary;
180
+ /**
181
+ * Provider-base-class entry point. Walks the block array once.
182
+ *
183
+ * - `mode === 'attach'`: for each boundary, set
184
+ * `cache_control: { type: 'ephemeral' }` on the immediately preceding
185
+ * non-boundary block, then drop the boundary itself. If a boundary is
186
+ * the first block (no predecessor) it is silently dropped — there is
187
+ * nothing to attach to. If multiple boundaries land back-to-back, only
188
+ * the predecessor of the *first* one in the run is marked (the others
189
+ * collapse, since they would all attach to the same predecessor).
190
+ *
191
+ * - `mode === 'strip'`: drop every boundary. No `cache_control` is
192
+ * added. Used by adapters whose wire format does not expose a
193
+ * client-side cache marker (OpenAI-compat, ACP CLI bridge).
194
+ *
195
+ * Always returns a NEW array (never mutates input — the caller may hold
196
+ * references to the original payload for diagnostics).
197
+ */
198
+ declare function lowerCacheBoundaries<T extends KodaXAnthropicCacheableBlock>(blocks: readonly (T | KodaXCacheBoundary)[], mode: KodaXCacheLowerMode): T[];
199
+ /**
200
+ * Drop every cache boundary from a block array without attaching any
201
+ * cache marker. Convenience wrapper for `lowerCacheBoundaries(blocks, 'strip')`
202
+ * for callers that only need the strip behaviour.
12
203
  *
13
- * See docs/ADR.md ADR-024 for the SDK formalization decision.
204
+ * Generic bound is intentionally loose (`{ type: string }`) so the helper
205
+ * is callable both at the KodaX-internal level (KodaXContentBlock arrays)
206
+ * and at the provider-wire level (Anthropic-compat / OpenAI-compat block
207
+ * shapes that include extra wire fields).
14
208
  */
15
- export * from '@kodax-ai/llm';
209
+ declare function stripCacheBoundaries<T extends {
210
+ type: string;
211
+ }>(blocks: readonly (T | KodaXCacheBoundary)[]): T[];
212
+
213
+ export { CostTracker, KODAX_API_MIN_INTERVAL, KODAX_CAPPED_MAX_OUTPUT_TOKENS, KODAX_ESCALATED_MAX_OUTPUT_TOKENS, KODAX_MAX_TOKENS, KodaXBaseProvider, KodaXCacheBoundary, KodaXContentBlock, KodaXMessage, KodaXProviderCapabilityProfile, KodaXReasoningRequest, KodaXTokenUsage, getCodexCliDefaultModel, getCodexCliKnownModels, getGeminiCliDefaultModel, getGeminiCliKnownModels, insertCacheBoundary, isCacheBoundary, lowerCacheBoundaries, normalizeCapabilityProfile, parseToolInputWithSalvage, sideQuery, stripCacheBoundaries };
214
+ export type { KodaXAnthropicCacheableBlock, KodaXCacheLowerMode, SideQueryRequest, SideQueryResult, SideQueryStopReason };