@kodax-ai/kodax 0.7.41 → 0.7.43

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 (54) hide show
  1. package/CHANGELOG.md +119 -3
  2. package/README.md +214 -286
  3. package/README_CN.md +173 -277
  4. package/dist/chunks/chunk-7G5PSL6C.js +830 -0
  5. package/dist/chunks/{chunk-6OB4AJOM.js → chunk-IYSK7LUK.js} +1 -1
  6. package/dist/chunks/chunk-K75O2CAE.js +31 -0
  7. package/dist/chunks/chunk-UG4262JI.js +502 -0
  8. package/dist/chunks/chunk-VHKAJDQD.js +425 -0
  9. package/dist/chunks/chunk-YMRZBS4G.js +2 -0
  10. package/dist/chunks/{compaction-config-LT5PEXPT.js → compaction-config-3E57ABCT.js} +1 -1
  11. package/dist/chunks/{construction-bootstrap-HBCWJFHC.js → construction-bootstrap-JR63KI5N.js} +4 -4
  12. package/dist/chunks/dist-KWHUKXEL.js +2 -0
  13. package/dist/chunks/dist-XANXEVTU.js +2 -0
  14. package/dist/chunks/utils-HQ2QCKJA.js +2 -0
  15. package/dist/index.d.ts +15 -10
  16. package/dist/index.js +5 -5
  17. package/dist/kodax_cli.js +1084 -1054
  18. package/dist/sdk-agent.d.ts +853 -135
  19. package/dist/sdk-agent.js +1 -1
  20. package/dist/sdk-coding.d.ts +932 -981
  21. package/dist/sdk-coding.js +1 -1
  22. package/dist/sdk-llm.d.ts +8 -5
  23. package/dist/sdk-llm.js +1 -1
  24. package/dist/sdk-mcp.d.ts +17 -0
  25. package/dist/sdk-mcp.js +2 -0
  26. package/dist/sdk-repl.d.ts +343 -10
  27. package/dist/sdk-repl.js +2 -1
  28. package/dist/sdk-session.d.ts +176 -0
  29. package/dist/sdk-session.js +2 -0
  30. package/dist/sdk-skills.d.ts +72 -4
  31. package/dist/sdk-skills.js +1 -1
  32. package/dist/types-chunks/{cost-tracker.d-C4dMlQuV.d.ts → base.d-FUJahC0i.d.ts} +22 -112
  33. package/dist/types-chunks/{bash-prefix-extractor.d-B2iliwdi.d.ts → bash-prefix-extractor.d-DMrGImMl.d.ts} +266 -228
  34. package/dist/types-chunks/capability.d-3C62G8Eq.d.ts +39 -0
  35. package/dist/types-chunks/config.d-BfJUXxC0.d.ts +41 -0
  36. package/dist/types-chunks/cost-tracker.d-wRtyEW9d.d.ts +110 -0
  37. package/dist/types-chunks/{history-cleanup.d-q1vAvCss.d.ts → file-tracker.d-zaLZeNBK.d.ts} +532 -15
  38. package/dist/types-chunks/manager.d-87belpiS.d.ts +370 -0
  39. package/dist/types-chunks/{resolver.d-BwD6TKz7.d.ts → resolver.d-CA68_NeH.d.ts} +150 -5
  40. package/dist/types-chunks/storage.d-DPAEX7zS.d.ts +115 -0
  41. package/dist/types-chunks/{capability.d-BxNgd1-c.d.ts → types.d-B1uGoVTE.d.ts} +72 -40
  42. package/dist/types-chunks/{instance-discovery.d-DZhp77vb.d.ts → types.d-CKJtjo-6.d.ts} +168 -258
  43. package/dist/types-chunks/types.d-mM8vqvhT.d.ts +254 -0
  44. package/dist/types-chunks/{storage.d-Bv9T99Qu.d.ts → utils.d-DkLZD_wa.d.ts} +38 -112
  45. package/package.json +15 -6
  46. package/dist/chunks/chunk-5TFLMGER.js +0 -2
  47. package/dist/chunks/chunk-6QO6HWGU.js +0 -30
  48. package/dist/chunks/chunk-EQ5DGS2W.js +0 -14
  49. package/dist/chunks/chunk-HYWVRTFA.js +0 -1233
  50. package/dist/chunks/chunk-SX2IS5JP.js +0 -16
  51. package/dist/chunks/chunk-ZPJPNLBK.js +0 -462
  52. package/dist/chunks/dist-M57GIWR4.js +0 -2
  53. package/dist/chunks/dist-V3BS2NKB.js +0 -2
  54. package/dist/chunks/utils-FAFUQJ2A.js +0 -2
