@kodax-ai/kodax 0.7.56 → 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 +33 -0
  2. package/README.md +21 -23
  3. package/README_CN.md +15 -17
  4. package/dist/builtin/code-review/SKILL.md +22 -3
  5. package/dist/chunks/{agent-MAAKRAF2.js → agent-EHWQZA4C.js} +1 -1
  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-EDDVNP2B.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 -17
  24. package/dist/index.js +6 -6
  25. package/dist/kodax_cli.js +1098 -1073
  26. package/dist/provider-capabilities.json +986 -197
  27. package/dist/sdk-agent.d.ts +20 -13
  28. package/dist/sdk-agent.js +1 -1
  29. package/dist/sdk-coding.d.ts +140 -110
  30. package/dist/sdk-coding.js +1 -1
  31. package/dist/sdk-llm.d.ts +5 -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 +48 -5
  36. package/dist/sdk-media.js +1 -1
  37. package/dist/sdk-repl.d.ts +106 -97
  38. package/dist/sdk-repl.js +1 -1
  39. package/dist/sdk-session.d.ts +6 -6
  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-CwPfI8WQ.d.ts → base.d-BnjQrSVf.d.ts} +36 -6
  44. package/dist/types-chunks/{bash-prefix-extractor.d-DZF1gDDz.d.ts → bash-prefix-extractor.d-BgvMbfq6.d.ts} +190 -135
  45. package/dist/types-chunks/{capsule.d-D0kjnqYy.d.ts → capsule.d-DwJp5r63.d.ts} +14 -11
  46. package/dist/types-chunks/{types.d-BKuHSiR0.d.ts → guardrail.d-BP3yyr6u.d.ts} +3 -121
  47. package/dist/types-chunks/{guardrail.d-DQQknOfb.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-BdiIUr8T.d.ts → process.d-BZncyzEj.d.ts} +2 -1
  50. package/dist/types-chunks/{resolver.d-Djq8KlCE.d.ts → resolver.d-ZvKQgl0X.d.ts} +82 -18
  51. package/dist/types-chunks/{sdk-session-BP6ZNpOp.d.ts → sdk-session-DAScB0rW.d.ts} +6 -4
  52. package/dist/types-chunks/{storage.d-CkydxFsV.d.ts → storage.d-CPvn9qI0.d.ts} +2 -2
  53. package/dist/types-chunks/{types.d-BJmoMf5H.d.ts → types.d-6VOXvF88.d.ts} +101 -22
  54. package/dist/types-chunks/types.d-D8WcfrOD.d.ts +143 -0
  55. package/dist/types-chunks/{utils.d-bC97IuQZ.d.ts → utils.d-CpgVIjYZ.d.ts} +16 -18
  56. package/package.json +11 -6
  57. package/dist/chunks/argument-completer-OWEXGWNL.js +0 -2
  58. package/dist/chunks/chunk-4OHXHC2S.js +0 -314
  59. package/dist/chunks/chunk-5YJIAP6C.js +0 -551
  60. package/dist/chunks/chunk-7EAGBLRV.js +0 -2
  61. package/dist/chunks/chunk-CDGOEK3T.js +0 -31
  62. package/dist/chunks/chunk-DHETLULC.js +0 -425
  63. package/dist/chunks/chunk-JCDO2FR4.js +0 -584
  64. package/dist/chunks/chunk-NZVJ3DFC.js +0 -656
  65. package/dist/chunks/chunk-QI3MRJGU.js +0 -5
  66. package/dist/chunks/chunk-XXQ3RLA2.js +0 -2
  67. package/dist/chunks/dist-2267YGB5.js +0 -2
  68. package/dist/chunks/dist-GW32CHO5.js +0 -2
  69. package/dist/chunks/paste-5IDBBQQ3.js +0 -2
  70. package/dist/chunks/utils-J7XBBZGB.js +0 -2
