@kodax-ai/kodax 0.7.41 → 0.7.42

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 (56) hide show
  1. package/CHANGELOG.md +89 -1
  2. package/README.md +129 -232
  3. package/README_CN.md +128 -253
  4. package/dist/chunks/chunk-3RKBXWZS.js +2 -0
  5. package/dist/chunks/chunk-7JLYVWAF.js +1033 -0
  6. package/dist/chunks/chunk-CD3R5YBH.js +16 -0
  7. package/dist/chunks/chunk-DKXUY5F2.js +209 -0
  8. package/dist/chunks/chunk-HMYEQJGT.js +31 -0
  9. package/dist/chunks/{chunk-6OB4AJOM.js → chunk-IYJ5EPRV.js} +1 -1
  10. package/dist/chunks/chunk-KUX5LRPP.js +2 -0
  11. package/dist/chunks/{chunk-EQ5DGS2W.js → chunk-OWSKU55I.js} +5 -6
  12. package/dist/chunks/chunk-ZZ4KRK2B.js +465 -0
  13. package/dist/chunks/compaction-config-FIFFP4FT.js +2 -0
  14. package/dist/chunks/{construction-bootstrap-HBCWJFHC.js → construction-bootstrap-J2WOCYEK.js} +1 -1
  15. package/dist/chunks/dist-2ZHWDXMQ.js +2 -0
  16. package/dist/chunks/dist-W4CJWLIH.js +2 -0
  17. package/dist/chunks/utils-A5MWDTWZ.js +2 -0
  18. package/dist/index.d.ts +15 -10
  19. package/dist/index.js +5 -5
  20. package/dist/kodax_cli.js +841 -833
  21. package/dist/sdk-agent.d.ts +9 -93
  22. package/dist/sdk-agent.js +1 -1
  23. package/dist/sdk-coding.d.ts +315 -250
  24. package/dist/sdk-coding.js +1 -1
  25. package/dist/sdk-llm.d.ts +6 -5
  26. package/dist/sdk-llm.js +1 -1
  27. package/dist/sdk-mcp.d.ts +17 -0
  28. package/dist/sdk-mcp.js +2 -0
  29. package/dist/sdk-repl.d.ts +342 -10
  30. package/dist/sdk-repl.js +2 -1
  31. package/dist/sdk-session.d.ts +164 -0
  32. package/dist/sdk-session.js +2 -0
  33. package/dist/sdk-skills.d.ts +72 -4
  34. package/dist/sdk-skills.js +1 -1
  35. package/dist/types-chunks/{bash-prefix-extractor.d-B2iliwdi.d.ts → bash-prefix-extractor.d-CkhaqKkg.d.ts} +237 -98
  36. package/dist/types-chunks/capability.d-3C62G8Eq.d.ts +39 -0
  37. package/dist/types-chunks/config.d-BfJUXxC0.d.ts +41 -0
  38. package/dist/types-chunks/{cost-tracker.d-C4dMlQuV.d.ts → cost-tracker.d-B6vMoLLF.d.ts} +20 -2
  39. package/dist/types-chunks/{history-cleanup.d-q1vAvCss.d.ts → history-cleanup.d-DznrzEiU.d.ts} +221 -12
  40. package/dist/types-chunks/{instance-discovery.d-DZhp77vb.d.ts → instance-discovery.d-BsKnIwpg.d.ts} +31 -258
  41. package/dist/types-chunks/{resolver.d-BwD6TKz7.d.ts → resolver.d-DX9au4NJ.d.ts} +4 -3
  42. package/dist/types-chunks/session-storage.d-Cci897iM.d.ts +68 -0
  43. package/dist/types-chunks/{storage.d-Bv9T99Qu.d.ts → storage.d-Bc5DoAwp.d.ts} +17 -69
  44. package/dist/types-chunks/transport.d-DuyjG30t.d.ts +180 -0
  45. package/dist/types-chunks/{capability.d-BxNgd1-c.d.ts → types.d-B1uGoVTE.d.ts} +72 -40
  46. package/dist/types-chunks/types.d-mM8vqvhT.d.ts +254 -0
  47. package/package.json +9 -1
  48. package/dist/chunks/chunk-5TFLMGER.js +0 -2
  49. package/dist/chunks/chunk-6QO6HWGU.js +0 -30
  50. package/dist/chunks/chunk-HYWVRTFA.js +0 -1233
  51. package/dist/chunks/chunk-SX2IS5JP.js +0 -16
  52. package/dist/chunks/chunk-ZPJPNLBK.js +0 -462
  53. package/dist/chunks/compaction-config-LT5PEXPT.js +0 -2
  54. package/dist/chunks/dist-M57GIWR4.js +0 -2
  55. package/dist/chunks/dist-V3BS2NKB.js +0 -2
  56. package/dist/chunks/utils-FAFUQJ2A.js +0 -2
