@kodax-ai/kodax 0.7.50 → 0.7.52
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.
- package/CHANGELOG.md +1814 -1773
- package/README.md +1215 -1213
- package/README_CN.md +636 -634
- package/dist/chunks/agent-XXTR7T37.js +2 -0
- package/dist/chunks/argument-completer-VMH6VZ4X.js +2 -0
- package/dist/chunks/chunk-4RVSFOUT.js +420 -0
- package/dist/chunks/chunk-5USNUSTL.js +648 -0
- package/dist/chunks/chunk-7X7SOVER.js +492 -0
- package/dist/chunks/{chunk-HR64F32V.js → chunk-BFXFSEHK.js} +1 -1
- package/dist/chunks/chunk-HMATTIU6.js +574 -0
- package/dist/chunks/{chunk-SK4HOYT2.js → chunk-JJTUBNQX.js} +1 -1
- package/dist/chunks/chunk-LE6STNVN.js +31 -0
- package/dist/chunks/chunk-MFPYZT52.js +301 -0
- package/dist/chunks/{compaction-config-DDJSQ4OT.js → compaction-config-UBPCNGC2.js} +1 -1
- package/dist/chunks/{construction-bootstrap-4QNM2BVM.js → construction-bootstrap-BXRMA3KL.js} +1 -1
- package/dist/chunks/dist-IHH4BYIU.js +2 -0
- package/dist/chunks/{dist-OJSNNI7P.js → dist-Z6U7TWKJ.js} +1 -1
- package/dist/chunks/utils-6WZHBMCC.js +2 -0
- package/dist/index.d.ts +11 -11
- package/dist/index.js +4 -4
- package/dist/kodax_cli.js +1004 -978
- package/dist/provider-capabilities.json +2 -0
- package/dist/sdk-agent.d.ts +16 -10
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +32 -16
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.d.ts +3 -5
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-repl.d.ts +16 -727
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-session.d.ts +8 -224
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/types-chunks/{types.d-rPRl2LSB.d.ts → base.d-BBNUF9nz.d.ts} +271 -3
- package/dist/types-chunks/{bash-prefix-extractor.d-B0CIb0N3.d.ts → bash-prefix-extractor.d-DBFZEwop.d.ts} +15 -521
- package/dist/types-chunks/{capsule.d-CwBEm6M-.d.ts → capsule.d-CNonpwAZ.d.ts} +3 -3
- package/dist/types-chunks/guardrail.d-B18oO1gt.d.ts +518 -0
- package/dist/types-chunks/{process.d-BbiXD24v.d.ts → process.d-Bj82oJhD.d.ts} +348 -275
- package/dist/types-chunks/{resolver.d-CQfaJbht.d.ts → resolver.d-CCX9NXWP.d.ts} +2 -2
- package/dist/types-chunks/sdk-session-D4tqRl0_.d.ts +977 -0
- package/dist/types-chunks/{storage.d-J2GqOgaX.d.ts → storage.d-CabW10Nt.d.ts} +78 -3
- package/dist/types-chunks/types.d-D4jL-gAA.d.ts +273 -0
- package/dist/types-chunks/{utils.d-D_-jrRku.d.ts → utils.d-23Gn14zP.d.ts} +7 -81
- package/package.json +3 -3
- package/dist/chunks/argument-completer-3WX5B42G.js +0 -2
- package/dist/chunks/chunk-5UJQ2GKJ.js +0 -574
- package/dist/chunks/chunk-MFOMFMSK.js +0 -1056
- package/dist/chunks/chunk-UB5IAZHF.js +0 -476
- package/dist/chunks/chunk-XZY4CIDV.js +0 -31
- package/dist/chunks/chunk-YJLRBIEW.js +0 -301
- package/dist/chunks/dist-T256OSDI.js +0 -2
- package/dist/chunks/utils-JHIEOX6Z.js +0 -2
- package/dist/types-chunks/base.d-C4jYVjJh.d.ts +0 -270
- package/dist/types-chunks/types.d-BnjX2Gn4.d.ts +0 -297
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{$ as ec,$a as ed,$b as ee,$c as ef,$d as fg,A as Fb,Aa as Fc,Ab as Fd,Ac as Fe,Ad as Gf,Ae as Gg,B as Gb,Ba as Gc,Bb as Gd,Bc as Ge,Bd as Hf,Be as Hg,C as Hb,Ca as Hc,Cb as Hd,Cc as He,Cd as If,Ce as Ig,D as Ib,Da as Ic,Db as Id,Dc as Ie,Dd as Jf,De as Jg,E as Jb,Ea as Jc,Eb as Jd,Ec as Je,Ed as Kf,Ee as Kg,F as Kb,Fa as Kc,Fb as Kd,Fc as Ke,Fd as Lf,Fe as Lg,G as Lb,Ga as Lc,Gb as Ld,Gc as Le,Gd as Mf,Ge as Mg,H as Mb,Ha as Mc,Hb as Md,Hc as Me,Hd as Nf,He as Ng,I as Nb,Ia as Nc,Ib as Nd,Ic as Ne,Id as Of,Ie as Og,J as Ob,Ja as Oc,Jb as Od,Jc as Oe,Jd as Pf,Je as Pg,K as Pb,Ka as Pc,Kb as Pd,Kc as Pe,Kd as Qf,Ke as Qg,L as Qb,La as Qc,Lb as Qd,Lc as Qe,Ld as Rf,Le as Rg,M as Rb,Ma as Rc,Mb as Rd,Mc as Re,Md as Sf,Me as Sg,N as Sb,Na as Sc,Nb as Sd,Nc as Se,Nd as Tf,Ne as Tg,O as Tb,Oa as Tc,Ob as Td,Oc as Te,Od as Uf,Oe as Ug,P as Ub,Pa as Uc,Pb as Ud,Pc as Ue,Pd as Vf,Pe as Vg,Q as Vb,Qa as Vc,Qb as Vd,Qc as Ve,Qd as Wf,Qe as Wg,R as Wb,Ra as Wc,Rb as Wd,Rc as We,Rd as Xf,Re as Xg,S as Xb,Sa as Xc,Sb as Xd,Sc as Xe,Sd as Yf,Se as Yg,T as Yb,Ta as Yc,Tb as Yd,Tc as Ye,Td as Zf,Te as Zg,U as Zb,Ua as Zc,Ub as Zd,Uc as Ze,Ud as _f,Ue as _g,V as _b,Va as _c,Vb as _d,Vc as _e,Vd as $f,Ve as $g,W as $b,Wa as $c,Wb as $d,Wc as $e,Wd as ag,We as ah,X as ac,Xa as ad,Xb as ae,Xc as af,Xd as bg,Xe as bh,Y as bc,Ya as bd,Yb as be,Yc as bf,Yd as cg,Z as cc,Za as cd,Zb as ce,Zc as cf,Zd as dg,_ as dc,_a as dd,_b as de,_c as df,_d as eg,a as X,aa as fc,ab as fd,ac as fe,ad as ff,ae as gg,b as Y,ba as gc,bb as gd,bc as ge,bd as gf,be as hg,c as Z,ca as hc,cb as hd,cc as he,cd as hf,ce as ig,d as _,da as ic,db as id,dc as ie,dd as jf,de as jg,e as $,ea as jc,eb as jd,ec as je,ed as kf,ee as kg,f as kb,fa as kc,fb as kd,fc as ke,fd as lf,fe as lg,g as lb,ga as lc,gb as ld,gc as le,gd as mf,ge as mg,h as mb,ha as mc,hb as md,hc as me,hd as nf,he as ng,i as nb,ia as nc,ib as nd,ic as ne,id as of,ie as og,j as ob,ja as oc,jb as od,jc as oe,jd as pf,je as pg,k as pb,ka as pc,kb as pd,kc as pe,kd as qf,ke as qg,l as qb,la as qc,lb as qd,lc as qe,ld as rf,le as rg,m as rb,ma as rc,mb as rd,mc as re,md as sf,me as sg,n as sb,na as sc,nb as sd,nc as se,nd as tf,ne as tg,o as tb,oa as tc,ob as td,oc as te,od as uf,oe as ug,p as ub,pa as uc,pb as ud,pc as ue,pd as vf,pe as vg,q as vb,qa as vc,qb as vd,qc as ve,qd as wf,qe as wg,r as wb,ra as wc,rb as wd,rc as we,rd as xf,re as xg,s as xb,sa as xc,sb as xd,sc as xe,sd as yf,se as yg,t as yb,ta as yc,tb as yd,tc as ye,td as zf,te as zg,u as zb,ua as zc,ub as zd,uc as ze,ud as Af,ue as Ag,v as Ab,va as Ac,vb as Ad,vc as Ae,vd as Bf,ve as Bg,w as Bb,wa as Bc,wb as Bd,wc as Be,wd as Cf,we as Cg,x as Cb,xa as Cc,xb as Cd,xc as Ce,xd as Df,xe as Dg,y as Db,ya as Dc,yb as Dd,yc as De,yd as Ef,ye as Eg,z as Eb,za as Ec,zb as Ed,zc as Ee,zd as Ff,ze as Fg}from"./chunk-MFOMFMSK.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-XZY4CIDV.js";import{Ac as Ta,Bc as Ua,Cb as xa,Cc as Va,Db as ya,Dc as Wa,Eb as za,Fb as Aa,Gb as Ba,Hb as Ca,Ib as Da,Jb as Ea,Kb as Fa,Kc as Xa,Lb as Ga,Lc as Ya,Mb as Ha,Mc as Za,Nb as Ia,Nc as _a,Ob as Ja,Oc as $a,Pb as Ka,Pc as ab,Qb as La,Qc as bb,Rb as Ma,Sb as Na,Sc as cb,Tb as Oa,Tc as db,Ub as Pa,Uc as eb,Vb as Qa,Vc as fb,Wb as Ra,Wc as gb,Xc as hb,a as aa,b as ba,c as ca,cd as ib,d as da,dd as jb,e as ea,f as fa,h as ga,i as ha,j as ia,jb as va,k as ja,ka as pa,kb as wa,l as ka,m as la,n as ma,na as qa,o as na,p as oa,ua as ra,va as sa,wa as ta,xa as ua,zc as Sa}from"./chunk-5UJQ2GKJ.js";import"./chunk-V4WSBIXB.js";export{Tf as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD,Uf as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD,mg as BASH_POLICY_SPEC,hf as BLOCKER_REQUIRED_CONSECUTIVE_TURNS,Zf as BREAKER_ERROR_THRESHOLD,_f as BREAKER_WINDOW_MS,$g as BUILTIN_WORKFLOWS,lb as CANCELLED_TOOL_RESULT_MESSAGE,kb as CANCELLED_TOOL_RESULT_PREFIX,Jf as CODING_AGENT_MARKER,Ue as CODING_INVARIANTS,Je as CODING_SUMMARY_PROMPT,Ke as CODING_UPDATE_SUMMARY_PROMPT,Yc as CapabilityDeniedError,We as Client,Zc as ConstructionManifestError,Le as DEFAULT_CODING_AGENT_NAME,yf as DEFAULT_DANGEROUS_PATTERNS,Wc as DEFAULT_HANDLER_TIMEOUT_MS,le as DEFAULT_RESILIENCE_CONFIG,xf as DEFAULT_SAFE_PATTERNS,hd as DEFAULT_SELF_MODIFY_BUDGET,ig as DEFAULT_SPECULATIVE_WINDOW_MS,nb as DEFAULT_TOOL_OUTPUT_MAX_BYTES,mb as DEFAULT_TOOL_OUTPUT_MAX_LINES,Pg as DEFAULT_WORKFLOW_GENERATION_TIMEOUT_MS,oa as DefaultSummaryCompaction,Gf as EMIT_VERDICT_TOOL_NAME,_ as ErrorCategory,Cc 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,Gd as KODAX_TOOLS,l as KodaXAnthropicCompatProvider,k as KodaXBaseProvider,We as KodaXClient,a as KodaXError,Cd as KodaXExtensionRuntime,m as KodaXOpenAICompatProvider,b as KodaXProviderError,c as KodaXRateLimitError,Y as KodaXSessionError,Z as KodaXTerminalError,X as KodaXToolError,Sa as LINEAGE_ENTRY_TYPES,Fe as LSP_SERVERS,Ua as LineageCompaction,Ta as LineageExtension,Ge as LspService,xb as MANUAL_TOPIC_IDS,Da as McpAuthRequiredError,Pa as McpCapabilityProvider,Ca as McpExpiredSessionError,Qa as McpManager,Oa as McpServerRuntime,Bc as PLANNER_AGENT_NAME,ia as PROMISE_PATTERN,Zd as PROMPT_SECTION_REGISTRY,If as PROTOCOL_EMITTER_TOOLS,qe as ProviderRecoveryCoordinator,ob as READ_DEFAULT_LIMIT,qb as READ_MAX_LINE_CHARS,pb as READ_PREFLIGHT_SIZE_BYTES,Wb as REPOINTEL_DEFAULT_ENDPOINT,qa as Runner,Ac as SCOUT_AGENT_NAME,de as SELF_KNOWLEDGE_ROUTING_RULE,Yd as SYSTEM_PROMPT,vg as SYSTEM_WORKFLOW_LIMITS,oe as StableBoundaryTracker,Fc as TASK_ENGINE_ROLE_AGENTS,df as TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME,pg as TRACING_ENV,Dc as WORKER_AGENT_NAME,Og as WORKFLOW_GENERATION_SYSTEM_PROMPT,od as _resetRuntimeForTesting,rd as activate,Nb as analyzeChangedScope,fd as appendAuditEntry,ab as appendSessionLineageLabel,Oc as applyAccountingDelta,$e as applyFanoutBranchTransition,bb as applySessionCompaction,mc as applyToolResultGuardrail,hb as archiveOldIslands,af as assignFanoutBranchWorker,Yf as autoModeDenialShouldFallback,fg as bashSignalCollector,qg as bootstrapTracing,Qe as boundedRevise,bg as breakerShouldFallback,Re as budgetCeiling,ze as buildAmaControllerDecision,wg as buildApprovalSummary,Rc as buildBlockedGoal,ee as buildCapabilityContextSections,Kf as buildClassifierPrompt,Sc as buildCompleteGoal,Nc as buildCreatedGoal,xe as buildFallbackRoutingDecision,Ye as buildFanoutSchedulerPlan,mf as buildGoalRuntimeBinding,Na as buildInitializeCapabilities,cd as buildLlmReviewPrompt,qf as buildMcpReverseCapabilities,Pc as buildPausedGoal,ie as buildPromptMessageContent,Ae as buildPromptOverlay,be as buildPromptSnapshot,re as buildProviderCapabilitySnapshot,ye as buildProviderPolicyHintsForDecision,se as buildProviderPolicyPromptNotes,g as buildReasoningOverrideKey,Mb as buildRepoIntelligenceContext,$b as buildRepoIntelligenceIndex,Jb as buildRepoOverview,Qc as buildResumedGoal,ce as buildSelfKnowledgeRoutingRule,fb as buildSessionTree,ge as buildSystemPrompt,fe as buildSystemPromptSnapshot,Sg as buildWorkflowGenerationUserPrompt,eg as checkAbsoluteDeny,he as checkIncompleteToolCalls,Ce as checkPromiseSignal,xg as clampWorkflowLimits,Mf as classify,Af as classifyBashCommand,$ as classifyError,ne as classifyResilienceError,wa as cleanupIncompleteToolCalls,j as clearReasoningOverride,Q as clearRuntimeModelProviders,hg as collectAllSignals,Cf as computeInputSignature,Nf as computeRulesFingerprint,nd as configureRuntime,qc as convertCapabilityReadResult,pc as convertProviderSearchResults,_e as countActiveFanoutBranches,gb as countActiveLineageMessages,ka as countTokens,la as createAgent,Vf as createAutoModeDenialTracker,lg as createAutoModeToolGuardrail,zf as createBashClassifierConfig,og as createBashPrefixExtractor,Od as createBuiltinToolDefinition,$f as createCircuitBreaker,sg as createCodingWorkflowBackend,_c as createCtxProxy,C as createCustomProvider,Me as createDefaultCodingAgent,Bf as createDenialTracker,Dd as createExtensionRuntime,Xe as createFanoutSchedulerInput,ma as createHandoff,na as createInMemorySession,tf as createKodaXTaskRunner,ya as createMcpCapabilityId,Ra as createMcpManager,Ea as createMcpTransport,_d as createPromptSection,Be as createReasoningPlan,ug as createRunGraphWriter,Oe as createSessionControl,Xa as createSessionLineage,ef as createToolResultTruncationGuardrail,Ng as createWorkflowLifecycleController,Yg as createWorkflowPatternTemplateModule,Kg as createWorkflowRunManager,Zg as decideWorkflowInvocation,xa as defaultMcpCacheDir,Xc as defaultPolicy,md as disableSelfModify,Ia as discoverAuthorizationServerMetadata,Ad as discoverMarkdownAgents,Ja as discoverOAuthEndpoints,Ha as discoverProtectedResourceMetadata,Ag as discoverSavedWorkflows,Ic as drainPendingSwaps,Hf as emitVerdict,ja as estimateTokens,te as evaluateProviderPolicy,Uc as exec,Xd as executeTool,ib as extractArtifactLedger,ng as extractCommandPrefix,ke as extractComparableUserMessageText,oc as extractHtmlTitle,Ga as extractInsufficientScope,je as extractPromptComparableText,Fa as extractResourceMetadataUrl,Wa as extractTitleFromMessages,gg as fileSignalCollector,sc as finalizeRetrievalResult,xd as findByVersion,cb as findPreviousUserEntryId,eb as forkSessionLineage,zc as formatAgentsForPrompt,vf as formatParallelDispatchResult,rb as formatSize,Va as generateSessionId,Ug as generateWorkflow,Vg as generateWorkflowFromOptions,Fd as getActiveExtensionRuntime,sa as getAgentConfigHome,ta as getAgentConfigPath,Qd as getAllRegisteredTools,ua as getAppDataDir,T as getAvailableProviderNames,Nd as getBuiltinRegisteredToolDefinition,Md as getBuiltinToolDefinition,ah as getBuiltinWorkflow,K as getCustomModelCapabilities,E as getCustomProvider,H as getCustomProviderList,J as getCustomProviderModelDescriptors,I as getCustomProviderModels,G as getCustomProviderNames,He as getDefaultLspService,Lg as getDefaultWorkflowRunManager,Ff as getDenialContext,Ze as getFanoutBranch,ec as getImpactEstimate,xc as getKodaxGlobalDir,Ba as getMcpCachePaths,z as getModelCapabilities,bc as getModuleContext,dc as getProcessContext,q as getProvider,u as getProviderConfiguredCapabilityProfile,t as getProviderConfiguredReasoningCapability,v as getProviderList,s as getProviderModel,y as getProviderModelDescriptors,w as getProviderModels,Kd as getRegisteredToolDefinition,ac as getRepoIntelligenceIndex,Kb as getRepoOverview,fc as getRepoRoutingSignals,Ud as getRequiredToolParams,N as getRuntimeModelProvider,P as getRuntimeModelProviderNames,Ya as getSessionLineagePath,Za as getSessionMessagesFromLineage,cc as getSymbolContext,Id as getTool,Jd as getToolDefinition,Ld as getToolRegistrations,lc as getToolResultPolicy,Xg as getWorkflowPatternTemplate,Kc as goalTokenDelta,Hc as hasPendingSwap,we as inferTaskType,Cb as inspectEditFailure,Zb as inspectRepoIntelligenceRuntime,F as isCustomProviderName,Ef as isDeniedRecently,S as isKnownProvider,uf as isParallelDispatchDirective,r as isProviderConfigured,x as isProviderName,O as isRuntimeModelProviderName,Sd as isToolFileMutation,Td as isToolMutation,Rd as isToolPlanModeAllowed,Tc as isValidTokenBudget,De as languageIdForPath,yd as listAll,W as listAllModelCapabilities,ud as listArtifacts,A as listBuiltinModelCapabilities,Pd as listBuiltinToolDefinitions,bh as listBuiltinWorkflows,wd as listConstructed,L as listCustomProviderModelCapabilities,Wd as listToolDefinitions,Vd as listTools,Wg as listWorkflowPatternTemplates,yc as loadAgentsFiles,zd as loadAgentsFromMarkdown,Rf as loadAutoRules,Hg as loadGeneratedWorkflowFromRun,$c as loadHandler,h as loadReasoningOverride,Dg as loadSavedWorkflow,Cg as loadSavedWorkflowCapsule,Ma as loadValidToken,Jc as makeDisabledGoalToolsContext,cf as markFanoutBranchCancelled,bf as markFanoutBranchCompleted,pf as mcpRootsFromWorkspace,jb as mergeArtifactLedger,Bg as normalizeWorkflowModule,$d as orderPromptSections,rg as parallelInvestigation,Qf as parseAutoRules,Lf as parseClassifierOutput,Bb as parseEditToolError,dd as parseLlmReviewVerdict,za as parseMcpCapabilityId,cg as parseModelSpec,Tg as parseWorkflowGeneration,La as performOAuthLogin,vb as persistToolOutput,Jg as preflightWorkflowCapsule,gc as prewarmRepoIntelligenceCaches,vd as readArtifact,gd as readAuditEntries,id as readBudget,ld as readDisableState,jg as readSpeculativeWindowFromEnv,Of as readTrustState,e as reasoningCapabilityToOverride,ve as reasoningModeToDepth,f as reasoningOverrideToCapability,pe as reconstructMessagesWithToolGuard,Xf as recordAutoModeAllow,Wf as recordAutoModeBlock,ff as recordBlockerAttempt,ag as recordBreakerError,Df as recordDenial,Ve as registerCodingInvariants,of as registerConfiguredMcpCapabilityProvider,D as registerCustomProviders,M as registerModelProvider,Ka as registerOAuthClient,rf as registerOfficialSandboxExtension,pa as registerPresetDispatcher,Hd as registerTool,sd as rehydrateActiveArtifacts,jd as remainingSelfModifyBudget,Fg as renameSavedWorkflow,Ob as renderChangedScope,Vb as renderImpactEstimate,Sb as renderModuleContext,Ub as renderProcessContext,ae as renderPromptSections,Lb as renderRepoOverview,rc as renderRetrievalResult,Tb as renderSymbolContext,Gg as replaceSavedWorkflow,Ee as reportLspDiagnostics,gf as resetBlockerCounter,kd as resetBudget,dg as resolveClassifierModel,Gc as resolveConstructedAgent,yb as resolveKodaXManual,V as resolveModelCapabilities,R as resolveProvider,U as resolveProviderModelDescriptors,ue as resolveReasoningMode,Yb as resolveRepoIntelligenceMode,Xb as resolveRepoIntelligenceRuntimeConfig,me as resolveResilienceConfig,_a as resolveSessionLineageTarget,Se as resolveToolCapability,Qg as resolveWorkflowGenerationTimeoutMs,Mg as resolveWorkflowIdentity,td as revoke,db as rewindSessionLineage,Bd as rollbackSelfModify,ad as runAstRules,Ne as runKodaX,ed as runLlmReview,nf as runManagedTask,sf as runOrchestration,zg as runWorkflowFromOptions,yg as runWorkflowModule,tg as safeWorkflowArtifactName,Eg as saveGeneratedWorkflow,Ig as saveGeneratedWorkflowFromRun,i as saveReasoningOverride,Aa as searchMcpCatalog,Ed as setActiveExtensionRuntime,ra as setAgentConfigHome,$a as setSessionLineageActiveEntry,Mc as shouldFlipBudgetLimited,Ie as shutdownDefaultLspService,kg as speculativeRace,pd as stage,Pe as startKodaX,Sf as stripAssistantText,nc as stripHtmlToText,qd as testArtifact,Ib as toolAskUserQuestion,Eb as toolBash,Rb as toolChangedDiff,Qb as toolChangedScope,vc as toolCodeSearch,Ab as toolEdit,Fb as toolGlob,Gb as toolGrep,kc as toolImpactEstimate,Db as toolInsertAfterAnchor,hc as toolModuleContext,Te as toolPermission,jc as toolProcessContext,wb as toolRead,Pb as toolRepoOverview,wc as toolSemanticLookup,ic as toolSymbolContext,Hb as toolUndo,uc as toolWebFetch,tc as toolWebSearch,zb as toolWrite,sb as truncateHead,ub as truncateLine,tb as truncateTail,Pf as trustProjectRules,Lc as turnWallTimeDelta,va as validateAndFixToolHistory,B as validateCustomProviderConfig,Rg as validateGeneratedWorkflowSource,wf as validateSubtaskIndependence,bd as validateToolSchemaForProvider,lf as verifyGoalCompletion,_b as warmRepoIntelligenceRuntime,Vc as webhook,jf as withGoalBeforeNextTurn,kf as withGoalStopHook,Ec as workerAgent,_g as workflowStartOutcomeConsumesTurn};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{A as z,B as A,C as B,D as C,b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t,v as u,w as v,x as w,y as x,z as y}from"./chunk-HR64F32V.js";import"./chunk-MFOMFMSK.js";import"./chunk-XZY4CIDV.js";import"./chunk-5UJQ2GKJ.js";import"./chunk-V4WSBIXB.js";export{c as KODAX_CONFIG_FILE,a as KODAX_DIR,b as KODAX_SESSIONS_DIR,i as KODAX_VERSION,d as PREVIEW_MAX_LENGTH,p as describeProviderCapabilitySummary,r as describeReasoningCapabilityControl,s as describeReasoningExecution,A as formatProviderCapabilityDetailLines,z as formatProviderSourceKind,q as formatReasoningCapabilityShort,y as getGitRoot,k as getProviderAvailableModels,m as getProviderCapabilityProfile,n as getProviderCapabilitySnapshot,B as getProviderCommonPolicyScenarios,t as getProviderList,j as getProviderModel,o as getProviderPolicyDecision,l as getProviderReasoningCapability,h as getVersion,e as hydrateProcessEnvFromShell,u as isProviderConfigured,v as loadConfig,w as prepareRuntimeConfig,C as rateLimitedCall,g as registerConfiguredCustomProviders,f as resetShellEnvironmentHydrationForTesting,x as saveConfig};
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import { s as KodaXProviderConfig, n as KodaXMessage, Y as KodaXToolDefinition, G as KodaXReasoningRequest, A as KodaXProviderStreamOptions, L as KodaXStreamResult, a2 as KodaXVerifyCredentialResult, o as KodaXModelDescriptor, r as KodaXProviderCapabilityProfile, D as KodaXReasoningCapability, F as KodaXReasoningOverride } from './types.d-rPRl2LSB.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Retry-After header parsing — FEATURE_130 (v0.7.36).
|
|
5
|
-
*
|
|
6
|
-
* Handles the four forms KodaX's 12 provider adapters encounter when a
|
|
7
|
-
* model returns 429 (rate limit) or 503/529 (overloaded):
|
|
8
|
-
*
|
|
9
|
-
* 1. `Retry-After: 120` — integer seconds (HTTP 7231 standard)
|
|
10
|
-
* 2. `Retry-After: <HTTP-date>` — RFC 7231 IMF-fixdate
|
|
11
|
-
* e.g. "Wed, 21 Oct 2026 07:28:00 GMT"
|
|
12
|
-
* 3. `retry-after-ms: 45000` — Anthropic millisecond extension
|
|
13
|
-
* 4. (no Retry-After header present) — falls back to exponential backoff
|
|
14
|
-
* capped at `maxBackoffMs`, with optional jitter for the
|
|
15
|
-
* "thundering herd" protection.
|
|
16
|
-
*
|
|
17
|
-
* All return values are normalized to whole milliseconds and clamped to
|
|
18
|
-
* a sensible upper bound — never block the user for more than 120s, and
|
|
19
|
-
* never honor a header advertising a wait longer than `maxHeaderWaitMs`
|
|
20
|
-
* (default 120s). Beyond that limit we still extract the header but cap
|
|
21
|
-
* it; the calling provider can check `cappedFromHeader` to decide
|
|
22
|
-
* whether to surface a "rate limit exceeded — please wait" error to the
|
|
23
|
-
* user instead of silently sleeping for two minutes.
|
|
24
|
-
*
|
|
25
|
-
* Pattern-B (FEATURE_119) interaction: the helper is referentially
|
|
26
|
-
* transparent and stateless — it can be invoked concurrently by N
|
|
27
|
-
* parallel children without coordination. The retry loop in each
|
|
28
|
-
* provider holds its own attempt counter; this helper only translates
|
|
29
|
-
* headers/attempts into wait durations.
|
|
30
|
-
*
|
|
31
|
-
* Reference: opencode session/retry.ts:14-123 (4-form coverage).
|
|
32
|
-
*/
|
|
33
|
-
type RetryAfterSource = 'retry-after-seconds' | 'retry-after-date' | 'retry-after-ms' | 'exponential-backoff';
|
|
34
|
-
type RetryAfterResult = {
|
|
35
|
-
readonly type: 'header';
|
|
36
|
-
readonly waitMs: number;
|
|
37
|
-
readonly source: 'retry-after-seconds' | 'retry-after-date' | 'retry-after-ms';
|
|
38
|
-
/** True when the header value exceeded `maxHeaderWaitMs` and was clamped. */
|
|
39
|
-
readonly cappedFromHeader: boolean;
|
|
40
|
-
} | {
|
|
41
|
-
readonly type: 'backoff';
|
|
42
|
-
readonly waitMs: number;
|
|
43
|
-
readonly source: 'exponential-backoff';
|
|
44
|
-
readonly attempt: number;
|
|
45
|
-
};
|
|
46
|
-
interface ParseRetryAfterOptions {
|
|
47
|
-
/** Zero-based attempt index used by the backoff branch (0 = first retry). */
|
|
48
|
-
readonly attempt: number;
|
|
49
|
-
/** Base delay for exponential backoff. Default 1000ms. */
|
|
50
|
-
readonly baseBackoffMs?: number;
|
|
51
|
-
/** Maximum exponential backoff cap. Default 30000ms. */
|
|
52
|
-
readonly maxBackoffMs?: number;
|
|
53
|
-
/** Maximum wait honored from a header. Default 120000ms. */
|
|
54
|
-
readonly maxHeaderWaitMs?: number;
|
|
55
|
-
/**
|
|
56
|
-
* Override the "now" reference used by the HTTP-date branch.
|
|
57
|
-
* Test-only escape hatch — production code should leave this undefined.
|
|
58
|
-
*/
|
|
59
|
-
readonly now?: () => number;
|
|
60
|
-
/**
|
|
61
|
-
* Whether the backoff branch adds 0-25% jitter on top of the base
|
|
62
|
-
* exponential. Default true (matches the legacy `withRateLimit`
|
|
63
|
-
* jitter contract). Tests can pass `false` for deterministic output.
|
|
64
|
-
*/
|
|
65
|
-
readonly withJitter?: boolean;
|
|
66
|
-
}
|
|
67
|
-
type HeadersLike = Headers | Record<string, string | string[] | undefined> | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Parse rate-limit/overload retry-after headers (4 forms) and decide
|
|
70
|
-
* how long the caller should sleep before retrying. Returns either:
|
|
71
|
-
*
|
|
72
|
-
* - `{type: 'header', ...}` when one of the supported headers was found
|
|
73
|
-
* and converted into a wait duration; OR
|
|
74
|
-
* - `{type: 'backoff', ...}` falling back to exponential backoff for
|
|
75
|
-
* the given `attempt` index when no header is present.
|
|
76
|
-
*/
|
|
77
|
-
declare function parseRetryAfter(headers: HeadersLike, options: ParseRetryAfterOptions): RetryAfterResult;
|
|
78
|
-
/**
|
|
79
|
-
* Pull headers off a thrown error in the various shapes produced across
|
|
80
|
-
* provider SDKs (Anthropic, OpenAI, fetch-based custom providers).
|
|
81
|
-
* Returns `undefined` when no headers can be located — the helper then
|
|
82
|
-
* falls through to exponential backoff.
|
|
83
|
-
*/
|
|
84
|
-
declare function extractHeadersFromError(error: unknown): HeadersLike;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* KodaX Base Provider
|
|
88
|
-
*
|
|
89
|
-
* Provider 抽象基类 - 所有 Provider 的公共基础
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* FEATURE_130 (v0.7.36): structured payload fired through
|
|
94
|
-
* `KodaXEvents.onRetryAfter` whenever a provider's `withRateLimit`
|
|
95
|
-
* loop catches a 429 / 503 / 529 response and decides to wait. The
|
|
96
|
-
* `source` field carries which retry-after header form (or fallback)
|
|
97
|
-
* produced the wait duration so UI surfaces can show "provider asked
|
|
98
|
-
* us to wait 45s" vs "no header, exp-backoff guess of 4s".
|
|
99
|
-
*/
|
|
100
|
-
interface KodaXRetryAfterEvent {
|
|
101
|
-
readonly provider: string;
|
|
102
|
-
readonly waitMs: number;
|
|
103
|
-
readonly reason: 'rate-limit' | 'overloaded';
|
|
104
|
-
readonly source: RetryAfterSource;
|
|
105
|
-
readonly attempt: number;
|
|
106
|
-
readonly maxAttempts: number;
|
|
107
|
-
}
|
|
108
|
-
type KodaXOnRetryAfterCallback = (event: KodaXRetryAfterEvent) => void;
|
|
109
|
-
declare abstract class KodaXBaseProvider {
|
|
110
|
-
abstract readonly name: string;
|
|
111
|
-
abstract readonly supportsThinking: boolean;
|
|
112
|
-
protected abstract readonly config: KodaXProviderConfig;
|
|
113
|
-
/**
|
|
114
|
-
* Per-request override for `max_tokens` in the next provider call. Consumed
|
|
115
|
-
* once and cleared in `withRateLimit` after the next successful response.
|
|
116
|
-
* Two callers set this:
|
|
117
|
-
* 1. Context-overflow recovery inside `withRateLimit` (reduces budget
|
|
118
|
-
* when the model reports "prompt too long").
|
|
119
|
-
* 2. The agent loop's max_tokens escalation path, which flips this to
|
|
120
|
-
* `KODAX_ESCALATED_MAX_OUTPUT_TOKENS` when a capped-budget turn
|
|
121
|
-
* returns `stop_reason: max_tokens`. See `coding/src/agent.ts`.
|
|
122
|
-
*/
|
|
123
|
-
protected maxOutputTokensOverride?: number;
|
|
124
|
-
/**
|
|
125
|
-
* Public setter for the one-shot override above. Callers outside the
|
|
126
|
-
* provider package (notably the agent loop's escalation branch) use this
|
|
127
|
-
* to stage a larger budget for the next stream call in the same logical
|
|
128
|
-
* turn. Pass `undefined` to clear a stale override explicitly.
|
|
129
|
-
*/
|
|
130
|
-
setMaxOutputTokensOverride(value: number | undefined): void;
|
|
131
|
-
/**
|
|
132
|
-
* Returns the max_tokens value the provider will currently use on its
|
|
133
|
-
* next request. Precedence (highest to lowest):
|
|
134
|
-
* 1. One-shot override (agent escalation, context-overflow recovery)
|
|
135
|
-
* 2. User env var `KODAX_MAX_OUTPUT_TOKENS` (explicit user intent)
|
|
136
|
-
* 3. Active model descriptor's `maxOutputTokens` (FEATURE_098)
|
|
137
|
-
* 4. Provider config default
|
|
138
|
-
* 5. Global `KODAX_MAX_TOKENS` fallback
|
|
139
|
-
* Used by provider stream() paths and by the agent loop to decide
|
|
140
|
-
* whether escalation is applicable (see `coding/src/agent.ts`).
|
|
141
|
-
*/
|
|
142
|
-
getEffectiveMaxOutputTokens(model?: string): number;
|
|
143
|
-
/**
|
|
144
|
-
* Hard cap on a single streaming request's wall-clock duration (ms).
|
|
145
|
-
* Returns undefined when no cap is configured. Consumed by the
|
|
146
|
-
* resilience layer to abort a doomed stream before the server-side
|
|
147
|
-
* kill window fires; routed through `non_streaming_fallback`.
|
|
148
|
-
*
|
|
149
|
-
* Cascade (highest to lowest):
|
|
150
|
-
* 1. Active model descriptor's `streamMaxDurationMs`
|
|
151
|
-
* 2. Provider config default
|
|
152
|
-
* 3. undefined (watchdog disabled)
|
|
153
|
-
*/
|
|
154
|
-
getStreamMaxDurationMs(model?: string): number | undefined;
|
|
155
|
-
/**
|
|
156
|
-
* Resolves whether OpenAI-compat `reasoning_content` should echo back
|
|
157
|
-
* on replayed assistant messages for the given model. Same cascade as
|
|
158
|
-
* `getStreamMaxDurationMs`. Defaults to false when neither layer sets it.
|
|
159
|
-
*/
|
|
160
|
-
getEffectiveReplayReasoningContent(model?: string): boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Resolves whether Anthropic-style thinking signatures must verify
|
|
163
|
-
* strictly (Anthropic proper only). Same cascade as
|
|
164
|
-
* `getStreamMaxDurationMs`. Defaults to false (lenient) when neither
|
|
165
|
-
* layer sets it — matches third-party Anthropic-compat behavior.
|
|
166
|
-
*/
|
|
167
|
-
getEffectiveStrictThinkingSignature(model?: string): boolean;
|
|
168
|
-
abstract stream(messages: KodaXMessage[], tools: KodaXToolDefinition[], system: string, reasoning?: boolean | KodaXReasoningRequest, streamOptions?: KodaXProviderStreamOptions, signal?: AbortSignal): Promise<KodaXStreamResult>;
|
|
169
|
-
supportsNonStreamingFallback(): boolean;
|
|
170
|
-
complete(_messages: KodaXMessage[], _tools: KodaXToolDefinition[], _system: string, _reasoning?: boolean | KodaXReasoningRequest, _streamOptions?: KodaXProviderStreamOptions, _signal?: AbortSignal): Promise<KodaXStreamResult>;
|
|
171
|
-
isConfigured(): boolean;
|
|
172
|
-
/**
|
|
173
|
-
* FEATURE_216 v0.7.45 — Lightweight credential verification. Returns
|
|
174
|
-
* a never-throws envelope with `ok` + categorized `error`. Concrete
|
|
175
|
-
* compat base classes (`KodaXAnthropicCompatProvider`,
|
|
176
|
-
* `KodaXOpenAICompatProvider`) override this to dispatch by the
|
|
177
|
-
* `verifyStrategy` field. The default here returns `unsupported` so
|
|
178
|
-
* Provider classes that don't extend a compat base — or future ones
|
|
179
|
-
* yet to be wired — fail safely instead of throwing.
|
|
180
|
-
*
|
|
181
|
-
* Distinct from `isConfigured()`: that one is env-only (no network);
|
|
182
|
-
* this one hits the wire (zero or ~7 tokens depending on strategy)
|
|
183
|
-
* and verifies the key is actually accepted by the upstream.
|
|
184
|
-
*/
|
|
185
|
-
verifyCredential(_opts?: {
|
|
186
|
-
timeoutMs?: number;
|
|
187
|
-
signal?: AbortSignal;
|
|
188
|
-
}): Promise<KodaXVerifyCredentialResult>;
|
|
189
|
-
getModel(): string;
|
|
190
|
-
getAvailableModels(): string[];
|
|
191
|
-
getModelDescriptor(modelId?: string): KodaXModelDescriptor | undefined;
|
|
192
|
-
getBaseUrl(): string | undefined;
|
|
193
|
-
getApiKeyEnv(): string;
|
|
194
|
-
getCapabilityProfile(): KodaXProviderCapabilityProfile;
|
|
195
|
-
getConfiguredReasoningCapability(modelOverride?: string): KodaXReasoningCapability;
|
|
196
|
-
getReasoningCapability(modelOverride?: string): KodaXReasoningCapability;
|
|
197
|
-
getReasoningOverride(modelOverride?: string): KodaXReasoningOverride | undefined;
|
|
198
|
-
getReasoningOverrideKey(modelOverride?: string): string;
|
|
199
|
-
protected persistReasoningCapabilityOverride(capability: KodaXReasoningCapability, modelOverride?: string): void;
|
|
200
|
-
protected shouldFallbackForReasoningError(error: unknown, ...terms: string[]): boolean;
|
|
201
|
-
protected shouldFallbackForSpecificReasoningError(error: unknown, ...terms: string[]): boolean;
|
|
202
|
-
protected shouldFallbackForForcedToolChoiceError(error: unknown): boolean;
|
|
203
|
-
protected getReasoningFallbackChain(capability: KodaXReasoningCapability): KodaXReasoningCapability[];
|
|
204
|
-
/**
|
|
205
|
-
* 获取模型的上下文窗口大小
|
|
206
|
-
*
|
|
207
|
-
* Backwards-compatible no-arg form: resolves against the provider's
|
|
208
|
-
* default model descriptor. New call sites that know the active
|
|
209
|
-
* model should use `getEffectiveContextWindow(model)` directly.
|
|
210
|
-
* @returns 上下文窗口大小 (tokens)
|
|
211
|
-
*/
|
|
212
|
-
getContextWindow(): number;
|
|
213
|
-
/**
|
|
214
|
-
* Resolves the context window for a specific model.
|
|
215
|
-
* Precedence (highest to lowest):
|
|
216
|
-
* 1. Active model descriptor's `contextWindow` (FEATURE_098)
|
|
217
|
-
* 2. Provider config default
|
|
218
|
-
* 3. 200_000 fallback
|
|
219
|
-
* The user-level `compaction.contextWindow` is layered on top of
|
|
220
|
-
* this at the call site, so it remains the highest-priority manual
|
|
221
|
-
* override.
|
|
222
|
-
*/
|
|
223
|
-
getEffectiveContextWindow(model?: string): number;
|
|
224
|
-
protected getApiKey(): string;
|
|
225
|
-
protected shouldLogStreamDiagnostics(): boolean;
|
|
226
|
-
protected logStreamDiagnostic(...args: unknown[]): void;
|
|
227
|
-
protected normalizeReasoning(reasoning?: boolean | KodaXReasoningRequest): Required<KodaXReasoningRequest>;
|
|
228
|
-
/**
|
|
229
|
-
* Called when ECONNRESET/EPIPE is detected, indicating a stale keep-alive
|
|
230
|
-
* socket. Subclasses should override to rebuild their HTTP client with a
|
|
231
|
-
* fresh connection pool so the next retry uses a new TCP connection.
|
|
232
|
-
*/
|
|
233
|
-
protected onStaleConnection(): void;
|
|
234
|
-
protected isRateLimitError(error: unknown): boolean;
|
|
235
|
-
/**
|
|
236
|
-
* FEATURE_130: classify a rate-limit error as either a 429-style
|
|
237
|
-
* "rate-limit" or a 503/529-style "overloaded" condition. The
|
|
238
|
-
* distinction matters for UI: "rate-limit" usually surfaces a
|
|
239
|
-
* provider-supplied retry-after window; "overloaded" tends to fall
|
|
240
|
-
* through to exponential backoff with no header. Both flow through
|
|
241
|
-
* the same retry path; this only labels the event.
|
|
242
|
-
*/
|
|
243
|
-
protected classifyRateLimitReason(error: unknown): 'rate-limit' | 'overloaded';
|
|
244
|
-
/**
|
|
245
|
-
* Extract Retry-After delay from error headers (429/529 responses).
|
|
246
|
-
* Returns milliseconds, or undefined when no usable header is present.
|
|
247
|
-
*
|
|
248
|
-
* FEATURE_130 (v0.7.36): now delegates to the shared `parseRetryAfter`
|
|
249
|
-
* helper so all 12 provider adapters get 4-form coverage without each
|
|
250
|
-
* adapter rolling its own parser. The 4 forms supported are:
|
|
251
|
-
* - `Retry-After: <integer-seconds>`
|
|
252
|
-
* - `Retry-After: <HTTP-date>`
|
|
253
|
-
* - `retry-after-ms: <milliseconds>` (Anthropic extension)
|
|
254
|
-
* - exponential-backoff fallback (returned via `withRateLimit`,
|
|
255
|
-
* not through this helper — it is `undefined` here when no
|
|
256
|
-
* header is present, which the caller then resolves to backoff)
|
|
257
|
-
*/
|
|
258
|
-
protected extractRetryAfterMs(error: unknown): number | undefined;
|
|
259
|
-
/**
|
|
260
|
-
* Detect "prompt too long / context window exceeded" errors and compute
|
|
261
|
-
* a reduced max_tokens for retry. Returns undefined if not a context
|
|
262
|
-
* overflow error.
|
|
263
|
-
*/
|
|
264
|
-
protected parseContextOverflow(error: unknown): number | undefined;
|
|
265
|
-
protected isContextOverflowError(error: unknown): boolean;
|
|
266
|
-
protected withRateLimit<T>(fn: () => Promise<T>, signal?: AbortSignal, retries?: number, onRateLimit?: (attempt: number, maxRetries: number, delayMs: number) => void, onRetryAfter?: KodaXOnRetryAfterCallback): Promise<T>;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
export { KodaXBaseProvider as K, extractHeadersFromError as e, parseRetryAfter as p };
|
|
270
|
-
export type { ParseRetryAfterOptions as P, RetryAfterResult as R, KodaXOnRetryAfterCallback as a, KodaXRetryAfterEvent as b, RetryAfterSource as c };
|
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import { n as KodaXMessage } from './types.d-rPRl2LSB.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @kodax-ai/agent Types
|
|
5
|
-
*
|
|
6
|
-
* 通用 Agent 类型定义
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
type KodaXJsonPrimitive = string | number | boolean | null;
|
|
10
|
-
type KodaXJsonValue = KodaXJsonPrimitive | KodaXJsonValue[] | {
|
|
11
|
-
[key: string]: KodaXJsonValue;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Session error metadata - 会话错误元数据
|
|
15
|
-
* Used for error recovery and session cleanup - 用于错误恢复和会话清理
|
|
16
|
-
*/
|
|
17
|
-
interface SessionErrorMetadata {
|
|
18
|
-
/** Last error message - 最后的错误消息 */
|
|
19
|
-
lastError?: string;
|
|
20
|
-
/** Last error timestamp - 最后错误时间戳 */
|
|
21
|
-
lastErrorTime?: number;
|
|
22
|
-
/** Consecutive error count - 连续错误计数 */
|
|
23
|
-
consecutiveErrors: number;
|
|
24
|
-
}
|
|
25
|
-
interface KodaXExtensionSessionRecord {
|
|
26
|
-
id: string;
|
|
27
|
-
extensionId: string;
|
|
28
|
-
type: string;
|
|
29
|
-
ts: number;
|
|
30
|
-
data?: KodaXJsonValue;
|
|
31
|
-
dedupeKey?: string;
|
|
32
|
-
}
|
|
33
|
-
type KodaXExtensionSessionState = Record<string, Record<string, KodaXJsonValue>>;
|
|
34
|
-
interface KodaXSessionEntryBase {
|
|
35
|
-
id: string;
|
|
36
|
-
parentId: string | null;
|
|
37
|
-
timestamp: string;
|
|
38
|
-
}
|
|
39
|
-
interface KodaXSessionMessageEntry extends KodaXSessionEntryBase {
|
|
40
|
-
type: 'message';
|
|
41
|
-
message: KodaXMessage;
|
|
42
|
-
}
|
|
43
|
-
interface KodaXSessionCompactionEntry extends KodaXSessionEntryBase {
|
|
44
|
-
type: 'compaction';
|
|
45
|
-
summary: string;
|
|
46
|
-
firstKeptEntryId?: string;
|
|
47
|
-
tokensBefore?: number;
|
|
48
|
-
tokensAfter?: number;
|
|
49
|
-
artifactLedgerId?: string;
|
|
50
|
-
reason?: string;
|
|
51
|
-
details?: KodaXJsonValue;
|
|
52
|
-
memorySeed?: KodaXCompactMemorySeed;
|
|
53
|
-
/**
|
|
54
|
-
* FEATURE_072: post-compact ledger summary + file-content messages that
|
|
55
|
-
* are inlined after the compaction summary at slicer time
|
|
56
|
-
* (`getSessionMessagesFromLineage`). Stored here so they leave the active
|
|
57
|
-
* path automatically when a new compaction entry is appended.
|
|
58
|
-
*
|
|
59
|
-
* NOTE: attachments are emitted by the slicer, NOT by `getContextMessagesForEntry`
|
|
60
|
-
* — preserving the latter's 1-to-1 contract that `entryMatchesContextMessage`
|
|
61
|
-
* and FEATURE_073's future slicing both depend on.
|
|
62
|
-
*/
|
|
63
|
-
postCompactAttachments?: readonly KodaXMessage[];
|
|
64
|
-
}
|
|
65
|
-
interface KodaXSessionBranchSummaryEntry extends KodaXSessionEntryBase {
|
|
66
|
-
type: 'branch_summary';
|
|
67
|
-
summary: string;
|
|
68
|
-
fromId?: string;
|
|
69
|
-
details?: KodaXJsonValue;
|
|
70
|
-
}
|
|
71
|
-
interface KodaXSessionLabelEntry extends KodaXSessionEntryBase {
|
|
72
|
-
type: 'label';
|
|
73
|
-
targetId: string;
|
|
74
|
-
label?: string;
|
|
75
|
-
}
|
|
76
|
-
interface KodaXSessionArchiveMarkerEntry extends KodaXSessionEntryBase {
|
|
77
|
-
type: 'archive_marker';
|
|
78
|
-
/** Links to the corresponding batch in the .archive.jsonl sidecar file */
|
|
79
|
-
archiveBatchId: string;
|
|
80
|
-
/** Number of entries that were archived in this batch */
|
|
81
|
-
archivedEntryCount: number;
|
|
82
|
-
/** Brief summary of the archived content */
|
|
83
|
-
summary: string;
|
|
84
|
-
}
|
|
85
|
-
type KodaXGoalStatus = 'active' | 'paused' | 'budget_limited' | 'blocked' | 'complete';
|
|
86
|
-
/**
|
|
87
|
-
* Persistent user-set goal state. v0.7.44 FEATURE_192 — backs the
|
|
88
|
-
* `/goal` slash command and the get_goal / create_goal / update_goal
|
|
89
|
-
* tools.
|
|
90
|
-
*
|
|
91
|
-
* Persistence model: each lifecycle event (create / update / pause /
|
|
92
|
-
* resume / clear / budget_limited / blocked / complete) appends a
|
|
93
|
-
* `KodaXSessionGoalEntry` carrying a frozen `KodaXGoalState` snapshot
|
|
94
|
-
* to the session lineage. `readLatestGoalFromBranch` walks the active
|
|
95
|
-
* branch's message-entry IDs and returns the latest goal entry whose
|
|
96
|
-
* parentId belongs to that branch — so forks and rewinds naturally
|
|
97
|
-
* drop goals attached to abandoned message paths.
|
|
98
|
-
*/
|
|
99
|
-
interface KodaXGoalState {
|
|
100
|
-
readonly version: 1;
|
|
101
|
-
/** `${createdAt}-${rand}` — stable across updates of the same goal. */
|
|
102
|
-
readonly id: string;
|
|
103
|
-
readonly objective: string;
|
|
104
|
-
readonly status: KodaXGoalStatus;
|
|
105
|
-
/** Optional explicit token budget; null when the user did not set one. */
|
|
106
|
-
readonly tokenBudget: number | null;
|
|
107
|
-
readonly tokensUsed: number;
|
|
108
|
-
readonly timeUsedSeconds: number;
|
|
109
|
-
/** Consecutive turns the model has reported the same blocker. */
|
|
110
|
-
readonly blockerTurnCount: number;
|
|
111
|
-
/** The blocker_kind string the model last reported, or null. */
|
|
112
|
-
readonly lastBlockerKind: string | null;
|
|
113
|
-
readonly createdAt: number;
|
|
114
|
-
readonly updatedAt: number;
|
|
115
|
-
}
|
|
116
|
-
type KodaXGoalEventType = 'created' | 'updated' | 'paused' | 'resumed' | 'cleared' | 'budget_limited' | 'blocked' | 'complete';
|
|
117
|
-
interface KodaXSessionGoalEntry extends KodaXSessionEntryBase {
|
|
118
|
-
type: 'goal';
|
|
119
|
-
/** Snapshot at time of event; `null` only when `event === 'cleared'`. */
|
|
120
|
-
goal: KodaXGoalState | null;
|
|
121
|
-
event: KodaXGoalEventType;
|
|
122
|
-
}
|
|
123
|
-
type KodaXSessionEntry = KodaXSessionMessageEntry | KodaXSessionCompactionEntry | KodaXSessionBranchSummaryEntry | KodaXSessionLabelEntry | KodaXSessionArchiveMarkerEntry | KodaXSessionGoalEntry;
|
|
124
|
-
interface KodaXSessionArtifactLedgerEntry {
|
|
125
|
-
id: string;
|
|
126
|
-
kind: 'file_read' | 'file_modified' | 'file_created' | 'file_deleted' | 'path_scope' | 'search_scope' | 'command_scope' | 'check_result' | 'decision' | 'image_input' | 'tombstone';
|
|
127
|
-
sourceTool?: string;
|
|
128
|
-
action?: string;
|
|
129
|
-
target: string;
|
|
130
|
-
displayTarget?: string;
|
|
131
|
-
summary?: string;
|
|
132
|
-
sessionEntryId?: string;
|
|
133
|
-
timestamp: string;
|
|
134
|
-
metadata?: Record<string, KodaXJsonValue>;
|
|
135
|
-
}
|
|
136
|
-
interface KodaXCompactMemoryProgress {
|
|
137
|
-
completed: string[];
|
|
138
|
-
inProgress: string[];
|
|
139
|
-
blockers: string[];
|
|
140
|
-
}
|
|
141
|
-
interface KodaXCompactMemorySeed {
|
|
142
|
-
objective?: string;
|
|
143
|
-
constraints: string[];
|
|
144
|
-
progress: KodaXCompactMemoryProgress;
|
|
145
|
-
keyDecisions: string[];
|
|
146
|
-
nextSteps: string[];
|
|
147
|
-
keyContext: string[];
|
|
148
|
-
importantTargets: string[];
|
|
149
|
-
tombstones: string[];
|
|
150
|
-
}
|
|
151
|
-
interface KodaXSessionLineage {
|
|
152
|
-
version: 2;
|
|
153
|
-
activeEntryId: string | null;
|
|
154
|
-
entries: KodaXSessionEntry[];
|
|
155
|
-
}
|
|
156
|
-
interface KodaXSessionNavigationOptions {
|
|
157
|
-
summarizeCurrentBranch?: boolean;
|
|
158
|
-
}
|
|
159
|
-
interface KodaXSessionTreeNode {
|
|
160
|
-
entry: Exclude<KodaXSessionEntry, KodaXSessionLabelEntry | KodaXSessionGoalEntry>;
|
|
161
|
-
children: KodaXSessionTreeNode[];
|
|
162
|
-
label?: string;
|
|
163
|
-
active: boolean;
|
|
164
|
-
}
|
|
165
|
-
type KodaXSessionScope = 'user' | 'managed-task-worker';
|
|
166
|
-
type KodaXSessionUiHistoryItemType = 'user' | 'assistant' | 'system' | 'thinking' | 'error' | 'event' | 'info' | 'hint';
|
|
167
|
-
interface KodaXSessionUiHistoryItem {
|
|
168
|
-
type: KodaXSessionUiHistoryItemType;
|
|
169
|
-
text: string;
|
|
170
|
-
icon?: string;
|
|
171
|
-
compactText?: string;
|
|
172
|
-
}
|
|
173
|
-
type KodaXSessionWorkspaceKind = 'detected' | 'managed';
|
|
174
|
-
interface KodaXSessionRuntimeInfo {
|
|
175
|
-
canonicalRepoRoot?: string;
|
|
176
|
-
workspaceRoot?: string;
|
|
177
|
-
executionCwd?: string;
|
|
178
|
-
branch?: string;
|
|
179
|
-
workspaceKind?: KodaXSessionWorkspaceKind;
|
|
180
|
-
}
|
|
181
|
-
interface KodaXSessionData {
|
|
182
|
-
messages: KodaXMessage[];
|
|
183
|
-
title: string;
|
|
184
|
-
gitRoot: string;
|
|
185
|
-
/** Consumer-owned private string persisted with the session. */
|
|
186
|
-
tag?: string;
|
|
187
|
-
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
188
|
-
scope?: KodaXSessionScope;
|
|
189
|
-
uiHistory?: KodaXSessionUiHistoryItem[];
|
|
190
|
-
errorMetadata?: SessionErrorMetadata;
|
|
191
|
-
extensionState?: KodaXExtensionSessionState;
|
|
192
|
-
extensionRecords?: KodaXExtensionSessionRecord[];
|
|
193
|
-
lineage?: KodaXSessionLineage;
|
|
194
|
-
artifactLedger?: KodaXSessionArtifactLedgerEntry[];
|
|
195
|
-
}
|
|
196
|
-
interface KodaXSessionMeta {
|
|
197
|
-
_type: 'meta';
|
|
198
|
-
title: string;
|
|
199
|
-
id: string;
|
|
200
|
-
gitRoot: string;
|
|
201
|
-
/** Consumer-owned private string persisted with the session. */
|
|
202
|
-
tag?: string;
|
|
203
|
-
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
204
|
-
createdAt: string;
|
|
205
|
-
scope?: KodaXSessionScope;
|
|
206
|
-
uiHistory?: KodaXSessionUiHistoryItem[];
|
|
207
|
-
extensionState?: KodaXExtensionSessionState;
|
|
208
|
-
extensionRecordCount?: number;
|
|
209
|
-
artifactLedgerCount?: number;
|
|
210
|
-
lineageVersion?: 2;
|
|
211
|
-
activeEntryId?: string | null;
|
|
212
|
-
lineageEntryCount?: number;
|
|
213
|
-
activeMessageCount?: number;
|
|
214
|
-
/** Error metadata for recovery - 错误元数据用于恢复 */
|
|
215
|
-
errorMetadata?: SessionErrorMetadata;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Extension-scoped persistence entry.
|
|
219
|
-
*
|
|
220
|
-
* Each entry belongs to a namespace (extensionId) and carries
|
|
221
|
-
* a string key, a JSON-safe value, and an opaque version tag
|
|
222
|
-
* used for optimistic concurrency control.
|
|
223
|
-
*/
|
|
224
|
-
interface KodaXExtensionStoreEntry {
|
|
225
|
-
key: string;
|
|
226
|
-
value: KodaXJsonValue;
|
|
227
|
-
version: string;
|
|
228
|
-
updatedAt: number;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Extension persistence store interface (FEATURE_034 manual persistence).
|
|
232
|
-
*
|
|
233
|
-
* Implementations provide a durable key-value store scoped to a single
|
|
234
|
-
* extension identity. The store is independent of session lifecycle —
|
|
235
|
-
* data survives across sessions and restarts.
|
|
236
|
-
*/
|
|
237
|
-
interface KodaXExtensionStore {
|
|
238
|
-
/**
|
|
239
|
-
* Read a single key.
|
|
240
|
-
* Returns `undefined` when the key does not exist.
|
|
241
|
-
*/
|
|
242
|
-
get(key: string): Promise<KodaXExtensionStoreEntry | undefined>;
|
|
243
|
-
/**
|
|
244
|
-
* Write a key-value pair.
|
|
245
|
-
*
|
|
246
|
-
* When `expectedVersion` is provided the write only succeeds when the
|
|
247
|
-
* stored entry's version still matches (optimistic concurrency).
|
|
248
|
-
* Returns the new entry on success, or `false` on version mismatch.
|
|
249
|
-
*/
|
|
250
|
-
put(key: string, value: KodaXJsonValue, options?: {
|
|
251
|
-
expectedVersion?: string;
|
|
252
|
-
}): Promise<KodaXExtensionStoreEntry | false>;
|
|
253
|
-
/**
|
|
254
|
-
* Remove a key.
|
|
255
|
-
* Returns `true` when the key existed and was removed.
|
|
256
|
-
*/
|
|
257
|
-
delete(key: string): Promise<boolean>;
|
|
258
|
-
/**
|
|
259
|
-
* List all keys (optionally filtered by prefix).
|
|
260
|
-
*/
|
|
261
|
-
list(options?: {
|
|
262
|
-
prefix?: string;
|
|
263
|
-
}): Promise<string[]>;
|
|
264
|
-
/**
|
|
265
|
-
* Clear all keys (optionally filtered by prefix).
|
|
266
|
-
* Returns the number of entries removed.
|
|
267
|
-
*/
|
|
268
|
-
clear(options?: {
|
|
269
|
-
prefix?: string;
|
|
270
|
-
}): Promise<number>;
|
|
271
|
-
}
|
|
272
|
-
interface KodaXSessionStorage {
|
|
273
|
-
save(id: string, data: KodaXSessionData): Promise<void>;
|
|
274
|
-
load(id: string): Promise<KodaXSessionData | null>;
|
|
275
|
-
getLineage?(id: string): Promise<KodaXSessionLineage | null>;
|
|
276
|
-
setActiveEntry?(id: string, selector: string, options?: KodaXSessionNavigationOptions): Promise<KodaXSessionData | null>;
|
|
277
|
-
setLabel?(id: string, selector: string, label?: string): Promise<KodaXSessionData | null>;
|
|
278
|
-
rewind?(id: string, selector?: string): Promise<KodaXSessionData | null>;
|
|
279
|
-
fork?(id: string, selector?: string, options?: {
|
|
280
|
-
sessionId?: string;
|
|
281
|
-
title?: string;
|
|
282
|
-
}): Promise<{
|
|
283
|
-
sessionId: string;
|
|
284
|
-
data: KodaXSessionData;
|
|
285
|
-
} | null>;
|
|
286
|
-
list?(gitRoot?: string): Promise<Array<{
|
|
287
|
-
id: string;
|
|
288
|
-
title: string;
|
|
289
|
-
msgCount: number;
|
|
290
|
-
tag?: string;
|
|
291
|
-
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
292
|
-
}>>;
|
|
293
|
-
delete?(id: string): Promise<void>;
|
|
294
|
-
deleteAll?(gitRoot?: string): Promise<void>;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
export type { KodaXSessionUiHistoryItem as A, KodaXSessionUiHistoryItemType as B, KodaXSessionWorkspaceKind as C, KodaXCompactMemoryProgress as K, SessionErrorMetadata as S, KodaXCompactMemorySeed as a, KodaXExtensionSessionRecord as b, KodaXExtensionSessionState as c, KodaXExtensionStore as d, KodaXExtensionStoreEntry as e, KodaXGoalEventType as f, KodaXGoalState as g, KodaXGoalStatus as h, KodaXJsonValue as i, KodaXSessionArchiveMarkerEntry as j, KodaXSessionArtifactLedgerEntry as k, KodaXSessionBranchSummaryEntry as l, KodaXSessionCompactionEntry as m, KodaXSessionData as n, KodaXSessionEntry as o, KodaXSessionEntryBase as p, KodaXSessionGoalEntry as q, KodaXSessionLabelEntry as r, KodaXSessionLineage as s, KodaXSessionMessageEntry as t, KodaXSessionMeta as u, KodaXSessionNavigationOptions as v, KodaXSessionRuntimeInfo as w, KodaXSessionScope as x, KodaXSessionStorage as y, KodaXSessionTreeNode as z };
|