dal-code 1.0.44 → 1.0.45

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 (426) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/NOTICE +17 -0
  3. package/PRIVACY.md +159 -102
  4. package/dal-docs/README.md +1 -1
  5. package/dal-docs/keybindings.md +1 -0
  6. package/dal-docs/settings.md +5 -0
  7. package/dist/cli/credential-print.js +1 -1
  8. package/dist/config.d.ts +1 -0
  9. package/dist/config.js +1 -1
  10. package/dist/core/agent-session-runtime.js +1 -1
  11. package/dist/core/agent-session.d.ts +1 -1
  12. package/dist/core/agent-session.js +5 -5
  13. package/dist/core/auth-storage.js +1 -1
  14. package/dist/core/background-processes.js +7 -7
  15. package/dist/core/export-html/template.js +34 -34
  16. package/dist/core/extensions/runner.js +1 -1
  17. package/dist/core/extensions/types.d.ts +5 -1
  18. package/dist/core/key-id-schema.js +1 -0
  19. package/dist/core/keybindings-schema.js +1 -0
  20. package/dist/core/keybindings.d.ts +5 -0
  21. package/dist/core/keybindings.js +1 -1
  22. package/dist/core/model-config.d.ts +818 -99
  23. package/dist/core/model-config.js +5 -5
  24. package/dist/core/model-resolver.d.ts +30 -10
  25. package/dist/core/model-resolver.js +1 -1
  26. package/dist/core/model-runtime.d.ts +1 -0
  27. package/dist/core/model-runtime.js +2 -2
  28. package/dist/core/package-manager.d.ts +5 -0
  29. package/dist/core/package-manager.js +2 -2
  30. package/dist/core/permissions/shell-words.d.ts +26 -0
  31. package/dist/core/project-trust.js +2 -2
  32. package/dist/core/prompt-templates.js +2 -2
  33. package/dist/core/remote-catalog-provider.js +1 -1
  34. package/dist/core/resource-loader.js +1 -1
  35. package/dist/core/sandbox/libreoffice.js +1 -0
  36. package/dist/core/sandbox/runtime.d.ts +1 -0
  37. package/dist/core/sandbox/runtime.js +1 -1
  38. package/dist/core/sandbox/shell-sandbox.js +6 -6
  39. package/dist/core/sandbox/windows.js +4 -4
  40. package/dist/core/session-manager.d.ts +1 -0
  41. package/dist/core/session-manager.js +12 -12
  42. package/dist/core/settings-defaults.js +1 -0
  43. package/dist/core/settings-manager.d.ts +5 -0
  44. package/dist/core/settings-manager.js +1 -1
  45. package/dist/core/settings-schema.d.ts +229 -0
  46. package/dist/core/settings-schema.js +1 -0
  47. package/dist/core/tools/bash-read-only.d.ts +1 -0
  48. package/dist/core/tools/read.js +12 -12
  49. package/dist/core/tools/render-utils.d.ts +40 -0
  50. package/dist/core/tools/render-utils.js +7 -7
  51. package/dist/core/tools/renderers/read.js +8 -8
  52. package/dist/core/trust-manager.js +1 -1
  53. package/dist/core/workspace-lock.d.ts +6 -2
  54. package/dist/core/workspace-lock.js +3 -3
  55. package/dist/dal/extension-compat.js +4 -4
  56. package/dist/dal/hooks/config.d.ts +5 -1
  57. package/dist/dal/hooks/config.js +1 -1
  58. package/dist/dal/hooks/extension.js +3 -3
  59. package/dist/dal/hooks/index.d.ts +1 -1
  60. package/dist/dal/hooks/index.js +1 -1
  61. package/dist/dal/i18n.js +1 -1
  62. package/dist/dal/manifest.js +1 -1
  63. package/dist/extensions/codemode/execute.js +14 -13
  64. package/dist/extensions/codemode/index.js +1 -1
  65. package/dist/extensions/codemode/renderer.js +6 -6
  66. package/dist/extensions/codemode/tool.d.ts +2 -3
  67. package/dist/extensions/codemode/tool.js +9 -12
  68. package/dist/extensions/mcp/cli.js +4 -4
  69. package/dist/extensions/mcp/index.js +12 -12
  70. package/dist/extensions/mcp/resources.d.ts +0 -5
  71. package/dist/extensions/mcp/resources.js +1 -1
  72. package/dist/extensions/mcp/runtime.d.ts +1 -4
  73. package/dist/extensions/mcp/runtime.js +3 -3
  74. package/dist/extensions/mcp/tools.js +7 -7
  75. package/dist/extensions/tool-search/tool.js +3 -3
  76. package/dist/index.d.ts +5 -2
  77. package/dist/index.js +1 -1
  78. package/dist/main.js +3 -3
  79. package/dist/migrations.js +5 -5
  80. package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  81. package/dist/modes/interactive/components/settings-selector.js +1 -1
  82. package/dist/modes/interactive/components/status-indicator.d.ts +1 -1
  83. package/dist/modes/interactive/components/status-indicator.js +1 -1
  84. package/dist/modes/interactive/components/tree-selector.js +1 -1
  85. package/dist/modes/interactive/interactive-mode.js +17 -17
  86. package/dist/modes/interactive/session-share.js +2 -2
  87. package/dist/modes/interactive/theme/dark.json +1 -1
  88. package/dist/modes/interactive/theme/light.json +1 -1
  89. package/dist/modes/interactive/theme/theme-schema.d.ts +18 -0
  90. package/dist/modes/interactive/theme/theme-schema.js +12 -0
  91. package/dist/modes/interactive/theme/theme-tokens.d.ts +255 -0
  92. package/dist/modes/interactive/theme/theme-tokens.js +1 -0
  93. package/dist/modes/interactive/theme/theme.d.ts +7 -10
  94. package/dist/modes/interactive/theme/theme.js +5 -5
  95. package/dist/modes/rpc/rpc-client.d.ts +5 -1
  96. package/dist/modes/rpc/rpc-client.js +2 -2
  97. package/dist/modes/rpc/rpc-mode.js +1 -1
  98. package/dist/modes/rpc/rpc-types.d.ts +20 -0
  99. package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
  100. package/dist/node_modules/@dalcode/dal-advisor/src/index.js +8 -8
  101. package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
  102. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  103. package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
  104. package/dist/node_modules/@dalcode/dal-capabilities/src/index.js +10 -10
  105. package/dist/node_modules/@dalcode/dal-codeindex/package.json +34 -0
  106. package/dist/node_modules/@dalcode/dal-codeindex/src/extract.js +3 -0
  107. package/dist/node_modules/@dalcode/dal-codeindex/src/format.js +11 -0
  108. package/dist/node_modules/@dalcode/dal-codeindex/src/index.js +4 -0
  109. package/dist/node_modules/@dalcode/dal-codeindex/src/indexer.js +1 -0
  110. package/dist/node_modules/@dalcode/dal-codeindex/src/languages.js +176 -0
  111. package/dist/node_modules/@dalcode/dal-codeindex/src/project.js +1 -0
  112. package/dist/node_modules/@dalcode/dal-codeindex/src/query.js +2 -0
  113. package/dist/node_modules/@dalcode/dal-codeindex/src/runtime.js +1 -0
  114. package/dist/node_modules/@dalcode/dal-codeindex/src/scan.js +1 -0
  115. package/dist/node_modules/@dalcode/dal-codeindex/src/semantic.js +2 -0
  116. package/dist/node_modules/@dalcode/dal-codeindex/src/sqlite.js +1 -0
  117. package/dist/node_modules/@dalcode/dal-codeindex/src/store.js +33 -0
  118. package/dist/node_modules/@dalcode/dal-codeindex/src/worker.js +1 -0
  119. package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
  120. package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
  121. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  122. package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
  123. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  124. package/dist/node_modules/@dalcode/dal-guard/src/index.js +4 -2
  125. package/dist/node_modules/@dalcode/dal-guard/src/mode.js +2 -2
  126. package/dist/node_modules/@dalcode/dal-guard/src/policy.js +1 -0
  127. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  128. package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
  129. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  130. package/dist/node_modules/@dalcode/dal-learn/package.json +2 -2
  131. package/dist/node_modules/@dalcode/dal-lsp/package.json +3 -3
  132. package/dist/node_modules/@dalcode/dal-lsp/src/index.js +12 -10
  133. package/dist/node_modules/@dalcode/dal-mcp/package.json +7 -5
  134. package/dist/node_modules/@dalcode/dal-mcp/src/http-client.d.ts +9 -27
  135. package/dist/node_modules/@dalcode/dal-mcp/src/http-client.js +1 -2
  136. package/dist/node_modules/@dalcode/dal-mcp/src/index.js +17 -17
  137. package/dist/node_modules/@dalcode/dal-mcp/src/protocol-client.d.ts +38 -0
  138. package/dist/node_modules/@dalcode/dal-mcp/src/protocol-client.js +1 -0
  139. package/dist/node_modules/@dalcode/dal-mcp/src/proxy.js +6 -6
  140. package/dist/node_modules/@dalcode/dal-mcp/src/resources.js +1 -0
  141. package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.d.ts +9 -18
  142. package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.js +4 -5
  143. package/dist/node_modules/@dalcode/dal-mcp/src/types.d.ts +50 -5
  144. package/dist/node_modules/@dalcode/dal-mcp/src/types.js +1 -1
  145. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  146. package/dist/node_modules/@dalcode/dal-office/src/index.d.ts +2 -2
  147. package/dist/node_modules/@dalcode/dal-office/src/index.js +1 -1
  148. package/dist/node_modules/@dalcode/dal-office/src/render/docx.js +1 -1
  149. package/dist/node_modules/@dalcode/dal-office/src/render/pptx.d.ts +8 -0
  150. package/dist/node_modules/@dalcode/dal-office/src/render/pptx.js +3 -3
  151. package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.js +1 -1
  152. package/dist/node_modules/@dalcode/dal-office/src/themes.d.ts +2 -0
  153. package/dist/node_modules/@dalcode/dal-office/src/themes.js +1 -1
  154. package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-generate.js +3 -2
  155. package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-plan.js +2 -2
  156. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +9 -3
  157. package/dist/node_modules/@dalcode/dal-pi-kit/dist/index.js +1 -1
  158. package/dist/node_modules/@dalcode/dal-pi-kit/dist/session-scope.js +1 -0
  159. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  160. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +9 -3
  161. package/dist/node_modules/@dalcode/dal-pi-kit/src/index.js +1 -1
  162. package/dist/node_modules/@dalcode/dal-pi-kit/src/session-scope.js +1 -0
  163. package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
  164. package/dist/node_modules/@dalcode/dal-plugins/src/brand.js +1 -1
  165. package/dist/node_modules/@dalcode/dal-plugins/src/index.js +11 -11
  166. package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
  167. package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
  168. package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
  169. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  170. package/dist/node_modules/@dalcode/dal-rewind/src/core.d.ts +0 -1
  171. package/dist/node_modules/@dalcode/dal-rewind/src/core.js +8 -8
  172. package/dist/node_modules/@dalcode/dal-rewind/src/index.js +1 -1
  173. package/dist/node_modules/@dalcode/dal-router/package.json +9 -5
  174. package/dist/node_modules/@dalcode/dal-router/src/advisor.js +1 -1
  175. package/dist/node_modules/@dalcode/dal-router/src/commands.js +8 -7
  176. package/dist/node_modules/@dalcode/dal-router/src/config.d.ts +11 -0
  177. package/dist/node_modules/@dalcode/dal-router/src/config.js +2 -2
  178. package/dist/node_modules/@dalcode/dal-router/src/index.js +4 -4
  179. package/dist/node_modules/@dalcode/dal-router/src/roles/changes.js +5 -0
  180. package/dist/node_modules/@dalcode/dal-router/src/roles/index.js +13 -0
  181. package/dist/node_modules/@dalcode/dal-router/src/roles/models.d.ts +50 -0
  182. package/dist/node_modules/@dalcode/dal-router/src/roles/models.js +1 -0
  183. package/dist/node_modules/@dalcode/dal-router/src/roles/prompts.js +40 -0
  184. package/dist/node_modules/@dalcode/dal-router/src/roles/signals.js +2 -0
  185. package/dist/node_modules/@dalcode/dal-router/src/runtime.d.ts +3 -0
  186. package/dist/node_modules/@dalcode/dal-router/src/runtime.js +1 -1
  187. package/dist/node_modules/@dalcode/dal-router/src/subagent.js +1 -1
  188. package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
  189. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  190. package/dist/node_modules/@dalcode/dal-skills/src/bundled/dal-slides/SKILL.md +74 -0
  191. package/dist/node_modules/@dalcode/dal-skills/src/bundled.js +1 -1
  192. package/dist/node_modules/@dalcode/dal-skills/src/client.js +1 -1
  193. package/dist/node_modules/@dalcode/dal-skills/src/index.js +14 -14
  194. package/dist/node_modules/@dalcode/dal-skills/src/packages.js +3 -3
  195. package/dist/node_modules/@dalcode/dal-skills/src/search.js +1 -1
  196. package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
  197. package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
  198. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  199. package/dist/node_modules/@dalcode/dal-telemetry/package.json +3 -3
  200. package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
  201. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  202. package/dist/node_modules/@dalcode/dal-tool-catalog/src/index.js +4 -4
  203. package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
  204. package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
  205. package/dist/node_modules/@dalcode/dal-workflow/LICENSE +27 -0
  206. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  207. package/dist/node_modules/@dalcode/dal-workflow/src/index.js +4 -4
  208. package/dist/node_modules/@dalcode/dal-workflow/src/plan-mode.js +13 -13
  209. package/dist/node_modules/@dalcode/dal-workflow/src/todo-snapshot.js +2 -0
  210. package/dist/node_modules/@dalcode/dal-workflow/src/todo.js +4 -4
  211. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  212. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  213. package/dist/node_modules/@earendil-works/pi-ai/README.md +5 -34
  214. package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +5 -5
  215. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +1 -1
  216. package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +4 -4
  217. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +1 -1
  218. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +6 -6
  219. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +2 -2
  220. package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +0 -1
  221. package/dist/node_modules/@earendil-works/pi-ai/dist/index.js +1 -1
  222. package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts +1 -0
  223. package/dist/node_modules/@earendil-works/pi-ai/dist/models.js +1 -1
  224. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts +359 -0
  225. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js +1 -0
  226. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  227. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  228. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  229. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/azure.json +1 -1
  230. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  231. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -1
  232. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  233. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
  234. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  235. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  236. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  237. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.json +1 -1
  238. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  239. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
  240. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -1
  241. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -1
  242. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
  243. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
  244. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  245. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
  246. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  247. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  248. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  249. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  250. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  251. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  252. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
  253. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  254. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  255. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
  256. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
  257. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
  258. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
  259. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
  260. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js +1 -1
  261. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts +90 -0
  262. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js +1 -0
  263. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.js +1 -0
  264. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +1 -1
  265. package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +5 -146
  266. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +1 -1
  267. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  268. package/dist/node_modules/@earendil-works/pi-codemode/README.md +195 -11
  269. package/dist/node_modules/@earendil-works/pi-codemode/dist/cloudflare.js +1 -0
  270. package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts +0 -2
  271. package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.js +9 -84
  272. package/dist/node_modules/@earendil-works/pi-codemode/dist/index.d.ts +5 -2
  273. package/dist/node_modules/@earendil-works/pi-codemode/dist/index.js +1 -1
  274. package/dist/node_modules/@earendil-works/pi-codemode/dist/portable.js +1 -0
  275. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.d.ts +29 -0
  276. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.js +1 -0
  277. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/host.d.ts +3 -16
  278. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/host.js +1 -1
  279. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.d.ts +13 -0
  280. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.js +1 -0
  281. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js +14 -6
  282. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.d.ts +72 -0
  283. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.js +1 -1
  284. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.d.ts +32 -0
  285. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.js +1 -0
  286. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.js +3 -0
  287. package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/worker.js +1 -3
  288. package/dist/node_modules/@earendil-works/pi-codemode/dist/source.js +4 -3
  289. package/dist/node_modules/@earendil-works/pi-codemode/dist/types.d.ts +51 -1
  290. package/dist/node_modules/@earendil-works/pi-codemode/package.json +14 -2
  291. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  292. package/dist/node_modules/@earendil-works/pi-mcp/CHANGELOG.md +13 -0
  293. package/dist/node_modules/@earendil-works/pi-mcp/dist/client.js +1 -1
  294. package/dist/node_modules/@earendil-works/pi-mcp/dist/index.d.ts +1 -1
  295. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts +2 -2
  296. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js +1 -1
  297. package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js +1 -1
  298. package/dist/node_modules/@earendil-works/pi-mcp/dist/protocol/content.d.ts +1 -1
  299. package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.d.ts +2 -2
  300. package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js +4 -4
  301. package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/transport.d.ts +4 -1
  302. package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
  303. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  304. package/dist/node_modules/@earendil-works/pi-tui/README.md +5 -3
  305. package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.js +6 -6
  306. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js +2 -2
  307. package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
  308. package/dist/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
  309. package/dist/node_modules/@earendil-works/pi-tui/dist/keys.js +5 -5
  310. package/dist/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +1 -1
  311. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +1 -1
  312. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +3 -3
  313. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +1 -1
  314. package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +4 -0
  315. package/dist/node_modules/@earendil-works/pi-tui/dist/tui.js +2 -2
  316. package/dist/node_modules/@earendil-works/pi-tui/dist/utils.js +1 -1
  317. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  318. package/dist/sdk/index.d.ts +3 -3
  319. package/dist/sdk/index.js +1 -1
  320. package/dist/sdk/rewind.d.ts +1 -1
  321. package/dist/sdk/rewind.js +1 -1
  322. package/dist/utils/clipboard.js +1 -1
  323. package/dist/utils/output-files.js +1 -1
  324. package/dist/utils/temp-files.js +1 -0
  325. package/docs/security.md +24 -7
  326. package/examples/README.md +0 -3
  327. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  328. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  329. package/examples/extensions/gondolin/package-lock.json +2 -2
  330. package/examples/extensions/gondolin/package.json +1 -1
  331. package/examples/extensions/minimal-mode.ts +4 -5
  332. package/examples/extensions/overlay-test.ts +2 -2
  333. package/examples/extensions/sandbox/package-lock.json +2 -2
  334. package/examples/extensions/sandbox/package.json +1 -1
  335. package/examples/extensions/subagent/index.ts +4 -6
  336. package/examples/extensions/with-deps/package-lock.json +2 -2
  337. package/examples/extensions/with-deps/package.json +1 -1
  338. package/npm-shrinkwrap.json +9 -460
  339. package/package.json +3 -12
  340. package/dist/modes/interactive/theme/theme-json.d.ts +0 -75
  341. package/dist/modes/interactive/theme/theme-json.js +0 -12
  342. package/dist/modes/interactive/theme/theme-schema.json +0 -361
  343. package/dist/node_modules/@earendil-works/chord/README.md +0 -264
  344. package/dist/node_modules/@earendil-works/chord/dist/api.js +0 -1
  345. package/dist/node_modules/@earendil-works/chord/dist/bundler.js +0 -1
  346. package/dist/node_modules/@earendil-works/chord/dist/context/index.js +0 -1
  347. package/dist/node_modules/@earendil-works/chord/dist/delta/apply-immutable-trusted.js +0 -1
  348. package/dist/node_modules/@earendil-works/chord/dist/delta/diff.js +0 -1
  349. package/dist/node_modules/@earendil-works/chord/dist/delta/draft.js +0 -0
  350. package/dist/node_modules/@earendil-works/chord/dist/delta/index.js +0 -1
  351. package/dist/node_modules/@earendil-works/chord/dist/delta/revision-validator.js +0 -1
  352. package/dist/node_modules/@earendil-works/chord/dist/delta/tracker.js +0 -1
  353. package/dist/node_modules/@earendil-works/chord/dist/facets/host.js +0 -1
  354. package/dist/node_modules/@earendil-works/chord/dist/facets/loader.js +0 -1
  355. package/dist/node_modules/@earendil-works/chord/dist/index.js +0 -1
  356. package/dist/node_modules/@earendil-works/chord/dist/json.js +0 -1
  357. package/dist/node_modules/@earendil-works/chord/dist/node/bundle-loader.js +0 -2
  358. package/dist/node_modules/@earendil-works/chord/dist/node/bundle.js +0 -4
  359. package/dist/node_modules/@earendil-works/chord/dist/node/manifest.js +0 -1
  360. package/dist/node_modules/@earendil-works/chord/dist/node/package.js +0 -1
  361. package/dist/node_modules/@earendil-works/chord/dist/node.js +0 -1
  362. package/dist/node_modules/@earendil-works/chord/dist/services/consumer.js +0 -1
  363. package/dist/node_modules/@earendil-works/chord/dist/services/errors.js +0 -1
  364. package/dist/node_modules/@earendil-works/chord/dist/services/handle.js +0 -1
  365. package/dist/node_modules/@earendil-works/chord/dist/services/instances.js +0 -1
  366. package/dist/node_modules/@earendil-works/chord/dist/services/loopback.js +0 -1
  367. package/dist/node_modules/@earendil-works/chord/dist/services/provider.js +0 -1
  368. package/dist/node_modules/@earendil-works/chord/dist/services/state-codec.js +0 -1
  369. package/dist/node_modules/@earendil-works/chord/dist/services/state-internals.js +0 -1
  370. package/dist/node_modules/@earendil-works/chord/dist/services/state.js +0 -1
  371. package/dist/node_modules/@earendil-works/chord/dist/services/wire.js +0 -1
  372. package/dist/node_modules/@earendil-works/chord/dist/types.js +0 -0
  373. package/dist/node_modules/@earendil-works/chord/package.json +0 -62
  374. package/dist/node_modules/@earendil-works/chord/src/delta/README.md +0 -191
  375. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts +0 -63
  376. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js +0 -1
  377. package/dist/node_modules/@earendil-works/pi-client/CHANGELOG.md +0 -45
  378. package/dist/node_modules/@earendil-works/pi-client/LICENSE +0 -21
  379. package/dist/node_modules/@earendil-works/pi-client/README.md +0 -72
  380. package/dist/node_modules/@earendil-works/pi-client/dist/client.js +0 -1
  381. package/dist/node_modules/@earendil-works/pi-client/dist/connection.js +0 -1
  382. package/dist/node_modules/@earendil-works/pi-client/dist/errors.js +0 -1
  383. package/dist/node_modules/@earendil-works/pi-client/dist/index.js +0 -1
  384. package/dist/node_modules/@earendil-works/pi-client/dist/promise.js +0 -1
  385. package/dist/node_modules/@earendil-works/pi-client/dist/transport.js +0 -0
  386. package/dist/node_modules/@earendil-works/pi-client/dist/types.js +0 -0
  387. package/dist/node_modules/@earendil-works/pi-client/dist/unix.js +0 -1
  388. package/dist/node_modules/@earendil-works/pi-client/package.json +0 -46
  389. package/dist/node_modules/@earendil-works/pi-protocol/LICENSE +0 -21
  390. package/dist/node_modules/@earendil-works/pi-protocol/README.md +0 -41
  391. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.js +0 -1
  392. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.js +0 -1
  393. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/index.js +0 -1
  394. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/options.js +0 -1
  395. package/dist/node_modules/@earendil-works/pi-protocol/dist/codec.js +0 -1
  396. package/dist/node_modules/@earendil-works/pi-protocol/dist/framing.js +0 -1
  397. package/dist/node_modules/@earendil-works/pi-protocol/dist/index.js +0 -1
  398. package/dist/node_modules/@earendil-works/pi-protocol/dist/protocol.js +0 -1
  399. package/dist/node_modules/@earendil-works/pi-protocol/dist/schemas.js +0 -1
  400. package/dist/node_modules/@earendil-works/pi-protocol/package.json +0 -39
  401. package/dist/node_modules/@earendil-works/pi-server/CHANGELOG.md +0 -81
  402. package/dist/node_modules/@earendil-works/pi-server/LICENSE +0 -21
  403. package/dist/node_modules/@earendil-works/pi-server/README.md +0 -63
  404. package/dist/node_modules/@earendil-works/pi-server/dist/connection.js +0 -1
  405. package/dist/node_modules/@earendil-works/pi-server/dist/errors.js +0 -1
  406. package/dist/node_modules/@earendil-works/pi-server/dist/index.js +0 -1
  407. package/dist/node_modules/@earendil-works/pi-server/dist/listener.js +0 -0
  408. package/dist/node_modules/@earendil-works/pi-server/dist/server.js +0 -1
  409. package/dist/node_modules/@earendil-works/pi-server/dist/session-router.js +0 -1
  410. package/dist/node_modules/@earendil-works/pi-server/dist/testing/client.js +0 -1
  411. package/dist/node_modules/@earendil-works/pi-server/dist/testing/host.js +0 -1
  412. package/dist/node_modules/@earendil-works/pi-server/dist/testing/index.js +0 -1
  413. package/dist/node_modules/@earendil-works/pi-server/dist/testing/server.js +0 -1
  414. package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/address.js +0 -1
  415. package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/index.js +0 -1
  416. package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/listener.js +0 -1
  417. package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/preset.js +0 -1
  418. package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/types.js +0 -0
  419. package/dist/node_modules/@earendil-works/pi-server/dist/types.js +0 -0
  420. package/dist/node_modules/@earendil-works/pi-server/package.json +0 -45
  421. package/examples/plugins/pi-example-plugin/README.md +0 -38
  422. package/examples/plugins/pi-example-plugin/package.json +0 -10
  423. package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
  424. package/examples/plugins/pi-example-plugin/src/session.ts +0 -24
  425. package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
  426. /package/dist/node_modules/{@earendil-works/chord → @dalcode/dal-codeindex}/LICENSE +0 -0
