@kodax-ai/kodax 0.7.96-beta.8 → 0.7.96-rc.1

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 (86) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +28 -6
  3. package/README_CN.md +19 -4
  4. package/config-templates/config.example.jsonc +3 -2
  5. package/dist/chunks/{agent-XBT4ZUCG.js → agent-4SHG4ZF3.js} +1 -1
  6. package/dist/chunks/argument-completer-2PP5RVZL.js +2 -0
  7. package/dist/chunks/{chunk-57PKLDQI.js → chunk-3C6UWDAN.js} +1 -1
  8. package/dist/chunks/chunk-5RFHTNGM.js +350 -0
  9. package/dist/chunks/{chunk-DGMNCSI3.js → chunk-5TAC6EP7.js} +147 -147
  10. package/dist/chunks/{chunk-5KG5LAUO.js → chunk-5Z7OAIPW.js} +1 -1
  11. package/dist/chunks/{chunk-JBOJY7LE.js → chunk-6EFXA3RL.js} +3 -3
  12. package/dist/chunks/{chunk-YURCMKAL.js → chunk-74UJ5IFX.js} +1 -1
  13. package/dist/chunks/chunk-GYU7ISNL.js +2 -0
  14. package/dist/chunks/chunk-HHC4AHAR.js +384 -0
  15. package/dist/chunks/chunk-I3V25QH4.js +324 -0
  16. package/dist/chunks/{chunk-R6JRHSQR.js → chunk-K5FIHIGU.js} +1 -1
  17. package/dist/chunks/{chunk-FZUPRAHK.js → chunk-KVL2URPE.js} +1 -1
  18. package/dist/chunks/{chunk-ROSCR2VP.js → chunk-N7UOIQZ3.js} +10 -10
  19. package/dist/chunks/{chunk-Y6VGGIKD.js → chunk-NYKZ6Z2Q.js} +1 -1
  20. package/dist/chunks/{chunk-F7JMG426.js → chunk-P472TI5T.js} +115 -115
  21. package/dist/chunks/{chunk-HFTCGOBB.js → chunk-R5XC57MT.js} +217 -216
  22. package/dist/chunks/chunk-UCXJSGBP.js +2 -0
  23. package/dist/chunks/{chunk-WAKPBFEA.js → chunk-YDHLWJ2G.js} +6 -5
  24. package/dist/chunks/{chunk-KHPUDIG7.js → chunk-Z6QJ23NH.js} +205 -205
  25. package/dist/chunks/{client-GI3J32G4.js → client-GQJBBOLH.js} +1 -1
  26. package/dist/chunks/{compaction-config-BUDCDBHY.js → compaction-config-JLQU7GJH.js} +1 -1
  27. package/dist/chunks/{construction-bootstrap-JWUX7O3Z.js → construction-bootstrap-WRUX7JNC.js} +1 -1
  28. package/dist/chunks/dist-OMC2HWYN.js +2 -0
  29. package/dist/chunks/host-VEC4V223.js +2 -0
  30. package/dist/chunks/run-manager-5ASP2QKN.js +2 -0
  31. package/dist/chunks/{utils-VEOO7TBI.js → utils-MLWOBEIS.js} +1 -1
  32. package/dist/index.d.ts +10 -10
  33. package/dist/index.js +5 -5
  34. package/dist/kodax_bootstrap.js +1 -1
  35. package/dist/kodax_cli.js +1482 -1472
  36. package/dist/native/darwin-arm64/kodax-text-transaction.node +0 -0
  37. package/dist/native/darwin-arm64/manifest.json +2 -2
  38. package/dist/native/darwin-x64/kodax-text-transaction.node +0 -0
  39. package/dist/native/darwin-x64/manifest.json +2 -2
  40. package/dist/native/linux-arm64/kodax-text-transaction.node +0 -0
  41. package/dist/native/linux-arm64/manifest.json +2 -2
  42. package/dist/native/linux-x64/kodax-text-transaction.node +0 -0
  43. package/dist/native/linux-x64/manifest.json +2 -2
  44. package/dist/native/win32-x64/kodax-windows-sandbox.exe +0 -0
  45. package/dist/native/win32-x64/kodax-windows-text-transaction.node +0 -0
  46. package/dist/native/win32-x64/manifest.json +3 -3
  47. package/dist/runtime-worker.js +1327 -1317
  48. package/dist/sdk-a2a.d.ts +6 -6
  49. package/dist/sdk-a2a.js +1 -1
  50. package/dist/sdk-agent.d.ts +1 -1
  51. package/dist/sdk-agent.js +1 -1
  52. package/dist/sdk-coding.d.ts +62 -14
  53. package/dist/sdk-coding.js +1 -1
  54. package/dist/sdk-experimental-memory.js +1 -1
  55. package/dist/sdk-mcp.js +1 -1
  56. package/dist/sdk-repl.d.ts +14 -45
  57. package/dist/sdk-repl.js +1 -1
  58. package/dist/sdk-runtime.d.ts +31 -15
  59. package/dist/sdk-runtime.js +1 -1
  60. package/dist/sdk-sandbox.js +1 -1
  61. package/dist/sdk-session.d.ts +3 -3
  62. package/dist/sdk-session.js +1 -1
  63. package/dist/sdk-skills.js +1 -1
  64. package/dist/semantic-worker.js +21 -21
  65. package/dist/types-chunks/{bash-prefix-extractor.d-bWj6gAhF.d.ts → bash-prefix-extractor.d-BpkX_m32.d.ts} +53 -3
  66. package/dist/types-chunks/{exec-policy.d-Bxi_R0VE.d.ts → exec-policy.d-CUpkRfMQ.d.ts} +28 -5
  67. package/dist/types-chunks/{public-api.d-D9-qDqh8.d.ts → public-api.d-DOytsyVd.d.ts} +1 -1
  68. package/dist/types-chunks/{run-manager.d-CiWW5-OM.d.ts → run-manager.d-DXSYnIn3.d.ts} +3 -0
  69. package/dist/types-chunks/{sdk-session-DpYJAre-.d.ts → sdk-session-CMR2ywbU.d.ts} +1 -1
  70. package/dist/types-chunks/{shell-command-sets.d-Db8Zm42g.d.ts → shell-command-sets.d-DItZzPPU.d.ts} +1 -1
  71. package/dist/types-chunks/{trusted-repl-entry-BLBfln-c.d.ts → trusted-repl-entry-BV_H1O0K.d.ts} +38 -9
  72. package/dist/types-chunks/{types.d-BtpNflsM.d.ts → types.d-dg7QozSh.d.ts} +22 -6
  73. package/dist/types-chunks/{utils.d-BGPRMOUS.d.ts → utils.d-qUyeZgIo.d.ts} +7 -3
  74. package/package.json +3 -3
  75. package/public_docs/README.md +2 -2
  76. package/public_docs/configuration/permissions.md +59 -6
  77. package/public_docs/sdk/embedder-guide.md +117 -7
  78. package/dist/chunks/argument-completer-WF7FTTWB.js +0 -2
  79. package/dist/chunks/chunk-6ABV6WUL.js +0 -2
  80. package/dist/chunks/chunk-MO3TCAKM.js +0 -384
  81. package/dist/chunks/chunk-P4OGLGQF.js +0 -321
  82. package/dist/chunks/chunk-VNTIH7QD.js +0 -2
  83. package/dist/chunks/chunk-ZMXVACRD.js +0 -345
  84. package/dist/chunks/dist-7K3VYIPU.js +0 -2
  85. package/dist/chunks/host-CZG5BNSF.js +0 -2
  86. package/dist/chunks/run-manager-PIGUJW3L.js +0 -2
