@orion-agents/orion-code 0.1.0

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 (1070) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +179 -0
  3. package/README.zh-CN.md +496 -0
  4. package/assets/orion-tui-icon.png +0 -0
  5. package/bin/orion +56 -0
  6. package/dist/agents/coder.d.ts +12 -0
  7. package/dist/agents/coder.d.ts.map +1 -0
  8. package/dist/agents/coder.js +48 -0
  9. package/dist/agents/coder.js.map +1 -0
  10. package/dist/agents/coordinator.d.ts +86 -0
  11. package/dist/agents/coordinator.d.ts.map +1 -0
  12. package/dist/agents/coordinator.js +251 -0
  13. package/dist/agents/coordinator.js.map +1 -0
  14. package/dist/agents/fork.d.ts +61 -0
  15. package/dist/agents/fork.d.ts.map +1 -0
  16. package/dist/agents/fork.js +168 -0
  17. package/dist/agents/fork.js.map +1 -0
  18. package/dist/agents/leader.d.ts +12 -0
  19. package/dist/agents/leader.d.ts.map +1 -0
  20. package/dist/agents/leader.js +49 -0
  21. package/dist/agents/leader.js.map +1 -0
  22. package/dist/agents/router.d.ts +59 -0
  23. package/dist/agents/router.d.ts.map +1 -0
  24. package/dist/agents/router.js +193 -0
  25. package/dist/agents/router.js.map +1 -0
  26. package/dist/agents/worker-pool.d.ts +72 -0
  27. package/dist/agents/worker-pool.d.ts.map +1 -0
  28. package/dist/agents/worker-pool.js +215 -0
  29. package/dist/agents/worker-pool.js.map +1 -0
  30. package/dist/cli.d.ts +5 -0
  31. package/dist/cli.d.ts.map +1 -0
  32. package/dist/cli.js +393 -0
  33. package/dist/cli.js.map +1 -0
  34. package/dist/commands/index.d.ts +15 -0
  35. package/dist/commands/index.d.ts.map +1 -0
  36. package/dist/commands/index.js +3281 -0
  37. package/dist/commands/index.js.map +1 -0
  38. package/dist/commands/parser.d.ts +26 -0
  39. package/dist/commands/parser.d.ts.map +1 -0
  40. package/dist/commands/parser.js +66 -0
  41. package/dist/commands/parser.js.map +1 -0
  42. package/dist/commands/target-command.d.ts +21 -0
  43. package/dist/commands/target-command.d.ts.map +1 -0
  44. package/dist/commands/target-command.js +81 -0
  45. package/dist/commands/target-command.js.map +1 -0
  46. package/dist/commands/types.d.ts +96 -0
  47. package/dist/commands/types.d.ts.map +1 -0
  48. package/dist/commands/types.js +32 -0
  49. package/dist/commands/types.js.map +1 -0
  50. package/dist/core/agent.d.ts +84 -0
  51. package/dist/core/agent.d.ts.map +1 -0
  52. package/dist/core/agent.js +58 -0
  53. package/dist/core/agent.js.map +1 -0
  54. package/dist/core/brain.d.ts +50 -0
  55. package/dist/core/brain.d.ts.map +1 -0
  56. package/dist/core/brain.js +95 -0
  57. package/dist/core/brain.js.map +1 -0
  58. package/dist/core/checkpoint.d.ts +50 -0
  59. package/dist/core/checkpoint.d.ts.map +1 -0
  60. package/dist/core/checkpoint.js +284 -0
  61. package/dist/core/checkpoint.js.map +1 -0
  62. package/dist/core/cost-tracker.d.ts +147 -0
  63. package/dist/core/cost-tracker.d.ts.map +1 -0
  64. package/dist/core/cost-tracker.js +275 -0
  65. package/dist/core/cost-tracker.js.map +1 -0
  66. package/dist/core/security-warning.d.ts +59 -0
  67. package/dist/core/security-warning.d.ts.map +1 -0
  68. package/dist/core/security-warning.js +163 -0
  69. package/dist/core/security-warning.js.map +1 -0
  70. package/dist/core/strategy-tracker.d.ts +61 -0
  71. package/dist/core/strategy-tracker.d.ts.map +1 -0
  72. package/dist/core/strategy-tracker.js +124 -0
  73. package/dist/core/strategy-tracker.js.map +1 -0
  74. package/dist/core/tool-artifacts.d.ts +48 -0
  75. package/dist/core/tool-artifacts.d.ts.map +1 -0
  76. package/dist/core/tool-artifacts.js +216 -0
  77. package/dist/core/tool-artifacts.js.map +1 -0
  78. package/dist/core/warn-dedup.d.ts +39 -0
  79. package/dist/core/warn-dedup.d.ts.map +1 -0
  80. package/dist/core/warn-dedup.js +80 -0
  81. package/dist/core/warn-dedup.js.map +1 -0
  82. package/dist/framework/index.d.ts +25 -0
  83. package/dist/framework/index.d.ts.map +1 -0
  84. package/dist/framework/index.js +53 -0
  85. package/dist/framework/index.js.map +1 -0
  86. package/dist/framework/prompt.d.ts +48 -0
  87. package/dist/framework/prompt.d.ts.map +1 -0
  88. package/dist/framework/prompt.js +174 -0
  89. package/dist/framework/prompt.js.map +1 -0
  90. package/dist/framework/query.d.ts +250 -0
  91. package/dist/framework/query.d.ts.map +1 -0
  92. package/dist/framework/query.js +870 -0
  93. package/dist/framework/query.js.map +1 -0
  94. package/dist/framework/store.d.ts +79 -0
  95. package/dist/framework/store.d.ts.map +1 -0
  96. package/dist/framework/store.js +92 -0
  97. package/dist/framework/store.js.map +1 -0
  98. package/dist/framework/tool-scheduler.d.ts +115 -0
  99. package/dist/framework/tool-scheduler.d.ts.map +1 -0
  100. package/dist/framework/tool-scheduler.js +285 -0
  101. package/dist/framework/tool-scheduler.js.map +1 -0
  102. package/dist/framework/tool-serializer.d.ts +21 -0
  103. package/dist/framework/tool-serializer.d.ts.map +1 -0
  104. package/dist/framework/tool-serializer.js +68 -0
  105. package/dist/framework/tool-serializer.js.map +1 -0
  106. package/dist/framework/tool-state.d.ts +39 -0
  107. package/dist/framework/tool-state.d.ts.map +1 -0
  108. package/dist/framework/tool-state.js +44 -0
  109. package/dist/framework/tool-state.js.map +1 -0
  110. package/dist/framework/tool.d.ts +110 -0
  111. package/dist/framework/tool.d.ts.map +1 -0
  112. package/dist/framework/tool.js +60 -0
  113. package/dist/framework/tool.js.map +1 -0
  114. package/dist/harness/assembler.d.ts +17 -0
  115. package/dist/harness/assembler.d.ts.map +1 -0
  116. package/dist/harness/assembler.js +206 -0
  117. package/dist/harness/assembler.js.map +1 -0
  118. package/dist/harness/capsule.d.ts +6 -0
  119. package/dist/harness/capsule.d.ts.map +1 -0
  120. package/dist/harness/capsule.js +192 -0
  121. package/dist/harness/capsule.js.map +1 -0
  122. package/dist/harness/context-harness.d.ts +81 -0
  123. package/dist/harness/context-harness.d.ts.map +1 -0
  124. package/dist/harness/context-harness.js +278 -0
  125. package/dist/harness/context-harness.js.map +1 -0
  126. package/dist/harness/contract.d.ts +6 -0
  127. package/dist/harness/contract.d.ts.map +1 -0
  128. package/dist/harness/contract.js +130 -0
  129. package/dist/harness/contract.js.map +1 -0
  130. package/dist/harness/drift-guard.d.ts +12 -0
  131. package/dist/harness/drift-guard.d.ts.map +1 -0
  132. package/dist/harness/drift-guard.js +50 -0
  133. package/dist/harness/drift-guard.js.map +1 -0
  134. package/dist/harness/evidence.d.ts +20 -0
  135. package/dist/harness/evidence.d.ts.map +1 -0
  136. package/dist/harness/evidence.js +195 -0
  137. package/dist/harness/evidence.js.map +1 -0
  138. package/dist/harness/harness.d.ts +58 -0
  139. package/dist/harness/harness.d.ts.map +1 -0
  140. package/dist/harness/harness.js +195 -0
  141. package/dist/harness/harness.js.map +1 -0
  142. package/dist/harness/index.d.ts +16 -0
  143. package/dist/harness/index.d.ts.map +1 -0
  144. package/dist/harness/index.js +39 -0
  145. package/dist/harness/index.js.map +1 -0
  146. package/dist/harness/intent.d.ts +4 -0
  147. package/dist/harness/intent.d.ts.map +1 -0
  148. package/dist/harness/intent.js +153 -0
  149. package/dist/harness/intent.js.map +1 -0
  150. package/dist/harness/ledger.d.ts +31 -0
  151. package/dist/harness/ledger.d.ts.map +1 -0
  152. package/dist/harness/ledger.js +135 -0
  153. package/dist/harness/ledger.js.map +1 -0
  154. package/dist/harness/safety.d.ts +91 -0
  155. package/dist/harness/safety.d.ts.map +1 -0
  156. package/dist/harness/safety.js +210 -0
  157. package/dist/harness/safety.js.map +1 -0
  158. package/dist/harness/state.d.ts +12 -0
  159. package/dist/harness/state.d.ts.map +1 -0
  160. package/dist/harness/state.js +114 -0
  161. package/dist/harness/state.js.map +1 -0
  162. package/dist/harness/turn-summary.d.ts +25 -0
  163. package/dist/harness/turn-summary.d.ts.map +1 -0
  164. package/dist/harness/turn-summary.js +120 -0
  165. package/dist/harness/turn-summary.js.map +1 -0
  166. package/dist/harness/types.d.ts +187 -0
  167. package/dist/harness/types.d.ts.map +1 -0
  168. package/dist/harness/types.js +3 -0
  169. package/dist/harness/types.js.map +1 -0
  170. package/dist/index.d.ts +34 -0
  171. package/dist/index.d.ts.map +1 -0
  172. package/dist/index.js +68 -0
  173. package/dist/index.js.map +1 -0
  174. package/dist/init.d.ts +112 -0
  175. package/dist/init.d.ts.map +1 -0
  176. package/dist/init.js +312 -0
  177. package/dist/init.js.map +1 -0
  178. package/dist/ink/index.d.ts +54 -0
  179. package/dist/ink/index.d.ts.map +1 -0
  180. package/dist/ink/index.js +111 -0
  181. package/dist/ink/index.js.map +1 -0
  182. package/dist/ink-ui/App.d.ts +9 -0
  183. package/dist/ink-ui/App.d.ts.map +1 -0
  184. package/dist/ink-ui/App.js +12 -0
  185. package/dist/ink-ui/App.js.map +1 -0
  186. package/dist/ink-ui/components/Markdown.d.ts +10 -0
  187. package/dist/ink-ui/components/Markdown.d.ts.map +1 -0
  188. package/dist/ink-ui/components/Markdown.js +210 -0
  189. package/dist/ink-ui/components/Markdown.js.map +1 -0
  190. package/dist/ink-ui/components/NativeCursor.d.ts +12 -0
  191. package/dist/ink-ui/components/NativeCursor.d.ts.map +1 -0
  192. package/dist/ink-ui/components/NativeCursor.js +35 -0
  193. package/dist/ink-ui/components/NativeCursor.js.map +1 -0
  194. package/dist/ink-ui/components/PixelHorseBanner.d.ts +8 -0
  195. package/dist/ink-ui/components/PixelHorseBanner.d.ts.map +1 -0
  196. package/dist/ink-ui/components/PixelHorseBanner.js +97 -0
  197. package/dist/ink-ui/components/PixelHorseBanner.js.map +1 -0
  198. package/dist/ink-ui/components/PromptInput.d.ts +13 -0
  199. package/dist/ink-ui/components/PromptInput.d.ts.map +1 -0
  200. package/dist/ink-ui/components/PromptInput.js +30 -0
  201. package/dist/ink-ui/components/PromptInput.js.map +1 -0
  202. package/dist/ink-ui/components/RunningHorseIndicator.d.ts +13 -0
  203. package/dist/ink-ui/components/RunningHorseIndicator.d.ts.map +1 -0
  204. package/dist/ink-ui/components/RunningHorseIndicator.js +53 -0
  205. package/dist/ink-ui/components/RunningHorseIndicator.js.map +1 -0
  206. package/dist/ink-ui/components/SelectList.d.ts +16 -0
  207. package/dist/ink-ui/components/SelectList.d.ts.map +1 -0
  208. package/dist/ink-ui/components/SelectList.js +60 -0
  209. package/dist/ink-ui/components/SelectList.js.map +1 -0
  210. package/dist/ink-ui/components/StatusLine.d.ts +11 -0
  211. package/dist/ink-ui/components/StatusLine.d.ts.map +1 -0
  212. package/dist/ink-ui/components/StatusLine.js +70 -0
  213. package/dist/ink-ui/components/StatusLine.js.map +1 -0
  214. package/dist/ink-ui/components/ToolActivity.d.ts +19 -0
  215. package/dist/ink-ui/components/ToolActivity.d.ts.map +1 -0
  216. package/dist/ink-ui/components/ToolActivity.js +134 -0
  217. package/dist/ink-ui/components/ToolActivity.js.map +1 -0
  218. package/dist/ink-ui/components/Transcript.d.ts +14 -0
  219. package/dist/ink-ui/components/Transcript.d.ts.map +1 -0
  220. package/dist/ink-ui/components/Transcript.js +66 -0
  221. package/dist/ink-ui/components/Transcript.js.map +1 -0
  222. package/dist/ink-ui/controllers/chat-controller.d.ts +2 -0
  223. package/dist/ink-ui/controllers/chat-controller.d.ts.map +1 -0
  224. package/dist/ink-ui/controllers/chat-controller.js +18 -0
  225. package/dist/ink-ui/controllers/chat-controller.js.map +1 -0
  226. package/dist/ink-ui/hooks/use-raw-input-bridge.d.ts +6 -0
  227. package/dist/ink-ui/hooks/use-raw-input-bridge.d.ts.map +1 -0
  228. package/dist/ink-ui/hooks/use-raw-input-bridge.js +27 -0
  229. package/dist/ink-ui/hooks/use-raw-input-bridge.js.map +1 -0
  230. package/dist/ink-ui/hooks/use-terminal-size.d.ts +7 -0
  231. package/dist/ink-ui/hooks/use-terminal-size.d.ts.map +1 -0
  232. package/dist/ink-ui/hooks/use-terminal-size.js +34 -0
  233. package/dist/ink-ui/hooks/use-terminal-size.js.map +1 -0
  234. package/dist/ink-ui/launch.d.ts +9 -0
  235. package/dist/ink-ui/launch.d.ts.map +1 -0
  236. package/dist/ink-ui/launch.js +101 -0
  237. package/dist/ink-ui/launch.js.map +1 -0
  238. package/dist/ink-ui/runtime/grapheme.d.ts +10 -0
  239. package/dist/ink-ui/runtime/grapheme.d.ts.map +1 -0
  240. package/dist/ink-ui/runtime/grapheme.js +17 -0
  241. package/dist/ink-ui/runtime/grapheme.js.map +1 -0
  242. package/dist/ink-ui/runtime/input-buffer.d.ts +10 -0
  243. package/dist/ink-ui/runtime/input-buffer.d.ts.map +1 -0
  244. package/dist/ink-ui/runtime/input-buffer.js +18 -0
  245. package/dist/ink-ui/runtime/input-buffer.js.map +1 -0
  246. package/dist/ink-ui/runtime/layout-budget.d.ts +13 -0
  247. package/dist/ink-ui/runtime/layout-budget.d.ts.map +1 -0
  248. package/dist/ink-ui/runtime/layout-budget.js +25 -0
  249. package/dist/ink-ui/runtime/layout-budget.js.map +1 -0
  250. package/dist/ink-ui/runtime/native-cursor.d.ts +62 -0
  251. package/dist/ink-ui/runtime/native-cursor.d.ts.map +1 -0
  252. package/dist/ink-ui/runtime/native-cursor.js +398 -0
  253. package/dist/ink-ui/runtime/native-cursor.js.map +1 -0
  254. package/dist/ink-ui/runtime/prompt-layout.d.ts +10 -0
  255. package/dist/ink-ui/runtime/prompt-layout.d.ts.map +1 -0
  256. package/dist/ink-ui/runtime/prompt-layout.js +21 -0
  257. package/dist/ink-ui/runtime/prompt-layout.js.map +1 -0
  258. package/dist/ink-ui/runtime/raw-input.d.ts +4 -0
  259. package/dist/ink-ui/runtime/raw-input.d.ts.map +1 -0
  260. package/dist/ink-ui/runtime/raw-input.js +15 -0
  261. package/dist/ink-ui/runtime/raw-input.js.map +1 -0
  262. package/dist/ink-ui/runtime/transcript-state.d.ts +37 -0
  263. package/dist/ink-ui/runtime/transcript-state.d.ts.map +1 -0
  264. package/dist/ink-ui/runtime/transcript-state.js +91 -0
  265. package/dist/ink-ui/runtime/transcript-state.js.map +1 -0
  266. package/dist/ink-ui/screens/ReplScreen.d.ts +22 -0
  267. package/dist/ink-ui/screens/ReplScreen.d.ts.map +1 -0
  268. package/dist/ink-ui/screens/ReplScreen.js +616 -0
  269. package/dist/ink-ui/screens/ReplScreen.js.map +1 -0
  270. package/dist/ink-ui/types.d.ts +2 -0
  271. package/dist/ink-ui/types.d.ts.map +1 -0
  272. package/dist/ink-ui/types.js +18 -0
  273. package/dist/ink-ui/types.js.map +1 -0
  274. package/dist/memory/embeddings.d.ts +33 -0
  275. package/dist/memory/embeddings.d.ts.map +1 -0
  276. package/dist/memory/embeddings.js +138 -0
  277. package/dist/memory/embeddings.js.map +1 -0
  278. package/dist/memory/entrypoint.d.ts +55 -0
  279. package/dist/memory/entrypoint.d.ts.map +1 -0
  280. package/dist/memory/entrypoint.js +151 -0
  281. package/dist/memory/entrypoint.js.map +1 -0
  282. package/dist/memory/index.d.ts +14 -0
  283. package/dist/memory/index.d.ts.map +1 -0
  284. package/dist/memory/index.js +31 -0
  285. package/dist/memory/index.js.map +1 -0
  286. package/dist/memory/prompts.d.ts +12 -0
  287. package/dist/memory/prompts.d.ts.map +1 -0
  288. package/dist/memory/prompts.js +117 -0
  289. package/dist/memory/prompts.js.map +1 -0
  290. package/dist/memory/relevant-finder.d.ts +54 -0
  291. package/dist/memory/relevant-finder.d.ts.map +1 -0
  292. package/dist/memory/relevant-finder.js +157 -0
  293. package/dist/memory/relevant-finder.js.map +1 -0
  294. package/dist/memory/semantic-search.d.ts +45 -0
  295. package/dist/memory/semantic-search.d.ts.map +1 -0
  296. package/dist/memory/semantic-search.js +113 -0
  297. package/dist/memory/semantic-search.js.map +1 -0
  298. package/dist/memory/storage.d.ts +86 -0
  299. package/dist/memory/storage.d.ts.map +1 -0
  300. package/dist/memory/storage.js +339 -0
  301. package/dist/memory/storage.js.map +1 -0
  302. package/dist/memory/store.d.ts +104 -0
  303. package/dist/memory/store.d.ts.map +1 -0
  304. package/dist/memory/store.js +235 -0
  305. package/dist/memory/store.js.map +1 -0
  306. package/dist/memory/team-paths.d.ts +63 -0
  307. package/dist/memory/team-paths.d.ts.map +1 -0
  308. package/dist/memory/team-paths.js +151 -0
  309. package/dist/memory/team-paths.js.map +1 -0
  310. package/dist/memory/types.d.ts +40 -0
  311. package/dist/memory/types.d.ts.map +1 -0
  312. package/dist/memory/types.js +71 -0
  313. package/dist/memory/types.js.map +1 -0
  314. package/dist/memory/validation.d.ts +28 -0
  315. package/dist/memory/validation.d.ts.map +1 -0
  316. package/dist/memory/validation.js +147 -0
  317. package/dist/memory/validation.js.map +1 -0
  318. package/dist/memory/vector-store.d.ts +69 -0
  319. package/dist/memory/vector-store.d.ts.map +1 -0
  320. package/dist/memory/vector-store.js +356 -0
  321. package/dist/memory/vector-store.js.map +1 -0
  322. package/dist/migration/command.d.ts +9 -0
  323. package/dist/migration/command.d.ts.map +1 -0
  324. package/dist/migration/command.js +96 -0
  325. package/dist/migration/command.js.map +1 -0
  326. package/dist/migration/index.d.ts +7 -0
  327. package/dist/migration/index.d.ts.map +1 -0
  328. package/dist/migration/index.js +14 -0
  329. package/dist/migration/index.js.map +1 -0
  330. package/dist/migration/migrate.d.ts +19 -0
  331. package/dist/migration/migrate.d.ts.map +1 -0
  332. package/dist/migration/migrate.js +459 -0
  333. package/dist/migration/migrate.js.map +1 -0
  334. package/dist/migration/types.d.ts +56 -0
  335. package/dist/migration/types.d.ts.map +1 -0
  336. package/dist/migration/types.js +6 -0
  337. package/dist/migration/types.js.map +1 -0
  338. package/dist/print-ui/launch.d.ts +50 -0
  339. package/dist/print-ui/launch.d.ts.map +1 -0
  340. package/dist/print-ui/launch.js +225 -0
  341. package/dist/print-ui/launch.js.map +1 -0
  342. package/dist/product/environment.d.ts +37 -0
  343. package/dist/product/environment.d.ts.map +1 -0
  344. package/dist/product/environment.js +72 -0
  345. package/dist/product/environment.js.map +1 -0
  346. package/dist/product/identity.d.ts +39 -0
  347. package/dist/product/identity.d.ts.map +1 -0
  348. package/dist/product/identity.js +46 -0
  349. package/dist/product/identity.js.map +1 -0
  350. package/dist/product/index.d.ts +4 -0
  351. package/dist/product/index.d.ts.map +1 -0
  352. package/dist/product/index.js +63 -0
  353. package/dist/product/index.js.map +1 -0
  354. package/dist/product/paths.d.ts +61 -0
  355. package/dist/product/paths.d.ts.map +1 -0
  356. package/dist/product/paths.js +243 -0
  357. package/dist/product/paths.js.map +1 -0
  358. package/dist/runtime/agent-runtime-controller.d.ts +85 -0
  359. package/dist/runtime/agent-runtime-controller.d.ts.map +1 -0
  360. package/dist/runtime/agent-runtime-controller.js +417 -0
  361. package/dist/runtime/agent-runtime-controller.js.map +1 -0
  362. package/dist/runtime/agent-runtime-protocol.d.ts +118 -0
  363. package/dist/runtime/agent-runtime-protocol.d.ts.map +1 -0
  364. package/dist/runtime/agent-runtime-protocol.js +128 -0
  365. package/dist/runtime/agent-runtime-protocol.js.map +1 -0
  366. package/dist/runtime/agent-status.d.ts +9 -0
  367. package/dist/runtime/agent-status.d.ts.map +1 -0
  368. package/dist/runtime/agent-status.js +41 -0
  369. package/dist/runtime/agent-status.js.map +1 -0
  370. package/dist/runtime/aggregate-tool-presenter.d.ts +13 -0
  371. package/dist/runtime/aggregate-tool-presenter.d.ts.map +1 -0
  372. package/dist/runtime/aggregate-tool-presenter.js +44 -0
  373. package/dist/runtime/aggregate-tool-presenter.js.map +1 -0
  374. package/dist/runtime/chat-controller.d.ts +89 -0
  375. package/dist/runtime/chat-controller.d.ts.map +1 -0
  376. package/dist/runtime/chat-controller.js +2183 -0
  377. package/dist/runtime/chat-controller.js.map +1 -0
  378. package/dist/runtime/composer/buffer.d.ts +43 -0
  379. package/dist/runtime/composer/buffer.d.ts.map +1 -0
  380. package/dist/runtime/composer/buffer.js +176 -0
  381. package/dist/runtime/composer/buffer.js.map +1 -0
  382. package/dist/runtime/composer/grapheme.d.ts +19 -0
  383. package/dist/runtime/composer/grapheme.d.ts.map +1 -0
  384. package/dist/runtime/composer/grapheme.js +73 -0
  385. package/dist/runtime/composer/grapheme.js.map +1 -0
  386. package/dist/runtime/composer/history.d.ts +39 -0
  387. package/dist/runtime/composer/history.d.ts.map +1 -0
  388. package/dist/runtime/composer/history.js +91 -0
  389. package/dist/runtime/composer/history.js.map +1 -0
  390. package/dist/runtime/composer/layout.d.ts +40 -0
  391. package/dist/runtime/composer/layout.d.ts.map +1 -0
  392. package/dist/runtime/composer/layout.js +174 -0
  393. package/dist/runtime/composer/layout.js.map +1 -0
  394. package/dist/runtime/goals/accounting.d.ts +17 -0
  395. package/dist/runtime/goals/accounting.d.ts.map +1 -0
  396. package/dist/runtime/goals/accounting.js +45 -0
  397. package/dist/runtime/goals/accounting.js.map +1 -0
  398. package/dist/runtime/goals/completion-audit.d.ts +24 -0
  399. package/dist/runtime/goals/completion-audit.d.ts.map +1 -0
  400. package/dist/runtime/goals/completion-audit.js +48 -0
  401. package/dist/runtime/goals/completion-audit.js.map +1 -0
  402. package/dist/runtime/goals/coordinator.d.ts +42 -0
  403. package/dist/runtime/goals/coordinator.d.ts.map +1 -0
  404. package/dist/runtime/goals/coordinator.js +278 -0
  405. package/dist/runtime/goals/coordinator.js.map +1 -0
  406. package/dist/runtime/goals/prompt.d.ts +16 -0
  407. package/dist/runtime/goals/prompt.d.ts.map +1 -0
  408. package/dist/runtime/goals/prompt.js +50 -0
  409. package/dist/runtime/goals/prompt.js.map +1 -0
  410. package/dist/runtime/goals/tools.d.ts +18 -0
  411. package/dist/runtime/goals/tools.d.ts.map +1 -0
  412. package/dist/runtime/goals/tools.js +118 -0
  413. package/dist/runtime/goals/tools.js.map +1 -0
  414. package/dist/runtime/goals/types.d.ts +167 -0
  415. package/dist/runtime/goals/types.d.ts.map +1 -0
  416. package/dist/runtime/goals/types.js +72 -0
  417. package/dist/runtime/goals/types.js.map +1 -0
  418. package/dist/runtime/loop-budget.d.ts +5 -0
  419. package/dist/runtime/loop-budget.d.ts.map +1 -0
  420. package/dist/runtime/loop-budget.js +77 -0
  421. package/dist/runtime/loop-budget.js.map +1 -0
  422. package/dist/runtime/model-coordinator.d.ts +54 -0
  423. package/dist/runtime/model-coordinator.d.ts.map +1 -0
  424. package/dist/runtime/model-coordinator.js +121 -0
  425. package/dist/runtime/model-coordinator.js.map +1 -0
  426. package/dist/runtime/rich-text/ansi-parser.d.ts +31 -0
  427. package/dist/runtime/rich-text/ansi-parser.d.ts.map +1 -0
  428. package/dist/runtime/rich-text/ansi-parser.js +310 -0
  429. package/dist/runtime/rich-text/ansi-parser.js.map +1 -0
  430. package/dist/runtime/rich-text/layout.d.ts +12 -0
  431. package/dist/runtime/rich-text/layout.d.ts.map +1 -0
  432. package/dist/runtime/rich-text/layout.js +362 -0
  433. package/dist/runtime/rich-text/layout.js.map +1 -0
  434. package/dist/runtime/rich-text/markdown-parser.d.ts +17 -0
  435. package/dist/runtime/rich-text/markdown-parser.d.ts.map +1 -0
  436. package/dist/runtime/rich-text/markdown-parser.js +218 -0
  437. package/dist/runtime/rich-text/markdown-parser.js.map +1 -0
  438. package/dist/runtime/rich-text/sanitizer.d.ts +18 -0
  439. package/dist/runtime/rich-text/sanitizer.d.ts.map +1 -0
  440. package/dist/runtime/rich-text/sanitizer.js +32 -0
  441. package/dist/runtime/rich-text/sanitizer.js.map +1 -0
  442. package/dist/runtime/rich-text/types.d.ts +59 -0
  443. package/dist/runtime/rich-text/types.d.ts.map +1 -0
  444. package/dist/runtime/rich-text/types.js +17 -0
  445. package/dist/runtime/rich-text/types.js.map +1 -0
  446. package/dist/runtime/subagents/budget.d.ts +118 -0
  447. package/dist/runtime/subagents/budget.d.ts.map +1 -0
  448. package/dist/runtime/subagents/budget.js +173 -0
  449. package/dist/runtime/subagents/budget.js.map +1 -0
  450. package/dist/runtime/subagents/child-executor-guard.d.ts +60 -0
  451. package/dist/runtime/subagents/child-executor-guard.d.ts.map +1 -0
  452. package/dist/runtime/subagents/child-executor-guard.js +219 -0
  453. package/dist/runtime/subagents/child-executor-guard.js.map +1 -0
  454. package/dist/runtime/subagents/context-builder.d.ts +34 -0
  455. package/dist/runtime/subagents/context-builder.d.ts.map +1 -0
  456. package/dist/runtime/subagents/context-builder.js +99 -0
  457. package/dist/runtime/subagents/context-builder.js.map +1 -0
  458. package/dist/runtime/subagents/index.d.ts +21 -0
  459. package/dist/runtime/subagents/index.d.ts.map +1 -0
  460. package/dist/runtime/subagents/index.js +62 -0
  461. package/dist/runtime/subagents/index.js.map +1 -0
  462. package/dist/runtime/subagents/policy.d.ts +68 -0
  463. package/dist/runtime/subagents/policy.d.ts.map +1 -0
  464. package/dist/runtime/subagents/policy.js +230 -0
  465. package/dist/runtime/subagents/policy.js.map +1 -0
  466. package/dist/runtime/subagents/presets.d.ts +44 -0
  467. package/dist/runtime/subagents/presets.d.ts.map +1 -0
  468. package/dist/runtime/subagents/presets.js +148 -0
  469. package/dist/runtime/subagents/presets.js.map +1 -0
  470. package/dist/runtime/subagents/production.d.ts +47 -0
  471. package/dist/runtime/subagents/production.d.ts.map +1 -0
  472. package/dist/runtime/subagents/production.js +148 -0
  473. package/dist/runtime/subagents/production.js.map +1 -0
  474. package/dist/runtime/subagents/provider-gate.d.ts +104 -0
  475. package/dist/runtime/subagents/provider-gate.d.ts.map +1 -0
  476. package/dist/runtime/subagents/provider-gate.js +192 -0
  477. package/dist/runtime/subagents/provider-gate.js.map +1 -0
  478. package/dist/runtime/subagents/result-parser.d.ts +40 -0
  479. package/dist/runtime/subagents/result-parser.d.ts.map +1 -0
  480. package/dist/runtime/subagents/result-parser.js +240 -0
  481. package/dist/runtime/subagents/result-parser.js.map +1 -0
  482. package/dist/runtime/subagents/runner.d.ts +53 -0
  483. package/dist/runtime/subagents/runner.d.ts.map +1 -0
  484. package/dist/runtime/subagents/runner.js +172 -0
  485. package/dist/runtime/subagents/runner.js.map +1 -0
  486. package/dist/runtime/subagents/runtime-integration.d.ts +76 -0
  487. package/dist/runtime/subagents/runtime-integration.d.ts.map +1 -0
  488. package/dist/runtime/subagents/runtime-integration.js +152 -0
  489. package/dist/runtime/subagents/runtime-integration.js.map +1 -0
  490. package/dist/runtime/subagents/supervisor.d.ts +79 -0
  491. package/dist/runtime/subagents/supervisor.d.ts.map +1 -0
  492. package/dist/runtime/subagents/supervisor.js +301 -0
  493. package/dist/runtime/subagents/supervisor.js.map +1 -0
  494. package/dist/runtime/subagents/tool.d.ts +38 -0
  495. package/dist/runtime/subagents/tool.d.ts.map +1 -0
  496. package/dist/runtime/subagents/tool.js +171 -0
  497. package/dist/runtime/subagents/tool.js.map +1 -0
  498. package/dist/runtime/subagents/types.d.ts +152 -0
  499. package/dist/runtime/subagents/types.d.ts.map +1 -0
  500. package/dist/runtime/subagents/types.js +56 -0
  501. package/dist/runtime/subagents/types.js.map +1 -0
  502. package/dist/runtime/tool-detail-repository.d.ts +45 -0
  503. package/dist/runtime/tool-detail-repository.d.ts.map +1 -0
  504. package/dist/runtime/tool-detail-repository.js +131 -0
  505. package/dist/runtime/tool-detail-repository.js.map +1 -0
  506. package/dist/runtime/tool-output-presentation.d.ts +89 -0
  507. package/dist/runtime/tool-output-presentation.d.ts.map +1 -0
  508. package/dist/runtime/tool-output-presentation.js +329 -0
  509. package/dist/runtime/tool-output-presentation.js.map +1 -0
  510. package/dist/runtime/turn-controller.d.ts +41 -0
  511. package/dist/runtime/turn-controller.d.ts.map +1 -0
  512. package/dist/runtime/turn-controller.js +92 -0
  513. package/dist/runtime/turn-controller.js.map +1 -0
  514. package/dist/runtime/ui-events.d.ts +188 -0
  515. package/dist/runtime/ui-events.d.ts.map +1 -0
  516. package/dist/runtime/ui-events.js +37 -0
  517. package/dist/runtime/ui-events.js.map +1 -0
  518. package/dist/runtime/ui-view-model.d.ts +362 -0
  519. package/dist/runtime/ui-view-model.d.ts.map +1 -0
  520. package/dist/runtime/ui-view-model.js +700 -0
  521. package/dist/runtime/ui-view-model.js.map +1 -0
  522. package/dist/sdk/index.d.ts +10 -0
  523. package/dist/sdk/index.d.ts.map +1 -0
  524. package/dist/sdk/index.js +23 -0
  525. package/dist/sdk/index.js.map +1 -0
  526. package/dist/sdk/init.d.ts +24 -0
  527. package/dist/sdk/init.d.ts.map +1 -0
  528. package/dist/sdk/init.js +48 -0
  529. package/dist/sdk/init.js.map +1 -0
  530. package/dist/sdk/query.d.ts +19 -0
  531. package/dist/sdk/query.d.ts.map +1 -0
  532. package/dist/sdk/query.js +42 -0
  533. package/dist/sdk/query.js.map +1 -0
  534. package/dist/sdk/sessions.d.ts +19 -0
  535. package/dist/sdk/sessions.d.ts.map +1 -0
  536. package/dist/sdk/sessions.js +57 -0
  537. package/dist/sdk/sessions.js.map +1 -0
  538. package/dist/sdk/types.d.ts +47 -0
  539. package/dist/sdk/types.d.ts.map +1 -0
  540. package/dist/sdk/types.js +8 -0
  541. package/dist/sdk/types.js.map +1 -0
  542. package/dist/services/agent-runner.d.ts +68 -0
  543. package/dist/services/agent-runner.d.ts.map +1 -0
  544. package/dist/services/agent-runner.js +185 -0
  545. package/dist/services/agent-runner.js.map +1 -0
  546. package/dist/services/atomic-write.d.ts +12 -0
  547. package/dist/services/atomic-write.d.ts.map +1 -0
  548. package/dist/services/atomic-write.js +27 -0
  549. package/dist/services/atomic-write.js.map +1 -0
  550. package/dist/services/auth/auth.d.ts +121 -0
  551. package/dist/services/auth/auth.d.ts.map +1 -0
  552. package/dist/services/auth/auth.js +233 -0
  553. package/dist/services/auth/auth.js.map +1 -0
  554. package/dist/services/auth/aws.d.ts +27 -0
  555. package/dist/services/auth/aws.d.ts.map +1 -0
  556. package/dist/services/auth/aws.js +109 -0
  557. package/dist/services/auth/aws.js.map +1 -0
  558. package/dist/services/auth/index.d.ts +6 -0
  559. package/dist/services/auth/index.d.ts.map +1 -0
  560. package/dist/services/auth/index.js +17 -0
  561. package/dist/services/auth/index.js.map +1 -0
  562. package/dist/services/auto-fix/autoFixConfig.d.ts +33 -0
  563. package/dist/services/auto-fix/autoFixConfig.d.ts.map +1 -0
  564. package/dist/services/auto-fix/autoFixConfig.js +61 -0
  565. package/dist/services/auto-fix/autoFixConfig.js.map +1 -0
  566. package/dist/services/auto-fix/autoFixHook.d.ts +20 -0
  567. package/dist/services/auto-fix/autoFixHook.d.ts.map +1 -0
  568. package/dist/services/auto-fix/autoFixHook.js +90 -0
  569. package/dist/services/auto-fix/autoFixHook.js.map +1 -0
  570. package/dist/services/auto-fix/autoFixRunner.d.ts +60 -0
  571. package/dist/services/auto-fix/autoFixRunner.d.ts.map +1 -0
  572. package/dist/services/auto-fix/autoFixRunner.js +207 -0
  573. package/dist/services/auto-fix/autoFixRunner.js.map +1 -0
  574. package/dist/services/auto-fix/index.d.ts +7 -0
  575. package/dist/services/auto-fix/index.d.ts.map +1 -0
  576. package/dist/services/auto-fix/index.js +17 -0
  577. package/dist/services/auto-fix/index.js.map +1 -0
  578. package/dist/services/commit-plan.d.ts +17 -0
  579. package/dist/services/commit-plan.d.ts.map +1 -0
  580. package/dist/services/commit-plan.js +161 -0
  581. package/dist/services/commit-plan.js.map +1 -0
  582. package/dist/services/compact/auto-compact.d.ts +119 -0
  583. package/dist/services/compact/auto-compact.d.ts.map +1 -0
  584. package/dist/services/compact/auto-compact.js +273 -0
  585. package/dist/services/compact/auto-compact.js.map +1 -0
  586. package/dist/services/compact/compact.d.ts +65 -0
  587. package/dist/services/compact/compact.d.ts.map +1 -0
  588. package/dist/services/compact/compact.js +162 -0
  589. package/dist/services/compact/compact.js.map +1 -0
  590. package/dist/services/compact/coordinator.d.ts +26 -0
  591. package/dist/services/compact/coordinator.d.ts.map +1 -0
  592. package/dist/services/compact/coordinator.js +44 -0
  593. package/dist/services/compact/coordinator.js.map +1 -0
  594. package/dist/services/compact/index.d.ts +11 -0
  595. package/dist/services/compact/index.d.ts.map +1 -0
  596. package/dist/services/compact/index.js +25 -0
  597. package/dist/services/compact/index.js.map +1 -0
  598. package/dist/services/compact/micro-compact.d.ts +21 -0
  599. package/dist/services/compact/micro-compact.d.ts.map +1 -0
  600. package/dist/services/compact/micro-compact.js +99 -0
  601. package/dist/services/compact/micro-compact.js.map +1 -0
  602. package/dist/services/compact/summary-generator.d.ts +40 -0
  603. package/dist/services/compact/summary-generator.d.ts.map +1 -0
  604. package/dist/services/compact/summary-generator.js +226 -0
  605. package/dist/services/compact/summary-generator.js.map +1 -0
  606. package/dist/services/concurrent-sessions.d.ts +97 -0
  607. package/dist/services/concurrent-sessions.d.ts.map +1 -0
  608. package/dist/services/concurrent-sessions.js +265 -0
  609. package/dist/services/concurrent-sessions.js.map +1 -0
  610. package/dist/services/config-dir.d.ts +18 -0
  611. package/dist/services/config-dir.d.ts.map +1 -0
  612. package/dist/services/config-dir.js +118 -0
  613. package/dist/services/config-dir.js.map +1 -0
  614. package/dist/services/config.d.ts +55 -0
  615. package/dist/services/config.d.ts.map +1 -0
  616. package/dist/services/config.js +351 -0
  617. package/dist/services/config.js.map +1 -0
  618. package/dist/services/diagnostic-tracking/diagnosticTracking.d.ts +58 -0
  619. package/dist/services/diagnostic-tracking/diagnosticTracking.d.ts.map +1 -0
  620. package/dist/services/diagnostic-tracking/diagnosticTracking.js +167 -0
  621. package/dist/services/diagnostic-tracking/diagnosticTracking.js.map +1 -0
  622. package/dist/services/diagnostic-tracking/formatter.d.ts +17 -0
  623. package/dist/services/diagnostic-tracking/formatter.d.ts.map +1 -0
  624. package/dist/services/diagnostic-tracking/formatter.js +78 -0
  625. package/dist/services/diagnostic-tracking/formatter.js.map +1 -0
  626. package/dist/services/diagnostic-tracking/index.d.ts +7 -0
  627. package/dist/services/diagnostic-tracking/index.d.ts.map +1 -0
  628. package/dist/services/diagnostic-tracking/index.js +19 -0
  629. package/dist/services/diagnostic-tracking/index.js.map +1 -0
  630. package/dist/services/diagnostic-tracking/types.d.ts +52 -0
  631. package/dist/services/diagnostic-tracking/types.d.ts.map +1 -0
  632. package/dist/services/diagnostic-tracking/types.js +27 -0
  633. package/dist/services/diagnostic-tracking/types.js.map +1 -0
  634. package/dist/services/doctor.d.ts +35 -0
  635. package/dist/services/doctor.d.ts.map +1 -0
  636. package/dist/services/doctor.js +417 -0
  637. package/dist/services/doctor.js.map +1 -0
  638. package/dist/services/file-context.d.ts +21 -0
  639. package/dist/services/file-context.d.ts.map +1 -0
  640. package/dist/services/file-context.js +194 -0
  641. package/dist/services/file-context.js.map +1 -0
  642. package/dist/services/file-glob.d.ts +30 -0
  643. package/dist/services/file-glob.d.ts.map +1 -0
  644. package/dist/services/file-glob.js +140 -0
  645. package/dist/services/file-glob.js.map +1 -0
  646. package/dist/services/format.d.ts +2 -0
  647. package/dist/services/format.d.ts.map +1 -0
  648. package/dist/services/format.js +20 -0
  649. package/dist/services/format.js.map +1 -0
  650. package/dist/services/global-config.d.ts +161 -0
  651. package/dist/services/global-config.d.ts.map +1 -0
  652. package/dist/services/global-config.js +166 -0
  653. package/dist/services/global-config.js.map +1 -0
  654. package/dist/services/goal-storage.d.ts +22 -0
  655. package/dist/services/goal-storage.d.ts.map +1 -0
  656. package/dist/services/goal-storage.js +153 -0
  657. package/dist/services/goal-storage.js.map +1 -0
  658. package/dist/services/llm.d.ts +190 -0
  659. package/dist/services/llm.d.ts.map +1 -0
  660. package/dist/services/llm.js +740 -0
  661. package/dist/services/llm.js.map +1 -0
  662. package/dist/services/mcp/index.d.ts +5 -0
  663. package/dist/services/mcp/index.d.ts.map +1 -0
  664. package/dist/services/mcp/index.js +16 -0
  665. package/dist/services/mcp/index.js.map +1 -0
  666. package/dist/services/mcp/transports.d.ts +106 -0
  667. package/dist/services/mcp/transports.d.ts.map +1 -0
  668. package/dist/services/mcp/transports.js +375 -0
  669. package/dist/services/mcp/transports.js.map +1 -0
  670. package/dist/services/memory.d.ts +39 -0
  671. package/dist/services/memory.d.ts.map +1 -0
  672. package/dist/services/memory.js +88 -0
  673. package/dist/services/memory.js.map +1 -0
  674. package/dist/services/model-catalog.d.ts +14 -0
  675. package/dist/services/model-catalog.d.ts.map +1 -0
  676. package/dist/services/model-catalog.js +73 -0
  677. package/dist/services/model-catalog.js.map +1 -0
  678. package/dist/services/model-client-pool.d.ts +37 -0
  679. package/dist/services/model-client-pool.d.ts.map +1 -0
  680. package/dist/services/model-client-pool.js +88 -0
  681. package/dist/services/model-client-pool.js.map +1 -0
  682. package/dist/services/model-context.d.ts +89 -0
  683. package/dist/services/model-context.d.ts.map +1 -0
  684. package/dist/services/model-context.js +395 -0
  685. package/dist/services/model-context.js.map +1 -0
  686. package/dist/services/model-registry.d.ts +98 -0
  687. package/dist/services/model-registry.d.ts.map +1 -0
  688. package/dist/services/model-registry.js +271 -0
  689. package/dist/services/model-registry.js.map +1 -0
  690. package/dist/services/project-instructions.d.ts +16 -0
  691. package/dist/services/project-instructions.d.ts.map +1 -0
  692. package/dist/services/project-instructions.js +135 -0
  693. package/dist/services/project-instructions.js.map +1 -0
  694. package/dist/services/prompt-context.d.ts +3 -0
  695. package/dist/services/prompt-context.d.ts.map +1 -0
  696. package/dist/services/prompt-context.js +13 -0
  697. package/dist/services/prompt-context.js.map +1 -0
  698. package/dist/services/provider-diagnostics.d.ts +30 -0
  699. package/dist/services/provider-diagnostics.d.ts.map +1 -0
  700. package/dist/services/provider-diagnostics.js +314 -0
  701. package/dist/services/provider-diagnostics.js.map +1 -0
  702. package/dist/services/provider-resilience/circuit-breaker.d.ts +32 -0
  703. package/dist/services/provider-resilience/circuit-breaker.d.ts.map +1 -0
  704. package/dist/services/provider-resilience/circuit-breaker.js +88 -0
  705. package/dist/services/provider-resilience/circuit-breaker.js.map +1 -0
  706. package/dist/services/provider-resilience/coordinator.d.ts +38 -0
  707. package/dist/services/provider-resilience/coordinator.d.ts.map +1 -0
  708. package/dist/services/provider-resilience/coordinator.js +155 -0
  709. package/dist/services/provider-resilience/coordinator.js.map +1 -0
  710. package/dist/services/provider-resilience/error-classifier.d.ts +15 -0
  711. package/dist/services/provider-resilience/error-classifier.d.ts.map +1 -0
  712. package/dist/services/provider-resilience/error-classifier.js +162 -0
  713. package/dist/services/provider-resilience/error-classifier.js.map +1 -0
  714. package/dist/services/provider-resilience/index.d.ts +10 -0
  715. package/dist/services/provider-resilience/index.d.ts.map +1 -0
  716. package/dist/services/provider-resilience/index.js +23 -0
  717. package/dist/services/provider-resilience/index.js.map +1 -0
  718. package/dist/services/provider-resilience/request-gate.d.ts +41 -0
  719. package/dist/services/provider-resilience/request-gate.d.ts.map +1 -0
  720. package/dist/services/provider-resilience/request-gate.js +82 -0
  721. package/dist/services/provider-resilience/request-gate.js.map +1 -0
  722. package/dist/services/provider-resilience/stream-recovery.d.ts +46 -0
  723. package/dist/services/provider-resilience/stream-recovery.d.ts.map +1 -0
  724. package/dist/services/provider-resilience/stream-recovery.js +106 -0
  725. package/dist/services/provider-resilience/stream-recovery.js.map +1 -0
  726. package/dist/services/provider-resilience/types.d.ts +100 -0
  727. package/dist/services/provider-resilience/types.d.ts.map +1 -0
  728. package/dist/services/provider-resilience/types.js +22 -0
  729. package/dist/services/provider-resilience/types.js.map +1 -0
  730. package/dist/services/redaction.d.ts +2 -0
  731. package/dist/services/redaction.d.ts.map +1 -0
  732. package/dist/services/redaction.js +27 -0
  733. package/dist/services/redaction.js.map +1 -0
  734. package/dist/services/session-index.d.ts +50 -0
  735. package/dist/services/session-index.d.ts.map +1 -0
  736. package/dist/services/session-index.js +196 -0
  737. package/dist/services/session-index.js.map +1 -0
  738. package/dist/services/session-memory/index.d.ts +6 -0
  739. package/dist/services/session-memory/index.d.ts.map +1 -0
  740. package/dist/services/session-memory/index.js +15 -0
  741. package/dist/services/session-memory/index.js.map +1 -0
  742. package/dist/services/session-memory/prompts.d.ts +23 -0
  743. package/dist/services/session-memory/prompts.d.ts.map +1 -0
  744. package/dist/services/session-memory/prompts.js +70 -0
  745. package/dist/services/session-memory/prompts.js.map +1 -0
  746. package/dist/services/session-memory/sessionMemory.d.ts +64 -0
  747. package/dist/services/session-memory/sessionMemory.d.ts.map +1 -0
  748. package/dist/services/session-memory/sessionMemory.js +243 -0
  749. package/dist/services/session-memory/sessionMemory.js.map +1 -0
  750. package/dist/services/session-storage.d.ts +378 -0
  751. package/dist/services/session-storage.d.ts.map +1 -0
  752. package/dist/services/session-storage.js +1026 -0
  753. package/dist/services/session-storage.js.map +1 -0
  754. package/dist/services/smart-routing.d.ts +41 -0
  755. package/dist/services/smart-routing.d.ts.map +1 -0
  756. package/dist/services/smart-routing.js +134 -0
  757. package/dist/services/smart-routing.js.map +1 -0
  758. package/dist/services/storage-maintenance.d.ts +53 -0
  759. package/dist/services/storage-maintenance.d.ts.map +1 -0
  760. package/dist/services/storage-maintenance.js +370 -0
  761. package/dist/services/storage-maintenance.js.map +1 -0
  762. package/dist/services/task-manager.d.ts +156 -0
  763. package/dist/services/task-manager.d.ts.map +1 -0
  764. package/dist/services/task-manager.js +301 -0
  765. package/dist/services/task-manager.js.map +1 -0
  766. package/dist/services/usage-state.d.ts +70 -0
  767. package/dist/services/usage-state.d.ts.map +1 -0
  768. package/dist/services/usage-state.js +257 -0
  769. package/dist/services/usage-state.js.map +1 -0
  770. package/dist/services/verification-profile.d.ts +51 -0
  771. package/dist/services/verification-profile.d.ts.map +1 -0
  772. package/dist/services/verification-profile.js +307 -0
  773. package/dist/services/verification-profile.js.map +1 -0
  774. package/dist/services/web-search-adapters.d.ts +24 -0
  775. package/dist/services/web-search-adapters.d.ts.map +1 -0
  776. package/dist/services/web-search-adapters.js +271 -0
  777. package/dist/services/web-search-adapters.js.map +1 -0
  778. package/dist/services/web-search-mcp.d.ts +32 -0
  779. package/dist/services/web-search-mcp.d.ts.map +1 -0
  780. package/dist/services/web-search-mcp.js +270 -0
  781. package/dist/services/web-search-mcp.js.map +1 -0
  782. package/dist/services/web-search-provider.d.ts +28 -0
  783. package/dist/services/web-search-provider.d.ts.map +1 -0
  784. package/dist/services/web-search-provider.js +127 -0
  785. package/dist/services/web-search-provider.js.map +1 -0
  786. package/dist/services/workspace-diff.d.ts +27 -0
  787. package/dist/services/workspace-diff.d.ts.map +1 -0
  788. package/dist/services/workspace-diff.js +160 -0
  789. package/dist/services/workspace-diff.js.map +1 -0
  790. package/dist/services/workspace-state.d.ts +25 -0
  791. package/dist/services/workspace-state.d.ts.map +1 -0
  792. package/dist/services/workspace-state.js +115 -0
  793. package/dist/services/workspace-state.js.map +1 -0
  794. package/dist/services/yaml-config.d.ts +57 -0
  795. package/dist/services/yaml-config.d.ts.map +1 -0
  796. package/dist/services/yaml-config.js +176 -0
  797. package/dist/services/yaml-config.js.map +1 -0
  798. package/dist/skills/discovery.d.ts +22 -0
  799. package/dist/skills/discovery.d.ts.map +1 -0
  800. package/dist/skills/discovery.js +75 -0
  801. package/dist/skills/discovery.js.map +1 -0
  802. package/dist/skills/index.d.ts +11 -0
  803. package/dist/skills/index.d.ts.map +1 -0
  804. package/dist/skills/index.js +27 -0
  805. package/dist/skills/index.js.map +1 -0
  806. package/dist/skills/loader.d.ts +53 -0
  807. package/dist/skills/loader.d.ts.map +1 -0
  808. package/dist/skills/loader.js +406 -0
  809. package/dist/skills/loader.js.map +1 -0
  810. package/dist/skills/registry.d.ts +41 -0
  811. package/dist/skills/registry.d.ts.map +1 -0
  812. package/dist/skills/registry.js +157 -0
  813. package/dist/skills/registry.js.map +1 -0
  814. package/dist/skills/runtime.d.ts +46 -0
  815. package/dist/skills/runtime.d.ts.map +1 -0
  816. package/dist/skills/runtime.js +331 -0
  817. package/dist/skills/runtime.js.map +1 -0
  818. package/dist/skills/types.d.ts +112 -0
  819. package/dist/skills/types.d.ts.map +1 -0
  820. package/dist/skills/types.js +24 -0
  821. package/dist/skills/types.js.map +1 -0
  822. package/dist/terminal-ui/completion.d.ts +13 -0
  823. package/dist/terminal-ui/completion.d.ts.map +1 -0
  824. package/dist/terminal-ui/completion.js +95 -0
  825. package/dist/terminal-ui/completion.js.map +1 -0
  826. package/dist/terminal-ui/editor.d.ts +17 -0
  827. package/dist/terminal-ui/editor.d.ts.map +1 -0
  828. package/dist/terminal-ui/editor.js +53 -0
  829. package/dist/terminal-ui/editor.js.map +1 -0
  830. package/dist/terminal-ui/launch.d.ts +121 -0
  831. package/dist/terminal-ui/launch.d.ts.map +1 -0
  832. package/dist/terminal-ui/launch.js +1247 -0
  833. package/dist/terminal-ui/launch.js.map +1 -0
  834. package/dist/terminal-ui/output-queue.d.ts +43 -0
  835. package/dist/terminal-ui/output-queue.d.ts.map +1 -0
  836. package/dist/terminal-ui/output-queue.js +139 -0
  837. package/dist/terminal-ui/output-queue.js.map +1 -0
  838. package/dist/terminal-ui/raw-editor.d.ts +106 -0
  839. package/dist/terminal-ui/raw-editor.d.ts.map +1 -0
  840. package/dist/terminal-ui/raw-editor.js +704 -0
  841. package/dist/terminal-ui/raw-editor.js.map +1 -0
  842. package/dist/tools/_validate.d.ts +11 -0
  843. package/dist/tools/_validate.d.ts.map +1 -0
  844. package/dist/tools/_validate.js +55 -0
  845. package/dist/tools/_validate.js.map +1 -0
  846. package/dist/tools/bash_security.d.ts +74 -0
  847. package/dist/tools/bash_security.d.ts.map +1 -0
  848. package/dist/tools/bash_security.js +356 -0
  849. package/dist/tools/bash_security.js.map +1 -0
  850. package/dist/tools/git.d.ts +15 -0
  851. package/dist/tools/git.d.ts.map +1 -0
  852. package/dist/tools/git.js +285 -0
  853. package/dist/tools/git.js.map +1 -0
  854. package/dist/tools/index.d.ts +40 -0
  855. package/dist/tools/index.d.ts.map +1 -0
  856. package/dist/tools/index.js +1881 -0
  857. package/dist/tools/index.js.map +1 -0
  858. package/dist/tools/lsp.d.ts +18 -0
  859. package/dist/tools/lsp.d.ts.map +1 -0
  860. package/dist/tools/lsp.js +548 -0
  861. package/dist/tools/lsp.js.map +1 -0
  862. package/dist/tools/mcp.d.ts +86 -0
  863. package/dist/tools/mcp.d.ts.map +1 -0
  864. package/dist/tools/mcp.js +570 -0
  865. package/dist/tools/mcp.js.map +1 -0
  866. package/dist/tools/plan.d.ts +18 -0
  867. package/dist/tools/plan.d.ts.map +1 -0
  868. package/dist/tools/plan.js +82 -0
  869. package/dist/tools/plan.js.map +1 -0
  870. package/dist/tools/todo.d.ts +18 -0
  871. package/dist/tools/todo.d.ts.map +1 -0
  872. package/dist/tools/todo.js +161 -0
  873. package/dist/tools/todo.js.map +1 -0
  874. package/dist/tools/web.d.ts +26 -0
  875. package/dist/tools/web.d.ts.map +1 -0
  876. package/dist/tools/web.js +586 -0
  877. package/dist/tools/web.js.map +1 -0
  878. package/dist/tui-core/frame.d.ts +37 -0
  879. package/dist/tui-core/frame.d.ts.map +1 -0
  880. package/dist/tui-core/frame.js +157 -0
  881. package/dist/tui-core/frame.js.map +1 -0
  882. package/dist/tui-core/input-parser.d.ts +36 -0
  883. package/dist/tui-core/input-parser.d.ts.map +1 -0
  884. package/dist/tui-core/input-parser.js +291 -0
  885. package/dist/tui-core/input-parser.js.map +1 -0
  886. package/dist/tui-core/style.d.ts +103 -0
  887. package/dist/tui-core/style.d.ts.map +1 -0
  888. package/dist/tui-core/style.js +269 -0
  889. package/dist/tui-core/style.js.map +1 -0
  890. package/dist/tui-core/terminal-writer.d.ts +34 -0
  891. package/dist/tui-core/terminal-writer.d.ts.map +1 -0
  892. package/dist/tui-core/terminal-writer.js +105 -0
  893. package/dist/tui-core/terminal-writer.js.map +1 -0
  894. package/dist/tui-ui/inline-surface.d.ts +191 -0
  895. package/dist/tui-ui/inline-surface.d.ts.map +1 -0
  896. package/dist/tui-ui/inline-surface.js +636 -0
  897. package/dist/tui-ui/inline-surface.js.map +1 -0
  898. package/dist/tui-ui/input-ownership.d.ts +46 -0
  899. package/dist/tui-ui/input-ownership.d.ts.map +1 -0
  900. package/dist/tui-ui/input-ownership.js +74 -0
  901. package/dist/tui-ui/input-ownership.js.map +1 -0
  902. package/dist/tui-ui/launch.d.ts +11 -0
  903. package/dist/tui-ui/launch.d.ts.map +1 -0
  904. package/dist/tui-ui/launch.js +632 -0
  905. package/dist/tui-ui/launch.js.map +1 -0
  906. package/dist/tui-ui/layout.d.ts +59 -0
  907. package/dist/tui-ui/layout.d.ts.map +1 -0
  908. package/dist/tui-ui/layout.js +426 -0
  909. package/dist/tui-ui/layout.js.map +1 -0
  910. package/dist/tui-ui/pickers.d.ts +13 -0
  911. package/dist/tui-ui/pickers.d.ts.map +1 -0
  912. package/dist/tui-ui/pickers.js +38 -0
  913. package/dist/tui-ui/pickers.js.map +1 -0
  914. package/dist/tui-ui/render-scheduler.d.ts +37 -0
  915. package/dist/tui-ui/render-scheduler.d.ts.map +1 -0
  916. package/dist/tui-ui/render-scheduler.js +118 -0
  917. package/dist/tui-ui/render-scheduler.js.map +1 -0
  918. package/dist/tui-ui/runner.d.ts +149 -0
  919. package/dist/tui-ui/runner.d.ts.map +1 -0
  920. package/dist/tui-ui/runner.js +1255 -0
  921. package/dist/tui-ui/runner.js.map +1 -0
  922. package/dist/tui-ui/state.d.ts +219 -0
  923. package/dist/tui-ui/state.d.ts.map +1 -0
  924. package/dist/tui-ui/state.js +569 -0
  925. package/dist/tui-ui/state.js.map +1 -0
  926. package/dist/tui-ui/terminal-image.d.ts +24 -0
  927. package/dist/tui-ui/terminal-image.d.ts.map +1 -0
  928. package/dist/tui-ui/terminal-image.js +211 -0
  929. package/dist/tui-ui/terminal-image.js.map +1 -0
  930. package/dist/tui-ui/theme-profile.d.ts +25 -0
  931. package/dist/tui-ui/theme-profile.d.ts.map +1 -0
  932. package/dist/tui-ui/theme-profile.js +130 -0
  933. package/dist/tui-ui/theme-profile.js.map +1 -0
  934. package/dist/tui-ui/theme.d.ts +13 -0
  935. package/dist/tui-ui/theme.d.ts.map +1 -0
  936. package/dist/tui-ui/theme.js +20 -0
  937. package/dist/tui-ui/theme.js.map +1 -0
  938. package/dist/tui-ui/transcript-cache.d.ts +35 -0
  939. package/dist/tui-ui/transcript-cache.d.ts.map +1 -0
  940. package/dist/tui-ui/transcript-cache.js +74 -0
  941. package/dist/tui-ui/transcript-cache.js.map +1 -0
  942. package/dist/tui-ui/transcript-inspector-layout.d.ts +9 -0
  943. package/dist/tui-ui/transcript-inspector-layout.d.ts.map +1 -0
  944. package/dist/tui-ui/transcript-inspector-layout.js +97 -0
  945. package/dist/tui-ui/transcript-inspector-layout.js.map +1 -0
  946. package/dist/tui-ui/transcript-inspector-surface.d.ts +18 -0
  947. package/dist/tui-ui/transcript-inspector-surface.d.ts.map +1 -0
  948. package/dist/tui-ui/transcript-inspector-surface.js +88 -0
  949. package/dist/tui-ui/transcript-inspector-surface.js.map +1 -0
  950. package/dist/tui-ui/transcript-inspector.d.ts +35 -0
  951. package/dist/tui-ui/transcript-inspector.d.ts.map +1 -0
  952. package/dist/tui-ui/transcript-inspector.js +128 -0
  953. package/dist/tui-ui/transcript-inspector.js.map +1 -0
  954. package/dist/tui-ui/transcript-layout.d.ts +22 -0
  955. package/dist/tui-ui/transcript-layout.d.ts.map +1 -0
  956. package/dist/tui-ui/transcript-layout.js +442 -0
  957. package/dist/tui-ui/transcript-layout.js.map +1 -0
  958. package/dist/ui/box.d.ts +48 -0
  959. package/dist/ui/box.d.ts.map +1 -0
  960. package/dist/ui/box.js +196 -0
  961. package/dist/ui/box.js.map +1 -0
  962. package/dist/ui/command-panel.d.ts +79 -0
  963. package/dist/ui/command-panel.d.ts.map +1 -0
  964. package/dist/ui/command-panel.js +460 -0
  965. package/dist/ui/command-panel.js.map +1 -0
  966. package/dist/ui/file-completion.d.ts +65 -0
  967. package/dist/ui/file-completion.d.ts.map +1 -0
  968. package/dist/ui/file-completion.js +214 -0
  969. package/dist/ui/file-completion.js.map +1 -0
  970. package/dist/ui/markdown.d.ts +18 -0
  971. package/dist/ui/markdown.d.ts.map +1 -0
  972. package/dist/ui/markdown.js +301 -0
  973. package/dist/ui/markdown.js.map +1 -0
  974. package/dist/ui/multiline-input.d.ts +51 -0
  975. package/dist/ui/multiline-input.d.ts.map +1 -0
  976. package/dist/ui/multiline-input.js +100 -0
  977. package/dist/ui/multiline-input.js.map +1 -0
  978. package/dist/ui/progress.d.ts +34 -0
  979. package/dist/ui/progress.d.ts.map +1 -0
  980. package/dist/ui/progress.js +85 -0
  981. package/dist/ui/progress.js.map +1 -0
  982. package/dist/ui/shared/command-palette.d.ts +3 -0
  983. package/dist/ui/shared/command-palette.d.ts.map +1 -0
  984. package/dist/ui/shared/command-palette.js +54 -0
  985. package/dist/ui/shared/command-palette.js.map +1 -0
  986. package/dist/ui/shared/command-suggestions.d.ts +19 -0
  987. package/dist/ui/shared/command-suggestions.d.ts.map +1 -0
  988. package/dist/ui/shared/command-suggestions.js +67 -0
  989. package/dist/ui/shared/command-suggestions.js.map +1 -0
  990. package/dist/ui/shared/input-frame.d.ts +19 -0
  991. package/dist/ui/shared/input-frame.d.ts.map +1 -0
  992. package/dist/ui/shared/input-frame.js +74 -0
  993. package/dist/ui/shared/input-frame.js.map +1 -0
  994. package/dist/ui/shared/text.d.ts +5 -0
  995. package/dist/ui/shared/text.d.ts.map +1 -0
  996. package/dist/ui/shared/text.js +55 -0
  997. package/dist/ui/shared/text.js.map +1 -0
  998. package/dist/ui/shared/types.d.ts +27 -0
  999. package/dist/ui/shared/types.d.ts.map +1 -0
  1000. package/dist/ui/shared/types.js +3 -0
  1001. package/dist/ui/shared/types.js.map +1 -0
  1002. package/dist/ui/status-bar.d.ts +33 -0
  1003. package/dist/ui/status-bar.d.ts.map +1 -0
  1004. package/dist/ui/status-bar.js +92 -0
  1005. package/dist/ui/status-bar.js.map +1 -0
  1006. package/dist/ui/stream-markdown.d.ts +50 -0
  1007. package/dist/ui/stream-markdown.d.ts.map +1 -0
  1008. package/dist/ui/stream-markdown.js +221 -0
  1009. package/dist/ui/stream-markdown.js.map +1 -0
  1010. package/dist/ui/suggestions.d.ts +35 -0
  1011. package/dist/ui/suggestions.d.ts.map +1 -0
  1012. package/dist/ui/suggestions.js +118 -0
  1013. package/dist/ui/suggestions.js.map +1 -0
  1014. package/dist/ui/tool-preview.d.ts +34 -0
  1015. package/dist/ui/tool-preview.d.ts.map +1 -0
  1016. package/dist/ui/tool-preview.js +127 -0
  1017. package/dist/ui/tool-preview.js.map +1 -0
  1018. package/dist/ui/user-input.d.ts +11 -0
  1019. package/dist/ui/user-input.d.ts.map +1 -0
  1020. package/dist/ui/user-input.js +70 -0
  1021. package/dist/ui/user-input.js.map +1 -0
  1022. package/dist/ui-v2/components/command-palette.d.ts +2 -0
  1023. package/dist/ui-v2/components/command-palette.d.ts.map +1 -0
  1024. package/dist/ui-v2/components/command-palette.js +18 -0
  1025. package/dist/ui-v2/components/command-palette.js.map +1 -0
  1026. package/dist/ui-v2/components/edit-preview-picker.d.ts +26 -0
  1027. package/dist/ui-v2/components/edit-preview-picker.d.ts.map +1 -0
  1028. package/dist/ui-v2/components/edit-preview-picker.js +79 -0
  1029. package/dist/ui-v2/components/edit-preview-picker.js.map +1 -0
  1030. package/dist/ui-v2/components/session-picker.d.ts +19 -0
  1031. package/dist/ui-v2/components/session-picker.d.ts.map +1 -0
  1032. package/dist/ui-v2/components/session-picker.js +52 -0
  1033. package/dist/ui-v2/components/session-picker.js.map +1 -0
  1034. package/dist/ui-v2/components/shell.d.ts +36 -0
  1035. package/dist/ui-v2/components/shell.d.ts.map +1 -0
  1036. package/dist/ui-v2/components/shell.js +131 -0
  1037. package/dist/ui-v2/components/shell.js.map +1 -0
  1038. package/dist/ui-v2/index.d.ts +11 -0
  1039. package/dist/ui-v2/index.d.ts.map +1 -0
  1040. package/dist/ui-v2/index.js +27 -0
  1041. package/dist/ui-v2/index.js.map +1 -0
  1042. package/dist/ui-v2/runtime/text.d.ts +2 -0
  1043. package/dist/ui-v2/runtime/text.d.ts.map +1 -0
  1044. package/dist/ui-v2/runtime/text.js +18 -0
  1045. package/dist/ui-v2/runtime/text.js.map +1 -0
  1046. package/dist/ui-v2/state/input-reducer.d.ts +39 -0
  1047. package/dist/ui-v2/state/input-reducer.d.ts.map +1 -0
  1048. package/dist/ui-v2/state/input-reducer.js +82 -0
  1049. package/dist/ui-v2/state/input-reducer.js.map +1 -0
  1050. package/dist/ui-v2/state/picker.d.ts +16 -0
  1051. package/dist/ui-v2/state/picker.d.ts.map +1 -0
  1052. package/dist/ui-v2/state/picker.js +52 -0
  1053. package/dist/ui-v2/state/picker.js.map +1 -0
  1054. package/dist/ui-v2/state/sessions.d.ts +15 -0
  1055. package/dist/ui-v2/state/sessions.d.ts.map +1 -0
  1056. package/dist/ui-v2/state/sessions.js +70 -0
  1057. package/dist/ui-v2/state/sessions.js.map +1 -0
  1058. package/dist/ui-v2/state/suggestions.d.ts +2 -0
  1059. package/dist/ui-v2/state/suggestions.d.ts.map +1 -0
  1060. package/dist/ui-v2/state/suggestions.js +18 -0
  1061. package/dist/ui-v2/state/suggestions.js.map +1 -0
  1062. package/dist/ui-v2/types.d.ts +2 -0
  1063. package/dist/ui-v2/types.d.ts.map +1 -0
  1064. package/dist/ui-v2/types.js +18 -0
  1065. package/dist/ui-v2/types.js.map +1 -0
  1066. package/dist/utils/token-estimate.d.ts +42 -0
  1067. package/dist/utils/token-estimate.d.ts.map +1 -0
  1068. package/dist/utils/token-estimate.js +150 -0
  1069. package/dist/utils/token-estimate.js.map +1 -0
  1070. package/package.json +100 -0
