@runeya/runeya 2.0.93 → 2.0.94

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 (246) hide show
  1. package/agent/index.js +191 -160
  2. package/agent/index.js.map +1 -1
  3. package/agent-manager-3KSS7BHP.js +7 -0
  4. package/{chunk-6Y24763Y.js → chunk-4PQXBTV6.js} +62 -28
  5. package/chunk-4PQXBTV6.js.map +1 -0
  6. package/index.js +1 -1
  7. package/package.json +1 -1
  8. package/{src-QDQ5AT4C.js → src-GGPKDQGD.js} +997 -933
  9. package/src-GGPKDQGD.js.map +1 -0
  10. package/web/assets/AgentScalarChatInterface.vue-CR0iWJNr.js +13 -0
  11. package/web/assets/AgentTerminalPage-DZj9UulV.js +1 -0
  12. package/web/assets/AiChatPage-D4h76hus.js +1 -0
  13. package/web/assets/AppLayout-DusPXiZn.js +1 -0
  14. package/web/assets/{AppLayout-DiMqQfDk.css → AppLayout-Sk3Qnkr-.css} +1 -1
  15. package/web/assets/AuditPage-BBEa6MYr.js +1 -0
  16. package/web/assets/CloudAccountPage-DKgXvPS1.js +1 -0
  17. package/web/assets/CloudAccountPage-DopITrxL.js +1 -0
  18. package/web/assets/CloudMessagingPage-BNIbysEO.js +2 -0
  19. package/web/assets/DashboardPage-CTGAGY7X.js +1 -0
  20. package/web/assets/DirectoryPickerDialog-BKI9vxkG.js +1 -0
  21. package/web/assets/{EditorIcon-Bi1br5gY.js → EditorIcon-CdvuLNAP.js} +2 -2
  22. package/web/assets/EnvironmentForm-BiWvLVax.js +108 -0
  23. package/web/assets/EnvironmentFormPage-RReX9Ijr.js +1 -0
  24. package/web/assets/EnvironmentListPage-BW5PlOxl.js +1 -0
  25. package/web/assets/KanbanBoardPage-BFYgHGl0.js +4 -0
  26. package/web/assets/KanbanListPage-BAcgRh8Z.js +1 -0
  27. package/web/assets/LaunchProjectPage-CpiyvCBv.js +1 -0
  28. package/web/assets/LaunchServicesPage-ChEXnYIi.js +1 -0
  29. package/web/assets/LogViewer-iTxXl8YQ.js +3 -0
  30. package/web/assets/OrgKeyPrompt-KRyXRMw7.js +1 -0
  31. package/web/assets/{ProcessControls-BOkCKqGc.js → ProcessControls-DynA7Ock.js} +1 -1
  32. package/web/assets/ProcessDetailPage-BpgGTkXx.js +1 -0
  33. package/web/assets/{ProcessMetrics-DgnpYxXh.js → ProcessMetrics-_FGC-0hm.js} +2 -2
  34. package/web/assets/ProjectDetailPage-B49_-83N.js +1 -0
  35. package/web/assets/ProjectListPage-CFoEPT2F.js +1 -0
  36. package/web/assets/RandomJobTestPage-CALSR3WS.js +2 -0
  37. package/web/assets/ScenarioEditorPage-DxyzCjhy.js +14 -0
  38. package/web/assets/SendToChatDialog-CeFdMciG.js +1 -0
  39. package/web/assets/ServiceControlsBar-CI1_piqu.js +1 -0
  40. package/web/assets/ServiceDetailPage-CVT68kTt.js +2 -0
  41. package/web/assets/ServiceFormPage-nLRxtrOu.js +1 -0
  42. package/web/assets/{SettingsPage-BKcxRTQg.css → SettingsPage-CX1EAjNK.css} +1 -1
  43. package/web/assets/SettingsPage-DDYegVxd.js +2063 -0
  44. package/web/assets/UnlockPage-D9_ZbMR_.js +1 -0
  45. package/web/assets/VariablesTable-ClL6KuSo.js +1 -0
  46. package/web/assets/VaultMigrationPage-rc5OA9Xt.js +1 -0
  47. package/web/assets/VersionBadge-K5UQnfc6.js +1 -0
  48. package/web/assets/WikiPage-VeQCqO9Z.js +1 -0
  49. package/web/assets/WikiView-XCwSa_R7.js +1 -0
  50. package/web/assets/add-scalar-classes-CvhyJKCs.js +387 -0
  51. package/web/assets/auth-errors-Cmx-4mn3.js +1 -0
  52. package/web/assets/{autocomplete-CFCpVybl.js → autocomplete-tNXsUW-e.js} +3 -3
  53. package/web/assets/{basic-shape-diamond.svg-1nuR3NBd.js → basic-shape-diamond.svg-BgNul67K.js} +1 -1
  54. package/web/assets/{basic-shape-hexagon.svg-Be-pZrVb.js → basic-shape-hexagon.svg-CILNnZwG.js} +1 -1
  55. package/web/assets/{basic-shape-primary-circle-ellipse-round.svg-9-zHtg8B.js → basic-shape-primary-circle-ellipse-round.svg-OXklrBAn.js} +1 -1
  56. package/web/assets/{basic-shape-primary-square-rectangle.svg-CRTdnGnv.js → basic-shape-primary-square-rectangle.svg-DYF4zyUj.js} +1 -1
  57. package/web/assets/{basic-shape-shield.svg-D9JPqU4l.js → basic-shape-shield.svg-CQbzQswT.js} +1 -1
  58. package/web/assets/{browser-BdPlaU7e.js → browser-CDtVZzm0.js} +1 -1
  59. package/web/assets/{browser-B6dstq4l.js → browser-CdTGBSDI.js} +1 -1
  60. package/web/assets/{card-D8XCM024.js → card-BfEdnBhU.js} +2 -2
  61. package/web/assets/{checkbox-C_jx73WS.js → checkbox-CTopTVtp.js} +3 -3
  62. package/web/assets/{chip-CQdqiw0W.js → chip-Cw38kJ50.js} +2 -2
  63. package/web/assets/{client-B_gN8XJ7.js → client-Bjn9AL4v.js} +2 -2
  64. package/web/assets/cloud-chat.store-BPoTzBeD.js +1 -0
  65. package/web/assets/cloud-session-D0ue5Z97.js +1 -0
  66. package/web/assets/column-BtLe8qbf.js +907 -0
  67. package/web/assets/{computer-device-desktop-monitor.svg-CGh6MdTp.js → computer-device-desktop-monitor.svg-ByBKx1CQ.js} +1 -1
  68. package/web/assets/{computer-device-desktop.svg-CSnagCeX.js → computer-device-desktop.svg-BPvzT4sF.js} +1 -1
  69. package/web/assets/{computer-device-laptop.svg-BI_ZVURQ.js → computer-device-laptop.svg-saGCSB2c.js} +1 -1
  70. package/web/assets/{computer-device-mobile-phone-android-samsung-back.svg-DM3ubsFX.js → computer-device-mobile-phone-android-samsung-back.svg-Bo-eisU4.js} +1 -1
  71. package/web/assets/{computer-device-mobile-phone-android-samsung.svg-CzDW3wBE.js → computer-device-mobile-phone-android-samsung.svg-Bavaieis.js} +1 -1
  72. package/web/assets/{computer-device-mobile-phone-iphone-x-back.svg-B41GuLoA.js → computer-device-mobile-phone-iphone-x-back.svg-BQK9BRXi.js} +1 -1
  73. package/web/assets/{computer-device-mobile-phone-iphone-x.svg-Cd1cIH5V.js → computer-device-mobile-phone-iphone-x.svg-C24hCDuI.js} +1 -1
  74. package/web/assets/{computer-device-mobile-tablet-touch.svg-rLuvpYQb.js → computer-device-mobile-tablet-touch.svg-CUHV3zSo.js} +1 -1
  75. package/web/assets/{computer-device-mobile-tablet.svg-DjBMAEhJ.js → computer-device-mobile-tablet.svg-C8SRYMmI.js} +1 -1
  76. package/web/assets/{computer-device-network-ethernet-cat6.svg-BeYjyXJh.js → computer-device-network-ethernet-cat6.svg-Ds4kUid3.js} +1 -1
  77. package/web/assets/{computer-device-network-lan-www.svg-DIR2TMun.js → computer-device-network-lan-www.svg-BwIieS6h.js} +1 -1
  78. package/web/assets/{computer-device-network-wifi-connection.svg-DhI5VT5g.js → computer-device-network-wifi-connection.svg-Q7Mxb3eP.js} +1 -1
  79. package/web/assets/{computer-device-network-wifi-router.svg-BO0V5pTE.js → computer-device-network-wifi-router.svg-B0PMuY1x.js} +1 -1
  80. package/web/assets/{cssMode-CdzA9M1t.js → cssMode-8lAGHoa8.js} +1 -1
  81. package/web/assets/{divider-Cijz8TDb.js → divider-DRKb8XBY.js} +2 -2
  82. package/web/assets/{docx-preview-B8bBf__c.js → docx-preview-K0JOmyAw.js} +1 -1
  83. package/web/assets/{ecology-science-erlenmeyer-flask.svg-BuQW5h4a.js → ecology-science-erlenmeyer-flask.svg-D5wbPwU2.js} +1 -1
  84. package/web/assets/{fieldset-DnZ-YI4V.js → fieldset-jU8x6yyO.js} +2 -2
  85. package/web/assets/{freemarker2-Bp9032QT.js → freemarker2-BmTZDOK9.js} +1 -1
  86. package/web/assets/{handlebars-CdVx92lU.js → handlebars-DM-mBhq3.js} +1 -1
  87. package/web/assets/{html-CkCZL9gx.js → html-BohxI4Ke.js} +1 -1
  88. package/web/assets/{htmlMode-CW62-ie1.js → htmlMode-vqRVK3v5.js} +1 -1
  89. package/web/assets/{image-flash-lightning.svg-DeCuJWFT.js → image-flash-lightning.svg-s-LoyOp-.js} +1 -1
  90. package/web/assets/{image-picture-flower.svg-2ZzZbPy5.js → image-picture-flower.svg-CofKZT5Q.js} +1 -1
  91. package/web/assets/{index-DXGQcaBP.js → index-DHr5P6pq.js} +293 -293
  92. package/web/assets/index-Da38OOd8.css +1 -0
  93. package/web/assets/{interface-alert-exclamation-diamond.svg-D9th7CAp.js → interface-alert-exclamation-diamond.svg-C4C4i4oQ.js} +1 -1
  94. package/web/assets/{interface-alert-exclamation-triangle-warning.svg-Dq9CWWQ3.js → interface-alert-exclamation-triangle-warning.svg-C-ogsTXk.js} +1 -1
  95. package/web/assets/{interface-alert-information-circle.svg-FaG159xA.js → interface-alert-information-circle.svg-BFpBDkj5.js} +1 -1
  96. package/web/assets/{interface-award-crown.svg-B_-NjgUX.js → interface-award-crown.svg-DfHdQ8rJ.js} +1 -1
  97. package/web/assets/{interface-bookmark.svg--yRnhMMQ.js → interface-bookmark-tag.svg-DkfXcRMe.js} +1 -1
  98. package/web/assets/{interface-bookmark-tag.svg-CKjw2WEc.js → interface-bookmark.svg-qCQ3v5rM.js} +1 -1
  99. package/web/assets/{interface-calendar-date-one.svg-BCrvSyS9.js → interface-calendar-date-one.svg-D2ssTK7X.js} +1 -1
  100. package/web/assets/{interface-content-book-open-pages.svg-BGIlAwyt.js → interface-content-book-open-pages.svg-CH1BmaVm.js} +1 -1
  101. package/web/assets/{interface-content-book-page.svg-DeLfK2OR.js → interface-content-book-page.svg-BU6m1d9-.js} +1 -1
  102. package/web/assets/{interface-content-file.svg-DUdYkC8Y.js → interface-content-file.svg-DbsUtWTI.js} +1 -1
  103. package/web/assets/{interface-content-folder.svg-Ccx-IYD-.js → interface-content-folder.svg-8IvlkKzB.js} +1 -1
  104. package/web/assets/interface-content-folder.svg-nRYFY3NY.js +1 -0
  105. package/web/assets/{interface-copy-clipboard.svg-DIR-oOPG.js → interface-copy-clipboard.svg-D8ev9OtX.js} +1 -1
  106. package/web/assets/{interface-edit-attachment.svg-B9CSuzCn.js → interface-edit-attachment.svg-dl-nfI3P.js} +1 -1
  107. package/web/assets/{interface-edit-binocular.svg-6WTqf985.js → interface-edit-binocular.svg-Box_OuXH.js} +1 -1
  108. package/web/assets/{interface-edit-magic-wand.svg-BiB-GwoX.js → interface-edit-magic-wand.svg-DIhMw--x.js} +1 -1
  109. package/web/assets/{interface-edit-tool-paint-roller.svg-Dh0uneh4.js → interface-edit-tool-paint-roller.svg-COUefijc.js} +1 -1
  110. package/web/assets/{interface-edit-tool-pencil.svg-C9HQOHce.js → interface-edit-tool-pencil.svg-BNmSspcl.js} +1 -1
  111. package/web/assets/{interface-favorite-award.svg-Cj_1Qy9M.js → interface-favorite-award.svg-Cy-XeB8N.js} +1 -1
  112. package/web/assets/{interface-favorite-flag.svg-BniwQaep.js → interface-favorite-flag.svg-BVBisei8.js} +1 -1
  113. package/web/assets/{interface-favorite-heart.svg-CYJO0Ggb.js → interface-favorite-heart.svg-BkVO2jBo.js} +1 -1
  114. package/web/assets/{interface-favorite-star.svg-CeFb37gO.js → interface-favorite-star.svg-Bxe8dqRi.js} +1 -1
  115. package/web/assets/{interface-favorite-stars-sparkles.svg-CGeIzi4_.js → interface-favorite-stars-sparkles.svg-MkrYfhIz.js} +1 -1
  116. package/web/assets/{interface-hierarchy-flowchart.svg-Bd0q_y82.js → interface-hierarchy-flowchart.svg-De7TQhr3.js} +1 -1
  117. package/web/assets/{interface-home-house.svg-BqSaaLzz.js → interface-home-house.svg-D_qOil1N.js} +1 -1
  118. package/web/assets/{interface-hyperlink.svg-DTtVOw8L.js → interface-hyperlink.svg-5S7ugTcP.js} +1 -1
  119. package/web/assets/{interface-lighting-brightness.svg-CVNVwF9w.js → interface-lighting-brightness.svg-vJA95mbx.js} +1 -1
  120. package/web/assets/{interface-lock-closed.svg-CKiXr8tU.js → interface-lock-closed.svg-DVL32yBG.js} +1 -1
  121. package/web/assets/{interface-lock-open-unlock.svg-DU7sOeAE.js → interface-lock-open-unlock.svg-C7DBYFPn.js} +1 -1
  122. package/web/assets/{interface-login-key.svg-tuWEt_tn.js → interface-login-key.svg-CEq51fI1.js} +1 -1
  123. package/web/assets/{interface-search.svg-CMDkllvr.js → interface-search.svg-CkP-JMXm.js} +1 -1
  124. package/web/assets/{interface-setting-cog.svg-BRM5rRrt.js → interface-setting-cog.svg-CgR9wxJN.js} +1 -1
  125. package/web/assets/{interface-share-megaphone-bullhorn.svg-BgC_SP2r.js → interface-share-megaphone-bullhorn.svg-C_VIGsI0.js} +1 -1
  126. package/web/assets/{interface-share-rocket.svg-C-XkIKh-.js → interface-share-rocket.svg-aseIyfXq.js} +1 -1
  127. package/web/assets/{interface-share-satellite.svg-BKE0N18S.js → interface-share-satellite.svg-CzkX6PJ2.js} +1 -1
  128. package/web/assets/{interface-share-space-ship.svg-B8QuVt2r.js → interface-share-space-ship.svg-Df1jdZi5.js} +1 -1
  129. package/web/assets/{interface-share.svg-bp3wJyGc.js → interface-share.svg-CioS2p8V.js} +1 -1
  130. package/web/assets/{interface-signal-square.svg-D8XH70Ue.js → interface-signal-square.svg-VUtTXd8G.js} +1 -1
  131. package/web/assets/{interface-time-clock-circle.svg-2DN-SbMe.js → interface-time-clock-circle.svg-DWh2OWyC.js} +1 -1
  132. package/web/assets/{interface-time-hour-glass.svg-l0_r1j5d.js → interface-time-hour-glass.svg-BCqCfi9r.js} +1 -1
  133. package/web/assets/{interface-users-multiple.svg-RRlj9uIH.js → interface-users-multiple.svg-Edac3LOs.js} +1 -1
  134. package/web/assets/{interface-weather-moon.svg-BmdUGPZe.js → interface-weather-moon.svg-BrK0lmKX.js} +1 -1
  135. package/web/assets/{javascript-edU55dwl.js → javascript-ByDc_p54.js} +1 -1
  136. package/web/assets/{jsonMode-CdE3cdJ3.js → jsonMode-Cm2EOOd4.js} +1 -1
  137. package/web/assets/{liquid-DCimUdoJ.js → liquid-z9Tc1tTM.js} +1 -1
  138. package/web/assets/{lspLanguageFeatures-BKbLLFFb.js → lspLanguageFeatures-D6O0oAJj.js} +1 -1
  139. package/web/assets/{mail-chat-bubble-square.svg-VF1duUdO.js → mail-chat-bubble-square.svg-obHuGV3I.js} +1 -1
  140. package/web/assets/{mail-send-email-paper-airplane.svg-CdSpwALk.js → mail-send-email-paper-airplane.svg-I-JVbCkD.js} +1 -1
  141. package/web/assets/{mail-send-envelope.svg-DZVjejiO.js → mail-send-envelope.svg-CcYcXCe5.js} +1 -1
  142. package/web/assets/{mdx-Hv_NSA7I.js → mdx-B8bePw34.js} +1 -1
  143. package/web/assets/{minus-CQh_GdvM.js → minus-k3R4JOtO.js} +2 -2
  144. package/web/assets/modal-CVWJd9ZI.js +5 -0
  145. package/web/assets/modal-Ccn3uciU.js +1 -0
  146. package/web/assets/{money-cashier-receipt.svg-CWHgfD-x.js → money-cashier-receipt.svg-BIKxMBIH.js} +1 -1
  147. package/web/assets/{money-currency-dollar-pay.svg-XPcb5aF0.js → money-currency-dollar-pay.svg-B-HfkTCE.js} +1 -1
  148. package/web/assets/{money-graph-arrow-increase.svg-DhPujH9x.js → money-graph-arrow-increase.svg-CnXoTtSD.js} +1 -1
  149. package/web/assets/{money-graph-bar-chart-increase.svg-BPOlqEDC.js → money-graph-bar-chart-increase.svg-Dt7ly9Tz.js} +1 -1
  150. package/web/assets/multiselect-BsCXwmy0.js +251 -0
  151. package/web/assets/{nature-ecology-leaf.svg-DZNsVAVa.js → nature-ecology-leaf.svg-TjKZfobq.js} +1 -1
  152. package/web/assets/{password-DlR3LzLg.js → password-dyrMCyHO.js} +4 -4
  153. package/web/assets/{phone-telephone.svg-B7vr6N8Z.js → phone-telephone.svg-CCMqAIP_.js} +1 -1
  154. package/web/assets/{plus-BDDTopKC.js → plus-Dg2E4ggP.js} +6 -6
  155. package/web/assets/process.store-CHdSS5Et.js +1 -0
  156. package/web/assets/{programming-bug.svg-DzlGVlKX.js → programming-bug.svg-yyshFuq4.js} +1 -1
  157. package/web/assets/{programming-cloud.svg-QHMLI7Md.js → programming-cloud.svg-DPyoJVZM.js} +1 -1
  158. package/web/assets/{programming-computer-database-server.svg-CjsFgYWn.js → programming-computer-database-server.svg-D7pShcvh.js} +1 -1
  159. package/web/assets/{programming-computer-database.svg-vah-tira.js → programming-computer-database.svg-CErKDQrw.js} +1 -1
  160. package/web/assets/{programming-module-four-layout.svg-Cpk_lyys.js → programming-module-four-layout.svg-B26pG3Bb.js} +1 -1
  161. package/web/assets/{programming-module-three.svg-DPfLaBLh.js → programming-module-three.svg-CnoN59HX.js} +1 -1
  162. package/web/assets/{programming-module.svg-X3KTc78b.js → programming-module.svg-C02rn1I7.js} +1 -1
  163. package/web/assets/{programming-script-code.svg-Btq5sYVs.js → programming-script-code.svg-D0sPjoPV.js} +1 -1
  164. package/web/assets/{python-7W62NPSS.js → python-1623Ut7s.js} +1 -1
  165. package/web/assets/{razor-B-cp1S_J.js → razor-CyTiWHYX.js} +1 -1
  166. package/web/assets/router-DWhykW-F.js +1 -0
  167. package/web/assets/settings-scope-9i3_Io9Z.js +1 -0
  168. package/web/assets/{settings.store-DvVMtpRN.js → settings.store-BPAoJA_7.js} +1 -1
  169. package/web/assets/{shopping-cart.svg-CrAdOGHj.js → shopping-cart.svg-Cusya5ZE.js} +1 -1
  170. package/web/assets/{shopping-gift-present.svg-D6lzCq46.js → shopping-gift-present.svg-DuhD1jDX.js} +1 -1
  171. package/web/assets/{shopping-shipping-box-parcel-package.svg-CvE0Deq6.js → shopping-shipping-box-parcel-package.svg-mUJnCOxq.js} +1 -1
  172. package/web/assets/src-BiD62eGr.js +1 -0
  173. package/web/assets/src-CGoYw9sv.css +1 -0
  174. package/web/assets/{src-KOvSDAsA.js → src-HsHwQ5rW.js} +14 -14
  175. package/web/assets/{tabpanel-DnsLaWEk.js → tabpanel-D-R0gqbm.js} +3 -3
  176. package/web/assets/{tag-new-circle.svg-K7X6DVeY.js → tag-new-circle.svg-DFYYOM3s.js} +1 -1
  177. package/web/assets/{toggleswitch-BIl5_ynN.js → toggleswitch-Bv2Y60nl.js} +2 -2
  178. package/web/assets/{travel-map-earth-globe.svg-CGHyssIY.js → travel-map-earth-globe.svg-D1KtAG5P.js} +1 -1
  179. package/web/assets/trpc-4Nls70HO.js +1 -0
  180. package/web/assets/{tsMode-Ch-xMRFe.js → tsMode-DarxEDX3.js} +1 -1
  181. package/web/assets/{typescript-DaR3W1ZS.js → typescript-Bp83QY3R.js} +1 -1
  182. package/web/assets/useAiChatDrawer-BYR24v6F.js +1 -0
  183. package/web/assets/useCloudOrg-B1BakNYp.js +572 -0
  184. package/web/assets/{useCloudOrg-CZ_ZOAVy.css → useCloudOrg-CkiFdVCe.css} +1 -1
  185. package/web/assets/useProjectCatalog-ClgttEEn.js +1 -0
  186. package/web/assets/{xml-DGHPJrA4.js → xml-CieK61bI.js} +1 -1
  187. package/web/assets/{yaml-Bt6S3avV.js → yaml-Dd4h-bcV.js} +1 -1
  188. package/web/index.html +2 -2
  189. package/agent-manager-WEFGEFRT.js +0 -7
  190. package/chunk-6Y24763Y.js.map +0 -1
  191. package/src-QDQ5AT4C.js.map +0 -1
  192. package/web/assets/AgentScalarChatInterface.vue-BlRhaFfk.js +0 -13
  193. package/web/assets/AgentTerminalPage-Bgz6cN1-.js +0 -1
  194. package/web/assets/AiChatPage-B2ZLntQV.js +0 -1
  195. package/web/assets/AppLayout-CwaLgkBP.js +0 -1
  196. package/web/assets/AuditPage-qw3Fsus7.js +0 -1
  197. package/web/assets/CloudAccountPage-BLOaK1nf.js +0 -1
  198. package/web/assets/CloudAccountPage-DTs4O-ua.js +0 -1
  199. package/web/assets/CloudMessagingPage-Cz1EQr91.js +0 -2
  200. package/web/assets/DashboardPage-B5HHqw9m.js +0 -1
  201. package/web/assets/DirectoryPickerDialog-DjpBVTYW.js +0 -1
  202. package/web/assets/EnvironmentForm-C9NbiSRH.js +0 -108
  203. package/web/assets/EnvironmentFormPage-DWbL-D3Z.js +0 -1
  204. package/web/assets/EnvironmentListPage-rdeHc34g.js +0 -1
  205. package/web/assets/KanbanBoardPage-CbHeyK8M.js +0 -4
  206. package/web/assets/KanbanListPage-xIqiBmTe.js +0 -1
  207. package/web/assets/LaunchProjectPage-D04ok35N.js +0 -1
  208. package/web/assets/LaunchServicesPage-Bkhxe7Ko.js +0 -1
  209. package/web/assets/LogViewer-BHlGDB4l.js +0 -3
  210. package/web/assets/OrgKeyPrompt-CnIY4K5s.js +0 -1
  211. package/web/assets/ProcessDetailPage-BQCvKU0O.js +0 -1
  212. package/web/assets/ProjectDetailPage-Cjf4eBYS.js +0 -1
  213. package/web/assets/ProjectListPage-DQH1VC3U.js +0 -1
  214. package/web/assets/RandomJobTestPage-BMc4Qb-3.js +0 -2
  215. package/web/assets/ScenarioEditorPage-ClH3vxG9.js +0 -14
  216. package/web/assets/SendToChatDialog-5TxDHf96.js +0 -1
  217. package/web/assets/ServiceControlsBar-D0nrwVz7.js +0 -1
  218. package/web/assets/ServiceDetailPage-DLTZ2bjR.js +0 -2
  219. package/web/assets/ServiceFormPage-BoUHidR5.js +0 -1
  220. package/web/assets/SettingsPage-B6jM9W4h.js +0 -2063
  221. package/web/assets/UnlockPage-boIYvNg3.js +0 -1
  222. package/web/assets/VariablesTable-Eyqi7OJN.js +0 -1
  223. package/web/assets/VaultMigrationPage-CqKla89B.js +0 -1
  224. package/web/assets/VersionBadge-CnU3z5Rl.js +0 -1
  225. package/web/assets/WikiPage-Cbdxhr9G.js +0 -1
  226. package/web/assets/WikiView-BeWVPGaR.js +0 -1
  227. package/web/assets/add-scalar-classes-CG8bn7uZ.js +0 -387
  228. package/web/assets/auth-errors-CZibvB1j.js +0 -1
  229. package/web/assets/cloud-chat.store-BB8XNnvp.js +0 -1
  230. package/web/assets/cloud-session-f2IzlmYY.js +0 -1
  231. package/web/assets/column-BaNiShA4.js +0 -907
  232. package/web/assets/index-Cz0azMVO.css +0 -1
  233. package/web/assets/interface-content-folder.svg-C0OEvuKX.js +0 -1
  234. package/web/assets/modal-BO4YZ0Od.js +0 -1
  235. package/web/assets/modal-DUYd78Dq.js +0 -5
  236. package/web/assets/multiselect-DJ80nRN0.js +0 -251
  237. package/web/assets/process.store-Dq6j8zkt.js +0 -1
  238. package/web/assets/router-BzVLWWlf.js +0 -1
  239. package/web/assets/settings-scope-B2XSViBz.js +0 -1
  240. package/web/assets/src-DB1mNeZv.js +0 -1
  241. package/web/assets/src-DIxcn8ra.css +0 -1
  242. package/web/assets/trpc-BT4fWDYZ.js +0 -1
  243. package/web/assets/useAiChatDrawer-Bn5BBHr2.js +0 -1
  244. package/web/assets/useCloudOrg-CCXszfIX.js +0 -572
  245. package/web/assets/useProjectCatalog-CHgbaNsn.js +0 -1
  246. /package/{agent-manager-WEFGEFRT.js.map → agent-manager-3KSS7BHP.js.map} +0 -0
@@ -5,6 +5,9 @@ import {
5
5
  AmbiguousProjectError,
6
6
  ApiKeyScopeSchema,
7
7
  ApiKeysFileSchema,
8
+ ChangelogIndexItemSchema,
9
+ ChangelogReleaseSchema,
10
+ ChangelogSurfaceSchema,
8
11
  CreateEnvironmentSchema,
9
12
  DockerConfigSchema,
10
13
  EDITOR_BY_KEY,
@@ -114,7 +117,7 @@ import {
114
117
  wasRead,
115
118
  withDeprecatedAliases,
116
119
  writeEntity
117
- } from "./chunk-6Y24763Y.js";
120
+ } from "./chunk-4PQXBTV6.js";
118
121
 
119
122
  // ../server/src/create-server.ts
120
123
  import express from "express";
@@ -494,6 +497,28 @@ function compareSemver(a, b) {
494
497
  }
495
498
  return 0;
496
499
  }
