@kodax-ai/kodax 0.7.49 → 0.7.51

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 (55) hide show
  1. package/CHANGELOG.md +1800 -1741
  2. package/README.md +1215 -1210
  3. package/README_CN.md +636 -632
  4. package/dist/chunks/agent-EFA7BSE7.js +2 -0
  5. package/dist/chunks/argument-completer-MAJVHSE7.js +2 -0
  6. package/dist/chunks/{chunk-TYZAH3YP.js → chunk-CCZMQE3Q.js} +1 -1
  7. package/dist/chunks/chunk-E3HENKTX.js +420 -0
  8. package/dist/chunks/chunk-FAIGYAEX.js +301 -0
  9. package/dist/chunks/chunk-HMATTIU6.js +574 -0
  10. package/dist/chunks/{chunk-YW4RQV7U.js → chunk-JJTUBNQX.js} +1 -1
  11. package/dist/chunks/chunk-ODVA5VTE.js +492 -0
  12. package/dist/chunks/chunk-PEWH3AAL.js +31 -0
  13. package/dist/chunks/chunk-WQTVG2T5.js +648 -0
  14. package/dist/chunks/{compaction-config-BQBYOWX2.js → compaction-config-UBPCNGC2.js} +1 -1
  15. package/dist/chunks/{construction-bootstrap-5TFGMSWQ.js → construction-bootstrap-WY5MDXRX.js} +1 -1
  16. package/dist/chunks/{dist-BL7IBQHD.js → dist-B73FQEAA.js} +1 -1
  17. package/dist/chunks/dist-BTWS2ENP.js +2 -0
  18. package/dist/chunks/utils-HVOJRR5C.js +2 -0
  19. package/dist/index.d.ts +11 -11
  20. package/dist/index.js +4 -4
  21. package/dist/kodax_cli.js +1091 -984
  22. package/dist/provider-capabilities.json +2 -0
  23. package/dist/sdk-agent.d.ts +25 -11
  24. package/dist/sdk-agent.js +1 -1
  25. package/dist/sdk-coding.d.ts +160 -34
  26. package/dist/sdk-coding.js +1 -1
  27. package/dist/sdk-llm.d.ts +3 -5
  28. package/dist/sdk-llm.js +1 -1
  29. package/dist/sdk-mcp.js +1 -1
  30. package/dist/sdk-repl.d.ts +38 -727
  31. package/dist/sdk-repl.js +2 -2
  32. package/dist/sdk-session.d.ts +8 -200
  33. package/dist/sdk-session.js +1 -1
  34. package/dist/sdk-skills.js +1 -1
  35. package/dist/types-chunks/{types.d-rPRl2LSB.d.ts → base.d-GZ6jvICS.d.ts} +270 -3
  36. package/dist/types-chunks/{bash-prefix-extractor.d-CI_xcPhn.d.ts → bash-prefix-extractor.d-DTOiDMlG.d.ts} +84 -537
  37. package/dist/types-chunks/{capsule.d-DaPuhyyK.d.ts → capsule.d-CXGdLGAn.d.ts} +6 -3
  38. package/dist/types-chunks/guardrail.d-D47yu9AO.d.ts +518 -0
  39. package/dist/types-chunks/{types.d-BR9oNWup.d.ts → process.d-B8kEBnQD.d.ts} +487 -275
  40. package/dist/types-chunks/{resolver.d-B_wm409c.d.ts → resolver.d-D75XFRH2.d.ts} +23 -6
  41. package/dist/types-chunks/sdk-session-BKQJN9oH.d.ts +977 -0
  42. package/dist/types-chunks/{storage.d-J2GqOgaX.d.ts → storage.d-BN1xIn8R.d.ts} +78 -3
  43. package/dist/types-chunks/types.d-DQ_hdN70.d.ts +273 -0
  44. package/dist/types-chunks/{utils.d-BJ_-y8gC.d.ts → utils.d-ZfRDo-kX.d.ts} +8 -80
  45. package/package.json +2 -2
  46. package/dist/chunks/argument-completer-GDG5OHN7.js +0 -2
  47. package/dist/chunks/chunk-67SWUEEN.js +0 -1035
  48. package/dist/chunks/chunk-C5PKZX5Z.js +0 -291
  49. package/dist/chunks/chunk-ISGHUKRY.js +0 -428
  50. package/dist/chunks/chunk-JTHMWRXM.js +0 -566
  51. package/dist/chunks/chunk-YACQ4OST.js +0 -31
  52. package/dist/chunks/dist-D7HOETCE.js +0 -2
  53. package/dist/chunks/utils-XWDT3W5X.js +0 -2
  54. package/dist/types-chunks/base.d-C4jYVjJh.d.ts +0 -270
  55. package/dist/types-chunks/types.d-BnjX2Gn4.d.ts +0 -297
