@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.
Files changed (79) hide show
  1. package/CHANGELOG.md +2004 -1887
  2. package/README.md +52 -48
  3. package/README_CN.md +37 -32
  4. package/dist/builtin/code-review/SKILL.md +22 -3
  5. package/dist/chunks/agent-YJNC2755.js +2 -0
  6. package/dist/chunks/argument-completer-QGBNXTYJ.js +2 -0
  7. package/dist/chunks/chunk-526OILYL.js +2 -0
  8. package/dist/chunks/{chunk-ZBK3DZ3S.js → chunk-6AU6EPO6.js} +1 -1
  9. package/dist/chunks/chunk-73Z7BK5H.js +15 -0
  10. package/dist/chunks/chunk-7QB55SYG.js +326 -0
  11. package/dist/chunks/chunk-CQ6EQG7E.js +322 -0
  12. package/dist/chunks/chunk-CV6JHPEO.js +2 -0
  13. package/dist/chunks/chunk-D6QVXQNI.js +1 -0
  14. package/dist/chunks/chunk-HS2K74I4.js +31 -0
  15. package/dist/chunks/chunk-NKHXRN7G.js +403 -0
  16. package/dist/chunks/chunk-OBPB5BQ6.js +310 -0
  17. package/dist/chunks/chunk-P4VF3JEP.js +7 -0
  18. package/dist/chunks/chunk-PIQWODWN.js +18 -0
  19. package/dist/chunks/chunk-QHWXPJEG.js +601 -0
  20. package/dist/chunks/chunk-XXEIFNBE.js +52 -0
  21. package/dist/chunks/chunk-ZZDC75H4.js +681 -0
  22. package/dist/chunks/compaction-config-OPMRZSAK.js +2 -0
  23. package/dist/chunks/{construction-bootstrap-EDDVNP2B.js → construction-bootstrap-CIXFH5SE.js} +4 -4
  24. package/dist/chunks/dist-JSE7NICF.js +2 -0
  25. package/dist/chunks/dist-SDNQOW52.js +2 -0
  26. package/dist/chunks/host-H7FQMMRC.js +2 -0
  27. package/dist/chunks/{paste-5IDBBQQ3.js → paste-Y4DVUWSM.js} +1 -1
  28. package/dist/chunks/run-manager-4H5HWMVW.js +2 -0
  29. package/dist/chunks/utils-FLVVQHM7.js +2 -0
  30. package/dist/index.d.ts +22 -18
  31. package/dist/index.js +6 -6
  32. package/dist/kodax_cli.js +1303 -1108
  33. package/dist/provider-capabilities.json +986 -197
  34. package/dist/sdk-agent.d.ts +162 -14
  35. package/dist/sdk-agent.js +1 -1
  36. package/dist/sdk-coding.d.ts +285 -255
  37. package/dist/sdk-coding.js +1 -1
  38. package/dist/sdk-llm.d.ts +66 -43
  39. package/dist/sdk-llm.js +1 -1
  40. package/dist/sdk-mcp.d.ts +1 -1
  41. package/dist/sdk-mcp.js +1 -1
  42. package/dist/sdk-media.d.ts +64 -5
  43. package/dist/sdk-media.js +1 -1
  44. package/dist/sdk-repl.d.ts +114 -107
  45. package/dist/sdk-repl.js +2 -2
  46. package/dist/sdk-session.d.ts +7 -7
  47. package/dist/sdk-session.js +1 -1
  48. package/dist/sdk-skills.js +1 -1
  49. package/dist/semantic-worker.js +11 -0
  50. package/dist/types-chunks/{base.d-CwPfI8WQ.d.ts → base.d-BA9Doaj_.d.ts} +38 -8
  51. package/dist/types-chunks/{bash-prefix-extractor.d-DZF1gDDz.d.ts → bash-prefix-extractor.d-D3cddmyV.d.ts} +639 -163
  52. package/dist/types-chunks/capability-learning.d-DRV80ISB.d.ts +29 -0
  53. package/dist/types-chunks/{cost-tracker.d-wRtyEW9d.d.ts → cost-tracker.d-CBLk1fiD.d.ts} +24 -2
  54. package/dist/types-chunks/{guardrail.d-DQQknOfb.d.ts → guardrail.d-iK7FwMdW.d.ts} +32 -10
  55. package/dist/types-chunks/{manager.d-DLmDhX3i.d.ts → manager.d-DBD7SOTT.d.ts} +7 -2
  56. package/dist/types-chunks/{process.d-BdiIUr8T.d.ts → process.d-DHow2y2G.d.ts} +170 -14
  57. package/dist/types-chunks/{resolver.d-Djq8KlCE.d.ts → resolver.d-DDOfVYDr.d.ts} +111 -18
  58. package/dist/types-chunks/{capsule.d-D0kjnqYy.d.ts → run-manager.d-ByDcJc5g.d.ts} +124 -13
  59. package/dist/types-chunks/{sdk-session-BP6ZNpOp.d.ts → sdk-session-21Tt3N_x.d.ts} +74 -9
  60. package/dist/types-chunks/{storage.d-CkydxFsV.d.ts → storage.d-BsZrBPYu.d.ts} +2 -2
  61. package/dist/types-chunks/{types.d-BJmoMf5H.d.ts → types.d-Ci5YPFEh.d.ts} +135 -22
  62. package/dist/types-chunks/{types.d-BKuHSiR0.d.ts → types.d-D4ZA8LJV.d.ts} +7 -3
  63. package/dist/types-chunks/{utils.d-bC97IuQZ.d.ts → utils.d-BURxOxFd.d.ts} +94 -19
  64. package/package.json +12 -7
  65. package/dist/chunks/agent-MAAKRAF2.js +0 -2
  66. package/dist/chunks/argument-completer-OWEXGWNL.js +0 -2
  67. package/dist/chunks/chunk-4OHXHC2S.js +0 -314
  68. package/dist/chunks/chunk-5YJIAP6C.js +0 -551
  69. package/dist/chunks/chunk-7EAGBLRV.js +0 -2
  70. package/dist/chunks/chunk-CDGOEK3T.js +0 -31
  71. package/dist/chunks/chunk-DHETLULC.js +0 -425
  72. package/dist/chunks/chunk-JCDO2FR4.js +0 -584
  73. package/dist/chunks/chunk-NZVJ3DFC.js +0 -656
  74. package/dist/chunks/chunk-QI3MRJGU.js +0 -5
  75. package/dist/chunks/chunk-XXQ3RLA2.js +0 -2
  76. package/dist/chunks/compaction-config-NAJEEPG5.js +0 -2
  77. package/dist/chunks/dist-2267YGB5.js +0 -2
  78. package/dist/chunks/dist-GW32CHO5.js +0 -2
  79. package/dist/chunks/utils-J7XBBZGB.js +0 -2
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * KodaX AI Types
3
3
  *
