decocms 4.168.1 → 4.169.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/README.md +1 -0
  2. package/dist/client/assets/{AlertCircle-WkAXz2RU.js → AlertCircle-BHQjUcef.js} +1 -1
  3. package/dist/client/assets/{AreaChart-wztQY_jC.js → AreaChart-l3T-nMKm.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-BWPRRURB.js → ArrowUp-Dj-cFAwv.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-h7SI5tgQ.js → ArrowUpRight-Y5hPCdzr.js} +1 -1
  6. package/dist/client/assets/{Check-mipwIsiZ.js → Check-CSyoUAf4.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-CWdBsPjp.js → CheckCircle-janeTcXa.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-Dnan0MwC.js → ChevronDown-CzvzcnHE.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-DP5hU4SR.js → ChevronRight-DBis8PDW.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-Txu-HIi-.js → ChevronUp-B-NKfo1g.js} +1 -1
  11. package/dist/client/assets/{Copy01-4iyXnjfm.js → Copy01-8C9VbGWL.js} +1 -1
  12. package/dist/client/assets/{CpuChip01-BBZpuyCu.js → CpuChip01-A8bcIFzB.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-CRhNFXQE.js → DotsVertical-BdE4_w9h.js} +1 -1
  14. package/dist/client/assets/{Eye-CSIx21VU.js → Eye-EvVbP4rR.js} +1 -1
  15. package/dist/client/assets/{FilterLines-B66_Mr2s.js → FilterLines-Gaw0UmED.js} +1 -1
  16. package/dist/client/assets/{HardDrive-Mn0hQUbu.js → HardDrive-C_qMCg5y.js} +1 -1
  17. package/dist/client/assets/{Key01-DYIDo6qe.js → Key01-Bfcda0jJ.js} +1 -1
  18. package/dist/client/assets/{LayoutLeft-BsA_Lgfv.js → LayoutLeft-BdRKWF_p.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-CqtooIkU.js → LinkExternal01-CobVwvk5.js} +1 -1
  20. package/dist/client/assets/{LogOut01-Dc85flmk.js → LogOut01-doI_2tq1.js} +1 -1
  21. package/dist/client/assets/{Monitor01-DTCgg1aj.js → Monitor01-BFfrIAEb.js} +1 -1
  22. package/dist/client/assets/{Palette-oZDmCbQY.js → Palette-Aamq_16P.js} +1 -1
  23. package/dist/client/assets/{Play-h71-fqG0.js → Play-DfCnwo1c.js} +1 -1
  24. package/dist/client/assets/{Plus-C_u5dTsJ.js → Plus-CPpb1y_T.js} +1 -1
  25. package/dist/client/assets/{SearchLg-B662t84Q.js → SearchLg-CWWzlUvD.js} +1 -1
  26. package/dist/client/assets/{SearchMd-BpkGwSZm.js → SearchMd-BCWVjSri.js} +1 -1
  27. package/dist/client/assets/{Settings02-Dck4h0cx.js → Settings02-pC2SAFuD.js} +1 -1
  28. package/dist/client/assets/{Shield01-H03t1WVA.js → Shield01-CFZIhAYB.js} +1 -1
  29. package/dist/client/assets/{Star01-wDPtGKC-.js → Star01-WnnjHkp9.js} +1 -1
  30. package/dist/client/assets/{Stars01-CDy5PQBZ.js → Stars01-BGA48AlN.js} +1 -1
  31. package/dist/client/assets/{Stars02-DtZzsS_i.js → Stars02-B7Z_FmwK.js} +1 -1
  32. package/dist/client/assets/{Sun-DuZrrKQn.js → Sun-BX81qTgU.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-Z39XMBu7.js → SwitchHorizontal01-D2aK9o1v.js} +1 -1
  34. package/dist/client/assets/{Tool01-B2hCitBT.js → Tool01-B4WsGGMZ.js} +1 -1
  35. package/dist/client/assets/{Tool02-BBTwlu3y.js → Tool02-BngdhbjZ.js} +1 -1
  36. package/dist/client/assets/{Trash01-BxSBp2I9.js → Trash01-K_-17n2i.js} +1 -1
  37. package/dist/client/assets/{TrendUp01-DoSUuden.js → TrendUp01-_rLV-_oy.js} +1 -1
  38. package/dist/client/assets/{Upload01-BTWyzOkt.js → Upload01-C595E5Fz.js} +1 -1
  39. package/dist/client/assets/{User01-DuewQHnM.js → User01-Chdj0dm8.js} +1 -1
  40. package/dist/client/assets/{Users01-ZujaqEUq.js → Users01-CCeCEY4G.js} +1 -1
  41. package/dist/client/assets/{Users03-Dz_s-C9y.js → Users03-DJ9QTo8l.js} +1 -1
  42. package/dist/client/assets/{X-DeSUhPjd.js → X-DiL2Rl_p.js} +1 -1
  43. package/dist/client/assets/{XCircle-BnZZm3Dr.js → XCircle-CDV12pjf.js} +1 -1
  44. package/dist/client/assets/{XClose-DJ8jN_e6.js → XClose-norW3ist.js} +1 -1
  45. package/dist/client/assets/{Zap-BRQ9CERg.js → Zap-UFgvYSLH.js} +1 -1
  46. package/dist/client/assets/{ZapSquare-NV_WZQtI.js → ZapSquare-IFLfTQf2.js} +1 -1
  47. package/dist/client/assets/{access-gate-Dm6SFJ7F.js → access-gate-DGUL_UcD.js} +1 -1
  48. package/dist/client/assets/{add-section-modal-DaX8--qz.js → add-section-modal-DTq5sMKM.js} +1 -1
  49. package/dist/client/assets/{agent-icon-yqjnsWjp.js → agent-icon-zT-2RUx7.js} +1 -1
  50. package/dist/client/assets/{agents-list-DUOFdJ6G.js → agents-list-DBDEVL02.js} +1 -1
  51. package/dist/client/assets/ai-providers-BRzUDSVT.js +1 -0
  52. package/dist/client/assets/{alert-BcIewVTs.js → alert-BB3xGluS.js} +1 -1
  53. package/dist/client/assets/{alert-dialog-AsnK1y5X.js → alert-dialog-Cene-7ya.js} +1 -1
  54. package/dist/client/assets/{app-editor-auRmXTru.js → app-editor-CZFvukFx.js} +1 -1
  55. package/dist/client/assets/{auth-CoGYzQ9z.js → auth-CU2bavW6.js} +1 -1
  56. package/dist/client/assets/{auth-catchall-DD0XZsg7.js → auth-catchall-BK249rmi.js} +1 -1
  57. package/dist/client/assets/{auth-entry-nQZ4mUfT.js → auth-entry-BN-iHbys.js} +1 -1
  58. package/dist/client/assets/{auth-split-layout-DSGIqXxy.js → auth-split-layout-BP1XC8RF.js} +1 -1
  59. package/dist/client/assets/{authenticate-and-persist-oauth-8fUEbwAP.js → authenticate-and-persist-oauth-WxZneatC.js} +1 -1
  60. package/dist/client/assets/{automation-list-row-CdMY8eoF.js → automation-list-row-DG0u7EnC.js} +1 -1
  61. package/dist/client/assets/{automation-runs-C5rqDXdA.js → automation-runs-BZvstwOZ.js} +10 -10
  62. package/dist/client/assets/{automations-DTv5NnjN.js → automations-BYxmkEsd.js} +1 -1
  63. package/dist/client/assets/{avatar-CqYevBdO.js → avatar-WftJ6-cv.js} +1 -1
  64. package/dist/client/assets/{badge-DR3fwt69.js → badge-CngbfVN3.js} +1 -1
  65. package/dist/client/assets/{block-document-DuYCWXo8.js → block-document-D3zId0t2.js} +1 -1
  66. package/dist/client/assets/{brand-context-1IF7TYyp.js → brand-context-DR22dUFM.js} +1 -1
  67. package/dist/client/assets/{buckets-DbvtNg26.js → buckets-CChnFANR.js} +1 -1
  68. package/dist/client/assets/{bulk-category-panel-BGox9OpC.js → bulk-category-panel-DlGXsJrs.js} +1 -1
  69. package/dist/client/assets/{calendar-Bobc7JsB.js → calendar-CsGWZ_S6.js} +1 -1
  70. package/dist/client/assets/{capability-load-error-0y1ODtOx.js → capability-load-error-BcUvQo1M.js} +1 -1
  71. package/dist/client/assets/{card-CW-_G833.js → card-ClYuWJUa.js} +1 -1
  72. package/dist/client/assets/{category-editor-DKbhj7ri.js → category-editor-C2M1K5r7.js} +1 -1
  73. package/dist/client/assets/chat-context-CF6DlBKA.js +35 -0
  74. package/dist/client/assets/{checkbox-CCyUx_cq.js → checkbox-Bh4CEti1.js} +1 -1
  75. package/dist/client/assets/{cli-auth-success-CXOnN2qg.js → cli-auth-success-J_4myM4V.js} +1 -1
  76. package/dist/client/assets/{collection-detail-DTED7bJ0.js → collection-detail-C_uKdK0e.js} +1 -1
  77. package/dist/client/assets/{collection-display-button-C1tz1Oa_.js → collection-display-button-h_MqjIGa.js} +1 -1
  78. package/dist/client/assets/{collection-search-DrF2Xdn3.js → collection-search-BPsHlues.js} +1 -1
  79. package/dist/client/assets/{collection-table-wrapper-C1uwKgw7.js → collection-table-wrapper-EuJPoGLv.js} +1 -1
  80. package/dist/client/assets/{collection-tabs-CWKAIWhV.js → collection-tabs-B4btCcQK.js} +1 -1
  81. package/dist/client/assets/{command-G3lehgDJ.js → command-CEwrg9I3.js} +1 -1
  82. package/dist/client/assets/{commerce-onboarding-V0jS1qPt.js → commerce-onboarding-Bcs4XvA5.js} +1 -1
  83. package/dist/client/assets/{companions-core-DcHzWOjX.js → companions-core-CgvTY-LL.js} +1 -1
  84. package/dist/client/assets/{connect-D01RYvRB.js → connect-BoicHjh_.js} +1 -1
  85. package/dist/client/assets/{connection-BgBxArCy.js → connection-CvvO_ps_.js} +1 -1
  86. package/dist/client/assets/{connection-card-BhaJe4Zb.js → connection-card-B95sNnDR.js} +1 -1
  87. package/dist/client/assets/{connection-detail-Byw-N1Bo.js → connection-detail-BmjJdTKV.js} +1 -1
  88. package/dist/client/assets/{connection-form-helpers-qxpxoBd5.js → connection-form-helpers-CkZhYHbj.js} +1 -1
  89. package/dist/client/assets/{connections-Ckul7hz4.js → connections-MUVwsnZL.js} +1 -1
  90. package/dist/client/assets/{decopilot-sse-pool-Bt8CbWLu.js → decopilot-sse-pool-waZ_rU9X.js} +1 -1
  91. package/dist/client/assets/{dialog-DqCa3fYo.js → dialog-DuRT12ix.js} +1 -1
  92. package/dist/client/assets/{domain-settings-CBLWJNaO.js → domain-settings-B3Na6PzM.js} +1 -1
  93. package/dist/client/assets/{drawer-C6VPAiPU.js → drawer-sfBh0-Fv.js} +1 -1
  94. package/dist/client/assets/{dropdown-menu-CF4rG0lW.js → dropdown-menu-CsjV1r80.js} +1 -1
  95. package/dist/client/assets/{empty-state-DBEDb5Fh.js → empty-state-D6MRkxtc.js} +1 -1
  96. package/dist/client/assets/{extract-connection-data-y_A75pXj.js → extract-connection-data-DOJCD4gJ.js} +1 -1
  97. package/dist/client/assets/{file-explorer-BXQ9vha-.js → file-explorer-BVtEaAXh.js} +1 -1
  98. package/dist/client/assets/{form-D5M3-8Om.js → form-CY4eVoPQ.js} +1 -1
  99. package/dist/client/assets/{general-B3anFwA8.js → general-uJAjf1TQ.js} +1 -1
  100. package/dist/client/assets/{github-repo-picker-BEpfcd_M.js → github-repo-picker-BiXEMaAr.js} +1 -1
  101. package/dist/client/assets/{hooks-BTOG4zaW.js → hooks-dHIdKcw0.js} +6 -6
  102. package/dist/client/assets/{index-Bw84LEjy.js → index-BE9BOpQs.js} +27 -27
  103. package/dist/client/assets/{index-wEB1M33V.js → index-BgtTeA9z.js} +1 -1
  104. package/dist/client/assets/{index-CZNDmjRz.js → index-C9dQEl37.js} +1 -1
  105. package/dist/client/assets/{index-CFJi2rll.js → index-CSXauqf7.js} +1 -1
  106. package/dist/client/assets/{index-Dqj3oyWO.js → index-CU5TPed0.js} +1 -1
  107. package/dist/client/assets/{index-Bj2l7mXt.js → index-CgAQSnkZ.js} +7 -7
  108. package/dist/client/assets/{index-DHxh9ayD.js → index-Dajxa_Es.js} +1 -1
  109. package/dist/client/assets/{index-Aanb-g8m.js → index-DtUPhr8V.js} +1 -1
  110. package/dist/client/assets/index-GilS3VqV.css +1 -0
  111. package/dist/client/assets/{index-B9qikq7g.js → index-_J6TZRhY.js} +3 -3
  112. package/dist/client/assets/{index-B0kDCBhT.js → index-mqZ-uRip.js} +1 -1
  113. package/dist/client/assets/{index-redirect-DhLs8yyu.js → index-redirect-Y4ChBzWT.js} +1 -1
  114. package/dist/client/assets/{index-CzT5Vk0B.js → index-to_1Kzx7.js} +1 -1
  115. package/dist/client/assets/{input-BzEnzzLJ.js → input-CHE0hHBC.js} +1 -1
  116. package/dist/client/assets/{integration-icon-CXLPDhGZ.js → integration-icon-D2mH-Jkd.js} +1 -1
  117. package/dist/client/assets/{invite-member-dialog-BQMrQZyT.js → invite-member-dialog-CqzNxjME.js} +1 -1
  118. package/dist/client/assets/{label-CGQ3_4Sc.js → label-DwVnbuko.js} +1 -1
  119. package/dist/client/assets/{layout-C4K4X6oJ.js → layout-Caoz8ush.js} +1 -1
  120. package/dist/client/assets/{login-BpzxrSny.js → login-BKYs4uy1.js} +1 -1
  121. package/dist/client/assets/{mcp-oauth-RhPzgMbg.js → mcp-oauth-DQ2pY9Pk.js} +1 -1
  122. package/dist/client/assets/members-Dct86MXi.js +1 -0
  123. package/dist/client/assets/{monaco-editor-H35EnaEI.js → monaco-editor-Dj-IdsHa.js} +1 -1
  124. package/dist/client/assets/{monitoring-stats-row-DYUcKBt7.js → monitoring-stats-row-Cre2etB8.js} +1 -1
  125. package/dist/client/assets/{multi-select-Bx7BW17a.js → multi-select-CFkntjz3.js} +1 -1
  126. package/dist/client/assets/{oauth-callback-C0JUjJBW.js → oauth-callback-HRS7qtkR.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-ai-provider-B_2v7uo-.js → oauth-callback-ai-provider-DrFdY2c1.js} +1 -1
  128. package/dist/client/assets/{onboarding-CFYF1hJy.js → onboarding-Cr1K0J8J.js} +1 -1
  129. package/dist/client/assets/{org-layout-BXN20r1P.js → org-layout-DaSkvfvO.js} +1 -1
  130. package/dist/client/assets/{organization-choice-C5jqBM93.js → organization-choice-Dyq7bKZl.js} +1 -1
  131. package/dist/client/assets/{orgs-gbzQA7eG.js → orgs-BxC49mPC.js} +1 -1
  132. package/dist/client/assets/{page-seo-form-sS1bBOxu.js → page-seo-form-ldbyqodA.js} +1 -1
  133. package/dist/client/assets/{popover-BlxZ1ohp.js → popover-EJdSdU2R.js} +1 -1
  134. package/dist/client/assets/{post-editor-6S5kWvEA.js → post-editor-DvrgHaCl.js} +1 -1
  135. package/dist/client/assets/{primitives-C1PbH_0j.js → primitives-DZBu37jf.js} +1 -1
  136. package/dist/client/assets/{profile-DhuTsmnR.js → profile-4lm5h4pF.js} +1 -1
  137. package/dist/client/assets/project-app-view-CgZmXp9l.js +1 -0
  138. package/dist/client/assets/record-editor-7dsCFH8x.js +1 -0
  139. package/dist/client/assets/{redirect-editor-CS6H6qKg.js → redirect-editor-Cw3SjuOc.js} +1 -1
  140. package/dist/client/assets/registry-CzjAuK1P.js +2 -0
  141. package/dist/client/assets/{registry-layout-BS9_TH1q.js → registry-layout-CTZB8f0R.js} +1 -1
  142. package/dist/client/assets/{reports-D-AFa-2o.js → reports-BXEV0yfu.js} +1 -1
  143. package/dist/client/assets/{require-capability-DBzjOvlq.js → require-capability-DrkYr70Z.js} +1 -1
  144. package/dist/client/assets/{required-auth-layout-Cq_mpgio.js → required-auth-layout-B6vtrKAD.js} +1 -1
  145. package/dist/client/assets/{reset-password-xbe2EKA2.js → reset-password-p-3CwomQ.js} +1 -1
  146. package/dist/client/assets/roles-CmuBIJp8.js +1 -0
  147. package/dist/client/assets/{search-input--RCGlyBq.js → search-input-DHP5_Hg7.js} +1 -1
  148. package/dist/client/assets/{secrets-CO4Pfk96.js → secrets-DC_R2-bM.js} +1 -1
  149. package/dist/client/assets/{sections-editor-Bs_xTo2x.js → sections-editor-FZrSIhzS.js} +1 -1
  150. package/dist/client/assets/{select-CGa1tZbM.js → select-DX4-JeQs.js} +1 -1
  151. package/dist/client/assets/{select-model-CS5i6otK.js → select-model-BWniT-zS.js} +1 -1
  152. package/dist/client/assets/{self-tool-result-CKWAU89E.js → self-tool-result-CQ5bxpQJ.js} +1 -1
  153. package/dist/client/assets/{seo-editor-BdOwOG_u.js → seo-editor-CTb7kcqp.js} +1 -1
  154. package/dist/client/assets/{settings-layout-CYQt0upN.js → settings-layout-Bd8sXbF-.js} +1 -1
  155. package/dist/client/assets/{settings-section-Dya12h7y.js → settings-section-3OqkMxsU.js} +1 -1
  156. package/dist/client/assets/{shell-controls-Y8vkXyDx.js → shell-controls-DX6d19p1.js} +1 -1
  157. package/dist/client/assets/{shell-layout-0HUOQpeA.js → shell-layout-C54fW9fN.js} +1 -1
  158. package/dist/client/assets/{sidebar-COQz-BQQ.js → sidebar-CSmYAwNE.js} +1 -1
  159. package/dist/client/assets/{skeleton-speSw7jS.js → skeleton-CF1G_JNJ.js} +1 -1
  160. package/dist/client/assets/{spinner-OTHCtfE-.js → spinner-BCrFtw47.js} +1 -1
  161. package/dist/client/assets/{sso-CkbVWHSh.js → sso-BUmcP8uB.js} +1 -1
  162. package/dist/client/assets/{store-C_EU1TBv.js → store-BlSIrn0n.js} +1 -1
  163. package/dist/client/assets/store-registry-a9DCucZk.js +2 -0
  164. package/dist/client/assets/{studio-tools-DUEQ1gbG.js → studio-tools-Dt_Nz2ZR.js} +1 -1
  165. package/dist/client/assets/{switch-x6WesByc.js → switch-Dq88gwUX.js} +1 -1
  166. package/dist/client/assets/{tab-id-OJbWUe7k.js → tab-id-C3dMkfSN.js} +1 -1
  167. package/dist/client/assets/{table-CXEzP7jF.js → table-DtnFgt1P.js} +1 -1
  168. package/dist/client/assets/{tabs-B-89PRzy.js → tabs-CvLevm39.js} +1 -1
  169. package/dist/client/assets/{textarea-DQkn5itu.js → textarea-P9iZqCQw.js} +1 -1
  170. package/dist/client/assets/{toggle-group-BCnSbCmi.js → toggle-group-Cp18zHbL.js} +1 -1
  171. package/dist/client/assets/{toolbar-CcZtWqdd.js → toolbar-CTFRzgG_.js} +1 -1
  172. package/dist/client/assets/{tooltip-3TZapsA0.js → tooltip-CPzDr35B.js} +1 -1
  173. package/dist/client/assets/{use-ai-providers-C2ddm__5.js → use-ai-providers-BVqvTgTt.js} +1 -1
  174. package/dist/client/assets/{use-automations-C7XZ_3Xs.js → use-automations-yaXDjUyj.js} +1 -1
  175. package/dist/client/assets/{use-autosave-CertWS8o.js → use-autosave-CWn6eQzu.js} +1 -1
  176. package/dist/client/assets/{use-capability-D7czuGny.js → use-capability-Bx3Aous3.js} +1 -1
  177. package/dist/client/assets/{use-clock-tick-DZFvErxX.js → use-clock-tick-3BC52fl2.js} +1 -1
  178. package/dist/client/assets/{use-connection-CQqi_Wkc.js → use-connection-waGAP3_8.js} +1 -1
  179. package/dist/client/assets/{use-copy-CJnQWs4J.js → use-copy-DdYavl9J.js} +1 -1
  180. package/dist/client/assets/{use-create-virtual-mcp-CQTVM0FK.js → use-create-virtual-mcp-Do3eak_a.js} +1 -1
  181. package/dist/client/assets/{use-debounced-autosave-CiszpXLt.js → use-debounced-autosave-Cz0m2SIt.js} +1 -1
  182. package/dist/client/assets/{use-debounced-value-B_ZbpgeP.js → use-debounced-value-CawzPtuY.js} +1 -1
  183. package/dist/client/assets/{use-deco-credits-jm9-o-ET.js → use-deco-credits-BZW42SVE.js} +1 -1
  184. package/dist/client/assets/{use-decopilot-events-CmG4ynOG.js → use-decopilot-events-uIvxhgZU.js} +1 -1
  185. package/dist/client/assets/{use-delete-connection-BBkEkrdt.js → use-delete-connection-DKkCdJK4.js} +1 -1
  186. package/dist/client/assets/{use-deployment-admin-Cg8_MC5r.js → use-deployment-admin-1Q_zx2o6.js} +1 -1
  187. package/dist/client/assets/{use-file-configs-C562fC2W.js → use-file-configs-5np55VXP.js} +1 -1
  188. package/dist/client/assets/{use-infinite-scroll-D8kUhuXF.js → use-infinite-scroll-DxyVjvA-.js} +1 -1
  189. package/dist/client/assets/{use-join-requests-Bv0i_YSP.js → use-join-requests-BrWdODmX.js} +1 -1
  190. package/dist/client/assets/{use-mcp-auth-status-gG4o_Hy1.js → use-mcp-auth-status-BJEHQ79H.js} +1 -1
  191. package/dist/client/assets/{use-mcp-client-DokdZWXf.js → use-mcp-client-B4o54gkr.js} +1 -1
  192. package/dist/client/assets/{use-mcp-tools-CcLpXWiY.js → use-mcp-tools-BpXABiGW.js} +1 -1
  193. package/dist/client/assets/{use-members-DhQLLXXS.js → use-members-BluEn-Xz.js} +1 -1
  194. package/dist/client/assets/{use-mobile-DEX6Ai9c.js → use-mobile-DdpcC-kW.js} +1 -1
  195. package/dist/client/assets/{use-navigate-to-agent-C301_9rI.js → use-navigate-to-agent-CriTJ4nX.js} +1 -1
  196. package/dist/client/assets/{use-org-auth-client-DrMUM7CX.js → use-org-auth-client-7VI-2ivW.js} +1 -1
  197. package/dist/client/assets/{use-org-sso-3SHSn2Zq.js → use-org-sso-gASlJc1Y.js} +1 -1
  198. package/dist/client/assets/{use-organization-roles-C7BG2DsY.js → use-organization-roles-CsNvvbTO.js} +1 -1
  199. package/dist/client/assets/{use-organization-settings-BILVfsIn.js → use-organization-settings-8VLD97hQ.js} +1 -1
  200. package/dist/client/assets/{use-registry-connections-TdM8qlB1.js → use-registry-connections-KqDKYhMW.js} +1 -1
  201. package/dist/client/assets/{use-secrets-C_G0vrkb.js → use-secrets-ByliR705.js} +1 -1
  202. package/dist/client/assets/{use-status-sounds-D0UZfmZi.js → use-status-sounds-BXJXMeiE.js} +1 -1
  203. package/dist/client/assets/{use-tags-CsyogmW0.js → use-tags-syMz2bE_.js} +1 -1
  204. package/dist/client/assets/{use-view-mode-CxS4aM25.js → use-view-mode-CBc8_c7H.js} +1 -1
  205. package/dist/client/assets/{use-virtual-mcp-6AQrTwof.js → use-virtual-mcp-CLnDaYb3.js} +1 -1
  206. package/dist/client/assets/useInfiniteQuery-CgqG_-vz.js +1 -0
  207. package/dist/client/assets/{useQueries-hZE-NvWG.js → useQueries-nGThkn2V.js} +1 -1
  208. package/dist/client/assets/{useRouterState-DnRo01nI.js → useRouterState-B2iSGy4D.js} +1 -1
  209. package/dist/client/assets/useSuspenseInfiniteQuery-BdXBswCG.js +1 -0
  210. package/dist/client/assets/{users-DjhV04Tl.js → users-pEdk07gE.js} +1 -1
  211. package/dist/client/assets/{variant-calendar-BsvjOdM5.js → variant-calendar-D-TKtVJ9.js} +1 -1
  212. package/dist/client/assets/{view-mode-toggle-B__hqocu.js → view-mode-toggle-BFoTStlx.js} +1 -1
  213. package/dist/client/index.html +2 -2
  214. package/dist/server/cli.js +1497 -1491
  215. package/dist/server/migrate.js +127 -123
  216. package/dist/server/server.js +1319 -1317
  217. package/package.json +1 -1
  218. package/dist/client/assets/ai-providers-CYzTJ6JT.js +0 -1
  219. package/dist/client/assets/chat-context-odIDuoxs.js +0 -35
  220. package/dist/client/assets/index-Dx6R9eJm.css +0 -1
  221. package/dist/client/assets/members-Dm-w2cjX.js +0 -1
  222. package/dist/client/assets/project-app-view-BmxvXVpm.js +0 -1
  223. package/dist/client/assets/record-editor-Bd0zJSQ5.js +0 -1
  224. package/dist/client/assets/registry-CnizMlye.js +0 -2
  225. package/dist/client/assets/roles-8JezSaPz.js +0 -1
  226. package/dist/client/assets/store-registry-C2Y2YQnJ.js +0 -2
  227. package/dist/client/assets/useInfiniteQuery-CDckZZBv.js +0 -1
  228. package/dist/client/assets/useSuspenseInfiniteQuery-D8BSIixK.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decocms",
