@kodax-ai/kodax 0.7.94 → 0.7.95

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 (97) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +36 -2
  3. package/README_CN.md +29 -0
  4. package/dist/chunks/agent-XXZMXKKA.js +2 -0
  5. package/dist/chunks/argument-completer-KCYDGTQW.js +2 -0
  6. package/dist/chunks/{chunk-BVV3IA5W.js → chunk-2PEDBGKN.js} +1 -1
  7. package/dist/chunks/{chunk-NGOPE4KK.js → chunk-2TM3W3GK.js} +1 -1
  8. package/dist/chunks/{chunk-ZKEXHAXA.js → chunk-6ABQJUK6.js} +219 -217
  9. package/dist/chunks/{chunk-ZGZLSKN6.js → chunk-7JXA3533.js} +223 -225
  10. package/dist/chunks/{chunk-UNRHTOT5.js → chunk-BNVSKIAB.js} +338 -141
  11. package/dist/chunks/chunk-BR2OSB2I.js +722 -0
  12. package/dist/chunks/{chunk-YMNFQ7SQ.js → chunk-C4DTUKTR.js} +2 -2
  13. package/dist/chunks/{chunk-ZMGATMXN.js → chunk-DSMONSVB.js} +1 -1
  14. package/dist/chunks/{chunk-6BATYA47.js → chunk-JS452J2F.js} +2 -2
  15. package/dist/chunks/chunk-O743AJ5V.js +323 -0
  16. package/dist/chunks/{chunk-IIIAUDGW.js → chunk-OK4AXDC5.js} +1 -1
  17. package/dist/chunks/chunk-Q5VRWSKG.js +418 -0
  18. package/dist/chunks/{chunk-N7HIJNJH.js → chunk-SRIJX5ZP.js} +1 -1
  19. package/dist/chunks/chunk-XWRPOGJN.js +4 -0
  20. package/dist/chunks/chunk-Y5VIQBT6.js +383 -0
  21. package/dist/chunks/{client-4IOUU4U3.js → client-JDOS3YJR.js} +1 -1
  22. package/dist/chunks/{compaction-config-2DTN3OHT.js → compaction-config-EGS4577X.js} +1 -1
  23. package/dist/chunks/{construction-bootstrap-BL56XTNW.js → construction-bootstrap-YCWHHUYO.js} +1 -1
  24. package/dist/chunks/dist-KFYN3OKD.js +2 -0
  25. package/dist/chunks/host-VAYADIPW.js +2 -0
  26. package/dist/chunks/run-manager-52IJZMZJ.js +2 -0
  27. package/dist/chunks/utils-P7PBSL3R.js +2 -0
  28. package/dist/index.d.ts +25 -25
  29. package/dist/index.js +1 -1
  30. package/dist/kodax_bootstrap.js +1 -1
  31. package/dist/kodax_cli.js +1680 -1442
  32. package/dist/kodax_resume.js +35 -35
  33. package/dist/runtime-worker.js +1543 -1305
  34. package/dist/sandbox-workspace-session.js +320 -646
  35. package/dist/sdk-a2a.d.ts +18 -18
  36. package/dist/sdk-a2a.js +1 -1
  37. package/dist/sdk-agent.d.ts +36 -26
  38. package/dist/sdk-agent.js +1 -1
  39. package/dist/sdk-coding.d.ts +30 -32
  40. package/dist/sdk-coding.js +1 -1
  41. package/dist/sdk-experimental-memory.d.ts +6 -6
  42. package/dist/sdk-experimental-memory.js +1 -1
  43. package/dist/sdk-llm.d.ts +8 -8
  44. package/dist/sdk-mcp.d.ts +4 -4
  45. package/dist/sdk-mcp.js +1 -1
  46. package/dist/sdk-media.d.ts +1 -1
  47. package/dist/sdk-repl.d.ts +21 -21
  48. package/dist/sdk-repl.js +1 -1
  49. package/dist/sdk-runtime.d.ts +28 -26
  50. package/dist/sdk-runtime.js +1 -1
  51. package/dist/sdk-sandbox.d.ts +3 -1
  52. package/dist/sdk-sandbox.js +1 -1
  53. package/dist/sdk-session.d.ts +10 -10
  54. package/dist/sdk-session.js +1 -1
  55. package/dist/sdk-skills.d.ts +2 -2
  56. package/dist/sdk-skills.js +1 -1
  57. package/dist/semantic-worker.js +278 -81
  58. package/dist/types-chunks/{base.d-JjF6aKsh.d.ts → base.d-vopO1rml.d.ts} +1 -1
  59. package/dist/types-chunks/{bash-prefix-extractor.d-AOJdvO4r.d.ts → bash-prefix-extractor.d-B2rxNI4L.d.ts} +20 -9
  60. package/dist/types-chunks/{capability-learning.d-BAxy0mfx.d.ts → capability-learning.d-CE1tm29C.d.ts} +1 -1
  61. package/dist/types-chunks/{capsule.d-nYbM4MNL.d.ts → capsule.d-Y7QRS4J2.d.ts} +5 -5
  62. package/dist/types-chunks/{config.d-CTPaqsD-.d.ts → config.d-CJy1WENT.d.ts} +1 -1
  63. package/dist/types-chunks/{controller.d-CTvvOy_V.d.ts → controller.d-BR-UVeUR.d.ts} +1 -1
  64. package/dist/types-chunks/{controller.d-Bm1i9RVj.d.ts → controller.d-C5noq5-w.d.ts} +4 -4
  65. package/dist/types-chunks/{cost-tracker.d-MTAt6N7b.d.ts → cost-tracker.d-BeaenODW.d.ts} +1 -1
  66. package/dist/types-chunks/{guardrail.d-D8RyuTrv.d.ts → guardrail.d-DqHD-61O.d.ts} +9 -9
  67. package/dist/types-chunks/{history-retrieval.d-D0LNyBED.d.ts → history-retrieval.d-CKU8zmt_.d.ts} +2 -2
  68. package/dist/types-chunks/{integration-config.d-BHoiz-WZ.d.ts → integration-config.d-BNowXE8k.d.ts} +3 -3
  69. package/dist/types-chunks/{manager.d-D_1fqveb.d.ts → manager.d-B67TmPO1.d.ts} +3 -3
  70. package/dist/types-chunks/{oauth-login.d-Cz9OpSmz.d.ts → oauth-login.d-6i-vidxv.d.ts} +3 -3
  71. package/dist/types-chunks/{public-api.d-BNmLxGnR.d.ts → public-api.d-D7fXaWW8.d.ts} +7 -6
  72. package/dist/types-chunks/{repl.d-Q6Z3lV2-.d.ts → repl.d-BYDb14s6.d.ts} +8 -8
  73. package/dist/types-chunks/{resolver.d-DparsV6Y.d.ts → resolver.d-CwHUwbdE.d.ts} +4 -4
  74. package/dist/types-chunks/{review-inbox.d-dAtGH3g2.d.ts → review-inbox.d-BSgFewyj.d.ts} +3 -3
  75. package/dist/types-chunks/{run-manager.d-BeSEc2OL.d.ts → run-manager.d-BVJSntpS.d.ts} +2 -2
  76. package/dist/types-chunks/{sdk-session-BwC_i6JB.d.ts → sdk-session-CqEG84oP.d.ts} +3 -3
  77. package/dist/types-chunks/{sdk-skills-Bg1yL4i4.d.ts → sdk-skills-DokfOoJF.d.ts} +1 -1
  78. package/dist/types-chunks/{shell-command-sets.d-hkYPr4Dy.d.ts → shell-command-sets.d-DqaaBwhU.d.ts} +1 -1
  79. package/dist/types-chunks/{side-query.d-DNes6rHA.d.ts → side-query.d-iH0P9ASy.d.ts} +3 -3
  80. package/dist/types-chunks/{types-D8OiIEwA.d.ts → types-PHjfwebT.d.ts} +1 -1
  81. package/dist/types-chunks/{types.d-CzrUifXB.d.ts → types.d-C5xQEFcj.d.ts} +6 -6
  82. package/dist/types-chunks/{types.d-Cv09EdJR.d.ts → types.d-CK9A9rpP.d.ts} +1 -1
  83. package/dist/types-chunks/{types.d-Bdv2JoiC.d.ts → types.d-CaTXAW_Q.d.ts} +3 -3
  84. package/dist/types-chunks/{types.d-ssh6zRaf.d.ts → types.d-Cb8RdrjU.d.ts} +1 -1
  85. package/dist/types-chunks/{types.d-EjZTEEVu.d.ts → types.d-rUOjXych.d.ts} +6 -2
  86. package/dist/types-chunks/{utils.d-Buv_Gxhi.d.ts → utils.d-CWUyLiXo.d.ts} +8 -8
  87. package/package.json +2 -2
  88. package/dist/chunks/agent-Q3FB3GNZ.js +0 -2
  89. package/dist/chunks/argument-completer-SS2Q2ZKT.js +0 -2
  90. package/dist/chunks/chunk-56CIZI5I.js +0 -418
  91. package/dist/chunks/chunk-7CKGNNTU.js +0 -383
  92. package/dist/chunks/chunk-EASGM7W7.js +0 -687
  93. package/dist/chunks/chunk-NK5AWGNW.js +0 -319
  94. package/dist/chunks/dist-B4CB7KHY.js +0 -2
  95. package/dist/chunks/host-7747QS3X.js +0 -2
  96. package/dist/chunks/run-manager-NLNMI3P2.js +0 -2
  97. package/dist/chunks/utils-CGGQLMJS.js +0 -2
