@kodax-ai/kodax 0.7.40 → 0.7.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +146 -1
  2. package/README.md +129 -232
  3. package/README_CN.md +128 -253
  4. package/dist/chunks/chunk-3RKBXWZS.js +2 -0
  5. package/dist/chunks/chunk-7JLYVWAF.js +1033 -0
  6. package/dist/chunks/chunk-CD3R5YBH.js +16 -0
  7. package/dist/chunks/chunk-DKXUY5F2.js +209 -0
  8. package/dist/chunks/chunk-HMYEQJGT.js +31 -0
  9. package/dist/chunks/{chunk-FAVPT4P7.js → chunk-IYJ5EPRV.js} +1 -1
  10. package/dist/chunks/chunk-KUX5LRPP.js +2 -0
  11. package/dist/chunks/{chunk-EQ5DGS2W.js → chunk-OWSKU55I.js} +5 -6
  12. package/dist/chunks/chunk-ZZ4KRK2B.js +465 -0
  13. package/dist/chunks/compaction-config-FIFFP4FT.js +2 -0
  14. package/dist/chunks/{construction-bootstrap-OFPUZTXQ.js → construction-bootstrap-J2WOCYEK.js} +1 -1
  15. package/dist/chunks/dist-2ZHWDXMQ.js +2 -0
  16. package/dist/chunks/dist-W4CJWLIH.js +2 -0
  17. package/dist/chunks/utils-A5MWDTWZ.js +2 -0
  18. package/dist/index.d.ts +237 -7
  19. package/dist/index.js +5 -5
  20. package/dist/kodax_cli.js +935 -917
  21. package/dist/sdk-agent.d.ts +1375 -10
  22. package/dist/sdk-agent.js +1 -1
  23. package/dist/sdk-coding.d.ts +4608 -14
  24. package/dist/sdk-coding.js +1 -1
  25. package/dist/sdk-llm.d.ts +210 -10
  26. package/dist/sdk-llm.js +1 -1
  27. package/dist/sdk-mcp.d.ts +17 -0
  28. package/dist/sdk-mcp.js +2 -0
  29. package/dist/sdk-repl.d.ts +3026 -13
  30. package/dist/sdk-repl.js +2 -1
  31. package/dist/sdk-session.d.ts +164 -0
  32. package/dist/sdk-session.js +2 -0
  33. package/dist/sdk-skills.d.ts +553 -9
  34. package/dist/sdk-skills.js +1 -1
  35. package/dist/types-chunks/bash-prefix-extractor.d-CkhaqKkg.d.ts +2571 -0
  36. package/dist/types-chunks/capability.d-3C62G8Eq.d.ts +39 -0
  37. package/dist/types-chunks/config.d-BfJUXxC0.d.ts +41 -0
  38. package/dist/types-chunks/cost-tracker.d-B6vMoLLF.d.ts +360 -0
  39. package/dist/types-chunks/history-cleanup.d-DznrzEiU.d.ts +1475 -0
  40. package/dist/types-chunks/instance-discovery.d-BsKnIwpg.d.ts +990 -0
  41. package/dist/types-chunks/resolver.d-DX9au4NJ.d.ts +263 -0
  42. package/dist/types-chunks/session-storage.d-Cci897iM.d.ts +68 -0
  43. package/dist/types-chunks/storage.d-Bc5DoAwp.d.ts +532 -0
  44. package/dist/types-chunks/transport.d-DuyjG30t.d.ts +180 -0
  45. package/dist/types-chunks/types.d-B1uGoVTE.d.ts +400 -0
  46. package/dist/types-chunks/types.d-C5mHR87z.d.ts +119 -0
  47. package/dist/types-chunks/types.d-mM8vqvhT.d.ts +254 -0
  48. package/package.json +16 -3
  49. package/dist/acp_events.d.ts +0 -109
  50. package/dist/acp_logger.d.ts +0 -20
  51. package/dist/acp_server.d.ts +0 -92
  52. package/dist/chunks/chunk-6QO6HWGU.js +0 -30
  53. package/dist/chunks/chunk-CLS57NPX.js +0 -460
  54. package/dist/chunks/chunk-NDNILSTR.js +0 -2
  55. package/dist/chunks/chunk-QZEDWITG.js +0 -1226
  56. package/dist/chunks/chunk-Z5EBDA6R.js +0 -15
  57. package/dist/chunks/compaction-config-A7XZ6H5Y.js +0 -2
  58. package/dist/chunks/dist-M57GIWR4.js +0 -2
  59. package/dist/chunks/dist-OTUF22DA.js +0 -2
  60. package/dist/chunks/utils-DFMYJUTE.js +0 -2
  61. package/dist/cli_commands.d.ts +0 -17
  62. package/dist/cli_option_helpers.d.ts +0 -49
  63. package/dist/cli_option_helpers.test.d.ts +0 -1
  64. package/dist/constructed_cli.d.ts +0 -82
  65. package/dist/constructed_cli.test.d.ts +0 -1
  66. package/dist/kodax_cli.d.ts +0 -7
  67. package/dist/self_modify_cli.d.ts +0 -81
  68. package/dist/self_modify_cli.test.d.ts +0 -9
  69. package/dist/skill_cli.d.ts +0 -15
  70. package/dist/skill_cli.test.d.ts +0 -1