@@ -1,6 +1,6 @@
1
- import { n as KodaXMessage } from './types.d-BJmoMf5H.js';
2
- import { Q as QueueEventListener, e as QueuedMessage, E as EnqueueInput, D as DequeueFilter } from './types.d-BKuHSiR0.js';
3
- import { f as AgentMessage, aM as SessionEntry, aK as Session, aO as SessionExtension, a4 as KodaXSessionLineage, W as KodaXJsonValue, p as CompactionDetails, O as KodaXCompactMemorySeed, a0 as KodaXSessionEntry, ab as KodaXSessionTreeNode, a3 as KodaXSessionLabelEntry, a2 as KodaXSessionGoalEntry, a7 as KodaXSessionNavigationOptions, Y as KodaXSessionArtifactLedgerEntry, x as FileOperations, br as WorkflowMeta, bs as WorkflowModelHint, bt as WorkflowModule } from './process.d-BdiIUr8T.js';
1
+ import { j as KodaXMessage } from './types.d-6VOXvF88.js';
2
+ import { Q as QueueEventListener, c as QueuedMessage, E as EnqueueInput, D as DequeueFilter } from './types.d-D8WcfrOD.js';
3
+ import { f as AgentMessage, aM as SessionEntry, aK as Session, aO as SessionExtension, a4 as KodaXSessionLineage, W as KodaXJsonValue, p as CompactionDetails, O as KodaXCompactMemorySeed, a0 as KodaXSessionEntry, ab as KodaXSessionTreeNode, a3 as KodaXSessionLabelEntry, a2 as KodaXSessionGoalEntry, a7 as KodaXSessionNavigationOptions, Y as KodaXSessionArtifactLedgerEntry, x as FileOperations, br as WorkflowMeta, bs as WorkflowModelHint, bt as WorkflowModule } from './process.d-BZncyzEj.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 `@kodax-ai/llm/src/reasoning-overrides.ts`; this
192
- * helper makes it the canonical path for all packages.)
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
- * - `@kodax-ai/llm/src/reasoning-overrides.ts:49` keeps its inline
212
+ * - llm-layer config helpers keep their inline
213
213
  * `process.env.KODAX_HOME ?? path.join(os.homedir(), '.kodax')`