@@ -0,0 +1,254 @@
1
+ import { m as KodaXMessage } from './types.d-B1uGoVTE.js';
2
+
3
+ /**
4
+ * @kodax-ai/agent Types
5
+ *
6
+ * 通用 Agent 类型定义
7
+ */
8
+
9
+ type KodaXJsonPrimitive = string | number | boolean | null;
10
+ type KodaXJsonValue = KodaXJsonPrimitive | KodaXJsonValue[] | {
11
+ [key: string]: KodaXJsonValue;
12
+ };
13
+ /**
14
+ * Session error metadata - 会话错误元数据
15
+ * Used for error recovery and session cleanup - 用于错误恢复和会话清理
16
+ */
17
+ interface SessionErrorMetadata {
18
+ /** Last error message - 最后的错误消息 */
19
+ lastError?: string;
20
+ /** Last error timestamp - 最后错误时间戳 */
21
+ lastErrorTime?: number;
22
+ /** Consecutive error count - 连续错误计数 */
23
+ consecutiveErrors: number;
24
+ }
25
+ interface KodaXExtensionSessionRecord {
26
+ id: string;
27
+ extensionId: string;
28
+ type: string;
29
+ ts: number;
30
+ data?: KodaXJsonValue;
31
+ dedupeKey?: string;
32
+ }
33
+ type KodaXExtensionSessionState = Record<string, Record<string, KodaXJsonValue>>;
34
+ interface KodaXSessionEntryBase {
35
+ id: string;
36
+ parentId: string | null;
37
+ timestamp: string;
38
+ }
39
+ interface KodaXSessionMessageEntry extends KodaXSessionEntryBase {
40
+ type: 'message';
41
+ message: KodaXMessage;
42
+ }
43
+ interface KodaXSessionCompactionEntry extends KodaXSessionEntryBase {
44
+ type: 'compaction';
45
+ summary: string;
46
+ firstKeptEntryId?: string;
47
+ tokensBefore?: number;
48
+ tokensAfter?: number;
49
+ artifactLedgerId?: string;
50
+ reason?: string;
51
+ details?: KodaXJsonValue;
52
+ memorySeed?: KodaXCompactMemorySeed;
53
+ /**
54
+ * FEATURE_072: post-compact ledger summary + file-content messages that
55
+ * are inlined after the compaction summary at slicer time
56
+ * (`getSessionMessagesFromLineage`). Stored here so they leave the active
57
+ * path automatically when a new compaction entry is appended.
58
+ *
59
+ * NOTE: attachments are emitted by the slicer, NOT by `getContextMessagesForEntry`
60
+ * — preserving the latter's 1-to-1 contract that `entryMatchesContextMessage`
61
+ * and FEATURE_073's future slicing both depend on.
62
+ */
63
+ postCompactAttachments?: readonly KodaXMessage[];
64
+ }
65
+ interface KodaXSessionBranchSummaryEntry extends KodaXSessionEntryBase {
66
+ type: 'branch_summary';
67
+ summary: string;
68
+ fromId?: string;
69
+ details?: KodaXJsonValue;
70
+ }
71
+ interface KodaXSessionLabelEntry extends KodaXSessionEntryBase {
72
+ type: 'label';
73
+ targetId: string;
74
+ label?: string;
75
+ }
76
+ interface KodaXSessionArchiveMarkerEntry extends KodaXSessionEntryBase {
77
+ type: 'archive_marker';
78
+ /** Links to the corresponding batch in the .archive.jsonl sidecar file */
79
+ archiveBatchId: string;
80
+ /** Number of entries that were archived in this batch */
81
+ archivedEntryCount: number;
82
+ /** Brief summary of the archived content */
83
+ summary: string;
84
+ }
85
+ type KodaXSessionEntry = KodaXSessionMessageEntry | KodaXSessionCompactionEntry | KodaXSessionBranchSummaryEntry | KodaXSessionLabelEntry | KodaXSessionArchiveMarkerEntry;
86
+ interface KodaXSessionArtifactLedgerEntry {
87
+ id: string;
88
+ kind: 'file_read' | 'file_modified' | 'file_created' | 'file_deleted' | 'path_scope' | 'search_scope' | 'command_scope' | 'check_result' | 'decision' | 'image_input' | 'tombstone';
89
+ sourceTool?: string;
90
+ action?: string;
91
+ target: string;
92
+ displayTarget?: string;
93
+ summary?: string;
94
+ sessionEntryId?: string;
95
+ timestamp: string;
96
+ metadata?: Record<string, KodaXJsonValue>;
97
+ }
98
+ interface KodaXCompactMemoryProgress {
99
+ completed: string[];
100
+ inProgress: string[];
101
+ blockers: string[];
102
+ }
103
+ interface KodaXCompactMemorySeed {
104
+ objective?: string;
105
+ constraints: string[];
106
+ progress: KodaXCompactMemoryProgress;
107
+ keyDecisions: string[];
108
+ nextSteps: string[];
109
+ keyContext: string[];
110
+ importantTargets: string[];
111
+ tombstones: string[];
112
+ }
113
+ interface KodaXSessionLineage {
114
+ version: 2;
115
+ activeEntryId: string | null;
116
+ entries: KodaXSessionEntry[];
117
+ }
118
+ interface KodaXSessionNavigationOptions {
119
+ summarizeCurrentBranch?: boolean;
120
+ }
121
+ interface KodaXSessionTreeNode {
122
+ entry: Exclude<KodaXSessionEntry, KodaXSessionLabelEntry>;
123
+ children: KodaXSessionTreeNode[];
124
+ label?: string;
125
+ active: boolean;
126
+ }
127
+ type KodaXSessionScope = 'user' | 'managed-task-worker';
128
+ type KodaXSessionUiHistoryItemType = 'user' | 'assistant' | 'system' | 'thinking' | 'error' | 'event' | 'info' | 'hint';
129
+ interface KodaXSessionUiHistoryItem {
130
+ type: KodaXSessionUiHistoryItemType;
131
+ text: string;
132
+ icon?: string;
133
+ compactText?: string;
134
+ }
135
+ type KodaXSessionWorkspaceKind = 'detected' | 'managed';
136
+ interface KodaXSessionRuntimeInfo {
137
+ canonicalRepoRoot?: string;
138
+ workspaceRoot?: string;
139
+ executionCwd?: string;
140
+ branch?: string;
141
+ workspaceKind?: KodaXSessionWorkspaceKind;
142
+ }
143
+ interface KodaXSessionData {
144
+ messages: KodaXMessage[];
145
+ title: string;
146
+ gitRoot: string;
147
+ runtimeInfo?: KodaXSessionRuntimeInfo;
148
+ scope?: KodaXSessionScope;
149
+ uiHistory?: KodaXSessionUiHistoryItem[];
150
+ errorMetadata?: SessionErrorMetadata;
151
+ extensionState?: KodaXExtensionSessionState;
152
+ extensionRecords?: KodaXExtensionSessionRecord[];
153
+ lineage?: KodaXSessionLineage;
154
+ artifactLedger?: KodaXSessionArtifactLedgerEntry[];
155
+ }
156
+ interface KodaXSessionMeta {
157
+ _type: 'meta';
158
+ title: string;
159
+ id: string;
160
+ gitRoot: string;
161
+ runtimeInfo?: KodaXSessionRuntimeInfo;
162
+ createdAt: string;
163
+ scope?: KodaXSessionScope;
164
+ uiHistory?: KodaXSessionUiHistoryItem[];
165
+ extensionState?: KodaXExtensionSessionState;
166
+ extensionRecordCount?: number;
167
+ artifactLedgerCount?: number;
168
+ lineageVersion?: 2;
169
+ activeEntryId?: string | null;
170
+ lineageEntryCount?: number;
171
+ activeMessageCount?: number;
172
+ /** Error metadata for recovery - 错误元数据用于恢复 */
173
+ errorMetadata?: SessionErrorMetadata;
174
+ }
175
+ /**
176
+ * Extension-scoped persistence entry.
177
+ *
178
+ * Each entry belongs to a namespace (extensionId) and carries
179
+ * a string key, a JSON-safe value, and an opaque version tag
180
+ * used for optimistic concurrency control.
181
+ */
182
+ interface KodaXExtensionStoreEntry {
183
+ key: string;
184
+ value: KodaXJsonValue;
185
+ version: string;
186
+ updatedAt: number;
187
+ }
188
+ /**
189
+ * Extension persistence store interface (FEATURE_034 manual persistence).
190
+ *
191
+ * Implementations provide a durable key-value store scoped to a single
192
+ * extension identity. The store is independent of session lifecycle —
193
+ * data survives across sessions and restarts.
194
+ */
195
+ interface KodaXExtensionStore {
196
+ /**
197
+ * Read a single key.
198
+ * Returns `undefined` when the key does not exist.
199
+ */
200
+ get(key: string): Promise<KodaXExtensionStoreEntry | undefined>;
201
+ /**
202
+ * Write a key-value pair.
203
+ *
204
+ * When `expectedVersion` is provided the write only succeeds when the
205
+ * stored entry's version still matches (optimistic concurrency).
206
+ * Returns the new entry on success, or `false` on version mismatch.
207
+ */
208
+ put(key: string, value: KodaXJsonValue, options?: {
209
+ expectedVersion?: string;
210
+ }): Promise<KodaXExtensionStoreEntry | false>;
211
+ /**
212
+ * Remove a key.
213
+ * Returns `true` when the key existed and was removed.
214
+ */
215
+ delete(key: string): Promise<boolean>;
216
+ /**
217
+ * List all keys (optionally filtered by prefix).
218
+ */
219
+ list(options?: {
220
+ prefix?: string;
221
+ }): Promise<string[]>;
222
+ /**
223
+ * Clear all keys (optionally filtered by prefix).
224
+ * Returns the number of entries removed.
225
+ */
226
+ clear(options?: {
227
+ prefix?: string;
228
+ }): Promise<number>;
229
+ }
230
+ interface KodaXSessionStorage {
231
+ save(id: string, data: KodaXSessionData): Promise<void>;
232
+ load(id: string): Promise<KodaXSessionData | null>;
233
+ getLineage?(id: string): Promise<KodaXSessionLineage | null>;
234
+ setActiveEntry?(id: string, selector: string, options?: KodaXSessionNavigationOptions): Promise<KodaXSessionData | null>;
235
+ setLabel?(id: string, selector: string, label?: string): Promise<KodaXSessionData | null>;
236
+ rewind?(id: string, selector?: string): Promise<KodaXSessionData | null>;
237
+ fork?(id: string, selector?: string, options?: {
238
+ sessionId?: string;
239
+ title?: string;
240
+ }): Promise<{
241
+ sessionId: string;
242
+ data: KodaXSessionData;
243
+ } | null>;
244
+ list?(gitRoot?: string): Promise<Array<{
245
+ id: string;
246
+ title: string;
247
+ msgCount: number;
248
+ runtimeInfo?: KodaXSessionRuntimeInfo;
249
+ }>>;
250
+ delete?(id: string): Promise<void>;
251
+ deleteAll?(gitRoot?: string): Promise<void>;
252
+ }
253
+
254
+ export type { KodaXCompactMemoryProgress as K, SessionErrorMetadata as S, KodaXCompactMemorySeed as a, KodaXExtensionSessionRecord as b, KodaXExtensionSessionState as c, KodaXExtensionStore as d, KodaXExtensionStoreEntry as e, KodaXJsonValue as f, KodaXSessionArchiveMarkerEntry as g, KodaXSessionArtifactLedgerEntry as h, KodaXSessionBranchSummaryEntry as i, KodaXSessionCompactionEntry as j, KodaXSessionData as k, KodaXSessionEntry as l, KodaXSessionEntryBase as m, KodaXSessionLabelEntry as n, KodaXSessionLineage as o, KodaXSessionMessageEntry as p, KodaXSessionMeta as q, KodaXSessionNavigationOptions as r, KodaXSessionRuntimeInfo as s, KodaXSessionScope as t, KodaXSessionStorage as u, KodaXSessionTreeNode as v, KodaXSessionUiHistoryItem as w, KodaXSessionUiHistoryItemType as x, KodaXSessionWorkspaceKind as y };
@@ -1,6 +1,7 @@
1
- import { l as BashPrefixExtractor, _ as KodaXOptions, H as KodaXContextTokenSnapshot, K as KodaXAgentMode, a3 as KodaXRepoIntelligenceMode, A as AgentsFile, i as AutoModeStats, ac as KodaXSkillInvocationContext, X as KodaXMcpServersConfig } from './bash-prefix-extractor.d-B2iliwdi.js';
2
- import { v as KodaXSessionData, z as KodaXSessionLineage, F as KodaXSessionNavigationOptions, J as KodaXSessionRuntimeInfo, M as KodaXSessionStorage, O as KodaXSessionUiHistoryItem, s as KodaXSessionArtifactLedgerEntry } from './instance-discovery.d-DZhp77vb.js';
3
- import { o as KodaXMessage, G as KodaXReasoningMode, s as KodaXProviderCapabilityProfile, H as KodaXReasoningOverride, j as KodaXCustomProviderConfig } from './capability.d-BxNgd1-c.js';
1
+ import { l as BashPrefixExtractor, W as KodaXOptions, x as KodaXContextTokenSnapshot, K as KodaXAgentMode, $ as KodaXRepoIntelligenceMode, A as AgentsFile, i as AutoModeStats, aa as KodaXSkillInvocationContext, T as KodaXMcpServersConfig } from './bash-prefix-extractor.d-DMrGImMl.js';
2
+ import { a as SessionStorage$1 } from './storage.d-DPAEX7zS.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';
4
5
  import * as readline from 'readline';
