@kodax-ai/kodax 0.7.72 → 0.7.74

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 (91) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/README.md +72 -18
  3. package/README_CN.md +55 -14
  4. package/config-templates/config.example.jsonc +7 -0
  5. package/dist/chunks/agent-2ABIG5NW.js +2 -0
  6. package/dist/chunks/argument-completer-C45DEO34.js +2 -0
  7. package/dist/chunks/chunk-5GH3SVI3.js +74 -0
  8. package/dist/chunks/{chunk-SQODXBLX.js → chunk-64M5HOCA.js} +1 -1
  9. package/dist/chunks/{chunk-PKQOEDHJ.js → chunk-7W6KYJU2.js} +224 -230
  10. package/dist/chunks/chunk-C7TZAT3S.js +369 -0
  11. package/dist/chunks/chunk-F7AIEHSS.js +46 -0
  12. package/dist/chunks/{chunk-E27LHEIP.js → chunk-GAFFYJU3.js} +1 -1
  13. package/dist/chunks/chunk-KPGVY6PF.js +321 -0
  14. package/dist/chunks/{chunk-44QXPEEE.js → chunk-MBAPT2R5.js} +1 -1
  15. package/dist/chunks/{chunk-IR5KIK7E.js → chunk-MVCAFD6M.js} +1 -1
  16. package/dist/chunks/chunk-PP53SIIL.js +5 -0
  17. package/dist/chunks/chunk-QH56WEHK.js +2 -0
  18. package/dist/chunks/chunk-UJS7JAO6.js +770 -0
  19. package/dist/chunks/{chunk-MVARIMQV.js → chunk-VK5QTHS6.js} +6 -6
  20. package/dist/chunks/chunk-VPURXE2F.js +427 -0
  21. package/dist/chunks/chunk-XM724XAA.js +329 -0
  22. package/dist/chunks/{chunk-WIBLZK4G.js → chunk-XMP66YWG.js} +11 -4
  23. package/dist/chunks/chunk-XXQLPTAN.js +78 -0
  24. package/dist/chunks/compaction-config-QYCDOW3Q.js +2 -0
  25. package/dist/chunks/{construction-bootstrap-ZJPXUPXQ.js → construction-bootstrap-BKNPJI7O.js} +1 -1
  26. package/dist/chunks/dist-6EK4H7TP.js +2 -0
  27. package/dist/chunks/{dist-GOUP4YVE.js → dist-EVEJAII2.js} +1 -1
  28. package/dist/chunks/host-KS4TJKWQ.js +2 -0
  29. package/dist/chunks/run-manager-L7MKGQNX.js +2 -0
  30. package/dist/chunks/{utils-OTT5CG5J.js → utils-GTJLL4GT.js} +1 -1
  31. package/dist/index.d.ts +17 -16
  32. package/dist/index.js +5 -5
  33. package/dist/kodax_cli.js +1357 -1294
  34. package/dist/provider-capabilities.json +184 -5
  35. package/dist/runtime-worker.js +1277 -1224
  36. package/dist/sdk-a2a.d.ts +11 -10
  37. package/dist/sdk-a2a.js +1 -1
  38. package/dist/sdk-agent.d.ts +110 -62
  39. package/dist/sdk-agent.js +1 -1
  40. package/dist/sdk-coding.d.ts +114 -32
  41. package/dist/sdk-coding.js +1 -1
  42. package/dist/sdk-experimental-memory.d.ts +1 -1
  43. package/dist/sdk-experimental-memory.js +1 -1
  44. package/dist/sdk-llm.d.ts +8 -49
  45. package/dist/sdk-llm.js +1 -1
  46. package/dist/sdk-mcp.js +1 -1
  47. package/dist/sdk-media.d.ts +1 -1
  48. package/dist/sdk-media.js +1 -1
  49. package/dist/sdk-repl.d.ts +153 -24
  50. package/dist/sdk-repl.js +2 -2
  51. package/dist/sdk-runtime.d.ts +238 -19
  52. package/dist/sdk-runtime.js +1 -1
  53. package/dist/sdk-session.d.ts +6 -6
  54. package/dist/sdk-session.js +1 -1
  55. package/dist/sdk-skills.js +1 -1
  56. package/dist/semantic-worker.js +16 -14
  57. package/dist/types-chunks/{base.d-Cz_rwpOi.d.ts → base.d-ChvpaKjZ.d.ts} +1 -1
  58. package/dist/types-chunks/{bash-prefix-extractor.d-CHJO5y94.d.ts → bash-prefix-extractor.d-r1beOESM.d.ts} +50 -14
  59. package/dist/types-chunks/{capability-learning.d-_lR0J4iR.d.ts → capability-learning.d-DPrYxRjF.d.ts} +1 -1
  60. package/dist/types-chunks/{capsule.d-DxtdE-GD.d.ts → capsule.d-zeqV4IQX.d.ts} +11 -3
  61. package/dist/types-chunks/{commands.d-DZxHzH5-.d.ts → commands.d-DUxnK2TU.d.ts} +67 -8
  62. package/dist/types-chunks/{guardrail.d-DlpMnd-Y.d.ts → guardrail.d-CWYD1bdL.d.ts} +2 -1
  63. package/dist/types-chunks/{guardrail.d-auV61_h5.d.ts → guardrail.d-qjuKJZ31.d.ts} +79 -18
  64. package/dist/types-chunks/history-retrieval.d-BKTJIrVd.d.ts +57 -0
  65. package/dist/types-chunks/{public-api.d--IDNJsu1.d.ts → public-api.d-CX4B11qY.d.ts} +19 -5
  66. package/dist/types-chunks/{run-manager.d-Bh50OdVl.d.ts → run-manager.d-B9fEIjZk.d.ts} +1 -1
  67. package/dist/types-chunks/{sdk-session-Cfw6NFu-.d.ts → sdk-session-B0fhAOPa.d.ts} +3 -3
  68. package/dist/types-chunks/{resolver.d-ssgNSlrh.d.ts → side-query.d-DWTMsndP.d.ts} +68 -5
  69. package/dist/types-chunks/{types.d-EqQmHztg.d.ts → types.d-Bm_y6YuM.d.ts} +16 -9
  70. package/dist/types-chunks/{types.d-Cqaw71Ax.d.ts → types.d-CSmF0t0n.d.ts} +6 -5
  71. package/dist/types-chunks/{types.d-CNZgY52F.d.ts → types.d-DEctY20M.d.ts} +10 -3
  72. package/dist/types-chunks/{types.d-DH1mvdcl.d.ts → types.d-sRLugmjy.d.ts} +64 -15
  73. package/dist/types-chunks/{utils.d-gmn3c5U4.d.ts → utils.d-D0wPxz8y.d.ts} +94 -10
  74. package/docs/SDK_EMBEDDER_GUIDE.md +1952 -1573
  75. package/package.json +9 -2
  76. package/dist/chunks/agent-YKGU4USA.js +0 -2
  77. package/dist/chunks/argument-completer-QZETLNAB.js +0 -2
  78. package/dist/chunks/chunk-23X6REO4.js +0 -46
  79. package/dist/chunks/chunk-2RI252RN.js +0 -2
  80. package/dist/chunks/chunk-CLFP6UGU.js +0 -71
  81. package/dist/chunks/chunk-EDZ5KJFT.js +0 -5
  82. package/dist/chunks/chunk-GIK4SGAT.js +0 -364
  83. package/dist/chunks/chunk-GVWPHE23.js +0 -310
  84. package/dist/chunks/chunk-JSDLBXME.js +0 -755
  85. package/dist/chunks/chunk-VDGCGOQH.js +0 -328
  86. package/dist/chunks/chunk-VVE3UM4F.js +0 -410
  87. package/dist/chunks/chunk-ZJIMT5I3.js +0 -78
  88. package/dist/chunks/compaction-config-TWCDFLX6.js +0 -2
  89. package/dist/chunks/dist-JT4ATXVM.js +0 -2
  90. package/dist/chunks/host-SVEDZUC5.js +0 -2
  91. package/dist/chunks/run-manager-RX42UNEM.js +0 -2