package/CHANGELOG.md CHANGED
@@ -8,6 +8,70 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  ---
10
10
 
11
+ ## [0.7.95] - 2026-08-23
12
+
13
+ ### Fixed
14
+
15
+ - KodaX-created linked worktrees now join the Session's exact sandbox policy
16
+ before the tool returns them to the model. The Runtime persists that bounded
17
+ root set, revalidates each Git common-directory backlink on later Runs, and
18
+ revokes it after worktree removal. A background Bash process in such a
19
+ worktree can therefore coexist with `write`/`edit` without authorizing
20
+ arbitrary sibling directories or weakening namespace fences. Atomic root
21
+ updates remain authoritative over stale full-Session snapshots, so an old
22
+ non-empty list cannot overwrite a newer registration or resurrect a revoked
23
+ root. Older Sessions migrate only retained successful `worktree_create`
24
+ evidence after the same Git relationship is revalidated. Session roots that
25
+ are real Git submodules use their byte-bounded `core.worktree` backlink as
26
+ the repository identity, so creating a linked worktree from a submodule does
27
+ not regress while forged `.git/modules` paths remain rejected.
28
+ - Windows sandbox cleanup now keeps every ACL-mutating helper and command owner
29
+ in a recoverable machine-global Job, persists only self-healing recovery
30
+ tickets, and retries process drain, ACL reset, and filesystem-effect fence
31
+ release in the background without blocking unrelated work. Runtime shutdown
32
+ also verifies exact daemon and supervisor process generations, so PID reuse or
33
+ an interrupted exit cannot strand a manual-recovery requirement. Same-boot
34
+ `unconfirmed-owner` tickets are retried automatically and cleared only after a
35
+ sandbox-user SID probe proves the account idle; probe failure remains
36
+ fail-closed and diagnosable without blocking non-sandbox work. Text cleanup
37
+ recovery records each completed phase and retains a consumed
38
+ sandbox attestation across retries. Transient workspace cleanup, policy-reset,
39
+ or outer lease-release failures therefore retry without losing evidence or
40
+ repeating already completed phases.
41
+ - Learning-store coordination now reclaims a stale zero-byte owner lock left by
42
+ a crash between exclusive creation and owner-record publication, plus stale
43
+ malformed or truncated owner records, using an unchanged-byte/stat compare
44
+ before deletion; valid live owners and successor records remain protected.
45
+ Fullscreen TUI
46
+ teardown also performs an exit-safe terminal restore from the renderer's
47
+ guaranteed unmount boundary, including when final rendering or React cleanup
48
+ throws; terminal write backpressure no longer disables cleanup (Issue 301).
49
+ - Explicit Skill execution now keeps the exact user query as the canonical
50
+ transcript/title input while carrying expanded instructions and host hook
51
+ context only in the execution overlay. Multiple known Skill references are
52
+ rejected consistently in Classic, Ink, immediate, and queued paths, and a
53
+ failed or malformed `PreToolUse` hook fails closed instead of authorizing the
54
+ guarded tool. The shared command-dispatch check also covers leading
55
+ `/<skill>` and legacy `/skill:<name>` forms before either Skill executes.
56
+ - Terminal Run persistence failure now converges to `unknown` before the public
57
+ result resolves. If neither status nor event journal can publish that state,
58
+ active `sessions.observe()` consumers are invalidated and must resnapshot,
59
+ preventing a stale terminal projection. The additive SDK contracts advance to
60
+ `runtimeExitSettlement:2` and Windows `sandboxRuntime:5`; release/version
61
+ assignment remains a maintainer step. If terminal status commits but its
62
+ status-lock cleanup reports failure, the exact committed proposal is reread
63
+ and its terminal event is still published once; a different authoritative
64
+ status is never overwritten or republished.
65
+ - The coding runtime now delays its public `onComplete` completion signal until
66
+ extension completion and asynchronous result finalization have produced the
67
+ authoritative `KodaXResult`. A2A responses and other completion subscribers
68
+ can no longer observe an empty successful answer before the coding result
69
+ settles, including the lost-executor-Promise fallback path (Issue 302). A
70
+ completion observer that throws after finalization is diagnosed without
71
+ rewriting the persisted terminal facts.
72
+
73
+ ---
74
+
11
75
  ## [0.7.94] - 2026-08-21