5
6
  import { SpawnSyncReturns } from 'child_process';
6
7
 
@@ -78,70 +79,6 @@ declare function computeConfirmTools(mode: PermissionMode): Set<string>;
78
79
  declare function isPermissionMode(value: string | undefined): value is PermissionMode;
79
80
  declare function normalizePermissionMode(value: string | undefined, fallback?: PermissionMode): PermissionMode | undefined;
80
81
 
81
- /**
82
- * Session Storage - Session storage abstraction layer
83
- *
84
- * Provides a shared persistence interface across memory and filesystem storage.
85
- */
86
-
87
- /**
88
- * Session data structure.
89
- */
90
- type SessionData = KodaXSessionData;
91
- /**
92
- * Session storage interface.
93
- */
94
- interface SessionStorage$1 {
95
- save(id: string, data: SessionData): Promise<void>;
96
- load(id: string): Promise<SessionData | null>;
97
- getLineage?(id: string): Promise<KodaXSessionLineage | null>;
98
- setActiveEntry?(id: string, selector: string, options?: KodaXSessionNavigationOptions): Promise<SessionData | null>;
99
- setLabel?(id: string, selector: string, label?: string): Promise<SessionData | null>;
100
- rewind?(id: string, selector?: string): Promise<SessionData | null>;
101
- fork?(id: string, selector?: string, options?: {
102
- sessionId?: string;
103
- title?: string;
104
- }): Promise<{
105
- sessionId: string;
106
- data: SessionData;
107
- } | null>;
108
- list(gitRoot?: string): Promise<Array<{
109
- id: string;
110
- title: string;
111
- msgCount: number;
112
- runtimeInfo?: KodaXSessionRuntimeInfo;
113
- }>>;
114
- delete?(id: string): Promise<void>;
115
- deleteAll?(gitRoot?: string): Promise<void>;
116
- }
117
- /**
118
- * In-memory session storage implementation.
119
- */
120
- declare class MemorySessionStorage implements SessionStorage$1 {
121
- private sessions;
122
- save(id: string, data: SessionData): Promise<void>;
123
- load(id: string): Promise<SessionData | null>;
124
- getLineage(id: string): Promise<KodaXSessionLineage | null>;
125
- setActiveEntry(id: string, selector: string, options?: KodaXSessionNavigationOptions): Promise<SessionData | null>;
126
- setLabel(id: string, selector: string, label?: string): Promise<SessionData | null>;
127
- fork(id: string, selector?: string, options?: {
128
- sessionId?: string;
129
- title?: string;
130
- }): Promise<{
131
- sessionId: string;
132
- data: SessionData;
133
- } | null>;
134
- rewind(id: string, selector?: string): Promise<SessionData | null>;
135
- list(_gitRoot?: string): Promise<Array<{
136
- id: string;
137
- title: string;
138
- msgCount: number;
139
- }>>;
140
- delete(id: string): Promise<void>;
141
- deleteAll(_gitRoot?: string): Promise<void>;
142
- }
143
- declare function createMemorySessionStorage(): SessionStorage$1;
144
-
145
82
  /**
146
83
  * InkREPL - Ink-based REPL Adapter
147
84
  *
@@ -328,6 +265,17 @@ interface CommandCallbacks {
328
265
  readline?: readline.Interface;
329
266
  startCompacting?: () => void;
330
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;
331
279
  printSessionTree?: () => Promise<void>;
332
280
  switchSessionBranch?: (selector: string) => Promise<SessionBranchSwitchStatus>;
333
281
  labelSessionBranch?: (selector: string, label?: string) => Promise<boolean>;
@@ -514,6 +462,23 @@ declare function loadConfig(): {
514
462
  repointelBin?: string;
515
463
  repoIntelligenceTrace?: boolean;
516
464
  streamIdleTimeoutMs?: number;
465
+ /**
466
+ * FEATURE_184 Phase D.3 follow-up (v0.7.42) — opt-in Sidecar Verifier
467
+ * observability. When `true`, the runtime emits a persisted note per
468
+ * verifier call:
469
+ * `[Sidecar Verifier] {verdict} · {model} · {ms}ms · {trace}`
470
+ * Mirrored to env var `KODAX_VERIFIER_LOG=1` so the agent-runtime
471
+ * layer (which has no access to `~/.kodax/config.json`) can read it.
472
+ */
473
+ verifierLog?: boolean;
474
+ /**
475
+ * FEATURE_187 Phase C (v0.7.43) — opt-in Stall Sidecar observability.
476
+ * When `true`, the runtime emits a persisted note per L2 stall
477
+ * verdict (isStuck true OR false):
478
+ * `[Stall Sidecar] isStuck={true|false} · {provider}/{model} · {ms}ms · {trace}`
479
+ * Mirrored to env var `KODAX_STALL_LOG=1`.
480
+ */
481
+ stallLog?: boolean;
517
482
  };
