@runeya/runeya 2.0.95 → 2.0.97

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 (226) hide show
  1. package/agent/index.js +24 -12
  2. package/agent/index.js.map +1 -1
  3. package/agent-manager-SNVPZNLC.js +8 -0
  4. package/{chat-LPMGV2VS.js → chat-NSWAMXLO.js} +6 -6
  5. package/{chunk-R23UUB5R.js → chunk-57NU22TS.js} +905 -682
  6. package/chunk-57NU22TS.js.map +1 -0
  7. package/{chunk-WAC56HS4.js → chunk-ANGVT3MX.js} +79 -32
  8. package/chunk-ANGVT3MX.js.map +1 -0
  9. package/{chunk-HX3ZIWHM.js → chunk-BHLCBARP.js} +2 -2
  10. package/{chunk-72LQC3YC.js → chunk-F3HKV5AU.js} +2 -2
  11. package/{chunk-3MJLS5UY.js → chunk-NDO5VFZY.js} +5 -5
  12. package/chunk-NDO5VFZY.js.map +1 -0
  13. package/{companion-VPYVGTRU.js → companion-EWR2QZAB.js} +12 -4
  14. package/index.js +1 -1
  15. package/mcp-server/index.js +289 -5
  16. package/mcp-server/index.js.map +1 -1
  17. package/mcp-server/launch.d.ts +20 -1
  18. package/mcp-server/launch.js +10 -5
  19. package/mcp-server/launch.js.map +1 -1
  20. package/package.json +1 -1
  21. package/settings-manager-YHQ5YHUH.js +8 -0
  22. package/{src-NEPDGULO.js → src-3IDP42KO.js} +23 -12
  23. package/src-3IDP42KO.js.map +1 -0
  24. package/web/assets/{AgentScalarChatInterface.vue-DCnwgzWk.js → AgentScalarChatInterface.vue-Cg4DrH5-.js} +1 -1
  25. package/web/assets/{AgentTerminalPage-D6iEzvyz.js → AgentTerminalPage-ClgOOzjC.js} +1 -1
  26. package/web/assets/AiChatPage-CrqIi3zp.js +1 -0
  27. package/web/assets/{AppLayout-B2mreJVA.js → AppLayout-tfKCrE0A.js} +1 -1
  28. package/web/assets/{AuditPage-CSPHdf0m.js → AuditPage-BwjVcB_e.js} +1 -1
  29. package/web/assets/CloudAccountPage-DJMj6rlx.js +1 -0
  30. package/web/assets/{CloudAccountPage-C35O8Pcb.js → CloudAccountPage-YqD1oWcl.js} +1 -1
  31. package/web/assets/{CloudMessagingPage-5KYELXQI.js → CloudMessagingPage-CGAN3l_2.js} +1 -1
  32. package/web/assets/{DashboardPage-Dl9Sg1av.js → DashboardPage-uzdaeNvE.js} +1 -1
  33. package/web/assets/{DirectoryPickerDialog-DLL3-GoW.js → DirectoryPickerDialog-_nki96n0.js} +1 -1
  34. package/web/assets/{EditorIcon-CzgSjXLk.js → EditorIcon-CN5NnRuP.js} +1 -1
  35. package/web/assets/{EnvironmentForm-DmdDIJHv.js → EnvironmentForm-C3XYN-u_.js} +1 -1
  36. package/web/assets/{EnvironmentFormPage-CV7Uq6Ah.js → EnvironmentFormPage-DzpLGPiH.js} +1 -1
  37. package/web/assets/{EnvironmentListPage-Cfo9RA_g.js → EnvironmentListPage-C2EfOvUQ.js} +1 -1
  38. package/web/assets/KanbanBoardPage-BTvn4Oks.css +1 -0
  39. package/web/assets/KanbanBoardPage-D62-0_x0.js +4 -0
  40. package/web/assets/{KanbanListPage-CSAnUfp3.js → KanbanListPage-mgJfhVzZ.js} +1 -1
  41. package/web/assets/{LaunchProjectPage-vNUoulGP.js → LaunchProjectPage-CRL5enYT.js} +1 -1
  42. package/web/assets/{LaunchServicesPage-CkWZxZ-v.js → LaunchServicesPage-BaIi1u2l.js} +1 -1
  43. package/web/assets/{LogViewer-CW-bBjZF.js → LogViewer-CQmf3bkB.js} +1 -1
  44. package/web/assets/{OrgKeyPrompt-CHoMbQhn.js → OrgKeyPrompt-x919NFZU.js} +1 -1
  45. package/web/assets/{ProcessControls-WS6BjS5H.js → ProcessControls-Bxuzo9xu.js} +1 -1
  46. package/web/assets/{ProcessDetailPage-DEvZSNER.js → ProcessDetailPage-CM4gv6qW.js} +1 -1
  47. package/web/assets/{ProcessMetrics-DmhwoKrE.js → ProcessMetrics-B8ReKltW.js} +1 -1
  48. package/web/assets/{ProjectDetailPage-DanRrWb4.js → ProjectDetailPage-DiaanTyL.js} +1 -1
  49. package/web/assets/{ProjectListPage--l9HsQ9u.js → ProjectListPage-eq12Vdsi.js} +1 -1
  50. package/web/assets/{RandomJobTestPage-BMatxc2G.js → RandomJobTestPage-CJbdpqF0.js} +1 -1
  51. package/web/assets/{ScenarioEditorPage-D_rJyudb.js → ScenarioEditorPage-D8xmK-aZ.js} +1 -1
  52. package/web/assets/{SendToChatDialog-D-pDvIjD.js → SendToChatDialog-B0m5-H1l.js} +1 -1
  53. package/web/assets/{ServiceControlsBar-BSU25sZZ.js → ServiceControlsBar-BdT0XYtF.js} +1 -1
  54. package/web/assets/{ServiceDetailPage-B1oRlnId.js → ServiceDetailPage-DGojuDKp.js} +1 -1
  55. package/web/assets/{ServiceFormPage-D-DmI0fF.js → ServiceFormPage-6aPMUBjp.js} +1 -1
  56. package/web/assets/SettingsPage-DisZogYn.js +2063 -0
  57. package/web/assets/{SettingsPage-D6-jpORY.css → SettingsPage-GKnTN75s.css} +1 -1
  58. package/web/assets/{UnlockPage-BtunlGnX.js → UnlockPage-QEUvn5MU.js} +1 -1
  59. package/web/assets/{VariablesTable-D3HpHlKY.js → VariablesTable-B9UiC69p.js} +1 -1
  60. package/web/assets/{VaultMigrationPage-DrrFR1I-.js → VaultMigrationPage-BKammxdb.js} +1 -1
  61. package/web/assets/{VersionBadge-DqcS34oJ.js → VersionBadge-B5SmMtZS.js} +1 -1
  62. package/web/assets/WikiPage-ChtHYLsn.js +1 -0
  63. package/web/assets/{WikiView-BasNZv2A.js → WikiView-Brud4K4u.js} +1 -1
  64. package/web/assets/{add-scalar-classes-_PYrgVvq.js → add-scalar-classes-CF1ZlVmT.js} +3 -3
  65. package/web/assets/auth-errors-1gmtFIpl.js +1 -0
  66. package/web/assets/{autocomplete-B-t_B26t.js → autocomplete-eQhMihkm.js} +1 -1
  67. package/web/assets/{basic-shape-diamond.svg-BFWFQIZl.js → basic-shape-diamond.svg-B79z96pk.js} +1 -1
  68. package/web/assets/{basic-shape-hexagon.svg-CXsvZPky.js → basic-shape-hexagon.svg-DAlWXIQS.js} +1 -1
  69. package/web/assets/{basic-shape-primary-circle-ellipse-round.svg-BVg6oDS7.js → basic-shape-primary-circle-ellipse-round.svg-C5OZu4mS.js} +1 -1
  70. package/web/assets/{basic-shape-primary-square-rectangle.svg-jiLWQSQV.js → basic-shape-primary-square-rectangle.svg-BykiIk1Y.js} +1 -1
  71. package/web/assets/{basic-shape-shield.svg-CEybfnew.js → basic-shape-shield.svg-BVcBjIsG.js} +1 -1
  72. package/web/assets/{browser-BfO6Jws3.js → browser-2YDfpiMy.js} +1 -1
  73. package/web/assets/{browser-C7Qh0u0N.js → browser-BeUKu6QW.js} +1 -1
  74. package/web/assets/{card-CWgnvlKH.js → card-BAlWlIgX.js} +1 -1
  75. package/web/assets/{checkbox-CKzrAJQv.js → checkbox-CmaD3L1T.js} +1 -1
  76. package/web/assets/{chip-Bu5HllmO.js → chip-CRmYXa8f.js} +1 -1
  77. package/web/assets/{client-CM-a2QU7.js → client-Bv9-b6hD.js} +1 -1
  78. package/web/assets/{cloud-chat.store-Cjbzzy1s.js → cloud-chat.store-D9e_ZoEW.js} +1 -1
  79. package/web/assets/{cloud-session-Bs6siQ-Y.js → cloud-session-CfIHVKlU.js} +1 -1
  80. package/web/assets/{column-pXrOxKc1.js → column-C9854MaP.js} +1 -1
  81. package/web/assets/{computer-device-desktop-monitor.svg-DO-9EDqA.js → computer-device-desktop-monitor.svg-DgYmz8if.js} +1 -1
  82. package/web/assets/{computer-device-desktop.svg-U_EIk7jo.js → computer-device-desktop.svg-CN3hxMSt.js} +1 -1
  83. package/web/assets/{computer-device-laptop.svg-nvbz6sjk.js → computer-device-laptop.svg-LDsA7kc5.js} +1 -1
  84. package/web/assets/{computer-device-mobile-phone-android-samsung-back.svg-Cs34LunN.js → computer-device-mobile-phone-android-samsung-back.svg-BDfCASg6.js} +1 -1
  85. package/web/assets/{computer-device-mobile-phone-android-samsung.svg-CDJgG-4L.js → computer-device-mobile-phone-android-samsung.svg-BMMyDOdR.js} +1 -1
  86. package/web/assets/{computer-device-mobile-phone-iphone-x-back.svg-Du0pDh9L.js → computer-device-mobile-phone-iphone-x-back.svg-BMcE4PZg.js} +1 -1
  87. package/web/assets/{computer-device-mobile-phone-iphone-x.svg-CUgXFf2r.js → computer-device-mobile-phone-iphone-x.svg-DCaO9pra.js} +1 -1
  88. package/web/assets/{computer-device-mobile-tablet-touch.svg-CKdx-iUf.js → computer-device-mobile-tablet-touch.svg-CL-ZgWuC.js} +1 -1
  89. package/web/assets/{computer-device-mobile-tablet.svg-BTvPzs5h.js → computer-device-mobile-tablet.svg-DDOk54bt.js} +1 -1
  90. package/web/assets/{computer-device-network-ethernet-cat6.svg-Cway8Bfw.js → computer-device-network-ethernet-cat6.svg-BlCpBZ1-.js} +1 -1
  91. package/web/assets/{computer-device-network-lan-www.svg-iuTZVSKE.js → computer-device-network-lan-www.svg-BnDixCMz.js} +1 -1
  92. package/web/assets/{computer-device-network-wifi-connection.svg-DEemVGZq.js → computer-device-network-wifi-connection.svg-CVBp6RTa.js} +1 -1
  93. package/web/assets/{computer-device-network-wifi-router.svg-BH2ASeRD.js → computer-device-network-wifi-router.svg-DC_hG81D.js} +1 -1
  94. package/web/assets/{cssMode-BHBdzmoS.js → cssMode-CvjBWwcj.js} +1 -1
  95. package/web/assets/{divider-kwmULX2U.js → divider-DtkApHDJ.js} +1 -1
  96. package/web/assets/{docx-preview-CxXKUxi7.js → docx-preview-D-0_AO3N.js} +1 -1
  97. package/web/assets/{ecology-science-erlenmeyer-flask.svg-9yLzulSu.js → ecology-science-erlenmeyer-flask.svg-Dou8Xul9.js} +1 -1
  98. package/web/assets/{fieldset-DE0sJS29.js → fieldset-CaTLOGqs.js} +1 -1
  99. package/web/assets/{freemarker2-CpcoAmNk.js → freemarker2-DS7rB38N.js} +1 -1
  100. package/web/assets/{handlebars-D6DR-MoZ.js → handlebars-D_6N9S4t.js} +1 -1
  101. package/web/assets/{html-Dx3QwrZR.js → html-aq8_YJ2V.js} +1 -1
  102. package/web/assets/{htmlMode-KSJ_gFzK.js → htmlMode-CVlBX1og.js} +1 -1
  103. package/web/assets/{image-flash-lightning.svg-O9m-H64P.js → image-flash-lightning.svg-DIcyUXwz.js} +1 -1
  104. package/web/assets/{image-picture-flower.svg--rWVVuqu.js → image-picture-flower.svg-CZjlyM5Y.js} +1 -1
  105. package/web/assets/{index-B4UWj2Kz.css → index-BBYieFBt.css} +1 -1
  106. package/web/assets/{index-pLefgbhx.js → index-BPOeXMH7.js} +287 -287
  107. package/web/assets/{interface-alert-exclamation-diamond.svg-CVeV0ecY.js → interface-alert-exclamation-diamond.svg-yMZPAslx.js} +1 -1
  108. package/web/assets/{interface-alert-exclamation-triangle-warning.svg-MIboYRzH.js → interface-alert-exclamation-triangle-warning.svg-B-t1Ml9l.js} +1 -1
  109. package/web/assets/{interface-alert-information-circle.svg-BlkHMxfH.js → interface-alert-information-circle.svg-B8HdecEH.js} +1 -1
  110. package/web/assets/{interface-award-crown.svg-C_Z3sLuP.js → interface-award-crown.svg-DDbSGaEo.js} +1 -1
  111. package/web/assets/{interface-bookmark.svg-CVpTNe3u.js → interface-bookmark-tag.svg-C5dS6Wy_.js} +1 -1
  112. package/web/assets/{interface-bookmark-tag.svg-ClOZOhfV.js → interface-bookmark.svg-BZwwsorn.js} +1 -1
  113. package/web/assets/{interface-calendar-date-one.svg-BvG92AQi.js → interface-calendar-date-one.svg-B_lSSDJQ.js} +1 -1
  114. package/web/assets/{interface-content-book-open-pages.svg-aXXXkj7d.js → interface-content-book-open-pages.svg-CPjHk5dC.js} +1 -1
  115. package/web/assets/{interface-content-book-page.svg-BE0nQJw_.js → interface-content-book-page.svg-DLBNBM0O.js} +1 -1
  116. package/web/assets/{interface-content-file.svg-DYonyE7J.js → interface-content-file.svg-dZo-oryw.js} +1 -1
  117. package/web/assets/interface-content-folder.svg-CeaK9A2u.js +1 -0
  118. package/web/assets/{interface-content-folder.svg-DKc7vKrm.js → interface-content-folder.svg-D3PMAR0L.js} +1 -1
  119. package/web/assets/{interface-copy-clipboard.svg-sAixmHqz.js → interface-copy-clipboard.svg-hGQ6TIiI.js} +1 -1
  120. package/web/assets/{interface-edit-attachment.svg-DsSzCN6U.js → interface-edit-attachment.svg-r3GzouWU.js} +1 -1
  121. package/web/assets/{interface-edit-binocular.svg-Bheco9Gv.js → interface-edit-binocular.svg-Cfv2KJGW.js} +1 -1
  122. package/web/assets/{interface-edit-magic-wand.svg-C73TY2iI.js → interface-edit-magic-wand.svg-DgdmCAUF.js} +1 -1
  123. package/web/assets/{interface-edit-tool-paint-roller.svg-D2OSqY3g.js → interface-edit-tool-paint-roller.svg-D9b8KTHm.js} +1 -1
  124. package/web/assets/{interface-edit-tool-pencil.svg-CdY316cw.js → interface-edit-tool-pencil.svg-6EZF-4AD.js} +1 -1
  125. package/web/assets/{interface-favorite-award.svg-DfA-EhHI.js → interface-favorite-award.svg-CX7vjSmO.js} +1 -1
  126. package/web/assets/{interface-favorite-flag.svg-BnmSaveE.js → interface-favorite-flag.svg-Bf-5zzqB.js} +1 -1
  127. package/web/assets/{interface-favorite-heart.svg-28i7lMzG.js → interface-favorite-heart.svg-CuDUk_-U.js} +1 -1
  128. package/web/assets/{interface-favorite-star.svg-u8xOEB4S.js → interface-favorite-star.svg-jiT9sBTw.js} +1 -1
  129. package/web/assets/{interface-favorite-stars-sparkles.svg-D5UHf8ar.js → interface-favorite-stars-sparkles.svg-B14YHOWj.js} +1 -1
  130. package/web/assets/{interface-hierarchy-flowchart.svg-BmjWTh4K.js → interface-hierarchy-flowchart.svg-DxZmAHe8.js} +1 -1
  131. package/web/assets/{interface-home-house.svg-DJ5Ae65N.js → interface-home-house.svg-CPRm99Q5.js} +1 -1
  132. package/web/assets/{interface-hyperlink.svg-HdHKY_g6.js → interface-hyperlink.svg-CYpU8zdB.js} +1 -1
  133. package/web/assets/{interface-lighting-brightness.svg-BDELfqMb.js → interface-lighting-brightness.svg-Bm2pypGs.js} +1 -1
  134. package/web/assets/{interface-lock-closed.svg-BcDwDHkS.js → interface-lock-closed.svg-BJbzqDi9.js} +1 -1
  135. package/web/assets/{interface-lock-open-unlock.svg-DNESCRC1.js → interface-lock-open-unlock.svg-Be2miC-V.js} +1 -1
  136. package/web/assets/{interface-login-key.svg-BOEot3yk.js → interface-login-key.svg-BvPEKsKK.js} +1 -1
  137. package/web/assets/{interface-search.svg-CFsy7ant.js → interface-search.svg-CxqA1oOe.js} +1 -1
  138. package/web/assets/{interface-setting-cog.svg-B7Zk0iyr.js → interface-setting-cog.svg-RjIklwFA.js} +1 -1
  139. package/web/assets/{interface-share-megaphone-bullhorn.svg-DvG0IjMM.js → interface-share-megaphone-bullhorn.svg-CqesMCvG.js} +1 -1
  140. package/web/assets/{interface-share-rocket.svg-gvaeTB8G.js → interface-share-rocket.svg-Du5P2iVk.js} +1 -1
  141. package/web/assets/{interface-share-satellite.svg-B5pXJ0kU.js → interface-share-satellite.svg-BMzUK6ux.js} +1 -1
  142. package/web/assets/{interface-share-space-ship.svg-B0k0J-VQ.js → interface-share-space-ship.svg-BWpbb-zz.js} +1 -1
  143. package/web/assets/{interface-share.svg-ZDsCvjRe.js → interface-share.svg-C044g6pa.js} +1 -1
  144. package/web/assets/{interface-signal-square.svg-DBkJ1ire.js → interface-signal-square.svg-DypNLn80.js} +1 -1
  145. package/web/assets/{interface-time-clock-circle.svg-BheUirew.js → interface-time-clock-circle.svg-CRNvdPs5.js} +1 -1
  146. package/web/assets/{interface-time-hour-glass.svg-iORrebF8.js → interface-time-hour-glass.svg-BYTiCdVN.js} +1 -1
  147. package/web/assets/{interface-users-multiple.svg-DMqedSUQ.js → interface-users-multiple.svg-B0BO30tc.js} +1 -1
  148. package/web/assets/{interface-weather-moon.svg-DyPBHRw4.js → interface-weather-moon.svg-C9dWP7q-.js} +1 -1
  149. package/web/assets/{javascript-B1Y6a5s6.js → javascript-DCs9TLWg.js} +1 -1
  150. package/web/assets/{jsonMode-Vj2pUgcF.js → jsonMode-BE2uSFxY.js} +1 -1
  151. package/web/assets/{liquid-lb0ImGEW.js → liquid-BZjYukYL.js} +1 -1
  152. package/web/assets/{lspLanguageFeatures-sh8ggL5N.js → lspLanguageFeatures-4LyxjQPX.js} +1 -1
  153. package/web/assets/{mail-chat-bubble-square.svg-D_Lx6uBc.js → mail-chat-bubble-square.svg-CTGFukhv.js} +1 -1
  154. package/web/assets/{mail-send-email-paper-airplane.svg-B6FGKBZu.js → mail-send-email-paper-airplane.svg-DD-FZNCw.js} +1 -1
  155. package/web/assets/{mail-send-envelope.svg-Dtm4h_xw.js → mail-send-envelope.svg-AuHOjRAo.js} +1 -1
  156. package/web/assets/{mdx-BbFPcqiD.js → mdx-9unslLAn.js} +1 -1
  157. package/web/assets/{minus-Bxw18Xk6.js → minus-CHP_QK2B.js} +1 -1
  158. package/web/assets/modal-BTKNoQeE.js +1 -0
  159. package/web/assets/{modal-DLY8nKW-.js → modal-OQde8W0w.js} +1 -1
  160. package/web/assets/{money-cashier-receipt.svg-VpEb8Ewv.js → money-cashier-receipt.svg-B3aJCJ9h.js} +1 -1
  161. package/web/assets/{money-currency-dollar-pay.svg-vo8FP9z4.js → money-currency-dollar-pay.svg-xdKFuxOB.js} +1 -1
  162. package/web/assets/{money-graph-arrow-increase.svg-CNcLQGOf.js → money-graph-arrow-increase.svg-wWmaxtEW.js} +1 -1
  163. package/web/assets/{money-graph-bar-chart-increase.svg-BHAccBVA.js → money-graph-bar-chart-increase.svg-BEhoD6l7.js} +1 -1
  164. package/web/assets/{multiselect-Crs0miOE.js → multiselect-DtWF2AZf.js} +1 -1
  165. package/web/assets/{nature-ecology-leaf.svg-0y4pBUlD.js → nature-ecology-leaf.svg-DjdQrhs6.js} +1 -1
  166. package/web/assets/{password-TyT4zuky.js → password-CrFWhx7M.js} +1 -1
  167. package/web/assets/{phone-telephone.svg-BdWhV2vz.js → phone-telephone.svg-CLNYyQne.js} +1 -1
  168. package/web/assets/{plus-4Z2iFfO2.js → plus-DW-wbR7B.js} +1 -1
  169. package/web/assets/process.store-DrmMxxoc.js +1 -0
  170. package/web/assets/{programming-bug.svg-DXDJVNeQ.js → programming-bug.svg-MarViUOk.js} +1 -1
  171. package/web/assets/{programming-cloud.svg-qWtq6fXG.js → programming-cloud.svg-W3xHdUnB.js} +1 -1
  172. package/web/assets/{programming-computer-database-server.svg-DnlJHfH5.js → programming-computer-database-server.svg-CKehXNTl.js} +1 -1
  173. package/web/assets/{programming-computer-database.svg-Bl73TDXc.js → programming-computer-database.svg-gCA_mBCi.js} +1 -1
  174. package/web/assets/{programming-module-four-layout.svg-CGkj0OdH.js → programming-module-four-layout.svg-BqwwSEVQ.js} +1 -1
  175. package/web/assets/{programming-module-three.svg-Bsk_vaHc.js → programming-module-three.svg-DqwYgzpA.js} +1 -1
  176. package/web/assets/{programming-module.svg-D0Yng9wS.js → programming-module.svg-BV--KFzc.js} +1 -1
  177. package/web/assets/{programming-script-code.svg-DTHMCNnF.js → programming-script-code.svg-CBCpPkxq.js} +1 -1
  178. package/web/assets/{python-HImlMuYG.js → python-CCsqTZHL.js} +1 -1
  179. package/web/assets/{razor-CTFKddzv.js → razor-BRMeTt-k.js} +1 -1
  180. package/web/assets/router-CV1Vunn0.js +1 -0
  181. package/web/assets/settings-scope-BTe7KdSG.js +1 -0
  182. package/web/assets/{settings.store-CZ9jrl3S.js → settings.store-erZiUPuR.js} +1 -1
  183. package/web/assets/{shopping-cart.svg-Cx50mrFm.js → shopping-cart.svg-jc4kXbD3.js} +1 -1
  184. package/web/assets/{shopping-gift-present.svg-DGOO6qNg.js → shopping-gift-present.svg-Bqvvhp3D.js} +1 -1
  185. package/web/assets/{shopping-shipping-box-parcel-package.svg-C96i4g3q.js → shopping-shipping-box-parcel-package.svg-D2SgWwJp.js} +1 -1
  186. package/web/assets/{src-DRjytMUo.js → src-CeApk0FF.js} +1 -1
  187. package/web/assets/{src-DzMKqnGu.js → src-dSgRs0bd.js} +1 -1
  188. package/web/assets/{tabpanel-BW8I76pY.js → tabpanel-CeLflR6J.js} +1 -1
  189. package/web/assets/{tag-new-circle.svg-CV5DN0Db.js → tag-new-circle.svg-CkA4UdUB.js} +1 -1
  190. package/web/assets/{toggleswitch-D4Evlg2b.js → toggleswitch-DKBXnmzT.js} +1 -1
  191. package/web/assets/{travel-map-earth-globe.svg-CWvuO_Hb.js → travel-map-earth-globe.svg-kl6fMv7M.js} +1 -1
  192. package/web/assets/trpc-CgcMlFhM.js +1 -0
  193. package/web/assets/{tsMode-BqKPHyIc.js → tsMode-DA6ejbio.js} +1 -1
  194. package/web/assets/{typescript-Bme6ns4u.js → typescript-Bfy7_Fw8.js} +1 -1
  195. package/web/assets/useAiChatDrawer-DPZ2UftQ.js +1 -0
  196. package/web/assets/{useCloudOrg-D2LTbk-G.js → useCloudOrg-CsuqKLSU.js} +3 -3
  197. package/web/assets/{useProjectCatalog-nlAZuu5X.js → useProjectCatalog-4ks7Tpfb.js} +1 -1
  198. package/web/assets/{xml-zsImRVNc.js → xml-D5p3PPs0.js} +1 -1
  199. package/web/assets/{yaml-VubzWJpP.js → yaml-CzBSY9q-.js} +1 -1
  200. package/web/index.html +2 -2
  201. package/agent-manager-QQPKKLKY.js +0 -8
  202. package/chunk-3MJLS5UY.js.map +0 -1
  203. package/chunk-R23UUB5R.js.map +0 -1
  204. package/chunk-WAC56HS4.js.map +0 -1
  205. package/settings-manager-6FKHBLIV.js +0 -8
  206. package/src-NEPDGULO.js.map +0 -1
  207. package/web/assets/AiChatPage-DDr9XEv8.js +0 -1
  208. package/web/assets/CloudAccountPage-BAkTRH4E.js +0 -1
  209. package/web/assets/KanbanBoardPage-DL1WwMBP.js +0 -4
  210. package/web/assets/KanbanBoardPage-K07_QbUq.css +0 -1
  211. package/web/assets/SettingsPage-Bi72zdhb.js +0 -2063
  212. package/web/assets/WikiPage-BH8A-IB_.js +0 -1
  213. package/web/assets/auth-errors-CwswzwYV.js +0 -1
  214. package/web/assets/interface-content-folder.svg-FcNZvOjy.js +0 -1
  215. package/web/assets/modal-D-InjkVP.js +0 -1
  216. package/web/assets/process.store-DsGpeQnV.js +0 -1
  217. package/web/assets/router-DTzqrUba.js +0 -1
  218. package/web/assets/settings-scope-CdxhnRbI.js +0 -1
  219. package/web/assets/trpc-BbC62Ymt.js +0 -1
  220. package/web/assets/useAiChatDrawer-BG8t5Thc.js +0 -1
  221. /package/{agent-manager-QQPKKLKY.js.map → agent-manager-SNVPZNLC.js.map} +0 -0
  222. /package/{chat-LPMGV2VS.js.map → chat-NSWAMXLO.js.map} +0 -0
  223. /package/{chunk-HX3ZIWHM.js.map → chunk-BHLCBARP.js.map} +0 -0
  224. /package/{chunk-72LQC3YC.js.map → chunk-F3HKV5AU.js.map} +0 -0
  225. /package/{companion-VPYVGTRU.js.map → companion-EWR2QZAB.js.map} +0 -0
  226. /package/{settings-manager-6FKHBLIV.js.map → settings-manager-YHQ5YHUH.js.map} +0 -0