package/CHANGELOG.md CHANGED
@@ -8,6 +8,56 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  ---
10
10
 
11
+ ## [0.7.96-rc.1] - 2026-09-12
12
+
13
+ First release candidate of the v0.7.96 line: trusted text authority is
14
+ unified across Runtime Sessions and direct SDK entries, and provider requests
15
+ carry live permission facts. Every beta.9 contract is retained. npm
16
+ publication remains a manual maintainer action.
17
+
18
+ ### Fixed
19
+
20
+ - Unify trusted text authority across Runtime Sessions and direct SDK entries.
21
+ Full Access now reaches native text transactions through `runKodaX`,
22
+ `runManagedTask`, and each `KodaXClient.send`. Auto-approved concrete text
23
+ calls can write their exact external target, including portable `tool_call`
24
+ dispatch, without granting a directory or reusing approval across operations
25
+ or Runs. Explicit denials and native integrity checks remain enforced.
26
+ - Include live host permission facts in direct and managed provider requests,
27
+ including retries, independently of configuration defaults and prompt
28
+ overrides. Runtime permission capability 6 fences older daemon authority.
29
+
30
+ ---
31
+
32
+ ## [0.7.96-beta.9] - 2026-09-12
33
+
34
+ Ninth beta pre-release of the v0.7.96 line, carrying FEATURE_299 (unified
35
+ Stop, Full Access and extension execution contracts) plus a legacy-metadata
36
+ paging fix. Every beta.8 contract is retained. npm publication remains a
37
+ manual maintainer action.
38
+
39
+ ### Added
40
+
41
+ - FEATURE_299: unified Stop, Full Access and extension execution contracts.
42
+ Owned Run controls and atomic Session Stop work independently of file locks
43
+ across direct CLI, SDK, daemon, and ACP hosts with a single acceptance-versus-
44
+ confirmation Stop contract. Full Access executes directly on the host without
45
+ sandbox or approval prompts and without built-in dangerous-command fallbacks,
46
+ while explicit forbidden rules stay enforced and prompt rules are rejected
47
+ under Never approval semantics; `kodax execpolicy check --mode full-access`
48
+ inspects that profile without running it. Managed extensions gain an
49
+ execution contract with reload isolation, runtime/session separation, and
50
+ lock-independent effects.
51
+
52
+ ### Fixed
53
+
54
+ - Legacy large metadata no longer breaks Conversation continuation:
55
+ `readConversationPageAdmission` pages oversized `actorSnapshot` metadata
56
+ instead of misreading a >=64 KiB first line as `data_corrupt`, so
57
+ snapshot-backed pages continue across the previous failure boundary.
58
+
59
+ ---
60
+
11
61
  ## [0.7.96-beta.8] - 2026-09-11
12
62
 
13
63
  Eighth beta pre-release of the v0.7.96 line: an explicit, audited opt-in for
package/README.md CHANGED
@@ -784,6 +784,28 @@ provider's model, REPL `/compact` clears the UI only after a durable save, and
784
784
  successful reports carry bounded `summaryRequests` plus `commitMs` per
785
785
  physical summary call.
786
786
 
787
+ **v0.7.96-rc.1 release:** First release candidate of the v0.7.96 line.
788
+ Unifies trusted text authority across Runtime Sessions and direct SDK
789
+ entries: Full Access reaches native text transactions through `runKodaX`,
790
+ `runManagedTask`, and each `KodaXClient.send`; auto-approved concrete text
791
+ calls write their exact external target, including portable `tool_call`
792
+ dispatch, without granting a directory or reusing approval across operations
793
+ or Runs; explicit denials and native integrity checks remain enforced.
794
+ Direct and managed provider requests carry live host permission facts,
795
+ refreshed on retries, and runtime permission capability 6 fences older
796
+ daemon authority.
797
+
798
+ **v0.7.96-beta.9 release:** Ships FEATURE_299 — unified Stop, Full Access
799
+ and extension execution contracts. Owned Run controls and atomic Session
800
+ Stop work independently of file locks across direct CLI, SDK, daemon, and
801
+ ACP hosts under a single acceptance-versus-confirmation Stop contract.
802
+ Full Access executes directly on the host without sandbox, approval prompts,
803
+ or built-in dangerous-command fallbacks while explicit forbidden rules stay
804
+ enforced; `kodax execpolicy check --mode full-access` inspects that profile
805
+ without running it. Managed extensions gain an execution contract with
806
+ reload isolation, and legacy oversized `actorSnapshot` metadata pages
807
+ correctly instead of failing Conversation continuation.
808
+
787
809
  **v0.7.96-beta.8 release:** Adds `runtime.sessions.confirmIdentityAlias`