4
- * AI 层类型定义 - 所有 Provider 共享的类型接口
4
+ * AI 层类型定义 - 所有 Provider 共享的类型接口
5
5
  */
6
6
  interface KodaXTextBlock {
7
7
  type: 'text';
@@ -12,6 +12,31 @@ interface KodaXToolUseBlock {
12
12
  id: string;
13
13
  name: string;
14
14
  input: Record<string, unknown>;
15
+ /**
16
+ * Set true when `input` was salvaged from malformed JSON (strict `JSON.parse`
17
+ * threw). RAW signal — set regardless of stop reason. On its own it means the
18
+ * payload is syntactically suspect: even a "complete" turn can carry malformed
19
+ * JSON (e.g. unescaped quotes) that the partial-json salvage silently truncates
20
+ * mid-value. `checkIncompleteToolCalls` therefore treats a salvaged input on a
21
+ * MUTATING tool (write/edit/bash — `isToolMutation`) as incomplete even on a
22
+ * clean stop, because executing a silently-cut payload corrupts files; a
23
+ * salvaged input on a read-only tool is allowed through on a clean stop.
24
+ */
25
+ _salvaged?: boolean;
26
+ /**
27
+ * Set true when `input` was salvaged AND the stream did NOT end on a
28
+ * recognized clean stop (`max_tokens`/`length`, or an ambiguous/`unknown`
29
+ * stop). A truncating stop means the payload may be cut mid-value, so this is
30
+ * unsafe to execute for ANY tool (not just mutating ones) — the agent loop
31
+ * routes it into the incomplete-tool retry (CAP-072). Subset of `_salvaged`.
32
+ *
33
+ * Both markers are internal: provider serializers never write them to the wire
34
+ * (they read only type/id/name/input). They may transiently remain on an
35
+ * assistant tool_use block in session history on the retry-cap path; harmless
36
+ * and never reaches the model. Mirrors the `KodaXMessage._synthetic`
37
+ * convention.
38
+ */
39
+ _truncated?: boolean;
15
40
  }
16
41
  /**
17
42
  * Tool-result content blocks — a structural subset of the full
@@ -93,6 +118,14 @@ interface KodaXMessage {
93
118
  content: string | KodaXContentBlock[];
94
119
  /** Marks messages injected by the system (auto-continue, retry prompts). Hidden in REPL display. */
95
120
  _synthetic?: boolean;
121
+ /**
122
+ * Identifies which subsystem injected a synthetic message so consumers can
123
+ * render/attribute it distinctly instead of treating it like a user query.
124
+ * Absent on genuine user/assistant/system messages. Known values include
125
+ * `'sidecar-verifier'` (Sidecar Verifier revise feedback). Exposed verbatim
126
+ * through `KodaXResult.messages` and session-load APIs for SDK consumers.
127
+ */
128
+ _source?: string;
96
129
  }
97
130
  interface KodaXTokenUsage {
98
131
  inputTokens: number;
@@ -120,6 +153,57 @@ interface KodaXToolDefinition {
120
153
  };
121
154
  }
122
155
  type KodaXReasoningCapability = 'native-effort' | 'native-budget' | 'native-toggle' | 'native-adaptive' | 'none' | 'prompt-only' | 'unknown';