@@ -2,6 +2,7 @@ import {
2
2
  COMPANION_SIGNATURE,
3
3
  claudeSessionExists,
4
4
  companionSystemNote,
5
+ companionThinkingIds,
5
6
  conversationStore,
6
7
  deliverToMainConversation,
7
8
  emitTurnFinished,
@@ -12,16 +13,18 @@ import {
12
13
  forgetReviewProgress,
13
14
  forgetSpawn,
14
15
  getLastTranscriptActivity,
16
+ isCompanionThinking,
15
17
  lastCompanionDelivery,
16
18
  noteSpawnConversation,
17
19
  observePtyChunk,
20
+ onCompanionThinkingChanged,
18
21
  projectPathStore,
19
22
  projectStore,
20
23
  readClaudeTranscript,
21
24
  resetRelaunches,
22
25
  syncConversationFromClaudeTranscript,
23
26
  verifyJwt
24
- } from "./chunk-WAC56HS4.js";
27
+ } from "./chunk-ANGVT3MX.js";
25
28
  import {
26
29
  agentManager,
27
30
  agentStore,
@@ -41,10 +44,10 @@ import {
41
44
  rememberFile,
42
45
  serviceStore,
43
46
  wasRead
44
- } from "./chunk-HX3ZIWHM.js";
47
+ } from "./chunk-BHLCBARP.js";
45
48
  import {
46
49
  settingsManager
47
- } from "./chunk-72LQC3YC.js";
50
+ } from "./chunk-F3HKV5AU.js";
48
51
  import {
49
52
  AGENT_STOP_FETCH_TIMEOUT,
50
53
  ApiKeysFileSchema,
@@ -74,7 +77,7 @@ import {
74
77
  urlHostFor,
75
78
  vaultIdOfRoot,
76
79
  withDeprecatedAliases
77
- } from "./chunk-3MJLS5UY.js";
80
+ } from "./chunk-NDO5VFZY.js";
78
81
 
79
82
  // ../server/src/trpc/routers/chat.ts
80
83
  import { z as z5 } from "zod";
@@ -84,466 +87,98 @@ import { execFile } from "child_process";
84
87
  import { promisify } from "util";
85
88
  import { fileURLToPath as fileURLToPath2 } from "url";
86
89
 