@@ -1,11 +1,94 @@
1
- import { k as KodaXMessage, F as KodaXReasoningMode, d as KodaXCustomProviderConfig, p as KodaXProviderCapabilityProfile } from './types.d-Cqaw71Ax.js';
2
- import { M as KodaXContextTokenSnapshot, ah as KodaXSkillDynamicContextPolicy, t as KodaXAgentMode, a4 as KodaXRepoIntelligenceMode, $ as KodaXOptions, ai as KodaXSkillInvocationContext } from './bash-prefix-extractor.d-CHJO5y94.js';
3
- import { bW as KodaXSessionUiHistoryItem, bL as KodaXSessionLineage, bC as KodaXSessionArtifactLedgerEntry, bm as KodaXExtensionSessionState, bl as KodaXExtensionSessionRecord, bS as KodaXSessionRuntimeInfo, ea as WorkflowProcessSource } from './types.d-DH1mvdcl.js';
4
- import { d as AgentsFile, j as AutoModeStats, p as KodaXMcpServersConfig } from './guardrail.d-auV61_h5.js';
1
+ import { k as KodaXMessage, F as KodaXReasoningMode, d as KodaXCustomProviderConfig, p as KodaXProviderCapabilityProfile } from './types.d-CSmF0t0n.js';
2
+ import { O as KodaXContextTokenSnapshot, aj as KodaXSkillDynamicContextPolicy, t as KodaXAgentMode, a6 as KodaXRepoIntelligenceMode, a1 as KodaXOptions, ak as KodaXSkillInvocationContext } from './bash-prefix-extractor.d-r1beOESM.js';
3
+ import { bX as KodaXSessionUiHistoryItem, bM as KodaXSessionLineage, bD as KodaXSessionArtifactLedgerEntry, bn as KodaXExtensionSessionState, bm as KodaXExtensionSessionRecord, bT as KodaXSessionRuntimeInfo, eb as WorkflowProcessSource } from './types.d-sRLugmjy.js';
4
+ import { d as AgentsFile, r as AutoModeStats, x as KodaXMcpServersConfig } from './guardrail.d-qjuKJZ31.js';
5
5
  import * as readline from 'readline';
