dorkos 0.101.0 → 0.103.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 (208) hide show
  1. package/README.md +10 -10
  2. package/dist/bin/cli.js +2935 -1738
  3. package/dist/browser/native/package-manifest.json +1 -1
  4. package/dist/browser/source-manifest.json +1 -1
  5. package/dist/client/assets/{AboutPage-CwxCTicf.js → AboutPage-BNVLNd3q.js} +1 -1
  6. package/dist/client/assets/{ActivityRow-D0QQ0SFu.js → ActivityRow-CvjAfRBM.js} +1 -1
  7. package/dist/client/assets/AdapterIcon-wGSXBn-k.js +1 -0
  8. package/dist/client/assets/AdapterSetupWizard-CmSJ2sno.js +2 -0
  9. package/dist/client/assets/{AgentRequestCard-BLLmoAES.js → AgentRequestCard-D62XQXBM.js} +4 -4
  10. package/dist/client/assets/{AppearancePage-GqrWckTQ.js → AppearancePage-Bds0L-wm.js} +1 -1
  11. package/dist/client/assets/{AttentionSignalRow-sEhnIPBB.js → AttentionSignalRow-C6RkjCWK.js} +1 -1
  12. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BXjzhT_D.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CerNarG-.js} +24 -24
  13. package/dist/client/assets/{BlintzCanvas-CXi0fvcM.js → BlintzCanvas-CUqethk_.js} +24 -24
  14. package/dist/client/assets/{CanvasCsvContent-QhDSf8Pd.js → CanvasCsvContent-DdbIUPMJ.js} +1 -1
  15. package/dist/client/assets/CanvasFileContent-CX2VNF4o.js +2 -0
  16. package/dist/client/assets/CanvasModel3dContent-OprkQsgq.js +2 -0
  17. package/dist/client/assets/{CodeMirrorDiff-BMG7DBg2.js → CodeMirrorDiff-BnMdmI0K.js} +1 -1
  18. package/dist/client/assets/{CodeMirrorEditor-BYdz0ipX.js → CodeMirrorEditor-C7T-DaVA.js} +1 -1
  19. package/dist/client/assets/ConnectionAccessLists-B3QGnSxM.js +1 -0
  20. package/dist/client/assets/ConnectionsPage-E3br6maQ.js +11 -0
  21. package/dist/client/assets/{ConventionPage-y-Zq3Klp.js → ConventionPage-vMN5qEwP.js} +3 -3
  22. package/dist/client/assets/{ExtensionPageRoute-gZKKPhaj.js → ExtensionPageRoute-DFkPAzjs.js} +2 -2
  23. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-CbKIa11X.js → FloatingTanStackRouterDevtools-CqogiFob-BP4itJWW.js} +1 -1
  24. package/dist/client/assets/HandlePage-De4D_IVs.js +1 -0
  25. package/dist/client/assets/{LexicalField-Ceoa9flp.js → LexicalField-BbUXXxTw.js} +1 -1
  26. package/dist/client/assets/{ManagesPage-Dcqdm6I8.js → ManagesPage-DsNSZHug.js} +1 -1
  27. package/dist/client/assets/Marketplace-D4zHIIak.js +36 -0
  28. package/dist/client/assets/MarketplaceSourcesView-DILS8-ca.js +1 -0
  29. package/dist/client/assets/{McpAppFrame-B1ThSf2U.js → McpAppFrame-Cl_2azg-.js} +2 -2
  30. package/dist/client/assets/McpSigninBody-TpoSImsV.js +1 -0
  31. package/dist/client/assets/{Model3dViewer-DlcQ3-LS.js → Model3dViewer-C-iyu5eV.js} +1 -1
  32. package/dist/client/assets/NamePage-C-3w8oeg.js +1 -0
  33. package/dist/client/assets/NewDirectMessageMenu-bJE7b4lX.js +1 -0
  34. package/dist/client/assets/{NotificationsPage-CQQIdLtI.js → NotificationsPage-CL23qwVw.js} +1 -1
  35. package/dist/client/assets/OperatorIdentityForm-ixaqUfIO.js +1 -0
  36. package/dist/client/assets/{PermissionsPage-TX-d7aVQ.js → PermissionsPage-D4xbxTkc.js} +1 -1
  37. package/dist/client/assets/{PersonalityPicker-C_9JVOva.js → PersonalityPicker-CTvPlN-k.js} +1 -1
  38. package/dist/client/assets/{PersonalityPopover-BoTED73t.js → PersonalityPopover-Coy0eaIg.js} +1 -1
  39. package/dist/client/assets/PhotoPage-DpEEXO3e.js +1 -0
  40. package/dist/client/assets/PreviewRefusedNotice-B2GLqLYi.js +1 -0
  41. package/dist/client/assets/{PromptSuggestionChips-B_oUtFMI.js → PromptSuggestionChips-YdKEWyNT.js} +1 -1
  42. package/dist/client/assets/RoomSurface-BwIBBvYq.js +44 -0
  43. package/dist/client/assets/{RoomsPage-zOjjpHdA.js → RoomsPage-DaEXPz65.js} +1 -1
  44. package/dist/client/assets/RunsOnPopover-tvbVPKVf.js +1 -0
  45. package/dist/client/assets/SessionsPage-CAdV_XBY.js +1 -0
  46. package/dist/client/assets/SkillsPage-B4F19LmV.js +1 -0
  47. package/dist/client/assets/{TasksPage-BZapA_v6.js → TasksPage-BXcaEx3V.js} +1 -1
  48. package/dist/client/assets/ToolsPage-BYBwPql_.js +2 -0
  49. package/dist/client/assets/{TopologyGraph-BMcPxZsA.js → TopologyGraph-CZ2Y5I2e.js} +1 -1
  50. package/dist/client/assets/TourHost-BNpDrN0O.js +1 -0
  51. package/dist/client/assets/UnlinkDialog-Zyuh5qZY.js +1 -0
  52. package/dist/client/assets/{UnreadDivider-KSqqcHKN.js → UnreadDivider-Dh67_mAz.js} +1 -1
  53. package/dist/client/assets/_shell-lcu5vkQ7.js +98 -0
  54. package/dist/client/assets/{_shell._home-Bp_p1VUv.js → _shell._home-CPV1Z64k.js} +1 -1
  55. package/dist/client/assets/_shell._home.activity-CEvkKYBD.js +1 -0
  56. package/dist/client/assets/_shell._home.index-tGnRLvY-.js +3 -0
  57. package/dist/client/assets/{_shell._home.tasks-BsBH_4tZ.js → _shell._home.tasks-CtpZNevK.js} +1 -1
  58. package/dist/client/assets/_shell._home.workspaces-D6tkWdS8.js +1 -0
  59. package/dist/client/assets/{_shell.channels-DWAHkDPV.js → _shell.channels-DbrQXIVv.js} +4 -4
  60. package/dist/client/assets/_shell.connections-C3Ho4S8R.js +6 -0
  61. package/dist/client/assets/{_shell.feedback-requests-Hjv640j9.js → _shell.feedback-requests-D9l7SJi1.js} +1 -1
  62. package/dist/client/assets/_shell.marketplace-BfY-kBJk.js +1 -0
  63. package/dist/client/assets/_shell.marketplace_.sources-B0km_EUs.js +1 -0
  64. package/dist/client/assets/_shell.session-O8MC-USm.js +54 -0
  65. package/dist/client/assets/{_shell.team-ctLQztjw.js → _shell.team-DvJK7irE.js} +4 -4
  66. package/dist/client/assets/_shell.x._extensionId-_-fII74H.js +1 -0
  67. package/dist/client/assets/_shell.x._extensionId_._-_-fII74H.js +1 -0
  68. package/dist/client/assets/agent-attention-BvnWcLpc.js +5 -0
  69. package/dist/client/assets/{agent-browser-CCN16ZOz.js → agent-browser-DsDp0cSX.js} +1 -1
  70. package/dist/client/assets/{banner-DOm9_4l-.js → banner-Cja2VfwN.js} +2 -2
  71. package/dist/client/assets/{file-exclamation-point-BKzL0QhY.js → file-exclamation-point-D8KYFYSh.js} +1 -1
  72. package/dist/client/assets/{highlighted-body-KPVGNVTW-DTxMTVdP.js → highlighted-body-KPVGNVTW-Chp5pHWq.js} +1 -1
  73. package/dist/client/assets/{hover-card-qzuFUCaR.js → hover-card-FvX18DHP.js} +1 -1
  74. package/dist/client/assets/{index-Dcs6e-U_.js → index-BFPRILKF.js} +1 -1
  75. package/dist/client/assets/{index-CtOB9fS3.js → index-BKCteC7q.js} +1 -1
  76. package/dist/client/assets/index-Bbffv0TQ.js +1247 -0
  77. package/dist/client/assets/{index-BMOfHKE0.js → index-BhatJcNc.js} +1 -1
  78. package/dist/client/assets/index-BroohPSu.js +1 -0
  79. package/dist/client/assets/{index-DT_v3O-B.js → index-Bt4vTnDj.js} +1 -1
  80. package/dist/client/assets/{index-DwzSdOh3.js → index-BwkmCRvO.js} +1 -1
  81. package/dist/client/assets/{index-CTai_TxZ.js → index-BzS1K2wS.js} +1 -1
  82. package/dist/client/assets/{index-C3XnoXTY.js → index-C6F5gzX-.js} +1 -1
  83. package/dist/client/assets/{index-BaB-skF0.js → index-CIzSi3tA.js} +3 -3
  84. package/dist/client/assets/{index-BPcwoJoz.js → index-CLCbHvV5.js} +1 -1
  85. package/dist/client/assets/{index-DA-i3I4q.js → index-CXjobHw0.js} +1 -1
  86. package/dist/client/assets/{index-DgH_dl1a.js → index-CYcJ7ENW.js} +2 -2
  87. package/dist/client/assets/{index-3lQkXKcq.js → index-CeqzGl3y.js} +1 -1
  88. package/dist/client/assets/{index-DgtF-nBt.js → index-CknNaeS2.js} +1 -1
  89. package/dist/client/assets/{index-Bk98IpMn.js → index-CtK6WJzD.js} +1 -1
  90. package/dist/client/assets/{index-C8ZMfyGc.js → index-CvxLe-_3.js} +1 -1
  91. package/dist/client/assets/{index-CF9fqPef.js → index-D24Ttd-y.js} +4 -4
  92. package/dist/client/assets/{index-CIPHHziB.js → index-D6Jn2eBq.js} +1 -1
  93. package/dist/client/assets/{index-D3DXMH4x.js → index-DDibi3-x.js} +1 -1
  94. package/dist/client/assets/{index-C7B2uRgo.js → index-DElGMXW8.js} +2 -2
  95. package/dist/client/assets/{index-CmlaXay_.js → index-DGNJkiFb.js} +1 -1
  96. package/dist/client/assets/{index-WjW-NUCp.js → index-DI2T-dXr.js} +1 -1
  97. package/dist/client/assets/{index-CLhD0Bno.js → index-DZf_utaG.js} +1 -1
  98. package/dist/client/assets/{index-CTXNRyRE.js → index-D_XtXoLp.js} +1 -1
  99. package/dist/client/assets/{index-CDTumWMC.js → index-DjdQaKwP.js} +1 -1
  100. package/dist/client/assets/index-Do18O9VZ.js +1 -0
  101. package/dist/client/assets/{index-CVl132_4.js → index-Do1vOFrm.js} +1 -1
  102. package/dist/client/assets/{index-BIMClIrX.js → index-Dv1DkyeB.js} +1 -1
  103. package/dist/client/assets/{index-IgIVF9T_.js → index-DyvLJ_Z5.js} +1 -1
  104. package/dist/client/assets/index-HgvJwMGi.js +5 -0
  105. package/dist/client/assets/{index-DR1JT9Uz.js → index-OxwtxTFo.js} +3 -3
  106. package/dist/client/assets/index-QSDTjavn.js +1 -0
  107. package/dist/client/assets/{index-DOxEmnH2.js → index-ZLdoJdwS.js} +1 -1
  108. package/dist/client/assets/index-_GlgFH88.css +1 -0
  109. package/dist/client/assets/{index-CScfHuKF.js → index-euarUu2E.js} +1 -1
  110. package/dist/client/assets/{index-B-z7hA9x.js → index-jYh6X22t.js} +1 -1
  111. package/dist/client/assets/{index-CIfwPLXd.js → index-uQ1vTS05.js} +1 -1
  112. package/dist/client/assets/{index-CejezM4U.js → index-xfBvKz-h.js} +1 -1
  113. package/dist/client/assets/{index-BW5ce4t8.js → index-znQ5q2gV.js} +1 -1
  114. package/dist/client/assets/{layers-CJHXSEKK.js → layers-8-cbYlfw.js} +1 -1
  115. package/dist/client/assets/{lightbulb-DWjxw7lb.js → lightbulb-DoB0IKly.js} +1 -1
  116. package/dist/client/assets/{mention-pill-akMU3IVs.js → mention-pill-BHC6tMG9.js} +1 -1
  117. package/dist/client/assets/{message-square-off-DEagHpQY.js → message-square-off-CEHuZJtY.js} +1 -1
  118. package/dist/client/assets/{owner-notice-CLsx0s7q.js → owner-notice-dtDSKfGs.js} +1 -1
  119. package/dist/client/assets/{page-container-W7byjRmk.js → page-container-BOrdASM1.js} +1 -1
  120. package/dist/client/assets/primer-trigger-CC-cR5zN.js +3 -0
  121. package/dist/client/assets/{radio-B8Ozjv9U.js → radio-BfZPhctR.js} +1 -1
  122. package/dist/client/assets/{room-files-source-Bsc3YA91.js → room-files-source-BHupFaLE.js} +2 -2
  123. package/dist/client/assets/{rotate-ccw-clock-CNcDcTvq.js → rotate-ccw-clock-BvzfP8lR.js} +1 -1
  124. package/dist/client/assets/{rotate-cw-xvfipJLN.js → rotate-cw-BDweizfR.js} +1 -1
  125. package/dist/client/assets/{scroll-area-C95q3ss7.js → scroll-area-Dph6w3a6.js} +1 -1
  126. package/dist/client/assets/{search-x-C6SAxw7a.js → search-x-CoFJOP2l.js} +2 -2
  127. package/dist/client/assets/{shield-x-DxOGc0dW.js → shield-x-BZ6rhiT0.js} +1 -1
  128. package/dist/client/assets/{soul-file-pg0ShYy3.js → soul-file-H8fwhgiL.js} +1 -1
  129. package/dist/client/assets/use-delete-binding-CUsepFIL.js +1 -0
  130. package/dist/client/assets/use-dev-links-DYYe0vvP.js +1 -0
  131. package/dist/client/assets/{use-external-adapter-catalog-B0gcY-k7.js → use-external-adapter-catalog-CAl3MNq-.js} +1 -1
  132. package/dist/client/assets/use-full-activity-feed-Bb7BUusp.js +1 -0
  133. package/dist/client/assets/use-is-below-desktop-CIgGSgoL.js +1 -0
  134. package/dist/client/assets/use-jump-back-in-BdLBzvDr.js +11 -0
  135. package/dist/client/assets/use-mesh-topology-wYtCBbF_.js +1 -0
  136. package/dist/client/assets/use-pending-read-9UcfnDwF.js +1 -0
  137. package/dist/client/assets/{use-personality-commit-OH7d0xl_.js → use-personality-commit-CaxUHrX5.js} +1 -1
  138. package/dist/client/assets/{use-promo-activation-BgdGasXE.js → use-promo-activation-rNaAOdoh.js} +2 -2
  139. package/dist/client/assets/use-pulse-freshness-CygG3s-S.js +1 -0
  140. package/dist/client/assets/use-room-follow-claim-BIK37Iy3.js +1 -0
  141. package/dist/client/assets/{use-roving-tab-list-Be60AWK3.js → use-roving-tab-list-DQgkKGzc.js} +1 -1
  142. package/dist/client/assets/{use-session-canvas-Bqs6IQO7.js → use-session-canvas-Dpy5BEId.js} +5 -5
  143. package/dist/client/assets/use-session-diagnostics-atu9cfgr.js +16 -0
  144. package/dist/client/assets/use-unclaimed-chats-qUI5vY5K.js +1 -0
  145. package/dist/client/index.html +2 -2
  146. package/dist/drizzle/20261008170031_session_touches.sql +5 -0
  147. package/dist/drizzle/20261009171311_chat_messages.sql +41 -0
  148. package/dist/drizzle/20261009173712_started_by_report_back.sql +1 -0
  149. package/dist/drizzle/meta/20261008170031_snapshot.json +12642 -0
  150. package/dist/drizzle/meta/20261009171311_snapshot.json +12906 -0
  151. package/dist/drizzle/meta/20261009173712_snapshot.json +12914 -0
  152. package/dist/drizzle/meta/_journal.json +21 -0
  153. package/dist/server/index.js +23608 -19236
  154. package/dist/server/index.js.map +2 -2
  155. package/package.json +6 -6
  156. package/dist/client/assets/AdapterIcon-CL-MyyKy.js +0 -1
  157. package/dist/client/assets/AdapterSetupWizard-C8HOvHLF.js +0 -2
  158. package/dist/client/assets/CanvasFileContent-ZZhdofR4.js +0 -2
  159. package/dist/client/assets/CanvasModel3dContent-DMMMZh4o.js +0 -2
  160. package/dist/client/assets/ConnectionAccessLists-PW1uzcGU.js +0 -1
  161. package/dist/client/assets/ConnectionsPage-EwitZwOE.js +0 -11
  162. package/dist/client/assets/HandlePage-CL3_n1CI.js +0 -1
  163. package/dist/client/assets/Marketplace-DsU-q1ZZ.js +0 -36
  164. package/dist/client/assets/MarketplaceSourcesView-D72YoKNR.js +0 -1
  165. package/dist/client/assets/McpSigninBody-Btg3PnYN.js +0 -1
  166. package/dist/client/assets/NamePage-Bzqj4Eob.js +0 -1
  167. package/dist/client/assets/NewDirectMessageMenu-89yeGqvy.js +0 -1
  168. package/dist/client/assets/OperatorIdentityForm-BhiB9tQp.js +0 -1
  169. package/dist/client/assets/PhotoPage-C3fMlebQ.js +0 -1
  170. package/dist/client/assets/PreviewRefusedNotice-ChCgdKWN.js +0 -1
  171. package/dist/client/assets/RoomSurface-CgtNuYhl.js +0 -39
  172. package/dist/client/assets/RunsOnPopover-JTm1cYuw.js +0 -1
  173. package/dist/client/assets/SessionsPage-D4kyvHQf.js +0 -6
  174. package/dist/client/assets/SkillsPage-KYUVzuVa.js +0 -1
  175. package/dist/client/assets/ToolsPage-CWpHMlrR.js +0 -2
  176. package/dist/client/assets/TourHost-VY1-sy1Y.js +0 -1
  177. package/dist/client/assets/UnlinkDialog-3p38G_9q.js +0 -1
  178. package/dist/client/assets/_shell-DAjwimLg.js +0 -93
  179. package/dist/client/assets/_shell._home.activity-tk-XApvX.js +0 -1
  180. package/dist/client/assets/_shell._home.index-BNVhSN0y.js +0 -3
  181. package/dist/client/assets/_shell._home.workspaces-DuXnjQh0.js +0 -1
  182. package/dist/client/assets/_shell.connections-DIm3mUHy.js +0 -6
  183. package/dist/client/assets/_shell.marketplace-DF6Y7mc0.js +0 -1
  184. package/dist/client/assets/_shell.marketplace_.sources-Do8cm7kq.js +0 -1
  185. package/dist/client/assets/_shell.session-DlN8iOl-.js +0 -43
  186. package/dist/client/assets/_shell.x._extensionId-0Q1rJtud.js +0 -1
  187. package/dist/client/assets/_shell.x._extensionId_._-0Q1rJtud.js +0 -1
  188. package/dist/client/assets/agent-attention-Dn__3LQE.js +0 -5
  189. package/dist/client/assets/hand-DLUdsiuR.js +0 -6
  190. package/dist/client/assets/index-CQWqpw_G.js +0 -1
  191. package/dist/client/assets/index-D5uYwabS.js +0 -1
  192. package/dist/client/assets/index-DFMDv6qR.js +0 -1
  193. package/dist/client/assets/index-DMYBI16t.js +0 -1252
  194. package/dist/client/assets/index-DbbZNAKk.js +0 -5
  195. package/dist/client/assets/index-Dgp1LmEk.css +0 -1
  196. package/dist/client/assets/primer-trigger-DuM9vVnV.js +0 -3
  197. package/dist/client/assets/use-delete-binding-CZVeHqn0.js +0 -1
  198. package/dist/client/assets/use-dev-links-Df2WkCic.js +0 -1
  199. package/dist/client/assets/use-full-activity-feed-SYcgdMZu.js +0 -1
  200. package/dist/client/assets/use-is-below-desktop-C5_YenEp.js +0 -1
  201. package/dist/client/assets/use-jump-back-in-DWUPb1gi.js +0 -11
  202. package/dist/client/assets/use-mesh-topology-HLzZIgis.js +0 -1
  203. package/dist/client/assets/use-pending-read-BuJknrxG.js +0 -1
  204. package/dist/client/assets/use-pulse-freshness-BlD-dM_g.js +0 -1
  205. package/dist/client/assets/use-rename-session-D3MuyK-F.js +0 -1
  206. package/dist/client/assets/use-room-follow-claim-CyjhzbRJ.js +0 -1
  207. package/dist/client/assets/use-session-diagnostics-CfKdB2iY.js +0 -16
  208. package/dist/client/assets/use-unclaimed-chats-lqMhotUB.js +0 -1
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/server/index.js.map
3
- size: 55519164 bytes
4
- sha256: 4263c9660e3b681e3138733d82ae0b3bb23e08c19462e6e9ab1ec6feb082669a
3
+ size: 55838531 bytes
4
+ sha256: 78a292b2f8ff09d836b56086ef33cf2789d4f89119cc2f699dcdbfe2876590b0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dorkos",
3
- "version": "0.101.0",
3
+ "version": "0.103.0",
4
4
  "description": "You, multiplied. Build and run your business with an agent team. Your agents join your team chat, take on real work, and build the tools your company runs on.",
5
5
  "license": "MIT",
6
6
  "author": "Dorian Collier",
@@ -55,7 +55,7 @@
55
55
  "@asteasolutions/zod-to-openapi": "9.1.0",
56
56
  "@composio/core": "0.21.0",
57
57
  "@inquirer/prompts": "^8.7.2",
58
- "@modelcontextprotocol/sdk": "1.30.1",
58
+ "@modelcontextprotocol/sdk": "1.31.0",
59
59
  "@ngrok/ngrok": "^1.7.0",
60
60
  "@openai/codex": "0.154.0",
61
61
  "@openai/codex-sdk": "~0.154.0",
@@ -85,14 +85,14 @@
85
85
  "typescript": "^5.9.3",
86
86
  "vitest": "^4.1.11",
87
87
  "@dorkos/browser": "0.0.0",
88
- "@dorkos/db": "0.0.0",
89
88
  "@dorkos/eslint-config": "0.0.0",
90
- "@dorkos/marketplace": "0.0.0",
91
89
  "@dorkos/harness": "0.0.0",
90
+ "@dorkos/db": "0.0.0",
91
+ "@dorkos/client": "0.0.0",
92
+ "@dorkos/marketplace": "0.0.0",
92
93
  "@dorkos/server": "0.0.0",
93
94
  "@dorkos/shared": "0.0.0",
94
- "@dorkos/typescript-config": "0.0.0",
95
- "@dorkos/client": "0.0.0"
95
+ "@dorkos/typescript-config": "0.0.0"
96
96
  },
