@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.
- package/CHANGELOG.md +119 -3
- package/README.md +214 -286
- package/README_CN.md +173 -277
- package/dist/chunks/chunk-7G5PSL6C.js +830 -0
- package/dist/chunks/{chunk-6OB4AJOM.js → chunk-IYSK7LUK.js} +1 -1
- package/dist/chunks/chunk-K75O2CAE.js +31 -0
- package/dist/chunks/chunk-UG4262JI.js +502 -0
- package/dist/chunks/chunk-VHKAJDQD.js +425 -0
- package/dist/chunks/chunk-YMRZBS4G.js +2 -0
- package/dist/chunks/{compaction-config-LT5PEXPT.js → compaction-config-3E57ABCT.js} +1 -1
- package/dist/chunks/{construction-bootstrap-HBCWJFHC.js → construction-bootstrap-JR63KI5N.js} +4 -4
- package/dist/chunks/dist-KWHUKXEL.js +2 -0
- package/dist/chunks/dist-XANXEVTU.js +2 -0
- package/dist/chunks/utils-HQ2QCKJA.js +2 -0
- package/dist/index.d.ts +15 -10
- package/dist/index.js +5 -5
- package/dist/kodax_cli.js +1084 -1054
- package/dist/sdk-agent.d.ts +853 -135
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +932 -981
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.d.ts +8 -5
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +17 -0
- package/dist/sdk-mcp.js +2 -0
- package/dist/sdk-repl.d.ts +343 -10
- package/dist/sdk-repl.js +2 -1
- package/dist/sdk-session.d.ts +176 -0
- package/dist/sdk-session.js +2 -0
- package/dist/sdk-skills.d.ts +72 -4
- package/dist/sdk-skills.js +1 -1
- package/dist/types-chunks/{cost-tracker.d-C4dMlQuV.d.ts → base.d-FUJahC0i.d.ts} +22 -112
- package/dist/types-chunks/{bash-prefix-extractor.d-B2iliwdi.d.ts → bash-prefix-extractor.d-DMrGImMl.d.ts} +266 -228
- package/dist/types-chunks/capability.d-3C62G8Eq.d.ts +39 -0
- package/dist/types-chunks/config.d-BfJUXxC0.d.ts +41 -0
- package/dist/types-chunks/cost-tracker.d-wRtyEW9d.d.ts +110 -0
- package/dist/types-chunks/{history-cleanup.d-q1vAvCss.d.ts → file-tracker.d-zaLZeNBK.d.ts} +532 -15
- package/dist/types-chunks/manager.d-87belpiS.d.ts +370 -0
- package/dist/types-chunks/{resolver.d-BwD6TKz7.d.ts → resolver.d-CA68_NeH.d.ts} +150 -5
- package/dist/types-chunks/storage.d-DPAEX7zS.d.ts +115 -0
- package/dist/types-chunks/{capability.d-BxNgd1-c.d.ts → types.d-B1uGoVTE.d.ts} +72 -40
- package/dist/types-chunks/{instance-discovery.d-DZhp77vb.d.ts → types.d-CKJtjo-6.d.ts} +168 -258
- package/dist/types-chunks/types.d-mM8vqvhT.d.ts +254 -0
- package/dist/types-chunks/{storage.d-Bv9T99Qu.d.ts → utils.d-DkLZD_wa.d.ts} +38 -112
- package/package.json +15 -6
- package/dist/chunks/chunk-5TFLMGER.js +0 -2
- package/dist/chunks/chunk-6QO6HWGU.js +0 -30
- package/dist/chunks/chunk-EQ5DGS2W.js +0 -14
- package/dist/chunks/chunk-HYWVRTFA.js +0 -1233
- package/dist/chunks/chunk-SX2IS5JP.js +0 -16
- package/dist/chunks/chunk-ZPJPNLBK.js +0 -462
- package/dist/chunks/dist-M57GIWR4.js +0 -2
- package/dist/chunks/dist-V3BS2NKB.js +0 -2
- package/dist/chunks/utils-FAFUQJ2A.js +0 -2
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { k as KodaXSessionData, o as KodaXSessionLineage, r as KodaXSessionNavigationOptions, s as KodaXSessionRuntimeInfo, u as KodaXSessionStorage } from './types.d-mM8vqvhT.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Session Storage - Session storage abstraction layer
|
|
5
|
+
*
|
|
6
|
+
* Provides a shared persistence interface across memory and filesystem storage.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Session data structure.
|
|
11
|
+
*/
|
|
12
|
+
type SessionData = KodaXSessionData;
|
|
13
|
+
/**
|
|
14
|
+
* Session storage interface.
|
|
15
|
+
*/
|
|
16
|
+
interface SessionStorage {
|
|
17
|
+
save(id: string, data: SessionData): Promise<void>;
|
|
18
|
+
load(id: string): Promise<SessionData | null>;
|
|
19
|
+
getLineage?(id: string): Promise<KodaXSessionLineage | null>;
|
|
20
|
+
setActiveEntry?(id: string, selector: string, options?: KodaXSessionNavigationOptions): Promise<SessionData | null>;
|
|
21
|
+
setLabel?(id: string, selector: string, label?: string): Promise<SessionData | null>;
|
|
22
|
+
rewind?(id: string, selector?: string): Promise<SessionData | null>;
|
|
23
|
+
fork?(id: string, selector?: string, options?: {
|
|
24
|
+
sessionId?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
sessionId: string;
|
|
28
|
+
data: SessionData;
|
|
29
|
+
} | null>;
|
|
30
|
+
list(gitRoot?: string): Promise<Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
msgCount: number;
|
|
34
|
+
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
35
|
+
}>>;
|
|
36
|
+
delete?(id: string): Promise<void>;
|
|
37
|
+
deleteAll?(gitRoot?: string): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* In-memory session storage implementation.
|
|
41
|
+
*/
|
|
42
|
+
declare class MemorySessionStorage implements SessionStorage {
|
|
43
|
+
private sessions;
|
|
44
|
+
save(id: string, data: SessionData): Promise<void>;
|
|
45
|
+
load(id: string): Promise<SessionData | null>;
|
|
46
|
+
getLineage(id: string): Promise<KodaXSessionLineage | null>;
|
|
47
|
+
setActiveEntry(id: string, selector: string, options?: KodaXSessionNavigationOptions): Promise<SessionData | null>;
|
|
48
|
+
setLabel(id: string, selector: string, label?: string): Promise<SessionData | null>;
|
|
49
|
+
fork(id: string, selector?: string, options?: {
|
|
50
|
+
sessionId?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
}): Promise<{
|
|
53
|
+
sessionId: string;
|
|
54
|
+
data: SessionData;
|
|
55
|
+
} | null>;
|
|
56
|
+
rewind(id: string, selector?: string): Promise<SessionData | null>;
|
|
57
|
+
list(_gitRoot?: string): Promise<Array<{
|
|
58
|
+
id: string;
|
|
59
|
+
title: string;
|
|
60
|
+
msgCount: number;
|
|
61
|
+
}>>;
|
|
62
|
+
delete(id: string): Promise<void>;
|
|
63
|
+
deleteAll(_gitRoot?: string): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
declare function createMemorySessionStorage(): SessionStorage;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* KodaX session storage - filesystem implementation.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
declare class FileSessionStorage implements KodaXSessionStorage {
|
|
72
|
+
private readonly sessionsDir;
|
|
73
|
+
constructor(opts?: {
|
|
74
|
+
sessionsDir?: string;
|
|
75
|
+
});
|
|
76
|
+
private writeQueues;
|
|
77
|
+
private serializedWrite;
|
|
78
|
+
private appendState;
|
|
79
|
+
/** Update watermarks. Only overwrites fields the caller actually provided. */
|
|
80
|
+
private syncAppendState;
|
|
81
|
+
private getSessionFilePath;
|
|
82
|
+
private getArchiveFilePath;
|
|
83
|
+
private readSession;
|
|
84
|
+
private writeSessionInternal;
|
|
85
|
+
private mergeAndWriteInternal;
|
|
86
|
+
appendSessionDelta(id: string, data: SessionData): Promise<void>;
|
|
87
|
+
private shouldRunMaintenance;
|
|
88
|
+
private runMaintenance;
|
|
89
|
+
save(id: string, data: SessionData): Promise<void>;
|
|
90
|
+
load(id: string): Promise<SessionData | null>;
|
|
91
|
+
getLineage(id: string): Promise<KodaXSessionLineage | null>;
|
|
92
|
+
setActiveEntry(id: string, selector: string, options?: {
|
|
93
|
+
summarizeCurrentBranch?: boolean;
|
|
94
|
+
}): Promise<SessionData | null>;
|
|
95
|
+
rewind(id: string, selector?: string): Promise<SessionData | null>;
|
|
96
|
+
setLabel(id: string, selector: string, label?: string): Promise<SessionData | null>;
|
|
97
|
+
fork(id: string, selector?: string, options?: {
|
|
98
|
+
sessionId?: string;
|
|
99
|
+
title?: string;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
sessionId: string;
|
|
102
|
+
data: SessionData;
|
|
103
|
+
} | null>;
|
|
104
|
+
list(gitRoot?: string): Promise<Array<{
|
|
105
|
+
id: string;
|
|
106
|
+
title: string;
|
|
107
|
+
msgCount: number;
|
|
108
|
+
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
109
|
+
}>>;
|
|
110
|
+
delete(id: string): Promise<void>;
|
|
111
|
+
deleteAll(gitRoot?: string): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { FileSessionStorage as F, MemorySessionStorage as M, createMemorySessionStorage as c };
|
|
115
|
+
export type { SessionData as S, SessionStorage as a };
|
|
@@ -13,10 +13,40 @@ interface KodaXToolUseBlock {
|
|
|
13
13
|
name: string;
|
|
14
14
|
input: Record<string, unknown>;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Tool-result content blocks — a structural subset of the full
|
|
18
|
+
* `KodaXContentBlock` union, restricted to what providers actually accept
|
|
19
|
+
* inside a tool_result envelope. Anthropic / OpenAI multimodal APIs accept
|
|
20
|
+
* text and image blocks inside tool_result; thinking / tool_use / nested
|
|
21
|
+
* tool_result / cache-boundary are not valid there.
|
|
22
|
+
*
|
|
23
|
+
* Carrying these as a stricter subtype (instead of the full union) lets
|
|
24
|
+
* provider serializers narrow without exhaustive type assertions and
|
|
25
|
+
* documents to tool authors what they can actually return.
|
|
26
|
+
*/
|
|
27
|
+
interface KodaXToolResultTextItem {
|
|
28
|
+
type: 'text';
|
|
29
|
+
text: string;
|
|
30
|
+
}
|
|
31
|
+
interface KodaXToolResultImageItem {
|
|
32
|
+
type: 'image';
|
|
33
|
+
/** Absolute path to the image file. Provider serializers read it into base64 at wire-send time. */
|
|
34
|
+
path: string;
|
|
35
|
+
mediaType?: string;
|
|
36
|
+
}
|
|
37
|
+
type KodaXToolResultContentItem = KodaXToolResultTextItem | KodaXToolResultImageItem;
|
|
16
38
|
interface KodaXToolResultBlock {
|
|
17
39
|
type: 'tool_result';
|
|
18
40
|
tool_use_id: string;
|
|
19
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Either a plain text string (backwards-compatible default) OR an array
|
|
43
|
+
* of content items. The array form lets multimodal-capable tools (e.g.
|
|
44
|
+
* `read` on an image path) emit images via tool_result, mirroring
|
|
45
|
+
* claudecode's `Read` tool behavior. Providers serialize each variant
|
|
46
|
+
* to their wire format; text-only providers (e.g. older OpenAI-compat
|
|
47
|
+
* gateways) downgrade image items to a placeholder rather than rejecting.
|
|
48
|
+
*/
|
|
49
|
+
content: string | readonly KodaXToolResultContentItem[];
|
|
20
50
|
is_error?: boolean;
|
|
21
51
|
}
|
|
22
52
|
interface KodaXImageBlock {
|
|
@@ -189,6 +219,24 @@ interface KodaXModelDescriptor {
|
|
|
189
219
|
maxOutputTokens?: number;
|
|
190
220
|
thinkingBudgetCap?: number;
|
|
191
221
|
reasoningCapability?: KodaXReasoningCapability;
|
|
222
|
+
/**
|
|
223
|
+
* Per-model override for `replayReasoningContent`. Falls through to the
|
|
224
|
+
* provider-level flag when undefined. Lets a single gateway endpoint
|
|
225
|
+
* route models that need the flag (DeepSeek V4) alongside models that
|
|
226
|
+
* would 400 if the flag were on (OpenAI proper).
|
|
227
|
+
*/
|
|
228
|
+
replayReasoningContent?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Per-model override for `strictThinkingSignature`. Falls through to
|
|
231
|
+
* the provider-level flag when undefined.
|
|
232
|
+
*/
|
|
233
|
+
strictThinkingSignature?: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Per-model override for `streamMaxDurationMs`. Falls through to the
|
|
236
|
+
* provider-level cap when undefined; undefined at both levels disables
|
|
237
|
+
* the watchdog.
|
|
238
|
+
*/
|
|
239
|
+
streamMaxDurationMs?: number;
|
|
192
240
|
}
|
|
193
241
|
type KodaXProtocolFamily = 'anthropic' | 'openai';
|
|
194
242
|
type KodaXProviderUserAgentMode = 'compat' | 'sdk';
|
|
@@ -217,6 +265,28 @@ interface KodaXCustomProviderConfig {
|
|
|
217
265
|
contextWindow?: number;
|
|
218
266
|
maxOutputTokens?: number;
|
|
219
267
|
thinkingBudgetCap?: number;
|
|
268
|
+
/**
|
|
269
|
+
* Provider-level default for OpenAI-compat `reasoning_content` echo.
|
|
270
|
+
* Required by DeepSeek V4 thinking mode (replay 400s without it).
|
|
271
|
+
* Defaults to false — must stay false for OpenAI proper or any gateway
|
|
272
|
+
* that rejects unknown fields. Per-model values in `models[]` can
|
|
273
|
+
* override on a model-by-model basis.
|
|
274
|
+
*/
|
|
275
|
+
replayReasoningContent?: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Provider-level default for strict Anthropic thinking-signature
|
|
278
|
+
* verification. Only Anthropic proper cryptographically verifies
|
|
279
|
+
* signatures — third-party Anthropic-compat gateways must keep this
|
|
280
|
+
* false (default). Per-model values in `models[]` can override.
|
|
281
|
+
*/
|
|
282
|
+
strictThinkingSignature?: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Provider-level default streaming wall-clock cap (ms). Set just below
|
|
285
|
+
* a known server-side kill window (zhipu-coding 308s → 300_000). Leave
|
|
286
|
+
* unset to disable the watchdog. Per-model values in `models[]` can
|
|
287
|
+
* override.
|
|
288
|
+
*/
|
|
289
|
+
streamMaxDurationMs?: number;
|
|
220
290
|
}
|
|
221
291
|
interface KodaXProviderConfig {
|
|
222
292
|
apiKeyEnv: string;
|
|
@@ -327,42 +397,4 @@ interface KodaXProviderStreamOptions {
|
|
|
327
397
|
signal?: AbortSignal;
|
|
328
398
|
}
|
|
329
399
|
|
|
330
|
-
|
|
331
|
-
* Layer A Primitive: Capability provider contract.
|
|
332
|
-
*
|
|
333
|
-
* FEATURE_082 (v0.7.24): extracted from `@kodax-ai/coding/src/extensions/types.ts`
|
|
334
|
-
* so third-party capability sources (MCP, RAG, custom indexes, …) can
|
|
335
|
-
* implement `CapabilityProvider` without importing from the coding preset.
|
|
336
|
-
*
|
|
337
|
-
* The richer "extension runtime" concept (command registration, file
|
|
338
|
-
* contributions, logger plumbing) stays in `@kodax-ai/coding/src/extensions/`
|
|
339
|
-
* because it is coupled to the coding CLI surface.
|
|
340
|
-
*/
|
|
341
|
-
type CapabilityKind = 'tool' | 'resource' | 'prompt';
|
|
342
|
-
interface CapabilityResult {
|
|
343
|
-
kind: CapabilityKind;
|
|
344
|
-
content?: string;
|
|
345
|
-
structuredContent?: unknown;
|
|
346
|
-
evidence?: unknown[];
|
|
347
|
-
artifacts?: unknown[];
|
|
348
|
-
metadata?: Record<string, unknown>;
|
|
349
|
-
}
|
|
350
|
-
interface CapabilityProvider {
|
|
351
|
-
id: string;
|
|
352
|
-
kinds: CapabilityKind[];
|
|
353
|
-
search?: (query: string, options?: {
|
|
354
|
-
kind?: CapabilityKind;
|
|
355
|
-
limit?: number;
|
|
356
|
-
server?: string;
|
|
357
|
-
}) => Promise<unknown[]>;
|
|
358
|
-
describe?: (id: string) => Promise<unknown>;
|
|
359
|
-
execute?: (id: string, input: Record<string, unknown>) => Promise<CapabilityResult>;
|
|
360
|
-
read?: (id: string, options?: Record<string, unknown>) => Promise<CapabilityResult>;
|
|
361
|
-
getPrompt?: (id: string, args?: Record<string, unknown>) => Promise<unknown>;
|
|
362
|
-
getPromptContext?: () => Promise<string | undefined> | string | undefined;
|
|
363
|
-
getDiagnostics?: () => Record<string, unknown> | undefined;
|
|
364
|
-
refresh?: () => Promise<void>;
|
|
365
|
-
dispose?: () => Promise<void>;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
export type { KodaXToolResultBlock as $, KodaXProviderSessionSupport as A, KodaXProviderStreamOptions as B, CapabilityKind as C, KodaXProviderToolCallingFidelity as D, KodaXProviderTransport as E, KodaXReasoningCapability as F, KodaXReasoningMode as G, KodaXReasoningOverride as H, KodaXReasoningRequest as I, KodaXRedactedThinkingBlock as J, KodaXAmaControllerDecision as K, KodaXReviewScale as L, KodaXRiskLevel as M, KodaXStreamResult as N, KodaXTaskActionability as O, KodaXTaskBudgetOverrides as P, KodaXTaskComplexity as Q, KodaXTaskFamily as R, KodaXTaskRoutingDecision as S, KodaXTaskType as T, KodaXTaskWorkIntent as U, KodaXTextBlock as V, KodaXThinkingBlock as W, KodaXThinkingBudgetMap as X, KodaXThinkingDepth as Y, KodaXTokenUsage as Z, KodaXToolDefinition as _, CapabilityProvider as a, KodaXToolUseBlock as a0, CapabilityResult as b, KodaXAmaFanoutClass as c, KodaXAmaFanoutPolicy as d, KodaXAmaProfile as e, KodaXAmaTactic as f, KodaXAssuranceIntent as g, KodaXCacheBoundary as h, KodaXContentBlock as i, KodaXCustomProviderConfig as j, KodaXExecutionMode as k, KodaXExecutionPattern as l, KodaXHarnessProfile as m, KodaXImageBlock as n, KodaXMessage as o, KodaXModelDescriptor as p, KodaXMutationSurface as q, KodaXProtocolFamily as r, KodaXProviderCapabilityProfile as s, KodaXProviderConfig as t, KodaXProviderContextFidelity as u, KodaXProviderConversationSemantics as v, KodaXProviderEvidenceSupport as w, KodaXProviderLongRunningSupport as x, KodaXProviderMcpSupport as y, KodaXProviderMultimodalSupport as z };
|
|
400
|
+
export type { KodaXToolResultTextItem as $, KodaXProviderToolCallingFidelity as A, KodaXProviderTransport as B, KodaXReasoningCapability as C, KodaXReasoningMode as D, KodaXReasoningOverride as E, KodaXReasoningRequest as F, KodaXRedactedThinkingBlock as G, KodaXReviewScale as H, KodaXRiskLevel as I, KodaXStreamResult as J, KodaXAmaControllerDecision as K, KodaXTaskActionability as L, KodaXTaskBudgetOverrides as M, KodaXTaskComplexity as N, KodaXTaskFamily as O, KodaXTaskRoutingDecision as P, KodaXTaskType as Q, KodaXTaskWorkIntent as R, KodaXTextBlock as S, KodaXThinkingBlock as T, KodaXThinkingBudgetMap as U, KodaXThinkingDepth as V, KodaXTokenUsage as W, KodaXToolDefinition as X, KodaXToolResultBlock as Y, KodaXToolResultContentItem as Z, KodaXToolResultImageItem as _, KodaXAmaFanoutClass as a, KodaXToolUseBlock as a0, KodaXAmaFanoutPolicy as b, KodaXAmaProfile as c, KodaXAmaTactic as d, KodaXAssuranceIntent as e, KodaXCacheBoundary as f, KodaXContentBlock as g, KodaXCustomProviderConfig as h, KodaXExecutionMode as i, KodaXExecutionPattern as j, KodaXHarnessProfile as k, KodaXImageBlock as l, KodaXMessage as m, KodaXModelDescriptor as n, KodaXMutationSurface as o, KodaXProtocolFamily as p, KodaXProviderCapabilityProfile as q, KodaXProviderConfig as r, KodaXProviderContextFidelity as s, KodaXProviderConversationSemantics as t, KodaXProviderEvidenceSupport as u, KodaXProviderLongRunningSupport as v, KodaXProviderMcpSupport as w, KodaXProviderMultimodalSupport as x, KodaXProviderSessionSupport as y, KodaXProviderStreamOptions as z };
|