@kodax-ai/kodax 0.7.55 → 0.7.57

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 (70) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +22 -24
  3. package/README_CN.md +16 -18
  4. package/dist/builtin/code-review/SKILL.md +22 -3
  5. package/dist/chunks/agent-EHWQZA4C.js +2 -0
  6. package/dist/chunks/argument-completer-AYDAYGKL.js +2 -0
  7. package/dist/chunks/chunk-3WWPJGPQ.js +2 -0
  8. package/dist/chunks/chunk-4SHP3M67.js +2 -0
  9. package/dist/chunks/chunk-KN6IJMTB.js +636 -0
  10. package/dist/chunks/{chunk-ZBK3DZ3S.js → chunk-LZKGOR2C.js} +1 -1
  11. package/dist/chunks/chunk-MJFPFRGK.js +423 -0
  12. package/dist/chunks/chunk-N2N2W3AQ.js +584 -0
  13. package/dist/chunks/chunk-PCPFLPS4.js +5 -0
  14. package/dist/chunks/chunk-TCLSPUTR.js +31 -0
  15. package/dist/chunks/chunk-VACH6QWN.js +315 -0
  16. package/dist/chunks/chunk-YSVPF6SN.js +597 -0
  17. package/dist/chunks/{compaction-config-NAJEEPG5.js → compaction-config-TLDMFMZO.js} +1 -1
  18. package/dist/chunks/{construction-bootstrap-4CIVZMQ5.js → construction-bootstrap-55B7Q5RX.js} +4 -4
  19. package/dist/chunks/dist-IE4HVWP7.js +2 -0
  20. package/dist/chunks/dist-IKOK2MJQ.js +2 -0
  21. package/dist/chunks/paste-WTL2XN7P.js +2 -0
  22. package/dist/chunks/utils-EJ2VCRTC.js +2 -0
  23. package/dist/index.d.ts +21 -16
  24. package/dist/index.js +6 -6
  25. package/dist/kodax_cli.js +1128 -1099
  26. package/dist/provider-capabilities.json +986 -195
  27. package/dist/sdk-agent.d.ts +20 -12
  28. package/dist/sdk-agent.js +1 -1
  29. package/dist/sdk-coding.d.ts +223 -108
  30. package/dist/sdk-coding.js +1 -1
  31. package/dist/sdk-llm.d.ts +10 -5
  32. package/dist/sdk-llm.js +1 -1
  33. package/dist/sdk-mcp.d.ts +1 -1
  34. package/dist/sdk-mcp.js +1 -1
  35. package/dist/sdk-media.d.ts +142 -0
  36. package/dist/sdk-media.js +2 -0
  37. package/dist/sdk-repl.d.ts +106 -96
  38. package/dist/sdk-repl.js +1 -1
  39. package/dist/sdk-session.d.ts +6 -5
  40. package/dist/sdk-session.js +1 -1
  41. package/dist/sdk-skills.js +1 -1
  42. package/dist/semantic-worker.js +11 -0
  43. package/dist/types-chunks/base.d-BnjQrSVf.d.ts +301 -0
  44. package/dist/types-chunks/{bash-prefix-extractor.d-LUGkQHcd.d.ts → bash-prefix-extractor.d-BgvMbfq6.d.ts} +198 -139
  45. package/dist/types-chunks/{capsule.d-CNonpwAZ.d.ts → capsule.d-DwJp5r63.d.ts} +14 -11
  46. package/dist/types-chunks/{types.d-D4jL-gAA.d.ts → guardrail.d-BP3yyr6u.d.ts} +3 -121
  47. package/dist/types-chunks/{guardrail.d-B18oO1gt.d.ts → guardrail.d-C1DhxnvC.d.ts} +31 -9
  48. package/dist/types-chunks/{manager.d-DLmDhX3i.d.ts → manager.d-DBD7SOTT.d.ts} +7 -2
  49. package/dist/types-chunks/{process.d-Bj82oJhD.d.ts → process.d-BZncyzEj.d.ts} +2 -1
  50. package/dist/types-chunks/{resolver.d-CCX9NXWP.d.ts → resolver.d-ZvKQgl0X.d.ts} +82 -17
  51. package/dist/types-chunks/{sdk-session-SjrnWb4-.d.ts → sdk-session-DAScB0rW.d.ts} +6 -4
  52. package/dist/types-chunks/{storage.d-BAuJ0Ks7.d.ts → storage.d-CPvn9qI0.d.ts} +2 -2
  53. package/dist/types-chunks/{base.d-BBNUF9nz.d.ts → types.d-6VOXvF88.d.ts} +101 -290
  54. package/dist/types-chunks/types.d-D8WcfrOD.d.ts +143 -0
  55. package/dist/types-chunks/{utils.d-C9MUY8n3.d.ts → utils.d-CpgVIjYZ.d.ts} +16 -18
  56. package/package.json +15 -6
  57. package/dist/chunks/agent-PYSVWY7M.js +0 -2
  58. package/dist/chunks/argument-completer-CTDNNWV3.js +0 -2
  59. package/dist/chunks/chunk-7C2QUBLE.js +0 -31
  60. package/dist/chunks/chunk-EVIDQWMF.js +0 -5
  61. package/dist/chunks/chunk-FRI7UQSB.js +0 -2
  62. package/dist/chunks/chunk-HQCLPWRI.js +0 -551
  63. package/dist/chunks/chunk-JCDO2FR4.js +0 -584
  64. package/dist/chunks/chunk-MX4G42EV.js +0 -425
  65. package/dist/chunks/chunk-RGPPZOD5.js +0 -314
  66. package/dist/chunks/chunk-THAKTCPE.js +0 -652
  67. package/dist/chunks/dist-7KTO2PUU.js +0 -2
  68. package/dist/chunks/dist-BNKIZRCP.js +0 -2
  69. package/dist/chunks/paste-5DSTHQGK.js +0 -2
  70. package/dist/chunks/utils-2QXBKYPJ.js +0 -2