214
- * fallback because moving it to this helper would create an
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 a `'...'` placeholder
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
- * a `'...'` placeholder text block (preserves message-alternation invariant
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
  /**
@@ -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-BdiIUr8T.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 { K as KodaXBaseProvider } from './base.d-CwPfI8WQ.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-BdiIUr8T.js';
5
- import { f as ToolGuardrail } from './types.d-BKuHSiR0.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 { n as KodaXMessage, Y as KodaXToolDefinition, E as KodaXReasoningMode, _ as KodaXToolResultContentItem, U as KodaXThinkingBlock, H as KodaXRedactedThinkingBlock } from './types.d-BJmoMf5H.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,6 +1,6 @@
1
- import { E as KodaXReasoningMode, V as KodaXThinkingBudgetMap, W as KodaXThinkingDepth, s as KodaXProviderConfig, D as KodaXReasoningCapability, G as KodaXReasoningRequest, R as KodaXTaskType, F as KodaXReasoningOverride, a2 as KodaXVerifyCredentialResult, Y as KodaXToolDefinition, n as KodaXMessage, A as KodaXProviderStreamOptions, L as KodaXStreamResult, o as KodaXModelDescriptor, r as KodaXProviderCapabilityProfile, a3 as KodaXVerifyStrategy, h as KodaXCustomProviderConfig, m as KodaXListModelsResult } from './types.d-BJmoMf5H.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-CwPfI8WQ.js';
3
+ import { K as KodaXBaseProvider } from './base.d-BnjQrSVf.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): 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;
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`:
@@ -119,6 +157,24 @@ declare abstract class KodaXAnthropicCompatProvider extends KodaXBaseProvider {
119
157
  private serializeSystemMessageContent;
120
158
  private buildSystemPrompt;
121
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;
122
178
  }
123
179
 
124
180
  /**
@@ -193,6 +249,8 @@ declare abstract class KodaXOpenAICompatProvider extends KodaXBaseProvider {
193
249
  private appendExtraBody;
194
250
  private resetReasoningCapabilityParams;
195
251
  private applyReasoningCapability;
252
+ private applyReasoningProfile;
253
+ private resolveReasoningProfileBudget;
196
254
  private getFallbackTerms;
197
255
  stream(messages: KodaXMessage[], tools: KodaXToolDefinition[], system: string, reasoning?: boolean | KodaXReasoningRequest, streamOptions?: KodaXProviderStreamOptions, signal?: AbortSignal): Promise<KodaXStreamResult>;
198
256
  supportsNonStreamingFallback(): boolean;
@@ -208,10 +266,10 @@ declare abstract class KodaXOpenAICompatProvider extends KodaXBaseProvider {
208
266
  /**
209
267
  * KodaX Provider Registry
210
268
  *
211
- * Provider 注册表 - 统一管理所有 Provider
269
+ * Provider 注册表 - 统一管理所有 Provider
212
270
  */
213
271
 
214
- 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';
215
273
  /**
216
274
  * Per-provider static metadata. v0.7.43 promoted this from a partial
217
275
  * descriptor (`models: string[]`) to the full capability surface so
@@ -240,6 +298,7 @@ type ProviderSnapshot = {
240
298
  readonly models?: readonly KodaXModelDescriptor[];
241
299
  readonly apiKeyEnv: string;
242
300
  readonly reasoningCapability: KodaXReasoningCapability;
301
+ readonly reasoningProfile?: KodaXReasoningProfile;
243
302
  readonly modelReasoningCapabilities?: Readonly<Record<string, KodaXReasoningCapability>>;
244
303
  readonly capabilityProfile: KodaXProviderCapabilityProfile;
245
304
  /** Maximum input context window (tokens). Provider-level default. */
@@ -271,6 +330,7 @@ declare function getProviderList(): Array<{
271
330
  models: string[];
272
331
  configured: boolean;
273
332
  reasoningCapability: KodaXReasoningCapability;
333
+ reasoningProfile?: KodaXReasoningProfile;
274
334
  capabilityProfile: KodaXProviderCapabilityProfile;
275
335
  }>;
276
336
  declare function getProviderModels(name: string): string[];
@@ -305,6 +365,8 @@ interface KodaXModelCapabilities {
305
365
  supportsThinking: boolean;
306
366
  /** Effective reasoning capability for THIS model (per-model override aware). */
307
367
  reasoningCapability: KodaXReasoningCapability;
368
+ /** Effort-first reasoning capability metadata for THIS model, when known. */
369
+ reasoningProfile?: KodaXReasoningProfile;
308
370
  /** Maximum input context window (tokens). `undefined` for CLI-bridge providers. */
309
371
  contextWindow?: number;
310
372
  /**
@@ -331,10 +393,12 @@ interface KodaXModelCapabilities {
331
393
  */
332
394
  declare function getProviderModelDescriptors(name: string): KodaXModelDescriptor[];
333
395
  /**
334
- * Effective per-model capability surface for a built-in provider. Returns
335
- * `undefined` for unknown provider name or unknown model under a known
336
- * provider caller should fall back to `DEFAULT_CONTEXT_WINDOW` from
337
- * `@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.
338
402
  *
339
403
  * No API key required.
340
404
  */
@@ -501,5 +565,5 @@ declare function listProviderModels(name: string, _opts?: {
501
565
  signal?: AbortSignal;
502
566
  }): Promise<KodaXListModelsResult>;
503
567
 
504
- 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 };
505
- 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-CkydxFsV.js';
2
- import { E as KodaXReasoningMode, n as KodaXMessage, g as KodaXContentBlock } from './types.d-BJmoMf5H.js';
3
- import { m as KodaXAgentMode } from './bash-prefix-extractor.d-DZF1gDDz.js';
4
- import { ac as KodaXSessionUiHistoryItem, ag as KodaXSessionUiToolCall } from './process.d-BdiIUr8T.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-DZF1gDDz.js';
2
- import { $ as KodaXSessionData, a4 as KodaXSessionLineage, a7 as KodaXSessionNavigationOptions, a8 as KodaXSessionRuntimeInfo, aa as KodaXSessionStorage } from './process.d-BdiIUr8T.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