@@ -1,4 +1,79 @@
1
- import { n as KodaXSessionData, s as KodaXSessionLineage, v as KodaXSessionNavigationOptions, w as KodaXSessionRuntimeInfo, y as KodaXSessionStorage } from './types.d-BnjX2Gn4.js';
1
+ import { a as BashPrefixExtractor } from './bash-prefix-extractor.d-DTOiDMlG.js';
2
+ import { $ as KodaXSessionData, a4 as KodaXSessionLineage, a7 as KodaXSessionNavigationOptions, a8 as KodaXSessionRuntimeInfo, aa as KodaXSessionStorage } from './process.d-B8kEBnQD.js';
3
+
4
+ /**
5
+ * Permission Types
6
+ */
7
+
8
+ /**
9
+ * Permission mode
10
+ * - plan: Read-only planning, all modifications blocked unless explicitly whitelisted
11
+ * - accept-edits: File edits auto-approved, shell commands require confirmation
12
+ * - auto: All tools auto-approved (with optional LLM classifier review when
13
+ * auto-mode engine === 'llm'; FEATURE_092 v0.7.33). When engine === 'rules',
14
+ * falls back to the legacy "all tools approved within project, outside
15
+ * requires confirmation" behavior — i.e., the v0.7.32 `auto-in-project`
16
+ * shape. The `auto-in-project` name is preserved as a deprecated alias
17
+ * for 5 minor versions (removed in v0.7.38).
18
+ */
19
+ type PermissionMode = "plan" | "accept-edits" | "auto" | "auto-in-project";
20
+ declare const PERMISSION_MODES: PermissionMode[];
21
+ /**
22
+ * Status-bar display name for a permission mode. Title-Case short labels
23
+ * (mirrors Claude Code's `shortTitle` convention in
24
+ * `src/utils/permissions/PermissionMode.ts`):
25
+ * - `plan` → `Plan`
26
+ * - `accept-edits` → `Edits`
27
+ * - `auto` → `Auto`
28
+ * - `auto-in-project` → `Auto` (deprecated alias folds into the canonical
29
+ * display name; the deprecation notice
30
+ * surfaces once per session at startup)
31
+ *
32
+ * Single source of truth — both the readline status-bar
33
+ * (`packages/repl/src/interactive/status-bar.ts`) and the Ink view-model
34
+ * (`packages/repl/src/ui/view-models/status-bar.ts`) consume this so the two
35
+ * surfaces never drift on capitalization or short-form choice.
36
+ */
37
+ declare function permissionModeDisplayName(mode: PermissionMode): string;
38
+ interface ConfirmResult {
39
+ confirmed: boolean;
40
+ always?: boolean;
41
+ }
42
+ interface PermissionContext {
43
+ permissionMode: PermissionMode;
44
+ confirmTools: Set<string>;
45
+ gitRoot?: string;
46
+ alwaysAllowTools: string[];
47
+ onConfirm?: (tool: string, input: Record<string, unknown>) => Promise<ConfirmResult>;
48
+ saveAlwaysAllowTool?: (tool: string, input: Record<string, unknown>, allowAll?: boolean) => void;
49
+ switchPermissionMode?: (mode: PermissionMode) => void;
50
+ beforeToolExecute?: (tool: string, input: Record<string, unknown>) => Promise<boolean | string>;
51
+ /**
52
+ * FEATURE_153 (v0.7.38) — Optional LLM-backed bash command prefix extractor.
53
+ * When supplied, `isToolCallAllowed` uses it to extract the SAFE PREFIX of
54
+ * a bash command before matching against allowlist patterns like
55
+ * `Bash(git commit:*)`. This eliminates the pre-FEATURE_153 vulnerability
56
+ * where `git commit -m "x" $(curl evil)` matched the allowlist via naive
57
+ * `command.startsWith` semantics.
58
+ *
59
+ * KodaX REPL bootstrap creates this via `createBashPrefixExtractor` from
60
+ * `@kodax-ai/coding` and threads it here. SDK consumers / tests without
61
+ * LLM access can omit it; legacy startsWith semantics apply (documented
62
+ * as insecure in `matchesBashPatternLegacy`).
63
+ */
64
+ bashPrefixExtractor?: BashPrefixExtractor;
65
+ }
66
+ /**
67
+ * Compute the base confirmation set for each permission mode.
68
+ *
69
+ * Note: `plan` still lists the standard mutating tools here even though most of
70
+ * them are blocked earlier in the permission pipeline via `getPlanModeBlockReason`.
71
+ * This helper only describes the remaining confirmation step for calls that are
72
+ * not hard-blocked.
73
+ */
74
+ declare function computeConfirmTools(mode: PermissionMode): Set<string>;
75
+ declare function isPermissionMode(value: string | undefined): value is PermissionMode;
76
+ declare function normalizePermissionMode(value: string | undefined, fallback?: PermissionMode): PermissionMode | undefined;
2
77
 
