@kodax-ai/kodax 0.7.56 → 0.7.58
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 +2004 -1887
- package/README.md +52 -48
- package/README_CN.md +37 -32
- package/dist/builtin/code-review/SKILL.md +22 -3
- package/dist/chunks/agent-YJNC2755.js +2 -0
- package/dist/chunks/argument-completer-QGBNXTYJ.js +2 -0
- package/dist/chunks/chunk-526OILYL.js +2 -0
- package/dist/chunks/{chunk-ZBK3DZ3S.js → chunk-6AU6EPO6.js} +1 -1
- package/dist/chunks/chunk-73Z7BK5H.js +15 -0
- package/dist/chunks/chunk-7QB55SYG.js +326 -0
- package/dist/chunks/chunk-CQ6EQG7E.js +322 -0
- package/dist/chunks/chunk-CV6JHPEO.js +2 -0
- package/dist/chunks/chunk-D6QVXQNI.js +1 -0
- package/dist/chunks/chunk-HS2K74I4.js +31 -0
- package/dist/chunks/chunk-NKHXRN7G.js +403 -0
- package/dist/chunks/chunk-OBPB5BQ6.js +310 -0
- package/dist/chunks/chunk-P4VF3JEP.js +7 -0
- package/dist/chunks/chunk-PIQWODWN.js +18 -0
- package/dist/chunks/chunk-QHWXPJEG.js +601 -0
- package/dist/chunks/chunk-XXEIFNBE.js +52 -0
- package/dist/chunks/chunk-ZZDC75H4.js +681 -0
- package/dist/chunks/compaction-config-OPMRZSAK.js +2 -0
- package/dist/chunks/{construction-bootstrap-EDDVNP2B.js → construction-bootstrap-CIXFH5SE.js} +4 -4
- package/dist/chunks/dist-JSE7NICF.js +2 -0
- package/dist/chunks/dist-SDNQOW52.js +2 -0
- package/dist/chunks/host-H7FQMMRC.js +2 -0
- package/dist/chunks/{paste-5IDBBQQ3.js → paste-Y4DVUWSM.js} +1 -1
- package/dist/chunks/run-manager-4H5HWMVW.js +2 -0
- package/dist/chunks/utils-FLVVQHM7.js +2 -0
- package/dist/index.d.ts +22 -18
- package/dist/index.js +6 -6
- package/dist/kodax_cli.js +1303 -1108
- package/dist/provider-capabilities.json +986 -197
- package/dist/sdk-agent.d.ts +162 -14
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +285 -255
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.d.ts +66 -43
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +64 -5
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +114 -107
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-session.d.ts +7 -7
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +11 -0
- package/dist/types-chunks/{base.d-CwPfI8WQ.d.ts → base.d-BA9Doaj_.d.ts} +38 -8
- package/dist/types-chunks/{bash-prefix-extractor.d-DZF1gDDz.d.ts → bash-prefix-extractor.d-D3cddmyV.d.ts} +639 -163
- package/dist/types-chunks/capability-learning.d-DRV80ISB.d.ts +29 -0
- package/dist/types-chunks/{cost-tracker.d-wRtyEW9d.d.ts → cost-tracker.d-CBLk1fiD.d.ts} +24 -2
- package/dist/types-chunks/{guardrail.d-DQQknOfb.d.ts → guardrail.d-iK7FwMdW.d.ts} +32 -10
- package/dist/types-chunks/{manager.d-DLmDhX3i.d.ts → manager.d-DBD7SOTT.d.ts} +7 -2
- package/dist/types-chunks/{process.d-BdiIUr8T.d.ts → process.d-DHow2y2G.d.ts} +170 -14
- package/dist/types-chunks/{resolver.d-Djq8KlCE.d.ts → resolver.d-DDOfVYDr.d.ts} +111 -18
- package/dist/types-chunks/{capsule.d-D0kjnqYy.d.ts → run-manager.d-ByDcJc5g.d.ts} +124 -13
- package/dist/types-chunks/{sdk-session-BP6ZNpOp.d.ts → sdk-session-21Tt3N_x.d.ts} +74 -9
- package/dist/types-chunks/{storage.d-CkydxFsV.d.ts → storage.d-BsZrBPYu.d.ts} +2 -2
- package/dist/types-chunks/{types.d-BJmoMf5H.d.ts → types.d-Ci5YPFEh.d.ts} +135 -22
- package/dist/types-chunks/{types.d-BKuHSiR0.d.ts → types.d-D4ZA8LJV.d.ts} +7 -3
- package/dist/types-chunks/{utils.d-bC97IuQZ.d.ts → utils.d-BURxOxFd.d.ts} +94 -19
- package/package.json +12 -7
- package/dist/chunks/agent-MAAKRAF2.js +0 -2
- package/dist/chunks/argument-completer-OWEXGWNL.js +0 -2
- package/dist/chunks/chunk-4OHXHC2S.js +0 -314
- package/dist/chunks/chunk-5YJIAP6C.js +0 -551
- package/dist/chunks/chunk-7EAGBLRV.js +0 -2
- package/dist/chunks/chunk-CDGOEK3T.js +0 -31
- package/dist/chunks/chunk-DHETLULC.js +0 -425
- package/dist/chunks/chunk-JCDO2FR4.js +0 -584
- package/dist/chunks/chunk-NZVJ3DFC.js +0 -656
- package/dist/chunks/chunk-QI3MRJGU.js +0 -5
- package/dist/chunks/chunk-XXQ3RLA2.js +0 -2
- package/dist/chunks/compaction-config-NAJEEPG5.js +0 -2
- package/dist/chunks/dist-2267YGB5.js +0 -2
- package/dist/chunks/dist-GW32CHO5.js +0 -2
- package/dist/chunks/utils-J7XBBZGB.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as KodaXReasoningMode,
|
|
1
|
+
import { E as KodaXReasoningMode, L as KodaXStableEffortIntent, a6 as KodaXWireReasoningEffort, F as KodaXReasoningProfile, W as KodaXThinkingBudgetMap, X as KodaXThinkingDepth, p as KodaXProviderConfig, A as KodaXReasoningCapability, G as KodaXReasoningRequest, m as KodaXNormalizedReasoningRequest, S as KodaXTaskType, a4 as KodaXVerifyCredentialResult, _ as KodaXToolDefinition, j as KodaXMessage, x as KodaXProviderStreamOptions, M as KodaXStreamResult, k as KodaXModelDescriptor, o as KodaXProviderCapabilityProfile, a5 as KodaXVerifyStrategy, d as KodaXCustomProviderConfig, i as KodaXListModelsResult } from './types.d-Ci5YPFEh.js';
|
|
2
2
|
import Anthropic from '@anthropic-ai/sdk';
|
|
3
|
-
import { K as KodaXBaseProvider } from './base.d-
|
|
3
|
+
import { K as KodaXBaseProvider } from './base.d-BA9Doaj_.js';
|
|
4
4
|
import OpenAI from 'openai';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -34,23 +34,58 @@ declare class KodaXToolCallIdError extends KodaXError {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
declare const KODAX_REASONING_MODE_SEQUENCE: KodaXReasoningMode[];
|
|
37
|
+
declare const KODAX_STABLE_EFFORT_INTENTS: KodaXStableEffortIntent[];
|
|
37
38
|
declare const KODAX_DEFAULT_THINKING_BUDGETS: KodaXThinkingBudgetMap;
|
|
38
39
|
declare const KODAX_REASONING_SAFETY_RESERVE = 4096;
|
|
39
40
|
declare function getReasoningCapability(config: KodaXProviderConfig): KodaXReasoningCapability;
|
|
40
41
|
declare function isReasoningEnabled(reasoning?: boolean | KodaXReasoningRequest): boolean;
|
|
41
|
-
declare function normalizeReasoningRequest(reasoning?: boolean | KodaXReasoningRequest):
|
|
42
|
+
declare function normalizeReasoningRequest(reasoning?: boolean | KodaXReasoningRequest): KodaXNormalizedReasoningRequest;
|
|
43
|
+
type KodaXReasoningEffortEnvOverride = {
|
|
44
|
+
kind: 'unset';
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'clear';
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'value';
|
|
49
|
+
value: KodaXWireReasoningEffort;
|
|
50
|
+
};
|
|
51
|
+
type KodaXReasoningEffortSource = 'env' | 'explicit' | 'session' | 'legacy' | 'model-default' | 'provider-default' | 'fallback';
|
|
52
|
+
interface KodaXResolvedReasoningEffort {
|
|
53
|
+
readonly configuredEffort: KodaXWireReasoningEffort;
|
|
54
|
+
readonly effectiveEffort?: KodaXWireReasoningEffort;
|
|
55
|
+
readonly source: KodaXReasoningEffortSource;
|
|
56
|
+
readonly isExplicit: boolean;
|
|
57
|
+
readonly diagnostics: readonly string[];
|
|
58
|
+
}
|
|
59
|
+
interface KodaXResolveReasoningEffortInput {
|
|
60
|
+
readonly capability?: KodaXReasoningProfile;
|
|
61
|
+
readonly envEffort?: string;
|
|
62
|
+
readonly explicitEffort?: string;
|
|
63
|
+
readonly sessionEffort?: string;
|
|
64
|
+
readonly legacyReasoningMode?: KodaXReasoningMode;
|
|
65
|
+
readonly thinking?: boolean;
|
|
66
|
+
readonly modelDefaultEffort?: string;
|
|
67
|
+
readonly providerDefaultEffort?: string;
|
|
68
|
+
readonly fallbackEffort?: string;
|
|
69
|
+
}
|
|
70
|
+
interface KodaXModelSwitchEffortResolution {
|
|
71
|
+
readonly effectiveEffort?: KodaXWireReasoningEffort;
|
|
72
|
+
readonly preserved: boolean;
|
|
73
|
+
readonly diagnostic?: string;
|
|
74
|
+
}
|
|
75
|
+
declare function normalizeReasoningEffortValue(value: string): KodaXWireReasoningEffort;
|
|
76
|
+
declare function mapLegacyReasoningModeToEffortIntent(mode: KodaXReasoningMode): KodaXStableEffortIntent;
|
|
77
|
+
declare function effortToLegacyReasoningMode(effort: string | undefined): KodaXReasoningMode | undefined;
|
|
78
|
+
declare function parseReasoningEffortEnv(raw: string | undefined): KodaXReasoningEffortEnvOverride;
|
|
79
|
+
declare function resolveReasoningEffort(input: KodaXResolveReasoningEffortInput): KodaXResolvedReasoningEffort;
|
|
80
|
+
declare function resolveReasoningEffortForModelSwitch(input: {
|
|
81
|
+
readonly currentEffort: string | undefined;
|
|
82
|
+
readonly capability?: KodaXReasoningProfile;
|
|
83
|
+
}): KodaXModelSwitchEffortResolution;
|
|
42
84
|
declare function getDefaultThinkingDepthForMode(mode: KodaXReasoningMode): KodaXThinkingDepth;
|
|
43
85
|
declare function resolveThinkingBudget(config: KodaXProviderConfig, depth: KodaXThinkingDepth, taskType?: KodaXTaskType): number;
|
|
44
86
|
declare function clampThinkingBudget(requestedBudget: number, maxOutputTokens: number, safetyReserve?: number): number;
|
|
45
87
|
declare function mapDepthToOpenAIReasoningEffort(depth: KodaXThinkingDepth): 'low' | 'medium' | 'high' | undefined;
|
|
46
88
|
|
|
47
|
-
declare function reasoningCapabilityToOverride(capability: KodaXReasoningCapability): KodaXReasoningOverride | undefined;
|
|
48
|
-
declare function reasoningOverrideToCapability(override: KodaXReasoningOverride): KodaXReasoningCapability;
|
|
49
|
-
declare function buildReasoningOverrideKey(providerName: string, config: Pick<KodaXProviderConfig, 'baseUrl' | 'model'>, modelOverride?: string): string;
|
|
50
|
-
declare function loadReasoningOverride(providerName: string, config: Pick<KodaXProviderConfig, 'baseUrl' | 'model'>, modelOverride?: string): KodaXReasoningOverride | undefined;
|
|
51
|
-
declare function saveReasoningOverride(providerName: string, config: Pick<KodaXProviderConfig, 'baseUrl' | 'model'>, override: KodaXReasoningOverride, modelOverride?: string): void;
|
|
52
|
-
declare function clearReasoningOverride(providerName: string, config: Pick<KodaXProviderConfig, 'baseUrl' | 'model'>, modelOverride?: string): void;
|
|
53
|
-
|
|
54
89
|
/**
|
|
55
90
|
* KodaX Anthropic Compatible Provider
|
|
56
91
|
*
|
|
@@ -73,6 +108,9 @@ declare abstract class KodaXAnthropicCompatProvider extends KodaXBaseProvider {
|
|
|
73
108
|
protected set client(client: Anthropic);
|
|
74
109
|
protected buildClient(): Anthropic;
|
|
75
110
|
protected onStaleConnection(): void;
|
|
111
|
+
private buildMessageCreateOptions;
|
|
112
|
+
private applyReasoningProfile;
|
|
113
|
+
private resolveReasoningProfileBudget;
|
|
76
114
|
/**
|
|
77
115
|
* FEATURE_216 v0.7.45 — Lightweight credential verification.
|
|
78
116
|
* Dispatches by `this.config.verifyStrategy`:
|
|
@@ -103,6 +141,14 @@ declare abstract class KodaXAnthropicCompatProvider extends KodaXBaseProvider {
|
|
|
103
141
|
* original string unchanged so prompt caching can be disabled at
|
|
104
142
|
* runtime without redeploying.
|
|
105
143
|
*/
|
|
144
|
+
/**
|
|
145
|
+
* Run-scoped (concurrency-safe) config wins over the global env, in BOTH
|
|
146
|
+
* directions: an SDK caller that explicitly sets `disablePromptCache: false`
|
|
147
|
+
* re-enables caching even when `KODAX_DISABLE_PROMPT_CACHE=1` is set at
|
|
148
|
+
* startup (e.g. bridged from `config.json`). A plain `||` would let the env
|
|
149
|
+
* win in that re-enable case, breaking the documented SDK > env precedence.
|
|
150
|
+
*/
|
|
151
|
+
private isPromptCacheDisabled;
|
|
106
152
|
protected applyCacheControlToSystem(systemText: string): string | Anthropic.Messages.TextBlockParam[];
|
|
107
153
|
/**
|
|
108
154
|
* FEATURE_116 (v0.7.37) — Mark the last tool definition as the cache
|
|
@@ -113,12 +159,51 @@ declare abstract class KodaXAnthropicCompatProvider extends KodaXBaseProvider {
|
|
|
113
159
|
* Returns a new array; never mutates input.
|
|
114
160
|
*/
|
|
115
161
|
protected applyCacheControlToTools(tools: KodaXToolDefinition[]): Anthropic.Messages.Tool[];
|
|
162
|
+
/**
|
|
163
|
+
* FEATURE_116 follow-up — Place an incremental cache breakpoint on the
|
|
164
|
+
* conversation history (Anthropic breakpoint 3). The system prompt and
|
|
165
|
+
* tools already carry breakpoints 1 & 2 (applyCacheControlToSystem /
|
|
166
|
+
* applyCacheControlToTools); without a message-level breakpoint the whole
|
|
167
|
+
* growing transcript is re-billed as uncached input every turn.
|
|
168
|
+
*
|
|
169
|
+
* Strategy: mark the LAST content block of the second-to-last `user` turn.
|
|
170
|
+
* The most recent user turn is skipped — it is the current, still-changing
|
|
171
|
+
* input. The prior user turn's content is settled, so its prefix is a stable
|
|
172
|
+
* cache write-point that later turns read back incrementally (Anthropic caches
|
|
173
|
+
* the whole prefix up to and including the marked block: tools + system + all
|
|
174
|
+
* earlier messages). Total breakpoints stay at 3 (≤ Anthropic's limit of 4).
|
|
175
|
+
*
|
|
176
|
+
* Only anthropic-compat providers reach this path; OpenAI/ACP strip cache
|
|
177
|
+
* markers and rely on upstream automatic prefix caching. Escape hatch:
|
|
178
|
+
* `KODAX_DISABLE_PROMPT_CACHE=1` returns the array untouched.
|
|
179
|
+
*
|
|
180
|
+
* Returns a new array; never mutates input.
|
|
181
|
+
*/
|
|
182
|
+
protected applyCacheControlToMessages(messages: Anthropic.Messages.MessageParam[]): Anthropic.Messages.MessageParam[];
|
|
116
183
|
stream(messages: KodaXMessage[], tools: KodaXToolDefinition[], system: string, reasoning?: boolean | KodaXReasoningRequest, streamOptions?: KodaXProviderStreamOptions, signal?: AbortSignal): Promise<KodaXStreamResult>;
|
|
117
184
|
supportsNonStreamingFallback(): boolean;
|
|
118
185
|
complete(messages: KodaXMessage[], tools: KodaXToolDefinition[], system: string, reasoning?: boolean | KodaXReasoningRequest, streamOptions?: KodaXProviderStreamOptions, signal?: AbortSignal): Promise<KodaXStreamResult>;
|
|
119
186
|
private serializeSystemMessageContent;
|
|
120
187
|
private buildSystemPrompt;
|
|
121
188
|
private convertMessages;
|
|
189
|
+
/**
|
|
190
|
+
* Wire-only defense-in-depth: drop orphan `tool_use` / `tool_result` blocks
|
|
191
|
+
* so the Anthropic API never 400s on "tool_use ids ... were not found in
|
|
192
|
+
* tool_result blocks" or "unexpected tool_result". The upstream
|
|
193
|
+
* `validateAndFixToolHistory` (run every turn before serialization) is the
|
|
194
|
+
* primary guard; this mirrors the OpenAI-side `repairToolCallHistory` so
|
|
195
|
+
* both provider families have the same last-mile net for any path that
|
|
196
|
+
* bypasses validate (custom callers, side queries). Never mutates input.
|
|
197
|
+
*
|
|
198
|
+
* Pairing is computed against adjacent messages (same rule as validate): a
|
|
199
|
+
* `tool_use` is orphan when the immediately-following user message has no
|
|
200
|
+
* matching `tool_result`; a `tool_result` is orphan when the
|
|
201
|
+
* immediately-preceding assistant message has no matching `tool_use`. A
|
|
202
|
+
* message emptied by repair is replaced with a minimal wire-only `'...'`
|
|
203
|
+
* text block to keep user/assistant alternation and satisfy gateways that
|
|
204
|
+
* reject empty content.
|
|
205
|
+
*/
|
|
206
|
+
private repairToolCallHistory;
|
|
122
207
|
}
|
|
123
208
|
|
|
124
209
|
/**
|
|
@@ -193,6 +278,8 @@ declare abstract class KodaXOpenAICompatProvider extends KodaXBaseProvider {
|
|
|
193
278
|
private appendExtraBody;
|
|
194
279
|
private resetReasoningCapabilityParams;
|
|
195
280
|
private applyReasoningCapability;
|
|
281
|
+
private applyReasoningProfile;
|
|
282
|
+
private resolveReasoningProfileBudget;
|
|
196
283
|
private getFallbackTerms;
|
|
197
284
|
stream(messages: KodaXMessage[], tools: KodaXToolDefinition[], system: string, reasoning?: boolean | KodaXReasoningRequest, streamOptions?: KodaXProviderStreamOptions, signal?: AbortSignal): Promise<KodaXStreamResult>;
|
|
198
285
|
supportsNonStreamingFallback(): boolean;
|
|
@@ -208,10 +295,10 @@ declare abstract class KodaXOpenAICompatProvider extends KodaXBaseProvider {
|
|
|
208
295
|
/**
|
|
209
296
|
* KodaX Provider Registry
|
|
210
297
|
*
|
|
211
|
-
|
|
298
|
+
* Provider 注册表 - 统一管理所有 Provider
|
|
212
299
|
*/
|
|
213
300
|
|
|
214
|
-
type ProviderName = 'anthropic' | 'openai' | 'deepseek' | 'kimi' | 'kimi-code' | 'qwen' | 'zhipu' | 'zhipu-coding' | 'minimax-coding' | 'mimo-coding' | 'mimo' | 'ark-coding' | 'gemini-cli' | 'codex-cli';
|
|
301
|
+
type ProviderName = 'anthropic' | 'openai' | 'deepseek' | 'kimi' | 'kimi-code' | 'qwen' | 'zhipu' | 'zhipu-coding' | 'zai-coding' | 'minimax-coding' | 'mimo-coding' | 'mimo' | 'ark-coding' | 'gemini-cli' | 'codex-cli';
|
|
215
302
|
/**
|
|
216
303
|
* Per-provider static metadata. v0.7.43 promoted this from a partial
|
|
217
304
|
* descriptor (`models: string[]`) to the full capability surface so
|
|
@@ -240,6 +327,7 @@ type ProviderSnapshot = {
|
|
|
240
327
|
readonly models?: readonly KodaXModelDescriptor[];
|
|
241
328
|
readonly apiKeyEnv: string;
|
|
242
329
|
readonly reasoningCapability: KodaXReasoningCapability;
|
|
330
|
+
readonly reasoningProfile?: KodaXReasoningProfile;
|
|
243
331
|
readonly modelReasoningCapabilities?: Readonly<Record<string, KodaXReasoningCapability>>;
|
|
244
332
|
readonly capabilityProfile: KodaXProviderCapabilityProfile;
|
|
245
333
|
/** Maximum input context window (tokens). Provider-level default. */
|
|
@@ -271,6 +359,7 @@ declare function getProviderList(): Array<{
|
|
|
271
359
|
models: string[];
|
|
272
360
|
configured: boolean;
|
|
273
361
|
reasoningCapability: KodaXReasoningCapability;
|
|
362
|
+
reasoningProfile?: KodaXReasoningProfile;
|
|
274
363
|
capabilityProfile: KodaXProviderCapabilityProfile;
|
|
275
364
|
}>;
|
|
276
365
|
declare function getProviderModels(name: string): string[];
|
|
@@ -305,6 +394,8 @@ interface KodaXModelCapabilities {
|
|
|
305
394
|
supportsThinking: boolean;
|
|
306
395
|
/** Effective reasoning capability for THIS model (per-model override aware). */
|
|
307
396
|
reasoningCapability: KodaXReasoningCapability;
|
|
397
|
+
/** Effort-first reasoning capability metadata for THIS model, when known. */
|
|
398
|
+
reasoningProfile?: KodaXReasoningProfile;
|
|
308
399
|
/** Maximum input context window (tokens). `undefined` for CLI-bridge providers. */
|
|
309
400
|
contextWindow?: number;
|
|
310
401
|
/**
|
|
@@ -331,10 +422,12 @@ interface KodaXModelCapabilities {
|
|
|
331
422
|
*/
|
|
332
423
|
declare function getProviderModelDescriptors(name: string): KodaXModelDescriptor[];
|
|
333
424
|
/**
|
|
334
|
-
* Effective per-model capability surface for a built-in provider.
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
425
|
+
* Effective per-model capability surface for a built-in provider.
|
|
426
|
+
*
|
|
427
|
+
* Returns `undefined` only for an unknown PROVIDER name. An unknown MODEL under
|
|
428
|
+
* a known provider inherits the provider-level capability (optimistic-wide
|
|
429
|
+
* default — see the inline note below), so callers always get a usable surface
|
|
430
|
+
* for any model id routed to a known provider.
|
|
338
431
|
*
|
|
339
432
|
* No API key required.
|
|
340
433
|
*/
|
|
@@ -501,5 +594,5 @@ declare function listProviderModels(name: string, _opts?: {
|
|
|
501
594
|
signal?: AbortSignal;
|
|
502
595
|
}): Promise<KodaXListModelsResult>;
|
|
503
596
|
|
|
504
|
-
export {
|
|
505
|
-
export type { ProviderName as P, KodaXModelCapabilities as
|
|
597
|
+
export { parseReasoningEffortEnv as $, getModelCapabilities as A, getProvider as B, getProviderConfiguredCapabilityProfile as C, getProviderConfiguredReasoningCapability as D, getProviderList as E, getProviderModel as F, getProviderModelDescriptors as G, getProviderModels as H, getReasoningCapability as I, getRuntimeModelProvider as J, KODAX_DEFAULT_PROVIDER as K, getRuntimeModelProviderNames as L, isCustomProviderName as M, isKnownProvider as N, isProviderConfigured as O, isProviderName as Q, isReasoningEnabled as R, isRuntimeModelProviderName as S, listAllModelCapabilities as T, listBuiltinModelCapabilities as U, listCustomProviderModelCapabilities as V, listProviderModels as W, mapDepthToOpenAIReasoningEffort as X, mapLegacyReasoningModeToEffortIntent as Y, normalizeReasoningEffortValue as Z, normalizeReasoningRequest as _, KODAX_DEFAULT_THINKING_BUDGETS as a, registerCustomProviders as a0, registerModelProvider as a1, resolveModelCapabilities as a2, resolveProvider as a3, resolveProviderModelDescriptors as a4, resolveReasoningEffort as a5, resolveReasoningEffortForModelSwitch as a6, resolveThinkingBudget as a7, validateCustomProviderConfig as a8, verifyProviderCredential as a9, KODAX_PROVIDERS as b, KODAX_PROVIDER_SNAPSHOTS as c, KODAX_REASONING_MODE_SEQUENCE as d, KODAX_REASONING_SAFETY_RESERVE as e, KODAX_STABLE_EFFORT_INTENTS as f, KodaXAnthropicCompatProvider as g, KodaXError as h, KodaXNetworkError as j, KodaXOpenAICompatProvider as k, KodaXProviderError as l, KodaXRateLimitError as m, KodaXToolCallIdError as n, clampThinkingBudget as o, clearRuntimeModelProviders as p, createCustomProvider as q, effortToLegacyReasoningMode as r, getAvailableProviderNames as s, getCustomModelCapabilities as t, getCustomProvider as u, getCustomProviderList as v, getCustomProviderModelDescriptors as w, getCustomProviderModels as x, getCustomProviderNames as y, getDefaultThinkingDepthForMode as z };
|
|
598
|
+
export type { ProviderName as P, KodaXModelCapabilities as i };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Q as QueueEventListener,
|
|
3
|
-
import {
|
|
1
|
+
import { j as KodaXMessage } from './types.d-Ci5YPFEh.js';
|
|
2
|
+
import { Q as QueueEventListener, f as QueuedMessage, E as EnqueueInput, D as DequeueFilter } from './types.d-D4ZA8LJV.js';
|
|
3
|
+
import { g as AgentMessage, aU as SessionEntry, aS as Session, aW as SessionExtension, aa as KodaXSessionLineage, a0 as KodaXJsonValue, q as CompactionDetails, P as KodaXCompactMemorySeed, a6 as KodaXSessionEntry, ah as KodaXSessionTreeNode, a9 as KodaXSessionLabelEntry, a8 as KodaXSessionGoalEntry, ad as KodaXSessionNavigationOptions, a2 as KodaXSessionArtifactLedgerEntry, y as FileOperations, bz as WorkflowMeta, bA as WorkflowModelHint, bB as WorkflowModule, bQ as WorkflowProcessTrackerOptions, bs as WorkflowEvent, bK as WorkflowProcessSnapshot, bF as WorkflowProcessEvent } from './process.d-DHow2y2G.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @kodax-ai/agent Constants
|
|
@@ -188,8 +188,8 @@ declare class DefaultSummaryCompaction implements CompactionPolicy {
|
|
|
188
188
|
* before any subsystem reads the path.
|
|
189
189
|
* 2. **`KODAX_HOME` env var** — middle priority. Used by shell / CI /
|
|
190
190
|
* test isolation / multi-tenant shared machines. (Already honored
|
|
191
|
-
* historically by
|
|
192
|
-
*
|
|
191
|
+
* historically by the llm-layer config helpers; this helper makes it
|
|
192
|
+
* the canonical path for all packages.)
|
|
193
193
|
* 3. **`~/.kodax/`** — lowest priority. Default for the standalone
|
|
194
194
|
* kodax CLI. With DI not set + env not set, the resolver returns
|
|
195
195
|
* the same byte sequence as the prior hardcoded
|
|
@@ -209,9 +209,9 @@ declare class DefaultSummaryCompaction implements CompactionPolicy {
|
|
|
209
209
|
* `~/.opsagent/` simultaneously).
|
|
210
210
|
*
|
|
211
211
|
* NOT migrated:
|
|
212
|
-
* -
|
|
212
|
+
* - llm-layer config helpers keep their inline
|
|
213
213
|
* `process.env.KODAX_HOME ?? path.join(os.homedir(), '.kodax')`
|
|
214
|
-
* fallback because moving
|
|
214
|
+
* fallback because moving them to this helper would create an
|
|
215
215
|
* `@kodax-ai/llm → @kodax-ai/agent` dependency cycle (agent already
|
|
216
216
|
* imports ai). The two implementations have identical observable
|
|
217
217
|
* behavior at the env / default tiers; the programmatic override
|
|
@@ -382,8 +382,10 @@ declare function _resetMessageQueueForTests(): void;
|
|
|
382
382
|
* history and fixes mis-pairings on both sides — orphan `tool_use` in
|
|
383
383
|
* assistant messages, orphan `tool_result` in user messages, and ensures
|
|
384
384
|
* no message becomes empty after stripping (Kimi specifically rejects
|
|
385
|
-
* empty assistant messages with 400, so we inject
|
|
386
|
-
* when stripping would empty an assistant message
|
|
385
|
+
* empty assistant messages with 400, so we inject an EMPTY text-block
|
|
386
|
+
* marker when stripping would empty an assistant message — the visible
|
|
387
|
+
* `'...'` is synthesized wire-only by the provider serializer, never
|
|
388
|
+
* persisted into history).
|
|
387
389
|
*
|
|
388
390
|
* Migration history: extracted from `agent.ts` (originally lines 517–758)
|
|
389
391
|
* during FEATURE_100 P2. Both `agent.ts` and `task-engine/runner-driven.ts`
|
|
@@ -407,8 +409,9 @@ declare function _resetMessageQueueForTests(): void;
|
|
|
407
409
|
* message → removed
|
|
408
410
|
* - user `tool_result` with empty / missing tool_use_id → removed
|
|
409
411
|
* - assistant message that becomes content-empty after stripping → inject
|
|
410
|
-
*
|
|
411
|
-
* downstream providers like Kimi require
|
|
412
|
+
* an EMPTY text-block marker (preserves message-alternation invariant
|
|
413
|
+
* downstream providers like Kimi require; the visible '...' is added
|
|
414
|
+
* wire-only by the serializer, never persisted)
|
|
412
415
|
*/
|
|
413
416
|
declare function validateAndFixToolHistory(messages: KodaXMessage[]): KodaXMessage[];
|
|
414
417
|
/**
|
|
@@ -755,6 +758,13 @@ declare const WORKFLOW_CAPSULE_API_VERSION: 1;
|
|
|
755
758
|
type WorkflowCapsuleEnvironmentRequirement = 'git-repo' | 'worktree-capable';
|
|
756
759
|
interface WorkflowCapsuleIntent {
|
|
757
760
|
readonly taskClass: string;
|
|
761
|
+
/**
|
|
762
|
+
* The full set of workflow patterns the script declares (manifest.patterns).
|
|
763
|
+
* `taskClass` keeps only the primary pattern; this records the whole
|
|
764
|
+
* combination so a declared ['fan-out-and-synthesize', 'adversarial-verification']
|
|
765
|
+
* is preserved rather than collapsed to its first id.
|
|
766
|
+
*/
|
|
767
|
+
readonly patterns?: readonly string[];
|
|
758
768
|
readonly originalRequest?: string;
|
|
759
769
|
readonly reusableFor?: readonly string[];
|
|
760
770
|
readonly notFor?: readonly string[];
|
|
@@ -803,6 +813,107 @@ interface CreateWorkflowCapsuleInput {
|
|
|
803
813
|
declare function validateWorkflowCapsule(value: unknown): WorkflowCapsule;
|
|
804
814
|
declare function createWorkflowCapsule(input: CreateWorkflowCapsuleInput): WorkflowCapsule;
|
|
805
815
|
declare function createWorkflowModuleFromCapsule(capsule: WorkflowCapsule): WorkflowModule;
|
|
816
|
+
/**
|
|
817
|
+
* Single source of truth for deriving a capsule intent from a workflow manifest.
|
|
818
|
+
* `taskClass` keeps the primary pattern; the full declared set is recorded on
|
|
819
|
+
* `patterns` so a combination like ['fan-out-and-synthesize',
|
|
820
|
+
* 'adversarial-verification'] is preserved rather than collapsed to its first id
|
|
821
|
+
* (M15). Used by every capsule-save path so the propagation logic is tested once.
|
|
822
|
+
*/
|
|
823
|
+
declare function buildWorkflowCapsuleIntent(manifest: {
|
|
824
|
+
readonly patterns: readonly string[];
|
|
825
|
+
readonly name: string;
|
|
826
|
+
readonly description: string;
|
|
827
|
+
}, opts?: {
|
|
828
|
+
readonly originalRequest?: string;
|
|
829
|
+
}): WorkflowCapsuleIntent;
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* FEATURE_246 Part A0 (ADR-046) — neutral workflow run lifecycle manager.
|
|
833
|
+
*
|
|
834
|
+
* Domain-neutral run registry + lifecycle (pause / resume / stop), process-event
|
|
835
|
+
* tracking, and terminal settle — lifted out of `@kodax-ai/coding` so any agent
|
|
836
|
+
* (including non-coding SDK hosts) can host and manage workflow runs.
|
|
837
|
+
*
|
|
838
|
+
* It never knows HOW a run executes: the caller injects a `runFn` thunk that
|
|
839
|
+
* receives lifecycle hooks (`onEvent` / `signal` / `beforeSpawn`) and returns a
|
|
840
|
+
* caller-shaped outcome, plus a `classify` mapping that outcome to a neutral
|
|
841
|
+
* terminal status and an `onError` that synthesizes a failure outcome. The
|
|
842
|
+
* coding layer wires `runFn` to its `runWorkflowModule` / `runWorkflowFromOptions`
|
|
843
|
+
* (backend + run-graph + worktrees); SDK hosts wire their own. Dependency arrows
|
|
844
|
+
* therefore point only coding → agent — no cycle.
|
|
845
|
+
*/
|
|
846
|
+
|
|
847
|
+
type ManagedWorkflowStatus = 'running' | 'paused' | 'completed' | 'failed' | 'denied' | 'stopped';
|
|
848
|
+
/** Provenance/display metadata for a run's process tracker. */
|
|
849
|
+
type WorkflowProcessMetadata = Pick<WorkflowProcessTrackerOptions, 'displayName' | 'goal' | 'source' | 'savedWorkflowName' | 'sourceRunId' | 'sourceWorkflowName' | 'revisionOf' | 'hostMetadata'>;
|
|
850
|
+
interface ManagedWorkflowSnapshot {
|
|
851
|
+
readonly runId: string;
|
|
852
|
+
readonly workflow: string;
|
|
853
|
+
readonly status: ManagedWorkflowStatus;
|
|
854
|
+
readonly totalSpawned: number;
|
|
855
|
+
readonly eventCount: number;
|
|
856
|
+
readonly startedAt: number;
|
|
857
|
+
readonly endedAt?: number;
|
|
858
|
+
readonly error?: string;
|
|
859
|
+
readonly resultText?: string;
|
|
860
|
+
}
|
|
861
|
+
interface ManagedWorkflowRun<TOutcome = unknown> {
|
|
862
|
+
readonly runId: string;
|
|
863
|
+
readonly done: Promise<TOutcome>;
|
|
864
|
+
getSnapshot(): ManagedWorkflowSnapshot | undefined;
|
|
865
|
+
getProcessSnapshot(): WorkflowProcessSnapshot | undefined;
|
|
866
|
+
}
|
|
867
|
+
/** Lifecycle hooks the manager injects into the caller's `runFn`. */
|
|
868
|
+
interface ManagedRunHooks {
|
|
869
|
+
/** Forward every workflow event so the manager can track spawn/progress. */
|
|
870
|
+
readonly onEvent: (event: WorkflowEvent) => void;
|
|
871
|
+
/** Abort signal owned by the manager (fires on stop()). */
|
|
872
|
+
readonly signal: AbortSignal;
|
|
873
|
+
/** Await before launching each agent so pause() can gate new spawns. */
|
|
874
|
+
readonly beforeSpawn: () => Promise<void>;
|
|
875
|
+
}
|
|
876
|
+
/** Neutral terminal classification of a caller-shaped outcome. */
|
|
877
|
+
interface ManagedRunClassification {
|
|
878
|
+
readonly status: 'completed' | 'failed' | 'denied';
|
|
879
|
+
readonly error?: Error;
|
|
880
|
+
readonly resultText?: string;
|
|
881
|
+
}
|
|
882
|
+
interface StartManagedRunInput<TOutcome> {
|
|
883
|
+
readonly runId: string;
|
|
884
|
+
/** Display name (usually the workflow's `meta.name`). */
|
|
885
|
+
readonly workflow: string;
|
|
886
|
+
readonly phases?: readonly string[];
|
|
887
|
+
readonly maxAgents?: number;
|
|
888
|
+
readonly plannedAgents?: number;
|
|
889
|
+
readonly tokenBudget?: number;
|
|
890
|
+
readonly processMetadata?: WorkflowProcessMetadata;
|
|
891
|
+
readonly signal?: AbortSignal;
|
|
892
|
+
/** Executes the run with the manager's lifecycle hooks injected. */
|
|
893
|
+
readonly runFn: (hooks: ManagedRunHooks) => Promise<TOutcome>;
|
|
894
|
+
/** Map the caller's terminal outcome to a neutral status for the snapshot. */
|
|
895
|
+
readonly classify: (outcome: TOutcome) => ManagedRunClassification;
|
|
896
|
+
/** Synthesize a caller-shaped outcome when `runFn` throws. */
|
|
897
|
+
readonly onError: (error: unknown) => TOutcome;
|
|
898
|
+
}
|
|
899
|
+
interface WorkflowRunManager {
|
|
900
|
+
start<TOutcome>(input: StartManagedRunInput<TOutcome>): ManagedWorkflowRun<TOutcome>;
|
|
901
|
+
list(): readonly ManagedWorkflowSnapshot[];
|
|
902
|
+
get(runId: string): ManagedWorkflowSnapshot | undefined;
|
|
903
|
+
subscribeWorkflowProcess(listener: (event: WorkflowProcessEvent) => void): () => void;
|
|
904
|
+
getWorkflowProcessSnapshot(runId: string): WorkflowProcessSnapshot | undefined;
|
|
905
|
+
listWorkflowProcessSnapshots(options?: {
|
|
906
|
+
readonly activeOnly?: boolean;
|
|
907
|
+
readonly limit?: number;
|
|
908
|
+
}): readonly WorkflowProcessSnapshot[];
|
|
909
|
+
pause(runId: string): boolean;
|
|
910
|
+
resume(runId: string): boolean;
|
|
911
|
+
stop(runId: string, reason?: string): boolean;
|
|
912
|
+
}
|
|
913
|
+
declare function createWorkflowRunManager(deps?: {
|
|
914
|
+
readonly now?: () => number;
|
|
915
|
+
}): WorkflowRunManager;
|
|
916
|
+
declare function getDefaultWorkflowRunManager(): WorkflowRunManager;
|
|
806
917
|
|
|
807
|
-
export {
|
|
808
|
-
export type { WorkflowCapsuleInputs as
|
|
918
|
+
export { buildWorkflowCapsuleIntent as $, WORKFLOW_CAPSULE_FORMAT as A, WORKFLOW_CAPSULE_VERSION as B, DefaultSummaryCompaction as D, WORKFLOW_PATTERN_IDS as E, KODAX_API_MIN_INTERVAL as K, LINEAGE_ENTRY_TYPES as L, PROMISE_PATTERN as P, appendSessionLineageLabel as U, applyLineageTruncation as V, WORKFLOW_CAPSULE_API_VERSION as W, applySessionCompaction as X, archiveOldIslands as Y, buildSessionTree as Z, _resetMessageQueueForTests as _, cleanupIncompleteToolCalls as a0, countActiveLineageMessages as a1, countTokens as a2, createSessionLineage as a3, createWorkflowCapsule as a4, createWorkflowModuleFromCapsule as a5, createWorkflowRunManager as a6, estimateTokens as a7, extractArtifactLedger as a8, extractFileOps as a9, extractTitleFromMessages as aa, findPreviousUserEntryId as ab, forkSessionLineage as ac, generateSessionId as ad, getAgentConfigHome as ae, getAgentConfigPath as af, getAppDataDir as ag, getDefaultWorkflowRunManager as ah, getMessageQueue as ai, getSessionLineagePath as aj, getSessionMessagesFromLineage as ak, mergeArtifactLedger as al, mergeFileOps as am, resolveSessionLineageTarget as an, rewindSessionLineage as ao, setAgentConfigHome as ap, setSessionLineageActiveEntry as aq, validateAndFixToolHistory as ar, validateWorkflowCapsule as as, validateWorkflowScriptManifest as at, KODAX_DEFAULT_TIMEOUT as f, KODAX_HARD_TIMEOUT as g, KODAX_MAX_INCOMPLETE_RETRIES as h, KODAX_MAX_MAXTOKENS_RETRIES as i, KODAX_MAX_RETRIES as j, KODAX_MAX_TOKENS as k, KODAX_RETRY_BASE_DELAY as l, KODAX_STAGGER_DELAY as m, LineageCompaction as o, LineageExtension as r, MessageQueue as y };
|
|
919
|
+
export type { CompactionContext as C, WorkflowCapsule as F, WorkflowCapsuleEnvironmentRequirement as G, WorkflowCapsuleInputs as H, WorkflowCapsuleIntent as I, WorkflowCapsuleProvenance as J, ManagedRunClassification as M, WorkflowCapsuleRequirements as N, WorkflowPatternId as O, WorkflowProcessMetadata as Q, WorkflowRunManager as R, StartManagedRunInput as S, WorkflowScriptManifest as T, CompactionEntry as a, CompactionEntryPayload as b, CompactionPolicy as c, CreateWorkflowCapsuleInput as d, DefaultSummaryCompactionOptions as e, LineageArtifactLedgerPayload as n, LineageCompactionDelegates as p, LineageEntryType as q, LineageLabelPayload as s, LineageTreeNode as t, ManagedRunHooks as u, ManagedWorkflowRun as v, ManagedWorkflowSnapshot as w, ManagedWorkflowStatus as x, PolicyCompactionResult as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as PermissionMode,
|
|
2
|
-
import { E as KodaXReasoningMode,
|
|
3
|
-
import { m as KodaXAgentMode } from './bash-prefix-extractor.d-
|
|
4
|
-
import {
|
|
1
|
+
import { b as PermissionMode, F as FileSessionStorage, S as SessionData } from './storage.d-BsZrBPYu.js';
|
|
2
|
+
import { E as KodaXReasoningMode, j as KodaXMessage, c as KodaXContentBlock } from './types.d-Ci5YPFEh.js';
|
|
3
|
+
import { m as KodaXAgentMode } from './bash-prefix-extractor.d-D3cddmyV.js';
|
|
4
|
+
import { ai as KodaXSessionUiHistoryItem, am as KodaXSessionUiToolCall } from './process.d-DHow2y2G.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* TextBuffer - Text buffer management class - 文本缓冲区管理类
|
|
@@ -412,6 +412,8 @@ interface StatusBarProps {
|
|
|
412
412
|
activeToolCount?: number;
|
|
413
413
|
thinking?: boolean;
|
|
414
414
|
reasoningMode?: KodaXReasoningMode;
|
|
415
|
+
effort?: string;
|
|
416
|
+
reasoningEffortLabel?: string;
|
|
415
417
|
reasoningCapability?: string;
|
|
416
418
|
/** Is context currently compacting - 是否正在压缩上下文 */
|
|
417
419
|
isCompacting?: boolean;
|
|
@@ -538,7 +540,7 @@ interface ToolCall {
|
|
|
538
540
|
* History item type - 历史项类型
|
|
539
541
|
* Reference: Gemini CLI HistoryItem - 参考: Gemini CLI HistoryItem
|
|
540
542
|
*/
|
|
541
|
-
type HistoryItemType = "user" | "assistant" | "system" | "tool_group" | "thinking" | "error" | "event" | "info" | "hint";
|
|
543
|
+
type HistoryItemType = "user" | "assistant" | "system" | "tool_group" | "thinking" | "error" | "event" | "info" | "hint" | "sidecar";
|
|
542
544
|
/**
|
|
543
545
|
* History item base class - 历史项基类
|
|
544
546
|
*/
|
|
@@ -622,15 +624,30 @@ interface HistoryItemHint extends HistoryItemBase {
|
|
|
622
624
|
type: "hint";
|
|
623
625
|
text: string;
|
|
624
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* Sidecar Verifier message - Sidecar 验证器消息
|
|
629
|
+
* Displayed as an independent "role" with its own header so the user can
|
|
630
|
+
* clearly see that the Sidecar Verifier is actively reviewing the output.
|
|
631
|
+
* verdict: 'revise' | 'blocked' | undefined; delivery 'budget-exhausted' means
|
|
632
|
+
* the verifier ran out of budget before returning a verdict.
|
|
633
|
+
*/
|
|
634
|
+
interface HistoryItemSidecar extends HistoryItemBase {
|
|
635
|
+
type: "sidecar";
|
|
636
|
+
text: string;
|
|
637
|
+
/** 'revise' or 'blocked'; absent when delivery === 'budget-exhausted' */
|
|
638
|
+
verdict?: "revise" | "blocked";
|
|
639
|
+
/** Set when the verifier exhausted its token budget before reaching a verdict */
|
|
640
|
+
delivery?: "budget-exhausted";
|
|
641
|
+
}
|
|
625
642
|
/**
|
|
626
643
|
* Union type of all history items - 所有历史项的联合类型
|
|
627
644
|
*/
|
|
628
|
-
type HistoryItem = HistoryItemUser | HistoryItemAssistant | HistoryItemSystem | HistoryItemToolGroup | HistoryItemThinking | HistoryItemError | HistoryItemEvent | HistoryItemInfo | HistoryItemHint;
|
|
645
|
+
type HistoryItem = HistoryItemUser | HistoryItemAssistant | HistoryItemSystem | HistoryItemToolGroup | HistoryItemThinking | HistoryItemError | HistoryItemEvent | HistoryItemInfo | HistoryItemHint | HistoryItemSidecar;
|
|
629
646
|
/**
|
|
630
647
|
* Creatable history item types (with text property) - 可创建的历史项类型(带 text 属性)
|
|
631
648
|
* Used for addHistoryItem function parameter type - 用于 addHistoryItem 等函数的参数类型
|
|
632
649
|
*/
|
|
633
|
-
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<HistoryItemToolGroup, "id" | "timestamp">;
|
|
650
|
+
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">;
|
|
634
651
|
/**
|
|
635
652
|
* UI global state interface - UI 全局状态接口
|
|
636
653
|
* Reference: Gemini CLI UIStateContext - 参考: Gemini CLI UIStateContext
|
|
@@ -755,6 +772,50 @@ declare function extractTitle(messages: KodaXMessage[]): string;
|
|
|
755
772
|
*/
|
|
756
773
|
declare function formatMessagePreview(content: string, maxLength?: number): string;
|
|
757
774
|
|
|
775
|
+
/**
|
|
776
|
+
* FEATURE_247 (R6) — imperative session compaction.
|
|
777
|
+
*
|
|
778
|
+
* Lets an SDK embedder (KodaX-Space) compact a session by id immediately —
|
|
779
|
+
* e.g. when the user clicks a "/compact" button — instead of forging a token
|
|
780
|
+
* snapshot or appending an empty message to trip auto-compaction. Loads the
|
|
781
|
+
* session, runs the same `compact()` pass the REPL `/compact` command uses,
|
|
782
|
+
* applies the result to the session lineage (so `loadFullTranscript` / resume
|
|
783
|
+
* see the compaction entry), and writes it back.
|
|
784
|
+
*
|
|
785
|
+
* Applies uniformly to Partner and Coder sessions. Never throws — failures
|
|
786
|
+
* return `{ compacted: false, reason }`.
|
|
787
|
+
*/
|
|
788
|
+
|
|
789
|
+
interface CompactSessionOptions {
|
|
790
|
+
/** Provider alias for the summarizer. Defaults to the session's persisted provider, then 'anthropic'. */
|
|
791
|
+
readonly provider?: string;
|
|
792
|
+
/** Model override forwarded to the summarizer. */
|
|
793
|
+
readonly model?: string;
|
|
794
|
+
/** Custom summarizer instructions (same as `/compact <text>`). */
|
|
795
|
+
readonly customInstructions?: string;
|
|
796
|
+
/** Provider context-window override (tokens). Otherwise resolved from the provider/model. */
|
|
797
|
+
readonly contextWindow?: number;
|
|
798
|
+
/** Sessions directory (mirrors createSessionManager's override). */
|
|
799
|
+
readonly sessionsDir?: string;
|
|
800
|
+
/** Injected storage instance (takes precedence over sessionsDir). */
|
|
801
|
+
readonly storage?: FileSessionStorage;
|
|
802
|
+
}
|
|
803
|
+
interface CompactSessionResult {
|
|
804
|
+
/** True when the session was actually rewritten. */
|
|
805
|
+
readonly compacted: boolean;
|
|
806
|
+
readonly tokensBefore: number;
|
|
807
|
+
readonly tokensAfter: number;
|
|
808
|
+
/** The rewritten (or unchanged) message list. */
|
|
809
|
+
readonly messages: KodaXMessage[];
|
|
810
|
+
/** Populated when `compacted` is false to explain why (not-found / no-op / error). */
|
|
811
|
+
readonly reason?: string;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Compact a session by id, writing the result (lineage + messages) back to
|
|
815
|
+
* storage. Never throws.
|
|
816
|
+
*/
|
|
817
|
+
declare function compactSession(sessionId: string, options?: CompactSessionOptions): Promise<CompactSessionResult>;
|
|
818
|
+
|
|
758
819
|
/**
|
|
759
820
|
* FEATURE_173 Part B (v0.7.42) — Session Management Public SDK.
|
|
760
821
|
*
|
|
@@ -775,6 +836,8 @@ interface SessionSummary {
|
|
|
775
836
|
readonly runtimeInfo?: {
|
|
776
837
|
workspaceRoot?: string;
|
|
777
838
|
gitRoot?: string;
|
|
839
|
+
surface?: string;
|
|
840
|
+
profileId?: string;
|
|
778
841
|
};
|
|
779
842
|
/**
|
|
780
843
|
* FEATURE_219 (v0.7.46) — the per-project directory key this session lives
|
|
@@ -846,6 +909,8 @@ interface SessionManager {
|
|
|
846
909
|
unarchiveSession: typeof unarchiveSession;
|
|
847
910
|
listRunningSessions: typeof listRunningSessions;
|
|
848
911
|
watchSessions: typeof watchSessions;
|
|
912
|
+
/** FEATURE_247 (R6) — imperatively compact a session by id (writes lineage + emits nothing; returns stats). */
|
|
913
|
+
compactSession: typeof compactSession;
|
|
849
914
|
/**
|
|
850
915
|
* v0.7.43 — the raw write-side storage instance. SDK embedders pass
|
|
851
916
|
* this into `runKodaX({ session: { id, scope, storage } })` so the
|
|
@@ -973,5 +1038,5 @@ declare function createSessionManager(opts?: {
|
|
|
973
1038
|
sessionsDir?: string;
|
|
974
1039
|
}): SessionManager;
|
|
975
1040
|
|
|
976
|
-
export { DEFAULT_UI_STATE as D, StreamingState as
|
|
977
|
-
export type {
|
|
1041
|
+
export { DEFAULT_UI_STATE as D, StreamingState as O, TOOL_STATUS_ICONS as T, TextBuffer as U, ToolCallStatus as _, archiveSession as a5, createSessionManager as a6, deleteSession as a7, extractHistorySeedsFromMessage as a8, extractHistorySeedsFromMessages as a9, extractTextContent as aa, extractTitle as ab, forkSession as ac, formatMessagePreview as ad, listRunningSessions as ae, listSessions as af, loadFullTranscript as ag, loadSession as ah, restoreHistoryItemsFromSession as ai, rewindSession as aj, seedToHistoryItem as ak, setActiveEntry as al, toolCallSeedToHistoryToolCall as am, trimPersistedUiHistorySnapshot as an, unarchiveSession as ao, watchSessions as ap, KeypressHandlerPriority as v };
|
|
1042
|
+
export type { UIActions as $, AppProps as A, RunningSessionInfo as B, Completer as C, SessionSummary as E, FullTranscriptSessionData as F, SessionTranscriptEntry as G, HistoryEntry as H, InputPromptProps as I, SessionTranscriptEntryType as J, KeyInfo as K, LegacyMessageListProps as L, Message as M, StatusBarProps as N, PastedContent as P, Suggestion as Q, RestoreHistoryItemsFromSessionInput as R, SessionManager as S, TextBufferOptions as V, Theme as W, ThemeColors as X, ThemeSymbols as Y, ToolCall as Z, AppState as a, UIState as a0, UseTextBufferReturn as a1, VisualCursor as a2, VisualLayout as a3, WatchSessionsCallback as a4, Completion as b, CreatableHistoryItem as c, CursorPosition as d, DeleteSessionResult as e, HistoryItem as f, HistoryItemAssistant as g, HistoryItemBase as h, HistoryItemError as i, HistoryItemEvent as j, HistoryItemHint as k, HistoryItemInfo as l, HistoryItemSidecar as m, HistoryItemSystem as n, HistoryItemThinking as o, HistoryItemToolGroup as p, HistoryItemType as q, HistoryItemUser as r, HistorySeedSourceMessage as s, KeypressEvent as t, KeypressHandler as u, ListSessionsOptions as w, PromptEditingMode as x, PromptSubmitPayload as y, RestoredHistorySeed as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as BashPrefixExtractor } from './bash-prefix-extractor.d-
|
|
2
|
-
import {
|
|
1
|
+
import { a as BashPrefixExtractor } from './bash-prefix-extractor.d-D3cddmyV.js';
|
|
2
|
+
import { a5 as KodaXSessionData, aa as KodaXSessionLineage, ad as KodaXSessionNavigationOptions, ae as KodaXSessionRuntimeInfo, ag as KodaXSessionStorage } from './process.d-DHow2y2G.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Permission Types
|