87
- // ../../packages/ai-capabilities/src/capabilities.ts
88
- function toList(raw) {
89
- if (!raw) return [];
90
- const text = raw.trim();
91
- if (text.startsWith("[")) {
90
+ // ../../packages/mcp-server/src/launch.ts
91
+ import { fileURLToPath } from "url";
92
+ import { createRequire } from "module";
93
+ import { existsSync } from "fs";
94
+ function resolveMcpServerPath() {
95
+ try {
96
+ const req = createRequire(import.meta.url);
97
+ return req.resolve("@runeya/packages-mcp-server");
98
+ } catch {
99
+ }
100
+ const candidates = [
101
+ // Build packagé du CLI : dist/agent/index.js et dist/index.js côtoient
102
+ // dist/mcp-server/, copié là par le post-build.
103
+ new URL("../mcp-server/index.js", import.meta.url),
104
+ new URL("./mcp-server/index.js", import.meta.url),
105
+ // Monorepo, depuis un dist d'app.
106
+ new URL("../../../packages/mcp-server/dist/index.js", import.meta.url),
107
+ new URL("../../../../packages/mcp-server/dist/index.js", import.meta.url)
108
+ ];
109
+ for (const c of candidates) {
110
+ const p = fileURLToPath(c);
111
+ if (existsSync(p)) return p;
112
+ }
113
+ throw new Error("Could not locate @runeya/packages-mcp-server (built dist not found)");
114
+ }
115
+ function pickEnv(env2) {
116
+ return {
117
+ ...env2.RUNEYA_BASE_URL ? { RUNEYA_BASE_URL: env2.RUNEYA_BASE_URL } : {},
118
+ ...env2.RUNEYA_API_TOKEN ? { RUNEYA_API_TOKEN: env2.RUNEYA_API_TOKEN } : {},
119
+ ...env2.RUNEYA_PROJECT_ID ? { RUNEYA_PROJECT_ID: env2.RUNEYA_PROJECT_ID } : {},
120
+ ...env2.RUNEYA_ORG_ID ? { RUNEYA_ORG_ID: env2.RUNEYA_ORG_ID } : {}
121
+ };
122
+ }
123
+ function runeyaMcpConfig(env2) {
124
+ return JSON.stringify({
125
+ mcpServers: {
126
+ runeya: {
127
+ command: "node",
128
+ args: [resolveMcpServerPath()],
129
+ env: pickEnv(env2)
130
+ }
131
+ }
132
+ });
133
+ }
134
+ function codexMcpArgs(env2) {
135
+ const fields = [
136
+ `command=${tomlString("node")}`,
137
+ `args=[${tomlString(resolveMcpServerPath())}]`
138
+ ];
139
+ const entries = Object.entries(pickEnv(env2));
140
+ if (entries.length > 0) {
141
+ const inline = entries.map(([k, v]) => `${k}=${tomlString(v)}`).join(",");
142
+ fields.push(`env={${inline}}`);
143
+ }
144
+ return ["-c", `mcp_servers.runeya={${fields.join(",")}}`];
145
+ }
146
+ function tomlString(value) {
147
+ const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/[\u0000-\u001f\u007f]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
148
+ return `"${escaped}"`;
149
+ }
150
+
151
+ // ../server/src/services/codex-sessions.ts
152
+ import { readdir } from "fs/promises";
153
+ import { homedir } from "os";
154
+ import { join } from "path";
155
+ var CODEX_SESSIONS_DIR = join(homedir(), ".codex", "sessions");
156
+ async function findCodexSessionFile(sessionId) {
157
+ const suffix = `-${sessionId}.jsonl`;
158
+ async function walk(dir) {
159
+ let entries;
92
160
  try {
93
- const parsed = JSON.parse(text);
94
- if (Array.isArray(parsed)) return parsed.map((v) => String(v).trim()).filter(Boolean);
161
+ entries = await readdir(dir, { withFileTypes: true });
95
162
  } catch {
163
+ return null;
164
+ }
165
+ for (const entry of entries) {
166
+ const full = join(dir, entry.name);
167
+ if (entry.isDirectory()) {
168
+ const found = await walk(full);
169
+ if (found) return found;
170
+ } else if (entry.name.endsWith(suffix)) {
171
+ return full;
172
+ }
96
173
  }
174
+ return null;
97
175
  }
98
- return text.split(",").map((v) => v.trim().replace(/^["'[]+|["'\]]+$/g, "")).filter(Boolean);
176
+ return walk(CODEX_SESSIONS_DIR);
99
177
  }
100
- function clearable(raw, parse2, key) {
101
- if (raw === void 0) return {};
102
- const text = String(raw).trim();
103
- if (!text || text === "null") return { [key]: null };
104
- return { [key]: parse2(text) };
105
- }
106
- var RUNEYA_CAPABILITIES = [
107
- {
108
- name: "list_services",
109
- description: "List all available services. Returns serviceId and agentId for each \u2014 use these exact fields in other calls.",
110
- route: "service.list",
111
- method: "GET",
112
- params: [],
113
- buildInput: () => void 0
114
- },
115
- {
116
- name: "get_service_status",
117
- description: "Get the current status (running, stopped, etc.) of a service.",
118
- route: "process.get",
119
- method: "GET",
120
- params: [
121
- { name: "serviceId", description: "The service ID", required: true },
122
- { name: "agentId", description: "The agent ID hosting this service", required: true }
123
- ],
124
- buildInput: (p) => ({ agentId: p.agentId, id: p.serviceId })
125
- },
126
- {
127
- name: "get_logs",
128
- description: "Get the recent buffered logs for a service.",
129
- route: "process.logs",
130
- method: "GET",
131
- params: [
132
- { name: "serviceId", description: "The service ID", required: true },
133
- { name: "agentId", description: "The agent ID hosting this service", required: true }
134
- ],
135
- buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId })
136
- },
137
- {
138
- name: "start_service",
139
- description: "Start a service on an agent.",
140
- route: "process.start",
141
- method: "POST",
142
- params: [
143
- { name: "serviceId", description: "The service ID to start", required: true },
144
- { name: "agentId", description: "The agent ID hosting this service", required: true }
145
- ],
146
- buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
147
- destructive: true
148
- },
149
- {
150
- name: "stop_service",
151
- description: "Stop a running service on an agent.",
152
- route: "process.stop",
153
- method: "POST",
154
- params: [
155
- { name: "serviceId", description: "The service ID to stop", required: true },
156
- { name: "agentId", description: "The agent ID hosting this service", required: true }
157
- ],
158
- buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
159
- destructive: true
160
- },
161
- {
162
- name: "restart_service",
163
- description: "Restart a service on an agent (stop \u2192 redeploy \u2192 start).",
164
- route: "process.restart",
165
- method: "POST",
166
- params: [
167
- { name: "serviceId", description: "The service ID to restart", required: true },
168
- { name: "agentId", description: "The agent ID hosting this service", required: true }
169
- ],
170
- buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
171
- destructive: true
172
- },
173
- // ─── Utility ─────────────────────────────────────────────────────────────
174
- {
175
- name: "wait",
176
- description: "Wait for a given number of milliseconds before continuing.",
177
- route: "utility.wait",
178
- method: "POST",
179
- params: [
180
- { name: "ms", description: "Number of MILLISECONDS to wait. Convert from seconds: 1s=1000, 10s=10000, 1min=60000. Max 300000.", required: true }
181
- ],
182
- buildInput: (p) => ({ ms: Number(p.ms) }),
183
- usageHint: '"wait 5s" \u2192 wait(ms=5000), "pause 10 seconds" \u2192 wait(ms=10000), "attends 3 secondes" \u2192 wait(ms=3000). Always convert to milliseconds.'
184
- },
185
- // ─── Kanban ───────────────────────────────────────────────────────────────
186
- {
187
- name: "kanban_list_boards",
188
- description: "List the kanban boards of the organization. Returns the organizationId actually queried, the boardId to use in the other kanban tools, plus column and card counts. Cards themselves are not included \u2014 use kanban_get_board for those. An empty list means that organization really has no board: a failure to reach the cloud is reported as an error instead, never as an empty list.",
189
- route: "kanban.listBoards",
190
- method: "GET",
191
- params: [
192
- { name: "includeArchived", description: 'Set to "true" to include archived boards. Default: false.', required: false },
193
- { name: "organizationId", description: "Which organization to read. Optional: needed only when the account belongs to several and the error message asks for it.", required: false }
194
- ],
195
- buildInput: (p) => ({
196
- includeArchived: p.includeArchived === "true",
197
- ...p.organizationId ? { organizationId: p.organizationId } : {}
198
- })
199
- },
200
- {
201
- name: "kanban_get_board",
202
- description: "Read one kanban board: its columns, and the cards in each (id, title, markdown body, assignees, comment count, and attachment metadata \u2014 use kanban_download_attachment to fetch the bytes of a file). Use the exact column names it returns when moving or adding a card.",
203
- route: "kanban.getBoard",
204
- method: "GET",
205
- params: [
206
- { name: "boardId", description: "The kanban board ID, from kanban_list_boards", required: true }
207
- ],
208
- buildInput: (p) => ({ boardId: p.boardId })
209
- },
210
- {
211
- name: "kanban_get_card_comments",
212
- description: "Read the comment thread of one kanban card, newest last: who wrote each comment (ai or user, with the person's name), when, its text, and its attachments. The comments in your task context are a snapshot taken when the task started \u2014 call this to see anything written since, whenever someone tells you a comment was added or kanban_get_board reports a higher commentCount than you have.",
213
- route: "kanban.getCardComments",
214
- method: "GET",
215
- params: [
216
- { name: "boardId", description: "The kanban board ID", required: true },
217
- { name: "cardId", description: "The card ID whose comments to read", required: true },
218
- { name: "limit", description: "How many of the most recent comments to return (1-200). Default: 50.", required: false }
219
- ],
220
- buildInput: (p) => ({
221
- boardId: p.boardId,
222
- cardId: p.cardId,
223
- ...p.limit ? { limit: Number(p.limit) } : {}
224
- }),
225
- usageHint: '"le support a ajout\xE9 un commentaire" / "regarde les nouveaux commentaires" \u2192 kanban_get_card_comments(boardId, cardId). Never answer from the snapshot in your context when fresh comments are mentioned.'
226
- },
227
- {
228
- name: "kanban_search_cards",
229
- description: "Search kanban cards by free text, matched against their title, body and comments (accent- and case-insensitive). Archived cards are included. Searches every board of the organization unless boardId narrows it down.",
230
- route: "kanban.searchCards",
231
- method: "GET",
232
- params: [
233
- { name: "query", description: "Text to look for in card titles, bodies and comments", required: true },
234
- { name: "boardId", description: "Restrict the search to this board. Omit to search all boards.", required: false },
235
- { name: "limit", description: "Maximum number of cards to return (1-100). Default: 25.", required: false },
236
- { name: "organizationId", description: "Which organization to search. Optional: needed only when the account belongs to several and the error message asks for it.", required: false }
237
- ],
238
- buildInput: (p) => ({
239
- query: p.query,
240
- ...p.boardId ? { boardId: p.boardId } : {},
241
- ...p.limit ? { limit: Number(p.limit) } : {},
242
- ...p.organizationId ? { organizationId: p.organizationId } : {}
243
- })
244
- },
245
- {
246
- name: "kanban_download_attachment",
247
- description: "Download a kanban card attachment (image, PDF, any file) onto this machine and return its local path, so it can be opened with file-reading tools. Attachment ids come from the card context, from kanban_get_board, or from kanban_get_card_comments \u2014 a file attached to a comment downloads exactly like one attached to the card.",
248
- route: "kanban.downloadAttachment",
249
- method: "POST",
250
- params: [
251
- { name: "attachmentId", description: "The attachment ID, as listed on the card", required: true }
252
- ],
253
- buildInput: (p) => ({ attachmentId: p.attachmentId })
254
- },
255
- {
256
- name: "kanban_move_card",
257
- description: "Move a kanban card to another column. Use the exact column name.",
258
- route: "kanban.moveCard",
259
- method: "POST",
260
- params: [
261
- { name: "boardId", description: "The kanban board ID", required: true },
262
- { name: "cardId", description: "The card ID to move", required: true },
263
- { name: "targetColumn", description: "Exact name of the target column", required: true }
264
- ],
265
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, targetColumn: p.targetColumn })
266
- },
267
- {
268
- name: "kanban_add_comment",
269
- description: "Add a comment to a kanban card.",
270
- route: "kanban.addComment",
271
- method: "POST",
272
- params: [
273
- { name: "boardId", description: "The kanban board ID", required: true },
274
- { name: "cardId", description: "The card ID", required: true },
275
- { name: "comment", description: "The comment text (markdown supported)", required: true }
276
- ],
277
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, comment: p.comment })
278
- },
279
- {
280
- name: "kanban_get_card_links",
281
- description: "Read the filiation of a board: which card depends on which. Returns one entry per link (child card \u2194 parent card), plus the title, board, column, assignees and comment count of any linked card living on another board. Use it when a card context says it has a parent or sub-cards and you need their ids to read them.",
282
- route: "kanban.getCardLinks",
283
- method: "GET",
284
- params: [
285
- { name: "boardId", description: "The kanban board ID whose links to read", required: true }
286
- ],
287
- buildInput: (p) => ({ boardId: p.boardId })
288
- },
289
- {
290
- name: "kanban_set_card_parent",
291
- description: "Link a kanban card to a parent card, or detach it. The parent is the card the other one depends on \u2014 an epic and its tasks, a bug and its follow-ups. A card has at most one parent, and setting a new one replaces it. Omit parentCardId to detach. kanban_get_board reports the current filiation as parentCardId / childCardIds on each card.",
292
- route: "kanban.setCardParent",
293
- method: "POST",
294
- params: [
295
- { name: "boardId", description: "The kanban board ID of the card being linked", required: true },
296
- { name: "cardId", description: "The card that depends on the parent (the child)", required: true },
297
- { name: "parentCardId", description: "The parent card ID. Omit to detach the card from its parent.", required: false },
298
- { name: "parentBoardId", description: "The parent's board, when it lives on another board of the same organization. Defaults to boardId.", required: false }
299
- ],
300
- buildInput: (p) => ({
301
- boardId: p.boardId,
302
- cardId: p.cardId,
303
- ...p.parentCardId ? { parentCardId: p.parentCardId } : {},
304
- ...p.parentBoardId ? { parentBoardId: p.parentBoardId } : {}
305
- })
306
- },
307
- {
308
- name: "kanban_add_card",
309
- description: "Add a new card to a kanban column.",
310
- route: "kanban.addCard",
311
- method: "POST",
312
- params: [
313
- { name: "boardId", description: "The kanban board ID", required: true },
314
- { name: "column", description: "Exact name of the target column", required: true },
315
- { name: "title", description: "Card title", required: true },
316
- { name: "content", description: "Card content in markdown", required: false }
317
- ],
318
- buildInput: (p) => ({ boardId: p.boardId, column: p.column, title: p.title, content: p.content })
319
- },
320
- {
321
- name: "kanban_get_card",
322
- description: "Read one kanban card by id, including archived ones. Cheaper than fetching the whole board, and the only way to read a card that has been archived.",
323
- route: "kanban.getCard",
324
- method: "GET",
325
- params: [
326
- { name: "boardId", description: "The kanban board ID", required: true },
327
- { name: "cardId", description: "The card ID", required: true }
328
- ],
329
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId })
330
- },
331
- {
332
- name: "kanban_update_card",
333
- description: "Update an existing kanban card. Only the fields you pass are changed; passing null to priority, color or deadline clears it. Prefer this over creating a second card when something needs correcting.",
334
- route: "kanban.updateCard",
335
- method: "POST",
336
- params: [
337
- { name: "boardId", description: "The kanban board ID", required: true },
338
- { name: "cardId", description: "The card ID", required: true },
339
- { name: "title", description: "New title", required: false },
340
- { name: "content", description: "New card content, in markdown", required: false },
341
- { name: "priority", description: "Priority from 1 to 10, or null to clear it", required: false },
342
- { name: "color", description: "Card colour, or null to clear it", required: false },
343
- { name: "groups", description: "Labels, as a list of strings. Replaces the current ones.", required: false },
344
- { name: "deadline", description: "Due date as YYYY-MM-DD, or null to clear it", required: false },
345
- { name: "assignees", description: "User ids to assign, as a list. Replaces the current ones; use kanban_list_members to find the ids.", required: false }
346
- ],
347
- buildInput: (p) => ({
348
- boardId: p.boardId,
349
- cardId: p.cardId,
350
- ...p.title !== void 0 ? { title: p.title } : {},
351
- ...p.content !== void 0 ? { content: p.content } : {},
352
- // Tout arrive en chaîne : un modèle n'écrit pas des nombres, des listes
353
- // ni des `null` typés. `clearable` distingue « efface » de « ne touche
354
- // pas » — sans quoi vider une couleur serait impossible à exprimer, et
355
- // changer un titre risquerait de vider le reste.
356
- ...clearable(p.priority, (v) => Number(v), "priority"),
357
- ...clearable(p.color, (v) => v, "color"),
358
- ...clearable(p.deadline, (v) => v, "deadline"),
359
- ...p.groups !== void 0 ? { groups: toList(p.groups) } : {},
360
- ...p.assignees !== void 0 ? { assignees: toList(p.assignees) } : {}
361
- })
362
- },
363
- {
364
- name: "kanban_set_card_archived",
365
- description: "Archive a kanban card (it leaves the board but is not deleted) or bring it back. An unarchived card returns to the column it left.",
366
- route: "kanban.setCardArchived",
367
- method: "POST",
368
- params: [
369
- { name: "boardId", description: "The kanban board ID", required: true },
370
- { name: "cardId", description: "The card ID", required: true },
371
- { name: "archived", description: "true to archive, false to bring the card back", required: true }
372
- ],
373
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, archived: p.archived === "true" })
374
- },
375
- {
376
- name: "kanban_list_members",
377
- description: "List the people of the organization who can be assigned to a card, with their ids. Needed before assigning anyone with kanban_update_card.",
378
- route: "kanban.listMembers",
379
- method: "GET",
380
- params: [
381
- { name: "organizationId", description: "Which organization. Optional: needed only when the account belongs to several and the error message asks for it.", required: false }
382
- ],
383
- buildInput: (p) => p.organizationId ? { organizationId: p.organizationId } : {}
384
- }
385
- ];
386
-
387
- // ../../packages/ai-capabilities/src/adapters/anthropic.ts
388
- function buildAnthropicTools(capabilities) {
389
- return capabilities.map((cap) => ({
390
- name: cap.name,
391
- description: cap.description,
392
- input_schema: {
393
- type: "object",
394
- properties: Object.fromEntries(
395
- cap.params.map((p) => [p.name, { type: "string", description: p.description }])
396
- ),
397
- required: cap.params.filter((p) => p.required).map((p) => p.name)
398
- }
399
- }));
400
- }
401
-
402
- // ../../packages/ai-capabilities/src/adapters/openai.ts
403
- function buildOpenAITools(capabilities) {
404
- return capabilities.map((cap) => ({
405
- type: "function",
406
- function: {
407
- name: cap.name,
408
- description: cap.description,
409
- parameters: {
410
- type: "object",
411
- properties: Object.fromEntries(
412
- cap.params.map((p) => [p.name, { type: "string", description: p.description }])
413
- ),
414
- required: cap.params.filter((p) => p.required).map((p) => p.name)
415
- }
416
- }
417
- }));
418
- }
419
-
420
- // ../../packages/ai-capabilities/src/adapters/prompt.ts
421
- function buildToolSafetyInstruction(capabilities) {
422
- const destructive = capabilities.filter((c) => c.destructive).map((c) => c.name);
423
- const withHints = capabilities.filter((c) => c.usageHint);
424
- const lines = ["## Tool use safety rules"];
425
- if (destructive.length > 0) {
426
- lines.push(`CRITICAL: Never call ${destructive.join(", ")} unless the user has EXPLICITLY and UNAMBIGUOUSLY requested it.`);
427
- lines.push(`- Only call destructive tools (${destructive.join(", ")}) when the user explicitly uses action words for a specific service.`);
428
- }
429
- if (withHints.length > 0) {
430
- lines.push("");
431
- lines.push("## Tool usage hints");
432
- for (const cap of withHints) {
433
- lines.push(`- ${cap.usageHint}`);
434
- }
435
- }
436
- return lines.join("\n");
437
- }
438
- function buildPromptDocs(baseUrl, token, capabilities) {
439
- if (!token) return "";
440
- const lines = [
441
- "## Runeya API",
442
- "",
443
- `Tu peux interagir avec Runeya via l'API HTTP tRPC ci-dessous.`,
444
- `Base URL : ${baseUrl}/api/trpc`,
445
- "Auth header : Authorization: Bearer $RUNEYA_API_TOKEN",
446
- ""
447
- ];
448
- const gets = capabilities.filter((c) => c.method === "GET");
449
- const posts = capabilities.filter((c) => c.method === "POST");
450
- if (gets.length > 0) {
451
- lines.push("### GET routes (param\xE8tres en query string ?input=<JSON encod\xE9>)", "");
452
- for (const cap of gets) {
453
- const example = cap.params.length > 0 ? `?input=${JSON.stringify(Object.fromEntries(cap.params.map((p) => [p.name === "serviceId" ? "id" : p.name, "..."])))}` : "";
454
- lines.push(`- \`${cap.route}${example}\` \u2014 ${cap.description}`);
455
- }
456
- lines.push("");
457
- }
458
- if (posts.length > 0) {
459
- lines.push("### POST routes (body JSON)", "");
460
- for (const cap of posts) {
461
- const bodyExample = cap.params.length > 0 ? JSON.stringify(Object.fromEntries(cap.params.map((p) => [p.name === "serviceId" ? "processId" : p.name, "..."]))) : "{}";
462
- lines.push(`- \`${cap.route}\` \u2014 \`${bodyExample}\``);
463
- }
464
- lines.push("");
465
- }
466
- const hints = capabilities.filter((c) => c.usageHint);
467
- if (hints.length > 0) {
468
- lines.push("### Usage hints", "");
469
- for (const cap of hints) {
470
- lines.push(`- ${cap.usageHint}`);
471
- }
472
- lines.push("");
473
- }
474
- lines.push(
475
- "### Exemple curl",
476
- "",
477
- "```bash",
478
- `curl -H "Authorization: Bearer $RUNEYA_API_TOKEN" \\`,
479
- ` "${baseUrl}/api/trpc/service.list"`,
480
- "",
481
- `curl -X POST -H "Authorization: Bearer $RUNEYA_API_TOKEN" \\`,
482
- ' -H "Content-Type: application/json" \\',
483
- ` -d '{"agentId":"local","processId":"my-service"}' \\`,
484
- ` "${baseUrl}/api/trpc/process.start"`,
485
- "```",
486
- "",
487
- 'La r\xE9ponse est de la forme `{"result":{"data":<r\xE9sultat>}}`.'
488
- );
489
- return lines.join("\n");
490
- }
491
-
492
- // ../../packages/ai-capabilities/src/trpc-caller.ts
493
- async function callTrpc(baseUrl, route, method, input, authToken) {
494
- const headers = {
495
- "Content-Type": "application/json",
496
- "Authorization": `Bearer ${authToken}`
497
- };
498
- const url = method === "GET" && input ? `${baseUrl}/api/trpc/${route}?input=${encodeURIComponent(JSON.stringify(input))}` : `${baseUrl}/api/trpc/${route}`;
499
- const res = await fetch(url, {
500
- method,
501
- headers,
502
- ...method === "POST" ? { body: JSON.stringify(input ?? {}) } : {},
503
- signal: AbortSignal.timeout(15e3)
504
- });
505
- const json = await res.json();
506
- if (json["error"]) throw new Error(JSON.stringify(json["error"]));
507
- const result = json["result"];
508
- return result?.["data"] ?? result ?? json;
509
- }
510
-
511
- // ../server/src/services/ai-runners/runeya-api-docs.ts
512
- function buildApiDocs(apiBaseUrl, apiToken) {
513
- return buildPromptDocs(apiBaseUrl, apiToken, RUNEYA_CAPABILITIES);
514
- }
515
-
516
- // ../server/src/services/codex-sessions.ts
517
- import { readdir } from "fs/promises";
518
- import { homedir } from "os";
519
- import { join } from "path";
520
- var CODEX_SESSIONS_DIR = join(homedir(), ".codex", "sessions");
521
- async function findCodexSessionFile(sessionId) {
522
- const suffix = `-${sessionId}.jsonl`;
523
- async function walk(dir) {
524
- let entries;
525
- try {
526
- entries = await readdir(dir, { withFileTypes: true });
527
- } catch {
528
- return null;
529
- }
530
- for (const entry of entries) {
531
- const full = join(dir, entry.name);
532
- if (entry.isDirectory()) {
533
- const found = await walk(full);
534
- if (found) return found;
535
- } else if (entry.name.endsWith(suffix)) {
536
- return full;
537
- }
538
- }
539
- return null;
540
- }
541
- return walk(CODEX_SESSIONS_DIR);
542
- }
543
- async function codexSessionExists(sessionId) {
544
- const { threadExists } = await import("./codex-thread-db-LE5FYDDA.js");
545
- if (threadExists(sessionId)) return true;
546
- return await findCodexSessionFile(sessionId) !== null;
178
+ async function codexSessionExists(sessionId) {
179
+ const { threadExists } = await import("./codex-thread-db-LE5FYDDA.js");
180
+ if (threadExists(sessionId)) return true;
181
+ return await findCodexSessionFile(sessionId) !== null;
547
182
  }
548
183
 
549
184
  // ../server/src/trpc/routers/chat.ts
@@ -1427,68 +1062,708 @@ var EnvironmentResolver = class {
1427
1062
  parentKeySources[variable.key] = { environmentId: source.environmentId, environmentName: source.environmentName };
1428
1063
  }
1429
1064
  }