6
- import { R as PermissionMode, L as LearningBinding, E as LearningSurfaceSnapshot } from './public-api.d--IDNJsu1.js';
6
+ import { R as PermissionMode, L as LearningBinding, E as LearningSurfaceSnapshot } from './public-api.d-CX4B11qY.js';
7
7
  import { SpawnSyncReturns } from 'child_process';
8
8
 
9
+ /**
10
+ * Permission Config - 2-level permission configuration load/save
11
+ *
12
+ * Priority: project-level (.kodax/config.local.json) > user-level (~/.kodax/config.json)
13
+ * 优先级:项目级 (.kodax/config.local.json) > 用户级 (~/.kodax/config.json)
14
+ *
15
+ * Pattern format (ONLY for Bash tool in accept-edits mode):
16
+ * - "Bash(npm install)" - exact command match
17
+ * - "Bash(git commit:*)" - prefix wildcard (matches "git commit -m 'msg'" etc.)
18
+ * - "Bash(npm:*)" - command prefix wildcard (matches "npm install", "npm run" etc.)
19
+ *
20
+ * Note: Bash(*) is REJECTED for safety. Use specific command patterns.
21
+ * Note: Other tools don't need patterns:
22
+ * - Read/Glob/Grep: Always allowed (project-external is enforced confirmation)
23
+ * - Edit/Write: Auto-allowed in accept-edits, blocked in plan
24
+ */
25
+
26
+ /**
27
+ * Auto-mode classifier configuration. Read from `~/.kodax/config.json` (user-
28
+ * level only — project-level is intentionally not consulted, matching
29
+ * `permissionMode`'s scope) plus the `KODAX_AUTO_MODE_*` env override family.
30
+ */
31
+ interface AutoModeSettings {
32
+ /**
33
+ * Starting engine for the session.
34
+ * - `'llm'` (default): classifier runs on every non-Tier-1 tool call
35
+ * - `'rules'`: classifier skipped; deterministic workspace/temp Tier 2 applies
36
+ * Engine downgrades stay sticky within the session regardless of this value.
37
+ */
38
+ engine?: 'llm' | 'rules';
39
+ /**
40
+ * Classifier model spec — `"provider:model"` or `"model"` (provider then
41
+ * inherits from the main session). Feeds layer 4 of `resolveClassifierModel`.
42
+ */
43
+ classifierModel?: string;
44
+ /** sideQuery timeout in ms. Default 20_000. */
45
+ timeoutMs?: number;
46
+ /**
47
+ * Issue 143 (WS3): speculative-classify quiet window in ms. Default 500.
48
+ * The window only controls "resolve instantly vs wait for the verdict" — the
49
+ * classifier verdict is always adopted (WS1), so this never decides
50
+ * "dialog vs no dialog". `0` disables the speculative race (synchronous
51
+ * classify). Lets users on slow/remote providers widen the window so a fast
52
+ * local classify still short-circuits while a slow one simply waits.
53
+ */
54
+ speculativeWindowMs?: number;
55
+ }
56
+ interface ResolvedAutoModeSettings {
57
+ readonly engine: 'llm' | 'rules';
58
+ readonly classifierModel?: string;
59
+ readonly classifierModelEnv?: string;
60
+ readonly timeoutMs?: number;
61
+ readonly speculativeWindowMs?: number;
62
+ }
63
+ interface ResolveAutoModeSettingsInput {
64
+ readonly settings?: AutoModeSettings;
65
+ readonly env?: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>>;
66
+ }
67
+ /**
68
+ * Load auto-mode settings from `~/.kodax/config.json` and apply the
69
+ * `KODAX_AUTO_MODE_*` env override family. This wrapper performs one
70
+ * filesystem read; `resolveAutoModeSettings()` is the pure counterpart.
71
+ *
72
+ * Env priority (highest first):
73
+ * - KODAX_AUTO_MODE_ENGINE: 'llm' | 'rules' — overrides settings.engine
74
+ * - KODAX_AUTO_MODE_CLASSIFIER_MODEL: model spec — surfaced as `classifierModelEnv`
75
+ * so it reaches `AutoModeGuardrailConfig.envVar` (the resolver's layer 2)
76
+ * - KODAX_AUTO_MODE_TIMEOUT_MS: integer ms — overrides settings.timeoutMs
77
+ * - KODAX_AUTO_SPECULATIVE_WINDOW_MS: integer ms (0 disables) — overrides
78
+ * settings.speculativeWindowMs (Issue 143 WS3; reuses the same env name
79
+ * speculative.ts reads, so a single var controls the knob everywhere)
80
+ *
81
+ * Invalid env values fall through to settings (defensive: a typo in an env
82
+ * var must not silently disable the classifier).
83
+ */
84
+ declare function loadAutoModeSettings(env?: NodeJS.ProcessEnv): ResolvedAutoModeSettings;
85
+ /**
86
+ * Resolve Auto settings from caller-owned data without reading global files.
87
+ * SDK hosts can therefore share the REPL's validation and precedence rules
88
+ * while retaining ownership of their own configuration source.
89
+ */
90
+ declare function resolveAutoModeSettings(input?: ResolveAutoModeSettingsInput): ResolvedAutoModeSettings;
91
+
9
92
  /**
10
93
  * KodaX Interactive Context Management - 交互式上下文管理
11
94
  */