156
+ type KodaXStableEffortIntent = 'auto' | 'none' | 'low' | 'medium' | 'high';
157
+ type KodaXWireReasoningEffort = string;
158
+ type KodaXReasoningPresetName = 'zai-glm-5.2' | 'zai-glm-toggle' | 'deepseek-v4-openai' | 'deepseek-v4-anthropic' | 'deepseek-toggle' | 'kimi-k2.7-code' | 'kimi-hybrid-toggle' | 'minimax-m3' | 'minimax-m2-always' | 'mimo-v2.5-toggle' | 'qwen-hybrid-thinking' | 'openai-chat-reasoning' | 'openai-responses-reasoning' | 'codex-cli-effort' | 'claude-adaptive-xhigh' | 'claude-adaptive-max' | 'anthropic-budget' | 'generic-thinking-toggle' | 'none';
159
+ interface KodaXReasoningEffortRequest {
160
+ readonly value: KodaXWireReasoningEffort;
161
+ readonly isExplicit: boolean;
162
+ }
163
+ interface KodaXReasoningEffortPreset {
164
+ readonly value: KodaXWireReasoningEffort;
165
+ readonly description?: string;
166
+ readonly isDefault?: boolean;
167
+ readonly isUserVisible?: boolean;
168
+ }
169
+ type KodaXReasoningEffortWireStrategy = 'openai-responses-effort' | 'openai-chat-effort' | 'codex-cli-config' | 'anthropic-output-effort' | 'anthropic-reasoning-effort' | 'provider-budget' | 'provider-toggle' | 'prompt-only' | 'none';
170
+ type KodaXThinkingWireStrategy = 'anthropic-adaptive' | 'anthropic-budget' | 'provider-budget' | 'provider-toggle' | 'none';
171
+ interface KodaXReasoningProfile {
172
+ readonly reasoningPreset?: KodaXReasoningPresetName;
173
+ readonly effortStrategy: KodaXReasoningEffortWireStrategy;
174
+ readonly thinkingStrategy?: KodaXThinkingWireStrategy;
175
+ readonly defaultEffort?: KodaXWireReasoningEffort;
176
+ readonly supportedEfforts?: readonly KodaXReasoningEffortPreset[];
177
+ readonly effortAliases?: Partial<Record<KodaXWireReasoningEffort, KodaXWireReasoningEffort>>;
178
+ readonly disabledEfforts?: readonly KodaXWireReasoningEffort[];
179
+ readonly localRejectEfforts?: readonly KodaXWireReasoningEffort[];
180
+ readonly allowCustomEffort?: boolean;
181
+ readonly budgetByEffort?: Partial<Record<KodaXWireReasoningEffort, number>>;
182
+ readonly supportsReasoningEffort?: boolean;
183
+ readonly supportsReasoningSummary?: boolean;
184
+ readonly supportsEncryptedReasoningReplay?: boolean;
185
+ readonly supportsAdaptiveThinking?: boolean;
186
+ readonly supportsManualThinkingBudget?: boolean;
187
+ readonly supportsDisabledThinking?: boolean;
188
+ readonly requiresEffortBetaHeader?: boolean;
189
+ }
190
+ /**
191
+ * Friendly reasoning declaration for CUSTOM providers / models — the canonical
192
+ * user-facing form. List the effort rungs the model accepts (order = the Ctrl+T
193
+ * ladder; include `"off"` to allow disabling thinking) plus an optional
194
+ * `default`. The wire strategy (effortStrategy / thinkingStrategy) is derived
195
+ * from the provider `protocol`, so users never touch preset names or strategy
196
+ * enums. Use the string `"none"` for a model with no thinking capability. For
197
+ * full, explicit control fall back to `reasoningProfile`.
198
+ *
199
+ * Example: `"reasoning": { "efforts": ["off", "low", "high", "max"], "default": "high" }`
200
+ */
201
+ interface KodaXSimpleReasoningConfig {
202
+ readonly efforts: readonly string[];
203
+ readonly default?: string;
204
+ }
205
+ /** User-facing reasoning declaration: friendly form, `"none"`, or (advanced) a raw profile override. */
206
+ type KodaXReasoningConfig = KodaXSimpleReasoningConfig | 'none' | Partial<KodaXReasoningProfile>;
123
207
  type KodaXProviderTransport = 'native-api' | 'cli-bridge';
124
208
  type KodaXProviderConversationSemantics = 'full-history' | 'last-user-message';
125
209
  type KodaXProviderMcpSupport = 'native' | 'none';
@@ -140,7 +224,6 @@ interface KodaXProviderCapabilityProfile {
140
224
  multimodalSupport?: KodaXProviderMultimodalSupport;
141
225
  evidenceSupport?: KodaXProviderEvidenceSupport;
142
226
  }
143
- type KodaXReasoningOverride = 'budget' | 'effort' | 'toggle' | 'adaptive' | 'none';
144
227
  type KodaXReasoningMode = 'off' | 'auto' | 'quick' | 'balanced' | 'deep';
145
228
  type KodaXThinkingDepth = 'off' | 'low' | 'medium' | 'high';
146
229
  type KodaXTaskType = 'conversation' | 'lookup' | 'review' | 'bugfix' | 'edit' | 'refactor' | 'plan' | 'qa' | 'unknown';
@@ -155,23 +238,7 @@ type KodaXMutationSurface = 'read-only' | 'docs-only' | 'code' | 'system';
155
238
  type KodaXAssuranceIntent = 'default' | 'explicit-check';
156
239
  type KodaXHarnessProfile = 'H0_DIRECT' | 'H1_EXECUTE_EVAL' | 'H2_PLAN_EXECUTE_EVAL' | 'PLANNED';
157
240
  type KodaXReviewScale = 'small' | 'large' | 'massive';