@@ -0,0 +1,1881 @@
1
+ "use strict";
2
+ /**
3
+ * orion code - 工具集
4
+ *
5
+ * 定义 Agent 可用的工具(Tool System v2):
6
+ * - read_file: 读取文件内容
7
+ * - write_file: 写入文件
8
+ * - list_files: 列出目录
9
+ * - exec_command: 执行 shell 命令
10
+ *
11
+ * 使用 buildTool() 工厂模式。
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.DEFAULT_SANDBOX_OPTIONS = exports.wrapForSandbox = exports.assessCommandSecurity = exports.isPotentiallyDestructive = exports.checkDangerousCommand = exports.isReadOnlyCommand = exports.POTENTIALLY_DESTRUCTIVE_PATTERNS = exports.DANGEROUS_PATTERNS = exports.READ_ONLY_COMMANDS = exports.TOOLS = void 0;
15
+ exports.getRuntimeTools = getRuntimeTools;
16
+ exports.executeTool = executeTool;
17
+ exports.getToolNames = getToolNames;
18
+ const child_process_1 = require("child_process");
19
+ const fs_1 = require("fs");
20
+ const path_1 = require("path");
21
+ const readline_1 = require("readline");
22
+ const tool_1 = require("../framework/tool");
23
+ const tool_state_1 = require("../framework/tool-state");
24
+ const tool_artifacts_1 = require("../core/tool-artifacts");
25
+ const environment_1 = require("../product/environment");
26
+ const memory_1 = require("../memory");
27
+ const semantic_search_1 = require("../memory/semantic-search");
28
+ const session_storage_1 = require("../services/session-storage");
29
+ const web_1 = require("./web");
30
+ const mcp_1 = require("./mcp");
31
+ const todo_1 = require("./todo");
32
+ const plan_1 = require("./plan");
33
+ const git_1 = require("./git");
34
+ const lsp_1 = require("./lsp");
35
+ const tools_1 = require("../runtime/goals/tools");
36
+ const bash_security_1 = require("./bash_security");
37
+ const BATCH_READ_ALLOWED_TOOLS = new Set(['git_status', 'list_files', 'glob', 'grep', 'read_file']);
38
+ const BATCH_READ_MAX_STEPS = 8;
39
+ const BATCH_READ_STEP_OUTPUT_MAX_BYTES = 1600;
40
+ function compactOneLine(text, maxLength) {
41
+ const compact = text.replace(/\s+/g, ' ').trim();
42
+ if (compact.length <= maxLength)
43
+ return compact;
44
+ if (maxLength <= 3)
45
+ return compact.slice(0, maxLength);
46
+ const headLength = Math.ceil((maxLength - 3) * 0.55);
47
+ const tailLength = Math.floor((maxLength - 3) * 0.45);
48
+ return `${compact.slice(0, headLength)}...${compact.slice(-tailLength)}`;
49
+ }
50
+ function summarizeFailedToolResult(result) {
51
+ const details = [];
52
+ if (result.error) {
53
+ details.push(compactOneLine(result.error, 80));
54
+ }
55
+ const output = result.output ? compactOneLine(result.output, 120) : '';
56
+ if (output && output !== result.error) {
57
+ details.push(`output: ${output}`);
58
+ }
59
+ return details.join('; ');
60
+ }
61
+ // ============================================================================
62
+ // 工具集
63
+ // ============================================================================
64
+ exports.TOOLS = [
65
+ // Web tools (P0)
66
+ ...web_1.WEB_TOOLS,
67
+ // MCP tools (P0)
68
+ ...mcp_1.MCP_TOOLS,
69
+ // Git tools (P0 - Issue #18/#23)
70
+ ...git_1.GIT_TOOLS,
71
+ // LSP tools (P0 - Phase 6)
72
+ ...lsp_1.lspTools,
73
+ // Todo tools (P1)
74
+ ...todo_1.TODO_TOOLS,
75
+ // Plan mode tools (P1)
76
+ ...plan_1.PLAN_TOOLS,
77
+ // Goal tools (P0 - v0.2.24)
78
+ ...tools_1.GOAL_TOOLS,
79
+ // File tools
80
+ (0, tool_1.buildTool)({
81
+ name: 'read_file',
82
+ description: '读取文件内容,支持从指定行开始分页。返回文件内容字符串。',
83
+ parameters: {
84
+ type: 'object',
85
+ properties: {
86
+ path: {
87
+ type: 'string',
88
+ description: '文件路径(绝对路径或相对路径)',
89
+ },
90
+ maxLines: {
91
+ type: 'number',
92
+ description: '最大读取行数(可选,默认 500 行)',
93
+ },
94
+ offset: {
95
+ type: 'number',
96
+ description: '开始读取的行号(可选,1-based,默认第 1 行)',
97
+ },
98
+ },
99
+ required: ['path'],
100
+ },
101
+ execute: async (args, context) => {
102
+ // Ensure path is a valid string
103
+ const path = args.path;
104
+ if (!path || typeof path !== 'string') {
105
+ return { success: false, output: '', error: 'read_file requires a path parameter' };
106
+ }
107
+ const maxLines = readPositiveInteger(args.maxLines, 'maxLines', 500);
108
+ if (typeof maxLines === 'string') {
109
+ return { success: false, output: '', error: maxLines };
110
+ }
111
+ const offset = readPositiveInteger(args.offset, 'offset', 1);
112
+ if (typeof offset === 'string') {
113
+ return { success: false, output: '', error: offset };
114
+ }
115
+ return readFileSync_(path, maxLines, offset, context.cwd);
116
+ },
117
+ isReadOnly: () => true,
118
+ isConcurrencySafe: () => true,
119
+ userFacingName: args => `Read ${args.path}`,
120
+ getSummary: (args, result) => {
121
+ const path = args.path;
122
+ if (!result.success)
123
+ return `📄 read ${path} → error`;
124
+ const lines = result.output.split('\n').length;
125
+ const bytes = Buffer.byteLength(result.output, 'utf8');
126
+ return `📄 read ${path} (${lines}L, ${bytes}B)`;
127
+ },
128
+ }),
129
+ (0, tool_1.buildTool)({
130
+ name: 'write_file',
131
+ description: '将内容写入文件。如果文件不存在则创建,存在则覆盖。',
132
+ parameters: {
133
+ type: 'object',
134
+ properties: {
135
+ path: {
136
+ type: 'string',
137
+ description: '文件路径(绝对路径或相对路径)',
138
+ },
139
+ content: {
140
+ type: 'string',
141
+ description: '要写入的文件内容',
142
+ },
143
+ },
144
+ required: ['path', 'content'],
145
+ },
146
+ execute: async (args, context) => {
147
+ // Ensure path and content are valid strings
148
+ const path = args.path;
149
+ const content = args.content;
150
+ if (!path || typeof path !== 'string') {
151
+ return { success: false, output: '', error: 'write_file requires a path parameter' };
152
+ }
153
+ if (typeof content !== 'string') {
154
+ return { success: false, output: '', error: 'write_file requires a content parameter' };
155
+ }
156
+ return writeFileSync_(path, content, context.cwd);
157
+ },
158
+ isDestructive: () => true,
159
+ checkPermissions: (_args, _context) => {
160
+ // Destructive operation - ask for confirmation in default mode
161
+ return { behavior: 'ask', reason: 'Write operation may modify existing files' };
162
+ },
163
+ userFacingName: args => `Write ${args.path}`,
164
+ getSummary: (args, result) => {
165
+ const path = args.path;
166
+ if (!result.success)
167
+ return `💾 write ${path} → error`;
168
+ const bytes = Buffer.byteLength(args.content || '', 'utf8');
169
+ return `💾 write ${path} (${bytes}B)`;
170
+ },
171
+ }),
172
+ (0, tool_1.buildTool)({
173
+ name: 'list_files',
174
+ description: '列出指定目录中的文件和子目录。支持控制递归深度。',
175
+ parameters: {
176
+ type: 'object',
177
+ properties: {
178
+ path: {
179
+ type: 'string',
180
+ description: '目录路径(绝对路径或相对路径)',
181
+ },
182
+ maxDepth: {
183
+ type: 'number',
184
+ description: '最大递归深度(可选,默认 2)',
185
+ },
186
+ },
187
+ required: ['path'],
188
+ },
189
+ execute: async (args, context) => {
190
+ // Ensure path is a valid string
191
+ const path = args.path;
192
+ if (!path || typeof path !== 'string') {
193
+ return { success: false, output: '', error: 'list_files requires a path parameter' };
194
+ }
195
+ return listFiles_(path, args.maxDepth, context.cwd);
196
+ },
197
+ isReadOnly: () => true,
198
+ isConcurrencySafe: () => true,
199
+ userFacingName: args => `List ${args.path}`,
200
+ getSummary: (args, result) => {
201
+ const path = args.path;
202
+ if (!result.success)
203
+ return `📁 list ${path} → error`;
204
+ const count = result.output.split('\n').filter(Boolean).length;
205
+ return `📁 list ${path} (${count} entries)`;
206
+ },
207
+ }),
208
+ (0, tool_1.buildTool)({
209
+ name: 'exec_command',
210
+ description: '执行一个 shell 命令。返回 stdout 和 stderr。输出超过 maxOutput 会自动截断。',
211
+ parameters: {
212
+ type: 'object',
213
+ properties: {
214
+ command: {
215
+ type: 'string',
216
+ description: '要执行的 shell 命令',
217
+ },
218
+ cwd: {
219
+ type: 'string',
220
+ description: '工作目录(可选,默认当前目录)',
221
+ },
222
+ timeout: {
223
+ type: 'number',
224
+ description: '超时时间 ms(可选,默认 30000)',
225
+ },
226
+ maxOutput: {
227
+ type: 'number',
228
+ description: '最大输出字节数(可选,默认 51200 = 50KB,超出截断)',
229
+ },
230
+ },
231
+ required: ['command'],
232
+ },
233
+ execute: async (args, context) => {
234
+ // Ensure command is a valid string
235
+ const command = args.command;
236
+ if (!command || typeof command !== 'string') {
237
+ return { success: false, output: '', error: 'exec_command requires a command parameter' };
238
+ }
239
+ // Issue #32 #3.2: 传递 abortSignal
240
+ return execCommand_(command, args.cwd, args.timeout, args.maxOutput, context.abortSignal, context.cwd);
241
+ },
242
+ isDestructive: args => {
243
+ const cmd = args.command || '';
244
+ return /(rm\s+-rf|mkfs|dd\s)/.test(cmd);
245
+ },
246
+ checkPermissions: (args, _context) => {
247
+ const cmd = args.command || '';
248
+ // Use the bash_security module for comprehensive checks
249
+ const security = (0, bash_security_1.assessCommandSecurity)(cmd);
250
+ if (security.level === 'blocked') {
251
+ return {
252
+ behavior: 'deny',
253
+ reason: security.reason || `Command blocked by safety policy: ${cmd.slice(0, 50)}`,
254
+ };
255
+ }
256
+ if (security.level === 'safe' && security.isReadOnly) {
257
+ return { behavior: 'allow' };
258
+ }
259
+ if (security.level === 'caution') {
260
+ return { behavior: 'ask', reason: security.reason || 'Command requires confirmation' };
261
+ }
262
+ // Default: ask for confirmation
263
+ return { behavior: 'ask', reason: 'Command requires confirmation' };
264
+ },
265
+ isReadOnly: args => {
266
+ const cmd = args.command || '';
267
+ return (0, bash_security_1.isReadOnlyCommand)(cmd);
268
+ },
269
+ isConcurrencySafe: args => {
270
+ const cmd = args.command || '';
271
+ return (0, bash_security_1.isReadOnlyCommand)(cmd);
272
+ },
273
+ userFacingName: args => `Exec ${compactOneLine(args.command || '', 80)}`,
274
+ getSummary: (args, result) => {
275
+ const command = args.command || '';
276
+ const commandSummary = command ? `\n $ ${compactOneLine(command, 160)}` : '';
277
+ if (!result.success) {
278
+ const detail = summarizeFailedToolResult(result);
279
+ return `🔧 exec → error${detail ? ` (${detail})` : ''}${commandSummary}`;
280
+ }
281
+ const bytes = Buffer.byteLength(result.output, 'utf8');
282
+ return `🔧 exec (${bytes}B output)${commandSummary}`;
283
+ },
284
+ }),
285
+ (0, tool_1.buildTool)({
286
+ name: 'edit_file',
287
+ description: '对文件进行精确字符串替换。old_string 必须在文件中唯一匹配,否则拒绝执行。使用 replace_all 可替换所有精确匹配;只有显式 fuzzy_match=true 时才尝试宽松空白匹配。',
288
+ parameters: {
289
+ type: 'object',
290
+ properties: {
291
+ path: {
292
+ type: 'string',
293
+ description: '文件路径(绝对路径或相对路径)',
294
+ },
295
+ old_string: {
296
+ type: 'string',
297
+ description: '要替换的字符串(必须精确匹配)',
298
+ },
299
+ new_string: {
300
+ type: 'string',
301
+ description: '替换后的字符串',
302
+ },
303
+ replace_all: {
304
+ type: 'boolean',
305
+ description: '是否替换所有匹配(可选,默认 false)',
306
+ },
307
+ fuzzy_match: {
308
+ type: 'boolean',
309
+ description: '精确匹配失败时是否允许宽松空白匹配(可选,默认 false;多候选时总是拒绝)',
310
+ },
311
+ preview: {
312
+ type: 'boolean',
313
+ description: '预览匹配结果而不写入文件(可选,默认 false)',
314
+ },
315
+ },
316
+ required: ['path', 'old_string', 'new_string'],
317
+ },
318
+ execute: async (args, context) => {
319
+ // Ensure required parameters are valid strings
320
+ const path = args.path;
321
+ const old_string = args.old_string;
322
+ const new_string = args.new_string;
323
+ if (!path || typeof path !== 'string') {
324
+ return { success: false, output: '', error: 'edit_file requires a path parameter' };
325
+ }
326
+ if (!old_string || typeof old_string !== 'string') {
327
+ return { success: false, output: '', error: 'edit_file requires an old_string parameter' };
328
+ }
329
+ if (typeof new_string !== 'string') {
330
+ return { success: false, output: '', error: 'edit_file requires a new_string parameter' };
331
+ }
332
+ const lastEditFileArgs = { path, old_string, new_string, updatedAt: Date.now() };
333
+ if (typeof args.replace_all === 'boolean')
334
+ lastEditFileArgs.replace_all = args.replace_all;
335
+ if (typeof args.fuzzy_match === 'boolean')
336
+ lastEditFileArgs.fuzzy_match = args.fuzzy_match;
337
+ if (context?.sessionId)
338
+ lastEditFileArgs.sessionId = context.sessionId;
339
+ if (context?.turnId)
340
+ lastEditFileArgs.turnId = context.turnId;
341
+ lastEditFileArgs.updatedAt = Date.now();
342
+ (0, tool_state_1.setToolState)({ lastEditFileArgs });
343
+ return editFile_(path, old_string, new_string, args.replace_all, args.fuzzy_match, args.preview, context.cwd);
344
+ },
345
+ isDestructive: () => true,
346
+ checkPermissions: (_args, _context) => {
347
+ return { behavior: 'ask', reason: 'Edit operation modifies file contents' };
348
+ },
349
+ userFacingName: args => `Edit ${args.path}`,
350
+ getSummary: (args, result) => {
351
+ const path = args.path;
352
+ if (!result.success)
353
+ return `✏️ edit ${path} → error`;
354
+ const replaceAll = args.replace_all ? ' (all)' : '';
355
+ return `✏️ edit ${path}${replaceAll}`;
356
+ },
357
+ }),
358
+ (0, tool_1.buildTool)({
359
+ name: 'glob',
360
+ description: '使用 glob 模式搜索文件。支持 **(递归)、*(任意字符)、?(单个字符)等通配符。',
361
+ parameters: {
362
+ type: 'object',
363
+ properties: {
364
+ pattern: {
365
+ type: 'string',
366
+ description: 'Glob 模式(如 **/*.ts, src/**/*.js)',
367
+ },
368
+ path: {
369
+ type: 'string',
370
+ description: '搜索起始目录(可选,默认当前目录)',
371
+ },
372
+ },
373
+ required: ['pattern'],
374
+ },
375
+ execute: async (args, context) => {
376
+ // Ensure pattern is a valid string
377
+ const pattern = args.pattern;
378
+ if (!pattern || typeof pattern !== 'string') {
379
+ return { success: false, output: '', error: 'glob requires a pattern parameter' };
380
+ }
381
+ return glob_(pattern, args.path, context.cwd);
382
+ },
383
+ isReadOnly: () => true,
384
+ isConcurrencySafe: () => true,
385
+ userFacingName: args => `Glob ${args.pattern}`,
386
+ getSummary: (args, result) => {
387
+ const pattern = args.pattern;
388
+ if (!result.success)
389
+ return `🔍 glob ${pattern} → error`;
390
+ const count = result.output.split('\n').filter(Boolean).length;
391
+ return `🔍 glob ${pattern} → ${count} matches`;
392
+ },
393
+ }),
394
+ (0, tool_1.buildTool)({
395
+ name: 'grep',
396
+ description: '在文件中搜索正则表达式模式。返回匹配的文件路径和行内容。',
397
+ parameters: {
398
+ type: 'object',
399
+ properties: {
400
+ pattern: {
401
+ type: 'string',
402
+ description: '正则表达式模式',
403
+ },
404
+ path: {
405
+ type: 'string',
406
+ description: '搜索路径(可选,默认当前目录)',
407
+ },
408
+ glob: {
409
+ type: 'string',
410
+ description: '文件过滤模式(可选,如 *.ts)',
411
+ },
412
+ context: {
413
+ type: 'number',
414
+ description: '上下文行数(可选,默认 0)',
415
+ },
416
+ },
417
+ required: ['pattern'],
418
+ },
419
+ execute: async (args, context) => {
420
+ // Ensure pattern is a valid string
421
+ const pattern = args.pattern;
422
+ if (!pattern || typeof pattern !== 'string') {
423
+ return { success: false, output: '', error: 'grep requires a pattern parameter' };
424
+ }
425
+ return grep_(pattern, args.path, args.glob, args.context, context.cwd);
426
+ },
427
+ isReadOnly: () => true,
428
+ isConcurrencySafe: () => true,
429
+ userFacingName: args => `Grep ${args.pattern}`,
430
+ getSummary: (args, result) => {
431
+ const pattern = args.pattern;
432
+ if (!result.success)
433
+ return `🔎 grep /${pattern}/ → error`;
434
+ const count = result.output.split('\n').filter(l => l && !l.startsWith('--')).length;
435
+ return `🔎 grep /${pattern}/ → ${count} matches`;
436
+ },
437
+ }),
438
+ (0, tool_1.buildTool)({
439
+ name: 'batch_read',
440
+ description: 'Run up to 8 read-only exploration tool calls in one ordered batch. Allowed tools: git_status, list_files, glob, grep, read_file.',
441
+ parameters: {
442
+ type: 'object',
443
+ properties: {
444
+ steps: {
445
+ type: 'array',
446
+ description: 'Array of steps: [{ "tool": "read_file", "args": { "path": "package.json" } }]. Max 8 steps.',
447
+ items: {
448
+ type: 'object',
449
+ properties: {
450
+ tool: { type: 'string', description: 'Allowed read-only tool name' },
451
+ args: { type: 'object', description: 'Arguments for the tool' },
452
+ },
453
+ required: ['tool', 'args'],
454
+ },
455
+ maxItems: BATCH_READ_MAX_STEPS,
456
+ },
457
+ reason: {
458
+ type: 'string',
459
+ description: 'Optional reason for this read-only batch.',
460
+ },
461
+ },
462
+ required: ['steps'],
463
+ },
464
+ execute: async (args, context) => executeBatchRead(args, context),
465
+ isReadOnly: () => true,
466
+ isConcurrencySafe: () => true,
467
+ userFacingName: args => {
468
+ const count = Array.isArray(args.steps) ? args.steps.length : 0;
469
+ return `Batch read ${count} steps`;
470
+ },
471
+ getSummary: (args, result) => {
472
+ if (!result.success)
473
+ return '📚 batch_read → error';
474
+ const count = Array.isArray(args.steps) ? args.steps.length : 0;
475
+ return `📚 batch_read → ${count} steps`;
476
+ },
477
+ }),
478
+ // Memory tools
479
+ (0, tool_1.buildTool)({
480
+ name: 'memory_save',
481
+ description: 'Save a memory entry to the persistent memory system. Memories help tailor behavior to user preferences.',
482
+ parameters: {
483
+ type: 'object',
484
+ properties: {
485
+ name: {
486
+ type: 'string',
487
+ description: 'Memory name (kebab-case, e.g., "user-role", "feedback-style")',
488
+ },
489
+ type: {
490
+ type: 'string',
491
+ enum: ['user', 'feedback', 'project', 'reference'],
492
+ description: 'Memory type',
493
+ },
494
+ description: {
495
+ type: 'string',
496
+ description: 'One-line description for memory index',
497
+ },
498
+ content: {
499
+ type: 'string',
500
+ description: 'Memory content. For feedback/project: use rule + Why + How to apply structure',
501
+ },
502
+ },
503
+ required: ['name', 'type', 'content'],
504
+ },
505
+ execute: async (args, context) => {
506
+ const name = args.name;
507
+ const type = args.type;
508
+ const content = args.content;
509
+ const description = args.description || content.slice(0, 80);
510
+ if (!name || typeof name !== 'string') {
511
+ return { success: false, output: '', error: 'memory_save requires a name parameter' };
512
+ }
513
+ if (!type || !['user', 'feedback', 'project', 'reference'].includes(type)) {
514
+ return {
515
+ success: false,
516
+ output: '',
517
+ error: 'memory_save requires a valid type: user, feedback, project, or reference',
518
+ };
519
+ }
520
+ if (!content || typeof content !== 'string') {
521
+ return { success: false, output: '', error: 'memory_save requires a content parameter' };
522
+ }
523
+ try {
524
+ const projectPath = context?.cwd || process.cwd();
525
+ const entry = {
526
+ name,
527
+ type,
528
+ description,
529
+ content,
530
+ createdAt: Date.now(),
531
+ updatedAt: Date.now(),
532
+ };
533
+ if ((0, semantic_search_1.isSemanticEnabled)()) {
534
+ // saveAndIndex internally calls saveMemory + vectorStore.upsert
535
+ await (0, semantic_search_1.getSemanticSearchService)().saveAndIndex(entry, projectPath);
536
+ }
537
+ else {
538
+ (0, memory_1.saveMemory)(entry, projectPath);
539
+ }
540
+ return { success: true, output: `Saved memory: ${name} (${type})` };
541
+ }
542
+ catch (err) {
543
+ return { success: false, output: '', error: err.message };
544
+ }
545
+ },
546
+ isReadOnly: () => false,
547
+ userFacingName: args => `Memory save ${args.name}`,
548
+ getSummary: (args, result) => {
549
+ const name = args.name;
550
+ const type = args.type;
551
+ if (!result.success)
552
+ return `🧠 save ${name} → error`;
553
+ return `🧠 save ${name} (${type})`;
554
+ },
555
+ }),
556
+ (0, tool_1.buildTool)({
557
+ name: 'memory_recall',
558
+ description: 'Recall memories from the memory system. Returns matching memories or all if no query.',
559
+ parameters: {
560
+ type: 'object',
561
+ properties: {
562
+ query: {
563
+ type: 'string',
564
+ description: 'Search query (optional, returns all if empty)',
565
+ },
566
+ type: {
567
+ type: 'string',
568
+ enum: ['user', 'feedback', 'project', 'reference'],
569
+ description: 'Filter by memory type (optional)',
570
+ },
571
+ },
572
+ required: [],
573
+ },
574
+ execute: async (args, context) => {
575
+ try {
576
+ const projectPath = context?.cwd || process.cwd();
577
+ const query = args.query || '';
578
+ const type = args.type;
579
+ let memories;
580
+ if (query && (0, semantic_search_1.isSemanticEnabled)()) {
581
+ // Semantic path: ask the vector store, then fall back to keywords if it
582
+ // returns nothing (e.g. embedding provider unreachable, empty index)
583
+ try {
584
+ const result = await (0, semantic_search_1.getSemanticSearchService)().search({
585
+ query,
586
+ projectPath,
587
+ type,
588
+ });
589
+ memories = result.memories.map(m => ({
590
+ name: m.name,
591
+ type: m.type,
592
+ description: m.description,
593
+ content: m.content,
594
+ createdAt: m.createdAt,
595
+ updatedAt: m.createdAt,
596
+ }));
597
+ if (memories.length === 0) {
598
+ memories = (0, memory_1.searchMemories)(query, projectPath);
599
+ if (type)
600
+ memories = memories.filter(m => m.type === type);
601
+ }
602
+ }
603
+ catch {
604
+ memories = (0, memory_1.searchMemories)(query, projectPath);
605
+ if (type)
606
+ memories = memories.filter(m => m.type === type);
607
+ }
608
+ }
609
+ else if (type) {
610
+ memories = (0, memory_1.loadAllMemories)(projectPath).filter(m => m.type === type);
611
+ }
612
+ else if (query) {
613
+ memories = (0, memory_1.searchMemories)(query, projectPath);
614
+ }
615
+ else {
616
+ memories = (0, memory_1.loadAllMemories)(projectPath);
617
+ }
618
+ if (memories.length === 0) {
619
+ return { success: true, output: 'No memories found' };
620
+ }
621
+ const lines = [];
622
+ for (const mem of memories) {
623
+ lines.push(`## ${mem.name} (${mem.type})`);
624
+ lines.push(mem.description);
625
+ lines.push(mem.content);
626
+ lines.push('');
627
+ }
628
+ return { success: true, output: lines.join('\n') };
629
+ }
630
+ catch (err) {
631
+ return { success: false, output: '', error: err.message };
632
+ }
633
+ },
634
+ isReadOnly: () => true,
635
+ userFacingName: args => `Memory recall ${args.query || 'all'}`,
636
+ getSummary: (args, result) => {
637
+ const query = args.query || 'all';
638
+ if (!result.success)
639
+ return `🧠 recall "${query}" → error`;
640
+ if (result.output === 'No memories found')
641
+ return `🧠 recall "${query}" → 0 found`;
642
+ const count = result.output.split(/^## /m).length - 1;
643
+ return `🧠 recall "${query}" → ${count} memories`;
644
+ },
645
+ }),
646
+ (0, tool_1.buildTool)({
647
+ name: 'memory_forget',
648
+ description: 'Delete a memory entry from the memory system.',
649
+ parameters: {
650
+ type: 'object',
651
+ properties: {
652
+ name: {
653
+ type: 'string',
654
+ description: 'Memory name to delete',
655
+ },
656
+ },
657
+ required: ['name'],
658
+ },
659
+ execute: async (args, context) => {
660
+ const name = args.name;
661
+ if (!name || typeof name !== 'string') {
662
+ return { success: false, output: '', error: 'memory_forget requires a name parameter' };
663
+ }
664
+ try {
665
+ const projectPath = context?.cwd || process.cwd();
666
+ const existing = (0, memory_1.loadMemory)(name, projectPath);
667
+ if (!existing) {
668
+ return { success: false, output: '', error: `Memory not found: ${name}` };
669
+ }
670
+ (0, memory_1.deleteMemory)(name, projectPath);
671
+ if ((0, semantic_search_1.isSemanticEnabled)()) {
672
+ try {
673
+ const { getVectorStore } = require('../memory/vector-store');
674
+ getVectorStore().delete(name, projectPath);
675
+ }
676
+ catch {
677
+ // Vector store cleanup is best-effort
678
+ }
679
+ }
680
+ return { success: true, output: `Deleted memory: ${name}` };
681
+ }
682
+ catch (err) {
683
+ return { success: false, output: '', error: err.message };
684
+ }
685
+ },
686
+ isReadOnly: () => false,
687
+ userFacingName: args => `Memory forget ${args.name}`,
688
+ getSummary: (args, result) => {
689
+ const name = args.name;
690
+ if (!result.success)
691
+ return `🧠 forget ${name} → error`;
692
+ return `🧠 forget ${name}`;
693
+ },
694
+ }),
695
+ // History search tool
696
+ (0, tool_1.buildTool)({
697
+ name: 'history_search',
698
+ description: 'Search previous tool operations in current or past sessions. Helps find what was done before.',
699
+ parameters: {
700
+ type: 'object',
701
+ properties: {
702
+ query: {
703
+ type: 'string',
704
+ description: 'Search query (tool name, file path, keyword)',
705
+ },
706
+ sessionId: {
707
+ type: 'string',
708
+ description: 'Session ID to search (optional, defaults to searching recent sessions)',
709
+ },
710
+ limit: {
711
+ type: 'number',
712
+ description: 'Max results (optional, default 10)',
713
+ },
714
+ },
715
+ required: ['query'],
716
+ },
717
+ execute: async (args) => {
718
+ const query = args.query;
719
+ if (!query || typeof query !== 'string') {
720
+ return { success: false, output: '', error: 'history_search requires a query parameter' };
721
+ }
722
+ try {
723
+ const limit = args.limit || 10;
724
+ const sessionId = args.sessionId;
725
+ // If sessionId provided, search that session; otherwise search all recent sessions
726
+ const sessions = sessionId
727
+ ? [(0, session_storage_1.loadSessionMeta)(sessionId)].filter(Boolean)
728
+ : (0, session_storage_1.listSessions)(5);
729
+ const results = [];
730
+ for (const session of sessions) {
731
+ if (!session)
732
+ continue;
733
+ const messages = (0, session_storage_1.readSessionMessages)(session.id);
734
+ // Search through messages for tool calls matching query
735
+ for (let i = 0; i < messages.length; i++) {
736
+ const msg = messages[i];
737
+ if (msg.role === 'assistant' && msg.tool_calls) {
738
+ for (const tc of msg.tool_calls) {
739
+ // Match tool name or arguments content
740
+ const matchesQuery = tc.function.name.toLowerCase().includes(query.toLowerCase()) ||
741
+ tc.function.arguments.toLowerCase().includes(query.toLowerCase());
742
+ if (matchesQuery) {
743
+ // Find corresponding tool result
744
+ const nextMsg = messages[i + 1];
745
+ const resultPreview = nextMsg?.role === 'tool' && nextMsg.toolCallId === tc.id
746
+ ? nextMsg.content.slice(0, 200)
747
+ : '(no result)';
748
+ results.push({
749
+ sessionId: session.id.slice(0, 8),
750
+ tool: tc.function.name,
751
+ args: tc.function.arguments.slice(0, 100),
752
+ resultPreview,
753
+ timestamp: msg.timestamp,
754
+ });
755
+ }
756
+ }
757
+ }
758
+ }
759
+ }
760
+ // Sort by timestamp (newest first) and limit
761
+ results.sort((a, b) => b.timestamp - a.timestamp);
762
+ const limited = results.slice(0, limit);
763
+ if (limited.length === 0) {
764
+ return { success: true, output: 'No matching tool operations found' };
765
+ }
766
+ const lines = [];
767
+ lines.push(`Found ${limited.length} matching operations:`);
768
+ lines.push('');
769
+ for (const r of limited) {
770
+ lines.push(`Session ${r.sessionId}: ${r.tool}`);
771
+ lines.push(` Args: ${r.args}`);
772
+ lines.push(` Result: ${r.resultPreview.slice(0, 100)}...`);
773
+ lines.push('');
774
+ }
775
+ return { success: true, output: lines.join('\n') };
776
+ }
777
+ catch (err) {
778
+ return { success: false, output: '', error: err.message };
779
+ }
780
+ },
781
+ isReadOnly: () => true,
782
+ userFacingName: args => `History search ${args.query}`,
783
+ getSummary: (args, result) => {
784
+ const query = args.query;
785
+ if (!result.success)
786
+ return `📜 history "${query}" → error`;
787
+ if (result.output.startsWith('No matching'))
788
+ return `📜 history "${query}" → 0 found`;
789
+ const match = result.output.match(/Found (\d+) matching/);
790
+ const count = match ? match[1] : '?';
791
+ return `📜 history "${query}" → ${count} found`;
792
+ },
793
+ }),
794
+ ];
795
+ /**
796
+ * Runtime tool pool.
797
+ *
798
+ * Static Orion Code tools are always present. Connected MCP server tools are
799
+ * exposed as first-class tools named mcp__<server>__<tool>, matching the
800
+ * convention used by Claude Code, Codex, and OpenClaude.
801
+ */
802
+ function getRuntimeTools() {
803
+ return [...exports.TOOLS, ...mcp_1.mcpManager.getOrionCodeTools()];
804
+ }
805
+ // ============================================================================
806
+ // 工具实现
807
+ // ============================================================================
808
+ /** Normalize model/tool path strings before resolving them on disk. */
809
+ function normalizeToolPath(input) {
810
+ let value = input.trim();
811
+ const markdownLink = value.match(/^!?\[[^\]]*\]\(([\s\S]+)\)$/u);
812
+ if (markdownLink) {
813
+ value = markdownLink[1].trim();
814
+ if (value.startsWith('<')) {
815
+ const end = value.indexOf('>');
816
+ if (end >= 0) {
817
+ value = value.slice(1, end);
818
+ }
819
+ }
820
+ else {
821
+ value = value.replace(/\s+["'][\s\S]*["']$/u, '');
822
+ }
823
+ }
824
+ if ((value.startsWith('`') && value.endsWith('`')) ||
825
+ (value.startsWith('"') && value.endsWith('"')) ||
826
+ (value.startsWith("'") && value.endsWith("'"))) {
827
+ value = value.slice(1, -1);
828
+ }
829
+ if (value.startsWith('file://')) {
830
+ try {
831
+ return decodeURIComponent(new URL(value).pathname);
832
+ }
833
+ catch {
834
+ return value.replace(/^file:\/\//u, '');
835
+ }
836
+ }
837
+ // Plain filesystem paths are not URLs: do NOT percent-decode them, or a
838
+ // literal filename like "lit%41.txt" is silently rewritten to "litA.txt".
839
+ return value;
840
+ }
841
+ /** Safely stat a path, returning null for dangling symlinks or missing files
842
+ * instead of throwing ENOENT. Uses lstatSync to avoid following symlinks
843
+ * when checking existence. */
844
+ function safeStatSync(resolved) {
845
+ try {
846
+ // lstatSync does NOT follow symlinks — safe for dangling ones.
847
+ const lst = (0, fs_1.lstatSync)(resolved);
848
+ if (lst.isSymbolicLink()) {
849
+ // For symlinks, use statSync (follows the link) inside try/catch.
850
+ // If the target doesn't exist, statSync throws ENOENT — catch and return null.
851
+ try {
852
+ return (0, fs_1.statSync)(resolved);
853
+ }
854
+ catch {
855
+ return null; // dangling symlink
856
+ }
857
+ }
858
+ return (0, fs_1.statSync)(resolved);
859
+ }
860
+ catch {
861
+ return null; // path doesn't exist at all
862
+ }
863
+ }
864
+ /** Read a file safely, returning null for dangling symlinks or unreadable files. */
865
+ function safeReadFileSync(resolved) {
866
+ try {
867
+ // Check if it's a dangling symlink before attempting read.
868
+ const st = safeStatSync(resolved);
869
+ if (!st || st.isDirectory())
870
+ return null;
871
+ return (0, fs_1.readFileSync)(resolved, 'utf-8');
872
+ }
873
+ catch {
874
+ return null;
875
+ }
876
+ }
877
+ /** Resolve tool path parameters relative to the current tool cwd. */
878
+ function safePath(input, cwd = process.cwd()) {
879
+ return (0, path_1.resolve)(cwd, normalizeToolPath(input));
880
+ }
881
+ /**
882
+ * Truncate text to at most maxBytes UTF-8 bytes, cutting on a character
883
+ * boundary (never inside a multi-byte sequence or surrogate pair). Returns the
884
+ * truncated text and the byte length it was cut at. String.slice counts UTF-16
885
+ * code units, not bytes, so it is wrong for enforcing a byte budget on CJK or
886
+ * emoji content and can split a surrogate pair.
887
+ */
888
+ function truncateToBytes(text, maxBytes) {
889
+ const buf = Buffer.from(text, 'utf-8');
890
+ if (buf.length <= maxBytes)
891
+ return { text, bytes: buf.length };
892
+ let cut = maxBytes;
893
+ // Walk back past UTF-8 continuation bytes (0x80-0xBF) to a lead-byte boundary.
894
+ while (cut > 0 && (buf[cut] & 0xc0) === 0x80)
895
+ cut--;
896
+ return { text: buf.subarray(0, cut).toString('utf-8'), bytes: cut };
897
+ }
898
+ function readPositiveInteger(value, name, defaultValue) {
899
+ if (value === undefined)
900
+ return defaultValue;
901
+ if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 1) {
902
+ return `read_file ${name} must be a positive integer`;
903
+ }
904
+ return value;
905
+ }
906
+ async function readFileSync_(path, maxLines, offset, cwd) {
907
+ try {
908
+ const normalizedPath = normalizeToolPath(path);
909
+ const resolved = safePath(path, cwd);
910
+ if (!(0, fs_1.existsSync)(resolved)) {
911
+ return { success: false, output: '', error: `File not found: ${normalizedPath}` };
912
+ }
913
+ const st = safeStatSync(resolved);
914
+ if (!st) {
915
+ return {
916
+ success: false,
917
+ output: '',
918
+ error: `Cannot access file: ${normalizedPath} (may be a dangling symlink or missing)`,
919
+ };
920
+ }
921
+ if (st.isDirectory()) {
922
+ return {
923
+ success: false,
924
+ output: '',
925
+ error: `Path is a directory, not a file: ${normalizedPath}`,
926
+ };
927
+ }
928
+ const content = safeReadFileSync(resolved);
929
+ if (content === null) {
930
+ return {
931
+ success: false,
932
+ output: '',
933
+ error: `Cannot read file: ${normalizedPath}`,
934
+ };
935
+ }
936
+ const lines = content.split('\n');
937
+ const maxBytes = 51200; // 50KB byte limit
938
+ if (offset > lines.length) {
939
+ return {
940
+ success: false,
941
+ output: '',
942
+ error: `read_file offset ${offset} is beyond the file (${lines.length} lines)`,
943
+ };
944
+ }
945
+ const startIndex = offset - 1;
946
+ const selectedLines = lines.slice(startIndex, startIndex + maxLines);
947
+ const selected = selectedLines.join('\n');
948
+ const remainingLines = Math.max(0, lines.length - startIndex - selectedLines.length);
949
+ if (remainingLines > 0) {
950
+ const byteLen = Buffer.byteLength(selected, 'utf8');
951
+ const notice = `\n\n[... truncated, ${remainingLines} more lines; showing lines ${offset}-${offset + selectedLines.length - 1} of ${lines.length}]`;
952
+ if (byteLen > maxBytes) {
953
+ const cut = truncateToBytes(selected, maxBytes);
954
+ return {
955
+ success: true,
956
+ output: cut.text + `\n\n[... truncated at ${cut.bytes}B]`,
957
+ };
958
+ }
959
+ return { success: true, output: selected + notice };
960
+ }
961
+ // Also apply byte limit to the selected page.
962
+ const byteLen = Buffer.byteLength(selected, 'utf8');
963
+ if (byteLen > maxBytes) {
964
+ const cut = truncateToBytes(selected, maxBytes);
965
+ return {
966
+ success: true,
967
+ output: cut.text + `\n\n[... truncated at ${cut.bytes}B of ${byteLen}B]`,
968
+ };
969
+ }
970
+ return { success: true, output: selected };
971
+ }
972
+ catch (err) {
973
+ return { success: false, output: '', error: String(err.message) };
974
+ }
975
+ }
976
+ async function writeFileSync_(path, content, cwd) {
977
+ try {
978
+ const normalizedPath = normalizeToolPath(path);
979
+ const resolved = safePath(path, cwd);
980
+ (0, fs_1.writeFileSync)(resolved, content, 'utf-8');
981
+ return {
982
+ success: true,
983
+ output: `Wrote ${content.split('\n').length} lines to ${normalizedPath}`,
984
+ };
985
+ }
986
+ catch (err) {
987
+ return { success: false, output: '', error: String(err.message) };
988
+ }
989
+ }
990
+ async function listFiles_(path, maxDepth, cwd) {
991
+ const normalizedPath = normalizeToolPath(path);
992
+ const resolved = safePath(path, cwd);
993
+ if (!(0, fs_1.existsSync)(resolved)) {
994
+ return { success: false, output: '', error: `Path not found: ${normalizedPath}` };
995
+ }
996
+ if (!(0, fs_1.statSync)(resolved).isDirectory()) {
997
+ return { success: true, output: normalizedPath };
998
+ }
999
+ const depth = maxDepth ?? 2;
1000
+ const results = [];
1001
+ function walk(dir, currentDepth, prefix) {
1002
+ if (currentDepth > depth)
1003
+ return;
1004
+ try {
1005
+ const entries = (0, fs_1.readdirSync)(dir, { withFileTypes: true });
1006
+ for (const entry of entries) {
1007
+ if (entry.name.startsWith('.') && entry.name !== '.')
1008
+ continue;
1009
+ const fullPath = (0, path_1.join)(dir, entry.name);
1010
+ const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;
1011
+ if (entry.isDirectory()) {
1012
+ results.push(`${relPath}/`);
1013
+ walk(fullPath, currentDepth + 1, relPath);
1014
+ }
1015
+ else {
1016
+ results.push(relPath);
1017
+ }
1018
+ }
1019
+ }
1020
+ catch {
1021
+ // skip unreadable directories
1022
+ }
1023
+ }
1024
+ walk(resolved, 1, '');
1025
+ // Limit output to 500 entries
1026
+ const maxEntries = 500;
1027
+ const output = results.length > maxEntries
1028
+ ? results.slice(0, maxEntries).join('\n') +
1029
+ `\n\n[... truncated, ${results.length - maxEntries} more entries]`
1030
+ : results.join('\n');
1031
+ return { success: true, output };
1032
+ }
1033
+ // Issue #32 #3.2: execCommand_ 支持 abortSignal
1034
+ async function execCommand_(command, cwd, timeout, maxOutput, abortSignal, baseCwd) {
1035
+ return new Promise(resolve => {
1036
+ const workdir = cwd ? safePath(cwd, baseCwd) : (baseCwd ?? process.cwd());
1037
+ const timeoutMs = timeout ?? 30000;
1038
+ const maxBytes = maxOutput ?? 51200; // Default 50KB, Issue #28 fix
1039
+ // Use spawn for streaming output with truncation support
1040
+ const useProcessGroup = process.platform !== 'win32';
1041
+ const child = (0, child_process_1.spawn)('sh', ['-c', command], {
1042
+ cwd: workdir,
1043
+ detached: useProcessGroup,
1044
+ });
1045
+ let stdoutData = '';
1046
+ let stderrData = '';
1047
+ let stdoutTruncated = false;
1048
+ let stderrTruncated = false;
1049
+ // Issue #32 修复:使用独立计数器
1050
+ let stdoutBytes = 0;
1051
+ let stderrBytes = 0;
1052
+ let interrupted = null;
1053
+ // Issue #32 #3.2: AbortSignal 处理
1054
+ let timeoutId;
1055
+ let killTimerId;
1056
+ let settled = false;
1057
+ const finish = (result) => {
1058
+ if (settled)
1059
+ return;
1060
+ settled = true;
1061
+ if (timeoutId)
1062
+ clearTimeout(timeoutId);
1063
+ if (killTimerId)
1064
+ clearTimeout(killTimerId);
1065
+ if (abortSignal) {
1066
+ abortSignal.removeEventListener('abort', abortHandler);
1067
+ }
1068
+ resolve(result);
1069
+ };
1070
+ const terminateChild = () => {
1071
+ if (!child.pid || child.killed)
1072
+ return;
1073
+ try {
1074
+ if (useProcessGroup) {
1075
+ process.kill(-child.pid, 'SIGTERM');
1076
+ }
1077
+ else {
1078
+ child.kill('SIGTERM');
1079
+ }
1080
+ }
1081
+ catch {
1082
+ child.kill('SIGTERM');
1083
+ }
1084
+ killTimerId = setTimeout(() => {
1085
+ if (!child.pid || child.killed || settled)
1086
+ return;
1087
+ try {
1088
+ if (useProcessGroup) {
1089
+ process.kill(-child.pid, 'SIGKILL');
1090
+ }
1091
+ else {
1092
+ child.kill('SIGKILL');
1093
+ }
1094
+ }
1095
+ catch {
1096
+ child.kill('SIGKILL');
1097
+ }
1098
+ }, 500);
1099
+ killTimerId.unref?.();
1100
+ };
1101
+ const abortHandler = () => {
1102
+ interrupted = 'aborted';
1103
+ terminateChild();
1104
+ };
1105
+ if (abortSignal) {
1106
+ abortSignal.addEventListener('abort', abortHandler);
1107
+ if (abortSignal.aborted) {
1108
+ abortHandler();
1109
+ }
1110
+ }
1111
+ // Timeout handling
1112
+ timeoutId = setTimeout(() => {
1113
+ if (!interrupted) {
1114
+ interrupted = 'timeout';
1115
+ terminateChild();
1116
+ }
1117
+ }, timeoutMs);
1118
+ // Stream stdout with truncation
1119
+ child.stdout.on('data', (data) => {
1120
+ if (!stdoutTruncated) {
1121
+ const chunk = data.toString();
1122
+ stdoutBytes += chunk.length;
1123
+ if (stdoutBytes > maxBytes) {
1124
+ stdoutTruncated = true;
1125
+ stdoutData += chunk.slice(0, maxBytes - stdoutData.length);
1126
+ }
1127
+ else {
1128
+ stdoutData += chunk;
1129
+ }
1130
+ }
1131
+ });
1132
+ // Stream stderr with truncation (Issue #32 修复:使用独立计数器)
1133
+ child.stderr.on('data', (data) => {
1134
+ if (!stderrTruncated) {
1135
+ const chunk = data.toString();
1136
+ stderrBytes += chunk.length;
1137
+ if (stderrBytes > maxBytes) {
1138
+ stderrTruncated = true;
1139
+ stderrData += chunk.slice(0, maxBytes - stderrData.length);
1140
+ }
1141
+ else {
1142
+ stderrData += chunk;
1143
+ }
1144
+ }
1145
+ });
1146
+ child.on('close', code => {
1147
+ if (interrupted === 'aborted') {
1148
+ finish({
1149
+ success: false,
1150
+ output: stdoutData.slice(0, maxBytes),
1151
+ error: 'Command aborted by user',
1152
+ });
1153
+ return;
1154
+ }
1155
+ if (interrupted === 'timeout') {
1156
+ finish({
1157
+ success: false,
1158
+ output: stdoutData.slice(0, maxBytes),
1159
+ error: `Command timed out after ${timeoutMs}ms`,
1160
+ });
1161
+ return;
1162
+ }
1163
+ const output = stdoutData.trim();
1164
+ const errOutput = stderrData.trim();
1165
+ // Add truncation notice if output was truncated
1166
+ let finalOutput = output;
1167
+ if (stdoutTruncated) {
1168
+ finalOutput += '\n\n[... output truncated, exceeded 50KB limit]';
1169
+ }
1170
+ if (code !== 0) {
1171
+ finish({
1172
+ success: false,
1173
+ output: finalOutput || errOutput,
1174
+ error: `Command exited with code ${code}`,
1175
+ });
1176
+ }
1177
+ else {
1178
+ finish({
1179
+ success: true,
1180
+ output: finalOutput || '(no output)',
1181
+ error: stderrTruncated
1182
+ ? errOutput + '\n\n[... stderr truncated]'
1183
+ : errOutput || undefined,
1184
+ });
1185
+ }
1186
+ });
1187
+ child.on('error', err => {
1188
+ finish({
1189
+ success: false,
1190
+ output: '',
1191
+ error: err.message,
1192
+ });
1193
+ });
1194
+ });
1195
+ }
1196
+ function lineNumberForIndex(content, index) {
1197
+ return content.slice(0, Math.max(0, index)).split('\n').length;
1198
+ }
1199
+ function findAllMatchIndexes(content, needle, limit = 20) {
1200
+ const indexes = [];
1201
+ let cursor = 0;
1202
+ while (indexes.length < limit) {
1203
+ const index = content.indexOf(needle, cursor);
1204
+ if (index < 0)
1205
+ break;
1206
+ indexes.push(index);
1207
+ cursor = index + Math.max(needle.length, 1);
1208
+ }
1209
+ return indexes;
1210
+ }
1211
+ function previewLine(text) {
1212
+ return text.replace(/\s+/g, ' ').trim().slice(0, 120);
1213
+ }
1214
+ function buildEditCandidates(params) {
1215
+ const cursorByMatch = new Map();
1216
+ return params.matches.slice(0, 20).map((match, index) => {
1217
+ const cursor = cursorByMatch.get(match) ?? 0;
1218
+ const matchIndex = params.content.indexOf(match, cursor);
1219
+ cursorByMatch.set(match, matchIndex >= 0 ? matchIndex + Math.max(match.length, 1) : cursor);
1220
+ const lineNum = matchIndex >= 0 ? lineNumberForIndex(params.content, matchIndex) : 0;
1221
+ // Get context lines (3 before, 3 after)
1222
+ const allLines = params.content.split('\n');
1223
+ const contextBefore = allLines.slice(Math.max(0, lineNum - 4), lineNum).join('\n');
1224
+ const contextAfter = allLines.slice(lineNum + 1, lineNum + 4).join('\n');
1225
+ return {
1226
+ index,
1227
+ line: lineNum,
1228
+ match,
1229
+ contextBefore,
1230
+ contextAfter,
1231
+ isReplaceAll: (params.count ?? 1) > 1,
1232
+ };
1233
+ });
1234
+ }
1235
+ function formatEditPreview(params) {
1236
+ const cursorByMatch = new Map();
1237
+ const lines = [
1238
+ `Preview: ${params.kind === 'fuzzy' ? `Fuzzy ${params.strategy ?? 'match'}` : 'Exact match'} candidates (${params.matches.length})`,
1239
+ ];
1240
+ params.matches.slice(0, 20).forEach((match, index) => {
1241
+ const cursor = cursorByMatch.get(match) ?? 0;
1242
+ const matchIndex = params.content.indexOf(match, cursor);
1243
+ cursorByMatch.set(match, matchIndex >= 0 ? matchIndex + Math.max(match.length, 1) : cursor);
1244
+ const lineNum = matchIndex >= 0 ? lineNumberForIndex(params.content, matchIndex) : '?';
1245
+ lines.push(`${index + 1}. line ${lineNum}: "${previewLine(match)}"`);
1246
+ });
1247
+ if (params.matches.length > 20) {
1248
+ lines.push(`... ${params.matches.length - 20} more candidates omitted`);
1249
+ }
1250
+ lines.push(`Would replace with: "${previewLine(params.newString)}"`);
1251
+ return lines.join('\n');
1252
+ }
1253
+ /**
1254
+ * Attempt to find old_string in content using fuzzy matching strategies.
1255
+ * Returns null if no match found, or the matched strings.
1256
+ */
1257
+ function fuzzyMatch(content, oldString) {
1258
+ // Strategy 1: Line-by-line matching (allow different indentation)
1259
+ const oldLines = oldString
1260
+ .split('\n')
1261
+ .map(l => l.trim())
1262
+ .filter(Boolean);
1263
+ const contentLines = content.split('\n');
1264
+ const lineMatches = [];
1265
+ for (let i = 0; i <= contentLines.length - oldLines.length; i++) {
1266
+ let allMatch = true;
1267
+ for (let j = 0; j < oldLines.length; j++) {
1268
+ if (contentLines[i + j].trim() !== oldLines[j]) {
1269
+ allMatch = false;
1270
+ break;
1271
+ }
1272
+ }
1273
+ if (allMatch) {
1274
+ const matchedStr = contentLines.slice(i, i + oldLines.length).join('\n');
1275
+ lineMatches.push(matchedStr);
1276
+ }
1277
+ }
1278
+ if (lineMatches.length > 0) {
1279
+ return { matches: lineMatches, strategy: 'line' };
1280
+ }
1281
+ // Strategy 2: Whitespace-tolerant token match. This preserves the actual
1282
+ // matched span without consuming unrelated leading/trailing blank lines.
1283
+ const tokens = oldString.trim().split(/\s+/).filter(Boolean);
1284
+ if (tokens.length === 0)
1285
+ return null;
1286
+ const pattern = tokens.map(escapeRegExp).join('\\s+');
1287
+ const regex = new RegExp(pattern, 'g');
1288
+ const wsMatches = [];
1289
+ let match;
1290
+ while ((match = regex.exec(content)) !== null) {
1291
+ if (match[0]) {
1292
+ wsMatches.push(match[0]);
1293
+ }
1294
+ if (wsMatches.length > 5)
1295
+ break; // Safety limit
1296
+ if (match.index === regex.lastIndex)
1297
+ regex.lastIndex++;
1298
+ }
1299
+ if (wsMatches.length > 0) {
1300
+ return { matches: wsMatches, strategy: 'whitespace' };
1301
+ }
1302
+ return null;
1303
+ }
1304
+ async function editFile_(path, old_string, new_string, replace_all, fuzzy_match, preview, cwd) {
1305
+ try {
1306
+ const normalizedPath = normalizeToolPath(path);
1307
+ const resolved = safePath(path, cwd);
1308
+ if (!(0, fs_1.existsSync)(resolved)) {
1309
+ return { success: false, output: '', error: `File not found: ${normalizedPath}` };
1310
+ }
1311
+ const fileStat = safeStatSync(resolved);
1312
+ if (!fileStat) {
1313
+ return { success: false, output: '', error: `Cannot access file: ${normalizedPath} (may be a dangling symlink)` };
1314
+ }
1315
+ if (fileStat.isDirectory()) {
1316
+ return {
1317
+ success: false,
1318
+ output: '',
1319
+ error: `Path is a directory, not a file: ${normalizedPath}`,
1320
+ };
1321
+ }
1322
+ const content = safeReadFileSync(resolved);
1323
+ if (content === null) {
1324
+ return { success: false, output: '', error: `Cannot read file: ${normalizedPath}` };
1325
+ }
1326
+ // Check if old_string exists exactly
1327
+ const count = (content.match(new RegExp(escapeRegExp(old_string), 'g')) || []).length;
1328
+ if (count > 0 && preview) {
1329
+ const matchIndexes = findAllMatchIndexes(content, old_string);
1330
+ const matches = matchIndexes.map(() => old_string);
1331
+ return {
1332
+ success: true,
1333
+ output: formatEditPreview({
1334
+ kind: 'exact',
1335
+ content,
1336
+ matches,
1337
+ newString: new_string,
1338
+ }),
1339
+ metadata: {
1340
+ candidates: buildEditCandidates({
1341
+ kind: 'exact',
1342
+ content,
1343
+ matches,
1344
+ newString: new_string,
1345
+ count,
1346
+ }),
1347
+ },
1348
+ };
1349
+ }
1350
+ if (count === 0) {
1351
+ if (!fuzzy_match) {
1352
+ return {
1353
+ success: false,
1354
+ output: '',
1355
+ error: `old_string not found in file: ${old_string.slice(0, 100)}...`,
1356
+ };
1357
+ }
1358
+ // Try fuzzy match strategies
1359
+ const fuzzyResult = fuzzyMatch(content, old_string);
1360
+ if (fuzzyResult === null) {
1361
+ return {
1362
+ success: false,
1363
+ output: '',
1364
+ error: `old_string not found in file: ${old_string.slice(0, 100)}...`,
1365
+ };
1366
+ }
1367
+ if (preview) {
1368
+ return {
1369
+ success: true,
1370
+ output: formatEditPreview({
1371
+ kind: 'fuzzy',
1372
+ content,
1373
+ matches: fuzzyResult.matches,
1374
+ newString: new_string,
1375
+ strategy: fuzzyResult.strategy,
1376
+ }),
1377
+ metadata: {
1378
+ candidates: buildEditCandidates({
1379
+ kind: 'fuzzy',
1380
+ content,
1381
+ matches: fuzzyResult.matches,
1382
+ newString: new_string,
1383
+ strategy: fuzzyResult.strategy,
1384
+ }),
1385
+ },
1386
+ };
1387
+ }
1388
+ if (fuzzyResult.matches.length > 1) {
1389
+ return {
1390
+ success: false,
1391
+ output: '',
1392
+ error: `Fuzzy match found ${fuzzyResult.matches.length} candidates. Provide a more specific string. First 3 candidates:\n${fuzzyResult.matches
1393
+ .slice(0, 3)
1394
+ .map((m, i) => ` ${i + 1}: "${m.slice(0, 80)}..."`)
1395
+ .join('\n')}`,
1396
+ };
1397
+ }
1398
+ // Use the single fuzzy match only.
1399
+ const match = fuzzyResult.matches[0];
1400
+ const idx = content.indexOf(match);
1401
+ const newContent = content.slice(0, idx) + new_string + content.slice(idx + match.length);
1402
+ (0, fs_1.writeFileSync)(resolved, newContent, 'utf-8');
1403
+ return {
1404
+ success: true,
1405
+ output: `Fuzzy edited ${normalizedPath} (matched by ${fuzzyResult.strategy}, "${match.slice(0, 50)}...")`,
1406
+ };
1407
+ }
1408
+ // If not replace_all, require unique match
1409
+ if (!replace_all && count > 1) {
1410
+ return {
1411
+ success: false,
1412
+ output: '',
1413
+ error: `old_string found ${count} times in file. Use replace_all=true to replace all occurrences, or provide a more specific string that matches exactly once.`,
1414
+ };
1415
+ }
1416
+ // Perform replacement
1417
+ let newContent;
1418
+ if (replace_all) {
1419
+ newContent = content.split(old_string).join(new_string);
1420
+ }
1421
+ else {
1422
+ // Replace first occurrence only
1423
+ const idx = content.indexOf(old_string);
1424
+ newContent = content.slice(0, idx) + new_string + content.slice(idx + old_string.length);
1425
+ }
1426
+ (0, fs_1.writeFileSync)(resolved, newContent, 'utf-8');
1427
+ return {
1428
+ success: true,
1429
+ output: `Replaced ${count} occurrence(s) of old_string with new_string in ${normalizedPath}`,
1430
+ };
1431
+ }
1432
+ catch (err) {
1433
+ return { success: false, output: '', error: String(err.message) };
1434
+ }
1435
+ }
1436
+ /** Escape special regex characters for literal matching */
1437
+ function escapeRegExp(str) {
1438
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
1439
+ }
1440
+ // ============================================================================
1441
+ // Glob/Grep 工具实现
1442
+ // ============================================================================
1443
+ /**
1444
+ * Glob 模式匹配 - 简化版实现
1445
+ * 支持: **(递归目录)、*(任意字符)、?(单个字符)
1446
+ */
1447
+ async function glob_(pattern, basePath, cwd) {
1448
+ try {
1449
+ const normalizedBasePath = basePath ? normalizeToolPath(basePath) : (cwd ?? process.cwd());
1450
+ const base = basePath ? safePath(basePath, cwd) : (cwd ?? process.cwd());
1451
+ if (!(0, fs_1.existsSync)(base)) {
1452
+ return { success: false, output: '', error: `Path not found: ${normalizedBasePath}` };
1453
+ }
1454
+ if (!(0, fs_1.statSync)(base).isDirectory()) {
1455
+ return {
1456
+ success: false,
1457
+ output: '',
1458
+ error: `Path is not a directory: ${normalizedBasePath}`,
1459
+ };
1460
+ }
1461
+ const results = [];
1462
+ // Convert glob pattern to regex.
1463
+ // Escape ALL regex metacharacters first, then translate glob wildcards.
1464
+ // Escaping only `.` (the old behavior) left parens/brackets/+/^/$/| as
1465
+ // regex syntax: a literal "(group)" became a capture group (so the real
1466
+ // file stopped matching) and an unbalanced "[" made new RegExp throw.
1467
+ function globToRegex(pat) {
1468
+ // Use placeholders for glob wildcards so escaping does not touch them.
1469
+ let regex = pat;
1470
+ // **/ at start - matches optional path (including empty)
1471
+ regex = regex.replace(/^\*\*\//, '<<STARSTAR_SLASH_START>>');
1472
+ // **/ in middle - matches any number of path segments
1473
+ regex = regex.replace(/\*\*\//g, '<<STARSTAR_SLASH>>');
1474
+ // standalone ** - matches anything
1475
+ regex = regex.replace(/\*\*/g, '<<STARSTAR>>');
1476
+ // Escape every regex metacharacter in the remaining literal text.
1477
+ // NOTE: * and ? are glob wildcards, handled below - do not escape them.
1478
+ regex = regex.replace(/[.+^${}()|[\]\\]/g, '\\$&');
1479
+ // * matches anything except /
1480
+ regex = regex.replace(/\*/g, '[^/]*');
1481
+ // ? matches single char except /
1482
+ regex = regex.replace(/\?/g, '[^/]');
1483
+ // Now restore ** placeholders
1484
+ regex = regex.replace(/<<STARSTAR_SLASH_START>>/g, '(.*\\/)?');
1485
+ regex = regex.replace(/<<STARSTAR_SLASH>>/g, '([^/]+\\/)*');
1486
+ regex = regex.replace(/<<STARSTAR>>/g, '.*');
1487
+ return new RegExp(`^${regex}$`);
1488
+ }
1489
+ const regex = globToRegex(pattern);
1490
+ // Recursive walk with a depth cap so a pathological tree (or symlink loop)
1491
+ // cannot hang or OOM the tool.
1492
+ const MAX_DEPTH = 16;
1493
+ function walk(dir, prefix, depth) {
1494
+ if (depth > MAX_DEPTH)
1495
+ return;
1496
+ try {
1497
+ const entries = (0, fs_1.readdirSync)(dir, { withFileTypes: true });
1498
+ for (const entry of entries) {
1499
+ if (entry.name.startsWith('.'))
1500
+ continue;
1501
+ const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;
1502
+ if (entry.isDirectory()) {
1503
+ walk((0, path_1.join)(dir, entry.name), relPath, depth + 1);
1504
+ }
1505
+ else {
1506
+ if (regex.test(relPath)) {
1507
+ results.push(relPath);
1508
+ }
1509
+ }
1510
+ }
1511
+ }
1512
+ catch {
1513
+ // skip unreadable directories
1514
+ }
1515
+ }
1516
+ walk(base, '', 0);
1517
+ if (results.length === 0) {
1518
+ return { success: true, output: 'No files found matching pattern' };
1519
+ }
1520
+ // Limit output to 200 matches
1521
+ const maxMatches = 200;
1522
+ const sorted = results.sort();
1523
+ const output = sorted.length > maxMatches
1524
+ ? sorted.slice(0, maxMatches).join('\n') +
1525
+ `\n\n[... truncated, ${sorted.length - maxMatches} more matches]`
1526
+ : sorted.join('\n');
1527
+ return { success: true, output };
1528
+ }
1529
+ catch (err) {
1530
+ return { success: false, output: '', error: String(err.message) };
1531
+ }
1532
+ }
1533
+ /**
1534
+ * Grep 搜索 - 在文件中搜索正则表达式
1535
+ */
1536
+ async function grep_(pattern, basePath, globPattern, contextLines, cwd) {
1537
+ try {
1538
+ const normalizedBasePath = basePath ? normalizeToolPath(basePath) : (cwd ?? process.cwd());
1539
+ const base = basePath ? safePath(basePath, cwd) : (cwd ?? process.cwd());
1540
+ if (!(0, fs_1.existsSync)(base)) {
1541
+ return { success: false, output: '', error: `Path not found: ${normalizedBasePath}` };
1542
+ }
1543
+ const regex = new RegExp(pattern);
1544
+ const context = contextLines ?? 0;
1545
+ const results = [];
1546
+ const maxResults = 100;
1547
+ // Get list of files to search
1548
+ const files = [];
1549
+ const skippedDangling = [];
1550
+ function collectFiles(dir) {
1551
+ try {
1552
+ const entries = (0, fs_1.readdirSync)(dir, { withFileTypes: true });
1553
+ for (const entry of entries) {
1554
+ if (entry.name.startsWith('.'))
1555
+ continue;
1556
+ const fullPath = (0, path_1.join)(dir, entry.name);
1557
+ if (entry.isDirectory()) {
1558
+ collectFiles(fullPath);
1559
+ }
1560
+ else {
1561
+ // Check glob filter if provided
1562
+ if (globPattern) {
1563
+ if (!matchGlobSimple(entry.name, globPattern))
1564
+ continue;
1565
+ }
1566
+ // Skip dangling symlinks — collect their paths for a warning.
1567
+ if (entry.isSymbolicLink()) {
1568
+ try {
1569
+ (0, fs_1.statSync)(fullPath);
1570
+ }
1571
+ catch {
1572
+ skippedDangling.push(fullPath);
1573
+ continue;
1574
+ }
1575
+ }
1576
+ files.push(fullPath);
1577
+ }
1578
+ }
1579
+ }
1580
+ catch {
1581
+ // skip unreadable
1582
+ }
1583
+ }
1584
+ function matchGlobSimple(name, pat) {
1585
+ const escaped = pat.replace(/[.+^${}()|[\]\\]/g, '\\$&');
1586
+ const regex = escaped.replace(/\*/g, '.*').replace(/\?/g, '.');
1587
+ return new RegExp(`^${regex}$`).test(name);
1588
+ }
1589
+ const baseStat = safeStatSync(base);
1590
+ if (!baseStat) {
1591
+ return { success: false, output: '', error: `Cannot access path: ${base} (may be a dangling symlink or missing)` };
1592
+ }
1593
+ if (baseStat.isDirectory()) {
1594
+ collectFiles(base);
1595
+ }
1596
+ else {
1597
+ // Skip dangling symlinks / unreadable single files early.
1598
+ const fileStat = safeStatSync(base);
1599
+ if (fileStat && fileStat.isFile()) {
1600
+ files.push(base);
1601
+ }
1602
+ }
1603
+ // Search each file
1604
+ for (const file of files) {
1605
+ if (results.length >= maxResults)
1606
+ break;
1607
+ try {
1608
+ // Skip dangling symlinks and unreadable files before creating the stream.
1609
+ const fileStat = safeStatSync(file);
1610
+ if (!fileStat || !fileStat.isFile())
1611
+ continue;
1612
+ const stream = (0, fs_1.createReadStream)(file, { encoding: 'utf-8' });
1613
+ const rl = (0, readline_1.createInterface)({
1614
+ input: stream,
1615
+ crlfDelay: Infinity,
1616
+ });
1617
+ const lines = [];
1618
+ const relPath = (0, path_1.relative)(base, file);
1619
+ rl.on('line', line => {
1620
+ lines.push(line);
1621
+ });
1622
+ // Guard against stream errors (dangling symlinks, permission denied, etc.)
1623
+ await new Promise((resolve, reject) => {
1624
+ stream.on('error', reject);
1625
+ rl.on('close', resolve);
1626
+ });
1627
+ // Search for matches
1628
+ for (let i = 0; i < lines.length && results.length < maxResults; i++) {
1629
+ if (regex.test(lines[i])) {
1630
+ // Format: file:line:content
1631
+ const start = Math.max(0, i - context);
1632
+ const end = Math.min(lines.length - 1, i + context);
1633
+ if (context > 0) {
1634
+ results.push(`${relPath}:${i + 1}:`);
1635
+ for (let j = start; j <= end; j++) {
1636
+ const prefix = j === i ? '>' : ' ';
1637
+ results.push(` ${prefix}${j + 1}: ${lines[j]}`);
1638
+ }
1639
+ results.push('');
1640
+ }
1641
+ else {
1642
+ results.push(`${relPath}:${i + 1}: ${lines[i]}`);
1643
+ }
1644
+ }
1645
+ }
1646
+ }
1647
+ catch {
1648
+ // skip unreadable files
1649
+ }
1650
+ }
1651
+ const symlinkWarning = skippedDangling.length > 0
1652
+ ? `\n⚠️ Skipped ${skippedDangling.length} dangling symlink(s): ${skippedDangling.slice(0, 3).join(', ')}${skippedDangling.length > 3 ? '...' : ''}\n`
1653
+ : '';
1654
+ if (results.length === 0) {
1655
+ return { success: true, output: 'No matches found' + symlinkWarning };
1656
+ }
1657
+ return { success: true, output: results.slice(0, maxResults).join('\n') + symlinkWarning };
1658
+ }
1659
+ catch (err) {
1660
+ return { success: false, output: '', error: String(err.message) };
1661
+ }
1662
+ }
1663
+ function isRecord(value) {
1664
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
1665
+ }
1666
+ function parseBatchReadSteps(rawSteps) {
1667
+ let value = rawSteps;
1668
+ if (typeof value === 'string') {
1669
+ try {
1670
+ value = JSON.parse(value);
1671
+ }
1672
+ catch {
1673
+ return { error: 'batch_read steps must be an array or a valid JSON array string' };
1674
+ }
1675
+ }
1676
+ if (!Array.isArray(value)) {
1677
+ return { error: 'batch_read requires steps to be an array' };
1678
+ }
1679
+ if (value.length === 0) {
1680
+ return { error: 'batch_read requires at least one step' };
1681
+ }
1682
+ if (value.length > BATCH_READ_MAX_STEPS) {
1683
+ return { error: `batch_read supports at most ${BATCH_READ_MAX_STEPS} steps` };
1684
+ }
1685
+ const steps = [];
1686
+ for (let i = 0; i < value.length; i++) {
1687
+ const step = value[i];
1688
+ if (!isRecord(step)) {
1689
+ return { error: `batch_read step ${i + 1} must be an object` };
1690
+ }
1691
+ if (typeof step.tool !== 'string' || !step.tool) {
1692
+ return { error: `batch_read step ${i + 1} requires a tool string` };
1693
+ }
1694
+ let stepArgs = step.args;
1695
+ if (typeof stepArgs === 'string') {
1696
+ try {
1697
+ stepArgs = JSON.parse(stepArgs);
1698
+ }
1699
+ catch {
1700
+ return {
1701
+ error: `batch_read step ${i + 1} args must be an object or valid JSON object string`,
1702
+ };
1703
+ }
1704
+ }
1705
+ if (!isRecord(stepArgs)) {
1706
+ return { error: `batch_read step ${i + 1} requires args to be an object` };
1707
+ }
1708
+ steps.push({ tool: step.tool, args: stepArgs });
1709
+ }
1710
+ return { steps };
1711
+ }
1712
+ function buildBatchReadPayload(success, summary, steps, error) {
1713
+ const payload = {
1714
+ success,
1715
+ output: steps
1716
+ .map(step => `${step.index}. ${step.tool}: ${step.summary || (step.success ? 'ok' : step.error || 'error')}`)
1717
+ .join('\n'),
1718
+ summary,
1719
+ steps,
1720
+ };
1721
+ if (error) {
1722
+ payload.error = error;
1723
+ }
1724
+ return {
1725
+ success,
1726
+ output: JSON.stringify(payload, null, 2),
1727
+ summary,
1728
+ error,
1729
+ };
1730
+ }
1731
+ async function executeBatchRead(args, context) {
1732
+ const parsed = parseBatchReadSteps(args.steps);
1733
+ if (parsed.error || !parsed.steps) {
1734
+ return buildBatchReadPayload(false, parsed.error || 'Invalid batch_read request', [], parsed.error);
1735
+ }
1736
+ const runtimeTools = getRuntimeTools();
1737
+ for (let i = 0; i < parsed.steps.length; i++) {
1738
+ const step = parsed.steps[i];
1739
+ const tool = runtimeTools.find(t => t.name === step.tool);
1740
+ if (!BATCH_READ_ALLOWED_TOOLS.has(step.tool)) {
1741
+ const error = `Tool ${step.tool} is not allowed in batch_read`;
1742
+ return buildBatchReadPayload(false, error, [
1743
+ {
1744
+ index: i + 1,
1745
+ tool: step.tool,
1746
+ args: step.args,
1747
+ success: false,
1748
+ error,
1749
+ output: '',
1750
+ },
1751
+ ], error);
1752
+ }
1753
+ if (!tool || tool.isReadOnly?.(step.args) !== true) {
1754
+ const error = `Tool ${step.tool} is unavailable or not read-only`;
1755
+ return buildBatchReadPayload(false, error, [
1756
+ {
1757
+ index: i + 1,
1758
+ tool: step.tool,
1759
+ args: step.args,
1760
+ success: false,
1761
+ error,
1762
+ output: '',
1763
+ },
1764
+ ], error);
1765
+ }
1766
+ }
1767
+ const stepResults = [];
1768
+ for (let i = 0; i < parsed.steps.length; i++) {
1769
+ const step = parsed.steps[i];
1770
+ try {
1771
+ const rawResult = await executeTool(step.tool, step.args, context.abortSignal, context);
1772
+ const envelope = JSON.parse(rawResult);
1773
+ const output = typeof envelope.output === 'string'
1774
+ ? envelope.output
1775
+ : JSON.stringify(envelope.output ?? '');
1776
+ stepResults.push({
1777
+ index: i + 1,
1778
+ tool: step.tool,
1779
+ args: step.args,
1780
+ success: envelope.success === true,
1781
+ summary: typeof envelope.summary === 'string' ? envelope.summary : undefined,
1782
+ error: typeof envelope.error === 'string' ? envelope.error : undefined,
1783
+ output: (0, tool_artifacts_1.truncateForContext)(output, BATCH_READ_STEP_OUTPUT_MAX_BYTES),
1784
+ });
1785
+ }
1786
+ catch (err) {
1787
+ stepResults.push({
1788
+ index: i + 1,
1789
+ tool: step.tool,
1790
+ args: step.args,
1791
+ success: false,
1792
+ error: err?.message || String(err),
1793
+ output: '',
1794
+ });
1795
+ }
1796
+ }
1797
+ const okCount = stepResults.filter(step => step.success).length;
1798
+ const success = okCount === stepResults.length;
1799
+ const summary = `batch_read completed ${okCount}/${stepResults.length} steps`;
1800
+ return buildBatchReadPayload(success, summary, stepResults, success ? undefined : summary);
1801
+ }
1802
+ // ============================================================================
1803
+ // 统一执行入口
1804
+ // ============================================================================
1805
+ /**
1806
+ * 执行一个工具调用,返回结构化结果字符串
1807
+ * Issue #32 #3.2: 支持 abortSignal
1808
+ */
1809
+ async function executeTool(name, args, abortSignal, toolContext) {
1810
+ const runtimeTools = getRuntimeTools();
1811
+ const tool = runtimeTools.find(t => t.name === name);
1812
+ if (!tool) {
1813
+ return JSON.stringify({
1814
+ success: false,
1815
+ error: `Unknown tool: ${name}. Available tools: ${runtimeTools.map(t => t.name).join(', ')}`,
1816
+ });
1817
+ }
1818
+ const context = {
1819
+ cwd: toolContext?.cwd || process.cwd(),
1820
+ config: toolContext?.config || {
1821
+ name: process.env[environment_1.ENV.NAME] || 'orion-code',
1822
+ mode: process.env[environment_1.ENV.MODE] || 'development',
1823
+ },
1824
+ abortSignal, // Issue #32 #3.2: 透传 abortSignal
1825
+ sessionId: toolContext?.sessionId,
1826
+ turnId: toolContext?.turnId,
1827
+ };
1828
+ const result = await tool.execute(args, context);
1829
+ const summary = summarizeToolResult(tool, args, result);
1830
+ const outputBytes = Buffer.byteLength(result.output || '', 'utf8');
1831
+ let output = result.output || '';
1832
+ let artifactRef;
1833
+ if (outputBytes > tool_artifacts_1.ARTIFACT_THRESHOLD) {
1834
+ const artifact = (0, tool_artifacts_1.storeArtifact)(context.cwd, name, output, outputBytes);
1835
+ if (artifact) {
1836
+ artifactRef = { id: artifact.id, outputBytes: artifact.outputBytes };
1837
+ output = (0, tool_artifacts_1.truncateForContext)(output);
1838
+ }
1839
+ }
1840
+ const payload = {
1841
+ success: result.success,
1842
+ output,
1843
+ summary,
1844
+ outputBytes,
1845
+ };
1846
+ if (!result.success) {
1847
+ payload.error = result.error;
1848
+ }
1849
+ if (artifactRef) {
1850
+ payload.artifactRef = artifactRef;
1851
+ }
1852
+ return JSON.stringify(payload);
1853
+ }
1854
+ function summarizeToolResult(tool, args, result) {
1855
+ try {
1856
+ return tool.getSummary?.(args, result);
1857
+ }
1858
+ catch {
1859
+ return undefined;
1860
+ }
1861
+ }
1862
+ /**
1863
+ * 获取可用工具名称列表
1864
+ */
1865
+ function getToolNames() {
1866
+ return getRuntimeTools()
1867
+ .map(t => t.name)
1868
+ .join(', ');
1869
+ }
1870
+ // Re-export bash_security module
1871
+ var bash_security_2 = require("./bash_security");
1872
+ Object.defineProperty(exports, "READ_ONLY_COMMANDS", { enumerable: true, get: function () { return bash_security_2.READ_ONLY_COMMANDS; } });
1873
+ Object.defineProperty(exports, "DANGEROUS_PATTERNS", { enumerable: true, get: function () { return bash_security_2.DANGEROUS_PATTERNS; } });
1874
+ Object.defineProperty(exports, "POTENTIALLY_DESTRUCTIVE_PATTERNS", { enumerable: true, get: function () { return bash_security_2.POTENTIALLY_DESTRUCTIVE_PATTERNS; } });
1875
+ Object.defineProperty(exports, "isReadOnlyCommand", { enumerable: true, get: function () { return bash_security_2.isReadOnlyCommand; } });
1876
+ Object.defineProperty(exports, "checkDangerousCommand", { enumerable: true, get: function () { return bash_security_2.checkDangerousCommand; } });
1877
+ Object.defineProperty(exports, "isPotentiallyDestructive", { enumerable: true, get: function () { return bash_security_2.isPotentiallyDestructive; } });
1878
+ Object.defineProperty(exports, "assessCommandSecurity", { enumerable: true, get: function () { return bash_security_2.assessCommandSecurity; } });
1879
+ Object.defineProperty(exports, "wrapForSandbox", { enumerable: true, get: function () { return bash_security_2.wrapForSandbox; } });
1880
+ Object.defineProperty(exports, "DEFAULT_SANDBOX_OPTIONS", { enumerable: true, get: function () { return bash_security_2.DEFAULT_SANDBOX_OPTIONS; } });
1881
+ //# sourceMappingURL=index.js.map