518
483
  declare function prepareRuntimeConfig(): ReturnType<typeof loadConfig>;
519
484
  declare function saveConfig(config: {
@@ -533,52 +498,13 @@ declare function saveConfig(config: {
533
498
  repointelEndpoint?: string;
534
499
  repointelBin?: string;
535
500
  repoIntelligenceTrace?: boolean;
501
+ /** FEATURE_184 Phase D.3 follow-up — opt-in verifier log line. */
502
+ verifierLog?: boolean;
503
+ /** FEATURE_187 Phase C — opt-in stall sidecar log line. */
504
+ stallLog?: boolean;
536
505
  }): void;
537
506
  declare function getGitRoot(): Promise<string | null>;
538
507
  declare function rateLimitedCall<T>(fn: () => Promise<T>): Promise<T>;
539
508
 
540
- /**
541
- * KodaX session storage - filesystem implementation.
542
- */
543
-
544
- declare class FileSessionStorage implements KodaXSessionStorage {
545
- private writeQueues;
546
- private serializedWrite;
547
- private appendState;
548
- /** Update watermarks. Only overwrites fields the caller actually provided. */
549
- private syncAppendState;
550
- private getSessionFilePath;
551
- private getArchiveFilePath;
552
- private readSession;
553
- private writeSessionInternal;
554
- private mergeAndWriteInternal;
555
- appendSessionDelta(id: string, data: SessionData): Promise<void>;
556
- private shouldRunMaintenance;
557
- private runMaintenance;
558
- save(id: string, data: SessionData): Promise<void>;
559
- load(id: string): Promise<SessionData | null>;
560
- getLineage(id: string): Promise<KodaXSessionLineage | null>;
561
- setActiveEntry(id: string, selector: string, options?: {
562
- summarizeCurrentBranch?: boolean;
563
- }): Promise<SessionData | null>;
564
- rewind(id: string, selector?: string): Promise<SessionData | null>;
565
- setLabel(id: string, selector: string, label?: string): Promise<SessionData | null>;
566
- fork(id: string, selector?: string, options?: {
567
- sessionId?: string;
568
- title?: string;
569
- }): Promise<{
570
- sessionId: string;
571
- data: SessionData;
572
- } | null>;
573
- list(gitRoot?: string): Promise<Array<{
574
- id: string;
575
- title: string;
576
- msgCount: number;
577
- runtimeInfo?: KodaXSessionRuntimeInfo;
578
- }>>;
579
- delete(id: string): Promise<void>;
580
- deleteAll(gitRoot?: string): Promise<void>;
581
- }
582
-
583
- export { permissionModeDisplayName as A, BUILTIN_COMMANDS as B, prepareRuntimeConfig as D, processSpecialSyntax as E, FileSessionStorage as F, rateLimitedCall as G, registerConfiguredCustomProviders as H, runInkInteractiveMode as J, KODAX_CONFIG_FILE as K, runInteractiveMode as L, MemorySessionStorage as M, saveConfig as N, touchContext as O, PERMISSION_MODES as P, KODAX_DIR as f, KODAX_SESSIONS_DIR as g, KODAX_VERSION as h, PREVIEW_MAX_LENGTH as i, computeConfirmTools as m, createInteractiveContext as n, createMemorySessionStorage as o, executeCommand as p, getGitRoot as q, getProviderList as r, getProviderModel as s, getVersion as t, hydrateProcessEnvFromShell as u, isPermissionMode as v, isProviderConfigured as w, loadConfig as x, normalizePermissionMode as y, parseCommand as z };
584
- export type { Command as C, InkREPLOptions as I, RepLOptions as R, SessionData as S, CommandCallbacks as a, ConfirmResult as b, CurrentConfig as c, InteractiveContext as d, InteractiveMode as e, PermissionContext as j, PermissionMode as k, SessionStorage$1 as l };
509
+ 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 };
510
+ 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 };
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@kodax-ai/kodax",
3
- "version": "0.7.41",
3
+ "version": "0.7.43",
4
4
  "description": "极致轻量化 Coding Agent - TypeScript 实现,支持 12 个 LLM 提供商,可发布为免 Node 单文件二进制",
