upfynai-code 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/README.md +123 -88
  2. package/bin/cli.js +63 -0
  3. package/package.json +48 -106
  4. package/src/auth.js +115 -0
  5. package/src/config.js +33 -0
  6. package/src/connect.js +314 -0
  7. package/src/launch.js +54 -0
  8. package/src/mcp.js +57 -0
  9. package/src/server.js +54 -0
  10. package/client/dist/api-docs.html +0 -879
  11. package/client/dist/assets/AppContent-C0CyP3g5.js +0 -513
  12. package/client/dist/assets/CanvasPanel-0u9QR7U-.js +0 -34
  13. package/client/dist/assets/CanvasPanel-WhZulBJw.css +0 -1
  14. package/client/dist/assets/DashboardPanel-Dgqw1yZk.js +0 -1
  15. package/client/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  16. package/client/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  17. package/client/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  18. package/client/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  19. package/client/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  20. package/client/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  21. package/client/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  22. package/client/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  23. package/client/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  24. package/client/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  25. package/client/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  26. package/client/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  27. package/client/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  28. package/client/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  29. package/client/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  30. package/client/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  31. package/client/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  32. package/client/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  33. package/client/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  34. package/client/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  35. package/client/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  36. package/client/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  37. package/client/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  38. package/client/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  39. package/client/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  40. package/client/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  41. package/client/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  42. package/client/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  43. package/client/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  44. package/client/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  45. package/client/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  46. package/client/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  47. package/client/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  48. package/client/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  49. package/client/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  50. package/client/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  51. package/client/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  52. package/client/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  53. package/client/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  54. package/client/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  55. package/client/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  56. package/client/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  57. package/client/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  58. package/client/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  59. package/client/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  60. package/client/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  61. package/client/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  62. package/client/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  63. package/client/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  64. package/client/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  65. package/client/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  66. package/client/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  67. package/client/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  68. package/client/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  69. package/client/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  70. package/client/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  71. package/client/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  72. package/client/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  73. package/client/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  74. package/client/dist/assets/LoginModal-CZDEzqjK.js +0 -19
  75. package/client/dist/assets/MarkdownPreview-CYdvwJaV.js +0 -1
  76. package/client/dist/assets/Onboarding-DR6NZ4Vz.js +0 -1
  77. package/client/dist/assets/SetupForm-D49gtWY4.js +0 -1
  78. package/client/dist/assets/Tableau10-B-NsZVaP.js +0 -1
  79. package/client/dist/assets/WorkflowsPanel-CqlbEJA_.js +0 -1
  80. package/client/dist/assets/_commonjs-dynamic-modules-TDtrdbi3.js +0 -1
  81. package/client/dist/assets/ar-SA-G6X2FPQ2-BWqa1yBH.js +0 -10
  82. package/client/dist/assets/arc-BegSKqEW.js +0 -1
  83. package/client/dist/assets/array-BKyUJesY.js +0 -1
  84. package/client/dist/assets/az-AZ-76LH7QW2-DrVlbZDP.js +0 -1
  85. package/client/dist/assets/bg-BG-XCXSNQG7-DdunjBgT.js +0 -5
  86. package/client/dist/assets/blockDiagram-38ab4fdb-BKMbwGHu.js +0 -118
  87. package/client/dist/assets/bn-BD-2XOGV67Q-_7DtmvwO.js +0 -5
  88. package/client/dist/assets/c4Diagram-3d4e48cf-hJuiHhSn.js +0 -10
  89. package/client/dist/assets/ca-ES-6MX7JW3Y-BFIrmojG.js +0 -8
  90. package/client/dist/assets/channel-Bur-rRTp.js +0 -1
  91. package/client/dist/assets/classDiagram-70f12bd4-BjiAf9cM.js +0 -2
  92. package/client/dist/assets/classDiagram-v2-f2320105-pwBewejc.js +0 -2
  93. package/client/dist/assets/clone-BtqXeoBJ.js +0 -1
  94. package/client/dist/assets/createText-2e5e7dd3-Dq_acOWe.js +0 -5
  95. package/client/dist/assets/cs-CZ-2BRQDIVT-B-x4F6TJ.js +0 -11
  96. package/client/dist/assets/da-DK-5WZEPLOC-Btlc8Dgn.js +0 -5
  97. package/client/dist/assets/de-DE-XR44H4JA-BVu3ZIoD.js +0 -8
  98. package/client/dist/assets/directory-open-01563666-DWU9wJ6I.js +0 -1
  99. package/client/dist/assets/directory-open-4ed118d0-CunoC1EB.js +0 -1
  100. package/client/dist/assets/edges-e0da2a9e-DH0wVTXR.js +0 -4
  101. package/client/dist/assets/el-GR-BZB4AONW-h2ll8_ZC.js +0 -10
  102. package/client/dist/assets/erDiagram-9861fffd-BYezLIR7.js +0 -51
  103. package/client/dist/assets/es-ES-U4NZUMDT-Cveiulwt.js +0 -9
  104. package/client/dist/assets/eu-ES-A7QVB2H4-DQluL2PY.js +0 -11
  105. package/client/dist/assets/fa-IR-HGAKTJCU-BJtcMBSv.js +0 -8
  106. package/client/dist/assets/fi-FI-Z5N7JZ37-D8NfbVXV.js +0 -6
  107. package/client/dist/assets/file-open-002ab408-DIuFHtCF.js +0 -1
  108. package/client/dist/assets/file-open-7c801643-684qeFg4.js +0 -1
  109. package/client/dist/assets/file-save-3189631c-C1wFhQhH.js +0 -1
  110. package/client/dist/assets/file-save-745eba88-Bb9F9Kg7.js +0 -1
  111. package/client/dist/assets/flowDb-956e92f1-scnUykhM.js +0 -10
  112. package/client/dist/assets/flowDiagram-66a62f08-jVyWsfyU.js +0 -4
  113. package/client/dist/assets/flowDiagram-v2-96b9c2cf-N6xgi25h.js +0 -1
  114. package/client/dist/assets/flowchart-elk-definition-4a651766-gKGX3HqR.js +0 -139
  115. package/client/dist/assets/fr-FR-RHASNOE6-vdj42kC6.js +0 -9
  116. package/client/dist/assets/ganttDiagram-c361ad54-C2CiWFUP.js +0 -257
  117. package/client/dist/assets/gitGraphDiagram-72cf32ee-C59Yz2LK.js +0 -70
  118. package/client/dist/assets/gl-ES-HMX3MZ6V-DQo0TzoP.js +0 -10
  119. package/client/dist/assets/graph-Dx_H43Kv.js +0 -1
  120. package/client/dist/assets/he-IL-6SHJWFNN-DKXK5e33.js +0 -10
  121. package/client/dist/assets/hi-IN-IWLTKZ5I-C2Qgqc0R.js +0 -4
  122. package/client/dist/assets/hu-HU-A5ZG7DT2-Ss-6vX0m.js +0 -7
  123. package/client/dist/assets/id-ID-SAP4L64H-D7Wsg1S2.js +0 -10
  124. package/client/dist/assets/image-blob-reduce.esm-D6s-rqMO.js +0 -7
  125. package/client/dist/assets/index-3862675e-u8Nv7hHC.js +0 -1
  126. package/client/dist/assets/index-BVowJdZF.js +0 -97
  127. package/client/dist/assets/index-ce18TYkg.js +0 -27
  128. package/client/dist/assets/index-kQoJx-bc.css +0 -1
  129. package/client/dist/assets/infoDiagram-f8f76790-LmoJYsxo.js +0 -7
  130. package/client/dist/assets/init-Gi6I4Gst.js +0 -1
  131. package/client/dist/assets/it-IT-JPQ66NNP-CAPTVl7M.js +0 -11
  132. package/client/dist/assets/ja-JP-DBVTYXUO-eNVPawR2.js +0 -8
  133. package/client/dist/assets/journeyDiagram-49397b02-BaJqehpR.js +0 -139
  134. package/client/dist/assets/kaa-6HZHGXH3-tpuNkKhS.js +0 -1
  135. package/client/dist/assets/kab-KAB-ZGHBKWFO-Dp83kx4x.js +0 -8
  136. package/client/dist/assets/kk-KZ-P5N5QNE5-B9IlC6YN.js +0 -1
  137. package/client/dist/assets/km-KH-HSX4SM5Z-B_KMYaMj.js +0 -11
  138. package/client/dist/assets/ko-KR-MTYHY66A-yebnUNdb.js +0 -9
  139. package/client/dist/assets/ku-TR-6OUDTVRD-BR6fh6-5.js +0 -9
  140. package/client/dist/assets/layout-DLl5Jwcl.js +0 -1
  141. package/client/dist/assets/line-FpB7omSK.js +0 -1
  142. package/client/dist/assets/linear-CkXqUFJ8.js +0 -1
  143. package/client/dist/assets/lt-LT-XHIRWOB4-SutZSWtR.js +0 -3
  144. package/client/dist/assets/lv-LV-5QDEKY6T-DuAxdcZL.js +0 -7
  145. package/client/dist/assets/mindmap-definition-fc14e90a-DyxXOExh.js +0 -425
  146. package/client/dist/assets/mr-IN-CRQNXWMA-DqDUWM_8.js +0 -13
  147. package/client/dist/assets/my-MM-5M5IBNSE-C40kMFMR.js +0 -1
  148. package/client/dist/assets/nb-NO-T6EIAALU-DVij32Ju.js +0 -10
  149. package/client/dist/assets/nl-NL-IS3SIHDZ-rT84mDYq.js +0 -8
  150. package/client/dist/assets/nn-NO-6E72VCQL-BBZXBW8V.js +0 -8
  151. package/client/dist/assets/oc-FR-POXYY2M6-DzjOugOf.js +0 -8
  152. package/client/dist/assets/ordinal-Cboi1Yqb.js +0 -1
  153. package/client/dist/assets/pa-IN-N4M65BXN-DD1iU8_F.js +0 -4
  154. package/client/dist/assets/path-CbwjOpE9.js +0 -1
  155. package/client/dist/assets/pdf-CE_K4jFx.js +0 -12
  156. package/client/dist/assets/pdf.worker-BA9kU3Pw.mjs +0 -61080
  157. package/client/dist/assets/percentages-BXMCSKIN-WVlHS4wx.js +0 -207
  158. package/client/dist/assets/pica-CQIY57Tf.js +0 -7
  159. package/client/dist/assets/pieDiagram-8a3498a8-Dd_85qBH.js +0 -35
  160. package/client/dist/assets/pl-PL-T2D74RX3-ukVXa48G.js +0 -9
  161. package/client/dist/assets/pt-BR-5N22H2LF-BibawarT.js +0 -9
  162. package/client/dist/assets/pt-PT-UZXXM6DQ-So3i9l9w.js +0 -9
  163. package/client/dist/assets/quadrantDiagram-120e2f19-C4dFVDEx.js +0 -7
  164. package/client/dist/assets/requirementDiagram-deff3bca-DrTO7yFl.js +0 -52
  165. package/client/dist/assets/ro-RO-JPDTUUEW-DY0Xq_Hd.js +0 -11
  166. package/client/dist/assets/roundRect-0PYZxl1G.js +0 -1
  167. package/client/dist/assets/ru-RU-B4JR7IUQ-B7u_Zvkd.js +0 -9
  168. package/client/dist/assets/sankeyDiagram-04a897e0-D24gfzuS.js +0 -8
  169. package/client/dist/assets/sequenceDiagram-704730f1-Dgji2XLQ.js +0 -122
  170. package/client/dist/assets/si-LK-N5RQ5JYF-OejsLzQ_.js +0 -1
  171. package/client/dist/assets/sk-SK-C5VTKIMK-_vy2Bt-M.js +0 -6
  172. package/client/dist/assets/sl-SI-NN7IZMDC-DKOl_u2M.js +0 -6
  173. package/client/dist/assets/stateDiagram-587899a1-CJ8eBaiU.js +0 -1
  174. package/client/dist/assets/stateDiagram-v2-d93cdb3a-C5K3l-Nt.js +0 -1
  175. package/client/dist/assets/styles-6aaf32cf-DAKE0jbx.js +0 -207
  176. package/client/dist/assets/styles-9a916d00-LFAJCgEy.js +0 -160
  177. package/client/dist/assets/styles-c10674c1-CllKO8NG.js +0 -116
  178. package/client/dist/assets/subset-shared.chunk-Uy-J87FQ.js +0 -84
  179. package/client/dist/assets/subset-worker.chunk-dvgDvqt9.js +0 -1
  180. package/client/dist/assets/sv-SE-XGPEYMSR-CDCB2ZV5.js +0 -10
  181. package/client/dist/assets/svgDrawCommon-08f97a94-CObOzbFQ.js +0 -1
  182. package/client/dist/assets/ta-IN-2NMHFXQM-DHUNdO69.js +0 -9
  183. package/client/dist/assets/th-TH-HPSO5L25-zI2hnBq3.js +0 -2
  184. package/client/dist/assets/timeline-definition-85554ec2-C2XHRmxK.js +0 -61
  185. package/client/dist/assets/tr-TR-DEFEU3FU-l-6Hu4-D.js +0 -7
  186. package/client/dist/assets/uk-UA-QMV73CPH-CqSOwrl7.js +0 -6
  187. package/client/dist/assets/vendor-codemirror-D_s0aGBu.js +0 -35
  188. package/client/dist/assets/vendor-i18n-DCFGyhQR.js +0 -1
  189. package/client/dist/assets/vendor-icons-Lb69KSFJ.js +0 -646
  190. package/client/dist/assets/vendor-markdown-BXEi_H3G.js +0 -298
  191. package/client/dist/assets/vendor-react-9mUTKBHH.js +0 -67
  192. package/client/dist/assets/vendor-syntax-DnmwQQJF.js +0 -16
  193. package/client/dist/assets/vendor-xterm-CZq1hqo1.js +0 -66
  194. package/client/dist/assets/vendor-xterm-qxJ8_QYu.css +0 -32
  195. package/client/dist/assets/vi-VN-M7AON7JQ-CUL8-mBZ.js +0 -5
  196. package/client/dist/assets/xychartDiagram-e933f94c-1fmf6slj.js +0 -7
  197. package/client/dist/assets/zh-CN-LNUGB5OW-CB5y5VVU.js +0 -10
  198. package/client/dist/assets/zh-HK-E62DVLB3-BHcrrEeJ.js +0 -1
  199. package/client/dist/assets/zh-TW-RAJ6MFWO-DoDUdkaJ.js +0 -9
  200. package/client/dist/clear-cache.html +0 -85
  201. package/client/dist/convert-icons.md +0 -53
  202. package/client/dist/favicon.png +0 -0
  203. package/client/dist/favicon.svg +0 -9
  204. package/client/dist/generate-icons.js +0 -49
  205. package/client/dist/icons/claude-ai-icon.svg +0 -1
  206. package/client/dist/icons/codex-white.svg +0 -3
  207. package/client/dist/icons/codex.svg +0 -3
  208. package/client/dist/icons/cursor-white.svg +0 -12
  209. package/client/dist/icons/cursor.svg +0 -1
  210. package/client/dist/icons/icon-128x128.png +0 -0
  211. package/client/dist/icons/icon-128x128.svg +0 -12
  212. package/client/dist/icons/icon-144x144.png +0 -0
  213. package/client/dist/icons/icon-144x144.svg +0 -12
  214. package/client/dist/icons/icon-152x152.png +0 -0
  215. package/client/dist/icons/icon-152x152.svg +0 -12
  216. package/client/dist/icons/icon-192x192.png +0 -0
  217. package/client/dist/icons/icon-192x192.svg +0 -12
  218. package/client/dist/icons/icon-384x384.png +0 -0
  219. package/client/dist/icons/icon-384x384.svg +0 -12
  220. package/client/dist/icons/icon-512x512.png +0 -0
  221. package/client/dist/icons/icon-512x512.svg +0 -12
  222. package/client/dist/icons/icon-72x72.png +0 -0
  223. package/client/dist/icons/icon-72x72.svg +0 -12
  224. package/client/dist/icons/icon-96x96.png +0 -0
  225. package/client/dist/icons/icon-96x96.svg +0 -12
  226. package/client/dist/icons/icon-template.svg +0 -12
  227. package/client/dist/index.html +0 -128
  228. package/client/dist/logo-128.png +0 -0
  229. package/client/dist/logo-256.png +0 -0
  230. package/client/dist/logo-32.png +0 -0
  231. package/client/dist/logo-512.png +0 -0
  232. package/client/dist/logo-64.png +0 -0
  233. package/client/dist/logo.svg +0 -17
  234. package/client/dist/manifest.json +0 -61
  235. package/client/dist/mcp-docs.html +0 -119
  236. package/client/dist/screenshots/cli-selection.png +0 -0
  237. package/client/dist/screenshots/desktop-main.png +0 -0
  238. package/client/dist/screenshots/mobile-chat.png +0 -0
  239. package/client/dist/screenshots/tools-modal.png +0 -0
  240. package/client/dist/sw.js +0 -19
  241. package/commands/upfynai-connect.md +0 -59
  242. package/commands/upfynai-disconnect.md +0 -31
  243. package/commands/upfynai-doctor.md +0 -99
  244. package/commands/upfynai-export.md +0 -49
  245. package/commands/upfynai-local.md +0 -82
  246. package/commands/upfynai-status.md +0 -75
  247. package/commands/upfynai-stop.md +0 -49
  248. package/commands/upfynai-uninstall.md +0 -58
  249. package/commands/upfynai.md +0 -69
  250. package/scripts/build-client.js +0 -17
  251. package/scripts/fix-node-pty.js +0 -67
  252. package/scripts/install-commands.js +0 -78
  253. package/server/claude-sdk.js +0 -714
  254. package/server/cli-ui.js +0 -785
  255. package/server/cli.js +0 -596
  256. package/server/constants/config.js +0 -31
  257. package/server/cursor-cli.js +0 -270
  258. package/server/database/auth.db +0 -0
  259. package/server/database/db.js +0 -822
  260. package/server/database/init.sql +0 -70
  261. package/server/index.js +0 -2738
  262. package/server/load-env.js +0 -26
  263. package/server/mcp-server.js +0 -621
  264. package/server/middleware/auth.js +0 -181
  265. package/server/openai-codex.js +0 -403
  266. package/server/openrouter.js +0 -137
  267. package/server/projects.js +0 -1742
  268. package/server/relay-client.js +0 -672
  269. package/server/routes/agent.js +0 -1226
  270. package/server/routes/auth.js +0 -266
  271. package/server/routes/cli-auth.js +0 -263
  272. package/server/routes/codex.js +0 -344
  273. package/server/routes/commands.js +0 -598
  274. package/server/routes/cursor.js +0 -807
  275. package/server/routes/dashboard.js +0 -205
  276. package/server/routes/git.js +0 -1151
  277. package/server/routes/mcp-utils.js +0 -48
  278. package/server/routes/mcp.js +0 -535
  279. package/server/routes/payments.js +0 -172
  280. package/server/routes/projects.js +0 -552
  281. package/server/routes/settings.js +0 -261
  282. package/server/routes/taskmaster.js +0 -1928
  283. package/server/routes/user.js +0 -106
  284. package/server/routes/vapi-chat.js +0 -94
  285. package/server/routes/voice.js +0 -194
  286. package/server/routes/webhooks.js +0 -166
  287. package/server/routes/workflows.js +0 -118
  288. package/server/sandbox.js +0 -120
  289. package/server/services/whisperService.js +0 -84
  290. package/server/services/workflowScheduler.js +0 -186
  291. package/server/utils/commandParser.js +0 -303
  292. package/server/utils/gitConfig.js +0 -24
  293. package/server/utils/mcp-detector.js +0 -198
  294. package/server/utils/taskmaster-websocket.js +0 -129
  295. package/shared/modelConstants.js +0 -96
