@kodax-ai/kodax 0.7.49 → 0.7.51

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 (55) hide show
  1. package/CHANGELOG.md +1800 -1741
  2. package/README.md +1215 -1210
  3. package/README_CN.md +636 -632
  4. package/dist/chunks/agent-EFA7BSE7.js +2 -0
  5. package/dist/chunks/argument-completer-MAJVHSE7.js +2 -0
  6. package/dist/chunks/{chunk-TYZAH3YP.js → chunk-CCZMQE3Q.js} +1 -1
  7. package/dist/chunks/chunk-E3HENKTX.js +420 -0
  8. package/dist/chunks/chunk-FAIGYAEX.js +301 -0
  9. package/dist/chunks/chunk-HMATTIU6.js +574 -0
  10. package/dist/chunks/{chunk-YW4RQV7U.js → chunk-JJTUBNQX.js} +1 -1
  11. package/dist/chunks/chunk-ODVA5VTE.js +492 -0
  12. package/dist/chunks/chunk-PEWH3AAL.js +31 -0
  13. package/dist/chunks/chunk-WQTVG2T5.js +648 -0
  14. package/dist/chunks/{compaction-config-BQBYOWX2.js → compaction-config-UBPCNGC2.js} +1 -1
  15. package/dist/chunks/{construction-bootstrap-5TFGMSWQ.js → construction-bootstrap-WY5MDXRX.js} +1 -1
  16. package/dist/chunks/{dist-BL7IBQHD.js → dist-B73FQEAA.js} +1 -1
  17. package/dist/chunks/dist-BTWS2ENP.js +2 -0
  18. package/dist/chunks/utils-HVOJRR5C.js +2 -0
  19. package/dist/index.d.ts +11 -11
  20. package/dist/index.js +4 -4
  21. package/dist/kodax_cli.js +1091 -984
  22. package/dist/provider-capabilities.json +2 -0
  23. package/dist/sdk-agent.d.ts +25 -11
  24. package/dist/sdk-agent.js +1 -1
  25. package/dist/sdk-coding.d.ts +160 -34
  26. package/dist/sdk-coding.js +1 -1
  27. package/dist/sdk-llm.d.ts +3 -5
  28. package/dist/sdk-llm.js +1 -1
  29. package/dist/sdk-mcp.js +1 -1
  30. package/dist/sdk-repl.d.ts +38 -727
  31. package/dist/sdk-repl.js +2 -2
  32. package/dist/sdk-session.d.ts +8 -200
  33. package/dist/sdk-session.js +1 -1
  34. package/dist/sdk-skills.js +1 -1
  35. package/dist/types-chunks/{types.d-rPRl2LSB.d.ts → base.d-GZ6jvICS.d.ts} +270 -3
  36. package/dist/types-chunks/{bash-prefix-extractor.d-CI_xcPhn.d.ts → bash-prefix-extractor.d-DTOiDMlG.d.ts} +84 -537
  37. package/dist/types-chunks/{capsule.d-DaPuhyyK.d.ts → capsule.d-CXGdLGAn.d.ts} +6 -3
  38. package/dist/types-chunks/guardrail.d-D47yu9AO.d.ts +518 -0
  39. package/dist/types-chunks/{types.d-BR9oNWup.d.ts → process.d-B8kEBnQD.d.ts} +487 -275
  40. package/dist/types-chunks/{resolver.d-B_wm409c.d.ts → resolver.d-D75XFRH2.d.ts} +23 -6
  41. package/dist/types-chunks/sdk-session-BKQJN9oH.d.ts +977 -0
  42. package/dist/types-chunks/{storage.d-J2GqOgaX.d.ts → storage.d-BN1xIn8R.d.ts} +78 -3
  43. package/dist/types-chunks/types.d-DQ_hdN70.d.ts +273 -0
  44. package/dist/types-chunks/{utils.d-BJ_-y8gC.d.ts → utils.d-ZfRDo-kX.d.ts} +8 -80
  45. package/package.json +2 -2
  46. package/dist/chunks/argument-completer-GDG5OHN7.js +0 -2
  47. package/dist/chunks/chunk-67SWUEEN.js +0 -1035
  48. package/dist/chunks/chunk-C5PKZX5Z.js +0 -291
  49. package/dist/chunks/chunk-ISGHUKRY.js +0 -428
  50. package/dist/chunks/chunk-JTHMWRXM.js +0 -566
  51. package/dist/chunks/chunk-YACQ4OST.js +0 -31
  52. package/dist/chunks/dist-D7HOETCE.js +0 -2
  53. package/dist/chunks/utils-XWDT3W5X.js +0 -2
  54. package/dist/types-chunks/base.d-C4jYVjJh.d.ts +0 -270
  55. package/dist/types-chunks/types.d-BnjX2Gn4.d.ts +0 -297
