@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.
Files changed (86) hide show
  1. package/CHANGELOG.md +602 -487
  2. package/README.md +46 -27
  3. package/README_CN.md +30 -13
  4. package/dist/chunks/agent-YKGU4USA.js +2 -0
  5. package/dist/chunks/argument-completer-QZETLNAB.js +2 -0
  6. package/dist/chunks/{chunk-SX2WFHIS.js → chunk-2RI252RN.js} +1 -1
  7. package/dist/chunks/chunk-CLFP6UGU.js +71 -0
  8. package/dist/chunks/chunk-E27LHEIP.js +37 -0
  9. package/dist/chunks/chunk-EDZ5KJFT.js +5 -0
  10. package/dist/chunks/chunk-GIK4SGAT.js +364 -0
  11. package/dist/chunks/chunk-GVWPHE23.js +310 -0
  12. package/dist/chunks/{chunk-A2TFSV5M.js → chunk-IR5KIK7E.js} +1 -1
  13. package/dist/chunks/chunk-JSDLBXME.js +755 -0
  14. package/dist/chunks/chunk-MVARIMQV.js +22 -0
  15. package/dist/chunks/chunk-PKQOEDHJ.js +628 -0
  16. package/dist/chunks/{chunk-64NQBOSN.js → chunk-SQODXBLX.js} +1 -1
  17. package/dist/chunks/chunk-VDGCGOQH.js +328 -0
  18. package/dist/chunks/chunk-VVE3UM4F.js +410 -0
  19. package/dist/chunks/chunk-WIBLZK4G.js +151 -0
  20. package/dist/chunks/{compaction-config-5KKKXYFT.js → compaction-config-TWCDFLX6.js} +1 -1
  21. package/dist/chunks/{construction-bootstrap-OXDDDW6O.js → construction-bootstrap-ZJPXUPXQ.js} +1 -1
  22. package/dist/chunks/dist-JT4ATXVM.js +2 -0
  23. package/dist/chunks/host-SVEDZUC5.js +2 -0
  24. package/dist/chunks/{run-manager-Z3W6MDO7.js → run-manager-RX42UNEM.js} +1 -1
  25. package/dist/chunks/{utils-CFOXDCB5.js → utils-OTT5CG5J.js} +1 -1
  26. package/dist/index.d.ts +13 -13
  27. package/dist/index.js +4 -4
  28. package/dist/kodax_bootstrap.js +28 -0
  29. package/dist/kodax_cli.js +1325 -1333
  30. package/dist/kodax_resume.js +44 -0
  31. package/dist/provider-capabilities.json +50 -48
  32. package/dist/runtime-worker.js +1322 -1330
  33. package/dist/sdk-a2a.d.ts +10 -9
  34. package/dist/sdk-a2a.js +1 -1
  35. package/dist/sdk-agent.d.ts +382 -206
  36. package/dist/sdk-agent.js +1 -1
  37. package/dist/sdk-coding.d.ts +80 -128
  38. package/dist/sdk-coding.js +1 -1
  39. package/dist/sdk-experimental-memory.js +1 -1
  40. package/dist/sdk-mcp.js +1 -1
  41. package/dist/sdk-media.d.ts +3 -0
  42. package/dist/sdk-media.js +1 -1
  43. package/dist/sdk-repl.d.ts +71 -23
  44. package/dist/sdk-repl.js +2 -2
  45. package/dist/sdk-runtime.d.ts +143 -31
  46. package/dist/sdk-runtime.js +1 -1
  47. package/dist/sdk-session.d.ts +6 -5
  48. package/dist/sdk-session.js +1 -1
  49. package/dist/sdk-skills.d.ts +5 -5
  50. package/dist/sdk-skills.js +1 -1
  51. package/dist/semantic-worker.js +14 -14
  52. package/dist/types-chunks/{bash-prefix-extractor.d-YoiZl5yt.d.ts → bash-prefix-extractor.d-CHJO5y94.d.ts} +107 -248
  53. package/dist/types-chunks/{capsule.d-CK5Pfz1k.d.ts → capsule.d-DxtdE-GD.d.ts} +24 -95
  54. package/dist/types-chunks/center-types.d-BBT122uJ.d.ts +91 -0
  55. package/dist/types-chunks/{commands.d-D6g2jq8V.d.ts → commands.d-DZxHzH5-.d.ts} +6 -4
  56. package/dist/types-chunks/{guardrail.d-DilYC1dh.d.ts → guardrail.d-DlpMnd-Y.d.ts} +1 -1
  57. package/dist/types-chunks/{guardrail.d-DdeDWnVu.d.ts → guardrail.d-auV61_h5.d.ts} +83 -10
  58. package/dist/types-chunks/public-api.d--IDNJsu1.d.ts +1342 -0
  59. package/dist/types-chunks/{run-manager.d-DxU3SSGR.d.ts → run-manager.d-Bh50OdVl.d.ts} +1 -1
  60. package/dist/types-chunks/sdk-session-Cfw6NFu-.d.ts +82 -0
  61. package/dist/types-chunks/{types.d-CEZZSY9s.d.ts → types.d-CNZgY52F.d.ts} +2 -2
  62. package/dist/types-chunks/{types.d-vJExiRje.d.ts → types.d-DCQVBqVn.d.ts} +10 -5
  63. package/dist/types-chunks/{types.d-CRCaLt_s.d.ts → types.d-DH1mvdcl.d.ts} +284 -164
  64. package/dist/types-chunks/{types.d-CzsLFqmf.d.ts → types.d-EqQmHztg.d.ts} +9 -10
  65. package/dist/types-chunks/{utils.d-Cb6vdvFM.d.ts → utils.d-gmn3c5U4.d.ts} +9 -12
  66. package/docs/SDK_EMBEDDER_GUIDE.md +171 -26
  67. package/package.json +4 -4
  68. package/scripts/kodax-bin.cjs +4 -2
  69. package/scripts/production-env.cjs +9 -0
  70. package/dist/chunks/agent-X2EWQADL.js +0 -2
  71. package/dist/chunks/argument-completer-BLNXDO2F.js +0 -2
  72. package/dist/chunks/chunk-4DY756KL.js +0 -70
  73. package/dist/chunks/chunk-52JSZ77P.js +0 -37
  74. package/dist/chunks/chunk-A574DBTV.js +0 -422
  75. package/dist/chunks/chunk-F7KGYHJ3.js +0 -624
  76. package/dist/chunks/chunk-GVTM4Z6O.js +0 -151
  77. package/dist/chunks/chunk-PHH4TRGF.js +0 -22
  78. package/dist/chunks/chunk-PVUXONQB.js +0 -366
  79. package/dist/chunks/chunk-T7LYK53M.js +0 -329
  80. package/dist/chunks/chunk-VRSVNU2Y.js +0 -7
  81. package/dist/chunks/chunk-Y5XKAN7C.js +0 -755
  82. package/dist/chunks/chunk-Z535BARK.js +0 -306
  83. package/dist/chunks/dist-IXJRJ27U.js +0 -2
  84. package/dist/chunks/host-VRKDAN26.js +0 -2
  85. package/dist/types-chunks/public-api.d-BvCp5VkW.d.ts +0 -601
  86. package/dist/types-chunks/sdk-session-wGpa7X_U.d.ts +0 -796