3
78
  /**
4
79
  * Session Storage - Session storage abstraction layer
@@ -201,5 +276,5 @@ declare class FileSessionStorage implements KodaXSessionStorage {
201
276
  cleanupOldSessions(retentionDays: number): Promise<number>;
202
277
  }
203
278
 
204
- export { FileSessionStorage as F, MemorySessionStorage as M, createMemorySessionStorage as c };
205
- export type { SessionData as S, SessionStorage as a };
279
+ export { FileSessionStorage as F, MemorySessionStorage as M, PERMISSION_MODES as P, computeConfirmTools as d, createMemorySessionStorage as e, isPermissionMode as i, normalizePermissionMode as n, permissionModeDisplayName as p };
280
+ export type { ConfirmResult as C, SessionData as S, PermissionContext as a, PermissionMode as b, SessionStorage as c };
@@ -0,0 +1,273 @@
1
+ import { y as Guardrail, aG as RunnerToolCall, d as Agent, f as AgentMessage, aJ as RunnerToolResult, aS as Span } from './process.d-B8kEBnQD.js';
2
+
3
+ /**
4
+ * Guardrail Runtime — FEATURE_085 (v0.7.26).
5
+ *
6
+ * Three-tier runtime for Agent guardrails:
7
+ *
8
+ * - `InputGuardrail`: runs once before the first LLM turn, inspects the
9
+ * full input transcript, may allow / rewrite / block / escalate.
10
+ * - `OutputGuardrail`: runs once before returning, inspects the final
11
+ * assistant message, may allow / rewrite / block / escalate.
12
+ * - `ToolGuardrail`: runs before and/or after each tool invocation,
13
+ * inspects the call / result, may allow / rewrite / block / escalate.
14
+ *
15
+ * The four verdict actions:
16
+ *
17
+ * - `allow`: continue with the current value.
18
+ * - `rewrite`: replace the current value with `payload`.
19
+ * - `block`: throw `GuardrailBlockedError` (for input/output) or surface
20
+ * an error tool_result (for tool-before); the LLM / caller sees a
21
+ * rejection and must adapt.
22
+ * - `escalate`: throw `GuardrailEscalateError`; the SDK consumer catches
23
+ * and decides whether to prompt the user, retry under different
24
+ * constraints, etc.
25
+ *
26
+ * Every guardrail invocation emits a `GuardrailSpan` under the agent's
27
+ * span when tracing is active.
28
+ *
29
+ * @experimental API shape may adjust during v0.7.x rollout.
30
+ */
31
+
32
+ /**
33
+ * Shared execution context passed to every guardrail.
34
+ *
35
+ * `messages` is the live conversation transcript at the moment this
36
+ * guardrail fires. For tool-side guardrails this is the transcript at
37
+ * call-site time — it does NOT yet include the assistant turn that
38
+ * emitted the current tool_use, since that turn is appended only after
39
+ * the full tool batch settles. Optional so existing guardrails that
40
+ * don't read context still type-check; populated by the Runner for all
41
+ * production hook points.
42
+ *
43
+ * Added in FEATURE_092 (v0.7.33) so the auto-mode classifier guardrail
44
+ * can extract intent context (user prompt + prior tool_use / tool_result
45
+ * blocks) without reaching into Runner internals.
46
+ */
47
+ interface GuardrailContext {
48
+ readonly agent: Agent;
49
+ readonly abortSignal?: AbortSignal;
50
+ readonly messages?: readonly AgentMessage[];
51
+ }
52
+ /**
53
+ * Outcome of a single guardrail check. `payload` shape depends on the hook
54
+ * point — see the specific guardrail interface for the expected type.
55
+ */
56
+ type GuardrailVerdict = {
57
+ readonly action: 'allow';
58
+ } | {
59
+ readonly action: 'rewrite';
60
+ readonly payload: unknown;
61
+ readonly reason?: string;
62
+ } | {
63
+ readonly action: 'block';
64
+ readonly reason: string;
65
+ } | {
66
+ readonly action: 'escalate';
67
+ readonly reason: string;
68
+ };
69
+ /**
70
+ * Input-side guardrail. Expected `rewrite` payload shape:
71
+ * `readonly AgentMessage[]` — the replacement transcript.
72
+ */
73
+ interface InputGuardrail extends Guardrail {
74
+ readonly kind: 'input';
75
+ check(input: readonly AgentMessage[], ctx: GuardrailContext): Promise<GuardrailVerdict>;
76
+ }
77
+ /**
78
+ * Output-side guardrail. Expected `rewrite` payload shape:
79
+ * `AgentMessage` — the replacement final assistant message.
80
+ */
81
+ interface OutputGuardrail extends Guardrail {
82
+ readonly kind: 'output';
83
+ check(output: AgentMessage, ctx: GuardrailContext): Promise<GuardrailVerdict>;
84
+ }
85
+ /**
86
+ * Tool-side guardrail. `beforeTool` rewrite payload shape: `RunnerToolCall`
87
+ * (replacement call). `afterTool` rewrite payload shape: `RunnerToolResult`
88
+ * (replacement result). Either hook is optional.
89
+ */
90
+ interface ToolGuardrail extends Guardrail {
91
+ readonly kind: 'tool';
92
+ beforeTool?(call: RunnerToolCall, ctx: GuardrailContext): Promise<GuardrailVerdict>;
93
+ afterTool?(call: RunnerToolCall, result: RunnerToolResult, ctx: GuardrailContext): Promise<GuardrailVerdict>;
94
+ }
95
+ /**
96
+ * Thrown when any guardrail returns `{ action: 'block' }`. The Runner
97
+ * propagates this up to the caller — the run is aborted at that point.
98
+ */
99
+ declare class GuardrailBlockedError extends Error {
100
+ readonly guardrailName: string;
101
+ readonly hookPoint: 'input' | 'output' | 'tool';
102
+ constructor(guardrailName: string, hookPoint: 'input' | 'output' | 'tool', reason: string);
103
+ }
104
+ /**
105
+ * Thrown when any guardrail returns `{ action: 'escalate' }`. Callers can
106
+ * catch and prompt the user or apply a stricter policy before retrying.
107
+ */
108
+ declare class GuardrailEscalateError extends Error {
109
+ readonly guardrailName: string;
110
+ readonly hookPoint: 'input' | 'output' | 'tool';
111
+ constructor(guardrailName: string, hookPoint: 'input' | 'output' | 'tool', reason: string);
112
+ }
113
+ /** Filter a guardrail list by hook-point. */
114
+ declare function collectGuardrails(guardrails: readonly Guardrail[] | undefined): {
115
+ input: readonly InputGuardrail[];
116
+ output: readonly OutputGuardrail[];
117
+ tool: readonly ToolGuardrail[];
118
+ };
119
+ /**
120
+ * Run all input guardrails in declaration order. Returns the (possibly
121
+ * rewritten) transcript. Throws on block / escalate.
122
+ */
123
+ declare function runInputGuardrails(transcript: readonly AgentMessage[], guardrails: readonly InputGuardrail[], ctx: GuardrailContext, agentSpan: Span | null): Promise<readonly AgentMessage[]>;
124
+ /**
125
+ * Run all output guardrails in declaration order. Returns the (possibly
126
+ * rewritten) final assistant message. Throws on block / escalate.
127
+ */
128
+ declare function runOutputGuardrails(output: AgentMessage, guardrails: readonly OutputGuardrail[], ctx: GuardrailContext, agentSpan: Span | null): Promise<AgentMessage>;
129
+ /**
130
+ * Outcome of the before-tool guardrail stage.
131
+ * - `{ kind: 'allow', call }`: continue to executeRunnerToolCall with `call`
132
+ * - `{ kind: 'block', result }`: skip execution; return `result` as the
133
+ * tool_result to the LLM (so it sees the rejection and can adapt)
134
+ */
135
+ type ToolBeforeOutcome = {
136
+ readonly kind: 'allow';
137
+ readonly call: RunnerToolCall;
138
+ } | {
139
+ readonly kind: 'block';
140
+ readonly result: RunnerToolResult;
141
+ };
142
+ /**
143
+ * Run before-tool guardrails in declaration order. Rewrite replaces the
144
+ * tool call. Block surfaces an error tool_result to the LLM instead of
145
+ * throwing — the LLM sees the rejection and adapts. Escalate still throws.
146
+ */
147
+ declare function runToolBeforeGuardrails(call: RunnerToolCall, guardrails: readonly ToolGuardrail[], ctx: GuardrailContext, agentSpan: Span | null): Promise<ToolBeforeOutcome>;
148
+ /**
149
+ * Run after-tool guardrails in declaration order. Rewrite replaces the
150
+ * result content. Block replaces with an error result. Escalate throws.
151
+ */
152
+ declare function runToolAfterGuardrails(call: RunnerToolCall, result: RunnerToolResult, guardrails: readonly ToolGuardrail[], ctx: GuardrailContext, agentSpan: Span | null): Promise<RunnerToolResult>;
153
+
154
+ /**
155
+ * @kodax-ai/agent/messaging — Message queue types
156
+ *
157
+ * FEATURE_115 (v0.7.36): agentId-scoped 2-tier priority queue infrastructure.
158
+ *
159
+ * Per ADR-021: messaging is a generic agent-platform primitive (not coding-
160
+ * specific). Downstream consumers:
161
+ * - @kodax-ai/coding runner-driven mid-turn drain
162
+ * - @kodax-ai/repl InkREPL ESC soft-pause + text injection (FEATURE_111 absorbed)
163
+ * - subagent task-notification routing (FEATURE_155 idle-yield wakeup)
164
+ *
165
+ * Phase 0.6 study (`c:/tmp/claude-code-actual-usage.md`): Claude Code's
166
+ * `'now'` priority has zero production usage; KodaX simplifies to 2 tiers.
167
+ */
168
+ type MessagePriority = 'user' | 'background';
169
+ type MessageMode = 'prompt' | 'task-notification' | 'system-reminder';
170
+ interface QueuedMessage {
171
+ /** Stable id for tracing / dedup. Format: `msg-<sequence>`. */
172
+ readonly id: string;
173
+ readonly priority: MessagePriority;
174
+ /**
175
+ * Routing key:
176
+ * undefined = main thread / coordinator agent
177
+ * 'agent-id-XYZ' = subagent / specific consumer
178
+ *
179
+ * Drain consumers MUST filter by agentId match — undefined matches only
180
+ * undefined-agentId messages, not "any agent".
181
+ */
182
+ readonly agentId?: string;
183
+ readonly mode: MessageMode;
184
+ readonly content: string;
185
+ /** Wall-clock timestamp (`Date.now()`) for tracing only — not used for ordering. */
186
+ readonly enqueuedAt: number;
187
+ }
188
+ interface DequeueFilter {
189
+ /**
190
+ * Only return messages with this agentId.
191
+ * undefined matches messages with no agentId (main-thread messages only).
192
+ */
193
+ readonly agentId?: string;
194
+ /**
195
+ * Highest priority level included in the drain.
196
+ * 'user' → only user priority drained, background stays queued
197
+ * 'background' → both user + background drained (Sleep-gated case)
198
+ */
199
+ readonly maxPriority: MessagePriority;
200
+ /**
201
+ * Optional cap on number of messages drained in this call.
202
+ * Defaults to unlimited (drains all matching).
203
+ */
204
+ readonly limit?: number;
205
+ /**
206
+ * FEATURE_159 (v0.7.40) — optional mode filter. Lets REPL split the
207
+ * single queue into mode-typed views (e.g. `mode:'prompt'` for user
208
+ * input vs `mode:'task-notification'` for child completion banners)
209
+ * without separate queues. When omitted, all modes match.
210
+ */
211
+ readonly mode?: MessageMode;
212
+ /**
213
+ * FEATURE_159 (v0.7.40) — optional precise-id filter. Single-message
214
+ * targeted removal — drives Esc-pop-this-uuid in REPL. When set, all
215
+ * other filters still apply (agentId / priority / mode mismatches still
216
+ * skip the message), so callers can't accidentally remove a message
217
+ * outside their scope.
218
+ */
219
+ readonly id?: string;
220
+ /**
221
+ * FEATURE_159 (v0.7.40) — optional escape-hatch predicate, AND-ed with
222
+ * the structured filters. Lets SDK consumers express conditions the
223
+ * typed fields don't cover (e.g. timestamp ranges, content-match) without
224
+ * forcing every new use case to extend `DequeueFilter`. KodaX-internal
225
+ * code should prefer the typed fields for readability; this is the
226
+ * "data-driven main path + predicate escape" pattern.
227
+ *
228
+ * Evaluated AFTER the typed filters succeed — so a `predicate` that
229
+ * inspects `message.content` never runs on messages outside the
230
+ * caller's `agentId` / `mode` / `id` scope.
231
+ */
232
+ readonly predicate?: (message: QueuedMessage) => boolean;
233
+ }
234
+ /**
235
+ * FEATURE_159 (v0.7.40) — structured queue event emitted to subscribers.
236
+ *
237
+ * Replaces the prior `() => void` bare-notify signal. Carries the kind +
238
+ * affected messages so SDK observability consumers (logging, tracing,
239
+ * metrics) can react per-event without re-diffing snapshots.
240
+ *
241
+ * Event granularity rules:
242
+ * - `enqueued` fires ONCE per `enqueue()` call (always 1 message).
243
+ * - `dequeued` fires ONCE per `dequeue()` call that removed ≥1 message,
244
+ * carrying ALL drained messages in priority+FIFO order. No-op drains
245
+ * (filter matched nothing) fire no event — quiet by design so the
246
+ * `waitForWakeEvent` 100ms poll doesn't spam idle subscribers.
247
+ * - `cleared` fires ONCE per `clear()` call that removed ≥1 message,
248
+ * carrying the pre-clear messages. Empty-queue clear fires nothing.
249
+ *
250
+ * The `useSyncExternalStore` React hook ignores the event payload (it
251
+ * only needs the change signal); SDK / tracer consumers read the event.
252
+ */
253
+ type QueueEvent = {
254
+ readonly kind: 'enqueued';
255
+ readonly message: QueuedMessage;
256
+ } | {
257
+ readonly kind: 'dequeued';
258
+ readonly messages: readonly QueuedMessage[];
259
+ } | {
260
+ readonly kind: 'cleared';
261
+ readonly messages: readonly QueuedMessage[];
262
+ };
263
+ /** FEATURE_159 — `MessageQueue.subscribe` listener signature. */
264
+ type QueueEventListener = (event: QueueEvent) => void;
265
+ interface EnqueueInput {
266
+ readonly priority: MessagePriority;
267
+ readonly mode: MessageMode;
268
+ readonly content: string;
269
+ readonly agentId?: string;
270
+ }
271
+
272
+ export { GuardrailBlockedError as G, GuardrailEscalateError as b, collectGuardrails as g, runOutputGuardrails as h, runToolAfterGuardrails as i, runToolBeforeGuardrails as j, runInputGuardrails as r };
273
+ export type { DequeueFilter as D, EnqueueInput as E, InputGuardrail as I, MessageMode as M, OutputGuardrail as O, QueueEventListener as Q, ToolBeforeOutcome as T, GuardrailContext as a, GuardrailVerdict as c, MessagePriority as d, QueuedMessage as e, ToolGuardrail as f };
@@ -1,84 +1,11 @@
1
- import { i as BashPrefixExtractor, a4 as KodaXOptions, M as KodaXContextTokenSnapshot, K as KodaXAgentMode, a9 as KodaXRepoIntelligenceMode, A as AgentsFile, f as AutoModeStats, al as KodaXSkillInvocationContext, a1 as KodaXMcpServersConfig } from './bash-prefix-extractor.d-CI_xcPhn.js';
2
- import { a as SessionStorage$1 } from './storage.d-J2GqOgaX.js';
3
- import { y as KodaXSessionStorage, n as KodaXSessionData, A as KodaXSessionUiHistoryItem, s as KodaXSessionLineage, k as KodaXSessionArtifactLedgerEntry, w as KodaXSessionRuntimeInfo } from './types.d-BnjX2Gn4.js';
4
- import { n as KodaXMessage, E as KodaXReasoningMode, r as KodaXProviderCapabilityProfile, F as KodaXReasoningOverride, h as KodaXCustomProviderConfig } from './types.d-rPRl2LSB.js';
1
+ import { P as KodaXOptions, s as KodaXContextTokenSnapshot, k as KodaXAgentMode, U as KodaXRepoIntelligenceMode, a4 as KodaXSkillInvocationContext } from './bash-prefix-extractor.d-DTOiDMlG.js';
2
+ import { c as SessionStorage$1, b as PermissionMode } from './storage.d-BN1xIn8R.js';
3
+ import { aa as KodaXSessionStorage, $ as KodaXSessionData, ac as KodaXSessionUiHistoryItem, a4 as KodaXSessionLineage, Y as KodaXSessionArtifactLedgerEntry, a8 as KodaXSessionRuntimeInfo, bD as WorkflowProcessSource } from './process.d-B8kEBnQD.js';
4
+ import { o as KodaXMessage, G as KodaXReasoningMode, t as KodaXProviderCapabilityProfile, H as KodaXReasoningOverride, i as KodaXCustomProviderConfig } from './base.d-GZ6jvICS.js';
5
+ import { A as AgentsFile, f as AutoModeStats, l as KodaXMcpServersConfig } from './guardrail.d-D47yu9AO.js';
5
6
  import * as readline from 'readline';