3
- "version": "4.168.1",
3
+ "version": "4.169.0",
4
4
  "description": "Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{Y as Z,Z as D,a3 as Ae,a5 as Ke,a6 as ne,a4 as qe,b8 as Te,c as X,b as oe,_ as ze,$ as Be,r as J,j as s,a7 as nt,t as re,aw as Le,F as Ne,o as we,e as Se,K as ie,n as Ve,m as Oe,B as se,p as Qe,v as at,E as ct}from"./index-Bj2l7mXt.js";import{i as dt}from"./AlertCircle-WkAXz2RU.js";import{P as ke}from"./index-Dqj3oyWO.js";import{S as Re}from"./skeleton-speSw7jS.js";import{b as Ge,a as Me,S as Ee,c as mt}from"./settings-section-Dya12h7y.js";import{u as Ye,b as Pe,i as ut,c as pt,p as ft,d as Fe,e as gt,f as We}from"./use-ai-providers-C2ddm__5.js";import{i as ht}from"./CheckCircle-CWdBsPjp.js";import{b as xt,j as vt}from"./use-organization-settings-BILVfsIn.js";import{c as bt,d as Je,P as yt,C as $e}from"./select-model-CS5i6otK.js";import{u as jt}from"./use-debounced-autosave-CiszpXLt.js";import{I as Ie}from"./input-BzEnzzLJ.js";import{T as Ue,a as St}from"./toggle-group-BCnSbCmi.js";import{A as Ze,a as Xe,b as et,c as tt,d as st,e as it,f as ot,g as rt}from"./alert-dialog-AsnK1y5X.js";import{u as je}from"./studio-tools-DUEQ1gbG.js";import{s as Ct}from"./Plus-C_u5dTsJ.js";import{p as _t,f as kt}from"./pt-BR-CLy76QW2.js";import{c as Pt}from"./Tool01-B2hCitBT.js";import{s as It}from"./Trash01-BxSBp2I9.js";import{A as Nt}from"./avatar-CqYevBdO.js";import{P as wt}from"./ai-providers-logos-DD3qZ33J.js";import{i as Dt}from"./Settings02-Dck4h0cx.js";import{s as Kt}from"./Eye-CSIx21VU.js";import{b as At,a as Rt,d as Mt,e as Et,c as Ft}from"./dialog-DqCa3fYo.js";import{S as Tt}from"./spinner-OTHCtfE-.js";import{R as Ot}from"./require-capability-DBzjOvlq.js";import"./sidebar-COQz-BQQ.js";import"./LayoutLeft-BsA_Lgfv.js";import"./use-mobile-DEX6Ai9c.js";import"./X-DeSUhPjd.js";import"./tooltip-3TZapsA0.js";import"./card-CW-_G833.js";import"./ArrowUpRight-h7SI5tgQ.js";import"./use-mcp-client-DokdZWXf.js";import"./auth-CoGYzQ9z.js";import"./drawer-C6VPAiPU.js";import"./chat-context-odIDuoxs.js";import"./tab-id-OJbWUe7k.js";import"./Check-mipwIsiZ.js";import"./Copy01-4iyXnjfm.js";import"./hooks-BTOG4zaW.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-Bt8CbWLu.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-6AQrTwof.js";import"./use-decopilot-events-CmG4ynOG.js";import"./checkbox-CCyUx_cq.js";import"./select-CGa1tZbM.js";import"./ChevronDown-Dnan0MwC.js";import"./ChevronUp-Txu-HIi-.js";import"./Key01-DYIDo6qe.js";import"./SearchMd-BpkGwSZm.js";import"./Monitor01-DTCgg1aj.js";import"./ChevronRight-DP5hU4SR.js";import"./Stars01-CDy5PQBZ.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-DuewQHnM.js";import"./use-capability-D7czuGny.js";import"./access-gate-Dm6SFJ7F.js";import"./capability-load-error-0y1ODtOx.js";Z({title:D(),url:D(),icon:D()});Z({registries:Ke(D(),Z({enabled:ne()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:Ae(D()).describe("List of MCP app_name or app_id values to hide from the store.")});const le=Z({keyId:D(),modelId:D(),title:D().optional()}).nullable();qe(["fast","smart","thinking","image","web_search","deep_research"]);qe(["fast","smart","thinking"]);const $t=Z({tiers:Z({fast:le,smart:le,thinking:le,image:le,web_search:le,deep_research:le})});Z({tiers:Z({fast:le.optional(),smart:le.optional(),thinking:le.optional()})});Z({ids:Ae(D()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});Z({demo_mode:ne().optional().describe("Curated demo org: the commerce connect modal proceeds without a configured required data source."),reports_only:ne().optional().describe("Curated commerce (reports) look: hides agent navigation, the home Customize button, and the Settings/Automations tabs. Defaulted on for orgs created by commerce onboarding."),qa_agent_enabled:ne().optional().describe("Run the QA Agent on a task's pull request once it's In Review — it verifies the task actually solved the problem (exercises the feature, not just the diff)."),code_reviewer_enabled:ne().optional().describe("Run the Code Reviewer on a task's pull request once it's In Review — it reviews the code using the repo's stack-appropriate review skills."),auto_merge:ne().optional().describe("When every enabled reviewer (QA Agent / Code Reviewer) approves a task's pull request, merge it automatically instead of leaving the merge to a human. If the merge is blocked by a conflict with the base branch, hand the PR back to the Super Agent to resolve the conflict (check out the branch, merge the base, push) so it can then merge.")});Z({id:D().describe("Brand context ID"),name:D().describe("Company name"),domain:D().describe("Company domain (e.g. example.com)"),overview:D().describe("Company overview / description"),logo:D().nullable().optional().describe("Logo URL"),favicon:D().nullable().optional().describe("Favicon URL"),ogImage:D().nullable().optional().describe("OG image URL"),fonts:Z({heading:D().optional().describe("Font family for headings"),body:D().optional().describe("Font family for body text"),code:D().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:Z({primary:D().optional().describe("Primary brand color (hex)"),secondary:D().optional().describe("Secondary brand color (hex)"),accent:D().optional().describe("Accent / highlight color (hex)"),background:D().optional().describe("Background color (hex)"),foreground:D().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:Ae(Ke(D(),Te())).nullable().optional().describe("Brand images"),metadata:Ke(D(),Te()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:D().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:ne().optional().describe("Whether this is the default brand for the organization")});const Ut=e=>e.capabilities?.includes("image")===!0,Ht=e=>ut(e),qt=e=>pt(e),zt=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:Ut},{key:"web_search",filter:Ht},{key:"deep_research",filter:qt}];function Bt(e){const t=X.c(30),{slot:i,onSlotChange:o,filterModels:n,defaultKeyId:c}=e,a=Ye(),l=a.some(I=>I.id===i?.keyId)?i?.keyId:null,[S,P]=J.useState(l??c);let b,r;t[0]!==l?(b=()=>{l&&P(l)},r=[l],t[0]=l,t[1]=b,t[2]=r):(b=t[1],r=t[2]),J.useEffect(b,r);let d;t[3]!==a||t[4]!==c||t[5]!==S?(d=a.some(I=>I.id===S)?S:c,t[3]=a,t[4]=c,t[5]=S,t[6]=d):d=t[6];const u=d;let p;t[7]!==u||t[8]!==a?(p=u?a.find(I=>I.id===u):null,t[7]=u,t[8]=a,t[9]=p):p=t[9];const y=p,{models:f,isLoading:_}=Pe(n?u??void 0:void 0),g=n?_||f.some(n):!0;let h;t[10]!==i||t[11]!==y?.providerId||t[12]!==l?(h=i&&l?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:y?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[10]=i,t[11]=y?.providerId,t[12]=l,t[13]=h):h=t[13];const N=h,j=oe();if(n&&!g){let I;t[14]!==j?(I=j("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[14]=j,t[15]=I):I=t[15];let K;return t[16]!==I?(K=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:I}),t[16]=I,t[17]=K):K=t[17],K}let C;t[18]!==j?(C=j("settings.simpleModeSection.pickModel"),t[18]=j,t[19]=C):C=t[19];let m;t[20]===Symbol.for("react.memo_cache_sentinel")?(m=I=>P(I),t[20]=m):m=t[20];let x;t[21]!==u||t[22]!==o?(x=I=>{const K=I.keyId??u??"";P(K),o({keyId:K,modelId:I.modelId,title:I.title})},t[21]=u,t[22]=o,t[23]=x):x=t[23];let k;return t[24]!==u||t[25]!==n||t[26]!==N||t[27]!==C||t[28]!==x?(k=s.jsx(bt,{variant:"bordered",placeholder:C,model:N,credentialId:u,filterModels:n,onCredentialChange:m,onModelChange:x}),t[24]=u,t[25]=n,t[26]=N,t[27]=C,t[28]=x,t[29]=k):k=t[29],k}function Lt(e){const t=X.c(10),{isPending:i,showSaved:o}=e,n=oe();if(i){let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Le,{size:12,className:"animate-spin"}),t[0]=c):c=t[0];let a;t[1]!==n?(a=n("settings.simpleModeSection.saving"),t[1]=n,t[2]=a):a=t[2];let l;return t[3]!==a?(l=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[c,a]}),t[3]=a,t[4]=l):l=t[4],l}if(o){let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(ht,{size:12}),t[5]=c):c=t[5];let a;t[6]!==n?(a=n("settings.simpleModeSection.saved"),t[6]=n,t[7]=a):a=t[7];let l;return t[8]!==a?(l=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[c,a]}),t[8]=a,t[9]=l):l=t[9],l}return null}function Vt(){const e=X.c(58),t=oe(),i=Ye(),o=xt(),n=i.length>0;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=ze($t),e[0]=c):c=e[0];let a;e[1]!==o?(a={resolver:c,values:o,mode:"onChange"},e[1]=o,e[2]=a):a=e[2];const l=Be(a),{mutate:S,isPending:P,isSuccess:b}=vt(),r=l.formState.isDirty;let d;e[3]!==l||e[4]!==o||e[5]!==t||e[6]!==S?(d={delayMs:250,save:async()=>{const v=l.getValues();S(v,{onSuccess:()=>l.reset(v,{keepValues:!0}),onError:R=>{l.reset(o),re.error(t("settings.simpleModeSection.failedToSave",{error:R.message}))}})}},e[3]=l,e[4]=o,e[5]=t,e[6]=S,e[7]=d):d=e[7];const{schedule:u}=jt(d),p=i[0],y=i[1],f=i[2],{models:_}=Pe(p?.id),{models:g}=Pe(y?.id),{models:h}=Pe(f?.id);let N,j;e[8]!==l||e[9]!==n?(N=()=>{n||l.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},j=[n,l],e[8]=l,e[9]=n,e[10]=N,e[11]=j):(N=e[10],j=e[11]),J.useEffect(N,j);let C;e[12]!==i||e[13]!==l||e[14]!==p||e[15]!==y||e[16]!==f||e[17]!==_||e[18]!==g||e[19]!==h?(C=()=>{const v=l.getValues(),R=new Set(i.map(Qt)),M={};p?.id&&(M[p.id]=_),y?.id&&(M[y.id]=g),f?.id&&(M[f.id]=h);const A=G=>G!=null&&!R.has(G.keyId),w={fast:A(v.tiers.fast)?null:v.tiers.fast,smart:A(v.tiers.smart)?null:v.tiers.smart,thinking:A(v.tiers.thinking)?null:v.tiers.thinking,image:A(v.tiers.image)?null:v.tiers.image,web_search:A(v.tiers.web_search)?null:v.tiers.web_search,deep_research:A(v.tiers.deep_research)?null:v.tiers.deep_research},Y=!w.fast||!w.smart||!w.thinking||!w.image||!w.web_search||!w.deep_research,W=w.fast===v.tiers.fast&&w.smart===v.tiers.smart&&w.thinking===v.tiers.thinking&&w.image===v.tiers.image&&w.web_search===v.tiers.web_search&&w.deep_research===v.tiers.deep_research;if(!Y&&W)return;const $=ft(i,M);l.reset({tiers:{fast:w.fast??$.chat.fast,smart:w.smart??$.chat.smart,thinking:w.thinking??$.chat.thinking,image:w.image??$.image,web_search:w.web_search??$.webSearch,deep_research:w.deep_research??$.deepResearch}},{keepDirty:!0})},e[12]=i,e[13]=l,e[14]=p,e[15]=y,e[16]=f,e[17]=_,e[18]=g,e[19]=h,e[20]=C):C=e[20];const m=p?.id,x=y?.id,k=f?.id;let I;e[21]!==i||e[22]!==l||e[23]!==_||e[24]!==g||e[25]!==h||e[26]!==m||e[27]!==x||e[28]!==k?(I=[l,i,_,g,h,m,x,k],e[21]=i,e[22]=l,e[23]=_,e[24]=g,e[25]=h,e[26]=m,e[27]=x,e[28]=k,e[29]=I):I=e[29],J.useEffect(C,I);let K;e[30]!==t?(K=v=>({fast:t("settings.simpleModeSection.tierFast"),smart:t("settings.simpleModeSection.tierSmart"),thinking:t("settings.simpleModeSection.tierThinking"),image:t("settings.simpleModeSection.tierImage"),web_search:t("settings.simpleModeSection.tierWebSearch"),deep_research:t("settings.simpleModeSection.tierDeepResearch")})[v]||v,e[30]=t,e[31]=K):K=e[31];const L=K;let U;e[32]!==t?(U=v=>({fast:t("settings.simpleModeSection.tierFastDesc"),smart:t("settings.simpleModeSection.tierSmartDesc"),thinking:t("settings.simpleModeSection.tierThinkingDesc"),image:t("settings.simpleModeSection.tierImageDesc"),web_search:t("settings.simpleModeSection.tierWebSearchDesc"),deep_research:t("settings.simpleModeSection.tierDeepResearchDesc")})[v]||"",e[32]=t,e[33]=U):U=e[33];const V=U;let H;e[34]!==t?(H=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=H):H=e[35];let q;e[36]!==t?(q=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=q):q=e[37];let z;e[38]!==q?(z=s.jsx("p",{className:"text-sm text-muted-foreground",children:q}),e[38]=q,e[39]=z):z=e[39];const Q=b&&!r;let E;e[40]!==P||e[41]!==Q?(E=s.jsx(Lt,{isPending:P,showSaved:Q}),e[40]=P,e[41]=Q,e[42]=E):E=e[42];let F;e[43]!==z||e[44]!==E?(F=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[z,E]}),e[43]=z,e[44]=E,e[45]=F):F=e[45];let T;e[46]!==i[0]?.id||e[47]!==l.control||e[48]!==V||e[49]!==L||e[50]!==u?(T=zt.map(v=>s.jsx(nt,{control:l.control,name:`tiers.${v.key}`,render:R=>{const{field:M}=R;return s.jsx(Ge,{title:L(v.key),description:V(v.key),action:s.jsx(Bt,{slot:M.value,defaultKeyId:i[0]?.id??null,filterModels:v.filter,onSlotChange:A=>{M.onChange(A),u()}})})}},v.key)),e[46]=i[0]?.id,e[47]=l.control,e[48]=V,e[49]=L,e[50]=u,e[51]=T):T=e[51];let O;e[52]!==T?(O=s.jsx(Me,{children:T}),e[52]=T,e[53]=O):O=e[53];let B;return e[54]!==H||e[55]!==F||e[56]!==O?(B=s.jsxs(Ee,{title:H,headerClassName:"pl-0",children:[F,O]}),e[54]=H,e[55]=F,e[56]=O,e[57]=B):B=e[57],B}function Qt(e){return e.id}const Gt={usd:[10,20,100],brl:[50,100,500]};function Yt(){const e=X.c(30),t=oe(),i=je(),[o,n]=J.useState(!1);let c;e[0]!==t?(c=m=>{re.error(t("settings.decoCreditsHero.topUpFailed",{message:m.message}))},e[0]=t,e[1]=c):c=e[1];const{mutate:a,isPending:l}=Se({mutationFn:async m=>{const{url:x}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:m,currency:d});return x},onSuccess:Wt,onError:c}),[S,P]=J.useState(""),[b,r]=J.useState("usd"),d=b,u=parseFloat(S),p=!isNaN(u)&&u>=1,y=d==="brl"?"R$":"$";let f;e[2]!==r?(f=m=>{m&&r(m)},e[2]=r,e[3]=f):f=e[3];let _,g;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Ue,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),g=s.jsx(Ue,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=_,e[5]=g):(_=e[4],g=e[5]);let h;e[6]!==d||e[7]!==f?(h=s.jsxs(St,{type:"single",variant:"outline",size:"default",value:d,onValueChange:f,children:[_,g]}),e[6]=d,e[7]=f,e[8]=h):h=e[8];let N;e[9]!==d||e[10]!==y||e[11]!==o||e[12]!==l||e[13]!==t||e[14]!==a?(N=!o&&s.jsxs(s.Fragment,{children:[Gt[d].map(m=>s.jsxs(se,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:l,onClick:()=>a(m*100),children:[y,m]},m)),s.jsx(se,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>n(!0),disabled:l,children:t("settings.decoCreditsHero.custom")})]}),e[9]=d,e[10]=y,e[11]=o,e[12]=l,e[13]=t,e[14]=a,e[15]=N):N=e[15];let j;e[16]!==y||e[17]!==S||e[18]!==u||e[19]!==o||e[20]!==p||e[21]!==l||e[22]!==P||e[23]!==t||e[24]!==a?(j=o&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:y}),s.jsx(Ie,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:S,onChange:m=>P(m.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(se,{className:"h-10",disabled:!p||l,onClick:()=>a(Math.round(u*100)),children:l?"...":t("settings.decoCreditsHero.add")}),s.jsx(se,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{n(!1),P("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=y,e[17]=S,e[18]=u,e[19]=o,e[20]=p,e[21]=l,e[22]=P,e[23]=t,e[24]=a,e[25]=j):j=e[25];let C;return e[26]!==h||e[27]!==N||e[28]!==j?(C=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h,N,j]})}),e[26]=h,e[27]=N,e[28]=j,e[29]=C):C=e[29],C}function Wt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Jt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Zt(){const e=X.c(121),t=oe(),{org:i}=Ne(),o=je(),n=we(),c=Fe();let a;e[0]!==c?(a=c.find(Xt),e[0]=c,e[1]=a):a=e[1];const l=a,[S,P]=J.useState(!1);let b;e[2]!==l||e[3]!==o?(b=async()=>{l&&await o.call("AI_PROVIDER_KEY_DELETE",{keyId:l.id})},e[2]=l,e[3]=o,e[4]=b):b=e[4];let r;e[5]!==i.id||e[6]!==n||e[7]!==t?(r=()=>{n.invalidateQueries({queryKey:ie.aiProviderKeys(i.id)}),n.invalidateQueries({queryKey:ie.aiProviders(i.id)}),re.success(t("settings.decoCreditsHero.disconnectSuccess")),P(!1)},e[5]=i.id,e[6]=n,e[7]=t,e[8]=r):r=e[8];let d;e[9]!==t?(d=lt=>{re.error(t("settings.decoCreditsHero.disconnectError",{message:lt.message}))},e[9]=t,e[10]=d):d=e[10];let u;e[11]!==b||e[12]!==r||e[13]!==d?(u={mutationFn:b,onSuccess:r,onError:d},e[11]=b,e[12]=r,e[13]=d,e[14]=u):u=e[14];const{mutate:p,isPending:y}=Se(u);let f;e[15]!==i.id?(f=ie.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=f):f=e[16];const _=!!l;let g;e[17]!==o?(g=async()=>{try{return await o.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=o,e[18]=g):g=e[18];let h;e[19]!==f||e[20]!==_||e[21]!==g?(h={queryKey:f,enabled:_,staleTime:6e4,queryFn:g},e[19]=f,e[20]=_,e[21]=g,e[22]=h):h=e[22];const{data:N,isLoading:j,refetch:C,isFetching:m}=Ve(h);if(!l)return null;const x=N?.balanceCents!=null?N.balanceCents/100:null;let k;e[23]!==x?(k=x!=null?`$${x.toFixed(2)}`:"—",e[23]=x,e[24]=k):k=e[24];const I=k;let K;e[25]!==t?(K=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=K):K=e[26];let L;e[27]!==t?(L=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=L):L=e[28];let U;e[29]!==L?(U=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:L,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=L,e[30]=U):U=e[30];let V;e[31]!==t?(V=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=V):V=e[32];let H;e[33]!==V?(H=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:V})}),e[33]=V,e[34]=H):H=e[34];let q;e[35]!==U||e[36]!==H?(q=s.jsxs("div",{className:"flex items-center gap-3",children:[U,H]}),e[35]=U,e[36]=H,e[37]=q):q=e[37];let z;e[38]===Symbol.for("react.memo_cache_sentinel")?(z=()=>P(!0),e[38]=z):z=e[38];let Q;e[39]!==t?(Q=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=Q):Q=e[40];let E;e[41]!==y||e[42]!==Q?(E=s.jsx(se,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:z,disabled:y,children:Q}),e[41]=y,e[42]=Q,e[43]=E):E=e[43];let F;e[44]!==q||e[45]!==E?(F=s.jsxs("div",{className:"flex items-center justify-between",children:[q,E]}),e[44]=q,e[45]=E,e[46]=F):F=e[46];let T;e[47]!==t?(T=t("settings.decoCreditsHero.disconnectTitle"),e[47]=t,e[48]=T):T=e[48];let O;e[49]!==T?(O=s.jsx(Ze,{children:T}),e[49]=T,e[50]=O):O=e[50];let B;e[51]!==t?(B=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=B):B=e[52];let v;e[53]!==B?(v=s.jsx(Xe,{children:B}),e[53]=B,e[54]=v):v=e[54];let R;e[55]!==O||e[56]!==v?(R=s.jsxs(et,{children:[O,v]}),e[55]=O,e[56]=v,e[57]=R):R=e[57];let M;e[58]!==t?(M=t("settings.decoCreditsHero.cancelButton"),e[58]=t,e[59]=M):M=e[59];let A;e[60]!==M?(A=s.jsx(tt,{children:M}),e[60]=M,e[61]=A):A=e[61];let w;e[62]!==p?(w=()=>p(),e[62]=p,e[63]=w):w=e[63];let Y;e[64]!==t?(Y=t("settings.decoCreditsHero.disconnectButton"),e[64]=t,e[65]=Y):Y=e[65];let W;e[66]!==w||e[67]!==Y?(W=s.jsx(st,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Y}),e[66]=w,e[67]=Y,e[68]=W):W=e[68];let $;e[69]!==A||e[70]!==W?($=s.jsxs(it,{children:[A,W]}),e[69]=A,e[70]=W,e[71]=$):$=e[71];let G;e[72]!==R||e[73]!==$?(G=s.jsxs(ot,{children:[R,$]}),e[72]=R,e[73]=$,e[74]=G):G=e[74];let te;e[75]!==S||e[76]!==G?(te=s.jsx(rt,{open:S,onOpenChange:P,children:G}),e[75]=S,e[76]=G,e[77]=te):te=e[77];let ee;e[78]!==x||e[79]!==I||e[80]!==m||e[81]!==j?(ee=j||m?s.jsx(Re,{className:"h-9 w-24"}):s.jsx("span",{className:Oe("text-3xl font-semibold tabular-nums tracking-tight",x!=null&&Jt(x)),children:I}),e[78]=x,e[79]=I,e[80]=m,e[81]=j,e[82]=ee):ee=e[82];let ae;e[83]!==C?(ae=()=>C(),e[83]=C,e[84]=ae):ae=e[84];let ce;e[85]!==t?(ce=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=ce):ce=e[86];const De=m&&"animate-spin";let de;e[87]!==De?(de=Oe(De),e[87]=De,e[88]=de):de=e[88];let me;e[89]!==de?(me=s.jsx(Le,{size:14,className:de}),e[89]=de,e[90]=me):me=e[90];let ue;e[91]!==m||e[92]!==ae||e[93]!==ce||e[94]!==me?(ue=s.jsx("button",{type:"button",onClick:ae,disabled:m,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":ce,children:me}),e[91]=m,e[92]=ae,e[93]=ce,e[94]=me,e[95]=ue):ue=e[95];let pe;e[96]!==ee||e[97]!==ue?(pe=s.jsxs("div",{className:"flex items-baseline gap-2",children:[ee,ue]}),e[96]=ee,e[97]=ue,e[98]=pe):pe=e[98];let fe;e[99]!==t?(fe=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=fe):fe=e[100];let ge;e[101]!==fe?(ge=s.jsx("p",{className:"text-xs text-muted-foreground",children:fe}),e[101]=fe,e[102]=ge):ge=e[102];let he;e[103]!==pe||e[104]!==ge?(he=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[pe,ge]}),e[103]=pe,e[104]=ge,e[105]=he):he=e[105];let xe;e[106]!==t?(xe=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=xe):xe=e[107];let ve;e[108]!==xe?(ve=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:xe}),e[108]=xe,e[109]=ve):ve=e[109];let Ce;e[110]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx(Yt,{}),e[110]=Ce):Ce=e[110];let be;e[111]!==ve?(be=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[ve,Ce]}),e[111]=ve,e[112]=be):be=e[112];let ye;e[113]!==F||e[114]!==te||e[115]!==he||e[116]!==be?(ye=s.jsx(Me,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[F,te,he,be]})}),e[113]=F,e[114]=te,e[115]=he,e[116]=be,e[117]=ye):ye=e[117];let _e;return e[118]!==K||e[119]!==ye?(_e=s.jsx(Ee,{title:K,children:ye}),e[118]=K,e[119]=ye,e[120]=_e):_e=e[120],_e}function Xt(e){return e.providerId==="deco"}function es(){const e=X.c(8),{org:t}=Ne(),i=je(),o=we();let n;e[0]!==i?(n=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=n):n=e[1];let c;e[2]!==t||e[3]!==o?(c=()=>{Qe("ai_provider_provision_succeeded",{provider_id:"deco"}),o.invalidateQueries({queryKey:ie.aiProviderKeys(t.id)}),o.invalidateQueries({queryKey:ie.aiProviders(t.id)}),re.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=o,e[4]=c):c=e[4];let a;return e[5]!==n||e[6]!==c?(a={mutationFn:n,onSuccess:c,onError:ts},e[5]=n,e[6]=c,e[7]=a):a=e[7],Se(a)}function ts(e){Qe("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),re.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function ss(){const e=X.c(37),t=oe(),{mutate:i,isPending:o}=es();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=n):n=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:n.join(", ")}}),e[1]=c):c=e[1];let a;e[2]!==t?(a=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=a):a=e[3];let l;e[4]!==a?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:a,className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[4]=a,e[5]=l):l=e[5];let S;e[6]!==t?(S=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=S):S=e[7];let P;e[8]!==S?(P=s.jsx("p",{className:"text-base font-semibold",children:S}),e[8]=S,e[9]=P):P=e[9];let b;e[10]!==t?(b=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=b):b=e[11];let r;e[12]!==b?(r=s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:b}),e[12]=b,e[13]=r):r=e[13];let d;e[14]!==P||e[15]!==r?(d=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[P,r]}),e[14]=P,e[15]=r,e[16]=d):d=e[16];let u;e[17]!==t?(u=t("settings.decoNudgeCard.description"),e[17]=t,e[18]=u):u=e[18];let p;e[19]!==u?(p=s.jsx("p",{className:"text-sm text-muted-foreground",children:u}),e[19]=u,e[20]=p):p=e[20];let y;e[21]!==p||e[22]!==d?(y=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,p]}),e[21]=p,e[22]=d,e[23]=y):y=e[23];let f;e[24]!==i?(f=()=>i(),e[24]=i,e[25]=f):f=e[25];let _;e[26]!==o||e[27]!==t?(_=t(o?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=o,e[27]=t,e[28]=_):_=e[28];let g;e[29]!==o||e[30]!==f||e[31]!==_?(g=s.jsx(se,{variant:"outline",disabled:o,onClick:f,children:_}),e[29]=o,e[30]=f,e[31]=_,e[32]=g):g=e[32];let h;return e[33]!==y||e[34]!==g||e[35]!==l?(h=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[c,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,y,g]})]}),e[33]=y,e[34]=g,e[35]=l,e[36]=h):h=e[36],h}const is=e=>Z({label:D().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:D().optional(),baseUrl:D().optional()});function os({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:o}){return e&&!!t&&t!==i&&!o}function rs({providerKey:e,provider:t,preset:i,maskedKey:o,currentLabel:n,currentBaseUrl:c,onCancel:a,onSuccess:l}){const{org:S}=Ne(),P=je(),b=we(),r=oe(),[d,u]=J.useState(!1),p=t.id==="openai-compatible",y=t.supportedMethods.includes("api-key"),f=is(r),{register:_,handleSubmit:g,watch:h,setError:N,formState:{errors:j}}=Be({resolver:ze(f),defaultValues:{label:n,apiKey:"",baseUrl:c??""}}),C=h("apiKey")??"",{mutate:m,isPending:x}=Se({mutationFn:async k=>{let I;k.apiKey&&(p?I=JSON.stringify({baseUrl:k.baseUrl||c||"",apiKey:k.apiKey}):I=k.apiKey),await P.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:k.label,...I!==void 0?{apiKey:I}:{}})},onSuccess:()=>{b.invalidateQueries({queryKey:ie.aiProviderKeys(S.id)}),b.invalidateQueries({queryKey:ie.aiProviders(S.id)}),re.success(r("settings.editProviderDialog.providerUpdated")),l()},onError:k=>re.error(r("settings.editProviderDialog.failedToUpdate",{error:k.message}))});return s.jsxs("form",{onSubmit:g(k=>{if(os({isOpenAICompatible:p,baseUrl:k.baseUrl,currentBaseUrl:c,apiKey:k.apiKey})){N("apiKey",{message:r("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}m(k)}),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("settings.editProviderDialog.label")}),s.jsx(Ie,{placeholder:r("settings.editProviderDialog.labelPlaceholder"),..._("label"),className:"h-8 text-sm"}),j.label&&s.jsx("p",{className:"text-xs text-destructive",children:j.label.message})]}),p&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("settings.editProviderDialog.baseUrl")}),s.jsx(Ie,{type:"url",placeholder:i?.baseUrlPlaceholder??r("settings.editProviderDialog.baseUrlPlaceholder"),..._("baseUrl"),className:"h-8 text-sm"})]}),y&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[r("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",r("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ie,{type:d&&C?"text":"password",placeholder:o,..._("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),C&&s.jsx("button",{type:"button",onClick:()=>u(!d),"aria-label":r(d?"settings.editProviderDialog.hideApiKey":"settings.editProviderDialog.showApiKey"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:d?s.jsx(Dt,{size:14}):s.jsx(Kt,{size:14})})]}),j.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:j.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(Ft,{children:[s.jsx(se,{type:"button",variant:"ghost",size:"sm",onClick:a,disabled:x,children:r("settings.editProviderDialog.cancel")}),s.jsx(se,{type:"submit",size:"sm",disabled:x,children:r(x?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function ls(e){const t=X.c(31),{providerKey:i,provider:o,open:n,onOpenChange:c}=e,a=oe(),l=je(),S=o.id==="openai-compatible"&&i.presetId?Je(i.presetId):void 0,P=S?.name??o.name;let b;t[0]!==i.id?(b=ie.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=b):b=t[1];let r;t[2]!==i.id||t[3]!==l?(r=()=>l.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=l,t[4]=r):r=t[4];let d;t[5]!==n||t[6]!==b||t[7]!==r?(d={queryKey:b,queryFn:r,enabled:n,staleTime:0},t[5]=n,t[6]=b,t[7]=r,t[8]=d):d=t[8];const{data:u,isLoading:p}=Ve(d),y=Et,f=Mt,_="sm:max-w-md",g=Rt,h=At,N=a("settings.editProviderDialog.editTitle",{name:P});let j;t[9]!==h||t[10]!==N?(j=s.jsx(h,{children:N}),t[9]=h,t[10]=N,t[11]=j):j=t[11];let C;t[12]!==g||t[13]!==j?(C=s.jsx(g,{children:j}),t[12]=g,t[13]=j,t[14]=C):C=t[14];let m;t[15]!==p||t[16]!==c||t[17]!==S||t[18]!==u||t[19]!==o||t[20]!==i?(m=p||!u?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(Tt,{})}):s.jsx(rs,{providerKey:i,provider:o,preset:S,maskedKey:u.maskedKey,currentLabel:u.label,currentBaseUrl:u.baseUrl,onCancel:()=>c(!1),onSuccess:()=>c(!1)}),t[15]=p,t[16]=c,t[17]=S,t[18]=u,t[19]=o,t[20]=i,t[21]=m):m=t[21];let x;t[22]!==f||t[23]!==C||t[24]!==m?(x=s.jsxs(f,{className:_,children:[C,m]}),t[22]=f,t[23]=C,t[24]=m,t[25]=x):x=t[25];let k;return t[26]!==y||t[27]!==c||t[28]!==n||t[29]!==x?(k=s.jsx(y,{open:n,onOpenChange:c,children:x}),t[26]=y,t[27]=c,t[28]=n,t[29]=x,t[30]=k):k=t[30],k}function ns(e){const t=X.c(86),{providerKey:i,provider:o}=e,{org:n}=Ne(),c=je(),a=we(),[l,S]=J.useState(!1),[P,b]=J.useState(!1),r=oe(),[d]=at(),u=d.language==="pt-BR"?_t:void 0,p=o?.id==="openai-compatible";let y;t[0]!==p||t[1]!==i.presetId?(y=p&&i.presetId?Je(i.presetId):void 0,t[0]=p,t[1]=i.presetId,t[2]=y):y=t[2];const f=y;let _;t[3]!==p||t[4]!==f||t[5]!==o?.name||t[6]!==i.providerId||t[7]!==r?(_=f?f.name:p?r("settings.aiProviders.customOpenAiCompatible"):o?.name??(i.providerId==="claude-code"?r("settings.providerKeyRow.claudeCode"):i.providerId==="codex"?r("settings.providerKeyRow.codex"):i.providerId),t[3]=p,t[4]=f,t[5]=o?.name,t[6]=i.providerId,t[7]=r,t[8]=_):_=t[8];const g=_,h=f?.logo??o?.logo??wt[i.providerId];let N;e:{if(p){N=i.label;break e}let ee;t[9]!==u||t[10]!==i.createdAt||t[11]!==i.label||t[12]!==r?(ee=r("settings.providerKeyRow.addedTimeAgo",{label:i.label,time:kt(new Date(i.createdAt),{locale:u})}),t[9]=u,t[10]=i.createdAt,t[11]=i.label,t[12]=r,t[13]=ee):ee=t[13],N=ee}const j=N;let C;t[14]!==i.id||t[15]!==c?(C=async()=>{await c.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[14]=i.id,t[15]=c,t[16]=C):C=t[16];let m;t[17]!==n||t[18]!==i.id||t[19]!==a||t[20]!==r?(m=()=>{a.invalidateQueries({queryKey:ie.aiProviderKeys(n.id)}),a.invalidateQueries({queryKey:ie.aiProviders(n.id)}),a.invalidateQueries({queryKey:ie.aiProviderModels(n.id,i.id)}),re.success(r("settings.providerKeyRow.keyDeleted")),S(!1)},t[17]=n,t[18]=i.id,t[19]=a,t[20]=r,t[21]=m):m=t[21];let x;t[22]!==r?(x=ee=>re.error(r("settings.providerKeyRow.failedToDeleteKey",{error:ee.message})),t[22]=r,t[23]=x):x=t[23];let k;t[24]!==C||t[25]!==m||t[26]!==x?(k={mutationFn:C,onSuccess:m,onError:x},t[24]=C,t[25]=m,t[26]=x,t[27]=k):k=t[27];const{mutate:I,isPending:K}=Se(k);let L;t[28]!==g||t[29]!==h?(L=h?s.jsx("img",{src:h,alt:g,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Nt,{fallback:g.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[28]=g,t[29]=h,t[30]=L):L=t[30];let U;t[31]!==o||t[32]!==r?(U=o?s.jsx(se,{variant:"ghost",size:"icon","aria-label":r("settings.providerKeyRow.editProviderKey"),className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>b(!0),children:s.jsx(Pt,{size:14})}):null,t[31]=o,t[32]=r,t[33]=U):U=t[33];let V;t[34]!==r?(V=r("settings.providerKeyRow.deleteProviderKey"),t[34]=r,t[35]=V):V=t[35];let H,q;t[36]===Symbol.for("react.memo_cache_sentinel")?(H=()=>S(!0),q=s.jsx(It,{size:14}),t[36]=H,t[37]=q):(H=t[36],q=t[37]);let z;t[38]!==K||t[39]!==V?(z=s.jsx(se,{variant:"ghost",size:"icon","aria-label":V,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:K,onClick:H,children:q}),t[38]=K,t[39]=V,t[40]=z):z=t[40];let Q;t[41]!==z||t[42]!==U?(Q=s.jsxs("div",{className:"flex items-center gap-0.5",children:[U,z]}),t[41]=z,t[42]=U,t[43]=Q):Q=t[43];let E;t[44]!==j||t[45]!==g||t[46]!==Q||t[47]!==L?(E=s.jsx(Ge,{icon:L,title:g,description:j,action:Q}),t[44]=j,t[45]=g,t[46]=Q,t[47]=L,t[48]=E):E=t[48];let F;t[49]!==P||t[50]!==o||t[51]!==i?(F=o?s.jsx(ls,{providerKey:i,provider:o,open:P,onOpenChange:b}):null,t[49]=P,t[50]=o,t[51]=i,t[52]=F):F=t[52];let T;t[53]!==r?(T=r("settings.providerKeyRow.deleteApiKey"),t[53]=r,t[54]=T):T=t[54];let O;t[55]!==T?(O=s.jsx(Ze,{children:T}),t[55]=T,t[56]=O):O=t[56];let B;t[57]!==i.label?(B=s.jsxs(Xe,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]}),t[57]=i.label,t[58]=B):B=t[58];let v;t[59]!==O||t[60]!==B?(v=s.jsxs(et,{children:[O,B]}),t[59]=O,t[60]=B,t[61]=v):v=t[61];let R;t[62]!==r?(R=r("settings.providerKeyRow.cancel"),t[62]=r,t[63]=R):R=t[63];let M;t[64]!==R?(M=s.jsx(tt,{children:R}),t[64]=R,t[65]=M):M=t[65];let A;t[66]!==I?(A=()=>I(),t[66]=I,t[67]=A):A=t[67];let w;t[68]!==r?(w=r("settings.providerKeyRow.delete"),t[68]=r,t[69]=w):w=t[69];let Y;t[70]!==A||t[71]!==w?(Y=s.jsx(st,{onClick:A,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:w}),t[70]=A,t[71]=w,t[72]=Y):Y=t[72];let W;t[73]!==M||t[74]!==Y?(W=s.jsxs(it,{children:[M,Y]}),t[73]=M,t[74]=Y,t[75]=W):W=t[75];let $;t[76]!==v||t[77]!==W?($=s.jsxs(ot,{children:[v,W]}),t[76]=v,t[77]=W,t[78]=$):$=t[78];let G;t[79]!==l||t[80]!==$?(G=s.jsx(rt,{open:l,onOpenChange:S,children:$}),t[79]=l,t[80]=$,t[81]=G):G=t[81];let te;return t[82]!==E||t[83]!==F||t[84]!==G?(te=s.jsxs(s.Fragment,{children:[E,F,G]}),t[82]=E,t[83]=F,t[84]=G,t[85]=te):te=t[85],te}function as(e){const t=e.filter(i=>gt(i.providerId));return{hasInventory:e.length>0,hasHostedProvider:t.length>0,hasDeco:t.some(i=>i.providerId==="deco")}}function cs(e,t){return e.filter(i=>i.providerId!=="deco").map(i=>({key:i,provider:t.find(o=>o.id===i.providerId)??null}))}function He(e){const t=X.c(13),{onConnectClick:i}=e,o=oe(),n=Fe(),c=We();let a;if(t[0]!==c?.providers||t[1]!==n||t[2]!==i||t[3]!==o){const l=c?.providers??[],S=cs(n,l);let P;t[5]!==o?(P=o("settings.connectedProvidersSection.sectionTitle"),t[5]=o,t[6]=P):P=t[6];let b;t[7]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(Ct,{size:14}),t[7]=b):b=t[7];let r;t[8]!==o?(r=o("settings.connectedProvidersSection.connectButton"),t[8]=o,t[9]=r):r=t[9];let d;t[10]!==i||t[11]!==r?(d=s.jsxs(se,{size:"sm",onClick:i,children:[b,r]}),t[10]=i,t[11]=r,t[12]=d):d=t[12],a=s.jsx(Ee,{title:P,headerClassName:"px-0",actions:d,children:S.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:o("settings.connectedProvidersSection.emptyState")}):s.jsx(Me,{children:S.map(ds)})}),t[0]=c?.providers,t[1]=n,t[2]=i,t[3]=o,t[4]=a}else a=t[4];return a}function ds(e){const{key:t,provider:i}=e;return s.jsx(ns,{providerKey:t,provider:i},t.id)}function ms(e){const t=X.c(3),{error:i}=e;let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(dt,{size:16}),t[0]=o):o=t[0];let n;return t[1]!==i.message?(n=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[o,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=n):n=t[2],n}function us(){const e=X.c(26),t=Fe();let i;e[0]!==t?(i=as(t),e[0]=t,e[1]=i):i=e[1];const{hasInventory:o,hasHostedProvider:n,hasDeco:c}=i,[a,l]=J.useState(!1),[S,P]=J.useState(null),b=We();let r;e[2]!==b?.providers?(r=b?.providers??[],e[2]=b?.providers,e[3]=r):r=e[3];const d=r;if(!n){let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>l(!0),e[4]=g):g=e[4];let h;e[5]!==d?(h=s.jsx(yt,{providers:d,onSelect:P,onShowAll:g}),e[5]=d,e[6]=h):h=e[6];const N=S!==null||a;let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=I=>{I||(P(null),l(!1))},e[7]=j):j=e[7];const C=S??void 0;let m;e[8]!==N||e[9]!==C?(m=s.jsx($e,{open:N,onOpenChange:j,initialProvider:C}),e[8]=N,e[9]=C,e[10]=m):m=e[10];let x;e[11]!==o?(x=o?s.jsx(He,{onConnectClick:()=>l(!0)}):null,e[11]=o,e[12]=x):x=e[12];let k;return e[13]!==h||e[14]!==m||e[15]!==x?(k=s.jsxs(s.Fragment,{children:[h,m,x]}),e[13]=h,e[14]=m,e[15]=x,e[16]=k):k=e[16],k}let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(J.Suspense,{fallback:s.jsx(Re,{className:"h-16 w-full"}),children:s.jsx(Vt,{})}),e[17]=u):u=e[17];let p;e[18]!==c?(p=c?s.jsx(Zt,{}):s.jsx(ss,{}),e[18]=c,e[19]=p):p=e[19];let y;e[20]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(He,{onConnectClick:()=>l(!0)}),e[20]=y):y=e[20];let f;e[21]!==a?(f=s.jsx($e,{open:a,onOpenChange:l}),e[21]=a,e[22]=f):f=e[22];let _;return e[23]!==p||e[24]!==f?(_=s.jsxs(s.Fragment,{children:[u,p,y,f]}),e[23]=p,e[24]=f,e[25]=_):_=e[25],_}function ps(){const e=X.c(7),t=oe();let i;e[0]!==t?(i=t("settings.nav.aiProviders"),e[0]=t,e[1]=i):i=e[1];let o;e[2]!==i?(o=s.jsx(ke.Title,{children:i}),e[2]=i,e[3]=o):o=e[3];let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ct,{fallback:fs,children:s.jsx(J.Suspense,{fallback:s.jsx(Re,{className:"h-64 w-full"}),children:s.jsx(us,{})})}),e[4]=n):n=e[4];let c;return e[5]!==o?(c=s.jsx(ke,{children:s.jsx(ke.Content,{children:s.jsx(ke.Body,{children:s.jsxs(mt,{children:[o,n]})})})}),e[5]=o,e[6]=c):c=e[6],c}function fs(e){const{error:t}=e;return s.jsx(ms,{error:t??new Error("Failed to load AI providers")})}function ji(){const e=X.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Ot,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(ps,{})}),e[0]=t):t=e[0],t}export{ji as default};