@@ -1,4 +1,4 @@
1
- import { y as Guardrail, aG as RunnerToolCall, d as Agent, f as AgentMessage, aJ as RunnerToolResult, aS as Span } from './process.d-Bj82oJhD.js';
1
+ import { y as Guardrail, aG as RunnerToolCall, d as Agent, f as AgentMessage, aJ as RunnerToolResult, aS as Span } from './process.d-BZncyzEj.js';
2
2
 
3
3
  /**
4
4
  * Guardrail Runtime — FEATURE_085 (v0.7.26).
@@ -151,123 +151,5 @@ declare function runToolBeforeGuardrails(call: RunnerToolCall, guardrails: reado
151
151
  */
152
152
  declare function runToolAfterGuardrails(call: RunnerToolCall, result: RunnerToolResult, guardrails: readonly ToolGuardrail[], ctx: GuardrailContext, agentSpan: Span | null): Promise<RunnerToolResult>;
153
153
 
154
- /**
155
- * @kodax-ai/agent/messaging Message queue types
156
- *
157
- * FEATURE_115 (v0.7.36): agentId-scoped 2-tier priority queue infrastructure.
158
- *
159
- * Per ADR-021: messaging is a generic agent-platform primitive (not coding-
160
- * specific). Downstream consumers:
161
- * - @kodax-ai/coding runner-driven mid-turn drain
162
- * - @kodax-ai/repl InkREPL ESC soft-pause + text injection (FEATURE_111 absorbed)
163
- * - subagent task-notification routing (FEATURE_155 idle-yield wakeup)
164
- *
165
- * Phase 0.6 study (`c:/tmp/claude-code-actual-usage.md`): Claude Code's
166
- * `'now'` priority has zero production usage; KodaX simplifies to 2 tiers.
167
- */
168
- type MessagePriority = 'user' | 'background';
169
- type MessageMode = 'prompt' | 'task-notification' | 'system-reminder';
170
- interface QueuedMessage {
171
- /** Stable id for tracing / dedup. Format: `msg-<sequence>`. */
172
- readonly id: string;
173
- readonly priority: MessagePriority;
174
- /**
175
- * Routing key:
176
- * undefined = main thread / coordinator agent
177
- * 'agent-id-XYZ' = subagent / specific consumer
178
- *
179
- * Drain consumers MUST filter by agentId match — undefined matches only
180
- * undefined-agentId messages, not "any agent".
181
- */
182
- readonly agentId?: string;
183
- readonly mode: MessageMode;
184
- readonly content: string;
185
- /** Wall-clock timestamp (`Date.now()`) for tracing only — not used for ordering. */
186
- readonly enqueuedAt: number;
187
- }
188
- interface DequeueFilter {
189
- /**
190
- * Only return messages with this agentId.
191
- * undefined matches messages with no agentId (main-thread messages only).
192
- */
193
- readonly agentId?: string;
194
- /**
195
- * Highest priority level included in the drain.
196
- * 'user' → only user priority drained, background stays queued
197
- * 'background' → both user + background drained (Sleep-gated case)
198
- */
199
- readonly maxPriority: MessagePriority;
200
- /**
201
- * Optional cap on number of messages drained in this call.
202
- * Defaults to unlimited (drains all matching).
203
- */
204
- readonly limit?: number;
205
- /**
206
- * FEATURE_159 (v0.7.40) — optional mode filter. Lets REPL split the
207
- * single queue into mode-typed views (e.g. `mode:'prompt'` for user
208
- * input vs `mode:'task-notification'` for child completion banners)
209
- * without separate queues. When omitted, all modes match.
210
- */
211
- readonly mode?: MessageMode;
212
- /**
213
- * FEATURE_159 (v0.7.40) — optional precise-id filter. Single-message
214
- * targeted removal — drives Esc-pop-this-uuid in REPL. When set, all
215
- * other filters still apply (agentId / priority / mode mismatches still
216
- * skip the message), so callers can't accidentally remove a message
217
- * outside their scope.
218
- */
219
- readonly id?: string;
220
- /**
221
- * FEATURE_159 (v0.7.40) — optional escape-hatch predicate, AND-ed with
222
- * the structured filters. Lets SDK consumers express conditions the
223
- * typed fields don't cover (e.g. timestamp ranges, content-match) without
224
- * forcing every new use case to extend `DequeueFilter`. KodaX-internal
225
- * code should prefer the typed fields for readability; this is the
226
- * "data-driven main path + predicate escape" pattern.
227
- *
228
- * Evaluated AFTER the typed filters succeed — so a `predicate` that
229
- * inspects `message.content` never runs on messages outside the
230
- * caller's `agentId` / `mode` / `id` scope.
231
- */
232
- readonly predicate?: (message: QueuedMessage) => boolean;
233
- }
234
- /**
235
- * FEATURE_159 (v0.7.40) — structured queue event emitted to subscribers.
236
- *
237
- * Replaces the prior `() => void` bare-notify signal. Carries the kind +
238
- * affected messages so SDK observability consumers (logging, tracing,
239
- * metrics) can react per-event without re-diffing snapshots.
240
- *
241
- * Event granularity rules:
242
- * - `enqueued` fires ONCE per `enqueue()` call (always 1 message).
243
- * - `dequeued` fires ONCE per `dequeue()` call that removed ≥1 message,
244
- * carrying ALL drained messages in priority+FIFO order. No-op drains
245
- * (filter matched nothing) fire no event — quiet by design so the
246
- * `waitForWakeEvent` 100ms poll doesn't spam idle subscribers.
247
- * - `cleared` fires ONCE per `clear()` call that removed ≥1 message,
248
- * carrying the pre-clear messages. Empty-queue clear fires nothing.
249
- *
250
- * The `useSyncExternalStore` React hook ignores the event payload (it
251
- * only needs the change signal); SDK / tracer consumers read the event.
252
- */
253
- type QueueEvent = {
254
- readonly kind: 'enqueued';
255
- readonly message: QueuedMessage;
256
- } | {
257
- readonly kind: 'dequeued';
258
- readonly messages: readonly QueuedMessage[];
259
- } | {
260
- readonly kind: 'cleared';
261
- readonly messages: readonly QueuedMessage[];
262
- };
263
- /** FEATURE_159 — `MessageQueue.subscribe` listener signature. */
264
- type QueueEventListener = (event: QueueEvent) => void;
265
- interface EnqueueInput {
266
- readonly priority: MessagePriority;
267
- readonly mode: MessageMode;
268
- readonly content: string;
269
- readonly agentId?: string;
270
- }
271
-
272
- export { GuardrailBlockedError as G, GuardrailEscalateError as b, collectGuardrails as g, runOutputGuardrails as h, runToolAfterGuardrails as i, runToolBeforeGuardrails as j, runInputGuardrails as r };
273
- export type { DequeueFilter as D, EnqueueInput as E, InputGuardrail as I, MessageMode as M, OutputGuardrail as O, QueueEventListener as Q, ToolBeforeOutcome as T, GuardrailContext as a, GuardrailVerdict as c, MessagePriority as d, QueuedMessage as e, ToolGuardrail as f };
154
+ export { GuardrailBlockedError as G, GuardrailEscalateError as b, collectGuardrails as e, runOutputGuardrails as f, runToolAfterGuardrails as g, runToolBeforeGuardrails as h, runInputGuardrails as r };
155
+ export type { InputGuardrail as I, OutputGuardrail as O, ToolBeforeOutcome as T, GuardrailContext as a, GuardrailVerdict as c, ToolGuardrail as d };
@@ -1,8 +1,8 @@
1
1
  import { M as McpConnectMode, a as McpServerConfig, b as McpServersConfig, c as McpTransportKind } from './config.d-CJy1WENT.js';