6
7
  import { SpawnSyncReturns } from 'child_process';
7
8
 
8
- /**
9
- * Permission Types
10
- */
11
-
12
- /**
13
- * Permission mode
14
- * - plan: Read-only planning, all modifications blocked unless explicitly whitelisted
15
- * - accept-edits: File edits auto-approved, shell commands require confirmation
16
- * - auto: All tools auto-approved (with optional LLM classifier review when
17
- * auto-mode engine === 'llm'; FEATURE_092 v0.7.33). When engine === 'rules',
18
- * falls back to the legacy "all tools approved within project, outside
19
- * requires confirmation" behavior — i.e., the v0.7.32 `auto-in-project`
20
- * shape. The `auto-in-project` name is preserved as a deprecated alias
21
- * for 5 minor versions (removed in v0.7.38).
22
- */
23
- type PermissionMode = "plan" | "accept-edits" | "auto" | "auto-in-project";
24
- declare const PERMISSION_MODES: PermissionMode[];
25
- /**
26
- * Status-bar display name for a permission mode. Title-Case short labels
27
- * (mirrors Claude Code's `shortTitle` convention in
28
- * `src/utils/permissions/PermissionMode.ts`):
29
- * - `plan` → `Plan`
30
- * - `accept-edits` → `Edits`
31
- * - `auto` → `Auto`
32
- * - `auto-in-project` → `Auto` (deprecated alias folds into the canonical
33
- * display name; the deprecation notice
34
- * surfaces once per session at startup)
35
- *
36
- * Single source of truth — both the readline status-bar
37
- * (`packages/repl/src/interactive/status-bar.ts`) and the Ink view-model
38
- * (`packages/repl/src/ui/view-models/status-bar.ts`) consume this so the two
39
- * surfaces never drift on capitalization or short-form choice.
40
- */
41
- declare function permissionModeDisplayName(mode: PermissionMode): string;
42
- interface ConfirmResult {
43
- confirmed: boolean;
44
- always?: boolean;
45
- }
46
- interface PermissionContext {
47
- permissionMode: PermissionMode;
48
- confirmTools: Set<string>;
49
- gitRoot?: string;
50
- alwaysAllowTools: string[];
51
- onConfirm?: (tool: string, input: Record<string, unknown>) => Promise<ConfirmResult>;
52
- saveAlwaysAllowTool?: (tool: string, input: Record<string, unknown>, allowAll?: boolean) => void;
53
- switchPermissionMode?: (mode: PermissionMode) => void;
54
- beforeToolExecute?: (tool: string, input: Record<string, unknown>) => Promise<boolean | string>;
55
- /**
56
- * FEATURE_153 (v0.7.38) — Optional LLM-backed bash command prefix extractor.
57
- * When supplied, `isToolCallAllowed` uses it to extract the SAFE PREFIX of
58
- * a bash command before matching against allowlist patterns like
59
- * `Bash(git commit:*)`. This eliminates the pre-FEATURE_153 vulnerability
60
- * where `git commit -m "x" $(curl evil)` matched the allowlist via naive
61
- * `command.startsWith` semantics.
62
- *
63
- * KodaX REPL bootstrap creates this via `createBashPrefixExtractor` from
64
- * `@kodax-ai/coding` and threads it here. SDK consumers / tests without
65
- * LLM access can omit it; legacy startsWith semantics apply (documented
66
- * as insecure in `matchesBashPatternLegacy`).
67
- */
68
- bashPrefixExtractor?: BashPrefixExtractor;
69
- }
70
- /**
71
- * Compute the base confirmation set for each permission mode.
72
- *
73
- * Note: `plan` still lists the standard mutating tools here even though most of
74
- * them are blocked earlier in the permission pipeline via `getPlanModeBlockReason`.
75
- * This helper only describes the remaining confirmation step for calls that are
76
- * not hard-blocked.
77
- */
78
- declare function computeConfirmTools(mode: PermissionMode): Set<string>;
79
- declare function isPermissionMode(value: string | undefined): value is PermissionMode;
80
- declare function normalizePermissionMode(value: string | undefined, fallback?: PermissionMode): PermissionMode | undefined;
81
-
82
9
  /**
83
10
  * InkREPL - Ink-based REPL Adapter
84
11
  *
@@ -347,6 +274,7 @@ interface CommandWorkflowInvocationRequest {
347
274
  request: string;
348
275
  source: 'command' | 'natural-language';
349
276
  displayName: string;
277
+ processSource?: WorkflowProcessSource;
350
278
  }
351
279
  type CommandResult$1 = boolean | CommandResultData;
352
280
  type CommandHandler = (args: string[], context: InteractiveContext, callbacks: CommandCallbacks, currentConfig: CurrentConfig) => Promise<CommandResult$1 | void>;
@@ -566,5 +494,5 @@ declare function saveConfig(config: {
566
494
  declare function getGitRoot(cwd?: string): Promise<string | null>;
567
495
  declare function rateLimitedCall<T>(fn: () => Promise<T>): Promise<T>;
568
496
 
569
- export { processSpecialSyntax as A, BUILTIN_COMMANDS as B, rateLimitedCall as D, registerConfiguredCustomProviders as E, runInkInteractiveMode as F, runInteractiveMode as G, saveConfig as H, touchContext as J, KODAX_CONFIG_FILE as K, PERMISSION_MODES as P, KODAX_DIR as f, KODAX_SESSIONS_DIR as g, KODAX_VERSION as h, PREVIEW_MAX_LENGTH as i, computeConfirmTools as l, createInteractiveContext as m, executeCommand as n, getGitRoot as o, getProviderList as p, getProviderModel as q, getVersion as r, hydrateProcessEnvFromShell as s, isPermissionMode as t, isProviderConfigured as u, loadConfig as v, normalizePermissionMode as w, parseCommand as x, permissionModeDisplayName as y, prepareRuntimeConfig as z };
570
- export type { Command as C, InkREPLOptions as I, RepLOptions as R, CommandCallbacks as a, ConfirmResult as b, CurrentConfig as c, InteractiveContext as d, InteractiveMode as e, PermissionContext as j, PermissionMode as k };
497
+ 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 };
498
+ 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,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodax-ai/kodax",
3
- "version": "0.7.49",
3
+ "version": "0.7.51",
4
4
  "description": "极致轻量化 Coding Agent - TypeScript 实现,支持 12 个 LLM 提供商,可发布为免 Node 单文件二进制",
5
5
  "type": "module",
6
6
  "private": false,
@@ -87,7 +87,7 @@
87
87
  "dependencies": {
88
88
  "@agentclientprotocol/sdk": "^0.15.0",
89
89
  "@alcalzone/ansi-tokenize": "^0.2.5",
90
- "@anthropic-ai/sdk": "^0.80.0",
90
+ "@anthropic-ai/sdk": "^0.104.2",
91
91
  "ansi-escapes": "^7.3.0",
92
92
  "auto-bind": "^5.0.1",
93
93
  "chalk": "^5.4.1",
@@ -1,2 +0,0 @@
1
- // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{ea as a,fa as b}from"./chunk-ISGHUKRY.js";import"./chunk-TYZAH3YP.js";import"./chunk-YW4RQV7U.js";import"./chunk-67SWUEEN.js";import"./chunk-YACQ4OST.js";import"./chunk-JTHMWRXM.js";import"./chunk-V4WSBIXB.js";export{a as ArgumentCompleter,b as createArgumentCompleter};