1430
- const isInterpRef = (v) => /\{\{environment\.[^}]+\}\}/.test(v);
1431
- for (const result of parentResults) {
1432
- for (const [key, value] of Object.entries(result.parentEnv)) {
1433
- const existingIsRef = key in parentEnv && isInterpRef(parentEnv[key]);
1434
- const newIsConcrete = !isInterpRef(value);
1435
- if (!(key in parentEnv) || existingIsRef && newIsConcrete) {
1436
- parentEnv[key] = value;
1437
- }
1438
- }
1439
- for (const key of result.parentSecretKeys) {
1440
- parentSecretKeys.add(key);
1441
- }
1442
- for (const [key, source] of Object.entries(result.parentKeySources)) {
1443
- if (!(key in parentKeySources)) {
1444
- parentKeySources[key] = source;
1445
- }
1065
+ const isInterpRef = (v) => /\{\{environment\.[^}]+\}\}/.test(v);
1066
+ for (const result of parentResults) {
1067
+ for (const [key, value] of Object.entries(result.parentEnv)) {
1068
+ const existingIsRef = key in parentEnv && isInterpRef(parentEnv[key]);
1069
+ const newIsConcrete = !isInterpRef(value);
1070
+ if (!(key in parentEnv) || existingIsRef && newIsConcrete) {
1071
+ parentEnv[key] = value;
1072
+ }
1073
+ }
1074
+ for (const key of result.parentSecretKeys) {
1075
+ parentSecretKeys.add(key);
1076
+ }
1077
+ for (const [key, source] of Object.entries(result.parentKeySources)) {
1078
+ if (!(key in parentKeySources)) {
1079
+ parentKeySources[key] = source;
1080
+ }
1081
+ }
1082
+ }
1083
+ for (const key of this.collectSecretKeys(mergedVariables, parentSecretKeys)) {
1084
+ parentSecretKeys.add(key);
1085
+ }
1086
+ const ownVariables = project ? project(environment.variables) : environment.variables;
1087
+ for (const [varId, variable] of Object.entries(ownVariables)) {
1088
+ let wasInherited = varId in mergedVariables;
1089
+ for (const [existingId, existingVar] of Object.entries(mergedVariables)) {
1090
+ if (existingVar.key === variable.key && existingId !== varId) {
1091
+ delete mergedVariables[existingId];
1092
+ delete sources[existingId];
1093
+ wasInherited = true;
1094
+ }
1095
+ }
1096
+ mergedVariables[varId] = variable;
1097
+ sources[varId] = {
1098
+ environmentId: environment.id,
1099
+ environmentName: environment.name,
1100
+ overridden: wasInherited
1101
+ };
1102
+ }
1103
+ return {
1104
+ variables: mergedVariables,
1105
+ sources,
1106
+ parentEnv,
1107
+ parentSecretKeys,
1108
+ parentKeySources
1109
+ };
1110
+ }
1111
+ };
1112
+ var environmentResolver = new EnvironmentResolver();
1113
+
1114
+ // ../../packages/ai-capabilities/src/capabilities.ts
1115
+ function toList(raw) {
1116
+ if (!raw) return [];
1117
+ const text = raw.trim();
1118
+ if (text.startsWith("[")) {
1119
+ try {
1120
+ const parsed = JSON.parse(text);
1121
+ if (Array.isArray(parsed)) return parsed.map((v) => String(v).trim()).filter(Boolean);
1122
+ } catch {
1123
+ }
1124
+ }
1125
+ return text.split(",").map((v) => v.trim().replace(/^["'[]+|["'\]]+$/g, "")).filter(Boolean);
1126
+ }
1127
+ function clearable(raw, parse2, key) {
1128
+ if (raw === void 0) return {};
1129
+ const text = String(raw).trim();
1130
+ if (!text || text === "null") return { [key]: null };
1131
+ return { [key]: parse2(text) };
1132
+ }
1133
+ function gitTarget(p) {
1134
+ return {
1135
+ ...p.serviceId ? { serviceId: p.serviceId } : {},
1136
+ ...p.projectId ? { projectId: p.projectId } : {},
1137
+ ...p.agentId ? { agentId: p.agentId } : {},
1138
+ ...p.orgId ? { orgId: p.orgId } : {}
1139
+ };
1140
+ }
1141
+ var RUNEYA_CAPABILITIES = [
1142
+ {
1143
+ name: "list_services",
1144
+ description: "List services, with the serviceId and agentId to use in other calls. Pass the projectId your context names to stay on the project the user is looking at, or another one from list_projects to look elsewhere. Called with no project, this can answer for every project of every organization on the machine \u2014 far more than the interface shows.",
1145
+ route: "service.list",
1146
+ method: "GET",
1147
+ params: [
1148
+ { name: "projectId", description: "Restrict to this project, from list_projects. Omit to list every service on the machine.", required: false },
1149
+ { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
1150
+ ],
1151
+ buildInput: (p) => p.projectId ? { projectId: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} } : void 0
1152
+ },
1153
+ {
1154
+ name: "get_service_status",
1155
+ description: "Get the current status (running, stopped, etc.) of a service. A service that has never been started on this agent has no process yet, and this answers 404 Process not found \u2014 that means STOPPED, not forbidden and not missing. Start it, or read its configuration with get_service.",
1156
+ route: "process.get",
1157
+ method: "GET",
1158
+ params: [
1159
+ { name: "serviceId", description: "The service ID", required: true },
1160
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
1161
+ ],
1162
+ buildInput: (p) => ({ agentId: p.agentId, id: p.serviceId })
1163
+ },
1164
+ {
1165
+ name: "get_logs",
1166
+ description: "Get the recent buffered logs for a service.",
1167
+ route: "process.logs",
1168
+ method: "GET",
1169
+ params: [
1170
+ { name: "serviceId", description: "The service ID", required: true },
1171
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
1172
+ ],
1173
+ buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId })
1174
+ },
1175
+ {
1176
+ name: "start_service",
1177
+ description: "Start a service on an agent.",
1178
+ route: "process.start",
1179
+ method: "POST",
1180
+ params: [
1181
+ { name: "serviceId", description: "The service ID to start", required: true },
1182
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
1183
+ ],
1184
+ buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
1185
+ destructive: true
1186
+ },
1187
+ {
1188
+ name: "stop_service",
1189
+ description: "Stop a running service on an agent.",
1190
+ route: "process.stop",
1191
+ method: "POST",
1192
+ params: [
1193
+ { name: "serviceId", description: "The service ID to stop", required: true },
1194
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
1195
+ ],
1196
+ buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
1197
+ destructive: true
1198
+ },
1199
+ {
1200
+ name: "restart_service",
1201
+ description: "Restart a service on an agent (stop \u2192 redeploy \u2192 start).",
1202
+ route: "process.restart",
1203
+ method: "POST",
1204
+ params: [
1205
+ { name: "serviceId", description: "The service ID to restart", required: true },
1206
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
1207
+ ],
1208
+ buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
1209
+ destructive: true
1210
+ },
1211
+ // ─── Utility ─────────────────────────────────────────────────────────────
1212
+ {
1213
+ name: "wait",
1214
+ description: "Wait for a given number of milliseconds before continuing.",
1215
+ route: "utility.wait",
1216
+ method: "POST",
1217
+ params: [
1218
+ { name: "ms", description: "Number of MILLISECONDS to wait. Convert from seconds: 1s=1000, 10s=10000, 1min=60000. Max 300000.", required: true }
1219
+ ],
1220
+ buildInput: (p) => ({ ms: Number(p.ms) }),
1221
+ usageHint: '"wait 5s" \u2192 wait(ms=5000), "pause 10 seconds" \u2192 wait(ms=10000), "attends 3 secondes" \u2192 wait(ms=3000). Always convert to milliseconds.'
1222
+ },
1223
+ // ─── Kanban ───────────────────────────────────────────────────────────────
1224
+ {
1225
+ name: "kanban_list_boards",
1226
+ description: "List the kanban boards of the organization. Returns the organizationId actually queried, the boardId to use in the other kanban tools, plus column and card counts. Cards themselves are not included \u2014 use kanban_get_board for those. An empty list means that organization really has no board: a failure to reach the cloud is reported as an error instead, never as an empty list.",
1227
+ route: "kanban.listBoards",
1228
+ method: "GET",
1229
+ params: [
1230
+ { name: "includeArchived", description: 'Set to "true" to include archived boards. Default: false.', required: false },
1231
+ { name: "organizationId", description: "Which organization to read. Optional: needed only when the account belongs to several and the error message asks for it.", required: false }
1232
+ ],
1233
+ buildInput: (p) => ({
1234
+ includeArchived: p.includeArchived === "true",
1235
+ ...p.organizationId ? { organizationId: p.organizationId } : {}
1236
+ })
1237
+ },
1238
+ {
1239
+ name: "kanban_get_board",
1240
+ description: "Read one kanban board: its columns, and the cards in each (id, title, markdown body, assignees, comment count, and attachment metadata \u2014 use kanban_download_attachment to fetch the bytes of a file). Use the exact column names it returns when moving or adding a card.",
1241
+ route: "kanban.getBoard",
1242
+ method: "GET",
1243
+ params: [
1244
+ { name: "boardId", description: "The kanban board ID, from kanban_list_boards", required: true }
1245
+ ],
1246
+ buildInput: (p) => ({ boardId: p.boardId })
1247
+ },
1248
+ {
1249
+ name: "kanban_get_card_comments",
1250
+ description: "Read the comment thread of one kanban card, newest last: who wrote each comment (ai or user, with the person's name), when, its text, and its attachments. The comments in your task context are a snapshot taken when the task started \u2014 call this to see anything written since, whenever someone tells you a comment was added or kanban_get_board reports a higher commentCount than you have.",
1251
+ route: "kanban.getCardComments",
1252
+ method: "GET",
1253
+ params: [
1254
+ { name: "boardId", description: "The kanban board ID", required: true },
1255
+ { name: "cardId", description: "The card ID whose comments to read", required: true },
1256
+ { name: "limit", description: "How many of the most recent comments to return (1-200). Default: 50.", required: false }
1257
+ ],
1258
+ buildInput: (p) => ({
1259
+ boardId: p.boardId,
1260
+ cardId: p.cardId,
1261
+ ...p.limit ? { limit: Number(p.limit) } : {}
1262
+ }),
1263
+ usageHint: '"le support a ajout\xE9 un commentaire" / "regarde les nouveaux commentaires" \u2192 kanban_get_card_comments(boardId, cardId). Never answer from the snapshot in your context when fresh comments are mentioned.'
1264
+ },
1265
+ {
1266
+ name: "kanban_search_cards",
1267
+ description: "Search kanban cards by free text, matched against their title, body and comments (accent- and case-insensitive). Archived cards are included. Searches every board of the organization unless boardId narrows it down.",
1268
+ route: "kanban.searchCards",
1269
+ method: "GET",
1270
+ params: [
1271
+ { name: "query", description: "Text to look for in card titles, bodies and comments", required: true },
1272
+ { name: "boardId", description: "Restrict the search to this board. Omit to search all boards.", required: false },
1273
+ { name: "limit", description: "Maximum number of cards to return (1-100). Default: 25.", required: false },
1274
+ { name: "organizationId", description: "Which organization to search. Optional: needed only when the account belongs to several and the error message asks for it.", required: false }
1275
+ ],
1276
+ buildInput: (p) => ({
1277
+ query: p.query,
1278
+ ...p.boardId ? { boardId: p.boardId } : {},
1279
+ ...p.limit ? { limit: Number(p.limit) } : {},
1280
+ ...p.organizationId ? { organizationId: p.organizationId } : {}
1281
+ })
1282
+ },
1283
+ {
1284
+ name: "kanban_download_attachment",
1285
+ description: "Download a kanban card attachment (image, PDF, any file) onto this machine and return its local path, so it can be opened with file-reading tools. Attachment ids come from the card context, from kanban_get_board, or from kanban_get_card_comments \u2014 a file attached to a comment downloads exactly like one attached to the card.",
1286
+ route: "kanban.downloadAttachment",
1287
+ method: "POST",
1288
+ params: [
1289
+ { name: "attachmentId", description: "The attachment ID, as listed on the card", required: true }
1290
+ ],
1291
+ buildInput: (p) => ({ attachmentId: p.attachmentId })
1292
+ },
1293
+ {
1294
+ name: "kanban_move_card",
1295
+ description: "Move a kanban card to another column. Use the exact column name.",
1296
+ route: "kanban.moveCard",
1297
+ method: "POST",
1298
+ params: [
1299
+ { name: "boardId", description: "The kanban board ID", required: true },
1300
+ { name: "cardId", description: "The card ID to move", required: true },
1301
+ { name: "targetColumn", description: "Exact name of the target column", required: true }
1302
+ ],
1303
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, targetColumn: p.targetColumn })
1304
+ },
1305
+ {
1306
+ name: "kanban_add_comment",
1307
+ description: "Add a comment to a kanban card.",
1308
+ route: "kanban.addComment",
1309
+ method: "POST",
1310
+ params: [
1311
+ { name: "boardId", description: "The kanban board ID", required: true },
1312
+ { name: "cardId", description: "The card ID", required: true },
1313
+ { name: "comment", description: "The comment text (markdown supported)", required: true }
1314
+ ],
1315
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, comment: p.comment })
1316
+ },
1317
+ {
1318
+ name: "kanban_get_card_links",
1319
+ description: "Read the filiation of a board: which card depends on which. Returns one entry per link (child card \u2194 parent card), plus the title, board, column, assignees and comment count of any linked card living on another board. Use it when a card context says it has a parent or sub-cards and you need their ids to read them.",
1320
+ route: "kanban.getCardLinks",
1321
+ method: "GET",
1322
+ params: [
1323
+ { name: "boardId", description: "The kanban board ID whose links to read", required: true }
1324
+ ],
1325
+ buildInput: (p) => ({ boardId: p.boardId })
1326
+ },
1327
+ {
1328
+ name: "kanban_set_card_parent",
1329
+ description: "Link a kanban card to a parent card, or detach it. The parent is the card the other one depends on \u2014 an epic and its tasks, a bug and its follow-ups. A card has at most one parent, and setting a new one replaces it. Omit parentCardId to detach. kanban_get_board reports the current filiation as parentCardId / childCardIds on each card.",
1330
+ route: "kanban.setCardParent",
1331
+ method: "POST",
1332
+ params: [
1333
+ { name: "boardId", description: "The kanban board ID of the card being linked", required: true },
1334
+ { name: "cardId", description: "The card that depends on the parent (the child)", required: true },
1335
+ { name: "parentCardId", description: "The parent card ID. Omit to detach the card from its parent.", required: false },
1336
+ { name: "parentBoardId", description: "The parent's board, when it lives on another board of the same organization. Defaults to boardId.", required: false }
1337
+ ],
1338
+ buildInput: (p) => ({
1339
+ boardId: p.boardId,
1340
+ cardId: p.cardId,
1341
+ ...p.parentCardId ? { parentCardId: p.parentCardId } : {},
1342
+ ...p.parentBoardId ? { parentBoardId: p.parentBoardId } : {}
1343
+ })
1344
+ },
1345
+ {
1346
+ name: "kanban_add_card",
1347
+ description: "Add a new card to a kanban column.",
1348
+ route: "kanban.addCard",
1349
+ method: "POST",
1350
+ params: [
1351
+ { name: "boardId", description: "The kanban board ID", required: true },
1352
+ { name: "column", description: "Exact name of the target column", required: true },
1353
+ { name: "title", description: "Card title", required: true },
1354
+ { name: "content", description: "Card content in markdown", required: false }
1355
+ ],
1356
+ buildInput: (p) => ({ boardId: p.boardId, column: p.column, title: p.title, content: p.content })
1357
+ },
1358
+ {
1359
+ name: "kanban_get_card",
1360
+ description: "Read one kanban card by id, including archived ones. Cheaper than fetching the whole board, and the only way to read a card that has been archived.",
1361
+ route: "kanban.getCard",
1362
+ method: "GET",
1363
+ params: [
1364
+ { name: "boardId", description: "The kanban board ID", required: true },
1365
+ { name: "cardId", description: "The card ID", required: true }
1366
+ ],
1367
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId })
1368
+ },
1369
+ {
1370
+ name: "kanban_update_card",
1371
+ description: "Update an existing kanban card. Only the fields you pass are changed; passing null to priority, color or deadline clears it. Prefer this over creating a second card when something needs correcting.",
1372
+ route: "kanban.updateCard",
1373
+ method: "POST",
1374
+ params: [
1375
+ { name: "boardId", description: "The kanban board ID", required: true },
1376
+ { name: "cardId", description: "The card ID", required: true },
1377
+ { name: "title", description: "New title", required: false },
1378
+ { name: "content", description: "New card content, in markdown", required: false },
1379
+ { name: "priority", description: "Priority from 1 to 10, or null to clear it", required: false },
1380
+ { name: "color", description: "Card colour, or null to clear it", required: false },
1381
+ { name: "groups", description: "Labels, as a list of strings. Replaces the current ones.", required: false },
1382
+ { name: "deadline", description: "Due date as YYYY-MM-DD, or null to clear it", required: false },
1383
+ { name: "assignees", description: "User ids to assign, as a list. Replaces the current ones; use kanban_list_members to find the ids.", required: false }
1384
+ ],
1385
+ buildInput: (p) => ({
1386
+ boardId: p.boardId,
1387
+ cardId: p.cardId,
1388
+ ...p.title !== void 0 ? { title: p.title } : {},
1389
+ ...p.content !== void 0 ? { content: p.content } : {},
1390
+ // Tout arrive en chaîne : un modèle n'écrit pas des nombres, des listes
1391
+ // ni des `null` typés. `clearable` distingue « efface » de « ne touche
1392
+ // pas » — sans quoi vider une couleur serait impossible à exprimer, et
1393
+ // changer un titre risquerait de vider le reste.
1394
+ ...clearable(p.priority, (v) => Number(v), "priority"),
1395
+ ...clearable(p.color, (v) => v, "color"),
1396
+ ...clearable(p.deadline, (v) => v, "deadline"),
1397
+ ...p.groups !== void 0 ? { groups: toList(p.groups) } : {},
1398
+ ...p.assignees !== void 0 ? { assignees: toList(p.assignees) } : {}
1399
+ })
1400
+ },
1401
+ {
1402
+ name: "kanban_set_card_archived",
1403
+ description: "Archive a kanban card (it leaves the board but is not deleted) or bring it back. An unarchived card returns to the column it left.",
1404
+ route: "kanban.setCardArchived",
1405
+ method: "POST",
1406
+ params: [
1407
+ { name: "boardId", description: "The kanban board ID", required: true },
1408
+ { name: "cardId", description: "The card ID", required: true },
1409
+ { name: "archived", description: "true to archive, false to bring the card back", required: true }
1410
+ ],
1411
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, archived: p.archived === "true" })
1412
+ },
1413
+ {
1414
+ name: "kanban_list_members",
1415
+ description: "List the people of the organization who can be assigned to a card, with their ids. Needed before assigning anyone with kanban_update_card.",
1416
+ route: "kanban.listMembers",
1417
+ method: "GET",
1418
+ params: [
1419
+ { name: "organizationId", description: "Which organization. Optional: needed only when the account belongs to several and the error message asks for it.", required: false }
1420
+ ],
1421
+ buildInput: (p) => p.organizationId ? { organizationId: p.organizationId } : {}
1422
+ },
1423
+ // ─── Lecture seule ───────────────────────────────────────────────────────
1424
+ //
1425
+ // Tout ce qui se consulte sans rien changer. La création, la mise à jour et
1426
+ // la suppression restent hors MCP : elles s'ajouteront au cas par cas.
1427
+ //
1428
+ // Volontairement absentes, et à ne pas ajouter sans y regarder à deux fois,
1429
+ // parce qu'elles rendent un secret : `environment.list` / `get` / `resolve` /
1430
+ // `resolveFlat` (un `Environment` porte ses variables, valeurs comprises),
1431
+ // `apiKeys.list` / `reveal`, `setup.getEncryptionKeyHex` et `getOrgKeys`
1432
+ // (clés de chiffrement), `settings.get` et `settings.listAIProviders` (clés
1433
+ // de fournisseurs d'IA — `settings.getPaths` et `getNetwork`, eux, ne
1434
+ // rendent que des chemins et une adresse, d'où leur présence ci-dessous),
1435
+ // `cloudAuth.session`, `agent.getPassthroughEnv`. Un agent n'a pas besoin de
1436
+ // ces valeurs pour travailler, et ce qu'il lit finit dans une transcription.
1437
+ {
1438
+ name: "list_processes",
1439
+ description: "List every process across all agents with its current state (running, stopped, exit code, uptime). Use this to see the whole machine at once, rather than calling get_service_status service by service. An agent only learns about a service when it is first started, so this lists what is deployed, not what is configured: an empty list means nothing has been started, not that you cannot see them \u2014 list_services shows what exists.",
1440
+ route: "process.list",
1441
+ method: "GET",
1442
+ params: [],
1443
+ buildInput: () => void 0
1444
+ },
1445
+ {
1446
+ name: "get_service",
1447
+ description: "Read the full configuration of one service: its commands, ports, groups, runner, log sources and restart policy. list_services gives the ids.",
1448
+ route: "service.get",
1449
+ method: "GET",
1450
+ params: [
1451
+ { name: "serviceId", description: "The service ID", required: true }
1452
+ ],
1453
+ buildInput: (p) => ({ id: p.serviceId })
1454
+ },
1455
+ {
1456
+ name: "get_service_metrics",
1457
+ description: "Read the CPU and memory currently used by a running service.",
1458
+ route: "process.metrics",
1459
+ method: "GET",
1460
+ params: [
1461
+ { name: "serviceId", description: "The service ID", required: true },
1462
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
1463
+ ],
1464
+ buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId })
1465
+ },
1466
+ {
1467
+ name: "list_agents",
1468
+ description: "List the agents connected to this Runeya, with their status and whether they run on this machine. Passphrases are never returned.",
1469
+ route: "agent.list",
1470
+ method: "GET",
1471
+ params: [],
1472
+ buildInput: () => void 0
1473
+ },
1474
+ {
1475
+ name: "list_projects",
1476
+ description: "List the projects known to this Runeya, with their ids and the services they hold.",
1477
+ route: "project.list",
1478
+ method: "GET",
1479
+ params: [],
1480
+ buildInput: () => void 0
1481
+ },
1482
+ {
1483
+ name: "get_project",
1484
+ description: "Read one project: its services, its active environment, its organization.",
1485
+ route: "project.get",
1486
+ method: "GET",
1487
+ params: [
1488
+ { name: "projectId", description: "The project ID, from list_projects", required: true },
1489
+ { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
1490
+ ],
1491
+ buildInput: (p) => ({ id: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} })
1492
+ },
1493
+ {
1494
+ name: "list_project_paths",
1495
+ description: "Where each project lives on this machine. Use it to find the directory to work in before reading or editing files.",
1496
+ route: "project.localPaths",
1497
+ method: "GET",
1498
+ params: [],
1499
+ buildInput: () => void 0
1500
+ },
1501
+ {
1502
+ name: "git_status",
1503
+ description: "Read the git working tree of a service or a project: staged, modified and untracked files, current branch, ahead/behind counts.",
1504
+ route: "git.status",
1505
+ method: "GET",
1506
+ params: [
1507
+ { name: "serviceId", description: "Target the repository of this service", required: false },
1508
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
1509
+ { name: "agentId", description: "The agent hosting the repository", required: false },
1510
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
1511
+ ],
1512
+ buildInput: (p) => gitTarget(p)
1513
+ },
1514
+ {
1515
+ name: "git_log",
1516
+ description: "Read the recent commits of a service or project repository: hash, author, date, message.",
1517
+ route: "git.log",
1518
+ method: "GET",
1519
+ params: [
1520
+ { name: "serviceId", description: "Target the repository of this service", required: false },
1521
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
1522
+ { name: "agentId", description: "The agent hosting the repository", required: false },
1523
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false },
1524
+ { name: "limit", description: "How many commits to return (1-200). Default: 50.", required: false }
1525
+ ],
1526
+ buildInput: (p) => ({ ...gitTarget(p), ...p.limit ? { limit: Number(p.limit) } : {} })
1527
+ },
1528
+ {
1529
+ name: "git_branches",
1530
+ description: "List the local and remote branches of a service or project repository.",
1531
+ route: "git.branches",
1532
+ method: "GET",
1533
+ params: [
1534
+ { name: "serviceId", description: "Target the repository of this service", required: false },
1535
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
1536
+ { name: "agentId", description: "The agent hosting the repository", required: false },
1537
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
1538
+ ],
1539
+ buildInput: (p) => gitTarget(p)
1540
+ },
1541
+ {
1542
+ name: "git_diff",
1543
+ description: "Read the diff of a service or project repository \u2014 everything, or one file. Use it to see what changed before describing or reviewing it.",
1544
+ route: "git.diff",
1545
+ method: "GET",
1546
+ params: [
1547
+ { name: "serviceId", description: "Target the repository of this service", required: false },
1548
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
1549
+ { name: "agentId", description: "The agent hosting the repository", required: false },
1550
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false },
1551
+ { name: "path", description: "Restrict the diff to this file path", required: false },
1552
+ { name: "staged", description: 'Set to "true" to read the staged diff instead of the working tree', required: false },
1553
+ { name: "untracked", description: 'Set to "true" to include untracked files', required: false }
1554
+ ],
1555
+ buildInput: (p) => ({
1556
+ ...gitTarget(p),
1557
+ ...p.path ? { path: p.path } : {},
1558
+ ...p.staged !== void 0 ? { staged: p.staged === "true" } : {},
1559
+ ...p.untracked !== void 0 ? { untracked: p.untracked === "true" } : {}
1560
+ })
1561
+ },
1562
+ {
1563
+ name: "list_docs",
1564
+ description: "List the markdown documentation files of a scope, as a tree. Pair it with read_doc to answer from the project's own docs rather than from guesswork.",
1565
+ route: "wiki.list",
1566
+ method: "GET",
1567
+ params: [
1568
+ { name: "scope", description: `"global" for this Runeya, or "service:<serviceId>" for one service's repository`, required: true }
1569
+ ],
1570
+ buildInput: (p) => ({ scope: p.scope })
1571
+ },
1572
+ {
1573
+ name: "read_doc",
1574
+ description: "Read one markdown documentation file. Paths come from list_docs; only .md and .markdown can be read.",
1575
+ route: "wiki.read",
1576
+ method: "GET",
1577
+ params: [
1578
+ { name: "scope", description: `"global" for this Runeya, or "service:<serviceId>" for one service's repository`, required: true },
1579
+ { name: "path", description: "Relative path of the file, as returned by list_docs", required: true }
1580
+ ],
1581
+ buildInput: (p) => ({ scope: p.scope, path: p.path })
1582
+ },
1583
+ {
1584
+ name: "get_server_logs",
1585
+ description: "Read Runeya's own recent log entries. Use it to explain why Runeya itself misbehaved \u2014 not to read a service's output, which is get_logs.",
1586
+ route: "diagnostics.recentLogs",
1587
+ method: "GET",
1588
+ params: [
1589
+ { name: "limit", description: "How many entries to return (1-2000). Default: 500.", required: false }
1590
+ ],
1591
+ buildInput: (p) => p.limit ? { limit: Number(p.limit) } : void 0
1592
+ },
1593
+ {
1594
+ name: "get_kanban_queue_state",
1595
+ description: "Read the state of the kanban task queue: what is running, what is waiting. Use it before queuing work, or to explain why a card has not started.",
1596
+ route: "kanbanQueue.getState",
1597
+ method: "GET",
1598
+ params: [],
1599
+ buildInput: () => void 0
1600
+ },
1601
+ {
1602
+ name: "export_project",
1603
+ description: "Read a project and every service it holds in one call, with secrets stripped out. Cheaper and safer than calling get_service for each service \u2014 prefer it whenever you need the whole picture of a project.",
1604
+ route: "project.export",
1605
+ method: "GET",
1606
+ params: [
1607
+ { name: "projectId", description: "The project ID, from list_projects", required: true },
1608
+ { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
1609
+ ],
1610
+ buildInput: (p) => ({ id: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} })
1611
+ },
1612
+ {
1613
+ name: "git_remotes",
1614
+ description: "List the git remotes of a service or project repository, with their URLs.",
1615
+ route: "git.remotes",
1616
+ method: "GET",
1617
+ params: [
1618
+ { name: "serviceId", description: "Target the repository of this service", required: false },
1619
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
1620
+ { name: "agentId", description: "The agent hosting the repository", required: false },
1621
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
1622
+ ],
1623
+ buildInput: (p) => gitTarget(p)
1624
+ },
1625
+ {
1626
+ name: "git_stash_list",
1627
+ description: "List the stashes of a service or project repository. Useful before assuming work was lost: it may simply be stashed.",
1628
+ route: "git.stashList",
1629
+ method: "GET",
1630
+ params: [
1631
+ { name: "serviceId", description: "Target the repository of this service", required: false },
1632
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
1633
+ { name: "agentId", description: "The agent hosting the repository", required: false },
1634
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
1635
+ ],
1636
+ buildInput: (p) => gitTarget(p)
1637
+ },
1638
+ {
1639
+ name: "get_runeya_version",
1640
+ description: "Read the version of Runeya running here, the latest published one, and whether this install is up to date. Use it before blaming a bug on the code: the machine may simply be behind.",
1641
+ route: "health.versionInfo",
1642
+ method: "GET",
1643
+ params: [],
1644
+ buildInput: () => void 0
1645
+ },
1646
+ {
1647
+ name: "get_runeya_paths",
1648
+ description: "Read where Runeya keeps its things on this machine: its launch directory, its data directory, and the machine-wide directory holding cloud projects.",
1649
+ route: "settings.getPaths",
1650
+ method: "GET",
1651
+ params: [],
1652
+ buildInput: () => void 0
1653
+ },
1654
+ {
1655
+ name: "get_network_info",
1656
+ description: "Read where this Runeya listens (host and port) and whether it is reachable from the local network, with the URLs to use. Use it to give someone a working link instead of guessing one.",
1657
+ route: "settings.getNetwork",
1658
+ method: "GET",
1659
+ params: [],
1660
+ buildInput: () => void 0
1661
+ },
1662
+ {
1663
+ name: "list_runeya_instances",
1664
+ description: "List every Runeya answering on this machine, this one included, with its port and directory. Use it when a port is taken or when two instances seem to disagree.",
1665
+ route: "diagnostics.instances",
1666
+ method: "GET",
1667
+ params: [],
1668
+ buildInput: () => void 0
1669
+ },
1670
+ {
1671
+ name: "get_cloud_status",
1672
+ description: "Say whether this Runeya is linked to a cloud account, and to which cloud. A kanban tool failing for lack of a cloud link is explained here.",
1673
+ route: "cloudAuth.status",
1674
+ method: "GET",
1675
+ params: [],
1676
+ buildInput: () => void 0
1677
+ }
1678
+ ];
1679
+
1680
+ // ../../packages/ai-capabilities/src/adapters/anthropic.ts
1681
+ function buildAnthropicTools(capabilities) {
1682
+ return capabilities.map((cap) => ({
1683
+ name: cap.name,
1684
+ description: cap.description,
1685
+ input_schema: {
1686
+ type: "object",
1687
+ properties: Object.fromEntries(
1688
+ cap.params.map((p) => [p.name, { type: "string", description: p.description }])
1689
+ ),
1690
+ required: cap.params.filter((p) => p.required).map((p) => p.name)
1691
+ }
1692
+ }));
1693
+ }
1694
+
1695
+ // ../../packages/ai-capabilities/src/adapters/openai.ts
1696
+ function buildOpenAITools(capabilities) {
1697
+ return capabilities.map((cap) => ({
1698
+ type: "function",
1699
+ function: {
1700
+ name: cap.name,
1701
+ description: cap.description,
1702
+ parameters: {
1703
+ type: "object",
1704
+ properties: Object.fromEntries(
1705
+ cap.params.map((p) => [p.name, { type: "string", description: p.description }])
1706
+ ),
1707
+ required: cap.params.filter((p) => p.required).map((p) => p.name)
1446
1708
  }
1447
1709
  }
1448
- for (const key of this.collectSecretKeys(mergedVariables, parentSecretKeys)) {
1449
- parentSecretKeys.add(key);
1450
- }
1451
- const ownVariables = project ? project(environment.variables) : environment.variables;
1452
- for (const [varId, variable] of Object.entries(ownVariables)) {
1453
- let wasInherited = varId in mergedVariables;
1454
- for (const [existingId, existingVar] of Object.entries(mergedVariables)) {
1455
- if (existingVar.key === variable.key && existingId !== varId) {
1456
- delete mergedVariables[existingId];
1457
- delete sources[existingId];
1458
- wasInherited = true;
1459
- }
1460
- }
1461
- mergedVariables[varId] = variable;
1462
- sources[varId] = {
1463
- environmentId: environment.id,
1464
- environmentName: environment.name,
1465
- overridden: wasInherited
1466
- };
1710
+ }));
1711
+ }
1712
+
1713
+ // ../../packages/ai-capabilities/src/adapters/prompt.ts
1714
+ function buildToolSafetyInstruction(capabilities) {
1715
+ const destructive = capabilities.filter((c) => c.destructive).map((c) => c.name);
1716
+ const withHints = capabilities.filter((c) => c.usageHint);
1717
+ const lines = ["## Tool use safety rules"];
1718
+ if (destructive.length > 0) {
1719
+ lines.push(`CRITICAL: Never call ${destructive.join(", ")} unless the user has EXPLICITLY and UNAMBIGUOUSLY requested it.`);
1720
+ lines.push(`- Only call destructive tools (${destructive.join(", ")}) when the user explicitly uses action words for a specific service.`);
1721
+ }
1722
+ if (withHints.length > 0) {
1723
+ lines.push("");
1724
+ lines.push("## Tool usage hints");
1725
+ for (const cap of withHints) {
1726
+ lines.push(`- ${cap.usageHint}`);
1467
1727
  }
1468
- return {
1469
- variables: mergedVariables,
1470
- sources,
1471
- parentEnv,
1472
- parentSecretKeys,
1473
- parentKeySources
1474
- };
1475
1728
  }
1476
- };
1477
- var environmentResolver = new EnvironmentResolver();
1729
+ return lines.join("\n");
1730
+ }
1731
+
1732
+ // ../../packages/ai-capabilities/src/trpc-caller.ts
1733
+ async function callTrpc(baseUrl, route, method, input, authToken) {
1734
+ const headers = {
1735
+ "Content-Type": "application/json",
1736
+ "Authorization": `Bearer ${authToken}`
1737
+ };
1738
+ const url = method === "GET" && input ? `${baseUrl}/api/trpc/${route}?input=${encodeURIComponent(JSON.stringify(input))}` : `${baseUrl}/api/trpc/${route}`;
1739
+ const res = await fetch(url, {
1740
+ method,
1741
+ headers,
1742
+ ...method === "POST" ? { body: JSON.stringify(input ?? {}) } : {},
1743
+ signal: AbortSignal.timeout(15e3)
1744
+ });
1745
+ const json = await res.json();
1746
+ if (json["error"]) throw new Error(JSON.stringify(json["error"]));
1747
+ const result = json["result"];
1748
+ return result?.["data"] ?? result ?? json;
1749
+ }
1478
1750
 