2
- import { f as KodaXBaseProvider } from './base.d-BBNUF9nz.js';
2
+ import { K as KodaXBaseProvider } from './base.d-BnjQrSVf.js';
3
3
  import { a as CostTracker } from './cost-tracker.d-wRtyEW9d.js';
4
- import { aG as RunnerToolCall } from './process.d-Bj82oJhD.js';
5
- import { f as ToolGuardrail } from './types.d-D4jL-gAA.js';
4
+ import { aG as RunnerToolCall } from './process.d-BZncyzEj.js';
5
+ import { d as ToolGuardrail } from './guardrail.d-BP3yyr6u.js';
6
6
 
7
7
  /**
8
8
  * FEATURE_200 Phase F (v0.7.45) — MCP domain types extracted from types.ts.
@@ -360,6 +360,21 @@ signals?: readonly ToolCallSignal[]) => Promise<AutoModeAskUserVerdict>;
360
360
  interface AutoModeGuardrailConfig {
361
361
  readonly rules: AutoRules;
362
362
  readonly claudeMd?: string;
363
+ /**
364
+ * FEATURE_092 follow-up (auto-mode classifier AGENTS.md staleness fix):
365
+ * live getter for the project AGENTS.md content. Takes precedence over the
366
+ * static `claudeMd` string and is evaluated INSIDE the classify path on
367
+ * every call — same live-getter pattern as `getDefaultProvider` /
368
+ * `getDefaultModel` (v0.7.34 hotfix-3).
369
+ *
370
+ * The bug it fixes: the guardrail is a lazy-cached singleton, so a
371
+ * captured `claudeMd` string froze the project rules at first
372
+ * construction. Even `/reload` couldn't refresh it — the classifier kept
373
+ * judging tool calls against a stale AGENTS.md snapshot. The REPL wires
374
+ * this to `loadAgentsFiles` (mtime-cached), so the classifier sees the
375
+ * same fresh project rules the system prompt does.
376
+ */
377
+ readonly getClaudeMd?: () => string | undefined;
363
378
  /**
364
379
  * FEATURE_092 phase 2b.7b: optional user-prompt callback for escalate
365
380
  * paths. See `AutoModeAskUser` for semantics.
@@ -470,14 +485,21 @@ interface AutoModeGuardrailConfig {
470
485
  /**
471
486
  * Speculative-classify quiet window (ms). When a classifier promise
472
487
  * settles within this window, the guardrail uses the verdict directly
473
- * (no confirm dialog). When the window expires, the call escalates to
474
- * the user; the background classifier is left running for cost-tracker
475
- * settlement but its eventual result is discarded in v1 (UI doesn't
476
- * adopt late verdicts yet).
488
+ * with no perceptible latency.
489
+ *
490
+ * Issue 143 (WS1): when the window expires the guardrail does NOT
491
+ * hard-escalate it waits for the real classifier verdict and adopts it
492
+ * (late-verdict adoption). The window therefore only controls "fast path
493
+ * vs wait", never "dialog vs no dialog": an `allow` never surfaces a
494
+ * confirm dialog regardless of how long the classifier takes, and only an
495
+ * `escalate` verdict (explicit LLM escalation, classifier timeout, or infra
496
+ * error — all mapped to `escalate` by classify()) reaches the user.
497
+ * The background classifier's cost is settled exactly once inside
498
+ * classify(), so awaiting it after window expiry does not double-count.
477
499
  *
478
500
  * Precedence: explicit arg > `KODAX_AUTO_SPECULATIVE_WINDOW_MS` env >
479
- * `DEFAULT_WINDOW_MS = 500`. Set to 0 to disable speculative race
480
- * (degrades to synchronous classify).
501
+ * `DEFAULT_WINDOW_MS = 500`. Set to 0 to disable the speculative race
502
+ * (degrades to a synchronous classify — identical verdict outcome).
481
503
  */