788
810
  for explicitly confirmed legacy interrupt identities: registration verifies
789
811
  the original delivery receipt and session revision, preserves an immutable
@@ -849,7 +871,7 @@ requests, preserves structured Child Agent Provider failures, honors exact
849
871
  run-scoped credential verification, and omits empty `tools` arrays for strict
850
872
  vLLM gateways (Issues 329-332). npm publication remains a
851
873
  manual maintainer action. See the
852
- [release checklist](docs/release.md#v0796-beta8-release-preparation).
874
+ [release checklist](docs/release.md#v0796-rc1-release-preparation).
853
875
 
854
876
  **v0.7.96-alpha.3 release:** Provider credentials are lazy, scoped,
855
877
  revocable capabilities (ADR-068). The v2 credential broker keeps Provider
@@ -1137,7 +1159,7 @@ Exec Policy and the Edits user decision or Auto[LLM] reviewer. Auto review has
1137
1159
  fixed 90/180-second attempt bounds and never falls back to Rules, Edits, or an
1138
1160
  automatic user prompt. Full Access samples the profile once per Bash call and
1139
1161
  runs directly on the host without sandbox or approval prompts. Explicit
1140
- forbidden rules and the Codex dangerous-command policy still block. Runtime permission prompts
1162
+ forbidden rules still block; built-in dangerous-command fallbacks do not apply. Runtime permission prompts
1141
1163
  offer opaque, exact
1142
1164
  allow-once/session/persistent grant suggestions; persistent grants are
1143
1165
  daemon-owned and revisioned. Host plan exit is exposed only when the host
@@ -1648,7 +1670,7 @@ KodaX provides 4 permission profiles:
1648
1670
  | `plan` | Read-only planning mode | All modification tools blocked |
1649
1671
  | `accept-edits` | Sandbox-first edits; user decides an exact host boundary | Host-boundary operations |
1650
1672
  | `auto` | Sandbox-first execution; LLM reviews an exact host boundary | No automatic prompt; denied calls return a safer-route reason |
1651
- | `full-access` | Direct host execution without sandbox or approval prompts | Never prompts; explicit forbidden/dangerous policy can block |
1673
+ | `full-access` | Direct host execution without sandbox or approval prompts | Explicit forbidden/prompt rules still block; no built-in dangerous-command fallback |
1652
1674
 
1653
1675
  ```bash
1654
1676
  # In REPL, use /mode command
@@ -1676,10 +1698,10 @@ KodaX provides 4 permission profiles:
1676
1698
  - Shift-Tab cycles `Plan -> Edits -> Auto[LLM] -> Full Access`; Shift+Enter
1677
1699
  inserts a newline. Legacy `auto-in-project` and Auto[RULES] state normalize
1678
1700
  to Auto[LLM] and are never persisted again.
1679
- - Full Access skips sandbox and all approval paths. Explicit forbidden rules
1680
- and the Codex dangerous-command policy remain enforced; an Exec Policy
1701
+ - Full Access skips sandbox, all approval paths, and built-in dangerous-command
1702
+ fallbacks. Explicit forbidden rules remain enforced; an Exec Policy
1681
1703
  `prompt` rule is rejected under Never approval semantics. Use
1682
- `kodax execpolicy check -- <command>` to inspect host policy without running it.
1704
+ `kodax execpolicy check --mode full-access -- <command>` to inspect that profile without running it.
1683
1705
  - Runtime-backed prompts can offer exact `allow once`, `allow this session`,
1684
1706
  and `always allow` choices. Return the Runtime-issued opaque suggestion;
1685
1707
  never derive or widen a permission rule from the displayed command or path.
package/README_CN.md CHANGED
@@ -296,6 +296,21 @@ SDK 系统代码契约更新,但没有放宽 shell/sandbox 的 fail-closed 边
296
296
  `handleRuntimePermissionRequest()` 管理 SDK 权限 UI,并在 prepared Session 尾部遇到
297
297
  `data_changed` 时通过权威 delta 合并恢复;后台持久化失败会显示为诊断,不再静默丢失。
298
298
 
299
+ **v0.7.96-rc.1 发布**:v0.7.96 线首个发布候选。统一 Runtime Session 与直接
300
+ SDK 入口的可信文本授权:Full Access 通过 `runKodaX`、`runManagedTask` 与每个
301
+ `KodaXClient.send` 覆盖原生文本事务;自动批准的具体文本调用可写入其确切外部
302
+ 目标(包括可移植的 `tool_call` 分发),但不授予目录权限,也不会跨操作或跨 Run
303
+ 复用批准;显式拒绝与原生完整性校验继续生效。直接与托管 provider 请求携带实时
304
+ 宿主权限事实并在重试时刷新,runtime 权限 capability 6 阻止旧 daemon 提供该授权。
305
+
306
+ **v0.7.96-beta.9 发布**:交付 FEATURE_299——统一 Stop、Full Access 与扩展
307
+ 执行契约。owned Run 控制与原子 Session Stop 不依赖文件锁,跨直接 CLI、SDK、
308
+ daemon 与 ACP 宿主在单一"受理 vs 确认"Stop 契约下工作。Full Access 直接在
309
+ 宿主执行,无沙箱、无审批提示、不套用内置危险命令回退,同时显式禁止规则
310
+ 仍然生效;`kodax execpolicy check --mode full-access` 可在不执行的情况下
311
+ 检查该 profile。托管扩展获得带重载隔离的执行契约;超大 legacy
312
+ `actorSnapshot` 元数据正确分页,不再中断 Conversation 续读。
313
+
299
314
  **v0.7.96-beta.8 发布**:新增 `runtime.sessions.confirmIdentityAlias`,
300
315
  用于显式确认的遗留中断标识:注册时验证原始投递回执与 session revision,
301
316
  保留不可变审计记录并拒绝竞争声明。别名跨保存、压缩、重启与分页生效;
@@ -361,8 +376,7 @@ native 文本权威改在摘要固定的 `manylinux_2_28` 构建器中编译,
361
376
  scope 在 SDK、Agent 摘要、CLI 与 Runtime Worker 请求间共享,保留结构化的 Child Agent Provider
362
377
  失败信息,精确遵循 run-scoped 凭据校验,并为严格 vLLM 网关省略空 `tools` 数组(Issues 329-332)。
363
378
  npm 发布仍由
364
- npm 发布仍由
365
- 维护者手动执行。详见 [v0.7.96-beta.8 发布清单](docs/release.md#v0796-beta8-release-preparation)。
379
+ 维护者手动执行。详见 [v0.7.96-rc.1 发布清单](docs/release.md#v0796-rc1-release-preparation)。
366
380
 
367
381
  **v0.7.96-alpha.3 发布**:Provider 凭据成为惰性、受限、可撤销的能力(ADR-068)。v2
368
382
  credential broker 将 Provider 密钥保留在 OS keychain,按每次 wire call、为单一封闭
@@ -559,8 +573,9 @@ CLI 也会在配置的 deadline 被终止。详见
559
573
  **v0.7.96 权限契约:**权限档位统一为 `Plan -> Edits -> Auto[LLM] -> Full Access`。
560
574
  Edits 与 Auto 先尝试 sandbox;成功即静默完成,只有启动前拒绝或 backend 不可用
561
575
  才在 Exec Policy 后进入用户/LLM 宿主边界。每次 Bash 调用只在入口读取一次权限档位;
562
- Full Access 直接在宿主执行,不经过 sandbox、reviewer 或授权弹窗。显式 forbidden 规则
563
- 与 Codex dangerous-command policy 仍可阻断,Exec Policy `prompt` 在 Never 语义下直接拒绝。
576
+ Full Access 直接在宿主执行,不经过 sandbox、reviewer 或授权弹窗,也不应用内置危险命令兜底。
577
+ 用户、管理员和受信项目的显式 forbidden 规则仍生效,Exec Policy `prompt` 在 Never 语义下直接拒绝。
578
+ 拒绝结果以 JSON 返回来源、规则和处理方式;模型不得将其误称为机器限制或改写脚本绕过。
564
579
  旧 `auto-in-project`
565
580
  和 Auto[RULES] 状态只做读取兼容并归一到 Auto[LLM];`/auto-engine` 已移除。
566
581
  Reviewer 首次 90 秒,只有 timeout/provider/无效输出会再试一次 180 秒;普通失败
@@ -39,8 +39,9 @@
39
39
  // Agent harness: "ama" enables adaptive multi-agent use; "sa" forces one
40
40
  // agent. Permission profiles are "plan", "accept-edits", sandbox-first
41
41
  // "auto", or direct-host "full-access". Full Access has no sandbox or
42
- // approval prompts; explicit forbidden and Codex dangerous-command policy
43
- // still block. Exec Policy is separate:
42
+ // approval prompts; built-in dangerous-command fallbacks do not apply.
43
+ // Explicit forbidden rules still block; explicit prompt rules cannot prompt.
44
+ // Exec Policy is separate:
44
45
  // ~/.kodax/exec-policy.jsonc (and explicitly trusted project policy).
45
46
  // "agentMode": "ama",
46
47
  // "permissionMode": "accept-edits",
@@ -1,2 +1,2 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{Aa as e,Ba as f,Ra as g,Ta as h,a as c,hb as i,ib as j,qb as k,za as d}from"./chunk-ZMXVACRD.js";import"./chunk-JA2DY4EC.js";import"./chunk-KHPUDIG7.js";import"./chunk-5KG5LAUO.js";import"./chunk-Y6VGGIKD.js";import{Ob as a,Pb as b}from"./chunk-F7JMG426.js";import"./chunk-WXBRPZMI.js";import"./chunk-V7ZTP5SV.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};
2
+ import{La as g,Na as h,a as c,ha as d,ia as e,ja as f,lb as i,mb as j,ub as k}from"./chunk-5RFHTNGM.js";import"./chunk-JA2DY4EC.js";import"./chunk-Z6QJ23NH.js";import"./chunk-5Z7OAIPW.js";import"./chunk-NYKZ6Z2Q.js";import{Ob as a,Pb as b}from"./chunk-P472TI5T.js";import"./chunk-WXBRPZMI.js";import"./chunk-V7ZTP5SV.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{Ma as a,Na as b}from"./chunk-R5XC57MT.js";import"./chunk-YDHLWJ2G.js";import"./chunk-74UJ5IFX.js";import"./chunk-5TAC6EP7.js";import"./chunk-KVL2URPE.js";import"./chunk-N7UOIQZ3.js";import"./chunk-5RFHTNGM.js";import"./chunk-JA2DY4EC.js";import"./chunk-Z6QJ23NH.js";import"./chunk-5Z7OAIPW.js";import"./chunk-NYKZ6Z2Q.js";import"./chunk-P472TI5T.js";import"./chunk-WXBRPZMI.js";import"./chunk-V7ZTP5SV.js";import"./chunk-ONUPGMER.js";export{a as ArgumentCompleter,b as createArgumentCompleter};
@@ -1,5 +1,5 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{a as hn,b as vn,c as De,d as xn,e as kn,f as En,g as cr,h as Rn,k as en,l as lr,m as ur,n as fr,o as nn,p as wr}from"./chunk-JBOJY7LE.js";import{Fc as dr,Ka as me,Ya as rr,_a as tr,ab as xe,bb as or,fb as Sn,hb as ke,kb as Oe,ob as ir,pb as sr,rb as ar,v as L}from"./chunk-F7JMG426.js";import{a}from"./chunk-ONUPGMER.js";import{spawn as qe,spawnSync as we}from"node:child_process";import{createHash as Xe,randomInt as jt,randomUUID as B}from"node:crypto";import{once as Ut}from"node:events";import{closeSync as Dn,constants as an,existsSync as qn,fsyncSync as Ft,lstatSync as ae,mkdirSync as qr,openSync as Xr,readFileSync as Ie,readSync as Vt,readdirSync as Jr,realpathSync as K,renameSync as Kt,rmSync as un,statSync as _e,writeFileSync as Hr,writeSync as qt}from"node:fs";import{copyFile as zr,lstat as Xt,mkdir as ne,readFile as Me,realpath as je,rm as H,stat as dn,writeFile as Ue}from"node:fs/promises";import{createRequire as Jt}from"node:module";import{createServer as Ht}from"node:net";import U from"node:os";import l from"node:path";import{lstatSync as vt,readFileSync as xt,readdirSync as pr,realpathSync as kt}from"node:fs";import C from"node:path";import{globSync as Et}from"glob";var Rt=[".ssh",".tsh",".brev",".gnupg",".aws",".azure",".kube",".docker",".config",".npm",".pki",".terraform.d"],At=new Set(["certificatefile","controlpath","globalknownhostsfile","identityagent","identityfile","revokedhostkeys","userknownhostsfile"]);function oe(e){try{return kt.native(e).toLowerCase()}catch(r){return["ENOENT","ENOTDIR"].includes(r.code??"")||L({source:"sandbox:ssh-config",level:"warn",message:`Cannot canonicalize SSH ACL path: ${e}`,detail:r}),C.resolve(e).toLowerCase()}}a(oe,"pathKey");function gr(e,r){return r===e||r.startsWith(e.endsWith(C.sep)?e:`${e}${C.sep}`)}a(gr,"inside");function Wt(e){let r=[],n="",t;for(let o=0;o<e.length;o+=1){let i=e[o];if(i==="#"&&t===void 0)break;if(i===t){t=void 0;continue}if((i==='"'||i==="'")&&t===void 0){t=i;continue}let s=e[o+1];i==="\\"&&s!==void 0&&(['"',"'","\\"].includes(s)||t===void 0&&s===" ")?(n+=s,o+=1):/\s/.test(i)&&t===void 0?(n&&r.push(n),n=""):n+=i}return n&&r.push(n),r}a(Wt,"sshWords");function Ct(e,r,n){if(e.toLowerCase()==="none")return;if(["~","%d","${HOME}"].includes(e))return r;let t=e.replace(/^(?:~|%d|\$\{HOME\})[/\\]/,`${r}${C.sep}`);return C.isAbsolute(t)?C.resolve(t):n===void 0?void 0:C.resolve(n,t)}a(Ct,"sshPath");function An(e,r,n,t,o=0){let i=oe(e);if(t.has(i))return;if(o>=32){L({source:"sandbox:ssh-config",level:"warn",message:`SSH Include depth limit reached; dependencies beyond this config were not inspected: ${e}`});return}t.add(i);let s;try{s=xt(e,"utf8")}catch(d){if(d.code==="ENOENT")return;L({source:"sandbox:ssh-config",level:"warn",message:`Cannot inspect SSH configuration dependencies: ${e}`,detail:d});return}for(let d of s.split(/\r?\n/)){let c=Wt(d.replace(/^(\s*[^\s=]+)\s*=\s*/,"$1 ")),u=c.shift()?.toLowerCase();if(u!==void 0)for(let f of c){let p=Ct(f,r,u==="include"?C.join(r,".ssh"):void 0);if(p!==void 0)if(u==="include")for(let g of Et(p.replace(/\\/g,"/"),{nodir:!0}))n.push(g),An(g,r,n,t,o+1);else At.has(u)&&n.push(p)}}}a(An,"visitSshConfig");function de(e){let r=[];An(C.join(e,".ssh","config"),e,r,new Set);let n=oe(e),t=Rt.map(o=>C.join(e,o));for(let o of r){let i=C.relative(n,oe(o));i&&!i.startsWith(`..${C.sep}`)&&i!==".."&&!C.isAbsolute(i)&&t.push(C.join(e,i.split(C.sep)[0]))}return[...new Set(t.map(o=>C.resolve(o)))]}a(de,"windowsSandboxAclExclusions");function mr(e){let r=[];An(C.join(e,".ssh","config"),e,r,new Set);let n=[C.join(e,".ssh")];for(;n.length>0;){let t=n.pop();r.push(t);let o;try{if(vt(t).isSymbolicLink())continue;o=pr(t,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")continue;throw i}for(let i of o){if(i.isSymbolicLink())continue;let s=C.join(t,i.name);r.push(s),i.isDirectory()&&n.push(s)}}return[...new Set(r.filter(t=>gr(oe(e),oe(t))))]}a(mr,"windowsSandboxSshCleanupRoots");function Ee(e,r,n){let t=oe(r),o=n.flatMap(s=>[C.resolve(s).toLowerCase(),oe(s)]),i=e.flatMap(s=>oe(s)===t?pr(r,{withFileTypes:!0}).filter(d=>!d.isSymbolicLink()).map(d=>C.join(r,d.name)):[s]);return[...new Set(i)].filter(s=>![C.resolve(s).toLowerCase(),oe(s)].some(c=>o.some(u=>gr(u,c))))}a(Ee,"windowsSandboxAclRoots");import{fileURLToPath as _r,pathToFileURL as Yr}from"node:url";import{realpathSync as Pt,statSync as Nt}from"node:fs";import _t from"node:path";function Wn(e){let r=e.code;return r==="ENOENT"||r==="ENOTDIR"}a(Wn,"isMissingGitTrustPath");function br(e,r,n){try{let t=r(e).replaceAll("\\","/").replace(/\/+$/,"");return t===""?void 0:/^[A-Za-z]:$/.test(t)?`${t}/`:t}catch(t){if(n(t))return;throw t}}a(br,"normalizeGitSafeDirectoryRootImplementation");function Tt(e){return br(e,Pt,Wn)}a(Tt,"normalizeGitSafeDirectoryRoot");function Sr(e,r,n,t){try{let i=r(n.join(e,".git"));if(i.isDirectory()||i.isFile())return!0}catch(i){if(!t(i))throw i}if(!(n.basename(e).toLowerCase()===".git"||/[/\\]\.git[/\\]modules[/\\]/i.test(e)))return!1;try{return r(n.join(e,"HEAD")).isFile()}catch(i){if(t(i))return!1;throw i}}a(Sr,"isRepoBearingGitReadRootImplementation");function It(e){return Sr(e,Nt,_t,Wn)}a(It,"isRepoBearingGitReadRoot");function hr(e,r,n,t,o){let i=[];typeof e=="string"&&e!==""&&i.push(e);for(let c of n??[])o(c)&&i.push(c);i.push(...r??[]);let s=[],d=new Set;for(let c of i){if(s.length>=8)break;let u=t(c);if(u===void 0)continue;let f=u.toLowerCase();d.has(f)||(d.add(f),s.push(u))}return s}a(hr,"windowsGitTrustRootsImplementation");function vr(e,r,n){return hr(e,r,n,Tt,It)}a(vr,"windowsGitTrustRoots");function xr(e){if(e==="git_config_count")return"count";if(/^git_config_key_\d+$/.test(e))return"key";if(/^git_config_value_\d+$/.test(e))return"value"}a(xr,"gitConfigEnvKind");function Ot(e,r,n,t,o){let i=new Map,s=[],d,c=!1;for(let u=0;u<r;u+=1){if(e[u]!=="--env"||u+1>=r)continue;let f=e[u+1],p=f.indexOf("="),g=(p<0?f:f.slice(0,p)).toLowerCase(),w=n(g);if(w===void 0)continue;c=!0,s.push(u);let m=p<0?"":f.slice(p+1);if(w==="count"){let W=Number.parseInt(m,10);(d!==void 0||!Number.isSafeInteger(W)||W<0||String(W)!==m)&&t(),d=W;continue}let S=Number.parseInt(g.slice(`git_config_${w}_`.length),10),h=i.get(S)??{};(!Number.isSafeInteger(S)||S<0||h[w]!==void 0)&&t(),h[w]=m,i.set(S,h)}return o(i,s,d,c,t)}a(Ot,"parseGitConfigEnvironmentImplementation");function rn(){throw new Error("ASRT GIT_CONFIG environment has an unexpected shape.")}a(rn,"throwUnexpectedGitConfigShape");function kr(e,r,n,t,o){!t||n!==void 0&&e.size===n&&[...e].every(([d,c])=>d<n&&c.key!==void 0&&c.value!==void 0)||o();let s=[...e].map(([d,c])=>({slot:d,key:c.key,value:c.value}));return{argumentIndices:r,pairs:s,sawAny:t}}a(kr,"finishParsedGitConfigEnvironment");function Er(e,r){let n=[];for(let o of e)n.push({key:"safe.directory",value:o},{key:"safe.directory",value:`${o}/*`});n.push(...r);let t=n.flatMap((o,i)=>[`GIT_CONFIG_KEY_${i}=${o.key}`,`GIT_CONFIG_VALUE_${i}=${o.value}`]);return t.push(`GIT_CONFIG_COUNT=${n.length}`),t}a(Er,"gitSafeDirectoryAssignments");function yr(e,r){let n=[],t=new Set;for(let[o,i]of Object.entries(e)){if(i===void 0)continue;if(o===""||o.includes("=")||o.includes("\0")||i.includes("\0"))throw new Error(`Invalid ${r} environment entry.`);let s=o.toUpperCase();if(t.has(s))throw new Error(`Ambiguous ${r} environment variable: ${o}.`);t.add(s),n.push([o,i])}return n}a(yr,"validatedEnvironmentEntries");function Dt(e,r){let n=new Map,t=[],o,i=!1;for(let[u,f]of Object.entries(e)){let p=u.toLowerCase(),g=xr(p);if(g===void 0){t.push([u,f]);continue}if(i=!0,g==="count"){let S=Number.parseInt(f,10);(o!==void 0||!Number.isSafeInteger(S)||S<0||String(S)!==f)&&rn(),o=S;continue}let w=Number.parseInt(p.slice(`git_config_${g}_`.length),10),m=n.get(w)??{};(!Number.isSafeInteger(w)||w<0||m[g]!==void 0)&&rn(),m[g]=f,n.set(w,m)}let d=kr(n,[],o,i,rn).pairs.filter(u=>u.key.toLowerCase()!=="safe.directory").sort((u,f)=>u.slot-f.slot),c=Object.fromEntries(t);for(let u of Er(r,d)){let f=u.indexOf("=");c[u.slice(0,f)]=u.slice(f+1)}return c}a(Dt,"rewriteWindowsGitSafeDirectoryEnvironment");function Rr(e,r,n){let t=yr(e,"ASRT-controlled"),o=yr(r,"Windows target"),i=new Map;for(let s of t)i.set(s[0].toUpperCase(),s);for(let s of o){let d=s[0].toUpperCase();i.has(d)&&d!=="PATH"&&d!=="PATHEXT"||i.set(d,s)}return Dt(Object.fromEntries(i.values()),n)}a(Rr,"mergeWindowsSandboxTargetEnvironment");function Lt(e,r,n,t){let o=new Set(n.argumentIndices),i=[],s=!1;for(let d=0;d<e.length;d+=1)if(o.has(d)){if(!s){for(let c of t)i.push("--env",c);s=!0}d+=1}else i.push(e[d]);return n.sawAny||i.splice(r,0,...t.flatMap(d=>["--env",d])),i}a(Lt,"replaceGitConfigEnvironment");function Bt(e,r,n,t,o){let i=e.lastIndexOf("--");if(i<0)throw new Error("ASRT Windows wrapper omitted its child separator.");let s=n(e,i),d=s.pairs.filter(u=>u.key.toLowerCase()!=="safe.directory").sort((u,f)=>u.slot-f.slot),c=t(r,d);return o(e,i,s,c)}a(Bt,"rewriteWindowsGitSafeDirectoryArgvImplementation");function Ar(){return String.raw`
2
+ import{a as hn,b as vn,c as De,d as xn,e as kn,f as En,g as cr,h as Rn,k as en,l as lr,m as ur,n as fr,o as nn,p as wr}from"./chunk-6EFXA3RL.js";import{Fc as dr,Ka as me,Ya as rr,_a as tr,ab as xe,bb as or,fb as Sn,hb as ke,kb as Oe,ob as ir,pb as sr,rb as ar,v as L}from"./chunk-P472TI5T.js";import{a}from"./chunk-ONUPGMER.js";import{spawn as qe,spawnSync as we}from"node:child_process";import{createHash as Xe,randomInt as jt,randomUUID as B}from"node:crypto";import{once as Ut}from"node:events";import{closeSync as Dn,constants as an,existsSync as qn,fsyncSync as Ft,lstatSync as ae,mkdirSync as qr,openSync as Xr,readFileSync as Ie,readSync as Vt,readdirSync as Jr,realpathSync as K,renameSync as Kt,rmSync as un,statSync as _e,writeFileSync as Hr,writeSync as qt}from"node:fs";import{copyFile as zr,lstat as Xt,mkdir as ne,readFile as Me,realpath as je,rm as H,stat as dn,writeFile as Ue}from"node:fs/promises";import{createRequire as Jt}from"node:module";import{createServer as Ht}from"node:net";import U from"node:os";import l from"node:path";import{lstatSync as vt,readFileSync as xt,readdirSync as pr,realpathSync as kt}from"node:fs";import C from"node:path";import{globSync as Et}from"glob";var Rt=[".ssh",".tsh",".brev",".gnupg",".aws",".azure",".kube",".docker",".config",".npm",".pki",".terraform.d"],At=new Set(["certificatefile","controlpath","globalknownhostsfile","identityagent","identityfile","revokedhostkeys","userknownhostsfile"]);function oe(e){try{return kt.native(e).toLowerCase()}catch(r){return["ENOENT","ENOTDIR"].includes(r.code??"")||L({source:"sandbox:ssh-config",level:"warn",message:`Cannot canonicalize SSH ACL path: ${e}`,detail:r}),C.resolve(e).toLowerCase()}}a(oe,"pathKey");function gr(e,r){return r===e||r.startsWith(e.endsWith(C.sep)?e:`${e}${C.sep}`)}a(gr,"inside");function Wt(e){let r=[],n="",t;for(let o=0;o<e.length;o+=1){let i=e[o];if(i==="#"&&t===void 0)break;if(i===t){t=void 0;continue}if((i==='"'||i==="'")&&t===void 0){t=i;continue}let s=e[o+1];i==="\\"&&s!==void 0&&(['"',"'","\\"].includes(s)||t===void 0&&s===" ")?(n+=s,o+=1):/\s/.test(i)&&t===void 0?(n&&r.push(n),n=""):n+=i}return n&&r.push(n),r}a(Wt,"sshWords");function Ct(e,r,n){if(e.toLowerCase()==="none")return;if(["~","%d","${HOME}"].includes(e))return r;let t=e.replace(/^(?:~|%d|\$\{HOME\})[/\\]/,`${r}${C.sep}`);return C.isAbsolute(t)?C.resolve(t):n===void 0?void 0:C.resolve(n,t)}a(Ct,"sshPath");function An(e,r,n,t,o=0){let i=oe(e);if(t.has(i))return;if(o>=32){L({source:"sandbox:ssh-config",level:"warn",message:`SSH Include depth limit reached; dependencies beyond this config were not inspected: ${e}`});return}t.add(i);let s;try{s=xt(e,"utf8")}catch(d){if(d.code==="ENOENT")return;L({source:"sandbox:ssh-config",level:"warn",message:`Cannot inspect SSH configuration dependencies: ${e}`,detail:d});return}for(let d of s.split(/\r?\n/)){let c=Wt(d.replace(/^(\s*[^\s=]+)\s*=\s*/,"$1 ")),u=c.shift()?.toLowerCase();if(u!==void 0)for(let f of c){let p=Ct(f,r,u==="include"?C.join(r,".ssh"):void 0);if(p!==void 0)if(u==="include")for(let g of Et(p.replace(/\\/g,"/"),{nodir:!0}))n.push(g),An(g,r,n,t,o+1);else At.has(u)&&n.push(p)}}}a(An,"visitSshConfig");function de(e){let r=[];An(C.join(e,".ssh","config"),e,r,new Set);let n=oe(e),t=Rt.map(o=>C.join(e,o));for(let o of r){let i=C.relative(n,oe(o));i&&!i.startsWith(`..${C.sep}`)&&i!==".."&&!C.isAbsolute(i)&&t.push(C.join(e,i.split(C.sep)[0]))}return[...new Set(t.map(o=>C.resolve(o)))]}a(de,"windowsSandboxAclExclusions");function mr(e){let r=[];An(C.join(e,".ssh","config"),e,r,new Set);let n=[C.join(e,".ssh")];for(;n.length>0;){let t=n.pop();r.push(t);let o;try{if(vt(t).isSymbolicLink())continue;o=pr(t,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")continue;throw i}for(let i of o){if(i.isSymbolicLink())continue;let s=C.join(t,i.name);r.push(s),i.isDirectory()&&n.push(s)}}return[...new Set(r.filter(t=>gr(oe(e),oe(t))))]}a(mr,"windowsSandboxSshCleanupRoots");function Ee(e,r,n){let t=oe(r),o=n.flatMap(s=>[C.resolve(s).toLowerCase(),oe(s)]),i=e.flatMap(s=>oe(s)===t?pr(r,{withFileTypes:!0}).filter(d=>!d.isSymbolicLink()).map(d=>C.join(r,d.name)):[s]);return[...new Set(i)].filter(s=>![C.resolve(s).toLowerCase(),oe(s)].some(c=>o.some(u=>gr(u,c))))}a(Ee,"windowsSandboxAclRoots");import{fileURLToPath as _r,pathToFileURL as Yr}from"node:url";import{realpathSync as Pt,statSync as Nt}from"node:fs";import _t from"node:path";function Wn(e){let r=e.code;return r==="ENOENT"||r==="ENOTDIR"}a(Wn,"isMissingGitTrustPath");function br(e,r,n){try{let t=r(e).replaceAll("\\","/").replace(/\/+$/,"");return t===""?void 0:/^[A-Za-z]:$/.test(t)?`${t}/`:t}catch(t){if(n(t))return;throw t}}a(br,"normalizeGitSafeDirectoryRootImplementation");function Tt(e){return br(e,Pt,Wn)}a(Tt,"normalizeGitSafeDirectoryRoot");function Sr(e,r,n,t){try{let i=r(n.join(e,".git"));if(i.isDirectory()||i.isFile())return!0}catch(i){if(!t(i))throw i}if(!(n.basename(e).toLowerCase()===".git"||/[/\\]\.git[/\\]modules[/\\]/i.test(e)))return!1;try{return r(n.join(e,"HEAD")).isFile()}catch(i){if(t(i))return!1;throw i}}a(Sr,"isRepoBearingGitReadRootImplementation");function It(e){return Sr(e,Nt,_t,Wn)}a(It,"isRepoBearingGitReadRoot");function hr(e,r,n,t,o){let i=[];typeof e=="string"&&e!==""&&i.push(e);for(let c of n??[])o(c)&&i.push(c);i.push(...r??[]);let s=[],d=new Set;for(let c of i){if(s.length>=8)break;let u=t(c);if(u===void 0)continue;let f=u.toLowerCase();d.has(f)||(d.add(f),s.push(u))}return s}a(hr,"windowsGitTrustRootsImplementation");function vr(e,r,n){return hr(e,r,n,Tt,It)}a(vr,"windowsGitTrustRoots");function xr(e){if(e==="git_config_count")return"count";if(/^git_config_key_\d+$/.test(e))return"key";if(/^git_config_value_\d+$/.test(e))return"value"}a(xr,"gitConfigEnvKind");function Ot(e,r,n,t,o){let i=new Map,s=[],d,c=!1;for(let u=0;u<r;u+=1){if(e[u]!=="--env"||u+1>=r)continue;let f=e[u+1],p=f.indexOf("="),g=(p<0?f:f.slice(0,p)).toLowerCase(),w=n(g);if(w===void 0)continue;c=!0,s.push(u);let m=p<0?"":f.slice(p+1);if(w==="count"){let W=Number.parseInt(m,10);(d!==void 0||!Number.isSafeInteger(W)||W<0||String(W)!==m)&&t(),d=W;continue}let S=Number.parseInt(g.slice(`git_config_${w}_`.length),10),h=i.get(S)??{};(!Number.isSafeInteger(S)||S<0||h[w]!==void 0)&&t(),h[w]=m,i.set(S,h)}return o(i,s,d,c,t)}a(Ot,"parseGitConfigEnvironmentImplementation");function rn(){throw new Error("ASRT GIT_CONFIG environment has an unexpected shape.")}a(rn,"throwUnexpectedGitConfigShape");function kr(e,r,n,t,o){!t||n!==void 0&&e.size===n&&[...e].every(([d,c])=>d<n&&c.key!==void 0&&c.value!==void 0)||o();let s=[...e].map(([d,c])=>({slot:d,key:c.key,value:c.value}));return{argumentIndices:r,pairs:s,sawAny:t}}a(kr,"finishParsedGitConfigEnvironment");function Er(e,r){let n=[];for(let o of e)n.push({key:"safe.directory",value:o},{key:"safe.directory",value:`${o}/*`});n.push(...r);let t=n.flatMap((o,i)=>[`GIT_CONFIG_KEY_${i}=${o.key}`,`GIT_CONFIG_VALUE_${i}=${o.value}`]);return t.push(`GIT_CONFIG_COUNT=${n.length}`),t}a(Er,"gitSafeDirectoryAssignments");function yr(e,r){let n=[],t=new Set;for(let[o,i]of Object.entries(e)){if(i===void 0)continue;if(o===""||o.includes("=")||o.includes("\0")||i.includes("\0"))throw new Error(`Invalid ${r} environment entry.`);let s=o.toUpperCase();if(t.has(s))throw new Error(`Ambiguous ${r} environment variable: ${o}.`);t.add(s),n.push([o,i])}return n}a(yr,"validatedEnvironmentEntries");function Dt(e,r){let n=new Map,t=[],o,i=!1;for(let[u,f]of Object.entries(e)){let p=u.toLowerCase(),g=xr(p);if(g===void 0){t.push([u,f]);continue}if(i=!0,g==="count"){let S=Number.parseInt(f,10);(o!==void 0||!Number.isSafeInteger(S)||S<0||String(S)!==f)&&rn(),o=S;continue}let w=Number.parseInt(p.slice(`git_config_${g}_`.length),10),m=n.get(w)??{};(!Number.isSafeInteger(w)||w<0||m[g]!==void 0)&&rn(),m[g]=f,n.set(w,m)}let d=kr(n,[],o,i,rn).pairs.filter(u=>u.key.toLowerCase()!=="safe.directory").sort((u,f)=>u.slot-f.slot),c=Object.fromEntries(t);for(let u of Er(r,d)){let f=u.indexOf("=");c[u.slice(0,f)]=u.slice(f+1)}return c}a(Dt,"rewriteWindowsGitSafeDirectoryEnvironment");function Rr(e,r,n){let t=yr(e,"ASRT-controlled"),o=yr(r,"Windows target"),i=new Map;for(let s of t)i.set(s[0].toUpperCase(),s);for(let s of o){let d=s[0].toUpperCase();i.has(d)&&d!=="PATH"&&d!=="PATHEXT"||i.set(d,s)}return Dt(Object.fromEntries(i.values()),n)}a(Rr,"mergeWindowsSandboxTargetEnvironment");function Lt(e,r,n,t){let o=new Set(n.argumentIndices),i=[],s=!1;for(let d=0;d<e.length;d+=1)if(o.has(d)){if(!s){for(let c of t)i.push("--env",c);s=!0}d+=1}else i.push(e[d]);return n.sawAny||i.splice(r,0,...t.flatMap(d=>["--env",d])),i}a(Lt,"replaceGitConfigEnvironment");function Bt(e,r,n,t,o){let i=e.lastIndexOf("--");if(i<0)throw new Error("ASRT Windows wrapper omitted its child separator.");let s=n(e,i),d=s.pairs.filter(u=>u.key.toLowerCase()!=="safe.directory").sort((u,f)=>u.slot-f.slot),c=t(r,d);return o(e,i,s,c)}a(Bt,"rewriteWindowsGitSafeDirectoryArgvImplementation");function Ar(){return String.raw`
3
3
  const isMissingGitTrustPath = ${Wn.toString()};
4
4
  const normalizeGitSafeDirectoryRootImplementation = ${br.toString()};
5
5
  const normalizeGitSafeDirectoryRoot = (root) => (