@kodax-ai/kodax 0.7.45 → 0.7.46
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 +38 -0
- package/README.md +1 -1
- package/README_CN.md +1 -1
- package/dist/builtin/skill-creator/scripts/utils.js +12 -27
- package/dist/chunks/chunk-2GEKCIIW.js +31 -0
- package/dist/chunks/chunk-ARUWXX25.js +2 -0
- package/dist/chunks/chunk-JRT447X5.js +565 -0
- package/dist/chunks/chunk-K4RBLNSY.js +2 -0
- package/dist/chunks/{chunk-IJUB7QXG.js → chunk-VBIVZOSD.js} +56 -56
- package/dist/chunks/{chunk-X6EHEQWP.js → chunk-XUEINS3X.js} +150 -150
- package/dist/chunks/{chunk-FKB7BWQT.js → chunk-Z4UT32NN.js} +1 -1
- package/dist/chunks/{compaction-config-WCNGYWT3.js → compaction-config-PFTBIGQT.js} +1 -1
- package/dist/chunks/{construction-bootstrap-OB5SDNBD.js → construction-bootstrap-2FKNOZZE.js} +1 -1
- package/dist/chunks/devtools-4CRULTR2.js +2 -0
- package/dist/chunks/devtools-YINBSZC7.js +2 -0
- package/dist/chunks/dist-JLMKDPEL.js +2 -0
- package/dist/chunks/dist-QTV5M2JW.js +2 -0
- package/dist/chunks/{utils-CHXCBR3Q.js → utils-LY3LB65Z.js} +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +1 -1
- package/dist/kodax_cli.js +920 -890
- package/dist/provider-capabilities.json +29 -15
- package/dist/sdk-agent.d.ts +8 -8
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +11 -11
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.d.ts +84 -7
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-repl.d.ts +18 -9
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-session.d.ts +27 -6
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/types-chunks/{base.d-FUJahC0i.d.ts → base.d-BdJKSPO2.d.ts} +18 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-HrTUwtV7.d.ts → bash-prefix-extractor.d-BICYx8pt.d.ts} +4 -4
- package/dist/types-chunks/{file-tracker.d-DOfaoCbJ.d.ts → file-tracker.d-BNTIvsdb.d.ts} +11 -4
- package/dist/types-chunks/{resolver.d-OMwxURit.d.ts → resolver.d-DkgJlEzr.d.ts} +79 -3
- package/dist/types-chunks/{storage.d-BvTdjYQF.d.ts → storage.d-B1Jk6ryM.d.ts} +79 -4
- package/dist/types-chunks/{types.d-HBbWT-iA.d.ts → types.d-B_MIIApc.d.ts} +1 -1
- package/dist/types-chunks/{types.d-B1uGoVTE.d.ts → types.d-Cf-GCzac.d.ts} +82 -1
- package/dist/types-chunks/{types.d-DM8zEJgF.d.ts → types.d-D2RNa5Y7.d.ts} +2 -2
- package/dist/types-chunks/{utils.d-DSEX6Rq1.d.ts → utils.d-pzHPkrb8.d.ts} +19 -5
- package/package.json +1 -1
- package/dist/chunks/chunk-CZHIUJQS.js +0 -535
- package/dist/chunks/chunk-FT2XFFNP.js +0 -2
- package/dist/chunks/chunk-PGF5EZ7C.js +0 -31
- package/dist/chunks/devtools-EYGFOXEU.js +0 -2
- package/dist/chunks/dist-C2VOGY5Z.js +0 -2
- package/dist/chunks/dist-Q2PQM7U7.js +0 -2
package/dist/sdk-repl.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{$ as Lt,$a as Wn,$b as Fo,A as Q,Aa as pn,Ab as lo,B as T,Ba as ln,Bb as uo,C as U,Ca as un,Cb as fo,D as V,Da as fn,Db as go,E as Y,Ea as gn,Eb as Co,F as Z,Fa as Cn,Fb as xo,G as tt,Ga as xn,Gb as yo,H as nt,Ha as yn,Hb as Ko,I as ot,Ia as Kn,Ib as Xo,J as et,Ja as Xn,Jb as ho,K as rt,Ka as hn,Kb as Do,L as at,La as Dn,Lb as Po,M as mt,Ma as Pn,Mb as Mo,N as it,Na as Mn,Nb as wo,O as st,Oa as wn,Ob as No,P as ct,Pa as Nn,Pb as _o,Q as dt,Qa as _n,Qb as bo,R as pt,Ra as bn,Rb as jo,S as lt,Sa as jn,Sb as ko,T as ut,Ta as kn,Tb as Ao,U as ft,Ua as An,Ub as Oo,V as gt,Va as On,Vb as Ro,W as Ct,Wa as Rn,Wb as So,X as xt,Xa as Sn,Xb as vo,Y as yt,Ya as vn,Yb as Io,Z as Kt,Za as In,Zb as Lo,_ as It,_a as Ln,_b as Wo,a as D,aa as Wt,ab as Fn,ac as $o,b as P,ba as Ft,bb as $n,bc as qo,c as M,ca as $t,cb as qn,cc as zo,d as w,da as qt,db as zn,dc as Bo,e as N,ea as zt,eb as Bn,ec as Eo,f as _,fa as Bt,fb as En,fc as Go,g as b,ga as Et,gb as Gn,gc as Ho,h as j,ha as Gt,hb as Hn,hc as Jo,i as k,ia as Ht,ib as Jn,ic as Qo,j as A,ja as Jt,jb as Qn,jc as To,k as O,ka as Qt,kb as Tn,l as R,la as Tt,lb as Un,m as S,ma as Ut,mb as Vn,n as v,na as Vt,nb as Yn,o as I,oa as Yt,ob as Zn,p as L,pa as Zt,pb as to,q as W,qa as tn,qb as no,r as F,ra as nn,rb as oo,s as $,sa as on,sb as eo,t as q,ta as en,tb as ro,u as z,ua as rn,ub as ao,v as B,va as an,vb as mo,w as E,wa as mn,wb as io,x as G,xa as sn,xb as so,y as H,ya as cn,yb as co,z as J,za as dn,zb as po}from"./chunks/chunk-
|
|
3
|
-
`)[0]?.replace(/^#\s*/,"").trim()??"").slice(0,60)||"(prompt command)";n.set(f,{name:f,description:i,content:d,type:"prompt"})}catch{}continue}if(m===".js"||m===".ts")try{let g=await import(c.join(o,t));for(let[i,p]of Object.entries(g))if(i.startsWith("command_")&&typeof p=="function"){let s=i.replace("command_",""),C=p.description??s;n.set(s,{name:s,description:String(C).slice(0,60),content:`[Programmable command: ${s}]`,type:"programmable",execute:p})}}catch{}}}catch{}return n}a(K,"loadCommands");async function X(e,n,o,r){let t=o.get(e);return t?t.type==="prompt"?n?t.content.replace(/{args}/g,n):t.content:t.type==="programmable"&&t.execute?t.execute({args:n,runAgent:r}):null:null}a(X,"processCommandCall");function h(e){if(!e.startsWith("/"))return null;let n=e.slice(1).split(/\s+/,2);if(n.length===0)return null;let[o,r]=n;return o?[o,r]:null}a(h,"parseCommandCall");export{Cn as App,Vt as AutocompleteContextProvider,Qt as BUILTIN_COMMANDS,qn as BackgroundTaskBar,No as ConsoleCapturer,dt as DEFAULT_UI_STATE,In as DialogSurface,mn as DotsIndicator,$o as FileSessionStorage,yn as FullscreenTranscriptLayout,pn as HistoryItemRenderer,en as InputPrompt,u as KODAX_COMMANDS_DIR,Dt as KODAX_CONFIG_FILE,Xt as KODAX_DIR,ht as KODAX_SESSIONS_DIR,_t as KODAX_VERSION,ft as KeyMatchers,ct as KeypressHandlerPriority,ot as KeypressParser,lt as KeypressProvider,L as LRUCache,dn as LoadingIndicator,no as MemorySessionStorage,Kn as MessageActions,ln as MessageList,Xn as MessageSelector,Wn as NotificationsSurface,gt as PERMISSION_MODES,Pt as PREVIEW_MAX_LENGTH,yo as PendingInputsIndicator,sn as ProgressIndicator,Dn as PromptComposer,wn as PromptFooter,Pn as PromptFooterLeftSide,Mn as PromptFooterRightSide,Nn as PromptHelpMenu,vn as PromptSuggestionsSurface,Ln as QueuedCommandsSurface,xn as SimpleApp,rn as SimpleInputPrompt,un as SimpleMessageDisplay,gn as SimpleStatusBar,tt as SingleLineTextInput,an as Spinner,$n as StashNotice,fn as StatusBar,Fn as StatusNoticesSurface,Bn as StreamingProvider,mt as StreamingState,Sn as SuggestionsDisplay,st as TOOL_STATUS_ICONS,nn as TextBuffer,Z as TextInput,cn as ThinkingIndicator,Co as ToolCallDisplay,it as ToolCallStatus,xo as ToolGroup,go as ToolProgressBar,fo as ToolStatusBadge,hn as TranscriptViewport,kn as UIStateProvider,Vn as _resetQueuedPromptsCacheForTests,to as bootstrapAutoMode,J as calculateVisualCursorFromLayout,H as calculateVisualLayout,zt as collectBashWriteTargets,xt as computeConfirmTools,lo as createCliEvents,bn as createHistoryItem,Yn as createInteractiveContext,uo as createJsonEvents,Qn as createKeyMatcher,pt as createKeypressManager,oo as createMemorySessionStorage,so as createRecoveryHistoryItem,mo as createRetryHistoryItem,
|
|
2
|
+
import{$ as Lt,$a as Wn,$b as Fo,A as Q,Aa as pn,Ab as lo,B as T,Ba as ln,Bb as uo,C as U,Ca as un,Cb as fo,D as V,Da as fn,Db as go,E as Y,Ea as gn,Eb as Co,F as Z,Fa as Cn,Fb as xo,G as tt,Ga as xn,Gb as yo,H as nt,Ha as yn,Hb as Ko,I as ot,Ia as Kn,Ib as Xo,J as et,Ja as Xn,Jb as ho,K as rt,Ka as hn,Kb as Do,L as at,La as Dn,Lb as Po,M as mt,Ma as Pn,Mb as Mo,N as it,Na as Mn,Nb as wo,O as st,Oa as wn,Ob as No,P as ct,Pa as Nn,Pb as _o,Q as dt,Qa as _n,Qb as bo,R as pt,Ra as bn,Rb as jo,S as lt,Sa as jn,Sb as ko,T as ut,Ta as kn,Tb as Ao,U as ft,Ua as An,Ub as Oo,V as gt,Va as On,Vb as Ro,W as Ct,Wa as Rn,Wb as So,X as xt,Xa as Sn,Xb as vo,Y as yt,Ya as vn,Yb as Io,Z as Kt,Za as In,Zb as Lo,_ as It,_a as Ln,_b as Wo,a as D,aa as Wt,ab as Fn,ac as $o,b as P,ba as Ft,bb as $n,bc as qo,c as M,ca as $t,cb as qn,cc as zo,d as w,da as qt,db as zn,dc as Bo,e as N,ea as zt,eb as Bn,ec as Eo,f as _,fa as Bt,fb as En,fc as Go,g as b,ga as Et,gb as Gn,gc as Ho,h as j,ha as Gt,hb as Hn,hc as Jo,i as k,ia as Ht,ib as Jn,ic as Qo,j as A,ja as Jt,jb as Qn,jc as To,k as O,ka as Qt,kb as Tn,kc as Uo,l as R,la as Tt,lb as Un,lc as Vo,m as S,ma as Ut,mb as Vn,n as v,na as Vt,nb as Yn,o as I,oa as Yt,ob as Zn,p as L,pa as Zt,pb as to,q as W,qa as tn,qb as no,r as F,ra as nn,rb as oo,s as $,sa as on,sb as eo,t as q,ta as en,tb as ro,u as z,ua as rn,ub as ao,v as B,va as an,vb as mo,w as E,wa as mn,wb as io,x as G,xa as sn,xb as so,y as H,ya as cn,yb as co,z as J,za as dn,zb as po}from"./chunks/chunk-JRT447X5.js";import{D as vt,b as Xt,c as ht,d as Dt,e as Pt,f as Mt,h as wt,i as Nt,j as _t,k as bt,u as jt,v as kt,w as At,x as Ot,y as Rt,z as St}from"./chunks/chunk-K4RBLNSY.js";import"./chunks/chunk-Z4UT32NN.js";import"./chunks/chunk-EVIDQWMF.js";import"./chunks/chunk-XUEINS3X.js";import"./chunks/chunk-2GEKCIIW.js";import"./chunks/chunk-VBIVZOSD.js";import{a}from"./chunks/chunk-V4WSBIXB.js";import l from"fs/promises";import c from"path";import x from"os";var u=c.join(x.homedir(),".kodax","commands");function y(){return u}a(y,"getDefaultCommandDir");async function K(e){let n=new Map,o=e??u;try{await l.mkdir(o,{recursive:!0});let r=await l.readdir(o);for(let t of r){let m=c.extname(t),f=t.replace(m,"");if(m===".md"){try{let d=await l.readFile(c.join(o,t),"utf-8"),i=(d.split(`
|
|
3
|
+
`)[0]?.replace(/^#\s*/,"").trim()??"").slice(0,60)||"(prompt command)";n.set(f,{name:f,description:i,content:d,type:"prompt"})}catch{}continue}if(m===".js"||m===".ts")try{let g=await import(c.join(o,t));for(let[i,p]of Object.entries(g))if(i.startsWith("command_")&&typeof p=="function"){let s=i.replace("command_",""),C=p.description??s;n.set(s,{name:s,description:String(C).slice(0,60),content:`[Programmable command: ${s}]`,type:"programmable",execute:p})}}catch{}}}catch{}return n}a(K,"loadCommands");async function X(e,n,o,r){let t=o.get(e);return t?t.type==="prompt"?n?t.content.replace(/{args}/g,n):t.content:t.type==="programmable"&&t.execute?t.execute({args:n,runAgent:r}):null:null}a(X,"processCommandCall");function h(e){if(!e.startsWith("/"))return null;let n=e.slice(1).split(/\s+/,2);if(n.length===0)return null;let[o,r]=n;return o?[o,r]:null}a(h,"parseCommandCall");export{Cn as App,Vt as AutocompleteContextProvider,Qt as BUILTIN_COMMANDS,qn as BackgroundTaskBar,No as ConsoleCapturer,dt as DEFAULT_UI_STATE,In as DialogSurface,mn as DotsIndicator,$o as FileSessionStorage,yn as FullscreenTranscriptLayout,pn as HistoryItemRenderer,en as InputPrompt,u as KODAX_COMMANDS_DIR,Dt as KODAX_CONFIG_FILE,Xt as KODAX_DIR,ht as KODAX_SESSIONS_DIR,_t as KODAX_VERSION,ft as KeyMatchers,ct as KeypressHandlerPriority,ot as KeypressParser,lt as KeypressProvider,L as LRUCache,dn as LoadingIndicator,no as MemorySessionStorage,Kn as MessageActions,ln as MessageList,Xn as MessageSelector,Wn as NotificationsSurface,gt as PERMISSION_MODES,Pt as PREVIEW_MAX_LENGTH,yo as PendingInputsIndicator,sn as ProgressIndicator,Dn as PromptComposer,wn as PromptFooter,Pn as PromptFooterLeftSide,Mn as PromptFooterRightSide,Nn as PromptHelpMenu,vn as PromptSuggestionsSurface,Ln as QueuedCommandsSurface,xn as SimpleApp,rn as SimpleInputPrompt,un as SimpleMessageDisplay,gn as SimpleStatusBar,tt as SingleLineTextInput,an as Spinner,$n as StashNotice,fn as StatusBar,Fn as StatusNoticesSurface,Bn as StreamingProvider,mt as StreamingState,Sn as SuggestionsDisplay,st as TOOL_STATUS_ICONS,nn as TextBuffer,Z as TextInput,cn as ThinkingIndicator,Co as ToolCallDisplay,it as ToolCallStatus,xo as ToolGroup,go as ToolProgressBar,fo as ToolStatusBadge,hn as TranscriptViewport,kn as UIStateProvider,Vn as _resetQueuedPromptsCacheForTests,Qo as archiveSession,to as bootstrapAutoMode,J as calculateVisualCursorFromLayout,H as calculateVisualLayout,zt as collectBashWriteTargets,xt as computeConfirmTools,lo as createCliEvents,bn as createHistoryItem,Yn as createInteractiveContext,uo as createJsonEvents,Qn as createKeyMatcher,pt as createKeypressManager,oo as createMemorySessionStorage,so as createRecoveryHistoryItem,mo as createRetryHistoryItem,Vo as createSessionManager,zn as createStreamingManager,jn as createToolCall,Q as darkTheme,Jo as deleteSession,wo as detectTerminalCapabilities,j as detectTerminalHostProfile,b as detectTerminalRenderHost,co as emitRecoveryHistoryItem,io as emitRetryHistoryItem,Ut as executeCommand,eo as executeShellCommand,Gt as extractTextContent,Ht as extractTitle,Bo as forkSession,Jt as formatMessagePreview,_n as generateId,Ft as generateSavePattern,Bt as getBashOutsideProjectWriteRisk,q as getCharAtCodePoint,W as getCodePointLength,Oo as getCustomProviderConfig,y as getDefaultCommandDir,St as getGitRoot,at as getKeyDisplayName,Io as getMcpServerConfig,Et as getPlanModeBlockReason,jt as getProviderList,bt as getProviderModel,S as getTerminalHostCapabilities,Po as getTerminalWidth,V as getTheme,Y as getThemeNames,Nt as getVersion,$ as getVisualWidth,G as getVisualWidthCached,P as hasCursorUpViewportYankRisk,w as hasMainScreenRenderScrollRisk,Mt as hydrateProcessEnvFromShell,$t as isAlwaysConfirmPath,It as isBashReadCommand,Lt as isBashWriteCommand,I as isClassicReplForced,et as isFunctionKey,v as isOwnedRendererPreferred,qt as isPathInsideProject,yt as isPermissionMode,rt as isPrintable,kt as isProviderConfigured,M as isRemoteConptyHost,Mo as isScreenReader,ro as isShellCommand,ao as isShellCommandSuccess,N as isTmuxControlMode,Wt as isToolCallAllowed,D as isVsCodeTerminalHostEnv,F as isWideChar,Ao as listCustomProviders,vo as listMcpServers,Ho as listRunningSessions,qo as listSessions,K as loadCommands,At as loadConfig,zo as loadSession,T as minimalTheme,Kt as normalizePermissionMode,Tt as parseCommand,h as parseCommandCall,nt as parseKeypress,Ct as permissionModeDisplayName,Ot as prepareRuntimeConfig,X as processCommandCall,ko as processSpecialSyntax,vt as rateLimitedCall,wt as registerConfiguredCustomProviders,So as removeCustomProvider,Wo as removeMcpServer,_ as resetTmuxControlModeProbeForTesting,k as resolveConfiguredTuiRendererMode,A as resolveEffectiveTuiRendererMode,R as resolveFullscreenPolicy,O as resolveInteractiveSurfacePreference,Eo as rewindSession,po as runInkInteractiveMode,jo as runInteractiveMode,Rt as saveConfig,Go as setActiveEntry,z as splitByCodePoints,Xo as supports256Colors,Do as supportsEmoji,Ko as supportsTrueColor,ho as supportsUnicode,U as themes,Zn as touchContext,B as truncateByVisualWidth,To as unarchiveSession,Ro as upsertCustomProvider,Lo as upsertMcpServer,Zt as useAutocomplete,Yt as useAutocompleteContext,tn as useInputHistory,Jn as useKeypress,ut as useKeypressManager,Un as useQueuedPromptContents,Tn as useQueuedPrompts,Hn as useStreaming,Gn as useStreamingActions,En as useStreamingState,on as useTextBuffer,Rn as useUI,On as useUIActions,An as useUIState,Fo as validateMcpServerConfig,E as visualWidthCache,Uo as watchSessions,_o as withCapture,bo as withCaptureSync};
|
package/dist/sdk-session.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as SessionData, F as FileSessionStorage } from './types-chunks/storage.d-
|
|
2
|
-
import './types-chunks/types.d-
|
|
3
|
-
import './types-chunks/types.d-
|
|
1
|
+
import { S as SessionData, F as FileSessionStorage } from './types-chunks/storage.d-B1Jk6ryM.js';
|
|
2
|
+
import './types-chunks/types.d-B_MIIApc.js';
|
|
3
|
+
import './types-chunks/types.d-Cf-GCzac.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* FEATURE_173 Part B (v0.7.42) — Session Management Public SDK.
|
|
@@ -22,6 +22,15 @@ interface SessionSummary {
|
|
|
22
22
|
workspaceRoot?: string;
|
|
23
23
|
gitRoot?: string;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* FEATURE_219 (v0.7.46) — the per-project directory key this session lives
|
|
27
|
+
* under (ADR-038 §7). A backward-compatible hint: consumers may pass it back
|
|
28
|
+
* for precise disambiguation, but `loadSession(id)` works without it.
|
|
29
|
+
*/
|
|
30
|
+
readonly projectKey?: string;
|
|
31
|
+
/** FEATURE_219 — true when the session is whole-session archived (only ever
|
|
32
|
+
* surfaced when `includeArchived` is set). */
|
|
33
|
+
readonly archived?: boolean;
|
|
25
34
|
}
|
|
26
35
|
interface ListSessionsOptions {
|
|
27
36
|
/**
|
|
@@ -37,8 +46,9 @@ interface ListSessionsOptions {
|
|
|
37
46
|
*/
|
|
38
47
|
readonly scope?: 'user' | 'managed-task-worker' | 'all';
|
|
39
48
|
/**
|
|
40
|
-
* Whether to include archived sessions (
|
|
41
|
-
*
|
|
49
|
+
* Whether to include whole-session-archived sessions. FEATURE_219 (v0.7.46):
|
|
50
|
+
* archived sessions live in `<projectKey>/archived/` (see `archiveSession`);
|
|
51
|
+
* also still hides the legacy `archived-` filename prefix. Default false.
|
|
42
52
|
*/
|
|
43
53
|
readonly includeArchived?: boolean;
|
|
44
54
|
/** Maximum number of sessions to return. Default 50. */
|
|
@@ -60,6 +70,8 @@ interface SessionManager {
|
|
|
60
70
|
rewindSession: typeof rewindSession;
|
|
61
71
|
setActiveEntry: typeof setActiveEntry;
|
|
62
72
|
deleteSession: typeof deleteSession;
|
|
73
|
+
archiveSession: typeof archiveSession;
|
|
74
|
+
unarchiveSession: typeof unarchiveSession;
|
|
63
75
|
listRunningSessions: typeof listRunningSessions;
|
|
64
76
|
watchSessions: typeof watchSessions;
|
|
65
77
|
/**
|
|
@@ -145,6 +157,15 @@ type DeleteSessionResult = {
|
|
|
145
157
|
* NEVER throws.
|
|
146
158
|
*/
|
|
147
159
|
declare function deleteSession(id: string): Promise<DeleteSessionResult>;
|
|
160
|
+
/**
|
|
161
|
+
* FEATURE_219 (v0.7.46) — whole-session archive. Moves the session (and its
|
|
162
|
+
* island sidecar) into `<projectKey>/archived/`. Returns false for a missing
|
|
163
|
+
* session. NEVER throws. Archived sessions are hidden from the default listing
|
|
164
|
+
* and resurface only with `listSessions({ includeArchived: true })`.
|
|
165
|
+
*/
|
|
166
|
+
declare function archiveSession(id: string): Promise<boolean>;
|
|
167
|
+
/** Restore an archived session back into its project directory. NEVER throws. */
|
|
168
|
+
declare function unarchiveSession(id: string): Promise<boolean>;
|
|
148
169
|
/**
|
|
149
170
|
* Watch the sessions directory for changes.
|
|
150
171
|
* Returns { close() } that stops the watcher / poll interval.
|
|
@@ -172,5 +193,5 @@ declare function createSessionManager(opts?: {
|
|
|
172
193
|
sessionsDir?: string;
|
|
173
194
|
}): SessionManager;
|
|
174
195
|
|
|
175
|
-
export { createSessionManager, deleteSession, forkSession, listRunningSessions, listSessions, loadSession, rewindSession, setActiveEntry, watchSessions };
|
|
196
|
+
export { archiveSession, createSessionManager, deleteSession, forkSession, listRunningSessions, listSessions, loadSession, rewindSession, setActiveEntry, unarchiveSession, watchSessions };
|
|
176
197
|
export type { DeleteSessionResult, ListSessionsOptions, RunningSessionInfo, SessionManager, SessionSummary, WatchSessionsCallback };
|
package/dist/sdk-session.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{bc as s,cc as e,dc as n,ec as i,fc as o,gc as
|
|
2
|
+
import{bc as s,cc as e,dc as n,ec as i,fc as o,gc as S,hc as t,ic as a,jc as r,kc as l,lc as c}from"./chunks/chunk-JRT447X5.js";import"./chunks/chunk-K4RBLNSY.js";import"./chunks/chunk-Z4UT32NN.js";import"./chunks/chunk-EVIDQWMF.js";import"./chunks/chunk-XUEINS3X.js";import"./chunks/chunk-2GEKCIIW.js";import"./chunks/chunk-VBIVZOSD.js";import"./chunks/chunk-V4WSBIXB.js";export{a as archiveSession,c as createSessionManager,t as deleteSession,n as forkSession,S as listRunningSessions,s as listSessions,e as loadSession,i as rewindSession,o as setActiveEntry,r as unarchiveSession,l as watchSessions};
|
package/dist/sdk-skills.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{$b as E,Ab as e,Bb as i,Cb as t,Db as a,Eb as o,Ib as k,Jb as r,Kb as S,Lb as s,Mb as n,Nb as g,Ob as u,Pb as c,Qb as x,Rb as d,Sb as P,Tb as R,Ub as h,Vb as p,Wb as v,Xb as y,Yb as M,Zb as f,_b as m,zb as l}from"./chunks/chunk-
|
|
2
|
+
import{$b as E,Ab as e,Bb as i,Cb as t,Db as a,Eb as o,Ib as k,Jb as r,Kb as S,Lb as s,Mb as n,Nb as g,Ob as u,Pb as c,Qb as x,Rb as d,Sb as P,Tb as R,Ub as h,Vb as p,Wb as v,Xb as y,Yb as M,Zb as f,_b as m,zb as l}from"./chunks/chunk-VBIVZOSD.js";import"./chunks/chunk-V4WSBIXB.js";export{y as SkillExecutor,R as SkillRegistry,x as VariableResolver,t as clearPluginSkillPaths,M as createExecutor,d as createResolver,n as discoverSkills,u as discoverSkillsWithMonorepo,f as executeSkill,m as expandSkillForLLM,E as formatSkillActivationMessage,a as getDefaultSkillPaths,g as getNestedSkillPaths,o as getSkillPathsFlat,h as getSkillRegistry,p as initializeSkillRegistry,i as listPluginSkillPaths,S as loadFullSkill,s as loadSkillFileContent,r as loadSkillMetadata,c as parseArguments,k as parseSkillMarkdown,l as registerPluginSkillPath,v as resetSkillRegistry,P as resolveSkillContent,e as unregisterPluginSkillPath};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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-Cf-GCzac.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Retry-After header parsing — FEATURE_130 (v0.7.36).
|
|
@@ -169,6 +169,23 @@ declare abstract class KodaXBaseProvider {
|
|
|
169
169
|
supportsNonStreamingFallback(): boolean;
|
|
170
170
|
complete(_messages: KodaXMessage[], _tools: KodaXToolDefinition[], _system: string, _reasoning?: boolean | KodaXReasoningRequest, _streamOptions?: KodaXProviderStreamOptions, _signal?: AbortSignal): Promise<KodaXStreamResult>;
|
|
171
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>;
|
|
172
189
|
getModel(): string;
|
|
173
190
|
getAvailableModels(): string[];
|
|
174
191
|
getModelDescriptor(modelId?: string): KodaXModelDescriptor | undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { M as McpConnectMode, a as McpServerConfig, b as McpServersConfig, c as McpTransportKind } from './config.d-BfJUXxC0.js';
|
|
2
|
-
import { g as KodaXGoalState, s as KodaXSessionLineage, x as KodaXSessionScope, y as KodaXSessionStorage, i as KodaXJsonValue, k as KodaXSessionArtifactLedgerEntry, S as SessionErrorMetadata } from './types.d-
|
|
3
|
-
import {
|
|
4
|
-
import { f as AgentMessage, av as StopHookFn, C as ChildTaskRegistry, p as CompactionUpdate, v as Guardrail, s as DiscoveredInstance, az as TaskAbortRegistry, aa as RunnerToolCall, aE as ToolGuardrail } from './types.d-
|
|
2
|
+
import { g as KodaXGoalState, s as KodaXSessionLineage, x as KodaXSessionScope, y as KodaXSessionStorage, i as KodaXJsonValue, k as KodaXSessionArtifactLedgerEntry, S as SessionErrorMetadata } from './types.d-B_MIIApc.js';
|
|
3
|
+
import { X as KodaXTokenUsage, n as KodaXMessage, E as KodaXReasoningMode, k as KodaXHarnessProfile, S as KodaXTaskWorkIntent, I as KodaXReviewScale, O as KodaXTaskComplexity, a as KodaXAmaFanoutClass, Q as KodaXTaskRoutingDecision, R as KodaXTaskType, J as KodaXRiskLevel, i as KodaXExecutionMode, c as KodaXAmaProfile, d as KodaXAmaTactic, b as KodaXAmaFanoutPolicy } from './types.d-Cf-GCzac.js';
|
|
4
|
+
import { f as AgentMessage, av as StopHookFn, C as ChildTaskRegistry, p as CompactionUpdate, v as Guardrail, s as DiscoveredInstance, az as TaskAbortRegistry, aa as RunnerToolCall, aE as ToolGuardrail } from './types.d-D2RNa5Y7.js';
|
|
5
5
|
import { C as CapabilityKind, b as CapabilityResult } from './capability.d-3C62G8Eq.js';
|
|
6
|
-
import { K as KodaXBaseProvider } from './base.d-
|
|
6
|
+
import { K as KodaXBaseProvider } from './base.d-BdJKSPO2.js';
|
|
7
7
|
import { a as CostTracker } from './cost-tracker.d-wRtyEW9d.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as AgentMessage, ag as SessionEntry, ae as Session, ah as SessionExtension, m as CompactionDetails, u as FileOperations } from './types.d-
|
|
3
|
-
import { s as KodaXSessionLineage, i as KodaXJsonValue, a as KodaXCompactMemorySeed, o as KodaXSessionEntry, z as KodaXSessionTreeNode, r as KodaXSessionLabelEntry, q as KodaXSessionGoalEntry, v as KodaXSessionNavigationOptions, k as KodaXSessionArtifactLedgerEntry } from './types.d-
|
|
1
|
+
import { n as KodaXMessage } from './types.d-Cf-GCzac.js';
|
|
2
|
+
import { f as AgentMessage, ag as SessionEntry, ae as Session, ah as SessionExtension, m as CompactionDetails, u as FileOperations } from './types.d-D2RNa5Y7.js';
|
|
3
|
+
import { s as KodaXSessionLineage, i as KodaXJsonValue, a as KodaXCompactMemorySeed, o as KodaXSessionEntry, z as KodaXSessionTreeNode, r as KodaXSessionLabelEntry, q as KodaXSessionGoalEntry, v as KodaXSessionNavigationOptions, k as KodaXSessionArtifactLedgerEntry } from './types.d-B_MIIApc.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @kodax-ai/agent Constants
|
|
@@ -457,7 +457,14 @@ declare class LineageCompaction implements CompactionPolicy {
|
|
|
457
457
|
|
|
458
458
|
/**
|
|
459
459
|
* 生成会话 ID
|
|
460
|
-
* 格式:
|
|
460
|
+
* 格式: YYYYMMDD_HHMMSS_<suffix> (suffix = ms 低位 + 随机, base36)
|
|
461
|
+
*
|
|
462
|
+
* FEATURE_219 (v0.7.46): the date-prefix is preserved (sortable +
|
|
463
|
+
* human-readable), but a per-call suffix makes the id GLOBALLY unique.
|
|
464
|
+
* Under the pre-FEATURE_219 flat layout the filename collision silently
|
|
465
|
+
* masked two same-second sessions (overwrite risk); under the per-project
|
|
466
|
+
* directory layout the same id could otherwise exist in two project folders
|
|
467
|
+
* and make `loadSession(id)` ambiguous. See ADR-038 §7.
|
|
461
468
|
*/
|
|
462
469
|
declare function generateSessionId(): Promise<string>;
|
|
463
470
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as KodaXReasoningMode, V as KodaXThinkingBudgetMap, W as KodaXThinkingDepth, s as KodaXProviderConfig, D as KodaXReasoningCapability, G as KodaXReasoningRequest, R as KodaXTaskType, F as KodaXReasoningOverride, a2 as KodaXVerifyCredentialResult, Y as KodaXToolDefinition, n as KodaXMessage, A as KodaXProviderStreamOptions, L as KodaXStreamResult, o as KodaXModelDescriptor, r as KodaXProviderCapabilityProfile, a3 as KodaXVerifyStrategy, h as KodaXCustomProviderConfig, m as KodaXListModelsResult } from './types.d-Cf-GCzac.js';
|
|
2
2
|
import Anthropic from '@anthropic-ai/sdk';
|
|
3
|
-
import { K as KodaXBaseProvider } from './base.d-
|
|
3
|
+
import { K as KodaXBaseProvider } from './base.d-BdJKSPO2.js';
|
|
4
4
|
import OpenAI from 'openai';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -64,6 +64,24 @@ declare abstract class KodaXAnthropicCompatProvider extends KodaXBaseProvider {
|
|
|
64
64
|
protected client: Anthropic;
|
|
65
65
|
protected initClient(): void;
|
|
66
66
|
protected onStaleConnection(): void;
|
|
67
|
+
/**
|
|
68
|
+
* FEATURE_216 v0.7.45 — Lightweight credential verification.
|
|
69
|
+
* Dispatches by `this.config.verifyStrategy`:
|
|
70
|
+
* - `count-tokens` (default for Anthropic protocol): 0-token
|
|
71
|
+
* `messages.countTokens()` — empirically reliable across 5/5
|
|
72
|
+
* Anthropic-compat providers tested (anthropic / zhipu-coding /
|
|
73
|
+
* kimi-code / minimax-coding / ark-coding).
|
|
74
|
+
* - `models-list`: 0-token `models.list()` — supported by Anthropic
|
|
75
|
+
* SDK 0.80+; not used by any Anthropic built-in but available
|
|
76
|
+
* for custom providers that explicitly opt-in.
|
|
77
|
+
* - `minimal-message`: ~7-token `messages.create({max_tokens:1})`
|
|
78
|
+
* fallback for Anthropic-compat providers whose `count_tokens`
|
|
79
|
+
* endpoint returns 404 (mimo / mimo-coding empirically).
|
|
80
|
+
*/
|
|
81
|
+
verifyCredential(opts?: {
|
|
82
|
+
timeoutMs?: number;
|
|
83
|
+
signal?: AbortSignal;
|
|
84
|
+
}): Promise<KodaXVerifyCredentialResult>;
|
|
67
85
|
/**
|
|
68
86
|
* FEATURE_116 (v0.7.37) — Wrap a string `system` prompt as a single
|
|
69
87
|
* cacheable text block. v1 treats the entire system prompt as one cache
|
|
@@ -107,6 +125,26 @@ declare abstract class KodaXOpenAICompatProvider extends KodaXBaseProvider {
|
|
|
107
125
|
protected client: OpenAI;
|
|
108
126
|
protected initClient(): void;
|
|
109
127
|
protected onStaleConnection(): void;
|
|
128
|
+
/**
|
|
129
|
+
* FEATURE_216 v0.7.45 — Lightweight credential verification.
|
|
130
|
+
* Dispatches by `this.config.verifyStrategy`:
|
|
131
|
+
* - `models-list` (default for OpenAI protocol): 0-token
|
|
132
|
+
* `models.list()` — empirically reliable for openai-compat
|
|
133
|
+
* providers where `/v1/models` gates on auth (kimi / qwen /
|
|
134
|
+
* deepseek confirmed). Verified by opencode `setup-recording-env.ts`
|
|
135
|
+
* for OPENAI_API_KEY proper.
|
|
136
|
+
* - `minimal-message`: ~6-token `chat.completions.create({max_tokens:1})`
|
|
137
|
+
* fallback for OpenAI-compat providers whose `/v1/models` is
|
|
138
|
+
* publicly accessible (zhipu — false-positive risk).
|
|
139
|
+
* - `count-tokens`: NOT supported on OpenAI protocol. Custom provider
|
|
140
|
+
* validator rejects this combo at config time; built-in providers
|
|
141
|
+
* never declare it. Orchestrator returns `unsupported` if it slips
|
|
142
|
+
* through, surfacing the misconfiguration.
|
|
143
|
+
*/
|
|
144
|
+
verifyCredential(opts?: {
|
|
145
|
+
timeoutMs?: number;
|
|
146
|
+
signal?: AbortSignal;
|
|
147
|
+
}): Promise<KodaXVerifyCredentialResult>;
|
|
110
148
|
/**
|
|
111
149
|
* FEATURE_116 (v0.7.37) — Strip any `cache-boundary` markers from
|
|
112
150
|
* KodaXMessage content arrays before they reach OpenAI wire
|
|
@@ -193,6 +231,12 @@ type ProviderSnapshot = {
|
|
|
193
231
|
readonly thinkingBudgetCap?: number;
|
|
194
232
|
/** Whether the provider supports `thinking_budget` / native reasoning. */
|
|
195
233
|
readonly supportsThinking?: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* FEATURE_216 v0.7.45 — Which verify primitive this provider supports
|
|
236
|
+
* for credential checks. Mirrors `provider-capabilities.types.ts`
|
|
237
|
+
* ProviderSnapshot's required field.
|
|
238
|
+
*/
|
|
239
|
+
readonly verifyStrategy: KodaXVerifyStrategy;
|
|
196
240
|
};
|
|
197
241
|
declare const KODAX_PROVIDER_SNAPSHOTS: Record<ProviderName, ProviderSnapshot>;
|
|
198
242
|
declare const KODAX_PROVIDERS: Record<string, () => KodaXBaseProvider>;
|
|
@@ -405,6 +449,38 @@ declare function resolveModelCapabilities(providerName: string, modelId: string)
|
|
|
405
449
|
* checking `process.env[snapshot.apiKeyEnv]` if they care.
|
|
406
450
|
*/
|
|
407
451
|
declare function listAllModelCapabilities(): KodaXModelCapabilities[];
|
|
452
|
+
/**
|
|
453
|
+
* FEATURE_216 v0.7.45 — Top-level lightweight credential verification
|
|
454
|
+
* for any registered provider (built-in / custom / runtime).
|
|
455
|
+
*
|
|
456
|
+
* Never throws. Short-circuits before hitting the provider ctor for:
|
|
457
|
+
* - unknown provider name → `unsupported`
|
|
458
|
+
* - cli-bridge / `verifyStrategy='unsupported'` → `unsupported`
|
|
459
|
+
* - env var missing → `unconfigured` (avoids the `getApiKey()` throw)
|
|
460
|
+
*
|
|
461
|
+
* Otherwise instantiates via `resolveProvider(name)` and delegates to
|
|
462
|
+
* `provider.verifyCredential(opts)`. Cost: 0 tokens (count-tokens /
|
|
463
|
+
* models-list strategies) or ~6-7 tokens (minimal-message strategy).
|
|
464
|
+
*/
|
|
465
|
+
declare function verifyProviderCredential(name: string, opts?: {
|
|
466
|
+
timeoutMs?: number;
|
|
467
|
+
signal?: AbortSignal;
|
|
468
|
+
}): Promise<KodaXVerifyCredentialResult>;
|
|
469
|
+
/**
|
|
470
|
+
* FEATURE_216 v0.7.45 — Returns the static model list KodaX maintains
|
|
471
|
+
* for a provider. Distinct from credential verification: this is for
|
|
472
|
+
* model-picker UIs in SDK consumers. Sourced from
|
|
473
|
+
* `provider-capabilities.json` for built-in providers + the custom
|
|
474
|
+
* registry for user-configured ones. Always `source: 'static'` in
|
|
475
|
+
* v0.7.45 — KodaX-curated list is the authoritative source per
|
|
476
|
+
* FEATURE_198 ("KodaX self-maintained snapshot is the only reliable
|
|
477
|
+
* source" — upstream `/v1/models` is noisy/inconsistent across
|
|
478
|
+
* providers). Future versions may add an opt-in upstream refresh.
|
|
479
|
+
*/
|
|
480
|
+
declare function listProviderModels(name: string, _opts?: {
|
|
481
|
+
timeoutMs?: number;
|
|
482
|
+
signal?: AbortSignal;
|
|
483
|
+
}): Promise<KodaXListModelsResult>;
|
|
408
484
|
|
|
409
|
-
export {
|
|
485
|
+
export { reasoningOverrideToCapability as $, getModelCapabilities as A, getProvider as B, getProviderConfiguredCapabilityProfile as C, getProviderConfiguredReasoningCapability as D, getProviderList as E, getProviderModel as F, getProviderModelDescriptors as G, getProviderModels as H, getReasoningCapability as I, getRuntimeModelProvider as J, KODAX_DEFAULT_PROVIDER as K, getRuntimeModelProviderNames as L, isCustomProviderName as M, isKnownProvider as N, isProviderConfigured as O, isProviderName as Q, isReasoningEnabled as R, isRuntimeModelProviderName as S, listAllModelCapabilities as T, listBuiltinModelCapabilities as U, listCustomProviderModelCapabilities as V, listProviderModels as W, loadReasoningOverride as X, mapDepthToOpenAIReasoningEffort as Y, normalizeReasoningRequest as Z, reasoningCapabilityToOverride as _, KODAX_DEFAULT_THINKING_BUDGETS as a, registerCustomProviders as a0, registerModelProvider as a1, resolveModelCapabilities as a2, resolveProvider as a3, resolveProviderModelDescriptors as a4, resolveThinkingBudget as a5, saveReasoningOverride as a6, validateCustomProviderConfig as a7, verifyProviderCredential as a8, KODAX_PROVIDERS as b, KODAX_PROVIDER_SNAPSHOTS as c, KODAX_REASONING_MODE_SEQUENCE as d, KODAX_REASONING_SAFETY_RESERVE as e, KodaXAnthropicCompatProvider as f, KodaXError as g, KodaXNetworkError as i, KodaXOpenAICompatProvider as j, KodaXProviderError as k, KodaXRateLimitError as l, KodaXToolCallIdError as m, buildReasoningOverrideKey as n, clampThinkingBudget as o, clearReasoningOverride as p, clearRuntimeModelProviders as q, createCustomProvider as r, getAvailableProviderNames as s, getCustomModelCapabilities as t, getCustomProvider as u, getCustomProviderList as v, getCustomProviderModelDescriptors as w, getCustomProviderModels as x, getCustomProviderNames as y, getDefaultThinkingDepthForMode as z };
|
|
410
486
|
export type { ProviderName as P, KodaXModelCapabilities as h };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as KodaXSessionData, s as KodaXSessionLineage, v as KodaXSessionNavigationOptions, w as KodaXSessionRuntimeInfo, y as KodaXSessionStorage } from './types.d-
|
|
1
|
+
import { n as KodaXSessionData, s as KodaXSessionLineage, v as KodaXSessionNavigationOptions, w as KodaXSessionRuntimeInfo, y as KodaXSessionStorage } from './types.d-B_MIIApc.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Session Storage - Session storage abstraction layer
|
|
@@ -70,17 +70,61 @@ declare function createMemorySessionStorage(): SessionStorage;
|
|
|
70
70
|
|
|
71
71
|
declare class FileSessionStorage implements KodaXSessionStorage {
|
|
72
72
|
private readonly sessionsDir;
|
|
73
|
+
/**
|
|
74
|
+
* v0.7.46 — optional explicit project cwd for in-process embedders
|
|
75
|
+
* (KodaX Space) serving multiple projects from a single runtime.
|
|
76
|
+
* Threaded through `getGitRoot(this.hostCwd)` and `inspectWorkspaceRuntime({cwd: this.hostCwd})`
|
|
77
|
+
* so the workspace-mismatch check in `load()` compares against the
|
|
78
|
+
* project the embedder opened, NOT the embedder's startup directory.
|
|
79
|
+
* Unset → all paths behave identically to the pre-v0.7.46 form.
|
|
80
|
+
*/
|
|
81
|
+
private readonly hostCwd?;
|
|
82
|
+
/**
|
|
83
|
+
* v0.7.46 F7 — explicit opt-in for the CLI-style "[Warning] Session
|
|
84
|
+
* project mismatch" stderr notice emitted from `load()`. Pre-v0.7.46
|
|
85
|
+
* the gate was `!this.hostCwd` which fired whenever the embedder
|
|
86
|
+
* hadn't supplied a cwd — but that ALSO matched SDK consumers who
|
|
87
|
+
* don't set cwd (e.g. KodaX Space), bleeding the yellow warning into
|
|
88
|
+
* their stdout/stderr UI channels on every cross-project load. The
|
|
89
|
+
* v0.7.46 default is `false` — silent. CLI surfaces that want the
|
|
90
|
+
* old behavior (warn when user resumes a session from outside its
|
|
91
|
+
* original project) can pass `emitMismatchWarnings: true`.
|
|
92
|
+
*/
|
|
93
|
+
private readonly emitMismatchWarnings;
|
|
73
94
|
constructor(opts?: {
|
|
74
95
|
sessionsDir?: string;
|
|
96
|
+
cwd?: string;
|
|
97
|
+
emitMismatchWarnings?: boolean;
|
|
75
98
|
});
|
|
76
99
|
private writeQueues;
|
|
77
100
|
private serializedWrite;
|
|
78
101
|
private appendState;
|
|
102
|
+
private sessionDirCache;
|
|
103
|
+
private projectJsonWritten;
|
|
104
|
+
private migrationPromise?;
|
|
105
|
+
private ensureMigrated;
|
|
79
106
|
/** Update watermarks. Only overwrites fields the caller actually provided. */
|
|
80
107
|
private syncAppendState;
|
|
81
|
-
private
|
|
82
|
-
private
|
|
108
|
+
private legacyFlatPath;
|
|
109
|
+
private legacyFlatArchivePath;
|
|
110
|
+
private projectDir;
|
|
111
|
+
/** Resolve (and cache) the project directory a write for `id` should land in. */
|
|
112
|
+
private resolveWriteDir;
|
|
113
|
+
private writeFilePath;
|
|
114
|
+
/**
|
|
115
|
+
* id-only locator (ADR-038 §7). Resolution order:
|
|
116
|
+
* 1. cached project dir for this id
|
|
117
|
+
* 2. bounded scan of project dirs: <key>/<id>.jsonl
|
|
118
|
+
* 3. bounded scan of archived: <key>/archived/<id>.jsonl
|
|
119
|
+
* 4. legacy flat: <sessionsDir>/<id>.jsonl
|
|
120
|
+
* On multiple matches (only possible for pre-FEATURE_219 same-second
|
|
121
|
+
* duplicate ids) it prefers the current process's project dir, else
|
|
122
|
+
* returns null with a warning rather than guessing.
|
|
123
|
+
*/
|
|
124
|
+
private resolveSessionLocation;
|
|
83
125
|
private readSession;
|
|
126
|
+
/** Write `<dir>/project.json` once per process per directory (best-effort). */
|
|
127
|
+
private ensureProjectJson;
|
|
84
128
|
private writeSessionInternal;
|
|
85
129
|
private mergeAndWriteInternal;
|
|
86
130
|
appendSessionDelta(id: string, data: SessionData): Promise<void>;
|
|
@@ -101,12 +145,43 @@ declare class FileSessionStorage implements KodaXSessionStorage {
|
|
|
101
145
|
sessionId: string;
|
|
102
146
|
data: SessionData;
|
|
103
147
|
} | null>;
|
|
104
|
-
|
|
148
|
+
/**
|
|
149
|
+
* v0.7.46 — `opts.limit` added so SDK consumers can request more than
|
|
150
|
+
* the legacy 10-entry cap. Default stays at 10 to preserve the
|
|
151
|
+
* interactive REPL picker's behavior. The `public-api.ts` fast path
|
|
152
|
+
* forwards the caller's `limit`; `deleteAll()` passes a large value
|
|
153
|
+
* so it can enumerate ALL sessions for the gitRoot.
|
|
154
|
+
*
|
|
155
|
+
* v0.7.46 — return now carries `createdAt` so the fast path in
|
|
156
|
+
* `public-api.ts` no longer silently strips it. Pre-v0.7.46 callers
|
|
157
|
+
* that only destructured `{id, title, msgCount, runtimeInfo}` are
|
|
158
|
+
* unaffected (extra fields are ignored).
|
|
159
|
+
*/
|
|
160
|
+
list(gitRoot?: string, opts?: {
|
|
161
|
+
limit?: number;
|
|
162
|
+
includeArchived?: boolean;
|
|
163
|
+
}): Promise<Array<{
|
|
105
164
|
id: string;
|
|
106
165
|
title: string;
|
|
107
166
|
msgCount: number;
|
|
108
167
|
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
168
|
+
archived?: boolean;
|
|
169
|
+
createdAt?: string;
|
|
109
170
|
}>>;
|
|
171
|
+
/**
|
|
172
|
+
* FEATURE_219 Phase 4 — whole-session archive (ADR-038 §4). Moves the session
|
|
173
|
+
* file together with its island sidecar into `<projectKey>/archived/`. Paired
|
|
174
|
+
* (never orphans the sidecar). No-op + returns false for a missing session.
|
|
175
|
+
*/
|
|
176
|
+
archive(id: string): Promise<boolean>;
|
|
177
|
+
/** Restore an archived session back into its project directory. */
|
|
178
|
+
unarchive(id: string): Promise<boolean>;
|
|
179
|
+
/**
|
|
180
|
+
* Move a session + its island sidecar between two directories. Propagates a
|
|
181
|
+
* non-ENOENT rename error (e.g. Windows file-in-use) so a partial move is
|
|
182
|
+
* surfaced as a failure instead of silently splitting main + sidecar.
|
|
183
|
+
*/
|
|
184
|
+
private movePair;
|
|
110
185
|
delete(id: string): Promise<void>;
|
|
111
186
|
deleteAll(gitRoot?: string): Promise<void>;
|
|
112
187
|
/**
|
|
@@ -240,6 +240,69 @@ interface KodaXModelDescriptor {
|
|
|
240
240
|
}
|
|
241
241
|
type KodaXProtocolFamily = 'anthropic' | 'openai';
|
|
242
242
|
type KodaXProviderUserAgentMode = 'compat' | 'sdk';
|
|
243
|
+
/**
|
|
244
|
+
* FEATURE_216 v0.7.45 — Strategy KodaX uses to verify a provider's API
|
|
245
|
+
* credentials. Per-provider data-driven (set in `provider-capabilities.json`)
|
|
246
|
+
* because the 14 providers KodaX ships do not share a single zero-token
|
|
247
|
+
* verify primitive — empirically 3 distinct strategies are needed:
|
|
248
|
+
*
|
|
249
|
+
* - `count-tokens`: Anthropic-protocol `messages.countTokens()` —
|
|
250
|
+
* true 0-token (input_tokens reported but no model invocation).
|
|
251
|
+
* Use for Anthropic-compat providers whose upstream implements
|
|
252
|
+
* `/v1/messages/count_tokens`.
|
|
253
|
+
* - `models-list`: `models.list()` — 0-token, authenticated GET.
|
|
254
|
+
* Use ONLY when the provider's `/v1/models` endpoint actually
|
|
255
|
+
* gates on auth (some compat layers expose it publicly → false
|
|
256
|
+
* positives; others 401 even for valid keys → false negatives).
|
|
257
|
+
* - `minimal-message`: `{messages,chat.completions}.create({max_tokens:1})`
|
|
258
|
+
* — ~6-7 tokens / call. Universal fallback for providers where
|
|
259
|
+
* the above two are unreliable. Cost is trivial for UI-button
|
|
260
|
+
* "test connection" use cases (≈ $0.00001 per verify).
|
|
261
|
+
* - `unsupported`: Provider has no verify primitive (CLI bridges
|
|
262
|
+
* own credentials in their own subprocess token store; the SDK
|
|
263
|
+
* does not enter that surface).
|
|
264
|
+
*/
|
|
265
|
+
type KodaXVerifyStrategy = 'count-tokens' | 'models-list' | 'minimal-message' | 'unsupported';
|
|
266
|
+
/**
|
|
267
|
+
* FEATURE_216 v0.7.45 — Never-throws result envelope for
|
|
268
|
+
* `provider.verifyCredential()` / `verifyProviderCredential(name)`.
|
|
269
|
+
* Mirrors `side-query.ts` `SideQueryResult` pattern: every failure
|
|
270
|
+
* mode is captured in the returned object — no rejection, no throw.
|
|
271
|
+
*/
|
|
272
|
+
interface KodaXVerifyCredentialResult {
|
|
273
|
+
readonly ok: boolean;
|
|
274
|
+
/** HTTP status when applicable (verify primitives that hit the wire). */
|
|
275
|
+
readonly status?: number;
|
|
276
|
+
/**
|
|
277
|
+
* Error category. Stable for UI consumers to map to user-facing
|
|
278
|
+
* states ("invalid key", "no network", "provider doesn't support
|
|
279
|
+
* verification", etc.). `unconfigured` is set by the top-level
|
|
280
|
+
* helper when env var is missing — avoids the provider ctor throw
|
|
281
|
+
* (per FEATURE_198 model-capabilities exposure pattern).
|
|
282
|
+
*/
|
|
283
|
+
readonly error?: 'unauthorized' | 'network' | 'timeout' | 'unsupported' | 'unconfigured' | 'server_error' | 'rate_limited' | 'unknown';
|
|
284
|
+
/** Upstream error body or short diagnostic, capped to 240 chars. */
|
|
285
|
+
readonly message?: string;
|
|
286
|
+
readonly durationMs: number;
|
|
287
|
+
/** Estimated token cost: 0 (count-tokens / models-list) or ~6-7 (minimal-message). */
|
|
288
|
+
readonly approxTokensSpent: number;
|
|
289
|
+
/** Which strategy ran (or 'unsupported' if no primitive was attempted). */
|
|
290
|
+
readonly strategy: KodaXVerifyStrategy;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* FEATURE_216 v0.7.45 — Best-effort upstream model listing. Distinct from
|
|
294
|
+
* credential verification: this is for "model picker" UIs. Mixes upstream
|
|
295
|
+
* `/v1/models` data with static `provider-capabilities.json` fallback when
|
|
296
|
+
* the upstream endpoint is unreliable. NOT a cred test — for that, call
|
|
297
|
+
* `verifyProviderCredential()`.
|
|
298
|
+
*/
|
|
299
|
+
interface KodaXListModelsResult {
|
|
300
|
+
readonly ok: boolean;
|
|
301
|
+
readonly source: 'upstream' | 'static' | 'failed';
|
|
302
|
+
readonly models?: readonly string[];
|
|
303
|
+
readonly error?: string;
|
|
304
|
+
readonly durationMs: number;
|
|
305
|
+
}
|
|
243
306
|
interface KodaXCustomProviderConfig {
|
|
244
307
|
name: string;
|
|
245
308
|
protocol: KodaXProtocolFamily;
|
|
@@ -287,6 +350,15 @@ interface KodaXCustomProviderConfig {
|
|
|
287
350
|
* override.
|
|
288
351
|
*/
|
|
289
352
|
streamMaxDurationMs?: number;
|
|
353
|
+
/**
|
|
354
|
+
* FEATURE_216 v0.7.45 — Which verify primitive this provider supports.
|
|
355
|
+
* Optional: when unset, the SDK derives a default from `protocol`
|
|
356
|
+
* (anthropic → count-tokens / openai → models-list). Set explicitly when
|
|
357
|
+
* the upstream `/v1/models` is public (false-positive risk) or the
|
|
358
|
+
* `messages.count_tokens` endpoint is unimplemented (404), in which
|
|
359
|
+
* case `minimal-message` is the only safe fallback.
|
|
360
|
+
*/
|
|
361
|
+
verifyStrategy?: KodaXVerifyStrategy;
|
|
290
362
|
}
|
|
291
363
|
interface KodaXProviderConfig {
|
|
292
364
|
apiKeyEnv: string;
|
|
@@ -349,6 +421,15 @@ interface KodaXProviderConfig {
|
|
|
349
421
|
* the ~RTT margin between client send and server kill timestamp).
|
|
350
422
|
*/
|
|
351
423
|
streamMaxDurationMs?: number;
|
|
424
|
+
/**
|
|
425
|
+
* FEATURE_216 v0.7.45 — Which verify primitive this provider's compat
|
|
426
|
+
* base class uses for `verifyCredential()`. Sourced from
|
|
427
|
+
* `provider-capabilities.json` for built-in providers; for custom
|
|
428
|
+
* providers, falls back to a protocol-derived default
|
|
429
|
+
* (anthropic → count-tokens / openai → models-list) when the custom
|
|
430
|
+
* config does not set it explicitly.
|
|
431
|
+
*/
|
|
432
|
+
verifyStrategy?: KodaXVerifyStrategy;
|
|
352
433
|
}
|
|
353
434
|
interface KodaXProviderStreamOptions {
|
|
354
435
|
onTextDelta?: (text: string) => void;
|
|
@@ -397,4 +478,4 @@ interface KodaXProviderStreamOptions {
|
|
|
397
478
|
signal?: AbortSignal;
|
|
398
479
|
}
|
|
399
480
|
|
|
400
|
-
export type {
|
|
481
|
+
export type { KodaXToolResultImageItem as $, KodaXProviderStreamOptions as A, KodaXProviderToolCallingFidelity as B, KodaXProviderTransport as C, KodaXReasoningCapability as D, KodaXReasoningMode as E, KodaXReasoningOverride as F, KodaXReasoningRequest as G, KodaXRedactedThinkingBlock as H, KodaXReviewScale as I, KodaXRiskLevel as J, KodaXAmaControllerDecision as K, KodaXStreamResult as L, KodaXTaskActionability as M, KodaXTaskBudgetOverrides as N, KodaXTaskComplexity as O, KodaXTaskFamily as P, KodaXTaskRoutingDecision as Q, KodaXTaskType as R, KodaXTaskWorkIntent as S, KodaXTextBlock as T, KodaXThinkingBlock as U, KodaXThinkingBudgetMap as V, KodaXThinkingDepth as W, KodaXTokenUsage as X, KodaXToolDefinition as Y, KodaXToolResultBlock as Z, KodaXToolResultContentItem as _, KodaXAmaFanoutClass as a, KodaXToolResultTextItem as a0, KodaXToolUseBlock as a1, KodaXVerifyCredentialResult as a2, KodaXVerifyStrategy as a3, KodaXAmaFanoutPolicy as b, KodaXAmaProfile as c, KodaXAmaTactic as d, KodaXAssuranceIntent as e, KodaXCacheBoundary as f, KodaXContentBlock as g, KodaXCustomProviderConfig as h, KodaXExecutionMode as i, KodaXExecutionPattern as j, KodaXHarnessProfile as k, KodaXImageBlock as l, KodaXListModelsResult as m, KodaXMessage as n, KodaXModelDescriptor as o, KodaXMutationSurface as p, KodaXProtocolFamily as q, KodaXProviderCapabilityProfile as r, KodaXProviderConfig as s, KodaXProviderContextFidelity as t, KodaXProviderConversationSemantics as u, KodaXProviderEvidenceSupport as v, KodaXProviderLongRunningSupport as w, KodaXProviderMcpSupport as x, KodaXProviderMultimodalSupport as y, KodaXProviderSessionSupport as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as KodaXCompactMemorySeed, k as KodaXSessionArtifactLedgerEntry } from './types.d-
|
|
1
|
+
import { Y as KodaXToolDefinition, n as KodaXMessage, E as KodaXReasoningMode, _ as KodaXToolResultContentItem, U as KodaXThinkingBlock, H as KodaXRedactedThinkingBlock } from './types.d-Cf-GCzac.js';
|
|
2
|
+
import { a as KodaXCompactMemorySeed, k as KodaXSessionArtifactLedgerEntry } from './types.d-B_MIIApc.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Layer A Primitive: Agent / Handoff / Guardrail / AgentReasoningProfile
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { l as BashPrefixExtractor, a1 as KodaXOptions, L as KodaXContextTokenSnapshot, K as KodaXAgentMode, a6 as KodaXRepoIntelligenceMode, A as AgentsFile, i as AutoModeStats, ah as KodaXSkillInvocationContext, _ as KodaXMcpServersConfig } from './bash-prefix-extractor.d-
|
|
2
|
-
import { a as SessionStorage$1 } from './storage.d-
|
|
3
|
-
import { y as KodaXSessionStorage, n as KodaXSessionData, A as KodaXSessionUiHistoryItem, s as KodaXSessionLineage, k as KodaXSessionArtifactLedgerEntry, w as KodaXSessionRuntimeInfo } from './types.d-
|
|
4
|
-
import {
|
|
1
|
+
import { l as BashPrefixExtractor, a1 as KodaXOptions, L as KodaXContextTokenSnapshot, K as KodaXAgentMode, a6 as KodaXRepoIntelligenceMode, A as AgentsFile, i as AutoModeStats, ah as KodaXSkillInvocationContext, _ as KodaXMcpServersConfig } from './bash-prefix-extractor.d-BICYx8pt.js';
|
|
2
|
+
import { a as SessionStorage$1 } from './storage.d-B1Jk6ryM.js';
|
|
3
|
+
import { y as KodaXSessionStorage, n as KodaXSessionData, A as KodaXSessionUiHistoryItem, s as KodaXSessionLineage, k as KodaXSessionArtifactLedgerEntry, w as KodaXSessionRuntimeInfo } from './types.d-B_MIIApc.js';
|
|
4
|
+
import { n as KodaXMessage, E as KodaXReasoningMode, r as KodaXProviderCapabilityProfile, F as KodaXReasoningOverride, h as KodaXCustomProviderConfig } from './types.d-Cf-GCzac.js';
|
|
5
5
|
import * as readline from 'readline';
|
|
6
6
|
import { SpawnSyncReturns } from 'child_process';
|
|
7
7
|
|
|
@@ -515,7 +515,21 @@ declare function saveConfig(config: {
|
|
|
515
515
|
/** FEATURE_102 Phase 3 — cross-provider child fallback chain. */
|
|
516
516
|
fallbackProviders?: string[];
|
|
517
517
|
}): void;
|
|
518
|
-
|
|
518
|
+
/**
|
|
519
|
+
* Get git root directory.
|
|
520
|
+
*
|
|
521
|
+
* v0.7.46 fix — accepts optional `cwd` so in-process SDK embedders (KodaX
|
|
522
|
+
* Space) that serve multiple projects from a single runtime can resolve
|
|
523
|
+
* the git root of the project the user opened, NOT the embedder's
|
|
524
|
+
* startup directory. Without `cwd`, `git rev-parse --show-toplevel`
|
|
525
|
+
* inherits the host process's cwd, which mis-tags storage operations
|
|
526
|
+
* for multi-project embedders (the same root cause as the
|
|
527
|
+
* `saveSessionSnapshot` gitRoot bug in agent-runtime/middleware/ shipped in v0.7.45).
|
|
528
|
+
*
|
|
529
|
+
* No `cwd` arg → behaves identically to the pre-v0.7.46 form
|
|
530
|
+
* (process.cwd() of the host).
|
|
531
|
+
*/
|
|
532
|
+
declare function getGitRoot(cwd?: string): Promise<string | null>;
|
|
519
533
|
declare function rateLimitedCall<T>(fn: () => Promise<T>): Promise<T>;
|
|
520
534
|
|
|
521
535
|
export { processSpecialSyntax as A, BUILTIN_COMMANDS as B, rateLimitedCall as D, registerConfiguredCustomProviders as E, runInkInteractiveMode as F, runInteractiveMode as G, saveConfig as H, touchContext as J, KODAX_CONFIG_FILE as K, PERMISSION_MODES as P, KODAX_DIR as f, KODAX_SESSIONS_DIR as g, KODAX_VERSION as h, PREVIEW_MAX_LENGTH as i, computeConfirmTools as l, createInteractiveContext as m, executeCommand as n, getGitRoot as o, getProviderList as p, getProviderModel as q, getVersion as r, hydrateProcessEnvFromShell as s, isPermissionMode as t, isProviderConfigured as u, loadConfig as v, normalizePermissionMode as w, parseCommand as x, permissionModeDisplayName as y, prepareRuntimeConfig as z };
|