482
504
  readonly speculativeWindowMs?: number;
483
505
  }
@@ -47,6 +47,11 @@ interface McpCatalogSearchOptions {
47
47
  }
48
48
  declare function defaultMcpCacheDir(): string;
49
49
  declare function createMcpCapabilityId(serverId: string, kind: McpCapabilityKind, name: string): string;
50
+ /**
51
+ * Applied defensively at handler, provider, and parse boundaries.
52
+ * Keep this idempotent so stacked normalization remains harmless.
53
+ */
54
+ declare function normalizeMcpCapabilityId(id: string): string;
50
55
  declare function parseMcpCapabilityId(id: string): {
51
56
  serverId: string;
52
57
  kind: McpCapabilityKind;
@@ -678,7 +683,7 @@ declare class McpManager {
678
683
  }): Promise<readonly McpCatalogItem[]>;
679
684
  /** v0.7.42 — escape hatch for advanced uses; usually consumers use {@link listTools}. */
680
685
  describe(id: string): Promise<McpCapabilityDescriptor | undefined>;
681
- /** v0.7.42 — invoke a tool by capability id (`mcp://<serverId>/<kind>/<name>`). */
686
+ /** v0.7.42 — invoke a tool by capability id (`mcp:<serverId>:tool:<name>`). */
682
687
  execute(id: string, input: Record<string, unknown>): Promise<CapabilityResult>;
