onbuzz 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (506) hide show
  1. package/LICENSE +267 -0
  2. package/README.md +425 -0
  3. package/bin/cli.js +556 -0
  4. package/bin/loxia-terminal-v2.js +162 -0
  5. package/bin/loxia-terminal.js +90 -0
  6. package/bin/start-with-terminal.js +200 -0
  7. package/node_modules/@isaacs/balanced-match/LICENSE.md +23 -0
  8. package/node_modules/@isaacs/balanced-match/README.md +60 -0
  9. package/node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts +9 -0
  10. package/node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts.map +1 -0
  11. package/node_modules/@isaacs/balanced-match/dist/commonjs/index.js +59 -0
  12. package/node_modules/@isaacs/balanced-match/dist/commonjs/index.js.map +1 -0
  13. package/node_modules/@isaacs/balanced-match/dist/commonjs/package.json +3 -0
  14. package/node_modules/@isaacs/balanced-match/dist/esm/index.d.ts +9 -0
  15. package/node_modules/@isaacs/balanced-match/dist/esm/index.d.ts.map +1 -0
  16. package/node_modules/@isaacs/balanced-match/dist/esm/index.js +54 -0
  17. package/node_modules/@isaacs/balanced-match/dist/esm/index.js.map +1 -0
  18. package/node_modules/@isaacs/balanced-match/dist/esm/package.json +3 -0
  19. package/node_modules/@isaacs/balanced-match/package.json +79 -0
  20. package/node_modules/@isaacs/brace-expansion/LICENSE +23 -0
  21. package/node_modules/@isaacs/brace-expansion/README.md +97 -0
  22. package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts +6 -0
  23. package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
  24. package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js +199 -0
  25. package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js.map +1 -0
  26. package/node_modules/@isaacs/brace-expansion/dist/commonjs/package.json +3 -0
  27. package/node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts +6 -0
  28. package/node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts.map +1 -0
  29. package/node_modules/@isaacs/brace-expansion/dist/esm/index.js +195 -0
  30. package/node_modules/@isaacs/brace-expansion/dist/esm/index.js.map +1 -0
  31. package/node_modules/@isaacs/brace-expansion/dist/esm/package.json +3 -0
  32. package/node_modules/@isaacs/brace-expansion/package.json +60 -0
  33. package/node_modules/glob/LICENSE.md +63 -0
  34. package/node_modules/glob/README.md +1177 -0
  35. package/node_modules/glob/dist/commonjs/glob.d.ts +388 -0
  36. package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -0
  37. package/node_modules/glob/dist/commonjs/glob.js +247 -0
  38. package/node_modules/glob/dist/commonjs/glob.js.map +1 -0
  39. package/node_modules/glob/dist/commonjs/has-magic.d.ts +14 -0
  40. package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -0
  41. package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
  42. package/node_modules/glob/dist/commonjs/has-magic.js.map +1 -0
  43. package/node_modules/glob/dist/commonjs/ignore.d.ts +24 -0
  44. package/node_modules/glob/dist/commonjs/ignore.d.ts.map +1 -0
  45. package/node_modules/glob/dist/commonjs/ignore.js +119 -0
  46. package/node_modules/glob/dist/commonjs/ignore.js.map +1 -0
  47. package/node_modules/glob/dist/commonjs/index.d.ts +97 -0
  48. package/node_modules/glob/dist/commonjs/index.d.ts.map +1 -0
  49. package/node_modules/glob/dist/commonjs/index.js +68 -0
  50. package/node_modules/glob/dist/commonjs/index.js.map +1 -0
  51. package/node_modules/glob/dist/commonjs/index.min.js +4 -0
  52. package/node_modules/glob/dist/commonjs/index.min.js.map +7 -0
  53. package/node_modules/glob/dist/commonjs/package.json +3 -0
  54. package/node_modules/glob/dist/commonjs/pattern.d.ts +76 -0
  55. package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -0
  56. package/node_modules/glob/dist/commonjs/pattern.js +219 -0
  57. package/node_modules/glob/dist/commonjs/pattern.js.map +1 -0
  58. package/node_modules/glob/dist/commonjs/processor.d.ts +59 -0
  59. package/node_modules/glob/dist/commonjs/processor.d.ts.map +1 -0
  60. package/node_modules/glob/dist/commonjs/processor.js +301 -0
  61. package/node_modules/glob/dist/commonjs/processor.js.map +1 -0
  62. package/node_modules/glob/dist/commonjs/walker.d.ts +97 -0
  63. package/node_modules/glob/dist/commonjs/walker.d.ts.map +1 -0
  64. package/node_modules/glob/dist/commonjs/walker.js +387 -0
  65. package/node_modules/glob/dist/commonjs/walker.js.map +1 -0
  66. package/node_modules/glob/dist/esm/glob.d.ts +388 -0
  67. package/node_modules/glob/dist/esm/glob.d.ts.map +1 -0
  68. package/node_modules/glob/dist/esm/glob.js +243 -0
  69. package/node_modules/glob/dist/esm/glob.js.map +1 -0
  70. package/node_modules/glob/dist/esm/has-magic.d.ts +14 -0
  71. package/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -0
  72. package/node_modules/glob/dist/esm/has-magic.js +23 -0
  73. package/node_modules/glob/dist/esm/has-magic.js.map +1 -0
  74. package/node_modules/glob/dist/esm/ignore.d.ts +24 -0
  75. package/node_modules/glob/dist/esm/ignore.d.ts.map +1 -0
  76. package/node_modules/glob/dist/esm/ignore.js +115 -0
  77. package/node_modules/glob/dist/esm/ignore.js.map +1 -0
  78. package/node_modules/glob/dist/esm/index.d.ts +97 -0
  79. package/node_modules/glob/dist/esm/index.d.ts.map +1 -0
  80. package/node_modules/glob/dist/esm/index.js +55 -0
  81. package/node_modules/glob/dist/esm/index.js.map +1 -0
  82. package/node_modules/glob/dist/esm/index.min.js +4 -0
  83. package/node_modules/glob/dist/esm/index.min.js.map +7 -0
  84. package/node_modules/glob/dist/esm/package.json +3 -0
  85. package/node_modules/glob/dist/esm/pattern.d.ts +76 -0
  86. package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -0
  87. package/node_modules/glob/dist/esm/pattern.js +215 -0
  88. package/node_modules/glob/dist/esm/pattern.js.map +1 -0
  89. package/node_modules/glob/dist/esm/processor.d.ts +59 -0
  90. package/node_modules/glob/dist/esm/processor.d.ts.map +1 -0
  91. package/node_modules/glob/dist/esm/processor.js +294 -0
  92. package/node_modules/glob/dist/esm/processor.js.map +1 -0
  93. package/node_modules/glob/dist/esm/walker.d.ts +97 -0
  94. package/node_modules/glob/dist/esm/walker.d.ts.map +1 -0
  95. package/node_modules/glob/dist/esm/walker.js +381 -0
  96. package/node_modules/glob/dist/esm/walker.js.map +1 -0
  97. package/node_modules/glob/node_modules/minimatch/LICENSE.md +55 -0
  98. package/node_modules/glob/node_modules/minimatch/README.md +453 -0
  99. package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
  100. package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
  101. package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  102. package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  103. package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.d.ts +20 -0
  104. package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  105. package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js +591 -0
  106. package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  107. package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
  108. package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
  109. package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
  110. package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  111. package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
  112. package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
  113. package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js +30 -0
  114. package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
  115. package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.d.ts +94 -0
  116. package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  117. package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.js +1029 -0
  118. package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
  119. package/node_modules/glob/node_modules/minimatch/dist/commonjs/package.json +3 -0
  120. package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
  121. package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
  122. package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
  123. package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
  124. package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
  125. package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
  126. package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  127. package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  128. package/node_modules/glob/node_modules/minimatch/dist/esm/ast.d.ts +20 -0
  129. package/node_modules/glob/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
  130. package/node_modules/glob/node_modules/minimatch/dist/esm/ast.js +587 -0
  131. package/node_modules/glob/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  132. package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
  133. package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
  134. package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.js +148 -0
  135. package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  136. package/node_modules/glob/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
  137. package/node_modules/glob/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
  138. package/node_modules/glob/node_modules/minimatch/dist/esm/escape.js +26 -0
  139. package/node_modules/glob/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  140. package/node_modules/glob/node_modules/minimatch/dist/esm/index.d.ts +94 -0
  141. package/node_modules/glob/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
  142. package/node_modules/glob/node_modules/minimatch/dist/esm/index.js +1016 -0
  143. package/node_modules/glob/node_modules/minimatch/dist/esm/index.js.map +1 -0
  144. package/node_modules/glob/node_modules/minimatch/dist/esm/package.json +3 -0
  145. package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
  146. package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
  147. package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.js +34 -0
  148. package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  149. package/node_modules/glob/node_modules/minimatch/package.json +67 -0
  150. package/node_modules/glob/package.json +101 -0
  151. package/node_modules/minipass/LICENSE +15 -0
  152. package/node_modules/minipass/README.md +825 -0
  153. package/node_modules/minipass/dist/commonjs/index.d.ts +549 -0
  154. package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
  155. package/node_modules/minipass/dist/commonjs/index.js +1028 -0
  156. package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
  157. package/node_modules/minipass/dist/commonjs/package.json +3 -0
  158. package/node_modules/minipass/dist/esm/index.d.ts +549 -0
  159. package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
  160. package/node_modules/minipass/dist/esm/index.js +1018 -0
  161. package/node_modules/minipass/dist/esm/index.js.map +1 -0
  162. package/node_modules/minipass/dist/esm/package.json +3 -0
  163. package/node_modules/minipass/package.json +82 -0
  164. package/node_modules/package-json-from-dist/LICENSE.md +63 -0
  165. package/node_modules/package-json-from-dist/README.md +110 -0
  166. package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts +89 -0
  167. package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts.map +1 -0
  168. package/node_modules/package-json-from-dist/dist/commonjs/index.js +134 -0
  169. package/node_modules/package-json-from-dist/dist/commonjs/index.js.map +1 -0
  170. package/node_modules/package-json-from-dist/dist/commonjs/package.json +3 -0
  171. package/node_modules/package-json-from-dist/dist/esm/index.d.ts +89 -0
  172. package/node_modules/package-json-from-dist/dist/esm/index.d.ts.map +1 -0
  173. package/node_modules/package-json-from-dist/dist/esm/index.js +129 -0
  174. package/node_modules/package-json-from-dist/dist/esm/index.js.map +1 -0
  175. package/node_modules/package-json-from-dist/dist/esm/package.json +3 -0
  176. package/node_modules/package-json-from-dist/package.json +68 -0
  177. package/node_modules/path-scurry/LICENSE.md +55 -0
  178. package/node_modules/path-scurry/README.md +636 -0
  179. package/node_modules/path-scurry/dist/commonjs/index.d.ts +1115 -0
  180. package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -0
  181. package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
  182. package/node_modules/path-scurry/dist/commonjs/index.js.map +1 -0
  183. package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
  184. package/node_modules/path-scurry/dist/esm/index.d.ts +1115 -0
  185. package/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -0
  186. package/node_modules/path-scurry/dist/esm/index.js +1983 -0
  187. package/node_modules/path-scurry/dist/esm/index.js.map +1 -0
  188. package/node_modules/path-scurry/dist/esm/package.json +3 -0
  189. package/node_modules/path-scurry/node_modules/lru-cache/LICENSE.md +55 -0
  190. package/node_modules/path-scurry/node_modules/lru-cache/README.md +383 -0
  191. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts +1323 -0
  192. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
  193. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1589 -0
  194. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
  195. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
  196. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
  197. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  198. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts +1323 -0
  199. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
  200. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1585 -0
  201. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js.map +1 -0
  202. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  203. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
  204. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
  205. package/node_modules/path-scurry/node_modules/lru-cache/package.json +101 -0
  206. package/node_modules/path-scurry/package.json +88 -0
  207. package/node_modules/rimraf/LICENSE.md +55 -0
  208. package/node_modules/rimraf/README.md +226 -0
  209. package/node_modules/rimraf/dist/commonjs/default-tmp.d.ts +3 -0
  210. package/node_modules/rimraf/dist/commonjs/default-tmp.d.ts.map +1 -0
  211. package/node_modules/rimraf/dist/commonjs/default-tmp.js +58 -0
  212. package/node_modules/rimraf/dist/commonjs/default-tmp.js.map +1 -0
  213. package/node_modules/rimraf/dist/commonjs/error.d.ts +6 -0
  214. package/node_modules/rimraf/dist/commonjs/error.d.ts.map +1 -0
  215. package/node_modules/rimraf/dist/commonjs/error.js +10 -0
  216. package/node_modules/rimraf/dist/commonjs/error.js.map +1 -0
  217. package/node_modules/rimraf/dist/commonjs/fix-eperm.d.ts +3 -0
  218. package/node_modules/rimraf/dist/commonjs/fix-eperm.d.ts.map +1 -0
  219. package/node_modules/rimraf/dist/commonjs/fix-eperm.js +38 -0
  220. package/node_modules/rimraf/dist/commonjs/fix-eperm.js.map +1 -0
  221. package/node_modules/rimraf/dist/commonjs/fs.d.ts +15 -0
  222. package/node_modules/rimraf/dist/commonjs/fs.d.ts.map +1 -0
  223. package/node_modules/rimraf/dist/commonjs/fs.js +33 -0
  224. package/node_modules/rimraf/dist/commonjs/fs.js.map +1 -0
  225. package/node_modules/rimraf/dist/commonjs/ignore-enoent.d.ts +3 -0
  226. package/node_modules/rimraf/dist/commonjs/ignore-enoent.d.ts.map +1 -0
  227. package/node_modules/rimraf/dist/commonjs/ignore-enoent.js +24 -0
  228. package/node_modules/rimraf/dist/commonjs/ignore-enoent.js.map +1 -0
  229. package/node_modules/rimraf/dist/commonjs/index.d.ts +50 -0
  230. package/node_modules/rimraf/dist/commonjs/index.d.ts.map +1 -0
  231. package/node_modules/rimraf/dist/commonjs/index.js +78 -0
  232. package/node_modules/rimraf/dist/commonjs/index.js.map +1 -0
  233. package/node_modules/rimraf/dist/commonjs/opt-arg.d.ts +34 -0
  234. package/node_modules/rimraf/dist/commonjs/opt-arg.d.ts.map +1 -0
  235. package/node_modules/rimraf/dist/commonjs/opt-arg.js +53 -0
  236. package/node_modules/rimraf/dist/commonjs/opt-arg.js.map +1 -0
  237. package/node_modules/rimraf/dist/commonjs/package.json +3 -0
  238. package/node_modules/rimraf/dist/commonjs/path-arg.d.ts +4 -0
  239. package/node_modules/rimraf/dist/commonjs/path-arg.d.ts.map +1 -0
  240. package/node_modules/rimraf/dist/commonjs/path-arg.js +48 -0
  241. package/node_modules/rimraf/dist/commonjs/path-arg.js.map +1 -0
  242. package/node_modules/rimraf/dist/commonjs/readdir-or-error.d.ts +3 -0
  243. package/node_modules/rimraf/dist/commonjs/readdir-or-error.d.ts.map +1 -0
  244. package/node_modules/rimraf/dist/commonjs/readdir-or-error.js +19 -0
  245. package/node_modules/rimraf/dist/commonjs/readdir-or-error.js.map +1 -0
  246. package/node_modules/rimraf/dist/commonjs/retry-busy.d.ts +8 -0
  247. package/node_modules/rimraf/dist/commonjs/retry-busy.d.ts.map +1 -0
  248. package/node_modules/rimraf/dist/commonjs/retry-busy.js +65 -0
  249. package/node_modules/rimraf/dist/commonjs/retry-busy.js.map +1 -0
  250. package/node_modules/rimraf/dist/commonjs/rimraf-manual.d.ts +3 -0
  251. package/node_modules/rimraf/dist/commonjs/rimraf-manual.d.ts.map +1 -0
  252. package/node_modules/rimraf/dist/commonjs/rimraf-manual.js +8 -0
  253. package/node_modules/rimraf/dist/commonjs/rimraf-manual.js.map +1 -0
  254. package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.d.ts +4 -0
  255. package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.d.ts.map +1 -0
  256. package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.js +138 -0
  257. package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.js.map +1 -0
  258. package/node_modules/rimraf/dist/commonjs/rimraf-native.d.ts +4 -0
  259. package/node_modules/rimraf/dist/commonjs/rimraf-native.d.ts.map +1 -0
  260. package/node_modules/rimraf/dist/commonjs/rimraf-native.js +24 -0
  261. package/node_modules/rimraf/dist/commonjs/rimraf-native.js.map +1 -0
  262. package/node_modules/rimraf/dist/commonjs/rimraf-posix.d.ts +4 -0
  263. package/node_modules/rimraf/dist/commonjs/rimraf-posix.d.ts.map +1 -0
  264. package/node_modules/rimraf/dist/commonjs/rimraf-posix.js +103 -0
  265. package/node_modules/rimraf/dist/commonjs/rimraf-posix.js.map +1 -0
  266. package/node_modules/rimraf/dist/commonjs/rimraf-windows.d.ts +4 -0
  267. package/node_modules/rimraf/dist/commonjs/rimraf-windows.d.ts.map +1 -0
  268. package/node_modules/rimraf/dist/commonjs/rimraf-windows.js +159 -0
  269. package/node_modules/rimraf/dist/commonjs/rimraf-windows.js.map +1 -0
  270. package/node_modules/rimraf/dist/commonjs/use-native.d.ts +4 -0
  271. package/node_modules/rimraf/dist/commonjs/use-native.d.ts.map +1 -0
  272. package/node_modules/rimraf/dist/commonjs/use-native.js +18 -0
  273. package/node_modules/rimraf/dist/commonjs/use-native.js.map +1 -0
  274. package/node_modules/rimraf/dist/esm/bin.d.mts +3 -0
  275. package/node_modules/rimraf/dist/esm/bin.d.mts.map +1 -0
  276. package/node_modules/rimraf/dist/esm/bin.mjs +250 -0
  277. package/node_modules/rimraf/dist/esm/bin.mjs.map +1 -0
  278. package/node_modules/rimraf/dist/esm/default-tmp.d.ts +3 -0
  279. package/node_modules/rimraf/dist/esm/default-tmp.d.ts.map +1 -0
  280. package/node_modules/rimraf/dist/esm/default-tmp.js +55 -0
  281. package/node_modules/rimraf/dist/esm/default-tmp.js.map +1 -0
  282. package/node_modules/rimraf/dist/esm/error.d.ts +6 -0
  283. package/node_modules/rimraf/dist/esm/error.d.ts.map +1 -0
  284. package/node_modules/rimraf/dist/esm/error.js +5 -0
  285. package/node_modules/rimraf/dist/esm/error.js.map +1 -0
  286. package/node_modules/rimraf/dist/esm/fix-eperm.d.ts +3 -0
  287. package/node_modules/rimraf/dist/esm/fix-eperm.d.ts.map +1 -0
  288. package/node_modules/rimraf/dist/esm/fix-eperm.js +33 -0
  289. package/node_modules/rimraf/dist/esm/fix-eperm.js.map +1 -0
  290. package/node_modules/rimraf/dist/esm/fs.d.ts +15 -0
  291. package/node_modules/rimraf/dist/esm/fs.d.ts.map +1 -0
  292. package/node_modules/rimraf/dist/esm/fs.js +18 -0
  293. package/node_modules/rimraf/dist/esm/fs.js.map +1 -0
  294. package/node_modules/rimraf/dist/esm/ignore-enoent.d.ts +3 -0
  295. package/node_modules/rimraf/dist/esm/ignore-enoent.d.ts.map +1 -0
  296. package/node_modules/rimraf/dist/esm/ignore-enoent.js +19 -0
  297. package/node_modules/rimraf/dist/esm/ignore-enoent.js.map +1 -0
  298. package/node_modules/rimraf/dist/esm/index.d.ts +50 -0
  299. package/node_modules/rimraf/dist/esm/index.d.ts.map +1 -0
  300. package/node_modules/rimraf/dist/esm/index.js +70 -0
  301. package/node_modules/rimraf/dist/esm/index.js.map +1 -0
  302. package/node_modules/rimraf/dist/esm/opt-arg.d.ts +34 -0
  303. package/node_modules/rimraf/dist/esm/opt-arg.d.ts.map +1 -0
  304. package/node_modules/rimraf/dist/esm/opt-arg.js +46 -0
  305. package/node_modules/rimraf/dist/esm/opt-arg.js.map +1 -0
  306. package/node_modules/rimraf/dist/esm/package.json +3 -0
  307. package/node_modules/rimraf/dist/esm/path-arg.d.ts +4 -0
  308. package/node_modules/rimraf/dist/esm/path-arg.d.ts.map +1 -0
  309. package/node_modules/rimraf/dist/esm/path-arg.js +46 -0
  310. package/node_modules/rimraf/dist/esm/path-arg.js.map +1 -0
  311. package/node_modules/rimraf/dist/esm/readdir-or-error.d.ts +3 -0
  312. package/node_modules/rimraf/dist/esm/readdir-or-error.d.ts.map +1 -0
  313. package/node_modules/rimraf/dist/esm/readdir-or-error.js +14 -0
  314. package/node_modules/rimraf/dist/esm/readdir-or-error.js.map +1 -0
  315. package/node_modules/rimraf/dist/esm/retry-busy.d.ts +8 -0
  316. package/node_modules/rimraf/dist/esm/retry-busy.d.ts.map +1 -0
  317. package/node_modules/rimraf/dist/esm/retry-busy.js +60 -0
  318. package/node_modules/rimraf/dist/esm/retry-busy.js.map +1 -0
  319. package/node_modules/rimraf/dist/esm/rimraf-manual.d.ts +3 -0
  320. package/node_modules/rimraf/dist/esm/rimraf-manual.d.ts.map +1 -0
  321. package/node_modules/rimraf/dist/esm/rimraf-manual.js +5 -0
  322. package/node_modules/rimraf/dist/esm/rimraf-manual.js.map +1 -0
  323. package/node_modules/rimraf/dist/esm/rimraf-move-remove.d.ts +4 -0
  324. package/node_modules/rimraf/dist/esm/rimraf-move-remove.d.ts.map +1 -0
  325. package/node_modules/rimraf/dist/esm/rimraf-move-remove.js +133 -0
  326. package/node_modules/rimraf/dist/esm/rimraf-move-remove.js.map +1 -0
  327. package/node_modules/rimraf/dist/esm/rimraf-native.d.ts +4 -0
  328. package/node_modules/rimraf/dist/esm/rimraf-native.d.ts.map +1 -0
  329. package/node_modules/rimraf/dist/esm/rimraf-native.js +19 -0
  330. package/node_modules/rimraf/dist/esm/rimraf-native.js.map +1 -0
  331. package/node_modules/rimraf/dist/esm/rimraf-posix.d.ts +4 -0
  332. package/node_modules/rimraf/dist/esm/rimraf-posix.d.ts.map +1 -0
  333. package/node_modules/rimraf/dist/esm/rimraf-posix.js +98 -0
  334. package/node_modules/rimraf/dist/esm/rimraf-posix.js.map +1 -0
  335. package/node_modules/rimraf/dist/esm/rimraf-windows.d.ts +4 -0
  336. package/node_modules/rimraf/dist/esm/rimraf-windows.d.ts.map +1 -0
  337. package/node_modules/rimraf/dist/esm/rimraf-windows.js +154 -0
  338. package/node_modules/rimraf/dist/esm/rimraf-windows.js.map +1 -0
  339. package/node_modules/rimraf/dist/esm/use-native.d.ts +4 -0
  340. package/node_modules/rimraf/dist/esm/use-native.d.ts.map +1 -0
  341. package/node_modules/rimraf/dist/esm/use-native.js +15 -0
  342. package/node_modules/rimraf/dist/esm/use-native.js.map +1 -0
  343. package/node_modules/rimraf/package.json +92 -0
  344. package/package.json +152 -0
  345. package/scripts/install-scanners.js +258 -0
  346. package/scripts/watchdog.js +147 -0
  347. package/src/analyzers/CSSAnalyzer.js +297 -0
  348. package/src/analyzers/ConfigValidator.js +690 -0
  349. package/src/analyzers/ESLintAnalyzer.js +320 -0
  350. package/src/analyzers/JavaScriptAnalyzer.js +261 -0
  351. package/src/analyzers/PrettierFormatter.js +247 -0
  352. package/src/analyzers/PythonAnalyzer.js +283 -0
  353. package/src/analyzers/SecurityAnalyzer.js +729 -0
  354. package/src/analyzers/SparrowAnalyzer.js +341 -0
  355. package/src/analyzers/TypeScriptAnalyzer.js +247 -0
  356. package/src/analyzers/codeCloneDetector/analyzer.js +344 -0
  357. package/src/analyzers/codeCloneDetector/detector.js +250 -0
  358. package/src/analyzers/codeCloneDetector/index.js +192 -0
  359. package/src/analyzers/codeCloneDetector/parser.js +199 -0
  360. package/src/analyzers/codeCloneDetector/reporter.js +148 -0
  361. package/src/analyzers/codeCloneDetector/scanner.js +88 -0
  362. package/src/core/agentPool.js +1957 -0
  363. package/src/core/agentScheduler.js +3212 -0
  364. package/src/core/contextManager.js +709 -0
  365. package/src/core/flowExecutor.js +928 -0
  366. package/src/core/messageProcessor.js +808 -0
  367. package/src/core/orchestrator.js +584 -0
  368. package/src/core/stateManager.js +1500 -0
  369. package/src/index.js +972 -0
  370. package/src/interfaces/cli.js +553 -0
  371. package/src/interfaces/terminal/__tests__/smoke/advancedFeatures.test.js +208 -0
  372. package/src/interfaces/terminal/__tests__/smoke/agentControl.test.js +236 -0
  373. package/src/interfaces/terminal/__tests__/smoke/agents.test.js +138 -0
  374. package/src/interfaces/terminal/__tests__/smoke/components.test.js +137 -0
  375. package/src/interfaces/terminal/__tests__/smoke/connection.test.js +350 -0
  376. package/src/interfaces/terminal/__tests__/smoke/enhancements.test.js +156 -0
  377. package/src/interfaces/terminal/__tests__/smoke/imports.test.js +332 -0
  378. package/src/interfaces/terminal/__tests__/smoke/messages.test.js +256 -0
  379. package/src/interfaces/terminal/__tests__/smoke/tools.test.js +388 -0
  380. package/src/interfaces/terminal/api/apiClient.js +299 -0
  381. package/src/interfaces/terminal/api/messageRouter.js +262 -0
  382. package/src/interfaces/terminal/api/session.js +266 -0
  383. package/src/interfaces/terminal/api/websocket.js +497 -0
  384. package/src/interfaces/terminal/components/AgentCreator.js +705 -0
  385. package/src/interfaces/terminal/components/AgentEditor.js +678 -0
  386. package/src/interfaces/terminal/components/AgentSwitcher.js +330 -0
  387. package/src/interfaces/terminal/components/ErrorBoundary.js +92 -0
  388. package/src/interfaces/terminal/components/ErrorPanel.js +264 -0
  389. package/src/interfaces/terminal/components/Header.js +28 -0
  390. package/src/interfaces/terminal/components/HelpPanel.js +231 -0
  391. package/src/interfaces/terminal/components/InputBox.js +118 -0
  392. package/src/interfaces/terminal/components/Layout.js +603 -0
  393. package/src/interfaces/terminal/components/LoadingSpinner.js +71 -0
  394. package/src/interfaces/terminal/components/MessageList.js +281 -0
  395. package/src/interfaces/terminal/components/MultilineTextInput.js +251 -0
  396. package/src/interfaces/terminal/components/SearchPanel.js +265 -0
  397. package/src/interfaces/terminal/components/SettingsPanel.js +415 -0
  398. package/src/interfaces/terminal/components/StatusBar.js +65 -0
  399. package/src/interfaces/terminal/components/TextInput.js +127 -0
  400. package/src/interfaces/terminal/config/agentEditorConstants.js +227 -0
  401. package/src/interfaces/terminal/config/constants.js +393 -0
  402. package/src/interfaces/terminal/index.js +168 -0
  403. package/src/interfaces/terminal/state/useAgentControl.js +496 -0
  404. package/src/interfaces/terminal/state/useAgents.js +537 -0
  405. package/src/interfaces/terminal/state/useConnection.js +444 -0
  406. package/src/interfaces/terminal/state/useMessages.js +630 -0
  407. package/src/interfaces/terminal/state/useTools.js +554 -0
  408. package/src/interfaces/terminal/utils/debugLogger.js +44 -0
  409. package/src/interfaces/terminal/utils/settingsStorage.js +232 -0
  410. package/src/interfaces/terminal/utils/theme.js +85 -0
  411. package/src/interfaces/webServer.js +5457 -0
  412. package/src/modules/fileExplorer/controller.js +413 -0
  413. package/src/modules/fileExplorer/index.js +37 -0
  414. package/src/modules/fileExplorer/middleware.js +92 -0
  415. package/src/modules/fileExplorer/routes.js +158 -0
  416. package/src/modules/fileExplorer/types.js +44 -0
  417. package/src/services/agentActivityService.js +399 -0
  418. package/src/services/aiService.js +2618 -0
  419. package/src/services/apiKeyManager.js +334 -0
  420. package/src/services/benchmarkService.js +196 -0
  421. package/src/services/budgetService.js +565 -0
  422. package/src/services/contextInjectionService.js +268 -0
  423. package/src/services/conversationCompactionService.js +1103 -0
  424. package/src/services/credentialVault.js +685 -0
  425. package/src/services/errorHandler.js +810 -0
  426. package/src/services/fileAttachmentService.js +547 -0
  427. package/src/services/flowContextService.js +189 -0
  428. package/src/services/memoryService.js +521 -0
  429. package/src/services/modelRouterService.js +365 -0
  430. package/src/services/modelsService.js +323 -0
  431. package/src/services/ollamaService.js +452 -0
  432. package/src/services/portRegistry.js +336 -0
  433. package/src/services/portTracker.js +223 -0
  434. package/src/services/projectDetector.js +404 -0
  435. package/src/services/promptService.js +372 -0
  436. package/src/services/qualityInspector.js +796 -0
  437. package/src/services/scheduleService.js +725 -0
  438. package/src/services/serviceRegistry.js +386 -0
  439. package/src/services/skillsService.js +486 -0
  440. package/src/services/telegramService.js +920 -0
  441. package/src/services/tokenCountingService.js +316 -0
  442. package/src/services/visualEditorBridge.js +1033 -0
  443. package/src/services/visualEditorServer.js +1727 -0
  444. package/src/services/whatsappService.js +663 -0
  445. package/src/tools/__tests__/webTool.e2e.test.js +569 -0
  446. package/src/tools/__tests__/webTool.unit.test.js +195 -0
  447. package/src/tools/agentCommunicationTool.js +1343 -0
  448. package/src/tools/agentDelayTool.js +498 -0
  449. package/src/tools/asyncToolManager.js +604 -0
  450. package/src/tools/baseTool.js +887 -0
  451. package/src/tools/browserTool.js +897 -0
  452. package/src/tools/cloneDetectionTool.js +581 -0
  453. package/src/tools/codeMapTool.js +857 -0
  454. package/src/tools/dependencyResolverTool.js +1212 -0
  455. package/src/tools/docxTool.js +623 -0
  456. package/src/tools/excelTool.js +636 -0
  457. package/src/tools/fileContentReplaceTool.js +840 -0
  458. package/src/tools/fileTreeTool.js +833 -0
  459. package/src/tools/filesystemTool.js +1217 -0
  460. package/src/tools/helpTool.js +198 -0
  461. package/src/tools/imageTool.js +1034 -0
  462. package/src/tools/importAnalyzerTool.js +1056 -0
  463. package/src/tools/jobDoneTool.js +388 -0
  464. package/src/tools/memoryTool.js +554 -0
  465. package/src/tools/pdfTool.js +627 -0
  466. package/src/tools/seekTool.js +883 -0
  467. package/src/tools/skillsTool.js +276 -0
  468. package/src/tools/staticAnalysisTool.js +2146 -0
  469. package/src/tools/taskManagerTool.js +2836 -0
  470. package/src/tools/terminalTool.js +2486 -0
  471. package/src/tools/userPromptTool.js +474 -0
  472. package/src/tools/videoTool.js +1139 -0
  473. package/src/tools/visionTool.js +507 -0
  474. package/src/tools/visualEditorTool.js +1175 -0
  475. package/src/tools/webTool.js +3114 -0
  476. package/src/tools/whatsappTool.js +457 -0
  477. package/src/types/agent.js +519 -0
  478. package/src/types/contextReference.js +972 -0
  479. package/src/types/conversation.js +730 -0
  480. package/src/types/toolCommand.js +747 -0
  481. package/src/utilities/attachmentValidator.js +288 -0
  482. package/src/utilities/browserStealth.js +630 -0
  483. package/src/utilities/configManager.js +618 -0
  484. package/src/utilities/constants.js +870 -0
  485. package/src/utilities/directoryAccessManager.js +566 -0
  486. package/src/utilities/fileProcessor.js +307 -0
  487. package/src/utilities/humanBehavior.js +453 -0
  488. package/src/utilities/jsonRepair.js +242 -0
  489. package/src/utilities/logger.js +436 -0
  490. package/src/utilities/platformUtils.js +255 -0
  491. package/src/utilities/platformUtils.test.js +98 -0
  492. package/src/utilities/stealthConstants.js +377 -0
  493. package/src/utilities/structuredFileValidator.js +699 -0
  494. package/src/utilities/tagParser.js +878 -0
  495. package/src/utilities/toolConstants.js +415 -0
  496. package/src/utilities/userDataDir.js +300 -0
  497. package/web-ui/build/brands/autopilot/favicon.svg +1 -0
  498. package/web-ui/build/brands/autopilot/logo.webp +0 -0
  499. package/web-ui/build/brands/onbuzz/favicon.svg +1 -0
  500. package/web-ui/build/brands/onbuzz/logo-text.webp +0 -0
  501. package/web-ui/build/brands/onbuzz/logo.webp +0 -0
  502. package/web-ui/build/index.html +15 -0
  503. package/web-ui/build/logo.png +0 -0
  504. package/web-ui/build/logo2.png +0 -0
  505. package/web-ui/build/static/index-SmQFfvBs.js +746 -0
  506. package/web-ui/build/static/index-V2ySwjHp.css +1 -0