5
5
  "type": "module",
6
+ "private": false,
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
6
10
  "workspaces": [
7
11
  "packages/*"
8
12
  ],
@@ -36,12 +40,20 @@
36
40
  "types": "./dist/sdk-skills.d.ts",
37
41
  "import": "./dist/sdk-skills.js"
38
42
  },
43
+ "./mcp": {
44
+ "types": "./dist/sdk-mcp.d.ts",
45
+ "import": "./dist/sdk-mcp.js"
46
+ },
47
+ "./session": {
48
+ "types": "./dist/sdk-session.d.ts",
49
+ "import": "./dist/sdk-session.js"
50
+ },
39
51
  "./package.json": "./package.json"
40
52
  },
41
53
  "scripts": {
42
54
  "build": "npm run build:packages && npm run build:bundle && npm run build:dts",
43
55
  "build:dts": "node scripts/build-dts.mjs",
44
- "build:packages": "tsc -b tsconfig.build.json && npm run copy:builtin -w @kodax-ai/skills",
56
+ "build:packages": "tsc -b tsconfig.build.json && npm run copy:builtin -w @kodax-ai/agent",
45
57
  "build:bundle": "node scripts/build-bundle.mjs",
46
58
  "dev": "node --max-old-space-size=4096 --require ./scripts/production-env.cjs --import tsx src/kodax_cli.ts",
47
59
  "dev:cli": "node --max-old-space-size=4096 --require ./scripts/production-env.cjs --import tsx src/kodax_cli.ts",
@@ -142,8 +154,5 @@
142
154
  "README_CN.md",
143
155
  "LICENSE",
144
156
  "CHANGELOG.md"
145
- ],
146
- "publishConfig": {
147
- "access": "public"
148
- }
157
+ ]
149
158
  }