@@ -165,7 +248,7 @@ interface CommandCallbacks {
165
248
  setThinking?: (enabled: boolean) => void;
166
249
  setReasoningMode?: (mode: KodaXReasoningMode) => void;
167
250
  setAgentMode?: (mode: KodaXAgentMode) => void;
168
- setPermissionMode?: (mode: PermissionMode) => void;
251
+ setPermissionMode?: (mode: PermissionMode) => void | Promise<void>;
169
252
  setRepoIntelligenceRuntime?: (update: {
170
253
  mode?: KodaXRepoIntelligenceMode;
171
254
  trace?: boolean;
@@ -238,13 +321,13 @@ interface CommandCallbacks {
238
321
  * guardrail state through it. Used by `/auto-engine` (show), `/auto-denials`,
239
322
  * and the status bar engine indicator.
240
323
  */
241
- getAutoModeStats?: () => AutoModeStats | undefined;
324
+ getAutoModeStats?: () => AutoModeStats | undefined | Promise<AutoModeStats | undefined>;
242
325
  /**
243
326
  * FEATURE_092 phase 2b.8: manual engine setter for `/auto-engine llm|rules`.
244
327
  * No-op when the guardrail hasn't been constructed yet. Threshold downgrades
245
328
  * still operate normally — a subsequent denial cross will downgrade again.
246
329
  */
247
- setAutoModeEngine?: (engine: 'llm' | 'rules') => void;
330
+ setAutoModeEngine?: (engine: 'llm' | 'rules') => void | Promise<void>;
248
331
  ui: UIContext;
249
332
  }
250
333
  interface CommandResultData {
@@ -428,6 +511,7 @@ declare function loadConfig(): {
428
511
  reasoningCeiling?: KodaXReasoningMode;
429
512
  agentMode?: KodaXAgentMode;
430
513
  permissionMode?: string;
514
+ autoMode?: AutoModeSettings;
431
515
  locale?: string;
432
516
  providerModels?: Record<string, string[]>;
433
517
  customProviders?: KodaXCustomProviderConfig[];
@@ -599,5 +683,5 @@ declare function resolveRuntimeEffortSelection(input: {
599
683
  declare function getGitRoot(cwd?: string): Promise<string | null>;
600
684
  declare function rateLimitedCall<T>(fn: () => Promise<T>): Promise<T>;
601
685
 
602
- export { registerConfiguredCustomProviders as A, resolveRuntimeEffortSelection as B, resolveRuntimeModelSelection as D, resolveRuntimeProviderSelection as E, saveConfig as F, touchContext as G, KODAX_CONFIG_FILE as K, PREVIEW_MAX_LENGTH as P, KODAX_DIR as i, KODAX_EXAMPLE_CONFIG_FILE as j, KODAX_INTEGRATION_EXAMPLE_FILES as k, KODAX_SESSIONS_DIR as l, KODAX_VERSION as m, createInteractiveContext as o, ensureExampleConfigFile as p, ensureExampleConfigFiles as q, getGitRoot as r, getProviderList as s, getProviderModel as t, getVersion as u, hydrateProcessEnvFromShell as v, isProviderConfigured as w, loadConfig as x, prepareRuntimeConfig as y, rateLimitedCall as z };
603
- export type { Command as C, InteractiveContext as I, RuntimeSurfaceMode as R, CommandCallbacks as a, CommandDefinition as b, CommandInfo as c, CommandInvocationRequest as d, CommandSource as e, CommandWorkflowInvocationRequest as f, CurrentConfig as g, InteractiveMode as h, RuntimeSurfaceStatus as n };
686
+ export { loadConfig as B, prepareRuntimeConfig as D, rateLimitedCall as E, registerConfiguredCustomProviders as F, resolveAutoModeSettings as G, resolveRuntimeEffortSelection as H, resolveRuntimeModelSelection as J, KODAX_CONFIG_FILE as K, resolveRuntimeProviderSelection as L, saveConfig as M, touchContext as N, PREVIEW_MAX_LENGTH as P, KODAX_DIR as i, KODAX_EXAMPLE_CONFIG_FILE as j, KODAX_INTEGRATION_EXAMPLE_FILES as k, KODAX_SESSIONS_DIR as l, KODAX_VERSION as m, createInteractiveContext as q, ensureExampleConfigFile as r, ensureExampleConfigFiles as s, getGitRoot as t, getProviderList as u, getProviderModel as v, getVersion as w, hydrateProcessEnvFromShell as x, isProviderConfigured as y, loadAutoModeSettings as z };
687
+ export type { AutoModeSettings as A, Command as C, InteractiveContext as I, ResolveAutoModeSettingsInput as R, CommandCallbacks as a, CommandDefinition as b, CommandInfo as c, CommandInvocationRequest as d, CommandSource as e, CommandWorkflowInvocationRequest as f, CurrentConfig as g, InteractiveMode as h, ResolvedAutoModeSettings as n, RuntimeSurfaceMode as o, RuntimeSurfaceStatus as p };