@@ -0,0 +1,725 @@
1
+ /**
2
+ * ScheduleService - Manages scheduled/recurring tasks
3
+ *
4
+ * Purpose:
5
+ * - Parse cron expressions and calculate next run times
6
+ * - Persist schedules to disk (survives restarts)
7
+ * - Check and trigger due schedules each tick
8
+ * - Push prompts to agents (switching to agent mode) or execute flows
9
+ * - Sync with OS scheduler (crontab/schtasks) for execution when system is down
10
+ * - Track execution history
11
+ */
12
+
13
+ import { promises as fs } from 'fs';
14
+ import path from 'path';
15
+ import { execSync } from 'child_process';
16
+ import { getUserDataDir } from '../utilities/userDataDir.js';
17
+
18
+ // ========================
19
+ // Lightweight cron parser (no external dependency)
20
+ // Supports: minute hour dayOfMonth month dayOfWeek
21
+ // Fields: 0-59 0-23 1-31 1-12 0-6 (Sun=0)
22
+ // Supports: *, */n, n, n-m, n,m,o
23
+ // ========================
24
+
25
+ function parseCronField(field, min, max) {
26
+ const values = new Set();
27
+
28
+ for (const part of field.split(',')) {
29
+ if (part === '*') {
30
+ for (let i = min; i <= max; i++) values.add(i);
31
+ } else if (part.includes('/')) {
32
+ const [range, stepStr] = part.split('/');
33
+ const step = parseInt(stepStr, 10);
34
+ let start = min;
35
+ let end = max;
36
+ if (range !== '*') {
37
+ if (range.includes('-')) {
38
+ [start, end] = range.split('-').map(Number);
39
+ } else {
40
+ start = parseInt(range, 10);
41
+ }
42
+ }
43
+ for (let i = start; i <= end; i += step) values.add(i);
44
+ } else if (part.includes('-')) {
45
+ const [a, b] = part.split('-').map(Number);
46
+ for (let i = a; i <= b; i++) values.add(i);
47
+ } else {
48
+ values.add(parseInt(part, 10));
49
+ }
50
+ }
51
+
52
+ return values;
53
+ }
54
+
55
+ function parseCron(expression) {
56
+ const parts = expression.trim().split(/\s+/);
57
+ if (parts.length !== 5) {
58
+ throw new Error(`Invalid cron expression: "${expression}" — expected 5 fields (minute hour dayOfMonth month dayOfWeek)`);
59
+ }
60
+
61
+ return {
62
+ minutes: parseCronField(parts[0], 0, 59),
63
+ hours: parseCronField(parts[1], 0, 23),
64
+ daysOfMonth: parseCronField(parts[2], 1, 31),
65
+ months: parseCronField(parts[3], 1, 12),
66
+ daysOfWeek: parseCronField(parts[4], 0, 6)
67
+ };
68
+ }
69
+
70
+ function cronMatchesDate(parsed, date) {
71
+ return (
72
+ parsed.minutes.has(date.getMinutes()) &&
73
+ parsed.hours.has(date.getHours()) &&
74
+ parsed.daysOfMonth.has(date.getDate()) &&
75
+ parsed.months.has(date.getMonth() + 1) &&
76
+ parsed.daysOfWeek.has(date.getDay())
77
+ );
78
+ }
79
+
80
+ function getNextCronDate(parsed, after = new Date()) {
81
+ // Walk forward minute by minute (max 2 years)
82
+ const limit = 2 * 365 * 24 * 60;
83
+ const d = new Date(after);
84
+ d.setSeconds(0, 0);
85
+ d.setMinutes(d.getMinutes() + 1);
86
+
87
+ for (let i = 0; i < limit; i++) {
88
+ if (cronMatchesDate(parsed, d)) return new Date(d);
89
+ d.setMinutes(d.getMinutes() + 1);
90
+ }
91
+
92
+ return null;
93
+ }
94
+
95
+ // ========================
96
+ // Predefined presets for user-friendly schedule creation
97
+ // ========================
98
+
99
+ const CRON_PRESETS = {
100
+ 'every-minute': '* * * * *',
101
+ 'every-5-minutes': '*/5 * * * *',
102
+ 'every-15-minutes': '*/15 * * * *',
103
+ 'every-30-minutes': '*/30 * * * *',
104
+ 'every-hour': '0 * * * *',
105
+ 'every-6-hours': '0 */6 * * *',
106
+ 'every-12-hours': '0 */12 * * *',
107
+ 'daily': '0 9 * * *',
108
+ 'daily-morning': '0 8 * * *',
109
+ 'daily-evening': '0 18 * * *',
110
+ 'weekdays': '0 9 * * 1-5',
111
+ 'weekends': '0 10 * * 0,6',
112
+ 'weekly-monday': '0 9 * * 1',
113
+ 'monthly': '0 9 1 * *'
114
+ };
115
+
116
+ class ScheduleService {
117
+ constructor(logger) {
118
+ this.logger = logger;
119
+ this.schedules = new Map(); // id → schedule object
120
+ this.configPath = path.join(getUserDataDir(), 'schedules.json');
121
+ this.checkIntervalMs = 30000; // Check every 30 seconds
122
+ this.checkTimer = null;
123
+
124
+ // Dependencies (injected)
125
+ this.agentPool = null;
126
+ this.messageProcessor = null;
127
+ this.flowExecutor = null;
128
+ this.webSocketManager = null;
129
+ this.orchestrator = null;
130
+ }
131
+
132
+ // ========================
133
+ // Dependency injection
134
+ // ========================
135
+
136
+ setAgentPool(agentPool) { this.agentPool = agentPool; }
137
+ setMessageProcessor(messageProcessor) { this.messageProcessor = messageProcessor; }
138
+ setFlowExecutor(flowExecutor) { this.flowExecutor = flowExecutor; }
139
+ setWebSocketManager(wsManager) { this.webSocketManager = wsManager; }
140
+ setOrchestrator(orchestrator) { this.orchestrator = orchestrator; }
141
+
142
+ // ========================
143
+ // Lifecycle
144
+ // ========================
145
+
146
+ async initialize() {
147
+ await this._loadSchedules();
148
+ this.logger.info('ScheduleService initialized', { scheduleCount: this.schedules.size });
149
+ }
150
+
151
+ start() {
152
+ if (this.checkTimer) return;
153
+
154
+ this.checkTimer = setInterval(() => {
155
+ this._tick().catch(err =>
156
+ this.logger.error('Schedule tick error', { error: err.message })
157
+ );
158
+ }, this.checkIntervalMs);
159
+
160
+ this.logger.info('ScheduleService started', { intervalMs: this.checkIntervalMs });
161
+
162
+ // Run an immediate check for any missed schedules
163
+ this._tick().catch(err =>
164
+ this.logger.error('Initial schedule tick error', { error: err.message })
165
+ );
166
+
167
+ // Sync all schedules to OS scheduler (non-blocking)
168
+ this.syncAllToOS().catch(err =>
169
+ this.logger.warn('Failed to sync schedules to OS on startup', { error: err.message })
170
+ );
171
+ }
172
+
173
+ stop() {
174
+ if (this.checkTimer) {
175
+ clearInterval(this.checkTimer);
176
+ this.checkTimer = null;
177
+ this.logger.info('ScheduleService stopped');
178
+ }
179
+ }
180
+
181
+ // ========================
182
+ // CRUD
183
+ // ========================
184
+
185
+ async createSchedule(config) {
186
+ const {
187
+ name,
188
+ prompt,
189
+ targetType, // 'agent' or 'flow'
190
+ targetId, // agent ID or flow ID
191
+ cronExpression, // raw cron or preset name
192
+ enabled = true,
193
+ description = '',
194
+ startDate = null, // ISO date string — schedule starts after this date
195
+ endDate = null, // ISO date string — schedule stops after this date
196
+ maxRuns = null, // number — auto-disable after N executions (null = unlimited)
197
+ runOnce = false // boolean — run once then auto-disable
198
+ } = config;
199
+
200
+ if (!name) throw new Error('Schedule name is required');
201
+ if (!prompt) throw new Error('Prompt is required');
202
+ if (!targetType || !['agent', 'flow'].includes(targetType)) {
203
+ throw new Error('targetType must be "agent" or "flow"');
204
+ }
205
+ if (!targetId) throw new Error('targetId is required');
206
+ if (!cronExpression) throw new Error('cronExpression is required');
207
+
208
+ // Resolve preset or validate cron
209
+ const resolvedCron = CRON_PRESETS[cronExpression] || cronExpression;
210
+ const parsed = parseCron(resolvedCron); // throws if invalid
211
+ const nextRun = getNextCronDate(parsed);
212
+
213
+ const id = `schedule-${Date.now()}-${Math.random().toString(36).substr(2, 6)}`;
214
+
215
+ const schedule = {
216
+ id,
217
+ name,
218
+ description,
219
+ prompt,
220
+ targetType,
221
+ targetId,
222
+ cronExpression: resolvedCron,
223
+ cronPreset: CRON_PRESETS[cronExpression] ? cronExpression : null,
224
+ enabled,
225
+ startDate: startDate || null,
226
+ endDate: endDate || null,
227
+ maxRuns: maxRuns != null ? parseInt(maxRuns) : null,
228
+ runOnce: !!runOnce,
229
+ nextRun: nextRun ? nextRun.toISOString() : null,
230
+ lastRun: null,
231
+ lastRunStatus: null,
232
+ runCount: 0,
233
+ createdAt: new Date().toISOString(),
234
+ updatedAt: new Date().toISOString()
235
+ };
236
+
237
+ this.schedules.set(id, schedule);
238
+ await this._saveSchedules();
239
+
240
+ // Sync to OS scheduler (non-blocking, non-fatal)
241
+ this._syncToOS(schedule).catch(() => {});
242
+
243
+ this._broadcast('schedule_created', schedule);
244
+ this.logger.info('Schedule created', { id, name, cron: resolvedCron, targetType, targetId });
245
+
246
+ return schedule;
247
+ }
248
+
249
+ async updateSchedule(id, updates) {
250
+ const schedule = this.schedules.get(id);
251
+ if (!schedule) throw new Error(`Schedule not found: ${id}`);
252
+
253
+ // If cron changed, reparse and recalculate next run
254
+ if (updates.cronExpression) {
255
+ const resolvedCron = CRON_PRESETS[updates.cronExpression] || updates.cronExpression;
256
+ parseCron(resolvedCron); // validate
257
+ updates.cronExpression = resolvedCron;
258
+ updates.cronPreset = CRON_PRESETS[updates.cronExpression] ? updates.cronExpression : null;
259
+ const parsed = parseCron(resolvedCron);
260
+ updates.nextRun = getNextCronDate(parsed)?.toISOString() || null;
261
+ }
262
+
263
+ // If re-enabled, recalculate next run
264
+ if (updates.enabled === true && !schedule.enabled) {
265
+ const parsed = parseCron(updates.cronExpression || schedule.cronExpression);
266
+ updates.nextRun = getNextCronDate(parsed)?.toISOString() || null;
267
+ }
268
+
269
+ const allowedFields = ['name', 'description', 'prompt', 'targetType', 'targetId', 'cronExpression', 'cronPreset', 'enabled', 'nextRun'];
270
+ for (const key of allowedFields) {
271
+ if (updates[key] !== undefined) {
272
+ schedule[key] = updates[key];
273
+ }
274
+ }
275
+ schedule.updatedAt = new Date().toISOString();
276
+
277
+ await this._saveSchedules();
278
+
279
+ // Sync to OS scheduler (non-blocking, non-fatal)
280
+ this._syncToOS(schedule).catch(() => {});
281
+
282
+ this._broadcast('schedule_updated', schedule);
283
+ this.logger.info('Schedule updated', { id, updates: Object.keys(updates) });
284
+
285
+ return schedule;
286
+ }
287
+
288
+ async deleteSchedule(id) {
289
+ if (!this.schedules.has(id)) throw new Error(`Schedule not found: ${id}`);
290
+
291
+ // Remove from OS scheduler first
292
+ this._removeFromOS(id).catch(() => {});
293
+
294
+ this.schedules.delete(id);
295
+ await this._saveSchedules();
296
+
297
+ this._broadcast('schedule_deleted', { id });
298
+ this.logger.info('Schedule deleted', { id });
299
+ }
300
+
301
+ getSchedule(id) {
302
+ return this.schedules.get(id) || null;
303
+ }
304
+
305
+ listSchedules() {
306
+ return Array.from(this.schedules.values()).sort((a, b) =>
307
+ new Date(b.createdAt) - new Date(a.createdAt)
308
+ );
309
+ }
310
+
311
+ getPresets() {
312
+ return { ...CRON_PRESETS };
313
+ }
314
+
315
+ // ========================
316
+ // Tick — check and fire due schedules
317
+ // ========================
318
+
319
+ async _tick() {
320
+ const now = new Date();
321
+
322
+ for (const schedule of this.schedules.values()) {
323
+ if (!schedule.enabled || !schedule.nextRun) continue;
324
+
325
+ // Check if schedule has expired (endDate passed)
326
+ if (schedule.endDate && now > new Date(schedule.endDate)) {
327
+ schedule.enabled = false;
328
+ schedule.nextRun = null;
329
+ schedule.updatedAt = now.toISOString();
330
+ this._broadcast('schedule_updated', schedule);
331
+ this.logger.info('Schedule expired (end date reached)', { id: schedule.id, name: schedule.name });
332
+ continue;
333
+ }
334
+
335
+ // Check if start date hasn't arrived yet
336
+ if (schedule.startDate && now < new Date(schedule.startDate)) {
337
+ continue;
338
+ }
339
+
340
+ const nextRun = new Date(schedule.nextRun);
341
+ if (now >= nextRun) {
342
+ // Fire!
343
+ await this._executeSchedule(schedule);
344
+
345
+ schedule.lastRun = now.toISOString();
346
+ schedule.runCount++;
347
+ schedule.updatedAt = now.toISOString();
348
+
349
+ // Check if schedule should auto-disable (runOnce or maxRuns reached)
350
+ if (schedule.runOnce || (schedule.maxRuns != null && schedule.runCount >= schedule.maxRuns)) {
351
+ schedule.enabled = false;
352
+ schedule.nextRun = null;
353
+ this._broadcast('schedule_updated', schedule);
354
+ this.logger.info('Schedule auto-disabled', {
355
+ id: schedule.id, name: schedule.name,
356
+ reason: schedule.runOnce ? 'run-once' : `maxRuns (${schedule.maxRuns}) reached`
357
+ });
358
+ } else {
359
+ // Calculate next run
360
+ const parsed = parseCron(schedule.cronExpression);
361
+ const next = getNextCronDate(parsed, now);
362
+ schedule.nextRun = next ? next.toISOString() : null;
363
+ }
364
+ }
365
+ }
366
+
367
+ await this._saveSchedules();
368
+ }
369
+
370
+ async _executeSchedule(schedule) {
371
+ this.logger.info('Executing scheduled task', {
372
+ id: schedule.id,
373
+ name: schedule.name,
374
+ targetType: schedule.targetType,
375
+ targetId: schedule.targetId
376
+ });
377
+
378
+ this._broadcast('schedule_triggered', {
379
+ id: schedule.id,
380
+ name: schedule.name,
381
+ targetType: schedule.targetType,
382
+ targetId: schedule.targetId,
383
+ triggeredAt: new Date().toISOString()
384
+ });
385
+
386
+ try {
387
+ if (schedule.targetType === 'agent') {
388
+ await this._executeAgentSchedule(schedule);
389
+ schedule.lastRunStatus = 'success';
390
+ } else if (schedule.targetType === 'flow') {
391
+ await this._executeFlowSchedule(schedule);
392
+ schedule.lastRunStatus = 'success';
393
+ }
394
+ } catch (error) {
395
+ schedule.lastRunStatus = 'error';
396
+ schedule.lastRunError = error.message;
397
+ this.logger.error('Scheduled task execution failed', {
398
+ id: schedule.id,
399
+ error: error.message
400
+ });
401
+ this._broadcast('schedule_error', {
402
+ id: schedule.id,
403
+ name: schedule.name,
404
+ error: error.message
405
+ });
406
+ }
407
+ }
408
+
409
+ async _executeAgentSchedule(schedule) {
410
+ if (!this.agentPool) throw new Error('AgentPool not available');
411
+
412
+ const agent = await this.agentPool.getAgent(schedule.targetId);
413
+ if (!agent) throw new Error(`Target agent not found: ${schedule.targetId}`);
414
+
415
+ // Switch agent to agent mode (autonomous)
416
+ const { AGENT_MODES } = await import('../utilities/constants.js');
417
+
418
+ // Get a session ID — use the first WebSocket connection or a synthetic one
419
+ let sessionId = `schedule-${schedule.id}-${Date.now()}`;
420
+ if (this.webSocketManager?.connections) {
421
+ for (const conn of this.webSocketManager.connections.values()) {
422
+ if (conn.sessionId) {
423
+ sessionId = conn.sessionId;
424
+ break;
425
+ }
426
+ }
427
+ }
428
+
429
+ // Switch to agent mode
430
+ await this.agentPool.updateAgent(schedule.targetId, {
431
+ mode: AGENT_MODES.AGENT,
432
+ sessionId
433
+ });
434
+
435
+ // Push the prompt as a user message
436
+ await this.agentPool.addUserMessage(schedule.targetId, {
437
+ role: 'user',
438
+ content: `[Scheduled Task: ${schedule.name}]\n\n${schedule.prompt}`,
439
+ timestamp: new Date().toISOString(),
440
+ source: 'schedule',
441
+ scheduleId: schedule.id
442
+ });
443
+
444
+ this.logger.info('Prompt pushed to agent via schedule', {
445
+ scheduleId: schedule.id,
446
+ agentId: schedule.targetId,
447
+ agentName: agent.name
448
+ });
449
+ }
450
+
451
+ async _executeFlowSchedule(schedule) {
452
+ if (!this.flowExecutor) throw new Error('FlowExecutor not available');
453
+
454
+ let sessionId = `schedule-${schedule.id}-${Date.now()}`;
455
+ if (this.webSocketManager?.connections) {
456
+ for (const conn of this.webSocketManager.connections.values()) {
457
+ if (conn.sessionId) {
458
+ sessionId = conn.sessionId;
459
+ break;
460
+ }
461
+ }
462
+ }
463
+
464
+ await this.flowExecutor.executeFlow(
465
+ schedule.targetId,
466
+ { userInput: schedule.prompt, source: 'schedule', scheduleId: schedule.id },
467
+ sessionId
468
+ );
469
+
470
+ this.logger.info('Flow executed via schedule', {
471
+ scheduleId: schedule.id,
472
+ flowId: schedule.targetId
473
+ });
474
+ }
475
+
476
+ // ========================
477
+ // Persistence
478
+ // ========================
479
+
480
+ async _loadSchedules() {
481
+ try {
482
+ const data = await fs.readFile(this.configPath, 'utf-8');
483
+ const arr = JSON.parse(data);
484
+ this.schedules.clear();
485
+ for (const s of arr) {
486
+ this.schedules.set(s.id, s);
487
+ }
488
+ this.logger.info('Schedules loaded from disk', { count: arr.length });
489
+ } catch (err) {
490
+ if (err.code !== 'ENOENT') {
491
+ this.logger.warn('Failed to load schedules', { error: err.message });
492
+ }
493
+ // First run or corrupted — start fresh
494
+ }
495
+ }
496
+
497
+ async _saveSchedules() {
498
+ try {
499
+ const dir = path.dirname(this.configPath);
500
+ await fs.mkdir(dir, { recursive: true });
501
+ const arr = Array.from(this.schedules.values());
502
+ await fs.writeFile(this.configPath, JSON.stringify(arr, null, 2), 'utf-8');
503
+ } catch (err) {
504
+ this.logger.error('Failed to save schedules', { error: err.message });
505
+ }
506
+ }
507
+
508
+ // ========================
509
+ // WebSocket broadcasting
510
+ // ========================
511
+
512
+ _broadcast(type, data) {
513
+ if (this.webSocketManager?.broadcast) {
514
+ this.webSocketManager.broadcast({ type, ...data });
515
+ }
516
+ }
517
+
518
+ // ========================
519
+ // OS Scheduler Sync
520
+ // Registers/unregisters cron jobs (Linux/macOS) or schtasks (Windows)
521
+ // so schedules fire even when Loxia is shut down.
522
+ // ========================
523
+
524
+ /**
525
+ * Find the loxia CLI binary path
526
+ */
527
+ _findLoxiaBin() {
528
+ try {
529
+ // Check if installed globally
530
+ const which = process.platform === 'win32' ? 'where loxia' : 'which loxia';
531
+ return execSync(which, { encoding: 'utf-8' }).trim().split('\n')[0];
532
+ } catch {
533
+ // Fallback to local bin
534
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
535
+ const localBin = path.resolve(__dirname, '../../bin/cli.js');
536
+ return `node "${localBin}"`;
537
+ }
538
+ }
539
+
540
+ /**
541
+ * Sync a single schedule to the OS scheduler.
542
+ * Called after create/update.
543
+ */
544
+ async _syncToOS(schedule) {
545
+ if (!schedule.enabled) {
546
+ await this._removeFromOS(schedule.id);
547
+ return;
548
+ }
549
+
550
+ try {
551
+ const loxiaBin = this._findLoxiaBin();
552
+ const command = `${loxiaBin} trigger-schedule ${schedule.id}`;
553
+
554
+ if (process.platform === 'win32') {
555
+ await this._syncToWindows(schedule, command);
556
+ } else {
557
+ await this._syncToCrontab(schedule, command);
558
+ }
559
+ } catch (err) {
560
+ // Non-fatal — internal scheduler still works as fallback
561
+ this.logger.warn('Failed to sync schedule to OS scheduler', {
562
+ id: schedule.id,
563
+ error: err.message
564
+ });
565
+ }
566
+ }
567
+
568
+ /**
569
+ * Remove a schedule from the OS scheduler.
570
+ * Called after delete or disable.
571
+ */
572
+ async _removeFromOS(scheduleId) {
573
+ try {
574
+ if (process.platform === 'win32') {
575
+ this._removeFromWindows(scheduleId);
576
+ } else {
577
+ this._removeFromCrontab(scheduleId);
578
+ }
579
+ } catch (err) {
580
+ this.logger.warn('Failed to remove schedule from OS scheduler', {
581
+ id: scheduleId,
582
+ error: err.message
583
+ });
584
+ }
585
+ }
586
+
587
+ /**
588
+ * Sync all enabled schedules to OS. Called on startup.
589
+ */
590
+ async syncAllToOS() {
591
+ for (const schedule of this.schedules.values()) {
592
+ await this._syncToOS(schedule);
593
+ }
594
+ this.logger.info('Synced all schedules to OS scheduler');
595
+ }
596
+
597
+ // --- Linux/macOS: crontab ---
598
+
599
+ _syncToCrontab(schedule, command) {
600
+ const tag = `# loxia-schedule:${schedule.id}`;
601
+
602
+ // Read current crontab
603
+ let existing = '';
604
+ try {
605
+ existing = execSync('crontab -l 2>/dev/null', { encoding: 'utf-8' });
606
+ } catch {
607
+ // No crontab yet
608
+ }
609
+
610
+ // Remove old entry for this schedule
611
+ const lines = existing.split('\n').filter(l => !l.includes(`loxia-schedule:${schedule.id}`));
612
+
613
+ // Add new entry
614
+ lines.push(`${schedule.cronExpression} ${command} ${tag}`);
615
+
616
+ // Write back
617
+ const newCrontab = lines.filter(l => l.trim() !== '').join('\n') + '\n';
618
+ execSync('crontab -', { input: newCrontab, encoding: 'utf-8' });
619
+
620
+ this.logger.info('Synced schedule to crontab', { id: schedule.id, cron: schedule.cronExpression });
621
+ }
622
+
623
+ _removeFromCrontab(scheduleId) {
624
+ let existing = '';
625
+ try {
626
+ existing = execSync('crontab -l 2>/dev/null', { encoding: 'utf-8' });
627
+ } catch {
628
+ return; // No crontab
629
+ }
630
+
631
+ const lines = existing.split('\n').filter(l => !l.includes(`loxia-schedule:${scheduleId}`));
632
+ const newCrontab = lines.filter(l => l.trim() !== '').join('\n') + '\n';
633
+ execSync('crontab -', { input: newCrontab, encoding: 'utf-8' });
634
+ }
635
+
636
+ // --- Windows: schtasks ---
637
+
638
+ _syncToWindows(schedule, command) {
639
+ const taskName = `LoxiaSchedule_${schedule.id}`;
640
+
641
+ // Remove existing task if any
642
+ try {
643
+ execSync(`schtasks /Delete /TN "${taskName}" /F 2>nul`, { encoding: 'utf-8' });
644
+ } catch {
645
+ // Task may not exist
646
+ }
647
+
648
+ // schtasks doesn't support cron directly — we map common patterns
649
+ // For complex crons, we rely on the internal scheduler as fallback
650
+ const scArgs = this._cronToSchtasksArgs(schedule.cronExpression);
651
+ if (!scArgs) {
652
+ this.logger.warn('Complex cron not supported by Windows Task Scheduler, using internal scheduler only', {
653
+ id: schedule.id,
654
+ cron: schedule.cronExpression
655
+ });
656
+ return;
657
+ }
658
+
659
+ execSync(
660
+ `schtasks /Create /TN "${taskName}" /TR "${command}" ${scArgs} /F`,
661
+ { encoding: 'utf-8' }
662
+ );
663
+
664
+ this.logger.info('Synced schedule to Windows Task Scheduler', { id: schedule.id, taskName });
665
+ }
666
+
667
+ _removeFromWindows(scheduleId) {
668
+ const taskName = `LoxiaSchedule_${scheduleId}`;
669
+ try {
670
+ execSync(`schtasks /Delete /TN "${taskName}" /F 2>nul`, { encoding: 'utf-8' });
671
+ } catch {
672
+ // Task may not exist
673
+ }
674
+ }
675
+
676
+ /**
677
+ * Convert simple cron patterns to schtasks /SC arguments.
678
+ * Returns null for complex patterns that schtasks can't express.
679
+ */
680
+ _cronToSchtasksArgs(cron) {
681
+ const parts = cron.trim().split(/\s+/);
682
+ const [min, hour, dom, mon, dow] = parts;
683
+
684
+ // Every N minutes: */N * * * *
685
+ if (min.startsWith('*/') && hour === '*' && dom === '*' && mon === '*' && dow === '*') {
686
+ const n = parseInt(min.slice(2), 10);
687
+ return `/SC MINUTE /MO ${n}`;
688
+ }
689
+
690
+ // Every hour at minute M: M * * * *
691
+ if (/^\d+$/.test(min) && hour === '*' && dom === '*' && mon === '*' && dow === '*') {
692
+ return `/SC HOURLY /ST 00:${min.padStart(2, '0')}`;
693
+ }
694
+
695
+ // Daily at H:M: M H * * *
696
+ if (/^\d+$/.test(min) && /^\d+$/.test(hour) && dom === '*' && mon === '*' && dow === '*') {
697
+ return `/SC DAILY /ST ${hour.padStart(2, '0')}:${min.padStart(2, '0')}`;
698
+ }
699
+
700
+ // Weekly on specific days: M H * * D
701
+ if (/^\d+$/.test(min) && /^\d+$/.test(hour) && dom === '*' && mon === '*' && /^[\d,-]+$/.test(dow)) {
702
+ const dayMap = { 0: 'SUN', 1: 'MON', 2: 'TUE', 3: 'WED', 4: 'THU', 5: 'FRI', 6: 'SAT' };
703
+ const days = dow.split(',').flatMap(part => {
704
+ if (part.includes('-')) {
705
+ const [a, b] = part.split('-').map(Number);
706
+ const result = [];
707
+ for (let i = a; i <= b; i++) result.push(dayMap[i] || '');
708
+ return result;
709
+ }
710
+ return [dayMap[parseInt(part, 10)] || ''];
711
+ }).filter(Boolean).join(',');
712
+ if (days) return `/SC WEEKLY /D ${days} /ST ${hour.padStart(2, '0')}:${min.padStart(2, '0')}`;
713
+ }
714
+
715
+ // Monthly on specific day: M H D * *
716
+ if (/^\d+$/.test(min) && /^\d+$/.test(hour) && /^\d+$/.test(dom) && mon === '*' && dow === '*') {
717
+ return `/SC MONTHLY /D ${dom} /ST ${hour.padStart(2, '0')}:${min.padStart(2, '0')}`;
718
+ }
719
+
720
+ return null; // Complex pattern — fallback to internal scheduler
721
+ }
722
+ }
723
+
724
+ export default ScheduleService;
725
+ export { CRON_PRESETS, parseCron, cronMatchesDate, getNextCronDate };