97
97
  "scripts": {
98
98
  "build": "tsx scripts/build.ts",
@@ -1 +0,0 @@
1
- import{be as n,bf as r,j as c,bg as s,ab as g}from"./index-DMYBI16t.js";const T={connected:n.success,disconnected:n.neutral,error:n.error,starting:`${n.warning} ${r}`,stopping:`${n.warning} ${r}`,reconnecting:`${n.warning} ${r}`},_={connected:"Connected",disconnected:"Ready",error:"Error",starting:"Connecting…",stopping:"Stopping…",reconnecting:"Reconnecting…"};function d({iconId:i,adapterType:a,size:t=16,className:e}){const o=s[i??""]??s[a??""];return o?c.jsx(o,{size:t,className:e}):c.jsx(g,{className:e,style:{width:t,height:t}})}export{d as A,T as a,_ as b};
@@ -1,2 +0,0 @@
1
- import{Q as be,R as Ne,U as ze,a7 as qe,j as e,cw as Ee,cx as Te,r as m,cy as ie,gh as Me,cz as oe,gi as le,a6 as We,cA as ce,cB as de,gj as ue,dG as he,cC as pe,ft as I,bd as Y,O as J,gk as me,gl as $e,aa as U,dH as X,dI as Z,dJ as ee,dK as se,dL as te,I as re,eq as xe,aF as Ve,bc as De,B as k,gm as Se,er as Pe,ep as ae,aU as ke,a$ as Re,a_ as Oe,am as Le,fY as ge,gn as _e,go as Ge,gp as Ue,gq as Ie,gr as He,gs as Qe,gt as Ke,gu as Ye,fU as Je,d7 as Xe,gv as Ze,W as G,eJ as es,eK as ss,eL as ts,eM as rs,eN as as,eO as ns,gw as fe,gx as Q}from"./index-DMYBI16t.js";function ks(s={}){const t=be(),a=Ne();return ze({mutationFn:({id:r,updates:l})=>t.updateBinding(r,l),onSuccess:()=>{a.invalidateQueries({queryKey:[...qe]})},meta:s.suppressErrorToast?{suppressErrorToast:!0}:{errorLabel:s.errorLabel??"Couldn’t update that connection"}})}function is({field:s,value:t,onChange:a,error:r,allValues:l}){const[i,n]=m.useState("");if(s.showWhen&&l[s.showWhen.field]!==s.showWhen.equals)return null;const o=`config-field-${s.key}`,v=s.type==="select"&&s.displayAs==="radio-cards",h=t!=null?String(t):"",x=h==="***",y=()=>{if(x){n("");return}if(s.pattern&&h&&!new RegExp(s.pattern).test(h)){n(s.patternMessage??"Check the format");return}n("")},d=r??i;if(s.type==="boolean")return e.jsxs("div",{children:[e.jsxs(ie,{orientation:"horizontal",className:"items-center justify-between gap-4",children:[e.jsxs(Me,{className:"min-w-0",children:[e.jsxs(oe,{htmlFor:o,className:"text-sm font-medium",children:[s.label,s.required&&e.jsx("span",{"aria-hidden":"true",className:"text-destructive ml-0.5",children:"*"})]}),s.description&&e.jsx(le,{className:"text-xs",children:s.description})]}),e.jsx(We,{id:o,checked:!!t,onCheckedChange:N=>a(s.key,N)})]}),s.helpMarkdown&&e.jsxs(ce,{children:[e.jsxs(de,{className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ue,{className:"size-3"}),"Where do I find this?",e.jsx(he,{className:"size-3 transition-transform [[data-state=open]_&]:rotate-180"})]}),e.jsx(pe,{children:e.jsx("div",{className:"bg-muted/50 mt-2 rounded-md border p-3",children:e.jsx(I,{content:s.helpMarkdown,className:"text-xs"})})})]}),e.jsx(Y,{children:d&&e.jsx(J.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.15},className:"overflow-hidden",children:e.jsx(me,{className:"mt-1.5",children:d})})})]});const b=()=>{var N,C;switch(s.type){case"text":case"url":return e.jsx(re,{id:o,type:s.type==="url"?"url":"text",value:h,onChange:c=>a(s.key,c.target.value),placeholder:s.placeholder,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});case"password":return x?e.jsx(xe,{id:o,value:h,showPassword:!1,onChange:c=>{a(s.key,c.target.value.trim()),i&&n("")},onFocus:()=>a(s.key,""),onBlur:y,placeholder:"Saved · type to replace"}):e.jsx(xe,{id:o,value:h,visibleByDefault:s.visibleByDefault??!1,onChange:c=>{a(s.key,c.target.value.trim()),i&&n("")},onBlur:y,onPaste:()=>setTimeout(y,0),placeholder:s.placeholder,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});case"number":return e.jsx(re,{id:o,type:"number",value:h,onChange:c=>a(s.key,c.target.value?Number(c.target.value):void 0),placeholder:s.placeholder,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});case"select":return s.displayAs==="radio-cards"?e.jsx("div",{className:"grid grid-cols-2 gap-3",role:"radiogroup","aria-labelledby":`${o}-label`,"aria-required":s.required||void 0,children:(N=s.options)==null?void 0:N.map(c=>e.jsxs("button",{type:"button",role:"radio","aria-checked":h===c.value,onClick:()=>a(s.key,c.value),className:U("hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-ring flex flex-col items-start rounded-md border p-3 text-left transition outline-none focus-visible:ring-[3px]",h===c.value&&"border-primary ring-primary bg-accent/30 ring-1"),children:[e.jsx("span",{className:"text-sm font-medium",children:c.label}),c.description&&e.jsx("span",{className:"text-muted-foreground mt-1 text-xs",children:c.description})]},c.value))}):e.jsxs(X,{value:h,onValueChange:c=>a(s.key,c),children:[e.jsx(Z,{id:o,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0,children:e.jsx(ee,{placeholder:s.placeholder??"Select…"})}),e.jsx(se,{children:(C=s.options)==null?void 0:C.map(c=>e.jsx(te,{value:c.value,children:c.label},c.value))})]});case"textarea":return e.jsx($e,{id:o,value:h,onChange:c=>a(s.key,c.target.value),placeholder:s.placeholder,rows:3,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});default:return null}};return e.jsxs(ie,{children:[e.jsxs(oe,{id:`${o}-label`,htmlFor:v?void 0:o,children:[s.label,s.required&&!x&&e.jsx("span",{"aria-hidden":"true",className:"text-destructive ml-0.5",children:"*"})]}),b(),s.description&&e.jsx(le,{className:"text-xs",children:s.description}),s.helpMarkdown&&e.jsxs(ce,{children:[e.jsxs(de,{className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ue,{className:"size-3"}),"Where do I find this?",e.jsx(he,{className:"size-3 transition-transform [[data-state=open]_&]:rotate-180"})]}),e.jsx(pe,{children:e.jsx("div",{className:"bg-muted/50 mt-2 rounded-md border p-3",children:e.jsx(I,{content:s.helpMarkdown,className:"text-xs"})})})]}),e.jsx(Y,{children:d&&e.jsx(J.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.15},className:"overflow-hidden",children:e.jsx(me,{children:d})})})]})}function os(s,t){return s.showWhen?t[s.showWhen.field]===s.showWhen.equals:!0}function ls({fields:s,allValues:t,renderField:a}){const r=new Map;for(const l of s){const i=l.section;r.has(i)||r.set(i,[]),r.get(i).push(l)}return e.jsx("div",{className:"space-y-6",children:Array.from(r.entries()).map(([l,i])=>{const n=i.filter(o=>os(o,t));return n.length===0?null:e.jsxs("div",{className:"space-y-3",children:[l&&e.jsx("h4",{className:"text-sm font-semibold",children:l}),e.jsx(Ee,{children:e.jsx(Te,{children:n.map(o=>a(o))})})]},l??"__default")})})}const je=["agent","configure","test","confirm"],cs={agent:"Agent",configure:"Set up",test:"Check",confirm:"Review"};function ds({current:s,showAgentStep:t}){const a=t?je:je.filter(l=>l!=="agent"),r=a.indexOf(s);return e.jsx("div",{className:"flex items-start justify-between px-1",role:"navigation","aria-label":"Setup steps",children:a.map((l,i)=>{const n=i<r,o=i===r,v=i>r;return e.jsxs(m.Fragment,{children:[i>0&&e.jsx("div",{className:U("mt-3 h-px flex-1",n||o?"bg-primary":"border-muted-foreground/40 border-t border-dashed")}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:U("flex size-6 items-center justify-center rounded-full text-xs font-medium",n&&"bg-primary text-primary-foreground",o&&"bg-primary text-primary-foreground ring-primary/30 ring-2",v&&"border-muted-foreground text-muted-foreground border"),"aria-current":o?"step":void 0,children:n?e.jsx(Ve,{className:"size-3"}):i+1}),e.jsx("span",{className:U("text-3xs",o?"text-foreground font-medium":"text-muted-foreground"),children:cs[l]})]})]},l)})})}function us({manifest:s,label:t,onLabelChange:a,fields:r,form:l,currentSetupStep:i,hasSetupGuide:n,onOpenGuide:o}){const{Subscribe:v,AppField:h}=l;return e.jsxs("div",{className:"space-y-4",children:[s.setupInstructions&&e.jsxs("div",{className:"flex gap-2 rounded-md border border-blue-200 bg-blue-50 p-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-200",children:[e.jsx(De,{className:"mt-0.5 size-4 shrink-0"}),e.jsx(I,{content:s.setupInstructions,className:"text-sm text-blue-800 dark:text-blue-200"})]}),(s.actionButton||n)&&e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n&&e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:o,children:[e.jsx(Se,{className:"mr-1.5 size-3.5"}),"Setup guide"]}),s.actionButton&&e.jsx(k,{asChild:!0,type:"button",variant:"outline",size:"sm",children:e.jsx(Pe,{href:s.actionButton.url,children:s.actionButton.label})})]}),i&&e.jsx("h4",{className:"text-sm font-medium",children:i.title}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ae,{htmlFor:"adapter-label",children:"Name (optional)"}),e.jsx(re,{id:"adapter-label",placeholder:s.displayName,value:t,onChange:x=>a(x.target.value)}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Helps you tell this connection apart."})]}),e.jsx(v,{selector:x=>x.values,children:x=>e.jsx(ls,{fields:r,allValues:x,renderField:y=>e.jsx(h,{name:y.key,children:d=>{var b;return e.jsx(is,{field:y,value:d.state.value,onChange:(N,C)=>d.handleChange(C),onBlur:d.handleBlur,error:d.state.meta.isTouched?(b=d.state.meta.errors[0])==null?void 0:b.toString():void 0,allValues:x})}},y.key)})})]})}function hs({isPending:s,isSuccess:t,isError:a,errorMessage:r,botUsername:l,onRetry:i}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{size:"lg",className:"text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Trying to reach it…"})]}),t&&e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(Re,{className:"text-status-success size-8"}),e.jsx("p",{className:"text-status-success-fg text-sm",children:"Reachable"}),l&&e.jsx("div",{className:"flex items-center gap-2 rounded-md border px-3 py-2 text-sm",children:e.jsxs("span",{className:"font-mono",children:["@",l]})})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Oe,{className:"text-destructive size-8"}),e.jsx("p",{className:"text-destructive text-sm",children:"Not reachable"}),r&&e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-xs text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-300",children:[e.jsx(Le,{className:"mt-0.5 size-3 shrink-0"}),e.jsx("span",{children:r})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:i,children:"Retry"})]})]})}function ps(s){return s.length>8?"•••• "+s.slice(-4):"•••"}function ms({manifest:s,adapterId:t,isEditMode:a,values:r,botUsername:l,agentName:i}){return e.jsxs("div",{className:"space-y-3",children:[!a&&i&&e.jsxs("p",{className:"bg-accent/30 rounded-md border px-3 py-2 text-sm",children:["Messages here go to ",e.jsx("span",{className:"font-medium",children:i}),"."]}),!a&&e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Connection ID"}),e.jsx("span",{className:"font-mono",children:t})]}),s.configFields.map(n=>{if(n.showWhen&&r[n.showWhen.field]!==n.showWhen.equals)return null;const o=String(r[n.key]??""),v=n.type==="password"?ps(o):o;return e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:n.label}),e.jsx("span",{className:"max-w-[200px] truncate font-mono",children:v})]},n.key)}),l&&s.type==="telegram"&&e.jsxs("a",{href:`https://t.me/${l}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary inline-flex items-center gap-1.5 text-sm underline-offset-4 hover:underline",children:["Message @",l," in Telegram"]})]})}const ye=[{value:"per-chat",label:"One conversation per chat",hint:"Everyone in a chat shares the same thread of memory."},{value:"per-user",label:"One conversation per person",hint:"Each person gets their own thread, even in a shared chat."},{value:"stateless",label:"A fresh start every message",hint:"Nothing carries over from the message before."}];function xs({agentOptions:s,agentId:t,onAgentIdChange:a,strategy:r,onStrategyChange:l}){var n;const i=s.length===1?s[0]:void 0;return m.useEffect(()=>{i&&!t&&a(i.id)},[i,t,a]),s.length===0?e.jsx("p",{role:"alert",className:"text-muted-foreground rounded-md border border-dashed px-4 py-6 text-center text-sm",children:"No agents yet. Add one from the Team page first."}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Messages here go to this agent."}),i?e.jsxs("div",{className:"bg-accent/30 rounded-md border px-4 py-3 text-sm",children:[e.jsx("span",{className:"font-medium",children:ge(i)})," will answer."]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(ae,{htmlFor:"wizard-agent",children:"Who should answer?"}),e.jsxs(X,{value:t,onValueChange:a,children:[e.jsx(Z,{id:"wizard-agent",className:"w-full",children:e.jsx(ee,{placeholder:"Pick an agent"})}),e.jsx(se,{children:s.map(o=>e.jsx(te,{value:o.id,children:ge(o)},o.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ae,{htmlFor:"wizard-memory",children:"How the agent remembers"}),e.jsxs(X,{value:r,onValueChange:o=>l(o),children:[e.jsx(Z,{id:"wizard-memory",className:"w-full",children:e.jsx(ee,{})}),e.jsx(se,{children:ye.map(o=>e.jsx(te,{value:o.value,children:o.label},o.value))})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:(n=ye.find(o=>o.value===r))==null?void 0:n.hint})]})]})}function gs({open:s,onOpenChange:t,title:a,content:r}){return e.jsx(_e,{open:s,onOpenChange:t,children:e.jsxs(Ge,{side:"right",className:"w-[480px] overflow-y-auto sm:max-w-lg",children:[e.jsxs(Ue,{children:[e.jsxs(Ie,{className:"flex items-center gap-2",children:[e.jsx(Se,{className:"size-4"}),a," setup guide"]}),e.jsx(He,{children:"Step-by-step setup instructions."})]}),e.jsx("div",{className:"mt-4 px-4",children:e.jsx(I,{content:r})})]})})}function we(s){const t=s.setupSteps;if(!t||t.length===0)return[];const a=new Set(t.flatMap(r=>r.fields));return s.configFields.filter(r=>!a.has(r.key))}function fs(s,t){return typeof t=="string"||t===void 0||t===null?t:s.valueShape==="id-list"?Array.isArray(t)?t.join(`
2
- `):t:s.valueShape==="json-object"&&typeof t=="object"?JSON.stringify(t,null,2):t}function js(s,t){const a=s.setupSteps;if(!a||a.length===0)return s.configFields;const r=a[t];if(!r)return s.configFields;const l=s.configFields.filter(i=>r.fields.includes(i.key));return t!==a.length-1?l:[...l,...we(s)]}const ys="Advanced";function K(s){const t={};for(const[a,r]of Object.entries(s)){const l=a.split(".");let i=t;for(let n=0;n<l.length-1;n++){const o=l[n];(!(o in i)||typeof i[o]!="object"||i[o]===null)&&(i[o]={}),i=i[o]}i[l[l.length-1]]=r}return t}function ve(s,t){const a=t.split(".");let r=s;for(const l of a){if(r==null||typeof r!="object")return;r=r[l]}return r}function vs(s,t){const a={};for(const r of s.configFields){const l=t?ve(t,r.key):void 0;l!==void 0&&r.type!=="password"?a[r.key]=fs(r,l):r.type==="password"&&t&&ve(t,r.key)!==void 0?a[r.key]="***":r.default!==void 0?a[r.key]=r.default:a[r.key]=r.type==="boolean"?!1:""}return a}function bs(s,t=[]){const a=s.type;if(!t.includes(a))return a;let r=2;for(;t.includes(`${a}-${r}`);)r++;return`${a}-${r}`}function Ns({manifest:s,existingInstance:t,existingAdapterIds:a=[],onOpenChange:r}){const l=!!t,[i,n]=m.useState(t?"configure":"agent"),[o,v]=m.useState(!1),[h]=m.useState(()=>(t==null?void 0:t.id)??bs(s,a)),[x,y]=m.useState(()=>{var p;return((p=t==null?void 0:t.config)==null?void 0:p.label)??""}),[d,b]=m.useState(0),[N,C]=m.useState(""),[c,P]=m.useState(""),[M,R]=m.useState("per-chat"),E=Qe(),z=Ke(),S=Ye(),W=Je(),{data:F}=Xe(),w=be(),q=Ne(),T=(F==null?void 0:F.agents)??[],B=s.setupSteps&&s.setupSteps.length>0,j=Ze({defaultValues:vs(s,t==null?void 0:t.config),validators:{onSubmit:({value:p})=>{const g={};for(const u of s.configFields)if(!(u.showWhen&&p[u.showWhen.field]!==u.showWhen.equals)&&u.required){const f=p[u.key];(f==null||f==="")&&(g[u.key]=`${u.label} is required`)}return Object.keys(g).length>0?{fields:g}:void 0}},onSubmit:async()=>{}}),$=m.useMemo(()=>{const p=new Set(we(s).map(g=>g.key));return js(s,d).map(g=>p.has(g.key)&&!g.section?{...g,section:ys}:g)},[s,d]),O=m.useCallback(()=>{const p=j.state.values;let g=!0;for(const u of $)if(!(u.showWhen&&p[u.showWhen.field]!==u.showWhen.equals)&&u.required){const f=p[u.key];(f==null||f==="")&&(j.setFieldMeta(u.key,A=>({...A,isTouched:!0,errors:[`${u.label} is required`],errorMap:{onSubmit:`${u.label} is required`}})),g=!1)}return g},[j,$]),L=m.useCallback(()=>{if(i==="agent"){if(!c)return;n("configure");return}if(i==="configure"){if(!O())return;if(B&&s.setupSteps&&d<s.setupSteps.length-1){b(u=>u+1);return}const g=j.state.values;n("test"),S.mutate({type:s.type,config:K(g)},{onSuccess:u=>{u.botUsername&&(C(u.botUsername),x||y(`@${u.botUsername}`))}})}else i==="test"&&n("confirm")},[i,c,B,s,d,O,j,S,x]),V=m.useCallback(()=>{i==="test"?(n("configure"),S.reset()):i==="confirm"?n("test"):i==="configure"&&(B&&d>0?b(p=>p-1):l||n("agent"))},[i,B,d,S,l]),D=m.useCallback(async p=>{try{return await w.removeRelayAdapter(p),!0}catch{return!1}finally{q.invalidateQueries({queryKey:["relay"]})}},[w,q]),H=m.useCallback(()=>{const p=j.state.values,g=K(p),u=x?{...g,label:x}:g;if(l&&t){z.mutate({id:t.id,config:u},{onSuccess:()=>r(!1)});return}if(!c){n("agent");return}E.mutate({type:s.type,id:h,config:u},{onSuccess:()=>{W.mutate({adapterId:h,agentId:c,sessionStrategy:M,label:""},{onSuccess:()=>{var A;const f=((A=T.find(_=>_.id===c))==null?void 0:A.name)??c;G.success(`${s.displayName} is connected`,{description:`Messages here go to ${f}.`}),r(!1)},onError:f=>{n("agent"),D(h).then(A=>{A?G.error("Nothing was set up",{description:`${s.displayName} couldn’t be linked to an agent, so it wasn’t saved. ${f.message}`}):G.error("Couldn’t finish undoing",{description:`${s.displayName} was added with no agent to answer it. Remove it from Messaging. ${f.message}`})})}})},onError:f=>{var A,_,ne;(A=f.message)!=null&&A.includes("timed out")?G.error(`Couldn’t reach ${s.displayName}`,{description:"Check your token and network, then try again."}):((_=f.message)!=null&&_.includes("duplicate")||(ne=f.message)!=null&&ne.includes("exists"))&&(n("configure"),b(0))}})},[j,l,t,z,E,W,s,h,x,c,M,T,D,r]),Ce=m.useCallback(p=>{p||(n(l?"configure":"agent"),b(0),y(""),C(""),P(""),R("per-chat"),v(!1),j.reset(),S.reset()),r(p)},[r,j,S,l]),Ae=m.useCallback(()=>{S.mutate({type:s.type,config:K(j.state.values)})},[S,s.type,j]),Fe=E.isPending||z.isPending||W.isPending,Be=B&&s.setupSteps?s.setupSteps[d]:void 0;return{step:i,isEditMode:l,adapterId:h,label:x,setLabel:y,botUsername:N,guideOpen:o,setGuideOpen:v,form:j,visibleFields:$,bindAgentId:c,setBindAgentId:P,bindStrategy:M,setBindStrategy:R,agentOptions:T,isSaving:Fe,hasSetupSteps:B,setupStepIndex:d,currentSetupStep:Be,testConnection:S,handleContinue:L,handleBack:V,handleSave:H,handleOpenChange:Ce,handleRetryTest:Ae}}function ws({open:s,onOpenChange:t,manifest:a,existingInstance:r,existingAdapterIds:l=[]}){var L;const i=Ns({manifest:a,existingInstance:r,existingAdapterIds:l,onOpenChange:t}),{step:n,isEditMode:o,adapterId:v,label:h,setLabel:x,botUsername:y,guideOpen:d,setGuideOpen:b,form:N,visibleFields:C,bindAgentId:c,setBindAgentId:P,bindStrategy:M,setBindStrategy:R,agentOptions:E,isSaving:z,hasSetupSteps:S,setupStepIndex:W,currentSetupStep:F,testConnection:w,handleContinue:q,handleBack:T,handleSave:B,handleOpenChange:j,handleRetryTest:$}=i,O={agent:"Pick who answers messages here.",configure:(F==null?void 0:F.description)??"Fill in the settings this needs.",test:"Checking the connection…",confirm:"Check it over, then save."}[n];return e.jsxs(m.Fragment,{children:[e.jsx(es,{open:s,onOpenChange:j,children:e.jsxs(ss,{className:"flex max-h-[85vh] max-w-lg flex-col",children:[e.jsxs(ts,{children:[e.jsx(rs,{children:o?`Edit ${a.displayName}`:`Add ${a.displayName}`}),e.jsx(as,{children:O})]}),e.jsxs("div",{className:"min-h-0 space-y-4 overflow-y-auto py-2",children:[e.jsx(ds,{current:n,showAgentStep:!o}),e.jsx(Y,{mode:"wait",children:e.jsxs(J.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[n==="agent"&&e.jsx(xs,{agentOptions:E,agentId:c,onAgentIdChange:P,strategy:M,onStrategyChange:R}),n==="configure"&&e.jsx(us,{manifest:a,label:h,onLabelChange:x,fields:C,form:N,currentSetupStep:F,hasSetupGuide:!!a.setupGuide,onOpenGuide:()=>b(!0)}),n==="test"&&e.jsx(hs,{isPending:w.isPending,isSuccess:w.isSuccess,isError:w.isError,errorMessage:(L=w.error)==null?void 0:L.message,botUsername:y,onRetry:$}),n==="confirm"&&e.jsx(N.Subscribe,{selector:V=>V.values,children:V=>{var D;return e.jsx(ms,{manifest:a,adapterId:v,isEditMode:o,values:V,botUsername:y,agentName:((D=E.find(H=>H.id===c))==null?void 0:D.name)||c})}})]},n)})]}),e.jsxs(ns,{className:"flex items-center justify-between sm:justify-between",children:[e.jsxs("div",{children:[(n==="test"||n==="confirm")&&e.jsxs(k,{variant:"ghost",onClick:T,disabled:z,children:[e.jsx(fe,{className:"mr-1 size-4"}),"Back"]}),n==="configure"&&(S?W>0:!o)&&e.jsxs(k,{variant:"ghost",onClick:T,children:[e.jsx(fe,{className:"mr-1 size-4"}),"Back"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),n==="agent"&&e.jsxs(k,{onClick:q,disabled:!c,children:["Continue",e.jsx(Q,{className:"ml-1 size-4"})]}),n==="configure"&&e.jsxs(k,{onClick:q,children:["Continue",e.jsx(Q,{className:"ml-1 size-4"})]}),n==="test"&&!w.isPending&&!w.isSuccess&&e.jsx(k,{variant:"ghost",onClick:q,children:"Skip"}),n==="test"&&w.isSuccess&&e.jsxs(k,{onClick:q,children:["Continue",e.jsx(Q,{className:"ml-1 size-4"})]}),n==="confirm"&&e.jsxs(k,{onClick:B,disabled:z,children:[z&&e.jsx(ke,{className:"mr-2"}),o?"Save changes":"Connect"]})]})]})]})}),a.setupGuide&&e.jsx(gs,{open:d,onOpenChange:b,title:a.displayName,content:a.setupGuide})]})}export{ws as A,ks as u};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-BYdz0ipX.js","assets/index-DMYBI16t.js","assets/index-Dgp1LmEk.css","assets/index-D3DXMH4x.js","assets/index-DR1JT9Uz.js","assets/BlintzCanvas-CXi0fvcM.js","assets/BlintzCanvas-GgiCXV7C.css"])))=>i.map(i=>d[i]);
2
- import{Q as H,aD as b,aE as q,ad as K,r,j as t,R as V,aa as $,B as R,aF as G,aG as U,aH as F}from"./index-DMYBI16t.js";import{u as Y}from"./use-session-canvas-Bqs6IQO7.js";import{R as I}from"./rotate-cw-xvfipJLN.js";import"./McpAppFrame-B1ThSf2U.js";const J=r.lazy(()=>F(()=>import("./CodeMirrorEditor-BYdz0ipX.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),W=r.lazy(()=>F(()=>import("./BlintzCanvas-CXi0fvcM.js"),__vite__mapDeps([5,1,2,4,6])).then(e=>({default:e.BlintzCanvas}))),X=500;function w(e,o){return["canvas-file",e,o]}function Z(e,o){return o==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function ee(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text, so the editor can’t show it.";default:return"This file couldn’t be loaded."}}function te(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";default:return null}}function ie({content:e,documentId:o}){const m=H(),i=b(s=>s.selectedCwd),C=b(s=>s.setDocumentEditing),a=b(s=>{var f;return((f=s.openDocuments.find(j=>j.id===o))==null?void 0:f.editing)??!1}),h=q(),{data:c,error:x,isLoading:T}=K({queryKey:w(i,e.sourcePath),enabled:i!==null,queryFn:()=>m.readFileContent(i,e.sourcePath),staleTime:3e4,retry:!1}),[d,v]=r.useState(null),p=s=>{v(s&&c?{pinnedHash:c.hash}:null)};if(i===null)return t.jsx(k,{children:"Open a session to view files."});if(T)return t.jsx(k,{children:"Loading file…"});if(x||!c)return t.jsx(k,{children:ee(x)});const u=d!==null&&a,n=(u?d==null?void 0:d.pinnedHash:null)??c.hash;return t.jsx(se,{content:e,documentId:o,cwd:i,loaded:c.content,theme:h,isEditing:u,onEditingChange:p,setDocumentEditing:C},`${e.sourcePath}:${n}`)}function se({content:e,documentId:o,cwd:m,loaded:i,theme:C,isEditing:a,onEditingChange:h,setDocumentEditing:c}){const x=e.readOnly!==!0,T=Z(e.sourcePath,e.language),d=V(),[v,p]=r.useState(i),u=Y({sourcePath:e.sourcePath,cwd:m,loadedContent:i}),n=r.useRef(null),s=r.useRef(v),f=r.useRef(0),j=r.useRef(0),g=r.useRef(u.save),E=r.useRef(h);r.useEffect(()=>{s.current=v,g.current=u.save,E.current=h});const P=r.useCallback(l=>{f.current+=1,s.current=l,p(l),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,g.current(s.current)},X)},[]),L=()=>{f.current+=1,s.current=i,p(i),h(!0),c(o,!0)},S=async()=>{n.current&&(clearTimeout(n.current),n.current=null);const l=s.current,Q=f.current,B=++j.current,y=await g.current(l);if(y.status!=="changed"&&y.status!=="no_op"||f.current!==Q||j.current!==B||y.confirmed.content!==l)return;const N=y.confirmed;N.content===s.current&&d.setQueryData(w(m,e.sourcePath),_=>_&&{..._,content:N.content,hash:N.hash}),h(!1),c(o,!1)},A=()=>{d.invalidateQueries({queryKey:w(m,e.sourcePath)})};r.useEffect(()=>{a||!n.current||(clearTimeout(n.current),n.current=null)},[a]),r.useEffect(()=>()=>{n.current&&(clearTimeout(n.current),g.current(s.current)),c(o,!1),E.current(!1)},[o,c]);const D=()=>{const l=u.adoptDisk();l!=null&&p(l)},M=()=>{u.overwrite(s.current)},z=te(u.status),O=a?v:i;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsxs("div",{className:"sticky top-0 z-10 flex h-0 items-start justify-end gap-2 pr-2",children:[x&&z&&t.jsx("span",{className:$("mt-3 text-xs",u.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:z}),!a&&t.jsx(R,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:A,"aria-label":"Refresh from disk",children:t.jsx(I,{className:"size-4"})}),x&&t.jsx(R,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:a?()=>void S():L,"aria-label":a?"Finish editing":"Edit file",children:a?t.jsx(G,{className:"size-4"}):t.jsx(U,{className:"size-4"})})]}),u.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(R,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:D,children:"Reload"}),t.jsx(R,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:M,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:T?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(W,{value:O,editable:a,onChange:a?P:void 0})}):t.jsx(J,{value:O,editable:a,filename:e.sourcePath,languageHint:e.language,theme:C,onChange:a?P:void 0})})})]})}function k({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{ie as CanvasFileContent};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-DlcQ3-LS.js","assets/index-DMYBI16t.js","assets/index-Dgp1LmEk.css"])))=>i.map(i=>d[i]);
2
- import{Q as n,aD as u,r as l,j as t,aH as d}from"./index-DMYBI16t.js";import{r as f}from"./use-session-canvas-Bqs6IQO7.js";import"./rotate-cw-xvfipJLN.js";import"./McpAppFrame-B1ThSf2U.js";const c=l.lazy(()=>d(()=>import("./Model3dViewer-DlcQ3-LS.js"),__vite__mapDeps([0,1,2])).then(r=>({default:r.Model3dViewer})));function m(r){var s;const e=(s=r.split(".").pop())==null?void 0:s.toLowerCase();return e==="glb"||e==="gltf"?"gltf":e==="stl"?"stl":e==="obj"?"obj":e==="3mf"?"3mf":e==="ply"?"ply":e==="fbx"?"fbx":e==="dae"?"dae":null}function v({content:r}){const e=n(),s=u(o=>o.selectedCwd),a=l.useMemo(()=>f(r.src,o=>e.mediaUrl(s??"",o)),[r.src,e,s]),i=l.useMemo(()=>m(r.src),[r.src]);return a.url===null||i===null?t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:"This 3D model can’t be displayed here."})}):t.jsx("div",{className:"bg-muted/40 h-full w-full",children:t.jsx(l.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading 3D viewer…"}),children:t.jsx(c,{url:a.url,format:i,label:r.title??"Canvas 3D model"})})})}export{v as CanvasModel3dContent,m as formatOf};
@@ -1 +0,0 @@
1
- import{Z as u,j as s,e as x,$ as g,B as o,a0 as h,a1 as p,a2 as l,a3 as m,a4 as j,a5 as N,a6 as f}from"./index-DMYBI16t.js";const v={agent:"From the agent",this_chat:"Only in this chat"};function A({agentId:n,onManage:e}){var i;const a=u(n);if(a.isPending)return s.jsx(x,{className:"h-24 w-full rounded-lg"});if(a.isError)return s.jsx(g,{title:"Couldn’t load account access",description:"Nothing changed. Try again.",onRetry:()=>void a.refetch(),isRetrying:a.isFetching});const c=((i=a.data)==null?void 0:i.connections)??[];return s.jsxs("section",{"aria-labelledby":"agent-account-access",className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h3",{id:"agent-account-access",className:"text-sm font-semibold",children:"Account access"}),s.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs",children:"Accounts this agent can use."})]}),e&&s.jsxs(o,{variant:"ghost",size:"sm",onClick:e,children:["Manage",s.jsx(h,{className:"size-3.5","aria-hidden":!0})]})]}),c.length===0?s.jsxs("div",{className:"bg-muted/40 rounded-lg p-4 text-sm",children:[s.jsx("p",{className:"font-medium",children:"No account access"}),s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Give access from the Connections page."})]}):s.jsx("ul",{className:"space-y-1.5",children:c.map(t=>{const r=t.readiness.state==="ready";return s.jsxs("li",{"data-testid":`agent-connection-${t.connectionId}`,className:"bg-muted/40 flex min-h-11 items-center gap-3 rounded-lg px-3 py-2",children:[s.jsx(p,{iconKey:t.toolkit,displayName:l(t.toolkit),className:"size-7"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"truncate text-sm font-medium",children:[l(t.toolkit)," (",t.label,")"]}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.operationRevisionIds.length," approved"," ",t.operationRevisionIds.length===1?"action":"actions",t.everyAgent&&" · given to every agent"]})]}),s.jsx(m,{size:"xs",variant:r?"secondary":"outline",title:r?void 0:t.readiness.copy.owner,children:r?"Available":"Unavailable"})]},t.connectionId)})})]})}const y="This only affects this chat. Turning an app back on never adds access.",C="Couldn’t change access for this chat. Try again.";function b(n){return(n==null?void 0:n.code)==="session_access_other_agent"?n.message:C}function I({sessionId:n,onManage:e,emptyAction:a,footer:c}){var r;const i=j(n);if(i.isPending)return s.jsx(x,{className:"h-16 w-full rounded-lg"});if(i.isError)return s.jsxs("section",{"data-testid":"session-connectors",className:"space-y-2",children:[s.jsx("p",{role:"alert",className:"text-destructive px-1 text-xs",children:"Couldn’t load account access."}),s.jsx(o,{variant:"ghost",size:"sm",onClick:()=>void i.refetch(),children:"Try again"})]});const t=((r=i.data)==null?void 0:r.connections)??[];return s.jsxs("section",{"data-testid":"session-connectors","aria-labelledby":"session-account-access",className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 pb-1",children:[s.jsx("h3",{id:"session-account-access",className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Connections"}),e&&s.jsxs(o,{variant:"ghost",size:"xs",onClick:e,children:["Manage agent access",s.jsx(h,{className:"size-3","aria-hidden":!0})]})]}),t.length===0?s.jsxs("div",{className:"bg-muted/40 space-y-2 rounded-md px-2.5 py-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"No account access"}),s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Ask this agent to request the access it needs."})]}),a]}):s.jsxs(s.Fragment,{children:[t.some(d=>d.thisChat)&&s.jsx("p",{className:"text-muted-foreground px-1 pb-1 text-xs",children:y}),t.map(d=>s.jsx(S,{sessionId:n,connection:d},d.connectionId))]}),t.length>0&&c]})}function S({sessionId:n,connection:e}){const a=N(n),c=e.readiness.state==="ready",i=`${l(e.toolkit)} (${e.label})`;return s.jsxs("div",{"data-testid":`session-connection-${e.connectionId}`,"data-reason":e.readiness.reason,className:"bg-muted/40 rounded-md px-2.5 py-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"text-sm font-medium",children:i}),s.jsx(m,{size:"xs",variant:c?"secondary":"outline",children:c?v[e.source]:"Not available"})]}),s.jsx("p",{className:c?"text-muted-foreground mt-1 text-xs":"text-status-warning-fg mt-1 text-xs",children:c?`${e.operationRevisionIds.length} ${e.operationRevisionIds.length===1?"action":"actions"} available in this chat.`:e.readiness.copy.owner})]}),e.thisChat&&s.jsx(f,{"aria-label":`${i} in this chat`,"data-testid":`session-connection-switch-${e.connectionId}`,checked:e.thisChat==="on",disabled:a.isPending,onCheckedChange:t=>a.mutate({connectionId:e.connectionId,on:t}),className:"mt-0.5 shrink-0"})]}),a.isError&&e.thisChat&&s.jsx("p",{role:"alert",className:"text-destructive mt-1 text-xs",children:b(a.error)})]})}export{A,I as S};
@@ -1,11 +0,0 @@
1
- import{Y as q,Q as Y,U as Z,r,fx as J,aV as K,j as e,aa as I,be as X,a3 as F,cr as ee,cs as se,ct as te,fy as ae,fz as ne,B as E,fA as ie,fB as re,fC as R,aU as ce,fD as oe,fE as L,fF as de,fG as le,fH as me,fI as ue,fJ as pe,fK as xe,fL as he,fM as ge,fN as fe,fO as je,fP as ye,fQ as ve,f as Ne,fR as Ce,fS as be,fT as Te,fU as Ie,fV as V,W as N,fW as Ae,fX as we,fY as Se,b as ke,e as De}from"./index-DMYBI16t.js";import{A as Re}from"./ConnectionAccessLists-PW1uzcGU.js";import{u as Me}from"./use-delete-binding-CZVeHqn0.js";import{u as Pe,A as Ee}from"./AdapterSetupWizard-C8HOvHLF.js";import{u as ze}from"./use-external-adapter-catalog-B0gcY-k7.js";import{A as _,a as P,b as Be}from"./AdapterIcon-CL-MyyKy.js";import{R as $}from"./radio-B8Ozjv9U.js";import"./agent-browser-CCN16ZOz.js";/**
2
- * @license lucide-react v1.48.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const G={name:"pause",size:24,node:[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]};G.node;const Oe=q(G);/**
7
- * @license lucide-react v1.48.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const H={name:"plug-2",size:24,node:[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0Z",key:"wtfw2c"}]]};H.node;const _e=q(H);function Fe(){const a=Y();return Z({mutationFn:i=>a.testBinding(i),meta:{errorLabel:"Couldn’t test the connection"}})}const Le={connected:P.connected,disconnected:X.warning,error:P.error,connecting:P.starting};function $e(a){const i=[];return a.canInitiate&&i.push("Can start conversations"),a.canReply||i.push("Can’t reply"),a.canReceive||i.push("Can’t receive"),i.join(" · ")}function Ue({binding:a,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:x,errorMessage:h,chatDisplayName:g,lastMessageAt:d,onTogglePause:f,onTest:n,onEdit:m,onRemove:u}){const[t,o]=r.useState(!1),[j,v]=r.useState(!1),p=a.enabled===!1,[A,w]=r.useState(0);r.useEffect(()=>{if(!d||p)return;const C=setInterval(()=>w(s=>s+1),6e4);return()=>clearInterval(C)},[d,p]);const z=g?`${i} · ${g}`:i,S=J({sessionStrategy:a.sessionStrategy,chatDisplayName:g,channelType:a.channelType}),k=a.canInitiate||!a.canReply||!a.canReceive,B=k?$e(a):"",D=r.useMemo(()=>p?"Paused: no messages delivered":d?`Last received ${K(d).toLowerCase()}`:"No recent activity",[p,d,A]),O=async()=>{v(!0);try{await n()}finally{v(!1)}};return e.jsxs("div",{className:I("relative rounded-xl border px-4 py-3 transition-colors",x==="error"&&!p&&"border-red-500/50 bg-red-500/[0.02]",p&&"opacity-60"),children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(_,{iconId:y,adapterType:l,size:32}),e.jsx("span",{className:I("ring-background absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full ring-2",p?"bg-muted-foreground/40":Le[x])})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:z}),p&&e.jsx(F,{variant:"secondary",children:"Paused"})]}),p?e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:D}):x==="error"&&h?e.jsx("p",{className:"text-destructive text-xs",children:h}):e.jsxs(e.Fragment,{children:[S&&e.jsx("p",{className:"text-muted-foreground truncate text-xs italic",children:S}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:D})]})]}),k&&e.jsxs(ee,{children:[e.jsx(se,{asChild:!0,children:e.jsx(F,{variant:"outline",children:"Restricted"})}),e.jsx(te,{children:B})]}),e.jsxs(ae,{children:[e.jsx(ne,{asChild:!0,children:e.jsxs(E,{variant:"ghost",size:"icon-md",responsive:!1,className:"h-8 w-8 shrink-0",children:[e.jsx(ie,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(re,{align:"end",children:[e.jsxs(R,{onClick:O,disabled:j||p,children:[j?e.jsx(ce,{className:"mr-2"}):e.jsx(oe,{className:"mr-2 size-(--size-icon-sm)"}),"Send test"]}),e.jsx(L,{}),e.jsx(R,{onClick:()=>f(!a.enabled),children:p?e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"mr-2 size-4"}),"Resume"]}):e.jsxs(e.Fragment,{children:[e.jsx(Oe,{className:"mr-2 size-4"}),"Pause"]})}),e.jsx(L,{}),e.jsx(R,{onClick:m,children:"Edit"}),e.jsx(R,{onClick:()=>o(!0),className:"text-destructive focus:text-destructive",children:"Remove"})]})]})]}),e.jsx(le,{open:t,onOpenChange:o,children:e.jsxs(me,{children:[e.jsxs(ue,{children:[e.jsxs(pe,{children:["Remove the ",i," connection?"]}),e.jsx(xe,{children:"This agent stops getting messages from it."})]}),e.jsxs(he,{children:[e.jsx(ge,{children:"Cancel"}),e.jsx(fe,{onClick:()=>{u(),o(!1)},className:"bg-red-600 hover:bg-red-700",children:"Remove connection"})]})]})})]})}function We({binding:a,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:x,errorMessage:h,onTogglePause:g,onTest:d,onEdit:f,onRemove:n}){const{data:m=[]}=je(a.adapterId),u=a.chatId?m.find(j=>j.chatId===a.chatId):void 0,t=(u==null?void 0:u.displayName)??(a.chatId?`#${a.chatId.slice(-4)}`:void 0),o=r.useMemo(()=>{if(u)return u.lastMessageAt;if(m.length!==0)return m.reduce((j,v)=>v.lastMessageAt>j?v.lastMessageAt:j,m[0].lastMessageAt)},[u,m]);return e.jsx(Ue,{binding:a,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:x,errorMessage:h,chatDisplayName:t,lastMessageAt:o,onTogglePause:g,onTest:d,onEdit:f,onRemove:n})}function U({catalog:a,boundAdapterIds:i,onSelectIntegration:y,onRequestSetup:l,disabled:x}){const[h,g]=r.useState(!1),d=r.useMemo(()=>a.flatMap(t=>t.instances.map(o=>({id:o.id,displayName:o.status.displayName??t.manifest.displayName,label:o.label,state:o.status.state,isDisabled:o.status.state==="error"||!o.enabled,alreadyBound:i.has(o.id),iconId:t.manifest.iconId,adapterType:t.manifest.type}))),[a,i]),f=r.useMemo(()=>a.filter(t=>!t.manifest.deprecated&&(t.instances.length===0||t.manifest.multiInstance)),[a]);function n(t){y(t),g(!1)}function m(t){g(!1),l(t)}const u=d.length===0&&f.length===0;return e.jsxs(ye,{open:h,onOpenChange:g,children:[e.jsx(ve,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",disabled:x,children:[e.jsx(Ne,{className:"mr-1.5 size-3.5"}),"Add connection"]})}),e.jsx(Ce,{className:"w-72 p-0",align:"start",children:e.jsx("div",{className:"max-h-64 overflow-y-auto",children:u?e.jsx("div",{className:"px-3 py-4 text-center",children:e.jsx("p",{className:"text-muted-foreground text-sm",children:"No connections available"})}):e.jsxs(e.Fragment,{children:[d.length>0&&e.jsx("div",{className:"py-1",children:d.map(t=>e.jsxs("button",{disabled:t.isDisabled||t.alreadyBound,onClick:()=>n(t.id),className:I("flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors","hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50"),children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(_,{iconId:t.iconId,adapterType:t.adapterType,size:20,className:"text-muted-foreground"}),e.jsx("span",{className:I("ring-background absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-[1.5px]",P[t.state])})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate font-medium",children:t.displayName}),t.label&&e.jsx("p",{className:"text-muted-foreground truncate text-xs",children:t.label})]}),e.jsx("span",{className:"text-muted-foreground/60 text-xs",children:t.alreadyBound?"Connected":Be[t.state]})]},t.id))}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t"}),e.jsxs("div",{className:"py-1",children:[e.jsx("p",{className:"text-muted-foreground px-3 py-1 text-xs font-medium",children:"Available to set up"}),f.map(t=>e.jsxs("button",{onClick:()=>m(t.manifest),className:I("flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors","hover:bg-accent"),children:[e.jsx(_,{iconId:t.manifest.iconId,adapterType:t.manifest.type,size:14,className:"text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate font-medium",children:t.manifest.displayName})]},t.manifest.type))]})]})]})})})]})}const M={open:!1,binding:null,adapterName:""},W={open:!1};function qe({agent:a}){const i=be(),{data:y=[]}=Te(),{data:l=[]}=ze(i),x=Ie(),h=Me(),g=Fe(),d=Pe(),f=V(),[n,m]=r.useState(M),[u,t]=r.useState(W),o=y.filter(s=>s.agentId===a.id),j=r.useMemo(()=>{const s=new Map;for(const c of l)for(const b of c.instances){const T=b.status.state,Q=T==="connected"||T==="error"?T:T==="starting"||T==="stopping"||T==="reconnecting"?"connecting":"disconnected";s.set(b.id,{state:Q,name:b.status.displayName??c.manifest.displayName,iconId:c.manifest.iconId,adapterType:c.manifest.type,errorMessage:b.status.lastError??void 0})}return s},[l]),v=r.useCallback(s=>j.get(s)??{state:"disconnected",name:s,adapterType:s},[j]),p=r.useMemo(()=>new Set(o.map(s=>s.adapterId)),[o]),A=r.useCallback(async s=>{try{await x.mutateAsync({adapterId:s,agentId:a.id,sessionStrategy:"per-chat",label:"",canInitiate:!1,canReply:!0,canReceive:!0}),N.success("Connection added")}catch{}},[a.id,x]),w=r.useCallback(s=>{t({open:!0,manifest:s})},[]),z=r.useCallback(s=>{m({open:!0,binding:s,adapterName:v(s.adapterId).name})},[v]),S=r.useCallback(async s=>{try{await h.mutateAsync(s),N.success("Connection removed")}catch{}},[h]),k=r.useCallback(async(s,c)=>{try{await d.mutateAsync({id:s,updates:{enabled:c}}),N.success(c?"Connection resumed":"Connection paused")}catch{}},[d]),B=r.useCallback(async s=>{const c=await g.mutateAsync(s);return c.ok?N.success(`Test message delivered in ${c.latencyMs}ms`):N.error(c.reason?`Test message didn’t arrive: ${c.reason}`:"Test message didn’t arrive. Try again."),c},[g]),D=r.useCallback(async s=>{if(n.binding)try{await d.mutateAsync({id:n.binding.id,updates:Ae(s)}),N.success("Connection updated"),m(M)}catch{}},[n.binding,d]),O=r.useCallback(async s=>{try{await h.mutateAsync(s),N.success("Connection removed"),m(M)}catch{}},[h]),C=e.jsxs(e.Fragment,{children:[n.binding&&e.jsx(we,{open:n.open,onOpenChange:s=>{s||m(M)},mode:"edit",initialValues:{adapterId:n.binding.adapterId,agentId:n.binding.agentId,sessionStrategy:n.binding.sessionStrategy,label:n.binding.label,permissionMode:n.binding.permissionMode,chatId:n.binding.chatId,channelType:n.binding.channelType,canInitiate:n.binding.canInitiate,canReply:n.binding.canReply,canReceive:n.binding.canReceive,notifyOnTaskComplete:n.binding.notifyOnTaskComplete},adapterName:n.adapterName,agentName:Se(a),bindingId:n.binding.id,onConfirm:D,onDelete:O,isPending:d.isPending||h.isPending}),u.manifest&&e.jsx(Ee,{open:u.open,onOpenChange:s=>{s||t(W)},manifest:u.manifest,existingAdapterIds:l.flatMap(s=>s.instances.map(c=>c.id))})]});return i?l.length===0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx($,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"No connections available"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Add Telegram, Slack or a webhook, then connect it here."})]}),e.jsx(E,{variant:"outline",size:"sm",onClick:()=>f(),children:"Add a connection"})]}),C]}):o.length===0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx($,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"Message this agent from anywhere"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Connect a chat app to message it while you’re away."})]}),e.jsx(U,{catalog:l,boundAdapterIds:p,onSelectIntegration:A,onRequestSetup:w,disabled:x.isPending})]}),C]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"space-y-2",children:o.map(s=>{const c=v(s.adapterId);return e.jsx(We,{binding:s,integrationName:c.name,integrationIconId:c.iconId,integrationAdapterType:c.adapterType,adapterState:c.state,errorMessage:c.errorMessage,onTogglePause:b=>k(s.id,b),onTest:()=>B(s.id),onEdit:()=>z(s),onRemove:()=>S(s.id)},s.id)})}),e.jsx(U,{catalog:l,boundAdapterIds:p,onSelectIntegration:A,onRequestSetup:w,disabled:x.isPending}),C]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx(_e,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"Chat apps are off"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Turn them on in Connections to reach this agent from chat."})]}),e.jsx(E,{variant:"outline",size:"sm",onClick:()=>f(),children:"Open Connections"})]}),C]})}function Xe({member:a}){const{agent:i,isPending:y}=ke(a),l=V();return y?e.jsx(De,{className:"h-32 w-full"}):i?e.jsxs("div",{className:"space-y-6",children:[e.jsx(Re,{agentId:i.id,onManage:()=>l()}),e.jsxs("section",{"aria-labelledby":"agent-messaging-access",className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"agent-messaging-access",className:"text-sm font-semibold",children:"Messaging"}),e.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs",children:"Places where people can reach this agent."})]}),e.jsx(qe,{agent:i})]})]}):e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s connections."})}export{Xe as ConnectionsPage};
@@ -1 +0,0 @@
1
- import{j as r,q as n}from"./index-DMYBI16t.js";function t({member:e}){return r.jsx(n,{member:e})}export{t as HandlePage};
@@ -1,36 +0,0 @@
1
- import{Y as te,Q as B,ad as de,ae as P,R as ae,U as ue,ml as ln,r as p,u as ke,mm as Ce,j as s,dH as on,dI as cn,dJ as dn,dK as un,dL as mn,hH as hn,ep as ee,hv as pn,I as fn,mn as We,mo as be,mp as Qe,mq as us,mr as ms,dQ as xn,e as W,fp as gn,lj as kn,am as me,ms as jn,B as C,g3 as vn,mt as Ke,mu as bn,mv as yn,O as Ge,P as Nn,aa as oe,W as S,cQ as K,dT as wn,lp as Cn,mw as Pn,cP as Sn,cO as $n,hj as In,mx as Rn,my as Ye,mz as J,mA as Tn,mB as ve,aF as hs,hB as qe,mC as Dn,aW as En,dR as Ve,hQ as ps,gB as fs,a3 as se,dY as Ln,C as Pe,ds as xs,gn as An,go as Un,gp as On,gq as Fn,mD as gs,gr as Mn,bl as zn,er as _n,es as Kn,ft as qn,j4 as Vn,ir as ks,ab as js,dS as vs,e6 as He,eI as bs,fV as Hn,aD as ys,mE as Bn,a as Ae,bp as Ns,cR as Se,cS as $e,cT as Ie,cU as Re,cV as Te,jD as ws,jE as ye,mF as Cs,ew as De,cW as Ee,aU as Fe,a$ as Ps,gj as Wn,mG as Qn,mH as Me,iA as Gn,mI as Yn,hG as Jn,mJ as Xn,mK as Zn,iu as et,mL as st,d6 as nt,mM as tt}from"./index-DMYBI16t.js";import{r as at,d as rt,u as Ss,P as $s,T as lt,a as it,b as Je}from"./PreviewRefusedNotice-ChCgdKWN.js";import{U as ot}from"./use-unclaimed-chats-lqMhotUB.js";import{d as ct,f as dt,a as ut,b as mt,c as ht,U as Is,u as pt,e as ft}from"./UnlinkDialog-3p38G_9q.js";import{a as Rs}from"./use-dev-links-Df2WkCic.js";import{F as xt}from"./file-exclamation-point-BKzL0QhY.js";import{R as Ts}from"./rotate-ccw-clock-CNcDcTvq.js";/**
2
- * @license lucide-react v1.48.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ds={name:"arrow-down-to-line",size:24,node:[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]};Ds.node;const gt=te(Ds);/**
7
- * @license lucide-react v1.48.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Es={name:"circle-arrow-up",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],aliases:["arrow-up-circle"]};Es.node;const kt=te(Es);/**
12
- * @license lucide-react v1.48.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Ls={name:"file-check-corner",size:24,node:[["path",{d:"M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6",key:"g5mvt7"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14 20 2 2 4-4",key:"15kota"}]],aliases:["file-check-2"]};Ls.node;const jt=te(Ls);/**
17
- * @license lucide-react v1.48.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const As={name:"key",size:24,node:[["path",{d:"m2 21 9.6-9.6",key:"9l79m3"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19",key:"fw8biw"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5",key:"4wxmhb"}]]};As.node;const vt=te(As);/**
22
- * @license lucide-react v1.48.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const Us={name:"package-search",size:24,node:[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"M20.27 18.27 22 20",key:"er2am"}],["path",{d:"M21 10.498V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l.98-.559",key:"tok1h1"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}],["circle",{cx:"18.5",cy:"16.5",r:"2.5",key:"ke13xx"}]]};Us.node;const bt=te(Us);/**
27
- * @license lucide-react v1.48.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const Os={name:"scale",size:24,node:[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]]};Os.node;const yt=te(Os);/**
32
- * @license lucide-react v1.48.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const Fs={name:"unlink",size:24,node:[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]};Fs.node;const Nt=te(Fs);function wt(e,n){const t=B(),{enabled:r=!0,marketplace:a}=n??{};return de({queryKey:P.packageDetail(e??""),queryFn:()=>t.getMarketplacePackage(e,a),enabled:r&&e!==null,staleTime:6e4})}function je(e){const n=B();return de({queryKey:P.installed(e),queryFn:()=>n.listInstalledPackages(e),staleTime:6e4})}function Ct(e,n){const t=B();return de({queryKey:P.installedDetail(e??""),queryFn:()=>t.listPackageInstallations(e),enabled:((n==null?void 0:n.enabled)??!0)&&e!==null,staleTime:6e4})}function Pt(){const e=B();return de({queryKey:P.integrity(),queryFn:()=>e.listInstalledPackages(void 0,{verify:!0}),select:n=>new Map(n.flatMap(t=>t.integrity?[[t.installPath,t.integrity]]:[])),staleTime:6e4})}const St=10*6e4;function $t(e,n={}){const t=B();return de({queryKey:P.updates(e),queryFn:()=>t.checkMarketplaceUpdates(e),enabled:n.enabled??!0,staleTime:St,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function It(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.installMarketplacePackage(t,r),onError:t=>{t.code==="disclosure_changed"&&n.invalidateQueries({queryKey:P.preview()})},onSuccess:(t,{name:r,options:a})=>{n.invalidateQueries({queryKey:P.installed()}),a!=null&&a.projectPath&&n.invalidateQueries({queryKey:P.installed(a.projectPath)}),n.invalidateQueries({queryKey:P.packages()}),n.invalidateQueries({queryKey:P.packageDetail(r)}),n.invalidateQueries({queryKey:["commands"]}),n.invalidateQueries({queryKey:P.updates(),refetchType:"none"})}})}function Rt(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.uninstallMarketplacePackage(t,r),onSuccess:(t,{name:r,options:a})=>{n.invalidateQueries({queryKey:P.installed()}),a!=null&&a.projectPath&&n.invalidateQueries({queryKey:P.installed(a.projectPath)}),n.invalidateQueries({queryKey:P.packageDetail(r)}),n.invalidateQueries({queryKey:["commands"]})}})}function Tt(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.checkPackageFiles(t,r),onSettled:()=>{n.invalidateQueries({queryKey:P.integrity()})}})}function Ms(e){if(!e.applied)return e;const{applied:n,applyError:t,note:r,...a}=e;return{...a,status:"current",hasUpdate:!1,installedVersion:n.version,installedVersionSource:n.version===e.latestVersion?e.latestVersionSource:"package"}}function Dt(){const e=B(),n=ae();return ue({mutationKey:P.applyUpdates(),mutationFn:t=>e.applyMarketplaceUpdates(t),meta:{suppressErrorToast:!0},onError:t=>{t.code==="disclosure_changed"&&n.invalidateQueries({queryKey:P.updates()})},onSuccess:async t=>{const r=new Map(t.checks.map(l=>[l.installPath,Ms(l)]));n.setQueriesData({queryKey:P.updates()},l=>l&&{checks:l.checks.map(i=>r.get(i.installPath)??i)});const a=t.checks.filter(l=>l.applied);if(a.length!==0){for(const l of new Set(a.map(i=>i.packageName)))n.invalidateQueries({queryKey:P.installedDetail(l)}),n.invalidateQueries({queryKey:P.packageDetail(l)});n.invalidateQueries({queryKey:["commands"]}),await n.invalidateQueries({queryKey:P.installed()})}}})}function Et(){const e=ln({filters:{mutationKey:P.applyUpdates(),status:"pending"},select:n=>{var t;return(t=n.state.variables)==null?void 0:t.targets.map(r=>r.installPath)}});return p.useMemo(()=>new Set(e.flatMap(n=>n??[])),[e])}function Lt(){const e=B();return ue({mutationFn:n=>e.reviewHeldBackPackage(n),meta:{suppressErrorToast:!0}})}function At(e){const n=B();return de({queryKey:P.heldBack(),queryFn:()=>n.listHeldBackPackages(),enabled:e})}function Ut(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.keepPackageFiles(t,r),meta:{suppressErrorToast:!0},onSettled:()=>{n.invalidateQueries({queryKey:P.installed()})}})}function Ot(e,n){return e.name.toLowerCase().includes(n)||(e.description??"").toLowerCase().includes(n)||(e.keywords??[]).some(t=>t.toLowerCase().includes(n))?!0:(e.tags??[]).some(t=>t.toLowerCase().includes(n))}const Ft=300,Mt=[{value:"featured",label:"Featured"},{value:"name",label:"A–Z"},{value:"popular",label:"Popular"},{value:"recent",label:"Recent"}];function zt(){const{sort:e,setSort:n}=ke(),{data:t}=Ce(),r=p.useMemo(()=>(t??[]).some(i=>i.installCount!==void 0),[t]),a=p.useMemo(()=>(t??[]).some(i=>i.updatedAt!==void 0),[t]),l=i=>i==="popular"?!r:i==="recent"?!a:!1;return s.jsxs("header",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(_t,{})}),s.jsxs(on,{value:e,onValueChange:i=>n(i),children:[s.jsx(cn,{"aria-label":"Sort packages",className:"w-28 shrink-0 text-xs sm:w-32",children:s.jsx(dn,{})}),s.jsx(un,{children:Mt.map(i=>s.jsx(mn,{value:i.value,disabled:l(i.value),className:"text-xs",children:i.label},i.value))})]})]})}function _t(){const{search:e,setSearch:n}=ke(),t=p.useRef(null),r=hn({value:e,generation:0});r.read().value!==e&&r.write({value:e,generation:r.read().generation+1});const a=r.read().generation,[l,i]=p.useState(null),o=l!==null&&l.generation===a?l.value:e,d=c=>i({generation:a,value:c});p.useEffect(()=>{if(o===e)return;const c=setTimeout(()=>n(o),Ft);return()=>clearTimeout(c)},[o,e,n]);const u=p.useCallback(c=>{var w;if(c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey)return;const h=c.target,f=h==null?void 0:h.tagName;f==="INPUT"||f==="TEXTAREA"||f==="SELECT"||h!=null&&h.isContentEditable||(c.preventDefault(),(w=t.current)==null||w.focus())},[]);return p.useEffect(()=>(document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)),[u]),s.jsxs("div",{className:"group/search relative",children:[s.jsx(ee,{htmlFor:"marketplace-search",className:"sr-only",children:"Search packages"}),s.jsx(pn,{className:"text-muted-foreground group-focus-within/search:text-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 transition-colors duration-200","aria-hidden":!0}),s.jsx(fn,{ref:t,id:"marketplace-search","data-testid":"marketplace-search",value:o,onChange:c=>d(c.target.value),placeholder:"Search…",className:"pl-9 transition-shadow duration-200 focus:shadow-md max-sm:pr-3 sm:pr-10"}),s.jsx("kbd",{className:"text-muted-foreground/60 text-3xs pointer-events-none absolute top-1/2 right-3 hidden -translate-y-1/2 rounded border border-current/20 px-1.5 py-0.5 font-mono leading-none group-focus-within/search:opacity-0 sm:block",children:"/"})]})}function Kt(e,n){if(n==="all")return!0;const t=e.type??"plugin";return n===We?t==="adapter"&&e.adapterType===We:t===n}function qt(e,n){const t=n.search.trim().toLowerCase();return e.filter(r=>!(!Kt(r,n.type)||n.categories.length>0&&!n.categories.some(l=>{var i;return(((i=r.categories)==null?void 0:i.includes(l))??!1)||r.category===l})||n.sources.length>0&&!n.sources.includes(r.marketplace)||t&&!Ot(r,t)))}function Le(e,n){return be(e).localeCompare(be(n))}function Vt(e,n){const t=e.marketplace===Qe?1:0,r=n.marketplace===Qe?1:0;if(t!==r)return r-t;const a=e.featured?1:0,l=n.featured?1:0;return a!==l?l-a:Le(e,n)}function Ht(e,n){const t=e.installCount??0,r=n.installCount??0;return t!==r?r-t:Le(e,n)}function Bt(e,n){const t=e.updatedAt??"",r=n.updatedAt??"";return t!==r?r.localeCompare(t):Le(e,n)}function Wt(e,n){const t=[...e];switch(n){case"featured":return t.sort(Vt);case"name":return t.sort(Le);case"popular":return t.sort(Ht);case"recent":return t.sort(Bt)}}function zs({count:e=8}){return s.jsx("div",{className:us,children:s.jsx("div",{"data-slot":"package-grid",className:ms,"aria-busy":"true","aria-label":"Loading packages",children:Array.from({length:e}).map((n,t)=>s.jsxs(xn,{radius:"lg",gap:"none",className:"p-6",children:[s.jsx("div",{className:"mb-3 flex items-start justify-between gap-2",children:s.jsx(W,{className:"size-6 rounded-full"})}),s.jsx(W,{className:"mb-1 h-4 w-3/4"}),s.jsx(W,{className:"mb-3 h-3 w-16"}),s.jsx(W,{className:"mb-1 h-3 w-full"}),s.jsx(W,{className:"mb-4 h-3 w-2/3"}),s.jsx("div",{className:"flex items-center justify-end",children:s.jsx(W,{className:"h-7 w-16"})})]},t))})})}function xe({onResetFilters:e,resetLabel:n="Reset filters",title:t="No packages match your filters",description:r="Try another search or filter."}){return s.jsx(gn,{className:"rounded-xl border border-dashed",icon:bt,headline:t,headingLevel:3,description:r,action:e?{label:n,onClick:e,variant:"outline"}:void 0})}const Qt=/network|fetch|offline/i;function _s({error:e,onRetry:n}){const t=Qt.test(e.message),r=t?kn:me,a=t?"Couldn’t reach the marketplace":"Couldn’t load packages";return s.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-dashed py-16 text-center",children:[s.jsx(r,{className:"text-muted-foreground mb-4 size-10","aria-hidden":!0}),s.jsx("h3",{className:"mb-2 text-base font-semibold",children:a}),s.jsx("p",{className:"text-muted-foreground mb-4 max-w-sm text-sm",children:s.jsx(jn,{text:e.message})}),s.jsx(C,{variant:"outline",onClick:n,children:"Try again"})]})}const ze=20,Gt=.03,Yt={hidden:{},visible:{transition:{staggerChildren:Gt}}},Jt={hidden:e=>({opacity:e<ze?0:1,y:e<ze?12:0}),visible:{opacity:1,y:0,transition:{duration:.25,ease:"easeOut"}}};function Xt(){const{data:e,isLoading:n,error:t,refetch:r}=Ce(),{data:a}=je(),l=vn(),{type:i,categories:o,sources:d,search:u,sort:c,resetFilters:h,clearCategories:f,clearSources:w,openDetail:T}=ke(),v=Ke(),x=p.useMemo(()=>e?Wt(qt(e,{type:i,categories:o,sources:d,search:u}),c):[],[e,i,o,d,u,c]),N=p.useMemo(()=>new Set((a??[]).map(k=>k.name)),[a]),$=p.useMemo(()=>new Set((a??[]).filter(k=>k.devLink).map(k=>k.name)),[a]);if(n)return s.jsx(zs,{});if(t)return s.jsx(_s,{error:t,onRetry:()=>void r()});if(x.length===0){const k=o.length>0&&d.length===0,I=d.length>0&&o.length===0;if(k){const A=o.length===1?o[0]:null,D=A?bn(A):void 0,E=A?D?yn[D]:A:null;return s.jsx(xe,{title:E?`No packages in ${E} yet`:"No packages in these categories yet",description:"Try another category.",resetLabel:o.length===1?"Clear category":"Clear categories",onResetFilters:f})}if(I){const A=d.length===1?d[0]:null;return s.jsx(xe,{title:A?`No packages from ${A} yet`:"No packages from these sources yet",description:"Try another source.",resetLabel:d.length===1?"Clear source":"Clear sources",onResetFilters:w})}return o.length>0&&d.length>0?s.jsx(xe,{title:"No packages match these filters",description:"Reset the filters to see everything.",onResetFilters:h}):s.jsx(xe,{onResetFilters:h})}return s.jsxs("div",{className:oe(us,"space-y-4"),children:[s.jsx("div",{className:"flex items-center justify-between gap-4",children:s.jsxs("h2",{className:"text-base font-semibold",children:["All packages",s.jsxs("span",{className:"text-muted-foreground ml-2 text-sm font-normal",children:["(",x.length,")"]})]})}),s.jsx(Ge.div,{variants:l?void 0:Yt,initial:"hidden",animate:"visible","data-slot":"package-grid",className:ms,children:x.map((k,I)=>s.jsx(Ge.div,{variants:l?void 0:Jt,custom:I<ze?I:0,className:"h-full",children:s.jsx(Nn,{pkg:k,installed:N.has(k.name),devLinked:$.has(k.name),onClick:()=>T(k.name),onInstallClick:()=>v(k)})},k.name))})]})}function Xe(e,n){return e instanceof Error?`Couldn’t uninstall ${n}: ${e.message}`:`Couldn’t uninstall ${n}. Try again.`}function re(e){const n=K(e.name);return e.where?`${n} from ${e.where}`:n}function Ze(e){const n=(e==null?void 0:e.warnings)??[];return n.length>0?{description:n.join(" ")}:{}}function Ks(){const e=Rt(),n=ae(),{mutate:t,mutateAsync:r}=e,a=p.useCallback(()=>{n.invalidateQueries({queryKey:[...ot]})},[n]),l=p.useCallback(({where:o,...d})=>{const u=S.loading(`Uninstalling ${re({...d,where:o})}…`);t(d,{onSuccess:c=>{a(),S.success(`Uninstalled ${re({...d,where:o})}`,{id:u,...Ze(c)})},onError:c=>{S.error(Xe(c,re({...d,where:o})),{id:u})}})},[t,a]),i=p.useCallback(async({where:o,...d})=>{const u=S.loading(`Uninstalling ${re({...d,where:o})}…`);try{const c=await r(d);return a(),S.success(`Uninstalled ${re({...d,where:o})}`,{id:u,...Ze(c)}),c}catch(c){throw S.error(Xe(c,re({...d,where:o})),{id:u}),c}},[r,a]);return{...e,mutate:l,mutateAsync:i}}function qs(){const[e,n]=p.useState(null),[t,r]=p.useState(null),a=Ke(),l=c=>{var h;return{name:c.name,...ct(c),parked:((h=c.devLink)==null?void 0:h.parked)===!0}},i=p.useCallback(c=>{r(null),n(l(c))},[]),o=p.useCallback((c,h)=>{r({pkg:h,installation:c}),n({...l(c),then:"install"})},[]),d=p.useCallback(()=>n(null),[]),u=p.useCallback(c=>{if(c.then!=="install"||!t)return;const{pkg:h,installation:f}=t;r(null),a(h,f.agentPath?{agentPath:f.agentPath,agentName:f.agentName??f.agentPath}:void 0)},[t,a]);return{target:e,askUnlink:i,askInstallPublished:o,close:d,onUnlinked:u}}function Zt(e){const{data:n}=Rs(),t=dt(n==null?void 0:n.links,e),r=Pn(ut(e,t)),a=Sn(l=>l.latest[r]);return e.devLink?mt(e.devLink,a,t):null}function ea({status:e}){switch(e.kind){case"reloaded":return s.jsx(sa,{at:e.at});case"watching":return s.jsx("p",{className:"text-muted-foreground text-xs",children:"Watching for edits."});case"reload-failed":return s.jsxs("div",{className:"text-status-warning-fg space-y-1 text-xs",children:[s.jsxs("p",{className:"flex items-start gap-1",children:[s.jsx(me,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"[overflow-wrap:anywhere]",children:e.headline})]}),s.jsx($n,{label:"Details",openLabel:"Hide details",className:"ml-4",children:e.details.map((n,t)=>s.jsx("p",{className:"font-mono text-xs [overflow-wrap:anywhere]",children:n},`${t}-${n}`))})]});case"folder-missing":return s.jsx(Ue,{children:"Folder missing. Restore it or unlink."});case"link-missing":return s.jsx(Ue,{children:"Its link is gone. Unlink to finish."});case"link-replaced":return s.jsx(Ue,{children:"Something else is in its place. Unlink to finish."})}}function sa({at:e}){const n=In(1e3);return s.jsx("time",{dateTime:e,title:new Date(e).toLocaleString(),className:"text-muted-foreground text-xs",children:ht(e,n)})}function Ue({children:e}){return s.jsxs("p",{className:"text-status-warning-fg flex items-start gap-1 text-xs",children:[s.jsx(me,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{children:e})]})}function Vs({installation:e}){const n=Zt(e);return!e.devLink||!n?null:s.jsxs("div",{className:"mt-1.5 space-y-1","data-testid":"dev-link-details",children:[s.jsx(wn,{path:e.devLink.path}),s.jsx("div",{role:"status","aria-live":"polite","data-testid":"dev-link-status",children:s.jsx(ea,{status:n})})]})}function Hs({installation:e,published:n,label:t,onUnlink:r,onInstallPublished:a,disabled:l}){return e.devLink?e.devLink.parked?s.jsxs(C,{size:"sm",variant:"outline",onClick:r,disabled:l,"aria-label":`Use the installed copy of ${t}`,children:[s.jsx(Cn,{className:"mr-1 size-3","aria-hidden":!0}),"Use installed copy"]}):s.jsxs(s.Fragment,{children:[n&&s.jsxs(C,{size:"sm",variant:"outline",onClick:()=>a(n),disabled:l,"aria-label":`Install the published version of ${t}`,children:[s.jsx(gt,{className:"mr-1 size-3","aria-hidden":!0}),"Install published version"]}),s.jsxs(C,{size:"sm",variant:"ghost",onClick:r,disabled:l,"aria-label":`Unlink ${t}`,children:[s.jsx(Nt,{className:"mr-1 size-3","aria-hidden":!0}),"Unlink"]})]}):null}function Bs(e){return e.includes("\\")&&!e.includes("/")?"\\":"/"}function es(e){return e.split(/[\\/]/)}function na(e){const n=e[0];if(n===void 0)return"";const t=Bs(n);let r=es(n).slice(0,-1);for(const a of e.slice(1)){const l=es(a).slice(0,-1);let i=0;for(;i<r.length&&i<l.length&&r[i]===l[i];)i+=1;if(r=r.slice(0,i),r.length===0)break}return r.length===0?"":r.length===1&&r[0]===""?t:r.join(t)}function ta(e,n){if(n==="")return e;const t=Bs(e),r=n.endsWith(t)?n:n+t;return e.startsWith(r)?e.slice(r.length):e}function ss(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/(^|\/)\.(?=\/|$)/g,"$1").replace(/\/+/g,"/").replace(/(.)\/$/,"$1")}function aa(e,n){if(n==="")return!1;const t=ss(n);if(t==="/"||t==="")return!0;const r=ss(e);return r===t||r.startsWith(`${t}/`)}const ra={delete:"removed",modify:"changed",create:"new"},la=["delete","modify","create"];function ns(e,n){const t=[];for(const r of la){const a=e.filter(l=>l.action===r).map(l=>ta(l.path,n)).sort((l,i)=>l.localeCompare(i));for(const l of a)t.push({text:l,tag:ra[r],...r==="delete"?{severity:"warning"}:{}})}return t}function ia(e,n){if(e.length===0)return[];const t=na(e.map(d=>d.path)),r={create:e.filter(d=>d.action==="create").length,modify:e.filter(d=>d.action==="modify").length,delete:e.filter(d=>d.action==="delete").length},a=e.length===1?"file":"files",l=t===""?"":` under ${t}`,i=[{icon:"file",label:`${e.length} ${a}${l}: ${r.create} new, ${r.modify} changed, ${r.delete} removed`,details:ns(e,t),detailsLabel:`Show ${e.length} ${a}`}];if(!n)return i;const o=e.filter(d=>!aa(d.path,n));return o.length>0&&i.push({icon:"alert-triangle",label:`${o.length} ${o.length===1?"file lands":"files land"} outside ${n}.`,severity:"warning",details:ns(o,""),detailsLabel:`Show ${o.length} ${o.length===1?"file":"files"}`}),i}function oa(e,n){const t=ia(e.fileChanges,n);if(e.npmDependencies.length>0){const r=e.npmDependencies.length;t.push({icon:"globe",label:`Download ${r} npm ${r===1?"library":"libraries"} and their dependencies`,description:e.npmDependencies.map(a=>`${a.name}@${a.range}${a.optional?" (optional)":""}`).join(", ")})}for(const r of e.extensions)t.push({icon:"puzzle",label:`Register UI extension: ${r.id}`,description:r.slots.length>0?`Slots: ${r.slots.join(", ")}`:void 0});for(const r of e.skippedLinks)t.push({icon:"alert-triangle",label:"Part of this package won’t be installed",description:r.message,severity:"warning"});return t}function Ws(e,n=Rn){const t=e.hooks.map(a=>({icon:"terminal",label:J(a.command),description:a.source?`Runs ${Ye(a.event,a.matcher)}, while ${J(a.source)} is in use`:`Runs ${Ye(a.event,a.matcher)}`,mono:!0}));for(const a of e.skillCommands){const l=Tn(a.source);t.push({icon:"terminal",label:J(a.command),description:`Runs when the ${l} "${J(a.skill)}" is used (${J(a.source)})`+(a.usesArguments?". Uses what you type after it":""),mono:!0})}for(const a of e.unreadableHooks)t.push({icon:"alert-triangle",label:"Sets up a command DorkOS couldn’t read",description:a.event?`${a.path} declares "${a.event}" in a form DorkOS can’t read`:`DorkOS can’t read ${a.path}`,severity:"warning"});const r=(a,l,i=!0)=>({icon:i?"terminal":"globe",label:a,description:`${l}. ${n}`,mono:!0});for(const a of e.mcpServers)t.push(a.command!==void 0?r(ve(a.command,a.args),`MCP server "${a.name}"`):r(J(JSON.stringify(a.url??"")),`Remote MCP server "${a.name}"`,!1));for(const a of e.lspServers)t.push(r(ve(a.command,a.args),`Language server "${a.name}"`));for(const a of e.monitors)t.push(r(ve(a.command),`Background monitor "${a.name}"${a.when?`, ${a.when}`:""}`));for(const a of e.executables)t.push(r(ve(a),"Added to the agent’s commands (bin/)"));for(const a of e.skillTools)t.push({icon:"key",label:a.tools.map(l=>J(JSON.stringify(l))).join(", "),description:`Skill "${J(a.skill)}" may use these without asking you`,mono:!0});for(const a of e.unreadableDeclarations)t.push({icon:"alert-triangle",label:"Sets up a program DorkOS couldn’t read",description:a.entry?`${a.path} declares "${a.entry}" in a form DorkOS can’t read`:`DorkOS can’t read ${a.path}`,severity:"warning"});return t}function Qs(e){return e.schedules.map(n=>({icon:"clock",label:n.name,description:rt(n),severity:at(n.permissionMode)&&n.startsEnabled?"warning":"info"}))}function ca(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function da(e){const n={create:e.fileChanges.filter(u=>u.action==="create").length,modify:e.fileChanges.filter(u=>u.action==="modify").length,delete:e.fileChanges.filter(u=>u.action==="delete").length},r=[{verb:"Adds",count:n.create},{verb:"Changes",count:n.modify},{verb:"Removes",count:n.delete}].filter(u=>u.count>0).map((u,c)=>{const h=c===0?u.verb:u.verb.toLowerCase(),f=c===0?` ${u.count===1?"file":"files"}`:"";return`${h} ${u.count}${f}`}),a=r.length===0?"Changes no files":ca(r),l=e.hooks.length+e.skillCommands.length+e.unreadableHooks.length,i=l===0?"Declares no commands":`Declares ${l} ${l===1?"command":"commands"}`,o=e.mcpServers.length+e.lspServers.length+e.monitors.length+e.executables.length,d=o===0?"":` Includes ${o} ${o===1?"program":"programs"}.`;return`${a}. ${i}.${d}`}function ua(e,n={}){return{effects:oa(e,n.installBase),commands:Ws(e),schedules:Qs(e),secrets:e.secrets.map(t=>({icon:"key",label:t.key+(t.required?"":" (optional)"),description:t.description,severity:t.required?"warning":"info"})),hosts:e.externalHosts.map(t=>({icon:"globe",label:t})),dependencies:e.requires.map(t=>({icon:t.satisfied?"check":"alert-triangle",label:`${t.type}:${t.name}${t.version?`@${t.version}`:""}`,severity:t.satisfied?"info":"warning"})),conflicts:e.conflicts.map(t=>({icon:"alert-triangle",label:t.description,description:t.conflictingPackage?`Conflicts with: ${t.conflictingPackage}`:void 0,severity:t.level==="error"?"error":"warning"}))}}const ma={global:"Starts in every session.",project:"Declared, but not started for a project install."};function Be(e,n){const t={hooks:e.hooks.map(a=>({event:a.event,...a.matcher!==null&&{matcher:a.matcher},command:a.command,...a.source!==null&&{source:a.source}})),unreadableHooks:[],mcpServers:e.mcpServers.map(a=>({name:a.name,transport:a.transport,...a.command!==null&&{command:a.command,args:a.args},...a.url!==null&&{url:a.url}})),lspServers:e.lspServers.map(({name:a,command:l,args:i})=>({name:a,command:l,args:i})),monitors:e.monitors.map(({name:a,command:l,when:i})=>({name:a,command:l,...i!==null&&{when:i}})),executables:e.executables,skillTools:e.skillTools,skillCommands:e.skillCommands,unreadableDeclarations:[]},r=e.schedules.map(a=>({name:a.name,cron:a.cron,permissionMode:a.permissionMode,startsEnabled:a.startsEnabled}));return[...Ws(t,ma[n]),...Qs({schedules:r})]}const ha={hooks:[],schedules:[],mcpServers:[],lspServers:[],monitors:[],executables:[],skillTools:[],skillCommands:[]},pa=["hooks","skillCommands","mcpServers","lspServers","monitors","executables","skillTools","schedules"];function Ne(e,n){if(!(e==="hooks"||e==="skillCommands"||e==="executables"))return e==="skillTools"?n.source:n.name}function fa(e,n,t){const r=[],a=(l,i)=>Be({...ha,[l]:[i]},t)[0];for(const l of pa)for(const i of e[l]){const o=a(l,i);if(!o)continue;const d=xa(l,i,n),u=d==="changed"?n[l].find(h=>Ne(l,h)===Ne(l,i)):void 0,c=u===void 0?void 0:a(l,u);r.push({row:o,change:d,...c&&{previous:c}})}return r}function xa(e,n,t){if(!t)return"unknown";const r=t[e],a=JSON.stringify(n);if(r.some(i=>JSON.stringify(i)===a))return"unchanged";const l=Ne(e,n);return l!==void 0&&r.some(i=>Ne(e,i)===l)?"changed":"new"}const ga={file:ps,puzzle:Ve,clock:En,terminal:Dn,key:vt,globe:qe,check:hs,"alert-triangle":me},we={info:"text-muted-foreground",warning:"text-status-warning-fg",error:"text-destructive"};function ka({items:e,label:n}){return s.jsxs("details",{className:"group/details mt-1.5",children:[s.jsxs("summary",{className:oe("text-muted-foreground hover:text-foreground focus-ring inline-flex cursor-pointer","list-none items-center gap-1 rounded-sm text-xs select-none","[&::-webkit-details-marker]:hidden"),children:[s.jsx(Pe,{className:"size-3 shrink-0 transition-transform duration-200 group-open/details:rotate-90"}),n]}),s.jsx("ul",{className:"bg-muted/40 mt-1.5 max-h-64 space-y-0.5 overflow-y-auto rounded-md p-2",children:e.map((t,r)=>s.jsxs("li",{className:"text-2xs flex items-baseline gap-2 font-mono",children:[t.tag&&s.jsx("span",{className:oe("w-14 shrink-0",t.severity?we[t.severity]:we.info),children:t.tag}),s.jsx("span",{className:"text-foreground min-w-0 break-all","data-testid":"file-change-path",children:t.text})]},r))})]})}function Gs(e){const n=e.split(new RegExp(`(?<=\\/)|(?=["'])`));return n.map((t,r)=>s.jsxs(p.Fragment,{children:[t,r<n.length-1&&s.jsx("wbr",{})]},r))}function ge({item:e}){const n=ga[e.icon]??ps,t=e.severity?we[e.severity]:we.info;return s.jsxs("li",{className:oe("flex items-start gap-2 text-sm",t),children:[s.jsx(n,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[e.mono?s.jsx("code",{className:"bg-muted text-foreground block rounded px-1.5 py-1 font-mono text-xs [overflow-wrap:anywhere] whitespace-pre-wrap",children:Gs(e.label)}):s.jsx("span",{className:"break-words",children:e.label}),e.description&&s.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs break-words",children:e.description}),e.details&&e.details.length>0&&s.jsx(ka,{items:e.details,label:e.detailsLabel??"Show details"})]})]})}function Z({title:e,items:n,tone:t,defaultOpen:r=!1}){const[a,l]=p.useState(r);return n.length===0?null:s.jsx(fs,{open:a,onOpenChange:l,trigger:s.jsx("span",{className:oe("text-xs font-semibold tracking-wider uppercase",t==="warning"?"text-status-warning-fg":"text-muted-foreground"),children:e}),badge:s.jsx(se,{variant:"secondary",className:"text-xs",children:n.length}),children:s.jsx("ul",{className:"space-y-1.5",children:n.map((i,o)=>s.jsx(ge,{item:i},o))})})}function ja(e){return e.isolation!==void 0}function va({extensions:e}){const[n,t]=p.useState(!0),r=e.filter(ja);return r.length===0?null:s.jsx(fs,{open:n,onOpenChange:t,trigger:s.jsx("span",{className:"text-muted-foreground text-xs font-semibold tracking-wider uppercase",children:"What its extensions can reach"}),badge:s.jsx(se,{variant:"secondary",className:"text-xs",children:r.length}),children:s.jsx("ul",{className:"space-y-3","data-testid":"preview-extension-reach",children:r.map(a=>s.jsxs("li",{className:"flex min-w-0 items-start gap-2 text-sm",children:[s.jsx(Ve,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsx("p",{className:"text-foreground font-mono text-xs break-all",children:s.jsx("bdi",{children:a.id})}),s.jsx(Ln,{permissions:{runtime:a.isolation.runtime,net:a.isolation.net,run:a.isolation.run.map(l=>({name:l})),agents:a.isolation.agents,...a.hasServer!==void 0?{hasServer:a.hasServer}:{}},"data-testid":`preview-extension-reach-${a.id}`})]})]},a.id))})})}function Ys({preview:e,installBase:n}){const t=ua(e,{installBase:n}),r=Object.values(t).some(a=>a.length>0);return s.jsxs("div",{className:"space-y-6",children:[r&&s.jsx("p",{className:"text-sm",children:da(e)}),s.jsx(Z,{title:"What this package will do",items:t.effects}),s.jsx(va,{extensions:e.extensions}),s.jsx(Z,{title:"Commands this package declares",items:t.commands,defaultOpen:!0}),s.jsx(Z,{title:"Jobs it will schedule",items:t.schedules,defaultOpen:!0}),s.jsx(Z,{title:"Secrets required",items:t.secrets}),s.jsx(Z,{title:"External hosts",items:t.hosts}),s.jsx(Z,{title:"Dependencies",items:t.dependencies}),s.jsx(Z,{title:"Conflicts",items:t.conflicts,tone:"warning",defaultOpen:!0})]})}function ba(e){if(typeof e=="string")return e;if(e&&typeof e=="object"&&"name"in e)return String(e.name)}function Js(e){return e.scope===void 0||e.scope==="global"}function _e(e){var n;return Js(e)?"All agents (global)":e.agentName??((n=e.agentPath)==null?void 0:n.split("/").filter(Boolean).pop())??"This agent"}function ya(e){if(!e)return null;const n=[];return e.commands>0&&n.push(`${e.commands} command${e.commands===1?"":"s"}`),e.skills>0&&n.push(`${e.skills} skill${e.skills===1?"":"s"}`),e.hooks&&n.push("hooks"),n.length>0?n.join(" · "):null}const Na=3e3;function wa(){return s.jsxs("div",{className:"space-y-4",children:[s.jsx(W,{className:"h-4 w-3/4"}),s.jsx(W,{className:"h-4 w-1/2"}),s.jsx(W,{className:"h-20 w-full rounded-lg"}),s.jsx(W,{className:"h-4 w-2/3"})]})}function Oe({icon:e,children:n}){return s.jsxs("div",{className:"bg-muted/50 flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs",children:[s.jsx(e,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"truncate",children:n})]})}function Ca({installation:e,isRemoving:n,isConfirmingUninstall:t,disabled:r,onReinstall:a,onUninstallClick:l,published:i,onUnlink:o,onInstallPublished:d}){const u=Js(e),c=_e(e),h=u?qe:js,f=e.installedAt?new Date(e.installedAt).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):null;return e.devLink?s.jsxs("div",{className:"space-y-2 rounded-lg border p-3",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[s.jsx(h,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:c}),s.jsx(vs,{})]}),s.jsx(Vs,{installation:e})]})]}),s.jsx("div",{className:"flex flex-wrap items-center justify-end gap-1",children:s.jsx(Hs,{installation:e,published:i,label:c,onUnlink:o,onInstallPublished:d,disabled:r})})]}):s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border p-3",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx(h,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:c}),e.scope==="override"&&s.jsx("span",{className:"text-3xs shrink-0 rounded-full bg-amber-100 px-1.5 py-0.5 font-medium text-amber-700 dark:bg-amber-900 dark:text-amber-300",children:"Overrides global"})]}),s.jsxs("div",{className:"text-muted-foreground text-xs",children:["v",e.version,f&&` · ${f}`]})]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsxs(C,{size:"sm",variant:"ghost",disabled:r,onClick:a,"aria-label":`Reinstall for ${c}`,children:[s.jsx(He,{className:"mr-1 size-3","aria-hidden":!0}),"Reinstall"]}),s.jsxs(C,{size:"sm",variant:t?"destructive":"ghost",disabled:r,onClick:l,"aria-label":t?`Uninstall ${c} now`:`Uninstall for ${c}`,className:t?"":"text-destructive hover:text-destructive",children:[s.jsx(bs,{className:"mr-1 size-3","aria-hidden":!0}),n?"Removing…":t?"Uninstall now":"Uninstall"]})]})]})}function Pa({installations:e,uninstallPendingFor:n,anyMutationPending:t,onReinstall:r,onUninstall:a,published:l,onUnlink:i,onInstallPublished:o}){var T,v;const[d,u]=p.useState(null);function c(x){d===x.installPath?(u(null),a(x)):(u(x.installPath),setTimeout(()=>{u(N=>N===x.installPath?null:N)},Na))}const h=e.some(x=>x.type==="shape"),f=ya((T=e.find(x=>x.provides))==null?void 0:T.provides)??(h?"a workspace layout, agents, and schedules":null),w=(v=e.find(x=>x.installedFrom))==null?void 0:v.installedFrom;return s.jsxs("section",{className:"space-y-3",children:[s.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 text-sm font-medium",children:[s.jsx(hs,{className:"size-4 shrink-0","aria-hidden":!0}),e.every(x=>x.devLink)?"Dev link":e.length===1?"Installed":`Installed in ${e.length} locations`]}),s.jsx("div",{className:"space-y-2",role:"list","aria-label":"Installations",children:e.map(x=>s.jsx("div",{role:"listitem",children:s.jsx(Ca,{installation:x,isRemoving:n===x.installPath,isConfirmingUninstall:d===x.installPath,disabled:t,onReinstall:()=>r(x),onUninstallClick:()=>c(x),published:l,onUnlink:()=>i(x),onInstallPublished:N=>o(x,N)})},x.installPath))}),s.jsxs("dl",{className:"text-muted-foreground space-y-1.5 text-xs",children:[w&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ks,{className:"size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{children:["from ",w]})]}),f&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Ve,{className:"size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{children:["Provides ",f]})]})]})]})}function Sa(){var b;const{selectedPackageName:e,closeDetail:n}=ke(),t=Ke(),{data:r}=Ce(),a=e?(r??[]).find(y=>y.name===e)??null:null;p.useEffect(()=>{e&&r&&!r.some(y=>y.name===e)&&n()},[e,r,n]);const l=a!==null,i=(a==null?void 0:a.name)??null,{data:o,isLoading:d}=wt(i,{enabled:l}),{data:u,isLoading:c}=je(),h=a!==null?(u??[]).filter(y=>y.name===a.name):[],f=h.length>0,{data:w}=Ct(i,{enabled:f}),{data:T,isLoading:v,error:x}=Ss(i,{enabled:l&&!f&&!c}),{data:N}=xs(),$=Ks(),k=qs(),A=d||v||l&&c,D=(T==null?void 0:T.preview)??(o==null?void 0:o.preview),E=ba((o==null?void 0:o.manifest.author)??(a==null?void 0:a.author)),M=o==null?void 0:o.manifest.version,H=o==null?void 0:o.manifest.license,U=a==null?void 0:a.homepage,R=a==null?void 0:a.marketplace;function O(y){a&&t(a,y.agentPath?{agentPath:y.agentPath,agentName:_e(y)}:void 0)}function F(y){a&&$.mutate({name:a.name,options:y.agentPath?{projectPath:y.agentPath}:void 0,where:y.agentPath?_e(y):void 0})}const _=$.isPending&&$.variables?((b=h.find(y=>{var q,j;return(y.agentPath??void 0)===((j=(q=$.variables)==null?void 0:q.options)==null?void 0:j.projectPath)}))==null?void 0:b.installPath)??null:null;return s.jsxs(An,{open:a!==null,onOpenChange:y=>!y&&n(),children:[s.jsx(Un,{side:"right",className:"flex w-full flex-col overflow-hidden sm:max-w-xl",children:a&&s.jsxs(s.Fragment,{children:[s.jsxs(On,{className:"shrink-0 space-y-4 border-b pb-6",children:[s.jsxs("div",{className:"flex items-start gap-4 pr-8",children:[s.jsx("div",{className:"bg-muted flex size-14 shrink-0 items-center justify-center rounded-xl text-3xl",children:a.icon??"📦"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx(Fn,{className:"text-lg",children:be(a)}),s.jsx(gs,{type:a.type??"plugin",adapterType:a.adapterType,className:"shrink-0"})]}),a.description&&s.jsx(Mn,{className:"mt-1.5 line-clamp-3 text-sm",children:a.description})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[M&&s.jsxs(se,{size:"xs",variant:"outline",className:"font-mono",children:["v",M]}),E&&s.jsx(Oe,{icon:zn,children:E}),R&&s.jsx(Oe,{icon:qe,children:R}),H&&s.jsx(Oe,{icon:yt,children:H})]}),U&&s.jsxs(_n,{href:U,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1.5 text-xs transition-colors",children:[s.jsx(Kn,{className:"size-3","aria-hidden":!0}),s.jsx("span",{className:"truncate",children:U})]})]}),s.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto px-4 py-6",children:[A?s.jsx(wa,{}):f?s.jsx(Pa,{installations:w??h,uninstallPendingFor:_,anyMutationPending:$.isPending,onReinstall:O,onUninstall:F,published:a,onUnlink:k.askUnlink,onInstallPublished:k.askInstallPublished}):x?s.jsx($s,{error:x}):D?s.jsxs("section",{children:[s.jsx("h3",{className:"mb-3 text-sm font-semibold",children:"What this can do"}),s.jsx(Ys,{preview:D,installBase:N==null?void 0:N.dorkHome})]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"No special permissions required."}),!A&&(o==null?void 0:o.readme)&&s.jsxs("section",{children:[s.jsx("h3",{className:"mb-3 text-sm font-semibold",children:"About"}),s.jsx(qn,{content:o.readme,className:"text-sm",errorFallback:s.jsx("p",{className:"text-muted-foreground text-sm",children:"This README couldn’t be displayed."})})]})]}),s.jsxs(Vn,{className:"flex-row gap-2 border-t pt-4",children:[s.jsx(C,{variant:"ghost",onClick:n,className:"flex-1",children:"Close"}),f?s.jsx(C,{variant:"outline",disabled:$.isPending,onClick:()=>t(a),className:"flex-1",children:"Install…"}):s.jsx(C,{onClick:()=>t(a),className:"flex-1",children:"Install"})]})]})}),s.jsx(Is,{target:k.target,onClose:k.close,onUnlinked:k.onUnlinked})]})}function ts(e,n){return e instanceof Error?`Couldn’t install ${n}: ${e.message}`:`Couldn’t install ${n}. Try again.`}function as(e,n,t){var l;const r=e.warnings.length>0?e.warnings.join(" "):void 0;return e.type==="shape"?{id:n,description:r,action:{label:"Apply…",onClick:()=>ys.getState().openShapeSwitcherToShape(e.packageName)}}:Bn(e.type,(l=e.manifest)==null?void 0:l.adapterType)?{id:n,description:r,action:{label:"Open Connections",onClick:()=>t()}}:{id:n,description:r}}function $a(){const e=It(),n=Hn(),{mutate:t,mutateAsync:r}=e,a=p.useCallback(i=>{const o=K(i.name),d=S.loading(`Installing ${o}…`);t(i,{onSuccess:u=>{S.success(`Installed ${o}`,as(u,d,n))},onError:u=>{S.error(ts(u,o),{id:d})}})},[t,n]),l=p.useCallback(async i=>{const o=K(i.name),d=S.loading(`Installing ${o}…`);try{const u=await r(i);return S.success(`Installed ${o}`,as(u,d,n)),u}catch(u){throw S.error(ts(u,o),{id:d}),u}},[r,n]);return{...e,mutate:a,mutateAsync:l}}function Ia(e,n){return n==="global"?e===void 0||e==="global":e==="agent-local"||e==="override"}function Ra(e){return e.isPending?e.isReinstall?"Reinstalling…":"Installing…":e.hasBlockingConflicts?"Can’t install: conflicts found":e.isReinstall?"Reinstall":"Install"}function Ta(){var q;const e=Ae(j=>j.installConfirmPackage),n=Ae(j=>j.installContext),t=Ae(j=>j.closeInstallConfirm),r=$a(),{data:a}=Ns(),l=(a==null?void 0:a.agents)??[],i=(e==null?void 0:e.type)==="shape",o=n?"agent-local":"global",d=n?(q=l.find(j=>j.projectPath===n.agentPath))==null?void 0:q.id:void 0,[u,c]=p.useState(null),h=u!==null&&u.forContext===n?u:null,f=(h==null?void 0:h.scope)??o,w=h===null?d:h.agentId,T=j=>c({forContext:n,scope:j.scope??f,agentId:"agentId"in j?j.agentId:w}),v=i?"global":f,x=l.find(j=>j.id===w),N=v==="agent-local"?x==null?void 0:x.projectPath:void 0,$=v==="agent-local"&&!w,{data:k,isLoading:I,error:A}=Ss((e==null?void 0:e.name)??null,{enabled:e!==null&&!$,...N?{projectPath:N}:{}}),D=$?null:(k==null?void 0:k.preview)??null,{data:E}=xs(),M=N?`${N}/.dork`:E==null?void 0:E.dorkHome,H=D!==null&&D.conflicts.some(j=>j.level==="error"),{data:U}=je(N),R=!$&&(U??[]).some(j=>j.name===(e==null?void 0:e.name)&&Ia(j.scope,v)),O=!$&&A!==null,F=r.isPending||I||O||H||e===null||$,_=Ra({isPending:r.isPending,isReinstall:R,hasBlockingConflicts:H});async function b(){if(e)try{const j={...N&&{projectPath:N},...(k==null?void 0:k.disclosed)&&{approvedDisclosure:k.disclosed,approvedContentHash:k.contentHash}};await r.mutateAsync({name:e.name,options:Object.keys(j).length>0?j:void 0}),t()}catch{}}function y(j){j||t()}return s.jsx(Se,{open:e!==null,onOpenChange:y,children:s.jsx($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-2xl",children:e&&s.jsxs(s.Fragment,{children:[s.jsxs(Ie,{className:"shrink-0",children:[s.jsxs(Re,{children:[R?"Reinstall":"Install"," ",be(e),"?"]}),s.jsx(Te,{children:R?"This replaces the installed copy. Check what it does below.":"Check what this package does before you install it."})]}),s.jsx("div",{className:"shrink-0 space-y-2 px-4 sm:px-6",children:i?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Shapes apply to your whole app."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-muted-foreground text-3xs font-medium tracking-wider uppercase",children:"Install for"}),s.jsxs(ws,{value:f,onValueChange:j=>{const Q=j;T(Q==="global"?{scope:Q,agentId:void 0}:{scope:Q})},className:"gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{value:"global",id:"scope-global"}),s.jsx(ee,{htmlFor:"scope-global",className:"text-sm font-normal",children:"All agents (global)"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{value:"agent-local",id:"scope-agent"}),s.jsx(ee,{htmlFor:"scope-agent",className:"text-sm font-normal",children:"Specific agent"})]})]}),f==="agent-local"&&s.jsx("div",{className:"pl-6",children:s.jsx(Cs,{agents:l,value:w,onValueChange:j=>T({agentId:j})})})]})}),s.jsxs(De,{className:"mt-4",children:[$&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"Pick an agent to preview this install."}),I&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading preview…"}),O&&s.jsx($s,{error:A}),D&&s.jsx(Ys,{preview:D,installBase:M})]}),s.jsxs(Ee,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:t,disabled:r.isPending,children:"Cancel"}),s.jsx(C,{onClick:b,disabled:F,children:_})]})]})})})}function Da(e){return new Map((e??[]).map(n=>[n.installPath,n]))}function rs(e){return e.startsWith("v")?e.slice(1):e}function Xs(e,n){const t=n.get(e.installPath);if(t)return t.installedVersionSource!=="package"||rs(t.installedVersion)===rs(e.version)?t:void 0}function Ea(e,n,t){const r=Xs(e,n);return t.applying.has(e.installPath)?{kind:"applying",check:r}:t.isChecking?{kind:"checking"}:r?{kind:r.status,check:r}:{kind:"unchecked"}}function La(e,n){const t={available:[],current:0,unknown:0};for(const r of e){if(r.devLink)continue;const a=Xs(r,n);(a==null?void 0:a.status)==="update-available"?t.available.push({installation:r,check:a}):(a==null?void 0:a.status)==="current"?t.current+=1:(a==null?void 0:a.status)==="unknown"&&(t.unknown+=1)}return t}const Aa=7;function X(e,n){return n==="commit"?e.slice(0,Aa):e.startsWith("v")?e:`v${e}`}function ce(e){var n;return e.scope!=="agent-local"&&e.scope!=="override"?null:e.agentName??((n=e.agentPath)==null?void 0:n.split("/").filter(Boolean).pop())??"agent"}function Ua(e){var n,t;return((t=(n=e.applied)==null?void 0:n.fileNotices)==null?void 0:t.some(r=>r.outcome==="kept-unproven"))??!1}function Zs({installation:e}){const n=K(e.name),t=ce(e);return t?`${n} on ${t}`:n}function Oa(e,n){if(n!=null&&n.applied){const t=Ms(n),r=X(t.installedVersion,t.installedVersionSource),a=n.applied.warnings??[];return{kind:"success",message:`Updated ${e} to ${r}`,...a.length>0&&{description:a.join(" ")}}}if(n!=null&&n.applyError)return{kind:"error",message:`Couldn’t update ${e}: ${n.applyError}`};if((n==null?void 0:n.status)==="current")return{kind:"success",message:`${e} is already up to date`};if((n==null?void 0:n.status)==="unknown"){const t=n.note?`: ${n.note}`:"";return{kind:"warning",message:`Couldn’t check ${e} for updates${t}`}}return{kind:"warning",message:`${e} wasn’t updated`}}function Fa(e){const n=e.length,t=e.filter(a=>a.applied).length,r=e.filter(a=>a.applyError).length;return t===n?{kind:"success",message:e.some(Ua)?`Updated ${n} packages. Some kept files need sorting; see their rows.`:`Updated ${n} packages`}:t>0?{kind:"warning",message:`Updated ${t} of ${n} packages. Each row shows why.`}:r>0?{kind:"error",message:`Couldn’t update ${r===n?`${n}`:`${r} of ${n}`} packages. Each row shows why.`}:e.every(a=>a.status==="current")?{kind:"success",message:`All ${n} packages are up to date`}:{kind:"warning",message:"Nothing was updated. Each row shows why."}}function Ma(e,n){const t=new Map(n.checks.map(r=>[r.installPath,r]));if(e.length===1){const r=e[0];return Oa(Zs(r),t.get(r.check.installPath))}return Fa(e.map(({check:r})=>t.get(r.installPath)??r))}function za(e,n){S[e.kind](e.message,{id:n,...e.description&&{description:e.description}})}const _a="batch_update_needs_approval",Ka="disclosure_changed";function qa(e,n){const t=e==null?void 0:e.code;return t===Ka?`${n.length===1?"This package":"One of these packages"} changed what it runs since you looked. Review it again.`:t===_a?n.length===1?`It needs your approval. Run \`dorkos marketplace update ${n[0].check.packageName} --apply\` in a terminal.`:"Each needs your approval. Run `dorkos marketplace update <name> --apply` in a terminal.":e instanceof Error?e.message:String(e)}function Va(){const{mutateAsync:e}=Dt(),n=p.useRef(new Set);return{apply:p.useCallback(r=>{const a=r.filter(({check:c})=>!n.current.has(c.installPath)),[l,...i]=a.map(({check:c})=>({installPath:c.installPath,latestVersion:c.latestVersion,disclosed:c.disclosed??null,contentHash:c.contentHash??""}));if(l===void 0)return;const o=a.map(({check:c})=>c.installPath);for(const c of o)n.current.add(c);const d=a.length===1?Zs(a[0]):`${a.length} packages`,u=S.loading(`Updating ${d}…`);e({targets:[l,...i]}).then(c=>za(Ma(a,c),u)).catch(c=>S.error(`Couldn’t update ${d}`,{id:u,description:qa(c,a)})).finally(()=>{for(const c of o)n.current.delete(c)})},[e])}}function Ha(){const e=Tt(),{mutate:n}=e,t=p.useCallback(({where:r,...a})=>{const l=r?`${K(a.name)} on ${r}`:K(a.name),i=S.loading(`Checking the files of ${l}…`);n(a,{onSuccess:o=>{(o.outcome==="rebuilt"||o.outcome==="not-needed"?S.success:S.warning)(o.message,{id:i})},onError:o=>{S.error(`Couldn’t check the files of ${l}: ${o.message}`,{id:i})}})},[n]);return{...e,mutate:t}}function Ba(){const e=Ut(),{mutate:n}=e,t=p.useCallback(r=>{n(r,{onSuccess:a=>{S.success(a.message)},onError:a=>{S.error(a.message)}})},[n]);return{...e,mutate:t}}function en(){const e=ae(),{data:n}=je(),t=((n==null?void 0:n.length)??0)>0,r=$t(void 0,{enabled:t}),{data:a,isFetching:l,error:i,refetch:o}=r,d=p.useRef(n);p.useEffect(()=>{const h=d.current;d.current=n,!(h===void 0||h===n)&&e.invalidateQueries({queryKey:P.updates(),refetchType:"none"})},[n,e]);const u=p.useMemo(()=>Da(i||a==null?void 0:a.checks),[a,i]),c=p.useMemo(()=>La(n??[],u),[n,u]);return{checks:u,summary:c,isChecking:l,error:i,recheck:()=>void o()}}function sn(e){const n=p.useRef(null),t=p.useRef(!1);p.useEffect(()=>{var l;if(e||!t.current)return;t.current=!1;const a=document.activeElement;(a===null||a===document.body)&&((l=n.current)==null||l.focus())},[e]);const r=p.useMemo(()=>({onFocus:()=>{t.current=!0},onBlur:a=>{a.relatedTarget!==null&&(t.current=!1)}}),[]);return{targetRef:n,controlProps:r}}function Wa(e){return e===1?"1 package is":`${e} packages are`}function Qa(e){return`${e} ${e===1?"package":"packages"}`}function Ga(e){const n=[];return e.current>0&&n.push(`${Wa(e.current)} up to date.`),e.unknown>0&&n.push(`${Qa(e.unknown)} couldn’t be checked.`),n}function Ya(e){const n=e.available.length;return n>0?{headline:`${n} ${n===1?"update":"updates"} available.`,allCurrent:!1}:e.current>0&&e.unknown===0?{headline:"All packages are up to date.",allCurrent:!0}:e.current===0&&e.unknown===0?{headline:"Not checked for updates yet.",allCurrent:!1}:{headline:"No updates found.",allCurrent:!1}}function Ja({summary:e,isChecking:n,error:t,isApplying:r,onUpdateAll:a,onRecheck:l}){const{headline:i,allCurrent:o}=Ya(e),d=o?[]:Ga(e),u=!n&&!t&&e.available.length>0,{targetRef:c,controlProps:h}=sn(u);return s.jsxs("div",{className:"bg-muted/40 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 rounded-xl px-4 py-3",children:[s.jsx("p",{ref:c,tabIndex:-1,role:"status","aria-live":"polite",className:"focus-visible:ring-ring min-w-0 rounded-sm text-sm outline-none focus-visible:ring-2",children:n?s.jsxs("span",{className:"text-muted-foreground flex items-center gap-2",children:[s.jsx(Fe,{size:"xs"}),"Checking your packages for updates…"]}):t?s.jsxs("span",{children:["Couldn’t check for updates: ",t.message]}):s.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[o&&s.jsx(Ps,{className:"text-status-success-fg size-4 shrink-0","aria-hidden":!0}),s.jsx("span",{className:e.available.length>0?"font-medium":void 0,children:i}),d.map(f=>s.jsx("span",{className:"text-muted-foreground",children:f},f))]})}),!n&&s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs(C,{size:"sm",variant:"ghost",onClick:l,disabled:r,children:[s.jsx(He,{className:"mr-1 size-3","aria-hidden":!0}),t?"Try again":"Check again"]}),u&&s.jsx(C,{size:"sm","aria-disabled":r||void 0,className:"aria-disabled:cursor-not-allowed aria-disabled:opacity-50",onClick:r?void 0:a,...h,children:"Update all…"})]})]})}const le="flex items-start gap-1.5 text-xs",ie="mt-0.5 size-3 shrink-0";function ls({text:e}){return s.jsx("p",{className:"text-muted-foreground pl-4.5 text-xs",children:e})}function Xa({state:e}){switch(e.kind){case"checking":return s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Fe,{size:"xs",className:ie}),"Checking for updates…"]});case"applying":return s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Fe,{size:"xs",className:ie}),e.check?`Updating to ${X(e.check.latestVersion,e.check.latestVersionSource)}…`:"Updating…"]});case"update-available":{const{check:n}=e,t=X(n.installedVersion,n.installedVersionSource),r=X(n.latestVersion,n.latestVersionSource);return s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("p",{className:`${le} text-status-info-fg font-medium`,children:[s.jsx(kt,{className:ie,"aria-hidden":!0}),s.jsxs("span",{children:["Update available: ",t," ",s.jsx("span",{"aria-hidden":!0,children:"→"}),s.jsx("span",{className:"sr-only",children:"to"})," ",r]})]}),n.note&&s.jsx(ls,{text:n.note}),n.applyError&&s.jsxs("p",{className:`${le} text-destructive`,children:[s.jsx(me,{className:ie,"aria-hidden":!0}),s.jsxs("span",{children:["Couldn’t update: ",n.applyError]})]})]})}case"current":return s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Ps,{className:ie,"aria-hidden":!0}),"Up to date"]}),e.check.note&&s.jsx(ls,{text:e.check.note})]});case"unknown":return s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Wn,{className:ie,"aria-hidden":!0}),s.jsxs("span",{children:["Couldn’t check for updates",e.check.note?`: ${e.check.note}`:""]})]});case"unchecked":return null}}const Za="Check files so updates keep your edits.";function er(e,n){return e===1?`the file you ${n}`:`the ${e} files you ${n}`}function nn(e){return[e.changed.length>0&&`Updating replaces ${er(e.changed.length,"edited")} and keeps your copies beside them.`,e.added.length>0&&(e.added.length===1?"The file you added stays.":`The ${e.added.length} files you added stay.`),e.missing.length>0&&(e.missing.length===1?"The file you removed comes back.":`The ${e.missing.length} files you removed come back.`)].filter(n=>typeof n=="string")}function sr(e){if(e.changed.length>0)return"Updating replaces your edits; copies are kept.";if(e.missing.length>0)return"Updating puts back files you removed.";if(e.added.length>0)return"Updating keeps the files you added."}function nr(e){const t=[[e.changed.length,"edited"],[e.added.length,"added"],[e.missing.length,"removed"]].filter(([i])=>i>0),r=t.reduce((i,[o])=>i+o,0),a=e.truncated?"+":"",l=`${r}${a} ${r===1?"file":"files"} changed since install`;return t.length>1?`${l} (${t.map(([i,o])=>`${i} ${o}`).join(", ")})`:l}function tn(e){return(e==null?void 0:e.status)==="unknown"&&(e.reason==="no-record"||e.reason==="inferred")}function tr(e){var r,a;const n=tn(e)?e.check:(e==null?void 0:e.status)==="clean"||(e==null?void 0:e.status)==="modified"?(r=e.unproven)==null?void 0:r.check:void 0;if(!n||n.source==="local")return!1;const t=(a=n.last)==null?void 0:a.outcome;return t!=="mismatch"&&t!=="no-source"}function ar(e){var n;return e.check.source==="local"||((n=e.check.last)==null?void 0:n.outcome)==="fetch-failed"}function ne({title:e,paths:n}){return n.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-3xs font-medium tracking-wide uppercase",children:e}),s.jsx("ul",{"aria-label":e,className:"mt-0.5 space-y-0.5",children:n.map(t=>s.jsx("li",{className:"font-mono text-xs [overflow-wrap:anywhere]",children:t},t))})]})}function rr({unproven:e,label:n,onKeepFiles:t}){const r=e.files.length,a=e.running,l=a.length>0,i=e.check.source==="local",o=e.files.filter(d=>!a.includes(d));return s.jsxs("details",{"data-testid":"installation-integrity-unproven","data-runs":l?"true":"false",className:"group/kept mt-1 text-xs",children:[s.jsxs("summary",{className:oe("focus-ring flex cursor-pointer list-none items-start gap-1 rounded-sm select-none [&::-webkit-details-marker]:hidden",l?"text-amber-700 hover:text-amber-800 dark:text-amber-400 dark:hover:text-amber-300":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Ts,{className:"mt-0.5 size-3 shrink-0 text-amber-600 dark:text-amber-400","aria-hidden":!0}),s.jsxs("span",{children:["Kept ",r," ",r===1?"file":"files"," an update couldn’t sort.",l&&` ${a.length} of ${r===1?"it":"them"} still ${a.length===1?"runs":"run"}.`]}),s.jsx(Pe,{className:"mt-0.5 size-3 shrink-0 transition-transform duration-200 group-open/kept:rotate-90","aria-hidden":!0})]}),s.jsxs("div",{className:"text-muted-foreground mt-1.5 space-y-1.5 pl-4",children:[s.jsx("p",{children:"Unclear if these are yours or leftovers, so DorkOS kept them."}),s.jsx("p",{children:i?"Keep them as yours, or delete any you don’t need.":"Check files sets aside the leftovers and keeps yours."}),e.check.last&&s.jsx("p",{children:e.check.last.message}),s.jsx(ne,{title:"Still runs",paths:a}),s.jsx(ne,{title:"Kept",paths:o}),t&&ar(e)&&s.jsx(C,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",onClick:t,"aria-label":`Keep the files ${n??"this package"} kept as mine`,children:"Keep these as mine"})]})]})}function lr(e){const{integrity:n}=e,t=(n==null?void 0:n.status)==="clean"||(n==null?void 0:n.status)==="modified"?n.unproven:void 0;return t?s.jsxs(s.Fragment,{children:[s.jsx(is,{...e}),s.jsx(rr,{unproven:t,label:e.label,onKeepFiles:e.onKeepFiles})]}):s.jsx(is,{...e})}function is({integrity:e,updateAvailable:n,label:t,onCheckFiles:r,isCheckingFiles:a=!1}){var l,i;if((e==null?void 0:e.status)==="modified"){const o=n?nn(e):[],d=n?sr(e):void 0;return s.jsxs("details",{"data-testid":"installation-integrity",className:"group/files mt-1 text-xs",children:[s.jsxs("summary",{className:"text-muted-foreground hover:text-foreground focus-ring flex cursor-pointer list-none items-start gap-1 rounded-sm select-none [&::-webkit-details-marker]:hidden",children:[s.jsx(xt,{className:"text-status-warning-dot mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{className:"flex flex-col",children:[s.jsxs("span",{children:[nr(e),"."]}),d&&s.jsx("span",{"data-testid":"installation-integrity-update",children:d})]}),s.jsx(Pe,{className:"mt-0.5 size-3 shrink-0 transition-transform duration-200 group-open/files:rotate-90","aria-hidden":!0})]}),s.jsxs("div",{className:"text-muted-foreground mt-1.5 space-y-1.5 pl-4",children:[o.map(u=>s.jsx("p",{children:u},u)),s.jsx(ne,{title:"Edited",paths:e.changed}),s.jsx(ne,{title:"Added",paths:e.added}),s.jsx(ne,{title:"Removed",paths:e.missing}),e.truncated&&s.jsx("p",{children:"Showing the first 50 of each."})]})]})}if(tn(e)){const o=((l=e.check)==null?void 0:l.source)==="local",d=(i=e.check)==null?void 0:i.last,u=o?"Installed from a folder by an older DorkOS. Reinstall so updates keep your edits.":d?d.message:`Installed by an older DorkOS. ${Za}`,c=!o&&(d==null?void 0:d.outcome)==="mismatch"&&r;return s.jsxs("p",{"data-testid":"installation-integrity",className:"text-muted-foreground mt-1 flex items-start gap-1 text-xs",children:[s.jsx(Ts,{className:"text-status-warning-dot mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{children:[u,c&&s.jsxs(s.Fragment,{children:[" ",s.jsx("button",{type:"button",onClick:r,disabled:a,"aria-label":`Check the files of ${t??"this package"} again`,className:"text-foreground focus-ring rounded-sm underline underline-offset-2 disabled:opacity-50",children:a?"Checking…":"Try again"})]})]})]})}return null}function os(e){if(e.length!==1)return`${e.length} packages`;const[{installation:n}]=e,t=ce(n),r=K(n.name);return t?`${r} on ${t}`:r}function an({check:e}){return e.disclosed?fa(e.disclosed,e.installedDisclosed,e.scope==="global"?"global":"project"):[]}function ir(e){const n=e.map(an),t=n.filter(i=>i.length>0).length,r=n.filter(i=>i.some(o=>o.change==="new"||o.change==="changed")).length,a=e.length===1?t===1?"The new version runs things on its own":"The new version runs nothing on its own":`${t} of ${e.length} run things on their own`;if(r===0)return a;const l=e.length===1?"it adds or changes something":`${r} ${r===1?"adds":"add"} or ${r===1?"changes":"change"} something`;return`${a} · ${l}`}function or({change:e}){return e!=="new"&&e!=="changed"?null:s.jsx(se,{variant:"outline",className:"text-3xs shrink-0 border-amber-500/60 text-amber-700 dark:text-amber-300",children:e==="new"?"New":"Changed"})}function cs({row:e,change:n,previous:t}){return s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("ul",{children:s.jsx(ge,{item:e})}),t&&s.jsxs("div",{className:"mt-1 pl-6 opacity-70",children:[s.jsx("p",{className:"text-muted-foreground text-3xs mb-0.5 font-medium tracking-wide uppercase",children:"Installed now"}),s.jsx("ul",{"aria-label":"What the installed version runs instead",children:s.jsx(ge,{item:{...t,description:void 0,details:void 0}})})]})]}),s.jsx(or,{change:n})]})}function cr(e){const n=an(e);if(n.length===0)return s.jsx("p",{className:"text-muted-foreground text-xs",children:"The new version runs nothing on its own."});const t=n.filter(a=>a.change!=="unchanged"),r=n.filter(a=>a.change==="unchanged");return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The new version runs ",n.length===1?"this":`these ${n.length}`," on its own:"]}),s.jsxs("div",{role:"list","aria-label":"What the new version runs",className:"space-y-2",children:[t.map((a,l)=>s.jsx("div",{role:"listitem",children:s.jsx(cs,{...a})},`lead-${l}`)),r.length>0&&s.jsxs("details",{className:"group/unchanged",role:"listitem",children:[s.jsxs("summary",{className:"text-muted-foreground hover:text-foreground focus-ring inline-flex cursor-pointer list-none items-center gap-1 rounded-sm text-xs select-none [&::-webkit-details-marker]:hidden",children:[s.jsx(Pe,{className:"size-3 shrink-0 transition-transform duration-200 group-open/unchanged:rotate-90"}),r.length," unchanged"]}),s.jsx("div",{className:"mt-2 space-y-2",children:r.map((a,l)=>s.jsx(cs,{...a},`same-${l}`))})]})]})]})}function dr({integrity:e,...n}){const{installation:t,check:r}=n,a=ce(t),l=X(r.installedVersion,r.installedVersionSource),i=X(r.latestVersion,r.latestVersionSource);return s.jsxs("li",{className:"bg-muted/40 space-y-2 rounded-lg px-3 py-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium",children:K(t.name)}),s.jsx("div",{className:"text-muted-foreground text-xs",children:a??"All agents"}),a&&t.agentPath&&s.jsx("div",{className:"text-muted-foreground text-2xs font-mono [overflow-wrap:anywhere]",children:Gs(t.agentPath)})]}),s.jsxs("div",{className:"shrink-0 font-mono text-xs",children:[l," ",s.jsx("span",{"aria-hidden":!0,children:"→"}),s.jsx("span",{className:"sr-only",children:"to"})," ",i]})]}),(e==null?void 0:e.status)==="modified"&&nn(e).map(o=>s.jsx("p",{className:"text-muted-foreground text-xs",children:o},o)),s.jsx(cr,{...n})]})}function ur({stale:e,onCancel:n,onConfirm:t,integrityByPath:r}){return s.jsx(Se,{open:e!==null,onOpenChange:a=>!a&&n(),children:s.jsx($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-xl",children:e&&s.jsxs(s.Fragment,{children:[s.jsxs(Ie,{className:"shrink-0 text-left",children:[s.jsxs(Re,{className:"text-left",children:["Update ",os(e),"?"]}),s.jsx(Te,{className:"text-left",children:e.length===1?"The newest version replaces this one in place. Check what it runs first.":"Each newest version replaces the one installed. Check what each runs first."}),s.jsx("p",{className:"text-foreground text-left text-xs font-medium","data-testid":"update-disclosure-summary",children:ir(e)})]}),s.jsx(De,{children:s.jsx("ul",{"aria-label":"Packages to update",className:"space-y-2",children:e.map(a=>s.jsx(dr,{...a,integrity:r==null?void 0:r.get(a.installation.installPath)},a.check.installPath))})}),s.jsxs(Ee,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:n,children:"Cancel"}),s.jsxs(C,{onClick:()=>t(e),children:["Update ",os(e)]})]})]})})})}function mr(e){return e!==null&&e.heldBack!==void 0&&(e.scope===void 0||e.scope==="global")}function hr({installation:e,unproven:n,onCancel:t,onConfirm:r}){var T;const a=mr(e),l=At(a),i=a?(T=l.data)==null?void 0:T.find(v=>v.name===(e==null?void 0:e.name)):void 0,o=i!=null&&i.effects&&i.bindsTo?{effects:i.effects,bindsTo:i.bindsTo}:void 0,d=a&&l.isPending,u=e!==null&&n!==void 0,c=e?K(e.name):"",h=(n==null?void 0:n.running)??[],f=(n==null?void 0:n.files.filter(v=>!h.includes(v)))??[],w=o?Be(o.effects,"global"):[];return s.jsx(Se,{open:u,onOpenChange:v=>!v&&t(),children:s.jsx($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-lg",children:u&&e&&n&&s.jsxs(s.Fragment,{children:[s.jsxs(Ie,{className:"shrink-0 text-left",children:[s.jsxs(Re,{className:"text-left",children:["Keep these ",c," files as yours?"]}),s.jsx(Te,{className:"text-left",children:"An update couldn’t tell if these are yours or leftovers."})]}),s.jsxs(De,{className:"space-y-3 text-xs",children:[s.jsxs("div",{className:"text-muted-foreground space-y-1",children:[s.jsx("p",{children:n.check.source==="local"?"No earlier version to compare with.":"DorkOS couldn’t download the old version to compare."}),s.jsx("p",{children:"Keeping makes them yours. Updates leave them alone."}),s.jsx("p",{children:"Nothing is moved or deleted."}),h.length>0&&s.jsx("p",{children:"They now run as your own files."})]}),s.jsx(ne,{title:"Still runs",paths:h}),s.jsx(ne,{title:"Kept",paths:f}),a&&s.jsx("div",{"data-testid":"keep-files-activation",className:"space-y-1.5",children:d?s.jsxs("p",{className:"text-muted-foreground",children:["Reading what ",c," runs…"]}):o?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-foreground font-medium",children:[c," is held back from sessions."]}),s.jsx("p",{className:"text-foreground",children:"Keeping also lets it run in every session, as it is now:"}),s.jsx("ul",{"aria-label":`What ${c} runs`,className:"space-y-1.5",children:w.map((v,x)=>s.jsx(ge,{item:v},x))})]}):s.jsxs("p",{className:"text-muted-foreground",children:[c," stays held back until you review it."]})})]}),s.jsxs(Ee,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:t,children:"Cancel"}),s.jsx(C,{disabled:d,onClick:()=>r({installRoot:e.installPath,keepKey:n.keepKey,...e.agentPath&&{projectPath:e.agentPath},...o&&{review:o}}),children:o?"Keep them and let it run":"Keep them as mine"})]})]})})})}const pr="dev_link_changed",fe={card:null,refusal:null,checking:!1};function ds(e){const n=e;return{message:(n==null?void 0:n.message)||"Couldn’t check this folder. Try again.",code:n==null?void 0:n.code}}function fr({open:e,onOpenChange:n}){var z;const[t,r]=p.useState(""),[a,l]=p.useState("global"),[i,o]=p.useState(void 0),[d,u]=p.useState(!1),[c,h]=p.useState(fe),[f,w]=p.useState(!1),[T,v]=p.useState(null),[x,N]=p.useState(null),[$,k]=p.useState(!1),I=p.useRef(0),A=pt(),D=ft(),{data:E}=Ns({enabled:e}),M=(E==null?void 0:E.agents)??[],H=a==="agent-local"?(z=M.find(g=>g.id===i))==null?void 0:z.projectPath:void 0,U=a==="agent-local"&&H===void 0;function R(){I.current+=1,n(!1)}async function O(g){const V=(g.path??t).trim(),G="projectPath"in g?g.projectPath:H,Y=g.replaceInstalled??!1;u(Y),N(null),v(null),g.keepChangedNotice||w(!1);const he=++I.current,rn=!("projectPath"in g)&&U;if(V===""||rn){h(fe);return}h(pe=>({card:g.keepCard?pe.card:null,refusal:null,checking:!0}));try{const pe=await A.mutateAsync({path:V,...G?{scope:"project",projectPath:G}:{scope:"global"},...Y&&{replaceInstalled:!0}});if(he!==I.current)return;h({card:{preview:pe,replaceInstalled:Y,projectPath:G},refusal:null,checking:!1})}catch(pe){if(he!==I.current)return;h({card:null,refusal:ds(pe).message,checking:!1})}}function F(g){c.card&&O({path:c.card.preview.path,projectPath:c.card.projectPath,replaceInstalled:g,keepCard:!0})}async function _(){if(!c.card||c.checking)return;N(null);const{preview:g,replaceInstalled:V,projectPath:G}=c.card;try{const Y=await D.mutateAsync({path:g.path,...G?{scope:"project",projectPath:G}:{scope:"global"},...V&&{replaceInstalled:!0},via:"app",expectedChange:g.change});if(Y.status==="approval_required"){v(Y.approval);return}S.success(`${K(g.name)} runs from your folder.`),R()}catch(Y){const he=ds(Y);if(he.code===pr){w(!0),await O({path:g.path,projectPath:G,replaceInstalled:V,keepChangedNotice:!0});return}N(he.message)}}const b=c.card,y=(b==null?void 0:b.preview.replaces)??null,q=b?K(b.preview.name):"",j=b!=null&&b.preview.effects?Be(b.preview.effects,b.projectPath?"project":"global"):[],Q=(b==null?void 0:b.preview.extensions)??[],m=y===null||d&&(b==null?void 0:b.replaceInstalled)===!0,L=b===null||c.checking||!m||D.isPending||T!==null;return s.jsxs(Se,{open:e,onOpenChange:g=>g?n(!0):R(),children:[s.jsxs($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-lg",children:[s.jsxs(Ie,{className:"shrink-0 text-left",children:[s.jsx(Re,{className:"text-left",children:b?`Run ${q} from this folder?`:"Link a folder"}),s.jsx(Te,{className:"text-left",children:"Run a plugin or skill pack from your own folder."})]}),s.jsxs(De,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{htmlFor:"dev-link-path",children:"Folder"}),s.jsx(Qn,{id:"dev-link-path",value:t,placeholder:"/Users/you/code/my-plugin",onChange:g=>{r(g),c!==fe&&(I.current+=1,h(fe),u(!1))},onBlur:()=>void O({}),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),O({}))},onBrowse:()=>k(!0),browseTestId:"dev-link-browse","aria-describedby":c.refusal?"dev-link-refusal":void 0,"aria-invalid":c.refusal?!0:void 0,autoComplete:"off",spellCheck:!1}),c.refusal&&s.jsx("p",{id:"dev-link-refusal",role:"alert",className:"text-status-warning-fg text-xs [overflow-wrap:anywhere]",children:c.refusal}),s.jsx("p",{className:"text-muted-foreground text-xs empty:hidden","aria-live":"polite",children:c.checking?"Checking the folder…":""})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-muted-foreground text-3xs font-medium tracking-wider uppercase",children:"Run for"}),s.jsxs(ws,{value:a,onValueChange:g=>{const V=g;l(V),V==="global"?(o(void 0),O({projectPath:void 0})):(I.current+=1,h(fe),u(!1))},className:"gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{value:"global",id:"dev-link-scope-global"}),s.jsx(ee,{htmlFor:"dev-link-scope-global",className:"text-sm font-normal",children:"All agents (global)"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{value:"agent-local",id:"dev-link-scope-agent"}),s.jsx(ee,{htmlFor:"dev-link-scope-agent",className:"text-sm font-normal",children:"Specific agent"})]})]}),a==="agent-local"&&s.jsx("div",{className:"pl-6",children:s.jsx(Cs,{agents:M,value:i,onValueChange:g=>{var V;o(g),O({projectPath:(V=M.find(G=>G.id===g))==null?void 0:V.projectPath})}})}),U&&t.trim()!==""&&s.jsx("p",{className:"text-muted-foreground text-xs",children:"Pick an agent to check this folder."})]}),f&&s.jsx(Me,{tone:"info",role:"alert",children:"The folder changed. Check it again."}),b&&s.jsxs("section",{"aria-label":"What linking does",className:"space-y-3 text-sm",children:[s.jsx("code",{className:"bg-muted block rounded px-2 py-1.5 font-mono text-xs [overflow-wrap:anywhere]",children:b.preview.path}),s.jsx("p",{children:"Edits here run in DorkOS right away, without asking."}),y&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("p",{children:["Your installed copy (v",y.version,") is set aside, not deleted."]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Gn,{id:"dev-link-replace",checked:d,onCheckedChange:g=>{c.checking||F(g===!0)},"aria-disabled":c.checking||void 0,className:"aria-disabled:cursor-not-allowed aria-disabled:opacity-50"}),s.jsx(ee,{htmlFor:"dev-link-replace",className:"text-sm leading-snug font-normal",children:"Use my folder instead of the installed copy"})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:"font-medium",children:"It runs:"}),j.length===0&&Q.length===0?s.jsx("p",{className:"text-muted-foreground",children:"Nothing on its own."}):s.jsxs("ul",{"aria-label":`What ${q} runs`,className:"space-y-1.5",children:[Q.map(g=>s.jsxs("li",{className:"text-sm [overflow-wrap:anywhere]",children:["Extension ",g]},g)),j.map((g,V)=>s.jsx(ge,{item:g},V))]})]})]}),T&&s.jsx(Me,{tone:"info",role:"status",children:"Approve it where DorkOS asks. This dialog can close."}),x&&s.jsx("p",{role:"alert",className:"text-status-warning-fg text-xs [overflow-wrap:anywhere]",children:x})]}),s.jsxs(Ee,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:R,disabled:D.isPending,children:"Cancel"}),s.jsx(C,{onClick:()=>void _(),disabled:L,children:D.isPending?"Linking…":"Link folder"})]})]}),$&&s.jsx(Yn,{open:!0,onOpenChange:k,initialPath:t.trim()||null,onSelect:g=>{r(g),k(!1),O({path:g})}})]})}function xr({heldBack:e,label:n,onReviewClick:t,isRaisingReview:r}){return s.jsxs("div",{className:"text-status-warning-fg mt-1.5 flex flex-col items-start gap-1.5 text-xs sm:flex-row sm:gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(Jn,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:e.note})]}),e.reviewable&&s.jsx(C,{size:"sm",variant:"outline",className:"ml-5 h-6 shrink-0 px-2 text-xs sm:ml-0",onClick:t,disabled:r,"aria-label":`Review ${n}`,children:r?"Asking…":"Review"})]})}function gr({state:e,label:n,onClick:t,focusProps:r}){if(e.kind!=="update-available"&&e.kind!=="applying")return null;const a=e.kind==="applying",{check:l}=e,i=l&&X(l.installedVersion,l.installedVersionSource),o=l&&X(l.latestVersion,l.latestVersionSource);return s.jsxs(C,{size:"sm",variant:"outline","aria-disabled":a||void 0,className:"aria-disabled:cursor-not-allowed aria-disabled:opacity-50",onClick:a?void 0:t,"aria-label":a?`Updating ${n}`:`Update ${n} from ${i} to ${o}`,...r,children:[s.jsx(He,{className:`mr-1 size-3 ${a?"animate-spin motion-reduce:animate-none":""}`,"aria-hidden":!0}),a?"Updating…":`Update to ${o}`]})}function kr(e){return(e==null?void 0:e.status)==="clean"||(e==null?void 0:e.status)==="modified"?e.unproven:void 0}function jr({installation:e,isActiveShape:n,isConfirmingUninstall:t,isUninstalling:r,updateState:a,integrity:l,isCheckingFiles:i,onCheckFilesClick:o,onKeepFilesClick:d,onApplyClick:u,onUpdateClick:c,onUninstallClick:h,onReviewClick:f,isRaisingReview:w,published:T,onUnlinkClick:v,onInstallPublishedClick:x}){const{name:N,version:$,type:k,scope:I,installedFrom:A,installedAt:D,adapterType:E}=e,M=e.dependencyWarnings??[],H=k==="shape",U=e.devLink!==void 0,R=K(N),O=D?new Date(D).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):null,F=ce(e),_=F?`${R} on ${F}`:R,{targetRef:b,controlProps:y}=sn(a.kind==="update-available"||a.kind==="applying");return s.jsxs("div",{className:"bg-card flex flex-col gap-3 rounded-xl border p-4 @2xl:flex-row @2xl:items-center @2xl:justify-between @2xl:gap-4 @2xl:p-6",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold",children:R}),s.jsx(gs,{type:k,adapterType:E}),U&&s.jsx(vs,{}),e.heldBack&&s.jsx(se,{variant:"outline",className:"border-amber-500/60 text-amber-700 dark:text-amber-300",children:"Held back"}),n&&s.jsx(se,{variant:"secondary",children:"Active"}),s.jsxs(se,{variant:"outline",className:"font-mono",children:["v",$]}),I==="agent-local"&&s.jsx("span",{className:"text-3xs rounded-full bg-blue-100 px-1.5 py-0.5 font-medium text-blue-700 dark:bg-blue-900 dark:text-blue-300",children:"Local"}),I==="override"&&s.jsx("span",{className:"text-3xs rounded-full bg-amber-100 px-1.5 py-0.5 font-medium text-amber-700 dark:bg-amber-900 dark:text-amber-300",children:"Overrides global"})]}),s.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs",children:[F&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(js,{className:"size-3","aria-hidden":!0}),F]}),A&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ks,{className:"size-3","aria-hidden":!0}),A]}),O&&s.jsxs("span",{children:["Installed ",O]})]}),U?s.jsx(Vs,{installation:e}):s.jsx("div",{ref:b,tabIndex:-1,"data-testid":"installation-update-status",className:"focus-visible:ring-ring mt-1.5 rounded-sm outline-none focus-visible:ring-2",children:s.jsx(Xa,{state:a})}),e.heldBack&&s.jsx(xr,{heldBack:e.heldBack,label:_,onReviewClick:f,isRaisingReview:w}),!U&&s.jsx(lr,{integrity:l,updateAvailable:a.kind==="update-available"||a.kind==="applying",label:_,onCheckFiles:o,isCheckingFiles:i,onKeepFiles:d}),M.length>0&&s.jsx("div",{className:"mt-1 space-y-0.5",children:M.map(q=>s.jsxs("p",{className:"text-status-warning-fg flex items-start gap-1 text-xs",children:[s.jsx(me,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{children:q})]},q))})]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[H&&!n&&s.jsxs(C,{size:"sm",variant:"outline",onClick:u,"aria-label":`Apply ${R}`,children:[s.jsx(st,{className:"mr-1 size-3","aria-hidden":!0}),"Apply…"]}),U&&s.jsx(Hs,{installation:e,published:T,label:_,onUnlink:v,onInstallPublished:x}),!U&&tr(l)&&s.jsxs(C,{size:"sm",variant:"outline",onClick:o,disabled:i,"aria-label":i?`Checking the files of ${_}`:`Check the files of ${_}`,children:[s.jsx(jt,{className:"mr-1 size-3","aria-hidden":!0}),i?"Checking…":"Check files"]}),!U&&s.jsx(gr,{state:a,label:_,onClick:c,focusProps:y}),!U&&s.jsxs(C,{size:"sm",variant:t?"destructive":"ghost",onClick:h,disabled:r,"aria-label":t?`Uninstall ${R}${F?` from ${F}`:""} now`:`Uninstall ${R}${F?` from ${F}`:""}`,className:t?"":"text-destructive hover:text-destructive",children:[s.jsx(bs,{className:"mr-1 size-3","aria-hidden":!0}),r?"Removing…":t?"Uninstall now":"Uninstall"]})]})]})}const vr=3e3;function br(){var Q;const{data:e,isLoading:n,error:t,refetch:r}=je(),{data:a}=Xn(),l=(Q=a==null?void 0:a.find(m=>m.active))==null?void 0:Q.name,i=ys(m=>m.openShapeSwitcherToShape),o=Ks(),d=en(),u=Et(),{apply:c}=Va(),h=Lt(),{data:f}=Pt(),w=Ha(),T=Ba(),[v,x]=p.useState(null),[N,$]=p.useState(null),[k,I]=p.useState(null),[A,D]=p.useState(!1),E=qs(),{data:M}=Rs(),H=(e??[]).some(m=>m.devLink&&!m.devLink.parked),{data:U}=Ce(void 0,{enabled:H}),R=m=>s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(C,{size:"sm",variant:"outline",onClick:()=>D(!0),children:[s.jsx(et,{className:"mr-1 size-3","aria-hidden":!0}),"Link a folder"]})}),(M==null?void 0:M.registryUnreadable)&&s.jsx(Me,{tone:"error",children:"Dev links can’t be read right now."}),m,A&&s.jsx(fr,{open:!0,onOpenChange:D}),s.jsx(Is,{target:E.target,onClose:E.close,onUnlinked:E.onUnlinked})]});if(n)return R(s.jsx(zs,{count:3}));if(t)return R(s.jsx(_s,{error:t,onRetry:()=>void r()}));if(!e||e.length===0)return R(s.jsx(xe,{title:"No packages installed",description:"Browse the marketplace to find one."}));function O(m){N===m.installPath?(o.mutate({name:m.name,options:{purge:!1,...m.agentPath&&{projectPath:m.agentPath}},where:ce(m)??void 0}),$(null)):($(m.installPath),setTimeout(()=>{$(L=>L===m.installPath?null:L)},vr))}function F(m){h.mutate(m.name,{onSuccess:()=>S.info(`Review ${K(m.name)} on the approval card`,{description:"It stays held back until you allow it."}),onError:L=>S.error(`Couldn’t ask about ${K(m.name)}`,{description:L.message})})}function _(m){I(null),c(m)}function b(m){w.mutate({name:m.name,options:{installRoot:m.installPath,...m.agentPath&&{projectPath:m.agentPath}},where:ce(m)??void 0})}function y(m){var L,z,g;return w.isPending&&((L=w.variables)==null?void 0:L.name)===m.name&&(((g=(z=w.variables)==null?void 0:z.options)==null?void 0:g.installRoot)??m.installPath)===m.installPath}function q(m){var z;const L=o.variables;return o.isPending&&(L==null?void 0:L.name)===m.name&&(((z=L==null?void 0:L.options)==null?void 0:z.projectPath)??void 0)===(m.agentPath??void 0)}const j={isChecking:d.isChecking,applying:u};return R(s.jsxs(s.Fragment,{children:[s.jsx(Ja,{summary:d.summary,isChecking:d.isChecking,error:d.error,isApplying:u.size>0,onUpdateAll:()=>I(d.summary.available),onRecheck:d.recheck}),s.jsx("div",{className:"@container space-y-3",role:"list","aria-label":"Installed packages",children:e.map(m=>{const L=Ea(m,d.checks,j);return s.jsx("div",{role:"listitem",children:s.jsx(jr,{installation:m,isActiveShape:m.type==="shape"&&m.name===l,isConfirmingUninstall:N===m.installPath,isUninstalling:q(m),updateState:L,integrity:f==null?void 0:f.get(m.installPath),isCheckingFiles:y(m),onCheckFilesClick:()=>b(m),onKeepFilesClick:()=>x(m),onApplyClick:()=>i(m.name),onUpdateClick:()=>{if(L.kind!=="update-available")return;const z={installation:m,check:L.check};Zn(L.check.disclosed)?I([z]):c([z])},onUninstallClick:()=>O(m),onReviewClick:()=>F(m),isRaisingReview:h.isPending&&h.variables===m.name,published:U==null?void 0:U.find(z=>z.name===m.name),onUnlinkClick:()=>E.askUnlink(m),onInstallPublishedClick:z=>E.askInstallPublished(m,z)})},m.installPath)})}),s.jsx(ur,{stale:k,integrityByPath:f,onCancel:()=>I(null),onConfirm:_}),s.jsx(hr,{installation:v,unproven:v?kr(f==null?void 0:f.get(v.installPath)):void 0,onCancel:()=>x(null),onConfirm:m=>{v&&T.mutate({name:v.name,options:m}),x(null)}})]}))}function Ir(){const{view:e,setView:n}=ke(),t=en().summary.available.length;return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx(nt,{children:"Marketplace"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:e==="installed"?"Everything you’ve installed.":"Packages for your agents and for DorkOS."})]}),s.jsx(lt,{value:e,onValueChange:r=>n(r),children:s.jsxs(it,{"aria-label":"Marketplace view",children:[s.jsx(Je,{value:"browse",children:"Browse"}),s.jsxs(Je,{value:"installed",children:["Installed",t>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":!0,className:"bg-status-info-bg text-status-info-fg text-2xs ml-1.5 rounded-full px-1.5 font-medium tabular-nums",children:t}),s.jsxs("span",{className:"sr-only",children:[", ",t," ",t===1?"update":"updates"," available"]})]})]})]})})]}),e==="installed"?s.jsx("section",{"aria-label":"Installed packages",children:s.jsx(br,{})}):s.jsxs(s.Fragment,{children:[s.jsx(zt,{}),s.jsx(tt,{}),s.jsx("section",{"aria-label":"All packages",children:s.jsx(Xt,{})})]}),s.jsx(Sa,{}),s.jsx(Ta,{})]})}export{br as I,Ir as M};
@@ -1 +0,0 @@
1
- import{Q as b,ad as L,ae as g,R as S,U as $,r as N,j as e,d6 as T,B as x,f as R,e as P,eH as I,e6 as H,eI as W,W as v,eJ as B,eK as V,eL as G,eM as J,eN as U,ep as D,I as M,eO as X}from"./index-DMYBI16t.js";import{u as Y}from"./use-pending-read-BuJknrxG.js";function Z(){const s=b();return L({queryKey:g.sources(),queryFn:()=>s.listMarketplaceSources(),staleTime:6e4})}function _(){const s=b(),t=S();return $({mutationFn:n=>s.addMarketplaceSource(n),onSuccess:()=>{t.invalidateQueries({queryKey:g.sources()}),t.invalidateQueries({queryKey:g.packages()})}})}function ee(){const s=b(),t=S();return $({mutationFn:n=>s.removeMarketplaceSource(n),onSuccess:()=>{t.invalidateQueries({queryKey:g.sources()}),t.invalidateQueries({queryKey:g.packages()})}})}function se(){const s=b(),t=S();return $({mutationFn:n=>s.refreshMarketplaceSource(n),meta:{suppressErrorToast:!0},onSettled:()=>{t.invalidateQueries({queryKey:g.sources()}),t.invalidateQueries({queryKey:g.packages()})}})}function F(s){return s===1?"1 package is ready to install.":`${s} packages are ready to install.`}function k(s){return`${s.replace(/\.+$/,"")}.`}function C(s){return new Date(s).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function q(s){return s.startsWith("file://")}function z(s){return q(s)?"Couldn’t read that folder":"Couldn’t reach it"}function ae(s){const t=s.lastFetch;return(t==null?void 0:t.state)==="failed"?{kind:"failed",message:`Its packages didn’t load: ${k(t.reason)}`}:(t==null?void 0:t.state)==="stale"?{kind:"stale",message:`${z(s.source)}: ${k(t.reason)} Still showing the last copy, from ${C(t.copyFetchedAt)}.`}:null}function te(s,t,n){return s?(t==null?void 0:t.kind)==="failed"?"Enabled, but its packages didn’t load":(t==null?void 0:t.kind)==="stale"?"Enabled, showing an older copy":n?"Enabled":"Enabled, not fetched yet":"Disabled"}function ne({name:s,source:t,enabled:n,addedAt:d,listing:u,fetched:i,onRefresh:h,isRefreshing:r,onRemove:p,isRemoving:f}){const c=C(d),j=n?u?"fill-current text-status-warning-dot":i?"fill-current text-status-success":"fill-none text-muted-foreground":"fill-current text-muted-foreground";return e.jsxs("div",{"data-slot":"source-card",className:"bg-card flex items-start justify-between gap-4 rounded-xl border p-5",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx(I,{className:`mt-0.5 size-3 shrink-0 ${j}`,"aria-label":te(n,u,i)}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold",children:s}),e.jsx("p",{className:"text-muted-foreground truncate text-xs",children:t}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["Added ",c]}),u&&e.jsxs("p",{className:"text-status-warning-fg mt-2 text-xs",children:[u.message," ",e.jsx(x,{variant:"link",size:"sm",onClick:h,"aria-busy":r,"aria-label":`Try again for ${s}`,className:"text-status-warning-fg h-auto p-0 text-xs underline",children:"Try again"})]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs(x,{variant:"ghost",size:"sm",onClick:h,"aria-busy":r,"aria-label":`Refresh ${s}`,children:[e.jsx(H,{className:`size-3.5 ${r?"animate-spin":""}`}),e.jsx("span",{className:"ml-1.5 hidden sm:inline",children:"Refresh"})]}),e.jsxs(x,{variant:"ghost",size:"sm",onClick:p,disabled:f,className:"text-destructive hover:text-destructive","aria-label":`Remove ${s}`,children:[e.jsx(W,{className:"size-3.5"}),e.jsx("span",{className:"ml-1.5 hidden sm:inline",children:"Remove"})]})]})]})}function re({open:s,onOpenChange:t,isPending:n,error:d,onSubmit:u}){const[i,h]=N.useState(""),[r,p]=N.useState(""),f=()=>{u(i.trim(),r.trim())},c=m=>{m||(h(""),p("")),t(m)},j=r.trim().length>0&&i.trim().length>0;return e.jsx(B,{open:s,onOpenChange:c,children:e.jsxs(V,{className:"sm:max-w-md",children:[e.jsxs(G,{children:[e.jsx(J,{children:"Add a marketplace source"}),e.jsx(U,{children:"Paste a git repository link and give it a name."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(D,{htmlFor:"source-url",children:"Repository link"}),e.jsx(M,{id:"source-url",value:r,onChange:m=>p(m.target.value),placeholder:"https://github.com/org/marketplace",autoComplete:"off"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(D,{htmlFor:"source-name",children:"Name"}),e.jsx(M,{id:"source-name",value:i,onChange:m=>h(m.target.value),placeholder:"e.g. my-registry",autoComplete:"off"})]}),d&&e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:d})]}),e.jsxs(X,{children:[e.jsx(x,{variant:"ghost",onClick:()=>c(!1),disabled:n,children:"Cancel"}),e.jsx(x,{onClick:f,disabled:!j||n,children:n?"Adding…":"Add source"})]})]})})}function oe(){var w;const{data:s,isLoading:t}=Z(),n=Y(t),d=_(),u=ee(),i=se(),[h,r]=N.useState(!1),[p,f]=N.useState({id:0,text:""}),c=a=>f(o=>({id:o.id+1,text:a})),j=(a,o)=>{d.mutate({name:a,source:o,enabled:!0},{onSuccess:l=>{if(r(!1),l.listing.fetched){const y=F(l.listing.packageCount);c(`${l.name}: ${y}`),v.success(`Added ${l.name}. ${y}`)}else c(`${l.name}: Added, but its packages didn’t load: ${k(l.listing.reason)}`),v.warning(`Added ${l.name}, but its packages didn’t load.`)}})},m=a=>i.isPending&&i.variables===a,E=a=>{m(a)||i.mutate(a,{onSuccess:o=>{var y;if(o.stale){const A=((y=s==null?void 0:s.find(O=>O.name===a))==null?void 0:y.source)??"";c(`${a}: ${z(A)}: ${k(o.reason??"no reason given")} Still showing the last copy, from ${C(o.fetchedAt)}.`),v.warning(`${q(A)?"Couldn’t read":"Couldn’t reach"} ${a}. Still showing the last copy.`);return}const l=F(o.marketplace.plugins.length);c(`${a}: ${l}`),v.success(`Refreshed ${a}. ${l}`)},onError:o=>{c(`${a}: Its packages didn’t load: ${k(o.message)}`),v.warning(`Couldn’t refresh ${a}.`)}})},K=a=>{a||d.reset(),r(a)},Q=!n&&(!s||s.length===0);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Marketplace sources"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Git registries that publish marketplace packages."})]}),e.jsxs(x,{onClick:()=>r(!0),size:"sm",children:[e.jsx(R,{className:"mr-1.5 size-4"}),"Add marketplace source"]})]}),n&&e.jsx("div",{className:"space-y-3",children:[1,2].map(a=>e.jsx(P,{className:"h-20 rounded-xl border"},a))}),Q&&e.jsxs("div",{className:"rounded-xl border border-dashed p-10 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"No marketplaces added yet"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Add a source to browse its packages."}),e.jsxs(x,{className:"mt-4",size:"sm",onClick:()=>r(!0),children:[e.jsx(R,{className:"mr-1.5 size-4"}),"Add marketplace source"]})]}),s&&s.length>0&&e.jsx("div",{className:"space-y-3",children:s.map(a=>e.jsx(ne,{name:a.name,source:a.source,enabled:a.enabled,addedAt:a.addedAt,listing:ae(a),fetched:a.lastFetch===void 0||a.lastFetch.state!=="never",onRefresh:()=>E(a.name),isRefreshing:m(a.name),onRemove:()=>u.mutate(a.name),isRemoving:u.isPending},a.name))}),e.jsx("div",{"data-slot":"listing-announcer",role:"status","aria-live":"polite",className:"sr-only",children:e.jsx("span",{children:p.text},p.id)}),e.jsx(re,{open:h,onOpenChange:K,isPending:d.isPending,error:((w=d.error)==null?void 0:w.message)??null,onSubmit:j})]})}export{oe as M};
@@ -1 +0,0 @@
1
- import{Q as q,R as Q,r as l,eo as B,U as T,ad as K,j as s,ep as U,I as W,eq as Y,B as v,aU as z,aa as S,dX as H,er as X,es as V,a$ as J}from"./index-DMYBI16t.js";const P={SIGNIN_NO_APP_REGISTRATION:"This server doesn’t let DorkOS register itself. Add your own app credentials to try again.",SIGNIN_NO_SIGNIN_SUPPORT:"This server doesn’t offer sign-in the way DorkOS expects.",SIGNIN_UNREACHABLE:"Couldn’t reach the server to start the sign-in."};function Z(e){return e!==void 0&&e in P}function k(e){const{message:t,code:i,detail:c}=e;return Z(i)?{message:P[i],detail:c??t??null,canUseOwnCredentials:i==="SIGNIN_NO_APP_REGISTRATION"}:{message:t??"Sign-in didn’t finish. Try again.",detail:c??null,canUseOwnCredentials:!1}}function ee(e){if(typeof e!="object"||e===null)return{};const{code:t,body:i}=e,c=typeof i=="object"&&i!==null?i.detail:void 0;return{...typeof t=="string"?{code:t}:{},...typeof c=="string"?{detail:c}:{}}}const _=2e3,F=5,se="Couldn’t check the sign-in. Retrying.",te="Couldn’t check if the sign-in finished. Try again in a moment.",j={phase:"idle",disclosure:null,authorizeUrl:null,startFailure:null,credentialsError:null,flowId:null,watching:!1};function ne(e){const t=e==null?void 0:e.toolCount;return typeof t!="number"||!Number.isFinite(t)||t<0?null:t}function re(e,t){return(e==null?void 0:e.status)==="failed"?e.error??"Sign-in didn’t finish. Try again.":t>=F?te:null}function ie(e){return{...j,phase:"failed",startFailure:k({message:e.message,...ee(e)})}}function le(e){return e===null?null:k({message:e})}function O(e){return e.flowId===null?!1:e.phase==="waiting"||e.phase==="disclosure"&&e.watching}function ae(e,t,i){return O(e)?(t==null?void 0:t.status)==="connected"?"connected":(t==null?void 0:t.status)==="failed"?"failed":e.phase!=="waiting"?e.phase:i>=F?"failed":"waiting":e.phase}function he(e,t){const i=q(),c=Q(),[o,r]=l.useState(j),h=l.useRef(0),[x,C]=l.useState(0),g=l.useRef(null),d=l.useCallback(n=>{g.current=n,h.current=0,C(0)},[]),p=l.useCallback((n,u)=>{u===g.current&&(h.current=n==="ok"?0:h.current+1,C(h.current))},[]),f=l.useCallback(()=>{c.invalidateQueries({queryKey:B.mcpServers(e)}),c.invalidateQueries({queryKey:["mcp-config"]})},[c,e]),a=T({mutationFn:()=>i.startMcpSignin(e,t),meta:{suppressErrorToast:!0}}),b=l.useCallback(()=>{d(null),r({...j,phase:"starting"}),a.mutate(void 0,{onSuccess:n=>{if(!n.alreadyConnected&&!n.authorizeUrl){r({...j,phase:"failed",startFailure:k({message:"Couldn’t make a sign-in link for this server."})});return}d(n.flowId),r({phase:n.alreadyConnected?"connected":"disclosure",disclosure:n.disclosure,authorizeUrl:n.authorizeUrl??null,startFailure:null,credentialsError:null,flowId:n.flowId,watching:!1})},onError:n=>r(ie(n))})},[a,d]),I=T({mutationFn:n=>i.setMcpClientCredentials(e,t,n),meta:{suppressErrorToast:!0}}),A=l.useCallback(n=>{r(u=>u.credentialsError===null?u:{...u,credentialsError:null}),I.mutate(n,{onSuccess:()=>{f(),b()},onError:u=>r(N=>({...N,credentialsError:u.message}))})},[I,f,b]),M=l.useCallback(n=>{g.current!==n.flowId&&(f(),d(n.flowId),r({phase:"disclosure",disclosure:n.disclosure,authorizeUrl:n.authorizeUrl,startFailure:null,credentialsError:null,flowId:n.flowId,watching:!0}))},[d]),D=l.useCallback(()=>{r(n=>n.phase==="disclosure"?{...n,phase:"waiting"}:n)},[]),$=l.useCallback(()=>{d(null),r(j)},[d]),E=K({queryKey:["mcp-signin",e,t,o.flowId??""],queryFn:async()=>{const n=o.flowId??"";try{const u=await i.pollMcpSignin(n);return p("ok",n),u}catch(u){throw p("failed",n),u}},enabled:O(o),refetchInterval:n=>{var R;const u=(R=n.state.data)==null?void 0:R.status;if(u==="connected"||u==="failed")return!1;const N=h.current;return N===0?_:N>=F?!1:_*(N+1)},retry:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1,gcTime:0,staleTime:0,meta:{suppressErrorToast:!0}}),w=x,y=ae(o,E.data,w);l.useEffect(()=>{y==="connected"&&f()},[y,f]);const m=O(o)?le(re(E.data,w)):o.startFailure,G=y==="waiting"&&w>0?se:null;return{state:{step:y,disclosure:o.disclosure,authorizeUrl:o.authorizeUrl,error:(m==null?void 0:m.message)??null,errorDetail:(m==null?void 0:m.detail)??null,canUseOwnCredentials:(m==null?void 0:m.canUseOwnCredentials)??!1,savingCredentials:I.isPending,credentialsError:o.credentialsError,retryNotice:G,toolCount:y==="connected"?ne(E.data):null},start:b,adopt:M,authOpened:D,useOwnCredentials:A,reset:$}}function ce({onSave:e,onCancel:t,saving:i=!1,error:c=null,className:o}){const r=l.useId(),h=l.useRef(null),[x,C]=l.useState(""),[g,d]=l.useState(""),p=x.trim(),f=g.trim();return l.useEffect(()=>{var a;(a=h.current)==null||a.focus()},[]),s.jsxs("form",{className:S("space-y-2",o),onSubmit:a=>{a.preventDefault(),!(!p||i)&&e({clientId:p,...f?{clientSecret:f}:{}})},children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(U,{htmlFor:`${r}-client-id`,className:"text-xs",children:"Client ID"}),s.jsx(W,{id:`${r}-client-id`,ref:h,value:x,onChange:a=>C(a.target.value),autoComplete:"off",spellCheck:!1,disabled:i,className:"h-8 text-xs"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs(U,{htmlFor:`${r}-client-secret`,className:"text-xs",children:["Client secret ",s.jsx("span",{className:"text-muted-foreground font-normal",children:"(if you got one)"})]}),s.jsx(Y,{id:`${r}-client-secret`,value:g,onChange:a=>d(a.target.value),autoComplete:"off",disabled:i,className:"h-8 text-xs"})]}),s.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"From the service’s developer settings. Kept encrypted here; agents never see it."}),c&&s.jsx("p",{role:"alert",className:"text-destructive text-xs leading-relaxed",children:c}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(v,{type:"submit",size:"sm",disabled:!p||i,className:"gap-1.5 focus-visible:ring-2",children:[i&&s.jsx(z,{size:"xs"}),"Save and sign in"]}),s.jsx(v,{type:"button",variant:"ghost",size:"sm",onClick:t,disabled:i,className:"focus-visible:ring-2",children:"Cancel"})]})]})}function L({children:e}){return s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[s.jsx(z,{size:"xs"}),e]})}function oe(e){return e===null?"Signed in. Its tools are available on the next turn.":`Connected · ${e} tool${e===1?"":"s"}.`}function ue(e){return`DorkOS keeps the key from ${e} here, never your agent. Removing the server deletes it.`}function de(e){const{state:t}=e;return t.step==="starting"?s.jsx(L,{children:"Starting sign-in…"}):t.step==="waiting"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(L,{children:"Waiting for you to sign in… Close the tab when done."}),t.retryNotice&&s.jsx("p",{className:"text-muted-foreground text-xs",children:t.retryNotice})]}):t.step==="connected"?s.jsxs("p",{className:"text-status-success-fg flex items-center gap-2 text-xs",children:[s.jsx(J,{className:"size-3.5","aria-hidden":!0}),oe(t.toolCount)]}):null}function pe({flow:e,serverName:t,className:i,failedActions:c,connectedActions:o}){const{state:r}=e,h=l.useRef(null),x=r.step==="disclosure",C=l.useRef(null),[g,d]=l.useState(!1),p=g&&r.canUseOwnCredentials;l.useEffect(()=>{var a;x&&((a=h.current)==null||a.focus())},[x]);const f=l.useRef(!1);return l.useEffect(()=>{var a;!f.current||p||(f.current=!1,(a=C.current)==null||a.focus())},[p]),s.jsxs(s.Fragment,{children:[s.jsx("div",{role:"status",className:S("[&:not(:empty)]:mt-1",i),children:de(e)}),x&&s.jsxs("div",{className:S("mt-1 space-y-2",i),children:[s.jsxs("div",{ref:h,tabIndex:-1,className:"border-status-success-border bg-status-success-bg text-status-success-fg flex items-start gap-2 rounded-md border px-3 py-2 focus-visible:ring-2",children:[s.jsx(H,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("p",{className:"text-xs font-semibold",children:"Your sign-in stays on this computer."}),s.jsx("p",{className:"text-xs leading-relaxed",children:r.disclosure??ue(t)})]})]}),r.authorizeUrl&&s.jsx(v,{asChild:!0,size:"sm",className:"gap-1.5 focus-visible:ring-2",children:s.jsxs(X,{href:r.authorizeUrl,onOpened:()=>e.authOpened(),"aria-label":`Open the sign-in page for ${t}`,children:["Open the sign-in page",s.jsx(V,{className:"size-3.5","aria-hidden":!0})]})})]}),r.step==="failed"&&s.jsxs("div",{className:S("mt-1 space-y-2",i),children:[s.jsx("p",{role:"alert",className:"text-destructive text-xs leading-relaxed",children:r.error??"Sign-in didn’t finish. Try again."}),r.errorDetail&&s.jsxs("details",{className:"text-muted-foreground text-xs",children:[s.jsx("summary",{className:"cursor-pointer focus-visible:ring-2",children:"Details"}),s.jsx("code",{className:"text-2xs mt-1 block font-mono break-all",children:r.errorDetail})]}),p?s.jsx(ce,{onSave:a=>e.useOwnCredentials(a),onCancel:()=>{d(!1),f.current=!0},saving:r.savingCredentials,error:r.credentialsError}):s.jsxs("div",{className:"flex flex-wrap gap-2",children:[c,r.canUseOwnCredentials&&s.jsx(v,{ref:C,variant:"secondary",size:"sm",onClick:()=>d(!0),className:"focus-visible:ring-2",children:"Use your own app credentials"})]})]}),r.step==="connected"&&o&&s.jsx("div",{className:S("mt-1",i),children:o})]})}export{pe as M,he as u};
@@ -1 +0,0 @@
1
- import{j as o,o as r}from"./index-DMYBI16t.js";function a({member:e}){return o.jsx(r,{member:e})}export{a as NamePage};
@@ -1 +0,0 @@
1
- import{Q as R,R as b,U as j,eu as x,W as P,ev as C,r as d,j as e,cR as E,cS as k,cT as M,cU as T,cV as K,ew as L,ep as I,I as F,as as N,B as D,dl as O,dm as Q,ex as B,f as _,dn as q,dp as H,ey as U}from"./index-DMYBI16t.js";function w(s){return Promise.all([s.invalidateQueries({queryKey:x.lists()}),s.invalidateQueries({queryKey:x.details()}),s.invalidateQueries({queryKey:x.threads()})]).then(()=>{})}function S(s){return(s==null?void 0:s.code)==="SLUG_TAKEN"}function V({isInlineErrorVisible:s}){const n=R(),r=b();return j({mutationFn:({title:a,agentPaths:l})=>n.createRoom({kind:"channel",title:a,members:[],agentPaths:l}),onSuccess:()=>w(r),meta:{suppressErrorToast:!0},onError:a=>{S(a)&&s()||P.error("Couldn’t create that channel.",{description:a.message})}})}function $(){const s=R(),n=b();return j({mutationFn:({agentPaths:r,title:a})=>s.createRoom({kind:"dm",title:a,members:[],agentPaths:r}),onSettled:()=>w(n),meta:{errorLabel:"Couldn’t start that conversation"}})}const y=200;function X({open:s,onOpenChange:n,onCreated:r}){const a=C(),[l,m]=d.useState(""),h=d.useRef(null),c=d.useRef(null),u=d.useRef(!0);d.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]);const o=V({isInlineErrorVisible:()=>u.current}),g=S(o.error)?o.error.message:null,f=l.trim(),p=f.length>0&&f.length<=y,v=t=>{!p||o.isPending||o.mutate({title:f,agentPaths:t.map(i=>i.agentPath)},{onSuccess:i=>{n(!1),r(i)}})},A=t=>{var i;t.key==="Enter"&&(t.preventDefault(),p&&((i=c.current)==null||i.focus()))};return e.jsx(E,{open:s,onOpenChange:n,children:e.jsxs(k,{className:"sm:max-w-md",onOpenAutoFocus:t=>{var i;t.preventDefault(),(i=h.current)==null||i.focus()},children:[e.jsxs(M,{children:[e.jsx(T,{children:"New channel"}),e.jsx(K,{children:"Name it, then pick who’s in it."})]}),e.jsxs(L,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{htmlFor:"channel-name",children:"Channel name"}),e.jsx(F,{ref:h,id:"channel-name",value:l,maxLength:y,placeholder:"Backend",autoComplete:"off",onChange:t=>{m(t.target.value),o.error&&o.reset()},onKeyDown:A,"aria-invalid":g?!0:void 0,"aria-describedby":g?"channel-name-error":void 0}),g&&e.jsx("p",{id:"channel-name-error",role:"alert",className:"text-destructive text-xs",children:g})]}),e.jsxs("section",{"aria-label":"Agents in this channel",className:"space-y-2 border-t pt-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Who’s in it"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Agents read everything here and reply when @mentioned."}),e.jsx(N,{roster:a,onSubmit:v,submitLabel:t=>t.length===0?"Create channel":t.length===1?"Create channel with 1 agent":`Create channel with ${t.length} agents`,emptyRosterMessage:"You don’t have any agents yet. You can add them to the channel later.",allChosenMessage:"That’s every agent you have.",isSubmitting:o.isPending,submitDisabled:!p,inputRef:c})]}),e.jsx("div",{className:"flex justify-center border-t pt-3",children:e.jsx(D,{type:"button",variant:"ghost",size:"sm",disabled:!p||o.isPending,onClick:()=>v([]),children:"Create it without agents"})})]})]})})}const Y="One agent opens a session. Two or more start a group message.";function z(s){return s.length===1}function G(s){const n=s[0];return n!==void 0&&z(s)?`Open session with ${n.displayName}`:"Start group message"}function J({onStart:s,open:n,onOpenChange:r,hideTrigger:a=!1}){const l=C(),m=d.useRef(null),h=()=>{r(!1),U.getState().open()};return e.jsxs(O,{open:n,onOpenChange:r,modal:!0,fullHeight:!0,children:[e.jsx(Q,{asChild:!0,children:e.jsx(B,{...a?{"aria-hidden":!0,tabIndex:-1,className:"sr-only"}:{"aria-label":"New message"},children:e.jsx(_,{})})}),e.jsxs(q,{side:"right",align:"start",className:"flex w-64 flex-col p-2","aria-label":"New message",onOpenAutoFocus:c=>{var u;c.preventDefault(),(u=m.current)==null||u.focus()},children:[e.jsx(H,{children:"New message"}),e.jsx(N,{inputRef:m,roster:l,onSubmit:c=>{r(!1),s(c)},submitLabel:G,emptyRosterMessage:"You don’t have any agents yet.",emptyRosterAction:e.jsx(D,{type:"button",size:"sm",variant:"outline",onClick:h,children:"Create agent"}),allChosenMessage:"Everyone is already in this conversation."}),e.jsx("p",{className:"text-muted-foreground mt-2 shrink-0 px-2 text-xs",children:Y})]})]})}export{X as C,J as N,Y as O,z as a,G as o,$ as u};
@@ -1 +0,0 @@
1
- import{eX as j,eY as H,eZ as F,aD as x,r as p,bE as P,e_ as w,e$ as B,Q as D,ad as G,bt as Y,bn as K,f0 as M,br as q,f1 as z,f2 as W,f3 as Q,f4 as N,f5 as J,f6 as U,bJ as V,j as i,ep as A,I as R,f7 as L,B as I}from"./index-DMYBI16t.js";function X(e){return{name:e.displayName.trim()===""||e.displayName===j,handle:!e.handle}}function se(e){const r=X(e);return r.name||r.handle}function Z(e,r){var t,s,d;const a=(d=(s=(t=e.person)==null?void 0:t.email)==null?void 0:s.split("@")[0])==null?void 0:d.trim();if(!a)return"";const o=new Set([...H,...r.filter(l=>l.id!==e.id&&l.handle).map(l=>l.handle.toLowerCase())]);return F(a,o)??""}function re(){const e=x(a=>a.setRightPanelOpen),r=x(a=>a.setActiveRightPanelTab);p.useEffect(()=>{const a=o=>{if((o.metaKey||o.ctrlKey)&&o.shiftKey&&o.key==="A"){o.preventDefault();const{rightPanelOpen:t,activeRightPanelTab:s}=x.getState();t&&s===P?e(!1):(r(P),e(!0))}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,r])}const $="agent-hub",ee={sessions:"sessions",tasks:"tasks",tools:"tools",channels:"rooms",config:null,toolkit:null,identity:null,overview:null,profile:null,personality:null};function te(e){return(typeof e=="string"?ee[e]:null)??void 0}const k=new Set(["identity","personality","channels","tools"]);function oe(){var n;const e=w(),r=D(),a=G({queryKey:["profile-location",e.profileRef],queryFn:()=>r.getSessionLocation(e.profileRef),enabled:!!e.profileRef}),o=Y(g=>g.openProfileDockedFromLink),t=x(g=>g.requestRightPanel),s=x(g=>g.setExplicitAgentPath),d=K(),l=e.panel===P,c=e.agentPath??((n=a.data)==null?void 0:n.cwd)??null,u=M(e.profilePage)??void 0,h=p.useRef(null);p.useEffect(()=>{!l&&c&&h.current!==c&&(h.current=c,s(c))},[l,c,s]);const f=p.useRef(new Map);p.useEffect(()=>{if(!l){f.current.clear();return}if(e.profileRef&&!c)return;const g=c??d;if(g){const m=f.current.get(g);if(m!==void 0&&(u===void 0||m.has(u)))return;f.current.set(g,(m??new Set).add(u??"")),o(g,u);return}t(P,null)},[l,e.profileRef,c,d,u,o,t])}function le(){const e=w(),r=B(),a=D(),o=e.panel===$,t=e.dialog==="agent"||!!e.agent&&k.has(e.agent),s=o||t,d=o?e.hubTab:e.agent;p.useEffect(()=>{if(!s&&!e.agentPath||!r)return;let l=!1;return(async()=>{const u=e.profileRef??(e.agentPath?(await a.createSessionLocation(e.agentPath)).id:void 0);if(l)return;const h=te(d);r({search:f=>{const n={...f};return e.dialog==="agent"&&delete n.dialog,typeof n.agent=="string"&&k.has(n.agent)&&delete n.agent,u&&(n.profileRef=u,delete n.agentPath),s&&(delete n.hubTab,n.panel=P,h?n.profilePage=h:delete n.profilePage),n},replace:!0})})().catch(()=>{}),()=>{l=!0}},[s,e.dialog,e.agentPath,e.profileRef,d,r,a])}function ae(){var b,S;const r=((b=q().data)==null?void 0:b.members)??[],a=r.find(y=>y.isSelf),o=z(),t=W({isShownInline:()=>o.current}),s=Q({isShownInline:()=>o.current}),[d,l]=p.useState(!1),c=!a||a.displayName===j?"":a.displayName,u=(a==null?void 0:a.handle)??"",[h,f]=N(c),[n,g]=N(a?u||Z(a,r):""),m=h.trim(),v=n.trim(),E=a?J(a):null,T=m.length>0&&(m!==c||E!==null),_=t.isError&&t.variables===m?U(t.error):null,C=s.isError&&((S=s.variables)==null?void 0:S.handle)===v?V(s.error,v):null,O=async()=>{if(!a)return!1;l(!0);let y=!0;return T&&(y=await t.mutateAsync(m).then(()=>y,()=>!1)),v&&v!==u&&(y=await s.mutateAsync({authorId:a.id,handle:v}).then(()=>y,()=>!1)),l(!1),y};return{ready:a!==void 0,name:h,setName:f,handle:n,setHandle:g,canSave:a!==void 0&&!d&&(m.length>0||v.length>0),saving:d,nameError:_,nameSuggestion:E!==null&&m===c?E:null,handleError:C,save:O}}function ie({onSaved:e,confirmLabel:r="Save",onSkip:a,skipLabel:o="Skip"}){const t=ae(),s=p.useId(),d=p.useId(),l=p.useId(),c=f=>{f.preventDefault(),t.canSave&&t.save().then(n=>{n&&e()})},u=t.nameError!==null||t.handleError!==null;let h=r;return t.saving?h="Saving…":u&&(h="Try again"),i.jsxs("form",{onSubmit:c,className:"flex flex-col gap-3","data-testid":"operator-identity-form",children:[i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(A,{htmlFor:s,className:"text-xs",children:"Your name"}),i.jsx(R,{id:s,value:t.name,maxLength:80,autoComplete:"name",placeholder:"What you go by",disabled:!t.ready,onChange:f=>t.setName(f.target.value),className:"h-8 text-sm"}),t.nameSuggestion&&!t.nameError&&i.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.nameSuggestion,". Save it to make it yours."]}),t.nameError&&i.jsx(L,{tone:"error",children:t.nameError})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(A,{htmlFor:d,className:"text-xs",children:"Handle"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-sm",children:"@"}),i.jsx(R,{id:d,value:t.handle,maxLength:64,autoComplete:"username",autoCapitalize:"none",spellCheck:!1,placeholder:"yourname","aria-describedby":l,disabled:!t.ready,onChange:f=>t.setHandle(f.target.value),className:"h-8 pl-6 text-sm"})]}),i.jsx("p",{id:l,className:"text-muted-foreground text-xs",children:"What others type after @ to reach you."}),t.handleError&&i.jsx(L,{tone:"error",children:t.handleError})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx(I,{type:"submit",size:"sm",disabled:!t.canSave,"data-testid":"confirm-identity",children:h}),a&&i.jsx(I,{type:"button",size:"sm",variant:"ghost",onClick:a,disabled:t.saving,"data-testid":"skip-identity",children:o})]})]})}export{ie as O,oe as a,re as b,se as i,le as u};
@@ -1 +0,0 @@
1
- import{j as t,s as r}from"./index-DMYBI16t.js";function s({member:o}){return t.jsx(r,{member:o})}export{s as PhotoPage};
@@ -1 +0,0 @@
1
- import{r as b,j as n,b1 as S,b4 as p,b5 as _,eP as k,b9 as E,ca as I,eQ as R,eR as N,eS as A,b2 as T,ba as h,eT as M,eU as $,eV as D,eW as O,Q as F,ad as V,ae as G}from"./index-DMYBI16t.js";import{S as L}from"./shield-x-DxOGc0dW.js";var K=Object.defineProperty,g=(e,t)=>K(e,"name",{value:t,configurable:!0}),x="Tabs",[U,oe]=_(x,[k]),P=k(),[q,y]=U(x),H=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,onValueChange:o,defaultValue:d,orientation:i="horizontal",dir:l,activationMode:v="automatic",...m}=t,u=E(l),[c,f]=I({prop:s,onChange:o,defaultProp:d??"",caller:x});return n.jsx(q,{scope:r,baseId:R(),value:c,onValueChange:f,orientation:i,dir:u,activationMode:v,children:n.jsx(p.div,{dir:u,"data-orientation":i,...m,ref:a})})},"Tabs")),Q="TabsList",z=b.forwardRef(g(function(t,a){const{__scopeTabs:r,loop:s=!0,...o}=t,d=y(Q,r),i=P(r);return n.jsx(N,{asChild:!0,...i,orientation:d.orientation,dir:d.dir,loop:s,children:n.jsx(p.div,{role:"tablist","aria-orientation":d.orientation,...o,ref:a})})},"TabsList")),B="TabsTrigger",W=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,disabled:o=!1,...d}=t,i=y(B,r),l=P(r),v=w(i.baseId,s),m=j(i.baseId,s),u=s===i.value;return n.jsx(A,{asChild:!0,...l,focusable:!o,active:u,children:n.jsx(p.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":m,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:v,...d,ref:a,onMouseDown:T(t.onMouseDown,c=>{!o&&c.button===0&&c.ctrlKey===!1?i.onValueChange(s):c.preventDefault()}),onKeyDown:T(t.onKeyDown,c=>{o||c.target!==c.currentTarget||[" ","Enter"].includes(c.key)&&i.onValueChange(s)}),onFocus:T(t.onFocus,()=>{const c=i.activationMode!=="manual";!u&&!o&&c&&i.onValueChange(s)})})})},"TabsTrigger")),X="TabsContent",J=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,forceMount:o,children:d,...i}=t,l=y(X,r),v=w(l.baseId,s),m=j(l.baseId,s),u=s===l.value,c=b.useRef(u);return b.useEffect(()=>{const f=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(f)},[]),n.jsx(S,{present:o||u,children:({present:f})=>n.jsx(p.div,{"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":v,hidden:!f,id:m,tabIndex:0,...i,ref:a,style:{...t.style,animationDuration:c.current?"0s":void 0},children:f&&d})})},"TabsContent"));function w(e,t){return`${e}-trigger-${t}`}g(w,"makeTriggerId");function j(e,t){return`${e}-content-${t}`}g(j,"makeContentId");var Y=H,Z=z,ee=W,te=J;function ie({...e}){return n.jsx(Y,{"data-slot":"tabs",...e})}function ce({className:e,responsive:t=!0,...a}){return n.jsx(Z,{"data-slot":"tabs-list",className:h("bg-dui-muted text-dui-muted-foreground inline-flex items-center justify-center rounded-lg p-1",t?M:"h-9",e),...a})}function ue({className:e,...t}){return n.jsx(ee,{"data-slot":"tabs-trigger",className:h("ring-offset-dui-background inline-flex items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-[color,background-color,box-shadow,opacity] motion-reduce:transition-none! md:py-1","focus-visible:ring-dui-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-dui-background data-[state=active]:text-dui-foreground data-[state=active]:shadow",e),...t})}function de({className:e,...t}){return n.jsx(te,{"data-slot":"tabs-content",className:h("ring-offset-dui-background mt-2","data-[state=active]:animate-in data-[state=active]:fade-in-0 data-[state=active]:duration-150 motion-reduce:animate-none!","focus-visible:ring-dui-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",e),...t})}const ae={default:!1,plan:!1,acceptEdits:!1,dontAsk:!0,bypassPermissions:!0,auto:!0};function le(e){return ae[e]??!1}function se(e){try{return O.toString(e)}catch{return`On the schedule ${e}`}}function fe(e){const t=e.cron?se(e.cron):"Runs only when you ask",a=$(e.startsEnabled);return`${t}, ${a}. This job ${D(e.permissionMode)}.`}function be(e,t){const a=F(),{enabled:r=!0,...s}=t??{},o=Object.keys(s).length>0;return V({queryKey:G.permissionPreview(e??"",o?s:void 0),queryFn:()=>a.previewMarketplacePackage(e,o?s:void 0),enabled:r&&e!==null,staleTime:3e4,networkMode:"always"})}function C(e){const t=e==null?void 0:e.body,a=Array.isArray(t==null?void 0:t.errors)?t.errors.filter(r=>typeof r=="string"):[];return a.length>0?{reasons:a,checked:!0}:{reasons:e instanceof Error&&e.message?[e.message]:[],checked:!1}}function ge(e){return C(e).checked}function ve({error:e}){const{reasons:t,checked:a}=C(e);return n.jsxs("div",{role:"alert",className:"border-destructive/40 bg-destructive/5 space-y-2 rounded-md border p-3 text-sm",children:[n.jsxs("p",{className:"text-destructive flex items-center gap-2 font-medium",children:[n.jsx(L,{className:"size-4 shrink-0","aria-hidden":!0}),"DorkOS won’t install this package"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:a?"What it found:":"It couldn’t check what this package does."}),t.length>0&&n.jsx("ul",{className:"text-muted-foreground list-disc space-y-1 pl-5 text-xs [overflow-wrap:anywhere]",children:t.map(r=>n.jsx("li",{children:r},r))})]})}export{ve as P,ie as T,ce as a,ue as b,de as c,fe as d,ge as i,le as r,be as u};