@@ -1,796 +0,0 @@
1
- import { f as PermissionMode } from './public-api.d-BvCp5VkW.js';
2
- import { F as KodaXReasoningMode, k as KodaXMessage, c as KodaXContentBlock } from './types.d-Cqaw71Ax.js';
3
- import { r as KodaXAgentMode } from './bash-prefix-extractor.d-YoiZl5yt.js';
4
- import { bm as KodaXSessionUiHistoryItem, bq as KodaXSessionUiToolCall } from './types.d-CRCaLt_s.js';
5
-
6
- /**
7
- * TextBuffer - Text buffer management class - 文本缓冲区管理类
8
- *
9
- * Reference implementation: Gemini CLI text-buffer.ts - 参考实现: Gemini CLI text-buffer.ts
10
- * Supports multi-line text editing, cursor navigation, and Unicode-safe operations - 支持多行文本编辑,光标导航,Unicode 安全操作
11
- */
12
- interface CursorPosition {
13
- row: number;
14
- col: number;
15
- }
16
- interface VisualCursor$1 {
17
- row: number;
18
- col: number;
19
- }
20
- interface TextBufferOptions {
21
- maxHistory?: number;
22
- }
23
- declare class TextBuffer {
24
- private _text;
25
- private _lines;
26
- private _cursor;
27
- private _rememberedCol;
28
- private _history;
29
- private _historyIndex;
30
- private _maxHistory;
31
- constructor(options?: TextBufferOptions);
32
- get text(): string;
33
- get lines(): string[];
34
- get cursor(): CursorPosition;
35
- get lineCount(): number;
36
- get currentLine(): string;
37
- get isEmpty(): boolean;
38
- /**
39
- * Get visual width of current line - 获取当前行的视觉宽度
40
- */
41
- get currentLineVisualWidth(): number;
42
- /**
43
- * Get visual position of cursor (considering wide characters) - 获取光标的视觉位置(考虑宽字符)
44
- */
45
- get visualCursor(): VisualCursor$1;
46
- /**
47
- * Get visual width of character at cursor position on current line - 获取当前行在光标位置的字符视觉宽度
48
- */
49
- getCharWidthAtCursor(): number;
50
- /**
51
- * Convert visual column position to logical column position - 将视觉列位置转换为逻辑列位置
52
- */
53
- visualColToLogicalCol(visualCol: number): number;
54
- /**
55
- * Move to visual column position - 移动到视觉列位置
56
- */
57
- moveToVisualCol(visualCol: number): void;
58
- /**
59
- * Set entire text content - 设置整个文本内容
60
- */
61
- setText(text: string): void;
62
- /**
63
- * Replace a text range and leave the cursor after the replacement.
64
- */
65
- replaceRange(start: number, end: number, replacement: string): void;
66
- /**
67
- * Insert text at cursor position - 在光标位置插入文本
68
- */
69
- insert(text: string, options?: {
70
- paste?: boolean;
71
- }): void;
72
- /**
73
- * Insert text on current line - 在当前行插入文本
74
- */
75
- private _insertText;
76
- /**
77
- * Insert newline character - 插入换行符
78
- */
79
- newline(): void;
80
- private _insertNewline;
81
- /**
82
- * Delete character before cursor - 删除光标前的字符
83
- */
84
- backspace(): void;
85
- /**
86
- * Delete character after cursor - 删除光标后的字符
87
- */
88
- delete(): void;
89
- /**
90
- * Move cursor - 移动光标
91
- */
92
- move(direction: "up" | "down" | "left" | "right" | "home" | "end"): void;
93
- private _moveUp;
94
- private _moveDown;
95
- private _moveLeft;
96
- private _moveRight;
97
- private _moveHome;
98
- private _moveEnd;
99
- /**
100
- * Clamp column position within current line range using rememberedCol - 限制列位置在当前行范围内,使用 rememberedCol
101
- */
102
- private _clampColumn;
103
- /**
104
- * Clamp cursor to valid range - 限制光标在有效范围内
105
- */
106
- private _clampCursor;
107
- /**
108
- * Delete content from cursor to end of line (Ctrl+K) - 删除光标到行尾的内容 (Ctrl+K)
109
- */
110
- killLineRight(): void;
111
- /**
112
- * Delete content from line start to cursor (Ctrl+U) - 删除行首到光标的内容 (Ctrl+U)
113
- */
114
- killLineLeft(): void;
115
- /**
116
- * Delete word before cursor (Ctrl+W) - 删除光标前的一个词 (Ctrl+W)
117
- */
118
- deleteWordLeft(): void;
119
- private _saveHistory;
120
- /**
121
- * Undo - 撤销
122
- */
123
- undo(): boolean;
124
- /**
125
- * Redo - 重做
126
- */
127
- redo(): boolean;
128
- private _updateText;
129
- private _setTextInternal;
130
- /**
131
- * Move cursor to an absolute string offset - 将光标移动到文本中的绝对偏移位置
132
- */
133
- moveToAbsoluteOffset(offset: number): void;
134
- /**
135
- * Clear buffer - 清空缓冲区
136
- */
137
- clear(): void;
138
- /**
139
- * Get absolute position of cursor in text - 获取光标在文本中的绝对位置
140
- */
141
- getAbsoluteOffset(): number;
142
- /**
143
- * Check if current line ends with backslash - 检查当前行是否以反斜杠结尾
144
- */
145
- isLineContinuation(): boolean;
146
- /**
147
- * Move cursor to end of entire text - 将光标移动到整个文本的末尾
148
- */
149
- moveToEnd(): void;
150
- }
151
-
152
- /**
153
- * PasteStore — per-session paste content registry + placeholder ref helpers.
154
- *
155
- * Design: see docs/KNOWN_ISSUES.md Issue 121 (三层防御:粘贴拦截 / 输入兜底 / 渲染硬上限).
156
- * Reference implementation: Claude Code src/history.ts + src/utils/pasteStore.ts.
157
- *
158
- * Responsibilities (pure / deterministic where possible):
159
- * - Format / parse `[Pasted text #N +K lines]` and related refs
160
- * - Allocate monotonic per-session paste IDs
161
- * - Store / expand paste content in memory
162
- * - Find placeholder boundaries adjacent to cursor (for atomic edit)
163
- *
164
- * Stateful concerns are confined to the `PasteStore` class. Everything else is
165
- * pure so rendering and controller code can call them safely.
166
- */
167
- type PastedContentType = "text" | "image";
168
- interface PastedContent {
169
- id: number;
170
- type: PastedContentType;
171
- content: string;
172
- /** Optional sha256 hash — set when backed by on-disk paste-cache */
173
- contentHash?: string;
174
- /** Media type for image pastes; unused for text */
175
- mediaType?: string;
176
- /** Optional filename hint for image pastes */
177
- filename?: string;
178
- }
179
- /**
180
- * Session-scoped stateful registry. One instance per REPL session (not per
181
- * paste). Lives as long as the composer. IDs are monotonic and never recycled
182
- * so undo/redo never collides with a fresh paste that reused an id.
183
- */
184
- declare class PasteStore {
185
- private readonly contents;
186
- private nextId;
187
- /**
188
- * Register text content, returns the allocated id + the placeholder string
189
- * to insert into the buffer in place of the raw content.
190
- */
191
- registerText(content: string): {
192
- id: number;
193
- placeholder: string;
194
- numLines: number;
195
- };
196
- /**
197
- * Register pre-computed Layer 2 truncation output. Caller is responsible
198
- * for constructing the truncated text; this just stores the middle chunk.
199
- */
200
- registerTruncatedText(content: string): {
201
- id: number;
202
- numLines: number;
203
- };
204
- /**
205
- * Adopt a pre-allocated id + content (e.g. when restoring from disk-backed
206
- * input history).
207
- */
208
- adopt(entry: PastedContent): void;
209
- /** Allocate the NEXT id without registering anything yet. */
210
- peekNextId(): number;
211
- get(id: number): PastedContent | undefined;
212
- /** Expand all placeholders in `input` using this store's contents. */
213
- expand(input: string): string;
214
- /**
215
- * Snapshot the current contents map. Returned map is a COPY — mutation does
216
- * not leak back. Used by undo buffer snapshots.
217
- */
218
- snapshot(): Map<number, PastedContent>;
219
- /** Replace contents from a snapshot. Used by undo. `nextId` preserved. */
220
- restore(snapshot: ReadonlyMap<number, PastedContent>): void;
221
- /**
222
- * Session-level reset. Called on `/clear`, start-new-session, etc.
223
- * Does NOT clear on per-submit since Up-arrow navigation re-submits may
224
- * reuse stored refs.
225
- */
226
- reset(): void;
227
- size(): number;
228
- /** Export contents for persistence (input history serialization). */
229
- export(): PastedContent[];
230
- }
231
-
232
- /**
233
- * Keyboard info interface - 键盘信息接口
234
- * Reference: Gemini CLI Key interface - 参考: Gemini CLI Key interface
235
- */
236
- interface KeyInfo {
237
- name: string;
238
- sequence: string;
239
- ctrl: boolean;
240
- meta: boolean;
241
- shift: boolean;
242
- insertable: boolean;
243
- isPasted?: boolean;
244
- mouse?: {
245
- action: "press" | "release" | "drag" | "move" | "wheel";
246
- button: "left" | "middle" | "right" | "wheelup" | "wheeldown" | "unknown";
247
- row: number;
248
- column: number;
249
- };
250
- }
251
-
252
- type PromptEditingMode = "idle" | "typing" | "pasting";
253
- interface UseTextBufferReturn {
254
- buffer: TextBuffer;
255
- text: string;
256
- cursor: CursorPosition;
257
- lines: string[];
258
- isPasting: boolean;
259
- editingMode: PromptEditingMode;
260
- /**
261
- * Issue 121: session-scoped paste registry. Registered paste ids survive
262
- * submit so Up-arrow input-history recall can still expand them.
263
- */
264
- pasteStore: PasteStore;
265
- resetTransientState: () => void;
266
- setText: (text: string) => void;
267
- replaceRange: (start: number, end: number, replacement: string) => void;
268
- insert: (text: string, options?: {
269
- paste?: boolean;
270
- }) => void;
271
- newline: () => void;
272
- backspace: () => void;
273
- delete: () => void;
274
- move: (direction: "up" | "down" | "left" | "right" | "home" | "end") => void;
275
- moveToEnd: () => void;
276
- moveToOffset: (offset: number) => void;
277
- killLineRight: () => void;
278
- killLineLeft: () => void;
279
- deleteWordLeft: () => void;
280
- clear: () => void;
281
- undo: () => boolean;
282
- redo: () => boolean;
283
- }
284
- /**
285
- * Visual Layout Interface - 视觉布局接口
286
- * Reference: Gemini CLI text-buffer.ts - VisualLayout
287
- */
288
- interface VisualLayout {
289
- /** All visual lines for rendering - 所有视觉行(用于渲染) */
290
- visualLines: string[];
291
- /** For each logical line: [[visualLineIndex, startColInLogical], ...] - 每个逻辑行 -> 视觉行索引 + 起始列的映射 */
292
- logicalToVisualMap: Array<Array<[number, number]>>;
293
- /** For each visual line: [logicalLineIndex, startColInLogical] - 每个视觉行 -> 逻辑行 + 起始列的映射 */
294
- visualToLogicalMap: Array<[number, number]>;
295
- }
296
- type VisualCursor = [number, number];
297
- /**
298
- * An input-history entry. `text` is the display form (may contain
299
- * `[Pasted text #N]` placeholders). `pastedContents`, when present, carries
300
- * the stored contents needed to expand those placeholders after recall.
301
- *
302
- * Issue 121: pastedContents preserves paste fidelity across Up-arrow and
303
- * undo. For entries loaded from disk-backed history, contents may carry only
304
- * `contentHash` until `retrievePastedText` resolves them.
305
- */
306
- interface HistoryEntry {
307
- text: string;
308
- timestamp: number;
309
- pastedContents?: PastedContent[];
310
- }
311
- interface Completion {
312
- text: string;
313
- display: string;
314
- description?: string;
315
- type: "file" | "command" | "argument";
316
- }
317
- interface Completer {
318
- canComplete(input: string, cursorPos: number): boolean;
319
- getCompletions(input: string, cursorPos: number): Promise<Completion[]>;
320
- }
321
- /**
322
- * Autocomplete suggestion item - 自动补全建议项
323
- * For SuggestionsDisplay component - 用于 SuggestionsDisplay 组件
324
- */
325
- interface Suggestion {
326
- id: string;
327
- text: string;
328
- displayText?: string;
329
- description?: string;
330
- type?: "command" | "file" | "history" | "argument" | "snippet" | "skill";
331
- icon?: string;
332
- }
333
- interface ThemeColors {
334
- primary: string;
335
- secondary: string;
336
- accent: string;
337
- text: string;
338
- dim: string;
339
- thinking: string;
340
- success: string;
341
- warning: string;
342
- error: string;
343
- info: string;
344
- hint: string;
345
- background: string;
346
- inputBackground: string;
347
- }
348
- interface ThemeSymbols {
349
- prompt: string;
350
- success: string;
351
- error: string;
352
- warning: string;
353
- spinner: string[];
354
- }
355
- interface Theme {
356
- name: string;
357
- colors: ThemeColors;
358
- symbols: ThemeSymbols;
359
- }
360
- interface PromptSubmitPayload {
361
- /**
362
- * Display form — what the user saw in the input bar. May contain
363
- * `[Pasted text #N +K lines]` placeholders or `[...Truncated text #N ...]`
364
- * refs (Issue 121).
365
- */
366
- displayText: string;
367
- /**
368
- * Fully expanded form — all paste placeholders substituted for their raw
369
- * stored contents. This is what parseCommand / the agent pipeline consume.
370
- */
371
- fullText: string;
372
- /** Paste contents referenced by displayText — for persistence / recall. */
373
- pastedContents: PastedContent[];
374
- }
375
- interface InputPromptProps {
376
- onSubmit: (payload: PromptSubmitPayload) => void;
377
- placeholder?: string;
378
- prompt?: string;
379
- focus?: boolean;
380
- initialValue?: string;
381
- /** Callback when input text changes - 输入文本变化时的回调 */
382
- onInputChange?: (text: string) => void;
383
- /** Called for a transient UI notice when image paste falls back to text. */
384
- onPasteFallback?: (message: string) => void;
385
- /**
386
- * Called when the ↑ arrow history recall brings back an entry with stored
387
- * paste contents. Consumer can hydrate a disk-backed paste cache here.
388
- */
389
- onHistoryRecall?: (entry: {
390
- text: string;
391
- pastedContents: PastedContent[];
392
- }) => void;
393
- /**
394
- * FEATURE_149 Phase 2.1 (v0.7.38) — pop the queued follow-up inputs back
395
- * into the editor when the user presses ↑ on an empty buffer. Return the
396
- * joined text to load (queue gets atomically cleared by the consumer), or
397
- * `undefined` to leave history-recall behavior intact when the queue is
398
- * empty.
399
- */
400
- onPopPendingInputs?: () => string | undefined;
401
- }
402
- interface StatusBarProps {
403
- sessionId: string;
404
- permissionMode: PermissionMode;
405
- agentMode: KodaXAgentMode;
406
- provider: string;
407
- model: string;
408
- tokenUsage?: {
409
- input: number;
410
- output: number;
411
- total: number;
412
- };
413
- currentTool?: string;
414
- activeToolCount?: number;
415
- thinking?: boolean;
416
- reasoningMode?: KodaXReasoningMode;
417
- effort?: string;
418
- reasoningEffortLabel?: string;
419
- reasoningCapability?: string;
420
- /** Is context currently compacting - 是否正在压缩上下文 */
421
- isCompacting?: boolean;
422
- /** Thinking character count - Issue 068: 显示 thinking 进度 */
423
- thinkingCharCount?: number;
424
- /** Whether a thinking stream is currently active */
425
- isThinkingActive?: boolean;
426
- /** Tool input character count - Issue 068: 显示 tool 输入进度 */
427
- toolInputCharCount?: number;
428
- /** Tool input content (truncated) - Issue 068 Phase 4: 显示参数摘要 */
429
- toolInputContent?: string;
430
- /** Current iteration number - Issue 068: 显示迭代进度 */
431
- currentIteration?: number;
432
- /** Maximum iterations - Issue 068: 显示迭代进度 */
433
- maxIter?: number;
434
- /** Context usage info - Issue 070: 显示上下文使用情况 */
435
- contextUsage?: {
436
- /** Current token count in context */
437
- currentTokens: number;
438
- /** Context window size (effective contextWindow) */
439
- contextWindow: number;
440
- /** Compaction trigger percentage (0-100) */
441
- triggerPercent: number;
442
- /** Provider output capacity reserved from the physical context window. */
443
- reservedResponseTokens?: number;
444
- };
445
- /** Whether current busy/thinking status should be visible in the bar */
446
- showBusyStatus?: boolean;
447
- managedPhase?: "starting" | "routing" | "preflight" | "round" | "worker" | "upgrade" | "verifying" | "completed";
448
- managedHarnessProfile?: string;
449
- managedWorkerTitle?: string;
450
- managedRound?: number;
451
- managedMaxRounds?: number;
452
- managedGlobalWorkBudget?: number;
453
- managedBudgetUsage?: number;
454
- managedBudgetApprovalRequired?: boolean;
455
- /**
456
- * v0.7.38 FEATURE_156 — true when the runner-driven outer loop is
457
- * parked in `waitForWakeEvent` (idle-yield from FEATURE_155). The
458
- * status bar renders this as "{role} - waiting for N children"
459
- * instead of falling back to the last role-emit label, so the user
460
- * can tell the spinner is actively waiting on something concrete.
461
- * Consumers MUST branch on `=== true` (undefined transitions out).
462
- */
463
- managedIdleWaiting?: boolean;
464
- /** v0.7.38 FEATURE_156 — child count surfaced in the idle-wait label. */
465
- managedIdleWaitingPendingCount?: number;
466
- /**
467
- * FEATURE_092 phase 2b.8: classifier engine indicator. Only renders when
468
- * permissionMode is in the auto family. `'llm'` shows green `auto[LLM]`
469
- * (healthy), `'rules'` shows yellow `auto[RULES]` (downgraded — every
470
- * non-Tier-1 tool call escalates to user confirm).
471
- */
472
- autoModeEngine?: 'llm' | 'rules';
473
- }
474
- /**
475
- * @deprecated Use MessageListProps from components/MessageList.js instead
476
- */
477
- interface LegacyMessageListProps {
478
- messages: Message[];
479
- isLoading?: boolean;
480
- }
481
- interface Message {
482
- id: string;
483
- role: "user" | "assistant" | "system";
484
- content: string;
485
- timestamp: number;
486
- }
487
- interface AppState {
488
- messages: Message[];
489
- isLoading: boolean;
490
- error?: string;
491
- sessionId: string;
492
- }
493
- interface AppProps {
494
- model: string;
495
- provider: string;
496
- onSubmit: (input: string) => Promise<void>;
497
- permissionMode?: PermissionMode;
498
- agentMode?: KodaXAgentMode;
499
- }
500
- /**
501
- * Streaming response state enum - 流式响应状态枚举
502
- * Reference: Gemini CLI StreamingContext.tsx - 参考: Gemini CLI StreamingContext.tsx
503
- */
504
- declare enum StreamingState {
505
- Idle = "idle",
506
- Responding = "responding",
507
- WaitingForConfirmation = "waiting_for_confirmation"
508
- }
509
- /**
510
- * Tool call status enum - 工具调用状态枚举
511
- * Reference: Gemini CLI useToolScheduler - 参考: Gemini CLI useToolScheduler
512
- */
513
- declare enum ToolCallStatus {
514
- Scheduled = "scheduled",
515
- Validating = "validating",
516
- AwaitingApproval = "awaiting_approval",
517
- Executing = "executing",
518
- Success = "success",
519
- Error = "error",
520
- Cancelled = "cancelled"
521
- }
522
- /**
523
- * Tool call status icons - 工具调用状态图标
524
- */
525
- declare const TOOL_STATUS_ICONS: Record<ToolCallStatus, string>;
526
- /**
527
- * Single tool call - 单个工具调用
528
- */
529
- interface ToolCall {
530
- id: string;
531
- name: string;
532
- status: ToolCallStatus;
533
- input?: Record<string, unknown>;
534
- preview?: string;
535
- output?: unknown;
536
- error?: string;
537
- progress?: number;
538
- /** Real-time progress lines displayed inside the tool block during execution. */
539
- progressLines?: string[];
540
- startTime: number;
541
- endTime?: number;
542
- }
543
- /**
544
- * History item type - 历史项类型
545
- * Reference: Gemini CLI HistoryItem - 参考: Gemini CLI HistoryItem
546
- */
547
- type HistoryItemType = "user" | "assistant" | "system" | "tool_group" | "thinking" | "error" | "event" | "info" | "hint" | "sidecar";
548
- /**
549
- * History item base class - 历史项基类
550
- */
551
- interface HistoryItemBase {
552
- id: string;
553
- type: HistoryItemType;
554
- timestamp: number;
555
- }
556
- /**
557
- * User message - 用户消息
558
- */
559
- interface HistoryItemUser extends HistoryItemBase {
560
- type: "user";
561
- text: string;
562
- }
563
- /**
564
- * Assistant message - 助手消息
565
- */
566
- interface HistoryItemAssistant extends HistoryItemBase {
567
- type: "assistant";
568
- text: string;
569
- compactText?: string;
570
- isStreaming?: boolean;
571
- }
572
- /**
573
- * System message - 系统消息
574
- */
575
- interface HistoryItemSystem extends HistoryItemBase {
576
- type: "system";
577
- text: string;
578
- }
579
- /**
580
- * Tool group - 工具组
581
- */
582
- interface HistoryItemToolGroup extends HistoryItemBase {
583
- type: "tool_group";
584
- tools: ToolCall[];
585
- }
586
- /**
587
- * Thinking content - 思考内容
588
- */
589
- interface HistoryItemThinking extends HistoryItemBase {
590
- type: "thinking";
591
- text: string;
592
- compactText?: string;
593
- }
594
- /**
595
- * Error message - 错误消息
596
- */
597
- interface HistoryItemError extends HistoryItemBase {
598
- type: "error";
599
- text: string;
600
- }
601
- interface HistoryItemEvent extends HistoryItemBase {
602
- type: "event";
603
- text: string;
604
- icon?: string;
605
- compactText?: string;
606
- }
607
- /**
608
- * Info message - 信息消息
609
- */
610
- interface HistoryItemInfo extends HistoryItemBase {
611
- type: "info";
612
- text: string;
613
- icon?: string;
614
- compactText?: string;
615
- /**
616
- * When true, drop the default bottom margin so consecutive info items
617
- * (e.g. a burst of repo-intelligence trace stages emitted within one
618
- * turn) visually stack as a block instead of each getting a blank
619
- * spacer line. Non-tight items following a tight run restore normal
620
- * spacing on their own via their own `marginBottom`.
621
- */
622
- tightSpacing?: boolean;
623
- }
624
- /**
625
- * Hint message - 提示消息
626
- */
627
- interface HistoryItemHint extends HistoryItemBase {
628
- type: "hint";
629
- text: string;
630
- }
631
- /**
632
- * Sidecar Verifier message - Sidecar 验证器消息
633
- * Displayed as an independent "role" with its own header so the user can
634
- * clearly see that the Sidecar Verifier is actively reviewing the output.
635
- * verdict: 'revise' | 'blocked' | undefined; delivery 'budget-exhausted' means
636
- * the verifier ran out of budget before returning a verdict.
637
- */
638
- interface HistoryItemSidecar extends HistoryItemBase {
639
- type: "sidecar";
640
- text: string;
641
- /** 'revise' or 'blocked'; absent when delivery === 'budget-exhausted' */
642
- verdict?: "revise" | "blocked";
643
- /** Set when the verifier exhausted its token budget before reaching a verdict */
644
- delivery?: "budget-exhausted";
645
- }
646
- /**
647
- * Union type of all history items - 所有历史项的联合类型
648
- */
649
- type HistoryItem = HistoryItemUser | HistoryItemAssistant | HistoryItemSystem | HistoryItemToolGroup | HistoryItemThinking | HistoryItemError | HistoryItemEvent | HistoryItemInfo | HistoryItemHint | HistoryItemSidecar;
650
- /**
651
- * Creatable history item types (with text property) - 可创建的历史项类型(带 text 属性)
652
- * Used for addHistoryItem function parameter type - 用于 addHistoryItem 等函数的参数类型
653
- */
654
- type CreatableHistoryItem = Omit<HistoryItemUser, "id" | "timestamp"> | Omit<HistoryItemAssistant, "id" | "timestamp"> | Omit<HistoryItemSystem, "id" | "timestamp"> | Omit<HistoryItemThinking, "id" | "timestamp"> | Omit<HistoryItemError, "id" | "timestamp"> | Omit<HistoryItemEvent, "id" | "timestamp"> | Omit<HistoryItemInfo, "id" | "timestamp"> | Omit<HistoryItemHint, "id" | "timestamp"> | Omit<HistoryItemSidecar, "id" | "timestamp"> | Omit<HistoryItemToolGroup, "id" | "timestamp">;
655
- /**
656
- * UI global state interface - UI 全局状态接口
657
- * Reference: Gemini CLI UIStateContext - 参考: Gemini CLI UIStateContext
658
- */
659
- interface UIState {
660
- streamingState: StreamingState;
661
- currentResponse: string;
662
- history: HistoryItem[];
663
- pendingToolCalls: ToolCall[];
664
- sessionId: string;
665
- provider: string;
666
- model: string;
667
- tokenUsage?: {
668
- input: number;
669
- output: number;
670
- total: number;
671
- };
672
- error?: string;
673
- isLoading: boolean;
674
- }
675
- /**
676
- * UI actions interface - UI 操作接口
677
- */
678
- interface UIActions {
679
- setStreamingState: (state: StreamingState) => void;
680
- appendToResponse: (text: string) => void;
681
- clearResponse: () => void;
682
- addHistoryItem: (item: CreatableHistoryItem) => void;
683
- addHistoryItems: (items: CreatableHistoryItem[]) => void;
684
- updateHistoryItem: (id: string, updates: Partial<HistoryItem>) => void;
685
- clearHistory: () => void;
686
- addToolCall: (tool: Omit<ToolCall, "id" | "startTime">) => string;
687
- updateToolCall: (id: string, updates: Partial<ToolCall>) => void;
688
- clearToolCalls: () => void;
689
- setSessionId: (id: string) => void;
690
- setProvider: (provider: string) => void;
691
- setModel: (model: string) => void;
692
- setTokenUsage: (usage: UIState["tokenUsage"]) => void;
693
- setError: (error: string | undefined) => void;
694
- setLoading: (loading: boolean) => void;
695
- }
696
- /**
697
- * Keyboard event handler priority - 键盘事件处理器优先级
698
- * Reference: Gemini CLI KeypressContext - 参考: Gemini CLI KeypressContext
699
- */
700
- declare enum KeypressHandlerPriority {
701
- Low = -100,
702
- Normal = 0,
703
- High = 100,
704
- Critical = 200
705
- }
706
- /**
707
- * Keyboard event handler - 键盘事件处理器
708
- */
709
- type KeypressHandler = (event: KeyInfo) => boolean | void;
710
- /**
711
- * Keyboard event - 键盘事件
712
- */
713
- interface KeypressEvent {
714
- key: KeyInfo;
715
- handled: boolean;
716
- }
717
- /**
718
- * Default UI state - 默认 UI 状态
719
- */
720
- declare const DEFAULT_UI_STATE: UIState;
721
-
722
- interface RestoreHistoryItemsFromSessionInput {
723
- messages: readonly KodaXMessage[];
724
- uiHistory?: readonly KodaXSessionUiHistoryItem[];
725
- }
726
- declare function trimPersistedUiHistorySnapshot(items: readonly KodaXSessionUiHistoryItem[]): KodaXSessionUiHistoryItem[];
727
- declare function restoreHistoryItemsFromSession(input: RestoreHistoryItemsFromSessionInput): CreatableHistoryItem[];
728
-
729
- /**
730
- * Utilities for extracting message content for history rendering, copy, and previews.
731
- */
732
-
733
- type RestoredHistorySeed = {
734
- type: "user";
735
- text: string;
736
- } | {
737
- type: "assistant";
738
- text: string;
739
- } | {
740
- type: "system";
741
- text: string;
742
- } | {
743
- type: "thinking";
744
- text: string;
745
- } | {
746
- type: "sidecar";
747
- text: string;
748
- verdict?: "revise" | "blocked";
749
- } | {
750
- type: "task_completed";
751
- text: string;
752
- } | {
753
- type: "tool_summary";
754
- text: string;
755
- } | {
756
- type: "tool_group";
757
- tools: KodaXSessionUiToolCall[];
758
- };
759
- /** Convert a RestoredHistorySeed to a CreatableHistoryItem. tool_summary / task_completed → event with icon. */
760
- declare function seedToHistoryItem(seed: RestoredHistorySeed): CreatableHistoryItem;
761
- declare function toolCallSeedToHistoryToolCall(tool: KodaXSessionUiToolCall): ToolCall;
762
- /**
763
- * Minimal message shape required to restore UI history items.
764
- */
765
- interface HistorySeedSourceMessage {
766
- role: KodaXMessage["role"];
767
- content: string | KodaXContentBlock[];
768
- _synthetic?: boolean;
769
- /**
770
- * Provenance marker persisted on host-injected messages. `'sidecar-verifier'`
771
- * tags the synthetic user message the Sidecar Verifier injects on a `revise`
772
- * verdict; `'task-completed'` tags the synthetic user message carrying a
773
- * dispatch_child_task / run_workflow `<task-completed>` result banner. Both are
774
- * rendered under their own identity on restore instead of being swallowed by
775
- * the generic `_synthetic` skip.
776
- */
777
- _source?: string;
778
- }
779
- declare function extractHistorySeedsFromMessage(message: HistorySeedSourceMessage): RestoredHistorySeed[];
780
- declare function extractHistorySeedsFromMessages(messages: readonly HistorySeedSourceMessage[]): RestoredHistorySeed[];
781
- /**
782
- * Extract plain text from message content.
783
- * Thinking/tool blocks are omitted so callers get only visible assistant text.
784
- */
785
- declare function extractTextContent(content: string | readonly unknown[]): string;
786
- /**
787
- * Extract a session title from the first user message.
788
- */
789
- declare function extractTitle(messages: KodaXMessage[]): string;
790
- /**
791
- * Format a single-line preview for session lists.
792
- */
793
- declare function formatMessagePreview(content: string, maxLength?: number): string;
794
-
795
- export { extractTitle as $, TextBuffer as B, DEFAULT_UI_STATE as D, ToolCallStatus as O, TOOL_STATUS_ICONS as T, extractHistorySeedsFromMessage as Y, extractHistorySeedsFromMessages as Z, extractTextContent as _, formatMessagePreview as a0, restoreHistoryItemsFromSession as a1, seedToHistoryItem as a2, toolCallSeedToHistoryToolCall as a3, trimPersistedUiHistorySnapshot as a4, KeypressHandlerPriority as u, StreamingState as y };
796
- export type { AppProps as A, Completer as C, TextBufferOptions as E, Theme as F, ThemeColors as G, HistoryEntry as H, InputPromptProps as I, ThemeSymbols as J, KeyInfo as K, LegacyMessageListProps as L, Message as M, ToolCall as N, PastedContent as P, UIState as Q, RestoreHistoryItemsFromSessionInput as R, StatusBarProps as S, UIActions as U, UseTextBufferReturn as V, VisualCursor as W, VisualLayout as X, AppState as a, Completion as b, CreatableHistoryItem as c, CursorPosition as d, HistoryItem as e, HistoryItemAssistant as f, HistoryItemBase as g, HistoryItemError as h, HistoryItemEvent as i, HistoryItemHint as j, HistoryItemInfo as k, HistoryItemSidecar as l, HistoryItemSystem as m, HistoryItemThinking as n, HistoryItemToolGroup as o, HistoryItemType as p, HistoryItemUser as q, HistorySeedSourceMessage as r, KeypressEvent as s, KeypressHandler as t, PromptEditingMode as v, PromptSubmitPayload as w, RestoredHistorySeed as x, Suggestion as z };