12
76
 
13
77
  ### Changed
package/README.md CHANGED
@@ -726,6 +726,40 @@ permission UI, and recovers stale prepared Session tails through an
726
726
  authoritative merge. Background persistence failures are surfaced as
727
727
  diagnostics rather than hidden.
728
728
 
729
+ **v0.7.95 release:** stale learning locks with zero-byte,
730
+ malformed, or truncated owner records self-recover after an unchanged
731
+ bytes/stat check. Same-boot Windows `unconfirmed-owner` cleanup retries until
732
+ the sandbox-user SID is proven idle, without requiring marker deletion.
733
+ Windows sandbox cleanup keeps every ACL-mutating helper and command owner in a
734
+ recoverable machine-global Job and retries process drain, ACL reset, and
735
+ effect-fence release in the background; Runtime shutdown verifies exact daemon
736
+ and supervisor process generations. Text cleanup retains its execution
737
+ attestation and retries transient workspace cleanup, policy reset, and
738
+ effect-lease release automatically.
739
+ Canonical history stores the exact explicit-Skill query, multiple Skill
740
+ references are rejected, and failed/malformed `PreToolUse` hooks deny the tool.
741
+ Terminal persistence uncertainty publishes `unknown` or invalidates live
742
+ Session observers for resnapshot. A status-lock cleanup failure after a
743
+ committed terminal is reconciled only when the reread status exactly matches
744
+ the local proposal, then publishes one terminal event; different authority
745
+ still wins. The coding runtime finalizes its authoritative result before
746
+ emitting the public completion signal, so A2A cannot publish an empty
747
+ successful answer (Issue 302). This release advertises Windows
748
+ `sandboxRuntime:5` and `runtimeExitSettlement:2`. See the
749
+ [v0.7.95 release checklist](docs/release.md#v0795-release-preparation).
750
+
751
+ **v0.7.95 dynamic-worktree correction:** KodaX-created linked
752
+ worktrees join the exact Session shell/text sandbox policy before their paths
753
+ are returned, persist across later Runs, and are revalidated against the same
754
+ Git common directory. Removal revokes the root; unrelated siblings remain
755
+ fenced. A real submodule Session root proves that identity through its bounded
756
+ `.git/modules/...` `core.worktree` backlink; candidates still require ordinary
757
+ linked-worktree backlinks. For an older Session without the registry field, a retained successful
758
+ `worktree_create` result is migrated once only after the same Git relationship
759
+ passes validation. If that exact evidence is unavailable, stop the background
760
+ process and remove/recreate the worktree through KodaX once. Do not delete
761
+ ProgramData coordination files for this migration.
762
+
729
763
  **v0.7.94 release:** Runtime text tools may overlap a compatible live Bash
730
764
  lease because snapshot and commit run through the same ASRT workspace policy.
731
765
  Hard-linked workspace targets are rejected. Windows sandboxed git trusts
@@ -742,8 +776,8 @@ Runtime advertises `conversationHistory:2`. Explicit Skill invocation
742
776
  still runs if an embedder result observer throws. Every Run
743
777
  finalization and sandbox/managed-child termination rejection is observed. If
744
778
  neither terminal record can be persisted, the Run resolves `unknown` with
745
- `run_settlement_not_persisted` and keeps the Session fenced. Daemon connection
746
- loss exposes a typed code, `connectionId`, and `reconnectable` fact. Once a
779
+ `run_settlement_not_persisted` and keeps the Session fenced.
780
+ Daemon connection loss exposes a typed code, `connectionId`, and `reconnectable` fact. Once a
747
781
  host receives a `runId`, it must retain it and, after reconnecting, call
748
782
  `runs.get(runId)` then `runs.await(runId)` on the replacement Runtime. It must
749
783
  never replay `runs.start()` for that admitted Run. Capability versions
package/README_CN.md CHANGED
@@ -266,6 +266,35 @@ SDK 系统代码契约更新,但没有放宽 shell/sandbox 的 fail-closed 边
266
266
  `handleRuntimePermissionRequest()` 管理 SDK 权限 UI,并在 prepared Session 尾部遇到
267
267
  `data_changed` 时通过权威 delta 合并恢复;后台持久化失败会显示为诊断,不再静默丢失。
268
268
 
269
+ **v0.7.95 发布**:零字节、畸形或截断 owner 的过期 learning lock
270
+ 会在字节与 stat 二次确认未变后自动恢复。同一次 Windows 启动内的
271
+ `unconfirmed-owner` 会持续自动重试,只有精确 sandbox-user SID 探针证明空闲后
272
+ 才清理,不要求用户删除 marker。Windows 沙箱清理将每个修改 ACL 的 helper 与命令
273
+ owner 保存在可恢复的机器级 Job 中,并在后台重试进程 drain、ACL reset 和
274
+ effect fence 释放;Runtime 关闭会校验精确的 daemon 与 supervisor 进程代际。
275
+ 显式 Skill 的 canonical 历史保留用户原始 query,
276
+ 多个 Skill 引用会被拒绝,失败或畸形的 `PreToolUse` 会拒绝工具。终态持久化不确定
277
+ 时发布 `unknown`,或让 live Session observer 失效并重新取快照。若终态已经提交、
278
+ 随后 status-lock 清理失败,只在重读状态与本地 proposal 完全一致时继续且只发布
279
+ 一次 terminal event;不同的权威终态仍然优先。coding runtime 会在发出公开完成
280
+ 信号之前先收敛出权威结果,A2A 不会再发布空的成功答复(Issue 302)。
281
+ 本版本广告 Windows `sandboxRuntime:5` 与 `runtimeExitSettlement:2`。详见
282
+ [v0.7.95 发布清单](docs/release.md#v0795-release-preparation)。
283
+
284
+ **v0.7.95 动态 worktree 修正**:KodaX 创建的 linked worktree 会在路径
285
+ 返回给模型前加入该 Session 的精确 shell/text sandbox 策略,跨后续 Run 持久化,
286
+ 并按同一 Git common-dir 关系重新校验。删除 worktree 时立即撤销;未登记的
287
+ sibling 目录仍保持门禁。若 Session 根本身是真实 Git submodule,只接受其有界
288
+ `.git/modules/...` `core.worktree` 对精确工作区的反向绑定;候选仍须通过普通
289
+ linked-worktree backlink 校验。旧版本创建的 worktree 没有持久化登记:Session 若仍
290
+ 保留成功的 `worktree_create` 结果,会在同一 Git 关系重新校验通过后
291
+ 一次性迁移;若该精确证据已不存在,请先停止后台进程,再通过 KodaX 删除并重新
292
+ 创建一次。迁移时不要删除 ProgramData 协调文件。
293
+
294
+ **v0.7.95 自动清理修正**:文本清理会跨重试保留已经读取的执行
295
+ attestation,并对瞬时 workspace cleanup、策略 reset 与 effect lease 释放失败自动
296
+ 重试;已经完成的阶段不会重复执行,也不会留下必须人工删除的恢复标记。
297
+
269
298
  **v0.7.94 发布**:Runtime 文本工具可以与兼容的长驻/后台 Bash 并发,因为
270
299
  snapshot 与 commit 走同一套 ASRT workspace 策略。硬链接工作区目标会被拒绝。
271
300
  Windows 沙箱 git 只信任已授权的仓库根,不再发出 `safe.directory=*`(Issue 300)。
@@ -0,0 +1,2 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{$a as j,Bc as k,La as g,Na as h,_a as i,a as c,ta as d,ua as e,va as f}from"./chunk-Q5VRWSKG.js";import"./chunk-7QBWHCIZ.js";import"./chunk-7JXA3533.js";import"./chunk-XWRPOGJN.js";import"./chunk-SRIJX5ZP.js";import"./chunk-2PEDBGKN.js";import"./chunk-BHE66SP3.js";import{Mb as a,Nb as b}from"./chunk-BNVSKIAB.js";import"./chunk-77PNP27P.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,k as runKodaX,j as saveRequiredSessionSnapshot,i as saveSessionSnapshot,a as validateAndFixToolHistory};
@@ -0,0 +1,2 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{Na as a,Oa as b}from"./chunk-6ABQJUK6.js";import"./chunk-C4DTUKTR.js";import"./chunk-OK4AXDC5.js";import"./chunk-DSMONSVB.js";import"./chunk-2TM3W3GK.js";import"./chunk-Q5VRWSKG.js";import"./chunk-7QBWHCIZ.js";import"./chunk-JS452J2F.js";import"./chunk-7JXA3533.js";import"./chunk-XWRPOGJN.js";import"./chunk-SRIJX5ZP.js";import"./chunk-2PEDBGKN.js";import"./chunk-BHE66SP3.js";import"./chunk-BNVSKIAB.js";import"./chunk-77PNP27P.js";import"./chunk-ONUPGMER.js";export{a as ArgumentCompleter,b as createArgumentCompleter};
@@ -1,2 +1,2 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{$a as o}from"./chunk-UNRHTOT5.js";import{a as r}from"./chunk-ONUPGMER.js";var p=Object.freeze({".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"typescriptreact",".js":"javascript",".mjs":"javascript",".cjs":"javascript",".jsx":"javascriptreact",".py":"python",".pyi":"python",".go":"go",".rs":"rust",".java":"java"});function f(e){let t=e.lastIndexOf(".");if(t<0)return;let s=e.slice(t).toLowerCase();return p[s]}r(f,"languageIdForPath");var a=process.platform==="win32";function v(e){let t=e.replace(/\\/g,"/");return a?t.toLowerCase():t}r(v,"normalizeFsPath");import{spawn as c}from"child_process";function u(e){return process.platform==="win32"&&e!==process.execPath&&!/\.exe$/i.test(e)}r(u,"needsShell");function I(e,t,s,i=e===process.execPath?"javascript":"native"){if(u(e)){let n=[l(e),...t].join(" ");return c(n,{...s,shell:!0,windowsHide:!0})}if(i==="javascript"){let n=o({args:t,env:s.env??process.env,isElectron:process.versions.electron!==void 0,executable:e});return c(n.command,n.args,{...s,env:n.env,shell:!1,windowsHide:!0})}return c(e,[...t],{...s,shell:!1,windowsHide:!0})}r(I,"spawnLspProcess");function l(e){return/[\s"]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}r(l,"quoteIfNeeded");export{f as a,v as b,I as c};
2
+ import{$a as o}from"./chunk-BNVSKIAB.js";import{a as r}from"./chunk-ONUPGMER.js";var p=Object.freeze({".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"typescriptreact",".js":"javascript",".mjs":"javascript",".cjs":"javascript",".jsx":"javascriptreact",".py":"python",".pyi":"python",".go":"go",".rs":"rust",".java":"java"});function f(e){let t=e.lastIndexOf(".");if(t<0)return;let s=e.slice(t).toLowerCase();return p[s]}r(f,"languageIdForPath");var a=process.platform==="win32";function v(e){let t=e.replace(/\\/g,"/");return a?t.toLowerCase():t}r(v,"normalizeFsPath");import{spawn as c}from"child_process";function u(e){return process.platform==="win32"&&e!==process.execPath&&!/\.exe$/i.test(e)}r(u,"needsShell");function I(e,t,s,i=e===process.execPath?"javascript":"native"){if(u(e)){let n=[l(e),...t].join(" ");return c(n,{...s,shell:!0,windowsHide:!0})}if(i==="javascript"){let n=o({args:t,env:s.env??process.env,isElectron:process.versions.electron!==void 0,executable:e});return c(n.command,n.args,{...s,env:n.env,shell:!1,windowsHide:!0})}return c(e,[...t],{...s,shell:!1,windowsHide:!0})}r(I,"spawnLspProcess");function l(e){return/[\s"]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}r(l,"quoteIfNeeded");export{f as a,v as b,I as c};
@@ -1,5 +1,5 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{D,J as F}from"./chunk-6BATYA47.js";import{n as q,o as j,p as N,q as C,sa as P}from"./chunk-ZGZLSKN6.js";import{Pa as E,gb as O,m as v,n as T}from"./chunk-BHE66SP3.js";import{Id as W,Jd as M,Od as I,rg as $,sg as k,tg as y,wg as _,xg as b,yg as x}from"./chunk-UNRHTOT5.js";import{a as o}from"./chunk-ONUPGMER.js";import{join as Le}from"node:path";var ae=["You generate KodaX Dynamic Workflow scripts.","Return JSON only. Do not wrap the answer in prose.","For simple tasks that do not benefit from multiple agents, return:",'{"action":"decline","reason":"..."}',"For complex tasks, return:",'{"action":"generate","manifest":{...},"source":"async function run(wf, args) { ... }","approvalSummary":"..."}',"Generated source may only coordinate agents through wf and args.","Generated source must return displayable final text for the user.","Never use import, require, process, fs, child_process, network APIs, shell commands, or direct file access."].join(`
2
+ import{D,J as F}from"./chunk-JS452J2F.js";import{c as q,d as j,e as N,f as C,ha as P}from"./chunk-7JXA3533.js";import{Pa as E,gb as O,m as v,n as T}from"./chunk-BHE66SP3.js";import{Ag as b,Bg as x,Ld as W,Md as M,Rd as I,ug as $,vg as k,wg as y,zg as _}from"./chunk-BNVSKIAB.js";import{a as o}from"./chunk-ONUPGMER.js";import{join as Le}from"node:path";var ae=["You generate KodaX Dynamic Workflow scripts.","Return JSON only. Do not wrap the answer in prose.","For simple tasks that do not benefit from multiple agents, return:",'{"action":"decline","reason":"..."}',"For complex tasks, return:",'{"action":"generate","manifest":{...},"source":"async function run(wf, args) { ... }","approvalSummary":"..."}',"Generated source may only coordinate agents through wf and args.","Generated source must return displayable final text for the user.","Never use import, require, process, fs, child_process, network APIs, shell commands, or direct file access."].join(`
3
3
  `),G=12e4,le="KODAX_WORKFLOW_GENERATION_TIMEOUT_SEC",ce="KODAX_WORKFLOW_GENERATION_TIMEOUT_MS",ue=64,fe=2,de=2e3,pe=[{name:"default"},{name:"variant-results",finalText:o((e,n)=>`Variant smoke child report from ${e} (${n}).`,"finalText"),synthesizeText:"Variant smoke synthesis report."},{name:"unverified-success",status:o(()=>"completed_unverified","status"),finalText:o(e=>`Smoke result for ${e}: completed with verification warnings.`,"finalText"),synthesizeText:"Smoke synthesis: completed with verification warnings."},{name:"empty-args-rerun",args:o(()=>({}),"args")}],me=[{id:"import",pattern:/\bimport\s*(?:\(|['"*{]|\w+\s+from\b)/},{id:"require",pattern:/\brequire\s*\(/},{id:"process",pattern:/\bprocess\s*(?:\.|\[)/},{id:"fs",pattern:/\b(?:node:)?fs\b/},{id:"child_process",pattern:/\bchild_process\b/},{id:"shell",pattern:/\b(?:exec|spawn|execFile)\s*\(/},{id:"fetch",pattern:/\bfetch\s*\(/},{id:"Deno",pattern:/\bDeno\s*(?:\.|\[)/},{id:"Bun",pattern:/\bBun\s*(?:\.|\[)/},{id:"globalThis-index",pattern:/\bglobalThis\s*\[/}];function we(e=process.env,n){let t=v(n?.workflow?.generationTimeoutSec,"timeouts.workflow.generationTimeoutSec");if(t!==void 0)return t;let r=T(e[le]);if(r!==void 0)return r;let s=e[ce];if(s===void 0||s.trim().length===0)return G;let i=Number(s);return!Number.isFinite(i)||i<=0?G:Math.floor(i)}o(we,"resolveWorkflowGenerationTimeoutMs");function he(e,n){if(typeof e!="object"||e===null)throw new Error(`${n} must be an object`);return e}o(he,"readRecord");function K(e,n){let t=e[n];if(typeof t!="string"||t.trim().length===0)throw new Error(`workflow generation ${n} must be a non-empty string`);return t}o(K,"readNonEmptyString");function ge(e){let n=e.trim(),t=/^```(?:json)?\s*([\s\S]*?)\s*```$/i.exec(n);if(t?.[1])return t[1].trim();let r=n.indexOf("{"),s=n.lastIndexOf("}");if(r>=0&&s>r)return n.slice(r,s+1);throw new Error("workflow generation output did not contain a JSON object")}o(ge,"extractJsonText");function ke(e){let n=ge(e);return he(JSON.parse(n),"workflow generation output")}o(ke,"parseGenerationJson");function ye(e){if(typeof e=="string"){let t=e.trim();return t.length>0?t:void 0}if(typeof e!="object"||e===null)return;let n=e;for(let t of["name","id","title","phase"]){let r=n[t];if(typeof r=="string"&&r.trim().length>0)return r.trim()}}o(ye,"normalizePhaseEntry");function be(e){return e.split(/(?:->|\u2192|,|\n)/).map(n=>n.trim()).filter(n=>n.length>0)}o(be,"splitPhaseString");function xe(e){if(typeof e!="object"||e===null)return e;let n=e,t=n.phases,r;if(Array.isArray(t)){let s=t.map(ye);s.every(i=>i!==void 0)&&(r=s)}else if(typeof t=="string"){let s=be(t);s.length>0&&(r=s)}return r?{...n,phases:r}:e}o(xe,"normalizeGeneratedManifestCandidate");function ve(e){return e.match(/\bwf\.(?:runAgent|spawnAgent|synthesize)\s*\(/g)?.length??0}o(ve,"estimateDirectAgentCalls");function Se(e,n){let t=e.maxConcurrency*Math.max(1,e.phases.length)+2,r=ve(n)+2,s=Math.min(ue,Math.max(e.maxAgents,t,r));return s>e.maxAgents?{...e,maxAgents:s}:e}o(Se,"reserveGeneratedWorkflowAgentCapacity");function w(e){let n="",t=0,r=["code"],s=[0];for(;t<e.length;){let i=e[t],a=e[t+1];if(r[r.length-1]==="template"){if(i==="\\"){n+=" ",t+=2;continue}if(i==="`"){n+=" ",t+=1,r.pop(),s.pop();continue}if(i==="$"&&a==="{"){n+=" ",t+=2,r.push("code"),s.push(0);continue}n+=i===`
4
4
  `?`
5
5
  `:" ",t+=1;continue}if(i==="/"&&a==="/"){for(n+=" ",t+=2;t<e.length&&e[t]!==`