package/server/sandbox.js DELETED
@@ -1,120 +0,0 @@
1
- /**
2
- * Sandbox Client — connects the backend to the separate sandbox-service on Railway.
3
- * All sandbox operations are proxied to the sandbox service via HTTP.
4
- */
5
-
6
- const SANDBOX_SERVICE_URL = process.env.SANDBOX_SERVICE_URL || 'http://localhost:4300';
7
- const SANDBOX_SERVICE_SECRET = process.env.SANDBOX_SERVICE_SECRET || 'dev-sandbox-secret';
8
-
9
- async function sandboxFetch(path, userId, body = null) {
10
- const opts = {
11
- method: body ? 'POST' : 'GET',
12
- headers: {
13
- 'Content-Type': 'application/json',
14
- 'x-sandbox-secret': SANDBOX_SERVICE_SECRET,
15
- 'x-user-id': String(userId),
16
- },
17
- };
18
- if (body) opts.body = JSON.stringify(body);
19
-
20
- const res = await fetch(`${SANDBOX_SERVICE_URL}${path}`, opts);
21
- const data = await res.json();
22
- if (!res.ok) throw new Error(data.error || `Sandbox service error: ${res.status}`);
23
- return data;
24
- }
25
-
26
- const sandboxClient = {
27
-
28
- /**
29
- * Check if the sandbox service is reachable.
30
- */
31
- async isAvailable() {
32
- try {
33
- const res = await fetch(`${SANDBOX_SERVICE_URL}/health`, { signal: AbortSignal.timeout(3000) });
34
- return res.ok;
35
- } catch {
36
- return false;
37
- }
38
- },
39
-
40
- /**
41
- * Initialize a user's sandbox (creates if doesn't exist).
42
- */
43
- async initSandbox(userId) {
44
- return sandboxFetch('/api/sandbox/init', userId, {});
45
- },
46
-
47
- /**
48
- * Get sandbox status.
49
- */
50
- async getStatus(userId) {
51
- return sandboxFetch('/api/sandbox/status', userId);
52
- },
53
-
54
- /**
55
- * Destroy a user's sandbox.
56
- */
57
- async destroySandbox(userId) {
58
- const res = await fetch(`${SANDBOX_SERVICE_URL}/api/sandbox`, {
59
- method: 'DELETE',
60
- headers: {
61
- 'Content-Type': 'application/json',
62
- 'x-sandbox-secret': SANDBOX_SERVICE_SECRET,
63
- 'x-user-id': String(userId),
64
- },
65
- });
66
- const data = await res.json();
67
- if (!res.ok) throw new Error(data.error || 'Failed to destroy sandbox');
68
- return data;
69
- },
70
-
71
- /**
72
- * Execute a command in the user's sandbox.
73
- */
74
- async exec(userId, command, opts = {}) {
75
- return sandboxFetch('/api/exec', userId, {
76
- command,
77
- cwd: opts.cwd,
78
- timeout: opts.timeout,
79
- userKeys: opts.userKeys,
80
- });
81
- },
82
-
83
- /**
84
- * Read a file from the user's sandbox.
85
- */
86
- async readFile(userId, filePath) {
87
- return sandboxFetch('/api/file/read', userId, { filePath });
88
- },
89
-
90
- /**
91
- * Write a file to the user's sandbox.
92
- */
93
- async writeFile(userId, filePath, content) {
94
- return sandboxFetch('/api/file/write', userId, { filePath, content });
95
- },
96
-
97
- /**
98
- * Get file tree from the user's sandbox.
99
- */
100
- async getFileTree(userId, dirPath, depth = 3) {
101
- return sandboxFetch('/api/file/tree', userId, { dirPath, depth });
102
- },
103
-
104
- /**
105
- * Run a git command in the user's sandbox.
106
- */
107
- async gitOperation(userId, gitCommand, cwd) {
108
- return sandboxFetch('/api/git', userId, { gitCommand, cwd });
109
- },
110
-
111
- /**
112
- * Get the WebSocket URL for an interactive shell session.
113
- */
114
- getShellWsUrl(userId, sessionId) {
115
- const wsBase = SANDBOX_SERVICE_URL.replace(/^http/, 'ws');
116
- return `${wsBase}/shell?secret=${encodeURIComponent(SANDBOX_SERVICE_SECRET)}&userId=${userId}&sessionId=${sessionId || 'default'}`;
117
- },
118
- };
119
-
120
- export { sandboxClient, SANDBOX_SERVICE_URL };
@@ -1,84 +0,0 @@
1
- /**
2
- * Local Whisper STT service using nodejs-whisper.
3
- * Used as a fallback when no OpenAI API key is configured (local mode).
4
- * Requires ffmpeg to be installed on the system.
5
- */
6
-
7
- let whisperAvailable = null; // null = unchecked, true/false
8
- let modelReady = false;
9
-
10
- /**
11
- * Check if nodejs-whisper and ffmpeg are available.
12
- */
13
- async function isWhisperAvailable() {
14
- if (whisperAvailable !== null) return whisperAvailable;
15
-
16
- try {
17
- // Check if nodejs-whisper can be imported
18
- await import('nodejs-whisper');
19
-
20
- // Check if ffmpeg is available
21
- const { execSync } = await import('child_process');
22
- execSync('ffmpeg -version', { stdio: 'pipe', timeout: 5000 });
23
-
24
- whisperAvailable = true;
25
- } catch {
26
- whisperAvailable = false;
27
- }
28
-
29
- return whisperAvailable;
30
- }
31
-
32
- /**
33
- * Ensure the whisper model is downloaded.
34
- * Downloads the tiny.en model (~75MB) on first use.
35
- */
36
- async function ensureWhisperModel() {
37
- if (modelReady) return true;
38
-
39
- const available = await isWhisperAvailable();
40
- if (!available) return false;
41
-
42
- try {
43
- const { nodeWhisper } = await import('nodejs-whisper');
44
- // Attempt to download model if not present
45
- await nodeWhisper.downloadModel('tiny.en');
46
- modelReady = true;
47
- return true;
48
- } catch (err) {
49
- console.warn('[WhisperService] Failed to download model:', err.message);
50
- return false;
51
- }
52
- }
53
-
54
- /**
55
- * Transcribe audio using local nodejs-whisper.
56
- * @param {string} audioFilePath - Path to the audio file (WAV, MP3, etc.)
57
- * @returns {Promise<string|null>} Transcribed text, or null if failed
58
- */
59
- async function transcribeLocal(audioFilePath) {
60
- const ready = await ensureWhisperModel();
61
- if (!ready) return null;
62
-
63
- try {
64
- const { nodeWhisper } = await import('nodejs-whisper');
65
- const result = await nodeWhisper(audioFilePath, {
66
- modelName: 'tiny.en',
67
- autoDownloadModelName: 'tiny.en',
68
- whisperOptions: {
69
- outputInText: true,
70
- language: 'en',
71
- }
72
- });
73
-
74
- // nodejs-whisper returns array of segments or text
75
- if (typeof result === 'string') return result.trim();
76
- if (Array.isArray(result)) return result.map(s => s.speech || s.text || '').join(' ').trim();
77
- return null;
78
- } catch (err) {
79
- console.error('[WhisperService] Transcription error:', err.message);
80
- return null;
81
- }
82
- }
83
-
84
- export { isWhisperAvailable, ensureWhisperModel, transcribeLocal };
@@ -1,186 +0,0 @@
1
- import cron from 'node-cron';
2
- import { workflowDb, webhookDb } from '../database/db.js';
3
-
4
- const activeJobs = new Map(); // workflowId -> cron task
5
-
6
- /**
7
- * Execute a single workflow's steps (same logic as the /run endpoint).
8
- * Returns { success, results, error }
9
- */
10
- async function executeWorkflow(workflow) {
11
- const steps = typeof workflow.steps === 'string' ? JSON.parse(workflow.steps) : workflow.steps;
12
- if (!steps.length) return { success: false, error: 'No steps' };
13
-
14
- const run = await workflowDb.createRun(workflow.id, workflow.user_id, steps.length);
15
- const results = [];
16
- let lastOutput = null;
17
-
18
- for (let i = 0; i < steps.length; i++) {
19
- const step = steps[i];
20
- try {
21
- let stepResult;
22
-
23
- if (step.type === 'webhook') {
24
- const webhookId = step.config?.webhookId;
25
- if (!webhookId) throw new Error('No webhook configured');
26
-
27
- const webhook = await webhookDb.getById(Number(webhookId), workflow.user_id);
28
- if (!webhook) throw new Error('Webhook not found');
29
-
30
- let parsedHeaders = {};
31
- try { parsedHeaders = JSON.parse(webhook.headers || '{}'); } catch { /* ignore */ }
32
-
33
- const controller = new AbortController();
34
- const timeout = setTimeout(() => controller.abort(), 15000);
35
-
36
- const fetchOptions = {
37
- method: webhook.method,
38
- headers: {
39
- 'Content-Type': 'application/json',
40
- 'User-Agent': 'UpfynAI-Scheduler/1.0',
41
- ...parsedHeaders
42
- },
43
- signal: controller.signal
44
- };
45
-
46
- if (['POST', 'PUT', 'PATCH'].includes(webhook.method)) {
47
- const payload = {
48
- workflow_id: workflow.id,
49
- workflow_name: workflow.name,
50
- step_index: i,
51
- step_label: step.label,
52
- previous_output: lastOutput,
53
- scheduled: true,
54
- timestamp: new Date().toISOString()
55
- };
56
- if (step.config?.payloadTemplate) {
57
- try { Object.assign(payload, JSON.parse(step.config.payloadTemplate)); } catch { /* ignore */ }
58
- }
59
- fetchOptions.body = JSON.stringify(payload);
60
- }
61
-
62
- const response = await fetch(webhook.url, fetchOptions);
63
- clearTimeout(timeout);
64
-
65
- const contentType = response.headers.get('content-type') || '';
66
- let body;
67
- if (contentType.includes('application/json')) {
68
- body = await response.json();
69
- } else {
70
- body = await response.text();
71
- if (body.length > 5000) body = body.slice(0, 5000) + '...';
72
- }
73
-
74
- await webhookDb.updateLastTriggered(webhook.id);
75
- stepResult = { status: response.status, body };
76
- lastOutput = body;
77
-
78
- } else if (step.type === 'ai-prompt') {
79
- stepResult = { type: 'ai-prompt', prompt: step.config?.prompt || '', note: 'Scheduled AI prompts require active session' };
80
- lastOutput = step.config?.prompt;
81
-
82
- } else if (step.type === 'delay') {
83
- const seconds = Math.min(step.config?.seconds || 1, 30);
84
- await new Promise(resolve => setTimeout(resolve, seconds * 1000));
85
- stepResult = { delayed: seconds };
86
-
87
- } else {
88
- stepResult = { type: step.type, note: 'Unknown step type' };
89
- }
90
-
91
- results.push({ step: i, label: step.label, type: step.type, success: true, result: stepResult });
92
- await workflowDb.updateRun(run.id, { status: 'running', stepsCompleted: i + 1 });
93
-
94
- } catch (stepError) {
95
- results.push({ step: i, label: step.label, type: step.type, success: false, error: stepError.message });
96
- await workflowDb.updateRun(run.id, { status: 'failed', stepsCompleted: i, error: `Step ${i + 1} (${step.label}): ${stepError.message}` });
97
- await workflowDb.updateLastRun(workflow.id);
98
- return { success: false, run_id: run.id, results, error: `Step ${i + 1} failed: ${stepError.message}` };
99
- }
100
- }
101
-
102
- await workflowDb.updateRun(run.id, { status: 'completed', stepsCompleted: steps.length, result: results });
103
- await workflowDb.updateLastRun(workflow.id);
104
- return { success: true, run_id: run.id, results };
105
- }
106
-
107
- /**
108
- * Schedule a single workflow's cron job.
109
- */
110
- function scheduleWorkflow(workflow) {
111
- const id = workflow.id;
112
-
113
- // Stop existing job if any
114
- if (activeJobs.has(id)) {
115
- activeJobs.get(id).stop();
116
- activeJobs.delete(id);
117
- }
118
-
119
- if (!workflow.schedule || !workflow.schedule_enabled) return;
120
-
121
- // Validate cron expression
122
- if (!cron.validate(workflow.schedule)) {
123
- console.warn(`[Scheduler] Invalid cron for workflow ${id}: ${workflow.schedule}`);
124
- return;
125
- }
126
-
127
- const task = cron.schedule(workflow.schedule, async () => {
128
- console.log(`[Scheduler] Running workflow ${id}: ${workflow.name}`);
129
- try {
130
- await executeWorkflow(workflow);
131
- } catch (err) {
132
- console.error(`[Scheduler] Workflow ${id} execution error:`, err.message);
133
- }
134
- }, {
135
- timezone: workflow.schedule_timezone || 'UTC'
136
- });
137
-
138
- activeJobs.set(id, task);
139
- console.log(`[Scheduler] Scheduled workflow ${id} (${workflow.name}): ${workflow.schedule}`);
140
- }
141
-
142
- /**
143
- * Load all scheduled workflows from DB and start their cron jobs.
144
- * Call this once at server startup.
145
- */
146
- async function initScheduler() {
147
- try {
148
- const workflows = await workflowDb.getScheduled();
149
- console.log(`[Scheduler] Found ${workflows.length} scheduled workflow(s)`);
150
- for (const wf of workflows) {
151
- scheduleWorkflow(wf);
152
- }
153
- } catch (err) {
154
- console.error('[Scheduler] Init error:', err.message);
155
- }
156
- }
157
-
158
- /**
159
- * Re-sync a specific workflow's schedule (call after create/update).
160
- */
161
- async function refreshWorkflowSchedule(workflowId, userId) {
162
- try {
163
- const wf = await workflowDb.getById(workflowId, userId);
164
- if (wf) {
165
- scheduleWorkflow(wf);
166
- } else {
167
- // Workflow deleted — stop its job
168
- if (activeJobs.has(workflowId)) {
169
- activeJobs.get(workflowId).stop();
170
- activeJobs.delete(workflowId);
171
- }
172
- }
173
- } catch { /* ignore */ }
174
- }
175
-
176
- /**
177
- * Stop a workflow's cron job.
178
- */
179
- function stopWorkflowSchedule(workflowId) {
180
- if (activeJobs.has(workflowId)) {
181
- activeJobs.get(workflowId).stop();
182
- activeJobs.delete(workflowId);
183
- }
184
- }
185
-
186
- export { initScheduler, refreshWorkflowSchedule, stopWorkflowSchedule, executeWorkflow };
@@ -1,303 +0,0 @@
1
- import matter from 'gray-matter';
2
- import { promises as fs } from 'fs';
3
- import path from 'path';
4
- import { execFile } from 'child_process';
5
- import { promisify } from 'util';
6
- import { parse as parseShellCommand } from 'shell-quote';
7
-
8
- const execFileAsync = promisify(execFile);
9
-
10
- // Configuration
11
- const MAX_INCLUDE_DEPTH = 3;
12
- const BASH_TIMEOUT = 30000; // 30 seconds
13
- const BASH_COMMAND_ALLOWLIST = [
14
- 'echo',
15
- 'ls',
16
- 'pwd',
17
- 'date',
18
- 'whoami',
19
- 'git',
20
- 'npm',
21
- 'node',
22
- 'cat',
23
- 'grep',
24
- 'find',
25
- 'task-master'
26
- ];
27
-
28
- /**
29
- * Parse a markdown command file and extract frontmatter and content
30
- * @param {string} content - Raw markdown content
31
- * @returns {object} Parsed command with data (frontmatter) and content
32
- */
33
- export function parseCommand(content) {
34
- try {
35
- const parsed = matter(content);
36
- return {
37
- data: parsed.data || {},
38
- content: parsed.content || '',
39
- raw: content
40
- };
41
- } catch (error) {
42
- throw new Error(`Failed to parse command: ${error.message}`);
43
- }
44
- }
45
-
46
- /**
47
- * Replace argument placeholders in content
48
- * @param {string} content - Content with placeholders
49
- * @param {string|array} args - Arguments to replace (string or array)
50
- * @returns {string} Content with replaced arguments
51
- */
52
- export function replaceArguments(content, args) {
53
- if (!content) return content;
54
-
55
- let result = content;
56
-
57
- // Convert args to array if it's a string
58
- const argsArray = Array.isArray(args) ? args : (args ? [args] : []);
59
-
60
- // Replace $ARGUMENTS with all arguments joined by space
61
- const allArgs = argsArray.join(' ');
62
- result = result.replace(/\$ARGUMENTS/g, allArgs);
63
-
64
- // Replace positional arguments $1-$9
65
- for (let i = 1; i <= 9; i++) {
66
- const regex = new RegExp(`\\$${i}`, 'g');
67
- const value = argsArray[i - 1] || '';
68
- result = result.replace(regex, value);
69
- }
70
-
71
- return result;
72
- }
73
-
74
- /**
75
- * Validate file path to prevent directory traversal
76
- * @param {string} filePath - Path to validate
77
- * @param {string} basePath - Base directory path
78
- * @returns {boolean} True if path is safe
79
- */
80
- export function isPathSafe(filePath, basePath) {
81
- const resolvedPath = path.resolve(basePath, filePath);
82
- const resolvedBase = path.resolve(basePath);
83
- const relative = path.relative(resolvedBase, resolvedPath);
84
- return (
85
- relative !== '' &&
86
- !relative.startsWith('..') &&
87
- !path.isAbsolute(relative)
88
- );
89
- }
90
-
91
- /**
92
- * Process file includes in content (@filename syntax)
93
- * @param {string} content - Content with @filename includes
94
- * @param {string} basePath - Base directory for resolving file paths
95
- * @param {number} depth - Current recursion depth
96
- * @returns {Promise<string>} Content with includes resolved
97
- */
98
- export async function processFileIncludes(content, basePath, depth = 0) {
99
- if (!content) return content;
100
-
101
- // Prevent infinite recursion
102
- if (depth >= MAX_INCLUDE_DEPTH) {
103
- throw new Error(`Maximum include depth (${MAX_INCLUDE_DEPTH}) exceeded`);
104
- }
105
-
106
- // Match @filename patterns (at start of line or after whitespace)
107
- const includePattern = /(?:^|\s)@([^\s]+)/gm;
108
- const matches = [...content.matchAll(includePattern)];
109
-
110
- if (matches.length === 0) {
111
- return content;
112
- }
113
-
114
- let result = content;
115
-
116
- for (const match of matches) {
117
- const fullMatch = match[0];
118
- const filename = match[1];
119
-
120
- // Security: prevent directory traversal
121
- if (!isPathSafe(filename, basePath)) {
122
- throw new Error(`Invalid file path (directory traversal detected): ${filename}`);
123
- }
124
-
125
- try {
126
- const filePath = path.resolve(basePath, filename);
127
- const fileContent = await fs.readFile(filePath, 'utf-8');
128
-
129
- // Recursively process includes in the included file
130
- const processedContent = await processFileIncludes(fileContent, basePath, depth + 1);
131
-
132
- // Replace the @filename with the file content
133
- result = result.replace(fullMatch, fullMatch.startsWith(' ') ? ' ' + processedContent : processedContent);
134
- } catch (error) {
135
- if (error.code === 'ENOENT') {
136
- throw new Error(`File not found: ${filename}`);
137
- }
138
- throw error;
139
- }
140
- }
141
-
142
- return result;
143
- }
144
-
145
- /**
146
- * Validate that a command and its arguments are safe
147
- * @param {string} commandString - Command string to validate
148
- * @returns {{ allowed: boolean, command: string, args: string[], error?: string }} Validation result
149
- */
150
- export function validateCommand(commandString) {
151
- const trimmedCommand = commandString.trim();
152
- if (!trimmedCommand) {
153
- return { allowed: false, command: '', args: [], error: 'Empty command' };
154
- }
155
-
156
- // Parse the command using shell-quote to handle quotes properly
157
- const parsed = parseShellCommand(trimmedCommand);
158
-
159
- // Check for shell operators or control structures
160
- const hasOperators = parsed.some(token =>
161
- typeof token === 'object' && token.op
162
- );
163
-
164
- if (hasOperators) {
165
- return {
166
- allowed: false,
167
- command: '',
168
- args: [],
169
- error: 'Shell operators (&&, ||, |, ;, etc.) are not allowed'
170
- };
171
- }
172
-
173
- // Extract command and args (all should be strings after validation)
174
- const tokens = parsed.filter(token => typeof token === 'string');
175
-
176
- if (tokens.length === 0) {
177
- return { allowed: false, command: '', args: [], error: 'No valid command found' };
178
- }
179
-
180
- const [command, ...args] = tokens;
181
-
182
- // Extract just the command name (remove path if present)
183
- const commandName = path.basename(command);
184
-
185
- // Check if command exactly matches allowlist (no prefix matching)
186
- const isAllowed = BASH_COMMAND_ALLOWLIST.includes(commandName);
187
-
188
- if (!isAllowed) {
189
- return {
190
- allowed: false,
191
- command: commandName,
192
- args,
193
- error: `Command '${commandName}' is not in the allowlist`
194
- };
195
- }
196
-
197
- // Validate arguments don't contain dangerous metacharacters
198
- const dangerousPattern = /[;&|`$()<>{}[\]\\]/;
199
- for (const arg of args) {
200
- if (dangerousPattern.test(arg)) {
201
- return {
202
- allowed: false,
203
- command: commandName,
204
- args,
205
- error: `Argument contains dangerous characters: ${arg}`
206
- };
207
- }
208
- }
209
-
210
- return { allowed: true, command: commandName, args };
211
- }
212
-
213
- /**
214
- * Backward compatibility: Check if command is allowed (deprecated)
215
- * @deprecated Use validateCommand() instead for better security
216
- * @param {string} command - Command to validate
217
- * @returns {boolean} True if command is allowed
218
- */
219
- export function isBashCommandAllowed(command) {
220
- const result = validateCommand(command);
221
- return result.allowed;
222
- }
223
-
224
- /**
225
- * Sanitize bash command output
226
- * @param {string} output - Raw command output
227
- * @returns {string} Sanitized output
228
- */
229
- export function sanitizeOutput(output) {
230
- if (!output) return '';
231
-
232
- // Remove control characters except \t, \n, \r
233
- return [...output]
234
- .filter(ch => {
235
- const code = ch.charCodeAt(0);
236
- return code === 9 // \t
237
- || code === 10 // \n
238
- || code === 13 // \r
239
- || (code >= 32 && code !== 127);
240
- })
241
- .join('');
242
- }
243
-
244
- /**
245
- * Process bash commands in content (!command syntax)
246
- * @param {string} content - Content with !command syntax
247
- * @param {object} options - Options for bash execution
248
- * @returns {Promise<string>} Content with bash commands executed and replaced
249
- */
250
- export async function processBashCommands(content, options = {}) {
251
- if (!content) return content;
252
-
253
- const { cwd = process.cwd(), timeout = BASH_TIMEOUT } = options;
254
-
255
- // Match !command patterns (at start of line or after whitespace)
256
- const commandPattern = /(?:^|\n)!(.+?)(?=\n|$)/g;
257
- const matches = [...content.matchAll(commandPattern)];
258
-
259
- if (matches.length === 0) {
260
- return content;
261
- }
262
-
263
- let result = content;
264
-
265
- for (const match of matches) {
266
- const fullMatch = match[0];
267
- const commandString = match[1].trim();
268
-
269
- // Security: validate command and parse args
270
- const validation = validateCommand(commandString);
271
-
272
- if (!validation.allowed) {
273
- throw new Error(`Command not allowed: ${commandString} - ${validation.error}`);
274
- }
275
-
276
- try {
277
- // Execute without shell using execFile with parsed args
278
- const { stdout, stderr } = await execFileAsync(
279
- validation.command,
280
- validation.args,
281
- {
282
- cwd,
283
- timeout,
284
- maxBuffer: 1024 * 1024, // 1MB max output
285
- shell: false, // IMPORTANT: No shell interpretation
286
- env: { ...process.env, PATH: process.env.PATH } // Inherit PATH for finding commands
287
- }
288
- );
289
-
290
- const output = sanitizeOutput(stdout || stderr || '');
291
-
292
- // Replace the !command with the output
293
- result = result.replace(fullMatch, fullMatch.startsWith('\n') ? '\n' + output : output);
294
- } catch (error) {
295
- if (error.killed) {
296
- throw new Error(`Command timeout: ${commandString}`);
297
- }
298
- throw new Error(`Command failed: ${commandString} - ${error.message}`);
299
- }
300
- }
301
-
302
- return result;
303
- }