@@ -0,0 +1,176 @@
1
+ var u=Object.defineProperty;var f=(n,i)=>u(n,"name",{value:i,configurable:!0});var y=Object.defineProperty,g=f((n,i)=>y(n,"name",{value:i,configurable:!0}),"d");const m=`
2
+ (function_declaration name: (identifier) @name) @def.function
3
+ (generator_function_declaration name: (identifier) @name) @def.function
4
+ (function_signature name: (identifier) @name) @def.function
5
+ (class_declaration name: (_) @name) @def.class
6
+ (abstract_class_declaration name: (type_identifier) @name) @def.class
7
+ (interface_declaration name: (type_identifier) @name) @def.interface
8
+ (type_alias_declaration name: (type_identifier) @name) @def.type
9
+ (enum_declaration name: (identifier) @name) @def.enum
10
+ (internal_module name: (_) @name) @def.module
11
+ (method_definition name: (_) @name) @def.method
12
+ (method_signature name: (_) @name) @def.method
13
+ (abstract_method_signature name: (_) @name) @def.method
14
+ (public_field_definition name: (_) @name) @def.field
15
+ (property_signature name: (_) @name) @def.field
16
+ (variable_declarator name: (identifier) @name value: [(arrow_function) (function_expression)]) @def.function
17
+ (program (lexical_declaration (variable_declarator name: (identifier) @name) @def.constant))
18
+ (program (export_statement declaration: (lexical_declaration (variable_declarator name: (identifier) @name) @def.constant)))
19
+ (pair key: (property_identifier) @name value: [(arrow_function) (function_expression)]) @def.function
20
+ `,x=`
21
+ (function_declaration name: (identifier) @name) @def.function
22
+ (generator_function_declaration name: (identifier) @name) @def.function
23
+ (class_declaration name: (_) @name) @def.class
24
+ (class name: (_) @name) @def.class
25
+ (method_definition name: (_) @name) @def.method
26
+ (field_definition property: (_) @name) @def.field
27
+ (variable_declarator name: (identifier) @name value: [(arrow_function) (function_expression)]) @def.function
28
+ (assignment_expression left: (member_expression property: (property_identifier) @name) right: [(arrow_function) (function_expression)]) @def.function
29
+ (program (lexical_declaration (variable_declarator name: (identifier) @name) @def.constant))
30
+ (program (export_statement declaration: (lexical_declaration (variable_declarator name: (identifier) @name) @def.constant)))
31
+ (pair key: (property_identifier) @name value: [(arrow_function) (function_expression)]) @def.function
32
+ `,c=`
33
+ (call_expression function: (identifier) @name) @ref.call
34
+ (call_expression function: (member_expression property: (_) @name)) @ref.call
35
+ (new_expression constructor: (identifier) @name) @ref.new
36
+ (new_expression constructor: (member_expression property: (property_identifier) @name)) @ref.new
37
+ (decorator (identifier) @name) @ref.call
38
+ (class_heritage (identifier) @name) @ref.extends
39
+ (import_specifier name: (identifier) @name) @ref.import
40
+ `,o=`
41
+ (jsx_opening_element name: (identifier) @name) @ref.call
42
+ (jsx_self_closing_element name: (identifier) @name) @ref.call
43
+ `,l=`${c.replace("(class_heritage (identifier) @name) @ref.extends","(extends_clause value: (identifier) @name) @ref.extends")}
44
+ (implements_clause (type_identifier) @name) @ref.implements
45
+ (implements_clause (generic_type name: (type_identifier) @name)) @ref.implements
46
+ (extends_type_clause type: (type_identifier) @name) @ref.extends
47
+ (extends_type_clause type: (generic_type name: (type_identifier) @name)) @ref.extends
48
+ (type_identifier) @name @ref.type
49
+ `,_=`
50
+ (class_definition name: (identifier) @name) @def.class
51
+ (function_definition name: (identifier) @name) @def.function
52
+ (module (expression_statement (assignment left: (identifier) @name) @def.constant))
53
+ (call function: (identifier) @name) @ref.call
54
+ (call function: (attribute attribute: (identifier) @name)) @ref.call
55
+ (class_definition superclasses: (argument_list (identifier) @name)) @ref.extends
56
+ (class_definition superclasses: (argument_list (attribute attribute: (identifier) @name))) @ref.extends
57
+ (decorator (identifier) @name) @ref.call
58
+ (import_from_statement name: (dotted_name (identifier) @name)) @ref.import
59
+ (import_from_statement name: (aliased_import name: (dotted_name (identifier) @name))) @ref.import
60
+ (type (identifier) @name) @ref.type
61
+ `,h=`
62
+ (function_declaration name: (identifier) @name) @def.function
63
+ (method_declaration receiver: (parameter_list (parameter_declaration type: [(type_identifier) @receiver (pointer_type (type_identifier) @receiver) (generic_type type: (type_identifier) @receiver) (pointer_type (generic_type type: (type_identifier) @receiver))])) name: (field_identifier) @name) @def.method
64
+ (type_spec name: (type_identifier) @name type: (struct_type)) @def.struct
65
+ (type_spec name: (type_identifier) @name type: (interface_type)) @def.interface
66
+ (type_spec name: (type_identifier) @name type: [(type_identifier) (qualified_type) (function_type) (map_type) (slice_type) (array_type) (pointer_type) (channel_type) (generic_type)]) @def.type
67
+ (type_alias name: (type_identifier) @name) @def.type
68
+ (method_elem name: (field_identifier) @name) @def.method
69
+ (field_declaration name: (field_identifier) @name) @def.field
70
+ (source_file (const_declaration (const_spec name: (identifier) @name) @def.constant))
71
+ (source_file (var_declaration (var_spec name: (identifier) @name) @def.variable))
72
+ (call_expression function: (identifier) @name) @ref.call
73
+ (call_expression function: (selector_expression field: (field_identifier) @name)) @ref.call
74
+ (type_identifier) @name @ref.type
75
+ `,b=`
76
+ (class_declaration name: (identifier) @name) @def.class
77
+ (interface_declaration name: (identifier) @name) @def.interface
78
+ (enum_declaration name: (identifier) @name) @def.enum
79
+ (record_declaration name: (identifier) @name) @def.class
80
+ (annotation_type_declaration name: (identifier) @name) @def.interface
81
+ (method_declaration name: (identifier) @name) @def.method
82
+ (constructor_declaration name: (identifier) @name) @def.constructor
83
+ (field_declaration declarator: (variable_declarator name: (identifier) @name)) @def.field
84
+ (enum_constant name: (identifier) @name) @def.member
85
+ (method_invocation name: (identifier) @name) @ref.call
86
+ (object_creation_expression type: (type_identifier) @name) @ref.new
87
+ (superclass (type_identifier) @name) @ref.extends
88
+ (super_interfaces (type_list (type_identifier) @name)) @ref.implements
89
+ (super_interfaces (type_list (generic_type (type_identifier) @name))) @ref.implements
90
+ (superclass (generic_type (type_identifier) @name)) @ref.extends
91
+ (extends_interfaces (type_list (type_identifier) @name)) @ref.extends
92
+ (type_identifier) @name @ref.type
93
+ `,v=`
94
+ (struct_item name: (type_identifier) @name) @def.struct
95
+ (enum_item name: (type_identifier) @name) @def.enum
96
+ (union_item name: (type_identifier) @name) @def.struct
97
+ (type_item name: (type_identifier) @name) @def.type
98
+ (trait_item name: (type_identifier) @name) @def.interface
99
+ (function_item name: (identifier) @name) @def.function
100
+ (function_signature_item name: (identifier) @name) @def.function
101
+ (mod_item name: (identifier) @name) @def.module
102
+ (macro_definition name: (identifier) @name) @def.macro
103
+ (const_item name: (identifier) @name) @def.constant
104
+ (static_item name: (identifier) @name) @def.constant
105
+ (field_declaration name: (field_identifier) @name) @def.field
106
+ (enum_variant name: (identifier) @name) @def.member
107
+ (impl_item type: (_) @name) @scope
108
+ (call_expression function: (identifier) @name) @ref.call
109
+ (call_expression function: (field_expression field: (field_identifier) @name)) @ref.call
110
+ (call_expression function: (scoped_identifier name: (identifier) @name)) @ref.call
111
+ (call_expression function: (generic_function function: (identifier) @name)) @ref.call
112
+ (call_expression function: (generic_function function: (scoped_identifier name: (identifier) @name))) @ref.call
113
+ (call_expression function: (generic_function function: (field_expression field: (field_identifier) @name))) @ref.call
114
+ (macro_invocation macro: (identifier) @name) @ref.call
115
+ (impl_item trait: (type_identifier) @name) @ref.implements
116
+ (use_declaration argument: (scoped_identifier name: (identifier) @name)) @ref.import
117
+ (type_identifier) @name @ref.type
118
+ `,w=`
119
+ (function_definition declarator: (function_declarator declarator: (_) @name)) @def.function
120
+ (function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (_) @name))) @def.function
121
+ (function_definition declarator: (reference_declarator (function_declarator declarator: (_) @name))) @def.function
122
+ (declaration declarator: (function_declarator declarator: (identifier) @name)) @def.declaration
123
+ (declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @def.declaration
124
+ (field_declaration declarator: (function_declarator declarator: (_) @name)) @def.method
125
+ (struct_specifier name: (type_identifier) @name body: (_)) @def.struct
126
+ (class_specifier name: (type_identifier) @name body: (_)) @def.class
127
+ (union_specifier name: (type_identifier) @name body: (_)) @def.struct
128
+ (enum_specifier name: (type_identifier) @name body: (_)) @def.enum
129
+ (type_definition declarator: (type_identifier) @name) @def.type
130
+ (alias_declaration name: (type_identifier) @name) @def.type
131
+ (namespace_definition name: (_) @name) @def.module
132
+ (preproc_def name: (identifier) @name) @def.macro
133
+ (preproc_function_def name: (identifier) @name) @def.macro
134
+ (field_declaration declarator: (field_identifier) @name) @def.field
135
+ (enumerator name: (identifier) @name) @def.member
136
+ (call_expression function: (identifier) @name) @ref.call
137
+ (call_expression function: (field_expression field: (field_identifier) @name)) @ref.call
138
+ (call_expression function: (qualified_identifier name: (identifier) @name)) @ref.call
139
+ (call_expression function: (template_function name: (identifier) @name)) @ref.call
140
+ (new_expression type: (type_identifier) @name) @ref.new
141
+ (base_class_clause (type_identifier) @name) @ref.extends
142
+ (type_identifier) @name @ref.type
143
+ `,q=`
144
+ (class_declaration name: (identifier) @name) @def.class
145
+ (interface_declaration name: (identifier) @name) @def.interface
146
+ (struct_declaration name: (identifier) @name) @def.struct
147
+ (enum_declaration name: (identifier) @name) @def.enum
148
+ (record_declaration name: (identifier) @name) @def.class
149
+ (method_declaration name: (identifier) @name) @def.method
150
+ (constructor_declaration name: (identifier) @name) @def.constructor
151
+ (property_declaration name: (identifier) @name) @def.field
152
+ (namespace_declaration name: (_) @name) @def.module
153
+ (invocation_expression function: (identifier) @name) @ref.call
154
+ (invocation_expression function: (member_access_expression name: (identifier) @name)) @ref.call
155
+ (object_creation_expression type: (identifier) @name) @ref.new
156
+ (base_list (identifier) @name) @ref.extends
157
+ `,j=`
158
+ (class name: (constant) @name) @def.class
159
+ (module name: (constant) @name) @def.module
160
+ (method name: (_) @name) @def.method
161
+ (singleton_method name: (_) @name) @def.method
162
+ (call method: (identifier) @name) @ref.call
163
+ (superclass (constant) @name) @ref.extends
164
+ `,P=`
165
+ (class_declaration name: (name) @name) @def.class
166
+ (interface_declaration name: (name) @name) @def.interface
167
+ (trait_declaration name: (name) @name) @def.interface
168
+ (enum_declaration name: (name) @name) @def.enum
169
+ (function_definition name: (name) @name) @def.function
170
+ (method_declaration name: (name) @name) @def.method
171
+ (function_call_expression function: (name) @name) @ref.call
172
+ (member_call_expression name: (name) @name) @ref.call
173
+ (scoped_call_expression name: (name) @name) @ref.call
174
+ (object_creation_expression (name) @name) @ref.new
175
+ (base_clause (name) @name) @ref.extends
176
+ `,a={language:"TypeScript",grammar:"typescript",query:m+l},S={language:"TypeScript",grammar:"tsx",query:m+l+o},t={language:"JavaScript",grammar:"javascript",query:x+c+o},e={language:"C/C++",grammar:"cpp",query:w},s=new Map([[".ts",a],[".mts",a],[".cts",a],[".tsx",S],[".js",t],[".mjs",t],[".cjs",t],[".jsx",t],[".py",{language:"Python",grammar:"python",query:_}],[".pyi",{language:"Python",grammar:"python",query:_}],[".go",{language:"Go",grammar:"go",query:h}],[".java",{language:"Java",grammar:"java",query:b}],[".rs",{language:"Rust",grammar:"rust",query:v}],[".c",e],[".h",e],[".cc",e],[".cpp",e],[".cxx",e],[".c++",e],[".hh",e],[".hpp",e],[".hxx",e],[".h++",e],[".inl",e],[".cs",{language:"C#",grammar:"c-sharp",query:q}],[".rb",{language:"Ruby",grammar:"ruby",query:j}],[".php",{language:"PHP",grammar:"php",query:P}]]);function p(n){const i=n.lastIndexOf("/"),r=n.slice(i+1).toLowerCase();if(r.endsWith(".d.ts"))return a;const d=r.lastIndexOf(".");return d>0?s.get(r.slice(d)):void 0}f(p,"P"),g(p,"languageForPath");const N=new Set(["class","interface","struct","enum","module","type","function","method","constructor"]);export{N as CONTAINER_KINDS,s as LANGUAGES_BY_EXTENSION,p as languageForPath};
@@ -0,0 +1 @@
1
+ var T=Object.defineProperty;var a=(t,e)=>T(t,"name",{value:e,configurable:!0});var C=Object.defineProperty,m=a((t,e)=>C(t,"name",{value:e,configurable:!0}),"c");import{spawnSync as j}from"node:child_process";import{createHash as E}from"node:crypto";import{readdirSync as N,readFileSync as A,realpathSync as L,rmSync as _,statSync as P,utimesSync as O,writeFileSync as $}from"node:fs";import{homedir as U}from"node:os";import{basename as b,dirname as z,join as d,parse as G,resolve as M,sep as g}from"node:path";import{storeBytes as H}from"./store.js";const u={enabled:!0,maxFiles:3e5,maxFileBytes:1024*1024,maxDiskBytes:2*1024*1024*1024,maxTotalDiskBytes:8*1024*1024*1024,maxMemoryMb:512,semantic:!1};function y(t,e,s,o){return typeof t=="number"&&Number.isFinite(t)?Math.min(o,Math.max(s,Math.round(t))):e}a(y,"x"),m(y,"positive");function B(t){let e={};try{const n=JSON.parse(A(d(t,"settings.json"),"utf8"));n.dalCodeIndex&&typeof n.dalCodeIndex=="object"&&(e=n.dalCodeIndex)}catch{}const s=process.env.DAL_CODEINDEX?.trim().toLowerCase(),o=1024*1024;return{enabled:s==="off"||s==="0"||s==="false"?!1:e.enabled!==!1,maxFiles:y(e.maxFiles,u.maxFiles,100,5e6),maxFileBytes:y(e.maxFileKB,u.maxFileBytes/1024,1,64*1024)*1024,maxDiskBytes:y(e.maxDiskMB,u.maxDiskBytes/o,16,1024*1024)*o,maxTotalDiskBytes:y(e.maxTotalDiskMB,u.maxTotalDiskBytes/o,64,4*1024*1024)*o,maxMemoryMb:y(e.maxMemoryMB,u.maxMemoryMb,64,16*1024),semantic:process.env.DAL_CODEINDEX_SEMANTIC==="on"||e.semantic===!0}}a(B,"z"),m(B,"readSettings");function x(t){try{return L(t)}catch{return M(t)}}a(x,"f"),m(x,"real");function S(t){const e=j("git",["-C",t,"rev-parse","--show-toplevel","--git-common-dir"],{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"],timeout:5e3});if(e.status!==0||typeof e.stdout!="string")return;const[s,o]=e.stdout.split(/\r?\n/);if(!(!s||!o))return{root:x(s),commonDir:x(M(t,o))}}a(S,"N"),m(S,"gitLocation");function D(t,e){return e===t||e.startsWith(t.endsWith(g)?t:t+g)}a(D,"h"),m(D,"isInside");const v=new Map;function F(t,e){const s=`${t}\0${e}`,o=v.get(s);if(o!==void 0)return o??void 0;const n=S(t),i=n?.root??x(t),f=x(e);let l=null;if(i!==x(U())&&i!==G(i).root&&!D(f,i)&&!D(i,f)){const r=n?b(n.commonDir)===".git"?z(n.commonDir):n.commonDir:i,c=b(r).replace(/[^A-Za-z0-9._-]+/g,"-").slice(0,40)||"project",p=E("sha256").update(r).digest("hex").slice(0,12),h=d(e,"codeindex",`${c}-${p}`);l={root:i,indexDir:h,dbPath:d(h,"index.db")}}return v.set(s,l),l??void 0}a(F,"G"),m(F,"locateProject");const k="last-used";function I(t){const e=d(t.indexDir,k);try{const s=new Date;try{O(e,s,s)}catch{$(e,"",{mode:384})}}catch{}}a(I,"J"),m(I,"markUsed");function w(t,e,s){const o=d(t,"codeindex");let n;try{n=N(o,{withFileTypes:!0})}catch{return[]}const i=n.filter(r=>r.isDirectory()).map(r=>{const c=d(o,r.name);let p=0;try{p=P(d(c,k)).mtimeMs}catch{}return{dir:c,used:p,bytes:H(d(c,"index.db"))}}).sort((r,c)=>r.used-c.used);let f=i.reduce((r,c)=>r+c.bytes,0);const l=[];for(const r of i){if(f<=s)break;r.dir!==e&&(_(r.dir,{recursive:!0,force:!0}),f-=r.bytes,l.push(r.dir))}return l}a(w,"K"),m(w,"pruneIndexes");export{u as DEFAULT_SETTINGS,F as locateProject,I as markUsed,w as pruneIndexes,B as readSettings};
@@ -0,0 +1,2 @@
1
+ var Y=Object.defineProperty;var p=(e,t)=>Y(e,"name",{value:t,configurable:!0});var z=Object.defineProperty,f=p((e,t)=>z(e,"name",{value:t,configurable:!0}),"f");import{identifierWords as T}from"./store.js";const g="d.id AS id, f.path AS path, n.name AS name, d.kind AS kind, d.line AS line, d.end_line AS end_line, d.col AS col, d.container AS container, d.signature AS signature, d.doc AS doc";function S(e){return{id:e.id,path:e.path,name:e.name,kind:e.kind,line:e.line,endLine:e.end_line,column:e.col,container:e.container??void 0,signature:e.signature,doc:e.doc??void 0}}p(S,"O"),f(S,"toDefinition");const K=/(^|\/)(tests?|__tests__|spec|specs|testdata|fixtures?)(\/|$)|[._-](test|spec)s?\.[a-z]+$|_test\.go$/i;function m(e){return K.test(e)}p(m,"I"),f(m,"isTestPath");const C={class:0,interface:0,struct:0,enum:1,type:1,function:1,method:1,constructor:2,module:2,macro:2,constant:3,variable:3,field:3,member:4,declaration:5};function v(e,t){return Number(m(e.path))-Number(m(t.path))||(C[e.kind]??3)-(C[t.kind]??3)||Number(e.path.endsWith(".d.ts"))-Number(t.path.endsWith(".d.ts"))||e.path.length-t.path.length||e.path.localeCompare(t.path)||e.line-t.line}p(v,"v"),f(v,"definitionOrder");function R(e){const t=e.trim().replace(/\(\)$/,""),r=/^(.*?)(?:::|\.|#)([^:.#]+)$/.exec(t);if(!r)return{name:t};const a=r[1].split(/::|\.|#/);return{name:r[2],container:a[a.length-1]}}p(R,"D"),f(R,"splitSymbol");function A(e,t){if(!e)return"";const r=e.replace(/^\.\/+/,"").replace(/\/+$/,"");return!r||r==="."?"":(t.push(r,`${r}/%`)," AND (f.path = ? OR f.path LIKE ?)")}p(A,"L"),f(A,"pathClause");function M(e,t,r=50){const{name:a,container:c}=R(t.symbol),s=f(u=>{const n=[e.rootId,a];let i=`SELECT ${g} FROM names n JOIN defs d ON d.name_id = n.id JOIN files f ON f.blob_id = d.blob_id AND f.root_id = ? WHERE n.name = ?${u?" COLLATE NOCASE":""}`;return c&&(i+=" AND d.container = ?",n.push(c)),t.kind&&(i+=" AND d.kind = ?",n.push(t.kind)),i+=A(t.pathPrefix,n),i+=" LIMIT 2000",e.store.db.prepare(i).all(...n).map(S)},"run");let o=s(!1),d=!1;return o.length===0&&(o=s(!0),d=o.length>0),{definitions:o.sort(v).slice(0,r),caseInsensitive:d||void 0}}p(M,"J"),f(M,"findDefinitions");function D(e,t,r=2e3){const{name:a}=R(t.symbol),c=[e.rootId,a];let s="WHERE n.name = ?";t.kinds&&t.kinds.length>0&&(s+=` AND r.kind IN (${t.kinds.map(()=>"?").join(", ")})`,c.push(...t.kinds)),s+=A(t.pathPrefix,c);const o="FROM names n JOIN refs r ON r.name_id = n.id JOIN files f ON f.blob_id = r.blob_id AND f.root_id = ?",d=Number(e.store.db.prepare(`SELECT count(*) AS n ${o} ${s}`).get(...c).n),u=e.store.db.prepare(`SELECT f.path AS path, r.line AS line, r.col AS col, r.kind AS kind, cn.name AS caller, cd.container AS caller_container, cd.line AS caller_line ${o} LEFT JOIN defs cd ON cd.id = r.caller LEFT JOIN names cn ON cn.id = cd.name_id ${s} LIMIT ?`).all(...c,r).map(n=>({path:n.path,line:n.line,column:n.col,kind:n.kind,caller:n.caller??void 0,callerContainer:n.caller_container??void 0,callerLine:n.caller_line??void 0}));return u.sort((n,i)=>Number(m(n.path))-Number(m(i.path))||n.path.localeCompare(i.path)||n.line-i.line),{references:u,total:d}}p(D,"y"),f(D,"findReferences");function $(e,t){return e.store.db.prepare("SELECT blob_id FROM files WHERE root_id = ? AND path = ?").get(e.rootId,t)?e.store.db.prepare(`SELECT ${g} FROM files f JOIN defs d ON d.blob_id = f.blob_id JOIN names n ON n.id = d.name_id WHERE f.root_id = ? AND f.path = ? ORDER BY d.line, d.col`).all(e.rootId,t).map(S):void 0}p($,"B"),f($,"fileOutline");function F(e,t){const r=new Map;if(e.length>0){const s=e.map(d=>d.id),o=t.store.db.prepare(`SELECT id, parent FROM defs WHERE id IN (${s.map(()=>"?").join(", ")})`).all(...s);for(const d of o)r.set(d.id,d.parent)}const a=new Map,c=f((s,o=0)=>{const d=a.get(s);if(d!==void 0)return d;const u=r.get(s),n=u==null||o>20?0:c(u,o+1)+1;return a.set(s,n),n},"depthOf");for(const s of e)c(s.id);return a}p(F,"Q"),f(F,"outlineDepths");const q=new Set(["the","a","an","of","to","in","for","and","or","is","where","which","what","how","code","that","this","with","on","by","from","handle","handles","handling","logic","function","implementation"]);function L(e){const t=T(e.replace(/[^\p{L}\p{N}_]+/gu," ")).split(" ").map(r=>r.toLowerCase()).filter(r=>/^[a-z0-9_]+$/.test(r)&&r.length>=2&&!q.has(r));return[...new Set(t)].slice(0,12)}p(L,"x"),f(L,"queryTerms");function k(e,t,r=25,a){const c=L(t);if(c.length===0)return[];const s=[c.map(n=>`"${n}"*`).join(" OR "),e.rootId],o=A(a,s),d=e.store.db.prepare(`WITH hits AS (SELECT rowid AS id, bm25(defs_fts, 4.0, 1.0) AS rank FROM defs_fts WHERE defs_fts MATCH ? ORDER BY rank LIMIT 4000)
2
+ SELECT ${g}, hits.rank AS rank FROM hits CROSS JOIN defs d ON d.id = hits.id JOIN files f ON f.blob_id = d.blob_id AND f.root_id = ? JOIN names n ON n.id = d.name_id WHERE 1${o} ORDER BY hits.rank LIMIT 400`).all(...s),u=[];for(const n of d){const i=S(n),I=`${T(i.name)} ${i.container?T(i.container):""} ${(i.doc??"").toLowerCase()} ${i.path.toLowerCase()}`,O=c.filter(b=>I.includes(b)).length/c.length,E=1/(1+(C[i.kind]??3)*.25),h=c.filter(b=>i.path.toLowerCase().includes(b)).length,l=-n.rank*E*(.25+O*O)*(1+.3*h)*(m(i.path)?.5:1);u.push({...i,score:l})}return u.sort((n,i)=>i.score-n.score),u.slice(0,r)}p(k,"P"),f(k,"searchSymbols");function W(e,t,r=10){const a=L(t);if(a.length===0)return[];const c=[e.rootId],s=a.map(o=>(c.push(`%${o}%`),"lower(path) LIKE ?"));return e.store.db.prepare(`SELECT path FROM files WHERE root_id = ? AND (${s.join(" OR ")}) LIMIT 5000`).all(...c).map(o=>({path:o.path,hits:a.filter(d=>o.path.toLowerCase().includes(d)).length})).filter(o=>o.hits>=Math.min(2,a.length)).sort((o,d)=>d.hits-o.hits||o.path.length-d.path.length).slice(0,r).map(o=>o.path)}p(W,"V"),f(W,"searchPaths");const H=3;function w(e,t,r=15){const{db:a}=e.store,c=a.prepare("SELECT blob_id FROM files WHERE root_id = ? AND path = ?").get(e.rootId,t);if(!c)return;const s=new Map,o=f((h,l,b,N)=>{if(h===t)return;let _=s.get(h);_||(_={score:0,via:new Set,uses:!1,usedBy:!1},s.set(h,_)),_.score+=b,_.via.size<6&&_.via.add(l),N==="uses"?_.uses=!0:_.usedBy=!0},"add"),d=a.prepare("SELECT DISTINCT f.path AS path FROM defs d JOIN files f ON f.blob_id = d.blob_id AND f.root_id = ? WHERE d.name_id = ? LIMIT 4"),u=a.prepare("SELECT f.path AS path, count(*) AS uses FROM refs r JOIN files f ON f.blob_id = r.blob_id AND f.root_id = ? WHERE r.name_id = ? GROUP BY f.path LIMIT 5000"),n=a.prepare("SELECT name FROM names WHERE id = ?"),i=a.prepare("SELECT DISTINCT name_id FROM refs WHERE blob_id = ? LIMIT 2000").all(c.blob_id);for(const{name_id:h}of i){const l=d.all(e.rootId,h);if(l.length===0||l.length>H)continue;const b=n.get(h).name;for(const N of l)o(N.path,b,1/l.length,"uses")}const I=a.prepare("SELECT DISTINCT name_id FROM defs WHERE blob_id = ? AND kind NOT IN ('field', 'member', 'variable') LIMIT 1000").all(c.blob_id);for(const{name_id:h}of I){const l=d.all(e.rootId,h);if(l.length>H)continue;const b=n.get(h).name;for(const N of u.all(e.rootId,h))o(N.path,b,Math.min(3,N.uses)/Math.max(1,l.length),"used-by")}const O=[...s.entries()].map(([h,l])=>({path:h,score:l.score,via:[...l.via],direction:l.uses&&l.usedBy?"both":l.uses?"uses":"used-by"})),E=t.replace(/^.*\//,"").replace(/\.[^.]+$/,"").replace(/([._-](test|spec)s?$)|(^test_)/i,"");if(E){const h=a.prepare("SELECT path FROM files WHERE root_id = ? AND path LIKE ? LIMIT 50").all(e.rootId,`%${E}%`);for(const l of h)if(l.path!==t&&l.path.replace(/^.*\//,"").replace(/\.[^.]+$/,"").replace(/([._-](test|spec)s?$)|(^test_)/i,"")===E&&m(l.path)!==m(t)){const b=O.find(N=>N.path===l.path);b?b.score+=5:O.push({path:l.path,score:5,via:[],direction:"test"})}}return O.sort((h,l)=>l.score-h.score||h.path.localeCompare(l.path)).slice(0,r)}p(w,"Y"),f(w,"relatedFiles");function J(e){const{db:t}=e.store,r=f(a=>Number(t.prepare(a).get(e.rootId).n),"count");return{files:r("SELECT count(*) AS n FROM files WHERE root_id = ?"),definitions:r("SELECT count(*) AS n FROM files f JOIN defs d ON d.blob_id = f.blob_id WHERE f.root_id = ?")}}p(J,"j"),f(J,"indexCounts");function y(e,t){return e.store.db.prepare(`SELECT ${g} FROM defs d JOIN names n ON n.id = d.name_id JOIN files f ON f.blob_id = d.blob_id AND f.root_id = ? AND f.path = ? WHERE d.parent = ? ORDER BY d.line`).all(e.rootId,t.path,t.id).map(S)}p(y,"K"),f(y,"childDefinitions");function x(e,t){return e.store.db.prepare("SELECT b.language AS language FROM files f JOIN blobs b ON b.id = f.blob_id WHERE f.root_id = ? AND f.path = ?").get(e.rootId,t)?.language??void 0}p(x,"z"),f(x,"fileLanguage");const B=new Map,G=3e4;function P(e,t,r,a,c=10,s){let o=B.get(t);if(!o||Date.now()-o.at>G){const n=e.store.db.prepare("SELECT f.path AS path, v.vec AS vec FROM files f JOIN blobs b ON b.id = f.blob_id JOIN vectors v ON v.hash = b.hash AND v.model = ? WHERE f.root_id = ?").all(r,e.rootId);o={at:Date.now(),paths:n.map(i=>i.path),vectors:n.map(i=>new Float32Array(i.vec.buffer.slice(i.vec.byteOffset,i.vec.byteOffset+i.vec.byteLength)))},B.set(t,o)}const d=s?.replace(/^\.\/+/,"").replace(/\/+$/,""),u=[];for(let n=0;n<o.vectors.length;n++){const i=o.paths[n];if(d&&d!=="."&&i!==d&&!i.startsWith(`${d}/`))continue;const I=o.vectors[n];if(I.length!==a.length)continue;let O=0;for(let E=0;E<I.length;E++)O+=I[E]*a[E];u.push({path:i,score:O*(m(i)?.9:1)})}return u.sort((n,i)=>i.score-n.score),u.slice(0,c)}p(P,"U"),f(P,"semanticFiles");function j(e,t){return Number(e.store.db.prepare("SELECT count(*) AS n FROM files f JOIN blobs b ON b.id = f.blob_id JOIN vectors v ON v.hash = b.hash AND v.model = ? WHERE f.root_id = ?").get(t,e.rootId).n)}p(j,"G"),f(j,"embeddedFileCount");export{y as childDefinitions,j as embeddedFileCount,x as fileLanguage,$ as fileOutline,M as findDefinitions,D as findReferences,J as indexCounts,m as isTestPath,F as outlineDepths,L as queryTerms,w as relatedFiles,W as searchPaths,k as searchSymbols,P as semanticFiles,R as splitSymbol};
@@ -0,0 +1 @@
1
+ var O=Object.defineProperty;var n=(e,t)=>O(e,"name",{value:t,configurable:!0});var S=Object.defineProperty,a=n((e,t)=>S(e,"name",{value:t,configurable:!0}),"s");import{randomUUID as I}from"node:crypto";import{Worker as R}from"node:worker_threads";import{openStore as A,rootId as B,rootState as E,touchRoot as T}from"./store.js";const b=Symbol.for("dalcode.codeindex.runtime"),j=3;function i(){const e=globalThis;let t=e[b];return t||(t={workerFailures:0,owner:`${process.pid}:${I()}`,readers:new Map,progress:new Map,requested:new Map,waiters:new Map,listeners:new Set,semanticPending:new Map,nextEmbedId:1,embedWaiters:new Map},e[b]=t),t}n(i,"i"),a(i,"runtime");function u(e){const t=i(),r=t.waiters.get(e);if(r){t.waiters.delete(e);for(const o of r)o()}}n(u,"a"),a(u,"settle");function m(e,t){const r=i();r.progress.set(e,t);for(const o of r.listeners)o(e,t)}n(m,"p"),a(m,"setProgress");function y(e){if(e.type==="semantic"){i().semanticPending.set(e.root,e.done?0:e.pending);return}if(e.type==="embedded"){const t=i().embedWaiters.get(e.id);i().embedWaiters.delete(e.id),t?.(e.vector);return}if(e.type==="progress")m(e.root,{total:e.total,pending:e.pending,done:e.done,note:e.note,updatedAt:Date.now()}),e.done&&u(e.root);else if(e.type==="busy"){const t=i().progress.get(e.root);m(e.root,{total:t?.total??0,pending:t?.pending??0,done:!1,busyElsewhere:!0,updatedAt:Date.now()}),u(e.root)}else{const t=i().progress.get(e.root);m(e.root,{total:t?.total??0,pending:t?.pending??0,done:!0,error:e.message,updatedAt:Date.now()}),u(e.root)}}n(y,"W"),a(y,"onMessage");function f(e){const t=i();if(t.worker)return t.worker;if(t.workerFailures>=j)return;const r=new R(new URL("./worker.js",import.meta.url),{resourceLimits:{maxOldGenerationSizeMb:e},stdout:!0,stderr:!0});r.on("message",y);const o=a(s=>{if(t.worker===r){t.worker=void 0,t.workerFailures+=1;for(const[d,c]of t.progress)c.done||m(d,{...c,done:!0,error:s,updatedAt:Date.now()}),u(d)}},"fail");return r.on("error",s=>o(s instanceof Error?s.message:String(s))),r.on("exit",s=>o(`index worker exited (${s})`)),r.unref(),t.worker=r,r}n(f,"m"),a(f,"ensureWorker");function p(e){return{maxFiles:e.maxFiles,maxFileBytes:e.maxFileBytes,maxDiskBytes:e.maxDiskBytes}}n(p,"w"),a(p,"limitsOf");function P(e,t,r,o){const s=i(),d=f(t.maxMemoryMb);if(!d)return Promise.resolve();s.requested.set(e.root,Date.now());const c=s.progress.get(e.root);m(e.root,{total:c?.total??0,pending:c?.pending??0,done:!1,note:c?.note,updatedAt:Date.now()});const l=new Promise(W=>{const w=s.waiters.get(e.root)??[];w.push(W),s.waiters.set(e.root,w)}),g={type:"sync",dbPath:e.dbPath,root:e.root,focus:r,limits:p(t),owner:s.owner,semanticDir:o};return d.postMessage(g),l}n(P,"A"),a(P,"requestSync");function x(e,t,r){const o=f(t.maxMemoryMb);if(!o||r.length===0)return;const s={type:"files",dbPath:e.dbPath,root:e.root,paths:r,limits:p(t)};o.postMessage(s)}n(x,"L"),a(x,"requestFiles");function k(e,t,r){const o=i(),s=f(e.maxMemoryMb);if(!s)return Promise.resolve(void 0);const d=o.nextEmbedId++;return new Promise(c=>{const l=setTimeout(()=>{o.embedWaiters.delete(d),c(void 0)},15e3);l.unref?.(),o.embedWaiters.set(d,g=>{clearTimeout(l),c(g)}),s.postMessage({type:"embed",id:d,semanticDir:t,text:r})})}n(k,"D"),a(k,"embedQuery");function M(e){return i().semanticPending.get(e)}n(M,"E"),a(M,"semanticPendingOf");function h(e){return i().requested.get(e)}n(h,"O"),a(h,"lastRequested");function v(e){return i().progress.get(e)}n(v,"j"),a(v,"progressOf");function D(e){const t=i();return t.listeners.add(e),()=>t.listeners.delete(e)}n(D,"C"),a(D,"onProgress");function q(e){const t=i();let r=t.readers.get(e.dbPath);if(!r){try{r=A(e.dbPath)}catch{return}t.readers.set(e.dbPath,r)}const o=B(r,e.root);if(!(o<0))return T(r,o),{store:r,rootId:o,state:E(r,o)}}n(q,"B"),a(q,"openIndex");async function F(){const e=i(),t=e.worker;e.worker=void 0,t&&(t.postMessage({type:"stop"}),await t.terminate().catch(()=>{}));for(const r of e.readers.values())try{r.db.close()}catch{}e.readers.clear(),e.progress.clear(),e.requested.clear(),e.semanticPending.clear();for(const r of e.embedWaiters.values())r(void 0);e.embedWaiters.clear();for(const r of[...e.waiters.keys()])u(r);e.workerFailures=0}n(F,"T"),a(F,"shutdownRuntime");export{k as embedQuery,h as lastRequested,p as limitsOf,D as onProgress,q as openIndex,v as progressOf,x as requestFiles,P as requestSync,M as semanticPendingOf,F as shutdownRuntime};
@@ -0,0 +1 @@
1
+ var b=Object.defineProperty;var u=(t,e)=>b(t,"name",{value:e,configurable:!0});var x=Object.defineProperty,d=u((t,e)=>x(t,"name",{value:e,configurable:!0}),"f");import{spawnSync as S}from"node:child_process";import{readdirSync as z,readFileSync as D,statSync as k}from"node:fs";import{join as h,relative as g,sep as v}from"node:path";import E from"ignore";import{languageForPath as W}from"./languages.js";const y=new Set(["node_modules","bower_components","jspm_packages","vendor","dist","build","out","target","coverage","__pycache__","site-packages",".venv","venv",".git",".hg",".svn",".next",".nuxt",".cache",".gradle",".idea",".vscode-test","Pods","DerivedData"]);function j(t){if(!W(t)||/\.min\.(js|mjs|cjs)$/i.test(t)||/[-.]bundle\.js$/i.test(t))return!1;for(const e of t.split("/").slice(0,-1))if(y.has(e))return!1;return!0}u(j,"_"),d(j,"wanted");function w(t){const e=S("git",["-c","core.fsmonitor=false","-C",t,"ls-files","-z","--cached","--others","--exclude-standard"],{encoding:"utf8",maxBuffer:1073741824,windowsHide:!0,stdio:["ignore","pipe","ignore"]});if(!(e.status!==0||typeof e.stdout!="string"))return e.stdout.split("\0").filter(Boolean)}u(w,"k"),d(w,"gitPaths");function P(t,e){const o=[],a=[{dir:t,rules:[]}];for(;a.length>0&&o.length<e;){const{dir:c,rules:f}=a.pop();let r=f;try{const i=D(h(c,".gitignore"),"utf8");r=[...f,{base:c,matcher:E().add(i)}]}catch{}let l;try{l=z(c,{withFileTypes:!0})}catch{continue}for(const i of l){const n=h(c,i.name),s=i.isDirectory();!s&&!i.isFile()||s&&(y.has(i.name)||i.name.startsWith("."))||r.some(({base:m,matcher:_})=>{const p=g(m,n).split(v).join("/");return p!==""&&_.ignores(s?`${p}/`:p)})||(s?a.push({dir:n,rules:r}):o.push(g(t,n).split(v).join("/")))}}return o}u(P,"z"),d(P,"walkPaths");function F(t,e,o){const a=w(t),c=a?"git":"walk",f=(a??P(t,e.maxFiles*4)).filter(j),r=o?g(t,o).split(v).join("/"):"";if(r&&!r.startsWith("..")){const n=`${r}/`;f.sort((s,m)=>+!s.startsWith(n)-+!m.startsWith(n))}const l=[];let i=0;for(const n of f){if(l.length>=e.maxFiles){i+=1;continue}let s;try{s=k(h(t,n))}catch{continue}!s.isFile()||s.size>e.maxFileBytes||s.size===0||l.push({path:n,size:s.size,mtimeMs:Math.trunc(s.mtimeMs)})}return{files:l,truncated:i,method:c}}u(F,"E"),d(F,"scanProject");export{y as SKIPPED_DIRECTORIES,F as scanProject};
@@ -0,0 +1,2 @@
1
+ var H=Object.defineProperty;var f=(n,o)=>H(n,"name",{value:o,configurable:!0});var J=Object.defineProperty,d=f((n,o)=>J(n,"name",{value:o,configurable:!0}),"f");import{createHash as U}from"node:crypto";import{existsSync as D,mkdirSync as $,readFileSync as S,renameSync as G,rmSync as _,writeFileSync as M}from"node:fs";import{createRequire as K}from"node:module";import{dirname as T,join as l}from"node:path";import{gunzipSync as Z}from"node:zlib";const k="all-MiniLM-L6-v2-int8",Q=384,V=128,y="751bff37182d3f1213fa05d7196b954e230abad9",Y=[{urls:["https://registry.npmjs.org/onnxruntime-web/-/onnxruntime-web-1.30.0.tgz","https://registry.npmmirror.com/onnxruntime-web/-/onnxruntime-web-1.30.0.tgz"],sha256:"d2228df7e4616bc3348bf504ee888f3bec43789a273f0a63f3e68d203ce3bf71",extract:[{from:"package/package.json",to:"node_modules/onnxruntime-web/package.json"},{from:"package/dist/ort.node.min.js",to:"node_modules/onnxruntime-web/dist/ort.node.min.js"},{from:"package/dist/ort-wasm-simd-threaded.mjs",to:"node_modules/onnxruntime-web/dist/ort-wasm-simd-threaded.mjs"},{from:"package/dist/ort-wasm-simd-threaded.wasm",to:"node_modules/onnxruntime-web/dist/ort-wasm-simd-threaded.wasm"}]},{urls:["https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.30.0.tgz","https://registry.npmmirror.com/onnxruntime-common/-/onnxruntime-common-1.30.0.tgz"],sha256:"7906c439e0d3e0f4048caa23b64cdfadc0f455c377f579ce1ab2a4b778f07d5f",extract:[{from:"package/",to:"node_modules/onnxruntime-common/"}]},{urls:[`https://huggingface.co/Xenova/all-MiniLM-L6-v2/resolve/${y}/onnx/model_quantized.onnx`,`https://hf-mirror.com/Xenova/all-MiniLM-L6-v2/resolve/${y}/onnx/model_quantized.onnx`],sha256:"afdb6f1a0e45b715d0bb9b11772f032c399babd23bfc31fed1c170afc848bdb1",to:"model/model_quantized.onnx"},{urls:[`https://huggingface.co/Xenova/all-MiniLM-L6-v2/resolve/${y}/vocab.txt`,`https://hf-mirror.com/Xenova/all-MiniLM-L6-v2/resolve/${y}/vocab.txt`],sha256:"07eced375cec144d27c900241f3e339478dec958f92fddbc551f295c992038a3",to:"model/vocab.txt"}];function B(n){return l(n,"codeindex","semantic")}f(B,"te"),d(B,"semanticDir");const N="installed.json";function j(n){try{return JSON.parse(S(l(n,N),"utf8")).model===k}catch{return!1}}f(j,"R"),d(j,"semanticInstalled");function P(n){return U("sha256").update(n).digest("hex")}f(P,"C"),d(P,"sha256");function q(n){const o=new Map;let s=0;for(;s+512<=n.length;){const t=n.subarray(s,s+512);if(t.every(c=>c===0))break;const e=t.subarray(0,100).toString("utf8").replace(/\0.*$/s,""),i=t.subarray(345,500).toString("utf8").replace(/\0.*$/s,""),a=Number.parseInt(t.subarray(124,136).toString("utf8").replace(/\0.*$/s,"").trim()||"0",8),r=String.fromCharCode(t[156]||48),m=i?`${i}/${e}`:e;s+=512,(r==="0"||r==="\0")&&o.set(m,Buffer.from(n.subarray(s,s+a))),s+=Math.ceil(a/512)*512}return o}f(q,"X"),d(q,"untar");async function A(n,o){const s=[];for(const t of n.urls)try{const e=await o(t,{redirect:"follow"});if(!e.ok){s.push(`${t}: HTTP ${e.status}`);continue}const i=Buffer.from(await e.arrayBuffer()),a=P(i);if(a!==n.sha256){s.push(`${t}: sha256 ${a} != ${n.sha256}`);continue}return i}catch(e){s.push(`${t}: ${e instanceof Error?e.message:String(e)}`)}throw new Error(s.join("; "))}f(A,"W"),d(A,"download");async function O(n,o={}){const s=o.fetchImpl??fetch,t=`${n}.partial`;_(t,{recursive:!0,force:!0}),$(t,{recursive:!0,mode:448});try{for(const e of Y){o.onProgress?.(e.urls[0]);const i=await A(e,s);if(e.to){$(T(l(t,e.to)),{recursive:!0}),M(l(t,e.to),i);continue}const a=q(Z(i));for(const r of e.extract??[]){const m=r.from.endsWith("/")?[...a.keys()].filter(c=>c.startsWith(r.from)):a.has(r.from)?[r.from]:[];if(m.length===0)throw new Error(`${r.from} missing from ${e.urls[0]}`);for(const c of m){const b=l(t,r.to+(r.from.endsWith("/")?c.slice(r.from.length):""));if(!b.startsWith(t))throw new Error(`unsafe path in archive: ${c}`);$(T(b),{recursive:!0}),M(b,a.get(c))}}}M(l(t,N),JSON.stringify({model:k,installedAt:new Date().toISOString()})),_(n,{recursive:!0,force:!0}),G(t,n)}catch(e){throw _(t,{recursive:!0,force:!0}),e}}f(O,"ne"),d(O,"installSemantic");function C(n){const o=[],s=n.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"");for(const t of s.split(/\s+/)){let e="";for(const i of t)/[\p{P}\p{S}]/u.test(i)||/[一-鿿]/.test(i)?(e&&o.push(e),o.push(i),e=""):e+=i;e&&o.push(e)}return o}f(C,"U"),d(C,"basicTokens");function z(n,o,s=V){const t=n.get("[UNK]")??100,e=[n.get("[CLS]")??101];for(const i of C(o)){if(e.length>=s-1)break;if(i.length>100){e.push(t);continue}const a=[];let r=0;for(;r<i.length;){let m=i.length,c;for(;r<m&&(c=n.get((r>0?"##":"")+i.slice(r,m)),c===void 0);)m-=1;if(c===void 0){a.length=0,a.push(t);break}a.push(c),r=m}e.push(...a)}return e.length=Math.min(e.length,s-1),e.push(n.get("[SEP]")??102),e}f(z,"H"),d(z,"tokenize");function F(n,o){const s=[n.replace(/\.[^./]+$/,"").split(/[/._-]+/).join(" ")];for(const t of o){const e=t.name.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/_/g," ");s.push(t.doc?`${e}: ${t.doc}`:e)}return s.join(". ")}f(F,"re"),d(F,"fileText");async function W(n){const o=K(l(n,"node_modules","loader.cjs"))("onnxruntime-web");o.env.wasm.numThreads=1;const s=await o.InferenceSession.create(S(l(n,"model","model_quantized.onnx"))),t=new Map;S(l(n,"model","vocab.txt"),"utf8").split(`
2
+ `).forEach((a,r)=>{a&&t.set(a.replace(/\r$/,""),r)});let e=Promise.resolve();const i=d(async a=>{if(a.length===0)return[];const r=a.map(h=>z(t,h)),m=Math.max(...r.map(h=>h.length)),c=r.length,b=new BigInt64Array(c*m),E=new BigInt64Array(c*m);r.forEach((h,p)=>{h.forEach((v,g)=>{b[p*m+g]=BigInt(v),E[p*m+g]=1n})});const I=(await s.run({input_ids:new o.Tensor("int64",b,[c,m]),attention_mask:new o.Tensor("int64",E,[c,m]),token_type_ids:new o.Tensor("int64",new BigInt64Array(c*m),[c,m])})).last_hidden_state,w=I.dims[2],L=[];for(let h=0;h<c;h++){const p=new Float32Array(w),v=r[h].length;for(let u=0;u<v;u++){const R=(h*m+u)*w;for(let x=0;x<w;x++)p[x]+=I.data[R+x]}let g=0;for(let u=0;u<w;u++)g+=p[u]*p[u];g=Math.sqrt(g)||1;for(let u=0;u<w;u++)p[u]/=g;L.push(p)}return L},"run");return a=>{const r=e.then(()=>i(a));return e=r.catch(()=>{}),r}}f(W,"oe"),d(W,"createEmbedder");function X(n){return j(n)&&D(l(n,"node_modules","onnxruntime-web","dist","ort-wasm-simd-threaded.wasm"))&&D(l(n,"model","model_quantized.onnx"))}f(X,"se"),d(X,"semanticRuntimePresent");export{Q as EMBEDDING_DIMENSIONS,k as MODEL_ID,W as createEmbedder,F as fileText,O as installSemantic,B as semanticDir,j as semanticInstalled,X as semanticRuntimePresent,z as tokenize};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var r=(e,n)=>c(e,"name",{value:n,configurable:!0});var p=Object.defineProperty,a=r((e,n)=>p(e,"name",{value:n,configurable:!0}),"i");import{createRequire as f}from"node:module";const u=f(import.meta.url);let i;function o(e,n){const t=typeof e=="string"?e:e.message;return(typeof e!="string"?e.name:typeof n[0]=="string"?n[0]:n[0]?.type)==="ExperimentalWarning"&&/sqlite/i.test(t)}r(o,"a"),a(o,"isSqliteExperimentalWarning");function s(){if(i)return i;const e=process.emitWarning;process.emitWarning=function(n,...t){if(!o(n,t))return e.call(this,n,...t)};try{i=u("node:sqlite")}finally{process.emitWarning=e}return i}r(s,"p"),a(s,"loadSqlite");function l(e,n){const{DatabaseSync:t}=s();return new t(e,{readOnly:n?.readOnly===!0})}r(l,"d"),a(l,"openSqlite");export{l as openSqlite};
@@ -0,0 +1,33 @@
1
+ var D=Object.defineProperty;var E=(r,e)=>D(r,"name",{value:e,configurable:!0});var C=Object.defineProperty,a=E((r,e)=>C(r,"name",{value:e,configurable:!0}),"i");import{chmodSync as g,closeSync as w,constants as R,fstatSync as y,lstatSync as B,mkdirSync as W,openSync as X,statSync as G}from"node:fs";import{dirname as v}from"node:path";import{openSqlite as H}from"./sqlite.js";const d=2,l=2,x=`
2
+ CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value TEXT NOT NULL);
3
+ CREATE TABLE IF NOT EXISTS roots (
4
+ id INTEGER PRIMARY KEY, path TEXT NOT NULL UNIQUE,
5
+ total INTEGER NOT NULL DEFAULT 0, pending INTEGER NOT NULL DEFAULT 0, complete INTEGER NOT NULL DEFAULT 0,
6
+ last_scan INTEGER NOT NULL DEFAULT 0, last_used INTEGER NOT NULL DEFAULT 0, note TEXT,
7
+ owner TEXT, heartbeat INTEGER NOT NULL DEFAULT 0
8
+ );
9
+ CREATE TABLE IF NOT EXISTS names (id INTEGER PRIMARY KEY, name TEXT NOT NULL UNIQUE);
10
+ CREATE INDEX IF NOT EXISTS names_nocase ON names(name COLLATE NOCASE);
11
+ CREATE TABLE IF NOT EXISTS blobs (id INTEGER PRIMARY KEY, hash TEXT NOT NULL UNIQUE, language TEXT);
12
+ CREATE TABLE IF NOT EXISTS files (
13
+ root_id INTEGER NOT NULL, path TEXT NOT NULL, blob_id INTEGER NOT NULL,
14
+ size INTEGER NOT NULL, mtime_ms INTEGER NOT NULL, PRIMARY KEY (root_id, path)
15
+ ) WITHOUT ROWID;
16
+ CREATE INDEX IF NOT EXISTS files_blob ON files(blob_id);
17
+ CREATE TABLE IF NOT EXISTS defs (
18
+ id INTEGER PRIMARY KEY, blob_id INTEGER NOT NULL, name_id INTEGER NOT NULL, kind TEXT NOT NULL,
19
+ line INTEGER NOT NULL, end_line INTEGER NOT NULL, col INTEGER NOT NULL, parent INTEGER,
20
+ container TEXT, signature TEXT NOT NULL, doc TEXT
21
+ );
22
+ CREATE INDEX IF NOT EXISTS defs_name ON defs(name_id);
23
+ CREATE INDEX IF NOT EXISTS defs_blob ON defs(blob_id);
24
+ CREATE TABLE IF NOT EXISTS refs (
25
+ name_id INTEGER NOT NULL, blob_id INTEGER NOT NULL, line INTEGER NOT NULL, col INTEGER NOT NULL,
26
+ kind TEXT NOT NULL, caller INTEGER, PRIMARY KEY (name_id, blob_id, line, col, kind)
27
+ ) WITHOUT ROWID;
28
+ CREATE INDEX IF NOT EXISTS refs_blob ON refs(blob_id);
29
+ CREATE TABLE IF NOT EXISTS vectors (hash TEXT PRIMARY KEY, model TEXT NOT NULL, vec BLOB NOT NULL);
30
+ CREATE VIRTUAL TABLE IF NOT EXISTS defs_fts USING fts5(
31
+ words, doc, content='', contentless_delete=1, tokenize='porter unicode61'
32
+ );
33
+ `,P=["vectors","defs_fts","refs","defs","files","blobs","names","roots","meta"];function c(r){if(!r.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'meta'").get())return;const e=r.prepare("SELECT value FROM meta WHERE key = 'schema'").get(),t=Number(e?.value);return Number.isInteger(t)&&t>0?t:void 0}E(c,"u"),a(c,"storedSchema");function I(r){const e=v(r);if(W(e,{recursive:!0,mode:448}),!B(e).isDirectory())throw new Error(`index directory is not a real directory: ${e}`);const t=X(r,R.O_RDWR|R.O_CREAT|(R.O_NOFOLLOW??0),384);try{if(!y(t).isFile())throw new Error("index database path is not a regular file")}finally{w(t)}process.platform!=="win32"&&g(r,384)}E(I,"U"),a(I,"secureFile");function L(r){const e=r.prepare("SELECT value FROM meta WHERE key = 'extractor'").get();if(!(Number(e?.value)>=l)){r.exec("BEGIN IMMEDIATE");try{Number(r.prepare("SELECT value FROM meta WHERE key = 'extractor'").get()?.value)>=l||(r.exec("DELETE FROM defs_fts; DELETE FROM refs; DELETE FROM defs; DELETE FROM files; DELETE FROM blobs;"),r.exec("UPDATE roots SET total = 0, pending = 0, complete = 0, last_scan = 0"),r.prepare("INSERT OR REPLACE INTO meta(key, value) VALUES ('extractor', ?)").run(String(l))),r.exec("COMMIT")}catch(t){throw r.exec("ROLLBACK"),t}}}E(L,"F"),a(L,"resetIfExtractorChanged");function O(r){I(r);const e=H(r);try{e.exec("PRAGMA busy_timeout = 10000"),e.exec("PRAGMA journal_mode = WAL"),e.exec("PRAGMA synchronous = NORMAL");const t=c(e);if(t!==void 0&&t>d)return{db:e,path:r,readOnly:!0};if(t===d)return L(e),{db:e,path:r,readOnly:!1};e.exec("BEGIN IMMEDIATE");try{const o=c(e);if(o===void 0||o<d){for(const s of P)e.exec(`DROP TABLE IF EXISTS ${s}`);e.exec(x),e.prepare("INSERT INTO meta(key, value) VALUES ('schema', ?)").run(String(d)),e.prepare("INSERT INTO meta(key, value) VALUES ('extractor', ?)").run(String(l))}e.exec("COMMIT")}catch(o){throw e.exec("ROLLBACK"),o}return{db:e,path:r,readOnly:c(e)!==d}}catch(t){throw e.close(),t}}E(O,"C"),a(O,"openStore");function u(r){let e=0;for(const t of["","-wal","-shm"])try{e+=G(r+t).size}catch{}return e}E(u,"v"),a(u,"storeBytes");function b(r,e){const t=r.db.prepare("SELECT id FROM roots WHERE path = ?").get(e);return t?t.id:r.readOnly?-1:(r.db.prepare("INSERT OR IGNORE INTO roots(path) VALUES (?)").run(e),r.db.prepare("SELECT id FROM roots WHERE path = ?").get(e).id)}E(b,"B"),a(b,"rootId");function m(r,e){const t=r.db.prepare("SELECT * FROM roots WHERE id = ?").get(e);if(t)return{id:t.id,path:t.path,total:t.total,pending:t.pending,complete:t.complete===1,lastScan:t.last_scan,note:t.note??void 0,owner:t.owner??void 0,heartbeat:t.heartbeat}}E(m,"W"),a(m,"rootState");const f=3e4;function S(r,e,t,o=Date.now()){const{db:s}=r;s.exec("BEGIN IMMEDIATE");try{const i=s.prepare("SELECT owner, heartbeat FROM roots WHERE id = ?").get(e),T=!i?.owner||i.owner===t||o-i.heartbeat>f;return T&&s.prepare("UPDATE roots SET owner = ?, heartbeat = ? WHERE id = ?").run(t,o,e),s.exec("COMMIT"),T}catch(i){throw s.exec("ROLLBACK"),i}}E(S,"X"),a(S,"acquireRoot");function h(r,e,t){r.db.prepare("UPDATE roots SET owner = NULL WHERE id = ? AND owner = ?").run(e,t)}E(h,"G"),a(h,"releaseRoot");function A(r,e,t,o=Date.now()){return Number(r.db.prepare("UPDATE roots SET heartbeat = ? WHERE id = ? AND owner = ?").run(o,e,t).changes)>0}E(A,"H"),a(A,"heartbeat");function U(r,e,t){const o=[],s=[];t.total!==void 0&&(o.push("total = ?"),s.push(t.total)),t.pending!==void 0&&(o.push("pending = ?"),s.push(t.pending)),t.complete!==void 0&&(o.push("complete = ?"),s.push(t.complete?1:0)),t.lastScan!==void 0&&(o.push("last_scan = ?"),s.push(t.lastScan)),t.note!==void 0&&(o.push("note = ?"),s.push(t.note)),o.length!==0&&r.db.prepare(`UPDATE roots SET ${o.join(", ")} WHERE id = ?`).run(...s,e)}E(U,"P"),a(U,"updateRootProgress");function _(r,e,t=Date.now()){r.readOnly||r.db.prepare("UPDATE roots SET last_used = ? WHERE id = ?").run(t,e)}E(_,"k"),a(_,"touchRoot");function M(r,e){const t=new Map,o=r.db.prepare("SELECT path, size, mtime_ms FROM files WHERE root_id = ?").all(e);for(const s of o)t.set(s.path,{size:s.size,mtimeMs:s.mtime_ms});return t}E(M,"V"),a(M,"fileStamps");function N(r){const e=r.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean).map(t=>t.toLowerCase());return[r,...e].join(" ")}E(N,"p"),a(N,"identifierWords");class k{static{E(this,"z")}static{a(this,"StoreWriter")}store;nameIds=new Map;statements;constructor(e){if(e.readOnly)throw new Error("index was written by a newer DAL; it is read-only");this.store=e,this.statements=this.prepare()}prepare(){const{db:e}=this.store;return{findName:e.prepare("SELECT id FROM names WHERE name = ?"),insertName:e.prepare("INSERT INTO names(name) VALUES (?)"),findBlob:e.prepare("SELECT id FROM blobs WHERE hash = ?"),insertBlob:e.prepare("INSERT INTO blobs(hash, language) VALUES (?, ?)"),insertDef:e.prepare("INSERT INTO defs(blob_id, name_id, kind, line, end_line, col, parent, container, signature, doc) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"),insertFts:e.prepare("INSERT INTO defs_fts(rowid, words, doc) VALUES (?, ?, ?)"),insertRef:e.prepare("INSERT OR IGNORE INTO refs(blob_id, name_id, line, col, kind, caller) VALUES (?, ?, ?, ?, ?, ?)"),fileBlob:e.prepare("SELECT blob_id FROM files WHERE root_id = ? AND path = ?"),upsertFile:e.prepare("INSERT INTO files(root_id, path, blob_id, size, mtime_ms) VALUES (?, ?, ?, ?, ?) ON CONFLICT(root_id, path) DO UPDATE SET blob_id = excluded.blob_id, size = excluded.size, mtime_ms = excluded.mtime_ms"),deleteFile:e.prepare("DELETE FROM files WHERE root_id = ? AND path = ?"),blobUsed:e.prepare("SELECT 1 FROM files WHERE blob_id = ? LIMIT 1"),blobDefIds:e.prepare("SELECT id FROM defs WHERE blob_id = ?"),deleteFts:e.prepare("DELETE FROM defs_fts WHERE rowid = ?"),deleteDefs:e.prepare("DELETE FROM defs WHERE blob_id = ?"),deleteRefs:e.prepare("DELETE FROM refs WHERE blob_id = ?"),deleteBlob:e.prepare("DELETE FROM blobs WHERE id = ?"),blobHash:e.prepare("SELECT hash FROM blobs WHERE id = ?"),deleteVector:e.prepare("DELETE FROM vectors WHERE hash = ?")}}nameId(e){const t=this.nameIds.get(e);if(t!==void 0)return t;const o=this.statements.findName.get(e),s=o?o.id:Number(this.statements.insertName.run(e).lastInsertRowid);return this.nameIds.size>2e5&&this.nameIds.clear(),this.nameIds.set(e,s),s}knownBlob(e){return this.statements.findBlob.get(e)?.id}addBlob(e,t,o){const s=this.statements,i=Number(s.insertBlob.run(e,t??null).lastInsertRowid),T=[];for(const n of o.definitions){const F=n.parent>=0?T[n.parent]??null:null,p=Number(s.insertDef.run(i,this.nameId(n.name),n.kind,n.line,n.endLine,n.column,F,n.container??null,n.signature,n.doc??null).lastInsertRowid);T.push(p),s.insertFts.run(p,`${N(n.name)} ${n.container?N(n.container):""}`,n.doc??"")}for(const n of o.references)s.insertRef.run(i,this.nameId(n.name),n.line,n.column,n.kind,n.caller>=0?T[n.caller]??null:null);return i}dropBlobIfUnused(e){const t=this.statements;if(t.blobUsed.get(e))return;for(const s of t.blobDefIds.all(e))t.deleteFts.run(s.id);t.deleteDefs.run(e),t.deleteRefs.run(e);const o=t.blobHash.get(e)?.hash;o&&t.deleteVector.run(o),t.deleteBlob.run(e)}setFile(e,t,o,s){const i=this.statements,T=i.fileBlob.get(e,t)?.blob_id;i.upsertFile.run(e,t,o,s.size,Math.trunc(s.mtimeMs)),T!==void 0&&T!==o&&this.dropBlobIfUnused(T)}removeFile(e,t){const o=this.statements,s=o.fileBlob.get(e,t)?.blob_id;s!==void 0&&(o.deleteFile.run(e,t),this.dropBlobIfUnused(s))}transaction(e){const{db:t}=this.store;t.exec("BEGIN IMMEDIATE");try{const o=e();return t.exec("COMMIT"),o}catch(o){throw t.exec("ROLLBACK"),o}}}export{l as EXTRACTOR_VERSION,f as LOCK_STALE_MS,d as STORE_SCHEMA_VERSION,k as StoreWriter,S as acquireRoot,M as fileStamps,A as heartbeat,N as identifierWords,O as openStore,h as releaseRoot,b as rootId,m as rootState,u as storeBytes,_ as touchRoot,U as updateRootProgress};
@@ -0,0 +1 @@
1
+ var S=Object.defineProperty;var r=(t,e)=>S(t,"name",{value:e,configurable:!0});var v=Object.defineProperty,o=r((t,e)=>v(t,"name",{value:e,configurable:!0}),"r");import{parentPort as D}from"node:worker_threads";import{embedRoot as M,syncRoot as x,updateFiles as B}from"./indexer.js";import{createEmbedder as E,MODEL_ID as O}from"./semantic.js";import{openStore as I}from"./store.js";const w=D,b=new Map;let i=!1,u=!1;const f=[],c=new Map,l=new Map;function y(t){let e=l.get(t);return e||(e=E(t),l.set(t,e),e.catch(()=>l.delete(t))),e}r(y,"f"),o(y,"embedder");function s(t){w?.postMessage(t)}r(s,"o"),o(s,"post");function h(t){let e=b.get(t);return e||(e=I(t),b.set(t,e)),e}r(h,"b"),o(h,"store");function m(t){return t instanceof Error?t.message:String(t)}r(m,"g"),o(m,"errorText");async function d(){for(;f.length>0;){const t=f.shift();try{const e=h(t.dbPath);e.readOnly||await B(e,t.root,t.paths,t.limits)}catch(e){s({type:"error",root:t.root,message:m(e)})}}}r(d,"d"),o(d,"drainFiles");async function g(){if(!u){u=!0;try{for(await d();c.size>0&&!i;){const[t,e]=c.entries().next().value;c.delete(t);try{const a=h(e.dbPath);if(a.readOnly)continue;if(!await x({store:a,rootPath:e.root,focus:e.focus,limits:e.limits,owner:e.owner,shouldStop:o(()=>i,"shouldStop"),betweenBatches:o(async()=>{await new Promise(n=>setImmediate(n)),await d()},"betweenBatches"),onProgress:o(n=>s({type:"progress",...n}),"onProgress")}))s({type:"busy",root:e.root});else if(e.semanticDir&&!i){const n=await y(e.semanticDir);await M({store:a,rootPath:e.root,model:O,embed:n,shouldStop:o(()=>i||c.size>0,"shouldStop"),betweenBatches:o(async()=>{await new Promise(p=>setImmediate(p)),await d()},"betweenBatches"),onProgress:o((p,P)=>s({type:"semantic",root:e.root,pending:p,done:P}),"onProgress")})}}catch(a){s({type:"error",root:e.root,message:m(a)})}await d()}}finally{u=!1}}}r(g,"v"),o(g,"runQueue"),w?.on("message",t=>{if(t.type==="stop"){i=!0;return}if(t.type==="embed"){y(t.semanticDir).then(e=>e([t.text])).then(([e])=>s({type:"embedded",id:t.id,vector:e}),e=>s({type:"embedded",id:t.id,error:m(e)}));return}t.type==="files"?f.push(t):c.set(`${t.dbPath}\0${t.root}`,t),g()});
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-compat",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "private": true,
5
5
  "description": "Claude Code compatibility: the user's and project's .claude/rules/ and .claude/CLAUDE.md apply in DAL. Grown from the claude-rules extension example.",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  ]
19
19
  },
20
20
  "dependencies": {
21
- "@dalcode/dal-pi-kit": "1.0.44",
21
+ "@dalcode/dal-pi-kit": "1.0.45",
22
22
  "minimatch": "10.2.6"
23
23
  },
24
24
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-dap",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "private": true,
5
5
  "description": "Debugger for DAL: breakpoints, stepping, call stacks and variables in Node.js and Python programs over the Debug Adapter Protocol, installing the adapter on first use. The DAP client is adapted from oh-my-pi's src/dap (MIT).",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  ]
25
25
  },
26
26
  "dependencies": {
27
- "@dalcode/dal-pi-kit": "1.0.44",
27
+ "@dalcode/dal-pi-kit": "1.0.45",
28
28
  "typebox": "1.3.27"
29
29
  },
30
30
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-gateway",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -17,7 +17,7 @@
17
17
  ]
18
18
  },
19
19
  "dependencies": {
20
- "@dalcode/deepailab": "1.0.44"
20
+ "@dalcode/deepailab": "1.0.45"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-goal",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "private": true,
5
5
  "description": "Goal mode for DAL: /goal keeps the agent working on one objective until it is verified complete, with token and continuation limits. Adapted from @narumitw/pi-goal 0.54.11 (MIT, narumiruna); the independent completion check adapts pi-goal-x 0.32.3 (MIT, Lucas).",
6
6
  "license": "MIT",
@@ -21,8 +21,8 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@dalcode/dal-pi-kit": "1.0.44",
25
- "@dalcode/dal-subagent": "1.0.44",
24
+ "@dalcode/dal-pi-kit": "1.0.45",
25
+ "@dalcode/dal-subagent": "1.0.45",
26
26
  "typebox": "1.3.27"
27
27
  },
28
28
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-guard",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -20,9 +20,9 @@
20
20
  ]
21
21
  },
22
22
  "dependencies": {
23
- "@dalcode/dal-pi-kit": "1.0.44",
24
- "@dalcode/dal-bridge": "1.0.44",
25
- "@dalcode/dal-halo": "1.0.44"
23
+ "@dalcode/dal-pi-kit": "1.0.45",
24
+ "@dalcode/dal-bridge": "1.0.45",
25
+ "@dalcode/dal-halo": "1.0.45"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -1,2 +1,4 @@
1
- var J=Object.defineProperty;var d=(u,a)=>J(u,"name",{value:a,configurable:!0});var K=Object.defineProperty,i=d((u,a)=>K(u,"name",{value:a,configurable:!0}),"l");import{realpathSync as G}from"node:fs";import{basename as Z,dirname as Q,isAbsolute as X,join as Y,relative as uu,resolve as eu,sep as au}from"node:path";import{readBridgeConfig as p}from"@dalcode/dal-bridge/client";import{getOwnTty as ou,requestHaloApproval as tu}from"@dalcode/dal-halo";import{hasChosenLanguage as su,t as e}from"@dalcode/dal-pi-kit";import{DAL_HOOK_NOTIFICATION_CHANNEL as ru,getAgentDir as D,registerSandboxEscalationHandler as nu,resolveToCwd as iu,shellExecutionRefusal as lu}from"@earendil-works/pi-coding-agent";import{DAL_CO_AUTHOR as O,foreignAttributionInMessageFile as du,rewriteCommitAttribution as cu}from"./attribution.js";import{credentialBlockReason as Fu,namesDalCredential as Eu,readsDalSecretCopy as Au,redactContent as mu,secretCopyBlockReason as fu}from"./credentials.js";import{exportGuardMode as Cu,saveGuardMode as P,shouldAskGuardMode as pu,startupGuardMode as Du}from"./mode.js";import{wrongPackageManager as gu}from"./package-manager.js";import{reviewBashCommand as Bu}from"./review.js";import{createWorkspaceGate as hu}from"./workspace.js";import{DAL_CO_AUTHOR as bu,foreignAttributionInMessageFile as vu,foreignCoAuthors as yu,isGitCommit as wu,rewriteCommitAttribution as Iu}from"./attribution.js";import{dalSecretValues as $u,fileHoldsDalSecret as ku,namesDalCredential as _u,REDACTED as Mu,readsDalSecretCopy as Nu,redactContent as Su,redactDalSecrets as Gu,shellPathCandidates as Ou}from"./credentials.js";import{GUARD_MODE_ENV as Pu,savedGuardMode as Ru,saveGuardMode as Tu,shouldAskGuardMode as xu,startupGuardMode as Uu}from"./mode.js";import{installingManager as ju,wrongPackageManager as Hu}from"./package-manager.js";import{reviewBashCommand as Lu,suspicionFor as zu}from"./review.js";import{createWorkspaceGate as Wu,modifiedDirectory as Vu}from"./workspace.js";const R=new Set;function T(u,a){if(u.toolName!=="bash"&&u.toolName!=="powershell")return;const o=u.input;if(typeof o.command!="string")return;const t=du(o.command,a);if(t)return{block:!0,denied:{source:"dal-guard",ruleId:"commit:attribution"},reason:e("dal-guard\uFF1A\u63D0\u4EA4\u8BF4\u660E\u6587\u4EF6 {file} \u628A\u53E6\u4E00\u4E2A\u4EA7\u54C1\u7684\u52A9\u624B\uFF08Claude\u3001Codex\u3001Copilot \u7B49\uFF09\u5199\u6210\u4E86\u5171\u540C\u4F5C\u8005\u3002\u4F60\u662F DAL Code\uFF1A\u628A\u90A3\u884C\u6539\u6210 {trailer} \u6216\u5220\u6389\uFF0C\u518D\u63D0\u4EA4\u3002").replace("{file}",t).replace("{trailer}",O)};const s=cu(o.command);s!==void 0&&(o.command=s,R.add(u.toolCallId))}d(T,"ce"),i(T,"checkCommitAttribution");function v(u){try{return G(u)}catch{try{return Y(G(Q(u)),Z(u))}catch{return u}}}d(v,"G"),i(v,"realPathBestEffort");const A=i(u=>a=>u.test(a),"has"),qu=[{id:"sudo",level:"high",label:e("\u7279\u6743\u6267\u884C\uFF08sudo/doas\uFF09"),test:A(/(^|[;&|\n]\s*)(sudo|doas)\s/)},{id:"force-push",level:"high",label:e("\u5F3A\u5236\u63A8\u9001\u5C06\u6539\u5199\u8FDC\u7A0B\u5386\u53F2"),test:A(/git\s+push\b[^;&|]*(--force\b|--force-with-lease\b|\s-f\b)/)},{id:"hard-reset",level:"high",label:e("\u786C\u91CD\u7F6E\u4F1A\u4E22\u5F03\u672C\u5730\u6539\u52A8"),test:A(/git\s+reset\b[^;&|]*--hard/)},{id:"git-clean",level:"high",label:e("git clean \u4F1A\u5220\u9664\u672A\u8DDF\u8E2A\u6587\u4EF6"),test:A(/git\s+clean\b[^;&|]*(-[a-z]*f|--force)/)},{id:"pipe-to-shell",level:"high",label:e("\u5C06\u4E0B\u8F7D\u5185\u5BB9\u76F4\u63A5\u7BA1\u9053\u6267\u884C"),test:A(/(curl|wget)\b[^;&|]*\|\s*(ba|z|da|fi)?sh\b/)},{id:"exec-download",level:"high",label:e("\u6267\u884C\u4E0B\u8F7D\u7684\u811A\u672C"),test:A(/\b(ba|z|da|fi)?sh\s+<\(\s*(curl|wget)\b|eval\b[^;&|\n]*\$\(\s*(curl|wget)\b/)},{id:"recursive-perms",label:e("\u9012\u5F52\u4FEE\u6539\u6743\u9650/\u5C5E\u4E3B"),test:A(/(chmod|chown)\b[^;&|]*-[a-zA-Z]*R/)},{id:"publish",label:e("\u53D1\u5E03\u8F6F\u4EF6\u5305"),test:A(/(npm|pnpm|yarn)\s+publish\b/)},{id:"kill",label:e("\u6309\u540D\u79F0\u7ED3\u675F\u8FDB\u7A0B"),test:A(/(^|[;&|\n]\s*)(killall|pkill)\s/)},{id:"disk",level:"high",label:e("\u5E95\u5C42\u78C1\u76D8\u64CD\u4F5C"),test:A(/(^|[;&|\n]\s*)(dd|mkfs\w*|diskutil|fdisk)\s/)}];function y(u){return qu.find(a=>a.test(u))}d(y,"me"),i(y,"riskForBash");function w(u,a){const o=v(iu(u,a)),t=v(eu(a)),s=uu(t,o);return s===".."||s.startsWith(`..${au}`)||X(s)}d(w,"ge"),i(w,"pathOutsideProject");function I(u,a){if(u.toolName.startsWith("mcp__")){const o=u.toolName.split("__")[1]||"unknown",t=JSON.stringify(u.input??{});return{ruleId:`mcp:${o}`,title:`${e("\u7B2C\u4E09\u65B9 MCP \u5DE5\u5177\u8C03\u7528\uFF08")}${o}${e("\uFF09")}`,detail:`${u.toolName} ${t.length>200?`${t.slice(0,200)}\u2026`:t}`,level:"medium"}}if(u.toolName==="bash"){const o=String(u.input.command??""),t=y(o);return t?{ruleId:`bash:${t.id}`,title:t.label,detail:o,level:t.level??"medium"}:void 0}if(u.toolName==="edit"||u.toolName==="write"){const o=String(u.input.path??u.input.file_path??"");if(o&&w(o,a))return{ruleId:`${u.toolName}:outside-project`,title:e("\u9879\u76EE\u76EE\u5F55\u4E4B\u5916\u7684\u6587\u4EF6\u6539\u52A8"),detail:o,level:"medium"}}}d(I,"pe"),i(I,"classify");async function x(u,a){if(u.toolName!=="bash")return;const o=String(u.input.command??""),t=await Bu(o,a);if(t)return{ruleId:`bash:jev-${t.suspicion.id}`,title:`${e("jev \u590D\u6838\u5224\u5B9A\u53EF\u7591")} (${Math.round(t.confidence*100)}%)`,detail:o,level:"medium"}}d(x,"he"),i(x,"secondOpinion");const Ju=i(()=>e("\u4EC5\u672C\u6B21\u5141\u8BB8"),"allowOnce"),Ku=i(()=>e("\u672C\u6B21\u4F1A\u8BDD\u5185\u5141\u8BB8\uFF08\u540C\u7C7B\u64CD\u4F5C\uFF09"),"allowSession"),Zu=i(()=>e("\u62D2\u7EDD"),"deny"),U=Symbol.for("dalcode.guard.state"),j=globalThis;j[U]??={mode:"default",sessionAllows:new Set};const c=j[U];function g(u){c.mode=u,Cu(u)}d(g,"I"),i(g,"setGuardMode");function H(){c.escalationApprover||(c.escalationApprover=nu(()=>{if(!(c.mode!=="yolo"||p(process.env)))return{approved:!0,scope:"once"}}))}d(H,"we"),i(H,"registerEscalationApprover");const B=c.sessionAllows;async function $(u,a,o,t,s,r=process.env,n){if(Eu(u,a))return{block:!0,reason:Fu(),denied:{source:"dal-guard",ruleId:"credential"}};const F=Au(u,a);if(F)return{block:!0,reason:fu(F),denied:{source:"dal-guard",ruleId:"credential:copy"}};const E=T(u,a);if(E)return E;const m=gu(u,a);if(m)return{block:!0,reason:m,denied:{source:"dal-guard",ruleId:"package-manager"}};const f=await L(u,a);if(f)return f;if(c.mode==="yolo"||p(r))return;const l=I(u,a)??await x(u,a);if(!l||B.has(l.ruleId))return;if(!o||!t)return{block:!0,denied:{source:"dal-guard",ruleId:l.ruleId},reason:`${e('dal-guard\uFF1A"')}${l.title}${e('"\u9700\u8981\u4EA4\u4E92\u5F0F\u5BA1\u6279\uFF08')}${l.detail}${e("\uFF09\u3002\u8BF7\u5728\u4EA4\u4E92\u6A21\u5F0F\u4E0B\u91CD\u8BD5\uFF0C\u6216\u7528 /guard yolo \u5173\u95ED\u5BA1\u6279\u95E8\u3002")}`};const h=s?tu({session_id:s.sessionId,cwd:a,event:"PermissionRequest",status:"waiting_for_approval",pid:process.pid,tty:ou(),tool:u.toolName,tool_input:{command:l.detail},tool_use_id:u.toolCallId,productName:"dal"}):void 0;n?.({type:"permission_prompt",message:`DAL needs your permission to use ${u.toolName}`});const k=new AbortController,[b,_,M]=[Ju(),Ku(),Zu()],V=t.select(`${e("\u9700\u8981\u5BA1\u6279\uFF1A")}${l.title} \u2014 ${l.detail}`,[b,_,M],{signal:k.signal,approval:{source:"guard",toolCallId:u.toolCallId,toolName:u.toolName,args:u.input,risk:{level:l.level,reason:l.title,ruleId:l.ruleId},title:l.title,description:l.detail,options:["allow_once","allow_session","deny"]}}).then(C=>({surface:"terminal",choice:C})),q=h?h.decision.then(C=>C===void 0?new Promise(()=>{}):{surface:"halo",choice:C==="allow"?b:M}):new Promise(()=>{}),N=await Promise.race([V,q]);N.surface==="halo"?k.abort():h?.cancel();const S=N.choice;if(S!==b){if(S===_){B.add(l.ruleId);return}return{block:!0,reason:`${e("dal-guard\uFF1A\u7528\u6237\u5DF2\u62D2\u7EDD\uFF08")}${l.title}${e("\uFF09\u3002")}`,denied:{source:"dal-guard",ruleId:l.ruleId}}}}d($,"ke"),i($,"evaluateToolCall");const Qu=new Set(["bash","powershell"]);async function L(u,a){if(!Qu.has(u.toolName))return;const o=u.input.command;if(typeof o!="string"||!o.trim())return;const t=await lu({toolName:u.toolName,command:o,cwd:a});if(t!==void 0)return{block:!0,denied:{source:"dangerous-command"},reason:`${e("dal-guard\uFF1A\u8FD9\u6761\u547D\u4EE4\u4F1A\u88AB\u5371\u9669\u547D\u4EE4\u62E6\u622A\u6321\u4E0B\uFF0C\u6CA1\u6709\u8FD0\u884C\uFF0C\u4E5F\u4E0D\u518D\u8BF7\u4F60\u786E\u8BA4\u3002")}
2
- ${t}`}}d(L,"Ae"),i(L,"destructiveCommandRefusal");async function z(u){const a=e("\u5168\u81EA\u52A8\uFF1A\u4E0D\u518D\u8BE2\u95EE\uFF0C\u53EA\u62E6\u622A\u7834\u574F\u6027\u547D\u4EE4\uFF08\u63A8\u8350\u719F\u6089\u7684\u7528\u6237\uFF09"),o=e("\u6BCF\u6B21\u8BE2\u95EE\uFF1A\u9AD8\u98CE\u9669\u64CD\u4F5C\u548C\u8D8A\u51FA\u6C99\u7BB1\u524D\u5148\u95EE\u6211"),t=await u.ui.select(e("\u9009\u62E9 dal \u7684\u5DE5\u4F5C\u65B9\u5F0F\uFF08\u4EE5\u540E\u53EF\u7528 /guard \u4FEE\u6539\uFF09"),[a,o]);if(t===void 0)return;const s=t===a?"yolo":"default";g(s);try{P(D(),s)}catch(r){u.ui.notify(`${e("\u4FDD\u5B58\u5931\u8D25\uFF1A")}${r instanceof Error?r.message:String(r)}`,"error");return}u.ui.notify(s==="yolo"?e("\u5DF2\u8BBE\u4E3A\u5168\u81EA\u52A8\u3002\u6539\u56DE\u6BCF\u6B21\u8BE2\u95EE\uFF1A/guard default save"):e("\u5DF2\u8BBE\u4E3A\u6BCF\u6B21\u8BE2\u95EE\u3002\u6539\u6210\u5168\u81EA\u52A8\uFF1A/guard yolo save"),"info")}d(z,"_e"),i(z,"askGuardModeOnce");function W(u){u.registerFlag("yolo",{description:e("\u4EE5\u5168\u81EA\u52A8\u6A21\u5F0F\u542F\u52A8\uFF1A\u4E0D\u518D\u5F39\u51FA\u4EFB\u4F55\u5BA1\u6279\uFF08\u542B\u6C99\u7BB1\u8D8A\u6743\uFF09\uFF0C\u53EA\u62E6\u622A\u7834\u574F\u6027\u547D\u4EE4\u548C\u767B\u5F55\u51ED\u636E"),type:"boolean",default:!1}),H();let a="default";u.on("session_start",async(s,r)=>{if(a="default",c.started)return;c.started=!0;const n=u.getFlag("yolo")===!0;g(Du(D(),n)),s.reason==="startup"&&pu({agentDir:D(),mode:r.mode,hasUI:r.hasUI,flag:n,underDalCode:!!p(process.env),languageChosen:su()})&&await z(r)}),u.on("before_agent_start",async()=>{if(!(c.mode===a||p(process.env)))return a=c.mode,{message:{customType:"dal-guard-mode",content:c.mode==="yolo"?e("[\u5168\u81EA\u52A8\u6A21\u5F0F] \u7528\u6237\u5F00\u542F\u4E86\u5168\u81EA\u52A8\uFF1A\u6240\u6709\u5BA1\u6279\uFF08\u5305\u62EC sandbox_escalation \u8D8A\u6743\uFF09\u90FD\u4F1A\u81EA\u52A8\u901A\u8FC7\uFF0C\u4E0D\u4F1A\u6709\u4EBA\u6765\u786E\u8BA4\u3002\u547D\u4EE4\u88AB\u6C99\u7BB1\u6321\u4F4F\u3001\u800C\u4EFB\u52A1\u786E\u5B9E\u9700\u8981\u65F6\uFF0C\u76F4\u63A5\u5E26 sandbox_escalation \u91CD\u8BD5\uFF0C\u4E0D\u8981\u505C\u4E0B\u6765\u95EE\u7528\u6237\u8981\u4E0D\u8981\u653E\u884C\u3002\u7834\u574F\u6027\u547D\u4EE4\u548C\u767B\u5F55\u51ED\u636E\u4ECD\u4F1A\u88AB\u62E6\u622A\u3002"):e("[\u5BA1\u6279\u5DF2\u6062\u590D] \u5168\u81EA\u52A8\u5DF2\u5173\u95ED\uFF1A\u8D8A\u6743\u548C\u9AD8\u98CE\u9669\u547D\u4EE4\u4F1A\u5148\u8BE2\u95EE\u7528\u6237\u3002"),display:!1}}});const o=hu(),t=new Map;u.on("tool_call",async(s,r)=>{const n=await $(s,r.cwd,r.hasUI,r.ui,{sessionId:r.sessionManager.getSessionId()},process.env,E=>u.events.emit(ru,E));if(n?.block)return n;const F=await o.check(s,r.cwd,r.sessionManager.getSessionId(),{hasUI:r.hasUI,confirm:r.hasUI?(E,m,f)=>r.ui.confirm(E,m,f?{approval:f}:void 0):void 0});return F?.block?{block:!0,reason:F.reason,denied:{source:"dal-guard",ruleId:"workspace:occupied"}}:(F?.note&&t.set(s.toolCallId,F.note),n)}),u.on("session_shutdown",async()=>{o.releaseAll()}),u.on("tool_result",async s=>{const r=mu(s.content),n=[];R.delete(s.toolCallId)&&n.push(e("[dal-guard] \u63D0\u4EA4\u91CC\u53E6\u4E00\u4E2A\u4EA7\u54C1\u52A9\u624B\u7684\u5171\u540C\u4F5C\u8005\u884C\u5DF2\u6539\u4E3A {trailer}\uFF1A\u4F60\u662F DAL Code\u3002").replace("{trailer}",O));const F=t.get(s.toolCallId);return F&&(t.delete(s.toolCallId),n.push(`[dal-guard] ${F}`)),n.length===0?r?{content:r}:void 0:{content:[...r??s.content,...n.map(E=>({type:"text",text:E}))]}}),u.registerCommand("guard",{description:e("\u67E5\u770B\u6216\u5207\u6362\u5BA1\u6279\u95E8\uFF08default | yolo\uFF0C\u52A0 save \u8BB0\u4E3A\u9ED8\u8BA4\uFF09"),handler:i(async(s,r)=>{const[n,F]=s.trim().split(/\s+/);if((n==="yolo"||n==="default")&&(g(n),F==="save"))try{P(D(),n),r.ui.notify(n==="yolo"?e("\u5DF2\u8BBE\u4E3A\u9ED8\u8BA4\uFF1A\u4EE5\u540E\u542F\u52A8\u90FD\u662F\u5168\u81EA\u52A8"):e("\u5DF2\u6062\u590D\u9ED8\u8BA4\uFF1A\u4EE5\u540E\u542F\u52A8\u90FD\u4F1A\u8BE2\u95EE"),"info")}catch(m){r.ui.notify(`${e("\u4FDD\u5B58\u5931\u8D25\uFF1A")}${m instanceof Error?m.message:String(m)}`,"error")}const E=B.size?`${e(" \xB7 \u672C\u6B21\u4F1A\u8BDD\u5DF2\u5141\u8BB8\uFF1A")}${[...B].join(", ")}`:"";r.ui.notify(`${e("dal-guard \u6A21\u5F0F\uFF1A")}${c.mode}${E}`,c.mode==="yolo"?"warning":"info")},"handler")})}d(W,"$e"),i(W,"default");export{bu as DAL_CO_AUTHOR,Pu as GUARD_MODE_ENV,Mu as REDACTED,I as classify,Wu as createWorkspaceGate,$u as dalSecretValues,W as default,$ as evaluateToolCall,ku as fileHoldsDalSecret,vu as foreignAttributionInMessageFile,yu as foreignCoAuthors,ju as installingManager,wu as isGitCommit,Vu as modifiedDirectory,_u as namesDalCredential,w as pathOutsideProject,Nu as readsDalSecretCopy,Su as redactContent,Gu as redactDalSecrets,Lu as reviewBashCommand,Iu as rewriteCommitAttribution,y as riskForBash,Tu as saveGuardMode,Ru as savedGuardMode,Ou as shellPathCandidates,xu as shouldAskGuardMode,Uu as startupGuardMode,zu as suspicionFor,Hu as wrongPackageManager};
1
+ var tu=Object.defineProperty;var E=(u,a)=>tu(u,"name",{value:a,configurable:!0});var ru=Object.defineProperty,n=E((u,a)=>ru(u,"name",{value:a,configurable:!0}),"s");import{readBridgeConfig as D}from"@dalcode/dal-bridge/client";import{getOwnTty as nu,requestHaloApproval as iu}from"@dalcode/dal-halo";import{hasChosenLanguage as Fu,t as o}from"@dalcode/dal-pi-kit";import{DAL_HOOK_NOTIFICATION_CHANNEL as du,getAgentDir as g,registerSandboxEscalationHandler as lu,shellExecutionRefusal as cu}from"@earendil-works/pi-coding-agent";import{DAL_CO_AUTHOR as x,foreignAttributionInMessageFile as Eu,rewriteCommitAttribution as Cu}from"./attribution.js";import{credentialBlockReason as Au,namesDalCredential as mu,readsDalSecretCopy as Du,redactContent as pu,secretCopyBlockReason as fu}from"./credentials.js";import{DEFAULT_GUARD_MODE as b,exportGuardMode as Bu,GUARD_MODES as v,guardModeLabel as p,guardModeSummary as _,nextGuardMode as T,parseGuardMode as L,savedGuardMode as gu,saveGuardMode as G,shouldAskGuardMode as hu,startupGuardMode as yu}from"./mode.js";import{wrongPackageManager as vu}from"./package-manager.js";import{riskInMode as j}from"./policy.js";import{reviewBashCommand as wu}from"./review.js";import{createWorkspaceGate as Mu}from"./workspace.js";import{DAL_CO_AUTHOR as bu,foreignAttributionInMessageFile as Iu,foreignCoAuthors as _u,isGitCommit as Gu,rewriteCommitAttribution as ku}from"./attribution.js";import{dalSecretValues as Su,fileHoldsDalSecret as Ou,namesDalCredential as $u,REDACTED as Uu,readsDalSecretCopy as Nu,redactContent as Ru,redactDalSecrets as Pu,shellPathCandidates as xu}from"./credentials.js";import{DEFAULT_GUARD_MODE as Tu,GUARD_MODE_ENV as Lu,GUARD_MODES as ju,guardModeLabel as Hu,nextGuardMode as Vu,parseGuardMode as Wu,savedGuardMode as qu,saveGuardMode as zu,shouldAskGuardMode as Ku,startupGuardMode as Ju}from"./mode.js";import{installingManager as Xu,wrongPackageManager as Yu}from"./package-manager.js";import{classify as Zu,classifyCall as Qu,classifyCommand as ue,isProtectedProjectPath as ee,modeAsks as oe,pathOutsideProject as ae,riskForBash as se,riskInMode as te}from"./policy.js";import{reviewBashCommand as re,suspicionFor as ne}from"./review.js";import{createWorkspaceGate as ie,modifiedDirectory as Fe}from"./workspace.js";const H=new Set;function V(u,a){if(u.toolName!=="bash"&&u.toolName!=="powershell")return;const s=u.input;if(typeof s.command!="string")return;const i=Eu(s.command,a);if(i)return{block:!0,denied:{source:"dal-guard",ruleId:"commit:attribution"},reason:o("dal-guard\uFF1A\u63D0\u4EA4\u8BF4\u660E\u6587\u4EF6 {file} \u628A\u53E6\u4E00\u4E2A\u4EA7\u54C1\u7684\u52A9\u624B\uFF08Claude\u3001Codex\u3001Copilot \u7B49\uFF09\u5199\u6210\u4E86\u5171\u540C\u4F5C\u8005\u3002\u4F60\u662F DAL Code\uFF1A\u628A\u90A3\u884C\u6539\u6210 {trailer} \u6216\u5220\u6389\uFF0C\u518D\u63D0\u4EA4\u3002").replace("{file}",i).replace("{trailer}",x)};const C=Cu(s.command);C!==void 0&&(s.command=C,H.add(u.toolCallId))}E(V,"pe"),n(V,"checkCommitAttribution");async function W(u,a){if(u.toolName!=="bash")return;const s=String(u.input.command??""),i=await wu(s,a);if(i)return{ruleId:`bash:jev-${i.suspicion.id}`,title:`${o("jev \u590D\u6838\u5224\u5B9A\u53EF\u7591")} (${Math.round(i.confidence*100)}%)`,detail:s,level:"medium"}}E(W,"ge"),n(W,"secondOpinion");const de=n(()=>o("\u4EC5\u672C\u6B21\u5141\u8BB8"),"allowOnce"),le=n(()=>o("\u672C\u6B21\u4F1A\u8BDD\u5185\u5141\u8BB8\uFF08\u540C\u7C7B\u64CD\u4F5C\uFF09"),"allowSession"),ce=n(()=>o("\u62D2\u7EDD"),"deny"),q=Symbol.for("dalcode.guard.state"),z=globalThis;z[q]??={mode:b,sessionAllows:new Set};const t=z[q];function K(){return t.mode}E(K,"je"),n(K,"currentGuardMode");function f(u){t.mode=u,Bu(u),t.onModeChange?.(u)}E(f,"I"),n(f,"setGuardMode");function J(){t.escalationApprover||(t.escalationApprover=lu(()=>{if(!(t.mode!=="yolo"||D(process.env)))return{approved:!0,scope:"once"}}))}E(J,"we"),n(J,"registerEscalationApprover");const w=t.sessionAllows;t.answeredCalls??=new Set;const X=t.answeredCalls;async function k(u,a,s,i,C,B=process.env,h){if(mu(u,a))return{block:!0,reason:Au(),denied:{source:"dal-guard",ruleId:"credential"}};const r=Du(u,a);if(r)return{block:!0,reason:fu(r),denied:{source:"dal-guard",ruleId:"credential:copy"}};const e=V(u,a);if(e)return e;const F=vu(u,a);if(F)return{block:!0,reason:F,denied:{source:"dal-guard",ruleId:"package-manager"}};const d=await Z(u,a);if(d)return d;if(D(B))return;const l=t.mode,c=j(l,u,a)??(l==="yolo"?void 0:await W(u,a));if(!c||w.has(c.ruleId)||X.delete(u.toolCallId))return;if(!s||!i)return{block:!0,denied:{source:"dal-guard",ruleId:c.ruleId},reason:`${o('dal-guard\uFF1A"{title}"\u9700\u8981\u7528\u6237\u6279\u51C6\uFF08{detail}\uFF09\uFF0C\u5F53\u524D\u6743\u9650\u6A21\u5F0F\u662F\u300C{mode}\u300D\uFF0C\u800C\u8FD9\u91CC\u6CA1\u6709\u4EBA\u53EF\u4EE5\u786E\u8BA4\uFF08\u65E0\u754C\u9762\u8FD0\u884C\u6216\u5B50\u52A9\u624B\uFF09\u3002\u53EF\u5728\u4EA4\u4E92\u6A21\u5F0F\u4E0B\u91CD\u8BD5\uFF0C\u6216\u7528 --permission-mode \u6362\u6210\u4E0D\u9700\u8981\u8BE2\u95EE\u5B83\u7684\u6A21\u5F0F\u3002').replace("{title}",()=>c.title).replace("{detail}",()=>c.detail).replace("{mode}",()=>p(l))}
2
+ ${Y(u.toolName)}`};const A=C?iu({session_id:C.sessionId,cwd:a,event:"PermissionRequest",status:"waiting_for_approval",pid:process.pid,tty:nu(),tool:u.toolName,tool_input:{command:c.detail},tool_use_id:u.toolCallId,productName:"dal"}):void 0;h?.({type:"permission_prompt",message:`DAL needs your permission to use ${u.toolName}`});const m=new AbortController,[y,U,N]=[de(),le(),ce()],au=i.select(`${o("\u9700\u8981\u5BA1\u6279\uFF1A")}${c.title} \u2014 ${c.detail}`,[y,U,N],{signal:m.signal,approval:{source:"guard",toolCallId:u.toolCallId,toolName:u.toolName,args:u.input,risk:{level:c.level,reason:c.title,ruleId:c.ruleId},title:c.title,description:c.detail,options:["allow_once","allow_session","deny"]}}).then(M=>({surface:"terminal",choice:M})),su=A?A.decision.then(M=>M===void 0?new Promise(()=>{}):{surface:"halo",choice:M==="allow"?y:N}):new Promise(()=>{}),R=await Promise.race([au,su]);R.surface==="halo"?m.abort():A?.cancel();const P=R.choice;if(P===y){u.toolName.startsWith("mcp__")&&X.add(u.toolCallId);return}if(P===U){w.add(c.ruleId);return}return{block:!0,reason:`${o("dal-guard\uFF1A\u7528\u6237\u5DF2\u62D2\u7EDD\uFF08")}${c.title}${o("\uFF09\u3002")}`,denied:{source:"dal-guard",ruleId:c.ruleId}}}E(k,"Me"),n(k,"evaluateToolCall");function Y(u){return u.startsWith("mcp__")?o("\u4E0D\u8981\u505C\u4E0B\u6765\u8BF7\u7528\u6237\u6279\u51C6\uFF0C\u4E5F\u4E0D\u8981\u91CD\u590D\u8FD9\u4E2A\u8C03\u7528\uFF1A\u6539\u7528\u5185\u7F6E\u5DE5\u5177\u5B8C\u6210\u4EFB\u52A1\u3002\u8BFB\u7F51\u9875\u7528 web_fetch\u3001\u641C\u7D22\u7528 web_search\uFF08\u4E0D\u5728\u5DE5\u5177\u5217\u8868\u91CC\u65F6\u5148\u7528 tool_catalog \u6FC0\u6D3B web \u5206\u7EC4\uFF09\uFF0C\u8BFB\u6587\u4EF6\u7528 read / grep\uFF1B\u5185\u7F6E\u5DE5\u5177\u786E\u5B9E\u505A\u4E0D\u5230\u65F6\uFF0C\u518D\u8BF4\u660E\u7F3A\u4E86\u4EC0\u4E48\u3002"):o("\u4E0D\u8981\u505C\u4E0B\u6765\u8BF7\u7528\u6237\u6279\u51C6\uFF0C\u4E5F\u4E0D\u8981\u91CD\u590D\u8FD9\u4E2A\u8C03\u7528\uFF1A\u6539\u7528\u8FD9\u4E2A\u6A21\u5F0F\u5141\u8BB8\u7684\u5DE5\u5177\u7EE7\u7EED\uFF08\u8BFB\u6587\u4EF6\u7528 read / grep / find\uFF0C\u8BFB\u7F51\u9875\u7528 web_fetch\uFF09\uFF1B\u786E\u5B9E\u505A\u4E0D\u5230\u65F6\uFF0C\u518D\u8BF4\u660E\u7F3A\u4E86\u4EC0\u4E48\u3002")}E(Y,"be"),n(Y,"headlessAlternative");const Ee=new Set(["bash","powershell"]);async function Z(u,a){if(!Ee.has(u.toolName))return;const s=u.input.command;if(typeof s!="string"||!s.trim())return;const i=await cu({toolName:u.toolName,command:s,cwd:a});if(i!==void 0)return{block:!0,denied:{source:"dangerous-command"},reason:`${o("dal-guard\uFF1A\u8FD9\u6761\u547D\u4EE4\u4F1A\u88AB\u5371\u9669\u547D\u4EE4\u62E6\u622A\u6321\u4E0B\uFF0C\u6CA1\u6709\u8FD0\u884C\uFF0C\u4E5F\u4E0D\u518D\u8BF7\u4F60\u786E\u8BA4\u3002")}
3
+ ${i}`}}E(Z,"Ie"),n(Z,"destructiveCommandRefusal");function S(u){return`${p(u)} \u2014 ${_(u)}`}E(S,"j"),n(S,"modeChoice");function I(u){return o("\u6743\u9650\u6A21\u5F0F\uFF1A{mode} \u2014 {summary}").replace("{mode}",()=>p(u)).replace("{summary}",()=>_(u))}E(I,"S"),n(I,"modeNotice");function O(u){return`${o("\u4FDD\u5B58\u5931\u8D25\uFF1A")}${u instanceof Error?u.message:String(u)}`}E(O,"B"),n(O,"saveFailure");async function Q(u){const a=["auto","default","yolo"],s=a.map(S),i=await u.ui.select(o("\u9009\u62E9 dal \u7684\u6743\u9650\u6A21\u5F0F\uFF08\u4EE5\u540E\u53EF\u7528 /guard \u4FEE\u6539\uFF09"),s),C=a[s.indexOf(i??"")];if(C!==void 0){f(C);try{G(g(),C)}catch(B){u.ui.notify(O(B),"error");return}u.ui.notify(`${I(C)}${o(" \xB7 \u4EE5\u540E\u53EF\u7528 /guard \u4FEE\u6539")}`,"info")}}E(Q,"ke"),n(Q,"askGuardModeOnce");function uu(u){switch(u){case"yolo":return o("[\u5B8C\u5168\u81EA\u52A8] \u7528\u6237\u5F00\u542F\u4E86\u5B8C\u5168\u81EA\u52A8\uFF1A\u9664 sudo\u3001\u7BA1\u9053\u6267\u884C\u4E0B\u8F7D\u7684\u811A\u672C\u3001\u5E95\u5C42\u78C1\u76D8\u64CD\u4F5C\u3001\u5F3A\u5236\u63A8\u9001\u548C\u5199\u5230\u9879\u76EE\u5916\u6216\u53D7\u4FDD\u62A4\u7684\u6587\u4EF6\u5916\uFF0C\u6240\u6709\u64CD\u4F5C\u548C sandbox_escalation \u8D8A\u6743\u90FD\u4F1A\u81EA\u52A8\u901A\u8FC7\uFF0C\u4E0D\u4F1A\u6709\u4EBA\u6765\u786E\u8BA4\u3002\u547D\u4EE4\u88AB\u6C99\u7BB1\u6321\u4F4F\u3001\u800C\u4EFB\u52A1\u786E\u5B9E\u9700\u8981\u65F6\uFF0C\u76F4\u63A5\u5E26 sandbox_escalation \u91CD\u8BD5\uFF0C\u4E0D\u8981\u505C\u4E0B\u6765\u95EE\u7528\u6237\u8981\u4E0D\u8981\u653E\u884C\u3002\u7834\u574F\u6027\u547D\u4EE4\u548C\u767B\u5F55\u51ED\u636E\u4ECD\u4F1A\u88AB\u62E6\u622A\u3002");case"auto":return o("[\u667A\u80FD\u81EA\u52A8] \u6539\u6587\u4EF6\u3001\u666E\u901A\u547D\u4EE4\u3001\u672C\u5730 git \u64CD\u4F5C\u76F4\u63A5\u6267\u884C\uFF1B\u5220\u9664\u6587\u4EF6\u3001git push\u3001\u6539\u5199\u5386\u53F2\u7B49\u9AD8\u98CE\u9669\u64CD\u4F5C\u548C\u6C99\u7BB1\u8D8A\u6743\u4F1A\u5148\u8BE2\u95EE\u7528\u6237\u3002\u4E0D\u8981\u5728\u56DE\u590D\u91CC\u5148\u5F81\u6C42\u540C\u610F\uFF0C\u76F4\u63A5\u8C03\u7528\u5DE5\u5177\uFF0C\u9700\u8981\u65F6\u7CFB\u7EDF\u4F1A\u8BE2\u95EE\u3002");case"acceptEdits":return o("[\u81EA\u52A8\u63A5\u53D7\u7F16\u8F91] \u9879\u76EE\u5185\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF1B\u8FD0\u884C\u547D\u4EE4\u548C\u8C03\u7528\u5176\u4ED6\u5DE5\u5177\u524D\u4F1A\u5148\u8BE2\u95EE\u7528\u6237\u3002\u4E0D\u8981\u5728\u56DE\u590D\u91CC\u5148\u5F81\u6C42\u540C\u610F\uFF0C\u76F4\u63A5\u8C03\u7528\u5DE5\u5177\uFF0C\u9700\u8981\u65F6\u7CFB\u7EDF\u4F1A\u8BE2\u95EE\u3002");case"default":return o("[\u6BCF\u6B21\u8BE2\u95EE] \u53EA\u8BFB\u64CD\u4F5C\u76F4\u63A5\u6267\u884C\uFF1B\u6539\u6587\u4EF6\u3001\u8FD0\u884C\u547D\u4EE4\u548C\u8C03\u7528\u5176\u4ED6\u5DE5\u5177\u524D\u90FD\u4F1A\u5148\u8BE2\u95EE\u7528\u6237\u3002\u4E0D\u8981\u5728\u56DE\u590D\u91CC\u5148\u5F81\u6C42\u540C\u610F\uFF0C\u76F4\u63A5\u8C03\u7528\u5DE5\u5177\uFF0C\u7CFB\u7EDF\u4F1A\u8BE2\u95EE\u3002")}}E(uu,"_e"),n(uu,"modeAnnouncement");function $(){const u=gu(g());return{mode:t.mode,...u?{saved:u}:{},enforced:!D(process.env)}}E($,"W"),n($,"permissionModeStatus");function eu(u,a){if(D(process.env))return!1;const s={type:"tool_call",toolCallId:"",toolName:u,input:{}},i=j(t.mode,s,a);return i!==void 0&&!w.has(i.ruleId)}E(eu,"Ee"),n(eu,"wouldAsk");const Ce=Symbol.for("dalcode.guard.modeApi");globalThis[Ce]={get:$,wouldAsk:eu,set(u){const a=L(u.mode);if(!a)return{error:`mode must be one of ${v.join(", ")}`};if(u.save!==void 0&&typeof u.save!="boolean")return{error:"save must be a boolean or omitted"};if(u.save)try{G(g(),a)}catch(s){return{error:s instanceof Error?s.message:String(s)}}return f(a),$()}};const Ae="dal-guard";function ou(u){u.registerFlag("permission-mode",{description:o("\u4EE5\u6307\u5B9A\u6743\u9650\u6A21\u5F0F\u542F\u52A8\uFF1Adefault\uFF08\u6BCF\u6B21\u8BE2\u95EE\uFF09\u3001acceptEdits\uFF08\u81EA\u52A8\u63A5\u53D7\u7F16\u8F91\uFF09\u3001auto\uFF08\u667A\u80FD\u81EA\u52A8\uFF0C\u9ED8\u8BA4\uFF09\u3001yolo\uFF08\u5B8C\u5168\u81EA\u52A8\uFF09"),type:"string"}),u.registerFlag("yolo",{description:o("\u4EE5\u5B8C\u5168\u81EA\u52A8\u6A21\u5F0F\u542F\u52A8\uFF0C\u7B49\u540C\u4E8E --permission-mode yolo"),type:"boolean",default:!1}),J();let a;const s=n(r=>{!a||D(process.env)||a.setStatus(Ae,r===b?void 0:o("\u6743\u9650\uFF1A{mode}").replace("{mode}",()=>p(r)))},"showMode");t.onModeChange=s;let i=b;u.on("session_start",async(r,e)=>{if(i=b,a=e.hasUI?e.ui:void 0,t.started){s(t.mode);return}t.started=!0;const F=u.getFlag("permission-mode"),d=yu(g(),{flag:typeof F=="string"?F:void 0,yoloFlag:u.getFlag("yolo")===!0});if(f(d.mode),d.invalid){const l=o("\u6743\u9650\u6A21\u5F0F {value} \u65E0\u6548\uFF08\u6765\u81EA {source}\uFF09\uFF0C\u53EF\u9009 {modes}\uFF1B\u672C\u6B21\u4F7F\u7528\u300C{mode}\u300D\u3002").replace("{value}",()=>d.invalid?.value??"").replace("{source}",()=>d.invalid?.source==="flag"?"--permission-mode":"DAL_GUARD_MODE").replace("{modes}",()=>v.join(" | ")).replace("{mode}",()=>p(d.mode));e.hasUI?e.ui.notify(l,"error"):process.stderr.write(`${l}
4
+ `)}r.reason==="startup"&&hu({agentDir:g(),mode:e.mode,hasUI:e.hasUI,source:d.source,underDalCode:!!D(process.env),languageChosen:Fu()})&&await Q(e)}),u.on("before_agent_start",async()=>{if(!(t.mode===i||D(process.env)))return i=t.mode,{message:{customType:"dal-guard-mode",content:uu(t.mode),display:!1}}});let C=!1;u.registerShortcut("alt+m",{keybinding:"app.permission.cycle",description:o("\u5207\u6362\u6743\u9650\u6A21\u5F0F"),handler:n(async r=>{let e=T(t.mode);e==="yolo"&&!C&&(C=await r.ui.confirm(o("\u5207\u6362\u5230\u5B8C\u5168\u81EA\u52A8\uFF1F"),_("yolo")),C||(e=T(e))),f(e),r.ui.notify(I(e),e==="yolo"?"warning":"info")},"handler")});const B=Mu(),h=new Map;u.on("tool_call",async(r,e)=>{const F=await k(r,e.cwd,e.hasUI,e.ui,{sessionId:e.sessionManager.getSessionId()},process.env,l=>u.events.emit(du,l));if(F?.block)return F;const d=await B.check(r,e.cwd,e.sessionManager.getSessionId(),{hasUI:e.hasUI,confirm:e.hasUI?(l,c,A)=>e.ui.confirm(l,c,A?{approval:A}:void 0):void 0});return d?.block?{block:!0,reason:d.reason,denied:{source:"dal-guard",ruleId:"workspace:occupied"}}:(d?.note&&h.set(r.toolCallId,d.note),F)}),u.on("session_shutdown",async()=>{B.releaseAll()}),u.on("tool_result",async r=>{const e=pu(r.content),F=[];H.delete(r.toolCallId)&&F.push(o("[dal-guard] \u63D0\u4EA4\u91CC\u53E6\u4E00\u4E2A\u4EA7\u54C1\u52A9\u624B\u7684\u5171\u540C\u4F5C\u8005\u884C\u5DF2\u6539\u4E3A {trailer}\uFF1A\u4F60\u662F DAL Code\u3002").replace("{trailer}",x));const d=h.get(r.toolCallId);return d&&(h.delete(r.toolCallId),F.push(`[dal-guard] ${d}`)),F.length===0?e?{content:e}:void 0:{content:[...e??r.content,...F.map(l=>({type:"text",text:l}))]}}),u.registerCommand("guard",{description:o("\u67E5\u770B\u6216\u5207\u6362\u6743\u9650\u6A21\u5F0F\uFF1Adefault\uFF08\u6BCF\u6B21\u8BE2\u95EE\uFF09| acceptEdits\uFF08\u81EA\u52A8\u63A5\u53D7\u7F16\u8F91\uFF09| auto\uFF08\u667A\u80FD\u81EA\u52A8\uFF09| yolo\uFF08\u5B8C\u5168\u81EA\u52A8\uFF09\uFF1B\u52A0 save \u8BB0\u4E3A\u9ED8\u8BA4"),handler:n(async(r,e)=>{const[F,d]=r.trim().split(/\s+/);let l=F?L(F):void 0;if(F&&!l){e.ui.notify(o("\u6CA1\u6709\u8FD9\u4E2A\u6743\u9650\u6A21\u5F0F\uFF1A{value}\u3002\u53EF\u9009 {modes}").replace("{value}",()=>F).replace("{modes}",()=>v.join(" | ")),"error");return}if(!F&&e.hasUI){const m=v.map(S),y=await e.ui.select(o("\u9009\u62E9\u6743\u9650\u6A21\u5F0F\uFF08\u5F53\u524D\uFF1A{mode}\uFF09").replace("{mode}",()=>p(t.mode)),m);l=v[m.indexOf(y??"")]}if(l&&(f(l),d==="save"))try{G(g(),l),e.ui.notify(o("\u5DF2\u8BBE\u4E3A\u9ED8\u8BA4\uFF1A\u4EE5\u540E\u542F\u52A8\u90FD\u662F\u300C{mode}\u300D").replace("{mode}",()=>p(l)),"info")}catch(m){e.ui.notify(O(m),"error")}const c=w.size?`${o(" \xB7 \u672C\u6B21\u4F1A\u8BDD\u5DF2\u5141\u8BB8\uFF1A")}${[...w].join(", ")}`:"",A=l&&d!=="save"?o(" \xB7 \u53EA\u5BF9\u672C\u6B21\u8FD0\u884C\u751F\u6548\uFF0C\u52A0 save \u8BB0\u4E3A\u9ED8\u8BA4"):"";e.ui.notify(`${I(t.mode)}${c}${A}`,t.mode==="yolo"?"warning":"info")},"handler")})}E(ou,"Se"),n(ou,"default");export{bu as DAL_CO_AUTHOR,Tu as DEFAULT_GUARD_MODE,ju as GUARD_MODES,Lu as GUARD_MODE_ENV,Uu as REDACTED,Zu as classify,Qu as classifyCall,ue as classifyCommand,ie as createWorkspaceGate,K as currentGuardMode,Su as dalSecretValues,ou as default,k as evaluateToolCall,Ou as fileHoldsDalSecret,Iu as foreignAttributionInMessageFile,_u as foreignCoAuthors,Hu as guardModeLabel,Xu as installingManager,Gu as isGitCommit,ee as isProtectedProjectPath,oe as modeAsks,Fe as modifiedDirectory,$u as namesDalCredential,Vu as nextGuardMode,Wu as parseGuardMode,ae as pathOutsideProject,Nu as readsDalSecretCopy,Ru as redactContent,Pu as redactDalSecrets,re as reviewBashCommand,ku as rewriteCommitAttribution,se as riskForBash,te as riskInMode,zu as saveGuardMode,qu as savedGuardMode,f as setGuardMode,xu as shellPathCandidates,Ku as shouldAskGuardMode,Ju as startupGuardMode,ne as suspicionFor,Yu as wrongPackageManager};
@@ -1,2 +1,2 @@
1
- var g=Object.defineProperty;var e=(r,o)=>g(r,"name",{value:o,configurable:!0});var p=Object.defineProperty,a=e((r,o)=>p(r,"name",{value:o,configurable:!0}),"o");import{existsSync as m,readFileSync as w}from"node:fs";import{join as G}from"node:path";import{declaredDataFormat as A,reportNewerDataFormat as D,withFileLockSync as M,writeFileAtomicSync as h}from"@dalcode/dal-pi-kit";const s="DAL_GUARD_MODE";function d(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}e(d,"a"),a(d,"isRecord");function i(r){try{const o=JSON.parse(w(r,"utf8"));return d(o)?o:void 0}catch{return}}e(i,"i"),a(i,"readJson");function u(r){return G(r,"settings.json")}e(u,"u"),a(u,"userSettingsPath");function c(r){const o=i(u(r))?.guard,t=d(o)?o.mode:void 0;return t==="yolo"||t==="default"?t:void 0}e(c,"s"),a(c,"savedGuardMode");function l(r,o,t=process.env){return o||t[s]==="yolo"?"yolo":c(r)??"default"}e(l,"S"),a(l,"startupGuardMode");function f(r,o){const t=u(r);M(t,()=>{if(m(t)&&i(t)===void 0)throw new Error(`${t} is not valid JSON; not overwriting it`);const n=i(t)??{};if(A(n)>1)throw D(t),new Error(`${t} was written by a newer DAL; not overwriting it`);n.guard={...d(n.guard)?n.guard:{},mode:o},h(t,`${JSON.stringify(n,null,2)}
2
- `)})}e(f,"h"),a(f,"saveGuardMode");function v(r,o=process.env){r==="yolo"?o[s]="yolo":delete o[s]}e(v,"x"),a(v,"exportGuardMode");function y(r){const o=r.env??process.env;return r.mode!=="tui"||!r.hasUI||r.flag||r.underDalCode||o[s]||o.DAL_SUBAGENT_DEPTH||!r.languageChosen?!1:c(r.agentDir)===void 0}e(y,"A"),a(y,"shouldAskGuardMode");export{s as GUARD_MODE_ENV,v as exportGuardMode,f as saveGuardMode,c as savedGuardMode,y as shouldAskGuardMode,l as startupGuardMode,u as userSettingsPath};
1
+ var S=Object.defineProperty;var o=(u,e)=>S(u,"name",{value:e,configurable:!0});var h=Object.defineProperty,a=o((u,e)=>h(u,"name",{value:e,configurable:!0}),"n");import{existsSync as B,readFileSync as O}from"node:fs";import{join as L}from"node:path";import{declaredDataFormat as _,reportNewerDataFormat as x,t as s,withFileLockSync as U,writeFileAtomicSync as b}from"@dalcode/dal-pi-kit";const d=["default","acceptEdits","auto","yolo"],p="auto",F="DAL_GUARD_MODE",g={ask:"default","accept-edits":"acceptEdits",acceptedits:"acceptEdits",edits:"acceptEdits",smart:"auto",full:"yolo","full-auto":"yolo",bypassPermissions:"yolo"};function i(u){if(typeof u!="string")return;const e=u.trim(),r=e.toLowerCase();return d.find(t=>t===e||t.toLowerCase()===r)??g[e]??g[r]}o(i,"c"),a(i,"parseGuardMode");function m(u){switch(u){case"default":return s("\u6BCF\u6B21\u8BE2\u95EE");case"acceptEdits":return s("\u81EA\u52A8\u63A5\u53D7\u7F16\u8F91");case"auto":return s("\u667A\u80FD\u81EA\u52A8");case"yolo":return s("\u5B8C\u5168\u81EA\u52A8")}}o(m,"N"),a(m,"guardModeLabel");function v(u){switch(u){case"default":return s("\u6539\u6587\u4EF6\u3001\u8FD0\u884C\u547D\u4EE4\u548C\u8C03\u7528\u5DE5\u5177\u524D\u90FD\u5148\u95EE\u6211");case"acceptEdits":return s("\u9879\u76EE\u5185\u6539\u6587\u4EF6\u76F4\u63A5\u505A\uFF0C\u8FD0\u884C\u547D\u4EE4\u548C\u8C03\u7528\u5DE5\u5177\u524D\u5148\u95EE\u6211");case"auto":return s("\u6539\u6587\u4EF6\u548C\u666E\u901A\u547D\u4EE4\u76F4\u63A5\u505A\uFF1B\u5220\u9664\u3001\u63A8\u9001\u3001\u6539\u5199\u5386\u53F2\u7B49\u9AD8\u98CE\u9669\u64CD\u4F5C\u5148\u95EE\u6211");case"yolo":return s("\u5168\u90E8\u76F4\u63A5\u505A\uFF1B\u53EA\u6709 sudo\u3001\u7BA1\u9053\u6267\u884C\u4E0B\u8F7D\u7684\u811A\u672C\u3001\u5F3A\u5236\u63A8\u9001\u3001\u5199\u5230\u9879\u76EE\u5916\u7B49\u4ECD\u4F1A\u95EE")}}o(v,"R"),a(v,"guardModeSummary");function y(u){return d[(d.indexOf(u)+1)%d.length]}o(y,"k"),a(y,"nextGuardMode");function E(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}o(E,"f"),a(E,"isRecord");function f(u){try{const e=JSON.parse(O(u,"utf8"));return E(e)?e:void 0}catch{return}}o(f,"l"),a(f,"readJson");function A(u){return L(u,"settings.json")}o(A,"M"),a(A,"userSettingsPath");function D(u){const e=f(A(u))?.guard;if(!E(e))return;const r=i(e.permissionMode);if(r)return r;if(e.mode==="yolo")return"yolo";if(e.mode==="default")return"auto"}o(D,"m"),a(D,"savedGuardMode");function M(u,e,r=process.env){let t;if(e.flag){const n=i(e.flag);if(n)return{mode:n,source:"flag"};t={source:"flag",value:e.flag}}if(e.yoloFlag)return{mode:"yolo",source:"flag",invalid:t};const c=r[F];if(c){const n=i(c);if(n)return{mode:n,source:"env",invalid:t};t??={source:"env",value:c}}const l=D(u);return l?{mode:l,source:"settings",invalid:t}:{mode:p,source:"default",invalid:t}}o(M,"F"),a(M,"startupGuardMode");function C(u,e){const r=A(u);U(r,()=>{if(B(r)&&f(r)===void 0)throw new Error(`${r} is not valid JSON; not overwriting it`);const t=f(r)??{};if(_(t)>1)throw x(r),new Error(`${r} was written by a newer DAL; not overwriting it`);const{mode:c,...l}=E(t.guard)?t.guard:{};t.guard={...l,permissionMode:e},b(r,`${JSON.stringify(t,null,2)}
2
+ `)})}o(C,"O"),a(C,"saveGuardMode");function G(u,e=process.env){e[F]=u}o(G,"U"),a(G,"exportGuardMode");function w(u){const e=u.env??process.env;return u.mode!=="tui"||!u.hasUI||u.source!=="default"||u.underDalCode||e.DAL_SUBAGENT_DEPTH||!u.languageChosen?!1:D(u.agentDir)===void 0}o(w,"J"),a(w,"shouldAskGuardMode");export{p as DEFAULT_GUARD_MODE,d as GUARD_MODES,F as GUARD_MODE_ENV,G as exportGuardMode,m as guardModeLabel,v as guardModeSummary,y as nextGuardMode,i as parseGuardMode,C as saveGuardMode,D as savedGuardMode,w as shouldAskGuardMode,M as startupGuardMode,A as userSettingsPath};
@@ -0,0 +1 @@
1
+ var S=Object.defineProperty;var o=(e,t)=>S(e,"name",{value:t,configurable:!0});var j=Object.defineProperty,l=o((e,t)=>j(e,"name",{value:t,configurable:!0}),"a");import{realpathSync as y}from"node:fs";import{basename as p,dirname as I,isAbsolute as x,join as W,relative as O,resolve as R,sep as w}from"node:path";import{t as i}from"@dalcode/dal-pi-kit";import{isReadOnlyBashCommand as C,PROTECTED_WRITE_NAMES as z,resolveToCwd as M,simpleCommands as T,unwrapCommand as J}from"@earendil-works/pi-coding-agent";const q={read:[],edit:["default"],command:["default","acceptEdits"],risky:["default","acceptEdits","auto"],always:["default","acceptEdits","auto","yolo"]};function F(e,t){return q[t].includes(e)}o(F,"I"),l(F,"modeAsks");const d=l(e=>t=>e.test(t),"has"),G=[{id:"sudo",tier:"always",level:"high",label:i("\u7279\u6743\u6267\u884C\uFF08sudo/doas\uFF09"),test:d(/(^|[;&|\n]\s*)(sudo|doas)\s/)},{id:"force-push",tier:"always",level:"high",label:i("\u5F3A\u5236\u63A8\u9001\u5C06\u6539\u5199\u8FDC\u7A0B\u5386\u53F2"),test:d(/git\s+push\b[^;&|]*(--force\b|--force-with-lease\b|\s-f\b)/)},{id:"hard-reset",tier:"risky",level:"high",label:i("\u786C\u91CD\u7F6E\u4F1A\u4E22\u5F03\u672C\u5730\u6539\u52A8"),test:d(/git\s+reset\b[^;&|]*--hard/)},{id:"git-clean",tier:"risky",level:"high",label:i("git clean \u4F1A\u5220\u9664\u672A\u8DDF\u8E2A\u6587\u4EF6"),test:d(/git\s+clean\b[^;&|]*(-[a-z]*f|--force)/)},{id:"pipe-to-shell",tier:"always",level:"high",label:i("\u5C06\u4E0B\u8F7D\u5185\u5BB9\u76F4\u63A5\u7BA1\u9053\u6267\u884C"),test:d(/(curl|wget)\b[^;&|]*\|\s*(ba|z|da|fi)?sh\b/)},{id:"exec-download",tier:"always",level:"high",label:i("\u6267\u884C\u4E0B\u8F7D\u7684\u811A\u672C"),test:d(/\b(ba|z|da|fi)?sh\s+<\(\s*(curl|wget)\b|eval\b[^;&|\n]*\$\(\s*(curl|wget)\b/)},{id:"recursive-perms",tier:"risky",label:i("\u9012\u5F52\u4FEE\u6539\u6743\u9650/\u5C5E\u4E3B"),test:d(/(chmod|chown)\b[^;&|]*-[a-zA-Z]*R/)},{id:"publish",tier:"risky",label:i("\u53D1\u5E03\u8F6F\u4EF6\u5305"),test:d(/(npm|pnpm|yarn)\s+publish\b/)},{id:"kill",tier:"risky",label:i("\u6309\u540D\u79F0\u7ED3\u675F\u8FDB\u7A0B"),test:d(/(^|[;&|\n]\s*)(killall|pkill)\s/)},{id:"disk",tier:"always",level:"high",label:i("\u5E95\u5C42\u78C1\u76D8\u64CD\u4F5C"),test:d(/(^|[;&|\n]\s*)(dd|mkfs(?:\.\w+)?|diskutil|fdisk)\s/)}];function E(e){return G.find(t=>t.test(e))}o(E,"O"),l(E,"riskForBash");const H=new Set(["rm","rmdir","unlink","shred","trash","srm"]),L=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--config-env","--super-prefix","--exec-path"]),Q=new Set(["add","remove","rm","rename","set-url","set-head","set-branches","prune","update"]);function A(e){let t=0;for(;t<e.length&&e[t].startsWith("-");)t+=L.has(e[t])?2:1;return{sub:e[t]??"",rest:e.slice(t+1)}}o(A,"j"),l(A,"gitSubcommand");const h=l((e,t)=>e.some(r=>/^-[^-]/.test(r)&&r.includes(t)),"shortFlag");function D(e){const t=[];for(const r of e.split(/\$\(|`|<\(|>\(/))for(const s of T(r)){const u=J(s.words.map(a=>a.value)).words;u.length>0&&t.push([...u])}return t}o(D,"L"),l(D,"commandWords");function B(e){const t=p(e[0]),r=e.slice(1);if(H.has(t)||t==="find"&&r.includes("-delete"))return{id:"delete",label:i("\u5220\u9664\u6587\u4EF6"),tier:"risky"};if(t!=="git")return;const{sub:s,rest:u}=A(r);switch(s){case"rm":return{id:"delete",label:i("\u5220\u9664\u6587\u4EF6"),tier:"risky"};case"push":return u.some(a=>a==="--force"||a==="--force-with-lease"||a.startsWith("--force-with-lease="))||h(u,"f")||u.some(a=>a.startsWith("+"))?{id:"force-push",label:i("\u5F3A\u5236\u63A8\u9001\u5C06\u6539\u5199\u8FDC\u7A0B\u5386\u53F2"),tier:"always"}:{id:"git-push",label:i("\u63A8\u9001\u5230\u8FDC\u7A0B\u4ED3\u5E93"),tier:"risky"};case"remote":return u[0]!==void 0&&Q.has(u[0])?{id:"git-remote",label:i("\u4FEE\u6539\u8FDC\u7A0B\u4ED3\u5E93\u8BBE\u7F6E"),tier:"risky"}:void 0;case"reset":return u.includes("--hard")?{id:"hard-reset",label:i("\u786C\u91CD\u7F6E\u4F1A\u4E22\u5F03\u672C\u5730\u6539\u52A8"),tier:"risky"}:void 0;case"clean":return u.includes("--force")||h(u,"f")?{id:"git-clean",label:i("git clean \u4F1A\u5220\u9664\u672A\u8DDF\u8E2A\u6587\u4EF6"),tier:"risky"}:void 0;case"branch":return u.includes("-D")||(u.includes("--delete")||h(u,"d"))&&(u.includes("--force")||h(u,"f"))?{id:"git-branch-delete",label:i("\u5F3A\u5236\u5220\u9664\u5206\u652F"),tier:"risky"}:void 0;case"checkout":return u.includes("--")?{id:"git-checkout-discard",label:i("\u4E22\u5F03\u5DE5\u4F5C\u533A\u6539\u52A8"),tier:"risky"}:void 0;default:return}}o(B,"D"),l(B,"wordRule");function m(e,t="bash"){const r=D(e);let s;const u=l(c=>{(!s||s.tier==="risky"&&c.tier==="always")&&(s={...c,level:c.level??(c.tier==="always"?"high":"medium")})},"consider"),a=E(e);a&&u(a);for(const c of r){const f=B(c);f&&u({...f,level:f.id==="delete"||f.id==="git-push"?"medium":"high"})}if(s)return{tier:s.tier,risk:{ruleId:`${t}:${s.id}`,title:s.label,detail:e,level:s.level}};if(t==="bash"&&C(e))return{tier:"read"};const n=[...new Set(r.filter(c=>!C(c.join(" "))).map(c=>p(c[0])))];return{tier:"command",risk:{ruleId:`${t}:run:${n.join(",")||"?"}`,title:i("\u8FD0\u884C\u547D\u4EE4"),detail:e,level:"medium"}}}o(m,"y"),l(m,"classifyCommand");function b(e){try{return y(e)}catch{try{return W(y(I(e)),p(e))}catch{return e}}}o(b,"b"),l(b,"realPathBestEffort");function g(e,t){const r=b(M(e,t)),s=b(R(t)),u=O(s,r);if(!(u===".."||u.startsWith(`..${w}`)||x(u)))return u.split(w).join("/")}o(g,"k"),l(g,"projectRelative");function $(e,t){return g(e,t)===void 0}o($,"q"),l($,"pathOutsideProject");function k(e){return e===".env"||/^\.env\.[^/]*$/.test(e)?!0:z.some(t=>e===t||e.startsWith(`${t}/`))}o(k,"P"),l(k,"isProtectedProjectPath");const Z={edit:["path","file_path"],write:["path","file_path"],office_doc_generate:["path"],office_sheet_generate:["path"],office_ppt_generate:["path"],office_md_generate:["path"],office_drawio_generate:["path"],office_chart_generate:["path"],office_docx_edit:["path","output"],office_pptx_edit:["path","output"],office_xlsx_edit:["path","output"]};function N(e,t,r){const s=e.input??{},u=r.map(a=>s[a]).filter(a=>typeof a=="string");for(const a of u.filter(n=>n!=="")){const n=g(a,t);if(n===void 0)return{tier:"always",risk:{ruleId:`${e.toolName}:outside-project`,title:i("\u9879\u76EE\u76EE\u5F55\u4E4B\u5916\u7684\u6587\u4EF6\u6539\u52A8"),detail:a,level:"medium"}};if(k(n))return{tier:"always",risk:{ruleId:`${e.toolName}:protected`,title:i("\u6539\u52A8\u53D7\u4FDD\u62A4\u7684\u6587\u4EF6\uFF08git \u94A9\u5B50\u4E0E\u914D\u7F6E\u3001\u4EE3\u7406\u4E0E\u7F16\u8F91\u5668\u8BBE\u7F6E\u3001.env\uFF09"),detail:a,level:"high"}}}return{tier:"edit",risk:{ruleId:"edits",title:i("\u4FEE\u6539\u9879\u76EE\u5185\u7684\u6587\u4EF6"),detail:u[0]??e.toolName,level:"medium"}}}o(N,"z"),l(N,"classifyEdit");const K=new Set(["read","grep","find","ls","lsp","glob","ripgrep","fd","web_search","web_fetch","todo","todo_read","skill","tool_catalog","tool_search","plugin_search","session_search","office_read_file","office_ppt_plan","goal_complete","goal_blocked","goal_wait","terminal_read","review_report","ask_user","submit_plan","task","advisor"]);function v(e,t){const r=e.input??{};if(e.toolName.startsWith("mcp__")){const a=e.toolName.split("__")[1]||"unknown",n=JSON.stringify(r);return{tier:"command",risk:{ruleId:`mcp:${a}`,title:`${i("\u7B2C\u4E09\u65B9 MCP \u5DE5\u5177\u8C03\u7528\uFF08")}${a}${i("\uFF09")}`,detail:`${e.toolName} ${n.length>200?`${n.slice(0,200)}\u2026`:n}`,level:"medium"}}}if(e.toolName==="bash"||e.toolName==="powershell")return m(String(r.command??""),e.toolName);if(e.toolName==="process")return r.action==="start"?m(String(r.command??"")):{tier:"read"};const s=Z[e.toolName];if(s)return N(e,t,s);if(K.has(e.toolName))return{tier:"read"};const u=JSON.stringify(r);return{tier:"command",risk:{ruleId:`tool:${e.toolName}`,title:i("\u8C03\u7528\u5DE5\u5177 {name}").replace("{name}",()=>e.toolName),detail:u.length>200?`${u.slice(0,200)}\u2026`:u,level:"medium"}}}o(v,"F"),l(v,"classifyCall");function _(e,t,r){const s=v(t,r);return F(e,s.tier)?s.risk:void 0}o(_,"J"),l(_,"riskInMode");function P(e,t){return _("auto",e,t)}o(P,"Q"),l(P,"classify");export{P as classify,v as classifyCall,m as classifyCommand,k as isProtectedProjectPath,F as modeAsks,$ as pathOutsideProject,E as riskForBash,_ as riskInMode};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-halo",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",