500
+ var VERSION_CACHE_MS = 4 * 60 * 1e3;
501
+ var versionCache = null;
502
+ async function fetchLatestVersion() {
503
+ if (versionCache && Date.now() - versionCache.at < VERSION_CACHE_MS) {
504
+ return versionCache.latest;
505
+ }
506
+ let latest = null;
507
+ try {
508
+ const res = await fetch(NPM_LATEST_URL, {
509
+ headers: { accept: "application/json" },
510
+ signal: AbortSignal.timeout(5e3)
511
+ });
512
+ if (res.ok) {
513
+ const parsed = z.object({ version: z.string().max(64) }).safeParse(await res.json());
514
+ if (parsed.success) latest = parsed.data.version;
515
+ }
516
+ } catch {
517
+ latest = null;
518
+ }
519
+ versionCache = { at: Date.now(), latest };
520
+ return latest;
521
+ }
497
522
  var healthRouter = router({
498
523
  check: publicProcedure.meta({ openapi: { method: "GET", path: "/health", tags: ["health"], summary: "Health check" } }).output(z.object({ status: z.literal("ok"), uptime: z.number(), version: z.string() })).query(() => {
499
524
  return {
@@ -512,25 +537,13 @@ var healthRouter = router({
512
537
  if (appVersion === "dev") {
513
538
  return { current: appVersion, latest: null, status: "dev" };
514
539
  }
515
- try {
516
- const res = await fetch(NPM_LATEST_URL, {
517
- headers: { accept: "application/json" },
518
- signal: AbortSignal.timeout(5e3)
519
- });
520
- if (!res.ok) {
521
- return { current: appVersion, latest: null, status: "unknown" };
522
- }
523
- const parsed = z.object({ version: z.string().max(64) }).safeParse(await res.json());
524
- if (!parsed.success) {
525
- return { current: appVersion, latest: null, status: "unknown" };
526
- }
527
- const latest = parsed.data.version;
528
- const cmp = compareSemver(appVersion, latest);
529
- const status = cmp === 0 ? "up-to-date" : cmp < 0 ? "outdated" : "ahead";
530
- return { current: appVersion, latest, status };
531
- } catch {
540
+ const latest = await fetchLatestVersion();
541
+ if (latest === null) {
532
542
  return { current: appVersion, latest: null, status: "unknown" };
533
543
  }
544
+ const cmp = compareSemver(appVersion, latest);
545
+ const status = cmp === 0 ? "up-to-date" : cmp < 0 ? "outdated" : "ahead";
546
+ return { current: appVersion, latest, status };
534
547
  }),
535
548
  systemInfo: protectedProcedure.output(
536
549
  z.object({
@@ -701,18 +714,233 @@ var appUpdateRouter = router({
701
714
  })
702
715
  });
703
716
 
704
- // ../server/src/trpc/routers/project.ts
717
+ // ../server/src/trpc/routers/changelog.ts
705
718
  import { z as z3 } from "zod";
719
+
720
+ // ../server/src/services/cloud-session-store.ts
721
+ import { readFile as readFile2, writeFile as writeFile2, rename as rename2, mkdir as mkdir2, chmod as chmod2, unlink } from "fs/promises";
722
+ import { dirname as dirname3 } from "path";
723
+ import { randomBytes as randomBytes3, timingSafeEqual as timingSafeEqual2 } from "crypto";
724
+ var FILENAME = "cloud-session.json";
725
+ var STATE_TTL_MS = 5 * 60 * 1e3;
726
+ var CloudSessionStore = class {
727
+ session = null;
728
+ loaded = false;
729
+ /** Pending login states (CSRF binding between `start` and the callback). */
730
+ pending = /* @__PURE__ */ new Map();
731
+ /**
732
+ * Encrypted, so it lives beside the key that opens it — usually the machine
733
+ * root, but a launch directory owning its own key keeps both together.
734
+ */
735
+ getFilePath() {
736
+ return keyedFilePath(FILENAME);
737
+ }
738
+ /** Where older versions kept it — read only, so an older Runeya keeps working. */
739
+ getLegacyFilePath() {
740
+ return legacyMachineFilePath(FILENAME);
741
+ }
742
+ /**
743
+ * Read the machine file, falling back to the launch directory of old.
744
+ *
745
+ * The legacy file is left in place: the next save writes the new location,
746
+ * and a directory still opened by an older Runeya keeps working meanwhile.
747
+ */
748
+ async readFromDisk() {
749
+ try {
750
+ return await readFile2(await this.getFilePath(), "utf-8");
751
+ } catch {
752
+ return readFile2(this.getLegacyFilePath(), "utf-8");
753
+ }
754
+ }
755
+ async load() {
756
+ if (this.loaded) return;
757
+ try {
758
+ const raw = await this.readFromDisk();
759
+ this.session = JSON.parse(raw);
760
+ } catch {
761
+ }
762
+ this.loaded = true;
763
+ }
764
+ /**
765
+ * Mint a state value binding a login attempt to this server. Returned to the
766
+ * cloud page and echoed back on the callback, so a redirect we never
767
+ * initiated cannot install a token.
768
+ */
769
+ createState(returnTo) {
770
+ this.sweepStates();
771
+ const state = randomBytes3(32).toString("hex");
772
+ this.pending.set(state, { expiresAt: Date.now() + STATE_TTL_MS, returnTo });
773
+ return state;
774
+ }
775
+ /**
776
+ * Consume a state — single use, constant-time compare, TTL enforced. Returns
777
+ * the URL to send the browser back to, or null when the state is unknown or
778
+ * expired (i.e. a callback this server never initiated).
779
+ */
780
+ consumeState(candidate) {
781
+ this.sweepStates();
782
+ for (const [state, entry] of this.pending) {
783
+ const a = Buffer.from(state);
784
+ const b = Buffer.from(candidate);
785
+ if (a.length === b.length && timingSafeEqual2(a, b)) {
786
+ this.pending.delete(state);
787
+ return entry.expiresAt > Date.now() ? entry.returnTo : null;
788
+ }
789
+ }
790
+ return null;
791
+ }
792
+ sweepStates() {
793
+ const now = Date.now();
794
+ for (const [state, entry] of this.pending) {
795
+ if (entry.expiresAt <= now) this.pending.delete(state);
796
+ }
797
+ }
798
+ async save() {
799
+ await mkdir2(dirname3(await this.getFilePath()), { recursive: true });
800
+ const filePath = await this.getFilePath();
801
+ const tmpPath = filePath + ".tmp";
802
+ await writeFile2(tmpPath, JSON.stringify(this.session, null, 2), "utf-8");
803
+ await rename2(tmpPath, filePath);
804
+ await chmod2(filePath, 384);
805
+ }
806
+ /** Store the session token obtained from the one-time-token exchange. */
807
+ async set(cloudUrl, token) {
808
+ await this.load();
809
+ this.session = { cloudUrl, encryptedToken: encryptValue(token) };
810
+ await this.save();
811
+ }
812
+ /** The decrypted session token, or null when not logged in. */
813
+ async getToken() {
814
+ await this.load();
815
+ if (!this.session) return null;
816
+ try {
817
+ return decryptValue(this.session.encryptedToken);
818
+ } catch {
819
+ return null;
820
+ }
821
+ }
822
+ /**
823
+ * The cloud this machine is signed into, or null when not linked.
824
+ *
825
+ * Needed to tell "an org I am not a member of" apart from "an org of another
826
+ * cloud instance entirely" — the ids of two clouds share no namespace, so
827
+ * comparing them without this would call every foreign-cloud project a
828
+ * permission problem.
829
+ */
830
+ async getCloudUrl() {
831
+ await this.load();
832
+ return this.session?.cloudUrl ?? null;
833
+ }
834
+ async isLinked() {
835
+ return await this.getToken() !== null;
836
+ }
837
+ /** Forget the session (sign-out). */
838
+ async clear() {
839
+ await this.load();
840
+ this.session = null;
841
+ this.pending.clear();
842
+ try {
843
+ await unlink(await this.getFilePath());
844
+ } catch {
845
+ }
846
+ }
847
+ };
848
+ var cloudSessionStore = new CloudSessionStore();
849
+
850
+ // ../server/src/services/cloud-api.ts
851
+ var DEFAULT_CLOUD_API_URL = "https://api.runeya.dev";
852
+ var DEFAULT_CLOUD_APP_URL = "https://runeya.dev";
853
+ function getCloudApiUrl() {
854
+ return (env.CLOUD_URL ?? DEFAULT_CLOUD_API_URL).replace(/\/+$/, "");
855
+ }
856
+ function getCloudAppUrl() {
857
+ return (env.CLOUD_APP_URL ?? DEFAULT_CLOUD_APP_URL).replace(/\/+$/, "");
858
+ }
859
+ var CloudNotLinkedError = class extends Error {
860
+ code = "CLOUD_NOT_LINKED";
861
+ constructor() {
862
+ super("Not linked to the Runeya cloud.");
863
+ this.name = "CloudNotLinkedError";
864
+ }
865
+ };
866
+ async function cloudFetch(path, init = {}) {
867
+ const token = await cloudSessionStore.getToken();
868
+ if (!token) throw new CloudNotLinkedError();
869
+ return fetch(`${getCloudApiUrl()}${path}`, {
870
+ method: init.method ?? "GET",
871
+ headers: {
872
+ Authorization: `Bearer ${token}`,
873
+ // Le cloud refuse (426) les apps trop anciennes pour son schéma courant.
874
+ [APP_VERSION_HEADER]: appVersion,
875
+ ...init.body !== void 0 ? { "Content-Type": "application/json" } : {}
876
+ },
877
+ ...init.body !== void 0 ? { body: JSON.stringify(init.body) } : {},
878
+ // 15s suits a JSON call; attachment downloads pass a longer budget.
879
+ signal: AbortSignal.timeout(init.timeoutMs ?? 15e3)
880
+ });
881
+ }
882
+
883
+ // ../server/src/trpc/routers/changelog.ts
884
+ var CACHE_MS = 5 * 60 * 1e3;
885
+ var cache = /* @__PURE__ */ new Map();
886
+ async function cloudChangelog(path, params) {
887
+ const search = new URLSearchParams();
888
+ for (const [key, value2] of Object.entries(params)) if (value2) search.set(key, value2);
889
+ const url = `${getCloudApiUrl()}${path}?${search.toString()}`;
890
+ const hit = cache.get(url);
891
+ if (hit && Date.now() - hit.at < CACHE_MS) return hit.value;
892
+ const res = await fetch(url, {
893
+ headers: { accept: "application/json" },
894
+ signal: AbortSignal.timeout(8e3)
895
+ });
896
+ if (!res.ok) throw new Error(`changelog: HTTP ${res.status}`);
897
+ const value = await res.json();
898
+ cache.set(url, { at: Date.now(), value });
899
+ return value;
900
+ }
901
+ function appCeiling() {
902
+ return appVersion === "dev" ? null : appVersion;
903
+ }
904
+ var inputSchema = z3.object({
905
+ surface: ChangelogSurfaceSchema,
906
+ /** Dernière version déjà vue par ce navigateur, exclue du résultat. */
907
+ since: z3.string().max(32).nullish()
908
+ });
909
+ var changelogRouter = router({
910
+ /** Ce qu'il y a à lire, sans les corps. */
911
+ index: publicProcedure.input(inputSchema).output(z3.object({ releases: z3.array(ChangelogIndexItemSchema), currentAppVersion: z3.string() })).query(async ({ input }) => {
912
+ const data = await cloudChangelog("/api/changelog", {
913
+ surface: input.surface,
914
+ since: input.since ?? null,
915
+ until: input.surface === "app" ? appCeiling() : null
916
+ });
917
+ const parsed = z3.object({ releases: z3.array(ChangelogIndexItemSchema) }).parse(data);
918
+ return { releases: parsed.releases, currentAppVersion: appVersion };
919
+ }),
920
+ /** Les entrées complètes. */
921
+ releases: publicProcedure.input(inputSchema).output(z3.object({ releases: z3.array(ChangelogReleaseSchema), currentAppVersion: z3.string() })).query(async ({ input }) => {
922
+ const data = await cloudChangelog("/api/changelog/releases", {
923
+ surface: input.surface,
924
+ since: input.since ?? null,
925
+ until: input.surface === "app" ? appCeiling() : null
926
+ });
927
+ const parsed = z3.object({ releases: z3.array(ChangelogReleaseSchema) }).parse(data);
928
+ return { releases: parsed.releases, currentAppVersion: appVersion };
929
+ })
930
+ });
931
+
932
+ // ../server/src/trpc/routers/project.ts
933
+ import { z as z4 } from "zod";
706
934
  import { TRPCError as TRPCError3 } from "@trpc/server";
707
935
 
708
936
  // ../server/src/services/project-store.ts
709
937
  import { randomUUID as randomUUID2 } from "crypto";
710
938
  import { EventEmitter } from "events";
711
- import { readFile as readFile3, writeFile as writeFile4, rename as rename3, mkdir as mkdir3, chmod as chmod3, rm } from "fs/promises";
939
+ import { readFile as readFile4, writeFile as writeFile5, rename as rename4, mkdir as mkdir4, chmod as chmod4, rm } from "fs/promises";
712
940
  import { join as join5 } from "path";
713
941
 
714
942
  // ../server/src/utils/ensure-data-gitignore.ts
715
- import { writeFile as writeFile2 } from "fs/promises";
943
+ import { writeFile as writeFile3 } from "fs/promises";
716
944
  import { join as join3 } from "path";
717
945
  var GITIGNORE_CONTENT = `
718
946
  #################
@@ -751,19 +979,19 @@ conversations.private.json
751
979
  `;
752
980
  async function ensureDataGitignore(dataDir) {
753
981
  const gitignorePath = join3(dataDir, ".gitignore");
754
- await writeFile2(gitignorePath, GITIGNORE_CONTENT, "utf-8");
982
+ await writeFile3(gitignorePath, GITIGNORE_CONTENT, "utf-8");
755
983
  }
756
984
 
757
985
  // ../server/src/services/project-path-store.ts
758
- import { readFile as readFile2, writeFile as writeFile3, rename as rename2, mkdir as mkdir2, chmod as chmod2, stat } from "fs/promises";
986
+ import { readFile as readFile3, writeFile as writeFile4, rename as rename3, mkdir as mkdir3, chmod as chmod3, stat } from "fs/promises";
759
987
  import { isAbsolute, join as join4, resolve } from "path";
760
- var FILENAME = "project-paths.json";
988
+ var FILENAME2 = "project-paths.json";
761
989
  var ProjectPathStore = class {
762
990
  paths = null;
763
991
  async load() {
764
992
  if (this.paths) return this.paths;
765
993
  try {
766
- const raw = await readFile2(machineFilePath(FILENAME), "utf-8");
994
+ const raw = await readFile3(machineFilePath(FILENAME2), "utf-8");
767
995
  const parsed = JSON.parse(raw);
768
996
  this.paths = isPathMap(parsed) ? parsed : {};
769
997
  } catch {
@@ -772,12 +1000,12 @@ var ProjectPathStore = class {
772
1000
  return this.paths;
773
1001
  }
774
1002
  async persist() {
775
- await mkdir2(machineRoot(), { recursive: true });
776
- const filePath = machineFilePath(FILENAME);
1003
+ await mkdir3(machineRoot(), { recursive: true });
1004
+ const filePath = machineFilePath(FILENAME2);
777
1005
  const tmpPath = `${filePath}.tmp`;
778
- await writeFile3(tmpPath, JSON.stringify(this.paths ?? {}, null, 2), "utf-8");
779
- await rename2(tmpPath, filePath);
780
- await chmod2(filePath, 384);
1006
+ await writeFile4(tmpPath, JSON.stringify(this.paths ?? {}, null, 2), "utf-8");
1007
+ await rename3(tmpPath, filePath);
1008
+ await chmod3(filePath, 384);
781
1009
  }
782
1010
  /** The directory chosen for this project, or null while it has none. */
783
1011
  async get(ref) {
@@ -855,7 +1083,7 @@ async function holdsRuneyaProject(path) {
855
1083
  var projectPathStore = new ProjectPathStore();
856
1084
 
857
1085
  // ../server/src/services/project-store.ts
858
- var FILENAME2 = "project.json";
1086
+ var FILENAME3 = "project.json";
859
1087
  var LEGACY_FILENAME = "projects.json";
860
1088
  function toDiskForm(project) {
861
1089
  const { activeEnvironmentId: _runtimeOnly, ...rest } = project;
@@ -865,14 +1093,14 @@ async function readLocalProject() {
865
1093
  const root = localVaultRoot();
866
1094
  let current = null;
867
1095
  try {
868
- const raw = await readFile3(join5(root, FILENAME2), "utf-8");
1096
+ const raw = await readFile4(join5(root, FILENAME3), "utf-8");
869
1097
  const parsed = ProjectSchema.safeParse(JSON.parse(raw));
870
1098
  if (parsed.success) current = parsed.data;
871
1099
  } catch {
872
1100
  }
873
1101
  let legacy;
874
1102
  try {
875
- legacy = JSON.parse(await readFile3(join5(root, LEGACY_FILENAME), "utf-8"));
1103
+ legacy = JSON.parse(await readFile4(join5(root, LEGACY_FILENAME), "utf-8"));
876
1104
  } catch {
877
1105
  return { local: current, strayCloud: [] };
878
1106
  }
@@ -891,7 +1119,7 @@ async function readCloudProjects() {
891
1119
  const found = [];
892
1120
  for (const { orgId, projectId, root } of await listCloudVaults()) {
893
1121
  try {
894
- const raw = await readFile3(join5(root, FILENAME2), "utf-8");
1122
+ const raw = await readFile4(join5(root, FILENAME3), "utf-8");
895
1123
  const parsed = ProjectSchema.safeParse({ ...JSON.parse(raw), id: projectId, orgId });
896
1124
  if (parsed.success) found.push({ project: parsed.data, root });
897
1125
  } catch {
@@ -921,13 +1149,13 @@ var ProjectStore = class {
921
1149
  /** Emits `'saved'` after every persisted mutation, for the cloud sync bridge. */
922
1150
  events = new EventEmitter();
923
1151
  getFilePath(root = localVaultRoot()) {
924
- return join5(root, FILENAME2);
1152
+ return join5(root, FILENAME3);
925
1153
  }
926
1154
  async writeAtomic(filePath, data) {
927
1155
  const tmpPath = filePath + ".tmp";
928
- await writeFile4(tmpPath, data, "utf-8");
929
- await rename3(tmpPath, filePath);
930
- await chmod3(filePath, 384);
1156
+ await writeFile5(tmpPath, data, "utf-8");
1157
+ await rename4(tmpPath, filePath);
1158
+ await chmod4(filePath, 384);
931
1159
  }
932
1160
  /** Adopt a project read from disk, remembering which vault it came from. */
933
1161
  async absorb(p, root) {
@@ -1002,10 +1230,10 @@ var ProjectStore = class {
1002
1230
  await rm(this.getFilePath(), { force: true }).catch(() => {
1003
1231
  });
1004
1232
  }
1005
- await rename3(join5(localVaultRoot(), LEGACY_FILENAME), join5(localVaultRoot(), LEGACY_FILENAME + ".bak")).catch(() => {
1233
+ await rename4(join5(localVaultRoot(), LEGACY_FILENAME), join5(localVaultRoot(), LEGACY_FILENAME + ".bak")).catch(() => {
1006
1234
  });
1007
1235
  for (const { project, root } of cloud) {
1008
- await mkdir3(root, { recursive: true });
1236
+ await mkdir4(root, { recursive: true });
1009
1237
  await this.writeAtomic(this.getFilePath(root), JSON.stringify(toDiskForm(project), null, 2));
1010
1238
  setProjectVault(project, root);
1011
1239
  }
@@ -1296,9 +1524,9 @@ var projectStore = new ProjectStore();
1296
1524
  registerProjectLoader(() => projectStore.list().then(() => void 0));
1297
1525
 
1298
1526
  // ../server/src/services/environment-overrides-store.ts
1299
- import { readFile as readFile4, writeFile as writeFile5, rename as rename4, mkdir as mkdir4, chmod as chmod4 } from "fs/promises";
1300
- import { dirname as dirname3, join as join6 } from "path";
1301
- var FILENAME3 = "environment-overrides.json";
1527
+ import { readFile as readFile5, writeFile as writeFile6, rename as rename5, mkdir as mkdir5, chmod as chmod5 } from "fs/promises";
1528
+ import { dirname as dirname4, join as join6 } from "path";
1529
+ var FILENAME4 = "environment-overrides.json";
1302
1530
  var EnvironmentOverridesStore = class {
1303
1531
  data = {};
1304
1532
  loaded = false;
@@ -1330,11 +1558,11 @@ var EnvironmentOverridesStore = class {
1330
1558
  async rootFor(variableId) {
1331
1559
  const root = await environmentStore.rootOfVariable(variableId);
1332
1560
  if (root) return root;
1333
- return this.roots.get(variableId) ?? dirname3(await keyedFilePath(FILENAME3));
1561
+ return this.roots.get(variableId) ?? dirname4(await keyedFilePath(FILENAME4));
1334
1562
  }
1335
1563
  /** Where earlier versions kept them: read once, rewritten to their vaults. */
1336
1564
  getLegacyFilePath() {
1337
- return legacyMachineFilePath(FILENAME3);
1565
+ return legacyMachineFilePath(FILENAME4);
1338
1566
  }
1339
1567
  /**
1340
1568
  * Read every vault, then the places older versions used.
@@ -1350,13 +1578,13 @@ var EnvironmentOverridesStore = class {
1350
1578
  const roots = await allVaultRoots();
1351
1579
  const sources = [
1352
1580
  this.getLegacyFilePath(),
1353
- await keyedFilePath(FILENAME3),
1354
- ...roots.map((root) => join6(root, FILENAME3))
1581
+ await keyedFilePath(FILENAME4),
1582
+ ...roots.map((root) => join6(root, FILENAME4))
1355
1583
  ];
1356
1584
  for (const path of sources) {
1357
1585
  let parsed;
1358
1586
  try {
1359
- parsed = JSON.parse(await readFile4(path, "utf-8"));
1587
+ parsed = JSON.parse(await readFile5(path, "utf-8"));
1360
1588
  } catch {
1361
1589
  continue;
1362
1590
  }
@@ -1368,11 +1596,11 @@ var EnvironmentOverridesStore = class {
1368
1596
  parsed,
1369
1597
  "environment-overrides",
1370
1598
  (variableId) => this.unreadableSecrets.add(variableId),
1371
- vaultIdOfRoot(dirname3(path))
1599
+ vaultIdOfRoot(dirname4(path))
1372
1600
  );
1373
1601
  for (const [id, override] of Object.entries(decrypted)) {
1374
1602
  this.data[id] = { value: override.value };
1375
- this.roots.set(id, dirname3(path));
1603
+ this.roots.set(id, dirname4(path));
1376
1604
  }
1377
1605
  }
1378
1606
  }
@@ -1407,12 +1635,12 @@ var EnvironmentOverridesStore = class {
1407
1635
  this.diskEncryptedSlots,
1408
1636
  extractEncryptedVariableSlots(encrypted)
1409
1637
  );
1410
- await mkdir4(root, { recursive: true });
1411
- const path = join6(root, FILENAME3);
1638
+ await mkdir5(root, { recursive: true });
1639
+ const path = join6(root, FILENAME4);
1412
1640
  const tmpPath = path + ".tmp";
1413
- await writeFile5(tmpPath, JSON.stringify(encrypted, null, 2), "utf-8");
1414
- await rename4(tmpPath, path);
1415
- await chmod4(path, 384);
1641
+ await writeFile6(tmpPath, JSON.stringify(encrypted, null, 2), "utf-8");
1642
+ await rename5(tmpPath, path);
1643
+ await chmod5(path, 384);
1416
1644
  }
1417
1645
  }
1418
1646
  /**
@@ -1849,7 +2077,7 @@ var EnvironmentResolver = class {
1849
2077
  var environmentResolver = new EnvironmentResolver();
1850
2078
 
1851
2079
  // ../server/src/services/audit-service.ts
1852
- import { appendFile, readFile as readFile5, stat as stat2, rename as rename5, unlink, readdir, mkdir as mkdir5 } from "fs/promises";
2080
+ import { appendFile, readFile as readFile6, stat as stat2, rename as rename6, unlink as unlink2, readdir, mkdir as mkdir6 } from "fs/promises";
1853
2081
  var AUDIT_FILENAME = "audit.log";
1854
2082
  var MAX_FILE_SIZE = 10 * 1024 * 1024;
1855
2083
  var MAX_AGE_DAYS = 30;
@@ -1869,7 +2097,7 @@ var AuditService = class {
1869
2097
  const line = JSON.stringify(record) + "\n";
1870
2098
  const filepath = this.getFilePath();
1871
2099
  try {
1872
- await mkdir5(machineRoot(), { recursive: true });
2100
+ await mkdir6(machineRoot(), { recursive: true });
1873
2101
  await appendFile(filepath, line, "utf-8");
1874
2102
  await this.rotateIfNeeded();
1875
2103
  } catch (err) {
@@ -1882,7 +2110,7 @@ var AuditService = class {
1882
2110
  const filepath = this.getFilePath();
1883
2111
  let lines;
1884
2112
  try {
1885
- const content = await readFile5(filepath, "utf-8");
2113
+ const content = await readFile6(filepath, "utf-8");
1886
2114
  lines = content.trim().split("\n").filter(Boolean);
1887
2115
  } catch {
1888
2116
  return { entries: [], total: 0 };
@@ -1915,7 +2143,7 @@ var AuditService = class {
1915
2143
  try {
1916
2144
  const stats = await stat2(filepath);
1917
2145
  if (stats.size > MAX_FILE_SIZE) {
1918
- await rename5(filepath, this.getRotatedPath());
2146
+ await rename6(filepath, this.getRotatedPath());
1919
2147
  }
1920
2148
  } catch {
1921
2149
  }
@@ -1930,7 +2158,7 @@ var AuditService = class {
1930
2158
  const ts = Number.parseInt(tsStr, 10);
1931
2159
  if (!Number.isNaN(ts) && ts < cutoff) {
1932
2160
  try {
1933
- await unlink(machineFilePath(file));
2161
+ await unlink2(machineFilePath(file));
1934
2162
  } catch {
1935
2163
  }
1936
2164
  }
@@ -1941,11 +2169,11 @@ var AuditService = class {
1941
2169
  var auditService = new AuditService();
1942
2170
 
1943
2171
  // ../server/src/services/org-keys.ts
1944
- import { mkdir as mkdir6 } from "fs/promises";
2172
+ import { mkdir as mkdir7 } from "fs/promises";
1945
2173
 
1946
2174
  // ../server/src/services/master-password.ts
1947
- import { randomBytes as randomBytes3, createCipheriv, createDecipheriv } from "crypto";
1948
- import { readFile as readFile6, writeFile as writeFile6, chmod as chmod5, stat as stat3, rename as rename6 } from "fs/promises";
2175
+ import { randomBytes as randomBytes4, createCipheriv, createDecipheriv } from "crypto";
2176
+ import { readFile as readFile7, writeFile as writeFile7, chmod as chmod6, stat as stat3, rename as rename7 } from "fs/promises";
1949
2177
  import { join as join7 } from "path";
1950
2178
  import { Entry } from "@napi-rs/keyring";
1951
2179
  import { hashRaw as argon2HashRaw } from "@node-rs/argon2";
@@ -1960,10 +2188,10 @@ var ARGON2_OPTIONS = { memoryCost: 65536, timeCost: 3, parallelism: 4, outputLen
1960
2188
  async function readKeyFile(filePath) {
1961
2189
  const s = await stat3(filePath);
1962
2190
  if (s.size > MAX_KEY_FILE_SIZE) throw new Error(`Fichier suspect : ${filePath} (${s.size} octets)`);
1963
- return readFile6(filePath);
2191
+ return readFile7(filePath);
1964
2192
  }
1965
2193
  function aesEncrypt(key, plaintext) {
1966
- const iv = randomBytes3(12);
2194
+ const iv = randomBytes4(12);
1967
2195
  const cipher = createCipheriv("aes-256-gcm", key, iv);
1968
2196
  const encrypted = Buffer.concat([cipher.update(plaintext), cipher.final()]);
1969
2197
  const authTag = cipher.getAuthTag();
@@ -1989,9 +2217,9 @@ async function getPepperFromFile(dataDir) {
1989
2217
  async function writePepperToFile(dataDir, pepper) {
1990
2218
  const filePath = join7(dataDir, PEPPER_FILENAME);
1991
2219
  const tmpPath = filePath + ".tmp";
1992
- await writeFile6(tmpPath, pepper.toString("hex"), "utf-8");
1993
- await chmod5(tmpPath, 384);
1994
- await rename6(tmpPath, filePath);
2220
+ await writeFile7(tmpPath, pepper.toString("hex"), "utf-8");
2221
+ await chmod6(tmpPath, 384);
2222
+ await rename7(tmpPath, filePath);
1995
2223
  }
1996
2224
  function tryKeyringGet() {
1997
2225
  try {
@@ -2015,7 +2243,7 @@ async function getOrCreatePepper(dataDir) {
2015
2243
  }
2016
2244
  const filePepper = await getPepperFromFile(dataDir);
2017
2245
  if (filePepper) return filePepper;
2018
- const pepper = randomBytes3(32);
2246
+ const pepper = randomBytes4(32);
2019
2247
  const saved = tryKeyringSet(pepper.toString("hex"));
2020
2248
  if (!saved) {
2021
2249
  console.warn("[master-password] Keyring unavailable, storing pepper in dataDir (fallback)");
@@ -2033,16 +2261,16 @@ async function deriveKey(masterPassword, pepper, salt) {
2033
2261
  }
2034
2262
  async function writeEncryptedKey(dataDir, masterPassword, encryptionKey, pepperDir = dataDir) {
2035
2263
  const pepper = await getOrCreatePepper(pepperDir);
2036
- const salt = randomBytes3(16);
2264
+ const salt = randomBytes4(16);
2037
2265
  const derivedKey = await deriveKey(masterPassword, pepper, salt);
2038
2266
  const payload = aesEncrypt(derivedKey, encryptionKey);
2039
2267
  const fileContent = Buffer.concat([salt, payload]);
2040
2268
  const encoded = fileContent.toString("base64");
2041
2269
  const filePath = join7(dataDir, ENCRYPTED_KEY_FILENAME);
2042
2270
  const tmpPath = filePath + ".tmp";
2043
- await writeFile6(tmpPath, encoded, "utf-8");
2044
- await chmod5(tmpPath, 384);
2045
- await rename6(tmpPath, filePath);
2271
+ await writeFile7(tmpPath, encoded, "utf-8");
2272
+ await chmod6(tmpPath, 384);
2273
+ await rename7(tmpPath, filePath);
2046
2274
  }
2047
2275
  async function readEncryptedKey(dataDir, masterPassword, pepperDir = dataDir) {
2048
2276
  const filePath = join7(dataDir, ENCRYPTED_KEY_FILENAME);
@@ -2067,8 +2295,8 @@ async function writeVerifyFile(dataDir, encryptionKey) {
2067
2295
  const payload = aesEncrypt(encryptionKey, Buffer.from(CANARY_PLAINTEXT, "utf-8"));
2068
2296
  const filePath = join7(dataDir, VERIFY_FILENAME);
2069
2297
  const tmpPath = filePath + ".tmp";
2070
- await writeFile6(tmpPath, payload.toString("base64"), "utf-8");
2071
- await rename6(tmpPath, filePath);
2298
+ await writeFile7(tmpPath, payload.toString("base64"), "utf-8");
2299
+ await rename7(tmpPath, filePath);
2072
2300
  }
2073
2301
  async function verifyEncryptionKey(dataDir, encryptionKey) {
2074
2302
  const filePath = join7(dataDir, VERIFY_FILENAME);
@@ -2142,7 +2370,7 @@ async function unlockOrgKeys(masterPassword) {
2142
2370
  }
2143
2371
  continue;
2144
2372
  }
2145
- await mkdir6(root, { recursive: true });
2373
+ await mkdir7(root, { recursive: true });
2146
2374
  await writeEncryptedKey(root, masterPassword, machineKey, await keyRoot());
2147
2375
  await writeVerifyFile(root, machineKey);
2148
2376
  setEncryptionKeyInMemory(machineKey, orgId);
@@ -2152,7 +2380,7 @@ async function unlockOrgKeys(masterPassword) {
2152
2380
  }
2153
2381
  async function installOrgKey(orgId, key, masterPassword) {
2154
2382
  const root = orgVaultRoot(orgId);
2155
- await mkdir6(root, { recursive: true });
2383
+ await mkdir7(root, { recursive: true });
2156
2384
  const pepperDir = await keyRoot();
2157
2385
  await writeEncryptedKey(root, masterPassword, key, pepperDir);
2158
2386
  const readBack = await readEncryptedKey(root, masterPassword, pepperDir);
@@ -2208,7 +2436,7 @@ var projectRouter = router({
2208
2436
  * `orgId` names which project — the same id can exist in several
2209
2437
  * organizations. Left out, the id must answer for exactly one project.
2210
2438
  */
2211
- get: protectedProcedure.input(z3.object({ id: z3.string().max(128), orgId: z3.string().max(128).nullable().optional() })).query(async ({ input }) => {
2439
+ get: protectedProcedure.input(z4.object({ id: z4.string().max(128), orgId: z4.string().max(128).nullable().optional() })).query(async ({ input }) => {
2212
2440
  const project = await projectStore.get(input);
2213
2441
  if (!project) {
2214
2442
  throw new TRPCError3({ code: "NOT_FOUND", message: `Project ${input.id} not found` });
@@ -2222,7 +2450,7 @@ var projectRouter = router({
2222
2450
  * Environments are intentionally excluded — they carry secret values that
2223
2451
  * stay local.
2224
2452
  */
2225
- export: protectedProcedure.input(z3.object({ id: z3.string().max(128), orgId: z3.string().max(128).nullable().optional() })).query(async ({ input }) => {
2453
+ export: protectedProcedure.input(z4.object({ id: z4.string().max(128), orgId: z4.string().max(128).nullable().optional() })).query(async ({ input }) => {
2226
2454
  const project = await projectStore.get(input);
2227
2455
  if (!project) {
2228
2456
  throw new TRPCError3({ code: "NOT_FOUND", message: `Project ${input.id} not found` });
@@ -2232,11 +2460,11 @@ var projectRouter = router({
2232
2460
  return { project, services };
2233
2461
  }),
2234
2462
  create: protectedProcedure.input(
2235
- z3.object({
2236
- name: z3.string().min(1).max(200),
2237
- description: z3.string().max(1e4).optional(),
2238
- orgId: z3.string().max(128).nullable().optional(),
2239
- serviceIds: z3.array(z3.string().max(128)).max(1e4).optional()
2463
+ z4.object({
2464
+ name: z4.string().min(1).max(200),
2465
+ description: z4.string().max(1e4).optional(),
2466
+ orgId: z4.string().max(128).nullable().optional(),
2467
+ serviceIds: z4.array(z4.string().max(128)).max(1e4).optional()
2240
2468
  })
2241
2469
  ).mutation(async ({ input }) => {
2242
2470
  let project;
@@ -2270,13 +2498,13 @@ var projectRouter = router({
2270
2498
  return result;
2271
2499
  }),
2272
2500
  update: protectedProcedure.input(
2273
- z3.object({
2274
- id: z3.string().max(128),
2275
- name: z3.string().min(1).max(200).optional(),
2276
- description: z3.string().max(1e4).optional(),
2277
- orgId: z3.string().max(128).nullable().optional(),
2278
- serviceIds: z3.array(z3.string().max(128)).max(1e4).optional(),
2279
- groupOrder: z3.array(z3.string().max(200)).max(100).optional()
2501
+ z4.object({
2502
+ id: z4.string().max(128),
2503
+ name: z4.string().min(1).max(200).optional(),
2504
+ description: z4.string().max(1e4).optional(),
2505
+ orgId: z4.string().max(128).nullable().optional(),
2506
+ serviceIds: z4.array(z4.string().max(128)).max(1e4).optional(),
2507
+ groupOrder: z4.array(z4.string().max(200)).max(100).optional()
2280
2508
  })
2281
2509
  ).mutation(async ({ input }) => {
2282
2510
  const project = await projectStore.update(input);
@@ -2286,7 +2514,7 @@ var projectRouter = router({
2286
2514
  await auditService.log({ userId: "local", action: "update", entityType: "project", entityId: input.id });
2287
2515
  return project;
2288
2516
  }),
2289
- delete: protectedProcedure.input(z3.object({ id: z3.string().max(128), orgId: z3.string().max(128).nullable().optional() })).mutation(async ({ input }) => {
2517
+ delete: protectedProcedure.input(z4.object({ id: z4.string().max(128), orgId: z4.string().max(128).nullable().optional() })).mutation(async ({ input }) => {
2290
2518
  const deleted = await projectStore.delete(input);
2291
2519
  if (!deleted) {
2292
2520
  throw new TRPCError3({ code: "NOT_FOUND", message: `Project ${input.id} not found` });
@@ -2294,10 +2522,10 @@ var projectRouter = router({
2294
2522
  await auditService.log({ userId: "local", action: "delete", entityType: "project", entityId: input.id });
2295
2523
  return { success: true };
2296
2524
  }),
2297
- addService: protectedProcedure.input(z3.object({
2298
- projectId: z3.string().max(128),
2299
- orgId: z3.string().max(128).nullable().optional(),
2300
- serviceId: z3.string().max(128)
2525
+ addService: protectedProcedure.input(z4.object({
2526
+ projectId: z4.string().max(128),
2527
+ orgId: z4.string().max(128).nullable().optional(),
2528
+ serviceId: z4.string().max(128)
2301
2529
  })).mutation(async ({ input }) => {
2302
2530
  const target = { id: input.projectId, orgId: input.orgId };
2303
2531
  const project = await projectStore.addService(target, input.serviceId);
@@ -2329,10 +2557,10 @@ var projectRouter = router({
2329
2557
  });
2330
2558
  return project;
2331
2559
  }),
2332
- removeService: protectedProcedure.input(z3.object({
2333
- projectId: z3.string().max(128),
2334
- orgId: z3.string().max(128).nullable().optional(),
2335
- serviceId: z3.string().max(128)
2560
+ removeService: protectedProcedure.input(z4.object({
2561
+ projectId: z4.string().max(128),
2562
+ orgId: z4.string().max(128).nullable().optional(),
2563
+ serviceId: z4.string().max(128)
2336
2564
  })).mutation(async ({ input }) => {
2337
2565
  const project = await projectStore.removeService(
2338
2566
  { id: input.projectId, orgId: input.orgId },
@@ -2350,10 +2578,10 @@ var projectRouter = router({
2350
2578
  });
2351
2579
  return project;
2352
2580
  }),
2353
- setActiveEnvironment: protectedProcedure.input(z3.object({
2354
- projectId: z3.string().max(128),
2355
- orgId: z3.string().max(128).nullable().optional(),
2356
- environmentId: z3.string().max(128)
2581
+ setActiveEnvironment: protectedProcedure.input(z4.object({
2582
+ projectId: z4.string().max(128),
2583
+ orgId: z4.string().max(128).nullable().optional(),
2584
+ environmentId: z4.string().max(128)
2357
2585
  })).mutation(async ({ input }) => {
2358
2586
  const project = await projectStore.get({ id: input.projectId, orgId: input.orgId });
2359
2587
  if (!project) {
@@ -2433,9 +2661,9 @@ var projectRouter = router({
2433
2661
  localPaths: protectedProcedure.query(async () => {
2434
2662
  return projectPathStore.all();
2435
2663
  }),
2436
- getLocalPath: protectedProcedure.input(z3.object({
2437
- id: z3.string().min(1).max(128),
2438
- orgId: z3.string().max(128).nullable().optional()
2664
+ getLocalPath: protectedProcedure.input(z4.object({
2665
+ id: z4.string().min(1).max(128),
2666
+ orgId: z4.string().max(128).nullable().optional()
2439
2667
  })).query(async ({ input }) => {
2440
2668
  return { path: await projectPathStore.get(input) };
2441
2669
  }),
@@ -2446,10 +2674,10 @@ var projectRouter = router({
2446
2674
  * project was already placed in: two projects sharing a directory is what
2447
2675
  * makes services run against the wrong code.
2448
2676
  */
2449
- setLocalPath: protectedProcedure.input(z3.object({
2450
- id: z3.string().min(1).max(128),
2451
- orgId: z3.string().max(128).nullable().optional(),
2452
- path: z3.string().min(1).max(4096)
2677
+ setLocalPath: protectedProcedure.input(z4.object({
2678
+ id: z4.string().min(1).max(128),
2679
+ orgId: z4.string().max(128).nullable().optional(),
2680
+ path: z4.string().min(1).max(4096)
2453
2681
  })).mutation(async ({ input }) => {
2454
2682
  const project = await projectStore.get(input);
2455
2683
  if (!project) throw new TRPCError3({ code: "NOT_FOUND", message: "Projet introuvable" });
@@ -2467,20 +2695,20 @@ var projectRouter = router({
2467
2695
  });
2468
2696
  }
2469
2697
  await projectPathStore.set(project, input.path);
2470
- await auditService.log("local", "update", "project", input.id, { localPath: input.path });
2698
+ await auditService.log({ userId: "local", action: "update", entityType: "project", entityId: input.id, metadata: { localPath: input.path } });
2471
2699
  return { path: input.path };
2472
2700
  })
2473
2701
  });
2474
2702
 
2475
2703
  // ../server/src/trpc/routers/service.ts
2476
- import { z as z4 } from "zod";
2704
+ import { z as z5 } from "zod";
2477
2705
  import { TRPCError as TRPCError4 } from "@trpc/server";
2478
2706
 
2479
2707
  // ../server/src/services/log-parser-store.ts
2480
2708
  import { randomUUID as randomUUID3 } from "crypto";
2481
2709
 
2482
2710
  // ../server/src/services/settings-manager.ts
2483
- import { readFile as readFile7, writeFile as writeFile7, rename as rename7, mkdir as mkdir7, chmod as chmod6 } from "fs/promises";
2711
+ import { readFile as readFile8, writeFile as writeFile8, rename as rename8, mkdir as mkdir8, chmod as chmod7 } from "fs/promises";
2484
2712
  import { join as join8 } from "path";
2485
2713
  var SETTINGS_FILE = "settings.json";
2486
2714
  var SETTINGS_PRIVATE_FILE = "settings.private.json";
@@ -2506,12 +2734,12 @@ var SettingsManager = class {
2506
2734
  }
2507
2735
  async atomicWrite(filename, data, vault) {
2508
2736
  const root = this.rootOf(vault);
2509
- await mkdir7(root, { recursive: true });
2737
+ await mkdir8(root, { recursive: true });
2510
2738
  const filePath = join8(root, filename);
2511
2739
  const tmpPath = filePath + ".tmp";
2512
- await writeFile7(tmpPath, JSON.stringify(data, null, 2), "utf-8");
2513
- await rename7(tmpPath, filePath);
2514
- await chmod6(filePath, 384);
2740
+ await writeFile8(tmpPath, JSON.stringify(data, null, 2), "utf-8");
2741
+ await rename8(tmpPath, filePath);
2742
+ await chmod7(filePath, 384);
2515
2743
  }
2516
2744
  /**
2517
2745
  * Lire le fichier de CE coffre, et rien d'autre.
@@ -2524,7 +2752,7 @@ var SettingsManager = class {
2524
2752
  */
2525
2753
  async readJson(filename, vault) {
2526
2754
  try {
2527
- return JSON.parse(await readFile7(join8(this.rootOf(vault), filename), "utf-8"));
2755
+ return JSON.parse(await readFile8(join8(this.rootOf(vault), filename), "utf-8"));
2528
2756
  } catch {
2529
2757
  return null;
2530
2758
  }
@@ -2538,7 +2766,7 @@ var SettingsManager = class {
2538
2766
  async readMachineJson(filename) {
2539
2767
  for (const path of [machineFilePath(filename), legacyMachineFilePath(filename)]) {
2540
2768
  try {
2541
- return JSON.parse(await readFile7(path, "utf-8"));
2769
+ return JSON.parse(await readFile8(path, "utf-8"));
2542
2770
  } catch {
2543
2771
  }
2544
2772
  }
@@ -2603,12 +2831,12 @@ var SettingsManager = class {
2603
2831
  }
2604
2832
  async saveSchemaVersion(sv) {
2605
2833
  this.schemaVersion = sv;
2606
- await mkdir7(machineRoot(), { recursive: true });
2834
+ await mkdir8(machineRoot(), { recursive: true });
2607
2835
  const filePath = machineFilePath(SCHEMA_VERSION_FILE);
2608
2836
  const tmpPath = filePath + ".tmp";
2609
- await writeFile7(tmpPath, JSON.stringify(sv, null, 2), "utf-8");
2610
- await rename7(tmpPath, filePath);
2611
- await chmod6(filePath, 384);
2837
+ await writeFile8(tmpPath, JSON.stringify(sv, null, 2), "utf-8");
2838
+ await rename8(tmpPath, filePath);
2839
+ await chmod7(filePath, 384);
2612
2840
  }
2613
2841
  getCurrentSchemaVersion() {
2614
2842
  return CURRENT_SCHEMA_VERSION;
@@ -2817,14 +3045,14 @@ function buildServerBuiltins(input) {
2817
3045
  import { isAbsolute as isAbsolute3 } from "path";
2818
3046
 
2819
3047
  // ../server/src/services/workspace-cwd.ts
2820
- import { isAbsolute as isAbsolute2, join as join10, dirname as dirname5 } from "path";
3048
+ import { isAbsolute as isAbsolute2, join as join10, dirname as dirname6 } from "path";
2821
3049
 
2822
3050
  // ../server/src/services/conversation-store.ts
2823
3051
  import { randomUUID as randomUUID4 } from "crypto";
2824
- import { readFile as readFile8, writeFile as writeFile8, rename as rename8, mkdir as mkdir8, chmod as chmod7 } from "fs/promises";
2825
- import { dirname as dirname4, join as join9 } from "path";
3052
+ import { readFile as readFile9, writeFile as writeFile9, rename as rename9, mkdir as mkdir9, chmod as chmod8 } from "fs/promises";
3053
+ import { dirname as dirname5, join as join9 } from "path";
2826
3054
  import { EventEmitter as EventEmitter2 } from "events";
2827
- var FILENAME4 = "conversations.private.json";
3055
+ var FILENAME5 = "conversations.private.json";
2828
3056
  async function localProjectId() {
2829
3057
  const projects = await projectStore.list().catch(() => []);
2830
3058
  return projects.find((p) => !p.orgId)?.id ?? null;
@@ -2855,11 +3083,11 @@ var ConversationStore = class {
2855
3083
  * root, but a launch directory owning its own key keeps both together.
2856
3084
  */
2857
3085
  getFilePath() {
2858
- return keyedFilePath(FILENAME4);
3086
+ return keyedFilePath(FILENAME5);
2859
3087
  }
2860
3088
  /** Where older versions kept it — read only, so an older Runeya keeps working. */
2861
3089
  getLegacyFilePath() {
2862
- return legacyMachineFilePath(FILENAME4);
3090
+ return legacyMachineFilePath(FILENAME5);
2863
3091
  }
2864
3092
  /**
2865
3093
  * Read the machine file, falling back to the launch directory of old.
@@ -2869,13 +3097,13 @@ var ConversationStore = class {
2869
3097
  */
2870
3098
  async readFromDisk() {
2871
3099
  try {
2872
- return await readFile8(await this.getFilePath(), "utf-8");
3100
+ return await readFile9(await this.getFilePath(), "utf-8");
2873
3101
  } catch {
2874
- return readFile8(this.getLegacyFilePath(), "utf-8");
3102
+ return readFile9(this.getLegacyFilePath(), "utf-8");
2875
3103
  }
2876
3104
  }
2877
3105
  async ensureDir() {
2878
- await mkdir8(dirname4(await this.getFilePath()), { recursive: true });
3106
+ await mkdir9(dirname5(await this.getFilePath()), { recursive: true });
2879
3107
  }
2880
3108
  encryptMessages(messages, vault) {
2881
3109
  return encryptValue(JSON.stringify(messages), vault);
@@ -2966,20 +3194,20 @@ ${new Error("trace").stack}`
2966
3194
  this.unreadable.clear();
2967
3195
  await ensureProjectsLoaded();
2968
3196
  const vaults = await allVaultRoots();
2969
- const legacyPaths = [this.getLegacyFilePath(), await keyedFilePath(FILENAME4)];
3197
+ const legacyPaths = [this.getLegacyFilePath(), await keyedFilePath(FILENAME5)];
2970
3198
  const sources = [
2971
3199
  ...legacyPaths.map((path) => ({ path, legacy: true })),
2972
- ...vaults.map((root) => ({ path: join9(root, FILENAME4), legacy: false }))
3200
+ ...vaults.map((root) => ({ path: join9(root, FILENAME5), legacy: false }))
2973
3201
  ];
2974
3202
  for (const { path, legacy } of sources) {
2975
3203
  let data;
2976
3204
  try {
2977
- data = JSON.parse(await readFile8(path, "utf-8"));
3205
+ data = JSON.parse(await readFile9(path, "utf-8"));
2978
3206
  } catch {
2979
3207
  continue;
2980
3208
  }
2981
3209
  const inherited = legacy ? await localProjectId() : null;
2982
- const root = dirname4(path);
3210
+ const root = dirname5(path);
2983
3211
  await rememberFile(path);
2984
3212
  for (const item of data) {
2985
3213
  try {
@@ -3049,22 +3277,22 @@ ${new Error("trace").stack}`
3049
3277
  }
3050
3278
  const stale = /* @__PURE__ */ new Set();
3051
3279
  for (const root of byRoot.keys()) {
3052
- const path = join9(root, FILENAME4);
3280
+ const path = join9(root, FILENAME5);
3053
3281
  if (wasRead(path) && await hasChangedSinceRead(path)) stale.add(root);
3054
3282
  }
3055
3283
  for (const [root, data] of byRoot) {
3056
- const filePath = join9(root, FILENAME4);
3284
+ const filePath = join9(root, FILENAME5);
3057
3285
  if (stale.has(root)) {
3058
3286
  console.warn(
3059
3287
  `[conversation-store] ${filePath} a chang\xE9 depuis sa lecture \u2014 \xE9criture ignor\xE9e pour ne pas \xE9craser une r\xE9paration faite en dehors du serveur.`
3060
3288
  );
3061
3289
  continue;
3062
3290
  }
3063
- await mkdir8(root, { recursive: true });
3291
+ await mkdir9(root, { recursive: true });
3064
3292
  const tmpPath = `${filePath}.tmp`;
3065
- await writeFile8(tmpPath, JSON.stringify(data, null, 2), "utf-8");
3066
- await rename8(tmpPath, filePath);
3067
- await chmod7(filePath, 384);
3293
+ await writeFile9(tmpPath, JSON.stringify(data, null, 2), "utf-8");
3294
+ await rename9(tmpPath, filePath);
3295
+ await chmod8(filePath, 384);
3068
3296
  await rememberFile(filePath);
3069
3297
  }
3070
3298
  }
@@ -3077,7 +3305,7 @@ ${new Error("trace").stack}`
3077
3305
  async rootFor(conv) {
3078
3306
  const known = this.roots.get(conv.id) ?? null;
3079
3307
  if (conv.projectId) return rootOfProjectAmong(conv.projectId, known);
3080
- return known ?? dirname4(await keyedFilePath(FILENAME4));
3308
+ return known ?? dirname5(await keyedFilePath(FILENAME5));
3081
3309
  }
3082
3310
  /**
3083
3311
  * Le projet d'une conversation, organisation comprise.
@@ -3263,7 +3491,7 @@ function anchor(base, raw) {
3263
3491
  return join10(base, raw);
3264
3492
  }
3265
3493
  function localVaultRootParent() {
3266
- return dirname5(localVaultRoot());
3494
+ return dirname6(localVaultRoot());
3267
3495
  }
3268
3496
  async function resolveAgentCwd(target) {
3269
3497
  if (target.serviceId) {
@@ -3358,7 +3586,7 @@ async function resolveServiceVariables(service) {
3358
3586
  }
3359
3587
  var DockerConfigInput = DockerConfigSchema;
3360
3588
  var serviceRouter = router({
3361
- list: protectedProcedure.meta({ openapi: { method: "GET", path: "/services", tags: ["services"], summary: "List all services", protect: true } }).output(z4.any()).query(async ({ ctx }) => {
3589
+ list: protectedProcedure.meta({ openapi: { method: "GET", path: "/services", tags: ["services"], summary: "List all services", protect: true } }).output(z5.any()).query(async ({ ctx }) => {
3362
3590
  const all = await serviceStore.list();
3363
3591
  const allowedIds = getAllowedServiceIds(ctx);
3364
3592
  const filtered = allowedIds ? all.filter((s) => allowedIds.has(s.id)) : all;
@@ -3367,7 +3595,7 @@ var serviceRouter = router({
3367
3595
  effectiveAgentId: await resolveEffectiveAgentId(s)
3368
3596
  })));
3369
3597
  }),
3370
- get: protectedProcedure.meta({ openapi: { method: "GET", path: "/services/{id}", tags: ["services"], summary: "Get a service by ID", protect: true } }).input(z4.object({ id: z4.string().max(128) })).output(z4.any()).query(async ({ input, ctx }) => {
3598
+ get: protectedProcedure.meta({ openapi: { method: "GET", path: "/services/{id}", tags: ["services"], summary: "Get a service by ID", protect: true } }).input(z5.object({ id: z5.string().max(128) })).output(z5.any()).query(async ({ input, ctx }) => {
3371
3599
  requireServiceAction(ctx, input.id, "service:read");
3372
3600
  const service = await serviceStore.get(input.id);
3373
3601
  if (!service) {
@@ -3375,34 +3603,34 @@ var serviceRouter = router({
3375
3603
  }
3376
3604
  return service;
3377
3605
  }),
3378
- create: protectedProcedure.meta({ openapi: { method: "POST", path: "/services", tags: ["services"], summary: "Create a new service", protect: true } }).output(z4.any()).input(
3379
- z4.object({
3380
- agentId: z4.string().max(128).optional(),
3381
- name: z4.string().min(1).max(200),
3382
- commands: z4.array(ServiceCommandSchema).max(50).optional(),
3383
- cwd: z4.string().max(4096).optional(),
3384
- ports: z4.array(z4.number().int().min(1).max(65535)).max(20).optional(),
3385
- groups: z4.array(z4.string().max(200)).max(20).optional(),
3386
- description: z4.string().max(2e3).optional(),
3387
- docsPath: z4.string().max(4096).optional(),
3388
- url: z4.string().max(2048).optional(),
3389
- localUrls: z4.array(z4.object({
3390
- url: z4.string().max(253),
3391
- port: z4.number().int().min(1).max(65535)
3606
+ create: protectedProcedure.meta({ openapi: { method: "POST", path: "/services", tags: ["services"], summary: "Create a new service", protect: true } }).output(z5.any()).input(
3607
+ z5.object({
3608
+ agentId: z5.string().max(128).optional(),
3609
+ name: z5.string().min(1).max(200),
3610
+ commands: z5.array(ServiceCommandSchema).max(50).optional(),
3611
+ cwd: z5.string().max(4096).optional(),
3612
+ ports: z5.array(z5.number().int().min(1).max(65535)).max(20).optional(),
3613
+ groups: z5.array(z5.string().max(200)).max(20).optional(),
3614
+ description: z5.string().max(2e3).optional(),
3615
+ docsPath: z5.string().max(4096).optional(),
3616
+ url: z5.string().max(2048).optional(),
3617
+ localUrls: z5.array(z5.object({
3618
+ url: z5.string().max(253),
3619
+ port: z5.number().int().min(1).max(65535)
3392
3620
  })).max(20).optional(),
3393
- openapiUrl: z4.string().max(2048).optional(),
3394
- git: z4.object({ remote: z4.string().max(2048).optional(), home: z4.string().max(2048).optional() }).optional(),
3395
- meta: z4.record(z4.string().max(256), z4.string().max(2e3)).optional().refine((obj) => !obj || Object.keys(obj).length <= 100, { message: "Too many meta keys (max 100)" }),
3396
- runner: z4.enum(["native", "docker"]).optional().default("native"),
3621
+ openapiUrl: z5.string().max(2048).optional(),
3622
+ git: z5.object({ remote: z5.string().max(2048).optional(), home: z5.string().max(2048).optional() }).optional(),
3623
+ meta: z5.record(z5.string().max(256), z5.string().max(2e3)).optional().refine((obj) => !obj || Object.keys(obj).length <= 100, { message: "Too many meta keys (max 100)" }),
3624
+ runner: z5.enum(["native", "docker"]).optional().default("native"),
3397
3625
  dockerConfig: DockerConfigInput.optional(),
3398
3626
  healthCheck: HealthCheckSchema.optional(),
3399
- autoRestart: z4.boolean().optional().default(false),
3627
+ autoRestart: z5.boolean().optional().default(false),
3400
3628
  restartStrategy: RestartStrategySchema.optional(),
3401
- maxRestarts: z4.number().int().nonnegative().optional(),
3402
- restartBackoffMs: z4.number().int().positive().optional().default(1e3),
3403
- orgId: z4.string().max(128).nullable().optional(),
3404
- shortcuts: z4.array(ServiceShortcutSchema).max(50).optional(),
3405
- parserIds: z4.array(z4.string().max(128)).max(50).optional()
3629
+ maxRestarts: z5.number().int().nonnegative().optional(),
3630
+ restartBackoffMs: z5.number().int().positive().optional().default(1e3),
3631
+ orgId: z5.string().max(128).nullable().optional(),
3632
+ shortcuts: z5.array(ServiceShortcutSchema).max(50).optional(),
3633
+ parserIds: z5.array(z5.string().max(128)).max(50).optional()
3406
3634
  })
3407
3635
  ).mutation(async ({ input }) => {
3408
3636
  if (input.agentId) {
@@ -3424,38 +3652,38 @@ var serviceRouter = router({
3424
3652
  await auditService.log({ userId: "local", action: "create", entityType: "service", entityId: service.id, metadata: { name: input.name } });
3425
3653
  return service;
3426
3654
  }),
3427
- update: protectedProcedure.meta({ openapi: { method: "PATCH", path: "/services/{id}", tags: ["services"], summary: "Update a service", protect: true } }).output(z4.any()).input(
3428
- z4.object({
3429
- id: z4.string().max(128),
3430
- agentId: z4.string().max(128).nullable().optional(),
3655
+ update: protectedProcedure.meta({ openapi: { method: "PATCH", path: "/services/{id}", tags: ["services"], summary: "Update a service", protect: true } }).output(z5.any()).input(
3656
+ z5.object({
3657
+ id: z5.string().max(128),
3658
+ agentId: z5.string().max(128).nullable().optional(),
3431
3659
  // null = clear (inherit from env)
3432
- name: z4.string().min(1).max(200).optional(),
3433
- commands: z4.array(ServiceCommandSchema).max(50).optional(),
3434
- cwd: z4.string().max(4096).nullable().optional(),
3435
- ports: z4.array(z4.number().int().min(1).max(65535)).max(20).optional(),
3436
- groups: z4.array(z4.string().max(200)).max(20).optional(),
3437
- description: z4.string().max(2e3).optional(),
3438
- docsPath: z4.string().max(4096).optional(),
3439
- url: z4.string().max(2048).optional(),
3440
- localUrls: z4.array(z4.object({
3441
- url: z4.string().max(253),
3442
- port: z4.number().int().min(1).max(65535)
3660
+ name: z5.string().min(1).max(200).optional(),
3661
+ commands: z5.array(ServiceCommandSchema).max(50).optional(),
3662
+ cwd: z5.string().max(4096).nullable().optional(),
3663
+ ports: z5.array(z5.number().int().min(1).max(65535)).max(20).optional(),
3664
+ groups: z5.array(z5.string().max(200)).max(20).optional(),
3665
+ description: z5.string().max(2e3).optional(),
3666
+ docsPath: z5.string().max(4096).optional(),
3667
+ url: z5.string().max(2048).optional(),
3668
+ localUrls: z5.array(z5.object({
3669
+ url: z5.string().max(253),
3670
+ port: z5.number().int().min(1).max(65535)
3443
3671
  })).max(20).optional(),
3444
- openapiUrl: z4.string().max(2048).optional(),
3445
- git: z4.object({ remote: z4.string().max(2048).optional(), home: z4.string().max(2048).optional() }).nullable().optional(),
3446
- meta: z4.record(z4.string().max(256), z4.string().max(2e3)).nullable().optional().refine((obj) => !obj || Object.keys(obj).length <= 100, { message: "Too many meta keys (max 100)" }),
3447
- runner: z4.enum(["native", "docker"]).optional(),
3672
+ openapiUrl: z5.string().max(2048).optional(),
3673
+ git: z5.object({ remote: z5.string().max(2048).optional(), home: z5.string().max(2048).optional() }).nullable().optional(),
3674
+ meta: z5.record(z5.string().max(256), z5.string().max(2e3)).nullable().optional().refine((obj) => !obj || Object.keys(obj).length <= 100, { message: "Too many meta keys (max 100)" }),
3675
+ runner: z5.enum(["native", "docker"]).optional(),
3448
3676
  dockerConfig: DockerConfigInput.optional(),
3449
3677
  healthCheck: HealthCheckSchema.nullable().optional(),
3450
- autoRestart: z4.boolean().optional(),
3451
- clearLogsOnStart: z4.boolean().optional(),
3678
+ autoRestart: z5.boolean().optional(),
3679
+ clearLogsOnStart: z5.boolean().optional(),
3452
3680
  restartStrategy: RestartStrategySchema.optional(),
3453
- maxRestarts: z4.number().int().nonnegative().optional(),
3454
- restartBackoffMs: z4.number().int().positive().optional(),
3455
- orgId: z4.string().max(128).nullable().optional(),
3456
- shortcuts: z4.array(ServiceShortcutSchema).max(50).optional(),
3457
- parserIds: z4.array(z4.string().max(128)).max(50).optional(),
3458
- logSources: z4.array(LogSourceConfigSchema).max(20).optional()
3681
+ maxRestarts: z5.number().int().nonnegative().optional(),
3682
+ restartBackoffMs: z5.number().int().positive().optional(),
3683
+ orgId: z5.string().max(128).nullable().optional(),
3684
+ shortcuts: z5.array(ServiceShortcutSchema).max(50).optional(),
3685
+ parserIds: z5.array(z5.string().max(128)).max(50).optional(),
3686
+ logSources: z5.array(LogSourceConfigSchema).max(20).optional()
3459
3687
  })
3460
3688
  ).mutation(async ({ input }) => {
3461
3689
  const existing = await serviceStore.get(input.id);
@@ -3510,7 +3738,7 @@ var serviceRouter = router({
3510
3738
  await auditService.log({ userId: "local", action: "update", entityType: "service", entityId: input.id });
3511
3739
  return { ...service, effectiveAgentId: await resolveEffectiveAgentId(service), stoppedForAgentChange };
3512
3740
  }),
3513
- delete: protectedProcedure.meta({ openapi: { method: "DELETE", path: "/services/{id}", tags: ["services"], summary: "Delete a service", protect: true } }).input(z4.object({ id: z4.string().max(128) })).output(z4.object({ success: z4.literal(true) })).mutation(async ({ input }) => {
3741
+ delete: protectedProcedure.meta({ openapi: { method: "DELETE", path: "/services/{id}", tags: ["services"], summary: "Delete a service", protect: true } }).input(z5.object({ id: z5.string().max(128) })).output(z5.object({ success: z5.literal(true) })).mutation(async ({ input }) => {
3514
3742
  const deleted = await serviceStore.delete(input.id);
3515
3743
  if (!deleted) {
3516
3744
  throw new TRPCError4({ code: "NOT_FOUND", message: `Service ${input.id} not found` });
@@ -3518,7 +3746,7 @@ var serviceRouter = router({
3518
3746
  await auditService.log({ userId: "local", action: "delete", entityType: "service", entityId: input.id });
3519
3747
  return { success: true };
3520
3748
  }),
3521
- checkCwd: protectedProcedure.input(z4.object({ id: z4.string().max(128), checkReachability: z4.boolean().optional() })).query(async ({ input }) => {
3749
+ checkCwd: protectedProcedure.input(z5.object({ id: z5.string().max(128), checkReachability: z5.boolean().optional() })).query(async ({ input }) => {
3522
3750
  const service = await serviceStore.get(input.id);
3523
3751
  if (!service) {
3524
3752
  throw new TRPCError4({ code: "NOT_FOUND", message: `Service ${input.id} not found` });
@@ -3551,7 +3779,7 @@ var serviceRouter = router({
3551
3779
  }
3552
3780
  return { exists: exists4, canClone, unresolvedVars: [], resolvedCwd, gitMismatch };
3553
3781
  }),
3554
- cloneRepository: protectedProcedure.input(z4.object({ id: z4.string().max(128) })).mutation(async ({ input }) => {
3782
+ cloneRepository: protectedProcedure.input(z5.object({ id: z5.string().max(128) })).mutation(async ({ input }) => {
3555
3783
  const service = await serviceStore.get(input.id);
3556
3784
  if (!service) {
3557
3785
  throw new TRPCError4({ code: "NOT_FOUND", message: `Service ${input.id} not found` });
@@ -3574,7 +3802,7 @@ var serviceRouter = router({
3574
3802
  });
3575
3803
 
3576
3804
  // ../server/src/trpc/routers/agent.ts
3577
- import { z as z5 } from "zod";
3805
+ import { z as z6 } from "zod";
3578
3806
  import { TRPCError as TRPCError5 } from "@trpc/server";
3579
3807
  var SUBSCRIPTION_QUEUE_MAX = LOG_BUFFER_SIZE;
3580
3808
  var agentRouter = router({
@@ -3583,7 +3811,7 @@ var agentRouter = router({
3583
3811
  return agentManager.listAgents();
3584
3812
  }),
3585
3813
  /** Get a single agent's config and status */
3586
- get: protectedProcedure.input(z5.object({ id: z5.string().max(128) })).query(({ input }) => {
3814
+ get: protectedProcedure.input(z6.object({ id: z6.string().max(128) })).query(({ input }) => {
3587
3815
  const agent = agentManager.getAgent(input.id);
3588
3816
  if (!agent) {
3589
3817
  throw new TRPCError5({ code: "NOT_FOUND", message: `Agent ${input.id} not found` });
@@ -3595,10 +3823,10 @@ var agentRouter = router({
3595
3823
  }),
3596
3824
  /** Test connectivity to an agent given url + passphrase */
3597
3825
  testConnection: protectedProcedure.input(
3598
- z5.object({
3599
- url: z5.string().url().max(2048),
3600
- passphrase: z5.string().min(1).max(1024).optional(),
3601
- agentId: z5.string().max(128).optional()
3826
+ z6.object({
3827
+ url: z6.string().url().max(2048),
3828
+ passphrase: z6.string().min(1).max(1024).optional(),
3829
+ agentId: z6.string().max(128).optional()
3602
3830
  })
3603
3831
  ).mutation(async ({ input }) => {
3604
3832
  let passphrase = input.passphrase;
@@ -3635,13 +3863,13 @@ var agentRouter = router({
3635
3863
  }),
3636
3864
  /** Register a new agent */
3637
3865
  register: protectedProcedure.input(
3638
- z5.object({
3639
- name: z5.string().min(1).max(100),
3640
- url: z5.string().url().max(2048),
3641
- passphrase: z5.string().min(1).max(1024),
3866
+ z6.object({
3867
+ name: z6.string().min(1).max(100),
3868
+ url: z6.string().url().max(2048),
3869
+ passphrase: z6.string().min(1).max(1024),
3642
3870
  // À quelle organisation rattacher l'agent. Absent = la machine, ce que
3643
3871
  // font l'agent local et tout client antérieur à ce champ.
3644
- orgId: z5.string().min(1).max(128).nullable().optional()
3872
+ orgId: z6.string().min(1).max(128).nullable().optional()
3645
3873
  })
3646
3874
  ).mutation(async ({ input }) => {
3647
3875
  const config = await agentManager.register(
@@ -3654,13 +3882,13 @@ var agentRouter = router({
3654
3882
  }),
3655
3883
  /** Update an existing agent */
3656
3884
  update: protectedProcedure.input(
3657
- z5.object({
3658
- id: z5.string().max(128),
3659
- name: z5.string().min(1).max(100).optional(),
3660
- url: z5.string().url().max(2048).optional(),
3661
- passphrase: z5.string().min(1).max(1024).optional(),
3662
- passthroughEnv: z5.array(
3663
- z5.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(256)
3885
+ z6.object({
3886
+ id: z6.string().max(128),
3887
+ name: z6.string().min(1).max(100).optional(),
3888
+ url: z6.string().url().max(2048).optional(),
3889
+ passphrase: z6.string().min(1).max(1024).optional(),
3890
+ passthroughEnv: z6.array(
3891
+ z6.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(256)
3664
3892
  ).max(100).optional()
3665
3893
  })
3666
3894
  ).mutation(async ({ input }) => {
@@ -3681,7 +3909,7 @@ var agentRouter = router({
3681
3909
  }
3682
3910
  }),
3683
3911
  /** Get resolved passthrough env values from an agent */
3684
- getPassthroughEnv: protectedProcedure.input(z5.object({ id: z5.string().max(128) })).query(async ({ input }) => {
3912
+ getPassthroughEnv: protectedProcedure.input(z6.object({ id: z6.string().max(128) })).query(async ({ input }) => {
3685
3913
  try {
3686
3914
  return await agentManager.agentQuery(input.id, "config.getPassthroughEnv");
3687
3915
  } catch {
@@ -3689,7 +3917,7 @@ var agentRouter = router({
3689
3917
  }
3690
3918
  }),
3691
3919
  /** Remove a registered agent */
3692
- remove: protectedProcedure.input(z5.object({ id: z5.string().max(128) })).mutation(async ({ input }) => {
3920
+ remove: protectedProcedure.input(z6.object({ id: z6.string().max(128) })).mutation(async ({ input }) => {
3693
3921
  try {
3694
3922
  const removed = await agentManager.remove(input.id);
3695
3923
  if (!removed) {
@@ -3736,7 +3964,7 @@ var agentRouter = router({
3736
3964
  });
3737
3965
 
3738
3966
  // ../server/src/trpc/routers/process.ts
3739
- import { z as z6 } from "zod";
3967
+ import { z as z7 } from "zod";
3740
3968
  import { TRPCError as TRPCError6 } from "@trpc/server";
3741
3969
  var SUBSCRIPTION_QUEUE_MAX2 = LOG_BUFFER_SIZE;
3742
3970
  async function* forwardEvents(eventName, filter) {
@@ -3799,7 +4027,7 @@ async function* forwardLogBatches(agentId, processId) {
3799
4027
  }
3800
4028
  var processRouter = router({
3801
4029
  /** List all processes across all connected agents */
3802
- list: protectedProcedure.meta({ openapi: { method: "GET", path: "/processes", tags: ["processes"], summary: "List all processes", protect: true } }).output(z6.any()).query(async () => {
4030
+ list: protectedProcedure.meta({ openapi: { method: "GET", path: "/processes", tags: ["processes"], summary: "List all processes", protect: true } }).output(z7.any()).query(async () => {
3803
4031
  const agents = agentManager.listAgents();
3804
4032
  const results = [];
3805
4033
  await Promise.allSettled(
@@ -3816,7 +4044,7 @@ var processRouter = router({
3816
4044
  return results;
3817
4045
  }),
3818
4046
  /** Get a single process from a specific agent */
3819
- get: protectedProcedure.meta({ openapi: { method: "GET", path: "/processes/{agentId}/{id}", tags: ["processes"], summary: "Get a process by agent and ID", protect: true } }).input(z6.object({ agentId: z6.string().max(128), id: z6.string().max(128) })).output(z6.any()).query(async ({ input, ctx }) => {
4047
+ get: protectedProcedure.meta({ openapi: { method: "GET", path: "/processes/{agentId}/{id}", tags: ["processes"], summary: "Get a process by agent and ID", protect: true } }).input(z7.object({ agentId: z7.string().max(128), id: z7.string().max(128) })).output(z7.any()).query(async ({ input, ctx }) => {
3820
4048
  requireServiceAction(ctx, input.id, "service:read");
3821
4049
  const status = agentManager.getStatus(input.agentId);
3822
4050
  if (!status) {
@@ -3830,7 +4058,7 @@ var processRouter = router({
3830
4058
  * (or restarted). This avoids pushing configs for every service at agent boot,
3831
4059
  * which would be wasteful when many services are never started.
3832
4060
  * The deploy call is idempotent — creates the process if missing, updates config if it exists. */
3833
- start: protectedProcedure.meta({ openapi: { method: "POST", path: "/processes/{agentId}/{processId}/start", tags: ["processes"], summary: "Start a process", protect: true } }).input(z6.object({ agentId: z6.string().max(128).optional(), processId: z6.string().max(128) })).output(z6.any()).mutation(async ({ input, ctx }) => {
4061
+ start: protectedProcedure.meta({ openapi: { method: "POST", path: "/processes/{agentId}/{processId}/start", tags: ["processes"], summary: "Start a process", protect: true } }).input(z7.object({ agentId: z7.string().max(128).optional(), processId: z7.string().max(128) })).output(z7.any()).mutation(async ({ input, ctx }) => {
3834
4062
  requireServiceAction(ctx, input.processId, "service:start");
3835
4063
  const service = await serviceStore.get(input.processId);
3836
4064
  const effectiveAgentId = (service ? await resolveEffectiveAgentId(service) : null) ?? input.agentId ?? null;
@@ -3868,7 +4096,7 @@ var processRouter = router({
3868
4096
  return { ...result, agentId: effectiveAgentId };
3869
4097
  }),
3870
4098
  /** Stop a process on an agent */
3871
- stop: protectedProcedure.meta({ openapi: { method: "POST", path: "/processes/{agentId}/{processId}/stop", tags: ["processes"], summary: "Stop a process", protect: true } }).input(z6.object({ agentId: z6.string().max(128), processId: z6.string().max(128) })).output(z6.any()).mutation(async ({ input, ctx }) => {
4099
+ stop: protectedProcedure.meta({ openapi: { method: "POST", path: "/processes/{agentId}/{processId}/stop", tags: ["processes"], summary: "Stop a process", protect: true } }).input(z7.object({ agentId: z7.string().max(128), processId: z7.string().max(128) })).output(z7.any()).mutation(async ({ input, ctx }) => {
3872
4100
  requireServiceAction(ctx, input.processId, "service:stop");
3873
4101
  const result = await agentManager.agentMutation(input.agentId, "process.stop", { id: input.processId }, AGENT_STOP_FETCH_TIMEOUT);
3874
4102
  await auditService.log({ userId: "local", action: "stop", entityType: "process", entityId: input.processId, metadata: { agentId: input.agentId } });
@@ -3877,7 +4105,7 @@ var processRouter = router({
3877
4105
  /** Restart a process on an agent.
3878
4106
  * Sends stop → deploy (latest resolved config) → start so that
3879
4107
  * config/variable changes take effect. Same lazy deploy pattern as start. */
3880
- restart: protectedProcedure.meta({ openapi: { method: "POST", path: "/processes/{agentId}/{processId}/restart", tags: ["processes"], summary: "Restart a process", protect: true } }).input(z6.object({ agentId: z6.string().max(128).optional(), processId: z6.string().max(128) })).output(z6.any()).mutation(async ({ input, ctx }) => {
4108
+ restart: protectedProcedure.meta({ openapi: { method: "POST", path: "/processes/{agentId}/{processId}/restart", tags: ["processes"], summary: "Restart a process", protect: true } }).input(z7.object({ agentId: z7.string().max(128).optional(), processId: z7.string().max(128) })).output(z7.any()).mutation(async ({ input, ctx }) => {
3881
4109
  requireServiceAction(ctx, input.processId, "service:restart");
3882
4110
  const service = await serviceStore.get(input.processId);
3883
4111
  const effectiveAgentId = (service ? await resolveEffectiveAgentId(service) : null) ?? input.agentId ?? null;
@@ -3910,20 +4138,20 @@ var processRouter = router({
3910
4138
  return { ...result, agentId: effectiveAgentId };
3911
4139
  }),
3912
4140
  /** Get buffered logs for a process from an agent */
3913
- logs: protectedProcedure.meta({ openapi: { method: "GET", path: "/processes/{agentId}/{processId}/logs", tags: ["processes"], summary: "Get buffered logs for a process", protect: true } }).input(z6.object({ agentId: z6.string().max(128), processId: z6.string().max(128) })).output(z6.any()).query(async ({ input, ctx }) => {
4141
+ logs: protectedProcedure.meta({ openapi: { method: "GET", path: "/processes/{agentId}/{processId}/logs", tags: ["processes"], summary: "Get buffered logs for a process", protect: true } }).input(z7.object({ agentId: z7.string().max(128), processId: z7.string().max(128) })).output(z7.any()).query(async ({ input, ctx }) => {
3914
4142
  requireServiceAction(ctx, input.processId, "logs:read");
3915
4143
  return agentManager.agentQuery(input.agentId, "process.logs", { id: input.processId });
3916
4144
  }),
3917
4145
  /** Clear buffered logs for a process on an agent */
3918
- clearLogBuffer: protectedProcedure.input(z6.object({ agentId: z6.string().max(128), processId: z6.string().max(128) })).mutation(async ({ input }) => {
4146
+ clearLogBuffer: protectedProcedure.input(z7.object({ agentId: z7.string().max(128), processId: z7.string().max(128) })).mutation(async ({ input }) => {
3919
4147
  await agentManager.agentMutation(input.agentId, "process.clearLogBuffer", { id: input.processId });
3920
4148
  await auditService.log({ userId: "local", action: "clearLogBuffer", entityType: "process", entityId: input.processId, metadata: { agentId: input.agentId } });
3921
4149
  return { success: true };
3922
4150
  }),
3923
4151
  /** Execute a shortcut command on an agent, streaming output into the process log */
3924
- executeShortcut: protectedProcedure.input(z6.object({
3925
- agentId: z6.string().max(128),
3926
- processId: z6.string().max(128),
4152
+ executeShortcut: protectedProcedure.input(z7.object({
4153
+ agentId: z7.string().max(128),
4154
+ processId: z7.string().max(128),
3927
4155
  shortcut: ServiceShortcutSchema
3928
4156
  })).mutation(async ({ input }) => {
3929
4157
  const service = await serviceStore.get(input.processId);
@@ -3951,12 +4179,12 @@ var processRouter = router({
3951
4179
  return result;
3952
4180
  }),
3953
4181
  /** Execute an ad-hoc command on an agent, streaming output into the process log */
3954
- executeAdHocCommand: protectedProcedure.input(z6.object({
3955
- agentId: z6.string().max(128),
3956
- processId: z6.string().max(128),
3957
- command: z6.string().min(1).max(4096),
3958
- cwd: z6.string().max(4096).optional(),
3959
- commandId: z6.string().max(128).optional()
4182
+ executeAdHocCommand: protectedProcedure.input(z7.object({
4183
+ agentId: z7.string().max(128),
4184
+ processId: z7.string().max(128),
4185
+ command: z7.string().min(1).max(4096),
4186
+ cwd: z7.string().max(4096).optional(),
4187
+ commandId: z7.string().max(128).optional()
3960
4188
  })).mutation(async ({ input }) => {
3961
4189
  const service = await serviceStore.get(input.processId);
3962
4190
  if (service) {
@@ -3990,25 +4218,25 @@ var processRouter = router({
3990
4218
  return result;
3991
4219
  }),
3992
4220
  /** Cancel a running shortcut command on an agent */
3993
- cancelShortcut: protectedProcedure.input(z6.object({
3994
- agentId: z6.string().max(128),
3995
- processId: z6.string().max(128),
3996
- shortcutId: z6.string().max(128)
4221
+ cancelShortcut: protectedProcedure.input(z7.object({
4222
+ agentId: z7.string().max(128),
4223
+ processId: z7.string().max(128),
4224
+ shortcutId: z7.string().max(128)
3997
4225
  })).mutation(async ({ input }) => {
3998
4226
  await agentManager.agentMutation(input.agentId, "process.cancelShortcut", { id: input.processId, shortcutId: input.shortcutId });
3999
4227
  return { success: true };
4000
4228
  }),
4001
4229
  /** Cancel a running ad-hoc command on an agent */
4002
- cancelAdHocCommand: protectedProcedure.input(z6.object({
4003
- agentId: z6.string().max(128),
4004
- processId: z6.string().max(128),
4005
- commandId: z6.string().max(128).optional()
4230
+ cancelAdHocCommand: protectedProcedure.input(z7.object({
4231
+ agentId: z7.string().max(128),
4232
+ processId: z7.string().max(128),
4233
+ commandId: z7.string().max(128).optional()
4006
4234
  })).mutation(async ({ input }) => {
4007
4235
  await agentManager.agentMutation(input.agentId, "process.cancelAdHocCommand", { id: input.processId, commandId: input.commandId });
4008
4236
  return { success: true };
4009
4237
  }),
4010
4238
  /** Get current metrics for a process from an agent */
4011
- metrics: protectedProcedure.input(z6.object({ agentId: z6.string().max(128), processId: z6.string().max(128) })).query(async ({ input }) => {
4239
+ metrics: protectedProcedure.input(z7.object({ agentId: z7.string().max(128), processId: z7.string().max(128) })).query(async ({ input }) => {
4012
4240
  return agentManager.agentQuery(input.agentId, "process.metrics", { id: input.processId });
4013
4241
  }),
4014
4242
  /**
@@ -4016,7 +4244,7 @@ var processRouter = router({
4016
4244
  * Forwards batched events from the AgentWSBridge in real-time.
4017
4245
  * Historical logs are fetched separately via process.logs query.
4018
4246
  */
4019
- onLog: protectedProcedure.input(z6.object({ agentId: z6.string().max(128), processId: z6.string().max(128) })).subscription(async function* ({ input, ctx }) {
4247
+ onLog: protectedProcedure.input(z7.object({ agentId: z7.string().max(128), processId: z7.string().max(128) })).subscription(async function* ({ input, ctx }) {
4020
4248
  requireServiceAction(ctx, input.processId, "logs:read");
4021
4249
  yield* forwardLogBatches(input.agentId, input.processId);
4022
4250
  }),
@@ -4025,9 +4253,9 @@ var processRouter = router({
4025
4253
  * Input is optional — omit agentId/processId for global monitoring (dashboard).
4026
4254
  * Forwards events from the AgentWSBridge in real-time.
4027
4255
  */
4028
- onStatus: protectedProcedure.input(z6.object({
4029
- agentId: z6.string().max(128).optional(),
4030
- processId: z6.string().max(128).optional()
4256
+ onStatus: protectedProcedure.input(z7.object({
4257
+ agentId: z7.string().max(128).optional(),
4258
+ processId: z7.string().max(128).optional()
4031
4259
  }).optional()).subscription(async function* ({ input, ctx }) {
4032
4260
  const allowedIds = getAllowedServiceIds(ctx);
4033
4261
  if (input?.processId) requireServiceAction(ctx, input.processId, "service:status");
@@ -4055,9 +4283,9 @@ var processRouter = router({
4055
4283
  });
4056
4284
  }),
4057
4285
  /** Subscribe to real-time metrics for a process. */
4058
- onMetrics: protectedProcedure.input(z6.object({
4059
- agentId: z6.string().max(128).optional(),
4060
- processId: z6.string().max(128).optional()
4286
+ onMetrics: protectedProcedure.input(z7.object({
4287
+ agentId: z7.string().max(128).optional(),
4288
+ processId: z7.string().max(128).optional()
4061
4289
  }).optional()).subscription(async function* ({ input, ctx }) {
4062
4290
  const allowedIds = getAllowedServiceIds(ctx);
4063
4291
  if (input?.processId) requireServiceAction(ctx, input.processId, "service:status");
@@ -4069,9 +4297,9 @@ var processRouter = router({
4069
4297
  });
4070
4298
  }),
4071
4299
  /** Subscribe to real-time health status changes. */
4072
- onHealth: protectedProcedure.input(z6.object({
4073
- agentId: z6.string().max(128).optional(),
4074
- processId: z6.string().max(128).optional()
4300
+ onHealth: protectedProcedure.input(z7.object({
4301
+ agentId: z7.string().max(128).optional(),
4302
+ processId: z7.string().max(128).optional()
4075
4303
  }).optional()).subscription(async function* ({ input, ctx }) {
4076
4304
  const allowedIds = getAllowedServiceIds(ctx);
4077
4305
  if (input?.processId) requireServiceAction(ctx, input.processId, "service:healthcheck");
@@ -4085,186 +4313,21 @@ var processRouter = router({
4085
4313
  });
4086
4314
 
4087
4315
  // ../server/src/trpc/routers/audit.ts
4088
- import { z as z7 } from "zod";
4316
+ import { z as z8 } from "zod";
4089
4317
  var auditRouter = router({
4090
- list: protectedProcedure.input(z7.object({
4091
- action: z7.string().max(50).optional(),
4092
- entityType: z7.string().max(50).optional(),
4093
- entityId: z7.string().max(100).optional(),
4094
- limit: z7.number().int().positive().max(100).default(50),
4095
- offset: z7.number().int().nonnegative().default(0)
4318
+ list: protectedProcedure.input(z8.object({
4319
+ action: z8.string().max(50).optional(),
4320
+ entityType: z8.string().max(50).optional(),
4321
+ entityId: z8.string().max(100).optional(),
4322
+ limit: z8.number().int().positive().max(100).default(50),
4323
+ offset: z8.number().int().nonnegative().default(0)
4096
4324
  }).optional()).query(async ({ input }) => {
4097
4325
  return auditService.list(input ?? {});
4098
4326
  })
4099
4327
  });
4100
4328
 
4101
4329
  // ../server/src/trpc/routers/setup.ts
4102
- import { z as z8 } from "zod";
4103
-
4104
- // ../server/src/services/cloud-session-store.ts
4105
- import { readFile as readFile9, writeFile as writeFile9, rename as rename9, mkdir as mkdir9, chmod as chmod8, unlink as unlink2 } from "fs/promises";
4106
- import { dirname as dirname6 } from "path";
4107
- import { randomBytes as randomBytes4, timingSafeEqual as timingSafeEqual2 } from "crypto";
4108
- var FILENAME5 = "cloud-session.json";
4109
- var STATE_TTL_MS = 5 * 60 * 1e3;
4110
- var CloudSessionStore = class {
4111
- session = null;
4112
- loaded = false;
4113
- /** Pending login states (CSRF binding between `start` and the callback). */
4114
- pending = /* @__PURE__ */ new Map();
4115
- /**
4116
- * Encrypted, so it lives beside the key that opens it — usually the machine
4117
- * root, but a launch directory owning its own key keeps both together.
4118
- */
4119
- getFilePath() {
4120
- return keyedFilePath(FILENAME5);
4121
- }
4122
- /** Where older versions kept it — read only, so an older Runeya keeps working. */
4123
- getLegacyFilePath() {
4124
- return legacyMachineFilePath(FILENAME5);
4125
- }
4126
- /**
4127
- * Read the machine file, falling back to the launch directory of old.
4128
- *
4129
- * The legacy file is left in place: the next save writes the new location,
4130
- * and a directory still opened by an older Runeya keeps working meanwhile.
4131
- */
4132
- async readFromDisk() {
4133
- try {
4134
- return await readFile9(await this.getFilePath(), "utf-8");
4135
- } catch {
4136
- return readFile9(this.getLegacyFilePath(), "utf-8");
4137
- }
4138
- }
4139
- async load() {
4140
- if (this.loaded) return;
4141
- try {
4142
- const raw = await this.readFromDisk();
4143
- this.session = JSON.parse(raw);
4144
- } catch {
4145
- }
4146
- this.loaded = true;
4147
- }
4148
- /**
4149
- * Mint a state value binding a login attempt to this server. Returned to the
4150
- * cloud page and echoed back on the callback, so a redirect we never
4151
- * initiated cannot install a token.
4152
- */
4153
- createState(returnTo) {
4154
- this.sweepStates();
4155
- const state = randomBytes4(32).toString("hex");
4156
- this.pending.set(state, { expiresAt: Date.now() + STATE_TTL_MS, returnTo });
4157
- return state;
4158
- }
4159
- /**
4160
- * Consume a state — single use, constant-time compare, TTL enforced. Returns
4161
- * the URL to send the browser back to, or null when the state is unknown or
4162
- * expired (i.e. a callback this server never initiated).
4163
- */
4164
- consumeState(candidate) {
4165
- this.sweepStates();
4166
- for (const [state, entry] of this.pending) {
4167
- const a = Buffer.from(state);
4168
- const b = Buffer.from(candidate);
4169
- if (a.length === b.length && timingSafeEqual2(a, b)) {
4170
- this.pending.delete(state);
4171
- return entry.expiresAt > Date.now() ? entry.returnTo : null;
4172
- }
4173
- }
4174
- return null;
4175
- }
4176
- sweepStates() {
4177
- const now = Date.now();
4178
- for (const [state, entry] of this.pending) {
4179
- if (entry.expiresAt <= now) this.pending.delete(state);
4180
- }
4181
- }
4182
- async save() {
4183
- await mkdir9(dirname6(await this.getFilePath()), { recursive: true });
4184
- const filePath = await this.getFilePath();
4185
- const tmpPath = filePath + ".tmp";
4186
- await writeFile9(tmpPath, JSON.stringify(this.session, null, 2), "utf-8");
4187
- await rename9(tmpPath, filePath);
4188
- await chmod8(filePath, 384);
4189
- }
4190
- /** Store the session token obtained from the one-time-token exchange. */
4191
- async set(cloudUrl, token) {
4192
- await this.load();
4193
- this.session = { cloudUrl, encryptedToken: encryptValue(token) };
4194
- await this.save();
4195
- }
4196
- /** The decrypted session token, or null when not logged in. */
4197
- async getToken() {
4198
- await this.load();
4199
- if (!this.session) return null;
4200
- try {
4201
- return decryptValue(this.session.encryptedToken);
4202
- } catch {
4203
- return null;
4204
- }
4205
- }
4206
- /**
4207
- * The cloud this machine is signed into, or null when not linked.
4208
- *
4209
- * Needed to tell "an org I am not a member of" apart from "an org of another
4210
- * cloud instance entirely" — the ids of two clouds share no namespace, so
4211
- * comparing them without this would call every foreign-cloud project a
4212
- * permission problem.
4213
- */
4214
- async getCloudUrl() {
4215
- await this.load();
4216
- return this.session?.cloudUrl ?? null;
4217
- }
4218
- async isLinked() {
4219
- return await this.getToken() !== null;
4220
- }
4221
- /** Forget the session (sign-out). */
4222
- async clear() {
4223
- await this.load();
4224
- this.session = null;
4225
- this.pending.clear();
4226
- try {
4227
- await unlink2(await this.getFilePath());
4228
- } catch {
4229
- }
4230
- }
4231
- };
4232
- var cloudSessionStore = new CloudSessionStore();
4233
-
4234
- // ../server/src/services/cloud-api.ts
4235
- var DEFAULT_CLOUD_API_URL = "https://api.runeya.dev";
4236
- var DEFAULT_CLOUD_APP_URL = "https://runeya.dev";
4237
- function getCloudApiUrl() {
4238
- return (env.CLOUD_URL ?? DEFAULT_CLOUD_API_URL).replace(/\/+$/, "");
4239
- }
4240
- function getCloudAppUrl() {
4241
- return (env.CLOUD_APP_URL ?? DEFAULT_CLOUD_APP_URL).replace(/\/+$/, "");
4242
- }
4243
- var CloudNotLinkedError = class extends Error {
4244
- code = "CLOUD_NOT_LINKED";
4245
- constructor() {
4246
- super("Not linked to the Runeya cloud.");
4247
- this.name = "CloudNotLinkedError";
4248
- }
4249
- };
4250
- async function cloudFetch(path, init = {}) {
4251
- const token = await cloudSessionStore.getToken();
4252
- if (!token) throw new CloudNotLinkedError();
4253
- return fetch(`${getCloudApiUrl()}${path}`, {
4254
- method: init.method ?? "GET",
4255
- headers: {
4256
- Authorization: `Bearer ${token}`,
4257
- // Le cloud refuse (426) les apps trop anciennes pour son schéma courant.
4258
- [APP_VERSION_HEADER]: appVersion,
4259
- ...init.body !== void 0 ? { "Content-Type": "application/json" } : {}
4260
- },
4261
- ...init.body !== void 0 ? { body: JSON.stringify(init.body) } : {},
4262
- // 15s suits a JSON call; attachment downloads pass a longer budget.
4263
- signal: AbortSignal.timeout(init.timeoutMs ?? 15e3)
4264
- });
4265
- }
4266
-
4267
- // ../server/src/trpc/routers/setup.ts
4330
+ import { z as z9 } from "zod";
4268
4331
  var setupRouter = router({
4269
4332
  /**
4270
4333
  * Check if encryption key is required (project initialized but no key).
@@ -4364,9 +4427,9 @@ var setupRouter = router({
4364
4427
  * une validation de la clé à adopter rendait le parcours impossible : vert
4365
4428
  * quand le geste est inutile, rouge sinon.
4366
4429
  */
4367
- checkOrgKeyLocal: protectedProcedure.input(z8.object({
4368
- orgId: z8.string().min(1).max(128),
4369
- keyHex: z8.string().length(64).regex(/^[0-9a-f]+$/i, "Invalid hex format")
4430
+ checkOrgKeyLocal: protectedProcedure.input(z9.object({
4431
+ orgId: z9.string().min(1).max(128),
4432
+ keyHex: z9.string().length(64).regex(/^[0-9a-f]+$/i, "Invalid hex format")
4370
4433
  })).query(async ({ input }) => {
4371
4434
  const canary = await readVerifyFile(orgVaultRoot(input.orgId));
4372
4435
  if (!canary) return { isCurrentKey: false, hasCanary: false };
@@ -4381,8 +4444,8 @@ var setupRouter = router({
4381
4444
  * Spawns the local agent if in local-simple mode.
4382
4445
  */
4383
4446
  submitEncryptionKey: publicProcedure.input(
4384
- z8.object({
4385
- keyHex: z8.string().length(64).regex(/^[0-9a-f]+$/i, "Invalid hex format")
4447
+ z9.object({
4448
+ keyHex: z9.string().length(64).regex(/^[0-9a-f]+$/i, "Invalid hex format")
4386
4449
  })
4387
4450
  ).mutation(async ({ input }) => {
4388
4451
  try {
@@ -4401,32 +4464,32 @@ var setupRouter = router({
4401
4464
  });
4402
4465
 
4403
4466
  // ../server/src/trpc/routers/environment.ts
4404
- import { z as z9 } from "zod";
4467
+ import { z as z10 } from "zod";
4405
4468
  import { TRPCError as TRPCError7 } from "@trpc/server";
4406
4469
  var environmentRouter = router({
4407
- list: protectedProcedure.input(z9.object({
4408
- projectId: z9.string().max(128),
4409
- orgId: z9.string().max(128).nullable().optional()
4470
+ list: protectedProcedure.input(z10.object({
4471
+ projectId: z10.string().max(128),
4472
+ orgId: z10.string().max(128).nullable().optional()
4410
4473
  })).query(async ({ input }) => {
4411
4474
  return await environmentStore.list(input.projectId, input.orgId);
4412
4475
  }),
4413
- get: protectedProcedure.input(z9.object({ id: z9.string().max(128) })).query(async ({ input }) => {
4476
+ get: protectedProcedure.input(z10.object({ id: z10.string().max(128) })).query(async ({ input }) => {
4414
4477
  const env2 = await environmentStore.get(input.id);
4415
4478
  if (!env2) throw new TRPCError7({ code: "NOT_FOUND", message: `Environment ${input.id} not found` });
4416
4479
  return env2;
4417
4480
  }),
4418
- listByScope: protectedProcedure.input(z9.object({
4419
- projectId: z9.string().max(128),
4420
- orgId: z9.string().max(128).nullable().optional(),
4421
- scope: z9.enum(["global", "service"])
4481
+ listByScope: protectedProcedure.input(z10.object({
4482
+ projectId: z10.string().max(128),
4483
+ orgId: z10.string().max(128).nullable().optional(),
4484
+ scope: z10.enum(["global", "service"])
4422
4485
  })).query(async ({ input }) => {
4423
4486
  return await environmentStore.listByScope(input.projectId, input.scope, input.orgId);
4424
4487
  }),
4425
- findServiceEnvironment: protectedProcedure.input(z9.object({ serviceId: z9.string().max(128), globalEnvId: z9.string().max(128) })).query(async ({ input }) => {
4488
+ findServiceEnvironment: protectedProcedure.input(z10.object({ serviceId: z10.string().max(128), globalEnvId: z10.string().max(128) })).query(async ({ input }) => {
4426
4489
  return await environmentStore.findServiceEnvironment(input.serviceId, input.globalEnvId);
4427
4490
  }),
4428
4491
  create: protectedProcedure.input(CreateEnvironmentSchema.extend({
4429
- orgId: z9.string().max(128).nullable().optional()
4492
+ orgId: z10.string().max(128).nullable().optional()
4430
4493
  })).mutation(async ({ input }) => {
4431
4494
  const { orgId, ...environment } = input;
4432
4495
  const target = { id: input.projectId, orgId };
@@ -4478,7 +4541,7 @@ var environmentRouter = router({
4478
4541
  }
4479
4542
  return env2;
4480
4543
  }),
4481
- delete: protectedProcedure.input(z9.object({ id: z9.string().max(128) })).mutation(async ({ input }) => {
4544
+ delete: protectedProcedure.input(z10.object({ id: z10.string().max(128) })).mutation(async ({ input }) => {
4482
4545
  const env2 = await environmentStore.get(input.id);
4483
4546
  if (!env2) throw new TRPCError7({ code: "NOT_FOUND", message: `Environment ${input.id} not found` });
4484
4547
  if (env2.immutable) {
@@ -4492,7 +4555,7 @@ var environmentRouter = router({
4492
4555
  await projectStore.removeEnvironment(environmentStore.projectRefOf(env2) ?? env2.projectId, input.id);
4493
4556
  return { success: true };
4494
4557
  }),
4495
- resolve: protectedProcedure.input(z9.object({ environmentId: z9.string().max(128) })).query(async ({ input, ctx }) => {
4558
+ resolve: protectedProcedure.input(z10.object({ environmentId: z10.string().max(128) })).query(async ({ input, ctx }) => {
4496
4559
  const { includeSecrets } = requireEnvAction(ctx, input.environmentId, "env:read");
4497
4560
  const env2 = await environmentStore.get(input.environmentId);
4498
4561
  if (!env2) throw new TRPCError7({ code: "NOT_FOUND", message: `Environment ${input.environmentId} not found` });
@@ -4511,7 +4574,7 @@ var environmentRouter = router({
4511
4574
  }
4512
4575
  return resolved;
4513
4576
  }),
4514
- resolveFlat: protectedProcedure.meta({ openapi: { method: "GET", path: "/environments/{environmentId}/resolve-flat", tags: ["environments"], summary: "Resolve environment variables as a flat key-value map", protect: true } }).input(z9.object({ environmentId: z9.string().max(128) })).output(z9.record(z9.string(), z9.string())).query(async ({ input, ctx }) => {
4577
+ resolveFlat: protectedProcedure.meta({ openapi: { method: "GET", path: "/environments/{environmentId}/resolve-flat", tags: ["environments"], summary: "Resolve environment variables as a flat key-value map", protect: true } }).input(z10.object({ environmentId: z10.string().max(128) })).output(z10.record(z10.string(), z10.string())).query(async ({ input, ctx }) => {
4515
4578
  const { includeSecrets } = requireEnvAction(ctx, input.environmentId, "env:read");
4516
4579
  const env2 = await environmentStore.get(input.environmentId);
4517
4580
  if (!env2) throw new TRPCError7({ code: "NOT_FOUND", message: `Environment ${input.environmentId} not found` });
@@ -4527,8 +4590,8 @@ var environmentRouter = router({
4527
4590
  return result;
4528
4591
  }),
4529
4592
  // --- Overrides (flat, by variableId) ---
4530
- setOverride: protectedProcedure.input(z9.object({
4531
- variableId: z9.string().max(128),
4593
+ setOverride: protectedProcedure.input(z10.object({
4594
+ variableId: z10.string().max(128),
4532
4595
  // Only the value slot: the env var name comes from the variable
4533
4596
  // definition (a `key` sent by an older client is stripped here).
4534
4597
  variable: VariableOverrideSchema
@@ -4536,8 +4599,8 @@ var environmentRouter = router({
4536
4599
  await environmentOverridesStore.setOverride(input.variableId, input.variable);
4537
4600
  return { success: true };
4538
4601
  }),
4539
- removeOverride: protectedProcedure.input(z9.object({
4540
- variableId: z9.string().max(128)
4602
+ removeOverride: protectedProcedure.input(z10.object({
4603
+ variableId: z10.string().max(128)
4541
4604
  })).mutation(async ({ input }) => {
4542
4605
  await environmentOverridesStore.removeOverride(input.variableId);
4543
4606
  return { success: true };
@@ -4545,9 +4608,9 @@ var environmentRouter = router({
4545
4608
  getOverrides: protectedProcedure.query(async () => {
4546
4609
  return await environmentOverridesStore.getAll();
4547
4610
  }),
4548
- upsertVariable: protectedProcedure.meta({ openapi: { method: "PUT", path: "/environments/{environmentId}/variables/{variableId}", tags: ["environments"], summary: "Upsert a variable in an environment", protect: true } }).output(z9.any()).input(z9.object({
4549
- environmentId: z9.string().max(128),
4550
- variableId: z9.string().max(128),
4611
+ upsertVariable: protectedProcedure.meta({ openapi: { method: "PUT", path: "/environments/{environmentId}/variables/{variableId}", tags: ["environments"], summary: "Upsert a variable in an environment", protect: true } }).output(z10.any()).input(z10.object({
4612
+ environmentId: z10.string().max(128),
4613
+ variableId: z10.string().max(128),
4551
4614
  variable: VariableSchema
4552
4615
  })).mutation(async ({ input, ctx }) => {
4553
4616
  requireEnvAction(ctx, input.environmentId, "env:write");
@@ -4562,12 +4625,12 @@ var environmentRouter = router({
4562
4625
  * define it, and variables that reference it through {{environment.KEY}}.
4563
4626
  * Used by the UI to warn before editing a shared variable from a resolved view.
4564
4627
  */
4565
- keyUsages: protectedProcedure.input(z9.object({
4566
- projectId: z9.string().max(128),
4567
- orgId: z9.string().max(128).nullable().optional(),
4568
- key: z9.string().min(1).max(256),
4628
+ keyUsages: protectedProcedure.input(z10.object({
4629
+ projectId: z10.string().max(128),
4630
+ orgId: z10.string().max(128).nullable().optional(),
4631
+ key: z10.string().min(1).max(256),
4569
4632
  /** Environment holding the variable about to be edited — enables inherited-impact detection */
4570
- environmentId: z9.string().max(128).optional()
4633
+ environmentId: z10.string().max(128).optional()
4571
4634
  })).query(async ({ input }) => {
4572
4635
  const environments = await environmentStore.list(input.projectId, input.orgId);
4573
4636
  const services = await serviceStore.list();
@@ -4624,9 +4687,9 @@ var environmentRouter = router({
4624
4687
  }
4625
4688
  return { definedIn, referencedBy, inheritedBy };
4626
4689
  }),
4627
- removeVariable: protectedProcedure.input(z9.object({
4628
- environmentId: z9.string().max(128),
4629
- variableId: z9.string().max(128)
4690
+ removeVariable: protectedProcedure.input(z10.object({
4691
+ environmentId: z10.string().max(128),
4692
+ variableId: z10.string().max(128)
4630
4693
  })).mutation(async ({ input }) => {
4631
4694
  const env2 = await environmentStore.get(input.environmentId);
4632
4695
  if (!env2) throw new TRPCError7({ code: "NOT_FOUND", message: `Environment ${input.environmentId} not found` });
@@ -4638,7 +4701,7 @@ var environmentRouter = router({
4638
4701
 
4639
4702
  // ../server/src/trpc/routers/settings.ts
4640
4703
  import { promises as dns } from "dns";
4641
- import { z as z11 } from "zod";
4704
+ import { z as z12 } from "zod";
4642
4705
  import { TRPCError as TRPCError8 } from "@trpc/server";
4643
4706
 
4644
4707
  // ../server/src/services/settings-scope.ts
@@ -4654,12 +4717,12 @@ async function vaultOfProject(projectId) {
4654
4717
  import { networkInterfaces } from "os";
4655
4718
  import { readFile as readFile10, writeFile as writeFile10, rename as rename10, mkdir as mkdir10 } from "fs/promises";
4656
4719
  import { join as join11 } from "path";
4657
- import { z as z10 } from "zod";
4720
+ import { z as z11 } from "zod";
4658
4721
  var LOOPBACK2 = "127.0.0.1";
4659
4722
  var ANY = "0.0.0.0";
4660
4723
  var NETWORK_FILE = "network.json";
4661
- var NetworkFileSchema = z10.object({
4662
- instances: z10.record(z10.string(), z10.object({ lanEnabled: z10.boolean().default(false) })).default({})
4724
+ var NetworkFileSchema = z11.object({
4725
+ instances: z11.record(z11.string(), z11.object({ lanEnabled: z11.boolean().default(false) })).default({})
4663
4726
  });
4664
4727
  var httpServer = null;
4665
4728
  function instanceKey() {
@@ -4779,8 +4842,8 @@ function maskApiKey2(plaintext) {
4779
4842
  return plaintext.slice(0, 4) + "****" + plaintext.slice(-4);
4780
4843
  }
4781
4844
  var ScopeShape = {
4782
- orgId: z11.string().max(128).nullable().optional(),
4783
- projectId: z11.string().max(128).optional()
4845
+ orgId: z12.string().max(128).nullable().optional(),
4846
+ projectId: z12.string().max(128).optional()
4784
4847
  };
4785
4848
  async function scopeOf(input) {
4786
4849
  return input?.orgId ?? await vaultOfProject(input?.projectId);
@@ -4818,7 +4881,7 @@ var settingsRouter = router({
4818
4881
  * celle de l'onglet qui bascule, ne sont pas coupées. Le choix est mémorisé
4819
4882
  * dans les réglages, donc conservé au prochain démarrage.
4820
4883
  */
4821
- setLanMode: protectedProcedure.input(z11.object({ enabled: z11.boolean() })).mutation(async ({ input }) => {
4884
+ setLanMode: protectedProcedure.input(z12.object({ enabled: z12.boolean() })).mutation(async ({ input }) => {
4822
4885
  try {
4823
4886
  return await setLanMode(input.enabled);
4824
4887
  } catch (err) {
@@ -4843,7 +4906,7 @@ var settingsRouter = router({
4843
4906
  /**
4844
4907
  * Get notification preferences
4845
4908
  */
4846
- getNotificationPreferences: protectedProcedure.input(z11.object(ScopeShape).optional()).query(async ({ input }) => {
4909
+ getNotificationPreferences: protectedProcedure.input(z12.object(ScopeShape).optional()).query(async ({ input }) => {
4847
4910
  const priv = await settingsManager.getPrivateSettings(await scopeOf(input));
4848
4911
  return NotificationPreferencesSchema.parse(priv.notifications ?? {});
4849
4912
  }),
@@ -4871,7 +4934,7 @@ var settingsRouter = router({
4871
4934
  * parseur d'organisation se modifie pour toute l'équipe, et l'interface doit
4872
4935
  * pouvoir le dire avant que quelqu'un le change sans le savoir.
4873
4936
  */
4874
- listParsers: protectedProcedure.input(z11.object(ScopeShape).optional()).query(async ({ input }) => {
4937
+ listParsers: protectedProcedure.input(z12.object(ScopeShape).optional()).query(async ({ input }) => {
4875
4938
  const vault = await scopeOf(input);
4876
4939
  return listWithOrigin(await logParserStore.list(vault), vault);
4877
4940
  }),
@@ -4883,7 +4946,7 @@ var settingsRouter = router({
4883
4946
  * retard — affichant une liste dans laquelle le parseur qu'un service vient
4884
4947
  * de référencer n'existe pas encore.
4885
4948
  */
4886
- onParsersChanged: protectedProcedure.input(z11.object(ScopeShape).optional()).subscription(async function* ({ input, signal }) {
4949
+ onParsersChanged: protectedProcedure.input(z12.object(ScopeShape).optional()).subscription(async function* ({ input, signal }) {
4887
4950
  const vault = await scopeOf(input);
4888
4951
  let pending = true;
4889
4952
  let wake = null;
@@ -4921,7 +4984,7 @@ var settingsRouter = router({
4921
4984
  /**
4922
4985
  * Get single parser by ID
4923
4986
  */
4924
- getParser: protectedProcedure.input(z11.object({ id: z11.string().max(128), ...ScopeShape })).query(async ({ input }) => {
4987
+ getParser: protectedProcedure.input(z12.object({ id: z12.string().max(128), ...ScopeShape })).query(async ({ input }) => {
4925
4988
  const parser = await logParserStore.get(input.id, await scopeOf(input));
4926
4989
  if (!parser) {
4927
4990
  throw new TRPCError8({ code: "NOT_FOUND", message: `Parser not found: ${input.id}` });
@@ -4969,7 +5032,7 @@ var settingsRouter = router({
4969
5032
  /**
4970
5033
  * Delete parser by ID
4971
5034
  */
4972
- deleteParser: protectedProcedure.input(z11.object({ id: z11.string().max(128), ...ScopeShape })).mutation(async ({ input }) => {
5035
+ deleteParser: protectedProcedure.input(z12.object({ id: z12.string().max(128), ...ScopeShape })).mutation(async ({ input }) => {
4973
5036
  if (input.id.startsWith("native:")) {
4974
5037
  throw new TRPCError8({ code: "FORBIDDEN", message: "Cannot delete built-in parsers" });
4975
5038
  }
@@ -4985,7 +5048,7 @@ var settingsRouter = router({
4985
5048
  /**
4986
5049
  * List AI providers (API keys are masked)
4987
5050
  */
4988
- listAIProviders: protectedProcedure.input(z11.object(ScopeShape).optional()).query(async ({ input }) => {
5051
+ listAIProviders: protectedProcedure.input(z12.object(ScopeShape).optional()).query(async ({ input }) => {
4989
5052
  const vault = await scopeOf(input);
4990
5053
  const priv = await settingsManager.getPrivateSettings(vault);
4991
5054
  return (priv.aiProviders ?? []).map((p) => {
@@ -5003,12 +5066,12 @@ var settingsRouter = router({
5003
5066
  /**
5004
5067
  * Create AI provider
5005
5068
  */
5006
- createAIProvider: protectedProcedure.input(z11.object({
5007
- name: z11.string().min(1).max(200),
5069
+ createAIProvider: protectedProcedure.input(z12.object({
5070
+ name: z12.string().min(1).max(200),
5008
5071
  provider: AIProviderSchema.shape.provider,
5009
- apiKey: z11.string().max(500).optional(),
5072
+ apiKey: z12.string().max(500).optional(),
5010
5073
  // optional for providers like Ollama
5011
- model: z11.string().max(200).optional(),
5074
+ model: z12.string().max(200).optional(),
5012
5075
  ...ScopeShape
5013
5076
  })).mutation(async ({ input }) => {
5014
5077
  if (input.provider !== "ollama" && !input.apiKey?.trim()) {
@@ -5041,12 +5104,12 @@ var settingsRouter = router({
5041
5104
  /**
5042
5105
  * Update AI provider (apiKey optional — omit to keep existing)
5043
5106
  */
5044
- updateAIProvider: protectedProcedure.input(z11.object({
5045
- id: z11.string().min(1).max(128),
5046
- name: z11.string().min(1).max(200).optional(),
5107
+ updateAIProvider: protectedProcedure.input(z12.object({
5108
+ id: z12.string().min(1).max(128),
5109
+ name: z12.string().min(1).max(200).optional(),
5047
5110
  provider: AIProviderSchema.shape.provider.optional(),
5048
- apiKey: z11.string().min(1).max(500).optional(),
5049
- model: z11.string().max(200).optional(),
5111
+ apiKey: z12.string().min(1).max(500).optional(),
5112
+ model: z12.string().max(200).optional(),
5050
5113
  ...ScopeShape
5051
5114
  })).mutation(async ({ input }) => {
5052
5115
  const vault = await scopeOf(input);
@@ -5079,7 +5142,7 @@ var settingsRouter = router({
5079
5142
  /**
5080
5143
  * Delete AI provider
5081
5144
  */
5082
- deleteAIProvider: protectedProcedure.input(z11.object({ id: z11.string().min(1).max(128), ...ScopeShape })).mutation(async ({ input }) => {
5145
+ deleteAIProvider: protectedProcedure.input(z12.object({ id: z12.string().min(1).max(128), ...ScopeShape })).mutation(async ({ input }) => {
5083
5146
  const vault = await scopeOf(input);
5084
5147
  const priv = await settingsManager.getPrivateSettings(vault);
5085
5148
  const providers = priv.aiProviders ?? [];
@@ -5093,7 +5156,7 @@ var settingsRouter = router({
5093
5156
  /**
5094
5157
  * Set one provider as active (clears active flag on all others)
5095
5158
  */
5096
- setActiveAIProvider: protectedProcedure.input(z11.object({ id: z11.string().min(1).max(128), ...ScopeShape })).mutation(async ({ input }) => {
5159
+ setActiveAIProvider: protectedProcedure.input(z12.object({ id: z12.string().min(1).max(128), ...ScopeShape })).mutation(async ({ input }) => {
5097
5160
  const vault = await scopeOf(input);
5098
5161
  const priv = await settingsManager.getPrivateSettings(vault);
5099
5162
  const providers = priv.aiProviders ?? [];
@@ -5109,7 +5172,7 @@ var settingsRouter = router({
5109
5172
  /**
5110
5173
  * Get Traefik config for a specific agent (never returns credentials or cert key in plain text)
5111
5174
  */
5112
- getAgentTraefikConfig: protectedProcedure.input(z11.object({ agentId: z11.string().max(128) })).query(async ({ input }) => {
5175
+ getAgentTraefikConfig: protectedProcedure.input(z12.object({ agentId: z12.string().max(128) })).query(async ({ input }) => {
5113
5176
  const raw = agentStore.getTraefikConfig(input.agentId);
5114
5177
  const parsed = raw ? TraefikConfigSchema.safeParse(raw) : null;
5115
5178
  const config = parsed?.success ? parsed.data : null;
@@ -5129,16 +5192,16 @@ var settingsRouter = router({
5129
5192
  /**
5130
5193
  * Update Traefik config for a specific agent (credentials are encrypted before saving)
5131
5194
  */
5132
- updateAgentTraefikConfig: protectedProcedure.input(z11.object({
5133
- agentId: z11.string().max(128),
5134
- enabled: z11.boolean().optional(),
5135
- acmeEmail: z11.string().email().max(256).optional(),
5136
- wildcardDomain: z11.string().max(253).optional(),
5137
- httpPort: z11.number().int().min(1).max(65535).optional(),
5138
- httpsPort: z11.number().int().min(1).max(65535).optional(),
5139
- dnsProvider: z11.string().max(64).optional(),
5140
- dnsCredentials: z11.record(z11.string().max(64), z11.string().max(2048)).optional(),
5141
- acmeStaging: z11.boolean().optional()
5195
+ updateAgentTraefikConfig: protectedProcedure.input(z12.object({
5196
+ agentId: z12.string().max(128),
5197
+ enabled: z12.boolean().optional(),
5198
+ acmeEmail: z12.string().email().max(256).optional(),
5199
+ wildcardDomain: z12.string().max(253).optional(),
5200
+ httpPort: z12.number().int().min(1).max(65535).optional(),
5201
+ httpsPort: z12.number().int().min(1).max(65535).optional(),
5202
+ dnsProvider: z12.string().max(64).optional(),
5203
+ dnsCredentials: z12.record(z12.string().max(64), z12.string().max(2048)).optional(),
5204
+ acmeStaging: z12.boolean().optional()
5142
5205
  })).mutation(async ({ input }) => {
5143
5206
  const { agentId, ...fields } = input;
5144
5207
  const raw = agentStore.getTraefikConfig(agentId);
@@ -5167,13 +5230,13 @@ var settingsRouter = router({
5167
5230
  /**
5168
5231
  * Get Traefik config files content for a specific agent
5169
5232
  */
5170
- getAgentTraefikConfigFiles: protectedProcedure.input(z11.object({ agentId: z11.string().max(128) })).query(async ({ input }) => {
5233
+ getAgentTraefikConfigFiles: protectedProcedure.input(z12.object({ agentId: z12.string().max(128) })).query(async ({ input }) => {
5171
5234
  return agentManager.agentQuery(
5172
5235
  input.agentId,
5173
5236
  "config.getTraefikConfigFiles"
5174
5237
  );
5175
5238
  }),
5176
- getAgentTraefikFileTree: protectedProcedure.input(z11.object({ agentId: z11.string().max(128) })).query(async ({ input }) => {
5239
+ getAgentTraefikFileTree: protectedProcedure.input(z12.object({ agentId: z12.string().max(128) })).query(async ({ input }) => {
5177
5240
  return agentManager.agentQuery(
5178
5241
  input.agentId,
5179
5242
  "config.getTraefikFileTree"
@@ -5182,7 +5245,7 @@ var settingsRouter = router({
5182
5245
  /**
5183
5246
  * Get Traefik container logs for a specific agent (snapshot)
5184
5247
  */
5185
- getAgentTraefikLogs: protectedProcedure.input(z11.object({ agentId: z11.string().max(128), lines: z11.number().int().min(1).max(500).default(100) })).query(async ({ input }) => {
5248
+ getAgentTraefikLogs: protectedProcedure.input(z12.object({ agentId: z12.string().max(128), lines: z12.number().int().min(1).max(500).default(100) })).query(async ({ input }) => {
5186
5249
  const result = await agentManager.agentQuery(
5187
5250
  input.agentId,
5188
5251
  "config.getTraefikLogs",
@@ -5193,7 +5256,7 @@ var settingsRouter = router({
5193
5256
  /**
5194
5257
  * Stream Traefik logs in real-time (subscription, yields new lines every 500ms)
5195
5258
  */
5196
- streamAgentTraefikLogs: protectedProcedure.input(z11.object({ agentId: z11.string().max(128) })).subscription(async function* ({ input, signal }) {
5259
+ streamAgentTraefikLogs: protectedProcedure.input(z12.object({ agentId: z12.string().max(128) })).subscription(async function* ({ input, signal }) {
5197
5260
  let seen = 0;
5198
5261
  while (!signal?.aborted) {
5199
5262
  try {
@@ -5216,7 +5279,7 @@ var settingsRouter = router({
5216
5279
  /**
5217
5280
  * Restart Traefik container on a specific agent (re-pushes config first to handle agent restarts)
5218
5281
  */
5219
- restartAgentTraefik: protectedProcedure.input(z11.object({ agentId: z11.string().max(128) })).mutation(async ({ input }) => {
5282
+ restartAgentTraefik: protectedProcedure.input(z12.object({ agentId: z12.string().max(128) })).mutation(async ({ input }) => {
5220
5283
  const raw = agentStore.getTraefikConfig(input.agentId);
5221
5284
  const parsed = raw ? TraefikConfigSchema.safeParse(raw) : null;
5222
5285
  const config = parsed?.success ? parsed.data : null;
@@ -5229,7 +5292,7 @@ var settingsRouter = router({
5229
5292
  /**
5230
5293
  * Force certificate renewal for a specific agent (wipes acme.json + restarts container)
5231
5294
  */
5232
- renewAgentTraefikCert: protectedProcedure.input(z11.object({ agentId: z11.string().max(128) })).mutation(async ({ input }) => {
5295
+ renewAgentTraefikCert: protectedProcedure.input(z12.object({ agentId: z12.string().max(128) })).mutation(async ({ input }) => {
5233
5296
  const raw = agentStore.getTraefikConfig(input.agentId);
5234
5297
  const parsed = raw ? TraefikConfigSchema.safeParse(raw) : null;
5235
5298
  const config = parsed?.success ? parsed.data : null;
@@ -5242,7 +5305,7 @@ var settingsRouter = router({
5242
5305
  /**
5243
5306
  * Validate Traefik configuration for a specific agent
5244
5307
  */
5245
- validateAgentTraefikConfig: protectedProcedure.input(z11.object({ agentId: z11.string().max(128) })).query(async ({ input }) => {
5308
+ validateAgentTraefikConfig: protectedProcedure.input(z12.object({ agentId: z12.string().max(128) })).query(async ({ input }) => {
5246
5309
  const raw = agentStore.getTraefikConfig(input.agentId);
5247
5310
  const parsed = raw ? TraefikConfigSchema.safeParse(raw) : null;
5248
5311
  const config = parsed?.success ? parsed.data : null;
@@ -5344,12 +5407,12 @@ var settingsRouter = router({
5344
5407
  * Test parser code: compile and run it against sample logs, return per-line results
5345
5408
  */
5346
5409
  testParser: protectedProcedure.input(
5347
- z11.object({
5348
- code: z11.string().max(5e4),
5349
- sampleLogs: z11.array(
5350
- z11.object({
5351
- raw: z11.string().max(16384),
5352
- stream: z11.enum(["stdout", "stderr"])
5410
+ z12.object({
5411
+ code: z12.string().max(5e4),
5412
+ sampleLogs: z12.array(
5413
+ z12.object({
5414
+ raw: z12.string().max(16384),
5415
+ stream: z12.enum(["stdout", "stderr"])
5353
5416
  })
5354
5417
  ).max(100).default([])
5355
5418
  })
@@ -5393,7 +5456,7 @@ var settingsRouter = router({
5393
5456
  });
5394
5457
 
5395
5458
  // ../server/src/trpc/routers/editor.ts
5396
- import { z as z13 } from "zod";
5459
+ import { z as z14 } from "zod";
5397
5460
  import { TRPCError as TRPCError9 } from "@trpc/server";
5398
5461
  import { execFile as execFile3, spawn as spawn2 } from "child_process";
5399
5462
  import { stat as stat4 } from "fs/promises";
@@ -5404,19 +5467,19 @@ import { homedir as homedir2 } from "os";
5404
5467
  import { readFile as readFile11, writeFile as writeFile11, rename as rename11, mkdir as mkdir11, chmod as chmod9 } from "fs/promises";
5405
5468
  import { join as join12 } from "path";
5406
5469
  import { homedir } from "os";
5407
- import { z as z12 } from "zod";
5470
+ import { z as z13 } from "zod";
5408
5471
  var CONFIG_DIR = join12(homedir(), ".runeya");
5409
5472
  var CONFIG_FILE = "runeya.conf";
5410
- var EditorPreferencesSchema = z12.object({
5411
- default: z12.string().max(64).optional()
5412
- }).catchall(z12.string().max(64)).refine((obj) => Object.keys(obj).length <= 500, "Too many editor preferences");
5413
- var ProjectSettingsSchema = z12.object({
5414
- settings: z12.object({
5473
+ var EditorPreferencesSchema = z13.object({
5474
+ default: z13.string().max(64).optional()
5475
+ }).catchall(z13.string().max(64)).refine((obj) => Object.keys(obj).length <= 500, "Too many editor preferences");
5476
+ var ProjectSettingsSchema = z13.object({
5477
+ settings: z13.object({
5415
5478
  editors: EditorPreferencesSchema.optional()
5416
5479
  }).optional()
5417
5480
  });
5418
- var UserConfigSchema = z12.record(
5419
- z12.string().max(128),
5481
+ var UserConfigSchema = z13.record(
5482
+ z13.string().max(128),
5420
5483
  ProjectSettingsSchema
5421
5484
  ).refine((obj) => Object.keys(obj).length <= 100, "Too many projects in config");
5422
5485
  function configKey(ref) {
@@ -5508,16 +5571,16 @@ var editorRouter = router({
5508
5571
  );
5509
5572
  return results;
5510
5573
  }),
5511
- getPreferences: protectedProcedure.input(z13.object({
5512
- projectId: z13.string().max(128),
5513
- orgId: z13.string().max(128).nullable().optional()
5574
+ getPreferences: protectedProcedure.input(z14.object({
5575
+ projectId: z14.string().max(128),
5576
+ orgId: z14.string().max(128).nullable().optional()
5514
5577
  })).query(async ({ input }) => {
5515
5578
  return userConfigManager.getEditorPreferences({ id: input.projectId, orgId: input.orgId });
5516
5579
  }),
5517
- setDefault: protectedProcedure.input(z13.object({
5518
- projectId: z13.string().max(128),
5519
- orgId: z13.string().max(128).nullable().optional(),
5520
- editorKey: z13.string().max(64)
5580
+ setDefault: protectedProcedure.input(z14.object({
5581
+ projectId: z14.string().max(128),
5582
+ orgId: z14.string().max(128).nullable().optional(),
5583
+ editorKey: z14.string().max(64)
5521
5584
  })).mutation(async ({ input }) => {
5522
5585
  if (!EDITOR_BY_KEY.has(input.editorKey)) {
5523
5586
  throw new TRPCError9({ code: "BAD_REQUEST", message: `Unknown editor: ${input.editorKey}` });
@@ -5529,11 +5592,11 @@ var editorRouter = router({
5529
5592
  );
5530
5593
  return { success: true };
5531
5594
  }),
5532
- setServiceEditor: protectedProcedure.input(z13.object({
5533
- projectId: z13.string().max(128),
5534
- orgId: z13.string().max(128).nullable().optional(),
5535
- serviceId: z13.string().max(128),
5536
- editorKey: z13.string().max(64)
5595
+ setServiceEditor: protectedProcedure.input(z14.object({
5596
+ projectId: z14.string().max(128),
5597
+ orgId: z14.string().max(128).nullable().optional(),
5598
+ serviceId: z14.string().max(128),
5599
+ editorKey: z14.string().max(64)
5537
5600
  })).mutation(async ({ input }) => {
5538
5601
  if (!EDITOR_BY_KEY.has(input.editorKey)) {
5539
5602
  throw new TRPCError9({ code: "BAD_REQUEST", message: `Unknown editor: ${input.editorKey}` });
@@ -5545,10 +5608,10 @@ var editorRouter = router({
5545
5608
  );
5546
5609
  return { success: true };
5547
5610
  }),
5548
- removeServiceEditor: protectedProcedure.input(z13.object({
5549
- projectId: z13.string().max(128),
5550
- orgId: z13.string().max(128).nullable().optional(),
5551
- serviceId: z13.string().max(128)
5611
+ removeServiceEditor: protectedProcedure.input(z14.object({
5612
+ projectId: z14.string().max(128),
5613
+ orgId: z14.string().max(128).nullable().optional(),
5614
+ serviceId: z14.string().max(128)
5552
5615
  })).mutation(async ({ input }) => {
5553
5616
  await userConfigManager.removeEditorPreference(
5554
5617
  { id: input.projectId, orgId: input.orgId },
@@ -5556,9 +5619,9 @@ var editorRouter = router({
5556
5619
  );
5557
5620
  return { success: true };
5558
5621
  }),
5559
- open: protectedProcedure.input(z13.object({
5560
- editorKey: z13.string().max(64),
5561
- path: z13.string().max(4096)
5622
+ open: protectedProcedure.input(z14.object({
5623
+ editorKey: z14.string().max(64),
5624
+ path: z14.string().max(4096)
5562
5625
  })).mutation(async ({ input }) => {
5563
5626
  const editor = EDITOR_BY_KEY.get(input.editorKey);
5564
5627
  if (!editor) {
@@ -5581,10 +5644,10 @@ var editorRouter = router({
5581
5644
  child.unref();
5582
5645
  return { success: true };
5583
5646
  }),
5584
- openFile: protectedProcedure.input(z13.object({
5585
- editorKey: z13.string().max(64),
5586
- serviceId: z13.string().max(128),
5587
- relativePath: z13.string().max(4096)
5647
+ openFile: protectedProcedure.input(z14.object({
5648
+ editorKey: z14.string().max(64),
5649
+ serviceId: z14.string().max(128),
5650
+ relativePath: z14.string().max(4096)
5588
5651
  })).mutation(async ({ input }) => {
5589
5652
  const editor = EDITOR_BY_KEY.get(input.editorKey);
5590
5653
  if (!editor) {
@@ -5612,7 +5675,7 @@ var editorRouter = router({
5612
5675
  });
5613
5676
 
5614
5677
  // ../server/src/trpc/routers/api-keys.ts
5615
- import { z as z14 } from "zod";
5678
+ import { z as z15 } from "zod";
5616
5679
  import { TRPCError as TRPCError10 } from "@trpc/server";
5617
5680
  import { mkdir as mkdir12, writeFile as writeFile12 } from "fs/promises";
5618
5681
  import { join as join14, dirname as dirname7 } from "path";
@@ -5621,43 +5684,43 @@ var ALLOWED_SKILL_PATHS = /* @__PURE__ */ new Set([
5621
5684
  ".cursor/rules/runeya.mdc",
5622
5685
  ".windsurf/rules/runeya.md"
5623
5686
  ]);
5624
- var KeyInputSchema = z14.object({
5625
- name: z14.string().min(1).max(200),
5687
+ var KeyInputSchema = z15.object({
5688
+ name: z15.string().min(1).max(200),
5626
5689
  scopes: ApiKeyScopeSchema,
5627
- isPublic: z14.boolean().default(false)
5690
+ isPublic: z15.boolean().default(false)
5628
5691
  });
5629
5692
  var apiKeysRouter = router({
5630
5693
  list: protectedProcedure.query(() => apiKeyStore.list()),
5631
- create: protectedProcedure.input(KeyInputSchema.extend({ orgId: z14.string().min(1).max(128).nullable().optional() })).mutation(
5694
+ create: protectedProcedure.input(KeyInputSchema.extend({ orgId: z15.string().min(1).max(128).nullable().optional() })).mutation(
5632
5695
  ({ input }) => apiKeyStore.create(input.name, input.scopes, input.isPublic, input.orgId ?? null)
5633
5696
  ),
5634
5697
  /**
5635
5698
  * Renvoie le secret d'une seule clé, sur demande explicite. `list` ne le
5636
5699
  * contient pas : une clé ne doit jamais être re-servie en masse.
5637
5700
  */
5638
- reveal: protectedProcedure.input(z14.object({ id: z14.string().max(128) })).query(async ({ input }) => {
5701
+ reveal: protectedProcedure.input(z15.object({ id: z15.string().max(128) })).query(async ({ input }) => {
5639
5702
  const key = await apiKeyStore.reveal(input.id);
5640
5703
  if (!key) throw new TRPCError10({ code: "NOT_FOUND", message: "API key not found" });
5641
5704
  return { key };
5642
5705
  }),
5643
- update: protectedProcedure.input(KeyInputSchema.extend({ id: z14.string().max(128) })).mutation(async ({ input }) => {
5706
+ update: protectedProcedure.input(KeyInputSchema.extend({ id: z15.string().max(128) })).mutation(async ({ input }) => {
5644
5707
  const updated = await apiKeyStore.update(input.id, input.name, input.scopes, input.isPublic);
5645
5708
  if (!updated) throw new TRPCError10({ code: "NOT_FOUND", message: "API key not found" });
5646
5709
  return maskApiKey(updated);
5647
5710
  }),
5648
- remove: protectedProcedure.input(z14.object({ id: z14.string().max(128) })).mutation(async ({ input }) => {
5711
+ remove: protectedProcedure.input(z15.object({ id: z15.string().max(128) })).mutation(async ({ input }) => {
5649
5712
  const removed = await apiKeyStore.remove(input.id);
5650
5713
  if (!removed) throw new TRPCError10({ code: "NOT_FOUND", message: "API key not found" });
5651
5714
  return { success: true };
5652
5715
  }),
5653
- renewKey: protectedProcedure.input(z14.object({ id: z14.string().max(128) })).mutation(async ({ input }) => {
5716
+ renewKey: protectedProcedure.input(z15.object({ id: z15.string().max(128) })).mutation(async ({ input }) => {
5654
5717
  const renewed = await apiKeyStore.renewKey(input.id);
5655
5718
  if (!renewed) throw new TRPCError10({ code: "NOT_FOUND", message: "API key not found" });
5656
5719
  return renewed;
5657
5720
  }),
5658
- writeSkillFile: protectedProcedure.input(z14.object({
5659
- relativePath: z14.string().max(256),
5660
- content: z14.string().max(32768)
5721
+ writeSkillFile: protectedProcedure.input(z15.object({
5722
+ relativePath: z15.string().max(256),
5723
+ content: z15.string().max(32768)
5661
5724
  })).mutation(async ({ input }) => {
5662
5725
  if (!ALLOWED_SKILL_PATHS.has(input.relativePath)) {
5663
5726
  throw new TRPCError10({ code: "BAD_REQUEST", message: "Chemin non autoris\xE9" });
@@ -5670,7 +5733,7 @@ var apiKeysRouter = router({
5670
5733
  });
5671
5734
 
5672
5735
  // ../server/src/trpc/routers/chat.ts
5673
- import { z as z17 } from "zod";
5736
+ import { z as z18 } from "zod";
5674
5737
  import Anthropic2 from "@anthropic-ai/sdk";
5675
5738
  import OpenAI2 from "openai";
5676
5739
  import { execFile as execFile4 } from "child_process";
@@ -6343,12 +6406,12 @@ async function codexSessionExists(sessionId) {
6343
6406
  import { TRPCError as TRPCError12 } from "@trpc/server";
6344
6407
 
6345
6408
  // ../server/src/trpc/shared-schemas.ts
6346
- import { z as z15 } from "zod";
6347
- var Id128Schema = z15.string().max(128);
6348
- var ConversationIdSchema = z15.string().max(128);
6349
- var NameSchema = z15.string().min(1).max(200);
6350
- var ShortString200Schema = z15.string().max(200);
6351
- var DescriptionSchema = z15.string().max(2e3);
6409
+ import { z as z16 } from "zod";
6410
+ var Id128Schema = z16.string().max(128);
6411
+ var ConversationIdSchema = z16.string().max(128);
6412
+ var NameSchema = z16.string().min(1).max(200);
6413
+ var ShortString200Schema = z16.string().max(200);
6414
+ var DescriptionSchema = z16.string().max(2e3);
6352
6415
  var OptionalProviderIdSchema = Id128Schema.optional();
6353
6416
 
6354
6417
  // ../server/src/services/llms-txt-generator.ts
@@ -7722,7 +7785,7 @@ async function resolveImagesToBase64(images, contextId) {
7722
7785
  }
7723
7786
 
7724
7787
  // ../server/src/trpc/routers/cloud-auth.ts
7725
- import { z as z16 } from "zod";
7788
+ import { z as z17 } from "zod";
7726
7789
  import { hostname } from "os";
7727
7790
  import { basename } from "path";
7728
7791
  import { TRPCError as TRPCError11 } from "@trpc/server";
@@ -7767,7 +7830,7 @@ function isAllowedProxyPath(path) {
7767
7830
  }
7768
7831
  var cloudAuthRouter = router({
7769
7832
  /** Build the cloud authorization URL to open in the browser. */
7770
- startLogin: protectedProcedure.input(z16.object({ returnTo: z16.string().url().max(2048) })).mutation(async ({ input }) => {
7833
+ startLogin: protectedProcedure.input(z17.object({ returnTo: z17.string().url().max(2048) })).mutation(async ({ input }) => {
7771
7834
  const callback = callbackForReturnTo(input.returnTo);
7772
7835
  if (!callback) {
7773
7836
  throw new TRPCError11({
@@ -7815,7 +7878,7 @@ var cloudAuthRouter = router({
7815
7878
  * drops the session, and the local token is dropped here too, so nothing is
7816
7879
  * left holding a dead credential.
7817
7880
  */
7818
- revokeDevice: protectedProcedure.input(z16.object({ id: z16.string().min(1).max(128) })).mutation(async ({ input }) => {
7881
+ revokeDevice: protectedProcedure.input(z17.object({ id: z17.string().min(1).max(128) })).mutation(async ({ input }) => {
7819
7882
  const res = await cloudFetch2("/api/auth/device/revoke", { method: "POST", body: { id: input.id } });
7820
7883
  if (!res.ok) {
7821
7884
  if (res.status === 401) await cloudSessionStore.clear();
@@ -7832,11 +7895,11 @@ var cloudAuthRouter = router({
7832
7895
  * the cloud: the web UI asks its own server, which holds the credential.
7833
7896
  */
7834
7897
  proxy: protectedProcedure.input(
7835
- z16.object({
7836
- path: z16.string().min(1).max(512),
7837
- method: z16.enum(["GET", "POST"]).default("GET"),
7838
- query: z16.record(z16.string().max(128), z16.string().max(2048)).optional(),
7839
- body: z16.unknown().optional()
7898
+ z17.object({
7899
+ path: z17.string().min(1).max(512),
7900
+ method: z17.enum(["GET", "POST"]).default("GET"),
7901
+ query: z17.record(z17.string().max(128), z17.string().max(2048)).optional(),
7902
+ body: z17.unknown().optional()
7840
7903
  })
7841
7904
  ).mutation(async ({ input }) => {
7842
7905
  if (!isAllowedProxyPath(input.path)) {
@@ -8545,7 +8608,7 @@ function tailTranscript(opts) {
8545
8608
 
8546
8609
  // ../server/src/services/ai-runners/claude-pty-runner.ts
8547
8610
  async function getAgentManager() {
8548
- const { agentManager: agentManager2 } = await import("./agent-manager-WEFGEFRT.js");
8611
+ const { agentManager: agentManager2 } = await import("./agent-manager-3KSS7BHP.js");
8549
8612
  return agentManager2;
8550
8613
  }
8551
8614
  function buildPtyArgs(params, sessionId, opts) {
@@ -9288,7 +9351,7 @@ async function shutdownCodexAppServer() {
9288
9351
  }
9289
9352
  }
9290
9353
  async function getAgentManager2() {
9291
- const { agentManager: agentManager2 } = await import("./agent-manager-WEFGEFRT.js");
9354
+ const { agentManager: agentManager2 } = await import("./agent-manager-3KSS7BHP.js");
9292
9355
  return agentManager2;
9293
9356
  }
9294
9357
  function parseRuneyaCurlCommand(command) {
@@ -9729,18 +9792,18 @@ ${prompt}`;
9729
9792
 
9730
9793
  // ../server/src/trpc/routers/chat.ts
9731
9794
  var execFileAsync3 = promisify3(execFile4);
9732
- var MessageSchema = z17.object({
9733
- role: z17.enum(["user", "assistant"]),
9734
- content: z17.string().max(1e5)
9795
+ var MessageSchema = z18.object({
9796
+ role: z18.enum(["user", "assistant"]),
9797
+ content: z18.string().max(1e5)
9735
9798
  });
9736
- var ImagePartSchema = z17.object({
9737
- type: z17.literal("image"),
9738
- imageId: z17.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
9739
- url: z17.string().max(500),
9740
- mimeType: z17.string().max(100),
9741
- altText: z17.string().max(500).optional()
9799
+ var ImagePartSchema = z18.object({
9800
+ type: z18.literal("image"),
9801
+ imageId: z18.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
9802
+ url: z18.string().max(500),
9803
+ mimeType: z18.string().max(100),
9804
+ altText: z18.string().max(500).optional()
9742
9805
  });
9743
- var ImagePartsSchema = z17.array(ImagePartSchema).max(5).optional();
9806
+ var ImagePartsSchema = z18.array(ImagePartSchema).max(5).optional();
9744
9807
  var LANGUAGE_INSTRUCTION = "Always respond in the same language the user writes in.";
9745
9808
  async function buildSystemPrompt(apiKey) {
9746
9809
  const allServices = await serviceStore.list();
@@ -10127,24 +10190,24 @@ async function startCodexSession(convId, prompt, opts = {}) {
10127
10190
  });
10128
10191
  return { session, done };
10129
10192
  }
10130
- var MessagePartSchema = z17.discriminatedUnion("type", [
10131
- z17.object({ type: z17.literal("thinking"), text: z17.string().max(1e5) }),
10132
- z17.object({ type: z17.literal("text"), text: z17.string().max(1e5) }),
10133
- z17.object({
10134
- type: z17.literal("tool"),
10193
+ var MessagePartSchema = z18.discriminatedUnion("type", [
10194
+ z18.object({ type: z18.literal("thinking"), text: z18.string().max(1e5) }),
10195
+ z18.object({ type: z18.literal("text"), text: z18.string().max(1e5) }),
10196
+ z18.object({
10197
+ type: z18.literal("tool"),
10135
10198
  id: Id128Schema,
10136
10199
  name: Id128Schema,
10137
- input: z17.record(z17.string(), z17.unknown()).optional(),
10138
- rawInput: z17.string().max(1e4).optional(),
10139
- result: z17.unknown().optional(),
10140
- isError: z17.boolean().optional(),
10141
- pending: z17.boolean()
10200
+ input: z18.record(z18.string(), z18.unknown()).optional(),
10201
+ rawInput: z18.string().max(1e4).optional(),
10202
+ result: z18.unknown().optional(),
10203
+ isError: z18.boolean().optional(),
10204
+ pending: z18.boolean()
10142
10205
  })
10143
10206
  ]);
10144
- var StoredMessageSchema = z17.object({
10145
- role: z17.enum(["user", "assistant"]),
10146
- content: z17.string().max(1e5),
10147
- parts: z17.array(MessagePartSchema).max(200).optional()
10207
+ var StoredMessageSchema = z18.object({
10208
+ role: z18.enum(["user", "assistant"]),
10209
+ content: z18.string().max(1e5),
10210
+ parts: z18.array(MessagePartSchema).max(200).optional()
10148
10211
  });
10149
10212
  async function conversationCwd(conv) {
10150
10213
  return resolveConversationCwd(conv.id);
@@ -10158,7 +10221,7 @@ var chatRouter = router({
10158
10221
  * et sans le même filtre il y reversait toutes les conversations de la
10159
10222
  * machine, une seconde après un chargement pourtant filtré.
10160
10223
  */
10161
- onChanged: protectedProcedure.input(z17.object({
10224
+ onChanged: protectedProcedure.input(z18.object({
10162
10225
  projectId: Id128Schema.optional(),
10163
10226
  orgId: Id128Schema.nullable().optional()
10164
10227
  }).optional()).subscription(async function* ({ input }) {
@@ -10206,7 +10269,7 @@ var chatRouter = router({
10206
10269
  * reachable where they were written, without leaking into every other
10207
10270
  * organization's projects.
10208
10271
  */
10209
- list: protectedProcedure.input(z17.object({
10272
+ list: protectedProcedure.input(z18.object({
10210
10273
  projectId: Id128Schema.optional(),
10211
10274
  orgId: Id128Schema.nullable().optional()
10212
10275
  }).optional()).query(async ({ input }) => {
@@ -10214,24 +10277,24 @@ var chatRouter = router({
10214
10277
  if (!projectId) return conversationStore.list();
10215
10278
  return conversationStore.listForProject({ id: projectId, orgId: input?.orgId });
10216
10279
  }),
10217
- get: protectedProcedure.input(z17.object({ id: Id128Schema })).query(async ({ input }) => {
10280
+ get: protectedProcedure.input(z18.object({ id: Id128Schema })).query(async ({ input }) => {
10218
10281
  const conv = await conversationStore.get(input.id);
10219
10282
  if (!conv) throw new TRPCError12({ code: "NOT_FOUND", message: "Conversation not found" });
10220
10283
  return conv;
10221
10284
  }),
10222
- create: protectedProcedure.input(z17.object({
10285
+ create: protectedProcedure.input(z18.object({
10223
10286
  title: ShortString200Schema.optional(),
10224
- isCli: z17.boolean().optional(),
10225
- runner: z17.enum(["claude-code", "codex"]).optional(),
10287
+ isCli: z18.boolean().optional(),
10288
+ runner: z18.enum(["claude-code", "codex"]).optional(),
10226
10289
  providerId: Id128Schema.optional(),
10227
10290
  scenarioId: Id128Schema.optional(),
10228
- scenarioInput: z17.string().max(1e5).optional(),
10291
+ scenarioInput: z18.string().max(1e5).optional(),
10229
10292
  kanbanBoardId: Id128Schema.optional(),
10230
10293
  kanbanCardId: Id128Schema.optional(),
10231
10294
  // The project the conversation is about: only the caller knows which
10232
10295
  // one it is looking at.
10233
10296
  projectId: Id128Schema.optional(),
10234
- orgId: z17.string().max(128).nullable().optional()
10297
+ orgId: z18.string().max(128).nullable().optional()
10235
10298
  })).mutation(async ({ input }) => {
10236
10299
  let scenario = null;
10237
10300
  if (input.scenarioId) {
@@ -10262,20 +10325,20 @@ var chatRouter = router({
10262
10325
  }
10263
10326
  return conv;
10264
10327
  }),
10265
- update: protectedProcedure.input(z17.object({
10328
+ update: protectedProcedure.input(z18.object({
10266
10329
  id: Id128Schema,
10267
10330
  title: ShortString200Schema.optional(),
10268
- messages: z17.array(StoredMessageSchema).max(500).optional(),
10269
- contextUsage: z17.object({
10270
- inputTokens: z17.number().int().nonnegative(),
10271
- contextWindow: z17.number().int().positive()
10331
+ messages: z18.array(StoredMessageSchema).max(500).optional(),
10332
+ contextUsage: z18.object({
10333
+ inputTokens: z18.number().int().nonnegative(),
10334
+ contextWindow: z18.number().int().positive()
10272
10335
  }).optional()
10273
10336
  })).mutation(async ({ input }) => {
10274
10337
  const conv = await conversationStore.update(input.id, { title: input.title, messages: input.messages, contextUsage: input.contextUsage });
10275
10338
  if (!conv) throw new TRPCError12({ code: "NOT_FOUND", message: "Conversation not found" });
10276
10339
  return conv;
10277
10340
  }),
10278
- delete: protectedProcedure.input(z17.object({ id: Id128Schema })).mutation(async ({ input }) => {
10341
+ delete: protectedProcedure.input(z18.object({ id: Id128Schema })).mutation(async ({ input }) => {
10279
10342
  const existing = await conversationStore.get(input.id);
10280
10343
  if (!existing) throw new TRPCError12({ code: "NOT_FOUND", message: "Conversation not found" });
10281
10344
  for (const agent of agentManager.listAgents()) {
@@ -10297,18 +10360,18 @@ var chatRouter = router({
10297
10360
  (err) => console.error("[chat.delete] Image cleanup error:", err)
10298
10361
  );
10299
10362
  }),
10300
- archive: protectedProcedure.input(z17.object({ id: Id128Schema, archived: z17.boolean() })).mutation(async ({ input }) => {
10363
+ archive: protectedProcedure.input(z18.object({ id: Id128Schema, archived: z18.boolean() })).mutation(async ({ input }) => {
10301
10364
  const conv = await conversationStore.update(input.id, { archived: input.archived });
10302
10365
  if (!conv) throw new TRPCError12({ code: "NOT_FOUND", message: "Conversation not found" });
10303
10366
  return conv;
10304
10367
  })
10305
10368
  }),
10306
- listModels: protectedProcedure.input(z17.object({
10369
+ listModels: protectedProcedure.input(z18.object({
10307
10370
  providerId: Id128Schema.optional(),
10308
10371
  // Le projet dit de quelle organisation lire les fournisseurs ; absent,
10309
10372
  // ce sont ceux du poste.
10310
10373
  projectId: Id128Schema.optional(),
10311
- orgId: z17.string().max(128).nullable().optional()
10374
+ orgId: z18.string().max(128).nullable().optional()
10312
10375
  }).optional()).query(async ({ input }) => {
10313
10376
  const active = await getActiveProvider(
10314
10377
  input?.providerId,
@@ -10321,7 +10384,7 @@ var chatRouter = router({
10321
10384
  return [];
10322
10385
  }
10323
10386
  }),
10324
- checkCliAvailability: protectedProcedure.input(z17.object({ agentId: Id128Schema.optional() }).optional()).query(async ({ input }) => {
10387
+ checkCliAvailability: protectedProcedure.input(z18.object({ agentId: Id128Schema.optional() }).optional()).query(async ({ input }) => {
10325
10388
  if (input?.agentId) {
10326
10389
  try {
10327
10390
  const res = await agentManager.agentQuery(
@@ -10339,12 +10402,12 @@ var chatRouter = router({
10339
10402
  ]);
10340
10403
  return { available: claudeOk, codexAvailable: codexOk };
10341
10404
  }),
10342
- enhanceScenarioPrompt: protectedProcedure.input(z17.object({
10343
- text: z17.string().max(1e4),
10405
+ enhanceScenarioPrompt: protectedProcedure.input(z18.object({
10406
+ text: z18.string().max(1e4),
10344
10407
  providerId: Id128Schema.optional(),
10345
- model: z17.string().max(200).optional(),
10408
+ model: z18.string().max(200).optional(),
10346
10409
  projectId: Id128Schema.optional(),
10347
- orgId: z17.string().max(128).nullable().optional()
10410
+ orgId: z18.string().max(128).nullable().optional()
10348
10411
  })).mutation(async ({ input }) => {
10349
10412
  const active = await getActiveProvider(
10350
10413
  input.providerId,
@@ -10401,22 +10464,22 @@ Return ONLY the improved text, no explanation, no preamble.`;
10401
10464
  }
10402
10465
  }),
10403
10466
  getStreamingStatus: protectedProcedure.query(() => activeSessionRegistry.listActive()),
10404
- stopSession: protectedProcedure.input(z17.object({ conversationId: ConversationIdSchema })).mutation(({ input }) => {
10467
+ stopSession: protectedProcedure.input(z18.object({ conversationId: ConversationIdSchema })).mutation(({ input }) => {
10405
10468
  if (process.env.RUNEYA_DEBUG) console.log("[chat]: stopSession");
10406
10469
  const killed = activeSessionRegistry.kill(input.conversationId);
10407
10470
  if (!killed) throw new TRPCError12({ code: "NOT_FOUND", message: "No active session for this conversation" });
10408
10471
  return { ok: true };
10409
10472
  }),
10410
- streamViaClaudeCode: protectedProcedure.input(z17.object({
10473
+ streamViaClaudeCode: protectedProcedure.input(z18.object({
10411
10474
  conversationId: ConversationIdSchema,
10412
- prompt: z17.string().max(1e5),
10413
- contextNote: z17.string().max(2e5).optional(),
10475
+ prompt: z18.string().max(1e5),
10476
+ contextNote: z18.string().max(2e5).optional(),
10414
10477
  model: ShortString200Schema.optional(),
10415
- effort: z17.enum(["low", "medium", "high"]).optional(),
10416
- reconnect: z17.boolean().optional(),
10478
+ effort: z18.enum(["low", "medium", "high"]).optional(),
10479
+ reconnect: z18.boolean().optional(),
10417
10480
  agentId: Id128Schema.optional(),
10418
- environmentId: z17.string().max(128).optional(),
10419
- imageIds: z17.array(z17.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
10481
+ environmentId: z18.string().max(128).optional(),
10482
+ imageIds: z18.array(z18.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
10420
10483
  imageParts: ImagePartsSchema
10421
10484
  })).subscription(async function* ({ input, ctx, signal }) {
10422
10485
  if (process.env.RUNEYA_DEBUG) console.log("[chat]: Reconnect");
@@ -10527,15 +10590,15 @@ ${imagePaths.map((p) => `Image: ${p}`).join("\n")}` : cliPrompt;
10527
10590
  if (process.env.RUNEYA_DEBUG) console.log("[chat]: drainSession...");
10528
10591
  yield* drainSession(session, signal, false);
10529
10592
  }),
10530
- streamViaCodex: protectedProcedure.input(z17.object({
10593
+ streamViaCodex: protectedProcedure.input(z18.object({
10531
10594
  conversationId: ConversationIdSchema,
10532
- prompt: z17.string().max(1e5),
10533
- contextNote: z17.string().max(2e5).optional(),
10595
+ prompt: z18.string().max(1e5),
10596
+ contextNote: z18.string().max(2e5).optional(),
10534
10597
  model: ShortString200Schema.optional(),
10535
- reconnect: z17.boolean().optional(),
10598
+ reconnect: z18.boolean().optional(),
10536
10599
  agentId: Id128Schema.optional(),
10537
- environmentId: z17.string().max(128).optional(),
10538
- imageIds: z17.array(z17.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
10600
+ environmentId: z18.string().max(128).optional(),
10601
+ imageIds: z18.array(z18.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
10539
10602
  imageParts: ImagePartsSchema
10540
10603
  })).subscription(async function* ({ input, ctx, signal }) {
10541
10604
  const existingSession = activeSessionRegistry.get(input.conversationId);
@@ -10613,13 +10676,13 @@ ${input.prompt}` : input.prompt;
10613
10676
  });
10614
10677
  yield* drainSession(session, signal, false);
10615
10678
  }),
10616
- send: protectedProcedure.input(z17.object({
10679
+ send: protectedProcedure.input(z18.object({
10617
10680
  conversationId: ConversationIdSchema,
10618
- messages: z17.array(MessageSchema).min(0).max(100),
10681
+ messages: z18.array(MessageSchema).min(0).max(100),
10619
10682
  model: ShortString200Schema.optional(),
10620
- contextNote: z17.string().max(2e5).optional(),
10621
- reconnect: z17.boolean().optional(),
10622
- imageIds: z17.array(z17.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
10683
+ contextNote: z18.string().max(2e5).optional(),
10684
+ reconnect: z18.boolean().optional(),
10685
+ imageIds: z18.array(z18.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
10623
10686
  imageParts: ImagePartsSchema
10624
10687
  })).subscription(async function* ({ input, ctx, signal }) {
10625
10688
  const existingSession = activeSessionRegistry.get(input.conversationId);
@@ -10737,25 +10800,25 @@ ${input.prompt}` : input.prompt;
10737
10800
  // ── PTY passthrough (interactive Claude Code session) ────────────────────
10738
10801
  pty: router({
10739
10802
  /** Start a PTY session running `claude --resume <sessionId>` (or fresh). */
10740
- start: protectedProcedure.input(z17.object({
10741
- agentId: z17.string().max(128).optional(),
10742
- sessionId: z17.string().max(128).optional(),
10743
- runner: z17.enum(["claude-code", "codex"]).default("claude-code"),
10744
- resume: z17.boolean().default(false),
10745
- model: z17.string().max(128).optional(),
10746
- cwd: z17.string().max(4096).optional(),
10803
+ start: protectedProcedure.input(z18.object({
10804
+ agentId: z18.string().max(128).optional(),
10805
+ sessionId: z18.string().max(128).optional(),
10806
+ runner: z18.enum(["claude-code", "codex"]).default("claude-code"),
10807
+ resume: z18.boolean().default(false),
10808
+ model: z18.string().max(128).optional(),
10809
+ cwd: z18.string().max(4096).optional(),
10747
10810
  /** Anchors the session when no explicit cwd is given. */
10748
- serviceId: z17.string().max(128).optional(),
10811
+ serviceId: z18.string().max(128).optional(),
10749
10812
  projectId: Id128Schema.optional(),
10750
- orgId: z17.string().max(128).nullable().optional(),
10751
- cols: z17.number().int().min(1).max(1e3).default(120),
10752
- rows: z17.number().int().min(1).max(1e3).default(30),
10753
- enableMcp: z17.boolean().default(false),
10754
- apiBaseUrl: z17.string().max(512).optional(),
10755
- environmentId: z17.string().max(128).optional(),
10756
- attachedContexts: z17.array(z17.object({
10757
- label: z17.string().max(200),
10758
- text: z17.string().max(1e6)
10813
+ orgId: z18.string().max(128).nullable().optional(),
10814
+ cols: z18.number().int().min(1).max(1e3).default(120),
10815
+ rows: z18.number().int().min(1).max(1e3).default(30),
10816
+ enableMcp: z18.boolean().default(false),
10817
+ apiBaseUrl: z18.string().max(512).optional(),
10818
+ environmentId: z18.string().max(128).optional(),
10819
+ attachedContexts: z18.array(z18.object({
10820
+ label: z18.string().max(200),
10821
+ text: z18.string().max(1e6)
10759
10822
  })).max(20).optional()
10760
10823
  })).mutation(async ({ input, ctx }) => {
10761
10824
  const t0 = Date.now();
@@ -10914,10 +10977,10 @@ Context:
10914
10977
  return { spawnId: res.spawnId, agentId, reattached: false };
10915
10978
  }),
10916
10979
  /** Subscribe to PTY output stream (raw text with ANSI). */
10917
- stream: protectedProcedure.input(z17.object({
10918
- agentId: z17.string().max(128).optional(),
10919
- spawnId: z17.string().max(128),
10920
- fromOffset: z17.number().int().min(0).default(0)
10980
+ stream: protectedProcedure.input(z18.object({
10981
+ agentId: z18.string().max(128).optional(),
10982
+ spawnId: z18.string().max(128),
10983
+ fromOffset: z18.number().int().min(0).default(0)
10921
10984
  })).subscription(async function* ({ input, signal }) {
10922
10985
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
10923
10986
  if (!agentId) throw new TRPCError12({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -10969,10 +11032,10 @@ Context:
10969
11032
  }
10970
11033
  }),
10971
11034
  /** Write input to a PTY session (keystrokes from xterm). */
10972
- write: protectedProcedure.input(z17.object({
10973
- agentId: z17.string().max(128).optional(),
10974
- spawnId: z17.string().max(128),
10975
- data: z17.string().max(1e6)
11035
+ write: protectedProcedure.input(z18.object({
11036
+ agentId: z18.string().max(128).optional(),
11037
+ spawnId: z18.string().max(128),
11038
+ data: z18.string().max(1e6)
10976
11039
  })).mutation(async ({ input }) => {
10977
11040
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
10978
11041
  if (!agentId) throw new TRPCError12({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -10982,11 +11045,11 @@ Context:
10982
11045
  });
10983
11046
  }),
10984
11047
  /** Resize a PTY session. */
10985
- resize: protectedProcedure.input(z17.object({
10986
- agentId: z17.string().max(128).optional(),
10987
- spawnId: z17.string().max(128),
10988
- cols: z17.number().int().min(1).max(1e3),
10989
- rows: z17.number().int().min(1).max(1e3)
11048
+ resize: protectedProcedure.input(z18.object({
11049
+ agentId: z18.string().max(128).optional(),
11050
+ spawnId: z18.string().max(128),
11051
+ cols: z18.number().int().min(1).max(1e3),
11052
+ rows: z18.number().int().min(1).max(1e3)
10990
11053
  })).mutation(async ({ input }) => {
10991
11054
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
10992
11055
  if (!agentId) throw new TRPCError12({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -11002,11 +11065,11 @@ Context:
11002
11065
  * picks it up. Returns the tmp path and which clipboard method succeeded
11003
11066
  * (null if none — caller should inject `@<path>` instead of Ctrl+V).
11004
11067
  */
11005
- pasteImage: protectedProcedure.input(z17.object({
11006
- agentId: z17.string().max(128).optional(),
11007
- sessionId: z17.string().max(128).optional(),
11008
- mimeType: z17.string().max(64),
11009
- base64: z17.string().max(15e6)
11068
+ pasteImage: protectedProcedure.input(z18.object({
11069
+ agentId: z18.string().max(128).optional(),
11070
+ sessionId: z18.string().max(128).optional(),
11071
+ mimeType: z18.string().max(64),
11072
+ base64: z18.string().max(15e6)
11010
11073
  })).mutation(async ({ input }) => {
11011
11074
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
11012
11075
  if (!agentId) throw new TRPCError12({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -11024,7 +11087,7 @@ Context:
11024
11087
  * Read the transcript Claude Code stores on disk for a given session.
11025
11088
  * Returns parsed JSONL entries (user / assistant messages, tool uses, etc.).
11026
11089
  */
11027
- transcript: protectedProcedure.input(z17.object({ sessionId: z17.string().max(128) })).query(async ({ input }) => {
11090
+ transcript: protectedProcedure.input(z18.object({ sessionId: z18.string().max(128) })).query(async ({ input }) => {
11028
11091
  return readClaudeTranscript(input.sessionId);
11029
11092
  }),
11030
11093
  /**
@@ -11032,9 +11095,9 @@ Context:
11032
11095
  * when was the transcript JSONL last touched? Used by the non-PTY view
11033
11096
  * to show a "Claude is thinking…" indicator while output streams.
11034
11097
  */
11035
- activity: protectedProcedure.input(z17.object({
11036
- agentId: z17.string().max(128).optional(),
11037
- sessionId: z17.string().max(128)
11098
+ activity: protectedProcedure.input(z18.object({
11099
+ agentId: z18.string().max(128).optional(),
11100
+ sessionId: z18.string().max(128)
11038
11101
  })).query(async ({ input }) => {
11039
11102
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
11040
11103
  let running = false;
@@ -11060,7 +11123,7 @@ Context:
11060
11123
  * them on the conversation, so the non-PTY chat view stays in sync.
11061
11124
  * Uses the conversation id as session id (PTY sessions are spawned that way).
11062
11125
  */
11063
- syncTranscript: protectedProcedure.input(z17.object({ conversationId: ConversationIdSchema })).mutation(async ({ input }) => {
11126
+ syncTranscript: protectedProcedure.input(z18.object({ conversationId: ConversationIdSchema })).mutation(async ({ input }) => {
11064
11127
  const conv = await conversationStore.get(input.conversationId);
11065
11128
  if (!conv) {
11066
11129
  throw new TRPCError12({ code: "NOT_FOUND", message: `Conversation ${input.conversationId} not found` });
@@ -11074,14 +11137,14 @@ Context:
11074
11137
  * with the given sessionId. Used to benchmark the PTY → tRPC → xterm.js
11075
11138
  * pipeline. Open the conversation in PTY mode to attach to it.
11076
11139
  */
11077
- debugStress: protectedProcedure.input(z17.object({
11078
- sessionId: z17.string().max(128),
11079
- agentId: z17.string().max(128).optional(),
11080
- bytesPerSec: z17.number().int().min(100).max(1e7).default(5e4),
11081
- chunkSize: z17.number().int().min(1).max(65536).default(256),
11082
- durationMs: z17.number().int().min(0).max(36e5).default(0),
11083
- cols: z17.number().int().min(1).max(1e3).default(120),
11084
- rows: z17.number().int().min(1).max(1e3).default(30)
11140
+ debugStress: protectedProcedure.input(z18.object({
11141
+ sessionId: z18.string().max(128),
11142
+ agentId: z18.string().max(128).optional(),
11143
+ bytesPerSec: z18.number().int().min(100).max(1e7).default(5e4),
11144
+ chunkSize: z18.number().int().min(1).max(65536).default(256),
11145
+ durationMs: z18.number().int().min(0).max(36e5).default(0),
11146
+ cols: z18.number().int().min(1).max(1e3).default(120),
11147
+ rows: z18.number().int().min(1).max(1e3).default(30)
11085
11148
  })).mutation(async ({ input }) => {
11086
11149
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
11087
11150
  if (!agentId) throw new TRPCError12({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -11128,9 +11191,9 @@ Context:
11128
11191
  return { spawnId: res.spawnId, agentId, stressSessionId };
11129
11192
  }),
11130
11193
  /** Kill a PTY session. */
11131
- kill: protectedProcedure.input(z17.object({
11132
- agentId: z17.string().max(128).optional(),
11133
- spawnId: z17.string().max(128)
11194
+ kill: protectedProcedure.input(z18.object({
11195
+ agentId: z18.string().max(128).optional(),
11196
+ spawnId: z18.string().max(128)
11134
11197
  })).mutation(async ({ input }) => {
11135
11198
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
11136
11199
  if (!agentId) throw new TRPCError12({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -11142,16 +11205,16 @@ Context:
11142
11205
  });
11143
11206
 
11144
11207
  // ../server/src/trpc/routers/git.ts
11145
- import { z as z18 } from "zod";
11208
+ import { z as z19 } from "zod";
11146
11209
  import { TRPCError as TRPCError13 } from "@trpc/server";
11147
11210
  import Anthropic3 from "@anthropic-ai/sdk";
11148
11211
  import OpenAI3 from "openai";
11149
- var SERVICE_ID_SCHEMA = z18.string().max(128);
11150
- var SAFE_PATH_SCHEMA = z18.string().min(1).max(4096).refine((p) => !p.startsWith("/") && !p.includes("../"), {
11212
+ var SERVICE_ID_SCHEMA = z19.string().max(128);
11213
+ var SAFE_PATH_SCHEMA = z19.string().min(1).max(4096).refine((p) => !p.startsWith("/") && !p.includes("../"), {
11151
11214
  message: "Path must be relative and not traverse up"
11152
11215
  });
11153
- var REMOTE_SCHEMA = z18.string().min(1).max(128).regex(/^[a-zA-Z0-9_\-.]+$/);
11154
- var BRANCH_SCHEMA = z18.string().min(1).max(256).regex(/^[a-zA-Z0-9._\-/]+$/);
11216
+ var REMOTE_SCHEMA = z19.string().min(1).max(128).regex(/^[a-zA-Z0-9_\-.]+$/);
11217
+ var BRANCH_SCHEMA = z19.string().min(1).max(256).regex(/^[a-zA-Z0-9._\-/]+$/);
11155
11218
  async function resolveServiceContext(serviceId) {
11156
11219
  const service = await serviceStore.get(serviceId);
11157
11220
  if (!service) {
@@ -11165,11 +11228,11 @@ async function resolveServiceContext(serviceId) {
11165
11228
  }
11166
11229
  var gitTargetShape = {
11167
11230
  serviceId: SERVICE_ID_SCHEMA.optional(),
11168
- agentId: z18.string().max(128).optional(),
11231
+ agentId: z19.string().max(128).optional(),
11169
11232
  /** Anchors on a project when no service is targeted (e.g. from the AI chat). */
11170
- projectId: z18.string().max(128).optional(),
11233
+ projectId: z19.string().max(128).optional(),
11171
11234
  /** Son organisation : un id de projet seul peut en nommer un par organisation. */
11172
- orgId: z18.string().max(128).nullable().optional()
11235
+ orgId: z19.string().max(128).nullable().optional()
11173
11236
  };
11174
11237
  async function resolveGitContext(input) {
11175
11238
  if (input.serviceId) return resolveServiceContext(input.serviceId);
@@ -11182,82 +11245,82 @@ async function resolveGitContext(input) {
11182
11245
  }
11183
11246
  var gitRouter = router({
11184
11247
  /** Get full git status */
11185
- status: protectedProcedure.input(z18.object({ ...gitTargetShape })).query(async ({ input }) => {
11248
+ status: protectedProcedure.input(z19.object({ ...gitTargetShape })).query(async ({ input }) => {
11186
11249
  const { agentId, cwd } = await resolveGitContext(input);
11187
11250
  return agentManager.agentQuery(agentId, "git.status", { cwd });
11188
11251
  }),
11189
11252
  /** Get commit log */
11190
- log: protectedProcedure.input(z18.object({ ...gitTargetShape, limit: z18.number().int().min(1).max(200).default(50) })).query(async ({ input }) => {
11253
+ log: protectedProcedure.input(z19.object({ ...gitTargetShape, limit: z19.number().int().min(1).max(200).default(50) })).query(async ({ input }) => {
11191
11254
  const { agentId, cwd } = await resolveGitContext(input);
11192
11255
  return agentManager.agentQuery(agentId, "git.log", { cwd, limit: input.limit });
11193
11256
  }),
11194
11257
  /** List local and remote branches */
11195
- branches: protectedProcedure.input(z18.object({ ...gitTargetShape })).query(async ({ input }) => {
11258
+ branches: protectedProcedure.input(z19.object({ ...gitTargetShape })).query(async ({ input }) => {
11196
11259
  const { agentId, cwd } = await resolveGitContext(input);
11197
11260
  return agentManager.agentQuery(agentId, "git.branches", { cwd });
11198
11261
  }),
11199
11262
  /** Checkout a branch */
11200
- checkout: protectedProcedure.input(z18.object({ ...gitTargetShape, branch: BRANCH_SCHEMA, create: z18.boolean().default(false) })).mutation(async ({ input }) => {
11263
+ checkout: protectedProcedure.input(z19.object({ ...gitTargetShape, branch: BRANCH_SCHEMA, create: z19.boolean().default(false) })).mutation(async ({ input }) => {
11201
11264
  const { agentId, cwd } = await resolveGitContext(input);
11202
11265
  return agentManager.agentMutation(agentId, "git.checkout", { cwd, branch: input.branch, create: input.create });
11203
11266
  }),
11204
11267
  /** Stage files */
11205
- stage: protectedProcedure.input(z18.object({ ...gitTargetShape, paths: z18.array(SAFE_PATH_SCHEMA).min(1).max(500) })).mutation(async ({ input }) => {
11268
+ stage: protectedProcedure.input(z19.object({ ...gitTargetShape, paths: z19.array(SAFE_PATH_SCHEMA).min(1).max(500) })).mutation(async ({ input }) => {
11206
11269
  const { agentId, cwd } = await resolveGitContext(input);
11207
11270
  return agentManager.agentMutation(agentId, "git.stage", { cwd, paths: input.paths });
11208
11271
  }),
11209
11272
  /** Stage all files */
11210
- stageAll: protectedProcedure.input(z18.object({ ...gitTargetShape })).mutation(async ({ input }) => {
11273
+ stageAll: protectedProcedure.input(z19.object({ ...gitTargetShape })).mutation(async ({ input }) => {
11211
11274
  const { agentId, cwd } = await resolveGitContext(input);
11212
11275
  return agentManager.agentMutation(agentId, "git.stageAll", { cwd });
11213
11276
  }),
11214
11277
  /** Unstage files */
11215
- unstage: protectedProcedure.input(z18.object({ ...gitTargetShape, paths: z18.array(SAFE_PATH_SCHEMA).min(1).max(500) })).mutation(async ({ input }) => {
11278
+ unstage: protectedProcedure.input(z19.object({ ...gitTargetShape, paths: z19.array(SAFE_PATH_SCHEMA).min(1).max(500) })).mutation(async ({ input }) => {
11216
11279
  const { agentId, cwd } = await resolveGitContext(input);
11217
11280
  return agentManager.agentMutation(agentId, "git.unstage", { cwd, paths: input.paths });
11218
11281
  }),
11219
11282
  /** Unstage all files */
11220
- unstageAll: protectedProcedure.input(z18.object({ ...gitTargetShape })).mutation(async ({ input }) => {
11283
+ unstageAll: protectedProcedure.input(z19.object({ ...gitTargetShape })).mutation(async ({ input }) => {
11221
11284
  const { agentId, cwd } = await resolveGitContext(input);
11222
11285
  return agentManager.agentMutation(agentId, "git.unstageAll", { cwd });
11223
11286
  }),
11224
11287
  /** Commit staged changes */
11225
- commit: protectedProcedure.input(z18.object({ ...gitTargetShape, message: z18.string().min(1).max(4096) })).mutation(async ({ input }) => {
11288
+ commit: protectedProcedure.input(z19.object({ ...gitTargetShape, message: z19.string().min(1).max(4096) })).mutation(async ({ input }) => {
11226
11289
  const { agentId, cwd } = await resolveGitContext(input);
11227
11290
  return agentManager.agentMutation(agentId, "git.commit", { cwd, message: input.message });
11228
11291
  }),
11229
11292
  /** Push to remote */
11230
- push: protectedProcedure.input(z18.object({ ...gitTargetShape, remote: REMOTE_SCHEMA.default("origin"), setUpstream: z18.boolean().default(false) })).mutation(async ({ input }) => {
11293
+ push: protectedProcedure.input(z19.object({ ...gitTargetShape, remote: REMOTE_SCHEMA.default("origin"), setUpstream: z19.boolean().default(false) })).mutation(async ({ input }) => {
11231
11294
  const { agentId, cwd } = await resolveGitContext(input);
11232
11295
  return agentManager.agentMutation(agentId, "git.push", { cwd, remote: input.remote, setUpstream: input.setUpstream });
11233
11296
  }),
11234
11297
  /** Pull from remote */
11235
- pull: protectedProcedure.input(z18.object({ ...gitTargetShape, remote: REMOTE_SCHEMA.default("origin") })).mutation(async ({ input }) => {
11298
+ pull: protectedProcedure.input(z19.object({ ...gitTargetShape, remote: REMOTE_SCHEMA.default("origin") })).mutation(async ({ input }) => {
11236
11299
  const { agentId, cwd } = await resolveGitContext(input);
11237
11300
  return agentManager.agentMutation(agentId, "git.pull", { cwd, remote: input.remote });
11238
11301
  }),
11239
11302
  /** Fetch from remote */
11240
- fetch: protectedProcedure.input(z18.object({ ...gitTargetShape, remote: REMOTE_SCHEMA.default("origin") })).mutation(async ({ input }) => {
11303
+ fetch: protectedProcedure.input(z19.object({ ...gitTargetShape, remote: REMOTE_SCHEMA.default("origin") })).mutation(async ({ input }) => {
11241
11304
  const { agentId, cwd } = await resolveGitContext(input);
11242
11305
  return agentManager.agentMutation(agentId, "git.fetch", { cwd, remote: input.remote });
11243
11306
  }),
11244
11307
  /** Get diff for a file or the whole index */
11245
- diff: protectedProcedure.input(z18.object({
11308
+ diff: protectedProcedure.input(z19.object({
11246
11309
  ...gitTargetShape,
11247
- path: z18.string().max(4096).optional(),
11248
- staged: z18.boolean().default(false),
11249
- untracked: z18.boolean().default(false)
11310
+ path: z19.string().max(4096).optional(),
11311
+ staged: z19.boolean().default(false),
11312
+ untracked: z19.boolean().default(false)
11250
11313
  })).query(async ({ input }) => {
11251
11314
  const { agentId, cwd } = await resolveGitContext(input);
11252
11315
  return agentManager.agentQuery(agentId, "git.diff", { cwd, path: input.path, staged: input.staged, untracked: input.untracked });
11253
11316
  }),
11254
11317
  /** Discard changes to working tree files */
11255
- discard: protectedProcedure.input(z18.object({ ...gitTargetShape, paths: z18.array(SAFE_PATH_SCHEMA).min(1).max(500) })).mutation(async ({ input }) => {
11318
+ discard: protectedProcedure.input(z19.object({ ...gitTargetShape, paths: z19.array(SAFE_PATH_SCHEMA).min(1).max(500) })).mutation(async ({ input }) => {
11256
11319
  const { agentId, cwd } = await resolveGitContext(input);
11257
11320
  return agentManager.agentMutation(agentId, "git.discard", { cwd, paths: input.paths });
11258
11321
  }),
11259
11322
  /** Generate a commit message from staged diffs using AI (diff fetched from agent, AI runs on server) */
11260
- generateCommitMessage: protectedProcedure.input(z18.object({ ...gitTargetShape, providerId: OptionalProviderIdSchema, model: z18.string().max(200).optional() })).mutation(async ({ input }) => {
11323
+ generateCommitMessage: protectedProcedure.input(z19.object({ ...gitTargetShape, providerId: OptionalProviderIdSchema, model: z19.string().max(200).optional() })).mutation(async ({ input }) => {
11261
11324
  const { agentId, cwd } = await resolveGitContext(input);
11262
11325
  const { diff } = await agentManager.agentQuery(agentId, "git.stagedDiff", { cwd });
11263
11326
  if (!diff.trim()) {
@@ -11304,42 +11367,42 @@ Rules:
11304
11367
  throw new TRPCError13({ code: "BAD_REQUEST", message: "Unsupported AI provider" });
11305
11368
  }),
11306
11369
  /** Merge a branch into the current branch */
11307
- merge: protectedProcedure.input(z18.object({ ...gitTargetShape, branch: BRANCH_SCHEMA, noFf: z18.boolean().default(false) })).mutation(async ({ input }) => {
11370
+ merge: protectedProcedure.input(z19.object({ ...gitTargetShape, branch: BRANCH_SCHEMA, noFf: z19.boolean().default(false) })).mutation(async ({ input }) => {
11308
11371
  const { agentId, cwd } = await resolveGitContext(input);
11309
11372
  return agentManager.agentMutation(agentId, "git.merge", { cwd, branch: input.branch, noFf: input.noFf });
11310
11373
  }),
11311
11374
  /** Rebase current branch onto another branch */
11312
- rebase: protectedProcedure.input(z18.object({ ...gitTargetShape, branch: BRANCH_SCHEMA })).mutation(async ({ input }) => {
11375
+ rebase: protectedProcedure.input(z19.object({ ...gitTargetShape, branch: BRANCH_SCHEMA })).mutation(async ({ input }) => {
11313
11376
  const { agentId, cwd } = await resolveGitContext(input);
11314
11377
  return agentManager.agentMutation(agentId, "git.rebase", { cwd, branch: input.branch });
11315
11378
  }),
11316
11379
  /** List stash entries */
11317
- stashList: protectedProcedure.input(z18.object({ ...gitTargetShape })).query(async ({ input }) => {
11380
+ stashList: protectedProcedure.input(z19.object({ ...gitTargetShape })).query(async ({ input }) => {
11318
11381
  const { agentId, cwd } = await resolveGitContext(input);
11319
11382
  return agentManager.agentQuery(agentId, "git.stashList", { cwd });
11320
11383
  }),
11321
11384
  /** Stash current changes */
11322
- stashPush: protectedProcedure.input(z18.object({ ...gitTargetShape, message: z18.string().max(4096).optional(), includeUntracked: z18.boolean().default(true) })).mutation(async ({ input }) => {
11385
+ stashPush: protectedProcedure.input(z19.object({ ...gitTargetShape, message: z19.string().max(4096).optional(), includeUntracked: z19.boolean().default(true) })).mutation(async ({ input }) => {
11323
11386
  const { agentId, cwd } = await resolveGitContext(input);
11324
11387
  return agentManager.agentMutation(agentId, "git.stashPush", { cwd, message: input.message, includeUntracked: input.includeUntracked });
11325
11388
  }),
11326
11389
  /** Pop a stash entry */
11327
- stashPop: protectedProcedure.input(z18.object({ ...gitTargetShape, index: z18.number().int().min(0).max(1e3).default(0) })).mutation(async ({ input }) => {
11390
+ stashPop: protectedProcedure.input(z19.object({ ...gitTargetShape, index: z19.number().int().min(0).max(1e3).default(0) })).mutation(async ({ input }) => {
11328
11391
  const { agentId, cwd } = await resolveGitContext(input);
11329
11392
  return agentManager.agentMutation(agentId, "git.stashPop", { cwd, index: input.index });
11330
11393
  }),
11331
11394
  /** Apply a stash entry without dropping it */
11332
- stashApply: protectedProcedure.input(z18.object({ ...gitTargetShape, index: z18.number().int().min(0).max(1e3).default(0) })).mutation(async ({ input }) => {
11395
+ stashApply: protectedProcedure.input(z19.object({ ...gitTargetShape, index: z19.number().int().min(0).max(1e3).default(0) })).mutation(async ({ input }) => {
11333
11396
  const { agentId, cwd } = await resolveGitContext(input);
11334
11397
  return agentManager.agentMutation(agentId, "git.stashApply", { cwd, index: input.index });
11335
11398
  }),
11336
11399
  /** Drop a stash entry */
11337
- stashDrop: protectedProcedure.input(z18.object({ ...gitTargetShape, index: z18.number().int().min(0).max(1e3).default(0) })).mutation(async ({ input }) => {
11400
+ stashDrop: protectedProcedure.input(z19.object({ ...gitTargetShape, index: z19.number().int().min(0).max(1e3).default(0) })).mutation(async ({ input }) => {
11338
11401
  const { agentId, cwd } = await resolveGitContext(input);
11339
11402
  return agentManager.agentMutation(agentId, "git.stashDrop", { cwd, index: input.index });
11340
11403
  }),
11341
11404
  /** Watch .git/ for changes and stream updated status */
11342
- onStatusChange: protectedProcedure.input(z18.object({ ...gitTargetShape })).subscription(async function* ({ input }) {
11405
+ onStatusChange: protectedProcedure.input(z19.object({ ...gitTargetShape })).subscription(async function* ({ input }) {
11343
11406
  const { agentId, cwd } = await resolveGitContext(input);
11344
11407
  const queue = [];
11345
11408
  let resolve7 = null;
@@ -11386,7 +11449,7 @@ Rules:
11386
11449
  }
11387
11450
  }),
11388
11451
  /** List remotes */
11389
- remotes: protectedProcedure.input(z18.object({ ...gitTargetShape })).query(async ({ input }) => {
11452
+ remotes: protectedProcedure.input(z19.object({ ...gitTargetShape })).query(async ({ input }) => {
11390
11453
  const { agentId, cwd } = await resolveGitContext(input);
11391
11454
  return agentManager.agentQuery(agentId, "git.remotes", { cwd });
11392
11455
  })
@@ -11395,7 +11458,7 @@ Rules:
11395
11458
  // ../server/src/trpc/routers/scenario.ts
11396
11459
  import { randomUUID as randomUUID8 } from "crypto";
11397
11460
  import { TRPCError as TRPCError16 } from "@trpc/server";
11398
- import { z as z19 } from "zod";
11461
+ import { z as z20 } from "zod";
11399
11462
 
11400
11463
  // ../server/src/trpc/crud-procedure-utils.ts
11401
11464
  import { TRPCError as TRPCError14 } from "@trpc/server";
@@ -12994,28 +13057,28 @@ Modify the scenario. Keep existing ids when possible.`;
12994
13057
  return `Generate an scenario org-chart based on: ${userPrompt}`;
12995
13058
  }
12996
13059
  var ScopeShape2 = {
12997
- orgId: z19.string().max(128).nullable().optional(),
13060
+ orgId: z20.string().max(128).nullable().optional(),
12998
13061
  projectId: Id128Schema.optional()
12999
13062
  };
13000
13063
  async function scopeOf2(input) {
13001
13064
  return input?.orgId ?? await vaultOfProject(input?.projectId);
13002
13065
  }
13003
13066
  var scenarioRouter = router({
13004
- list: protectedProcedure.input(z19.object(ScopeShape2).optional()).query(async ({ input }) => scenarioStore.list(await scopeOf2(input))),
13005
- get: protectedProcedure.input(z19.object({ id: Id128Schema, ...ScopeShape2 })).query(async ({ input }) => getOrNotFound(
13067
+ list: protectedProcedure.input(z20.object(ScopeShape2).optional()).query(async ({ input }) => scenarioStore.list(await scopeOf2(input))),
13068
+ get: protectedProcedure.input(z20.object({ id: Id128Schema, ...ScopeShape2 })).query(async ({ input }) => getOrNotFound(
13006
13069
  async () => scenarioStore.get(input.id, await scopeOf2(input)),
13007
13070
  "Scenario not found"
13008
13071
  )),
13009
- create: protectedProcedure.input(z19.object({
13072
+ create: protectedProcedure.input(z20.object({
13010
13073
  name: NameSchema,
13011
- icon: z19.string().max(64).optional(),
13074
+ icon: z20.string().max(64).optional(),
13012
13075
  description: DescriptionSchema.optional(),
13013
13076
  leaderId: Id128Schema,
13014
- groups: z19.array(ScenarioGroupSchema).max(100).optional(),
13015
- nodes: z19.array(ScenarioNodeSchema).min(1).max(500),
13016
- traversalMode: z19.enum(["hierarchical", "topological"]).optional(),
13017
- presetId: z19.string().max(128).optional(),
13018
- isPublished: z19.boolean().optional(),
13077
+ groups: z20.array(ScenarioGroupSchema).max(100).optional(),
13078
+ nodes: z20.array(ScenarioNodeSchema).min(1).max(500),
13079
+ traversalMode: z20.enum(["hierarchical", "topological"]).optional(),
13080
+ presetId: z20.string().max(128).optional(),
13081
+ isPublished: z20.boolean().optional(),
13019
13082
  ...ScopeShape2
13020
13083
  })).mutation(({ input }) => {
13021
13084
  const now = Date.now();
@@ -13034,17 +13097,17 @@ var scenarioRouter = router({
13034
13097
  updatedAt: now
13035
13098
  }));
13036
13099
  }),
13037
- update: protectedProcedure.input(z19.object({
13100
+ update: protectedProcedure.input(z20.object({
13038
13101
  id: Id128Schema,
13039
13102
  name: NameSchema.optional(),
13040
- icon: z19.string().max(64).optional(),
13103
+ icon: z20.string().max(64).optional(),
13041
13104
  description: DescriptionSchema.optional(),
13042
13105
  leaderId: Id128Schema.optional(),
13043
- groups: z19.array(ScenarioGroupSchema).max(100).optional(),
13044
- nodes: z19.array(ScenarioNodeSchema).min(1).max(500).optional(),
13045
- traversalMode: z19.enum(["hierarchical", "topological"]).optional(),
13046
- presetId: z19.string().max(128).optional(),
13047
- isPublished: z19.boolean().optional(),
13106
+ groups: z20.array(ScenarioGroupSchema).max(100).optional(),
13107
+ nodes: z20.array(ScenarioNodeSchema).min(1).max(500).optional(),
13108
+ traversalMode: z20.enum(["hierarchical", "topological"]).optional(),
13109
+ presetId: z20.string().max(128).optional(),
13110
+ isPublished: z20.boolean().optional(),
13048
13111
  ...ScopeShape2
13049
13112
  })).mutation(({ input }) => updateOrThrow(
13050
13113
  async () => scenarioStore.update(input.id, {
@@ -13061,22 +13124,22 @@ var scenarioRouter = router({
13061
13124
  }, await scopeOf2(input)),
13062
13125
  "Scenario not found"
13063
13126
  )),
13064
- delete: protectedProcedure.input(z19.object({ id: Id128Schema, ...ScopeShape2 })).mutation(({ input }) => deleteOrNotFound(
13127
+ delete: protectedProcedure.input(z20.object({ id: Id128Schema, ...ScopeShape2 })).mutation(({ input }) => deleteOrNotFound(
13065
13128
  async () => scenarioStore.delete(input.id, await scopeOf2(input)),
13066
13129
  "Scenario not found"
13067
13130
  )),
13068
- run: protectedProcedure.input(z19.object({
13131
+ run: protectedProcedure.input(z20.object({
13069
13132
  conversationId: ConversationIdSchema,
13070
13133
  scenarioId: Id128Schema,
13071
- userRequest: z19.string().max(1e5),
13072
- runnerOverride: z19.enum(["claude-code", "codex"]).optional(),
13134
+ userRequest: z20.string().max(1e5),
13135
+ runnerOverride: z20.enum(["claude-code", "codex"]).optional(),
13073
13136
  modelOverride: Id128Schema.optional(),
13074
13137
  agentId: Id128Schema.optional(),
13075
13138
  /** Anchors the run's working directory on the project it belongs to. */
13076
13139
  projectId: Id128Schema.optional(),
13077
13140
  /** Son organisation : sans elle, un id partagé désignerait un projet au hasard. */
13078
- orgId: z19.string().max(128).nullable().optional(),
13079
- resume: z19.boolean().optional()
13141
+ orgId: z20.string().max(128).nullable().optional(),
13142
+ resume: z20.boolean().optional()
13080
13143
  })).subscription(async function* ({ input, signal }) {
13081
13144
  const scenario = await scenarioStore.get(input.scenarioId, await scopeOf2(input));
13082
13145
  if (!scenario) throw new TRPCError16({ code: "NOT_FOUND", message: "Scenario not found" });
@@ -13096,41 +13159,41 @@ var scenarioRouter = router({
13096
13159
  }
13097
13160
  yield* tapBus(input.conversationId, signal ?? new AbortController().signal);
13098
13161
  }),
13099
- stop: protectedProcedure.input(z19.object({ conversationId: ConversationIdSchema })).mutation(({ input }) => {
13162
+ stop: protectedProcedure.input(z20.object({ conversationId: ConversationIdSchema })).mutation(({ input }) => {
13100
13163
  abortScenario(input.conversationId);
13101
13164
  return { ok: true };
13102
13165
  }),
13103
- sendNodeInput: protectedProcedure.input(z19.object({
13166
+ sendNodeInput: protectedProcedure.input(z20.object({
13104
13167
  conversationId: ConversationIdSchema,
13105
13168
  nodeId: Id128Schema,
13106
- text: z19.string().min(1).max(1e5)
13169
+ text: z20.string().min(1).max(1e5)
13107
13170
  })).mutation(({ input }) => {
13108
13171
  const resolved = resolveNodeInput(input.conversationId, input.nodeId, input.text);
13109
13172
  if (!resolved) throw new TRPCError16({ code: "NOT_FOUND", message: "No pending input request for this node" });
13110
13173
  return { ok: true };
13111
13174
  }),
13112
- isRunning: protectedProcedure.input(z19.object({ conversationId: ConversationIdSchema })).query(({ input }) => ({ running: isScenarioRunning(input.conversationId) })),
13113
- runState: protectedProcedure.input(z19.object({ conversationId: ConversationIdSchema })).query(({ input }) => {
13175
+ isRunning: protectedProcedure.input(z20.object({ conversationId: ConversationIdSchema })).query(({ input }) => ({ running: isScenarioRunning(input.conversationId) })),
13176
+ runState: protectedProcedure.input(z20.object({ conversationId: ConversationIdSchema })).query(({ input }) => {
13114
13177
  const runState = scenarioRunStore.getRunState(input.conversationId);
13115
13178
  return runState ?? { nodeStates: {}, nodeOutputs: {}, activeNodeId: void 0 };
13116
13179
  }),
13117
- getPersistedRunState: protectedProcedure.input(z19.object({ conversationId: ConversationIdSchema })).query(async ({ input }) => {
13180
+ getPersistedRunState: protectedProcedure.input(z20.object({ conversationId: ConversationIdSchema })).query(async ({ input }) => {
13118
13181
  return await scenarioRunStore.loadPersistedRunState(input.conversationId);
13119
13182
  }),
13120
- getReadme: protectedProcedure.input(z19.object({ conversationId: ConversationIdSchema })).query(async ({ input }) => {
13183
+ getReadme: protectedProcedure.input(z20.object({ conversationId: ConversationIdSchema })).query(async ({ input }) => {
13121
13184
  return await scenarioRunStore.readReadme(input.conversationId);
13122
13185
  }),
13123
- getSnapshot: protectedProcedure.input(z19.object({ conversationId: ConversationIdSchema })).query(async ({ input }) => {
13186
+ getSnapshot: protectedProcedure.input(z20.object({ conversationId: ConversationIdSchema })).query(async ({ input }) => {
13124
13187
  return await scenarioRunStore.loadScenarioSnapshot(input.conversationId);
13125
13188
  }),
13126
- streamGenerateWithAI: protectedProcedure.input(z19.object({
13127
- prompt: z19.string().min(1).max(1e4),
13189
+ streamGenerateWithAI: protectedProcedure.input(z20.object({
13190
+ prompt: z20.string().min(1).max(1e4),
13128
13191
  providerId: OptionalProviderIdSchema,
13129
- model: z19.string().max(200).optional(),
13130
- current: z19.object({
13192
+ model: z20.string().max(200).optional(),
13193
+ current: z20.object({
13131
13194
  leaderId: Id128Schema,
13132
- groups: z19.array(ScenarioGroupSchema).max(100),
13133
- nodes: z19.array(ScenarioNodeSchema).max(500)
13195
+ groups: z20.array(ScenarioGroupSchema).max(100),
13196
+ nodes: z20.array(ScenarioNodeSchema).max(500)
13134
13197
  }).optional()
13135
13198
  })).subscription(async function* ({ input, signal }) {
13136
13199
  const userMessage = buildScenarioUserMessage(input.prompt, input.current);
@@ -13143,7 +13206,7 @@ var scenarioRouter = router({
13143
13206
  signal: signal ?? void 0
13144
13207
  });
13145
13208
  }),
13146
- streamRunEvents: protectedProcedure.input(z19.object({ conversationId: ConversationIdSchema })).subscription(async function* ({ input }) {
13209
+ streamRunEvents: protectedProcedure.input(z20.object({ conversationId: ConversationIdSchema })).subscription(async function* ({ input }) {
13147
13210
  const convId = input.conversationId;
13148
13211
  const runState = scenarioRunStore.getRunState(convId);
13149
13212
  if (runState) {
@@ -13157,14 +13220,14 @@ var scenarioRouter = router({
13157
13220
  * open a debug PTY with `claude --resume <sessionId>` on the right agent.
13158
13221
  * Falls back to the persisted run-state for past nodes.
13159
13222
  */
13160
- getNodeSession: protectedProcedure.input(z19.object({
13223
+ getNodeSession: protectedProcedure.input(z20.object({
13161
13224
  conversationId: ConversationIdSchema,
13162
13225
  nodeId: Id128Schema
13163
13226
  })).query(async ({ input }) => {
13164
13227
  return await scenarioRunStore.getNodeSessionPersistent(input.conversationId, input.nodeId);
13165
13228
  }),
13166
13229
  listPresets: protectedProcedure.query(() => listPresets()),
13167
- getPreset: protectedProcedure.input(z19.object({ id: Id128Schema })).query(({ input }) => {
13230
+ getPreset: protectedProcedure.input(z20.object({ id: Id128Schema })).query(({ input }) => {
13168
13231
  const preset = getPreset(input.id);
13169
13232
  if (!preset) throw new TRPCError16({ code: "NOT_FOUND", message: "Preset not found" });
13170
13233
  return preset;
@@ -13174,7 +13237,7 @@ var scenarioRouter = router({
13174
13237
  // ../server/src/trpc/routers/debug.ts
13175
13238
  import { randomUUID as randomUUID9 } from "crypto";
13176
13239
  import { TRPCError as TRPCError17 } from "@trpc/server";
13177
- import { z as z20 } from "zod";
13240
+ import { z as z21 } from "zod";
13178
13241
  var MAX_BUFFER3 = 300;
13179
13242
  var jobs = /* @__PURE__ */ new Map();
13180
13243
  function publish(job, event) {
@@ -13231,9 +13294,9 @@ async function* tapJob(job, signal) {
13231
13294
  }
13232
13295
  }
13233
13296
  var debugRouter = router({
13234
- startRandomJob: protectedProcedure.input(z20.object({
13235
- intervalMs: z20.number().int().min(100).max(5e3).optional(),
13236
- maxTicks: z20.number().int().min(1).max(1e4).optional()
13297
+ startRandomJob: protectedProcedure.input(z21.object({
13298
+ intervalMs: z21.number().int().min(100).max(5e3).optional(),
13299
+ maxTicks: z21.number().int().min(1).max(1e4).optional()
13237
13300
  }).optional()).mutation(({ input }) => {
13238
13301
  const jobId = randomUUID9();
13239
13302
  const intervalMs = input?.intervalMs ?? 400;
@@ -13267,15 +13330,15 @@ var debugRouter = router({
13267
13330
  jobs.set(jobId, job);
13268
13331
  return { jobId, intervalMs, maxTicks, startedAt: job.startedAt };
13269
13332
  }),
13270
- streamRandomJob: protectedProcedure.input(z20.object({ jobId: z20.string().max(128) })).subscription(async function* ({ input, signal }) {
13333
+ streamRandomJob: protectedProcedure.input(z21.object({ jobId: z21.string().max(128) })).subscription(async function* ({ input, signal }) {
13271
13334
  const job = jobs.get(input.jobId);
13272
13335
  if (!job) {
13273
13336
  throw new TRPCError17({ code: "NOT_FOUND", message: "Random job not found" });
13274
13337
  }
13275
13338
  yield* tapJob(job, signal ?? new AbortController().signal);
13276
13339
  }),
13277
- stopRandomJob: protectedProcedure.input(z20.object({ jobId: z20.string().max(128) })).mutation(({ input }) => ({ ok: stopJob(input.jobId, "stopped") })),
13278
- randomJobStatus: protectedProcedure.input(z20.object({ jobId: z20.string().max(128) })).query(({ input }) => {
13340
+ stopRandomJob: protectedProcedure.input(z21.object({ jobId: z21.string().max(128) })).mutation(({ input }) => ({ ok: stopJob(input.jobId, "stopped") })),
13341
+ randomJobStatus: protectedProcedure.input(z21.object({ jobId: z21.string().max(128) })).query(({ input }) => {
13279
13342
  const job = jobs.get(input.jobId);
13280
13343
  return {
13281
13344
  running: !!job && !job.done,
@@ -13285,7 +13348,7 @@ var debugRouter = router({
13285
13348
  });
13286
13349
 
13287
13350
  // ../server/src/trpc/routers/diagnostics.ts
13288
- import { z as z21 } from "zod";
13351
+ import { z as z22 } from "zod";
13289
13352
  import { TRPCError as TRPCError18 } from "@trpc/server";
13290
13353
 
13291
13354
  // ../server/src/services/log-buffer.ts
@@ -13357,7 +13420,7 @@ function onEntry(listener) {
13357
13420
  // ../server/src/trpc/routers/diagnostics.ts
13358
13421
  var diagnosticsRouter = router({
13359
13422
  /** Backlog for a client that just opened the panel. */
13360
- recentLogs: protectedProcedure.input(z21.object({ limit: z21.number().int().min(1).max(2e3).default(500) }).optional()).query(({ input }) => recentEntries(input?.limit ?? 500)),
13423
+ recentLogs: protectedProcedure.input(z22.object({ limit: z22.number().int().min(1).max(2e3).default(500) }).optional()).query(({ input }) => recentEntries(input?.limit ?? 500)),
13361
13424
  /**
13362
13425
  * Live log stream.
13363
13426
  *
@@ -13366,7 +13429,7 @@ var diagnosticsRouter = router({
13366
13429
  * silently loses lines, which is precisely what someone watching a boot
13367
13430
  * failure cannot afford.
13368
13431
  */
13369
- streamLogs: protectedProcedure.input(z21.object({ afterSeq: z21.number().int().nonnegative().default(0) }).optional()).subscription(async function* ({ input, signal }) {
13432
+ streamLogs: protectedProcedure.input(z22.object({ afterSeq: z22.number().int().nonnegative().default(0) }).optional()).subscription(async function* ({ input, signal }) {
13370
13433
  for (const entry of entriesSince(input?.afterSeq ?? 0)) yield entry;
13371
13434
  const queue = [];
13372
13435
  let wake = null;
@@ -13400,7 +13463,7 @@ var diagnosticsRouter = router({
13400
13463
  * refused. That is what keeps this from being a way to signal arbitrary
13401
13464
  * processes with the server's privileges.
13402
13465
  */
13403
- killInstance: protectedProcedure.input(z21.object({ pid: z21.number().int().positive() })).mutation(async ({ input }) => {
13466
+ killInstance: protectedProcedure.input(z22.object({ pid: z22.number().int().positive() })).mutation(async ({ input }) => {
13404
13467
  try {
13405
13468
  return await killInstance(input.pid);
13406
13469
  } catch (err) {
@@ -13428,7 +13491,7 @@ var diagnosticsRouter = router({
13428
13491
  * reproductible : instance trop ancienne pour avoir publié sa ligne de
13429
13492
  * commande, ou lancée avec un secret que le registre ne conserve pas.
13430
13493
  */
13431
- restartInstance: protectedProcedure.input(z21.object({ pid: z21.number().int().positive() })).mutation(async ({ input }) => {
13494
+ restartInstance: protectedProcedure.input(z22.object({ pid: z22.number().int().positive() })).mutation(async ({ input }) => {
13432
13495
  try {
13433
13496
  if (input.pid === process.pid) {
13434
13497
  const { relauncherPid, port } = await scheduleSelfRestart();
@@ -13452,7 +13515,7 @@ var diagnosticsRouter = router({
13452
13515
  });
13453
13516
 
13454
13517
  // ../server/src/trpc/routers/kanban-queue.ts
13455
- import { z as z22 } from "zod";
13518
+ import { z as z23 } from "zod";
13456
13519
 
13457
13520
  // ../server/src/services/kanban-queue.ts
13458
13521
  import { randomUUID as randomUUID10 } from "crypto";
@@ -13640,36 +13703,36 @@ var kanbanQueue = new KanbanQueueService();
13640
13703
  // ../server/src/trpc/routers/kanban-queue.ts
13641
13704
  var kanbanQueueRouter = router({
13642
13705
  getState: protectedProcedure.query(() => kanbanQueue.getState()),
13643
- add: protectedProcedure.input(z22.object({
13644
- boardId: z22.string().max(128),
13645
- cardId: z22.string().max(128),
13646
- runner: z22.enum(["claude-code", "codex"]).optional(),
13647
- model: z22.string().max(128).optional(),
13648
- scenarioId: z22.string().max(128).optional(),
13706
+ add: protectedProcedure.input(z23.object({
13707
+ boardId: z23.string().max(128),
13708
+ cardId: z23.string().max(128),
13709
+ runner: z23.enum(["claude-code", "codex"]).optional(),
13710
+ model: z23.string().max(128).optional(),
13711
+ scenarioId: z23.string().max(128).optional(),
13649
13712
  // Le projet ouvert quand la carte a été mise en file : la conversation
13650
13713
  // qui en naîtra lui appartient, plutôt que de rester orpheline et de
13651
13714
  // s'afficher dans tous les projets.
13652
- projectId: z22.string().max(128).optional(),
13653
- orgId: z22.string().max(128).nullable().optional()
13715
+ projectId: z23.string().max(128).optional(),
13716
+ orgId: z23.string().max(128).nullable().optional()
13654
13717
  })).mutation(({ input }) => kanbanQueue.add(input)),
13655
- addColumn: protectedProcedure.input(z22.object({
13656
- boardId: z22.string().max(128),
13657
- columnId: z22.string().max(128),
13658
- runner: z22.enum(["claude-code", "codex"]).optional(),
13659
- model: z22.string().max(128).optional(),
13660
- scenarioId: z22.string().max(128).optional(),
13661
- projectId: z22.string().max(128).optional(),
13662
- orgId: z22.string().max(128).nullable().optional()
13718
+ addColumn: protectedProcedure.input(z23.object({
13719
+ boardId: z23.string().max(128),
13720
+ columnId: z23.string().max(128),
13721
+ runner: z23.enum(["claude-code", "codex"]).optional(),
13722
+ model: z23.string().max(128).optional(),
13723
+ scenarioId: z23.string().max(128).optional(),
13724
+ projectId: z23.string().max(128).optional(),
13725
+ orgId: z23.string().max(128).nullable().optional()
13663
13726
  })).mutation(async ({ input }) => {
13664
13727
  const { boardId, columnId, ...options } = input;
13665
13728
  return kanbanQueue.addColumn(boardId, columnId, options);
13666
13729
  }),
13667
- remove: protectedProcedure.input(z22.object({ itemId: z22.string().max(128) })).mutation(({ input }) => ({ removed: kanbanQueue.remove(input.itemId) })),
13730
+ remove: protectedProcedure.input(z23.object({ itemId: z23.string().max(128) })).mutation(({ input }) => ({ removed: kanbanQueue.remove(input.itemId) })),
13668
13731
  stopAll: protectedProcedure.mutation(() => {
13669
13732
  kanbanQueue.stopAll();
13670
13733
  return { ok: true };
13671
13734
  }),
13672
- setMaxConcurrent: protectedProcedure.input(z22.object({ max: z22.number().int().min(1).max(20) })).mutation(({ input }) => {
13735
+ setMaxConcurrent: protectedProcedure.input(z23.object({ max: z23.number().int().min(1).max(20) })).mutation(({ input }) => {
13673
13736
  kanbanQueue.setMaxConcurrent(input.max);
13674
13737
  return kanbanQueue.getState();
13675
13738
  }),
@@ -13707,7 +13770,7 @@ import { mkdir as mkdir17, readdir as readdir5, rm as rm3, stat as stat5, writeF
13707
13770
  import { createHash } from "crypto";
13708
13771
  import { tmpdir } from "os";
13709
13772
  import { join as join20 } from "path";
13710
- import { z as z23 } from "zod";
13773
+ import { z as z24 } from "zod";
13711
13774
  import { TRPCError as TRPCError19 } from "@trpc/server";
13712
13775
  function summarizeCard(card, boardId, columnTitle) {
13713
13776
  return {
@@ -13795,9 +13858,9 @@ var kanbanRouter = router({
13795
13858
  * card graph, so listing them in full would be megabytes to answer "which
13796
13859
  * boards exist?". Use `getBoard` for the cards of one.
13797
13860
  */
13798
- listBoards: protectedProcedure.input(z23.object({
13799
- includeArchived: z23.boolean().optional(),
13800
- organizationId: z23.string().max(128).optional()
13861
+ listBoards: protectedProcedure.input(z24.object({
13862
+ includeArchived: z24.boolean().optional(),
13863
+ organizationId: z24.string().max(128).optional()
13801
13864
  }).optional()).query(async ({ input }) => {
13802
13865
  const { organizationId, boards } = await kanbanStore.list(
13803
13866
  input?.includeArchived ?? false,
@@ -13823,7 +13886,7 @@ var kanbanRouter = router({
13823
13886
  };
13824
13887
  }),
13825
13888
  /** One board: its columns, and the cards in each. */
13826
- getBoard: protectedProcedure.input(z23.object({ boardId: z23.string().max(128) })).query(async ({ input }) => {
13889
+ getBoard: protectedProcedure.input(z24.object({ boardId: z24.string().max(128) })).query(async ({ input }) => {
13827
13890
  const board = await kanbanStore.get(input.boardId);
13828
13891
  if (!board) return { board: null };
13829
13892
  const { links } = await kanbanStore.cardLinks(input.boardId);
@@ -13862,11 +13925,11 @@ var kanbanRouter = router({
13862
13925
  * organization — or one board when `boardId` is given. Archived boards are
13863
13926
  * left out: they are what the team decided to stop looking at.
13864
13927
  */
13865
- searchCards: protectedProcedure.input(z23.object({
13866
- query: z23.string().min(1).max(256),
13867
- boardId: z23.string().max(128).optional(),
13868
- limit: z23.number().int().min(1).max(100).optional(),
13869
- organizationId: z23.string().max(128).optional()
13928
+ searchCards: protectedProcedure.input(z24.object({
13929
+ query: z24.string().min(1).max(256),
13930
+ boardId: z24.string().max(128).optional(),
13931
+ limit: z24.number().int().min(1).max(100).optional(),
13932
+ organizationId: z24.string().max(128).optional()
13870
13933
  })).query(async ({ input }) => {
13871
13934
  return kanbanStore.searchCards(input);
13872
13935
  }),
@@ -13879,10 +13942,10 @@ var kanbanRouter = router({
13879
13942
  * qu'un `commentCount`, et rien n'en donnait le texte. Cette route est la
13880
13943
  * relecture, pour une seule carte : c'est le journal qui pèse, pas le reste.
13881
13944
  */
13882
- getCardComments: protectedProcedure.input(z23.object({
13883
- boardId: z23.string().max(128),
13884
- cardId: z23.string().max(128),
13885
- limit: z23.number().int().min(1).max(200).optional()
13945
+ getCardComments: protectedProcedure.input(z24.object({
13946
+ boardId: z24.string().max(128),
13947
+ cardId: z24.string().max(128),
13948
+ limit: z24.number().int().min(1).max(200).optional()
13886
13949
  })).query(async ({ input }) => {
13887
13950
  const history = await kanbanStore.cardHistory(input.boardId, input.cardId);
13888
13951
  const comments = history.filter((e) => e.type === "comment");
@@ -13911,18 +13974,18 @@ var kanbanRouter = router({
13911
13974
  * `getBoard` en donne déjà l'essentiel carte par carte ; cette route sert
13912
13975
  * quand c'est l'arbre lui-même qu'on veut, dates et auteurs compris.
13913
13976
  */
13914
- getCardLinks: protectedProcedure.input(z23.object({ boardId: z23.string().max(128) })).query(async ({ input }) => kanbanStore.cardLinks(input.boardId)),
13977
+ getCardLinks: protectedProcedure.input(z24.object({ boardId: z24.string().max(128) })).query(async ({ input }) => kanbanStore.cardLinks(input.boardId)),
13915
13978
  /**
13916
13979
  * Rattacher une carte à une carte parente, ou l'en détacher.
13917
13980
  *
13918
13981
  * Sans `parentCardId`, le lien est retiré. Le parent peut vivre sur un autre
13919
13982
  * tableau : `parentBoardId` le désigne alors, sinon c'est celui de la carte.
13920
13983
  */
13921
- setCardParent: protectedProcedure.input(z23.object({
13922
- boardId: z23.string().max(128),
13923
- cardId: z23.string().max(128),
13924
- parentCardId: z23.string().max(128).optional(),
13925
- parentBoardId: z23.string().max(128).optional()
13984
+ setCardParent: protectedProcedure.input(z24.object({
13985
+ boardId: z24.string().max(128),
13986
+ cardId: z24.string().max(128),
13987
+ parentCardId: z24.string().max(128).optional(),
13988
+ parentBoardId: z24.string().max(128).optional()
13926
13989
  })).mutation(async ({ input }) => {
13927
13990
  const ok = await kanbanStore.setCardParent(
13928
13991
  input.boardId,
@@ -13934,31 +13997,31 @@ var kanbanRouter = router({
13934
13997
  }
13935
13998
  return { ok: true };
13936
13999
  }),
13937
- moveCard: protectedProcedure.input(z23.object({
13938
- boardId: z23.string().max(128),
13939
- cardId: z23.string().max(128),
13940
- targetColumn: z23.string().max(256)
14000
+ moveCard: protectedProcedure.input(z24.object({
14001
+ boardId: z24.string().max(128),
14002
+ cardId: z24.string().max(128),
14003
+ targetColumn: z24.string().max(256)
13941
14004
  })).mutation(async ({ input }) => {
13942
14005
  await executeKanbanCommands(input.boardId, input.cardId, [
13943
14006
  { type: "move_card", columnTitle: input.targetColumn }
13944
14007
  ]);
13945
14008
  return { ok: true };
13946
14009
  }),
13947
- addComment: protectedProcedure.input(z23.object({
13948
- boardId: z23.string().max(128),
13949
- cardId: z23.string().max(128),
13950
- comment: z23.string().max(1e5)
14010
+ addComment: protectedProcedure.input(z24.object({
14011
+ boardId: z24.string().max(128),
14012
+ cardId: z24.string().max(128),
14013
+ comment: z24.string().max(1e5)
13951
14014
  })).mutation(async ({ input }) => {
13952
14015
  await executeKanbanCommands(input.boardId, input.cardId, [
13953
14016
  { type: "add_comment", comment: input.comment }
13954
14017
  ]);
13955
14018
  return { ok: true };
13956
14019
  }),
13957
- addCard: protectedProcedure.input(z23.object({
13958
- boardId: z23.string().max(128),
13959
- column: z23.string().max(256),
13960
- title: z23.string().max(512),
13961
- content: z23.string().max(2e4).optional()
14020
+ addCard: protectedProcedure.input(z24.object({
14021
+ boardId: z24.string().max(128),
14022
+ column: z24.string().max(256),
14023
+ title: z24.string().max(512),
14024
+ content: z24.string().max(2e4).optional()
13962
14025
  })).mutation(async ({ input }) => {
13963
14026
  await executeKanbanBoardCommands(input.boardId, [
13964
14027
  { type: "add_card", columnTitle: input.column, cardTitle: input.title, cardContent: input.content }
@@ -13971,7 +14034,7 @@ var kanbanRouter = router({
13971
14034
  * `getBoard` rapatrie le tableau entier pour n'en regarder qu'une ; et il ne
13972
14035
  * porte pas les cartes rangées. Une carte s'adresse par son identifiant.
13973
14036
  */
13974
- getCard: protectedProcedure.input(z23.object({ boardId: z23.string().max(128), cardId: z23.string().max(128) })).query(async ({ input }) => {
14037
+ getCard: protectedProcedure.input(z24.object({ boardId: z24.string().max(128), cardId: z24.string().max(128) })).query(async ({ input }) => {
13975
14038
  const found = await kanbanStore.card(input.boardId, input.cardId);
13976
14039
  if (!found) throw new Error(`Carte ${input.cardId} introuvable sur le tableau ${input.boardId}.`);
13977
14040
  return { ...summarizeCard(found.card, input.boardId, ""), columnId: found.columnId };
@@ -13985,16 +14048,16 @@ var kanbanRouter = router({
13985
14048
  * Un champ absent n'est pas touché ; `null` l'efface. La distinction compte —
13986
14049
  * changer un titre ne doit pas vider une couleur.
13987
14050
  */
13988
- updateCard: protectedProcedure.input(z23.object({
13989
- boardId: z23.string().max(128),
13990
- cardId: z23.string().max(128),
13991
- title: z23.string().min(1).max(512).optional(),
13992
- content: z23.string().max(1e5).optional(),
13993
- priority: z23.number().int().min(1).max(10).nullable().optional(),
13994
- color: z23.string().max(32).nullable().optional(),
13995
- groups: z23.array(z23.string().min(1).max(60)).max(30).optional(),
13996
- deadline: z23.string().regex(/^\d{4}-\d{2}-\d{2}$/).nullable().optional(),
13997
- assignees: z23.array(z23.string().max(128)).max(50).optional()
14051
+ updateCard: protectedProcedure.input(z24.object({
14052
+ boardId: z24.string().max(128),
14053
+ cardId: z24.string().max(128),
14054
+ title: z24.string().min(1).max(512).optional(),
14055
+ content: z24.string().max(1e5).optional(),
14056
+ priority: z24.number().int().min(1).max(10).nullable().optional(),
14057
+ color: z24.string().max(32).nullable().optional(),
14058
+ groups: z24.array(z24.string().min(1).max(60)).max(30).optional(),
14059
+ deadline: z24.string().regex(/^\d{4}-\d{2}-\d{2}$/).nullable().optional(),
14060
+ assignees: z24.array(z24.string().max(128)).max(50).optional()
13998
14061
  })).mutation(async ({ input }) => {
13999
14062
  const { boardId, cardId, content, ...rest } = input;
14000
14063
  const patch = { ...rest };
@@ -14005,10 +14068,10 @@ var kanbanRouter = router({
14005
14068
  return summarizeCard(card, boardId, "");
14006
14069
  }),
14007
14070
  /** Ranger une carte, ou la reprendre. */
14008
- setCardArchived: protectedProcedure.input(z23.object({
14009
- boardId: z23.string().max(128),
14010
- cardId: z23.string().max(128),
14011
- archived: z23.boolean()
14071
+ setCardArchived: protectedProcedure.input(z24.object({
14072
+ boardId: z24.string().max(128),
14073
+ cardId: z24.string().max(128),
14074
+ archived: z24.boolean()
14012
14075
  })).mutation(async ({ input }) => {
14013
14076
  const ok = await kanbanStore.setCardArchived(input.boardId, input.cardId, input.archived);
14014
14077
  if (!ok) throw new Error(`La carte ${input.cardId} n'a pas pu \xEAtre ${input.archived ? "archiv\xE9e" : "reprise"}.`);
@@ -14020,13 +14083,13 @@ var kanbanRouter = router({
14020
14083
  * Sans cette liste, assigner revient à deviner un identifiant — et l'agent
14021
14084
  * n'a aucun moyen de le trouver.
14022
14085
  */
14023
- listMembers: protectedProcedure.input(z23.object({ organizationId: z23.string().max(128).optional() })).query(async ({ input }) => ({ members: await kanbanStore.members(input.organizationId) })),
14086
+ listMembers: protectedProcedure.input(z24.object({ organizationId: z24.string().max(128).optional() })).query(async ({ input }) => ({ members: await kanbanStore.members(input.organizationId) })),
14024
14087
  /**
14025
14088
  * Fetch one card attachment from the cloud and drop it on this machine, so an
14026
14089
  * agent can open it with its own file tools. The bytes never go through the
14027
14090
  * prompt: the card context lists the attachments, this returns a path.
14028
14091
  */
14029
- downloadAttachment: protectedProcedure.input(z23.object({ attachmentId: z23.string().max(128) })).mutation(async ({ input }) => {
14092
+ downloadAttachment: protectedProcedure.input(z24.object({ attachmentId: z24.string().max(128) })).mutation(async ({ input }) => {
14030
14093
  const id = input.attachmentId;
14031
14094
  if (!ATTACHMENT_ID_REGEX.test(id)) {
14032
14095
  throw new TRPCError19({ code: "BAD_REQUEST", message: "Invalid attachment id" });
@@ -14059,21 +14122,21 @@ var kanbanRouter = router({
14059
14122
  });
14060
14123
 
14061
14124
  // ../server/src/trpc/routers/terminal.ts
14062
- import { z as z24 } from "zod";
14125
+ import { z as z25 } from "zod";
14063
14126
  import { TRPCError as TRPCError20 } from "@trpc/server";
14064
14127
  var terminalRouter = router({
14065
14128
  /** Create a PTY shell session on the target agent */
14066
- create: protectedProcedure.input(z24.object({
14067
- agentId: z24.string().max(128),
14068
- cwd: z24.string().max(512).optional(),
14129
+ create: protectedProcedure.input(z25.object({
14130
+ agentId: z25.string().max(128),
14131
+ cwd: z25.string().max(512).optional(),
14069
14132
  /** Anchors the terminal when no explicit cwd is given. */
14070
- serviceId: z24.string().max(128).optional(),
14071
- projectId: z24.string().max(128).optional(),
14133
+ serviceId: z25.string().max(128).optional(),
14134
+ projectId: z25.string().max(128).optional(),
14072
14135
  /** L'organisation du projet : un id seul peut en nommer un par organisation. */
14073
- orgId: z24.string().max(128).nullable().optional(),
14074
- cols: z24.number().int().min(1).max(512).optional(),
14075
- rows: z24.number().int().min(1).max(256).optional(),
14076
- title: z24.string().max(128).optional()
14136
+ orgId: z25.string().max(128).nullable().optional(),
14137
+ cols: z25.number().int().min(1).max(512).optional(),
14138
+ rows: z25.number().int().min(1).max(256).optional(),
14139
+ title: z25.string().max(128).optional()
14077
14140
  })).mutation(async ({ input }) => {
14078
14141
  const result = await agentManager.agentMutation(
14079
14142
  input.agentId,
@@ -14094,17 +14157,17 @@ var terminalRouter = router({
14094
14157
  return result;
14095
14158
  }),
14096
14159
  /** Les sessions PTY encore vivantes sur l'agent (onglets à retrouver) */
14097
- list: protectedProcedure.input(z24.object({ agentId: z24.string().max(128) })).query(async ({ input }) => {
14160
+ list: protectedProcedure.input(z25.object({ agentId: z25.string().max(128) })).query(async ({ input }) => {
14098
14161
  return agentManager.agentQuery(
14099
14162
  input.agentId,
14100
14163
  "terminal.list"
14101
14164
  );
14102
14165
  }),
14103
14166
  /** Renommer un onglet */
14104
- rename: protectedProcedure.input(z24.object({
14105
- agentId: z24.string().max(128),
14106
- sessionId: z24.string().max(128),
14107
- title: z24.string().max(128)
14167
+ rename: protectedProcedure.input(z25.object({
14168
+ agentId: z25.string().max(128),
14169
+ sessionId: z25.string().max(128),
14170
+ title: z25.string().max(128)
14108
14171
  })).mutation(async ({ input }) => {
14109
14172
  await agentManager.agentMutation(
14110
14173
  input.agentId,
@@ -14114,10 +14177,10 @@ var terminalRouter = router({
14114
14177
  return { ok: true };
14115
14178
  }),
14116
14179
  /** Send keystrokes / data to a PTY session */
14117
- write: protectedProcedure.input(z24.object({
14118
- agentId: z24.string().max(128),
14119
- sessionId: z24.string().max(128),
14120
- data: z24.string().max(65536)
14180
+ write: protectedProcedure.input(z25.object({
14181
+ agentId: z25.string().max(128),
14182
+ sessionId: z25.string().max(128),
14183
+ data: z25.string().max(65536)
14121
14184
  })).mutation(async ({ input }) => {
14122
14185
  await agentManager.agentMutation(
14123
14186
  input.agentId,
@@ -14127,11 +14190,11 @@ var terminalRouter = router({
14127
14190
  return { ok: true };
14128
14191
  }),
14129
14192
  /** Resize the PTY */
14130
- resize: protectedProcedure.input(z24.object({
14131
- agentId: z24.string().max(128),
14132
- sessionId: z24.string().max(128),
14133
- cols: z24.number().int().min(1).max(512),
14134
- rows: z24.number().int().min(1).max(256)
14193
+ resize: protectedProcedure.input(z25.object({
14194
+ agentId: z25.string().max(128),
14195
+ sessionId: z25.string().max(128),
14196
+ cols: z25.number().int().min(1).max(512),
14197
+ rows: z25.number().int().min(1).max(256)
14135
14198
  })).mutation(async ({ input }) => {
14136
14199
  await agentManager.agentMutation(
14137
14200
  input.agentId,
@@ -14141,9 +14204,9 @@ var terminalRouter = router({
14141
14204
  return { ok: true };
14142
14205
  }),
14143
14206
  /** Destroy a PTY session */
14144
- destroy: protectedProcedure.input(z24.object({
14145
- agentId: z24.string().max(128),
14146
- sessionId: z24.string().max(128)
14207
+ destroy: protectedProcedure.input(z25.object({
14208
+ agentId: z25.string().max(128),
14209
+ sessionId: z25.string().max(128)
14147
14210
  })).mutation(async ({ input }) => {
14148
14211
  await agentManager.agentMutation(
14149
14212
  input.agentId,
@@ -14153,11 +14216,11 @@ var terminalRouter = router({
14153
14216
  return { ok: true };
14154
14217
  }),
14155
14218
  /** Stream PTY output — proxied via AgentWSBridge dynamic subscription */
14156
- onData: protectedProcedure.input(z24.object({
14157
- agentId: z24.string().max(128),
14158
- sessionId: z24.string().max(128),
14219
+ onData: protectedProcedure.input(z25.object({
14220
+ agentId: z25.string().max(128),
14221
+ sessionId: z25.string().max(128),
14159
14222
  /** Rejouer l'historique de la session avant le flux temps réel. */
14160
- replay: z24.boolean().optional()
14223
+ replay: z25.boolean().optional()
14161
14224
  })).subscription(async function* ({ input }) {
14162
14225
  const queue = [];
14163
14226
  let resolve7 = null;
@@ -14206,11 +14269,11 @@ var terminalRouter = router({
14206
14269
  });
14207
14270
 
14208
14271
  // ../server/src/trpc/routers/utility.ts
14209
- import { z as z25 } from "zod";
14272
+ import { z as z26 } from "zod";
14210
14273
  var MAX_WAIT_MS = 5 * 60 * 1e3;
14211
14274
  var utilityRouter = router({
14212
- wait: protectedProcedure.input(z25.object({
14213
- ms: z25.number().int().min(0).max(MAX_WAIT_MS)
14275
+ wait: protectedProcedure.input(z26.object({
14276
+ ms: z26.number().int().min(0).max(MAX_WAIT_MS)
14214
14277
  })).mutation(async ({ input }) => {
14215
14278
  await new Promise((resolve7) => setTimeout(resolve7, input.ms));
14216
14279
  return { waited: input.ms };
@@ -14218,15 +14281,15 @@ var utilityRouter = router({
14218
14281
  });
14219
14282
 
14220
14283
  // ../server/src/trpc/routers/wiki.ts
14221
- import { z as z26 } from "zod";
14284
+ import { z as z27 } from "zod";
14222
14285
  import { TRPCError as TRPCError21 } from "@trpc/server";
14223
14286
  import { readFile as readFile16, readdir as readdir6, stat as stat6, realpath, writeFile as writeFile16, mkdir as mkdir18, rename as rename13, rm as rm4 } from "fs/promises";
14224
14287
  import { resolve as resolvePath, join as join21, relative, sep as sep3, dirname as dirname9 } from "path";
14225
- var SCOPE_SCHEMA = z26.union([
14226
- z26.literal("global"),
14227
- z26.string().regex(/^service:[A-Za-z0-9_-]{1,128}$/, "Invalid service scope")
14288
+ var SCOPE_SCHEMA = z27.union([
14289
+ z27.literal("global"),
14290
+ z27.string().regex(/^service:[A-Za-z0-9_-]{1,128}$/, "Invalid service scope")
14228
14291
  ]);
14229
- var REL_PATH_SCHEMA = z26.string().min(1).max(512).regex(/^[A-Za-z0-9_./-]+$/).refine((p) => !p.includes("..") && !p.startsWith("/"), {
14292
+ var REL_PATH_SCHEMA = z27.string().min(1).max(512).regex(/^[A-Za-z0-9_./-]+$/).refine((p) => !p.includes("..") && !p.startsWith("/"), {
14230
14293
  message: "Path must be a relative path without traversal"
14231
14294
  });
14232
14295
  var MAX_FILES = 500;
@@ -14246,9 +14309,9 @@ var IGNORED_DIRS = /* @__PURE__ */ new Set([
14246
14309
  "target",
14247
14310
  "out"
14248
14311
  ]);
14249
- var DocsEntrySchema = z26.lazy(() => z26.union([
14250
- z26.object({ type: z26.literal("file"), name: z26.string(), path: z26.string() }),
14251
- z26.object({ type: z26.literal("dir"), name: z26.string(), path: z26.string(), children: z26.array(DocsEntrySchema) })
14312
+ var DocsEntrySchema = z27.lazy(() => z27.union([
14313
+ z27.object({ type: z27.literal("file"), name: z27.string(), path: z27.string() }),
14314
+ z27.object({ type: z27.literal("dir"), name: z27.string(), path: z27.string(), children: z27.array(DocsEntrySchema) })
14252
14315
  ]));
14253
14316
  async function resolveScope(scope) {
14254
14317
  if (scope === "global") {
@@ -14338,7 +14401,7 @@ async function resolveSafeLocal(root, relPath, requireExist) {
14338
14401
  return resolvePath(realParent, target.slice(parent.length).replace(/^[\\/]+/, ""));
14339
14402
  }
14340
14403
  var wikiRouter = router({
14341
- list: protectedProcedure.input(z26.object({ scope: SCOPE_SCHEMA })).output(z26.object({ root: z26.string(), entries: z26.array(DocsEntrySchema), truncated: z26.boolean() })).query(async ({ input }) => {
14404
+ list: protectedProcedure.input(z27.object({ scope: SCOPE_SCHEMA })).output(z27.object({ root: z27.string(), entries: z27.array(DocsEntrySchema), truncated: z27.boolean() })).query(async ({ input }) => {
14342
14405
  const target = await resolveScope(input.scope);
14343
14406
  if (target.mode === "agent") {
14344
14407
  return agentManager.agentQuery(target.agentId, "wiki.listRepoMarkdown", { cwd: target.cwd });
@@ -14347,7 +14410,7 @@ var wikiRouter = router({
14347
14410
  const entries2 = await walkLocal(target.root, target.root, 0, counter);
14348
14411
  return { root: target.root, entries: entries2, truncated: counter.n >= MAX_FILES };
14349
14412
  }),
14350
- read: protectedProcedure.input(z26.object({ scope: SCOPE_SCHEMA, path: REL_PATH_SCHEMA })).output(z26.object({ path: z26.string(), content: z26.string() })).query(async ({ input }) => {
14413
+ read: protectedProcedure.input(z27.object({ scope: SCOPE_SCHEMA, path: REL_PATH_SCHEMA })).output(z27.object({ path: z27.string(), content: z27.string() })).query(async ({ input }) => {
14351
14414
  if (!/\.(md|markdown)$/i.test(input.path)) {
14352
14415
  throw new TRPCError21({ code: "BAD_REQUEST", message: "Seuls les .md/.markdown sont autoris\xE9s" });
14353
14416
  }
@@ -14362,7 +14425,7 @@ var wikiRouter = router({
14362
14425
  const content = await readFile16(file, "utf-8");
14363
14426
  return { path: input.path, content };
14364
14427
  }),
14365
- write: protectedProcedure.input(z26.object({ scope: SCOPE_SCHEMA, path: REL_PATH_SCHEMA, content: z26.string().max(5e6) })).mutation(async ({ input }) => {
14428
+ write: protectedProcedure.input(z27.object({ scope: SCOPE_SCHEMA, path: REL_PATH_SCHEMA, content: z27.string().max(5e6) })).mutation(async ({ input }) => {
14366
14429
  if (!/\.(md|markdown)$/i.test(input.path)) {
14367
14430
  throw new TRPCError21({ code: "BAD_REQUEST", message: "Seuls les .md/.markdown sont autoris\xE9s" });
14368
14431
  }
@@ -14375,7 +14438,7 @@ var wikiRouter = router({
14375
14438
  await writeFile16(file, input.content, "utf-8");
14376
14439
  return { path: input.path, ok: true };
14377
14440
  }),
14378
- createFile: protectedProcedure.input(z26.object({ scope: SCOPE_SCHEMA, path: REL_PATH_SCHEMA })).mutation(async ({ input }) => {
14441
+ createFile: protectedProcedure.input(z27.object({ scope: SCOPE_SCHEMA, path: REL_PATH_SCHEMA })).mutation(async ({ input }) => {
14379
14442
  if (!/\.(md|markdown)$/i.test(input.path)) {
14380
14443
  throw new TRPCError21({ code: "BAD_REQUEST", message: "Seuls les .md/.markdown sont autoris\xE9s" });
14381
14444
  }
@@ -14394,7 +14457,7 @@ var wikiRouter = router({
14394
14457
  await writeFile16(file, "", "utf-8");
14395
14458
  return { path: input.path, ok: true };
14396
14459
  }),
14397
- createDir: protectedProcedure.input(z26.object({ scope: SCOPE_SCHEMA, path: REL_PATH_SCHEMA })).mutation(async ({ input }) => {
14460
+ createDir: protectedProcedure.input(z27.object({ scope: SCOPE_SCHEMA, path: REL_PATH_SCHEMA })).mutation(async ({ input }) => {
14398
14461
  const target = await resolveScope(input.scope);
14399
14462
  if (target.mode === "agent") {
14400
14463
  return agentManager.agentMutation(target.agentId, "wiki.createDir", { cwd: target.cwd, path: input.path });
@@ -14403,7 +14466,7 @@ var wikiRouter = router({
14403
14466
  await mkdir18(dir, { recursive: true });
14404
14467
  return { path: input.path, ok: true };
14405
14468
  }),
14406
- rename: protectedProcedure.input(z26.object({ scope: SCOPE_SCHEMA, fromPath: REL_PATH_SCHEMA, toPath: REL_PATH_SCHEMA })).mutation(async ({ input }) => {
14469
+ rename: protectedProcedure.input(z27.object({ scope: SCOPE_SCHEMA, fromPath: REL_PATH_SCHEMA, toPath: REL_PATH_SCHEMA })).mutation(async ({ input }) => {
14407
14470
  const target = await resolveScope(input.scope);
14408
14471
  if (target.mode === "agent") {
14409
14472
  return agentManager.agentMutation(target.agentId, "wiki.renamePath", { cwd: target.cwd, fromPath: input.fromPath, toPath: input.toPath });
@@ -14420,7 +14483,7 @@ var wikiRouter = router({
14420
14483
  await rename13(from, to);
14421
14484
  return { fromPath: input.fromPath, toPath: input.toPath, ok: true };
14422
14485
  }),
14423
- ensureRoot: protectedProcedure.input(z26.object({ scope: SCOPE_SCHEMA })).mutation(async ({ input }) => {
14486
+ ensureRoot: protectedProcedure.input(z27.object({ scope: SCOPE_SCHEMA })).mutation(async ({ input }) => {
14424
14487
  if (input.scope === "global") {
14425
14488
  await resolveScope("global");
14426
14489
  return { ok: true };
@@ -14433,7 +14496,7 @@ var wikiRouter = router({
14433
14496
  const cwd = await resolveWorkspaceCwd({ serviceId, override: service.docsPath?.trim() || void 0 });
14434
14497
  return agentManager.agentMutation(agentId, "wiki.ensureRoot", { cwd });
14435
14498
  }),
14436
- delete: protectedProcedure.input(z26.object({ scope: SCOPE_SCHEMA, path: REL_PATH_SCHEMA })).mutation(async ({ input }) => {
14499
+ delete: protectedProcedure.input(z27.object({ scope: SCOPE_SCHEMA, path: REL_PATH_SCHEMA })).mutation(async ({ input }) => {
14437
14500
  const target = await resolveScope(input.scope);
14438
14501
  if (target.mode === "agent") {
14439
14502
  return agentManager.agentMutation(target.agentId, "wiki.deletePath", { cwd: target.cwd, path: input.path });
@@ -14459,7 +14522,7 @@ var configRouter = router({
14459
14522
  });
14460
14523
 
14461
14524
  // ../server/src/trpc/routers/cloud-sync.ts
14462
- import { z as z27 } from "zod";
14525
+ import { z as z28 } from "zod";
14463
14526
  import { TRPCError as TRPCError22 } from "@trpc/server";
14464
14527
 
14465
14528
  // ../server/src/services/org-sync-scope.ts
@@ -15626,10 +15689,10 @@ var cloudSyncRouter = router({
15626
15689
  * "open this project" is the whole gesture.
15627
15690
  */
15628
15691
  trackProject: protectedProcedure.input(
15629
- z27.object({
15630
- orgId: z27.string().min(1).max(128),
15631
- cloudUrl: z27.string().url().max(2048),
15632
- projectId: z27.string().min(1).max(128)
15692
+ z28.object({
15693
+ orgId: z28.string().min(1).max(128),
15694
+ cloudUrl: z28.string().url().max(2048),
15695
+ projectId: z28.string().min(1).max(128)
15633
15696
  })
15634
15697
  ).mutation(async ({ input }) => {
15635
15698
  await assertOrgReadable(input.orgId);
@@ -15663,10 +15726,10 @@ var cloudSyncRouter = router({
15663
15726
  * fusionné.
15664
15727
  */
15665
15728
  publishProject: protectedProcedure.input(
15666
- z27.object({
15667
- orgId: z27.string().min(1).max(128),
15668
- cloudUrl: z27.string().url().max(2048),
15669
- projectId: z27.string().min(1).max(128)
15729
+ z28.object({
15730
+ orgId: z28.string().min(1).max(128),
15731
+ cloudUrl: z28.string().url().max(2048),
15732
+ projectId: z28.string().min(1).max(128)
15670
15733
  })
15671
15734
  ).mutation(async ({ input }) => {
15672
15735
  const local = await projectStore.get({ id: input.projectId, orgId: null });
@@ -15707,9 +15770,9 @@ var cloudSyncRouter = router({
15707
15770
  * publié. Le cloud, lui, ne peut pas répondre — il n'a que du chiffré sous
15708
15771
  * les yeux — donc le canari est rapatrié et jugé ici.
15709
15772
  */
15710
- checkOrgKey: protectedProcedure.input(z27.object({
15711
- orgId: z27.string().min(1).max(128),
15712
- keyHex: z27.string().length(64).regex(/^[0-9a-f]+$/i)
15773
+ checkOrgKey: protectedProcedure.input(z28.object({
15774
+ orgId: z28.string().min(1).max(128),
15775
+ keyHex: z28.string().length(64).regex(/^[0-9a-f]+$/i)
15713
15776
  })).query(async ({ input }) => {
15714
15777
  const res = await cloudFetch2(
15715
15778
  `/api/auth/organization/canary?organizationId=${encodeURIComponent(input.orgId)}`,
@@ -15731,7 +15794,7 @@ var cloudSyncRouter = router({
15731
15794
  * que l'interface puisse proposer ni l'adoption ni la remise à zéro — le seul
15732
15795
  * chemin qui la répare. Rien n'est écrit ici, ni sur le disque ni sur le cloud.
15733
15796
  */
15734
- orgKeyStatus: protectedProcedure.input(z27.object({ orgId: z27.string().min(1).max(128) })).query(async ({ input }) => {
15797
+ orgKeyStatus: protectedProcedure.input(z28.object({ orgId: z28.string().min(1).max(128) })).query(async ({ input }) => {
15735
15798
  const key = getEncryptionKey(input.orgId);
15736
15799
  if (!key) return { status: "unknown" };
15737
15800
  const res = await cloudFetch2(
@@ -15753,10 +15816,10 @@ var cloudSyncRouter = router({
15753
15816
  * Bornée au coffre de l'organisation et à ceux de ses projets : les autres
15754
15817
  * organisations et la machine gardent leur clé.
15755
15818
  */
15756
- adoptOrgKey: protectedProcedure.input(z27.object({
15757
- orgId: z27.string().min(1).max(128),
15758
- keyHex: z27.string().length(64).regex(/^[0-9a-f]+$/i),
15759
- masterPassword: z27.string().min(1).max(1024)
15819
+ adoptOrgKey: protectedProcedure.input(z28.object({
15820
+ orgId: z28.string().min(1).max(128),
15821
+ keyHex: z28.string().length(64).regex(/^[0-9a-f]+$/i),
15822
+ masterPassword: z28.string().min(1).max(1024)
15760
15823
  })).mutation(async ({ input }) => {
15761
15824
  const report = await adoptOrgKey(
15762
15825
  input.orgId,
@@ -15780,7 +15843,7 @@ var cloudSyncRouter = router({
15780
15843
  * Elle ne re-chiffre rien : ce qui a déjà été synchronisé sous l'ancienne clé
15781
15844
  * reste illisible. L'interface le dit avant de la déclencher.
15782
15845
  */
15783
- resetOrgKey: protectedProcedure.input(z27.object({ orgId: z27.string().min(1).max(128) })).mutation(async ({ input }) => {
15846
+ resetOrgKey: protectedProcedure.input(z28.object({ orgId: z28.string().min(1).max(128) })).mutation(async ({ input }) => {
15784
15847
  const canary = await readVerifyFile(orgVaultRoot(input.orgId)) ?? await readVerifyFile(await keyRoot());
15785
15848
  if (!canary) {
15786
15849
  throw new TRPCError22({
@@ -15810,9 +15873,9 @@ var cloudSyncRouter = router({
15810
15873
  * every other member and for this one on another machine.
15811
15874
  */
15812
15875
  untrackProject: protectedProcedure.input(
15813
- z27.object({
15814
- orgId: z27.string().min(1).max(128),
15815
- projectId: z27.string().min(1).max(128)
15876
+ z28.object({
15877
+ orgId: z28.string().min(1).max(128),
15878
+ projectId: z28.string().min(1).max(128)
15816
15879
  })
15817
15880
  ).mutation(async ({ input }) => {
15818
15881
  await cloudSyncBridge.unfollowProject(input.orgId, input.projectId);
@@ -15828,9 +15891,9 @@ var cloudSyncRouter = router({
15828
15891
  * membre, ce qui évite d'effacer les fichiers si le cloud a refusé l'ordre.
15829
15892
  */
15830
15893
  deleteProjectFromOrg: protectedProcedure.input(
15831
- z27.object({
15832
- orgId: z27.string().min(1).max(128),
15833
- projectId: z27.string().min(1).max(128)
15894
+ z28.object({
15895
+ orgId: z28.string().min(1).max(128),
15896
+ projectId: z28.string().min(1).max(128)
15834
15897
  })
15835
15898
  ).mutation(async ({ input }) => {
15836
15899
  let res;
@@ -15874,10 +15937,10 @@ var cloudSyncRouter = router({
15874
15937
  * afficher. Le nom est donc recopié dans le tampon du coffre au passage, là
15875
15938
  * où il est déjà lu au démarrage suivant.
15876
15939
  */
15877
- rememberOrgNames: protectedProcedure.input(z27.object({
15878
- orgs: z27.array(z27.object({
15879
- orgId: z27.string().min(1).max(128),
15880
- name: z27.string().min(1).max(100)
15940
+ rememberOrgNames: protectedProcedure.input(z28.object({
15941
+ orgs: z28.array(z28.object({
15942
+ orgId: z28.string().min(1).max(128),
15943
+ name: z28.string().min(1).max(100)
15881
15944
  })).max(200)
15882
15945
  })).mutation(async ({ input }) => {
15883
15946
  for (const { orgId, name } of input.orgs) await rememberOrgName(orgId, name);
@@ -15907,7 +15970,7 @@ var cloudSyncRouter = router({
15907
15970
  * Un 404 efface le logo retenu — l'organisation en a retiré un — tandis qu'un
15908
15971
  * réseau muet laisse en place ce qui est déjà là : hors ligne, on garde.
15909
15972
  */
15910
- cacheOrgLogos: protectedProcedure.input(z27.object({ orgIds: z27.array(z27.string().min(1).max(128)).max(200) })).mutation(async ({ input }) => {
15973
+ cacheOrgLogos: protectedProcedure.input(z28.object({ orgIds: z28.array(z28.string().min(1).max(128)).max(200) })).mutation(async ({ input }) => {
15911
15974
  const clouds = await readOrgClouds();
15912
15975
  let cached = 0;
15913
15976
  for (const orgId of input.orgIds) {
@@ -15969,9 +16032,9 @@ var cloudSyncRouter = router({
15969
16032
  import { readdir as readdir8, stat as stat8 } from "fs/promises";
15970
16033
  import { homedir as homedir5 } from "os";
15971
16034
  import { isAbsolute as isAbsolute4, join as join25, resolve as resolve5, dirname as dirname10, basename as basename2 } from "path";
15972
- import { z as z28 } from "zod";
16035
+ import { z as z29 } from "zod";
15973
16036
  var MAX_ENTRIES2 = 500;
15974
- var PATH_SCHEMA = z28.string().min(1).max(4096);
16037
+ var PATH_SCHEMA = z29.string().min(1).max(4096);
15975
16038
  function safeResolve(input) {
15976
16039
  if (input.includes("\0")) throw new Error("Chemin invalide");
15977
16040
  const expanded = input.startsWith("~") ? join25(homedir5(), input.slice(1)) : input;
@@ -15995,7 +16058,7 @@ var filesystemRouter = router({
15995
16058
  * Hidden entries are skipped: they are noise for choosing a workspace, and
15996
16059
  * `.runeya` itself would invite placing a project inside another's data.
15997
16060
  */
15998
- listDirectories: protectedProcedure.input(z28.object({ path: PATH_SCHEMA })).query(async ({ input }) => {
16061
+ listDirectories: protectedProcedure.input(z29.object({ path: PATH_SCHEMA })).query(async ({ input }) => {
15999
16062
  const dir = safeResolve(input.path);
16000
16063
  const info = await stat8(dir).catch(() => null);
16001
16064
  if (!info?.isDirectory()) {
@@ -16029,10 +16092,10 @@ var filesystemRouter = router({
16029
16092
  * Two projects in one directory is what makes services run against the wrong
16030
16093
  * code, so a directory that already holds one is refused outright.
16031
16094
  */
16032
- checkProjectTarget: protectedProcedure.input(z28.object({
16095
+ checkProjectTarget: protectedProcedure.input(z29.object({
16033
16096
  path: PATH_SCHEMA,
16034
- projectId: z28.string().min(1).max(128),
16035
- orgId: z28.string().max(128).nullable().optional()
16097
+ projectId: z29.string().min(1).max(128),
16098
+ orgId: z29.string().max(128).nullable().optional()
16036
16099
  })).query(async ({ input }) => {
16037
16100
  const dir = safeResolve(input.path);
16038
16101
  const info = await stat8(dir).catch(() => null);
@@ -16054,6 +16117,7 @@ var filesystemRouter = router({
16054
16117
  var appRouter = router({
16055
16118
  health: healthRouter,
16056
16119
  appUpdate: appUpdateRouter,
16120
+ changelog: changelogRouter,
16057
16121
  diagnostics: diagnosticsRouter,
16058
16122
  project: projectRouter,
16059
16123
  service: serviceRouter,
@@ -16436,7 +16500,7 @@ async function runLegacyMigration(dataDir) {
16436
16500
  }
16437
16501
  console.log("[legacy-migration] Legacy Runeya data detected, starting migration\u2026");
16438
16502
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").substring(0, 19);
16439
- const legacyTmp = join28(abCwd, ".runeya-tmp");
16503
+ const legacyTmp = `${legacyRoot}-tmp`;
16440
16504
  await rename17(legacyRoot, legacyTmp);
16441
16505
  await mkdir24(dataDir, { recursive: true });
16442
16506
  const legacyOld = join28(dataDir, `backup-${timestamp}`);
@@ -18366,4 +18430,4 @@ export {
18366
18430
  pullEnv,
18367
18431
  registerInstance
18368
18432
  };
18369
- //# sourceMappingURL=src-QDQ5AT4C.js.map
18433
+ //# sourceMappingURL=src-GGPKDQGD.js.map