@@ -1,2 +0,0 @@
1
- // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{pc as A,rc as M}from"./chunk-HYWVRTFA.js";import{ia as O}from"./chunk-SX2IS5JP.js";import{$ as m,S as w,T as S,U as x,V as I,W as L,X as h,_ as k,ca as b,ja as R}from"./chunk-6QO6HWGU.js";import{a as i}from"./chunk-V4WSBIXB.js";import a from"fs";import c from"path";import{exec as F,spawnSync as G}from"child_process";import{promisify as V}from"util";import{fileURLToPath as q}from"url";var E="en";function U(){return(process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"").toLowerCase().startsWith("zh")?"zh":"en"}i(U,"detectSystemLocale");function N(e){if(!e||e==="auto"){E=U();return}E=e.toLowerCase().replace(/[-_].*/,"")==="zh"?"zh":"en"}i(N,"setLocale");var T={en:{"dialog.confirm":"[Confirm]","dialog.select":"[Select]","dialog.input":"[Input]","confirm.instruction.basic":"Press (y) yes, (n) no","confirm.instruction.always":"Press (y) yes, (a) always yes for this tool, (n) no","confirm.instruction.protected":"Press (y) to confirm, (n) to cancel (protected path)","confirm.result.approved":"Approved","confirm.result.approved_always":"Approved (always)","confirm.result.denied":"Denied","tool.bash.title":"Execute bash command?","tool.shell.title":"Execute shell command?","tool.write.title":"Write to file?","tool.edit.title":"Edit file?","tool.generic.title":"Execute {tool}?","field.reason":"Reason","field.intent":"Intent","field.target":"Target","field.scope":"Scope","field.risk":"Risk","field.summary":"Summary","intent.read":"Read project files","intent.delete":"Delete files","intent.deps":"Modify dependencies or environment","intent.modify":"Modify files","intent.execute":"Execute command","intent.write_file":"Write file","intent.edit_file":"Edit file","intent.use_tool":"Use {tool}","risk.destructive":"Destructive change","risk.deps":"May change dependencies or local tools","risk.modify":"May modify files","risk.unknown":"Command effects depend on its arguments","risk.network":"May access network","scope.outside":"Outside project","scope.protected":"Protected path","waiting.confirm":"Waiting: approval required","waiting.select":"Waiting: choose an option","waiting.input":"Waiting: answer the prompt","placeholder.confirm":"Respond to the approval prompt above...","placeholder.select":"Choose an option above...","placeholder.input":"Answer the prompt above...","placeholder.busy":"Agent is busy...","placeholder.queue":"Queue a follow-up for the next round...","placeholder.idle":"Type a message...","select.choice":"Choice:","select.type_number":"(type a number)","select.more":"{count} more choices...","select.more_above":"\u2191 {count} more above","select.more_below":"\u2193 {count} more below","select.confirm_hint":"Press Enter to confirm, Esc to cancel","select.navigate_hint":"Use \u2191\u2193 to navigate, Enter to confirm, Esc to cancel","select.multiselect_hint":"Use \u2191\u2193 to navigate, Space to toggle, Enter to confirm, Esc to cancel","select.multiselect_empty":"Select at least one option with Space before confirming.","select.back_prev":"\u2190 Back to previous question","input.default":"Default:","input.value":"Value:","input.type_response":"(type your response)","managed.completed":"Task completed","managed.completed.blocked":"Task blocked","managed.completed.continuation":"Task needs continuation",cancelled:"[Cancelled] Operation cancelled by user"},zh:{"dialog.confirm":"[\u786E\u8BA4]","dialog.select":"[\u9009\u62E9]","dialog.input":"[\u8F93\u5165]","confirm.instruction.basic":"\u6309 (y) \u786E\u8BA4, (n) \u62D2\u7EDD","confirm.instruction.always":"\u6309 (y) \u786E\u8BA4, (a) \u59CB\u7EC8\u5141\u8BB8\u6B64\u5DE5\u5177, (n) \u62D2\u7EDD","confirm.instruction.protected":"\u6309 (y) \u786E\u8BA4, (n) \u53D6\u6D88 (\u53D7\u4FDD\u62A4\u8DEF\u5F84)","confirm.result.approved":"\u5DF2\u6279\u51C6","confirm.result.approved_always":"\u5DF2\u6279\u51C6 (\u59CB\u7EC8\u5141\u8BB8)","confirm.result.denied":"\u5DF2\u62D2\u7EDD","tool.bash.title":"\u6267\u884C bash \u547D\u4EE4\uFF1F","tool.shell.title":"\u6267\u884C shell \u547D\u4EE4\uFF1F","tool.write.title":"\u5199\u5165\u6587\u4EF6\uFF1F","tool.edit.title":"\u7F16\u8F91\u6587\u4EF6\uFF1F","tool.generic.title":"\u6267\u884C {tool}\uFF1F","field.reason":"\u539F\u56E0","field.intent":"\u610F\u56FE","field.target":"\u76EE\u6807","field.scope":"\u8303\u56F4","field.risk":"\u98CE\u9669","field.summary":"\u6458\u8981","intent.read":"\u8BFB\u53D6\u9879\u76EE\u6587\u4EF6","intent.delete":"\u5220\u9664\u6587\u4EF6","intent.deps":"\u4FEE\u6539\u4F9D\u8D56\u6216\u73AF\u5883","intent.modify":"\u4FEE\u6539\u6587\u4EF6","intent.execute":"\u6267\u884C\u547D\u4EE4","intent.write_file":"\u5199\u5165\u6587\u4EF6","intent.edit_file":"\u7F16\u8F91\u6587\u4EF6","intent.use_tool":"\u4F7F\u7528 {tool}","risk.destructive":"\u7834\u574F\u6027\u53D8\u66F4","risk.deps":"\u53EF\u80FD\u4FEE\u6539\u4F9D\u8D56\u6216\u672C\u5730\u5DE5\u5177","risk.modify":"\u53EF\u80FD\u4FEE\u6539\u6587\u4EF6","risk.unknown":"\u547D\u4EE4\u6548\u679C\u53D6\u51B3\u4E8E\u53C2\u6570","risk.network":"\u53EF\u80FD\u8BBF\u95EE\u7F51\u7EDC","scope.outside":"\u9879\u76EE\u5916\u90E8","scope.protected":"\u53D7\u4FDD\u62A4\u8DEF\u5F84","waiting.confirm":"\u7B49\u5F85\u4E2D\uFF1A\u9700\u8981\u5BA1\u6279","waiting.select":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u9009\u62E9","waiting.input":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u56DE\u7B54","placeholder.confirm":"\u8BF7\u56DE\u5E94\u4E0A\u65B9\u7684\u5BA1\u6279\u63D0\u793A...","placeholder.select":"\u8BF7\u5728\u4E0A\u65B9\u9009\u62E9\u4E00\u4E2A\u9009\u9879...","placeholder.input":"\u8BF7\u56DE\u7B54\u4E0A\u65B9\u7684\u63D0\u793A...","placeholder.busy":"\u4EE3\u7406\u6B63\u5728\u5DE5\u4F5C\u4E2D...","placeholder.queue":"\u6392\u961F\u7B49\u5F85\u4E0B\u4E00\u8F6E\u8DDF\u8FDB...","placeholder.idle":"\u8F93\u5165\u6D88\u606F...","select.choice":"\u9009\u9879\uFF1A","select.type_number":"(\u8F93\u5165\u7F16\u53F7)","select.more":"\u8FD8\u6709 {count} \u4E2A\u9009\u9879...","select.more_above":"\u2191 \u4E0A\u65B9\u8FD8\u6709 {count} \u4E2A","select.more_below":"\u2193 \u4E0B\u65B9\u8FD8\u6709 {count} \u4E2A","select.confirm_hint":"\u6309 Enter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.navigate_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0C\u7A7A\u683C \u5207\u6362\u9009\u4E2D\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_empty":"\u8BF7\u5148\u4F7F\u7528\u7A7A\u683C\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u9009\u9879\u3002","select.back_prev":"\u2190 \u8FD4\u56DE\u4E0A\u4E00\u9898","input.default":"\u9ED8\u8BA4\u503C\uFF1A","input.value":"\u503C\uFF1A","input.type_response":"(\u8F93\u5165\u4F60\u7684\u56DE\u7B54)","managed.completed":"\u4EFB\u52A1\u5B8C\u6210","managed.completed.blocked":"\u4EFB\u52A1\u53D7\u963B","managed.completed.continuation":"\u4EFB\u52A1\u9700\u8981\u7EE7\u7EED",cancelled:"[\u5DF2\u53D6\u6D88] \u64CD\u4F5C\u5DF2\u88AB\u7528\u6237\u53D6\u6D88"}};function pe(e,t){let o=T[E][e]??T.en[e]??e;if(t)for(let[r,l]of Object.entries(t))o=o.replace(`{${r}}`,String(l));return o}i(pe,"t");var W=V(F),X=O(),Ce=c.join(X,"sessions"),d=c.join(X,"config.json"),we=60,s=null,_=!1,J="dumb";function Q(e){let t=c.basename(e).toLowerCase(),n="__KODAX_SHELL_ENV_START__",o=`printf '%s\\0' '${n}'; env -0`;return t==="fish"?{args:["-i","-c",o],sentinel:n}:{args:t==="bash"||t==="zsh"?["-ic",o]:["-lc",o],sentinel:n}}i(Q,"buildShellEnvCommand");function Y(e,t){let n=`${t}\0`,o=e.lastIndexOf(n);if(o===-1)return{};let r=e.slice(o+n.length),l={};for(let u of r.split("\0")){if(!u)continue;let p=u.indexOf("=");p<=0||(l[u.slice(0,p)]=u.slice(p+1))}return l}i(Y,"parseNullDelimitedShellEnv");function Z(e={}){let t=e.env??process.env;if((e.platform??process.platform)==="win32"||t.KODAX_DISABLE_SHELL_ENV_HYDRATION==="1")return!1;let o=e.shell??t.SHELL;if(!o||!c.isAbsolute(o))return!1;let{args:r,sentinel:l}=Q(o),u=e.run??G,p={...t,TERM:J},f=u(o,r,{encoding:"utf8",env:p,maxBuffer:1024*1024,timeout:5e3,windowsHide:!0,detached:!0,stdio:["ignore","pipe","pipe"]});if(f.status!==0||!f.stdout)return!1;let H=typeof f.stdout=="string"?f.stdout:f.stdout.toString("utf8"),j=Y(H,l),C=!1;for(let[v,z]of Object.entries(j))v!=="TERM"&&t[v]===void 0&&(t[v]=z,C=!0);return C}i(Z,"hydrateProcessEnvFromShell");function ee(){if(!_){_=!0;try{Z()}catch{}}}i(ee,"ensureShellEnvironmentHydrated");function Se(){_=!1}i(Se,"resetShellEnvironmentHydrationForTesting");function te(e){k(e.customProviders??[])}i(te,"registerConfiguredCustomProviders");function $(e){if(!Array.isArray(e))return;let t=e.filter(n=>typeof n=="string").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:[]}i($,"normalizeConfiguredExtensions");function ne(e){if(e.permissionMode!=="default")return e;let t={...e,permissionMode:"accept-edits"};try{a.mkdirSync(c.dirname(d),{recursive:!0}),a.writeFileSync(d,JSON.stringify(t,null,2))}catch{}return t}i(ne,"migrateLegacyPermissionModeInConfig");function oe(){if(s)return s;let e="0.7.41";if(e)return s=e,s;let t=c.join(c.dirname(q(import.meta.url)),"../../package.json");if(a.existsSync(t))try{return s=JSON.parse(a.readFileSync(t,"utf-8")).version??"0.0.0",s??"0.0.0"}catch{}return s="0.0.0",s}i(oe,"getVersion");var xe=oe();function Ie(e){return S(e)}i(Ie,"getProviderModel");function P(e,t){let n=new Set(e.map(r=>r.toLowerCase())),o=[...e];for(let r of t)n.has(r.toLowerCase())||o.push(r);return o}i(P,"mergeModels");function ie(e,t){t||(t=y().providerModels);let n=t?.[e];if(n&&n.length>0){try{let o=h(e);if(o.length>0)return P(n,o)}catch{}try{let o=m(e);if(o)return P(n,o.getAvailableModels())}catch{}return n}try{let o=h(e);if(o.length>0)return o}catch{}try{let o=m(e);if(o)return o.getAvailableModels()}catch{}return[]}i(ie,"getProviderAvailableModels");function re(e,t){let n=x(e,t);if(n!=="unknown")return n;try{let o=m(e);if(o)return o.getReasoningCapability(t)}catch{}return"unknown"}i(re,"getProviderReasoningCapability");function se(e){let t=I(e);if(t)return t;try{return b().find(o=>o.name===e)?.capabilityProfile??null}catch{return null}}i(se,"getProviderCapabilityProfile");function B(e,t){let n=se(e),o=re(e,t);if(n)return{capabilityProfile:n,reasoningCapability:o};try{let r=R(e);return{capabilityProfile:r.getCapabilityProfile(),reasoningCapability:r.getReasoningCapability(t)}}catch{return null}}i(B,"getProviderCapabilityMetadata");function Le(e,t){let n=B(e,t);return n?A({providerName:e,model:t,capabilityProfile:n.capabilityProfile,reasoningCapability:n.reasoningCapability==="unknown"?void 0:n.reasoningCapability}):null}i(Le,"getProviderCapabilitySnapshot");function ae(e,t,n,o){let r=B(e,t);return r?M({providerName:e,model:t,capabilityProfile:r.capabilityProfile,reasoningCapability:r.reasoningCapability==="unknown"?void 0:r.reasoningCapability,reasoningMode:n,hints:o}):null}i(ae,"getProviderPolicyDecision");function ke(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"forwards only the latest user message":"preserves full conversation history",o=e.mcpSupport==="native"?"MCP available":"MCP unavailable";return`${t}; ${n}; ${o}`}i(ke,"describeProviderCapabilitySummary");function Re(e){switch(e){case"native-budget":return"B";case"native-effort":return"E";case"native-toggle":return"T";default:return"-"}}i(Re,"formatReasoningCapabilityShort");function ce(e){switch(e){case"native-budget":return"budget";case"native-effort":return"effort";case"native-toggle":return"toggle";default:return"none"}}i(ce,"describeReasoningCapabilityControl");function Oe(e,t){if(e==="off")return"Reasoning disabled";switch(t){case"native-budget":return"Uses native thinking budget control";case"native-effort":return"Uses native reasoning effort control";case"native-toggle":return"Uses provider-native thinking toggle only";case"none":return"Runs without native reasoning parameters";case"prompt-only":return"Uses prompt overlays only; no native reasoning parameter";default:return"Runs without native reasoning parameters"}}i(Oe,"describeReasoningExecution");function Ae(e){let t=[];e||(e=y().providerModels);for(let n of L())t.push({name:n.name,model:n.model,models:ie(n.name,e),configured:n.capabilityProfile.transport==="cli-bridge"?!0:n.configured,reasoningCapability:n.reasoningCapability,capabilityProfile:n.capabilityProfile});try{let n=b().map(o=>({...o,models:(()=>{let r=e?.[o.name];return r&&r.length>0?P(r,o.models):o.models})()}));t.push(...n)}catch{}return t}i(Ae,"getProviderList");function Me(e){if(w(e))return!0;try{return m(e)?.isConfigured()??!1}catch{return!1}}i(Me,"isProviderConfigured");function y(){try{if(a.existsSync(d)){let e=JSON.parse(a.readFileSync(d,"utf-8")),t=e.reasoningCeiling??e.reasoningMode;return ne({...e,reasoningMode:t,extensions:$(e.extensions)})}}catch{}return{}}i(y,"loadConfig");function le(e){e.streamIdleTimeoutMs&&!process.env.KODAX_STREAM_IDLE_TIMEOUT_MS&&(process.env.KODAX_STREAM_IDLE_TIMEOUT_MS=String(e.streamIdleTimeoutMs))}i(le,"applyResilienceRuntimeEnv");function ue(e){e.repoIntelligenceMode&&!process.env.KODAX_REPO_INTELLIGENCE_MODE&&(process.env.KODAX_REPO_INTELLIGENCE_MODE=e.repoIntelligenceMode),e.repointelEndpoint&&!process.env.KODAX_REPOINTEL_ENDPOINT&&(process.env.KODAX_REPOINTEL_ENDPOINT=e.repointelEndpoint),e.repointelBin&&!process.env.KODAX_REPOINTEL_BIN&&(process.env.KODAX_REPOINTEL_BIN=e.repointelBin),e.repoIntelligenceTrace===!0&&!process.env.KODAX_REPO_INTELLIGENCE_TRACE&&(process.env.KODAX_REPO_INTELLIGENCE_TRACE="1")}i(ue,"applyRepoIntelligenceRuntimeEnv");function Te(){ee();let e=y();return le(e),ue(e),te(e),N(e.locale),e}i(Te,"prepareRuntimeConfig");function Ne(e){let n={...y(),...e},o=$(n.extensions);o!==void 0&&(n.extensions=o);for(let r of Object.keys(e))e[r]===void 0&&delete n[r];a.mkdirSync(c.dirname(d),{recursive:!0}),a.writeFileSync(d,JSON.stringify(n,null,2))}i(Ne,"saveConfig");async function De(){try{let{stdout:e}=await W("git rev-parse --show-toplevel");return e.trim()}catch{return null}}i(De,"getGitRoot");function de(e){switch(e){case"builtin":return"Built-in";case"runtime":return"Runtime extension";case"custom":return"Custom config";default:return"Unknown"}}i(de,"formatProviderSourceKind");function Ke(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"latest-user-message only":"full conversation history";return[`Source: ${de(e.sourceKind)}`,`Transport: ${t}`,`Conversation semantics: ${n}`,`Context fidelity: ${e.contextFidelity}`,`Tool calling: ${e.toolCallingFidelity}`,`Session behavior: ${e.sessionSupport}`,`Long-running support: ${e.longRunningSupport}`,`Evidence-heavy flows: ${e.evidenceSupport}`,`Multimodal support: ${e.multimodalSupport}`,`MCP support: ${e.mcpSupport}`,`Reasoning control: ${ce(e.reasoningCapability)}`]}i(Ke,"formatProviderCapabilityDetailLines");function Xe(e,t,n){return[{label:"General coding",hints:{}},{label:"Evidence-heavy review",hints:{evidenceHeavy:!0}},{label:"Long-running task",hints:{longRunning:!0}}].map(r=>({label:r.label,decision:ae(e,t,n,r.hints)})).filter(r=>r.decision!==null)}i(Xe,"getProviderCommonPolicyScenarios");var D=.5,K=0,g={locked:!1,queue:[]};async function $e(e){for(;g.locked;)await new Promise(t=>g.queue.push(t));g.locked=!0;try{let t=(Date.now()-K)/1e3;t<D&&await new Promise(o=>setTimeout(o,(D-t)*1e3));let n=await e();return K=Date.now(),n}finally{g.locked=!1;let t=g.queue.shift();t&&t()}}i($e,"rateLimitedCall");export{pe as a,X as b,Ce as c,d,we as e,Z as f,Se as g,te as h,oe as i,xe as j,Ie as k,ie as l,re as m,se as n,Le as o,ae as p,ke as q,Re as r,ce as s,Oe as t,Ae as u,Me as v,y as w,Te as x,Ne as y,De as z,de as A,Ke as B,Xe as C,$e as D};