683
688
  /** v0.7.42 — read a resource by capability id. */
684
689
  read(id: string, options?: Record<string, unknown>): Promise<CapabilityResult>;
@@ -692,5 +697,5 @@ declare class McpManager {
692
697
  */
693
698
  declare function createMcpManager(servers: McpServersConfig | undefined, options?: McpProviderOptions): McpManager;
694
699
 
695
- export { buildInitializeCapabilities as C, createMcpCapabilityId as E, createMcpManager as F, createMcpTransport as G, defaultMcpCacheDir as H, discoverAuthorizationServerMetadata as I, discoverOAuthEndpoints as J, discoverProtectedResourceMetadata as K, extractInsufficientScope as L, McpAuthRequiredError as M, extractResourceMetadataUrl as N, getMcpCachePaths as Q, loadValidToken as R, parseMcpCapabilityId as S, performOAuthLogin as T, registerOAuthClient as U, searchMcpCatalog as V, McpCapabilityProvider as c, McpExpiredSessionError as h, McpManager as j, McpServerRuntime as s };
700
+ export { buildInitializeCapabilities as C, createMcpCapabilityId as E, createMcpManager as F, createMcpTransport as G, defaultMcpCacheDir as H, discoverAuthorizationServerMetadata as I, discoverOAuthEndpoints as J, discoverProtectedResourceMetadata as K, extractInsufficientScope as L, McpAuthRequiredError as M, extractResourceMetadataUrl as N, getMcpCachePaths as Q, loadValidToken as R, normalizeMcpCapabilityId as S, parseMcpCapabilityId as T, performOAuthLogin as U, registerOAuthClient as V, searchMcpCatalog as X, McpCapabilityProvider as c, McpExpiredSessionError as h, McpManager as j, McpServerRuntime as s };
696
701
  export type { AuthorizationServerMetadata as A, ProtectedResourceMetadata as B, DiscoveredOAuthEndpoints as D, OAuthClientInfo as O, PerformOAuthLoginOptions as P, WwwAuthenticateChallenge as W, McpCapabilityDescriptor as a, McpCapabilityKind as b, McpCapabilityRisk as d, McpCatalogItem as e, McpElicitRequest as f, McpElicitResult as g, McpIcon as i, McpProviderOptions as k, McpReverseCapabilities as l, McpRoot as m, McpSamplingRequest as n, McpSamplingResult as o, McpServerCatalog as p, McpServerCatalogSnapshot as q, McpServerLogs as r, McpServerRuntimeDiagnostics as t, McpServerStatus as u, McpServerToolList as v, McpToolTaskSupport as w, McpTransport as x, McpTransportEvents as y, OAuthLoginConsent as z };
@@ -1,4 +1,4 @@
1
- import { o as KodaXMessage, $ as KodaXToolDefinition, G as KodaXReasoningMode, a1 as KodaXToolResultContentItem, X as KodaXThinkingBlock, J as KodaXRedactedThinkingBlock } from './base.d-BBNUF9nz.js';
1
+ import { j as KodaXMessage, _ as KodaXToolDefinition, E as KodaXReasoningMode, a6 as KodaXWireReasoningEffort, a0 as KodaXToolResultContentItem, V as KodaXThinkingBlock, H as KodaXRedactedThinkingBlock } from './types.d-6VOXvF88.js';
2
2
 
3
3
  /**
4
4
  * @kodax-ai/agent Types
@@ -447,6 +447,7 @@ interface Agent<TContext = unknown> {
447
447
  readonly outputSchema?: unknown;
448
448
  readonly model?: string;
449
449
  readonly provider?: string;
450
+ readonly effort?: KodaXWireReasoningEffort;
450
451
  /**
451
452
  * FEATURE_100 (v0.7.29) substrate executor: when set, `Runner.run`
452
453
  * delegates execution to this function instead of consulting the
@@ -1,5 +1,6 @@
1
- import { G as KodaXReasoningMode, Y as KodaXThinkingBudgetMap, Z as KodaXThinkingDepth, u as KodaXProviderConfig, F as KodaXReasoningCapability, I as KodaXReasoningRequest, U as KodaXTaskType, H as KodaXReasoningOverride, f as KodaXBaseProvider, a5 as KodaXVerifyCredentialResult, $ as KodaXToolDefinition, o as KodaXMessage, C as KodaXProviderStreamOptions, O as KodaXStreamResult, p as KodaXModelDescriptor, t as KodaXProviderCapabilityProfile, a6 as KodaXVerifyStrategy, i as KodaXCustomProviderConfig, n as KodaXListModelsResult } from './base.d-BBNUF9nz.js';
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-6VOXvF88.js';
2
2
  import Anthropic from '@anthropic-ai/sdk';
3
+ import { K as KodaXBaseProvider } from './base.d-BnjQrSVf.js';
3
4
  import OpenAI from 'openai';
4
5
 
5
6
  /**
@@ -33,23 +34,58 @@ declare class KodaXToolCallIdError extends KodaXError {
33
34
  }
34
35
 
35
36
  declare const KODAX_REASONING_MODE_SEQUENCE: KodaXReasoningMode[];
37
+ declare const KODAX_STABLE_EFFORT_INTENTS: KodaXStableEffortIntent[];
36
38
  declare const KODAX_DEFAULT_THINKING_BUDGETS: KodaXThinkingBudgetMap;
37
39
  declare const KODAX_REASONING_SAFETY_RESERVE = 4096;
38
40
  declare function getReasoningCapability(config: KodaXProviderConfig): KodaXReasoningCapability;
39
41
  declare function isReasoningEnabled(reasoning?: boolean | KodaXReasoningRequest): boolean;
40
- declare function normalizeReasoningRequest(reasoning?: boolean | KodaXReasoningRequest): Required<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;
41
84
  declare function getDefaultThinkingDepthForMode(mode: KodaXReasoningMode): KodaXThinkingDepth;
42
85
  declare function resolveThinkingBudget(config: KodaXProviderConfig, depth: KodaXThinkingDepth, taskType?: KodaXTaskType): number;
43
86
  declare function clampThinkingBudget(requestedBudget: number, maxOutputTokens: number, safetyReserve?: number): number;
44
87
  declare function mapDepthToOpenAIReasoningEffort(depth: KodaXThinkingDepth): 'low' | 'medium' | 'high' | undefined;
45
88
 
46
- declare function reasoningCapabilityToOverride(capability: KodaXReasoningCapability): KodaXReasoningOverride | undefined;
47
- declare function reasoningOverrideToCapability(override: KodaXReasoningOverride): KodaXReasoningCapability;
48
- declare function buildReasoningOverrideKey(providerName: string, config: Pick<KodaXProviderConfig, 'baseUrl' | 'model'>, modelOverride?: string): string;
49
- declare function loadReasoningOverride(providerName: string, config: Pick<KodaXProviderConfig, 'baseUrl' | 'model'>, modelOverride?: string): KodaXReasoningOverride | undefined;
50
- declare function saveReasoningOverride(providerName: string, config: Pick<KodaXProviderConfig, 'baseUrl' | 'model'>, override: KodaXReasoningOverride, modelOverride?: string): void;
51
- declare function clearReasoningOverride(providerName: string, config: Pick<KodaXProviderConfig, 'baseUrl' | 'model'>, modelOverride?: string): void;
52
-
53
89
  /**
54
90
  * KodaX Anthropic Compatible Provider
55
91
  *
@@ -72,6 +108,9 @@ declare abstract class KodaXAnthropicCompatProvider extends KodaXBaseProvider {
72
108
  protected set client(client: Anthropic);
73
109
  protected buildClient(): Anthropic;
74
110
  protected onStaleConnection(): void;
111
+ private buildMessageCreateOptions;
112
+ private applyReasoningProfile;
113
+ private resolveReasoningProfileBudget;
75
114
  /**
76
115
  * FEATURE_216 v0.7.45 — Lightweight credential verification.
77
116
  * Dispatches by `this.config.verifyStrategy`:
@@ -118,6 +157,24 @@ declare abstract class KodaXAnthropicCompatProvider extends KodaXBaseProvider {
118
157
  private serializeSystemMessageContent;
119
158
  private buildSystemPrompt;
120
159
  private convertMessages;
160
+ /**
161
+ * Wire-only defense-in-depth: drop orphan `tool_use` / `tool_result` blocks
162
+ * so the Anthropic API never 400s on "tool_use ids ... were not found in
163
+ * tool_result blocks" or "unexpected tool_result". The upstream
164
+ * `validateAndFixToolHistory` (run every turn before serialization) is the
165
+ * primary guard; this mirrors the OpenAI-side `repairToolCallHistory` so
166
+ * both provider families have the same last-mile net for any path that
167
+ * bypasses validate (custom callers, side queries). Never mutates input.
168
+ *
169
+ * Pairing is computed against adjacent messages (same rule as validate): a
170
+ * `tool_use` is orphan when the immediately-following user message has no
171
+ * matching `tool_result`; a `tool_result` is orphan when the
172
+ * immediately-preceding assistant message has no matching `tool_use`. A
173
+ * message emptied by repair is replaced with a minimal wire-only `'...'`
174
+ * text block to keep user/assistant alternation and satisfy gateways that
175
+ * reject empty content.
176
+ */
177
+ private repairToolCallHistory;
121
178
  }