1479
1751
  // ../server/src/services/llms-txt-generator.ts
1480
- function generateAdminLlmsTxt(services, jwt) {
1481
- const baseUrl = `http://localhost:${env.PORT}`;
1482
- const trpcBase = `${baseUrl}/api/trpc`;
1752
+ function generateAdminLlmsTxt(services, jwt, project) {
1483
1753
  const lines = [];
1484
- lines.push("# Runeya \u2014 Service Management API");
1754
+ lines.push("# Runeya \u2014 Service Management");
1485
1755
  lines.push("");
1486
1756
  lines.push("> You are operating as an authenticated admin with full access to all services.");
1487
- lines.push(`> Base URL: ${trpcBase}`);
1488
- if (jwt) {
1489
- lines.push("> Authentication: pass `Authorization: Bearer $RUNEYA_API_TOKEN` on all tRPC requests.");
1490
- }
1757
+ lines.push("> Everything below is driven through the Runeya MCP tools.");
1491
1758
  lines.push("");
1759
+ if (project) {
1760
+ lines.push(`## Current project`);
1761
+ lines.push("");
1762
+ lines.push(`You are working on **${project.name}** (projectId: \`${project.id}\`${project.orgId ? `, orgId: \`${project.orgId}\`` : ""}).`);
1763
+ lines.push(`The services listed below are its own. Name this project \u2014 \`projectId=${project.id}\` \u2014 on any tool that takes one, and you will stay on what the user actually sees.`);
1764
+ lines.push("A call that names no project may answer for every project of the machine, which is far more than this screen shows: if a result mentions services you do not recognize, that is why.");
1765
+ lines.push("");
1766
+ }
1492
1767
  if (services.length === 0) {
1493
1768
  lines.push("No services configured.");
1494
1769
  return lines.join("\n");
@@ -1506,47 +1781,24 @@ function generateAdminLlmsTxt(services, jwt) {
1506
1781
  }
1507
1782
  lines.push("## MCP Tools");
1508
1783
  lines.push("");
1509
- lines.push("You have access to Runeya MCP tools to manage services. **Always prefer MCP tools** over raw HTTP calls.");
1510
- lines.push("Available tools: `list_services`, `get_service_status`, `start_service`, `stop_service`, `restart_service`, `get_logs`.");
1784
+ lines.push("Runeya is driven exclusively through the MCP tools below. There is no HTTP API to fall back on.");
1785
+ lines.push("");
1786
+ lines.push(RUNEYA_CAPABILITIES.map((c) => `\`${c.name}\``).join(", ") + ".");
1511
1787
  lines.push("");
1788
+ const hints = RUNEYA_CAPABILITIES.filter((c) => c.usageHint);
1789
+ if (hints.length > 0) {
1790
+ lines.push("### Usage hints");
1791
+ lines.push("");
1792
+ for (const cap of hints) lines.push(`- ${cap.usageHint}`);
1793
+ lines.push("");
1794
+ }
1512
1795
  if (jwt) {
1513
1796
  lines.push("**Important**: Pass the `authToken` parameter with value `$RUNEYA_API_TOKEN` (from environment) on every MCP tool call for authentication.");
1514
1797
  lines.push("");
1515
1798
  }
1516
1799
  lines.push("Use the service IDs and agent IDs listed above when calling these tools.");
1517
1800
  lines.push("");
1518
- lines.push("## API Reference (fallback)");
1519
- lines.push("");
1520
- lines.push("Only use raw HTTP calls if MCP tools are unavailable.");
1521
- lines.push("All endpoints use tRPC v11 over HTTP (`Content-Type: application/json`).");
1522
- lines.push("");
1523
- lines.push("**tRPC v11 request format:**");
1524
- lines.push('- **GET queries**: `?input={"id":"abc"}`');
1525
- lines.push('- **POST mutations**: JSON body `{"agentId":"<agentId>","processId":"<serviceId>"}`');
1526
- lines.push("");
1527
- lines.push(`### List services
1528
- \`GET ${trpcBase}/service.list\``);
1529
- lines.push("");
1530
- lines.push(`### Get service
1531
- \`GET ${trpcBase}/service.get?input={"agentId":"<agentId>","id":"<serviceId>"}\``);
1532
- lines.push("");
1533
- lines.push(`### Read logs
1534
- \`GET ${trpcBase}/process.logs?input={"agentId":"<agentId>","processId":"<serviceId>"}\``);
1535
- lines.push("");
1536
- lines.push(`### Start service
1537
- \`POST ${trpcBase}/process.start\`
1538
- Body: \`{"agentId":"<agentId>","processId":"<serviceId>"}\``);
1539
- lines.push("");
1540
- lines.push(`### Stop service
1541
- \`POST ${trpcBase}/process.stop\`
1542
- Body: \`{"agentId":"<agentId>","processId":"<serviceId>"}\``);
1543
- lines.push("");
1544
- lines.push(`### Restart service
1545
- \`POST ${trpcBase}/process.restart\`
1546
- Body: \`{"agentId":"<agentId>","processId":"<serviceId>"}\``);
1547
- lines.push("");
1548
- lines.push(`### Get service status
1549
- \`GET ${trpcBase}/process.status?input={"agentId":"<agentId>","processId":"<serviceId>"}\``);
1801
+ lines.push("If a tool you need does not exist, say so instead of improvising another route.");
1550
1802
  lines.push("");
1551
1803
  return lines.join("\n");
1552
1804
  }