@@ -1,35 +0,0 @@
1
- import{Y as S,a3 as C,a6 as ae,Z as i,a4 as ue,a5 as xe,aH as Me,cw as xt,bj as Ne,b8 as lt,c as ie,J as ct,u as je,o as Ve,F as J,K as de,t as ce,I as be,G as ge,d as dt,f as It,r as v,n as wt,e as Mt,j as Ie,b as De,a as Tt,v as Ct,aa as At,p as Pt}from"./index-Bj2l7mXt.js";import{d as _t,s as Rt,A as ut,t as Dt,u as Et,o as $t,w as Ut}from"./tab-id-OJbWUe7k.js";import{S as Ot,u as Lt,f as Nt,b as Ft}from"./hooks-BTOG4zaW.js";import{u as qt}from"./use-is-desktop-app-BNujXJc_.js";import{a as jt,u as Vt,S as Bt}from"./use-mcp-client-DokdZWXf.js";import{u as Ht}from"./use-virtual-mcp-6AQrTwof.js";import{u as pt,p as Kt,b as Se,i as Qt,c as Wt}from"./use-ai-providers-C2ddm__5.js";import{u as Gt}from"./use-decopilot-events-CmG4ynOG.js";import{u as zt,c as Xt}from"./studio-tools-DUEQ1gbG.js";import{b as Zt}from"./use-organization-settings-BILVfsIn.js";const ke=S({connection_id:i().describe("Connection ID"),selected_tools:C(i()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:C(i()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:C(i()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),ht=ke.extend({selected_tools:ke.shape.selected_tools.optional(),selected_resources:ke.shape.selected_resources.optional(),selected_prompts:ke.shape.selected_prompts.optional()}),Yt=S({connectionId:i(),toolName:i(),label:i(),icon:i().nullable().optional()}),Jt=S({id:i().describe("Stable id; used as React key and ?tab= value"),title:i().describe("Tab label"),icon:i().optional().describe("Optional lucide icon name"),view:S({type:Ne("ext-app"),appId:i(),args:xe(i(),lt()).optional()})}),en=S({defaultMainView:S({type:i(),id:i().optional(),toolName:i().optional()}).nullable().optional(),chatDefaultOpen:ae().nullable().optional(),cmsDefaultOpen:ae().nullable().optional(),tabs:C(Jt).optional()}),tt=S({tileId:i().optional(),connectionId:i().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:i().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:i().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:xe(i(),lt()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:Me().int().positive().optional(),maxHeight:Me().int().positive().optional()}),Be=S({banner:i().nullable().optional(),bannerColor:i().nullable().optional(),icon:i().nullable().optional(),themeColor:i().nullable().optional(),pinnedViews:C(Yt).nullable().optional(),layout:en.nullable().optional(),homeTile:tt.nullable().optional(),homeTiles:C(tt).nullable().optional(),homePrompts:C(i()).nullable().optional()});function ds(t){const e=t?.homeTiles;if(Array.isArray(e)&&e.length>0)return e;const n=t?.homeTile;return n?[n]:[]}const tn=/^[A-Za-z_][A-Za-z0-9_]*$/,nt=i().min(1).regex(tn,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),nn=xt("kind",[S({key:nt,kind:Ne("literal"),value:i()}),S({key:nt,kind:Ne("secret"),secretId:i().min(1)})]),sn=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,on=S({host:i().min(1).regex(sn).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:i().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),He=S({selected:i().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:i().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:i().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:C(nn).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:C(on).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),Ke=S({url:i().describe("GitHub repository URL"),owner:i().describe("Repository owner"),name:i().describe("Repository name"),installationId:Me().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:i().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),an=ue(["agent-sandbox","user-desktop"]),rn=ue(["agent-sandbox","user-desktop","cluster"]);function Qe(t){return t==="cluster"?"agent-sandbox":t}const mt={sandboxHandle:i().describe("Provider-specific handle"),previewUrl:i().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:i().nullable().optional().describe("Daemon's public URL — what cluster→daemon RPCs target. Equal to previewUrl for user-desktop; null/absent for the agent-sandbox provider (routes through hosted ingress)."),sandboxProviderKind:an.optional(),createdAt:Me().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:S({packageManager:i().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:i().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:i().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},ft=S(mt),ln=S({...mt,sandboxProviderKind:rn.optional()});function cn(t){const e=ln.parse(t);return ft.parse({...e,sandboxProviderKind:e.sandboxProviderKind?Qe(e.sandboxProviderKind):void 0})}function us(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,n={};for(const[s,o]of Object.entries(e)){if(!o||typeof o!="object"||s!=="cluster"&&s!=="agent-sandbox"&&s!=="user-desktop")continue;const a=Qe(s);try{if(s==="cluster"&&n[a])continue;n[a]=cn(o)}catch{}}return n}const We=xe(i().describe("userId"),xe(i().describe("branch"),xe(i().describe("sandboxProviderKind"),ft))),dn=S({id:i().describe("Stable identifier for this knowledge file"),name:i().describe("File name shown in the UI"),kind:ue(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:i().describe("Org filesystem (Library) volume the file lives in"),path:i().describe("Path within the volume"),url:i().describe("Same-origin URL to read the file (display/download)"),contentType:i().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:Me().nullable().optional().describe("File size in bytes"),addedAt:i().describe("ISO timestamp when the file was attached")}),Ge=C(dn).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),un=ue(["smart","code-review","open"]),ze=un.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),ps=S({id:i().describe("Unique identifier"),title:i().describe("Human-readable name"),description:i().nullable().describe("Description"),icon:i().nullable().describe("Icon URL"),created_at:i().describe("Creation timestamp"),updated_at:i().describe("Last update timestamp"),created_by:i().describe("User ID who created this item"),updated_by:i().optional().describe("User ID who last updated this item"),organization_id:i().describe("Organization ID this item belongs to"),status:ue(["active","inactive"]).describe("Current status"),pinned:ae().describe("Whether this space is pinned to the sidebar"),metadata:S({instructions:i().nullable().describe("Instructions also used as system prompt"),enabled_plugins:C(i()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C(i()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:i().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Be.nullable().optional().describe("UI customization settings"),githubRepo:Ke.nullable().optional().describe("Linked GitHub repository"),runtime:He.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:We.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }"),knowledge:Ge,siteSlug:i().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:ze,productionUrl:i().nullable().optional().describe("Live production URL of the linked site (e.g. https://acme.com). Painted in the preview iframe while the sandbox dev server is waking."),fieldDescriptionTooltips:ae().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title.")}).loose().describe("Metadata"),connections:C(ke).describe("Connections with their selected tools, resources, and prompts")}),bt=S({title:i().min(1).max(120).describe("Short label shown on the chip"),description:i().max(280).optional().describe("One-line subtitle shown under the title"),text:i().min(1).describe("The message sent to the agent when the prompt is clicked")});S({title:i().min(1).max(255).describe("Name for the virtual MCP"),description:i().nullable().optional().describe("Optional description"),icon:i().nullish().describe("Optional icon URL"),status:ue(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:ae().optional().default(!1).describe("Pin to sidebar"),metadata:S({instructions:i().nullable().optional().describe("MCP server instructions"),enabled_plugins:C(i()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C(i()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:i().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Be.nullable().optional().describe("UI customization settings"),githubRepo:Ke.nullable().optional().describe("Linked GitHub repository"),runtime:He.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:We.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }"),knowledge:Ge,siteSlug:i().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:ze,productionUrl:i().nullable().optional().describe("Live production URL of the linked site (e.g. https://acme.com). Painted in the preview iframe while the sandbox dev server is waking."),fieldDescriptionTooltips:ae().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title.")}).loose().nullable().optional().describe("Additional metadata including MCP server instructions"),connections:C(ht).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:C(bt).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});S({title:i().min(1).max(255).optional().describe("New name"),description:i().nullable().optional().describe("New description (null to clear)"),icon:i().nullish().describe("New icon URL"),status:ue(["active","inactive"]).optional().describe("New status"),pinned:ae().optional().describe("Pin/unpin from sidebar"),metadata:S({instructions:i().nullable().optional().describe("MCP server instructions"),enabled_plugins:C(i()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C(i()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:i().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Be.nullable().optional().describe("UI customization settings"),githubRepo:Ke.nullable().optional().describe("Linked GitHub repository"),runtime:He.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:We.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }"),knowledge:Ge,siteSlug:i().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:ze,productionUrl:i().nullable().optional().describe("Live production URL of the linked site (e.g. https://acme.com). Painted in the preview iframe while the sandbox dev server is waking."),fieldDescriptionTooltips:ae().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title.")}).loose().nullable().optional().describe("Additional metadata including MCP server instructions"),connections:C(ht).optional().describe("New connections (replaces existing)"),prompts:C(bt).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});function pn(t,e=[]){return t==="stop"?"completed":t==="tool-calls"?e.some(s=>s.type==="tool-user_ask"&&s.state==="input-available"||s.state==="approval-requested")?"requires_action":"completed":"failed"}const Fe={decopilot:{harness:"decopilot",sandbox:"agent-sandbox"},"claude-code-desktop":{harness:"claude-code",sandbox:"user-desktop"},"codex-desktop":{harness:"codex",sandbox:"user-desktop"},"opencode-desktop":{harness:"opencode",sandbox:"user-desktop"}};function hn(t,e){if(!t)return null;const n=e?Qe(e):null;if(t==="decopilot"&&(n===null||n==="user-desktop"))return"decopilot";for(const[s,o]of Object.entries(Fe))if(o.harness===t&&o.sandbox===n)return s;return null}function mn({pendingOption:t,lockedHarness:e}){return e==="claude-code"?"claude-code-desktop":e==="codex"?"codex-desktop":e==="opencode"?"opencode-desktop":t==="claude-code-desktop"||t==="codex-desktop"||t==="opencode-desktop"?t:null}function fn(t){return t.thread?.harness_id!=null?{}:{harnessId:"decopilot",sandboxProviderKind:"agent-sandbox",branch:t.globals.branch??null}}function bn({isDesktopApp:t,harnessId:e,sandboxProviderKind:n}){return e!=null&&e!=="decopilot"?!0:n==null||n==="agent-sandbox"?!1:!(e==="decopilot"&&n==="user-desktop")}const gn="home",yn=new Set(["output","upload","public","home"]),vn=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function hs(t){return yn.has(t)||!vn.test(t)?"home":t}function Sn(t){const e=t?t.split("/").filter(Boolean):[],n=e[0]==="public",s=n?e[1]??null:null,o=n?s?`public-${s}`:null:e[0]??null,a=(n?e.slice(2):e.slice(1)).join("/");return{segments:e,volume:o,dirPath:a,isPublic:n,publicSet:s,readOnly:n,isHomeRoot:o===gn&&a===""}}function ms(t){return t==="public"?"skills":t}function fs(t,e){return t.isPublic&&t.publicSet?`public/${t.publicSet}/${e}`:t.volume?`${t.volume}/${e}`:e}const st="public-";function gt(t){return t.startsWith(st)?t.slice(st.length):null}function bs(t,e){const n=gt(t);return n?`public/${n}/${e}`:`${t}/${e}`}function kn(t){const e=t.lastIndexOf("/");return e===-1?t:t.slice(e+1)}function xn(t){const{volume:e,dirPath:n}=Sn(t);if(!e)return null;let s;if(e==="home")s="org/home";else if(e==="outputs")s="org/.outputs";else if(e==="uploads")s="org/.uploads";else{const o=gt(e);s=o?`org/public/${o}`:`org/${e}`}return n?`${s}/${n}`:s}function In(t){const e=ie.c(21);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},e[0]=n):n=e[0];const s=ct(n);let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},e[1]=o):o=e[1];const a=je(o);let l;e[2]!==a.brand||e[3]!==a.main||e[4]!==a.preview||e[5]!==a.skill?(l=(typeof a.main=="string"?_t(a.main)?.path:void 0)??a.preview??a.skill??a.brand??null,e[2]=a.brand,e[3]=a.main,e[4]=a.preview,e[5]=a.skill,e[6]=l):l=e[6];const c=l;let h;if(e[7]!==s?.params.appSlug||e[8]!==s?.params.collectionName||e[9]!==s?.params.itemId||e[10]!==c||e[11]!==t){if(h=[],t&&h.push(`### Selected Agent
2
- - ID: ${t}`),c){let f;e[13]!==c?(f=xn(c),e[13]=c,e[14]=f):f=e[14];const k=f;let M;e[15]!==c?(M=kn(c),e[15]=c,e[16]=M):M=e[16],h.push(`### Currently Open File
3
- The user has this file open in the Library and is most likely referring to it:
4
- - Name: ${M}
5
- - Library path: ${c}${k?`
6
- - Read/edit it with your file tools at: \`${k}\``:""}
7
-
8
- When a request is ambiguous about which file or resource it targets (e.g. "change the h1", "fix this", "what's in this file", "update the title"), assume it means this file unless the user clearly indicates otherwise.`)}let m;e[17]!==s?.params.appSlug||e[18]!==s?.params.collectionName||e[19]!==s?.params.itemId?(m=[],s?.params.appSlug&&m.push(`- Connection ID: ${s?.params.appSlug}`),s?.params.collectionName&&m.push(`- Collection: ${s?.params.collectionName}`),s?.params.itemId&&m.push(`- Item ID: ${s?.params.itemId}`),e[17]=s?.params.appSlug,e[18]=s?.params.collectionName,e[19]=s?.params.itemId,e[20]=m):m=e[20],m.length>0&&h.push(`### Current Resource
9
- The user is viewing the following resource:
10
- ${m.join(`
11
- `)}
12
-
13
- Help the user understand and work with this resource.`),e[7]=s?.params.appSlug,e[8]=s?.params.collectionName,e[9]=s?.params.itemId,e[10]=c,e[11]=t,e[12]=h}else h=e[12];return h.join(`
14
-
15
- `)}function wn(){const t=ie.c(5),e=Ve(),{org:n}=J();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},t[0]=s):s=t[0];const o=ct(s);let a;return t[1]!==o?.params||t[2]!==n||t[3]!==e?(a=l=>{const h=l.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!h||!h[1])return;const m=h[1],f=o?.params.appSlug;if(!f)return;e.invalidateQueries({queryKey:de.collection(n.slug,f,m)});const k=m.toLowerCase().replace(/_/g," ");ce.success(`${k} updated`)},t[1]=o?.params,t[2]=n,t[3]=e,t[4]=a):a=t[4],a}function Mn(){const t=ie.c(4),{org:e,project:n}=J(),s=`${e.id}/${n.id}`;let o;t[0]!==s?(o=ge.taskLastViewed(s),t[0]=s,t[1]=o):o=t[1];const[,a]=be(o,Tn);let l;return t[2]!==a?(l={markTaskRead:h=>{a(m=>({...m,[h]:new Date().toISOString()}))}},t[2]=a,t[3]=l):l=t[3],l}function Tn(t){return t??{}}function yt(){const t=dt(),{org:e}=J(),n=je({strict:!1}),s=It({strict:!1}),o=n.virtualmcpid??jt(e.id).id,a=(h,m)=>{t({to:"/$org/$taskId",params:{org:e.slug,taskId:h},search:f=>{const k={},M=m?.virtualMcpId??f.virtualmcpid;M&&(k.virtualmcpid=M);const p=f.main;return p&&typeof p=="string"&&!Rt(p)&&(k.main=p),(f.sidepanel==="chat"||f.sidepanel===0)&&(k.sidepanel=f.sidepanel),m?.autosend&&(k.autosend=ut),k}})},l=v.useRef(crypto.randomUUID()),c=s.taskId??l.current;return{virtualMcpId:o,taskId:c,navigateToTask:a}}function Cn(t,e){const{mimeType:n,data:s}=t;if(n.startsWith("text/"))try{const o=new TextDecoder().decode(Uint8Array.from(atob(s),a=>a.charCodeAt(0)));return[{type:"text",text:`${e}
16
- ${o}`}]}catch(o){console.error("Failed to decode text file:",o)}return[{type:"file",url:`data:${n};base64,${s}`,filename:e,mediaType:n}]}function ot(t,e){const n=[];for(const s of t)!s||typeof s!="object"||("text"in s&&s.text?n.push({type:"text",text:`[${e}]
17
- ${s.text}`}):"blob"in s&&s.blob&&s.mimeType&&n.push({type:"file",url:`data:${s.mimeType};base64,${s.blob}`,filename:String(s.uri),mediaType:String(s.mimeType)}));return n}function An(t,e){const n=(t.files??[]).filter(l=>l.content?.trim()),s=t.omittedPaths??[];if(n.length===0&&s.length===0)return[];const o=n.map(l=>`<skill-file path="${l.relPath}">
18
- ${l.content.trim()}
19
- </skill-file>`).join(`
20
-
21
- `),a=s.length>0?`
22
-
23
- Other files in \`${t.sandboxPath}/\`: ${s.join(", ")}`:"";return[{type:"text",text:`[${e}]
24
- ${o}${a}`}]}function Pn(t,e){const n=[];for(const s of t){if(s.role!=="user"||!s.content)continue;const o=Array.isArray(s.content)?s.content:[s.content];for(const a of o)switch(a.type){case"text":{const l=a.text?.trim();if(!l)continue;n.push({type:"text",text:`[${e}]
25
- ${l}`});break}case"image":case"audio":{if(!a.data||!a.mimeType)continue;n.push({type:"file",url:`data:${a.mimeType};base64,${a.data}`,mediaType:a.mimeType});break}case"resource":{const l=a.resource;if(!l||!l.mimeType)continue;l&&("text"in l&&l.text?n.push({type:"text",text:`[${e}]
26
- ${l.text}`}):"blob"in l&&l.blob&&l.mimeType&&n.push({type:"file",url:`data:${l.mimeType};base64,${l.blob}`,filename:String(l.uri),mediaType:String(l.mimeType)}));break}}}return n}function vt(t){if(!t)return[];const e=[];let n="";const s=o=>{if(o){if(o.type==="text"&&"text"in o&&typeof o.text=="string")n+=o.text;else if(o.type==="mention"&&o.attrs){const a=o.attrs.char??"/",l=`${a}${o.attrs.name}`;if(o.attrs.kind==="task"){const c=o.attrs.metadata,h=c?.title??o.attrs.name??"",m=c?.context?.trim()||[h,c?.description?.trim()].filter(Boolean).join(`
27
-
28
- `);m&&e.push({type:"text",text:m});return}if(n+=l,a==="@"){const c=o.attrs.metadata;c&&typeof c=="object"&&!Array.isArray(c)&&"agentId"in c?e.push({type:"text",text:`[DELEGATE TO AGENT: ${c.title??o.attrs.name} (agent_id: ${c.agentId})]
29
- Use the subtask tool to delegate this task to the agent above. Include the full relevant context from this conversation in the prompt field — the subagent has no conversation history.`}):Array.isArray(c)&&e.push(...ot(c,l))}else if(o.attrs.kind==="skill"){const c=o.attrs.metadata;c&&!Array.isArray(c)&&Array.isArray(c.files)&&e.push(...An(c,l))}else{const c=o.attrs.metadata||o.attrs.prompts||[];Array.isArray(c)&&c.length>0&&typeof c[0]=="object"&&c[0]!==null&&"role"in c[0]?e.push(...Pn(c,l)):Array.isArray(c)&&e.push(...ot(c,l))}}else if(o.type==="file"&&o.attrs){const a=o.attrs,l=`[file:://${encodeURIComponent(a.name)}]`;n+=l,e.push(...Cn(a,l))}if("content"in o&&Array.isArray(o.content))for(const a of o.content)s(a)}};return s(t),n.trim()&&e.unshift({type:"text",text:n.trim()}),e}function gs(t){const e=vt(t);return e.length===0?[]:[{id:crypto.randomUUID(),role:"user",parts:e,metadata:{tiptapDoc:t}}]}function ys(t){return new Set(t.filter(e=>e.status==="queued").map(e=>e.messageId))}function _n(t){return(t??[]).map(e=>e?.type==="text"&&typeof e.text=="string"?e.text:"").join("").trim()}function vs(t){return t.filter(e=>e.status==="queued").sort((e,n)=>e.enqueuedAt-n.enqueuedAt)}function Rn(t,e){return t.some(n=>n.messageId===e.messageId)?t:[...t,e]}function Dn(t,e){return t.filter(n=>n.messageId!==e)}const at=new Map,Xe=new Set;function En(t){Xe.add(t)}function $n(t){return Xe.has(t)}function Un(t){Xe.delete(t)}function Te(t){let e=at.get(t);return e||(e=new Ot([]),at.set(t,e)),e}function St(t,e){Te(t).update(n=>Rn(n,e))}function qe(t,e){Te(t).update(n=>Dn(n,e))}function On(t,e){Te(t).set(e)}const Re=new Map;function Ln(t,e){Re.set(`${t}:${e.id}`,e)}function Nn(t,e){const n=`${t}:${e}`,s=Re.get(n);return Re.delete(n),s}function it(t,e){Re.delete(`${t}:${e}`)}async function oe(t,e){try{const n=await fetch(`/api/${encodeURIComponent(t)}/decopilot/queue/${encodeURIComponent(e)}`,{credentials:"include"});if(!n.ok)return;const s=await n.json();On(e,s.items??[])}catch{}}function Ss(t){const e=ie.c(2);let n;e[0]!==t?(n=Te(t),e[0]=t,e[1]=n):n=e[1];const s=n;return v.useSyncExternalStore(s.subscribe,s.get,s.get)}function Fn(){const{org:t}=J();return{enqueue:St,refresh:e=>oe(t.slug,e),cancel:async(e,n)=>{const s=`thread-run:${e}:${n}`;qe(e,n);try{const o=await fetch(`/api/${encodeURIComponent(t.slug)}/decopilot/queue/${encodeURIComponent(e)}/cancel/${encodeURIComponent(s)}`,{method:"POST",credentials:"include"});if(!o.ok&&o.status!==404)throw new Error(`Cancel failed: ${o.status}`);return!0}catch(o){return ce.error(o instanceof Error?o.message:"Failed to cancel"),!1}finally{await oe(t.slug,e)}}}}function _e(t,e){return t.find(n=>n!=null&&e.has(n.keyId))??null}function qn(t,e,n){const s=o=>_e([o],n);return{tiers:{fast:_e([e.tiers.fast,t.tiers.fast],n),smart:_e([e.tiers.smart,t.tiers.smart],n),thinking:_e([e.tiers.thinking,t.tiers.thinking],n),image:s(t.tiers.image),web_search:s(t.tiers.web_search),deep_research:s(t.tiers.deep_research)}}}const we={tiers:{}};function jn(){const t=ie.c(7),{org:e}=J();let n;t[0]!==e.id?(n=de.userModelPreferences(e.id),t[0]=e.id,t[1]=n):n=t[1];let s;t[2]!==e.slug?(s=async()=>{const a=await Xt(e.slug,"USER_MODEL_PREFERENCES_GET",{});return a?.tiers?a:we},t[2]=e.slug,t[3]=s):s=t[3];let o;return t[4]!==n||t[5]!==s?(o={queryKey:n,queryFn:s,staleTime:6e4},t[4]=n,t[5]=s,t[6]=o):o=t[6],wt(o)}function Vn(){return jn().data??we}function ks(){const t=ie.c(19),{org:e}=J(),n=zt(),s=Ve();let o;t[0]!==e.id?(o=de.userModelPreferences(e.id),t[0]=e.id,t[1]=o):o=t[1];const a=o;let l;t[2]!==a||t[3]!==s||t[4]!==n?(l=async M=>{const p=s.getQueryData(a)??we;return await n.call("USER_MODEL_PREFERENCES_UPDATE",p)??p},t[2]=a,t[3]=s,t[4]=n,t[5]=l):l=t[5];let c,h,m,f;t[6]!==a||t[7]!==s?(c=M=>{const{tier:p,slot:A}=M,F=s.getQueryData(a),q=F??we;return s.setQueryData(a,{tiers:{...q.tiers,[p]:A}}),{prev:F}},h=(M,p,A)=>{s.setQueryData(a,A?.prev??we)},m=M=>{s.setQueryData(a,M)},f=()=>{s.isMutating({mutationKey:a})===1&&s.invalidateQueries({queryKey:a})},t[6]=a,t[7]=s,t[8]=c,t[9]=h,t[10]=m,t[11]=f):(c=t[8],h=t[9],m=t[10],f=t[11]);let k;return t[12]!==a||t[13]!==l||t[14]!==c||t[15]!==h||t[16]!==m||t[17]!==f?(k={mutationKey:a,mutationFn:l,onMutate:c,onError:h,onSuccess:m,onSettled:f},t[12]=a,t[13]=l,t[14]=c,t[15]=h,t[16]=m,t[17]=f,t[18]=k):k=t[18],Mt(k)}function Bn(){const t=ie.c(4),e=Zt(),n=Vn(),s=pt();let o;return t[0]!==s||t[1]!==e||t[2]!==n?(o=qn(e,n,new Set(s.map(Hn))),t[0]=s,t[1]=e,t[2]=n,t[3]=o):o=t[3],o}function Hn(t){return t.id}function le(t,e,n,s){if(!t)return null;const o=e.find(l=>l.id===t.keyId);if(!o)return null;const a=n.find(l=>l.modelId===t.modelId);return a?{...a,keyId:t.keyId}:{modelId:t.modelId,title:s??t.modelId,keyId:t.keyId,providerId:o.providerId,description:null,logo:null,capabilities:[],limits:null,costs:null}}function Kn(t){return t==="fast"||t==="smart"||t==="thinking"?t:"smart"}function Qn(t,e,n,s){if(!n||s.length===0)return null;const o=e.find(h=>h.id===n);if(!o)return null;const a=Kt([o],{[n]:s}),l=t==="fast"?a.chat.fast:t==="thinking"?a.chat.thinking:a.chat.smart;if(!l)return null;const c=s.find(h=>h.modelId===l.modelId);return c?{...c,keyId:n}:null}const rt=new Set,se=new Set;function fe(t){return v.useSyncExternalStore(t.subscribe,t.get,t.get)}function Wn(t){return t.kind==="loading"?"ready":t.kind}const Gn=1e4,zn=10,Ze=v.createContext(null),Ye=v.createContext(null),Je=v.createContext(null),kt=v.createContext(null);function Xn({children:t}){const{locator:e}=J(),{virtualMcpId:n}=yt(),[s,o]=be(ge.chatSelectedImageModel(e),null),[a,l]=be(ge.chatSelectedWebSearchModel(e),null),[c,h]=be(ge.chatSelectedDeepResearchModel(e),null),[m,f]=v.useState(null),[k,M]=v.useState("default"),p=Bn(),[A,F]=be(ge.chatSimpleModeTier(e),null),q=Kn(A),x=pt(),T=p.tiers[q],j=x.some(r=>r.id===T?.keyId)?T?.keyId:void 0,W=m&&x.some(r=>r.id===m)?m:j??x[0]?.id??null,{models:V,isLoading:_}=Se(W??void 0),{models:z}=Se(j),$=x.some(r=>r.id===p.tiers.image?.keyId)?p.tiers.image?.keyId:void 0,{models:ee}=Se($),B=x.some(r=>r.id===p.tiers.web_search?.keyId)?p.tiers.web_search?.keyId:void 0,{models:H}=Se(B),te=x.some(r=>r.id===p.tiers.deep_research?.keyId)?p.tiers.deep_research?.keyId:void 0,{models:K}=Se(te),G=le(T,x,z,T?.title)??Qn(q,x,W,V),ne=_,X=V.filter(r=>r.capabilities?.includes("image")),b=le(s,x,X),D=le(p.tiers.image,x,ee,p.tiers.image?.title)??b??X[0]??null,L=V.filter(Qt),P=le(a,x,L),Q=L.find(r=>r.modelId==="perplexity/sonar")??L[0]??null,pe=le(p.tiers.web_search,x,H,p.tiers.web_search?.title)??P??Q,Z=V.filter(Wt),N=le(c,x,Z),ye=Z.find(r=>r.modelId==="perplexity/deep-research")??Z.find(r=>r.asyncResearch===!0)??Z[0]??null,Ee=le(p.tiers.deep_research,x,K,p.tiers.deep_research?.title)??N??ye,Ue=Ht(n)??{id:n,title:"",description:null,icon:null},[Ce,ve]=v.useState({}),Ae=(r,g)=>{const O=[];for(const w of g.content??[])w.type==="text"&&w.text?.trim()&&O.push(w.text.trim());const R=O.join(`
30
- `);if(!R){re(r);return}new TextEncoder().encode(R).length>Gn||ve(w=>Object.keys(w).length>=zn&&!(r in w)?w:{...w,[r]:R})},re=r=>{ve(g=>{const{[r]:O,...R}=g;return R})},[Oe,Le]=be(ge.chatLastAgentOption(e),r=>r&&r in Fe?r:null),Y=Jn(),et=Y?.isThreadLocked&&Y.lockedHarness!=null?hn(Y.lockedHarness,Y.lockedSandbox):null;mn({pendingOption:Oe,lockedHarness:Y?.isThreadLocked?Y.lockedHarness:null});const he=Y?.isThreadLocked?et:"decopilot",Pe=he?Fe[he]:null,d=Pe?.harness??null,u=Pe?.sandbox??null,[E,U]=v.useState(void 0),y=v.useRef(E);y.current=E;const I={selectedModel:G,setModel:()=>{},credentialId:W,setCredentialId:f,allModelsConnections:x,isModelsLoading:ne,selectedVirtualMcp:Ue,imageModel:D,setImageModel:r=>{o(r?.keyId?{keyId:r.keyId,modelId:r.modelId}:null)},webSearchModel:pe,setWebSearchModel:r=>{l(r?.keyId?{keyId:r.keyId,modelId:r.modelId}:null)},deepResearchModel:Ee,setDeepResearchModel:r=>{h(r?.keyId?{keyId:r.keyId,modelId:r.modelId}:null)},chatMode:k,setChatMode:M,appContexts:Ce,setAppContext:Ae,clearAppContext:re,tiptapDoc:E,setTiptapDoc:U,tiptapDocRef:y,resetInteraction:()=>{},simpleModeTier:q,setSimpleModeTier:r=>F(r),pendingAgentOption:he,setPendingAgentOption:Le,pendingHarnessId:d,pendingSandboxProviderKind:u};return Ie.jsx(Je.Provider,{value:I,children:t})}function xs(t){const e=ie.c(41),{virtualMcpId:n,task:s,children:o}=t,{locator:a}=J(),{data:l}=Tt.useSession(),c=l?.user??null,{taskId:h,virtualMcpId:m,navigateToTask:f}=yt(),[k]=Ct(),{markTaskRead:M}=Mn(),p=Ft(),A=h,F=m,q=In(F);let x;e[0]!==M||e[1]!==f?(x=(P,Q)=>{M(P),f(P,{virtualMcpId:Q?.virtualMcpId,autosend:Q?.autosend})},e[0]=M,e[1]=f,e[2]=x):x=e[2];const T=x,j=A&&s?.id===A?s:null,W=j?.harness_id??null,V=j?.sandbox_provider_kind??null,_=j?.branch??null,z=W!=null,$=_;let ee;e[3]!==$||e[4]!==T||e[5]!==p||e[6]!==n?(ee=()=>{const P=crypto.randomUUID();return p.create({id:P,virtual_mcp_id:n,...$?{branch:$}:{}}).then(()=>T(P)).catch(()=>{T(P)}),P},e[3]=$,e[4]=T,e[5]=p,e[6]=n,e[7]=ee):ee=e[7];const B=ee;let H;e[8]!==$||e[9]!==a||e[10]!==T||e[11]!==p||e[12]!==n?(H=P=>{const Q=crypto.randomUUID(),pe=P.virtualMcpId??n,Z=pe===n?$:null;Ut(sessionStorage,a,Q,P.message),p.create({id:Q,virtual_mcp_id:pe,...Z?{branch:Z}:{}}).then(()=>T(Q,{virtualMcpId:P.virtualMcpId,autosend:!0})).catch(()=>{T(Q,{virtualMcpId:P.virtualMcpId,autosend:!0})})},e[8]=$,e[9]=a,e[10]=T,e[11]=p,e[12]=n,e[13]=H):H=e[13];const te=H;let K;e[14]!==A||e[15]!==p?(K=P=>{A&&p.setBranch(A,P)},e[14]=A,e[15]=p,e[16]=K):K=e[16];let G;e[17]!==j||e[18]!==B||e[19]!==te||e[20]!==$||e[21]!==A||e[22]!==F||e[23]!==z||e[24]!==_||e[25]!==W||e[26]!==V||e[27]!==T||e[28]!==K?(G={virtualMcpId:F,taskId:A,openTask:T,createTask:B,createTaskWithMessage:te,activeTask:j,isThreadLocked:z,lockedHarness:W,lockedSandbox:V,lockedBranch:_,currentBranch:$,setCurrentTaskBranch:K},e[17]=j,e[18]=B,e[19]=te,e[20]=$,e[21]=A,e[22]=F,e[23]=z,e[24]=_,e[25]=W,e[26]=V,e[27]=T,e[28]=K,e[29]=G):G=e[29];const ne=G;let X;e[30]!==q||e[31]!==k||e[32]!==f||e[33]!==c?(X={user:c,contextPrompt:q,preferences:k,rawNavigateToTask:f},e[30]=q,e[31]=k,e[32]=f,e[33]=c,e[34]=X):X=e[34];const b=X;let D;e[35]!==o||e[36]!==b?(D=Ie.jsx(Xn,{children:Ie.jsx(kt.Provider,{value:b,children:o})}),e[35]=o,e[36]=b,e[37]=D):D=e[37];let L;return e[38]!==D||e[39]!==ne?(L=Ie.jsx(Ye.Provider,{value:ne,children:D}),e[38]=D,e[39]=ne,e[40]=L):L=e[40],L}function Is({taskId:t,children:e}){const n=De(),s=qt(),{virtualMcpId:o,activeTask:a,currentBranch:l}=Zn(),c=bn({isDesktopApp:s,harnessId:a?.harness_id,sandboxProviderKind:a?.sandbox_provider_kind}),h=n("chat.input.codingAgentRequiresDesktop");t&&!rt.has(t)&&(rt.add(t),Pt("chat_opened",{thread_id:t}));const{imageModel:m,webSearchModel:f,deepResearchModel:k,chatMode:M,setChatMode:p,appContexts:A,setTiptapDoc:F,simpleModeTier:q}=Yn(),x=v.useContext(kt);if(!x)throw new Error(n("chat.chatContext.activeTaskProviderMissingContext"));const{user:T,contextPrompt:j,preferences:W,rawNavigateToTask:V}=x,{org:_,locator:z}=J(),$=Fn(),[ee,B]=v.useState(null),H=()=>{B(new Error(h))},te=wn(),K=Ve(),G=Lt(),ne=dt(),X=Vt({connectionId:Bt,orgId:_.id,orgSlug:_.slug}),b=Nt(_.slug,t,{client:X});v.use(b.ready);const D=fe(b.messages),L=fe(b.status),P=fe(b.finishReason),Q=fe(b.runStatusStage),pe=fe(b.hasMoreOlder),Z=fe(b.isFetchingOlder),N=v.useRef({onToolCall:te,queryClient:K,rawNavigateToTask:V,taskId:t,manager:G,navigate:ne,orgId:_.id,orgSlug:_.slug});N.current={onToolCall:te,queryClient:K,rawNavigateToTask:V,taskId:t,manager:G,navigate:ne,orgId:_.id,orgSlug:_.slug},Gt({orgSlug:_.slug,taskId:t,onTaskStatus:d=>{const u=N.current,E=d.data.message_id;if(d.data.status==="in_progress"&&E){qe(u.taskId,E);const U=Nn(u.taskId,E);U&&b.applyLocalMessage(U),oe(u.orgSlug,u.taskId)}$n(u.taskId)&&(async()=>(await oe(u.orgSlug,u.taskId),await b.reconcileFromServer()&&Te(u.taskId).get().length===0&&Un(u.taskId)))()}}),v.useEffect(()=>{const d={onData:y=>{if(y.type==="data-thread-title"){const I=y.data;if(!I?.title)return;const r=N.current;if(!r.taskId)return;r.manager.patchThread({id:r.taskId,title:I.title,updated_at:new Date().toISOString()});return}if(y.type==="data-deck-updated"){const I=y.data;if(!I?.path)return;const r=I.path,g=N.current;g.queryClient.invalidateQueries({queryKey:de.orgFsStat(g.orgId,"home",r)}),g.queryClient.invalidateQueries({queryKey:de.orgFsRecent(g.orgId)}),g.navigate({to:".",search:O=>({...O,main:$t(r)}),replace:!0});return}if(y.type==="data-open-preview"){const I=y.data,r=N.current,g=r.taskId;if(g){const O=r.manager.threads.get().find(R=>R.id===g);r.manager.patchThread({id:g,...I?.branch?{branch:I.branch}:{},...I?.sandboxProviderKind?{sandbox_provider_kind:I.sandboxProviderKind}:{},metadata:{...O?.metadata??{},...I?.githubRepo?{githubRepo:I.githubRepo}:{},...I?.sandboxMap?{sandboxMap:I.sandboxMap}:{}}})}r.navigate({to:".",search:O=>({...O,main:"preview"}),replace:!0});return}},onFinish:(y,I,r)=>{const g=N.current;g.taskId&&oe(g.orgSlug,g.taskId),g.taskId&&g.manager.patchThread({id:g.taskId,status:pn(r,y.parts),updated_at:new Date().toISOString()});const O=y.parts?.some(w=>{const me=w;return(me.type==="tool-share_with_user"||me.type==="tool-bash"||me.type==="tool-write")&&me.state==="output-available"});if(g.taskId&&O){const w=de.threadOutputs(g.taskId);for(const me of[0,1500,3e3,6e3,12e3,25e3])setTimeout(()=>{g.queryClient.invalidateQueries({queryKey:w})},me)}g.queryClient.invalidateQueries({queryKey:de.homeNextActions(g.orgSlug)});const R=y.metadata?.thread_id;R&&R!==g.taskId&&g.rawNavigateToTask(R)},onError:y=>{B(y),console.error("[chat] Error",y)},onToolCall:y=>N.current.onToolCall(y)};b.observer=d,oe(N.current.orgSlug,N.current.taskId);const u=y=>y==="submitted"||y==="streaming";let E=u(b.status.get().kind);const U=b.status.subscribe(()=>{const y=u(b.status.get().kind);if(y===E)return;E=y;const I=N.current;oe(I.orgSlug,I.taskId)});return()=>{b.observer===d&&(b.observer=null),U()}},[b]);const ye=L.kind==="submitted"||L.kind==="streaming",Ee=D.length===0,$e=D.at(-1),Ue=!ye&&$e?.role==="assistant"&&$e.parts.some(d=>"state"in d&&d.state==="approval-requested"),Ce=a,ve=(Ce?.status==="in_progress"||Ce?.status==="expired")&&L.kind==="ready"&&D.length>0;async function Ae(d){const u=t,E=o;if(c)return H(),se.delete(u),!1;const U=Object.entries(A),y=U.length>0?U.map(([R,w])=>`### App Context: ${R}
31
- ${w}`).join(`
32
-
33
- `):"",I=[j,y].filter(Boolean).join(`
34
-
35
- `);let r=M;r==="gen-image"&&!m&&(r="default"),r==="web-search"&&!f&&(r="default"),r==="deep-research"&&!k&&(r="default"),(r==="web-search"||r==="deep-research")&&p("default");const g=fn({thread:a?{harness_id:a.harness_id??null,sandbox_provider_kind:a.sandbox_provider_kind??null,branch:a.branch??null}:null,globals:{branch:l}});a?.harness_id||G.patchThread({id:u,harness_id:g.harnessId??"decopilot",updated_at:new Date().toISOString()});const O={tier:q,mode:r,toolApprovalLevel:W.toolApprovalLevel??At(),system:I||void 0,agent:{id:E},thread_id:u,...g};try{if(ye||ve){let R=!0;try{Ln(u,d),await b.enqueue(d,O),St(u,{workflowId:`thread-run:${u}:${d.id}`,messageId:d.id,text:_n(d.parts),hasAttachments:d.parts.some(w=>w.type==="file"),status:"queued",enqueuedAt:Date.now(),optimistic:!0}),En(u)}catch(w){R=!1,it(u,d.id),qe(u,d.id),B(w instanceof Error?w:new Error(String(w))),ce.error(w instanceof Error?w.message:n("chat.chatContext.failedToQueueMessage"))}return oe(_.slug,u),R}return await b.submit({kind:"message",message:d},O),!0}finally{se.delete(u)}}async function re(d){const u=d.parts??vt(d.tiptapDoc);if(u.length===0||se.has(t))return;se.add(t),B(null),F(void 0);const E={tiptapDoc:d.tiptapDoc,created_at:new Date().toISOString(),user:{avatar:T?.image??void 0,name:T?.name??"you"}},U={id:crypto.randomUUID(),role:"user",parts:u,metadata:E};await Ae(U)}async function Oe(d,u){if(c)return H(),!1;if(se.has(t))return ce.info(n("chat.chatContext.stillSendingPreviousMessage")),!1;if(se.add(t),!await $.cancel(t,d))return se.delete(t),ce.error(n("chat.chatContext.couldNotRemoveOriginalMessage")),!1;it(t,d),b.removeLocalMessage(d);const U={id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:u}],metadata:{created_at:new Date().toISOString(),user:{avatar:T?.image??void 0,name:T?.name??"you"}}};try{return await Ae(U)}catch(y){return ce.error(y instanceof Error?y.message:n("chat.chatContext.failedToSendEditedMessage")),!1}}const Le=async()=>{b.stop();try{const d=await fetch(`/api/${_.slug}/decopilot/cancel/${t}`,{method:"POST",credentials:"include"});if(d.status===404)return;if(!d.ok){const u=await d.json().catch(()=>({}));throw new Error(u.message??n("chat.chatContext.cancelFailedStatus",{status:d.status}))}}catch(d){const u=d instanceof Error?d.message:n("chat.chatContext.failedToCancel");ce.error(u),console.error("[chat] cancelRun",d)}},Y=d=>d&&typeof d=="object"&&"type"in d?re({tiptapDoc:d}):re(d),he=je({strict:!1}).autosend===ut;v.useEffect(()=>{if(!he||D.length>0||c)return;const d=Dt(sessionStorage,z,t);d&&re(d.message).then(()=>{Et(sessionStorage,z,t)})},[he,D.length,c,z,t,re]);const Pe={messages:D,status:Wn(L),sendMessage:Y,editQueuedMessage:Oe,stop:()=>{if(c){H();return}Le()},submit:async(d,u)=>{if(c){H();return}await b.submit(d,u)},removeLocalMessage:d=>b.removeLocalMessage(d),isSendInFlight:()=>se.has(t),error:ee,clearError:()=>B(null),finishReason:P,runStatusStage:Q,clearFinishReason:()=>b.finishReason.set(null),isStreaming:ye,isChatEmpty:Ee,isWaitingForApprovals:Ue??!1,isRunInProgress:ve,hasMoreOlder:pe,isFetchingOlder:Z,fetchOlderMessages:b.fetchOlderMessages.bind(b)};return Ie.jsx(Ze.Provider,{value:Pe,children:e})}function ws(){const t=De(),e=v.useContext(Ze);if(!e)throw new Error(t("chat.chatContext.useChatStreamMissingContext"));return e}function Ms(){return v.useContext(Ze)}function Zn(){const t=De(),e=v.useContext(Ye);if(!e)throw new Error(t("chat.chatContext.useChatTaskMissingContext"));return e}function Yn(){const t=De(),e=v.useContext(Je);if(!e)throw new Error(t("chat.chatContext.useChatPrefsMissingContext"));return e}function Ts(){return v.useContext(Je)}function Jn(){return v.useContext(Ye)}export{Is as A,bs as B,Xn as C,yt as D,tn as E,Ts as F,gn as H,sn as S,ps as V,ws as a,Zn as b,Ss as c,Fn as d,it as e,_e as f,jn as g,ks as h,Bn as i,Ms as j,Jn as k,bn as l,xs as m,ys as n,ds as o,us as p,vt as q,Sn as r,vs as s,gs as t,Yn as u,kn as v,ms as w,hs as x,fs as y,gt as z};