122
179
 
123
180
  /**
@@ -192,6 +249,8 @@ declare abstract class KodaXOpenAICompatProvider extends KodaXBaseProvider {
192
249
  private appendExtraBody;
193
250
  private resetReasoningCapabilityParams;
194
251
  private applyReasoningCapability;
252
+ private applyReasoningProfile;
253
+ private resolveReasoningProfileBudget;
195
254
  private getFallbackTerms;
196
255
  stream(messages: KodaXMessage[], tools: KodaXToolDefinition[], system: string, reasoning?: boolean | KodaXReasoningRequest, streamOptions?: KodaXProviderStreamOptions, signal?: AbortSignal): Promise<KodaXStreamResult>;
197
256
  supportsNonStreamingFallback(): boolean;
@@ -207,10 +266,10 @@ declare abstract class KodaXOpenAICompatProvider extends KodaXBaseProvider {
207
266
  /**
208
267
  * KodaX Provider Registry
209
268
  *
210
- * Provider 注册表 - 统一管理所有 Provider
269
+ * Provider 注册表 - 统一管理所有 Provider
211
270
  */
212
271
 
213
- type ProviderName = 'anthropic' | 'openai' | 'deepseek' | 'kimi' | 'kimi-code' | 'qwen' | 'zhipu' | 'zhipu-coding' | 'minimax-coding' | 'mimo-coding' | 'mimo' | 'ark-coding' | 'gemini-cli' | 'codex-cli';
272
+ 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';
214
273
  /**
215
274
  * Per-provider static metadata. v0.7.43 promoted this from a partial
216
275
  * descriptor (`models: string[]`) to the full capability surface so
@@ -239,6 +298,7 @@ type ProviderSnapshot = {
239
298
  readonly models?: readonly KodaXModelDescriptor[];
240
299
  readonly apiKeyEnv: string;
241
300
  readonly reasoningCapability: KodaXReasoningCapability;
301
+ readonly reasoningProfile?: KodaXReasoningProfile;
242
302
  readonly modelReasoningCapabilities?: Readonly<Record<string, KodaXReasoningCapability>>;
243
303
  readonly capabilityProfile: KodaXProviderCapabilityProfile;
244
304
  /** Maximum input context window (tokens). Provider-level default. */