@@ -2072,10 +2324,31 @@ async function resolveServiceVariables(service) {
2072
2324
  }
2073
2325
  var DockerConfigInput = DockerConfigSchema;
2074
2326
  var serviceRouter = router({
2075
- list: protectedProcedure.meta({ openapi: { method: "GET", path: "/services", tags: ["services"], summary: "List all services", protect: true } }).output(z2.any()).query(async ({ ctx }) => {
2327
+ /**
2328
+ * Sans `projectId`, la réponse couvre TOUT le poste : `serviceStore.list()`
2329
+ * rend chaque coffre, donc chaque organisation et chaque projet de la
2330
+ * machine. L'interface le supporte — elle n'affiche que le projet ouvert —
2331
+ * mais un appelant sans écran reçoit la liste entière, d'où le filtre.
2332
+ *
2333
+ * Un projet introuvable rend une liste vide, jamais tout le poste : un repli
2334
+ * silencieux ferait croire au filtrage tout en rendant les services des
2335
+ * autres organisations.
2336
+ */
2337
+ list: protectedProcedure.meta({ openapi: { method: "GET", path: "/services", tags: ["services"], summary: "List services (every project of the machine unless narrowed)", protect: true } }).input(z2.object({
2338
+ projectId: z2.string().max(128).optional(),
2339
+ orgId: z2.string().max(128).nullable().optional()
2340
+ }).optional()).output(z2.any()).query(async ({ input, ctx }) => {
2076
2341
  const all = await serviceStore.list();
2077
2342
  const allowedIds = getAllowedServiceIds(ctx);
2078
- const filtered = allowedIds ? all.filter((s) => allowedIds.has(s.id)) : all;
2343
+ let filtered = allowedIds ? all.filter((s) => allowedIds.has(s.id)) : all;
2344
+ if (input?.projectId) {
2345
+ const project = await projectStore.get({
2346
+ id: input.projectId,
2347
+ ...input.orgId !== void 0 ? { orgId: input.orgId } : {}
2348
+ });
2349
+ const ids = new Set(project?.serviceIds ?? []);
2350
+ filtered = filtered.filter((s) => ids.has(s.id));
2351
+ }
2079
2352
  return Promise.all(filtered.map(async (s) => ({
2080
2353
  ...s,
2081
2354
  effectiveAgentId: await resolveEffectiveAgentId(s)
@@ -3253,7 +3526,7 @@ async function vaultOfProject(projectId) {
3253
3526
  // ../server/src/services/image-storage.service.ts
3254
3527
  import { randomUUID as randomUUID3 } from "crypto";
3255
3528
  import { mkdir as mkdir6, writeFile as writeFile4, readFile as readFile6, unlink as unlink2, readdir as readdir3 } from "fs/promises";
3256
- import { existsSync } from "fs";
3529
+ import { existsSync as existsSync2 } from "fs";
3257
3530
  import { join as join6, extname, resolve as resolve2, sep as sep2 } from "path";
3258
3531
  var ALLOWED_MIME_TYPES = /* @__PURE__ */ new Set([
3259
3532
  "image/png",
@@ -3319,7 +3592,7 @@ var ImageStorageService = class {
3319
3592
  if (!metaFile) return null;
3320
3593
  const raw = JSON.parse(await readFile6(join6(this.dir, metaFile), "utf-8"));
3321
3594
  if (expectedContextId !== void 0 && raw.contextId !== expectedContextId) return null;
3322
- if (!existsSync(raw.filePath)) return null;
3595
+ if (!existsSync2(raw.filePath)) return null;
3323
3596
  return { filePath: raw.filePath, mimeType: raw.mimeType, contextId: raw.contextId };
3324
3597
  } catch {
3325
3598
  return null;
@@ -4547,17 +4820,13 @@ function tailTranscript(opts) {
4547
4820
 
4548
4821
  // ../server/src/services/ai-runners/claude-pty-runner.ts
4549
4822
  async function getAgentManager() {
4550
- const { agentManager: agentManager2 } = await import("./agent-manager-QQPKKLKY.js");
4823
+ const { agentManager: agentManager2 } = await import("./agent-manager-SNVPZNLC.js");
4551
4824
  return agentManager2;
4552
4825
  }
4553
4826
  function buildPtyArgs(params, sessionId, opts) {
4554
- const { isResume, systemContext, apiBaseUrl, apiToken, model, mcpConfig, skipTokenInstructions, prompt } = params;
4827
+ const { isResume, systemContext, model, mcpConfig, skipTokenInstructions, prompt } = params;
4555
4828
  const sessionArg = isResume ? ["--resume", sessionId] : ["--session-id", sessionId];
4556
- const apiDocs = buildApiDocs(apiBaseUrl, apiToken);
4557
- const fullSystemContext = apiDocs ? `${systemContext}
4558
-
4559
- ${apiDocs}` : systemContext;
4560
- const systemPrompt = skipTokenInstructions ? fullSystemContext : `${fullSystemContext}
4829
+ const systemPrompt = skipTokenInstructions ? systemContext : `${systemContext}
4561
4830
 
4562
4831
  ${TOKEN_INSTRUCTIONS}`;
4563
4832
  const mcpArgs = mcpConfig && !opts.excludeMcp ? ["--mcp-config", mcpConfig] : [];
@@ -4716,7 +4985,9 @@ async function runClaudeViaPty(params) {
4716
4985
  // toutes les tools répondent « No auth token available », et `$RUNEYA_API_TOKEN`
4717
4986
  // ne résout à rien dans le shell du CLI. Le jeton est déjà là — la file le
4718
4987
  // signe elle-même, faute de requête HTTP d'où le tirer.
4719
- mcpApiToken: params.apiToken || void 0
4988
+ mcpApiToken: params.apiToken || void 0,
4989
+ mcpProjectId: params.projectId || void 0,
4990
+ mcpOrgId: params.orgId || void 0
4720
4991
  }).then(({ spawnId: id }) => {
4721
4992
  spawnId = id;
4722
4993
  if (signal.aborted) {
@@ -4863,16 +5134,12 @@ var EFFORT_THINKING_BUDGET = {
4863
5134
  high: 1e4
4864
5135
  };
4865
5136
  function buildClaudeSpawnConfig(params, opts) {
4866
- const { sessionId, prompt, isResume, systemContext, apiBaseUrl, apiToken, model, effort, images, mcpConfig, skipTokenInstructions, injectedEnv } = params;
5137
+ const { sessionId, prompt, isResume, systemContext, apiToken, model, effort, images, mcpConfig, skipTokenInstructions, injectedEnv } = params;
4867
5138
  const hasImages = images && images.length > 0;
4868
5139
  const sessionArg = isResume ? ["--resume", sessionId] : sessionId ? ["--session-id", sessionId] : [];
4869
5140
  const thinkingBudget = EFFORT_THINKING_BUDGET[effort] ?? 0;
4870
5141
  const thinkingArgs = thinkingBudget > 0 ? ["--thinking", "enabled"] : [];
4871
- const apiDocs = buildApiDocs(apiBaseUrl, apiToken);
4872
- const fullSystemContext = apiDocs ? `${systemContext}
4873
-
4874
- ${apiDocs}` : systemContext;
4875
- const systemPrompt = skipTokenInstructions ? fullSystemContext : `${fullSystemContext}
5142
+ const systemPrompt = skipTokenInstructions ? systemContext : `${systemContext}
4876
5143
 
4877
5144
  ${TOKEN_INSTRUCTIONS}`;
4878
5145
  const inputArgs = hasImages ? ["--input-format", "stream-json"] : ["-p", prompt];
@@ -5050,56 +5317,6 @@ var ClaudeCodeRunner = class {
5050
5317
  import { spawn as spawn2 } from "child_process";
5051
5318
  import { createInterface } from "readline";
5052
5319
  import { EventEmitter } from "events";
5053
-
5054
- // ../../packages/mcp-server/src/launch.ts
5055
- import { fileURLToPath } from "url";
5056
- import { createRequire } from "module";
5057
- import { existsSync as existsSync2 } from "fs";
5058
- function resolveMcpServerPath() {
5059
- try {
5060
- const req = createRequire(import.meta.url);
5061
- return req.resolve("@runeya/packages-mcp-server");
5062
- } catch {
5063
- }
5064
- const candidates = [
5065
- // Build packagé du CLI : dist/agent/index.js et dist/index.js côtoient
5066
- // dist/mcp-server/, copié là par le post-build.
5067
- new URL("../mcp-server/index.js", import.meta.url),
5068
- new URL("./mcp-server/index.js", import.meta.url),
5069
- // Monorepo, depuis un dist d'app.
5070
- new URL("../../../packages/mcp-server/dist/index.js", import.meta.url),
5071
- new URL("../../../../packages/mcp-server/dist/index.js", import.meta.url)
5072
- ];
5073
- for (const c of candidates) {
5074
- const p = fileURLToPath(c);
5075
- if (existsSync2(p)) return p;
5076
- }
5077
- throw new Error("Could not locate @runeya/packages-mcp-server (built dist not found)");
5078
- }
5079
- function pickEnv(env2) {
5080
- return {
5081
- ...env2.RUNEYA_BASE_URL ? { RUNEYA_BASE_URL: env2.RUNEYA_BASE_URL } : {},
5082
- ...env2.RUNEYA_API_TOKEN ? { RUNEYA_API_TOKEN: env2.RUNEYA_API_TOKEN } : {}
5083
- };
5084
- }
5085
- function codexMcpArgs(env2) {
5086
- const fields = [
5087
- `command=${tomlString("node")}`,
5088
- `args=[${tomlString(resolveMcpServerPath())}]`
5089
- ];
5090
- const entries = Object.entries(pickEnv(env2));
5091
- if (entries.length > 0) {
5092
- const inline = entries.map(([k, v]) => `${k}=${tomlString(v)}`).join(",");
5093
- fields.push(`env={${inline}}`);
5094
- }
5095
- return ["-c", `mcp_servers.runeya={${fields.join(",")}}`];
5096
- }
5097
- function tomlString(value) {
5098
- const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/[\u0000-\u001f\u007f]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
5099
- return `"${escaped}"`;
5100
- }
5101
-
5102
- // ../server/src/services/ai-runners/codex-app-server-client.ts
5103
5320
  function resolveMcpArgs(env2) {
5104
5321
  if (!env2["RUNEYA_API_TOKEN"]) return [];
5105
5322
  try {
@@ -5293,7 +5510,7 @@ async function shutdownCodexAppServer() {
5293
5510
  }
5294
5511
  }
5295
5512
  async function getAgentManager2() {
5296
- const { agentManager: agentManager2 } = await import("./agent-manager-QQPKKLKY.js");
5513
+ const { agentManager: agentManager2 } = await import("./agent-manager-SNVPZNLC.js");
5297
5514
  return agentManager2;
5298
5515
  }
5299
5516
  function parseRuneyaCurlCommand(command) {
@@ -5396,8 +5613,7 @@ var CodexRunner = class {
5396
5613
  this.lastThreadId = threadId;
5397
5614
  params.onThreadId?.(threadId);
5398
5615
  }
5399
- const apiDocs = buildApiDocs(apiBaseUrl, apiToken);
5400
- const systemParts = [systemContext, ...skipTokenInstructions ? [] : [TOKEN_INSTRUCTIONS], apiDocs].filter(Boolean);
5616
+ const systemParts = [systemContext, ...skipTokenInstructions ? [] : [TOKEN_INSTRUCTIONS]].filter(Boolean);
5401
5617
  const fullSystemContext = systemParts.join("\n\n");
5402
5618
  const fullPrompt = isResume && this.lastThreadId ? prompt : `${fullSystemContext}
5403
5619
 
@@ -5589,8 +5805,7 @@ ${prompt}`;
5589
5805
  this.lastThreadId = threadId;
5590
5806
  params.onThreadId?.(threadId);
5591
5807
  }
5592
- const apiDocs = buildApiDocs(apiBaseUrl, apiToken);
5593
- const systemParts = [systemContext, ...skipTokenInstructions ? [] : [TOKEN_INSTRUCTIONS], apiDocs].filter(Boolean);
5808
+ const systemParts = [systemContext, ...skipTokenInstructions ? [] : [TOKEN_INSTRUCTIONS]].filter(Boolean);
5594
5809
  const fullSystemContext = systemParts.join("\n\n");
5595
5810
  const fullPrompt = isResume && this.lastThreadId ? prompt : `${fullSystemContext}
5596
5811
 
@@ -5977,20 +6192,21 @@ async function* drainSession(session, signal, isReconnect) {
5977
6192
  if (signal?.aborted) return;
5978
6193
  }
5979
6194
  }
6195
+ async function kanbanContextFor(conv) {
6196
+ if (!conv?.kanbanBoardId) return "";
6197
+ const kanbanBoard = await kanbanStore.get(conv.kanbanBoardId);
6198
+ if (!kanbanBoard) return "";
6199
+ return "\n\n" + (conv.kanbanCardId ? await buildKanbanCardPrompt(kanbanBoard, conv.kanbanCardId) : generateKanbanPopulatePrompt(kanbanBoard));
6200
+ }
5980
6201
  async function buildCliSystemContext(conv, jwt) {
5981
6202
  const allServices = await serviceStore.list();
5982
6203
  const ref = conv ? await conversationStore.projectRefOf(conv) : null;
5983
6204
  const project = ref ? await projectStore.get(ref) : null;
5984
6205
  const ownServices = project ? allServices.filter((svc) => project.serviceIds.includes(svc.id)) : allServices;
5985
6206
  const resolvedServices = await Promise.all(ownServices.map(resolveServiceVariables));
5986
- let systemContext = generateAdminLlmsTxt(resolvedServices, jwt);
6207
+ let systemContext = generateAdminLlmsTxt(resolvedServices, jwt, project);
5987
6208
  if (!conv?.isCompanion) systemContext += "\n\n" + companionSystemNote();
5988
- if (conv?.kanbanBoardId) {
5989
- const kanbanBoard = await kanbanStore.get(conv.kanbanBoardId);
5990
- if (kanbanBoard) {
5991
- systemContext += "\n\n" + (conv.kanbanCardId ? await buildKanbanCardPrompt(kanbanBoard, conv.kanbanCardId) : generateKanbanPopulatePrompt(kanbanBoard));
5992
- }
5993
- }
6209
+ systemContext += await kanbanContextFor(conv);
5994
6210
  return systemContext;
5995
6211
  }
5996
6212
  async function resolveInjectedEnv(environmentId) {
@@ -6017,15 +6233,12 @@ async function startClaudeCodeSession(convId, prompt, opts = {}) {
6017
6233
  conversationStore.update(conv.id, { messages: conv.messages }, { silent: true }).catch(() => {
6018
6234
  });
6019
6235
  const systemContext = await buildCliSystemContext(conv, opts.jwt);
6020
- const mcpServerPath = fileURLToPath2(new URL("../mcp-server/index.js", import.meta.url));
6021
- const mcpConfig = JSON.stringify({
6022
- mcpServers: {
6023
- runeya: {
6024
- command: "node",
6025
- args: [mcpServerPath],
6026
- env: { RUNEYA_BASE_URL: `http://localhost:${env.PORT}`, ...opts.jwt ? { RUNEYA_API_TOKEN: opts.jwt } : {} }
6027
- }
6028
- }
6236
+ const mcpRef = conv ? await conversationStore.projectRefOf(conv) : null;
6237
+ const mcpConfig = runeyaMcpConfig({
6238
+ RUNEYA_BASE_URL: `http://localhost:${env.PORT}`,
6239
+ ...opts.jwt ? { RUNEYA_API_TOKEN: opts.jwt } : {},
6240
+ ...mcpRef?.id ? { RUNEYA_PROJECT_ID: mcpRef.id } : {},
6241
+ ...mcpRef?.orgId ? { RUNEYA_ORG_ID: mcpRef.orgId } : {}
6029
6242
  });
6030
6243
  const ac = new AbortController();
6031
6244
  const session = activeSessionRegistry.registerProviderApiSession(convId, ac);
@@ -6045,6 +6258,8 @@ async function startClaudeCodeSession(convId, prompt, opts = {}) {
6045
6258
  systemContext,
6046
6259
  apiBaseUrl: `http://localhost:${env.PORT}`,
6047
6260
  apiToken: opts.jwt ?? "",
6261
+ ...mcpRef?.id ? { projectId: mcpRef.id } : {},
6262
+ ...mcpRef?.orgId ? { orgId: mcpRef.orgId } : {},
6048
6263
  model: opts.model ?? "claude-opus-4-6",
6049
6264
  effort: opts.effort ?? "normal",
6050
6265
  signal: ac.signal,
@@ -6322,9 +6537,43 @@ var chatRouter = router({
6322
6537
  companionDelivery: protectedProcedure.input(z5.object({ id: Id128Schema })).query(async ({ input }) => {
6323
6538
  const conv = await conversationStore.get(input.id);
6324
6539
  const companionId = conv?.companionConversationId;
6325
- const running = companionId ? activeSessionRegistry.get(companionId)?.status === "running" : false;
6540
+ const running = isCompanionThinking(input.id) || (companionId ? activeSessionRegistry.get(companionId)?.status === "running" : false);
6326
6541
  return { delivery: lastCompanionDelivery(input.id), running };
6327
6542
  }),
6543
+ /**
6544
+ * Le flux des conversations dont le compagnon relit, à cet instant.
6545
+ *
6546
+ * Remplace le sondage de `companionDelivery.running` : un état qui ne
6547
+ * change que deux fois par tour n'a pas à être redemandé toutes les
6548
+ * 1,5 s — et une relecture plus courte que cette période passait
6549
+ * inaperçue. La liste entière est renvoyée à chaque fois, comme
6550
+ * `kanbanQueue.onChanged` : elle tient en quelques identifiants, et un
6551
+ * client qui se branche en cours de route reçoit l'état complet plutôt
6552
+ * que la prochaine transition.
6553
+ */
6554
+ onCompanionThinking: protectedProcedure.subscription(async function* () {
6555
+ const queue = [companionThinkingIds()];
6556
+ let resolve3 = null;
6557
+ const handler = () => {
6558
+ if (queue.length >= 50) queue.shift();
6559
+ queue.push(companionThinkingIds());
6560
+ if (resolve3) {
6561
+ resolve3();
6562
+ resolve3 = null;
6563
+ }
6564
+ };
6565
+ const unsubscribe = onCompanionThinkingChanged(handler);
6566
+ try {
6567
+ while (true) {
6568
+ if (queue.length > 0) yield { thinking: queue.shift() };
6569
+ else await new Promise((r) => {
6570
+ resolve3 = r;
6571
+ });
6572
+ }
6573
+ } finally {
6574
+ unsubscribe();
6575
+ }
6576
+ }),
6328
6577
  /**
6329
6578
  * Envoyer un message de test par le pont du compagnon.
6330
6579
  *
@@ -6512,25 +6761,14 @@ Return ONLY the improved text, no explanation, no preamble.`;
6512
6761
  const cliPrompt = input.contextNote ? `${input.contextNote}
6513
6762
 
6514
6763
  ${input.prompt}` : input.prompt;
6515
- const allServices = await serviceStore.list();
6516
- const resolvedServices = await Promise.all(allServices.map(resolveServiceVariables));
6517
6764
  const jwt = ctx.authorization?.startsWith("Bearer ") ? ctx.authorization.slice(7) : void 0;
6518
- let systemContext = generateAdminLlmsTxt(resolvedServices, jwt);
6519
- if (conv.kanbanBoardId) {
6520
- const kanbanBoard = await kanbanStore.get(conv.kanbanBoardId);
6521
- if (kanbanBoard) {
6522
- systemContext += "\n\n" + (conv.kanbanCardId ? await buildKanbanCardPrompt(kanbanBoard, conv.kanbanCardId) : generateKanbanPopulatePrompt(kanbanBoard));
6523
- }
6524
- }
6525
- const mcpServerPath = fileURLToPath2(new URL("../mcp-server/index.js", import.meta.url));
6526
- const mcpConfig = JSON.stringify({
6527
- mcpServers: {
6528
- runeya: {
6529
- command: "node",
6530
- args: [mcpServerPath],
6531
- env: { RUNEYA_BASE_URL: `http://localhost:${env.PORT}`, ...jwt ? { RUNEYA_API_TOKEN: jwt } : {} }
6532
- }
6533
- }
6765
+ const systemContext = await buildCliSystemContext(conv, jwt);
6766
+ const mcpRef = await conversationStore.projectRefOf(conv);
6767
+ const mcpConfig = runeyaMcpConfig({
6768
+ RUNEYA_BASE_URL: `http://localhost:${env.PORT}`,
6769
+ ...jwt ? { RUNEYA_API_TOKEN: jwt } : {},
6770
+ ...mcpRef?.id ? { RUNEYA_PROJECT_ID: mcpRef.id } : {},
6771
+ ...mcpRef?.orgId ? { RUNEYA_ORG_ID: mcpRef.orgId } : {}
6534
6772
  });
6535
6773
  const imagePaths = [];
6536
6774
  if (input.imageIds && input.imageIds.length > 0) {
@@ -6566,6 +6804,8 @@ ${imagePaths.map((p) => `Image: ${p}`).join("\n")}` : cliPrompt;
6566
6804
  systemContext,
6567
6805
  apiBaseUrl: `http://localhost:${env.PORT}`,
6568
6806
  apiToken: jwt ?? "",
6807
+ ...mcpRef?.id ? { projectId: mcpRef.id } : {},
6808
+ ...mcpRef?.orgId ? { orgId: mcpRef.orgId } : {},
6569
6809
  model: input.model ?? "claude-opus-4-6",
6570
6810
  effort: input.effort ?? "normal",
6571
6811
  signal: ac.signal,
@@ -6628,16 +6868,8 @@ ${imagePaths.map((p) => `Image: ${p}`).join("\n")}` : cliPrompt;
6628
6868
  const cliPrompt = input.contextNote ? `${input.contextNote}
6629
6869
 
6630
6870
  ${input.prompt}` : input.prompt;
6631
- const allServices = await serviceStore.list();
6632
- const resolvedServices = await Promise.all(allServices.map(resolveServiceVariables));
6633
6871
  const jwt = ctx.authorization?.startsWith("Bearer ") ? ctx.authorization.slice(7) : void 0;
6634
- let systemContext = generateAdminLlmsTxt(resolvedServices, jwt);
6635
- if (conv.kanbanBoardId) {
6636
- const kanbanBoard = await kanbanStore.get(conv.kanbanBoardId);
6637
- if (kanbanBoard) {
6638
- systemContext += "\n\n" + (conv.kanbanCardId ? await buildKanbanCardPrompt(kanbanBoard, conv.kanbanCardId) : generateKanbanPopulatePrompt(kanbanBoard));
6639
- }
6640
- }
6872
+ const systemContext = await buildCliSystemContext(conv, jwt);
6641
6873
  const resolvedImages = input.imageIds && input.imageIds.length > 0 ? await resolveImagesToBase64(input.imageIds.map((id) => ({ imageId: id, mimeType: "" })), input.conversationId) : [];
6642
6874
  const convId = input.conversationId;
6643
6875
  const ac = new AbortController();
@@ -6727,12 +6959,7 @@ ${input.prompt}` : input.prompt;
6727
6959
  const authToken = ctx.authorization?.replace(/^Bearer\s+/i, "") ?? "";
6728
6960
  let system = await buildSystemPrompt(apiKey);
6729
6961
  system += "\n\n" + TOOL_SAFETY_INSTRUCTION;
6730
- if (conv && conv.kanbanBoardId) {
6731
- const kanbanBoard = await kanbanStore.get(conv.kanbanBoardId);
6732
- if (kanbanBoard) {
6733
- system += "\n\n" + (conv.kanbanCardId ? await buildKanbanCardPrompt(kanbanBoard, conv.kanbanCardId) : generateKanbanPopulatePrompt(kanbanBoard));
6734
- }
6735
- }
6962
+ system += await kanbanContextFor(conv);
6736
6963
  const resolvedImages = input.imageIds && input.imageIds.length > 0 ? await resolveImagesToBase64(input.imageIds.map((id) => ({ imageId: id, mimeType: "" })), input.conversationId) : [];
6737
6964
  let session;
6738
6965
  try {
@@ -6880,20 +7107,14 @@ ${input.prompt}` : input.prompt;
6880
7107
  if (input.model) args.push("--model", input.model);
6881
7108
  args.push("--dangerously-skip-permissions");
6882
7109
  }
7110
+ const ptyConv = input.sessionId ? await conversationStore.get(input.sessionId).catch(() => null) : null;
7111
+ const ptyRef = (ptyConv ? await conversationStore.projectRefOf(ptyConv) : null) ?? (input.projectId ? { id: input.projectId, orgId: input.orgId ?? null } : null);
6883
7112
  const jwt = ctx.authorization?.startsWith("Bearer ") ? ctx.authorization.slice(7) : void 0;
6884
- if (!isCodex && input.sessionId) {
7113
+ if (!isCodex && ptyConv) {
6885
7114
  try {
6886
- const conv = await conversationStore.get(input.sessionId);
6887
- if (conv) {
6888
- const systemContext = await buildCliSystemContext(conv, jwt);
6889
- const apiBase = input.apiBaseUrl ?? `http://localhost:${env.PORT}`;
6890
- const apiDocs = buildApiDocs(apiBase, jwt ?? "");
6891
- const fullSystemPrompt = apiDocs ? `${systemContext}
6892
-
6893
- ${apiDocs}` : systemContext;
6894
- if (fullSystemPrompt.trim().length > 0) {
6895
- args.push("--append-system-prompt", fullSystemPrompt);
6896
- }
7115
+ const systemContext = await buildCliSystemContext(ptyConv, jwt);
7116
+ if (systemContext.trim().length > 0) {
7117
+ args.push("--append-system-prompt", systemContext);
6897
7118
  }
6898
7119
  } catch (err) {
6899
7120
  console.warn("[chat.pty.start] buildCliSystemContext failed:", err.message);
@@ -6925,7 +7146,9 @@ ${apiDocs}` : systemContext;
6925
7146
  sessionId: input.sessionId,
6926
7147
  enableMcp: input.enableMcp,
6927
7148
  mcpApiBaseUrl: input.apiBaseUrl ?? `http://localhost:${env.PORT}`,
6928
- mcpApiToken: jwt
7149
+ mcpApiToken: jwt,
7150
+ ...ptyRef?.id ? { mcpProjectId: ptyRef.id } : {},
7151
+ ...ptyRef?.orgId ? { mcpOrgId: ptyRef.orgId } : {}
6929
7152
  }
6930
7153
  );
6931
7154
  lap("agent ai.spawnPty");
@@ -7282,4 +7505,4 @@ export {
7282
7505
  startCliSession,
7283
7506
  chatRouter
7284
7507
  };
7285
- //# sourceMappingURL=chunk-R23UUB5R.js.map
7508
+ //# sourceMappingURL=chunk-57NU22TS.js.map