@@ -1,6 +1,102 @@
1
- import { l as KodaXCompactMemorySeed, s as KodaXSessionArtifactLedgerEntry, L as KodaXSessionScope, M as KodaXSessionStorage, q as KodaXJsonValue, G as Guardrail, a3 as SessionErrorMetadata, D as DiscoveredInstance, C as ChildTaskRegistry, ac as TaskAbortRegistry, $ as RunnerToolCall, ae as ToolGuardrail } from './instance-discovery.d-DZhp77vb.js';
2
- import { o as KodaXMessage, C as CapabilityKind, b as CapabilityResult, Z as KodaXTokenUsage, G as KodaXReasoningMode, m as KodaXHarnessProfile, U as KodaXTaskWorkIntent, L as KodaXReviewScale, Q as KodaXTaskComplexity, c as KodaXAmaFanoutClass, S as KodaXTaskRoutingDecision, T as KodaXTaskType, M as KodaXRiskLevel, k as KodaXExecutionMode, e as KodaXAmaProfile, f as KodaXAmaTactic, d as KodaXAmaFanoutPolicy } from './capability.d-BxNgd1-c.js';
3
- import { K as KodaXBaseProvider, a as CostTracker } from './cost-tracker.d-C4dMlQuV.js';
1
+ import { a as KodaXCompactMemorySeed, h as KodaXSessionArtifactLedgerEntry, t as KodaXSessionScope, u as KodaXSessionStorage, f as KodaXJsonValue, S as SessionErrorMetadata } from './types.d-mM8vqvhT.js';
2
+ import { m as KodaXMessage, W as KodaXTokenUsage, D as KodaXReasoningMode, k as KodaXHarnessProfile, R as KodaXTaskWorkIntent, H as KodaXReviewScale, N as KodaXTaskComplexity, a as KodaXAmaFanoutClass, P as KodaXTaskRoutingDecision, Q as KodaXTaskType, I as KodaXRiskLevel, i as KodaXExecutionMode, c as KodaXAmaProfile, d as KodaXAmaTactic, b as KodaXAmaFanoutPolicy } from './types.d-B1uGoVTE.js';
3
+ import { G as Guardrail, D as DiscoveredInstance, C as ChildTaskRegistry, T as TaskAbortRegistry, r as RunnerToolCall, J as ToolGuardrail } from './instance-discovery.d-BsKnIwpg.js';
4
+ import { C as CapabilityKind, b as CapabilityResult } from './capability.d-3C62G8Eq.js';
5
+ import { M as McpConnectMode, a as McpServerConfig, b as McpServersConfig, c as McpTransportKind } from './config.d-BfJUXxC0.js';
6
+ import { K as KodaXBaseProvider, a as CostTracker } from './cost-tracker.d-B6vMoLLF.js';
7
+
8
+ /** One tool-call breadcrumb. Captures only the name + a 60-char input
9
+ * hint so the snapshot stays compact under fan-out. Mirrors the
10
+ * `inputHint` extraction in `buildChildEvents.onToolUseStart`. */
11
+ interface ChildToolCallBreadcrumb {
12
+ readonly iteration: number;
13
+ readonly toolName: string;
14
+ /** Truncated path/pattern/command, ≤60 chars. May be empty when the
15
+ * tool input has no obvious key field. */
16
+ readonly inputHint: string;
17
+ /** Monotonic wall-clock ms at the time the tool call started. */
18
+ readonly startedAt: number;
19
+ }
20
+ /** Snapshot status. `running` is the initial state on dispatch. The
21
+ * three terminal states map from the child promise outcome:
22
+ * - `completed` — child returned success
23
+ * - `failed` — child returned non-success OR threw (non-AbortError)
24
+ * - `aborted` — child threw an AbortError (parent or task_stop fired)
25
+ */
26
+ type ChildProgressStatus = 'running' | 'completed' | 'failed' | 'aborted';
27
+ interface ChildProgressSnapshot {
28
+ readonly childId: string;
29
+ /** Mutable in the writer (dispatch-child-tasks) — terminal status is
30
+ * set once in the inner-IIFE `.finally` block. Readers
31
+ * (task-output tool) treat it as authoritative. */
32
+ status: ChildProgressStatus;
33
+ /** Monotonic wall-clock ms at dispatch. */
34
+ readonly startedAt: number;
35
+ /** Monotonic wall-clock ms at terminal. Undefined while `status===
36
+ * 'running'`. */
37
+ endedAt?: number;
38
+ /** Iterations consumed by the child agent. Updated by
39
+ * `snapshotUpdater({kind:'iteration', iteration, max})` from
40
+ * `buildChildEvents.onIterationStart`. */
41
+ iterations: number;
42
+ /** Iteration ceiling forwarded from `ChildExecutorOptions
43
+ * .maxIterationsPerChild`. */
44
+ maxIterations: number;
45
+ /** Mutable ring buffer; writer must respect `RECENT_TOOL_CALLS_RING_CAP`
46
+ * via `pushBreadcrumb`. */
47
+ recentToolCalls: ChildToolCallBreadcrumb[];
48
+ /** Populated at terminal (any of `completed` / `failed` / `aborted`)
49
+ * with the same pre-guardrail `rawSummary` string that
50
+ * `dispatch-child-tasks.ts` produces for the `<task-completed>` body.
51
+ * For success-empty / failed-empty paths this is the diagnostic
52
+ * envelope (mode= ... iterations=... etc.) so post-completion
53
+ * `task_output` reads stay in lock-step with the banner the Worker
54
+ * already saw. */
55
+ finalText?: string;
56
+ /** Optional dispatcher role (`scout` / `worker` / `generator`),
57
+ * captured at init so a debug-style `task_output` peek can correlate
58
+ * the child with the parent fan-out class. Not surfaced in the
59
+ * envelope; reserved for future tracing. */
60
+ readonly parentRole?: string;
61
+ /** Read-only flag forwarded from the dispatch bundle. Same rationale
62
+ * as `parentRole` — currently captured for future surfacing. */
63
+ readonly readOnly?: boolean;
64
+ }
65
+
66
+ /** Result of a cache lookup. */
67
+ type ReadStateLookup = {
68
+ readonly kind: 'miss';
69
+ } | {
70
+ readonly kind: 'hit';
71
+ /** Wall-clock time (ms since epoch) of the prior matching read. */
72
+ readonly previousReadAtMs: number;
73
+ };
74
+ interface ReadFileStateCache {
75
+ /**
76
+ * Have we read this exact `(filePath, offset, limit)` in this task,
77
+ * with no mtime change since? `'hit'` means yes — caller should
78
+ * return a stub instead of re-reading the file off disk.
79
+ *
80
+ * On stat failure (file deleted / permission denied between record
81
+ * and lookup), returns `'miss'` so the read tool runs its own stat
82
+ * and reports the right error to the LLM rather than serving a stale
83
+ * stub.
84
+ */
85
+ lookup(filePath: string, offset: number, limit: number): ReadStateLookup;
86
+ /**
87
+ * Record a successful read at this `(filePath, offset, limit)` with
88
+ * the mtime observed at read time. The mtime is supplied by the
89
+ * caller (the read tool already stats the file) so the cache does
90
+ * not pay a second stat call.
91
+ */
92
+ record(filePath: string, offset: number, limit: number, mtimeMs: number): void;
93
+ /** Drop all entries for this file. Called by Edit / Write / MultiEdit on success. */
94
+ forget(filePath: string): void;
95
+ /** Drop everything. Called by the compaction post-hook. */
96
+ clear(): void;
97
+ /** Test/diagnostic accessor — number of distinct files currently cached. */
98
+ size(): number;
99
+ }
4
100
 
