@ebowwa/coder 0.2.1 → 0.7.64

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 (401) hide show
  1. package/README.md +31 -32
  2. package/dist/core/__tests__/permissions.test.d.ts +12 -0
  3. package/dist/core/__tests__/permissions.test.d.ts.map +1 -0
  4. package/dist/core/__tests__/permissions.test.js +851 -0
  5. package/dist/core/agent-loop/__tests__/compaction.test.d.ts +5 -0
  6. package/dist/core/agent-loop/__tests__/compaction.test.d.ts.map +1 -0
  7. package/dist/core/agent-loop/__tests__/compaction.test.js +209 -0
  8. package/dist/core/agent-loop/__tests__/formatters.test.d.ts +5 -0
  9. package/dist/core/agent-loop/__tests__/formatters.test.d.ts.map +1 -0
  10. package/dist/core/agent-loop/__tests__/formatters.test.js +195 -0
  11. package/dist/core/agent-loop/__tests__/index.test.d.ts +5 -0
  12. package/dist/core/agent-loop/__tests__/index.test.d.ts.map +1 -0
  13. package/dist/core/agent-loop/__tests__/index.test.js +121 -0
  14. package/dist/core/agent-loop/__tests__/loop-state.test.d.ts +5 -0
  15. package/dist/core/agent-loop/__tests__/loop-state.test.d.ts.map +1 -0
  16. package/dist/core/agent-loop/__tests__/loop-state.test.js +340 -0
  17. package/dist/core/agent-loop/__tests__/message-builder.test.d.ts +5 -0
  18. package/dist/core/agent-loop/__tests__/message-builder.test.d.ts.map +1 -0
  19. package/dist/core/agent-loop/__tests__/message-builder.test.js +178 -0
  20. package/dist/core/agent-loop/__tests__/tool-executor.test.d.ts +5 -0
  21. package/dist/core/agent-loop/__tests__/tool-executor.test.d.ts.map +1 -0
  22. package/dist/core/agent-loop/__tests__/tool-executor.test.js +331 -0
  23. package/dist/core/agent-loop/compaction.d.ts +39 -0
  24. package/dist/core/agent-loop/compaction.d.ts.map +1 -0
  25. package/dist/core/agent-loop/compaction.js +51 -0
  26. package/dist/core/agent-loop/formatters.d.ts +21 -0
  27. package/dist/core/agent-loop/formatters.d.ts.map +1 -0
  28. package/dist/core/agent-loop/formatters.js +42 -0
  29. package/dist/core/agent-loop/index.d.ts +25 -0
  30. package/dist/core/agent-loop/index.d.ts.map +1 -0
  31. package/dist/core/agent-loop/index.js +83 -0
  32. package/dist/core/agent-loop/loop-state.d.ts +74 -0
  33. package/dist/core/agent-loop/loop-state.d.ts.map +1 -0
  34. package/dist/core/agent-loop/loop-state.js +147 -0
  35. package/dist/core/agent-loop/message-builder.d.ts +13 -0
  36. package/dist/core/agent-loop/message-builder.d.ts.map +1 -0
  37. package/dist/core/agent-loop/message-builder.js +49 -0
  38. package/dist/core/agent-loop/tool-executor.d.ts +23 -0
  39. package/dist/core/agent-loop/tool-executor.d.ts.map +1 -0
  40. package/dist/core/agent-loop/tool-executor.js +152 -0
  41. package/dist/core/agent-loop/turn-executor.d.ts +57 -0
  42. package/dist/core/agent-loop/turn-executor.d.ts.map +1 -0
  43. package/dist/core/agent-loop/turn-executor.js +124 -0
  44. package/dist/core/agent-loop/types.d.ts +141 -0
  45. package/dist/core/agent-loop/types.d.ts.map +1 -0
  46. package/dist/core/agent-loop/types.js +4 -0
  47. package/dist/core/agent-loop.d.ts +17 -0
  48. package/dist/core/agent-loop.d.ts.map +1 -0
  49. package/dist/core/agent-loop.js +16 -0
  50. package/dist/core/api-client-impl.d.ts +62 -0
  51. package/dist/core/api-client-impl.d.ts.map +1 -0
  52. package/dist/core/api-client-impl.js +479 -0
  53. package/dist/core/api-client.d.ts +6 -0
  54. package/dist/core/api-client.d.ts.map +1 -0
  55. package/dist/core/api-client.js +5 -0
  56. package/dist/core/checkpoints.d.ts +128 -0
  57. package/dist/core/checkpoints.d.ts.map +1 -0
  58. package/dist/core/checkpoints.js +438 -0
  59. package/dist/core/claude-md.d.ts +71 -0
  60. package/dist/core/claude-md.d.ts.map +1 -0
  61. package/dist/core/claude-md.js +198 -0
  62. package/dist/core/cognitive-security/hooks.d.ts +138 -0
  63. package/dist/core/cognitive-security/hooks.d.ts.map +1 -0
  64. package/dist/core/cognitive-security/hooks.js +389 -0
  65. package/dist/core/cognitive-security/index.d.ts +751 -0
  66. package/dist/core/cognitive-security/index.d.ts.map +1 -0
  67. package/dist/core/cognitive-security/index.js +1123 -0
  68. package/dist/core/cognitive-security/middleware.d.ts +136 -0
  69. package/dist/core/cognitive-security/middleware.d.ts.map +1 -0
  70. package/dist/core/cognitive-security/middleware.js +376 -0
  71. package/dist/core/config-loader.d.ts +127 -0
  72. package/dist/core/config-loader.d.ts.map +1 -0
  73. package/dist/core/config-loader.js +219 -0
  74. package/dist/core/context-compaction.d.ts +87 -0
  75. package/dist/core/context-compaction.d.ts.map +1 -0
  76. package/dist/core/context-compaction.js +428 -0
  77. package/dist/core/git-status.d.ts +25 -0
  78. package/dist/core/git-status.d.ts.map +1 -0
  79. package/dist/core/git-status.js +204 -0
  80. package/dist/core/image.d.ts +69 -0
  81. package/dist/core/image.d.ts.map +1 -0
  82. package/dist/core/image.js +290 -0
  83. package/dist/core/image.test.d.ts +2 -0
  84. package/dist/core/image.test.d.ts.map +1 -0
  85. package/dist/core/image.test.js +149 -0
  86. package/dist/core/models.d.ts +123 -0
  87. package/dist/core/models.d.ts.map +1 -0
  88. package/dist/core/models.js +325 -0
  89. package/dist/core/permissions.d.ts +81 -0
  90. package/dist/core/permissions.d.ts.map +1 -0
  91. package/dist/core/permissions.js +327 -0
  92. package/dist/core/retry.d.ts +25 -0
  93. package/dist/core/retry.d.ts.map +1 -0
  94. package/dist/core/retry.js +121 -0
  95. package/dist/core/session-store.d.ts +9 -0
  96. package/dist/core/session-store.d.ts.map +1 -0
  97. package/dist/core/session-store.js +10 -0
  98. package/dist/core/sessions/export.d.ts +47 -0
  99. package/dist/core/sessions/export.d.ts.map +1 -0
  100. package/dist/core/sessions/export.js +256 -0
  101. package/dist/core/sessions/index.d.ts +132 -0
  102. package/dist/core/sessions/index.d.ts.map +1 -0
  103. package/dist/core/sessions/index.js +442 -0
  104. package/dist/core/sessions/metadata.d.ts +77 -0
  105. package/dist/core/sessions/metadata.d.ts.map +1 -0
  106. package/dist/core/sessions/metadata.js +233 -0
  107. package/dist/core/sessions/persistence.d.ts +72 -0
  108. package/dist/core/sessions/persistence.d.ts.map +1 -0
  109. package/dist/core/sessions/persistence.js +201 -0
  110. package/dist/core/sessions/types.d.ts +110 -0
  111. package/dist/core/sessions/types.d.ts.map +1 -0
  112. package/dist/core/sessions/types.js +4 -0
  113. package/dist/core/stream-highlighter.d.ts +18 -0
  114. package/dist/core/stream-highlighter.d.ts.map +1 -0
  115. package/dist/core/stream-highlighter.js +916 -0
  116. package/dist/core/system-reminders.d.ts +89 -0
  117. package/dist/core/system-reminders.d.ts.map +1 -0
  118. package/dist/core/system-reminders.js +285 -0
  119. package/dist/ecosystem/hooks/__tests__/index.test.d.ts +5 -0
  120. package/dist/ecosystem/hooks/__tests__/index.test.d.ts.map +1 -0
  121. package/dist/ecosystem/hooks/__tests__/index.test.js +458 -0
  122. package/dist/ecosystem/hooks/index.d.ts +59 -0
  123. package/dist/ecosystem/hooks/index.d.ts.map +1 -0
  124. package/dist/ecosystem/hooks/index.js +294 -0
  125. package/dist/ecosystem/hooks/prompt-evaluator.d.ts +32 -0
  126. package/dist/ecosystem/hooks/prompt-evaluator.d.ts.map +1 -0
  127. package/dist/ecosystem/hooks/prompt-evaluator.js +229 -0
  128. package/dist/ecosystem/skills/index.d.ts +55 -0
  129. package/dist/ecosystem/skills/index.d.ts.map +1 -0
  130. package/dist/ecosystem/skills/index.js +258 -0
  131. package/dist/ecosystem/tools/__tests__/index.test.d.ts +7 -0
  132. package/dist/ecosystem/tools/__tests__/index.test.d.ts.map +1 -0
  133. package/dist/ecosystem/tools/__tests__/index.test.js +856 -0
  134. package/dist/ecosystem/tools/index.d.ts +24 -0
  135. package/dist/ecosystem/tools/index.d.ts.map +1 -0
  136. package/dist/ecosystem/tools/index.js +1709 -0
  137. package/dist/index.d.ts +24 -0
  138. package/dist/index.d.ts.map +1 -0
  139. package/dist/index.js +32 -2
  140. package/dist/interfaces/mcp/client.d.ts +40 -0
  141. package/dist/interfaces/mcp/client.d.ts.map +1 -0
  142. package/dist/interfaces/mcp/client.js +309 -0
  143. package/dist/interfaces/ui/index.d.ts +36 -0
  144. package/dist/interfaces/ui/index.d.ts.map +1 -0
  145. package/dist/interfaces/ui/index.js +61 -0
  146. package/dist/interfaces/ui/spinner.d.ts +140 -0
  147. package/dist/interfaces/ui/spinner.d.ts.map +1 -0
  148. package/dist/interfaces/ui/spinner.js +342 -0
  149. package/dist/interfaces/ui/terminal/cli/index.d.ts +12 -0
  150. package/dist/interfaces/ui/terminal/cli/index.d.ts.map +1 -0
  151. package/dist/interfaces/ui/terminal/cli/index.js +167 -0
  152. package/dist/interfaces/ui/terminal/shared/args.d.ts +39 -0
  153. package/dist/interfaces/ui/terminal/shared/args.d.ts.map +1 -0
  154. package/dist/interfaces/ui/terminal/shared/args.js +176 -0
  155. package/dist/interfaces/ui/terminal/shared/index.d.ts +11 -0
  156. package/dist/interfaces/ui/terminal/shared/index.d.ts.map +1 -0
  157. package/dist/interfaces/ui/terminal/shared/index.js +16 -0
  158. package/dist/interfaces/ui/terminal/shared/loading-state.d.ts +124 -0
  159. package/dist/interfaces/ui/terminal/shared/loading-state.d.ts.map +1 -0
  160. package/dist/interfaces/ui/terminal/shared/loading-state.js +246 -0
  161. package/dist/interfaces/ui/terminal/shared/query.d.ts +22 -0
  162. package/dist/interfaces/ui/terminal/shared/query.d.ts.map +1 -0
  163. package/dist/interfaces/ui/terminal/shared/query.js +100 -0
  164. package/dist/interfaces/ui/terminal/shared/setup.d.ts +33 -0
  165. package/dist/interfaces/ui/terminal/shared/setup.d.ts.map +1 -0
  166. package/dist/interfaces/ui/terminal/shared/setup.js +226 -0
  167. package/dist/interfaces/ui/terminal/shared/status-line.d.ts +117 -0
  168. package/dist/interfaces/ui/terminal/shared/status-line.d.ts.map +1 -0
  169. package/dist/interfaces/ui/terminal/shared/status-line.js +267 -0
  170. package/dist/interfaces/ui/terminal/shared/system-prompt.d.ts +38 -0
  171. package/dist/interfaces/ui/terminal/shared/system-prompt.d.ts.map +1 -0
  172. package/dist/interfaces/ui/terminal/shared/system-prompt.js +102 -0
  173. package/dist/interfaces/ui/terminal/tui/HelpPanel.d.ts +39 -0
  174. package/dist/interfaces/ui/terminal/tui/HelpPanel.d.ts.map +1 -0
  175. package/dist/interfaces/ui/terminal/tui/HelpPanel.js +215 -0
  176. package/dist/interfaces/ui/terminal/tui/InputContext.d.ts +91 -0
  177. package/dist/interfaces/ui/terminal/tui/InputContext.d.ts.map +1 -0
  178. package/dist/interfaces/ui/terminal/tui/InputContext.js +154 -0
  179. package/dist/interfaces/ui/terminal/tui/InputField.d.ts +18 -0
  180. package/dist/interfaces/ui/terminal/tui/InputField.d.ts.map +1 -0
  181. package/dist/interfaces/ui/terminal/tui/InputField.js +41 -0
  182. package/dist/interfaces/ui/terminal/tui/InteractiveTUI.d.ts +16 -0
  183. package/dist/interfaces/ui/terminal/tui/InteractiveTUI.d.ts.map +1 -0
  184. package/dist/interfaces/ui/terminal/tui/InteractiveTUI.js +451 -0
  185. package/dist/interfaces/ui/terminal/tui/MessageArea.d.ts +10 -0
  186. package/dist/interfaces/ui/terminal/tui/MessageArea.d.ts.map +1 -0
  187. package/dist/interfaces/ui/terminal/tui/MessageArea.js +91 -0
  188. package/dist/interfaces/ui/terminal/tui/MessageStore.d.ts +48 -0
  189. package/dist/interfaces/ui/terminal/tui/MessageStore.d.ts.map +1 -0
  190. package/dist/interfaces/ui/terminal/tui/MessageStore.js +151 -0
  191. package/dist/interfaces/ui/terminal/tui/StatusBar.d.ts +9 -0
  192. package/dist/interfaces/ui/terminal/tui/StatusBar.d.ts.map +1 -0
  193. package/dist/interfaces/ui/terminal/tui/StatusBar.js +36 -0
  194. package/dist/interfaces/ui/terminal/tui/commands.d.ts +21 -0
  195. package/dist/interfaces/ui/terminal/tui/commands.d.ts.map +1 -0
  196. package/dist/interfaces/ui/terminal/tui/commands.js +359 -0
  197. package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.d.ts +115 -0
  198. package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.d.ts.map +1 -0
  199. package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.js +306 -0
  200. package/dist/interfaces/ui/terminal/tui/components/MultilineInput.d.ts +92 -0
  201. package/dist/interfaces/ui/terminal/tui/components/MultilineInput.d.ts.map +1 -0
  202. package/dist/interfaces/ui/terminal/tui/components/MultilineInput.js +399 -0
  203. package/dist/interfaces/ui/terminal/tui/components/PaneManager.d.ts +59 -0
  204. package/dist/interfaces/ui/terminal/tui/components/PaneManager.d.ts.map +1 -0
  205. package/dist/interfaces/ui/terminal/tui/components/PaneManager.js +139 -0
  206. package/dist/interfaces/ui/terminal/tui/components/Sidebar.d.ts +68 -0
  207. package/dist/interfaces/ui/terminal/tui/components/Sidebar.d.ts.map +1 -0
  208. package/dist/interfaces/ui/terminal/tui/components/Sidebar.js +340 -0
  209. package/dist/interfaces/ui/terminal/tui/components/index.d.ts +23 -0
  210. package/dist/interfaces/ui/terminal/tui/components/index.d.ts.map +1 -0
  211. package/dist/interfaces/ui/terminal/tui/components/index.js +51 -0
  212. package/dist/interfaces/ui/terminal/tui/console.d.ts +20 -0
  213. package/dist/interfaces/ui/terminal/tui/console.d.ts.map +1 -0
  214. package/dist/interfaces/ui/terminal/tui/console.js +46 -0
  215. package/dist/interfaces/ui/terminal/tui/index.d.ts +20 -0
  216. package/dist/interfaces/ui/terminal/tui/index.d.ts.map +1 -0
  217. package/dist/interfaces/ui/terminal/tui/index.js +28 -0
  218. package/dist/interfaces/ui/terminal/tui/run.d.ts +13 -0
  219. package/dist/interfaces/ui/terminal/tui/run.d.ts.map +1 -0
  220. package/dist/interfaces/ui/terminal/tui/run.js +31 -0
  221. package/dist/interfaces/ui/terminal/tui/spinner.d.ts +44 -0
  222. package/dist/interfaces/ui/terminal/tui/spinner.d.ts.map +1 -0
  223. package/dist/interfaces/ui/terminal/tui/spinner.js +59 -0
  224. package/dist/interfaces/ui/terminal/tui/tui-app.d.ts +39 -0
  225. package/dist/interfaces/ui/terminal/tui/tui-app.d.ts.map +1 -0
  226. package/dist/interfaces/ui/terminal/tui/tui-app.js +198 -0
  227. package/dist/interfaces/ui/terminal/tui/tui-footer.d.ts +167 -0
  228. package/dist/interfaces/ui/terminal/tui/tui-footer.d.ts.map +1 -0
  229. package/dist/interfaces/ui/terminal/tui/tui-footer.js +330 -0
  230. package/dist/interfaces/ui/terminal/tui/types.d.ts +165 -0
  231. package/dist/interfaces/ui/terminal/tui/types.d.ts.map +1 -0
  232. package/dist/interfaces/ui/terminal/tui/types.js +5 -0
  233. package/dist/interfaces/ui/terminal/tui/useInputHandler.d.ts +23 -0
  234. package/dist/interfaces/ui/terminal/tui/useInputHandler.d.ts.map +1 -0
  235. package/dist/interfaces/ui/terminal/tui/useInputHandler.js +72 -0
  236. package/dist/interfaces/ui/terminal/tui/useNativeInput.d.ts +90 -0
  237. package/dist/interfaces/ui/terminal/tui/useNativeInput.d.ts.map +1 -0
  238. package/dist/interfaces/ui/terminal/tui/useNativeInput.js +188 -0
  239. package/dist/native/index.d.ts +480 -0
  240. package/dist/native/index.d.ts.map +1 -0
  241. package/dist/native/index.js +1625 -0
  242. package/dist/teammates/index.d.ts +161 -0
  243. package/dist/teammates/index.d.ts.map +1 -0
  244. package/dist/teammates/index.js +827 -0
  245. package/dist/types/index.d.ts +482 -0
  246. package/dist/types/index.d.ts.map +1 -0
  247. package/dist/types/index.js +52 -0
  248. package/native/README.md +5 -5
  249. package/native/index.darwin-arm64.node +0 -0
  250. package/native/index.node +0 -0
  251. package/native/package.json +4 -4
  252. package/package.json +33 -16
  253. package/packages/src/core/__tests__/permissions.test.ts +1091 -0
  254. package/packages/src/core/agent-loop/__tests__/compaction.test.ts +280 -0
  255. package/packages/src/core/agent-loop/__tests__/formatters.test.ts +234 -0
  256. package/packages/src/core/agent-loop/__tests__/index.test.ts +162 -0
  257. package/packages/src/core/agent-loop/__tests__/loop-state.test.ts +413 -0
  258. package/packages/src/core/agent-loop/__tests__/message-builder.test.ts +229 -0
  259. package/packages/src/core/agent-loop/__tests__/tool-executor.test.ts +457 -0
  260. package/packages/src/core/agent-loop/compaction.ts +88 -0
  261. package/packages/src/core/agent-loop/formatters.ts +50 -0
  262. package/packages/src/core/agent-loop/index.ts +135 -0
  263. package/packages/src/core/agent-loop/loop-state.ts +187 -0
  264. package/packages/src/core/agent-loop/message-builder.ts +62 -0
  265. package/packages/src/core/agent-loop/tool-executor.ts +211 -0
  266. package/packages/src/core/agent-loop/turn-executor.ts +222 -0
  267. package/packages/src/core/agent-loop/types.ts +148 -0
  268. package/packages/src/core/agent-loop.ts +18 -0
  269. package/packages/src/core/api-client-impl.ts +619 -0
  270. package/packages/src/core/api-client.ts +6 -0
  271. package/packages/src/core/checkpoints.ts +606 -0
  272. package/packages/src/core/claude-md.ts +272 -0
  273. package/packages/src/core/cognitive-security/hooks.ts +590 -0
  274. package/packages/src/core/cognitive-security/index.ts +2041 -0
  275. package/packages/src/core/cognitive-security/middleware.ts +536 -0
  276. package/packages/src/core/config-loader.ts +324 -0
  277. package/packages/src/core/context-compaction.ts +578 -0
  278. package/packages/src/core/git-status.ts +262 -0
  279. package/packages/src/core/image.test.ts +180 -0
  280. package/packages/src/core/image.ts +350 -0
  281. package/packages/src/core/lmdb.db +0 -0
  282. package/packages/src/core/lmdb.db-lock +0 -0
  283. package/packages/src/core/models.ts +430 -0
  284. package/packages/src/core/normalizers/todo +4 -0
  285. package/packages/src/core/permissions.ts +431 -0
  286. package/packages/src/core/retry.ts +170 -0
  287. package/packages/src/core/session-store.ts +36 -0
  288. package/packages/src/core/sessions/export.ts +329 -0
  289. package/packages/src/core/sessions/index.ts +587 -0
  290. package/packages/src/core/sessions/metadata.ts +309 -0
  291. package/packages/src/core/sessions/persistence.ts +244 -0
  292. package/packages/src/core/sessions/types.ts +169 -0
  293. package/packages/src/core/stream-highlighter.ts +1123 -0
  294. package/packages/src/core/system-reminders.ts +402 -0
  295. package/packages/src/core/todo +8 -0
  296. package/packages/src/ecosystem/hooks/__tests__/index.test.ts +561 -0
  297. package/packages/src/ecosystem/hooks/index.ts +341 -0
  298. package/packages/src/ecosystem/hooks/prompt-evaluator.ts +300 -0
  299. package/packages/src/ecosystem/skills/index.ts +295 -0
  300. package/packages/src/ecosystem/tools/__tests__/index.test.ts +1335 -0
  301. package/packages/src/ecosystem/tools/index.ts +1877 -0
  302. package/packages/src/index.ts +120 -0
  303. package/packages/src/interfaces/mcp/client.ts +389 -0
  304. package/packages/src/interfaces/ui/Screenshot 2026-03-02 at 9.23.10/342/200/257PM.png +0 -0
  305. package/packages/src/interfaces/ui/Screenshot 2026-03-03 at 10.55.11/342/200/257AM.png +0 -0
  306. package/packages/src/interfaces/ui/index.ts +161 -0
  307. package/packages/src/interfaces/ui/lmdb.db +0 -0
  308. package/packages/src/interfaces/ui/lmdb.db-lock +0 -0
  309. package/packages/src/interfaces/ui/spinner.ts +451 -0
  310. package/packages/src/interfaces/ui/terminal/cli/index.ts +228 -0
  311. package/packages/src/interfaces/ui/terminal/lmdb.db +0 -0
  312. package/packages/src/interfaces/ui/terminal/lmdb.db-lock +0 -0
  313. package/packages/src/interfaces/ui/terminal/shared/args.ts +222 -0
  314. package/packages/src/interfaces/ui/terminal/shared/index.ts +71 -0
  315. package/packages/src/interfaces/ui/terminal/shared/loading-state.ts +322 -0
  316. package/packages/src/interfaces/ui/terminal/shared/query.ts +146 -0
  317. package/packages/src/interfaces/ui/terminal/shared/setup.ts +295 -0
  318. package/packages/src/interfaces/ui/terminal/shared/status-line.ts +358 -0
  319. package/packages/src/interfaces/ui/terminal/shared/system-prompt.ts +146 -0
  320. package/packages/src/interfaces/ui/terminal/tui/HelpPanel.tsx +262 -0
  321. package/packages/src/interfaces/ui/terminal/tui/InputContext.tsx +232 -0
  322. package/packages/src/interfaces/ui/terminal/tui/InputField.tsx +62 -0
  323. package/packages/src/interfaces/ui/terminal/tui/InteractiveTUI.tsx +537 -0
  324. package/packages/src/interfaces/ui/terminal/tui/MessageArea.tsx +107 -0
  325. package/packages/src/interfaces/ui/terminal/tui/MessageStore.tsx +240 -0
  326. package/packages/src/interfaces/ui/terminal/tui/StatusBar.tsx +54 -0
  327. package/packages/src/interfaces/ui/terminal/tui/commands.ts +438 -0
  328. package/packages/src/interfaces/ui/terminal/tui/components/InteractiveElements.tsx +584 -0
  329. package/packages/src/interfaces/ui/terminal/tui/components/MultilineInput.tsx +614 -0
  330. package/packages/src/interfaces/ui/terminal/tui/components/PaneManager.tsx +333 -0
  331. package/packages/src/interfaces/ui/terminal/tui/components/Sidebar.tsx +604 -0
  332. package/packages/src/interfaces/ui/terminal/tui/components/index.ts +118 -0
  333. package/packages/src/interfaces/ui/terminal/tui/console.ts +49 -0
  334. package/packages/src/interfaces/ui/terminal/tui/index.ts +90 -0
  335. package/packages/src/interfaces/ui/terminal/tui/run.tsx +42 -0
  336. package/packages/src/interfaces/ui/terminal/tui/spinner.ts +69 -0
  337. package/packages/src/interfaces/ui/terminal/tui/tui-app.tsx +390 -0
  338. package/packages/src/interfaces/ui/terminal/tui/tui-footer.ts +422 -0
  339. package/packages/src/interfaces/ui/terminal/tui/types.ts +186 -0
  340. package/packages/src/interfaces/ui/terminal/tui/useInputHandler.ts +104 -0
  341. package/packages/src/interfaces/ui/terminal/tui/useNativeInput.ts +239 -0
  342. package/packages/src/lmdb.db +0 -0
  343. package/packages/src/lmdb.db-lock +0 -0
  344. package/packages/src/native/index.ts +2345 -0
  345. package/packages/src/teammates/index.ts +982 -0
  346. package/packages/src/types/index.ts +722 -0
  347. package/dist/cli.js +0 -148
  348. package/dist/index-0pkak453.js +0 -136
  349. package/dist/index-0qd0x8b4.js +0 -110
  350. package/dist/index-0x3kprq6.js +0 -240
  351. package/dist/index-1eawy937.js +0 -308
  352. package/dist/index-24m2aygy.js +0 -240
  353. package/dist/index-29xcjnne.js +0 -280
  354. package/dist/index-2avyytn5.js +0 -349
  355. package/dist/index-4ms367ey.js +0 -136
  356. package/dist/index-4w2t3b0m.js +0 -240
  357. package/dist/index-4xfgd8nz.js +0 -261
  358. package/dist/index-5acjp9gc.js +0 -157
  359. package/dist/index-5s15hr56.js +0 -136
  360. package/dist/index-6e4wf341.js +0 -349
  361. package/dist/index-6fvnkedw.js +0 -240
  362. package/dist/index-6rqpmd4g.js +0 -128
  363. package/dist/index-77ckwnbm.js +0 -280
  364. package/dist/index-9knxy49k.js +0 -128
  365. package/dist/index-9zrnw4zx.js +0 -128
  366. package/dist/index-bk21w99v.js +0 -280
  367. package/dist/index-c41n76fv.js +0 -240
  368. package/dist/index-cb4ppjdt.js +0 -255
  369. package/dist/index-cfb2edt6.js +0 -240
  370. package/dist/index-cmfa38hh.js +0 -308
  371. package/dist/index-datjz8q1.js +0 -257
  372. package/dist/index-eadf4wvn.js +0 -240
  373. package/dist/index-em5k0m3z.js +0 -345
  374. package/dist/index-gh8r333a.js +0 -110
  375. package/dist/index-gkx6k2tr.js +0 -261
  376. package/dist/index-h5cabfks.js +0 -155
  377. package/dist/index-hcrpwyy3.js +0 -261
  378. package/dist/index-hk7fwwa8.js +0 -257
  379. package/dist/index-jb8cw7f8.js +0 -136
  380. package/dist/index-kbyw4th1.js +0 -347
  381. package/dist/index-kgj5gqnm.js +0 -345
  382. package/dist/index-mdf6xp1z.js +0 -255
  383. package/dist/index-mrhv8kvc.js +0 -280
  384. package/dist/index-mt4743dd.js +0 -161
  385. package/dist/index-qnwsg97q.js +0 -240
  386. package/dist/index-qwdy6x44.js +0 -261
  387. package/dist/index-rmj77261.js +0 -157
  388. package/dist/index-sbbw1a61.js +0 -349
  389. package/dist/index-svy5bcpn.js +0 -345
  390. package/dist/index-tvmy7tm9.js +0 -261
  391. package/dist/index-tzz4vzkj.js +0 -312
  392. package/dist/index-vz80zmhe.js +0 -110
  393. package/dist/index-wed2fk67.js +0 -240
  394. package/dist/index-wksgzz8e.js +0 -280
  395. package/dist/index-wn2m4wma.js +0 -240
  396. package/dist/index-xha05vjc.js +0 -257
  397. package/dist/index-yc6eh8p8.js +0 -136
  398. package/dist/index-ycjxx9ft.js +0 -240
  399. package/dist/index-z0gzd0fc.js +0 -110
  400. package/dist/index-z8cwtf8j.js +0 -240
  401. package/dist/index-zy5mtt00.js +0 -128