@@ -270,6 +330,7 @@ declare function getProviderList(): Array<{
270
330
  models: string[];
271
331
  configured: boolean;
272
332
  reasoningCapability: KodaXReasoningCapability;
333
+ reasoningProfile?: KodaXReasoningProfile;
273
334
  capabilityProfile: KodaXProviderCapabilityProfile;
274
335
  }>;
275
336
  declare function getProviderModels(name: string): string[];
@@ -304,6 +365,8 @@ interface KodaXModelCapabilities {
304
365
  supportsThinking: boolean;
305
366
  /** Effective reasoning capability for THIS model (per-model override aware). */
306
367
  reasoningCapability: KodaXReasoningCapability;
368
+ /** Effort-first reasoning capability metadata for THIS model, when known. */
369
+ reasoningProfile?: KodaXReasoningProfile;
307
370
  /** Maximum input context window (tokens). `undefined` for CLI-bridge providers. */
308
371
  contextWindow?: number;
309
372
  /**
@@ -330,10 +393,12 @@ interface KodaXModelCapabilities {
330
393
  */
331
394
  declare function getProviderModelDescriptors(name: string): KodaXModelDescriptor[];
332
395
  /**
333
- * Effective per-model capability surface for a built-in provider. Returns
334
- * `undefined` for unknown provider name or unknown model under a known
335
- * provider caller should fall back to `DEFAULT_CONTEXT_WINDOW` from
336
- * `@kodax-ai/kodax/agent` when nothing is advertised.
396
+ * Effective per-model capability surface for a built-in provider.
397
+ *
398
+ * Returns `undefined` only for an unknown PROVIDER name. An unknown MODEL under
399
+ * a known provider inherits the provider-level capability (optimistic-wide
400
+ * default — see the inline note below), so callers always get a usable surface
401
+ * for any model id routed to a known provider.
337
402
  *
338
403
  * No API key required.
339
404
  */
@@ -500,5 +565,5 @@ declare function listProviderModels(name: string, _opts?: {
500
565
  signal?: AbortSignal;
501
566
  }): Promise<KodaXListModelsResult>;
502
567
 
503
- export { reasoningOverrideToCapability 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, loadReasoningOverride as X, mapDepthToOpenAIReasoningEffort as Y, normalizeReasoningRequest as Z, reasoningCapabilityToOverride as _, KODAX_DEFAULT_THINKING_BUDGETS as a, registerCustomProviders as a0, registerModelProvider as a1, resolveModelCapabilities as a2, resolveProvider as a3, resolveProviderModelDescriptors as a4, resolveThinkingBudget as a5, saveReasoningOverride as a6, validateCustomProviderConfig as a7, verifyProviderCredential as a8, KODAX_PROVIDERS as b, KODAX_PROVIDER_SNAPSHOTS as c, KODAX_REASONING_MODE_SEQUENCE as d, KODAX_REASONING_SAFETY_RESERVE as e, KodaXAnthropicCompatProvider as f, KodaXError as g, KodaXNetworkError as i, KodaXOpenAICompatProvider as j, KodaXProviderError as k, KodaXRateLimitError as l, KodaXToolCallIdError as m, buildReasoningOverrideKey as n, clampThinkingBudget as o, clearReasoningOverride as p, clearRuntimeModelProviders as q, createCustomProvider 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 };
504
- export type { ProviderName as P, KodaXModelCapabilities as h };
568
+ 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 };
569
+ export type { ProviderName as P, KodaXModelCapabilities as i };
@@ -1,7 +1,7 @@
1
- import { b as PermissionMode, S as SessionData, F as FileSessionStorage } from './storage.d-BAuJ0Ks7.js';
2
- import { G as KodaXReasoningMode, o as KodaXMessage, h as KodaXContentBlock } from './base.d-BBNUF9nz.js';
3
- import { m as KodaXAgentMode } from './bash-prefix-extractor.d-LUGkQHcd.js';
4
- import { ac as KodaXSessionUiHistoryItem, ag as KodaXSessionUiToolCall } from './process.d-Bj82oJhD.js';
1
+ import { b as PermissionMode, S as SessionData, F as FileSessionStorage } from './storage.d-CPvn9qI0.js';
2
+ import { E as KodaXReasoningMode, j as KodaXMessage, c as KodaXContentBlock } from './types.d-6VOXvF88.js';
3
+ import { m as KodaXAgentMode } from './bash-prefix-extractor.d-BgvMbfq6.js';
4
+ import { ac as KodaXSessionUiHistoryItem, ag as KodaXSessionUiToolCall } from './process.d-BZncyzEj.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;
@@ -1,5 +1,5 @@
1
- import { a as BashPrefixExtractor } from './bash-prefix-extractor.d-LUGkQHcd.js';
2
- import { $ as KodaXSessionData, a4 as KodaXSessionLineage, a7 as KodaXSessionNavigationOptions, a8 as KodaXSessionRuntimeInfo, aa as KodaXSessionStorage } from './process.d-Bj82oJhD.js';
1
+ import { a as BashPrefixExtractor } from './bash-prefix-extractor.d-BgvMbfq6.js';
2
+ import { $ as KodaXSessionData, a4 as KodaXSessionLineage, a7 as KodaXSessionNavigationOptions, a8 as KodaXSessionRuntimeInfo, aa as KodaXSessionStorage } from './process.d-BZncyzEj.js';
3
3
 
4
4
  /**
5
5
  * Permission Types