5
101
  /** Result of a stale-check against the current on-disk content. */
6
102
  type StaleCheckResult = {
@@ -70,7 +166,9 @@ interface ContentHashCache {
70
166
 
71
167
  interface TodoInit {
72
168
  readonly id: string;
73
- readonly content: string;
169
+ /** v0.7.42 — see TodoItem.subject JSDoc. */
170
+ readonly subject: string;
171
+ readonly description?: string;
74
172
  readonly owner?: string;
75
173
  readonly sourceObligationIndex?: number;
76
174
  /**
@@ -96,9 +194,12 @@ interface TodoInit {
96
194
  /**
97
195
  * FEATURE_170 v0.7.41 — input shape for `add()`. No `id` (auto-generated
98
196
  * by the store), no `status` (always created as `pending`).
197
+ *
198
+ * v0.7.42 — `content` renamed to `subject` + optional `description`.
99
199
  */
100
200
  interface TodoAddSeed {
101
- readonly content: string;
201
+ readonly subject: string;
202
+ readonly description?: string;
102
203
  readonly activeForm?: string;
103
204
  readonly evaluator?: TodoEvaluatorHint;
104
205
  readonly owner?: string;
@@ -107,9 +208,22 @@ interface TodoAddSeed {
107
208
  }
108
209
  /**
109
210
  * FEATURE_170 v0.7.41 — input shape for `patch()`. Every field optional;
110
- * only those present in the patch object are applied. `metadata` is
111
- * shallow-merged (mirrors React setState mental model); explicit
112
- * `metadata: null` clears it.
211
+ * only those present in the patch object are applied.
212
+ *
213
+ * Metadata patch semantics (mirrors React setState mental model):
214
+ * - `metadata: undefined` (omitted) → preserve existing metadata as-is.
215
+ * - `metadata: null` (explicit) → CLEAR all metadata.
216
+ * - `metadata: {key: value}` → shallow-merge `key=value` into
217
+ * existing metadata.
218
+ * - `metadata: {key: null}` → v0.7.42 — DELETE that key from
219
+ * existing metadata. Other existing
220
+ * keys not mentioned in the patch
221
+ * are preserved. If all keys end up
222
+ * removed, the metadata field is
223
+ * set back to `undefined` so the
224
+ * JSON envelope stays compact.
225
+ * - Mixed (`{keyA: null, keyB: v}`) → deletes keyA, sets keyB. Useful
226
+ * for atomic "rename a flag" patches.
113
227
  *
114
228
  * `owner` and `sourceObligationIndex` are intentionally NOT patchable
115
229
  * post-creation — they identify provenance (which dispatch_child_task
@@ -118,11 +232,20 @@ interface TodoAddSeed {
118
232
  * seed and treat them as immutable thereafter.
119
233
  */
120
234
  interface TodoPatch {
121
- readonly content?: string;
235
+ /** v0.7.42 — `content` renamed; patch the row label. */
236
+ readonly subject?: string;
237
+ /** v0.7.42 — patch the optional fuller description. Empty string clears. */
238
+ readonly description?: string;
122
239
  readonly activeForm?: string;
123
240
  readonly status?: TodoStatus;
124
241
  readonly note?: string;
125
242
  readonly evaluator?: TodoEvaluatorHint;
243
+ /**
244
+ * Opaque metadata patch. See type-level JSDoc for the four semantics
245
+ * (preserve / clear-all / merge / per-key-delete). Individual values
246
+ * inside the object MAY be `null` (v0.7.42 — interpreted as "delete
247
+ * this key from existing metadata").
248
+ */
126
249
  readonly metadata?: Record<string, unknown> | null;
127
250
  }
128
251
  interface TodoStore {
@@ -192,37 +315,6 @@ interface TodoStore {
192
315
  reset(): void;
193
316
  }
194
317
 
195
- /**
196
- * Telemetry payload for the `events.onEvaluatorFallbackSynthesized`
197
- * event. Fires AFTER `recorder.verdict` is written but BEFORE
198
- * `formatDeterministicEvaluatorResult` builds the final `KodaXResult`,
199
- * so consumers see the synth event in causal order before the result.
200
- */
201
- interface EvaluatorFallbackSynthesizedInfo {
202
- /**
203
- * Number of retries that were attempted before falling back. `0` means
204
- * the very first detection of `verdict missing` led to fallback with
205
- * no retry (only possible if `cap === 0`, which we don't allow — but
206
- * keeping the field non-optional to keep the telemetry shape stable).
207
- */
208
- readonly retriesAttempted: number;
209
- /** The cap value resolved for this run's model alias. */
210
- readonly cap: number;
211
- /**
212
- * The model alias the run used, if known. `undefined` when the run
213
- * dispatcher didn't surface the alias to the outer loop.
214
- */
215
- readonly modelAlias: string | undefined;
216
- /**
217
- * The last assistant text the Evaluator produced (the text-only
218
- * response that triggered B2). Stored verbatim so post-hoc audit can
219
- * see what the model said when it failed to terminate.
220
- */
221
- readonly userFacingText: string;
222
- /** Stable reason string written into the synthesized verdict. */
223
- readonly reason: string;
224
- }
225
-
226
318
  /**
227
319
  * @kodax-ai/agent Compaction Types
228
320
  */
@@ -430,46 +522,6 @@ interface ProviderResiliencePolicy extends ProviderResilienceConfig {
430
522
  provider: string;
431
523
  }
432
524
 
433
- /**
434
- * MCP server configuration shapes.
435
- *
436
- * FEATURE_082 (v0.7.24): moved from `@kodax-ai/coding/src/types.ts`. Kept as the
437
- * `Mcp*` names here; the `KodaXMcp*` aliases continue to re-export from
438
- * `@kodax-ai/coding` for backward compatibility.
439
- */
440
- type McpTransportKind = 'stdio' | 'sse' | 'streamable-http';
441
- type McpConnectMode = 'lazy' | 'prewarm' | 'disabled';
442
- interface McpServerConfig {
443
- /** Transport type. Defaults to 'stdio' when omitted. */
444
- type?: McpTransportKind;
445
- /** stdio: executable command. */
446
- command?: string;
447
- /** stdio: command arguments. */
448
- args?: string[];
449
- /** stdio: working directory for the spawned process. */
450
- cwd?: string;
451
- /** stdio: extra environment variables for the spawned process. */
452
- env?: Record<string, string>;
453
- /** sse / streamable-http: server endpoint URL. */
454
- url?: string;
455
- /** sse / streamable-http: extra HTTP headers (e.g. Authorization). */
456
- headers?: Record<string, string>;
457
- connect?: McpConnectMode;
458
- startupTimeoutMs?: number;
459
- requestTimeoutMs?: number;
460
- /** OAuth 2.0 configuration for authenticated MCP servers. */
461
- auth?: {
462
- readonly type: 'oauth2';
463
- readonly clientId: string;
464
- readonly authorizationUrl: string;
465
- readonly tokenUrl: string;
466
- readonly scopes?: readonly string[];
467
- readonly redirectPort?: number;
468
- };
469
- }
470
- /** Flat map of MCP server configs, keyed under `mcpServers` in config.json. */
471
- type McpServersConfig = Record<string, McpServerConfig>;
472
-
473
525
  interface KodaXEvents {
474
526
  onTextDelta?: (text: string) => void;
475
527
  onThinkingDelta?: (text: string) => void;
@@ -628,7 +680,6 @@ interface KodaXEvents {
628
680
  * — consumers see the synth signal in causal order before the result
629
681
  * surfaces.
630
682
  */
631
- onEvaluatorFallbackSynthesized?: (info: EvaluatorFallbackSynthesizedInfo) => void;
632
683
  /** Returns a formatted cost report for the current session. Set by agent at session start. */
633
684
  getCostReport?: {
634
685
  current: (() => string) | null;
@@ -781,17 +832,34 @@ type TodoStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'skipped'
781
832
  */
782
833
  type TodoEvaluatorHint = 'build' | 'test' | 'lint';
783
834
  /**
784
- * One row in the planner-produced todo list. Content is sourced from
785
- * Scout's existing `executionObligations: string[]` payload (no schema
786
- * change at the protocol layer). Status is advanced via the
787
- * `todo_update` tool by Scout (H0 path) / Generator / Planner.
835
+ * One row in the planner-produced todo list. Subject is the short
836
+ * imperative title (shown in the UI row + throttle reminder); the
837
+ * optional description carries fuller context for downstream consumers
838
+ * that need the full work instruction. Sourced from Scout's existing
839
+ * `executionObligations: string[]` payload (each string becomes the
840
+ * `subject` of one seed item, no `description`). Status is advanced
841
+ * via the `todo_update` tool by Scout (H0 path) / Worker / Generator /
842
+ * Planner.
843
+ *
844
+ * v0.7.42 — `content` field renamed to `subject` to match claudecode V2
845
+ * `TaskSchema` (TaskCreateTool's required `subject` + `description`
846
+ * pair). KodaX makes `description` optional because trivial single-line
847
+ * steps don't need it; weaker models reach the API more easily without
848
+ * the forced second-string burden.
788
849
  *
789
850
  * `owner` partitions the list when child agents run in parallel under
790
851
  * `dispatch_child_task`; "main" is the parent thread.
791
852
  */
792
853
  interface TodoItem {
793
854
  readonly id: string;
794
- readonly content: string;
855
+ /** Brief imperative title — the row label users see in the plan list. */
856
+ readonly subject: string;
857
+ /**
858
+ * Optional fuller description / context. Read by the executing role
859
+ * when picking up an item (claudecode V2 `TaskGet`-style detail view).
860
+ * Not rendered in the compact plan-list row.
861
+ */
862
+ readonly description?: string;
795
863
  readonly status: TodoStatus;
796
864
  readonly owner?: string;
797
865
  /** Index into the originating `executionObligations: string[]` array (0-based). */
@@ -967,6 +1035,15 @@ interface KodaXChildAgentResult {
967
1035
  sessionId?: string;
968
1036
  /** Actual iterations consumed by this child agent. */
969
1037
  actualIterations?: number;
1038
+ /**
1039
+ * True when the child's `runKodaX` exited via CAP-083 AbortError silent
1040
+ * terminal (`KodaXResult.interrupted === true`). Surfaces the
1041
+ * "success but empty lastText" path that produces empty
1042
+ * `<task-completed task_id="X"></task-completed>` banners.
1043
+ * Diagnostic field — populated by child-executor on the success branch
1044
+ * and consumed by dispatch-child-tasks' empty-summary fallback.
1045
+ */
1046
+ interrupted?: boolean;
970
1047
  }
971
1048
  interface KodaXParentReductionContract {
972
1049
  owner: 'parent';
@@ -981,8 +1058,6 @@ interface KodaXChildExecutionResult {
981
1058
  readonly mergedArtifacts: readonly string[];
982
1059
  readonly totalTokensUsed: number;
983
1060
  readonly cancelledChildren: readonly string[];
984
- /** Worktree paths for write children, keyed by childId. Available for evaluator review. */
985
- readonly worktreePaths?: ReadonlyMap<string, string>;
986
1061
  }
987
1062
  interface KodaXChildFinding {
988
1063
  readonly childId: string;
@@ -1042,7 +1117,7 @@ interface KodaXManagedTaskHarnessTransition {
1042
1117
  approved: boolean;
1043
1118
  denialReason?: string;
1044
1119
  }
1045
- type KodaXManagedTaskPhase = 'starting' | 'routing' | 'preflight' | 'round' | 'worker' | 'upgrade' | 'completed';
1120
+ type KodaXManagedTaskPhase = 'starting' | 'routing' | 'preflight' | 'round' | 'worker' | 'upgrade' | 'verifying' | 'completed';
1046
1121
  type KodaXManagedLiveEventPresentation = 'status' | 'assistant' | 'thinking';
1047
1122
  interface KodaXManagedLiveEvent {
1048
1123
  key: string;
@@ -1235,8 +1310,6 @@ interface KodaXContextOptions {
1235
1310
  };
1236
1311
  /** Mutable mutation tracker shared between worker events and the protocol tool handler. */
1237
1312
  mutationTracker?: ManagedMutationTracker;
1238
- /** FEATURE_067 v2: Callback for dispatch_child_tasks to register write worktree paths. */
1239
- registerChildWriteWorktrees?: (worktreePaths: ReadonlyMap<string, string>) => void;
1240
1313
  /** FEATURE_067 v3: Tool names to exclude from API-level tool list (child agents). */
1241
1314
  excludeTools?: readonly string[];
1242
1315
  /**
@@ -1281,6 +1354,37 @@ interface KodaXOptions {
1281
1354
  guardrails?: readonly Guardrail[];
1282
1355
  /** AbortSignal for cancelling the API request */
1283
1356
  abortSignal?: AbortSignal;
1357
+ /**
1358
+ * v0.7.42 — `RunningSession` plumbing (closes gap 6 reported by KodaX
1359
+ * Space). When provided, the substrate `_attach`es low-level mutators
1360
+ * onto this control object so the embedder can flip provider / model
1361
+ * / reasoning between turns without restarting the run. The mutations
1362
+ * land on the live `RuntimeSessionState` and are picked up by the
1363
+ * next-turn CAP-055 provider re-resolution. `startKodaX` (the
1364
+ * non-blocking entry) is the canonical producer of this field; direct
1365
+ * SDK callers can also instantiate one via {@link createSessionControl}.
1366
+ */
1367
+ sessionControl?: KodaXSessionControl;
1368
+ }
1369
+ /**
1370
+ * Low-level mutators handed to a `KodaXSessionControl` by the substrate.
1371
+ * Each setter writes directly into the live `RuntimeSessionState`. Called
1372
+ * exactly once per session (just after `buildRuntimeSessionState`).
1373
+ */
1374
+ interface KodaXSessionMutators {
1375
+ setProvider(name: string): void;
1376
+ setModel(model: string | undefined): void;
1377
+ setReasoning(mode: KodaXReasoningMode | undefined): void;
1378
+ }
1379
+ /**
1380
+ * Embedder-facing control surface. Created by the embedder (or by
1381
+ * `startKodaX`), passed in via `KodaXOptions.sessionControl`. The
1382
+ * substrate calls `_attach` once, after which the control's setter
1383
+ * methods apply live to the in-flight run.
1384
+ */
1385
+ interface KodaXSessionControl {
1386
+ /** @internal — wired by `run-substrate`. Do not call from user code. */
1387
+ _attach(mutators: KodaXSessionMutators): void;
1284
1388
  }
1285
1389
  type KodaXTaskSurface = 'cli' | 'repl' | 'plan';
1286
1390
  type KodaXTaskStatus = 'planned' | 'running' | 'blocked' | 'failed' | 'completed';
@@ -1432,8 +1536,6 @@ interface KodaXManagedTaskRuntimeState {
1432
1536
  childWriteReviewPrompt?: string;
1433
1537
  /** FEATURE_067: Number of write child diffs pending evaluator review. */
1434
1538
  childWriteDiffCount?: number;
1435
- /** FEATURE_067 v2: Worktree paths from dispatch_child_tasks write fan-out, keyed by childId. */
1436
- childWriteWorktreePaths?: ReadonlyMap<string, string>;
1437
1539
  }
1438
1540
  interface KodaXManagedTask {
1439
1541
  contract: KodaXTaskContract;
@@ -1444,7 +1546,11 @@ interface KodaXManagedTask {
1444
1546
  runtime?: KodaXManagedTaskRuntimeState;
1445
1547
  }
1446
1548
  interface KodaXManagedVerdictPayload {
1447
- source: 'evaluator' | 'worker';
1549
+ /** FEATURE_184 (v0.7.45): `'sidecar'` is the new architectural source —
1550
+ * Sidecar Verifier replaces the in-chain Evaluator role. `'evaluator'`
1551
+ * / `'worker'` are retained for backward-compat reads of session jsonl
1552
+ * written before v0.7.45. New writes use `'sidecar'`. */
1553
+ source: 'evaluator' | 'worker' | 'sidecar';
1448
1554
  status: 'accept' | 'revise' | 'blocked';
1449
1555
  reason?: string;
1450
1556
  debugReason?: string;
@@ -1661,8 +1767,6 @@ interface KodaXToolExecutionContext {
1661
1767
  /** FEATURE_067 v2: Callback for long-running tools to report execution progress to the REPL transcript.
1662
1768
  * The string will be displayed as the tool's "Running:" line in the transcript. */
1663
1769
  reportToolProgress?: (message: string) => void;
1664
- /** FEATURE_067 v2: Callback to store write child worktree paths for Evaluator diff injection. */
1665
- registerChildWriteWorktrees?: (worktreePaths: ReadonlyMap<string, string>) => void;
1666
1770
  /** Mutation tracker for scope-aware protocol responses. Populated by createWorkerEvents. */
1667
1771
  mutationTracker?: ManagedMutationTracker;
1668
1772
  /**
@@ -1714,6 +1818,20 @@ interface KodaXToolExecutionContext {
1714
1818
  * See `packages/coding/src/multi-instance/content-hash-cache.ts`.
1715
1819
  */
1716
1820
  contentHashCache?: ContentHashCache;
1821
+ /**
1822
+ * FEATURE_177 v0.7.42 — per-task read-file-state cache (anti-loop).
1823
+ *
1824
+ * Tracks `(filePath, offset, limit)` tuples the LLM has already read
1825
+ * in this task. On a re-read with unchanged mtime, the Read tool
1826
+ * returns a short stub instead of the full content — breaking
1827
+ * `narrate-then-re-read` loops on models with structural decoder
1828
+ * floors (kimi-code 2026-05). Edit / Write / MultiEdit call `forget`
1829
+ * after a successful mutation; the compaction post-hook calls
1830
+ * `clear`. Disabled by `KODAX_READ_DEDUP_KILLSWITCH=1`.
1831
+ *
1832
+ * See `packages/coding/src/multi-instance/read-file-state-cache.ts`.
1833
+ */
1834
+ readFileStateCache?: ReadFileStateCache;
1717
1835
  /**
1718
1836
  * FEATURE_125 v0.7.41 — Team Mode Layer 3 input.
1719
1837
  *
@@ -1779,6 +1897,27 @@ interface KodaXToolExecutionContext {
1779
1897
  * `childTaskRegistry`).
1780
1898
  */
1781
1899
  childAbortControllers?: TaskAbortRegistry;
1900
+ /**
1901
+ * FEATURE_177 v0.7.45 substrate for the `task_output` tool. Per-child
1902
+ * runtime snapshot a parent agent can query mid-flight to peek at
1903
+ * iteration count + recent tool-call breadcrumbs without waiting for
1904
+ * the child's `<task-completed>` banner.
1905
+ *
1906
+ * Populated by `dispatch_child_task` at launch (`initChildSnapshot`)
1907
+ * and at terminal (`finalizeChildSnapshot` in the child promise's
1908
+ * inner-IIFE `.finally`). The `task_output` tool reads from this map.
1909
+ *
1910
+ * Snapshots survive the child task settling (so post-completion peeks
1911
+ * work) and are bounded by `CHILD_PROGRESS_SNAPSHOT_CAP` (FIFO prune
1912
+ * by `startedAt` when the cap is exceeded). No TTL — snapshots are
1913
+ * cleared with the ctx itself when the parent runner exits.
1914
+ *
1915
+ * Undefined in legacy sync-mode dispatch (same gate as
1916
+ * `childTaskRegistry`). Children's own SA contexts do NOT inherit
1917
+ * this map (verified by `buildToolExecutionContext` not forwarding
1918
+ * it into child `runKodaX` calls).
1919
+ */
1920
+ childProgressSnapshots?: Map<string, ChildProgressSnapshot>;
1782
1921
  }
1783
1922
 
1784
1923
  /**
@@ -2428,5 +2567,5 @@ interface CreateBashPrefixExtractorOptions {
2428
2567
  */
2429
2568
  declare function createBashPrefixExtractor(opts: CreateBashPrefixExtractorOptions): BashPrefixExtractor;
2430
2569
 
2431
- export { BASH_POLICY_SPEC as B, CONSECUTIVE_THRESHOLD as C, ERROR_THRESHOLD as E, extractCommandPrefix as a$, WINDOW_MS as aU, collectAllSignals as aV, computeRulesFingerprint as aW, createAutoModeToolGuardrail as aX, createBashPrefixExtractor as aY, createCircuitBreaker as aZ, createDenialTracker as a_, formatAgentsForPrompt as b0, getKodaxGlobalDir as b1, loadAgentsFiles as b2, loadAutoRules as b3, parseAutoRules as b4, readTrustState as b5, recordAllow as b6, recordBlock as b7, recordError as b8, shouldFallback$1 as b9, shouldFallback as ba, trustProjectRules as bb, CUMULATIVE_THRESHOLD as n };
2432
- export type { KodaXOrchestrationVerdict as $, AgentsFile as A, DenialTracker as D, FailureStage as F, KodaXContextOptions as G, KodaXContextTokenSnapshot as H, KodaXEvents as I, KodaXFanoutBranchLifecycle as J, KodaXAgentMode as K, KodaXFanoutBranchRecord as L, KodaXFanoutBranchTransition as M, KodaXFanoutSchedulerInput as N, KodaXFanoutSchedulerPlan as O, KodaXInputArtifact as P, KodaXManagedBudgetSnapshot as Q, KodaXManagedProtocolPayload as R, KodaXManagedTask as S, KodaXManagedTaskRuntimeState as T, KodaXManagedTaskStatusEvent as U, KodaXMcpConnectMode as V, KodaXMcpServerConfig as W, KodaXMcpServersConfig as X, KodaXMcpTransport as Y, KodaXMemoryStrategy as Z, KodaXOptions as _, AskUserMultiOptions as a, KodaXParentReductionContract as a0, KodaXProviderPolicyHints as a1, KodaXRepoIntelligenceCapability as a2, KodaXRepoIntelligenceMode as a3, KodaXRepoIntelligenceResolvedMode as a4, KodaXRepoIntelligenceTrace as a5, KodaXRepoIntelligenceTraceEvent as a6, KodaXRepoRoutingSignals as a7, KodaXResult as a8, KodaXRoleRoundSummary as a9, McpTransportKind as aA, ProviderExecutionState as aB, ProviderRecoveryEvent as aC, ProviderResilienceConfig as aD, ProviderResiliencePolicy as aE, RecoveryAction as aF, RecoveryDecision as aG, RecoveryLadderStep as aH, RecoveryResult as aI, ResilienceClassification as aJ, ResilienceErrorClass as aK, RulesLoadError as aL, RulesLoadResult as aM, SignalCollector as aN, SkippedRulesSource as aO, TodoItem as aP, TodoList as aQ, TodoStatus as aR, ToolCallSignal as aS, TrustState as aT, KodaXRuntimeVerificationContract as aa, KodaXSessionOptions as ab, KodaXSkillInvocationContext as ac, KodaXSkillMap as ad, KodaXSkillProjectionConfidence as ae, KodaXTaskCapabilityHint as af, KodaXTaskContract as ag, KodaXTaskEvidenceArtifact as ah, KodaXTaskEvidenceBundle as ai, KodaXTaskEvidenceEntry as aj, KodaXTaskRole as ak, KodaXTaskRoleAssignment as al, KodaXTaskStatus as am, KodaXTaskSurface as an, KodaXTaskToolPolicy as ao, KodaXTaskVerificationContract as ap, KodaXTaskVerificationCriterion as aq, KodaXTaskWorkItem as ar, KodaXToolExecutionContext as as, KodaXVerificationScorecard as at, KodaXVerificationScorecardCriterion as au, LoadAgentsOptions as av, LoadedRulesSource as aw, McpConnectMode as ax, McpServerConfig as ay, McpServersConfig as az, AskUserQuestionItem as b, AskUserQuestionOptions as c, AutoModeAskUser as d, AutoModeAskUserVerdict as e, AutoModeEngine as f, AutoModeGuardrailConfig as g, AutoModeSharedState as h, AutoModeStats as i, AutoModeToolGuardrail as j, AutoRules as k, BashPrefixExtractor as l, BashPrefixResult as m, CircuitBreaker as o, CompactionAnchor as p, CompactionDetails as q, CompactionResult as r, CompactionUpdate as s, CreateBashPrefixExtractorOptions as t, ExtensionRuntimeContract as u, ExtractCommandPrefixOptions as v, KodaXBudgetDisclosureZone as w, KodaXBudgetExtensionRequest as x, KodaXChildAgentResult as y, KodaXChildContextBundle as z };
2570
+ export { BASH_POLICY_SPEC as B, CONSECUTIVE_THRESHOLD as C, ERROR_THRESHOLD as E, getKodaxGlobalDir as a$, WINDOW_MS as aS, collectAllSignals as aT, computeRulesFingerprint as aU, createAutoModeToolGuardrail as aV, createBashPrefixExtractor as aW, createCircuitBreaker as aX, createDenialTracker as aY, extractCommandPrefix as aZ, formatAgentsForPrompt as a_, loadAgentsFiles as b0, loadAutoRules as b1, parseAutoRules as b2, readTrustState as b3, recordAllow as b4, recordBlock as b5, recordError as b6, shouldFallback$1 as b7, shouldFallback as b8, trustProjectRules as b9, CUMULATIVE_THRESHOLD as n };
2571
+ export type { KodaXOrchestrationVerdict as $, AgentsFile as A, DenialTracker as D, FailureStage as F, KodaXContextOptions as G, KodaXContextTokenSnapshot as H, KodaXEvents as I, KodaXFanoutBranchLifecycle as J, KodaXAgentMode as K, KodaXFanoutBranchRecord as L, KodaXFanoutBranchTransition as M, KodaXFanoutSchedulerInput as N, KodaXFanoutSchedulerPlan as O, KodaXInputArtifact as P, KodaXManagedBudgetSnapshot as Q, KodaXManagedProtocolPayload as R, KodaXManagedTask as S, KodaXManagedTaskRuntimeState as T, KodaXManagedTaskStatusEvent as U, KodaXMcpConnectMode as V, KodaXMcpServerConfig as W, KodaXMcpServersConfig as X, KodaXMcpTransport as Y, KodaXMemoryStrategy as Z, KodaXOptions as _, AskUserMultiOptions as a, KodaXParentReductionContract as a0, KodaXProviderPolicyHints as a1, KodaXRepoIntelligenceCapability as a2, KodaXRepoIntelligenceMode as a3, KodaXRepoIntelligenceResolvedMode as a4, KodaXRepoIntelligenceTrace as a5, KodaXRepoIntelligenceTraceEvent as a6, KodaXRepoRoutingSignals as a7, KodaXResult as a8, KodaXRoleRoundSummary as a9, ProviderRecoveryEvent as aA, ProviderResilienceConfig as aB, ProviderResiliencePolicy as aC, RecoveryAction as aD, RecoveryDecision as aE, RecoveryLadderStep as aF, RecoveryResult as aG, ResilienceClassification as aH, ResilienceErrorClass as aI, RulesLoadError as aJ, RulesLoadResult as aK, SignalCollector as aL, SkippedRulesSource as aM, TodoItem as aN, TodoList as aO, TodoStatus as aP, ToolCallSignal as aQ, TrustState as aR, KodaXRuntimeVerificationContract as aa, KodaXSessionControl as ab, KodaXSessionMutators as ac, KodaXSessionOptions as ad, KodaXSkillInvocationContext as ae, KodaXSkillMap as af, KodaXSkillProjectionConfidence as ag, KodaXTaskCapabilityHint as ah, KodaXTaskContract as ai, KodaXTaskEvidenceArtifact as aj, KodaXTaskEvidenceBundle as ak, KodaXTaskEvidenceEntry as al, KodaXTaskRole as am, KodaXTaskRoleAssignment as an, KodaXTaskStatus as ao, KodaXTaskSurface as ap, KodaXTaskToolPolicy as aq, KodaXTaskVerificationContract as ar, KodaXTaskVerificationCriterion as as, KodaXTaskWorkItem as at, KodaXToolExecutionContext as au, KodaXVerificationScorecard as av, KodaXVerificationScorecardCriterion as aw, LoadAgentsOptions as ax, LoadedRulesSource as ay, ProviderExecutionState as az, AskUserQuestionItem as b, AskUserQuestionOptions as c, AutoModeAskUser as d, AutoModeAskUserVerdict as e, AutoModeEngine as f, AutoModeGuardrailConfig as g, AutoModeSharedState as h, AutoModeStats as i, AutoModeToolGuardrail as j, AutoRules as k, BashPrefixExtractor as l, BashPrefixResult as m, CircuitBreaker as o, CompactionAnchor as p, CompactionDetails as q, CompactionResult as r, CompactionUpdate as s, CreateBashPrefixExtractorOptions as t, ExtensionRuntimeContract as u, ExtractCommandPrefixOptions as v, KodaXBudgetDisclosureZone as w, KodaXBudgetExtensionRequest as x, KodaXChildAgentResult as y, KodaXChildContextBundle as z };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Layer A Primitive: Capability provider contract.
3
+ *
4
+ * FEATURE_082 (v0.7.24): extracted from `@kodax-ai/coding/src/extensions/types.ts`
5
+ * so third-party capability sources (MCP, RAG, custom indexes, …) can
6
+ * implement `CapabilityProvider` without importing from the coding preset.
7
+ *
8
+ * The richer "extension runtime" concept (command registration, file
9
+ * contributions, logger plumbing) stays in `@kodax-ai/coding/src/extensions/`
10
+ * because it is coupled to the coding CLI surface.
11
+ */
12
+ type CapabilityKind = 'tool' | 'resource' | 'prompt';
13
+ interface CapabilityResult {
14
+ kind: CapabilityKind;
15
+ content?: string;
16
+ structuredContent?: unknown;
17
+ evidence?: unknown[];
18
+ artifacts?: unknown[];
19
+ metadata?: Record<string, unknown>;
20
+ }
21
+ interface CapabilityProvider {
22
+ id: string;
23
+ kinds: CapabilityKind[];
24
+ search?: (query: string, options?: {
25
+ kind?: CapabilityKind;
26
+ limit?: number;
27
+ server?: string;
28
+ }) => Promise<unknown[]>;
29
+ describe?: (id: string) => Promise<unknown>;
30
+ execute?: (id: string, input: Record<string, unknown>) => Promise<CapabilityResult>;
31
+ read?: (id: string, options?: Record<string, unknown>) => Promise<CapabilityResult>;
32
+ getPrompt?: (id: string, args?: Record<string, unknown>) => Promise<unknown>;
33
+ getPromptContext?: () => Promise<string | undefined> | string | undefined;
34
+ getDiagnostics?: () => Record<string, unknown> | undefined;
35
+ refresh?: () => Promise<void>;
36
+ dispose?: () => Promise<void>;
37
+ }
38
+
39
+ export type { CapabilityKind as C, CapabilityProvider as a, CapabilityResult as b };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * MCP server configuration shapes.
3
+ *
4
+ * FEATURE_082 (v0.7.24): moved from `@kodax-ai/coding/src/types.ts`. Kept as the
5
+ * `Mcp*` names here; the `KodaXMcp*` aliases continue to re-export from
6
+ * `@kodax-ai/coding` for backward compatibility.
7
+ */
8
+ type McpTransportKind = 'stdio' | 'sse' | 'streamable-http';
9
+ type McpConnectMode = 'lazy' | 'prewarm' | 'disabled';
10
+ interface McpServerConfig {
11
+ /** Transport type. Defaults to 'stdio' when omitted. */
12
+ type?: McpTransportKind;
13
+ /** stdio: executable command. */
14
+ command?: string;
15
+ /** stdio: command arguments. */
16
+ args?: string[];
17
+ /** stdio: working directory for the spawned process. */
18
+ cwd?: string;
19
+ /** stdio: extra environment variables for the spawned process. */
20
+ env?: Record<string, string>;
21
+ /** sse / streamable-http: server endpoint URL. */
22
+ url?: string;
23
+ /** sse / streamable-http: extra HTTP headers (e.g. Authorization). */
24
+ headers?: Record<string, string>;
25
+ connect?: McpConnectMode;
26
+ startupTimeoutMs?: number;
27
+ requestTimeoutMs?: number;
28
+ /** OAuth 2.0 configuration for authenticated MCP servers. */
29
+ auth?: {
30
+ readonly type: 'oauth2';
31
+ readonly clientId: string;
32
+ readonly authorizationUrl: string;
33
+ readonly tokenUrl: string;
34
+ readonly scopes?: readonly string[];
35
+ readonly redirectPort?: number;
36
+ };
37
+ }
38
+ /** Flat map of MCP server configs, keyed under `mcpServers` in config.json. */
39
+ type McpServersConfig = Record<string, McpServerConfig>;
40
+
41
+ export type { McpConnectMode as M, McpServerConfig as a, McpServersConfig as b, McpTransportKind as c };
@@ -1,4 +1,4 @@
1
- import { t as KodaXProviderConfig, o as KodaXMessage, _ as KodaXToolDefinition, I as KodaXReasoningRequest, B as KodaXProviderStreamOptions, N as KodaXStreamResult, p as KodaXModelDescriptor, s as KodaXProviderCapabilityProfile, F as KodaXReasoningCapability, H as KodaXReasoningOverride } from './capability.d-BxNgd1-c.js';
1
+ import { r as KodaXProviderConfig, m as KodaXMessage, X as KodaXToolDefinition, F as KodaXReasoningRequest, z as KodaXProviderStreamOptions, J as KodaXStreamResult, n as KodaXModelDescriptor, q as KodaXProviderCapabilityProfile, C as KodaXReasoningCapability, E as KodaXReasoningOverride } from './types.d-B1uGoVTE.js';
2
2
 
3
3
  /**
4
4
  * Retry-After header parsing — FEATURE_130 (v0.7.36).
@@ -145,8 +145,26 @@ declare abstract class KodaXBaseProvider {
145
145
  * Returns undefined when no cap is configured. Consumed by the
146
146
  * resilience layer to abort a doomed stream before the server-side
147
147
  * kill window fires; routed through `non_streaming_fallback`.
148
+ *
149
+ * Cascade (highest to lowest):
150
+ * 1. Active model descriptor's `streamMaxDurationMs`
151
+ * 2. Provider config default
152
+ * 3. undefined (watchdog disabled)
153
+ */
154
+ getStreamMaxDurationMs(model?: string): number | undefined;
155
+ /**
156
+ * Resolves whether OpenAI-compat `reasoning_content` should echo back
157
+ * on replayed assistant messages for the given model. Same cascade as
158
+ * `getStreamMaxDurationMs`. Defaults to false when neither layer sets it.
159
+ */
160
+ getEffectiveReplayReasoningContent(model?: string): boolean;
161
+ /**
162
+ * Resolves whether Anthropic-style thinking signatures must verify
163
+ * strictly (Anthropic proper only). Same cascade as
164
+ * `getStreamMaxDurationMs`. Defaults to false (lenient) when neither
165
+ * layer sets it — matches third-party Anthropic-compat behavior.
148
166
  */
149
- getStreamMaxDurationMs(): number | undefined;
167
+ getEffectiveStrictThinkingSignature(model?: string): boolean;
150
168
  abstract stream(messages: KodaXMessage[], tools: KodaXToolDefinition[], system: string, reasoning?: boolean | KodaXReasoningRequest, streamOptions?: KodaXProviderStreamOptions, signal?: AbortSignal): Promise<KodaXStreamResult>;
151
169
  supportsNonStreamingFallback(): boolean;
152
170
  complete(_messages: KodaXMessage[], _tools: KodaXToolDefinition[], _system: string, _reasoning?: boolean | KodaXReasoningRequest, _streamOptions?: KodaXProviderStreamOptions, _signal?: AbortSignal): Promise<KodaXStreamResult>;