@@ -0,0 +1,532 @@
1
+ import { l as BashPrefixExtractor, _ as KodaXOptions, H as KodaXContextTokenSnapshot, K as KodaXAgentMode, a3 as KodaXRepoIntelligenceMode, A as AgentsFile, i as AutoModeStats, ae as KodaXSkillInvocationContext, X as KodaXMcpServersConfig } from './bash-prefix-extractor.d-CkhaqKkg.js';
2
+ import { a as SessionStorage$1, S as SessionData } from './session-storage.d-Cci897iM.js';
3
+ import { u as KodaXSessionStorage, k as KodaXSessionData, w as KodaXSessionUiHistoryItem, o as KodaXSessionLineage, h as KodaXSessionArtifactLedgerEntry, s as KodaXSessionRuntimeInfo } from './types.d-mM8vqvhT.js';
4
+ import { m as KodaXMessage, D as KodaXReasoningMode, q as KodaXProviderCapabilityProfile, E as KodaXReasoningOverride, h as KodaXCustomProviderConfig } from './types.d-B1uGoVTE.js';
5
+ import * as readline from 'readline';
6
+ import { SpawnSyncReturns } from 'child_process';
7
+
8
+ /**
9
+ * Permission Types
10
+ */
11
+
12
+ /**
13
+ * Permission mode
14
+ * - plan: Read-only planning, all modifications blocked unless explicitly whitelisted
15
+ * - accept-edits: File edits auto-approved, shell commands require confirmation
16
+ * - auto: All tools auto-approved (with optional LLM classifier review when
17
+ * auto-mode engine === 'llm'; FEATURE_092 v0.7.33). When engine === 'rules',
18
+ * falls back to the legacy "all tools approved within project, outside
19
+ * requires confirmation" behavior — i.e., the v0.7.32 `auto-in-project`
20
+ * shape. The `auto-in-project` name is preserved as a deprecated alias
21
+ * for 5 minor versions (removed in v0.7.38).
22
+ */
23
+ type PermissionMode = "plan" | "accept-edits" | "auto" | "auto-in-project";
24
+ declare const PERMISSION_MODES: PermissionMode[];
25
+ /**
26
+ * Status-bar display name for a permission mode. Title-Case short labels
27
+ * (mirrors Claude Code's `shortTitle` convention in
28
+ * `src/utils/permissions/PermissionMode.ts`):
29
+ * - `plan` → `Plan`
30
+ * - `accept-edits` → `Edits`
31
+ * - `auto` → `Auto`
32
+ * - `auto-in-project` → `Auto` (deprecated alias folds into the canonical
33
+ * display name; the deprecation notice
34
+ * surfaces once per session at startup)
35
+ *
36
+ * Single source of truth — both the readline status-bar
37
+ * (`packages/repl/src/interactive/status-bar.ts`) and the Ink view-model
38
+ * (`packages/repl/src/ui/view-models/status-bar.ts`) consume this so the two
39
+ * surfaces never drift on capitalization or short-form choice.
40
+ */
41
+ declare function permissionModeDisplayName(mode: PermissionMode): string;
42
+ interface ConfirmResult {
43
+ confirmed: boolean;
44
+ always?: boolean;
45
+ }
46
+ interface PermissionContext {
47
+ permissionMode: PermissionMode;
48
+ confirmTools: Set<string>;
49
+ gitRoot?: string;
50
+ alwaysAllowTools: string[];
51
+ onConfirm?: (tool: string, input: Record<string, unknown>) => Promise<ConfirmResult>;
52
+ saveAlwaysAllowTool?: (tool: string, input: Record<string, unknown>, allowAll?: boolean) => void;
53
+ switchPermissionMode?: (mode: PermissionMode) => void;
54
+ beforeToolExecute?: (tool: string, input: Record<string, unknown>) => Promise<boolean | string>;
55
+ /**
56
+ * FEATURE_153 (v0.7.38) — Optional LLM-backed bash command prefix extractor.
57
+ * When supplied, `isToolCallAllowed` uses it to extract the SAFE PREFIX of
58
+ * a bash command before matching against allowlist patterns like
59
+ * `Bash(git commit:*)`. This eliminates the pre-FEATURE_153 vulnerability
60
+ * where `git commit -m "x" $(curl evil)` matched the allowlist via naive
61
+ * `command.startsWith` semantics.
62
+ *
63
+ * KodaX REPL bootstrap creates this via `createBashPrefixExtractor` from
64
+ * `@kodax-ai/coding` and threads it here. SDK consumers / tests without
65
+ * LLM access can omit it; legacy startsWith semantics apply (documented
66
+ * as insecure in `matchesBashPatternLegacy`).
67
+ */
68
+ bashPrefixExtractor?: BashPrefixExtractor;
69
+ }
70
+ /**
71
+ * Compute the base confirmation set for each permission mode.
72
+ *
73
+ * Note: `plan` still lists the standard mutating tools here even though most of
74
+ * them are blocked earlier in the permission pipeline via `getPlanModeBlockReason`.
75
+ * This helper only describes the remaining confirmation step for calls that are
76
+ * not hard-blocked.
77
+ */
78
+ declare function computeConfirmTools(mode: PermissionMode): Set<string>;
79
+ declare function isPermissionMode(value: string | undefined): value is PermissionMode;
80
+ declare function normalizePermissionMode(value: string | undefined, fallback?: PermissionMode): PermissionMode | undefined;
81
+
82
+ /**
83
+ * InkREPL - Ink-based REPL Adapter
84
+ *
85
+ * Bridges Ink UI components with existing KodaX command processing logic.
86
+ * Replaces the Node.js readline-based input with Ink's React components.
87
+ *
88
+ * Architecture based on Gemini CLI:
89
+ * - Uses UIStateContext for global state
90
+ * - Uses KeypressContext for priority-based keyboard handling
91
+ * - Uses StreamingContext for streaming response management
92
+ */
93
+
94
+ interface InkREPLOptions extends KodaXOptions {
95
+ storage?: SessionStorage$1;
96
+ hardExitOnClose?: boolean;
97
+ }
98
+ /**
99
+ * Run Ink-based interactive mode
100
+ */
101
+ declare function runInkInteractiveMode(options: InkREPLOptions): Promise<void>;
102
+
103
+ /**
104
+ * KodaX Interactive REPL Mode - 交互式 REPL 模式
105
+ */
106
+
107
+ interface SessionStorage extends KodaXSessionStorage {
108
+ list(gitRoot?: string): Promise<Array<{
109
+ id: string;
110
+ title: string;
111
+ msgCount: number;
112
+ runtimeInfo?: KodaXSessionData['runtimeInfo'];
113
+ }>>;
114
+ }
115
+ interface RepLOptions extends KodaXOptions {
116
+ storage?: SessionStorage;
117
+ }
118
+ declare function runInteractiveMode(options: RepLOptions): Promise<void>;
119
+ declare function processSpecialSyntax(input: string): Promise<string>;
120
+
121
+ /**
122
+ * KodaX Interactive Context Management - 交互式上下文管理
123
+ */
124
+
125
+ type InteractiveMode = 'code' | 'ask';
126
+ interface InteractiveContext {
127
+ messages: KodaXMessage[];
128
+ uiHistory?: KodaXSessionUiHistoryItem[];
129
+ contextTokenSnapshot?: KodaXContextTokenSnapshot;
130
+ lineage?: KodaXSessionLineage;
131
+ artifactLedger?: KodaXSessionArtifactLedgerEntry[];
132
+ sessionId: string;
133
+ title: string;
134
+ gitRoot?: string;
135
+ runtimeInfo?: KodaXSessionRuntimeInfo;
136
+ createdAt: string;
137
+ lastAccessed: string;
138
+ }
139
+ declare function createInteractiveContext(options: {
140
+ sessionId?: string;
141
+ gitRoot?: string;
142
+ runtimeInfo?: KodaXSessionRuntimeInfo;
143
+ existingMessages?: KodaXMessage[];
144
+ existingUiHistory?: KodaXSessionUiHistoryItem[];
145
+ existingLineage?: KodaXSessionLineage;
146
+ existingArtifactLedger?: KodaXSessionArtifactLedgerEntry[];
147
+ }): Promise<InteractiveContext>;
148
+ declare function touchContext(context: InteractiveContext): void;
149
+
150
+ /**
151
+ * UI Context Interface - UI 交互上下文接口
152
+ *
153
+ * 通用 UI 交互接口,可用于:
154
+ * - Command handlers (命令处理器)
155
+ * - Skills execution (技能执行)
156
+ * - LLM tool calls (LLM 工具调用)
157
+ * - Agent workflows (Agent 工作流)
158
+ */
159
+ /**
160
+ * UIContext - 通用 UI 交互接口
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * // Command handler 中使用
165
+ * const selected = await callbacks.ui.select("Choose an option", ["A", "B", "C"]);
166
+ * const confirmed = await callbacks.ui.confirm("Delete all sessions?");
167
+ * const value = await callbacks.ui.input("Enter your name", "John");
168
+ * ```
169
+ */
170
+ interface UIContext {
171
+ /**
172
+ * Show a selector and return the user's choice
173
+ * 显示选择对话框,返回用户的选择
174
+ *
175
+ * @param title - Dialog title
176
+ * @param options - List of options to choose from
177
+ * @returns Selected option, or undefined if cancelled
178
+ */
179
+ select(title: string, options: string[]): Promise<string | undefined>;
180
+ /**
181
+ * Show a confirmation dialog
182
+ * 显示确认对话框
183
+ *
184
+ * @param message - Confirmation message
185
+ * @returns true if confirmed, false if declined
186
+ */
187
+ confirm(message: string): Promise<boolean>;
188
+ /**
189
+ * Show a text input dialog
190
+ * 显示文本输入对话框
191
+ *
192
+ * @param prompt - Input prompt
193
+ * @param defaultValue - Optional default value
194
+ * @returns Input value, or undefined if cancelled
195
+ */
196
+ input(prompt: string, defaultValue?: string): Promise<string | undefined>;
197
+ }
198
+
199
+ type CommandSource = 'builtin' | 'extension' | 'skill' | 'prompt';
200
+ type CommandPriority = 'critical' | 'high' | 'medium' | 'low';
201
+ interface CommandHook {
202
+ matcher?: string;
203
+ command: string;
204
+ }
205
+ interface CommandHooks {
206
+ SessionStart?: CommandHook[];
207
+ UserPromptSubmit?: CommandHook[];
208
+ PreToolUse?: CommandHook[];
209
+ PostToolUse?: CommandHook[];
210
+ Stop?: CommandHook[];
211
+ SubagentStop?: CommandHook[];
212
+ Notification?: CommandHook[];
213
+ }
214
+ interface CommandExecutionMetadata {
215
+ disableModelInvocation?: boolean;
216
+ userInvocable?: boolean;
217
+ allowedTools?: string;
218
+ context?: 'fork';
219
+ agent?: string;
220
+ argumentHint?: string;
221
+ model?: string;
222
+ hooks?: CommandHooks;
223
+ frontmatter?: Record<string, unknown>;
224
+ }
225
+ interface CurrentConfig {
226
+ provider: string;
227
+ model?: string;
228
+ thinking: boolean;
229
+ reasoningMode: KodaXReasoningMode;
230
+ agentMode: KodaXAgentMode;
231
+ permissionMode: PermissionMode;
232
+ repoIntelligenceMode?: KodaXRepoIntelligenceMode;
233
+ repointelEndpoint?: string;
234
+ repointelBin?: string;
235
+ repoIntelligenceTrace?: boolean;
236
+ }
237
+ type SessionLoadStatus = 'loaded' | 'missing' | 'blocked';
238
+ type SessionBranchSwitchStatus = 'switched' | 'missing' | 'blocked';
239
+ type SessionForkStatus = 'forked' | 'failed' | 'blocked';
240
+ type SessionRewindStatus = 'rewound' | 'failed' | 'blocked';
241
+ interface CommandCallbacks {
242
+ exit: () => void | Promise<void>;
243
+ saveSession: () => Promise<void>;
244
+ startNewSession?: () => void;
245
+ loadSession: (id: string) => Promise<SessionLoadStatus>;
246
+ listSessions: () => Promise<void>;
247
+ clearHistory: () => void;
248
+ printHistory: () => void;
249
+ switchProvider?: (provider: string, model?: string) => void;
250
+ setThinking?: (enabled: boolean) => void;
251
+ setReasoningMode?: (mode: KodaXReasoningMode) => void;
252
+ setAgentMode?: (mode: KodaXAgentMode) => void;
253
+ setPermissionMode?: (mode: PermissionMode) => void;
254
+ setRepoIntelligenceRuntime?: (update: {
255
+ mode?: KodaXRepoIntelligenceMode;
256
+ endpoint?: string | null;
257
+ bin?: string | null;
258
+ trace?: boolean;
259
+ }) => void;
260
+ deleteSession?: (id: string) => Promise<void>;
261
+ deleteAllSessions?: () => Promise<void>;
262
+ createKodaXOptions?: () => KodaXOptions;
263
+ reloadAgentsFiles?: () => Promise<AgentsFile[]>;
264
+ confirm?: (message: string) => Promise<boolean>;
265
+ readline?: readline.Interface;
266
+ startCompacting?: () => void;
267
+ stopCompacting?: () => void;
268
+ /**
269
+ * Fired by `/compact` after a successful manual compaction so the UI
270
+ * layer can update its live token count (mirrors the agent-runtime
271
+ * `onCompactStats` for auto-compaction). Without this, the status bar
272
+ * keeps showing the pre-compact `liveTokenCount` because that field
273
+ * outranks `context.contextTokenSnapshot` in the cascade.
274
+ */
275
+ onCompactStats?: (info: {
276
+ tokensBefore: number;
277
+ tokensAfter: number;
278
+ }) => void;
279
+ printSessionTree?: () => Promise<void>;
280
+ switchSessionBranch?: (selector: string) => Promise<SessionBranchSwitchStatus>;
281
+ labelSessionBranch?: (selector: string, label?: string) => Promise<boolean>;
282
+ forkSession?: (selector?: string) => Promise<SessionForkStatus>;
283
+ rewindSession?: (selector?: string) => Promise<SessionRewindStatus>;
284
+ getCostReport?: () => string | null;
285
+ /**
286
+ * FEATURE_092 phase 2b.8: read-only stats accessor for the auto-mode
287
+ * classifier guardrail. Returns undefined when the guardrail hasn't been
288
+ * constructed yet (REPL never entered auto mode this session). The
289
+ * returned snapshot is a copy of references — caller cannot mutate
290
+ * guardrail state through it. Used by `/auto-engine` (show), `/auto-denials`,
291
+ * and the status bar engine indicator.
292
+ */
293
+ getAutoModeStats?: () => AutoModeStats | undefined;
294
+ /**
295
+ * FEATURE_092 phase 2b.8: manual engine setter for `/auto-engine llm|rules`.
296
+ * No-op when the guardrail hasn't been constructed yet. Threshold downgrades
297
+ * still operate normally — a subsequent denial cross will downgrade again.
298
+ */
299
+ setAutoModeEngine?: (engine: 'llm' | 'rules') => void;
300
+ ui: UIContext;
301
+ }
302
+ interface CommandResultData {
303
+ success?: boolean;
304
+ message?: string;
305
+ data?: unknown;
306
+ skillContent?: string;
307
+ invocation?: CommandInvocationRequest;
308
+ }
309
+ interface CommandInvocationRequest extends CommandExecutionMetadata {
310
+ prompt: string;
311
+ source: 'skill' | 'prompt' | 'extension';
312
+ displayName: string;
313
+ path?: string;
314
+ skillInvocation?: KodaXSkillInvocationContext;
315
+ }
316
+ type CommandResult$1 = boolean | CommandResultData;
317
+ type CommandHandler = (args: string[], context: InteractiveContext, callbacks: CommandCallbacks, currentConfig: CurrentConfig) => Promise<CommandResult$1 | void>;
318
+ /**
319
+ * Legacy command shape used by the existing REPL command table.
320
+ */
321
+ interface Command$1 {
322
+ name: string;
323
+ aliases?: string[];
324
+ description: string;
325
+ usage?: string;
326
+ handler: CommandHandler;
327
+ detailedHelp?: () => void;
328
+ source?: CommandSource;
329
+ priority?: CommandPriority;
330
+ location?: 'user' | 'project' | 'path';
331
+ path?: string;
332
+ userInvocable?: boolean;
333
+ disableModelInvocation?: boolean;
334
+ allowedTools?: string;
335
+ context?: 'fork';
336
+ agent?: string;
337
+ argumentHint?: string;
338
+ model?: string;
339
+ hooks?: CommandHooks;
340
+ frontmatter?: Record<string, unknown>;
341
+ }
342
+
343
+ /**
344
+ * KodaX Interactive Command System
345
+ */
346
+
347
+ type Command = Command$1;
348
+ declare const BUILTIN_COMMANDS: Command[];
349
+ declare function parseCommand(input: string): {
350
+ command: string;
351
+ args: string[];
352
+ skillInvocation?: {
353
+ name: string;
354
+ };
355
+ } | null;
356
+ type CommandResult = boolean | {
357
+ skillContent?: string;
358
+ invocation?: CommandInvocationRequest;
359
+ };
360
+ declare function executeCommand(parsed: {
361
+ command: string;
362
+ args: string[];
363
+ skillInvocation?: {
364
+ name: string;
365
+ };
366
+ }, context: InteractiveContext, callbacks: CommandCallbacks, currentConfig: CurrentConfig): Promise<CommandResult>;
367
+
368
+ /**
369
+ * KodaX CLI Utilities
370
+ * CLI 层工具函数
371
+ */
372
+
373
+ /**
374
+ * CLI config directory paths — top-level constants frozen at module-load time.
375
+ *
376
+ * **LOAD-TIME FREEZE WARNING (v0.7.35.1 FEATURE_145)** — these constants
377
+ * are computed ONCE when this module is first imported, by reading
378
+ * `getAgentConfigHome()` (which itself reads `KODAX_HOME` env var and
379
+ * the programmatic override at that single moment). Subsequent calls to
380
+ * `setAgentConfigHome()` have NO effect on these constants. This
381
+ * matches the prior v0.7.35 behavior where they were inlined as
382
+ * `path.join(os.homedir(), '.kodax')` — same load-time semantics, just
383
+ * routed through the resolver so that `KODAX_HOME` env is now honored.
384
+ *
385
+ * **For substrate consumers**: if you intend to redirect the agent
386
+ * config home via `setAgentConfigHome()`, you MUST call it BEFORE
387
+ * importing any module that transitively imports `@kodax-ai/repl`'s
388
+ * `utils.ts`. Common downstream consumers that capture these constants
389
+ * include:
390
+ * - `repl/interactive/storage.ts` → `KODAX_SESSIONS_DIR` (session
391
+ * persistence; silent corruption risk if override is set late)
392
+ * - the SDK's `repl/index.ts` re-exports
393
+ * - root `src/index.ts` re-exports
394
+ *
395
+ * **For env-var users**: setting `KODAX_HOME=/path` before launching
396
+ * the kodax CLI works as expected — the env var is read at first
397
+ * import.
398
+ *
399
+ * **For per-call resolution**: use `getAgentConfigHome()` /
400
+ * `getAgentConfigPath(...)` directly from `@kodax-ai/agent` instead of
401
+ * these constants — those resolve at call time and honor late
402
+ * `setAgentConfigHome()` calls.
403
+ */
404
+ declare const KODAX_DIR: string;
405
+ declare const KODAX_SESSIONS_DIR: string;
406
+ declare const KODAX_CONFIG_FILE: string;
407
+ declare const PREVIEW_MAX_LENGTH = 60;
408
+ type ShellEnvRunner = (command: string, args: string[], options: {
409
+ encoding: 'utf8';
410
+ env: NodeJS.ProcessEnv;
411
+ maxBuffer: number;
412
+ timeout: number;
413
+ windowsHide: boolean;
414
+ detached: boolean;
415
+ stdio: ['ignore', 'pipe', 'pipe'];
416
+ }) => SpawnSyncReturns<string>;
417
+ declare function hydrateProcessEnvFromShell(options?: {
418
+ env?: NodeJS.ProcessEnv;
419
+ platform?: NodeJS.Platform;
420
+ run?: ShellEnvRunner;
421
+ shell?: string;
422
+ }): boolean;
423
+ declare function registerConfiguredCustomProviders(config: {
424
+ customProviders?: KodaXCustomProviderConfig[];
425
+ }): void;
426
+ declare function getVersion(): string;
427
+ declare const KODAX_VERSION: string;
428
+ declare function getProviderModel(name: string): string | null;
429
+ declare function getProviderList(providerModelsConfig?: Record<string, string[]>): Array<{
430
+ name: string;
431
+ model: string;
432
+ models: string[];
433
+ configured: boolean;
434
+ reasoningCapability: string;
435
+ capabilityProfile: KodaXProviderCapabilityProfile;
436
+ custom?: boolean;
437
+ }>;
438
+ declare function isProviderConfigured(name: string): boolean;
439
+ declare function loadConfig(): {
440
+ provider?: string;
441
+ model?: string;
442
+ thinking?: boolean;
443
+ reasoningMode?: KodaXReasoningMode;
444
+ /**
445
+ * FEATURE_078 (v0.7.29): preferred name for `reasoningMode`. Both
446
+ * fields map to the same runtime L1 user-ceiling semantic; when both
447
+ * are present `reasoningCeiling` wins. Prefer this name in new
448
+ * configs — `reasoningMode` is kept accepted for backward
449
+ * compatibility and never auto-renamed (no user-visible churn).
450
+ */
451
+ reasoningCeiling?: KodaXReasoningMode;
452
+ agentMode?: KodaXAgentMode;
453
+ permissionMode?: string;
454
+ locale?: string;
455
+ providerReasoningOverrides?: Record<string, KodaXReasoningOverride>;
456
+ providerModels?: Record<string, string[]>;
457
+ customProviders?: KodaXCustomProviderConfig[];
458
+ extensions?: string[];
459
+ mcpServers?: KodaXMcpServersConfig;
460
+ repoIntelligenceMode?: 'auto' | 'off' | 'oss' | 'premium-shared' | 'premium-native';
461
+ repointelEndpoint?: string;
462
+ repointelBin?: string;
463
+ repoIntelligenceTrace?: boolean;
464
+ streamIdleTimeoutMs?: number;
465
+ };
466
+ declare function prepareRuntimeConfig(): ReturnType<typeof loadConfig>;
467
+ declare function saveConfig(config: {
468
+ provider?: string;
469
+ model?: string;
470
+ thinking?: boolean;
471
+ reasoningMode?: KodaXReasoningMode;
472
+ agentMode?: KodaXAgentMode;
473
+ permissionMode?: string;
474
+ locale?: string;
475
+ providerReasoningOverrides?: Record<string, KodaXReasoningOverride>;
476
+ providerModels?: Record<string, string[]>;
477
+ customProviders?: KodaXCustomProviderConfig[];
478
+ extensions?: string[];
479
+ mcpServers?: KodaXMcpServersConfig;
480
+ repoIntelligenceMode?: 'auto' | 'off' | 'oss' | 'premium-shared' | 'premium-native';
481
+ repointelEndpoint?: string;
482
+ repointelBin?: string;
483
+ repoIntelligenceTrace?: boolean;
484
+ }): void;
485
+ declare function getGitRoot(): Promise<string | null>;
486
+ declare function rateLimitedCall<T>(fn: () => Promise<T>): Promise<T>;
487
+
488
+ /**
489
+ * KodaX session storage - filesystem implementation.
490
+ */
491
+
492
+ declare class FileSessionStorage implements KodaXSessionStorage {
493
+ private writeQueues;
494
+ private serializedWrite;
495
+ private appendState;
496
+ /** Update watermarks. Only overwrites fields the caller actually provided. */
497
+ private syncAppendState;
498
+ private getSessionFilePath;
499
+ private getArchiveFilePath;
500
+ private readSession;
501
+ private writeSessionInternal;
502
+ private mergeAndWriteInternal;
503
+ appendSessionDelta(id: string, data: SessionData): Promise<void>;
504
+ private shouldRunMaintenance;
505
+ private runMaintenance;
506
+ save(id: string, data: SessionData): Promise<void>;
507
+ load(id: string): Promise<SessionData | null>;
508
+ getLineage(id: string): Promise<KodaXSessionLineage | null>;
509
+ setActiveEntry(id: string, selector: string, options?: {
510
+ summarizeCurrentBranch?: boolean;
511
+ }): Promise<SessionData | null>;
512
+ rewind(id: string, selector?: string): Promise<SessionData | null>;
513
+ setLabel(id: string, selector: string, label?: string): Promise<SessionData | null>;
514
+ fork(id: string, selector?: string, options?: {
515
+ sessionId?: string;
516
+ title?: string;
517
+ }): Promise<{
518
+ sessionId: string;
519
+ data: SessionData;
520
+ } | null>;
521
+ list(gitRoot?: string): Promise<Array<{
522
+ id: string;
523
+ title: string;
524
+ msgCount: number;
525
+ runtimeInfo?: KodaXSessionRuntimeInfo;
526
+ }>>;
527
+ delete(id: string): Promise<void>;
528
+ deleteAll(gitRoot?: string): Promise<void>;
529
+ }
530
+
531
+ export { processSpecialSyntax as A, BUILTIN_COMMANDS as B, rateLimitedCall as D, registerConfiguredCustomProviders as E, FileSessionStorage as F, runInkInteractiveMode as G, runInteractiveMode as H, saveConfig as J, KODAX_CONFIG_FILE as K, touchContext as L, 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 };
532
+ export type { Command as C, InkREPLOptions as I, RepLOptions as R, CommandCallbacks as a, ConfirmResult as b, CurrentConfig as c, InteractiveContext as d, InteractiveMode as e, PermissionContext as j, PermissionMode as k };