@@ -1,128 +0,0 @@
1
- // @bun
2
- var y6=Object.create;var{getPrototypeOf:u6,defineProperty:T5,getOwnPropertyNames:f6}=Object;var h6=Object.prototype.hasOwnProperty;var m6=(Q,X,Z)=>{Z=Q!=null?y6(u6(Q)):{};let V=X||!Q||!Q.__esModule?T5(Z,"default",{value:Q,enumerable:!0}):Z;for(let $ of f6(Q))if(!h6.call(V,$))T5(V,$,{get:()=>Q[$],enumerable:!0});return V};var g6=import.meta.require;var mQ={enabled:!0,ttl:"1h",cacheSystemPrompt:!0,cacheTools:!0,minTokensForCache:1024},G9={"claude-opus-4-6":{input:15,output:75,cache_write:18.75,cache_read:1.5},"claude-sonnet-4-6":{input:3,output:15,cache_write:3.75,cache_read:0.3},"claude-haiku-4-5":{input:0.8,output:4,cache_write:1,cache_read:0.08}};var E5={"claude-opus-4-6":{input:15,output:75,cache_write:18.75,cache_read:1.5},"claude-sonnet-4-6":{input:3,output:15,cache_write:3.75,cache_read:0.3},"claude-haiku-4-5":{input:0.8,output:4,cache_write:1,cache_read:0.08},"claude-3-5-sonnet":{input:3,output:15,cache_write:3.75,cache_read:0.3},"claude-3-5-haiku":{input:0.8,output:4,cache_write:1,cache_read:0.08},"claude-3-opus":{input:15,output:75,cache_write:18.75,cache_read:1.5}};function d6(Q,X){let Z=E5[Q]??E5["claude-sonnet-4-6"],V=X.input_tokens-(X.cache_read_input_tokens??0),$=X.cache_read_input_tokens??0,J=X.cache_creation_input_tokens??0,q=X.output_tokens,z=V/1e6*Z.input,K=$/1e6*Z.cache_read,Y=J/1e6*Z.cache_write,W=q/1e6*Z.output,H=z+K+Y+W,_=($+J)/1e6*(Z.input-Z.cache_read);return{costUSD:H,estimatedSavingsUSD:_}}function c6(Q,X){if(!Q||!X.enabled||!X.cacheSystemPrompt)return typeof Q==="string"?Q:void 0;if(Array.isArray(Q)){let Z=[...Q];if(Z.length>0){let V=Z[Z.length-1];if(V&&V.type==="text")Z[Z.length-1]={type:"text",text:V.text,cache_control:{type:"ephemeral",ttl:X.ttl}}}return Z}return[{type:"text",text:Q,cache_control:{type:"ephemeral",ttl:X.ttl}}]}function l6(Q,X){if(!X.enabled)return Q;let Z=[];for(let V=0;V<Q.length;V++){let $=Q[V],J=[];for(let q=0;q<$.content.length;q++){let z=$.content[q],K=q===$.content.length-1,Y=V===Q.length-1;if(z.type==="text"&&z.text.length>=X.minTokensForCache*4&&!z.cache_control&&(K||Y))J.push({...z,cache_control:{type:"ephemeral",ttl:X.ttl}});else J.push(z)}Z.push({...$,content:J})}if(Z.length>0&&X.enabled){let V=Z[Z.length-1],$=V.content[V.content.length-1];if($&&!("cache_control"in $))V.content[V.content.length-1]={...$,cache_control:{type:"ephemeral",ttl:X.ttl}}}return Z}function p6(Q){let X=Q.cache_read_input_tokens??0,Z=Q.cache_creation_input_tokens??0,V=X+Z,$=X>0?1:0,J=Z>0?1:0,q=$+J;return{cacheHits:$,cacheMisses:J,totalCacheReadTokens:X,totalCacheWriteTokens:Z,cacheHitRate:q>0?$/q:0,estimatedSavingsUSD:0}}async function b5(Q,X){let{apiKey:Z,model:V="claude-sonnet-4-6",maxTokens:$=4096,tools:J,systemPrompt:q,cacheConfig:z=mQ,thinking:K,onToken:Y,onThinking:W,onToolUse:H,signal:j}=X,_=Date.now(),G=0,U=!0,w=l6(Q,z),A=c6(q,z),B={model:V,max_tokens:$,messages:w.map((i)=>({role:i.role,content:i.content})),stream:!0};if(A)B.system=A;if(J&&J.length>0)B.tools=J;let C=`${process.env.ANTHROPIC_BASE_URL||"https://api.anthropic.com"}/v1/messages`,L={"Content-Type":"application/json","x-api-key":Z,"anthropic-version":"2023-06-01","anthropic-beta":"max-tokens-3-5-sonnet-2024-07-15"};if(K&&K.type!=="disabled"){if(K.type==="enabled")B.thinking={type:"enabled",budget_tokens:K.budget_tokens};else if(K.type==="adaptive")B.thinking={type:"adaptive"};L["anthropic-beta"]="extended-thinking-2025-01-24"}let N=await fetch(C,{method:"POST",headers:L,body:JSON.stringify(B),signal:j});if(!N.ok){let i=await N.text();throw Error(`API error: ${N.status} - ${i}`)}if(!N.body)throw Error("No response body");let x=N.body.getReader(),c=new TextDecoder,P=null,l=[],D={input_tokens:0,output_tokens:0},zQ=null,p=null,f=null,HQ="",S5="";try{let i="";while(!0){let{done:hQ,value:z5}=await x.read();if(hQ)break;i+=c.decode(z5,{stream:!0});let OQ=i.split(`
3
- `);i=OQ.pop()||"";for(let CQ of OQ){if(!CQ.startsWith("data: "))continue;let UQ=CQ.slice(6);if(!UQ)continue;try{let o=JSON.parse(UQ);switch(o.type){case"message_start":{let v=o.message;P=v,D=v.usage;break}case"content_block_start":{let v=o.content_block;if(v.type==="text")zQ={type:"text",text:""};else if(v.type==="thinking")p={type:"thinking",thinking:""};else if(v.type==="tool_use")f={type:"tool_use",id:v.id,name:v.name,input:{}},HQ="";break}case"content_block_delta":{let v=o.delta;if(v.type==="text_delta"&&zQ){let ZQ=v.text;if(zQ.text+=ZQ,Y?.(ZQ),U)G=Date.now()-_,U=!1}else if(v.type==="thinking_delta"&&p){let ZQ=v.thinking;p.thinking+=ZQ,W?.(ZQ)}else if(v.type==="input_json_delta"&&f)HQ+=v.partial_json;break}case"content_block_stop":if(zQ)l.push(zQ),zQ=null;else if(p)l.push(p),p=null;else if(f){try{f.input=JSON.parse(HQ)}catch{f.input={}}l.push(f),H?.({id:f.id,name:f.name,input:f.input}),f=null}break;case"message_delta":{let v=o;if(v.usage)D.output_tokens=v.usage.output_tokens;if(P&&v.delta?.stop_reason)P.stop_reason=v.delta.stop_reason;break}case"message_stop":break}}catch{}}}}finally{x.releaseLock()}if(!P)throw Error("No message received from API");P.content=l;let{costUSD:q5,estimatedSavingsUSD:XQ}=d6(V,D),GQ=p6(D);GQ.estimatedSavingsUSD=XQ;let s=Date.now()-_;return{message:P,usage:D,cacheMetrics:GQ,costUSD:q5,durationMs:s,ttftMs:G||s}}var Y5={tokenWarningThreshold:0.8,costUpdateInterval:5,toolSummaryInterval:3,envInfoOnStart:!0},K5={WARNING:0.8,CRITICAL:0.9,EMERGENCY:0.95};function i6(Q){let{current:X,max:Z,threshold:V=K5.WARNING}=Q;if(Z<=0)return"";let $=X/Z;if($<V)return"";let J=Z-X,q=Math.round($*100),z,K;if($>=K5.EMERGENCY)z="emergency",K="\uD83D\uDEA8";else if($>=K5.CRITICAL)z="critical",K="\u26A0\uFE0F";else z="warning",K="\u26A1";let Y=[`${K} Token Usage ${z.toUpperCase()}`,"",`Current: ${X.toLocaleString()} / ${Z.toLocaleString()} tokens (${q}%)`,`Remaining: ${J.toLocaleString()} tokens`];if(z==="emergency")Y.push(""),Y.push("Consider summarizing or compacting the conversation to continue.");else if(z==="critical")Y.push(""),Y.push("Approaching token limit. Consider wrapping up soon.");return Y.join(`
4
- `)}function o6(Q){let{cost:X,previousCost:Z=0,currency:V="USD"}=Q,$=n6(V),J=y5(X,$),q=X-Z,z=y5(Math.abs(q),$),K=["\uD83D\uDCB0 Cost Update","",`Total: ${J} ${V}`];if(q!==0){let Y=q>0?"+":"-";K.push(`This turn: ${Y}${z} ${V}`)}return K.join(`
5
- `)}function y5(Q,X){if(Q<0.01)return`${X}${Q.toFixed(4)}`;else if(Q<1)return`${X}${Q.toFixed(3)}`;return`${X}${Q.toFixed(2)}`}function n6(Q){return{USD:"$",EUR:"\u20AC",GBP:"\xA3",JPY:"\xA5"}[Q]||Q}function a6(Q){let{tools:X,maxDisplay:Z=10}=Q;if(X.length===0)return"No tools used this session.";let V=new Map;for(let z of X){let K=V.get(z.name)||0;V.set(z.name,K+1)}let $=[...V.entries()].sort((z,K)=>K[1]-z[1]),J=[`\uD83D\uDD27 Tool Usage Summary (${X.length} total calls)`,""],q=$.slice(0,Z);for(let[z,K]of q)J.push(` \u2022 ${z}: ${K} call${K===1?"":"s"}`);if($.length>Z){let z=$.length-Z;J.push(` ... and ${z} more tool${z===1?"":"s"}`)}return J.join(`
6
- `)}function r6(Q){let{workingDirectory:X,gitStatus:Z,platform:V=process.platform,shell:$=process.env.SHELL||"unknown"}=Q,J=["\uD83D\uDCCD Environment Information","",`Working Directory: ${X}`,`Platform: ${V}`,`Shell: ${$}`];if(Z){if(J.push(""),J.push("Git Status:"),J.push(` Branch: ${Z.branch}`),Z.ahead>0||Z.behind>0)J.push(` Ahead: ${Z.ahead}, Behind: ${Z.behind}`);let q=Z.staged.length+Z.unstaged.length+Z.untracked.length+Z.conflicted.length;if(q>0){if(J.push(` Changes: ${q} file${q===1?"":"s"}`),Z.staged.length>0)J.push(` Staged: ${Z.staged.length}`);if(Z.unstaged.length>0)J.push(` Unstaged: ${Z.unstaged.length}`);if(Z.untracked.length>0)J.push(` Untracked: ${Z.untracked.length}`);if(Z.conflicted.length>0)J.push(` Conflicted: ${Z.conflicted.length}`)}else J.push(" Working tree clean")}return J.join(`
7
- `)}function u5(Q){let{usage:X,maxTokens:Z,totalCost:V,previousCost:$,toolsUsed:J,workingDirectory:q,gitStatus:z,turnNumber:K,config:Y}=Q,W={...Y5,...Y},H=[],j=X.input_tokens+X.output_tokens,_=i6({current:j,max:Z,threshold:W.tokenWarningThreshold});if(_)H.push(_);if(K%W.costUpdateInterval===0){let G=o6({cost:V,previousCost:$});H.push(G)}if(K%W.toolSummaryInterval===0&&J.length>0){let G=a6({tools:J});H.push(G)}if(K===1&&W.envInfoOnStart){let G=r6({workingDirectory:q,gitStatus:z});H.push(G)}if(H.length===0)return"";return["---","System Reminders:","",...H,"---"].join(`
8
- `)}async function R9(Q,X){let{apiKey:Z,model:V="claude-sonnet-4-6",maxTokens:$=4096,systemPrompt:J,tools:q,permissionMode:z,workingDirectory:K,gitStatus:Y=null,reminderConfig:W,cacheConfig:H=mQ,thinking:j,onText:_,onThinking:G,onToolUse:U,onToolResult:w,onMetrics:A,onReminder:B,signal:O}=X,C=[...Q],L=[],N=[],x=0,c=0,P=0,l=0,D={cacheHits:0,cacheMisses:0,totalCacheReadTokens:0,totalCacheWriteTokens:0,cacheHitRate:0,estimatedSavingsUSD:0},zQ={...Y5,...W},p=!0;while(p){if(O?.aborted)break;P++;let f=L[L.length-1],HQ=u5({usage:f?.usage??{input_tokens:0,output_tokens:0},maxTokens:$,totalCost:x,previousCost:l,toolsUsed:N,workingDirectory:K,gitStatus:Y,turnNumber:P,config:zQ});if(HQ)B?.(HQ);let S5=s6(C,J,HQ),q5=await b5(S5,{apiKey:Z,model:V,maxTokens:$,systemPrompt:J,cacheConfig:H,thinking:j,tools:q.map((v)=>({name:v.name,description:v.description,input_schema:v.input_schema})),onToken:_,onThinking:G,onToolUse:U,signal:O}),{message:XQ,usage:GQ,cacheMetrics:s,costUSD:i,durationMs:hQ,ttftMs:z5}=q5,OQ={model:V,messageCount:C.length,messageTokens:GQ.input_tokens+GQ.output_tokens,usage:GQ,cacheMetrics:s,durationMs:hQ,ttftMs:z5,costUSD:i,stopReason:XQ.stop_reason,requestId:XQ.id};if(L.push(OQ),l=x,x+=i,c+=hQ,s)D.cacheHits+=s.cacheHits,D.cacheMisses+=s.cacheMisses,D.totalCacheReadTokens+=s.totalCacheReadTokens,D.totalCacheWriteTokens+=s.totalCacheWriteTokens,D.estimatedSavingsUSD+=s.estimatedSavingsUSD;let CQ=D.cacheHits+D.cacheMisses;if(D.cacheHitRate=CQ>0?D.cacheHits/CQ:0,A?.(OQ),C.push({role:"assistant",content:XQ.content}),XQ.stop_reason==="end_turn"||XQ.stop_reason==="stop_sequence"){p=!1;break}if(XQ.stop_reason==="max_tokens"){console.warn("Max tokens reached - context compaction needed"),p=!1;break}let UQ=XQ.content.filter((v)=>v.type==="tool_use");if(N.push(...UQ),UQ.length===0){p=!1;break}let o=[];for(let v of UQ){if(O?.aborted)break;let ZQ=q.find((VQ)=>VQ.name===v.name);if(!ZQ){o.push({type:"tool_result",tool_use_id:v.id,content:`Error: Unknown tool "${v.name}"`,is_error:!0});continue}if(!t6(ZQ.name,z)){o.push({type:"tool_result",tool_use_id:v.id,content:`Permission denied for tool "${v.name}"`,is_error:!0});continue}try{let VQ=await ZQ.handler(v.input,{workingDirectory:K,permissionMode:z,abortSignal:O});o.push({type:"tool_result",tool_use_id:v.id,content:VQ.content,is_error:VQ.is_error}),w?.({id:v.id,result:VQ})}catch(VQ){let b6=VQ instanceof Error?VQ.message:String(VQ);o.push({type:"tool_result",tool_use_id:v.id,content:`Error: ${b6}`,is_error:!0})}}C.push({role:"user",content:o})}return{messages:C,metrics:L,totalCost:x,totalDuration:c,totalCacheMetrics:D}}function s6(Q,X,Z){if(Z&&Q.length>0){let V=[...Q];for(let $=V.length-1;$>=0;$--){let J=V[$];if(J&&J.role==="user"){let q={role:"user",content:Array.isArray(J.content)?e6(J.content,Z):[{type:"text",text:`${String(J.content)}
9
-
10
- ${Z}`}]};V[$]=q;break}}return V}return Q}function e6(Q,X){if(Q.length>0){let V=Q[Q.length-1];if(V&&V.type==="text"){let $={type:"text",text:`${V.text}
11
-
12
- ${X}`};return[...Q.slice(0,-1),$]}}let Z={type:"text",text:`
13
-
14
- ${X}`};return[...Q,Z]}function t6(Q,X){switch(X){case"bypassPermissions":return!0;case"dontAsk":return!1;case"acceptEdits":return["Read","Write","Edit","Glob","Grep"].includes(Q);case"interactive":case"default":case"plan":return!0;default:return!0}}function f5(Q){if(Q<0.01)return`$${Q.toFixed(4)}`;return`$${Q.toFixed(2)}`}function k9(Q){let X=f5(Q.costUSD),Z=`${Q.usage.input_tokens.toLocaleString()} input, ${Q.usage.output_tokens.toLocaleString()} output`;if(Q.usage.cache_read_input_tokens||Q.usage.cache_creation_input_tokens){let V=Q.usage.cache_read_input_tokens?.toLocaleString()??"0",$=Q.usage.cache_creation_input_tokens?.toLocaleString()??"0";return`Cost: ${X} | Tokens: ${Z} | Cache: ${V} read, ${$} write`}return`Cost: ${X} | Tokens: ${Z}`}function I9(Q){let X=f5(Q.estimatedSavingsUSD);return`Cache: ${(Q.cacheHitRate*100).toFixed(1)}% hit rate | ${Q.totalCacheReadTokens.toLocaleString()} read | ${Q.totalCacheWriteTokens.toLocaleString()} written | Saved: ${X}`}import{homedir as Q7}from"os";import{join as $Q}from"path";class X7{sessionsDir;currentSessionId=null;currentSessionFile=null;writeQueue=Promise.resolve();constructor(Q){this.sessionsDir=Q??$Q(Q7(),".claude","sessions")}async init(){try{await Bun.write($Q(this.sessionsDir,".gitkeep"),"")}catch{}}generateSessionId(){let Q=Date.now().toString(36),X=Math.random().toString(36).slice(2,8);return`${Q}-${X}`}async createSession(Q){await this.init();let X=this.generateSessionId();this.currentSessionId=X,this.currentSessionFile=$Q(this.sessionsDir,`${X}.jsonl`);let Z={id:X,created:Date.now(),updated:Date.now(),model:Q.model,workingDirectory:Q.workingDirectory,agentName:Q.agentName,agentColor:Q.agentColor,teamName:Q.teamName};await this.appendEntry(Z);let V={type:"context",timestamp:Date.now(),workingDirectory:Q.workingDirectory};return await this.appendEntry(V),X}async resumeSession(Q){let X=$Q(this.sessionsDir,`${Q}.jsonl`);try{let Z=await Bun.file(X).text();if(!Z)return null;let V=Z.trim().split(`
15
- `),$=[];for(let J of V)try{$.push(JSON.parse(J))}catch{}return this.parseSessionEntries($)}catch{return null}}parseSessionEntries(Q){let X=null,Z=[],V=[],$=[],J=null;for(let q of Q){if(!("type"in q)&&"id"in q&&"created"in q){X=q;continue}if("type"in q){let z=q;switch(z.type){case"message":Z.push(z.data);break;case"tool_use":V.push(z);break;case"metrics":$.push(z.data);break;case"context":J=z;break}}}if(!X)X={id:"unknown",created:Date.now(),updated:Date.now(),model:"claude-sonnet-4-6",workingDirectory:process.cwd()};return{metadata:X,messages:Z,tools:V,metrics:$,context:J}}async appendEntry(Q){if(!this.currentSessionFile)return;this.writeQueue=this.writeQueue.then(async()=>{let X=JSON.stringify(Q)+`
16
- `,Z=Bun.file(this.currentSessionFile),V=await Z.exists()?await Z.text():"";await Bun.write(this.currentSessionFile,V+X)}),await this.writeQueue}async saveMessage(Q){let X={type:"message",timestamp:Date.now(),data:Q};await this.appendEntry(X),await this.updateTimestamp()}async saveToolUse(Q,X,Z,V,$){let J={type:"tool_use",timestamp:Date.now(),toolId:Q,toolName:X,input:Z,result:V,isError:$};await this.appendEntry(J)}async saveMetrics(Q){let X={type:"metrics",timestamp:Date.now(),data:Q};await this.appendEntry(X)}async updateTimestamp(){if(!this.currentSessionFile||!this.currentSessionId)return}async listSessions(Q=20){await this.init();let X=Bun.file(this.sessionsDir),Z=[];try{let $=[...new Bun.Glob("*.jsonl").scanSync(this.sessionsDir)],J=await Promise.all($.map(async(q)=>{let z=$Q(this.sessionsDir,q),K=await Bun.file(z).stat();return{file:q,fullPath:z,mtime:K?.mtime??new Date(0)}}));J.sort((q,z)=>z.mtime.getTime()-q.mtime.getTime());for(let{file:q,fullPath:z}of J.slice(0,Q)){let K=q.replace(".jsonl",""),Y=await this.getSessionSummary(K,z);if(Y)Z.push(Y)}}catch{}return Z}async getSessionSummary(Q,X){let Z=X??$Q(this.sessionsDir,`${Q}.jsonl`);try{let V=await Bun.file(Z).text();if(!V)return null;let $=V.trim().split(`
17
- `),J=null,q=0,z=0,K=0,Y=0,W;for(let H of $)try{let j=JSON.parse(H);if(j.id&&j.created)J=j;else if(j.type==="message"){q++;let _=j.data;if(!W&&_.role==="user"){let G=_.content.find((U)=>U.type==="text");if(G&&"text"in G){if(W=G.text.slice(0,100),G.text.length>100)W+="..."}}}else if(j.type==="metrics")z+=j.data.costUSD,K+=j.data.usage.input_tokens,Y+=j.data.usage.output_tokens}catch{}if(!J)return null;return{id:Q,created:J.created,updated:J.updated,model:J.model,messageCount:q,totalCost:z,totalTokens:{input:K,output:Y},firstMessage:W,workingDirectory:J.workingDirectory}}catch{return null}}getCurrentSessionId(){return this.currentSessionId}async exportSession(Q,X,Z){let V=await this.resumeSession(Q);if(!V)throw Error(`Session not found: ${Q}`);let $,J;switch(X){case"jsonl":{let z=$Q(this.sessionsDir,`${Q}.jsonl`);$=await Bun.file(z).text(),J="jsonl";break}case"json":{$=JSON.stringify(V,null,2),J="json";break}case"markdown":{$=this.sessionToMarkdown(V),J="md";break}default:throw Error(`Unsupported format: ${X}`)}let q=Z??$Q(process.cwd(),`session-${Q}.${J}`);return await Bun.write(q,$),q}sessionToMarkdown(Q){let X=[];X.push(`# Session: ${Q.metadata.id}`),X.push(""),X.push(`**Created:** ${new Date(Q.metadata.created).toISOString()}`),X.push(`**Model:** ${Q.metadata.model}`),X.push(`**Working Directory:** ${Q.metadata.workingDirectory}`),X.push(""),X.push("## Conversation"),X.push("");for(let Z of Q.messages){let V=Z.role==="user"?"**User**":"**Claude**";X.push(`### ${V}`),X.push("");for(let $ of Z.content)if($.type==="text")X.push($.text),X.push("");else if($.type==="tool_use"){let J=$;X.push(`\`\`\`tool:${J.name}`),X.push(JSON.stringify(J.input,null,2)),X.push("```"),X.push("")}else if($.type==="tool_result"){let J=$;X.push(`**Result**${J.is_error?" (error)":""}:`),X.push("```"),X.push(typeof J.content==="string"?J.content:JSON.stringify(J.content,null,2)),X.push("```"),X.push("")}}if(Q.metrics.length>0){X.push("## Metrics"),X.push("");let Z=Q.metrics.reduce((J,q)=>J+q.costUSD,0),V=Q.metrics.reduce((J,q)=>J+q.usage.input_tokens,0),$=Q.metrics.reduce((J,q)=>J+q.usage.output_tokens,0);X.push(`- **Total Cost:** $${Z.toFixed(4)}`),X.push(`- **Total Input Tokens:** ${V.toLocaleString()}`),X.push(`- **Total Output Tokens:** ${$.toLocaleString()}`),X.push(`- **API Calls:** ${Q.metrics.length}`)}return X.join(`
18
- `)}async deleteSession(Q){let X=$Q(this.sessionsDir,`${Q}.jsonl`);try{if(await Bun.file(X).exists()){let{unlink:V}=await import("fs/promises");return await V(X),!0}return!1}catch{return!1}}}function Z7(Q){let X=new Date(Q.created),Z=new Date(Q.updated),V=V7(Z),$=[];$.push(`\x1B[1m${Q.id}\x1B[0m (${V})`),$.push(` Model: ${Q.model} | Messages: ${Q.messageCount}`);let J=Q.totalCost<0.01?`$${Q.totalCost.toFixed(4)}`:`$${Q.totalCost.toFixed(2)}`;if($.push(` Cost: ${J} | Tokens: ${Q.totalTokens.input.toLocaleString()} in, ${Q.totalTokens.output.toLocaleString()} out`),Q.firstMessage)$.push(` Preview: ${Q.firstMessage}`);return $.push(` Directory: ${Q.workingDirectory}`),$.join(`
19
- `)}function V7(Q){let Z=new Date().getTime()-Q.getTime(),V=Math.floor(Z/60000),$=Math.floor(Z/3600000),J=Math.floor(Z/86400000);if(V<1)return"just now";if(V<60)return`${V}m ago`;if($<24)return`${$}h ago`;if(J<7)return`${J}d ago`;return Q.toLocaleDateString()}function D9(Q){if(Q.length===0){console.log("No sessions found."),console.log(`
20
- Start a new conversation to create a session.`);return}console.log(`\x1B[1mRecent Sessions (${Q.length})\x1B[0m
21
- `);for(let X of Q)console.log(Z7(X)),console.log("");console.log("To resume a session:"),console.log(" claude-remake --resume <session-id>")}var H5=(Q,X,Z)=>{let V=Q instanceof RegExp?h5(Q,Z):Q,$=X instanceof RegExp?h5(X,Z):X,J=V!==null&&$!=null&&$7(V,$,Z);return J&&{start:J[0],end:J[1],pre:Z.slice(0,J[0]),body:Z.slice(J[0]+V.length,J[1]),post:Z.slice(J[1]+$.length)}},h5=(Q,X)=>{let Z=X.match(Q);return Z?Z[0]:null},$7=(Q,X,Z)=>{let V,$,J,q=void 0,z,K=Z.indexOf(Q),Y=Z.indexOf(X,K+1),W=K;if(K>=0&&Y>0){if(Q===X)return[K,Y];V=[],J=Z.length;while(W>=0&&!z){if(W===K)V.push(W),K=Z.indexOf(Q,W+1);else if(V.length===1){let H=V.pop();if(H!==void 0)z=[H,Y]}else{if($=V.pop(),$!==void 0&&$<J)J=$,q=Y;Y=Z.indexOf(X,W+1)}W=K<Y&&K>=0?K:Y}if(V.length&&q!==void 0)z=[J,q]}return z};var m5="\x00SLASH"+Math.random()+"\x00",g5="\x00OPEN"+Math.random()+"\x00",j5="\x00CLOSE"+Math.random()+"\x00",d5="\x00COMMA"+Math.random()+"\x00",c5="\x00PERIOD"+Math.random()+"\x00",J7=new RegExp(m5,"g"),q7=new RegExp(g5,"g"),z7=new RegExp(j5,"g"),K7=new RegExp(d5,"g"),Y7=new RegExp(c5,"g"),H7=/\\\\/g,W7=/\\{/g,j7=/\\}/g,_7=/\\,/g,G7=/\\./g,U7=1e5;function W5(Q){return!isNaN(Q)?parseInt(Q,10):Q.charCodeAt(0)}function A7(Q){return Q.replace(H7,m5).replace(W7,g5).replace(j7,j5).replace(_7,d5).replace(G7,c5)}function w7(Q){return Q.replace(J7,"\\").replace(q7,"{").replace(z7,"}").replace(K7,",").replace(Y7,".")}function l5(Q){if(!Q)return[""];let X=[],Z=H5("{","}",Q);if(!Z)return Q.split(",");let{pre:V,body:$,post:J}=Z,q=V.split(",");q[q.length-1]+="{"+$+"}";let z=l5(J);if(J.length)q[q.length-1]+=z.shift(),q.push.apply(q,z);return X.push.apply(X,q),X}function p5(Q,X={}){if(!Q)return[];let{max:Z=U7}=X;if(Q.slice(0,2)==="{}")Q="\\{\\}"+Q.slice(2);return FQ(A7(Q),Z,!0).map(w7)}function B7(Q){return"{"+Q+"}"}function L7(Q){return/^-?0\d/.test(Q)}function v7(Q,X){return Q<=X}function O7(Q,X){return Q>=X}function FQ(Q,X,Z){let V=[],$=H5("{","}",Q);if(!$)return[Q];let J=$.pre,q=$.post.length?FQ($.post,X,!1):[""];if(/\$$/.test($.pre))for(let z=0;z<q.length&&z<X;z++){let K=J+"{"+$.body+"}"+q[z];V.push(K)}else{let z=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test($.body),K=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test($.body),Y=z||K,W=$.body.indexOf(",")>=0;if(!Y&&!W){if($.post.match(/,(?!,).*\}/))return Q=$.pre+"{"+$.body+j5+$.post,FQ(Q,X,!0);return[Q]}let H;if(Y)H=$.body.split(/\.\./);else if(H=l5($.body),H.length===1&&H[0]!==void 0){if(H=FQ(H[0],X,!1).map(B7),H.length===1)return q.map((_)=>$.pre+H[0]+_)}let j;if(Y&&H[0]!==void 0&&H[1]!==void 0){let _=W5(H[0]),G=W5(H[1]),U=Math.max(H[0].length,H[1].length),w=H.length===3&&H[2]!==void 0?Math.abs(W5(H[2])):1,A=v7;if(G<_)w*=-1,A=O7;let O=H.some(L7);j=[];for(let C=_;A(C,G);C+=w){let L;if(K){if(L=String.fromCharCode(C),L==="\\")L=""}else if(L=String(C),O){let N=U-L.length;if(N>0){let x=Array(N+1).join("0");if(C<0)L="-"+x+L.slice(1);else L=x+L}}j.push(L)}}else{j=[];for(let _=0;_<H.length;_++)j.push.apply(j,FQ(H[_],X,!1))}for(let _=0;_<j.length;_++)for(let G=0;G<q.length&&V.length<X;G++){let U=J+j[_]+q[G];if(!Z||Y||U)V.push(U)}}return V}var MQ=(Q)=>{if(typeof Q!=="string")throw TypeError("invalid pattern");if(Q.length>65536)throw TypeError("pattern is too long")};var C7={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},RQ=(Q)=>Q.replace(/[[\]\\-]/g,"\\$&"),F7=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i5=(Q)=>Q.join(""),o5=(Q,X)=>{let Z=X;if(Q.charAt(Z)!=="[")throw Error("not in a brace expression");let V=[],$=[],J=Z+1,q=!1,z=!1,K=!1,Y=!1,W=Z,H="";Q:while(J<Q.length){let U=Q.charAt(J);if((U==="!"||U==="^")&&J===Z+1){Y=!0,J++;continue}if(U==="]"&&q&&!K){W=J+1;break}if(q=!0,U==="\\"){if(!K){K=!0,J++;continue}}if(U==="["&&!K){for(let[w,[A,B,O]]of Object.entries(C7))if(Q.startsWith(w,J)){if(H)return["$.",!1,Q.length-Z,!0];if(J+=w.length,O)$.push(A);else V.push(A);z=z||B;continue Q}}if(K=!1,H){if(U>H)V.push(RQ(H)+"-"+RQ(U));else if(U===H)V.push(RQ(U));H="",J++;continue}if(Q.startsWith("-]",J+1)){V.push(RQ(U+"-")),J+=2;continue}if(Q.startsWith("-",J+1)){H=U,J+=2;continue}V.push(RQ(U)),J++}if(W<J)return["",!1,0,!1];if(!V.length&&!$.length)return["$.",!1,Q.length-Z,!0];if($.length===0&&V.length===1&&/^\\?.$/.test(V[0])&&!Y){let U=V[0].length===2?V[0].slice(-1):V[0];return[F7(U),!1,W-Z,!1]}let j="["+(Y?"^":"")+i5(V)+"]",_="["+(Y?"":"^")+i5($)+"]";return[V.length&&$.length?"("+j+"|"+_+")":V.length?j:_,z,W-Z,!0]};var n=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!0}={})=>{if(Z)return X?Q.replace(/\[([^\/\\])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");return X?Q.replace(/\[([^\/\\{}])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")};var y,M7=new Set(["!","?","+","*","@"]),_5=(Q)=>M7.has(Q),n5=(Q)=>_5(Q.type),R7=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),k7=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),I7=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),a5=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),N7="(?!(?:^|/)\\.\\.?(?:$|/))",gQ="(?!\\.)",x7=new Set(["[","."]),P7=new Set(["..","."]),D7=new Set("().*{}+?[]^$\\!"),S7=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),G5="[^/]",r5=G5+"*?",s5=G5+"+?",T7=0;class AQ{type;#Q;#V;#$=!1;#X=[];#q;#F;#B;#W=!1;#z;#j;#H=!1;id=++T7;get depth(){return(this.#q?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#Q.id,parent:this.#q?.id,depth:this.depth,partsLength:this.#X.length,parts:this.#X}}constructor(Q,X,Z={}){if(this.type=Q,Q)this.#V=!0;if(this.#q=X,this.#Q=this.#q?this.#q.#Q:this,this.#z=this.#Q===this?Z:this.#Q.#z,this.#B=this.#Q===this?[]:this.#Q.#B,Q==="!"&&!this.#Q.#W)this.#B.push(this);this.#F=this.#q?this.#q.#X.length:0}get hasMagic(){if(this.#V!==void 0)return this.#V;for(let Q of this.#X){if(typeof Q==="string")continue;if(Q.type||Q.hasMagic)return this.#V=!0}return this.#V}toString(){if(this.#j!==void 0)return this.#j;if(!this.type)return this.#j=this.#X.map((Q)=>String(Q)).join("");else return this.#j=this.type+"("+this.#X.map((Q)=>String(Q)).join("|")+")"}#K(){if(this!==this.#Q)throw Error("should only call on root");if(this.#W)return this;this.toString(),this.#W=!0;let Q;while(Q=this.#B.pop()){if(Q.type!=="!")continue;let X=Q,Z=X.#q;while(Z){for(let V=X.#F+1;!Z.type&&V<Z.#X.length;V++)for(let $ of Q.#X){if(typeof $==="string")throw Error("string part in extglob AST??");$.copyIn(Z.#X[V])}X=Z,Z=X.#q}}return this}push(...Q){for(let X of Q){if(X==="")continue;if(typeof X!=="string"&&!(X instanceof y&&X.#q===this))throw Error("invalid part: "+X);this.#X.push(X)}}toJSON(){let Q=this.type===null?this.#X.slice().map((X)=>typeof X==="string"?X:X.toJSON()):[this.type,...this.#X.map((X)=>X.toJSON())];if(this.isStart()&&!this.type)Q.unshift([]);if(this.isEnd()&&(this===this.#Q||this.#Q.#W&&this.#q?.type==="!"))Q.push({});return Q}isStart(){if(this.#Q===this)return!0;if(!this.#q?.isStart())return!1;if(this.#F===0)return!0;let Q=this.#q;for(let X=0;X<this.#F;X++){let Z=Q.#X[X];if(!(Z instanceof y&&Z.type==="!"))return!1}return!0}isEnd(){if(this.#Q===this)return!0;if(this.#q?.type==="!")return!0;if(!this.#q?.isEnd())return!1;if(!this.type)return this.#q?.isEnd();let Q=this.#q?this.#q.#X.length:0;return this.#F===Q-1}copyIn(Q){if(typeof Q==="string")this.push(Q);else this.push(Q.clone(this))}clone(Q){let X=new y(this.type,Q);for(let Z of this.#X)X.copyIn(Z);return X}static#J(Q,X,Z,V,$){let J=V.maxExtglobRecursion??2,q=!1,z=!1,K=-1,Y=!1;if(X.type===null){let G=Z,U="";while(G<Q.length){let w=Q.charAt(G++);if(q||w==="\\"){q=!q,U+=w;continue}if(z){if(G===K+1){if(w==="^"||w==="!")Y=!0}else if(w==="]"&&!(G===K+2&&Y))z=!1;U+=w;continue}else if(w==="["){z=!0,K=G,Y=!1,U+=w;continue}if(!V.noext&&_5(w)&&Q.charAt(G)==="("&&$<=J){X.push(U),U="";let B=new y(w,X);G=y.#J(Q,B,G,V,$+1),X.push(B);continue}U+=w}return X.push(U),G}let W=Z+1,H=new y(null,X),j=[],_="";while(W<Q.length){let G=Q.charAt(W++);if(q||G==="\\"){q=!q,_+=G;continue}if(z){if(W===K+1){if(G==="^"||G==="!")Y=!0}else if(G==="]"&&!(W===K+2&&Y))z=!1;_+=G;continue}else if(G==="["){z=!0,K=W,Y=!1,_+=G;continue}if(!V.noext&&_5(G)&&Q.charAt(W)==="("&&($<=J||X&&X.#G(G))){let w=X&&X.#G(G)?0:1;H.push(_),_="";let A=new y(G,H);H.push(A),W=y.#J(Q,A,W,V,$+w);continue}if(G==="|"){H.push(_),_="",j.push(H),H=new y(null,X);continue}if(G===")"){if(_===""&&X.#X.length===0)X.#H=!0;return H.push(_),_="",X.push(...j,H),W}_+=G}return X.type=null,X.#V=void 0,X.#X=[Q.substring(Z-1)],W}#L(Q){return this.#O(Q,k7)}#O(Q,X=R7){if(!Q||typeof Q!=="object"||Q.type!==null||Q.#X.length!==1||this.type===null)return!1;let Z=Q.#X[0];if(!Z||typeof Z!=="object"||Z.type===null)return!1;return this.#G(Z.type,X)}#G(Q,X=I7){return!!X.get(this.type)?.includes(Q)}#U(Q,X){let Z=Q.#X[0],V=new y(null,Z,this.options);V.#X.push(""),Z.push(V),this.#k(Q,X)}#k(Q,X){let Z=Q.#X[0];this.#X.splice(X,1,...Z.#X);for(let V of Z.#X)if(typeof V==="object")V.#q=this;this.#j=void 0}#A(Q){return!!a5.get(this.type)?.has(Q)}#C(Q){if(!Q||typeof Q!=="object"||Q.type!==null||Q.#X.length!==1||this.type===null||this.#X.length!==1)return!1;let X=Q.#X[0];if(!X||typeof X!=="object"||X.type===null)return!1;return this.#A(X.type)}#M(Q){let X=a5.get(this.type),Z=Q.#X[0],V=X?.get(Z.type);if(!V)return!1;this.#X=Z.#X;for(let $ of this.#X)if(typeof $==="object")$.#q=this;this.type=V,this.#j=void 0,this.#H=!1}static fromGlob(Q,X={}){let Z=new y(null,void 0,X);return y.#J(Q,Z,0,X,0),Z}toMMPattern(){if(this!==this.#Q)return this.#Q.toMMPattern();let Q=this.toString(),[X,Z,V,$]=this.toRegExpSource();if(!(V||this.#V||this.#z.nocase&&!this.#z.nocaseMagicOnly&&Q.toUpperCase()!==Q.toLowerCase()))return Z;let q=(this.#z.nocase?"i":"")+($?"u":"");return Object.assign(new RegExp(`^${X}$`,q),{_src:X,_glob:Q})}get options(){return this.#z}toRegExpSource(Q){let X=Q??!!this.#z.dot;if(this.#Q===this)this.#_(),this.#K();if(!n5(this)){let z=this.isStart()&&this.isEnd()&&!this.#X.some((j)=>typeof j!=="string"),K=this.#X.map((j)=>{let[_,G,U,w]=typeof j==="string"?y.#v(j,this.#V,z):j.toRegExpSource(Q);return this.#V=this.#V||U,this.#$=this.#$||w,_}).join(""),Y="";if(this.isStart()){if(typeof this.#X[0]==="string"){if(!(this.#X.length===1&&P7.has(this.#X[0]))){let _=x7,G=X&&_.has(K.charAt(0))||K.startsWith("\\.")&&_.has(K.charAt(2))||K.startsWith("\\.\\.")&&_.has(K.charAt(4)),U=!X&&!Q&&_.has(K.charAt(0));Y=G?N7:U?gQ:""}}}let W="";if(this.isEnd()&&this.#Q.#W&&this.#q?.type==="!")W="(?:$|\\/)";return[Y+K+W,n(K),this.#V=!!this.#V,this.#$]}let Z=this.type==="*"||this.type==="+",V=this.type==="!"?"(?:(?!(?:":"(?:",$=this.#w(X);if(this.isStart()&&this.isEnd()&&!$&&this.type!=="!"){let z=this.toString(),K=this;return K.#X=[z],K.type=null,K.#V=void 0,[z,n(this.toString()),!1,!1]}let J=!Z||Q||X||!gQ?"":this.#w(!0);if(J===$)J="";if(J)$=`(?:${$})(?:${J})*?`;let q="";if(this.type==="!"&&this.#H)q=(this.isStart()&&!X?gQ:"")+s5;else{let z=this.type==="!"?"))"+(this.isStart()&&!X&&!Q?gQ:"")+r5+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&J?")":this.type==="*"&&J?")?":`)${this.type}`;q=V+$+z}return[q,n($),this.#V=!!this.#V,this.#$]}#_(){if(!n5(this)){for(let Q of this.#X)if(typeof Q==="object")Q.#_()}else{let Q=0,X=!1;do{X=!0;for(let Z=0;Z<this.#X.length;Z++){let V=this.#X[Z];if(typeof V==="object"){if(V.#_(),this.#O(V))X=!1,this.#k(V,Z);else if(this.#L(V))X=!1,this.#U(V,Z);else if(this.#C(V))X=!1,this.#M(V)}}}while(!X&&++Q<10)}this.#j=void 0}#w(Q){return this.#X.map((X)=>{if(typeof X==="string")throw Error("string type in extglob ast??");let[Z,V,$,J]=X.toRegExpSource(Q);return this.#$=this.#$||J,Z}).filter((X)=>!(this.isStart()&&this.isEnd())||!!X).join("|")}static#v(Q,X,Z=!1){let V=!1,$="",J=!1,q=!1;for(let z=0;z<Q.length;z++){let K=Q.charAt(z);if(V){V=!1,$+=(D7.has(K)?"\\":"")+K;continue}if(K==="*"){if(q)continue;q=!0,$+=Z&&/^[*]+$/.test(Q)?s5:r5,X=!0;continue}else q=!1;if(K==="\\"){if(z===Q.length-1)$+="\\\\";else V=!0;continue}if(K==="["){let[Y,W,H,j]=o5(Q,z);if(H){$+=Y,J=J||W,z+=H-1,X=X||j;continue}}if(K==="?"){$+=G5,X=!0;continue}$+=S7(K)}return[$,n(Q),!!X,J]}}y=AQ;var wQ=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!1}={})=>{if(Z)return X?Q.replace(/[?*()[\]{}]/g,"[$&]"):Q.replace(/[?*()[\]\\{}]/g,"\\$&");return X?Q.replace(/[?*()[\]]/g,"[$&]"):Q.replace(/[?*()[\]\\]/g,"\\$&")};var T=(Q,X,Z={})=>{if(MQ(X),!Z.nocomment&&X.charAt(0)==="#")return!1;return new m(X,Z).match(Q)},E7=/^\*+([^+@!?\*\[\(]*)$/,b7=(Q)=>(X)=>!X.startsWith(".")&&X.endsWith(Q),y7=(Q)=>(X)=>X.endsWith(Q),u7=(Q)=>{return Q=Q.toLowerCase(),(X)=>!X.startsWith(".")&&X.toLowerCase().endsWith(Q)},f7=(Q)=>{return Q=Q.toLowerCase(),(X)=>X.toLowerCase().endsWith(Q)},h7=/^\*+\.\*+$/,m7=(Q)=>!Q.startsWith(".")&&Q.includes("."),g7=(Q)=>Q!=="."&&Q!==".."&&Q.includes("."),d7=/^\.\*+$/,c7=(Q)=>Q!=="."&&Q!==".."&&Q.startsWith("."),l7=/^\*+$/,p7=(Q)=>Q.length!==0&&!Q.startsWith("."),i7=(Q)=>Q.length!==0&&Q!=="."&&Q!=="..",o7=/^\?+([^+@!?\*\[\(]*)?$/,n7=([Q,X=""])=>{let Z=Q6([Q]);if(!X)return Z;return X=X.toLowerCase(),(V)=>Z(V)&&V.toLowerCase().endsWith(X)},a7=([Q,X=""])=>{let Z=X6([Q]);if(!X)return Z;return X=X.toLowerCase(),(V)=>Z(V)&&V.toLowerCase().endsWith(X)},r7=([Q,X=""])=>{let Z=X6([Q]);return!X?Z:(V)=>Z(V)&&V.endsWith(X)},s7=([Q,X=""])=>{let Z=Q6([Q]);return!X?Z:(V)=>Z(V)&&V.endsWith(X)},Q6=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&!Z.startsWith(".")},X6=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&Z!=="."&&Z!==".."},Z6=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",e5={win32:{sep:"\\"},posix:{sep:"/"}},e7=Z6==="win32"?e5.win32.sep:e5.posix.sep;T.sep=e7;var F=Symbol("globstar **");T.GLOBSTAR=F;var t7="[^/]",Q8=t7+"*?",X8="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Z8="(?:(?!(?:\\/|^)\\.).)*?",V8=(Q,X={})=>(Z)=>T(Z,Q,X);T.filter=V8;var h=(Q,X={})=>Object.assign({},Q,X),$8=(Q)=>{if(!Q||typeof Q!=="object"||!Object.keys(Q).length)return T;let X=T;return Object.assign((V,$,J={})=>X(V,$,h(Q,J)),{Minimatch:class extends X.Minimatch{constructor($,J={}){super($,h(Q,J))}static defaults($){return X.defaults(h(Q,$)).Minimatch}},AST:class extends X.AST{constructor($,J,q={}){super($,J,h(Q,q))}static fromGlob($,J={}){return X.AST.fromGlob($,h(Q,J))}},unescape:(V,$={})=>X.unescape(V,h(Q,$)),escape:(V,$={})=>X.escape(V,h(Q,$)),filter:(V,$={})=>X.filter(V,h(Q,$)),defaults:(V)=>X.defaults(h(Q,V)),makeRe:(V,$={})=>X.makeRe(V,h(Q,$)),braceExpand:(V,$={})=>X.braceExpand(V,h(Q,$)),match:(V,$,J={})=>X.match(V,$,h(Q,J)),sep:X.sep,GLOBSTAR:F})};T.defaults=$8;var V6=(Q,X={})=>{if(MQ(Q),X.nobrace||!/\{(?:(?!\{).)*\}/.test(Q))return[Q];return p5(Q,{max:X.braceExpandMax})};T.braceExpand=V6;var J8=(Q,X={})=>new m(Q,X).makeRe();T.makeRe=J8;var q8=(Q,X,Z={})=>{let V=new m(X,Z);if(Q=Q.filter(($)=>V.match($)),V.options.nonull&&!Q.length)Q.push(X);return Q};T.match=q8;var t5=/[?*]|[+@!]\(.*?\)|\[|\]/,z8=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class m{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(Q,X={}){MQ(Q),X=X||{},this.options=X,this.maxGlobstarRecursion=X.maxGlobstarRecursion??200,this.pattern=Q,this.platform=X.platform||Z6,this.isWindows=this.platform==="win32";let Z="allowWindowsEscape";if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X[Z]===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!X.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!X.nonegate,this.comment=!1,this.empty=!1,this.partial=!!X.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=X.windowsNoMagicRoot!==void 0?X.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let Q of this.set)for(let X of Q)if(typeof X!=="string")return!0;return!1}debug(...Q){}make(){let Q=this.pattern,X=this.options;if(!X.nocomment&&Q.charAt(0)==="#"){this.comment=!0;return}if(!Q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],X.debug)this.debug=(...$)=>console.error(...$);this.debug(this.pattern,this.globSet);let Z=this.globSet.map(($)=>this.slashSplit($));this.globParts=this.preprocess(Z),this.debug(this.pattern,this.globParts);let V=this.globParts.map(($,J,q)=>{if(this.isWindows&&this.windowsNoMagicRoot){let z=$[0]===""&&$[1]===""&&($[2]==="?"||!t5.test($[2]))&&!t5.test($[3]),K=/^[a-z]:/i.test($[0]);if(z)return[...$.slice(0,4),...$.slice(4).map((Y)=>this.parse(Y))];else if(K)return[$[0],...$.slice(1).map((Y)=>this.parse(Y))]}return $.map((z)=>this.parse(z))});if(this.debug(this.pattern,V),this.set=V.filter(($)=>$.indexOf(!1)===-1),this.isWindows)for(let $=0;$<this.set.length;$++){let J=this.set[$];if(J[0]===""&&J[1]===""&&this.globParts[$][2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]))J[2]="?"}this.debug(this.pattern,this.set)}preprocess(Q){if(this.options.noglobstar){for(let Z=0;Z<Q.length;Z++)for(let V=0;V<Q[Z].length;V++)if(Q[Z][V]==="**")Q[Z][V]="*"}let{optimizationLevel:X=1}=this.options;if(X>=2)Q=this.firstPhasePreProcess(Q),Q=this.secondPhasePreProcess(Q);else if(X>=1)Q=this.levelOneOptimize(Q);else Q=this.adjascentGlobstarOptimize(Q);return Q}adjascentGlobstarOptimize(Q){return Q.map((X)=>{let Z=-1;while((Z=X.indexOf("**",Z+1))!==-1){let V=Z;while(X[V+1]==="**")V++;if(V!==Z)X.splice(Z,V-Z)}return X})}levelOneOptimize(Q){return Q.map((X)=>{return X=X.reduce((Z,V)=>{let $=Z[Z.length-1];if(V==="**"&&$==="**")return Z;if(V===".."){if($&&$!==".."&&$!=="."&&$!=="**")return Z.pop(),Z}return Z.push(V),Z},[]),X.length===0?[""]:X})}levelTwoFileOptimize(Q){if(!Array.isArray(Q))Q=this.slashSplit(Q);let X=!1;do{if(X=!1,!this.preserveMultipleSlashes){for(let V=1;V<Q.length-1;V++){let $=Q[V];if(V===1&&$===""&&Q[0]==="")continue;if($==="."||$==="")X=!0,Q.splice(V,1),V--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))X=!0,Q.pop()}let Z=0;while((Z=Q.indexOf("..",Z+1))!==-1){let V=Q[Z-1];if(V&&V!=="."&&V!==".."&&V!=="**")X=!0,Q.splice(Z-1,2),Z-=2}}while(X);return Q.length===0?[""]:Q}firstPhasePreProcess(Q){let X=!1;do{X=!1;for(let Z of Q){let V=-1;while((V=Z.indexOf("**",V+1))!==-1){let J=V;while(Z[J+1]==="**")J++;if(J>V)Z.splice(V+1,J-V);let q=Z[V+1],z=Z[V+2],K=Z[V+3];if(q!=="..")continue;if(!z||z==="."||z===".."||!K||K==="."||K==="..")continue;X=!0,Z.splice(V,1);let Y=Z.slice(0);Y[V]="**",Q.push(Y),V--}if(!this.preserveMultipleSlashes){for(let J=1;J<Z.length-1;J++){let q=Z[J];if(J===1&&q===""&&Z[0]==="")continue;if(q==="."||q==="")X=!0,Z.splice(J,1),J--}if(Z[0]==="."&&Z.length===2&&(Z[1]==="."||Z[1]===""))X=!0,Z.pop()}let $=0;while(($=Z.indexOf("..",$+1))!==-1){let J=Z[$-1];if(J&&J!=="."&&J!==".."&&J!=="**"){X=!0;let z=$===1&&Z[$+1]==="**"?["."]:[];if(Z.splice($-1,2,...z),Z.length===0)Z.push("");$-=2}}}}while(X);return Q}secondPhasePreProcess(Q){for(let X=0;X<Q.length-1;X++)for(let Z=X+1;Z<Q.length;Z++){let V=this.partsMatch(Q[X],Q[Z],!this.preserveMultipleSlashes);if(V){Q[X]=[],Q[Z]=V;break}}return Q.filter((X)=>X.length)}partsMatch(Q,X,Z=!1){let V=0,$=0,J=[],q="";while(V<Q.length&&$<X.length)if(Q[V]===X[$])J.push(q==="b"?X[$]:Q[V]),V++,$++;else if(Z&&Q[V]==="**"&&X[$]===Q[V+1])J.push(Q[V]),V++;else if(Z&&X[$]==="**"&&Q[V]===X[$+1])J.push(X[$]),$++;else if(Q[V]==="*"&&X[$]&&(this.options.dot||!X[$].startsWith("."))&&X[$]!=="**"){if(q==="b")return!1;q="a",J.push(Q[V]),V++,$++}else if(X[$]==="*"&&Q[V]&&(this.options.dot||!Q[V].startsWith("."))&&Q[V]!=="**"){if(q==="a")return!1;q="b",J.push(X[$]),V++,$++}else return!1;return Q.length===X.length&&J}parseNegate(){if(this.nonegate)return;let Q=this.pattern,X=!1,Z=0;for(let V=0;V<Q.length&&Q.charAt(V)==="!";V++)X=!X,Z++;if(Z)this.pattern=Q.slice(Z);this.negate=X}matchOne(Q,X,Z=!1){let V=0,$=0;if(this.isWindows){let q=typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0]),z=!q&&Q[0]===""&&Q[1]===""&&Q[2]==="?"&&/^[a-z]:$/i.test(Q[3]),K=typeof X[0]==="string"&&/^[a-z]:$/i.test(X[0]),Y=!K&&X[0]===""&&X[1]===""&&X[2]==="?"&&typeof X[3]==="string"&&/^[a-z]:$/i.test(X[3]),W=z?3:q?0:void 0,H=Y?3:K?0:void 0;if(typeof W==="number"&&typeof H==="number"){let[j,_]=[Q[W],X[H]];if(j.toLowerCase()===_.toLowerCase())X[H]=j,$=H,V=W}}let{optimizationLevel:J=1}=this.options;if(J>=2)Q=this.levelTwoFileOptimize(Q);if(X.includes(F))return this.#Q(Q,X,Z,V,$);return this.#$(Q,X,Z,V,$)}#Q(Q,X,Z,V,$){let J=X.indexOf(F,$),q=X.lastIndexOf(F),[z,K,Y]=Z?[X.slice($,J),X.slice(J+1),[]]:[X.slice($,J),X.slice(J+1,q),X.slice(q+1)];if(z.length){let A=Q.slice(V,V+z.length);if(!this.#$(A,z,Z,0,0))return!1;V+=z.length,$+=z.length}let W=0;if(Y.length){if(Y.length+V>Q.length)return!1;let A=Q.length-Y.length;if(this.#$(Q,Y,Z,A,0))W=Y.length;else{if(Q[Q.length-1]!==""||V+Y.length===Q.length)return!1;if(A--,!this.#$(Q,Y,Z,A,0))return!1;W=Y.length+1}}if(!K.length){let A=!!W;for(let B=V;B<Q.length-W;B++){let O=String(Q[B]);if(A=!0,O==="."||O===".."||!this.options.dot&&O.startsWith("."))return!1}return Z||A}let H=[[[],0]],j=H[0],_=0,G=[0];for(let A of K)if(A===F)G.push(_),j=[[],0],H.push(j);else j[0].push(A),_++;let U=H.length-1,w=Q.length-W;for(let A of H)A[1]=w-(G[U--]+A[0].length);return!!this.#V(Q,H,V,0,Z,0,!!W)}#V(Q,X,Z,V,$,J,q){let z=X[V];if(!z){for(let W=Z;W<Q.length;W++){q=!0;let H=Q[W];if(H==="."||H===".."||!this.options.dot&&H.startsWith("."))return!1}return q}let[K,Y]=z;while(Z<=Y){if(this.#$(Q.slice(0,Z+K.length),K,$,Z,0)&&J<this.maxGlobstarRecursion){let j=this.#V(Q,X,Z+K.length,V+1,$,J+1,q);if(j!==!1)return j}let H=Q[Z];if(H==="."||H===".."||!this.options.dot&&H.startsWith("."))return!1;Z++}return $||null}#$(Q,X,Z,V,$){let J,q,z,K;for(J=V,q=$,K=Q.length,z=X.length;J<K&&q<z;J++,q++){this.debug("matchOne loop");let Y=X[q],W=Q[J];if(this.debug(X,Y,W),Y===!1||Y===F)return!1;let H;if(typeof Y==="string")H=W===Y,this.debug("string match",Y,W,H);else H=Y.test(W),this.debug("pattern match",Y,W,H);if(!H)return!1}if(J===K&&q===z)return!0;else if(J===K)return Z;else if(q===z)return J===K-1&&Q[J]==="";else throw Error("wtf?")}braceExpand(){return V6(this.pattern,this.options)}parse(Q){MQ(Q);let X=this.options;if(Q==="**")return F;if(Q==="")return"";let Z,V=null;if(Z=Q.match(l7))V=X.dot?i7:p7;else if(Z=Q.match(E7))V=(X.nocase?X.dot?f7:u7:X.dot?y7:b7)(Z[1]);else if(Z=Q.match(o7))V=(X.nocase?X.dot?a7:n7:X.dot?r7:s7)(Z);else if(Z=Q.match(h7))V=X.dot?g7:m7;else if(Z=Q.match(d7))V=c7;let $=AQ.fromGlob(Q,this.options).toMMPattern();if(V&&typeof $==="object")Reflect.defineProperty($,"test",{value:V});return $}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Q=this.set;if(!Q.length)return this.regexp=!1,this.regexp;let X=this.options,Z=X.noglobstar?Q8:X.dot?X8:Z8,V=new Set(X.nocase?["i"]:[]),$=Q.map((z)=>{let K=z.map((W)=>{if(W instanceof RegExp)for(let H of W.flags.split(""))V.add(H);return typeof W==="string"?z8(W):W===F?F:W._src});K.forEach((W,H)=>{let j=K[H+1],_=K[H-1];if(W!==F||_===F)return;if(_===void 0)if(j!==void 0&&j!==F)K[H+1]="(?:\\/|"+Z+"\\/)?"+j;else K[H]=Z;else if(j===void 0)K[H-1]=_+"(?:\\/|\\/"+Z+")?";else if(j!==F)K[H-1]=_+"(?:\\/|\\/"+Z+"\\/)"+j,K[H+1]=F});let Y=K.filter((W)=>W!==F);if(this.partial&&Y.length>=1){let W=[];for(let H=1;H<=Y.length;H++)W.push(Y.slice(0,H).join("/"));return"(?:"+W.join("|")+")"}return Y.join("/")}).join("|"),[J,q]=Q.length>1?["(?:",")"]:["",""];if($="^"+J+$+q+"$",this.partial)$="^(?:\\/|"+J+$.slice(1,-1)+q+")$";if(this.negate)$="^(?!"+$+").+$";try{this.regexp=new RegExp($,[...V].join(""))}catch(z){this.regexp=!1}return this.regexp}slashSplit(Q){if(this.preserveMultipleSlashes)return Q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Q))return["",...Q.split(/\/+/)];else return Q.split(/\/+/)}match(Q,X=this.partial){if(this.debug("match",Q,this.pattern),this.comment)return!1;if(this.empty)return Q==="";if(Q==="/"&&X)return!0;let Z=this.options;if(this.isWindows)Q=Q.split("\\").join("/");let V=this.slashSplit(Q);this.debug(this.pattern,"split",V);let $=this.set;this.debug(this.pattern,"set",$);let J=V[V.length-1];if(!J)for(let q=V.length-2;!J&&q>=0;q--)J=V[q];for(let q=0;q<$.length;q++){let z=$[q],K=V;if(Z.matchBase&&z.length===1)K=[J];if(this.matchOne(K,z,X)){if(Z.flipNegate)return!0;return!this.negate}}if(Z.flipNegate)return!1;return this.negate}static defaults(Q){return T.defaults(Q).Minimatch}}T.AST=AQ;T.Minimatch=m;T.escape=wQ;T.unescape=n;import{fileURLToPath as g8}from"url";var K8=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,J6=new Set,U5=typeof process=="object"&&process?process:{},q6=(Q,X,Z,V)=>{typeof U5.emitWarning=="function"?U5.emitWarning(Q,X,Z,V):console.error(`[${Z}] ${X}: ${Q}`)},cQ=globalThis.AbortController,$6=globalThis.AbortSignal;if(typeof cQ>"u"){$6=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(Z,V){this._onabort.push(V)}},cQ=class{constructor(){X()}signal=new $6;abort(Z){if(!this.signal.aborted){this.signal.reason=Z,this.signal.aborted=!0;for(let V of this.signal._onabort)V(Z);this.signal.onabort?.(Z)}}};let Q=U5.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",X=()=>{Q&&(Q=!1,q6("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",X))}}var Y8=(Q)=>!J6.has(Q),e9=Symbol("type"),KQ=(Q)=>Q&&Q===Math.floor(Q)&&Q>0&&isFinite(Q),z6=(Q)=>KQ(Q)?Q<=Math.pow(2,8)?Uint8Array:Q<=Math.pow(2,16)?Uint16Array:Q<=Math.pow(2,32)?Uint32Array:Q<=Number.MAX_SAFE_INTEGER?dQ:null:null,dQ=class extends Array{constructor(Q){super(Q),this.fill(0)}},H8=class Q{heap;length;static#Q=!1;static create(X){let Z=z6(X);if(!Z)return[];Q.#Q=!0;let V=new Q(X,Z);return Q.#Q=!1,V}constructor(X,Z){if(!Q.#Q)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new Z(X),this.length=0}push(X){this.heap[this.length++]=X}pop(){return this.heap[--this.length]}},kQ=class Q{#Q;#V;#$;#X;#q;#F;#B;#W;get perf(){return this.#W}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#z;#j;#H;#K;#J;#L;#O;#G;#U;#k;#A;#C;#M;#_;#w;#v;#I;#Z;#E;static unsafeExposeInternals(X){return{starts:X.#M,ttls:X.#_,autopurgeTimers:X.#w,sizes:X.#C,keyMap:X.#H,keyList:X.#K,valList:X.#J,next:X.#L,prev:X.#O,get head(){return X.#G},get tail(){return X.#U},free:X.#k,isBackgroundFetch:(Z)=>X.#Y(Z),backgroundFetch:(Z,V,$,J)=>X.#d(Z,V,$,J),moveToTail:(Z)=>X.#y(Z),indexes:(Z)=>X.#P(Z),rindexes:(Z)=>X.#D(Z),isStale:(Z)=>X.#R(Z)}}get max(){return this.#Q}get maxSize(){return this.#V}get calculatedSize(){return this.#j}get size(){return this.#z}get fetchMethod(){return this.#F}get memoMethod(){return this.#B}get dispose(){return this.#$}get onInsert(){return this.#X}get disposeAfter(){return this.#q}constructor(X){let{max:Z=0,ttl:V,ttlResolution:$=1,ttlAutopurge:J,updateAgeOnGet:q,updateAgeOnHas:z,allowStale:K,dispose:Y,onInsert:W,disposeAfter:H,noDisposeOnSet:j,noUpdateTTL:_,maxSize:G=0,maxEntrySize:U=0,sizeCalculation:w,fetchMethod:A,memoMethod:B,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:L,allowStaleOnFetchAbort:N,ignoreFetchAbort:x,perf:c}=X;if(c!==void 0&&typeof c?.now!="function")throw TypeError("perf option must have a now() method if specified");if(this.#W=c??K8,Z!==0&&!KQ(Z))throw TypeError("max option must be a nonnegative integer");let P=Z?z6(Z):Array;if(!P)throw Error("invalid max value: "+Z);if(this.#Q=Z,this.#V=G,this.maxEntrySize=U||this.#V,this.sizeCalculation=w,this.sizeCalculation){if(!this.#V&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(B!==void 0&&typeof B!="function")throw TypeError("memoMethod must be a function if defined");if(this.#B=B,A!==void 0&&typeof A!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#F=A,this.#I=!!A,this.#H=new Map,this.#K=Array(Z).fill(void 0),this.#J=Array(Z).fill(void 0),this.#L=new P(Z),this.#O=new P(Z),this.#G=0,this.#U=0,this.#k=H8.create(Z),this.#z=0,this.#j=0,typeof Y=="function"&&(this.#$=Y),typeof W=="function"&&(this.#X=W),typeof H=="function"?(this.#q=H,this.#A=[]):(this.#q=void 0,this.#A=void 0),this.#v=!!this.#$,this.#E=!!this.#X,this.#Z=!!this.#q,this.noDisposeOnSet=!!j,this.noUpdateTTL=!!_,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!L,this.allowStaleOnFetchAbort=!!N,this.ignoreFetchAbort=!!x,this.maxEntrySize!==0){if(this.#V!==0&&!KQ(this.#V))throw TypeError("maxSize must be a positive integer if specified");if(!KQ(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#l()}if(this.allowStale=!!K,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!q,this.updateAgeOnHas=!!z,this.ttlResolution=KQ($)||$===0?$:1,this.ttlAutopurge=!!J,this.ttl=V||0,this.ttl){if(!KQ(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#S()}if(this.#Q===0&&this.ttl===0&&this.#V===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Q&&!this.#V){let l="LRU_CACHE_UNBOUNDED";Y8(l)&&(J6.add(l),q6("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",l,Q))}}getRemainingTTL(X){return this.#H.has(X)?1/0:0}#S(){let X=new dQ(this.#Q),Z=new dQ(this.#Q);this.#_=X,this.#M=Z;let V=this.ttlAutopurge?Array(this.#Q):void 0;this.#w=V,this.#f=(q,z,K=this.#W.now())=>{if(Z[q]=z!==0?K:0,X[q]=z,V?.[q]&&(clearTimeout(V[q]),V[q]=void 0),z!==0&&V){let Y=setTimeout(()=>{this.#R(q)&&this.#x(this.#K[q],"expire")},z+1);Y.unref&&Y.unref(),V[q]=Y}},this.#N=(q)=>{Z[q]=X[q]!==0?this.#W.now():0},this.#T=(q,z)=>{if(X[z]){let K=X[z],Y=Z[z];if(!K||!Y)return;q.ttl=K,q.start=Y,q.now=$||J();let W=q.now-Y;q.remainingTTL=K-W}};let $=0,J=()=>{let q=this.#W.now();if(this.ttlResolution>0){$=q;let z=setTimeout(()=>$=0,this.ttlResolution);z.unref&&z.unref()}return q};this.getRemainingTTL=(q)=>{let z=this.#H.get(q);if(z===void 0)return 0;let K=X[z],Y=Z[z];if(!K||!Y)return 1/0;let W=($||J())-Y;return K-W},this.#R=(q)=>{let z=Z[q],K=X[q];return!!K&&!!z&&($||J())-z>K}}#N=()=>{};#T=()=>{};#f=()=>{};#R=()=>!1;#l(){let X=new dQ(this.#Q);this.#j=0,this.#C=X,this.#u=(Z)=>{this.#j-=X[Z],X[Z]=0},this.#h=(Z,V,$,J)=>{if(this.#Y(V))return 0;if(!KQ($))if(J){if(typeof J!="function")throw TypeError("sizeCalculation must be a function");if($=J(V,Z),!KQ($))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return $},this.#b=(Z,V,$)=>{if(X[Z]=V,this.#V){let J=this.#V-X[Z];for(;this.#j>J;)this.#g(!0)}this.#j+=X[Z],$&&($.entrySize=V,$.totalCalculatedSize=this.#j)}}#u=(X)=>{};#b=(X,Z,V)=>{};#h=(X,Z,V,$)=>{if(V||$)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#P({allowStale:X=this.allowStale}={}){if(this.#z)for(let Z=this.#U;!(!this.#m(Z)||((X||!this.#R(Z))&&(yield Z),Z===this.#G));)Z=this.#O[Z]}*#D({allowStale:X=this.allowStale}={}){if(this.#z)for(let Z=this.#G;!(!this.#m(Z)||((X||!this.#R(Z))&&(yield Z),Z===this.#U));)Z=this.#L[Z]}#m(X){return X!==void 0&&this.#H.get(this.#K[X])===X}*entries(){for(let X of this.#P())this.#J[X]!==void 0&&this.#K[X]!==void 0&&!this.#Y(this.#J[X])&&(yield[this.#K[X],this.#J[X]])}*rentries(){for(let X of this.#D())this.#J[X]!==void 0&&this.#K[X]!==void 0&&!this.#Y(this.#J[X])&&(yield[this.#K[X],this.#J[X]])}*keys(){for(let X of this.#P()){let Z=this.#K[X];Z!==void 0&&!this.#Y(this.#J[X])&&(yield Z)}}*rkeys(){for(let X of this.#D()){let Z=this.#K[X];Z!==void 0&&!this.#Y(this.#J[X])&&(yield Z)}}*values(){for(let X of this.#P())this.#J[X]!==void 0&&!this.#Y(this.#J[X])&&(yield this.#J[X])}*rvalues(){for(let X of this.#D())this.#J[X]!==void 0&&!this.#Y(this.#J[X])&&(yield this.#J[X])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(X,Z={}){for(let V of this.#P()){let $=this.#J[V],J=this.#Y($)?$.__staleWhileFetching:$;if(J!==void 0&&X(J,this.#K[V],this))return this.get(this.#K[V],Z)}}forEach(X,Z=this){for(let V of this.#P()){let $=this.#J[V],J=this.#Y($)?$.__staleWhileFetching:$;J!==void 0&&X.call(Z,J,this.#K[V],this)}}rforEach(X,Z=this){for(let V of this.#D()){let $=this.#J[V],J=this.#Y($)?$.__staleWhileFetching:$;J!==void 0&&X.call(Z,J,this.#K[V],this)}}purgeStale(){let X=!1;for(let Z of this.#D({allowStale:!0}))this.#R(Z)&&(this.#x(this.#K[Z],"expire"),X=!0);return X}info(X){let Z=this.#H.get(X);if(Z===void 0)return;let V=this.#J[Z],$=this.#Y(V)?V.__staleWhileFetching:V;if($===void 0)return;let J={value:$};if(this.#_&&this.#M){let q=this.#_[Z],z=this.#M[Z];if(q&&z){let K=q-(this.#W.now()-z);J.ttl=K,J.start=Date.now()}}return this.#C&&(J.size=this.#C[Z]),J}dump(){let X=[];for(let Z of this.#P({allowStale:!0})){let V=this.#K[Z],$=this.#J[Z],J=this.#Y($)?$.__staleWhileFetching:$;if(J===void 0||V===void 0)continue;let q={value:J};if(this.#_&&this.#M){q.ttl=this.#_[Z];let z=this.#W.now()-this.#M[Z];q.start=Math.floor(Date.now()-z)}this.#C&&(q.size=this.#C[Z]),X.unshift([V,q])}return X}load(X){this.clear();for(let[Z,V]of X){if(V.start){let $=Date.now()-V.start;V.start=this.#W.now()-$}this.set(Z,V.value,V)}}set(X,Z,V={}){if(Z===void 0)return this.delete(X),this;let{ttl:$=this.ttl,start:J,noDisposeOnSet:q=this.noDisposeOnSet,sizeCalculation:z=this.sizeCalculation,status:K}=V,{noUpdateTTL:Y=this.noUpdateTTL}=V,W=this.#h(X,Z,V.size||0,z);if(this.maxEntrySize&&W>this.maxEntrySize)return K&&(K.set="miss",K.maxEntrySizeExceeded=!0),this.#x(X,"set"),this;let H=this.#z===0?void 0:this.#H.get(X);if(H===void 0)H=this.#z===0?this.#U:this.#k.length!==0?this.#k.pop():this.#z===this.#Q?this.#g(!1):this.#z,this.#K[H]=X,this.#J[H]=Z,this.#H.set(X,H),this.#L[this.#U]=H,this.#O[H]=this.#U,this.#U=H,this.#z++,this.#b(H,W,K),K&&(K.set="add"),Y=!1,this.#E&&this.#X?.(Z,X,"add");else{this.#y(H);let j=this.#J[H];if(Z!==j){if(this.#I&&this.#Y(j)){j.__abortController.abort(Error("replaced"));let{__staleWhileFetching:_}=j;_!==void 0&&!q&&(this.#v&&this.#$?.(_,X,"set"),this.#Z&&this.#A?.push([_,X,"set"]))}else q||(this.#v&&this.#$?.(j,X,"set"),this.#Z&&this.#A?.push([j,X,"set"]));if(this.#u(H),this.#b(H,W,K),this.#J[H]=Z,K){K.set="replace";let _=j&&this.#Y(j)?j.__staleWhileFetching:j;_!==void 0&&(K.oldValue=_)}}else K&&(K.set="update");this.#E&&this.onInsert?.(Z,X,Z===j?"update":"replace")}if($!==0&&!this.#_&&this.#S(),this.#_&&(Y||this.#f(H,$,J),K&&this.#T(K,H)),!q&&this.#Z&&this.#A){let j=this.#A,_;for(;_=j?.shift();)this.#q?.(..._)}return this}pop(){try{for(;this.#z;){let X=this.#J[this.#G];if(this.#g(!0),this.#Y(X)){if(X.__staleWhileFetching)return X.__staleWhileFetching}else if(X!==void 0)return X}}finally{if(this.#Z&&this.#A){let X=this.#A,Z;for(;Z=X?.shift();)this.#q?.(...Z)}}}#g(X){let Z=this.#G,V=this.#K[Z],$=this.#J[Z];return this.#I&&this.#Y($)?$.__abortController.abort(Error("evicted")):(this.#v||this.#Z)&&(this.#v&&this.#$?.($,V,"evict"),this.#Z&&this.#A?.push([$,V,"evict"])),this.#u(Z),this.#w?.[Z]&&(clearTimeout(this.#w[Z]),this.#w[Z]=void 0),X&&(this.#K[Z]=void 0,this.#J[Z]=void 0,this.#k.push(Z)),this.#z===1?(this.#G=this.#U=0,this.#k.length=0):this.#G=this.#L[Z],this.#H.delete(V),this.#z--,Z}has(X,Z={}){let{updateAgeOnHas:V=this.updateAgeOnHas,status:$}=Z,J=this.#H.get(X);if(J!==void 0){let q=this.#J[J];if(this.#Y(q)&&q.__staleWhileFetching===void 0)return!1;if(this.#R(J))$&&($.has="stale",this.#T($,J));else return V&&this.#N(J),$&&($.has="hit",this.#T($,J)),!0}else $&&($.has="miss");return!1}peek(X,Z={}){let{allowStale:V=this.allowStale}=Z,$=this.#H.get(X);if($===void 0||!V&&this.#R($))return;let J=this.#J[$];return this.#Y(J)?J.__staleWhileFetching:J}#d(X,Z,V,$){let J=Z===void 0?void 0:this.#J[Z];if(this.#Y(J))return J;let q=new cQ,{signal:z}=V;z?.addEventListener("abort",()=>q.abort(z.reason),{signal:q.signal});let K={signal:q.signal,options:V,context:$},Y=(U,w=!1)=>{let{aborted:A}=q.signal,B=V.ignoreFetchAbort&&U!==void 0,O=V.ignoreFetchAbort||!!(V.allowStaleOnFetchAbort&&U!==void 0);if(V.status&&(A&&!w?(V.status.fetchAborted=!0,V.status.fetchError=q.signal.reason,B&&(V.status.fetchAbortIgnored=!0)):V.status.fetchResolved=!0),A&&!B&&!w)return H(q.signal.reason,O);let C=_,L=this.#J[Z];return(L===_||B&&w&&L===void 0)&&(U===void 0?C.__staleWhileFetching!==void 0?this.#J[Z]=C.__staleWhileFetching:this.#x(X,"fetch"):(V.status&&(V.status.fetchUpdated=!0),this.set(X,U,K.options))),U},W=(U)=>(V.status&&(V.status.fetchRejected=!0,V.status.fetchError=U),H(U,!1)),H=(U,w)=>{let{aborted:A}=q.signal,B=A&&V.allowStaleOnFetchAbort,O=B||V.allowStaleOnFetchRejection,C=O||V.noDeleteOnFetchRejection,L=_;if(this.#J[Z]===_&&(!C||!w&&L.__staleWhileFetching===void 0?this.#x(X,"fetch"):B||(this.#J[Z]=L.__staleWhileFetching)),O)return V.status&&L.__staleWhileFetching!==void 0&&(V.status.returnedStale=!0),L.__staleWhileFetching;if(L.__returned===L)throw U},j=(U,w)=>{let A=this.#F?.(X,J,K);A&&A instanceof Promise&&A.then((B)=>U(B===void 0?void 0:B),w),q.signal.addEventListener("abort",()=>{(!V.ignoreFetchAbort||V.allowStaleOnFetchAbort)&&(U(void 0),V.allowStaleOnFetchAbort&&(U=(B)=>Y(B,!0)))})};V.status&&(V.status.fetchDispatched=!0);let _=new Promise(j).then(Y,W),G=Object.assign(_,{__abortController:q,__staleWhileFetching:J,__returned:void 0});return Z===void 0?(this.set(X,G,{...K.options,status:void 0}),Z=this.#H.get(X)):this.#J[Z]=G,G}#Y(X){if(!this.#I)return!1;let Z=X;return!!Z&&Z instanceof Promise&&Z.hasOwnProperty("__staleWhileFetching")&&Z.__abortController instanceof cQ}async fetch(X,Z={}){let{allowStale:V=this.allowStale,updateAgeOnGet:$=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,ttl:q=this.ttl,noDisposeOnSet:z=this.noDisposeOnSet,size:K=0,sizeCalculation:Y=this.sizeCalculation,noUpdateTTL:W=this.noUpdateTTL,noDeleteOnFetchRejection:H=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:j=this.allowStaleOnFetchRejection,ignoreFetchAbort:_=this.ignoreFetchAbort,allowStaleOnFetchAbort:G=this.allowStaleOnFetchAbort,context:U,forceRefresh:w=!1,status:A,signal:B}=Z;if(!this.#I)return A&&(A.fetch="get"),this.get(X,{allowStale:V,updateAgeOnGet:$,noDeleteOnStaleGet:J,status:A});let O={allowStale:V,updateAgeOnGet:$,noDeleteOnStaleGet:J,ttl:q,noDisposeOnSet:z,size:K,sizeCalculation:Y,noUpdateTTL:W,noDeleteOnFetchRejection:H,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:G,ignoreFetchAbort:_,status:A,signal:B},C=this.#H.get(X);if(C===void 0){A&&(A.fetch="miss");let L=this.#d(X,C,O,U);return L.__returned=L}else{let L=this.#J[C];if(this.#Y(L)){let P=V&&L.__staleWhileFetching!==void 0;return A&&(A.fetch="inflight",P&&(A.returnedStale=!0)),P?L.__staleWhileFetching:L.__returned=L}let N=this.#R(C);if(!w&&!N)return A&&(A.fetch="hit"),this.#y(C),$&&this.#N(C),A&&this.#T(A,C),L;let x=this.#d(X,C,O,U),c=x.__staleWhileFetching!==void 0&&V;return A&&(A.fetch=N?"stale":"refresh",c&&N&&(A.returnedStale=!0)),c?x.__staleWhileFetching:x.__returned=x}}async forceFetch(X,Z={}){let V=await this.fetch(X,Z);if(V===void 0)throw Error("fetch() returned undefined");return V}memo(X,Z={}){let V=this.#B;if(!V)throw Error("no memoMethod provided to constructor");let{context:$,forceRefresh:J,...q}=Z,z=this.get(X,q);if(!J&&z!==void 0)return z;let K=V(X,z,{options:q,context:$});return this.set(X,K,q),K}get(X,Z={}){let{allowStale:V=this.allowStale,updateAgeOnGet:$=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,status:q}=Z,z=this.#H.get(X);if(z!==void 0){let K=this.#J[z],Y=this.#Y(K);return q&&this.#T(q,z),this.#R(z)?(q&&(q.get="stale"),Y?(q&&V&&K.__staleWhileFetching!==void 0&&(q.returnedStale=!0),V?K.__staleWhileFetching:void 0):(J||this.#x(X,"expire"),q&&V&&(q.returnedStale=!0),V?K:void 0)):(q&&(q.get="hit"),Y?K.__staleWhileFetching:(this.#y(z),$&&this.#N(z),K))}else q&&(q.get="miss")}#c(X,Z){this.#O[Z]=X,this.#L[X]=Z}#y(X){X!==this.#U&&(X===this.#G?this.#G=this.#L[X]:this.#c(this.#O[X],this.#L[X]),this.#c(this.#U,X),this.#U=X)}delete(X){return this.#x(X,"delete")}#x(X,Z){let V=!1;if(this.#z!==0){let $=this.#H.get(X);if($!==void 0)if(this.#w?.[$]&&(clearTimeout(this.#w?.[$]),this.#w[$]=void 0),V=!0,this.#z===1)this.#p(Z);else{this.#u($);let J=this.#J[$];if(this.#Y(J)?J.__abortController.abort(Error("deleted")):(this.#v||this.#Z)&&(this.#v&&this.#$?.(J,X,Z),this.#Z&&this.#A?.push([J,X,Z])),this.#H.delete(X),this.#K[$]=void 0,this.#J[$]=void 0,$===this.#U)this.#U=this.#O[$];else if($===this.#G)this.#G=this.#L[$];else{let q=this.#O[$];this.#L[q]=this.#L[$];let z=this.#L[$];this.#O[z]=this.#O[$]}this.#z--,this.#k.push($)}}if(this.#Z&&this.#A?.length){let $=this.#A,J;for(;J=$?.shift();)this.#q?.(...J)}return V}clear(){return this.#p("delete")}#p(X){for(let Z of this.#D({allowStale:!0})){let V=this.#J[Z];if(this.#Y(V))V.__abortController.abort(Error("deleted"));else{let $=this.#K[Z];this.#v&&this.#$?.(V,$,X),this.#Z&&this.#A?.push([V,$,X])}}if(this.#H.clear(),this.#J.fill(void 0),this.#K.fill(void 0),this.#_&&this.#M){this.#_.fill(0),this.#M.fill(0);for(let Z of this.#w??[])Z!==void 0&&clearTimeout(Z);this.#w?.fill(void 0)}if(this.#C&&this.#C.fill(0),this.#G=0,this.#U=0,this.#k.length=0,this.#j=0,this.#z=0,this.#Z&&this.#A){let Z=this.#A,V;for(;V=Z?.shift();)this.#q?.(...V)}}};import{posix as O8,win32 as R5}from"path";import{fileURLToPath as C8}from"url";import{lstatSync as F8,readdir as M8,readdirSync as R8,readlinkSync as k8,realpathSync as I8}from"fs";import*as N8 from"fs";import{lstat as P8,readdir as D8,readlink as S8,realpath as T8}from"fs/promises";import{EventEmitter as O5}from"events";import j6 from"stream";import{StringDecoder as W8}from"string_decoder";var K6=typeof process==="object"&&process?process:{stdout:null,stderr:null},j8=(Q)=>!!Q&&typeof Q==="object"&&(Q instanceof jQ||Q instanceof j6||_8(Q)||G8(Q)),_8=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof O5&&typeof Q.pipe==="function"&&Q.pipe!==j6.Writable.prototype.pipe,G8=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof O5&&typeof Q.write==="function"&&typeof Q.end==="function",JQ=Symbol("EOF"),qQ=Symbol("maybeEmitEnd"),YQ=Symbol("emittedEnd"),lQ=Symbol("emittingEnd"),IQ=Symbol("emittedError"),pQ=Symbol("closed"),Y6=Symbol("read"),iQ=Symbol("flush"),H6=Symbol("flushChunk"),a=Symbol("encoding"),BQ=Symbol("decoder"),R=Symbol("flowing"),NQ=Symbol("paused"),LQ=Symbol("resume"),k=Symbol("buffer"),E=Symbol("pipes"),I=Symbol("bufferLength"),A5=Symbol("bufferPush"),oQ=Symbol("bufferShift"),S=Symbol("objectMode"),M=Symbol("destroyed"),w5=Symbol("error"),B5=Symbol("emitData"),W6=Symbol("emitEnd"),L5=Symbol("emitEnd2"),e=Symbol("async"),v5=Symbol("abort"),nQ=Symbol("aborted"),xQ=Symbol("signal"),WQ=Symbol("dataListeners"),u=Symbol("discarded"),PQ=(Q)=>Promise.resolve().then(Q),U8=(Q)=>Q(),A8=(Q)=>Q==="end"||Q==="finish"||Q==="prefinish",w8=(Q)=>Q instanceof ArrayBuffer||!!Q&&typeof Q==="object"&&Q.constructor&&Q.constructor.name==="ArrayBuffer"&&Q.byteLength>=0,B8=(Q)=>!Buffer.isBuffer(Q)&&ArrayBuffer.isView(Q);class C5{src;dest;opts;ondrain;constructor(Q,X,Z){this.src=Q,this.dest=X,this.opts=Z,this.ondrain=()=>Q[LQ](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class _6 extends C5{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Q,X,Z){super(Q,X,Z);this.proxyErrors=(V)=>this.dest.emit("error",V),Q.on("error",this.proxyErrors)}}var L8=(Q)=>!!Q.objectMode,v8=(Q)=>!Q.objectMode&&!!Q.encoding&&Q.encoding!=="buffer";class jQ extends O5{[R]=!1;[NQ]=!1;[E]=[];[k]=[];[S];[a];[e];[BQ];[JQ]=!1;[YQ]=!1;[lQ]=!1;[pQ]=!1;[IQ]=null;[I]=0;[M]=!1;[xQ];[nQ]=!1;[WQ]=0;[u]=!1;writable=!0;readable=!0;constructor(...Q){let X=Q[0]||{};super();if(X.objectMode&&typeof X.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(L8(X))this[S]=!0,this[a]=null;else if(v8(X))this[a]=X.encoding,this[S]=!1;else this[S]=!1,this[a]=null;if(this[e]=!!X.async,this[BQ]=this[a]?new W8(this[a]):null,X&&X.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[k]});if(X&&X.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[E]});let{signal:Z}=X;if(Z)if(this[xQ]=Z,Z.aborted)this[v5]();else Z.addEventListener("abort",()=>this[v5]())}get bufferLength(){return this[I]}get encoding(){return this[a]}set encoding(Q){throw Error("Encoding must be set at instantiation time")}setEncoding(Q){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[S]}set objectMode(Q){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[e]}set["async"](Q){this[e]=this[e]||!!Q}[v5](){this[nQ]=!0,this.emit("abort",this[xQ]?.reason),this.destroy(this[xQ]?.reason)}get aborted(){return this[nQ]}set aborted(Q){}write(Q,X,Z){if(this[nQ])return!1;if(this[JQ])throw Error("write after end");if(this[M])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof X==="function")Z=X,X="utf8";if(!X)X="utf8";let V=this[e]?PQ:U8;if(!this[S]&&!Buffer.isBuffer(Q)){if(B8(Q))Q=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);else if(w8(Q))Q=Buffer.from(Q);else if(typeof Q!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[S]){if(this[R]&&this[I]!==0)this[iQ](!0);if(this[R])this.emit("data",Q);else this[A5](Q);if(this[I]!==0)this.emit("readable");if(Z)V(Z);return this[R]}if(!Q.length){if(this[I]!==0)this.emit("readable");if(Z)V(Z);return this[R]}if(typeof Q==="string"&&!(X===this[a]&&!this[BQ]?.lastNeed))Q=Buffer.from(Q,X);if(Buffer.isBuffer(Q)&&this[a])Q=this[BQ].write(Q);if(this[R]&&this[I]!==0)this[iQ](!0);if(this[R])this.emit("data",Q);else this[A5](Q);if(this[I]!==0)this.emit("readable");if(Z)V(Z);return this[R]}read(Q){if(this[M])return null;if(this[u]=!1,this[I]===0||Q===0||Q&&Q>this[I])return this[qQ](),null;if(this[S])Q=null;if(this[k].length>1&&!this[S])this[k]=[this[a]?this[k].join(""):Buffer.concat(this[k],this[I])];let X=this[Y6](Q||null,this[k][0]);return this[qQ](),X}[Y6](Q,X){if(this[S])this[oQ]();else{let Z=X;if(Q===Z.length||Q===null)this[oQ]();else if(typeof Z==="string")this[k][0]=Z.slice(Q),X=Z.slice(0,Q),this[I]-=Q;else this[k][0]=Z.subarray(Q),X=Z.subarray(0,Q),this[I]-=Q}if(this.emit("data",X),!this[k].length&&!this[JQ])this.emit("drain");return X}end(Q,X,Z){if(typeof Q==="function")Z=Q,Q=void 0;if(typeof X==="function")Z=X,X="utf8";if(Q!==void 0)this.write(Q,X);if(Z)this.once("end",Z);if(this[JQ]=!0,this.writable=!1,this[R]||!this[NQ])this[qQ]();return this}[LQ](){if(this[M])return;if(!this[WQ]&&!this[E].length)this[u]=!0;if(this[NQ]=!1,this[R]=!0,this.emit("resume"),this[k].length)this[iQ]();else if(this[JQ])this[qQ]();else this.emit("drain")}resume(){return this[LQ]()}pause(){this[R]=!1,this[NQ]=!0,this[u]=!1}get destroyed(){return this[M]}get flowing(){return this[R]}get paused(){return this[NQ]}[A5](Q){if(this[S])this[I]+=1;else this[I]+=Q.length;this[k].push(Q)}[oQ](){if(this[S])this[I]-=1;else this[I]-=this[k][0].length;return this[k].shift()}[iQ](Q=!1){do;while(this[H6](this[oQ]())&&this[k].length);if(!Q&&!this[k].length&&!this[JQ])this.emit("drain")}[H6](Q){return this.emit("data",Q),this[R]}pipe(Q,X){if(this[M])return Q;this[u]=!1;let Z=this[YQ];if(X=X||{},Q===K6.stdout||Q===K6.stderr)X.end=!1;else X.end=X.end!==!1;if(X.proxyErrors=!!X.proxyErrors,Z){if(X.end)Q.end()}else if(this[E].push(!X.proxyErrors?new C5(this,Q,X):new _6(this,Q,X)),this[e])PQ(()=>this[LQ]());else this[LQ]();return Q}unpipe(Q){let X=this[E].find((Z)=>Z.dest===Q);if(X){if(this[E].length===1){if(this[R]&&this[WQ]===0)this[R]=!1;this[E]=[]}else this[E].splice(this[E].indexOf(X),1);X.unpipe()}}addListener(Q,X){return this.on(Q,X)}on(Q,X){let Z=super.on(Q,X);if(Q==="data"){if(this[u]=!1,this[WQ]++,!this[E].length&&!this[R])this[LQ]()}else if(Q==="readable"&&this[I]!==0)super.emit("readable");else if(A8(Q)&&this[YQ])super.emit(Q),this.removeAllListeners(Q);else if(Q==="error"&&this[IQ]){let V=X;if(this[e])PQ(()=>V.call(this,this[IQ]));else V.call(this,this[IQ])}return Z}removeListener(Q,X){return this.off(Q,X)}off(Q,X){let Z=super.off(Q,X);if(Q==="data"){if(this[WQ]=this.listeners("data").length,this[WQ]===0&&!this[u]&&!this[E].length)this[R]=!1}return Z}removeAllListeners(Q){let X=super.removeAllListeners(Q);if(Q==="data"||Q===void 0){if(this[WQ]=0,!this[u]&&!this[E].length)this[R]=!1}return X}get emittedEnd(){return this[YQ]}[qQ](){if(!this[lQ]&&!this[YQ]&&!this[M]&&this[k].length===0&&this[JQ]){if(this[lQ]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[pQ])this.emit("close");this[lQ]=!1}}emit(Q,...X){let Z=X[0];if(Q!=="error"&&Q!=="close"&&Q!==M&&this[M])return!1;else if(Q==="data")return!this[S]&&!Z?!1:this[e]?(PQ(()=>this[B5](Z)),!0):this[B5](Z);else if(Q==="end")return this[W6]();else if(Q==="close"){if(this[pQ]=!0,!this[YQ]&&!this[M])return!1;let $=super.emit("close");return this.removeAllListeners("close"),$}else if(Q==="error"){this[IQ]=Z,super.emit(w5,Z);let $=!this[xQ]||this.listeners("error").length?super.emit("error",Z):!1;return this[qQ](),$}else if(Q==="resume"){let $=super.emit("resume");return this[qQ](),$}else if(Q==="finish"||Q==="prefinish"){let $=super.emit(Q);return this.removeAllListeners(Q),$}let V=super.emit(Q,...X);return this[qQ](),V}[B5](Q){for(let Z of this[E])if(Z.dest.write(Q)===!1)this.pause();let X=this[u]?!1:super.emit("data",Q);return this[qQ](),X}[W6](){if(this[YQ])return!1;return this[YQ]=!0,this.readable=!1,this[e]?(PQ(()=>this[L5]()),!0):this[L5]()}[L5](){if(this[BQ]){let X=this[BQ].end();if(X){for(let Z of this[E])Z.dest.write(X);if(!this[u])super.emit("data",X)}}for(let X of this[E])X.end();let Q=super.emit("end");return this.removeAllListeners("end"),Q}async collect(){let Q=Object.assign([],{dataLength:0});if(!this[S])Q.dataLength=0;let X=this.promise();return this.on("data",(Z)=>{if(Q.push(Z),!this[S])Q.dataLength+=Z.length}),await X,Q}async concat(){if(this[S])throw Error("cannot concat in objectMode");let Q=await this.collect();return this[a]?Q.join(""):Buffer.concat(Q,Q.dataLength)}async promise(){return new Promise((Q,X)=>{this.on(M,()=>X(Error("stream destroyed"))),this.on("error",(Z)=>X(Z)),this.on("end",()=>Q())})}[Symbol.asyncIterator](){this[u]=!1;let Q=!1,X=async()=>{return this.pause(),Q=!0,{value:void 0,done:!0}};return{next:()=>{if(Q)return X();let V=this.read();if(V!==null)return Promise.resolve({done:!1,value:V});if(this[JQ])return X();let $,J,q=(W)=>{this.off("data",z),this.off("end",K),this.off(M,Y),X(),J(W)},z=(W)=>{this.off("error",q),this.off("end",K),this.off(M,Y),this.pause(),$({value:W,done:!!this[JQ]})},K=()=>{this.off("error",q),this.off("data",z),this.off(M,Y),X(),$({done:!0,value:void 0})},Y=()=>q(Error("stream destroyed"));return new Promise((W,H)=>{J=H,$=W,this.once(M,Y),this.once("error",q),this.once("end",K),this.once("data",z)})},throw:X,return:X,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[u]=!1;let Q=!1,X=()=>{return this.pause(),this.off(w5,X),this.off(M,X),this.off("end",X),Q=!0,{done:!0,value:void 0}},Z=()=>{if(Q)return X();let V=this.read();return V===null?X():{done:!1,value:V}};return this.once("end",X),this.once(w5,X),this.once(M,X),{next:Z,throw:X,return:X,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(Q){if(this[M]){if(Q)this.emit("error",Q);else this.emit(M);return this}this[M]=!0,this[u]=!0,this[k].length=0,this[I]=0;let X=this;if(typeof X.close==="function"&&!this[pQ])X.close();if(Q)this.emit("error",Q);else this.emit(M);return this}static get isStream(){return j8}}var x8=I8.native,SQ={lstatSync:F8,readdir:M8,readdirSync:R8,readlinkSync:k8,realpathSync:x8,promises:{lstat:P8,readdir:D8,readlink:S8,realpath:T8}},B6=(Q)=>!Q||Q===SQ||Q===N8?SQ:{...SQ,...Q,promises:{...SQ.promises,...Q.promises||{}}},L6=/^\\\\\?\\([a-z]:)\\?$/i,E8=(Q)=>Q.replace(/\//g,"\\").replace(L6,"$1\\"),b8=/[\\\/]/,d=0,v6=1,O6=2,t=4,C6=6,F6=8,_Q=10,M6=12,g=15,DQ=~g,F5=16,G6=32,TQ=64,r=128,aQ=256,sQ=512,U6=TQ|r|sQ,y8=1023,M5=(Q)=>Q.isFile()?F6:Q.isDirectory()?t:Q.isSymbolicLink()?_Q:Q.isCharacterDevice()?O6:Q.isBlockDevice()?C6:Q.isSocket()?M6:Q.isFIFO()?v6:d,A6=new kQ({max:4096}),EQ=(Q)=>{let X=A6.get(Q);if(X)return X;let Z=Q.normalize("NFKD");return A6.set(Q,Z),Z},w6=new kQ({max:4096}),rQ=(Q)=>{let X=w6.get(Q);if(X)return X;let Z=EQ(Q.toLowerCase());return w6.set(Q,Z),Z};class k5 extends kQ{constructor(){super({max:256})}}class R6 extends kQ{constructor(Q=16384){super({maxSize:Q,sizeCalculation:(X)=>X.length+1})}}var k6=Symbol("PathScurry setAsCwd");class b{name;root;roots;parent;nocase;isCWD=!1;#Q;#V;get dev(){return this.#V}#$;get mode(){return this.#$}#X;get nlink(){return this.#X}#q;get uid(){return this.#q}#F;get gid(){return this.#F}#B;get rdev(){return this.#B}#W;get blksize(){return this.#W}#z;get ino(){return this.#z}#j;get size(){return this.#j}#H;get blocks(){return this.#H}#K;get atimeMs(){return this.#K}#J;get mtimeMs(){return this.#J}#L;get ctimeMs(){return this.#L}#O;get birthtimeMs(){return this.#O}#G;get atime(){return this.#G}#U;get mtime(){return this.#U}#k;get ctime(){return this.#k}#A;get birthtime(){return this.#A}#C;#M;#_;#w;#v;#I;#Z;#E;#S;#N;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Q,X=d,Z,V,$,J,q){if(this.name=Q,this.#C=$?rQ(Q):EQ(Q),this.#Z=X&y8,this.nocase=$,this.roots=V,this.root=Z||this,this.#E=J,this.#_=q.fullpath,this.#v=q.relative,this.#I=q.relativePosix,this.parent=q.parent,this.parent)this.#Q=this.parent.#Q;else this.#Q=B6(q.fs)}depth(){if(this.#M!==void 0)return this.#M;if(!this.parent)return this.#M=0;return this.#M=this.parent.depth()+1}childrenCache(){return this.#E}resolve(Q){if(!Q)return this;let X=this.getRootString(Q),V=Q.substring(X.length).split(this.splitSep);return X?this.getRoot(X).#T(V):this.#T(V)}#T(Q){let X=this;for(let Z of Q)X=X.child(Z);return X}children(){let Q=this.#E.get(this);if(Q)return Q;let X=Object.assign([],{provisional:0});return this.#E.set(this,X),this.#Z&=~F5,X}child(Q,X){if(Q===""||Q===".")return this;if(Q==="..")return this.parent||this;let Z=this.children(),V=this.nocase?rQ(Q):EQ(Q);for(let z of Z)if(z.#C===V)return z;let $=this.parent?this.sep:"",J=this.#_?this.#_+$+Q:void 0,q=this.newChild(Q,d,{...X,parent:this,fullpath:J});if(!this.canReaddir())q.#Z|=r;return Z.push(q),q}relative(){if(this.isCWD)return"";if(this.#v!==void 0)return this.#v;let Q=this.name,X=this.parent;if(!X)return this.#v=this.name;let Z=X.relative();return Z+(!Z||!X.parent?"":this.sep)+Q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let Q=this.name,X=this.parent;if(!X)return this.#I=this.fullpathPosix();let Z=X.relativePosix();return Z+(!Z||!X.parent?"":"/")+Q}fullpath(){if(this.#_!==void 0)return this.#_;let Q=this.name,X=this.parent;if(!X)return this.#_=this.name;let V=X.fullpath()+(!X.parent?"":this.sep)+Q;return this.#_=V}fullpathPosix(){if(this.#w!==void 0)return this.#w;if(this.sep==="/")return this.#w=this.fullpath();if(!this.parent){let V=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(V))return this.#w=`//?/${V}`;else return this.#w=V}let Q=this.parent,X=Q.fullpathPosix(),Z=X+(!X||!Q.parent?"":"/")+this.name;return this.#w=Z}isUnknown(){return(this.#Z&g)===d}isType(Q){return this[`is${Q}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#Z&g)===F6}isDirectory(){return(this.#Z&g)===t}isCharacterDevice(){return(this.#Z&g)===O6}isBlockDevice(){return(this.#Z&g)===C6}isFIFO(){return(this.#Z&g)===v6}isSocket(){return(this.#Z&g)===M6}isSymbolicLink(){return(this.#Z&_Q)===_Q}lstatCached(){return this.#Z&G6?this:void 0}readlinkCached(){return this.#S}realpathCached(){return this.#N}readdirCached(){let Q=this.children();return Q.slice(0,Q.provisional)}canReadlink(){if(this.#S)return!0;if(!this.parent)return!1;let Q=this.#Z&g;return!(Q!==d&&Q!==_Q||this.#Z&aQ||this.#Z&r)}calledReaddir(){return!!(this.#Z&F5)}isENOENT(){return!!(this.#Z&r)}isNamed(Q){return!this.nocase?this.#C===EQ(Q):this.#C===rQ(Q)}async readlink(){let Q=this.#S;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=await this.#Q.promises.readlink(this.fullpath()),Z=(await this.parent.realpath())?.resolve(X);if(Z)return this.#S=Z}catch(X){this.#D(X.code);return}}readlinkSync(){let Q=this.#S;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=this.#Q.readlinkSync(this.fullpath()),Z=this.parent.realpathSync()?.resolve(X);if(Z)return this.#S=Z}catch(X){this.#D(X.code);return}}#f(Q){this.#Z|=F5;for(let X=Q.provisional;X<Q.length;X++){let Z=Q[X];if(Z)Z.#R()}}#R(){if(this.#Z&r)return;this.#Z=(this.#Z|r)&DQ,this.#l()}#l(){let Q=this.children();Q.provisional=0;for(let X of Q)X.#R()}#u(){this.#Z|=sQ,this.#b()}#b(){if(this.#Z&TQ)return;let Q=this.#Z;if((Q&g)===t)Q&=DQ;this.#Z=Q|TQ,this.#l()}#h(Q=""){if(Q==="ENOTDIR"||Q==="EPERM")this.#b();else if(Q==="ENOENT")this.#R();else this.children().provisional=0}#P(Q=""){if(Q==="ENOTDIR")this.parent.#b();else if(Q==="ENOENT")this.#R()}#D(Q=""){let X=this.#Z;if(X|=aQ,Q==="ENOENT")X|=r;if(Q==="EINVAL"||Q==="UNKNOWN")X&=DQ;if(this.#Z=X,Q==="ENOTDIR"&&this.parent)this.parent.#b()}#m(Q,X){return this.#d(Q,X)||this.#g(Q,X)}#g(Q,X){let Z=M5(Q),V=this.newChild(Q.name,Z,{parent:this}),$=V.#Z&g;if($!==t&&$!==_Q&&$!==d)V.#Z|=TQ;return X.unshift(V),X.provisional++,V}#d(Q,X){for(let Z=X.provisional;Z<X.length;Z++){let V=X[Z];if((this.nocase?rQ(Q.name):EQ(Q.name))!==V.#C)continue;return this.#Y(Q,V,Z,X)}}#Y(Q,X,Z,V){let $=X.name;if(X.#Z=X.#Z&DQ|M5(Q),$!==Q.name)X.name=Q.name;if(Z!==V.provisional){if(Z===V.length-1)V.pop();else V.splice(Z,1);V.unshift(X)}return V.provisional++,X}async lstat(){if((this.#Z&r)===0)try{return this.#c(await this.#Q.promises.lstat(this.fullpath())),this}catch(Q){this.#P(Q.code)}}lstatSync(){if((this.#Z&r)===0)try{return this.#c(this.#Q.lstatSync(this.fullpath())),this}catch(Q){this.#P(Q.code)}}#c(Q){let{atime:X,atimeMs:Z,birthtime:V,birthtimeMs:$,blksize:J,blocks:q,ctime:z,ctimeMs:K,dev:Y,gid:W,ino:H,mode:j,mtime:_,mtimeMs:G,nlink:U,rdev:w,size:A,uid:B}=Q;this.#G=X,this.#K=Z,this.#A=V,this.#O=$,this.#W=J,this.#H=q,this.#k=z,this.#L=K,this.#V=Y,this.#F=W,this.#z=H,this.#$=j,this.#U=_,this.#J=G,this.#X=U,this.#B=w,this.#j=A,this.#q=B;let O=M5(Q);if(this.#Z=this.#Z&DQ|O|G6,O!==d&&O!==t&&O!==_Q)this.#Z|=TQ}#y=[];#x=!1;#p(Q){this.#x=!1;let X=this.#y.slice();this.#y.length=0,X.forEach((Z)=>Z(null,Q))}readdirCB(Q,X=!1){if(!this.canReaddir()){if(X)Q(null,[]);else queueMicrotask(()=>Q(null,[]));return}let Z=this.children();if(this.calledReaddir()){let $=Z.slice(0,Z.provisional);if(X)Q(null,$);else queueMicrotask(()=>Q(null,$));return}if(this.#y.push(Q),this.#x)return;this.#x=!0;let V=this.fullpath();this.#Q.readdir(V,{withFileTypes:!0},($,J)=>{if($)this.#h($.code),Z.provisional=0;else{for(let q of J)this.#m(q,Z);this.#f(Z)}this.#p(Z.slice(0,Z.provisional));return})}#i;async readdir(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();if(this.#i)await this.#i;else{let Z=()=>{};this.#i=new Promise((V)=>Z=V);try{for(let V of await this.#Q.promises.readdir(X,{withFileTypes:!0}))this.#m(V,Q);this.#f(Q)}catch(V){this.#h(V.code),Q.provisional=0}this.#i=void 0,Z()}return Q.slice(0,Q.provisional)}readdirSync(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();try{for(let Z of this.#Q.readdirSync(X,{withFileTypes:!0}))this.#m(Z,Q);this.#f(Q)}catch(Z){this.#h(Z.code),Q.provisional=0}return Q.slice(0,Q.provisional)}canReaddir(){if(this.#Z&U6)return!1;let Q=g&this.#Z;if(!(Q===d||Q===t||Q===_Q))return!1;return!0}shouldWalk(Q,X){return(this.#Z&t)===t&&!(this.#Z&U6)&&!Q.has(this)&&(!X||X(this))}async realpath(){if(this.#N)return this.#N;if((sQ|aQ|r)&this.#Z)return;try{let Q=await this.#Q.promises.realpath(this.fullpath());return this.#N=this.resolve(Q)}catch(Q){this.#u()}}realpathSync(){if(this.#N)return this.#N;if((sQ|aQ|r)&this.#Z)return;try{let Q=this.#Q.realpathSync(this.fullpath());return this.#N=this.resolve(Q)}catch(Q){this.#u()}}[k6](Q){if(Q===this)return;Q.isCWD=!1,this.isCWD=!0;let X=new Set([]),Z=[],V=this;while(V&&V.parent)X.add(V),V.#v=Z.join(this.sep),V.#I=Z.join("/"),V=V.parent,Z.push("..");V=Q;while(V&&V.parent&&!X.has(V))V.#v=void 0,V.#I=void 0,V=V.parent}}class eQ extends b{sep="\\";splitSep=b8;constructor(Q,X=d,Z,V,$,J,q){super(Q,X,Z,V,$,J,q)}newChild(Q,X=d,Z={}){return new eQ(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}getRootString(Q){return R5.parse(Q).root}getRoot(Q){if(Q=E8(Q.toUpperCase()),Q===this.root.name)return this.root;for(let[X,Z]of Object.entries(this.roots))if(this.sameRoot(Q,X))return this.roots[Q]=Z;return this.roots[Q]=new bQ(Q,this).root}sameRoot(Q,X=this.root.name){return Q=Q.toUpperCase().replace(/\//g,"\\").replace(L6,"$1\\"),Q===X}}class tQ extends b{splitSep="/";sep="/";constructor(Q,X=d,Z,V,$,J,q){super(Q,X,Z,V,$,J,q)}getRootString(Q){return Q.startsWith("/")?"/":""}getRoot(Q){return this.root}newChild(Q,X=d,Z={}){return new tQ(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}}class I5{root;rootPath;roots;cwd;#Q;#V;#$;nocase;#X;constructor(Q=process.cwd(),X,Z,{nocase:V,childrenCacheSize:$=16384,fs:J=SQ}={}){if(this.#X=B6(J),Q instanceof URL||Q.startsWith("file://"))Q=C8(Q);let q=X.resolve(Q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(q),this.#Q=new k5,this.#V=new k5,this.#$=new R6($);let z=q.substring(this.rootPath.length).split(Z);if(z.length===1&&!z[0])z.pop();if(V===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=V,this.root=this.newRoot(this.#X),this.roots[this.rootPath]=this.root;let K=this.root,Y=z.length-1,W=X.sep,H=this.rootPath,j=!1;for(let _ of z){let G=Y--;K=K.child(_,{relative:Array(G).fill("..").join(W),relativePosix:Array(G).fill("..").join("/"),fullpath:H+=(j?"":W)+_}),j=!0}this.cwd=K}depth(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.depth()}childrenCache(){return this.#$}resolve(...Q){let X="";for(let $=Q.length-1;$>=0;$--){let J=Q[$];if(!J||J===".")continue;if(X=X?`${J}/${X}`:J,this.isAbsolute(J))break}let Z=this.#Q.get(X);if(Z!==void 0)return Z;let V=this.cwd.resolve(X).fullpath();return this.#Q.set(X,V),V}resolvePosix(...Q){let X="";for(let $=Q.length-1;$>=0;$--){let J=Q[$];if(!J||J===".")continue;if(X=X?`${J}/${X}`:J,this.isAbsolute(J))break}let Z=this.#V.get(X);if(Z!==void 0)return Z;let V=this.cwd.resolve(X).fullpathPosix();return this.#V.set(X,V),V}relative(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relative()}relativePosix(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relativePosix()}basename(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.name}dirname(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return(Q.parent||Q).fullpath()}async readdir(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q,Q=this.cwd;let{withFileTypes:Z}=X;if(!Q.canReaddir())return[];else{let V=await Q.readdir();return Z?V:V.map(($)=>$.name)}}readdirSync(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q,Q=this.cwd;let{withFileTypes:Z=!0}=X;if(!Q.canReaddir())return[];else if(Z)return Q.readdirSync();else return Q.readdirSync().map((V)=>V.name)}async lstat(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstat()}lstatSync(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstatSync()}async readlink(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.readlink();return X?Z:Z?.fullpath()}readlinkSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q.withFileTypes,Q=this.cwd;let Z=Q.readlinkSync();return X?Z:Z?.fullpath()}async realpath(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.realpath();return X?Z:Z?.fullpath()}realpathSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q.withFileTypes,Q=this.cwd;let Z=Q.realpathSync();return X?Z:Z?.fullpath()}async walk(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=[];if(!$||$(Q))q.push(Z?Q:Q.fullpath());let z=new Set,K=(W,H)=>{z.add(W),W.readdirCB((j,_)=>{if(j)return H(j);let G=_.length;if(!G)return H();let U=()=>{if(--G===0)H()};for(let w of _){if(!$||$(w))q.push(Z?w:w.fullpath());if(V&&w.isSymbolicLink())w.realpath().then((A)=>A?.isUnknown()?A.lstat():A).then((A)=>A?.shouldWalk(z,J)?K(A,U):U());else if(w.shouldWalk(z,J))K(w,U);else U()}},!0)},Y=Q;return new Promise((W,H)=>{K(Y,(j)=>{if(j)return H(j);W(q)})})}walkSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=[];if(!$||$(Q))q.push(Z?Q:Q.fullpath());let z=new Set([Q]);for(let K of z){let Y=K.readdirSync();for(let W of Y){if(!$||$(W))q.push(Z?W:W.fullpath());let H=W;if(W.isSymbolicLink()){if(!(V&&(H=W.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk(z,J))z.add(H)}}return q}[Symbol.asyncIterator](){return this.iterate()}iterate(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q,Q=this.cwd;return this.stream(Q,X)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X;if(!$||$(Q))yield Z?Q:Q.fullpath();let q=new Set([Q]);for(let z of q){let K=z.readdirSync();for(let Y of K){if(!$||$(Y))yield Z?Y:Y.fullpath();let W=Y;if(Y.isSymbolicLink()){if(!(V&&(W=Y.realpathSync())))continue;if(W.isUnknown())W.lstatSync()}if(W.shouldWalk(q,J))q.add(W)}}}stream(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=new jQ({objectMode:!0});if(!$||$(Q))q.write(Z?Q:Q.fullpath());let z=new Set,K=[Q],Y=0,W=()=>{let H=!1;while(!H){let j=K.shift();if(!j){if(Y===0)q.end();return}Y++,z.add(j);let _=(U,w,A=!1)=>{if(U)return q.emit("error",U);if(V&&!A){let B=[];for(let O of w)if(O.isSymbolicLink())B.push(O.realpath().then((C)=>C?.isUnknown()?C.lstat():C));if(B.length){Promise.all(B).then(()=>_(null,w,!0));return}}for(let B of w)if(B&&(!$||$(B))){if(!q.write(Z?B:B.fullpath()))H=!0}Y--;for(let B of w){let O=B.realpathCached()||B;if(O.shouldWalk(z,J))K.push(O)}if(H&&!q.flowing)q.once("drain",W);else if(!G)W()},G=!0;j.readdirCB(_,!0),G=!1}};return W(),q}streamSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof b))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=new jQ({objectMode:!0}),z=new Set;if(!$||$(Q))q.write(Z?Q:Q.fullpath());let K=[Q],Y=0,W=()=>{let H=!1;while(!H){let j=K.shift();if(!j){if(Y===0)q.end();return}Y++,z.add(j);let _=j.readdirSync();for(let G of _)if(!$||$(G)){if(!q.write(Z?G:G.fullpath()))H=!0}Y--;for(let G of _){let U=G;if(G.isSymbolicLink()){if(!(V&&(U=G.realpathSync())))continue;if(U.isUnknown())U.lstatSync()}if(U.shouldWalk(z,J))K.push(U)}}if(H&&!q.flowing)q.once("drain",W)};return W(),q}chdir(Q=this.cwd){let X=this.cwd;this.cwd=typeof Q==="string"?this.cwd.resolve(Q):Q,this.cwd[k6](X)}}class bQ extends I5{sep="\\";constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,R5,"\\",{...X,nocase:Z});this.nocase=Z;for(let V=this.cwd;V;V=V.parent)V.nocase=this.nocase}parseRootPath(Q){return R5.parse(Q).root.toUpperCase()}newRoot(Q){return new eQ(this.rootPath,t,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")||Q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Q)}}class yQ extends I5{sep="/";constructor(Q=process.cwd(),X={}){let{nocase:Z=!1}=X;super(Q,O8,"/",{...X,nocase:Z});this.nocase=Z}parseRootPath(Q){return"/"}newRoot(Q){return new tQ(this.rootPath,t,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")}}class Q5 extends yQ{constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,{...X,nocase:Z})}}var _0=process.platform==="win32"?eQ:tQ,I6=process.platform==="win32"?bQ:process.platform==="darwin"?Q5:yQ;var u8=(Q)=>Q.length>=1,f8=(Q)=>Q.length>=1;class vQ{#Q;#V;#$;length;#X;#q;#F;#B;#W;#z;#j=!0;constructor(Q,X,Z,V){if(!u8(Q))throw TypeError("empty pattern list");if(!f8(X))throw TypeError("empty glob list");if(X.length!==Q.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=Q.length,Z<0||Z>=this.length)throw TypeError("index out of range");if(this.#Q=Q,this.#V=X,this.#$=Z,this.#X=V,this.#$===0){if(this.isUNC()){let[$,J,q,z,...K]=this.#Q,[Y,W,H,j,..._]=this.#V;if(K[0]==="")K.shift(),_.shift();let G=[$,J,q,z,""].join("/"),U=[Y,W,H,j,""].join("/");this.#Q=[G,...K],this.#V=[U,..._],this.length=this.#Q.length}else if(this.isDrive()||this.isAbsolute()){let[$,...J]=this.#Q,[q,...z]=this.#V;if(J[0]==="")J.shift(),z.shift();let K=$+"/",Y=q+"/";this.#Q=[K,...J],this.#V=[Y,...z],this.length=this.#Q.length}}}pattern(){return this.#Q[this.#$]}isString(){return typeof this.#Q[this.#$]==="string"}isGlobstar(){return this.#Q[this.#$]===F}isRegExp(){return this.#Q[this.#$]instanceof RegExp}globString(){return this.#F=this.#F||(this.#$===0?this.isAbsolute()?this.#V[0]+this.#V.slice(1).join("/"):this.#V.join("/"):this.#V.slice(this.#$).join("/"))}hasMore(){return this.length>this.#$+1}rest(){if(this.#q!==void 0)return this.#q;if(!this.hasMore())return this.#q=null;return this.#q=new vQ(this.#Q,this.#V,this.#$+1,this.#X),this.#q.#z=this.#z,this.#q.#W=this.#W,this.#q.#B=this.#B,this.#q}isUNC(){let Q=this.#Q;return this.#W!==void 0?this.#W:this.#W=this.#X==="win32"&&this.#$===0&&Q[0]===""&&Q[1]===""&&typeof Q[2]==="string"&&!!Q[2]&&typeof Q[3]==="string"&&!!Q[3]}isDrive(){let Q=this.#Q;return this.#B!==void 0?this.#B:this.#B=this.#X==="win32"&&this.#$===0&&this.length>1&&typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0])}isAbsolute(){let Q=this.#Q;return this.#z!==void 0?this.#z:this.#z=Q[0]===""&&Q.length>1||this.isDrive()||this.isUNC()}root(){let Q=this.#Q[0];return typeof Q==="string"&&this.isAbsolute()&&this.#$===0?Q:""}checkFollowGlobstar(){return!(this.#$===0||!this.isGlobstar()||!this.#j)}markFollowGlobstar(){if(this.#$===0||!this.isGlobstar()||!this.#j)return!1;return this.#j=!1,!0}}var h8=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class uQ{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Q,{nobrace:X,nocase:Z,noext:V,noglobstar:$,platform:J=h8}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=J,this.mmopts={dot:!0,nobrace:X,nocase:Z,noext:V,noglobstar:$,optimizationLevel:2,platform:J,nocomment:!0,nonegate:!0};for(let q of Q)this.add(q)}add(Q){let X=new m(Q,this.mmopts);for(let Z=0;Z<X.set.length;Z++){let V=X.set[Z],$=X.globParts[Z];if(!V||!$)throw Error("invalid pattern object");while(V[0]==="."&&$[0]===".")V.shift(),$.shift();let J=new vQ(V,$,0,this.platform),q=new m(J.globString(),this.mmopts),z=$[$.length-1]==="**",K=J.isAbsolute();if(K)this.absolute.push(q);else this.relative.push(q);if(z)if(K)this.absoluteChildren.push(q);else this.relativeChildren.push(q)}}ignored(Q){let X=Q.fullpath(),Z=`${X}/`,V=Q.relative()||".",$=`${V}/`;for(let J of this.relative)if(J.match(V)||J.match($))return!0;for(let J of this.absolute)if(J.match(X)||J.match(Z))return!0;return!1}childrenIgnored(Q){let X=Q.fullpath()+"/",Z=(Q.relative()||".")+"/";for(let V of this.relativeChildren)if(V.match(Z))return!0;for(let V of this.absoluteChildren)if(V.match(X))return!0;return!1}}class N5{store;constructor(Q=new Map){this.store=Q}copy(){return new N5(new Map(this.store))}hasWalked(Q,X){return this.store.get(Q.fullpath())?.has(X.globString())}storeWalked(Q,X){let Z=Q.fullpath(),V=this.store.get(Z);if(V)V.add(X.globString());else this.store.set(Z,new Set([X.globString()]))}}class N6{store=new Map;add(Q,X,Z){let V=(X?2:0)|(Z?1:0),$=this.store.get(Q);this.store.set(Q,$===void 0?V:V&$)}entries(){return[...this.store.entries()].map(([Q,X])=>[Q,!!(X&2),!!(X&1)])}}class x6{store=new Map;add(Q,X){if(!Q.canReaddir())return;let Z=this.store.get(Q);if(Z){if(!Z.find((V)=>V.globString()===X.globString()))Z.push(X)}else this.store.set(Q,[X])}get(Q){let X=this.store.get(Q);if(!X)throw Error("attempting to walk unknown path");return X}entries(){return this.keys().map((Q)=>[Q,this.store.get(Q)])}keys(){return[...this.store.keys()].filter((Q)=>Q.canReaddir())}}class fQ{hasWalkedCache;matches=new N6;subwalks=new x6;patterns;follow;dot;opts;constructor(Q,X){this.opts=Q,this.follow=!!Q.follow,this.dot=!!Q.dot,this.hasWalkedCache=X?X.copy():new N5}processPatterns(Q,X){this.patterns=X;let Z=X.map((V)=>[Q,V]);for(let[V,$]of Z){this.hasWalkedCache.storeWalked(V,$);let J=$.root(),q=$.isAbsolute()&&this.opts.absolute!==!1;if(J){V=V.resolve(J==="/"&&this.opts.root!==void 0?this.opts.root:J);let W=$.rest();if(!W){this.matches.add(V,!0,!1);continue}else $=W}if(V.isENOENT())continue;let z,K,Y=!1;while(typeof(z=$.pattern())==="string"&&(K=$.rest()))V=V.resolve(z),$=K,Y=!0;if(z=$.pattern(),K=$.rest(),Y){if(this.hasWalkedCache.hasWalked(V,$))continue;this.hasWalkedCache.storeWalked(V,$)}if(typeof z==="string"){let W=z===".."||z===""||z===".";this.matches.add(V.resolve(z),q,W);continue}else if(z===F){if(!V.isSymbolicLink()||this.follow||$.checkFollowGlobstar())this.subwalks.add(V,$);let W=K?.pattern(),H=K?.rest();if(!K||(W===""||W===".")&&!H)this.matches.add(V,q,W===""||W===".");else if(W===".."){let j=V.parent||V;if(!H)this.matches.add(j,q,!0);else if(!this.hasWalkedCache.hasWalked(j,H))this.subwalks.add(j,H)}}else if(z instanceof RegExp)this.subwalks.add(V,$)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new fQ(this.opts,this.hasWalkedCache)}filterEntries(Q,X){let Z=this.subwalks.get(Q),V=this.child();for(let $ of X)for(let J of Z){let q=J.isAbsolute(),z=J.pattern(),K=J.rest();if(z===F)V.testGlobstar($,J,K,q);else if(z instanceof RegExp)V.testRegExp($,z,K,q);else V.testString($,z,K,q)}return V}testGlobstar(Q,X,Z,V){if(this.dot||!Q.name.startsWith(".")){if(!X.hasMore())this.matches.add(Q,V,!1);if(Q.canReaddir()){if(this.follow||!Q.isSymbolicLink())this.subwalks.add(Q,X);else if(Q.isSymbolicLink()){if(Z&&X.checkFollowGlobstar())this.subwalks.add(Q,Z);else if(X.markFollowGlobstar())this.subwalks.add(Q,X)}}}if(Z){let $=Z.pattern();if(typeof $==="string"&&$!==".."&&$!==""&&$!==".")this.testString(Q,$,Z.rest(),V);else if($===".."){let J=Q.parent||Q;this.subwalks.add(J,Z)}else if($ instanceof RegExp)this.testRegExp(Q,$,Z.rest(),V)}}testRegExp(Q,X,Z,V){if(!X.test(Q.name))return;if(!Z)this.matches.add(Q,V,!1);else this.subwalks.add(Q,Z)}testString(Q,X,Z,V){if(!Q.isNamed(X))return;if(!Z)this.matches.add(Q,V,!1);else this.subwalks.add(Q,Z)}}var m8=(Q,X)=>typeof Q==="string"?new uQ([Q],X):Array.isArray(Q)?new uQ(Q,X):Q;class x5{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Q=[];#V;#$;signal;maxDepth;includeChildMatches;constructor(Q,X,Z){if(this.patterns=Q,this.path=X,this.opts=Z,this.#$=!Z.posix&&Z.platform==="win32"?"\\":"/",this.includeChildMatches=Z.includeChildMatches!==!1,Z.ignore||!this.includeChildMatches){if(this.#V=m8(Z.ignore??[],Z),!this.includeChildMatches&&typeof this.#V.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=Z.maxDepth||1/0,Z.signal)this.signal=Z.signal,this.signal.addEventListener("abort",()=>{this.#Q.length=0})}#X(Q){return this.seen.has(Q)||!!this.#V?.ignored?.(Q)}#q(Q){return!!this.#V?.childrenIgnored?.(Q)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Q=void 0;while(!this.paused&&(Q=this.#Q.shift()))Q()}onResume(Q){if(this.signal?.aborted)return;if(!this.paused)Q();else this.#Q.push(Q)}async matchCheck(Q,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||await Q.realpath(),!Z)return;Q=Z}let $=Q.isUnknown()||this.opts.stat?await Q.lstat():Q;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let J=await $.realpath();if(J&&(J.isUnknown()||this.opts.stat))await J.lstat()}return this.matchCheckTest($,X)}matchCheckTest(Q,X){return Q&&(this.maxDepth===1/0||Q.depth()<=this.maxDepth)&&(!X||Q.canReaddir())&&(!this.opts.nodir||!Q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Q.isSymbolicLink()||!Q.realpathCached()?.isDirectory())&&!this.#X(Q)?Q:void 0}matchCheckSync(Q,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||Q.realpathSync(),!Z)return;Q=Z}let $=Q.isUnknown()||this.opts.stat?Q.lstatSync():Q;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let J=$.realpathSync();if(J&&(J?.isUnknown()||this.opts.stat))J.lstatSync()}return this.matchCheckTest($,X)}matchFinish(Q,X){if(this.#X(Q))return;if(!this.includeChildMatches&&this.#V?.add){let $=`${Q.relativePosix()}/**`;this.#V.add($)}let Z=this.opts.absolute===void 0?X:this.opts.absolute;this.seen.add(Q);let V=this.opts.mark&&Q.isDirectory()?this.#$:"";if(this.opts.withFileTypes)this.matchEmit(Q);else if(Z){let $=this.opts.posix?Q.fullpathPosix():Q.fullpath();this.matchEmit($+V)}else{let $=this.opts.posix?Q.relativePosix():Q.relative(),J=this.opts.dotRelative&&!$.startsWith(".."+this.#$)?"."+this.#$:"";this.matchEmit(!$?"."+V:J+$+V)}}async match(Q,X,Z){let V=await this.matchCheck(Q,Z);if(V)this.matchFinish(V,X)}matchSync(Q,X,Z){let V=this.matchCheckSync(Q,Z);if(V)this.matchFinish(V,X)}walkCB(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2(Q,X,new fQ(this.opts),Z)}walkCB2(Q,X,Z,V){if(this.#q(Q))return V();if(this.signal?.aborted)V();if(this.paused){this.onResume(()=>this.walkCB2(Q,X,Z,V));return}Z.processPatterns(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,z,K]of Z.matches.entries()){if(this.#X(q))continue;$++,this.match(q,z,K).then(()=>J())}for(let q of Z.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;$++;let z=q.readdirCached();if(q.calledReaddir())this.walkCB3(q,z,Z,J);else q.readdirCB((K,Y)=>this.walkCB3(q,Y,Z,J),!0)}J()}walkCB3(Q,X,Z,V){Z=Z.filterEntries(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,z,K]of Z.matches.entries()){if(this.#X(q))continue;$++,this.match(q,z,K).then(()=>J())}for(let[q,z]of Z.subwalks.entries())$++,this.walkCB2(q,z,Z.child(),J);J()}walkCBSync(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2Sync(Q,X,new fQ(this.opts),Z)}walkCB2Sync(Q,X,Z,V){if(this.#q(Q))return V();if(this.signal?.aborted)V();if(this.paused){this.onResume(()=>this.walkCB2Sync(Q,X,Z,V));return}Z.processPatterns(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,z,K]of Z.matches.entries()){if(this.#X(q))continue;this.matchSync(q,z,K)}for(let q of Z.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;$++;let z=q.readdirSync();this.walkCB3Sync(q,z,Z,J)}J()}walkCB3Sync(Q,X,Z,V){Z=Z.filterEntries(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,z,K]of Z.matches.entries()){if(this.#X(q))continue;this.matchSync(q,z,K)}for(let[q,z]of Z.subwalks.entries())$++,this.walkCB2Sync(q,z,Z.child(),J);J()}}class X5 extends x5{matches=new Set;constructor(Q,X,Z){super(Q,X,Z)}matchEmit(Q){this.matches.add(Q)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Q,X)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)X(this.signal.reason);else Q(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class Z5 extends x5{results;constructor(Q,X,Z){super(Q,X,Z);this.results=new jQ({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Q){if(this.results.write(Q),!this.results.flowing)this.pause()}stream(){let Q=this.path;if(Q.isUnknown())Q.lstat().then(()=>{this.walkCB(Q,this.patterns,()=>this.results.end())});else this.walkCB(Q,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var d8=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class QQ{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(Q,X){if(!X)throw TypeError("glob options required");if(this.withFileTypes=!!X.withFileTypes,this.signal=X.signal,this.follow=!!X.follow,this.dot=!!X.dot,this.dotRelative=!!X.dotRelative,this.nodir=!!X.nodir,this.mark=!!X.mark,!X.cwd)this.cwd="";else if(X.cwd instanceof URL||X.cwd.startsWith("file://"))X.cwd=g8(X.cwd);if(this.cwd=X.cwd||"",this.root=X.root,this.magicalBraces=!!X.magicalBraces,this.nobrace=!!X.nobrace,this.noext=!!X.noext,this.realpath=!!X.realpath,this.absolute=X.absolute,this.includeChildMatches=X.includeChildMatches!==!1,this.noglobstar=!!X.noglobstar,this.matchBase=!!X.matchBase,this.maxDepth=typeof X.maxDepth==="number"?X.maxDepth:1/0,this.stat=!!X.stat,this.ignore=X.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof Q==="string")Q=[Q];if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)Q=Q.map((z)=>z.replace(/\\/g,"/"));if(this.matchBase){if(X.noglobstar)throw TypeError("base matching requires globstar");Q=Q.map((z)=>z.includes("/")?z:`./**/${z}`)}if(this.pattern=Q,this.platform=X.platform||d8,this.opts={...X,platform:this.platform},X.scurry){if(this.scurry=X.scurry,X.nocase!==void 0&&X.nocase!==X.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let z=X.platform==="win32"?bQ:X.platform==="darwin"?Q5:X.platform?yQ:I6;this.scurry=new z(this.cwd,{nocase:X.nocase,fs:X.fs})}this.nocase=this.scurry.nocase;let Z=this.platform==="darwin"||this.platform==="win32",V={...X,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:Z,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},$=this.pattern.map((z)=>new m(z,V)),[J,q]=$.reduce((z,K)=>{return z[0].push(...K.set),z[1].push(...K.globParts),z},[[],[]]);this.patterns=J.map((z,K)=>{let Y=q[K];if(!Y)throw Error("invalid pattern object");return new vQ(z,Y,0,this.platform)})}async walk(){return[...await new X5(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new X5(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Z5(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Z5(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var P5=(Q,X={})=>{if(!Array.isArray(Q))Q=[Q];for(let Z of Q)if(new m(Z,X).hasMagic())return!0;return!1};function $5(Q,X={}){return new QQ(Q,X).streamSync()}function D6(Q,X={}){return new QQ(Q,X).stream()}function S6(Q,X={}){return new QQ(Q,X).walkSync()}async function P6(Q,X={}){return new QQ(Q,X).walk()}function J5(Q,X={}){return new QQ(Q,X).iterateSync()}function T6(Q,X={}){return new QQ(Q,X).iterate()}var c8=$5,l8=Object.assign(D6,{sync:$5}),p8=J5,i8=Object.assign(T6,{sync:J5}),o8=Object.assign(S6,{stream:$5,iterate:J5}),V5=Object.assign(P6,{glob:P6,globSync:S6,sync:o8,globStream:D6,stream:l8,globStreamSync:$5,streamSync:c8,globIterate:T6,iterate:i8,globIterateSync:J5,iterateSync:p8,Glob:QQ,hasMagic:P5,escape:wQ,unescape:n});V5.glob=V5;var n8={name:"Read",description:"Reads a file from the local filesystem. You can access any file directly by using this tool.",input_schema:{type:"object",properties:{file_path:{type:"string",description:"The absolute path to the file to read"},offset:{type:"number",description:"The line number to start reading from (1-based)"},limit:{type:"number",description:"The number of lines to read"}},required:["file_path"]},handler:async(Q,X)=>{let Z=Q.file_path,V=Q.offset||1,$=Q.limit||2000;try{let z=(await Bun.file(Z).text()).split(`
22
- `),K=Math.max(0,V-1),Y=Math.min(z.length,K+$);return{content:z.slice(K,Y).map((j,_)=>`${K+_+1} ${j}`).join(`
23
- `)}}catch(J){return{content:`Error reading file: ${J instanceof Error?J.message:String(J)}`,is_error:!0}}}},a8={name:"Write",description:"Writes a file to the local filesystem. This tool will overwrite the existing file if there is one at the provided path.",input_schema:{type:"object",properties:{file_path:{type:"string",description:"The absolute path to the file to write"},content:{type:"string",description:"The content to write to the file"}},required:["file_path","content"]},handler:async(Q,X)=>{let{file_path:Z,content:V}=Q;try{return await Bun.write(Z,V),{content:`Successfully wrote to ${Z}`}}catch($){return{content:`Error writing file: ${$ instanceof Error?$.message:String($)}`,is_error:!0}}}},r8={name:"Edit",description:"Performs exact string replacements in files. Use this tool to modify existing files.",input_schema:{type:"object",properties:{file_path:{type:"string",description:"The absolute path to the file to modify"},old_string:{type:"string",description:"The text to replace"},new_string:{type:"string",description:"The text to replace it with"},replace_all:{type:"boolean",description:"Replace all occurrences (default false)"}},required:["file_path","old_string","new_string"]},handler:async(Q,X)=>{let{file_path:Z,old_string:V,new_string:$}=Q,J=Q.replace_all||!1;try{let z=await Bun.file(Z).text();if(J){let K=z;z=z.split(V).join($);let Y=(K.match(new RegExp(s8(V),"g"))||[]).length;if(Y===0)return{content:"Error: String not found in file",is_error:!0};return await Bun.write(Z,z),{content:`Successfully replaced ${Y} occurrences`}}else{let K=z.indexOf(V);if(K===-1)return{content:"Error: String not found in file",is_error:!0};if(z.indexOf(V,K+1)!==-1)return{content:"Error: String appears multiple times in file. Use replace_all or provide more context.",is_error:!0};return z=z.replace(V,$),await Bun.write(Z,z),{content:`Successfully edited ${Z}`}}}catch(q){return{content:`Error editing file: ${q instanceof Error?q.message:String(q)}`,is_error:!0}}}};function s8(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var e8={name:"Bash",description:"Executes a given bash command with optional timeout. Working directory persists between commands.",input_schema:{type:"object",properties:{command:{type:"string",description:"The command to execute"},timeout:{type:"number",description:"Optional timeout in milliseconds (max 600000)"},description:{type:"string",description:"Clear, concise description of what this command does"}},required:["command"]},handler:async(Q,X)=>{let Z=Q.command,V=Q.timeout||120000;try{let $=Bun.spawnSync(["sh","-c",Z],{cwd:X.workingDirectory,timeout:V,maxBuffer:31457280}),J=$.stdout?.toString()||"",q=$.stderr?.toString()||"";if($.exitCode!==0)return{content:`Exit code: ${$.exitCode}
24
- ${J}
25
- ${q}`.trim(),is_error:!0};return{content:J||"(no output)"}}catch($){return{content:`Error executing command: ${$ instanceof Error?$.message:String($)}`,is_error:!0}}}},t8={name:"Glob",description:"Fast file pattern matching tool that works with any codebase size. Supports glob patterns.",input_schema:{type:"object",properties:{pattern:{type:"string",description:"The glob pattern to match files"},path:{type:"string",description:"The directory to search (default: current directory)"}},required:["pattern"]},handler:async(Q,X)=>{let Z=Q.pattern,V=Q.path||X.workingDirectory;try{let $=await V5(Z,{cwd:V,absolute:!0,nodir:!0});if($.length===0)return{content:"No files found matching pattern"};return{content:$.sort().join(`
26
- `)}}catch($){return{content:`Error searching files: ${$ instanceof Error?$.message:String($)}`,is_error:!0}}}},Q9={name:"Grep",description:"A powerful search tool built on ripgrep. Supports full regex syntax.",input_schema:{type:"object",properties:{pattern:{type:"string",description:"The regular expression pattern to search for"},path:{type:"string",description:"File or directory to search"},glob:{type:"string",description:"Glob pattern to filter files"},output_mode:{type:"string",enum:["content","files_with_matches","count"],description:"Output mode (default: content)"},"-i:":{type:"boolean",description:"Case insensitive search"},"-C:":{type:"number",description:"Context lines around match"},head_limit:{type:"number",description:"Maximum number of results"}},required:["pattern"]},handler:async(Q,X)=>{let Z=Q.pattern,V=Q.path||X.workingDirectory,$=Q.glob,J=Q.output_mode||"content",q=Q["-i:"],z=Q["-C:"],K=Q.head_limit;try{let Y=["--json"];if(q)Y.push("-i");if(z)Y.push("-C",String(z));if($)Y.push("--glob",$);if(J==="files_with_matches")Y.push("--files-with-matches");if(J==="count")Y.push("--count");Y.push(Z,V);let H=Bun.spawnSync(["rg",...Y],{cwd:X.workingDirectory,maxBuffer:10485760}).stdout?.toString()||"";if(!H.trim())return{content:"No matches found"};if(J==="content"){let j=H.trim().split(`
27
- `),_=[];for(let G of j.slice(0,K||100))try{let U=JSON.parse(G);if(U.type==="match"){let w=U.data?.path?.text||"",A=U.data?.line_number||0,B=U.data?.lines?.text||"";_.push(`${w}:${A}:${B.trim()}`)}}catch{_.push(G)}return{content:_.join(`
28
- `)||"No matches found"}}return{content:H.trim()}}catch(Y){return{content:`Error searching: ${Y instanceof Error?Y.message:String(Y)}`,is_error:!0}}}},X9=[n8,a8,r8,e8,t8,Q9];function c0(Q){return X9.find((X)=>X.name===Q)}import{spawn as Z9}from"child_process";class V9{hooks=new Map;timeout;constructor(Q=60000){this.timeout=Q}register(Q,X){if(!this.hooks.has(Q))this.hooks.set(Q,[]);this.hooks.get(Q)?.push(X)}registerAll(Q){for(let[X,Z]of Object.entries(Q))for(let V of Z)this.register(X,V)}async execute(Q,X){let Z=this.hooks.get(Q);if(!Z||Z.length===0)return{decision:"allow"};let V={...X,event:Q,timestamp:Date.now()};for(let $ of Z){if($.enabled===!1)continue;let J=await this.executeHook($,V);if(J.decision==="deny"||J.decision==="block")return J;if(J.modified_input)Object.assign(X,J.modified_input)}return{decision:"allow"}}async executeHook(Q,X){let Z=Q.timeout||this.timeout;try{return await new Promise(($,J)=>{let q=Z9(Q.command,[],{shell:!0,stdio:["pipe","pipe","pipe"]}),z="",K="";q.stdout?.on("data",(Y)=>{z+=Y.toString()}),q.stderr?.on("data",(Y)=>{K+=Y.toString()}),q.on("close",(Y)=>{if(Y===0)try{let W=JSON.parse(z);$(W)}catch{$({decision:"allow"})}else if(Y===1)$({decision:"deny",reason:K||"Hook denied execution"});else if(Y===2)$({decision:"block",reason:K||"Hook blocked execution"});else $({decision:"allow"})}),q.on("error",(Y)=>{$({decision:"allow",reason:`Hook error: ${Y.message}`})}),q.stdin?.write(JSON.stringify(X)),q.stdin?.end(),setTimeout(()=>{q.kill(),$({decision:"allow",reason:"Hook timeout"})},Z)})}catch(V){return{decision:"allow",reason:`Hook execution failed: ${V instanceof Error?V.message:String(V)}`}}}getHooks(Q){return this.hooks.get(Q)||[]}clear(Q){if(Q)this.hooks.delete(Q);else this.hooks.clear()}}var i0={validateWrite:{event:"PreToolUse",command:`node -e '
29
- const input = JSON.parse(require("fs").readFileSync(0, "utf8"));
30
- if (input.tool_name === "Write") {
31
- const path = input.tool_input.file_path;
32
- if (path.includes("..") || path.startsWith("/etc/")) {
33
- console.log(JSON.stringify({ decision: "deny", reason: "Unsafe path" }));
34
- process.exit(1);
35
- }
36
- }
37
- console.log(JSON.stringify({ decision: "allow" }));
38
- '`,timeout:5000,enabled:!1},logToolUse:{event:"PostToolUse",command:`node -e '
39
- const input = JSON.parse(require("fs").readFileSync(0, "utf8"));
40
- console.error(\`[LOG] Tool: \${input.tool_name}\`);
41
- console.log(JSON.stringify({ decision: "allow" }));
42
- '`,timeout:5000,enabled:!1}},o0={PreToolUse:"Before a tool is executed. Can modify input or deny execution.",PostToolUse:"After a tool successfully executes. Can process result.",PostToolUseFailure:"After a tool fails. Can handle error or retry.",Stop:"When the agent stops (end_turn, max_tokens, error).",UserPromptSubmit:"When user submits a prompt. Can modify or reject.",SessionStart:"When a new session starts.",SessionEnd:"When a session ends.",Notification:"When a notification is sent.",ConfigChange:"When configuration changes.",WorktreeCreate:"When a git worktree is created."},n0={ALLOW:0,DENY:1,BLOCK:2};import{readFileSync as $9,existsSync as E6,readdirSync as J9}from"fs";import{join as q9}from"path";function z9(Q,X="project"){if(!E6(Q))return null;let Z=$9(Q,"utf-8"),V=Q.split("/").pop()?.replace(/\.md$/i,"")||"unknown",$=Z.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!$)return{path:Q,name:V,description:"",prompt:Z.trim(),source:X};let J=$[1]??"",q=$[2]??"",z=K9(J);return{path:Q,name:z.name||V,description:z.description||"",prompt:q.trim(),tools:z.tools,model:z.model,color:z.color,source:X}}function K9(Q){let X={},Z=Q.split(`
43
- `);for(let V of Z){let $=V.match(/^(\w+):\s*(.*)$/);if($){let J=$[1];if(!J)continue;let q=$[2]??"";if(q.startsWith("["))try{X[J]=JSON.parse(q)}catch{X[J]=q}else if(q==="true")X[J]=!0;else if(q==="false")X[J]=!1;else if(/^\d+$/.test(q))X[J]=parseInt(q,10);else if(/^\d+\.\d+$/.test(q))X[J]=parseFloat(q);else X[J]=q}}return X}class Y9{skills=new Map;loadFromDirectory(Q,X="project"){if(!E6(Q))return 0;let Z=0,V=J9(Q);for(let $ of V)if($.endsWith(".md")){let J=z9(q9(Q,$),X);if(J)this.skills.set(J.name,J),Z++}return Z}get(Q){return this.skills.get(Q)}getAll(){return Array.from(this.skills.values())}has(Q){return this.skills.has(Q)}getNames(){return Array.from(this.skills.keys())}}function t0(Q){return`
44
- <skill-loading>
45
- You are operating with the "${Q.name}" skill loaded.
46
-
47
- ${Q.description?`Description: ${Q.description}
48
- `:""}
49
- ${Q.prompt}
50
- </skill-loading>
51
- `.trim()}var QX=[{path:"built-in://commit",name:"commit",description:"Create a git commit with the staged changes",prompt:`Analyze the staged changes and create a git commit.
52
-
53
- Steps:
54
- 1. Run \`git diff --staged\` to see staged changes
55
- 2. Run \`git log --oneline -5\` to understand commit message style
56
- 3. Create a commit message following conventional commits format
57
- 4. Include "Co-Authored-By: Claude <noreply@anthropic.com>" if applicable
58
- 5. Run \`git commit\` with the message`,tools:["Bash"],model:"sonnet",source:"built-in"},{path:"built-in://review-pr",name:"review-pr",description:"Review a pull request",prompt:`Review the current pull request and provide feedback.
59
-
60
- Steps:
61
- 1. Use \`gh pr view\` to get PR details
62
- 2. Use \`gh pr diff\` to see the changes
63
- 3. Analyze the code for:
64
- - Bugs and potential issues
65
- - Code quality and style
66
- - Test coverage
67
- - Documentation
68
- 4. Provide constructive feedback
69
- 5. Approve or request changes as appropriate`,tools:["Bash"],model:"sonnet",source:"built-in"},{path:"built-in://mcp-builder",name:"mcp-builder",description:"Guide for creating MCP servers",prompt:`Help the user build MCP (Model Context Protocol) servers.
70
-
71
- MCP servers enable LLMs to interact with external services through well-designed tools.
72
-
73
- Key concepts:
74
- 1. Use FastMCP (Python) or MCP SDK (TypeScript)
75
- 2. Define tools with clear input schemas
76
- 3. Return structured content
77
- 4. Handle errors gracefully
78
-
79
- Transport types:
80
- - stdio: Local process communication
81
- - HTTP: REST API with JSON-RPC
82
- - SSE: Server-Sent Events for streaming
83
- - WebSocket: Bidirectional communication`,tools:["Read","Write","Edit","Bash"],model:"sonnet",source:"built-in"},{path:"built-in://claude-hooks",name:"claude-hooks",description:"Guide for Claude Code hooks",prompt:`Help the user configure Claude Code hooks.
84
-
85
- Hooks are user-defined shell commands that execute at specific points during Claude Code's lifecycle.
86
-
87
- Available events:
88
- - PreToolUse: Before a tool executes
89
- - PostToolUse: After a tool succeeds
90
- - PostToolUseFailure: After a tool fails
91
- - Stop: When agent stops
92
- - UserPromptSubmit: When user submits prompt
93
- - SessionStart/SessionEnd: Session lifecycle
94
-
95
- Exit codes:
96
- - 0: Allow execution
97
- - 1: Deny and show stderr
98
- - 2: Block silently`,tools:["Read","Write","Edit"],model:"sonnet",source:"built-in"}];function XX(Q){return Q.match(/^\/(\w+)(?:\s+(.*))?$/)?.[1]??null}function ZX(Q){return Q.match(/^\/\w+\s+(.*)$/)?.[1]??""}import{spawn as D5}from"child_process";class H9{teams=new Map;teammates=new Map;storagePath;constructor(Q="~/.claude/teams"){this.storagePath=Q.replace("~",process.env.HOME||"")}createTeam(Q){let X={...Q,status:"active"};this.teams.set(Q.name,X);for(let Z of Q.teammates)this.teammates.set(Z.teammateId,Z);return this.persistTeam(X),X}getTeam(Q){return this.teams.get(Q)}listTeams(){return Array.from(this.teams.values())}deleteTeam(Q){let X=this.teams.get(Q);if(X){for(let Z of X.teammates)this.teammates.delete(Z.teammateId);this.teams.delete(Q)}}getTeammate(Q){return this.teammates.get(Q)}updateTeammateStatus(Q,X){let Z=this.teammates.get(Q);if(Z)Z.status=X}async spawnTeammate(Q,X={}){let{session:Z,workingDir:V=process.cwd()}=X;if(!process.env.TMUX)await this.spawnInTerminal(Q,{session:Z,workingDir:V});else await this.spawnInTmux(Q,{session:Z,workingDir:V});this.updateTeammateStatus(Q.teammateId,"in_progress")}async spawnInTerminal(Q,X){let Z=["bun","run","src/cli.ts","--teammate-mode","--agent-id",Q.teammateId,"--agent-name",Q.name,"--team-name",Q.teamName,"--agent-color",Q.color];if(Q.planModeRequired)Z.push("--permission-mode","plan");if(process.platform==="darwin"){let V=`
99
- tell application "Terminal"
100
- do script "cd ${X.workingDir} && ${Z.join(" ")}"
101
- activate
102
- end tell
103
- `;D5("osascript",["-e",V])}else D5("xterm",["-e",Z.join(" ")])}async spawnInTmux(Q,X){let Z=X.session||process.env.TMUX?.split(",")[0]?.split(":")[0]||"claude";await this.tmuxCommand(["split-window","-t",Z,"-c",X.workingDir]);let V=await this.tmuxCommand(["display-message","-p","#{pane_id}"]);if(V)Q.paneId=V.trim();let $=["bun","run","src/cli.ts","--teammate-mode","--agent-id",Q.teammateId,"--agent-name",Q.name,"--team-name",Q.teamName];await this.tmuxCommand(["send-keys","-t",Q.paneId||"",$.join(" "),"Enter"])}async tmuxCommand(Q){return new Promise((X)=>{let Z=D5("tmux",Q),V="";Z.stdout?.on("data",($)=>{V+=$.toString()}),Z.on("close",()=>{X(V)})})}broadcast(Q,X){if(!this.teams.get(Q))return;let V={type:"broadcast",from:"system",content:X,timestamp:Date.now()};console.log(`[Broadcast:${Q}] ${X}`)}sendDirect(Q,X,Z){let V={type:"direct",from:X,to:Q,content:Z,timestamp:Date.now()};console.log(`[Direct:${X}->${Q}] ${Z}`)}persistTeam(Q){let X=`${this.storagePath}/${Q.name}/config.json`}loadTeams(){}}var JX={architect:(Q)=>({name:"architect",teamName:Q,color:"blue",prompt:`You are an architect on the ${Q} team.
104
- Your role is to design and plan the technical architecture.
105
- Focus on:
106
- - System design and component relationships
107
- - API contracts and interfaces
108
- - Data models and schemas
109
- - Trade-offs and design decisions`,planModeRequired:!0,status:"pending"}),implementer:(Q)=>({name:"implementer",teamName:Q,color:"green",prompt:`You are an implementer on the ${Q} team.
110
- Your role is to write clean, working code based on the architecture.
111
- Focus on:
112
- - Implementing the designed architecture
113
- - Writing tests
114
- - Following coding standards
115
- - Handling edge cases`,planModeRequired:!1,status:"pending"}),reviewer:(Q)=>({name:"reviewer",teamName:Q,color:"yellow",prompt:`You are a code reviewer on the ${Q} team.
116
- Your role is to review code changes and provide feedback.
117
- Focus on:
118
- - Code quality and readability
119
- - Potential bugs and issues
120
- - Performance considerations
121
- - Test coverage`,planModeRequired:!1,status:"pending"}),tester:(Q)=>({name:"tester",teamName:Q,color:"orange",prompt:`You are a tester on the ${Q} team.
122
- Your role is to ensure features work correctly.
123
- Focus on:
124
- - Writing comprehensive tests
125
- - Finding edge cases
126
- - Verifying requirements
127
- - Reporting bugs`,planModeRequired:!1,status:"pending"})};function W9(){return`teammate_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function qX(Q){return{...Q,teammateId:W9(),status:"pending"}}
128
- export{g6 as a,mQ as b,G9 as c,d6 as d,c6 as e,l6 as f,p6 as g,b5 as h,R9 as i,f5 as j,k9 as k,I9 as l,X7 as m,Z7 as n,D9 as o,n8 as p,a8 as q,r8 as r,e8 as s,t8 as t,Q9 as u,X9 as v,c0 as w,V9 as x,i0 as y,o0 as z,n0 as A,z9 as B,Y9 as C,t0 as D,QX as E,XX as F,ZX as G,H9 as H,JX as I,W9 as J,qX as K};