@@ -1,297 +0,0 @@
1
- import { n as KodaXMessage } from './types.d-rPRl2LSB.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 KodaXGoalStatus = 'active' | 'paused' | 'budget_limited' | 'blocked' | 'complete';
86
- /**
87
- * Persistent user-set goal state. v0.7.44 FEATURE_192 — backs the
88
- * `/goal` slash command and the get_goal / create_goal / update_goal
89
- * tools.
90
- *
91
- * Persistence model: each lifecycle event (create / update / pause /
92
- * resume / clear / budget_limited / blocked / complete) appends a
93
- * `KodaXSessionGoalEntry` carrying a frozen `KodaXGoalState` snapshot
94
- * to the session lineage. `readLatestGoalFromBranch` walks the active
95
- * branch's message-entry IDs and returns the latest goal entry whose
96
- * parentId belongs to that branch — so forks and rewinds naturally
97
- * drop goals attached to abandoned message paths.
98
- */
99
- interface KodaXGoalState {
100
- readonly version: 1;
101
- /** `${createdAt}-${rand}` — stable across updates of the same goal. */
102
- readonly id: string;
103
- readonly objective: string;
104
- readonly status: KodaXGoalStatus;
105
- /** Optional explicit token budget; null when the user did not set one. */
106
- readonly tokenBudget: number | null;
107
- readonly tokensUsed: number;
108
- readonly timeUsedSeconds: number;
109
- /** Consecutive turns the model has reported the same blocker. */
110
- readonly blockerTurnCount: number;
111
- /** The blocker_kind string the model last reported, or null. */
112
- readonly lastBlockerKind: string | null;
113
- readonly createdAt: number;
114
- readonly updatedAt: number;
115
- }
116
- type KodaXGoalEventType = 'created' | 'updated' | 'paused' | 'resumed' | 'cleared' | 'budget_limited' | 'blocked' | 'complete';
117
- interface KodaXSessionGoalEntry extends KodaXSessionEntryBase {
118
- type: 'goal';
119
- /** Snapshot at time of event; `null` only when `event === 'cleared'`. */
120
- goal: KodaXGoalState | null;
121
- event: KodaXGoalEventType;
122
- }
123
- type KodaXSessionEntry = KodaXSessionMessageEntry | KodaXSessionCompactionEntry | KodaXSessionBranchSummaryEntry | KodaXSessionLabelEntry | KodaXSessionArchiveMarkerEntry | KodaXSessionGoalEntry;
124
- interface KodaXSessionArtifactLedgerEntry {
125
- id: string;
126
- kind: 'file_read' | 'file_modified' | 'file_created' | 'file_deleted' | 'path_scope' | 'search_scope' | 'command_scope' | 'check_result' | 'decision' | 'image_input' | 'tombstone';
127
- sourceTool?: string;
128
- action?: string;
129
- target: string;
130
- displayTarget?: string;
131
- summary?: string;
132
- sessionEntryId?: string;
133
- timestamp: string;
134
- metadata?: Record<string, KodaXJsonValue>;
135
- }
136
- interface KodaXCompactMemoryProgress {
137
- completed: string[];
138
- inProgress: string[];
139
- blockers: string[];
140
- }
141
- interface KodaXCompactMemorySeed {
142
- objective?: string;
143
- constraints: string[];
144
- progress: KodaXCompactMemoryProgress;
145
- keyDecisions: string[];
146
- nextSteps: string[];
147
- keyContext: string[];
148
- importantTargets: string[];
149
- tombstones: string[];
150
- }
151
- interface KodaXSessionLineage {
152
- version: 2;
153
- activeEntryId: string | null;
154
- entries: KodaXSessionEntry[];
155
- }
156
- interface KodaXSessionNavigationOptions {
157
- summarizeCurrentBranch?: boolean;
158
- }
159
- interface KodaXSessionTreeNode {
160
- entry: Exclude<KodaXSessionEntry, KodaXSessionLabelEntry | KodaXSessionGoalEntry>;
161
- children: KodaXSessionTreeNode[];
162
- label?: string;
163
- active: boolean;
164
- }
165
- type KodaXSessionScope = 'user' | 'managed-task-worker';
166
- type KodaXSessionUiHistoryItemType = 'user' | 'assistant' | 'system' | 'thinking' | 'error' | 'event' | 'info' | 'hint';
167
- interface KodaXSessionUiHistoryItem {
168
- type: KodaXSessionUiHistoryItemType;
169
- text: string;
170
- icon?: string;
171
- compactText?: string;
172
- }
173
- type KodaXSessionWorkspaceKind = 'detected' | 'managed';
174
- interface KodaXSessionRuntimeInfo {
175
- canonicalRepoRoot?: string;
176
- workspaceRoot?: string;
177
- executionCwd?: string;
178
- branch?: string;
179
- workspaceKind?: KodaXSessionWorkspaceKind;
180
- }
181
- interface KodaXSessionData {
182
- messages: KodaXMessage[];
183
- title: string;
184
- gitRoot: string;
185
- /** Consumer-owned private string persisted with the session. */
186
- tag?: string;
187
- runtimeInfo?: KodaXSessionRuntimeInfo;
188
- scope?: KodaXSessionScope;
189
- uiHistory?: KodaXSessionUiHistoryItem[];
190
- errorMetadata?: SessionErrorMetadata;
191
- extensionState?: KodaXExtensionSessionState;
192
- extensionRecords?: KodaXExtensionSessionRecord[];
193
- lineage?: KodaXSessionLineage;
194
- artifactLedger?: KodaXSessionArtifactLedgerEntry[];
195
- }
196
- interface KodaXSessionMeta {
197
- _type: 'meta';
198
- title: string;
199
- id: string;
200
- gitRoot: string;
201
- /** Consumer-owned private string persisted with the session. */
202
- tag?: string;
203
- runtimeInfo?: KodaXSessionRuntimeInfo;
204
- createdAt: string;
205
- scope?: KodaXSessionScope;
206
- uiHistory?: KodaXSessionUiHistoryItem[];
207
- extensionState?: KodaXExtensionSessionState;
208
- extensionRecordCount?: number;
209
- artifactLedgerCount?: number;
210
- lineageVersion?: 2;
211
- activeEntryId?: string | null;
212
- lineageEntryCount?: number;
213
- activeMessageCount?: number;
214
- /** Error metadata for recovery - 错误元数据用于恢复 */
215
- errorMetadata?: SessionErrorMetadata;
216
- }
217
- /**
218
- * Extension-scoped persistence entry.
219
- *
220
- * Each entry belongs to a namespace (extensionId) and carries
221
- * a string key, a JSON-safe value, and an opaque version tag
222
- * used for optimistic concurrency control.
223
- */
224
- interface KodaXExtensionStoreEntry {
225
- key: string;
226
- value: KodaXJsonValue;
227
- version: string;
228
- updatedAt: number;
229
- }
230
- /**
231
- * Extension persistence store interface (FEATURE_034 manual persistence).
232
- *
233
- * Implementations provide a durable key-value store scoped to a single
234
- * extension identity. The store is independent of session lifecycle —
235
- * data survives across sessions and restarts.
236
- */
237
- interface KodaXExtensionStore {
238
- /**
239
- * Read a single key.
240
- * Returns `undefined` when the key does not exist.
241
- */
242
- get(key: string): Promise<KodaXExtensionStoreEntry | undefined>;
243
- /**
244
- * Write a key-value pair.
245
- *
246
- * When `expectedVersion` is provided the write only succeeds when the
247
- * stored entry's version still matches (optimistic concurrency).
248
- * Returns the new entry on success, or `false` on version mismatch.
249
- */
250
- put(key: string, value: KodaXJsonValue, options?: {
251
- expectedVersion?: string;
252
- }): Promise<KodaXExtensionStoreEntry | false>;
253
- /**
254
- * Remove a key.
255
- * Returns `true` when the key existed and was removed.
256
- */
257
- delete(key: string): Promise<boolean>;
258
- /**
259
- * List all keys (optionally filtered by prefix).
260
- */
261
- list(options?: {
262
- prefix?: string;
263
- }): Promise<string[]>;
264
- /**
265
- * Clear all keys (optionally filtered by prefix).
266
- * Returns the number of entries removed.
267
- */
268
- clear(options?: {
269
- prefix?: string;
270
- }): Promise<number>;
271
- }
272
- interface KodaXSessionStorage {
273
- save(id: string, data: KodaXSessionData): Promise<void>;
274
- load(id: string): Promise<KodaXSessionData | null>;
275
- getLineage?(id: string): Promise<KodaXSessionLineage | null>;
276
- setActiveEntry?(id: string, selector: string, options?: KodaXSessionNavigationOptions): Promise<KodaXSessionData | null>;
277
- setLabel?(id: string, selector: string, label?: string): Promise<KodaXSessionData | null>;
278
- rewind?(id: string, selector?: string): Promise<KodaXSessionData | null>;
279
- fork?(id: string, selector?: string, options?: {
280
- sessionId?: string;
281
- title?: string;
282
- }): Promise<{
283
- sessionId: string;
284
- data: KodaXSessionData;
285
- } | null>;
286
- list?(gitRoot?: string): Promise<Array<{
287
- id: string;
288
- title: string;
289
- msgCount: number;
290
- tag?: string;
291
- runtimeInfo?: KodaXSessionRuntimeInfo;
292
- }>>;
293
- delete?(id: string): Promise<void>;
294
- deleteAll?(gitRoot?: string): Promise<void>;
295
- }
296
-
297
- export type { KodaXSessionUiHistoryItem as A, KodaXSessionUiHistoryItemType as B, KodaXSessionWorkspaceKind as C, KodaXCompactMemoryProgress as K, SessionErrorMetadata as S, KodaXCompactMemorySeed as a, KodaXExtensionSessionRecord as b, KodaXExtensionSessionState as c, KodaXExtensionStore as d, KodaXExtensionStoreEntry as e, KodaXGoalEventType as f, KodaXGoalState as g, KodaXGoalStatus as h, KodaXJsonValue as i, KodaXSessionArchiveMarkerEntry as j, KodaXSessionArtifactLedgerEntry as k, KodaXSessionBranchSummaryEntry as l, KodaXSessionCompactionEntry as m, KodaXSessionData as n, KodaXSessionEntry as o, KodaXSessionEntryBase as p, KodaXSessionGoalEntry as q, KodaXSessionLabelEntry as r, KodaXSessionLineage as s, KodaXSessionMessageEntry as t, KodaXSessionMeta as u, KodaXSessionNavigationOptions as v, KodaXSessionRuntimeInfo as w, KodaXSessionScope as x, KodaXSessionStorage as y, KodaXSessionTreeNode as z };