158
- type KodaXAmaProfile = 'tactical' | 'managed';
159
- type KodaXAmaTactic = 'direct' | 'child-fanout' | 'planning-pass' | 'verification-pass' | 'repair-loop';
160
- type KodaXAmaFanoutClass = 'finding-validation' | 'evidence-scan' | 'module-triage' | 'hypothesis-check';
161
- interface KodaXAmaFanoutPolicy {
162
- admissible: boolean;
163
- class?: KodaXAmaFanoutClass;
164
- reason: string;
165
- maxChildren?: number;
166
- requiresReadOnly?: boolean;
167
- }
168
- interface KodaXAmaControllerDecision {
169
- profile: KodaXAmaProfile;
170
- tactics: KodaXAmaTactic[];
171
- fanout: KodaXAmaFanoutPolicy;
172
- reason: string;
173
- upgradeTriggers: string[];
174
- }
241
+ type KodaXChildFanoutClass = 'finding-validation' | 'evidence-scan' | 'module-triage' | 'hypothesis-check';
175
242
  interface KodaXTaskRoutingDecision {
176
243
  primaryTask: KodaXTaskType;
177
244
  secondaryTask?: KodaXTaskType;
@@ -207,18 +274,40 @@ interface KodaXThinkingBudgetMap {
207
274
  type KodaXTaskBudgetOverrides = Partial<Record<KodaXTaskType, Partial<KodaXThinkingBudgetMap>>>;
208
275
  interface KodaXReasoningRequest {
209
276
  enabled?: boolean;
210
- mode?: KodaXReasoningMode;
211
- depth?: KodaXThinkingDepth;
277
+ /**
278
+ * Canonical reasoning control. Reasoning single-tracking removed the legacy
279
+ * `mode` (KodaXReasoningMode) + `depth` (KodaXThinkingDepth) request fields —
280
+ * callers pass `effort` (or `enabled` as a boolean shorthand). Providers
281
+ * derive any thinking budget from the effort via `effortToThinkingDepth`.
282
+ */
283
+ effort?: KodaXWireReasoningEffort;
212
284
  taskType?: KodaXTaskType;
213
285
  executionMode?: KodaXExecutionMode;
214
286
  }
287
+ interface KodaXNormalizedReasoningRequest {
288
+ enabled: boolean;
289
+ effort: KodaXWireReasoningEffort;
290
+ effortSource?: 'explicit' | 'legacy';
291
+ taskType: KodaXTaskType;
292
+ executionMode: KodaXExecutionMode;
293
+ }
215
294
  interface KodaXModelDescriptor {
216
295
  id: string;
217
296
  displayName?: string;
218
297
  contextWindow?: number;
219
298
  maxOutputTokens?: number;
220
299
  thinkingBudgetCap?: number;
300
+ /** @deprecated Auto-migrated on load. Prefer `reasoning: { efforts, default }`. */
221
301
  reasoningCapability?: KodaXReasoningCapability;
302
+ /** @deprecated Internal preset name; auto-migrated on load. Prefer `reasoning`. */
303
+ reasoningPreset?: KodaXReasoningPresetName;
304
+ /**
305
+ * Canonical reasoning declaration: friendly `{ efforts, default }`, `"none"`,
306
+ * or (advanced) a raw `Partial<KodaXReasoningProfile>` override. See
307
+ * `KodaXReasoningConfig`.
308
+ */
309
+ reasoning?: KodaXReasoningConfig;
310
+ reasoningProfile?: KodaXReasoningProfile;
222
311
  /**
223
312
  * Per-model override for `replayReasoningContent`. Falls through to the
224
313
  * provider-level flag when undefined. Lets a single gateway endpoint
@@ -309,6 +398,14 @@ interface KodaXCustomProviderConfig {
309
398
  baseUrl: string;
310
399
  apiKeyEnv: string;
311
400
  model: string;
401
+ /** @deprecated Internal preset name; auto-migrated on load. Prefer `reasoning`. */
402
+ reasoningPreset?: KodaXReasoningPresetName;
403
+ /**
404
+ * Canonical reasoning declaration for this provider: friendly
405
+ * `{ efforts, default }`, `"none"`, or (advanced) a raw profile override.
406
+ * See `KodaXReasoningConfig`.
407
+ */
408
+ reasoning?: KodaXReasoningConfig;
312
409
  /**
313
410
  * Additional available models beyond the default. Accepts either a
314
411
  * plain model id string (legacy) or a KodaXModelDescriptor object
@@ -322,8 +419,11 @@ interface KodaXCustomProviderConfig {
322
419
  * - sdk: keep the upstream SDK default User-Agent
323
420
  */
324
421
  userAgentMode?: KodaXProviderUserAgentMode;
422
+ /** @deprecated Auto-migrated on load. Prefer `reasoning: "none"` (off) or `reasoning: { efforts, default }`. */
325
423
  supportsThinking?: boolean;
424
+ /** @deprecated Auto-migrated on load. Prefer `reasoning: { efforts, default }`. */
326
425
  reasoningCapability?: KodaXReasoningCapability;
426
+ reasoningProfile?: KodaXReasoningProfile;
327
427
  capabilityProfile?: KodaXProviderCapabilityProfile;
328
428
  contextWindow?: number;
329
429
  maxOutputTokens?: number;
@@ -370,6 +470,7 @@ interface KodaXProviderConfig {
370
470
  userAgentMode?: KodaXProviderUserAgentMode;
371
471
  supportsThinking: boolean;
372
472
  reasoningCapability?: KodaXReasoningCapability;
473
+ reasoningProfile?: KodaXReasoningProfile;
373
474
  capabilityProfile?: KodaXProviderCapabilityProfile;
374
475
  /** 模型的上下文窗口大小 (tokens) */
375
476
  contextWindow?: number;
@@ -471,6 +572,18 @@ interface KodaXProviderStreamOptions {
471
572
  maxAttempts: number;
472
573
  }) => void;
473
574
  /** 会话标识,用于多轮对话上下文恢复 */
575
+ /**
576
+ * Passive capability learning: fired when a provider HARD-rejects a
577
+ * reasoning-effort value (400/422 naming the param). Hosts can record it via
578
+ * the agent-layer capability cache so the rung is removed from the effective
579
+ * ladder and never offered or sent again (see
580
+ * `classifyReasoningEffortRejection`).
581
+ */
582
+ onReasoningEffortRejected?: (event: {
583
+ provider: string;
584
+ model: string;
585
+ effort: string;
586
+ }) => void;
474
587
  sessionId?: string;
475
588
  /** Override the provider's default model for a single request */
476
589
  modelOverride?: string;
@@ -482,4 +595,4 @@ interface KodaXProviderStreamOptions {
482
595
  signal?: AbortSignal;
483
596
  }
484
597
 
485
- export type { KodaXToolResultImageItem as $, KodaXProviderStreamOptions as A, KodaXProviderToolCallingFidelity as B, KodaXProviderTransport as C, KodaXReasoningCapability as D, KodaXReasoningMode as E, KodaXReasoningOverride as F, KodaXReasoningRequest as G, KodaXRedactedThinkingBlock as H, KodaXReviewScale as I, KodaXRiskLevel as J, KodaXAmaControllerDecision as K, KodaXStreamResult as L, KodaXTaskActionability as M, KodaXTaskBudgetOverrides as N, KodaXTaskComplexity as O, KodaXTaskFamily as P, KodaXTaskRoutingDecision as Q, KodaXTaskType as R, KodaXTaskWorkIntent as S, KodaXTextBlock as T, KodaXThinkingBlock as U, KodaXThinkingBudgetMap as V, KodaXThinkingDepth as W, KodaXTokenUsage as X, KodaXToolDefinition as Y, KodaXToolResultBlock as Z, KodaXToolResultContentItem as _, KodaXAmaFanoutClass as a, KodaXToolResultTextItem as a0, KodaXToolUseBlock as a1, KodaXVerifyCredentialResult as a2, KodaXVerifyStrategy as a3, KodaXAmaFanoutPolicy as b, KodaXAmaProfile as c, KodaXAmaTactic as d, KodaXAssuranceIntent as e, KodaXCacheBoundary as f, KodaXContentBlock as g, KodaXCustomProviderConfig as h, KodaXExecutionMode as i, KodaXExecutionPattern as j, KodaXHarnessProfile as k, KodaXImageBlock as l, KodaXListModelsResult as m, KodaXMessage as n, KodaXModelDescriptor as o, KodaXMutationSurface as p, KodaXProtocolFamily as q, KodaXProviderCapabilityProfile as r, KodaXProviderConfig as s, KodaXProviderContextFidelity as t, KodaXProviderConversationSemantics as u, KodaXProviderEvidenceSupport as v, KodaXProviderLongRunningSupport as w, KodaXProviderMcpSupport as x, KodaXProviderMultimodalSupport as y, KodaXProviderSessionSupport as z };
598
+ export type { KodaXToolResultBlock as $, KodaXReasoningCapability as A, KodaXReasoningEffortPreset as B, KodaXReasoningEffortRequest as C, KodaXReasoningEffortWireStrategy as D, KodaXReasoningMode as E, KodaXReasoningProfile as F, KodaXReasoningRequest as G, KodaXRedactedThinkingBlock as H, KodaXReviewScale as I, KodaXRiskLevel as J, KodaXAssuranceIntent as K, KodaXStableEffortIntent as L, KodaXStreamResult as M, KodaXTaskActionability as N, KodaXTaskBudgetOverrides as O, KodaXTaskComplexity as P, KodaXTaskFamily as Q, KodaXTaskRoutingDecision as R, KodaXTaskType as S, KodaXTaskWorkIntent as T, KodaXTextBlock as U, KodaXThinkingBlock as V, KodaXThinkingBudgetMap as W, KodaXThinkingDepth as X, KodaXThinkingWireStrategy as Y, KodaXTokenUsage as Z, KodaXToolDefinition as _, KodaXCacheBoundary as a, KodaXToolResultContentItem as a0, KodaXToolResultImageItem as a1, KodaXToolResultTextItem as a2, KodaXToolUseBlock as a3, KodaXVerifyCredentialResult as a4, KodaXVerifyStrategy as a5, KodaXWireReasoningEffort as a6, KodaXChildFanoutClass as b, KodaXContentBlock as c, KodaXCustomProviderConfig as d, KodaXExecutionMode as e, KodaXExecutionPattern as f, KodaXHarnessProfile as g, KodaXImageBlock as h, KodaXListModelsResult as i, KodaXMessage as j, KodaXModelDescriptor as k, KodaXMutationSurface as l, KodaXNormalizedReasoningRequest as m, KodaXProtocolFamily as n, KodaXProviderCapabilityProfile as o, KodaXProviderConfig as p, KodaXProviderContextFidelity as q, KodaXProviderConversationSemantics as r, KodaXProviderEvidenceSupport as s, KodaXProviderLongRunningSupport as t, KodaXProviderMcpSupport as u, KodaXProviderMultimodalSupport as v, KodaXProviderSessionSupport as w, KodaXProviderStreamOptions as x, KodaXProviderToolCallingFidelity as y, KodaXProviderTransport as z };
@@ -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 { z as Guardrail, aO as RunnerToolCall, e as Agent, g as AgentMessage, aR as RunnerToolResult, a_ as Span, _ as KodaXInputArtifact } from './process.d-DHow2y2G.js';
2
2
 
3
3
  /**
4
4
  * Guardrail Runtime — FEATURE_085 (v0.7.26).
@@ -165,8 +165,10 @@ declare function runToolAfterGuardrails(call: RunnerToolCall, result: RunnerTool
165
165
  * Phase 0.6 study (`c:/tmp/claude-code-actual-usage.md`): Claude Code's
166
166
  * `'now'` priority has zero production usage; KodaX simplifies to 2 tiers.
167
167
  */
168
+
168
169
  type MessagePriority = 'user' | 'background';
169
170
  type MessageMode = 'prompt' | 'task-notification' | 'system-reminder';
171
+ type QueuedInputArtifact = KodaXInputArtifact;
170
172
  interface QueuedMessage {
171
173
  /** Stable id for tracing / dedup. Format: `msg-<sequence>`. */
172
174
  readonly id: string;
@@ -182,6 +184,7 @@ interface QueuedMessage {
182
184
  readonly agentId?: string;
183
185
  readonly mode: MessageMode;
184
186
  readonly content: string;
187
+ readonly inputArtifacts?: readonly QueuedInputArtifact[];
185
188
  /** Wall-clock timestamp (`Date.now()`) for tracing only — not used for ordering. */
186
189
  readonly enqueuedAt: number;
187
190
  }
@@ -267,7 +270,8 @@ interface EnqueueInput {
267
270
  readonly mode: MessageMode;
268
271
  readonly content: string;
269
272
  readonly agentId?: string;
273
+ readonly inputArtifacts?: readonly QueuedInputArtifact[];
270
274
  }
271
275
 
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 };
276
+ export { GuardrailBlockedError as G, GuardrailEscalateError as b, collectGuardrails as h, runOutputGuardrails as i, runToolAfterGuardrails as j, runToolBeforeGuardrails as k, runInputGuardrails as r };
277
+ 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, QueuedInputArtifact as e, QueuedMessage as f, ToolGuardrail as g };
@@ -1,8 +1,8 @@
1
- import { U as KodaXOptions, u as KodaXContextTokenSnapshot, m as KodaXAgentMode, Z as KodaXRepoIntelligenceMode, aa as KodaXSkillInvocationContext } from './bash-prefix-extractor.d-DZF1gDDz.js';
2
- import { c as SessionStorage$1, b as PermissionMode } from './storage.d-CkydxFsV.js';
3
- import { ac as KodaXSessionUiHistoryItem, a4 as KodaXSessionLineage, Y as KodaXSessionArtifactLedgerEntry, Q as KodaXExtensionSessionState, P as KodaXExtensionSessionRecord, a8 as KodaXSessionRuntimeInfo, aa as KodaXSessionStorage, $ as KodaXSessionData, bD as WorkflowProcessSource } from './process.d-BdiIUr8T.js';
4
- import { n as KodaXMessage, E as KodaXReasoningMode, r as KodaXProviderCapabilityProfile, F as KodaXReasoningOverride, h as KodaXCustomProviderConfig } from './types.d-BJmoMf5H.js';
5
- import { A as AgentsFile, f as AutoModeStats, l as KodaXMcpServersConfig } from './guardrail.d-DQQknOfb.js';
1
+ import { P as KodaXOptions, v as KodaXContextTokenSnapshot, m as KodaXAgentMode, U as KodaXRepoIntelligenceMode, a5 as KodaXSkillInvocationContext } from './bash-prefix-extractor.d-D3cddmyV.js';
2
+ import { c as SessionStorage$1, b as PermissionMode } from './storage.d-BsZrBPYu.js';
3
+ import { ai as KodaXSessionUiHistoryItem, aa as KodaXSessionLineage, a2 as KodaXSessionArtifactLedgerEntry, R as KodaXExtensionSessionState, Q as KodaXExtensionSessionRecord, ae as KodaXSessionRuntimeInfo, ag as KodaXSessionStorage, a5 as KodaXSessionData, bL as WorkflowProcessSource } from './process.d-DHow2y2G.js';
4
+ import { j as KodaXMessage, E as KodaXReasoningMode, o as KodaXProviderCapabilityProfile, d as KodaXCustomProviderConfig } from './types.d-Ci5YPFEh.js';
5
+ import { A as AgentsFile, f as AutoModeStats, l as KodaXMcpServersConfig } from './guardrail.d-iK7FwMdW.js';
6
6
  import * as readline from 'readline';
7
7
  import { SpawnSyncReturns } from 'child_process';
8
8
 
@@ -155,13 +155,14 @@ interface CommandExecutionMetadata {
155
155
  interface CurrentConfig {
156
156
  provider: string;
157
157
  model?: string;
158
+ effort?: string;
159
+ effortOverride?: boolean;
160
+ planModeEffort?: string;
158
161
  thinking: boolean;
159
162
  reasoningMode: KodaXReasoningMode;
160
163
  agentMode: KodaXAgentMode;
161
164
  permissionMode: PermissionMode;
162
165
  repoIntelligenceMode?: KodaXRepoIntelligenceMode;
163
- repointelEndpoint?: string;
164
- repointelBin?: string;
165
166
  repoIntelligenceTrace?: boolean;
166
167
  /** FEATURE_102 Phase 3 — cross-provider child fallback chain. */
167
168
  fallbackProviders?: string[];
@@ -180,14 +181,13 @@ interface CommandCallbacks {
180
181
  clearHistory: () => void;
181
182
  printHistory: () => void;
182
183
  switchProvider?: (provider: string, model?: string) => void;
184
+ setEffort?: (effort?: string) => void;
183
185
  setThinking?: (enabled: boolean) => void;
184
186
  setReasoningMode?: (mode: KodaXReasoningMode) => void;
185
187
  setAgentMode?: (mode: KodaXAgentMode) => void;
186
188
  setPermissionMode?: (mode: PermissionMode) => void;
187
189
  setRepoIntelligenceRuntime?: (update: {
188
190
  mode?: KodaXRepoIntelligenceMode;
189
- endpoint?: string | null;
190
- bin?: string | null;
191
191
  trace?: boolean;
192
192
  }) => void;
193
193
  deleteSession?: (id: string) => Promise<void>;
@@ -277,6 +277,14 @@ interface CommandInvocationRequest extends CommandExecutionMetadata {
277
277
  displayName: string;
278
278
  path?: string;
279
279
  skillInvocation?: KodaXSkillInvocationContext;
280
+ /**
281
+ * FEATURE_246: per-turn agent-mode elevation for this invocation only.
282
+ * The `/workflow` command in AMA sets this to `'amaw'` so its authoring turn
283
+ * gets `run_workflow` (scout-then-author) — matching AMAW's capability without
284
+ * making plain AMA self-activate workflows from natural language. The session
285
+ * mode is unchanged; only this one turn runs elevated.
286
+ */
287
+ agentModeOverride?: KodaXAgentMode;
280
288
  }
281
289
  interface CommandWorkflowInvocationRequest {
282
290
  request: string;
@@ -339,7 +347,7 @@ declare function executeCommand(parsed: {
339
347
 
340
348
  /**
341
349
  * KodaX CLI Utilities
342
- * CLI 层工具函数
350
+ * CLI 灞傚伐鍏峰嚱鏁?
343
351
  */
344
352
 
345
353
  /**
@@ -411,6 +419,8 @@ declare function isProviderConfigured(name: string): boolean;
411
419
  declare function loadConfig(): {
412
420
  provider?: string;
413
421
  model?: string;
422
+ effort?: string;
423
+ planModeEffort?: string;
414
424
  thinking?: boolean;
415
425
  reasoningMode?: KodaXReasoningMode;
416
426
  /**
@@ -424,14 +434,11 @@ declare function loadConfig(): {
424
434
  agentMode?: KodaXAgentMode;
425
435
  permissionMode?: string;
426
436
  locale?: string;
427
- providerReasoningOverrides?: Record<string, KodaXReasoningOverride>;
428
437
  providerModels?: Record<string, string[]>;
429
438
  customProviders?: KodaXCustomProviderConfig[];
430
439
  extensions?: string[];
431
440
  mcpServers?: KodaXMcpServersConfig;
432
- repoIntelligenceMode?: 'auto' | 'off' | 'oss' | 'premium-shared' | 'premium-native';
433
- repointelEndpoint?: string;
434
- repointelBin?: string;
441
+ repoIntelligenceMode?: 'auto' | 'off' | 'light' | 'full';
435
442
  repoIntelligenceTrace?: boolean;
436
443
  streamIdleTimeoutMs?: number;
437
444
  /**
@@ -459,24 +466,71 @@ declare function loadConfig(): {
459
466
  * layer, which has no config access. Set via the `/fallback` command.
460
467
  */
461
468
  fallbackProviders?: string[];
469
+ /**
470
+ * Per-agent model TIERS for the workflow / dispatch `model_hint` (M2 config
471
+ * surface). Operators point a tier at a concrete provider+model; a workflow
472
+ * script / dispatch then expresses intent via `modelHint: 'fast' | 'deep'`.
473
+ * 'fast' routes read-only children only (write/codegen stays on the parent —
474
+ * a quality guard); 'deep' routes any child. Mirrored to
475
+ * KODAX_FAST/DEEP_PROVIDER/MODEL for the coding layer (which has no config
476
+ * access); env wins if pre-set. An unset tier inherits the parent model.
477
+ */
478
+ fastProvider?: string;
479
+ fastModel?: string;
480
+ deepProvider?: string;
481
+ deepModel?: string;
482
+ /**
483
+ * Config surface for settings the coding/llm layer reads only via env (it has
484
+ * no config access). Bridged to their KODAX_* env vars in prepareRuntimeConfig
485
+ * (env-wins). See CONFIG_ENV_BRIDGES for the mapping.
486
+ */
487
+ maxOutputTokens?: number;
488
+ disablePromptCache?: boolean;
489
+ lsp?: boolean;
490
+ lspAutoDownload?: boolean;
491
+ acpLogLevel?: string;
492
+ sessionRetentionDays?: number;
493
+ repoIntelligence?: {
494
+ toolWaitMs?: number;
495
+ workerTimeoutMs?: number;
496
+ workerOldSpaceMb?: number;
497
+ storageDir?: string;
498
+ };
499
+ workflow?: {
500
+ maxConcurrency?: number;
501
+ };
462
502
  };
503
+ /**
504
+ * F1 — first-launch onboarding. config.json must be STRICT JSON (no comments), so we
505
+ * cannot ship a self-documenting config.json. Instead, on first launch (no config.json
506
+ * yet) we write a heavily-commented `config.example.jsonc` REFERENCE file next to it.
507
+ * It is never loaded by KodaX — it exists purely so a new user can see the minimal
508
+ * fields and the inline guidance (especially custom-provider thinking/reasoning) and
509
+ * copy what they need into config.json.
510
+ *
511
+ * Returns the example path only when it was just created (so the caller can print a
512
+ * one-time pointer); returns undefined if config.json already exists, the example
513
+ * already exists, or the write failed. Never throws — a template-write failure must
514
+ * not block startup.
515
+ */
516
+ declare const KODAX_EXAMPLE_CONFIG_FILE: string;
517
+ declare function ensureExampleConfigFile(): string | undefined;
463
518
  declare function prepareRuntimeConfig(): ReturnType<typeof loadConfig>;
464
519
  declare function saveConfig(config: {
465
520
  provider?: string;
466
521
  model?: string;
522
+ effort?: string;
523
+ planModeEffort?: string;
467
524
  thinking?: boolean;
468
525
  reasoningMode?: KodaXReasoningMode;
469
526
  agentMode?: KodaXAgentMode;
470
527
  permissionMode?: string;
471
528
  locale?: string;
472
- providerReasoningOverrides?: Record<string, KodaXReasoningOverride>;
473
529
  providerModels?: Record<string, string[]>;
474
530
  customProviders?: KodaXCustomProviderConfig[];
475
531
  extensions?: string[];
476
532
  mcpServers?: KodaXMcpServersConfig;
477
- repoIntelligenceMode?: 'auto' | 'off' | 'oss' | 'premium-shared' | 'premium-native';
478
- repointelEndpoint?: string;
479
- repointelBin?: string;
533
+ repoIntelligenceMode?: 'auto' | 'off' | 'light' | 'full';
480
534
  repoIntelligenceTrace?: boolean;
481
535
  /** FEATURE_184 Phase D.3 follow-up — opt-in verifier log line. */
482
536
  verifierLog?: boolean;
@@ -484,6 +538,27 @@ declare function saveConfig(config: {
484
538
  stallLog?: boolean;
485
539
  /** FEATURE_102 Phase 3 — cross-provider child fallback chain. */
486
540
  fallbackProviders?: string[];
541
+ /** M2 — per-agent model tiers (workflow / dispatch model_hint). */
542
+ fastProvider?: string;
543
+ fastModel?: string;
544
+ deepProvider?: string;
545
+ deepModel?: string;
546
+ /** Config surface bridged to KODAX_* env for the coding/llm layer. */
547
+ maxOutputTokens?: number;
548
+ disablePromptCache?: boolean;
549
+ lsp?: boolean;
550
+ lspAutoDownload?: boolean;
551
+ acpLogLevel?: string;
552
+ sessionRetentionDays?: number;
553
+ repoIntelligence?: {
554
+ toolWaitMs?: number;
555
+ workerTimeoutMs?: number;
556
+ workerOldSpaceMb?: number;
557
+ storageDir?: string;
558
+ };
559
+ workflow?: {
560
+ maxConcurrency?: number;
561
+ };
487
562
  }): void;
488
563
  /**
489
564
  * Get git root directory.
@@ -502,5 +577,5 @@ declare function saveConfig(config: {
502
577
  declare function getGitRoot(cwd?: string): Promise<string | null>;
503
578
  declare function rateLimitedCall<T>(fn: () => Promise<T>): Promise<T>;
504
579
 
505
- export { BUILTIN_COMMANDS as B, KODAX_CONFIG_FILE as K, PREVIEW_MAX_LENGTH as P, KODAX_DIR as e, KODAX_SESSIONS_DIR as f, KODAX_VERSION as g, createInteractiveContext as h, executeCommand as i, getGitRoot as j, getProviderList as k, getProviderModel as l, getVersion as m, hydrateProcessEnvFromShell as n, isProviderConfigured as o, loadConfig as p, parseCommand as q, prepareRuntimeConfig as r, processSpecialSyntax as s, rateLimitedCall as t, registerConfiguredCustomProviders as u, runInkInteractiveMode as v, runInteractiveMode as w, saveConfig as x, touchContext as y };
580
+ export { touchContext as A, BUILTIN_COMMANDS as B, KODAX_CONFIG_FILE as K, PREVIEW_MAX_LENGTH as P, KODAX_DIR as e, KODAX_EXAMPLE_CONFIG_FILE as f, KODAX_SESSIONS_DIR as g, KODAX_VERSION as h, createInteractiveContext as i, ensureExampleConfigFile as j, executeCommand as k, getGitRoot as l, getProviderList as m, getProviderModel as n, getVersion as o, hydrateProcessEnvFromShell as p, isProviderConfigured as q, loadConfig as r, parseCommand as s, prepareRuntimeConfig as t, processSpecialSyntax as u, rateLimitedCall as v, registerConfiguredCustomProviders as w, runInkInteractiveMode as x, runInteractiveMode as y, saveConfig as z };
506
581
  export type { Command as C, InkREPLOptions as I, RepLOptions as R, CommandCallbacks as a, CurrentConfig as b, InteractiveContext as c, InteractiveMode as d };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kodax-ai/kodax",
3
- "version": "0.7.56",
4
- "description": "极致轻量化 Coding Agent - TypeScript 实现,支持 12 LLM 提供商,可发布为免 Node 单文件二进制",
3
+ "version": "0.7.58",
4
+ "description": "KodaX lightweight coding agent - TypeScript implementation with 15 built-in LLM provider aliases, published as a Node-free single-file CLI and SDK",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "publishConfig": {
@@ -64,9 +64,7 @@
64
64
  "dev:mem-diag": "node scripts/mem-diag-launch.cjs",
65
65
  "dev:mem-snapshot": "node scripts/mem-diag-launch.cjs 2",
66
66
  "probe:reasoning": "tsx scripts/probe-reasoning.ts",
67
- "repointel:install": "node clients/repointel/scripts/install.mjs",
68
- "repointel:demo": "node clients/repointel/scripts/demo.mjs",
69
- "repointel:doctor": "node clients/repointel/scripts/doctor.mjs",
67
+ "probe:max-tokens": "node scripts/probe-max-tokens.mjs",
70
68
  "start": "node --max-old-space-size=4096 --require ./scripts/production-env.cjs dist/kodax_cli.js",
71
69
  "build:binary": "node scripts/build-binary.mjs",
72
70
  "build:binary:all": "node scripts/build-binary.mjs --all",
@@ -75,6 +73,7 @@
75
73
  "test:eval": "vitest run -c vitest.eval.config.ts",
76
74
  "bench:perf": "tsx benchmark/perf/repl-render-perf.bench.ts",
77
75
  "bench:perf:e2e": "tsx benchmark/perf/repl-render-engine-e2e.bench.ts",
76
+ "bench:repo-intel": "tsx benchmark/perf/repo-intelligence-index.bench.ts",
78
77
  "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
79
78
  "clean:packages": "npm run clean --workspaces"
80
79
  },
@@ -149,10 +148,16 @@
149
148
  },
150
149
  "repository": {
151
150
  "type": "git",
152
- "url": "https://github.com/icetomoyo/KodaX.git"
151
+ "url": "git+https://github.com/icetomoyo/KodaX.git"
153
152
  },
154
153
  "files": [
155
- "dist",
154
+ "dist/*.d.ts",
155
+ "dist/*.js",
156
+ "dist/builtin",
157
+ "dist/chunks",
158
+ "dist/provider-capabilities.json",
159
+ "dist/semantic-worker.js",
160
+ "dist/types-chunks",
156
161
  "scripts/kodax-bin.cjs",
157
162
  "scripts/production-env.cjs",
158
163
  "README.md",
@@ -1,2 +0,0 @@
1
- // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{Pb as c,Qb as d,Rb as e,Sb as f,kc as g,lc as h,pd as i,ud as j}from"./chunk-NZVJ3DFC.js";import"./chunk-QI3MRJGU.js";import"./chunk-CDGOEK3T.js";import{jb as a,kb as b}from"./chunk-JCDO2FR4.js";import"./chunk-V4WSBIXB.js";export{d as bucketProviderPayloadSize,g as buildAutoRepoIntelligenceContext,e as checkPromiseSignal,b as cleanupIncompleteToolCalls,h as describeTransientProviderRetry,f as emitResilienceDebug,c as estimateProviderPayloadBytes,j as runKodaX,i as saveSessionSnapshot,a as validateAndFixToolHistory};
@@ -1,2 +0,0 @@
1
- // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{wa as a,xa as b}from"./chunk-5YJIAP6C.js";import"./chunk-7EAGBLRV.js";import"./chunk-ZBK3DZ3S.js";import"./chunk-DHETLULC.js";import"./chunk-NZVJ3DFC.js";import"./chunk-QI3MRJGU.js";import"./chunk-CDGOEK3T.js";import"./chunk-JCDO2FR4.js";import"./chunk-V4WSBIXB.js";export{a as ArgumentCompleter,b as createArgumentCompleter};