openmausbot 0.1.98 → 0.1.100

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 (397) hide show
  1. package/dist/assets/{ActivityPanel-H6D3SD39.js → ActivityPanel-CA9zfl3_.js} +1 -1
  2. package/dist/assets/BotSettingsDialog-3i_izROu.js +7 -0
  3. package/dist/assets/{CloudBackendPicker-iezpJFpF.js → CloudBackendPicker-BR42-xBg.js} +1 -1
  4. package/dist/assets/{ComputerPanel-DZPj-IWu.js → ComputerPanel-CvThnFmt.js} +1 -1
  5. package/dist/assets/{DesktopViewer-utONms1p.js → DesktopViewer-CqovWUic.js} +1 -1
  6. package/dist/assets/InspectorPanel-Cbjm86gt.js +5 -0
  7. package/dist/assets/{KeyboardShortcutsModal-gk9mvHj_.js → KeyboardShortcutsModal-X13pVrkh.js} +1 -1
  8. package/dist/assets/{LocalVmWorkspace-DLIvd2kC.js → LocalVmWorkspace-BGD3Tvd3.js} +1 -1
  9. package/dist/assets/{MacLocalControl-bJv8yiPB.js → MacLocalControl-ExdXHVUv.js} +1 -1
  10. package/dist/assets/NewBotDialog-ftDBMjWR.js +2 -0
  11. package/dist/assets/RemoteAgentSettingsPanel-BUHLV_vC.js +1 -0
  12. package/dist/assets/RoutinesPage-Buk5-r3o.js +1 -0
  13. package/dist/assets/{RoutinesSection-Dny9ra-c.js → RoutinesSection-NyReOXr8.js} +1 -1
  14. package/dist/assets/{SettingsModal-gC6XJJmt.js → SettingsModal-DkkhdxKM.js} +3 -3
  15. package/dist/assets/{TeamMapPage-B6fuu4r_.js → TeamMapPage-BIxeHoy3.js} +1 -1
  16. package/dist/assets/{TriggersPanel-j0qTP2CO.js → TriggersPanel-m5iqc43H.js} +1 -1
  17. package/dist/assets/{VisibilitySection-DT0FqPvu.js → VisibilitySection-y8Adk-c4.js} +1 -1
  18. package/dist/assets/WebhooksPanel-G_NWjHOP.js +3 -0
  19. package/dist/assets/{abnfDiagram-O67JEVCF-BsjcFX0-.js → abnfDiagram-O67JEVCF-D56ZgyPf.js} +1 -1
  20. package/dist/assets/{activity-BxOkayvD.js → activity-D_puBfZo.js} +1 -1
  21. package/dist/assets/{arc-CJNA94c6.js → arc-DzduGHbq.js} +1 -1
  22. package/dist/assets/{architectureDiagram-NJMV4G6O-dz2ud7lP.js → architectureDiagram-NJMV4G6O-C4NS6DQF.js} +1 -1
  23. package/dist/assets/{blockDiagram-BEXU5L5S-ChBEALoR.js → blockDiagram-BEXU5L5S-BNvsskiE.js} +1 -1
  24. package/dist/assets/{brain-CFZ7PEXc.js → brain-oq48IgWl.js} +1 -1
  25. package/dist/assets/{c4Diagram-YGBWAQC7-KZNRKDQe.js → c4Diagram-YGBWAQC7-ch3B7xZy.js} +1 -1
  26. package/dist/assets/channel-CmFDMHrN.js +1 -0
  27. package/dist/assets/{chunk-2Q5K7J3B-BLLwmCET.js → chunk-2Q5K7J3B-D9dL9ZS7.js} +1 -1
  28. package/dist/assets/{chunk-3FUC2YCW-CQxyreBZ.js → chunk-3FUC2YCW-DmLUUuNr.js} +2 -2
  29. package/dist/assets/{chunk-5VM5RSS4-D6sFMW0u.js → chunk-5VM5RSS4-B90ODeo2.js} +1 -1
  30. package/dist/assets/{chunk-GTNCS2PH-BaZ1YgLF.js → chunk-GTNCS2PH-BtlGIG3W.js} +1 -1
  31. package/dist/assets/{chunk-GWA4HPMP-CcalphmC.js → chunk-GWA4HPMP-CurBwFFG.js} +1 -1
  32. package/dist/assets/{chunk-JWPE2WC7-CSk8R3ve.js → chunk-JWPE2WC7-DTjNNXcd.js} +1 -1
  33. package/dist/assets/{chunk-NETBCI7D-CTmLjA57.js → chunk-NETBCI7D-xS7hOqBJ.js} +1 -1
  34. package/dist/assets/{chunk-WEXAMYUT-CM9Z77Ne.js → chunk-WEXAMYUT-DJZBSyA9.js} +1 -1
  35. package/dist/assets/{chunk-XXDRQBXY-B1fxpMS2.js → chunk-XXDRQBXY-CbiNRzjt.js} +1 -1
  36. package/dist/assets/{classDiagram-v2-NBCMYWYE-DCCyoLpj.js → classDiagram-v2-NBCMYWYE-DyON9tUb.js} +1 -1
  37. package/dist/assets/core-CRkAXD3N.js +12 -0
  38. package/dist/assets/{cose-bilkent-JH36ORCC-KyImBKvE.js → cose-bilkent-JH36ORCC-C7UwNnp8.js} +1 -1
  39. package/dist/assets/cpp-DddhVWhK.js +1 -0
  40. package/dist/assets/{cynefin-OW5HDTMX-fsZc6MGa.js → cynefin-OW5HDTMX-Dv1GTekc.js} +1 -1
  41. package/dist/assets/{cynefinDiagram-VND7K2PF-CGmHsShB.js → cynefinDiagram-VND7K2PF-CKgpyZxo.js} +1 -1
  42. package/dist/assets/{dagre-6A5THRUB-Dah1h-CH.js → dagre-6A5THRUB-BY3cYc8R.js} +1 -1
  43. package/dist/assets/{diagram-22UHCM2B-BIu71OyV.js → diagram-22UHCM2B-D71jBFCO.js} +1 -1
  44. package/dist/assets/{diagram-3UASUU5V-gxhUB_Mu.js → diagram-3UASUU5V-Bc3i6JGD.js} +1 -1
  45. package/dist/assets/{diagram-ATOU4E4O-CBhusUBn.js → diagram-ATOU4E4O-BPDSHISG.js} +1 -1
  46. package/dist/assets/{diagram-CDSNMT55-BdPrc86x.js → diagram-CDSNMT55-xuCT1v32.js} +1 -1
  47. package/dist/assets/{diagram-MLGK6HIB-Clp110R_.js → diagram-MLGK6HIB-LEDTXDPg.js} +1 -1
  48. package/dist/assets/{diagram-MPIPVDR6-DJKfbugw.js → diagram-MPIPVDR6-B0kfscRD.js} +1 -1
  49. package/dist/assets/{ebnfDiagram-ZINNZB2B-DnsltoBu.js → ebnfDiagram-ZINNZB2B-B-Z0HLzJ.js} +1 -1
  50. package/dist/assets/{elk-276RUBZZ-jWdq6gqH.js → elk-276RUBZZ-Bzypn7lU.js} +1 -1
  51. package/dist/assets/engine-javascript-D5Xfc425.js +141 -0
  52. package/dist/assets/{erDiagram-OPXOYQCR-DArPVf8u.js → erDiagram-OPXOYQCR-vl1xKmbS.js} +1 -1
  53. package/dist/assets/{flowDiagram-KWPJA3E3-D2HZ-2f7.js → flowDiagram-KWPJA3E3-DQXCXm7z.js} +1 -1
  54. package/dist/assets/{ganttDiagram-FUAMR5RP--o0KIxEo.js → ganttDiagram-FUAMR5RP-B0wwnP2j.js} +1 -1
  55. package/dist/assets/{gitGraphDiagram-X574FWY7-CsoXr2D7.js → gitGraphDiagram-X574FWY7-HfEVZRuR.js} +1 -1
  56. package/dist/assets/{image-plus-BbVjGHin.js → image-plus-D9o3v9bi.js} +1 -1
  57. package/dist/assets/{index-C3NqfdVU.js → index-CyM91z0J.js} +205 -205
  58. package/dist/assets/{index-BrPW5HDO.css → index-DbN_Hfjs.css} +1 -1
  59. package/dist/assets/{infoDiagram-VRGFBTTK-g-6lNp7r.js → infoDiagram-VRGFBTTK-BcCklxlu.js} +1 -1
  60. package/dist/assets/{ishikawaDiagram-OU5B5YK6-B1d6qVTV.js → ishikawaDiagram-OU5B5YK6-Bw7Fp8yZ.js} +1 -1
  61. package/dist/assets/{journeyDiagram-ZHPQQLJL-BTPuiU6T.js → journeyDiagram-ZHPQQLJL-BqFaTPiB.js} +1 -1
  62. package/dist/assets/{kanban-definition-PNTS6WVX-bDDuRJvP.js → kanban-definition-PNTS6WVX-BdGyimUh.js} +1 -1
  63. package/dist/assets/{linear-BVVKbEMy.js → linear-DezKjgv7.js} +1 -1
  64. package/dist/assets/{mermaid.core-JJdoKyKB.js → mermaid.core-97L7xtx0.js} +5 -5
  65. package/dist/assets/{mindmap-definition-NLK3R4M7-B4aE3T0q.js → mindmap-definition-NLK3R4M7-DP6qz87C.js} +1 -1
  66. package/dist/assets/{page-visible-BBo_Zm8g.js → page-visible-BehtKJDm.js} +1 -1
  67. package/dist/assets/{pegDiagram-GJSIUBJH-DFKQWpR7.js → pegDiagram-GJSIUBJH-CsYSloVz.js} +1 -1
  68. package/dist/assets/{pieDiagram-5QR66LMP-Iv7OKVJi.js → pieDiagram-5QR66LMP-CFI2Dcix.js} +1 -1
  69. package/dist/assets/{quadrantDiagram-O4NWA36T-U2YnfwBk.js → quadrantDiagram-O4NWA36T-DqTdAE5z.js} +1 -1
  70. package/dist/assets/{railroadDiagram-XR7U4H2S-CuPy6RqM.js → railroadDiagram-XR7U4H2S-t_rszRIF.js} +1 -1
  71. package/dist/assets/{remote-desktop-panel-BNEj7tUx.js → remote-desktop-panel-WTaz_HI9.js} +1 -1
  72. package/dist/assets/{requirementDiagram-PLB6GJNP-bMI5AK7T.js → requirementDiagram-PLB6GJNP-1MU-l7p8.js} +1 -1
  73. package/dist/assets/ruby-Ct1eTYOr.js +1 -0
  74. package/dist/assets/{sankeyDiagram-IPEJSGJF-BKcFE2WQ.js → sankeyDiagram-IPEJSGJF-CtkrwAvo.js} +1 -1
  75. package/dist/assets/{sequenceDiagram-PO4LG4MO-Bn9q88kl.js → sequenceDiagram-PO4LG4MO-CJOwBubv.js} +1 -1
  76. package/dist/assets/{sizeCapture-INFHLROL-Cvmdq9HD.js → sizeCapture-INFHLROL-DhQVhKCc.js} +1 -1
  77. package/dist/assets/{stateDiagram-v2-GCMORJYK-JJQYw3eQ.js → stateDiagram-v2-GCMORJYK-CaQK9yA9.js} +1 -1
  78. package/dist/assets/{swimlanes-2SLR337P-BkSCBEwp.js → swimlanes-2SLR337P-Ct8cqf01.js} +1 -1
  79. package/dist/assets/swimlanesDiagram-TC7HE7FX-BBUcFKOA.js +8 -0
  80. package/dist/assets/{timeline-definition-EJHVYXUP-DsaM4GHr.js → timeline-definition-EJHVYXUP-qim2Km3q.js} +1 -1
  81. package/dist/assets/{usecaseDiagram-POWQR4AR-3FOwLq7B.js → usecaseDiagram-POWQR4AR-BIzcxmgX.js} +1 -1
  82. package/dist/assets/{user-DcZBnAuv.js → user-EQ8rI0f4.js} +1 -1
  83. package/dist/assets/{vennDiagram-UO4OBE2U-DyNjJsKt.js → vennDiagram-UO4OBE2U-BFEuz8Ba.js} +1 -1
  84. package/dist/assets/{wardleyDiagram-VNRHLVJA-Y4ZMcnBC.js → wardleyDiagram-VNRHLVJA-JRkAN01c.js} +1 -1
  85. package/dist/assets/{xychartDiagram-PMCCYNJV-BXZpg955.js → xychartDiagram-PMCCYNJV-WBsvmu0R.js} +1 -1
  86. package/dist/index.html +2 -2
  87. package/dist-server/drivers/agents-proxy.js +10 -9
  88. package/dist-server/index.js +1483 -813
  89. package/dist-server/openmausbot.js +248 -152
  90. package/dist-server/pair-cli.js +248 -152
  91. package/dist-server/server/activity.js +2 -0
  92. package/dist-server/server/checkpoints.js +55 -39
  93. package/dist-server/server/direct-apply.js +20 -0
  94. package/dist-server/server/drivers/agents-call.js +1 -1
  95. package/dist-server/server/drivers/agents-catalog.js +11 -8
  96. package/dist-server/server/drivers/codex.js +147 -24
  97. package/dist-server/server/drivers/device-auth.js +5 -4
  98. package/dist-server/server/drivers/openai-chat.js +5 -4
  99. package/dist-server/server/harness/registry.js +63 -45
  100. package/dist-server/server/index.js +203 -23
  101. package/dist-server/server/mcp-oauth.js +125 -47
  102. package/dist-server/server/mcp-probe.js +18 -10
  103. package/dist-server/server/message-file.js +95 -3
  104. package/dist-server/server/model-requests.js +55 -4
  105. package/dist-server/server/profile-requests.js +80 -4
  106. package/dist-server/server/request-auth.js +1 -0
  107. package/dist-server/server/routes/undo.js +17 -0
  108. package/dist-server/server/routine-requests.js +210 -6
  109. package/dist-server/server/setup-mode.js +1 -1
  110. package/dist-server/server/skill-learn.js +2 -2
  111. package/dist-server/server/skills.js +30 -0
  112. package/dist-server/server/system-prompt.js +1 -1
  113. package/dist-server/server/turn-continuation.js +13 -18
  114. package/dist-server/server/workspace-backup.js +6 -1
  115. package/dist-server/workspace-backup.worker.js +1 -1
  116. package/package.json +1 -1
  117. package/skills/create-verification-skill/SKILL.md +9 -8
  118. package/skills/create-verification-skill/manifest.json +1 -1
  119. package/dist/assets/BotSettingsDialog-Dqz_AiBZ.js +0 -7
  120. package/dist/assets/InspectorPanel-OVaBVrzC.js +0 -5
  121. package/dist/assets/NewBotDialog-1qGOAdUM.js +0 -2
  122. package/dist/assets/RemoteAgentSettingsPanel-DqKr0HkO.js +0 -1
  123. package/dist/assets/RoutinesPage-BM2D4qGi.js +0 -1
  124. package/dist/assets/WebhooksPanel--YQyCjKO.js +0 -3
  125. package/dist/assets/abap-BdImnpbu.js +0 -1
  126. package/dist/assets/actionscript-3-B3316cI-.js +0 -1
  127. package/dist/assets/ada-bCR0ucgS.js +0 -1
  128. package/dist/assets/ahk-CsyLZFj1.js +0 -1
  129. package/dist/assets/ahk2-8Zs4aa1G.js +0 -1
  130. package/dist/assets/andromeeda-C4gqWexZ.js +0 -1
  131. package/dist/assets/angular-html-DA-rfuFy.js +0 -1
  132. package/dist/assets/angular-ts-BrjP3tb8.js +0 -1
  133. package/dist/assets/apache-Pmp26Uib.js +0 -1
  134. package/dist/assets/apex-DhZFqWV2.js +0 -1
  135. package/dist/assets/apl-CORt7UWP.js +0 -1
  136. package/dist/assets/applescript-Co6uUVPk.js +0 -1
  137. package/dist/assets/ara-BRHolxvo.js +0 -1
  138. package/dist/assets/asciidoc-CSVQ5wI8.js +0 -1
  139. package/dist/assets/asm-D_Q5rh1f.js +0 -1
  140. package/dist/assets/astro-HNnZUWAn.js +0 -1
  141. package/dist/assets/aurora-x-D-2ljcwZ.js +0 -1
  142. package/dist/assets/awk-DMzUqQB5.js +0 -1
  143. package/dist/assets/ayu-dark-DYE7WIF3.js +0 -1
  144. package/dist/assets/ayu-light-BA47KaF1.js +0 -1
  145. package/dist/assets/ayu-mirage-32ctXXKs.js +0 -1
  146. package/dist/assets/ballerina-BFfxhgS-.js +0 -1
  147. package/dist/assets/bat-CickPsom.js +0 -1
  148. package/dist/assets/beancount-k_qm7-4y.js +0 -1
  149. package/dist/assets/berry-uYugtg8r.js +0 -1
  150. package/dist/assets/bibtex-CHM0blh-.js +0 -1
  151. package/dist/assets/bicep-Bmn6On1c.js +0 -1
  152. package/dist/assets/bird2-Bx8U0n9b.js +0 -1
  153. package/dist/assets/blade-2xfisSek.js +0 -1
  154. package/dist/assets/bsl-DlhNcFeZ.js +0 -1
  155. package/dist/assets/c3-Dp5svz6Z.js +0 -1
  156. package/dist/assets/cadence-Bv_4Rxtq.js +0 -1
  157. package/dist/assets/cairo-KRGpt6FW.js +0 -1
  158. package/dist/assets/catppuccin-frappe-CZL1YF0i.js +0 -1
  159. package/dist/assets/catppuccin-latte-DH-8KZSZ.js +0 -1
  160. package/dist/assets/catppuccin-macchiato-B7yYVSCf.js +0 -1
  161. package/dist/assets/catppuccin-mocha-Ct7hS0mc.js +0 -1
  162. package/dist/assets/channel-WhFyujhZ.js +0 -1
  163. package/dist/assets/chapel-DTp_pixX.js +0 -1
  164. package/dist/assets/clarity-Dn5IMItf.js +0 -1
  165. package/dist/assets/clojure-P80f7IUj.js +0 -1
  166. package/dist/assets/cmake-D1j8_8rp.js +0 -1
  167. package/dist/assets/cobol-nBiQ_Alo.js +0 -1
  168. package/dist/assets/codeowners-Bp6g37R7.js +0 -1
  169. package/dist/assets/codeql-DsOJ9woJ.js +0 -1
  170. package/dist/assets/coffee-Ch7k5sss.js +0 -1
  171. package/dist/assets/common-lisp-Cg-RD9OK.js +0 -1
  172. package/dist/assets/coq-C7JzOVbR.js +0 -1
  173. package/dist/assets/cpp-BMRokrvK.js +0 -1
  174. package/dist/assets/crystal-DGywbUpC.js +0 -1
  175. package/dist/assets/csv-fuZLfV_i.js +0 -1
  176. package/dist/assets/cue-D82EKSYY.js +0 -1
  177. package/dist/assets/cypher-COkxafJQ.js +0 -1
  178. package/dist/assets/d-85-TOEBH.js +0 -1
  179. package/dist/assets/dark-plus-C3mMm8J8.js +0 -1
  180. package/dist/assets/dax-CEL-wOlO.js +0 -1
  181. package/dist/assets/desktop-BmXAJ9_W.js +0 -1
  182. package/dist/assets/dotenv-Da5cRb03.js +0 -1
  183. package/dist/assets/dracula-BzJJZx-M.js +0 -1
  184. package/dist/assets/dracula-soft-BXkSAIEj.js +0 -1
  185. package/dist/assets/dream-maker-BtqSS_iP.js +0 -1
  186. package/dist/assets/edge-FbVlp4U3.js +0 -1
  187. package/dist/assets/elixir-CkH2-t6x.js +0 -1
  188. package/dist/assets/elm-DbKCFpqz.js +0 -1
  189. package/dist/assets/emacs-lisp-C_m_b--Z.js +0 -1
  190. package/dist/assets/erb-DXfck5VN.js +0 -1
  191. package/dist/assets/erlang-DsQrWhSR.js +0 -1
  192. package/dist/assets/everforest-dark-BgDCqdQA.js +0 -1
  193. package/dist/assets/everforest-light-C8M2exoo.js +0 -1
  194. package/dist/assets/fennel-BYunw83y.js +0 -1
  195. package/dist/assets/fluent-C4IJs8-o.js +0 -1
  196. package/dist/assets/fortran-fixed-form-CkoXwp7k.js +0 -1
  197. package/dist/assets/fortran-free-form-BxgE0vQu.js +0 -1
  198. package/dist/assets/fsharp-CXgrBDvD.js +0 -1
  199. package/dist/assets/gdresource-TyuKm33G.js +0 -1
  200. package/dist/assets/gdscript-DqcFQ5yU.js +0 -1
  201. package/dist/assets/gdshader-DkwncUOv.js +0 -1
  202. package/dist/assets/genie-D0YGMca9.js +0 -1
  203. package/dist/assets/gherkin-DyxjwDmM.js +0 -1
  204. package/dist/assets/git-commit-F4YmCXRG.js +0 -1
  205. package/dist/assets/git-rebase-r7XF79zn.js +0 -1
  206. package/dist/assets/github-dark-DHJKELXO.js +0 -1
  207. package/dist/assets/github-dark-dimmed-DH5Ifo-i.js +0 -1
  208. package/dist/assets/github-dark-high-contrast-E3gJ1_iC.js +0 -1
  209. package/dist/assets/github-light-DAi9KRSo.js +0 -1
  210. package/dist/assets/github-light-high-contrast-BfjtVDDH.js +0 -1
  211. package/dist/assets/gleam-BspZqrRM.js +0 -1
  212. package/dist/assets/glimmer-js-ByusRIyA.js +0 -1
  213. package/dist/assets/glimmer-ts-BfAWNZQY.js +0 -1
  214. package/dist/assets/glsl-DplSGwfg.js +0 -1
  215. package/dist/assets/gn-n2N0HUVH.js +0 -1
  216. package/dist/assets/gnuplot-DdkO51Og.js +0 -1
  217. package/dist/assets/groovy-gcz8RCvz.js +0 -1
  218. package/dist/assets/gruvbox-dark-hard-CFHQjOhq.js +0 -1
  219. package/dist/assets/gruvbox-dark-medium-GsRaNv29.js +0 -1
  220. package/dist/assets/gruvbox-dark-soft-CVdnzihN.js +0 -1
  221. package/dist/assets/gruvbox-light-hard-CH1njM8p.js +0 -1
  222. package/dist/assets/gruvbox-light-medium-DRw_LuNl.js +0 -1
  223. package/dist/assets/gruvbox-light-soft-hJgmCMqR.js +0 -1
  224. package/dist/assets/hack-BWmVpMyf.js +0 -1
  225. package/dist/assets/haml-D5jkg6IW.js +0 -1
  226. package/dist/assets/handlebars-BpdQsYii.js +0 -1
  227. package/dist/assets/haskell-Df6bDoY_.js +0 -1
  228. package/dist/assets/haxe-CfZj7gIn.js +0 -1
  229. package/dist/assets/hcl-BWvSN4gD.js +0 -1
  230. package/dist/assets/hjson-D5-asLiD.js +0 -1
  231. package/dist/assets/hlsl-D3lLCCz7.js +0 -1
  232. package/dist/assets/horizon-BUw7H-hv.js +0 -1
  233. package/dist/assets/horizon-bright-CUuTKBJd.js +0 -1
  234. package/dist/assets/houston-DnULxvSX.js +0 -1
  235. package/dist/assets/html-derivative-DlHx6ybY.js +0 -1
  236. package/dist/assets/http-jrhK8wxY.js +0 -1
  237. package/dist/assets/hurl-irOxFIW8.js +0 -1
  238. package/dist/assets/hxml-2-FPmUDs.js +0 -1
  239. package/dist/assets/hy-DFXneXwc.js +0 -1
  240. package/dist/assets/imba-DGztddWO.js +0 -1
  241. package/dist/assets/index-CJTp9JEp.js +0 -153
  242. package/dist/assets/ini-BEwlwnbL.js +0 -1
  243. package/dist/assets/jinja-f2NsQr07.js +0 -1
  244. package/dist/assets/jison-wvAkD_A8.js +0 -1
  245. package/dist/assets/jsonl-DcaNXYhu.js +0 -1
  246. package/dist/assets/jsonnet-DFQXde-d.js +0 -1
  247. package/dist/assets/jssm-C2t-YnRu.js +0 -1
  248. package/dist/assets/julia-5Bft2YPA.js +0 -1
  249. package/dist/assets/just-Cwhn7H3k.js +0 -1
  250. package/dist/assets/kanagawa-dragon-BuwD2xS4.js +0 -1
  251. package/dist/assets/kanagawa-lotus-C3DzagqV.js +0 -1
  252. package/dist/assets/kanagawa-wave-DFGoQZhC.js +0 -1
  253. package/dist/assets/kdl-DV7GczEv.js +0 -1
  254. package/dist/assets/kusto-wEQ09or8.js +0 -1
  255. package/dist/assets/laserwave-DUszq2jm.js +0 -1
  256. package/dist/assets/latex-D5pSuvFb.js +0 -1
  257. package/dist/assets/lean-BZvkOJ9d.js +0 -1
  258. package/dist/assets/light-plus-B7mTdjB0.js +0 -1
  259. package/dist/assets/liquid-C0sCDyMI.js +0 -1
  260. package/dist/assets/llvm-BZoOZj88.js +0 -1
  261. package/dist/assets/log-2UxHyX5q.js +0 -1
  262. package/dist/assets/logo-BtOb2qkB.js +0 -1
  263. package/dist/assets/luau-BnpPk5vE.js +0 -1
  264. package/dist/assets/marko-DjSrsDqO.js +0 -1
  265. package/dist/assets/material-theme-D5KoaKCx.js +0 -1
  266. package/dist/assets/material-theme-darker-BfHTSMKl.js +0 -1
  267. package/dist/assets/material-theme-lighter-B0m2ddpp.js +0 -1
  268. package/dist/assets/material-theme-ocean-CyktbL80.js +0 -1
  269. package/dist/assets/material-theme-palenight-Csfq5Kiy.js +0 -1
  270. package/dist/assets/matlab-D7o27uSR.js +0 -1
  271. package/dist/assets/mdc-D1_yUvq7.js +0 -1
  272. package/dist/assets/mermaid-CQcHuHx7.js +0 -1
  273. package/dist/assets/min-dark-CafNBF8u.js +0 -1
  274. package/dist/assets/min-light-CTRr51gU.js +0 -1
  275. package/dist/assets/mipsasm-CKIfxQSi.js +0 -1
  276. package/dist/assets/mojo-DJz3ZmWd.js +0 -1
  277. package/dist/assets/monokai-BRVnQi9A.js +0 -1
  278. package/dist/assets/moonbit-CHtswR0a.js +0 -1
  279. package/dist/assets/move-el3G9tDJ.js +0 -1
  280. package/dist/assets/narrat-DRg8JJMk.js +0 -1
  281. package/dist/assets/nextflow-C-mBbutL.js +0 -1
  282. package/dist/assets/nextflow-groovy-vE_lwT2v.js +0 -1
  283. package/dist/assets/nginx-BpAMiNFr.js +0 -1
  284. package/dist/assets/night-owl-C39BiMTA.js +0 -1
  285. package/dist/assets/night-owl-light-CMTm3GFP.js +0 -1
  286. package/dist/assets/nim-BIad80T-.js +0 -1
  287. package/dist/assets/nix-CwoSXNpI.js +0 -1
  288. package/dist/assets/nord-Ddv68eIx.js +0 -1
  289. package/dist/assets/nsis-BlV79W_Q.js +0 -1
  290. package/dist/assets/nushell-D3jzshHO.js +0 -1
  291. package/dist/assets/objective-c-DXmwc3jG.js +0 -1
  292. package/dist/assets/objective-cpp-CLxacb5B.js +0 -1
  293. package/dist/assets/ocaml-C0hk2d4L.js +0 -1
  294. package/dist/assets/odin-BBf5iR-q.js +0 -1
  295. package/dist/assets/one-dark-pro-DVMEJ2y_.js +0 -1
  296. package/dist/assets/one-light-C3Wv6jpd.js +0 -1
  297. package/dist/assets/openscad-C4EeE6gA.js +0 -1
  298. package/dist/assets/org-DM6o9KBp.js +0 -1
  299. package/dist/assets/pascal-D93ZcfNL.js +0 -1
  300. package/dist/assets/perl-B9cMNwum.js +0 -1
  301. package/dist/assets/pkl-u5AG7uiY.js +0 -1
  302. package/dist/assets/plastic-3e1v2bzS.js +0 -1
  303. package/dist/assets/plsql-ChMvpjG-.js +0 -1
  304. package/dist/assets/po-BTJTHyun.js +0 -1
  305. package/dist/assets/poimandres-CS3Unz2-.js +0 -1
  306. package/dist/assets/polar-C0HS_06l.js +0 -1
  307. package/dist/assets/postcss-CXtECtnM.js +0 -1
  308. package/dist/assets/powerquery-CEu0bR-o.js +0 -1
  309. package/dist/assets/prisma-Vru482bI.js +0 -1
  310. package/dist/assets/prolog-CbFg5uaA.js +0 -1
  311. package/dist/assets/pug-DKIMFp6K.js +0 -1
  312. package/dist/assets/puppet-BMWR74SV.js +0 -1
  313. package/dist/assets/purescript-CklMAg4u.js +0 -1
  314. package/dist/assets/qml-3beO22l8.js +0 -1
  315. package/dist/assets/qmldir-C8lEn-DE.js +0 -1
  316. package/dist/assets/qss-IeuSbFQv.js +0 -1
  317. package/dist/assets/racket-BqYA7rlc.js +0 -1
  318. package/dist/assets/raku-DXvB9xmW.js +0 -1
  319. package/dist/assets/razor-BjBPvh-w.js +0 -1
  320. package/dist/assets/rbs-CpoqiR4B.js +0 -1
  321. package/dist/assets/red-hvxz__6c.js +0 -1
  322. package/dist/assets/reg-C-SQnVFl.js +0 -1
  323. package/dist/assets/regexp-CDVJQ6XC.js +0 -1
  324. package/dist/assets/rel-C3B-1QV4.js +0 -1
  325. package/dist/assets/riscv-BM1_JUlF.js +0 -1
  326. package/dist/assets/ron-D8l8udqQ.js +0 -1
  327. package/dist/assets/rose-pine-5qJOZa0Y.js +0 -1
  328. package/dist/assets/rose-pine-dawn-zx0QlTCp.js +0 -1
  329. package/dist/assets/rose-pine-moon-C9pEdX9L.js +0 -1
  330. package/dist/assets/rosmsg-BJDFO7_C.js +0 -1
  331. package/dist/assets/rst-bs7f0vWN.js +0 -1
  332. package/dist/assets/ruby-C0TQ7zu5.js +0 -1
  333. package/dist/assets/sas-DEy46yEz.js +0 -1
  334. package/dist/assets/scala-CqE71os6.js +0 -1
  335. package/dist/assets/scheme-C98Dy4si.js +0 -1
  336. package/dist/assets/sdbl-DVxCFoDh.js +0 -1
  337. package/dist/assets/shaderlab-Dg9Lc6iA.js +0 -1
  338. package/dist/assets/shellsession-BADoaaVG.js +0 -1
  339. package/dist/assets/slack-dark-BthQWCQV.js +0 -1
  340. package/dist/assets/slack-ochin-DqwNpetd.js +0 -1
  341. package/dist/assets/smalltalk-BOQMe2GC.js +0 -1
  342. package/dist/assets/smithy-cds9vsN8.js +0 -1
  343. package/dist/assets/snazzy-light-Bw305WKR.js +0 -1
  344. package/dist/assets/solarized-dark-CpvCGNkr.js +0 -1
  345. package/dist/assets/solarized-light-Dlz6yCKv.js +0 -1
  346. package/dist/assets/solidity-DijEV5ha.js +0 -1
  347. package/dist/assets/soy-8wufbnw4.js +0 -1
  348. package/dist/assets/sparql-rVzFXLq3.js +0 -1
  349. package/dist/assets/splunk-BtCnVYZw.js +0 -1
  350. package/dist/assets/ssh-config-_ykCGR6B.js +0 -1
  351. package/dist/assets/stata-DI20mbqo.js +0 -1
  352. package/dist/assets/stylus-BEDo0Tqx.js +0 -1
  353. package/dist/assets/surrealql-Cjom0U5J.js +0 -1
  354. package/dist/assets/svelte-Cy7k_4gC.js +0 -1
  355. package/dist/assets/swimlanesDiagram-TC7HE7FX-CmTirbVT.js +0 -8
  356. package/dist/assets/synthwave-84-CbfX1IO0.js +0 -1
  357. package/dist/assets/system-verilog-0hqHdDBg.js +0 -1
  358. package/dist/assets/systemd-4A_iFExJ.js +0 -1
  359. package/dist/assets/talonscript-CkByrt1z.js +0 -1
  360. package/dist/assets/tasl-QIJgUcNo.js +0 -1
  361. package/dist/assets/tcl-dwOrl1Do.js +0 -1
  362. package/dist/assets/templ-DhtptRzy.js +0 -1
  363. package/dist/assets/terraform-BETggiCN.js +0 -1
  364. package/dist/assets/tex-D96PA37w.js +0 -1
  365. package/dist/assets/tokyo-night-hegEt444.js +0 -1
  366. package/dist/assets/ts-tags-D351s5mN.js +0 -1
  367. package/dist/assets/tsv-B_m7g4N7.js +0 -1
  368. package/dist/assets/turtle-BsS91CYL.js +0 -1
  369. package/dist/assets/twig-27uCiNez.js +0 -1
  370. package/dist/assets/typespec-CAFt9gP4.js +0 -1
  371. package/dist/assets/typst-BUadGCkm.js +0 -1
  372. package/dist/assets/v-BGw2Nkan.js +0 -1
  373. package/dist/assets/vala-CsfeWuGM.js +0 -1
  374. package/dist/assets/vb-Cu-pLBUe.js +0 -1
  375. package/dist/assets/verilog-nZwndyjY.js +0 -1
  376. package/dist/assets/vesper-DRje8inN.js +0 -1
  377. package/dist/assets/vhdl-CeAyd5Ju.js +0 -1
  378. package/dist/assets/viml-CJc9bBzg.js +0 -1
  379. package/dist/assets/vitesse-black-Bkuqu6BP.js +0 -1
  380. package/dist/assets/vitesse-dark-D0r3Knsf.js +0 -1
  381. package/dist/assets/vitesse-light-CVO1_9PV.js +0 -1
  382. package/dist/assets/vue-BqiEGhQt.js +0 -1
  383. package/dist/assets/vue-html-AaS7Mt5G.js +0 -1
  384. package/dist/assets/vue-vine-BoDAl6tE.js +0 -1
  385. package/dist/assets/vyper-CDx5xZoG.js +0 -1
  386. package/dist/assets/wasm-CG6Dc4jp.js +0 -1
  387. package/dist/assets/wenyan-BV7otONQ.js +0 -1
  388. package/dist/assets/wgsl-Dx-B1_4e.js +0 -1
  389. package/dist/assets/wikitext-BhOHFoWU.js +0 -1
  390. package/dist/assets/wit-5i3qLPDT.js +0 -1
  391. package/dist/assets/wolfram-lXgVvXCa.js +0 -1
  392. package/dist/assets/xsl-CtQFsRM5.js +0 -1
  393. package/dist/assets/zenscript-DVFEvuxE.js +0 -1
  394. package/dist/assets/zig-VOosw3JB.js +0 -1
  395. /package/dist/assets/{shellscript-Yzrsuije.js → bash-Yzrsuije.js} +0 -0
  396. /package/dist/assets/{docker-BcOcwvcX.js → dockerfile-BcOcwvcX.js} +0 -0
  397. /package/dist/assets/{make-CHLpvVh8.js → makefile-CHLpvVh8.js} +0 -0
@@ -1,7 +0,0 @@
1
- import{k as re,aO as Se,aE as Ae,C as Ue,aL as Be,ae as De,aP as Ie,aQ as Pe,j as t,a7 as Ce,c as k,r as u,t as m,a3 as pe,E as ze,g as b,A as $e,av as He,u as le,aR as Fe,aS as _e,q as Me,F as Re,T as qe,aT as Ve,aU as We,aV as Ke,aW as Je,aX as Ye,aY as Ge,aZ as he,a_ as Qe,a$ as Xe,b0 as Ze,X as Le,B as et,U as ge,b1 as tt,b2 as st,a8 as nt,b3 as at,ak as it,a5 as rt,b4 as lt,b5 as ot,b6 as ye,al as ct,a as dt,b7 as xt,ah as mt,Q as ut,S as pt,aK as ht}from"./index-C3NqfdVU.js";import{U as gt,C as yt}from"./user-DcZBnAuv.js";import{B as ft}from"./brain-CFZ7PEXc.js";import{w as Ee}from"./RoutinesPage-BM2D4qGi.js";import{i as fe,u as vt,b as kt,c as bt,d as jt,V as Nt,P as wt,M as St,A as Ct,a as $t,S as Mt,I as Rt}from"./VisibilitySection-DT0FqPvu.js";import{R as Lt}from"./RoutinesSection-Dny9ra-c.js";import"./WebhooksPanel--YQyCjKO.js";import"./image-plus-BbVjGHin.js";import"./CloudBackendPicker-iezpJFpF.js";const Et=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Ot=re("cpu",Et);const Tt=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],At=re("history",Tt);const Ut=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Bt=re("layout-dashboard",Ut);const Dt=[["rect",{width:"3",height:"8",x:"13",y:"2",rx:"1.5",key:"diqz80"}],["path",{d:"M19 8.5V10h1.5A1.5 1.5 0 1 0 19 8.5",key:"183iwg"}],["rect",{width:"3",height:"8",x:"8",y:"14",rx:"1.5",key:"hqg7r1"}],["path",{d:"M5 15.5V14H3.5A1.5 1.5 0 1 0 5 15.5",key:"76g71w"}],["rect",{width:"8",height:"3",x:"14",y:"13",rx:"1.5",key:"1kmz0a"}],["path",{d:"M15.5 19H14v1.5a1.5 1.5 0 1 0 1.5-1.5",key:"jc4sz0"}],["rect",{width:"8",height:"3",x:"2",y:"8",rx:"1.5",key:"1omvl4"}],["path",{d:"M8.5 5H10V3.5A1.5 1.5 0 1 0 8.5 5",key:"16f3cl"}]],It=re("slack",Dt),Pt=[{id:"overview",label:"Overview",icon:Bt,keywords:["summary","status","what it does","won't","prompt","what the model sees"]},{id:"identity",label:"Identity",icon:gt,keywords:["name","title","avatar","blurb","instructions"]},{id:"slack",label:"Slack",icon:It,keywords:["slack","slack app","admin","message","direct messages","mentions"]},{id:"soul",label:"Soul",icon:Se,keywords:["standing instructions","instructions","persona","rules","soul.md"]},{id:"skills",label:"Skills",icon:Ae,keywords:["skills","learned","procedures","teach"]},{id:"memory",label:"Memory",icon:ft,keywords:["memory","notes","remember","topics"]},{id:"routines",label:"Routines",icon:Ue,keywords:["schedule","routines","cron","tasks"]},{id:"access",label:"Access",icon:Be,keywords:["works on","computer","vm","cloud","vps","folder","workspace","browser","connected apps","composio","webhooks","always allow","grants","tool selection","tools","mcp","allow","exclude"]},{id:"model",label:"Model",icon:Ot,keywords:["engine","model","provider","cli","effort"]},{id:"permissions",label:"Permissions",icon:De,keywords:["auto mode","approve","auto approve","review","routine approvals","peers","contact","coordination","chief of staff","section"]},{id:"voice",label:"Voice & alerts",icon:Ie,keywords:["voice","alerts","notifications","speak"]},{id:"visibility",label:"Who can see it",labelKey:"botSettings.visibility.title",icon:Pe,keywords:["visibility","who can see","private","people","admins","members","access","hide"]},{id:"history",label:"History",icon:At,keywords:["history","changes","undo","rollback","log"]},{id:"usage",label:"Usage",icon:yt,keywords:["tokens","cost","billing"]}];function zt({data:e,error:s,open:i,onToggle:a}){return t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsxs("button",{type:"button",onClick:a,"aria-expanded":i,className:"flex w-full items-center justify-between gap-3 text-left",children:[t.jsx("span",{className:"text-[15px] font-medium text-ink",children:e?`Prompt preview · ${e.totalBytes.toLocaleString()} bytes ≈ ${e.approxTokens.toLocaleString()} tokens`:"Prompt preview"}),t.jsx(Ce,{size:16,className:k("shrink-0 text-ink-secondary transition-transform",i&&"rotate-180")})]}),i&&!e&&s&&t.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:"Couldn’t load the prompt preview."}),i&&!e&&!s&&t.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:"Loading…"}),i&&e&&t.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[e.sections.map(l=>t.jsxs("details",{className:"rounded-lg border border-hairline/40 bg-inset px-3 py-2",children:[t.jsxs("summary",{className:"flex cursor-pointer items-center justify-between gap-3 text-[13px] text-ink",children:[t.jsx("span",{children:l.label}),t.jsxs("span",{className:"shrink-0 tabular-nums text-ink-secondary",children:[l.bytes.toLocaleString()," bytes"]})]}),t.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed text-ink",children:l.text})]},l.id)),e.note&&t.jsx("div",{className:"text-[11px] text-ink-secondary",children:e.note})]})]})}function Ht({overview:e,refreshError:s,prompt:i,promptError:a,onOpen:l,onSetup:r}){const[o,y]=u.useState(!1);if(!e)return t.jsx("div",{className:"text-[13px] text-ink-secondary",children:"Loading…"});const f=(e.setup??[]).filter(h=>!h.done);return t.jsxs("div",{className:"flex flex-col gap-4",children:[s&&t.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[12.5px] text-ink-secondary",children:"Couldn’t refresh — showing the last loaded overview."}),f.length>0&&t.jsxs("div",{className:"rounded-xl border border-accent/30 bg-accent/[0.06] p-4",children:[t.jsx("div",{className:"text-[15px] font-medium text-ink",children:m("botSetup.ideas")}),t.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:m("botSetup.optional")}),t.jsx("ul",{className:"mt-2 flex flex-col gap-1",children:f.map(h=>t.jsx("li",{children:h.section?t.jsxs("button",{type:"button",onClick:()=>l(h.section),className:"flex w-full items-center gap-2.5 rounded-lg px-1 py-1 text-left text-[13px] text-ink hover:bg-inset",children:[t.jsx(pe,{"aria-hidden":"true",size:14,className:"shrink-0 text-ink-secondary"}),t.jsx("span",{className:"flex-1",children:h.label}),t.jsx("span",{className:"text-[12px] text-ink-secondary",children:"→"})]}):t.jsxs("div",{className:"flex items-center gap-2.5 px-1 py-1 text-[13px] text-ink",children:[t.jsx(pe,{"aria-hidden":"true",size:14,className:"shrink-0 text-ink-secondary"}),t.jsx("span",{children:h.label})]})},h.id))}),r&&t.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[t.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[12.5px] font-medium text-accent-ink hover:brightness-110",children:[t.jsx(Se,{size:14})," ",m("botSetup.withBot")]}),t.jsx("span",{className:"text-[12px] text-ink-secondary",children:m("botSetup.help")})]})]}),t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsx("div",{className:"text-[15px] font-medium text-ink",children:e.who.name}),e.who.title&&t.jsx("div",{className:"mt-0.5 text-[13px] text-ink-secondary",children:e.who.title}),e.who.blurb&&t.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink",children:e.who.blurb}),e.who.soulLead&&t.jsxs("div",{className:"mt-3 rounded-lg bg-inset px-3 py-2.5",children:[t.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:e.who.soulLead}),t.jsx("button",{type:"button",onClick:()=>l("soul"),className:"mt-1.5 rounded-md text-[12px] font-medium text-accent-text hover:underline",children:"Read all"})]})]}),t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsx("div",{className:"text-[15px] font-medium text-ink",children:"Does"}),e.does.length===0?t.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:"Nothing scheduled or learned yet."}):t.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:e.does.map((h,p)=>t.jsx("li",{children:h},p))})]}),t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsx("div",{className:"text-[15px] font-medium text-ink",children:"Can reach"}),e.reaches.length===0?t.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:"Nothing yet."}):t.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:e.reaches.map((h,p)=>t.jsx("li",{children:h},p))})]}),t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsx("div",{className:"text-[15px] font-medium text-ink",children:"Won’t"}),t.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:e.wont.map((h,p)=>t.jsx("li",{children:h},p))})]}),t.jsx(zt,{data:i,error:a,open:o,onToggle:()=>y(h=>!h)}),t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("div",{className:"text-[15px] font-medium text-ink",children:"Recent changes"}),t.jsx("button",{type:"button",onClick:()=>l("history"),className:"shrink-0 text-[12px] text-ink-secondary hover:text-ink",children:"View all →"})]}),e.recent.length===0?t.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:"Nothing changed recently."}):t.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] text-ink",children:e.recent.map((h,p)=>t.jsxs("li",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("span",{className:"min-w-0 truncate",children:h.summary}),t.jsxs("span",{className:"shrink-0 text-[11.5px] text-ink-secondary",children:["· ",Ee(h.at)]})]},p))})]})]})}function Ft({managementUrl:e}){return t.jsxs("div",{className:"flex flex-col gap-3 text-[13px] leading-relaxed text-ink-secondary",children:[t.jsx("p",{children:m("botSlack.body")}),t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"flex w-fit items-center gap-2 rounded-lg bg-control px-3 py-2 font-medium text-ink hover:bg-control/70",children:[m("botSlack.manage")," ",t.jsx(ze,{size:14,"aria-hidden":"true"})]})]})}function _t(e){if(!e||typeof e!="object")return null;const{available:s,managementUrl:i}=e;if(s!==!0||typeof i!="string")return null;try{return new URL(i).protocol==="https:"?i:null}catch{return null}}function qt(e){const[s,i]=u.useState(null);return u.useEffect(()=>{const a=new AbortController;return b(`/api/bots/${encodeURIComponent(e)}/slack-management`,{signal:a.signal,timeoutMs:1e4}).then(l=>{a.signal.aborted||i({botId:e,url:_t(l)})}).catch(()=>{a.signal.aborted||i({botId:e,url:null})}),()=>a.abort()},[e]),s?.botId===e?s.url:null}const D="MEMORY.md";function Vt(e){return b(`/api/bots/${e}/memory`)}function ve(e,s){return b(`/api/bots/${e}/memory/file?path=${encodeURIComponent(s)}`)}async function Wt(e,s,i,a){const l=await fetch(`/api/bots/${e}/memory/file`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({path:s,text:i,expectedHash:a})}),r=await l.json().catch(()=>({}));if(l.status===409&&typeof r.current=="string"&&typeof r.currentHash=="string")return{ok:!1,conflict:!0,current:r.current,currentHash:r.currentHash};if(!l.ok)throw new $e(typeof r.error=="string"?r.error:`${l.status} ${l.statusText}`,l.status);const o=r;return{ok:!0,doc:{path:o.path,text:o.text,hash:o.hash,exists:o.exists},overview:o.overview}}function Kt(e,s){return b(`/api/bots/${e}/memory/file?path=${encodeURIComponent(s)}`,{method:"DELETE"})}async function G(e,s=50){return(await b(`/api/bots/${e}/memory/journal?limit=${s}`)).entries}function Jt(e,s){return b(`/api/bots/${e}/memory/journal/${encodeURIComponent(s)}/revert`,{method:"POST"})}function xe(e){return e?e.added+(e.topics??0):0}function ke(e){return b(`/api/bots/${e}/memory/upkeep`)}function Yt(e,s){return b(`/api/bots/${e}/memory/reviewed`,{method:"POST",body:JSON.stringify({token:s})})}function Gt(e){return b(`/api/bots/${e}/memory/tidy`,{method:"POST"})}function Oe(e){const s=[];e.expired&&s.push(`archived ${e.expired} expired note${e.expired===1?"":"s"}`),e.duplicates&&s.push(`merged ${e.duplicates} duplicate${e.duplicates===1?"":"s"}`),e.superseded&&s.push(`crossed out ${e.superseded} contradicted note${e.superseded===1?"":"s"}`),e.organized&&s.push(`filed ${e.organized} note${e.organized===1?"":"s"} into topics`);const i=s.length?s.join(", "):"nothing to tidy";return i.charAt(0).toUpperCase()+i.slice(1)}function Qt(e,s){return b(`/api/bots/${e}/memory/open`,{method:"POST",body:JSON.stringify({target:s})})}function I(e){return e<1024?`${e} B`:`${Math.round(e/102.4)/10} KB`}function ie(e,s=Date.now()){const i=Math.max(0,Math.round((s-e)/1e3));if(i<45)return"just now";const a=Math.round(i/60);if(a<60)return`${a} min ago`;const l=Math.round(a/60);if(l<24)return`${l} hr ago`;const r=Math.round(l/24);return r===1?"yesterday":r<7?`${r} days ago`:new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})}function Xt(e){const s=e.maxLines?e.lines/e.maxLines:0,i=e.maxBytes?e.bytes/e.maxBytes:0,a=e.truncated?"over":Math.max(s,i)>=.8?"near":"ok",l=`${e.lines} of ${e.maxLines} lines · ${I(e.bytes)} of ${I(e.maxBytes)} — only the first ${e.maxLines} lines load each turn.`;let r=null;if(e.truncated){const o=e.lines-e.loadedLines;r=o>0?`${e.lines} lines saved, ${e.loadedLines} load into every conversation — ${o} ${o===1?"line is":"lines are"} not being loaded. Trim this file or move notes into a topic file.`:`${I(e.bytes)} saved, ${I(e.loadedBytes)} load into every conversation — the rest is not being loaded. Trim this file or move notes into a topic file.`}return{level:a,lineShare:s,byteShare:i,sentence:l,warning:r}}function Zt(e){return e===D?"MEMORY.md":e.startsWith("memory/log/")?`the ${e.slice(11).replace(/\.md$/,"")} log`:e.replace(/^memory\//,"").replace(/\.md$/,"")}function es(e,s){const i=e.actor==="bot"?s:e.actor==="import"?"An import":e.actor==="upkeep"?"Memory upkeep":"You",a=Zt(e.path),r=e.path===D||e.path.startsWith("memory/log/")?a:`the ${a} topic`;return e.kind==="created"?`${i} created ${r}${e.added?` with ${ae(e.added,"line")}`:""}`:e.kind==="deleted"?`${i} deleted ${r}`:e.added&&!e.removed?`${i} added ${ae(e.added,"line")} to ${r}`:e.removed&&!e.added?`${i} removed ${ae(e.removed,"line")} from ${r}`:`${i} rewrote ${ae(Math.max(e.added,e.removed),"line")} in ${r}`}function ae(e,s){return`${e} ${s}${e===1?"":"s"}`}function ts(e){return e.via==="revert"?"undo":e.via==="disk"?"changed outside the app":e.via==="tidy"?"tidy-up":e.via==="organize"?"filed into topics":e.via==="capture"?e.threadTitle?`noticed in chat “${e.threadTitle}”`:"noticed in a chat":e.threadTitle?`from chat “${e.threadTitle}”`:e.actor==="bot"?"during a task":e.via==="ui"?"in Settings":e.via==="api"?"through the API":null}function ss(e){return e==="darwin"?"Show in Finder":e==="win32"?"Show in Explorer":"Show in file manager"}function ns(e){const s=e.trim().replace(/\.md$/i,"").replace(/[^\w .-]+/g,"-").replace(/^[^\w]+/,"").trim();return s?`${s}.md`:null}const T="rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",me="rounded-md px-2 py-1 text-[12.5px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50",O=e=>e instanceof Error?e.message:String(e);function as({changed:e,stale:s,busy:i,onReviewed:a}){return t.jsxs("div",{role:"status",className:"rounded-xl border border-danger/40 bg-card p-4",children:[t.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:m(s?"memory.lendingReviewStale":"memory.lendingReview")}),e.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:m("memory.lendingReviewChanged")}),t.jsx("ul",{className:"mt-1 space-y-0.5",children:e.map(l=>t.jsx("li",{className:"break-all font-mono text-[12px] text-ink",children:l},l))})]}),t.jsx("button",{type:"button",className:k(T,"mt-3"),disabled:i,onClick:a,children:m("memory.lendingReviewed")})]})}function is({bot:e,active:s=!0,onToggle:i}){const{capabilities:a}=He(),[l,r]=u.useState(null),[o,y]=u.useState(null),[c,f]=u.useState(null),[h,p]=u.useState(null),[j,N]=u.useState(null),[R,v]=u.useState(null),[w,C]=u.useState(null),[$,P]=u.useState(!1),[A,U]=u.useState(null),[x,L]=u.useState(""),[Q,z]=u.useState(null),[oe,X]=u.useState(!1),[q,V]=u.useState(null),[W,Z]=u.useState(!1),[ee,K]=u.useState(!1),{dispatch:J}=le(),te=async n=>{const[d,M,B]=await Promise.all([Vt(e.id),G(e.id),ke(e.id).catch(()=>null)]);if(r(d),V(d.lendingReview??null),y(M),z(B),n){const E=await ve(e.id,n);f({path:E.path,text:E.text,hash:E.hash,dirty:!1,readOnly:n.startsWith("memory/log/")})}};u.useEffect(()=>{if(!s)return;let n=!1;v(null);const d=c?.dirty===!0;return te(d?void 0:c?.path??D).catch(M=>{n||v(O(M))}),()=>{n=!0}},[s,e.id]);const S=async n=>{v(null),p(null);try{const d=await ve(e.id,n);f({path:d.path,text:d.text,hash:d.hash,dirty:!1,readOnly:n.startsWith("memory/log/")})}catch(d){v(O(d))}},Y=async n=>{if(c){P(!0),v(null);try{const d=await Wt(e.id,c.path,c.text,n);if(!d.ok){p({path:c.path,current:d.current,currentHash:d.currentHash});return}p(null),N(null),f({...c,text:d.doc.text,hash:d.doc.hash,dirty:!1}),r(d.overview),y(await G(e.id))}catch(d){v(O(d))}finally{P(!1)}}},se=()=>{!h||!c||(N(c.text),f({...c,text:h.current,hash:h.currentHash,dirty:!1}),p(null))},H=async n=>{if(window.confirm(`Delete ${n.name}? The journal below can bring it back.`)){v(null);try{const{overview:d}=await Kt(e.id,n.path);r(d),y(await G(e.id)),c?.path===n.path&&f(null)}catch(d){v(O(d))}}},F=async()=>{const n=ns(x);if(!n){v("Give the topic a name — letters, numbers, spaces, dots or dashes.");return}L(""),await S(`memory/${n}`),f(d=>d&&{...d,dirty:!0,text:d.text||rs(n)})},ce=async n=>{U(n.id),v(null);try{const d=await Jt(e.id,n.id);r(d.overview),y(await G(e.id)),c?.path===n.path&&!c.dirty&&f({...c,text:d.text,hash:d.hash}),C(`Put ${n.path} back the way it was.`)}catch(d){v(O(d))}finally{U(null)}},_=async n=>{v(null),C(null);try{await Qt(e.id,n)}catch(d){v(O(d))}},de=()=>{const n=e.memoryUpkeep===!1;J({type:"updateBot",botId:e.id,patch:{memoryUpkeep:n}}),z(d=>d&&{...d,enabled:n})},ne=async()=>{X(!0),v(null),C(null);try{const{report:n,overview:d}=await Gt(e.id);r(d),y(await G(e.id)),z(await ke(e.id)),c&&!c.dirty&&await S(c.path),C(`${Oe(n)}.${n.note?` ${n.note}`:""}`)}catch(n){v(O(n))}finally{X(!1)}},g=a.host.homeDir;return t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsx("div",{className:"text-[15px] font-medium text-ink",children:"Memory"}),t.jsxs("label",{className:"mt-3 flex items-center gap-2 text-[13px] text-ink",children:[t.jsx("input",{type:"checkbox",checked:e.memoryEnabled!==!1,disabled:e.busy,onChange:n=>i(n.target.checked)}),"Let this bot use memory"]}),t.jsxs("p",{className:"mt-1 text-[12.5px] text-ink-secondary",children:["Off stops memory prompts, recall, native memory tools, upkeep, and automatic turn logs. Existing files remain available for review.",e.busy?" Stop this bot's turn before changing this setting.":""]}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:"Notes this bot keeps between tasks. They are plain markdown files in a folder on this computer — open them in any editor, or in Obsidian."}),l&&t.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink-secondary",title:l.workspacePath,children:Fe(l.workspacePath,g)}),t.jsx("button",{type:"button",className:T,onClick:()=>{_("obsidian")},children:"Open in Obsidian"}),t.jsxs("button",{type:"button",className:k(T,"inline-flex items-center gap-1.5"),onClick:()=>{_("folder")},children:[t.jsx(_e,{size:14}),ss(a.host.platform)]})]})]}),q&&t.jsx(as,{changed:q.changed,stale:W,busy:ee,onReviewed:()=>{K(!0),Yt(e.id,q.token).then(()=>{V(null),Z(!1)}).catch(n=>{if(n instanceof $e&&n.status===409)return Z(!0),te();v(O(n))}).finally(()=>K(!1))}}),l&&t.jsx(os,{index:l.index}),e.memoryEnabled!==!1&&t.jsx(ls,{enabled:e.memoryUpkeep!==!1,status:Q,tidying:oe,onToggle:de,onTidy:()=>{ne()}}),c&&t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"truncate font-mono text-[12.5px] text-ink",children:c.path}),c.path!==D&&t.jsx("button",{type:"button",className:me,onClick:()=>{S(D)},children:"Back to MEMORY.md"})]}),h&&t.jsx(cs,{botName:e.name,busy:$,onReload:se,onOverwrite:()=>{Y(h.currentHash)}}),t.jsx("textarea",{className:k(fe,"mt-2 min-h-[200px] resize-y font-mono text-[12.5px] leading-relaxed"),value:c.text,readOnly:c.readOnly,placeholder:c.path===D?"Nothing remembered yet. The bot writes durable notes here — or add your own.":"Write the note here.","aria-label":c.path===D?"Bot memory":`Memory file ${c.path}`,onChange:n=>f({...c,text:n.target.value,dirty:!0})}),c.readOnly?t.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:"Daily logs are the bot's own record of what it did; they are not loaded into conversations and are read-only here."}):t.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[t.jsx("button",{type:"button",onClick:()=>{Y(c.hash)},disabled:$||!c.dirty,className:T,children:$?"Saving…":"Save"}),c.dirty&&t.jsx("button",{type:"button",className:me,disabled:$,onClick:()=>{S(c.path)},children:"Discard changes"})]}),j!==null&&t.jsxs("div",{className:"mt-3",children:[t.jsx("div",{className:"mb-1 text-[12px] text-ink-secondary",children:"Your unsaved draft, kept so nothing is lost:"}),t.jsx("pre",{className:"max-h-[160px] overflow-auto whitespace-pre-wrap rounded-lg border border-hairline/40 bg-inset p-3 font-mono text-[12px] leading-relaxed text-ink",children:j}),t.jsx("button",{type:"button",className:k(me,"mt-1"),onClick:()=>N(null),children:"Dismiss draft"})]})]}),l&&t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsx(je,{title:"Topic files",hint:"Longer notes the bot reads on demand. Click one to edit it.",files:l.topics,selected:c?.path,onOpen:n=>{S(n.path)},onDelete:n=>{H(n)}}),t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsx("input",{className:k(fe,"py-1.5 text-[13px]"),value:x,placeholder:"New topic name, e.g. clients","aria-label":"New topic name",onChange:n=>L(n.target.value),onKeyDown:n=>{n.key==="Enter"&&F()}}),t.jsx("button",{type:"button",className:T,disabled:!x.trim(),onClick:()=>{F()},children:"New topic"})]}),l.logs.length>0&&t.jsx("div",{className:"mt-4",children:t.jsx(je,{title:"Daily logs",hint:"What the bot did each day, in its own words. Not loaded into conversations.",files:l.logs,selected:c?.path,onOpen:n=>{S(n.path)},onDelete:n=>{H(n)}})})]}),t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsx("div",{className:"text-[15px] font-medium text-ink",children:"Changes"}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:"Every change to these files, whoever made it. Undo puts a file back the way it was before that change."}),t.jsx("div",{className:"mt-3",children:t.jsx(ds,{rows:o,botName:e.name,reverting:A,onRevert:n=>{ce(n)}})})]}),w&&t.jsx("div",{className:"text-[12.5px] text-ink-secondary",children:w}),R&&t.jsx("div",{className:"text-[12.5px] text-danger",children:R})]})}function rs(e){return`---
2
- title: ${e.replace(/\.md$/,"")}
3
- description:
4
- aliases: []
5
- ---
6
-
7
- `}function ls({enabled:e,status:s,tidying:i,onToggle:a,onTidy:l}){return t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[15px] font-medium text-ink",children:"Memory upkeep"}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:"Keeps these notes in shape without the bot having to remember to: notices facts you mention in chats and files them — core facts here, detail in topic files it creates — and tidies up every night: expired notes are archived, duplicates merged, contradicted notes crossed out. Facts about you are added to About me (Settings → General), where every bot reads them and you can remove any. Every change shows below and can be undone."})]}),t.jsx(Me,{checked:e,"aria-label":"Memory upkeep",onClick:a})]}),e&&s&&!s.modelSteps&&t.jsx("p",{className:"mt-2 text-[12.5px] text-ink-secondary",children:"This bot's engine can't make the quick background model call upkeep uses, so it only archives expired notes and merges exact duplicates. Claude and chat-model engines can do the rest."}),e&&t.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3",children:[t.jsx("button",{type:"button",className:T,disabled:i,onClick:l,children:i?"Tidying…":"Tidy up now"}),t.jsxs("span",{className:"text-[12.5px] text-ink-secondary",children:[s?.lastTidy?`Last tidy-up ${ie(s.lastTidy.at)}: ${Oe(s.lastTidy).toLowerCase()}.`:"Not tidied yet.",s?.lastCapture&&xe(s.lastCapture)?` Last noticed ${xe(s.lastCapture)} fact${xe(s.lastCapture)===1?"":"s"} ${ie(s.lastCapture.at)}.`:""]})]})]})}function os({index:e}){const s=Xt(e),i=s.level==="over"?"bg-danger":s.level==="near"?"bg-warning":"bg-accent";return t.jsxs("div",{className:k("rounded-xl p-4",s.level==="over"?"border border-danger/30 bg-danger/10":"bg-card"),children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 text-[13px]",children:[t.jsx("span",{className:"font-medium text-ink",children:"How much of MEMORY.md loads"}),t.jsxs("span",{className:k("text-[12px]",s.level==="over"?"text-danger":"text-ink-secondary"),children:[e.lines," / ",e.maxLines," lines · ",I(e.bytes)," / ",I(e.maxBytes)]})]}),t.jsx(be,{label:"Lines",share:s.lineShare,fill:i}),t.jsx(be,{label:"Size",share:s.byteShare,fill:i}),t.jsx("p",{className:k("mt-2 text-[12.5px] leading-relaxed",s.level==="over"?"text-danger":"text-ink-secondary"),children:s.warning??s.sentence}),s.warning&&t.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:s.sentence})]})}function be({label:e,share:s,fill:i}){const a=`${Math.min(100,Math.round(s*100))}%`;return t.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[11.5px] text-ink-secondary",children:[t.jsx("span",{className:"w-10 shrink-0",children:e}),t.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-inset",role:"meter","aria-label":`${e} used`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.min(100,Math.round(s*100)),children:t.jsx("div",{className:k("h-full rounded-full",i),style:{width:a}})})]})}function cs({botName:e,busy:s,onReload:i,onOverwrite:a}){return t.jsxs("div",{className:"mt-2 rounded-lg border border-warning/25 bg-warning/10 p-3 text-[12.5px] leading-relaxed text-ink",children:[t.jsxs("div",{className:"font-medium",children:[e," changed this file while you were editing."]}),t.jsxs("div",{className:"mt-0.5 text-ink-secondary",children:["Nothing has been saved. Reload to see ",e,"'s version (your draft is kept below), or overwrite it with yours."]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx("button",{type:"button",className:T,disabled:s,onClick:i,children:"Reload"}),t.jsx("button",{type:"button",className:T,disabled:s,onClick:a,children:"Overwrite with mine"})]})]})}function je({title:e,hint:s,files:i,selected:a,onOpen:l,onDelete:r}){return t.jsxs("div",{children:[t.jsx("div",{className:"text-[12px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:e}),t.jsx("div",{className:"mt-0.5 text-[12px] text-ink-secondary",children:s}),i.length===0?t.jsx("div",{className:"mt-2 text-[12.5px] text-ink-secondary",children:"None yet."}):t.jsx("div",{className:"mt-2 overflow-hidden rounded-lg border border-hairline/40",children:i.map(o=>t.jsxs("div",{className:k("flex items-center gap-2 border-b border-hairline/40 px-3 py-2 last:border-b-0",a===o.path?"bg-control/60":"hover:bg-control/40"),children:[t.jsxs("button",{type:"button",onClick:()=>l(o),className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[t.jsx(Re,{size:14,className:"shrink-0 text-ink-secondary"}),t.jsx("span",{className:"truncate font-mono text-[12.5px] text-ink",children:o.name}),t.jsxs("span",{className:"shrink-0 text-[11.5px] text-ink-secondary",children:[I(o.bytes)," · ",ie(o.modifiedAt)]})]}),t.jsx("button",{type:"button",onClick:()=>r(o),"aria-label":`Delete ${o.name}`,title:"Delete",className:"shrink-0 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-danger",children:t.jsx(qe,{size:14})})]},o.path))})]})}function ds({rows:e,botName:s,reverting:i,onRevert:a,now:l=Date.now()}){return e?e.length===0?t.jsx("div",{className:"text-[13px] text-ink-secondary",children:"No changes recorded yet."}):t.jsx("div",{className:"flex flex-col gap-2",children:e.map(r=>{const o=ts(r);return t.jsxs("div",{className:"rounded-lg bg-inset px-3 py-2",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1 text-[13px] leading-relaxed text-ink",children:[t.jsx("span",{children:es(r,s)})," · ",t.jsx("span",{className:"text-ink-secondary",children:ie(r.at,l)}),o&&t.jsxs(t.Fragment,{children:[" · ",t.jsx("span",{className:"text-ink-secondary",children:o})]})]}),r.canRevert?t.jsxs("button",{type:"button",disabled:i!==null,onClick:()=>a(r),className:"inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[12px] font-medium text-accent-text hover:bg-accent/10 disabled:opacity-50",children:[t.jsx(Ve,{size:12}),i===r.id?"Undoing…":"Undo"]}):t.jsx("span",{className:"shrink-0 text-[11.5px] text-ink-secondary",title:r.revertUnavailableReason,children:"Can't undo"})]}),r.diff&&t.jsxs("details",{className:"mt-1",children:[t.jsxs("summary",{className:"cursor-pointer text-[12px] text-ink-secondary",children:["+",r.added," −",r.removed," · show what changed"]}),t.jsx("pre",{className:"mt-1 max-h-[240px] overflow-auto whitespace-pre-wrap rounded-md bg-card p-2 font-mono text-[11.5px] leading-relaxed text-ink",children:r.diff})]})]},r.id)})}):t.jsx("div",{className:"text-[13px] text-ink-secondary",children:"Loading…"})}function xs({bot:e,rows:s,refreshError:i,onRollback:a,rollingBack:l}){if(!s)return t.jsx("div",{className:"text-[13px] text-ink-secondary",children:"Loading…"});if(s.length===0)return t.jsx("div",{className:"text-[13px] text-ink-secondary",children:"No changes recorded yet."});const r=[...s].sort((o,y)=>y.at-o.at);return t.jsxs("div",{className:"flex flex-col gap-2",children:[i&&t.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[12.5px] text-ink-secondary",children:"Couldn’t refresh history."}),r.map(o=>t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1 text-[13px] leading-relaxed text-ink",children:[t.jsx("span",{className:"text-ink-secondary",children:Ee(o.at)})," · ",t.jsxs("span",{children:[o.actor," via ",o.via]})," · ",t.jsx("span",{children:o.summary})]}),o.field==="soul"&&o.canRestore===!0&&t.jsx("button",{type:"button",disabled:l,onClick:()=>a(o.id),className:"shrink-0 rounded-md px-2 py-1 text-[12px] font-medium text-accent-text hover:bg-accent/10 disabled:opacity-50",children:"Undo this change"})]}),o.field==="soul"&&o.canRestore!==!0&&t.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:o.restoreUnavailableReason??"The exact previous instructions are unavailable, so this change cannot be undone."})]},`${e.id}-${o.id}`))]})}function ms({bot:e}){const{state:s,dispatch:i}=le(),a=We(e),l=s.instances.find(r=>r.instanceId===e.modelSelection.instanceId);return a.turns===0?t.jsx("div",{className:"rounded-xl bg-card p-4 text-[13px] text-ink-secondary",children:m("usage.bot.empty")}):t.jsxs("div",{className:"rounded-xl bg-card p-4",children:[t.jsxs("div",{className:"flex items-baseline justify-between",children:[t.jsx("div",{className:"text-[15px] font-medium text-ink",children:m("usage.title")}),t.jsxs("button",{onClick:()=>i({type:"toggleAppSettings",open:!0,section:"usage"}),className:"text-[12px] text-ink-secondary hover:text-ink",children:[m("usage.allBots")," →"]})]}),t.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-3 text-[13px]",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-[11.5px] uppercase tracking-wide text-ink-secondary",children:m("usage.colTurns")}),t.jsx("div",{className:"mt-0.5 tabular-nums text-ink",children:a.turns})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[11.5px] uppercase tracking-wide text-ink-secondary",children:Ke(a)}),t.jsx("div",{className:"mt-0.5 tabular-nums text-ink",title:Ge(a),children:Je(Ye(a))})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[11.5px] uppercase tracking-wide text-ink-secondary",children:m("usage.colCost")}),t.jsx("div",{className:"mt-0.5 tabular-nums text-ink",children:he(a.costUsd)?Qe(a.costUsd):"—"})]})]}),t.jsx("div",{className:"mt-2 text-[12px] text-ink-secondary",children:he(a.costUsd)?m("usage.costLine",{caption:Xe(l?.snapshot.billing)}):m("usage.bot.unpriced")})]})}const Ne="w-full rounded-xl border border-hairline/40 bg-inset px-3 py-2.5 text-[14px] text-ink placeholder:text-ink-tertiary focus:border-accent-border focus:outline-none",ue="mb-1.5 block text-[12px] text-ink-secondary";function us(e){const s=[],i=new Set;for(const a of[...rt(e)].reverse()){const l=[];if(s.push(l),a.role!=="bot"||a.kind!=="text")continue;const r=lt(a.attachments),o=[...r.files,...ot(a.text??"",[...r.images,...r.files.map(c=>c.path)])],y=(c,f,h)=>{i.has(c)||(i.add(c),l.push({key:`${a.id}:${c}`,name:f,kind:h,at:a.at,messageId:a.id}))};for(const c of r.images)y(c,ye(c),"image");for(const c of o)y(c.path,c.name||ye(c.path),"file")}return s.flat()}function ps({bot:e,derived:s,headerClassName:i,onClose:a,onAllSettings:l,onAddSkill:r}){const{dispatch:o}=le(),[y,c]=u.useState("details"),[f,h]=u.useState(null),p=vt(e),{patch:j,approvalMode:N,engine:R,trustedModesAvailable:v}=s,w=R?.driverKind==="antigravityAgent"&&N==="auto"?"ask":N,C=Ze(R?.driverKind??"",v).some(x=>x.mode==="auto"),$=x=>{if(!(e.busy||x===N)){if(x==="auto"&&e.computer==="local"){h(e.id);return}j({approvalMode:x})}},P=w!=="ask"&&w!=="auto",A=u.useMemo(()=>y==="library"?us(e):[],[y,e]),U=x=>k("rounded-full px-4 py-1.5 text-[13px] font-medium transition-colors",x?"bg-raised text-ink shadow-sm":"text-ink-secondary hover:text-ink");return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:k("flex shrink-0 items-center justify-end px-4 py-3",i),children:t.jsx("button",{type:"button",onClick:a,"aria-label":m("botSettings.simple.close"),className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",children:t.jsx(Le,{size:18,className:"pointer-events-none"})})}),t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-5 pb-6",children:[t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(et,{bot:e,size:72,state:s.activeState}),t.jsx("h2",{id:"bot-settings-title",className:"max-w-full truncate text-[17px] font-semibold text-ink",children:e.name})]}),t.jsx("div",{className:"mt-4 flex justify-center",children:t.jsxs("div",{role:"tablist","aria-label":m("botSettings.simple.tabs"),className:"inline-flex rounded-full bg-inset p-1",children:[t.jsx("button",{type:"button",role:"tab","aria-selected":y==="details","data-simple-tab":"details",onClick:()=>c("details"),className:U(y==="details"),children:m("botSettings.simple.details")}),t.jsx("button",{type:"button",role:"tab","aria-selected":y==="library","data-simple-tab":"library",onClick:()=>c("library"),className:U(y==="library"),children:m("botSettings.simple.library")})]})}),y==="details"?t.jsxs("div",{role:"tabpanel",className:"mt-5 flex flex-col gap-5",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("label",{htmlFor:`simple-bot-name-${e.id}`,className:ue,children:m("botSettings.simple.name")}),t.jsx("input",{id:`simple-bot-name-${e.id}`,className:Ne,maxLength:ge.name,value:e.name,onChange:x=>j({name:x.target.value})})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("label",{htmlFor:`simple-bot-job-${e.id}`,className:ue,children:m("botSettings.simple.job")}),t.jsx("input",{id:`simple-bot-job-${e.id}`,className:Ne,maxLength:ge.title,placeholder:m("botSettings.simple.jobPlaceholder"),value:e.title,onChange:x=>j({title:x.target.value})})]})]}),t.jsx(kt,{bot:e,onPatch:j,simple:{label:m("botSettings.simple.instructions"),placeholder:m("botSettings.simple.instructionsPlaceholder",{name:e.name})}}),t.jsxs("div",{"data-simple-default-model":!0,children:[t.jsx(tt,{bot:e,contained:!0,label:t.jsx("span",{className:"text-[12px] text-ink-secondary",children:m("botSettings.simple.defaultModel")})}),t.jsx(st,{bot:e,className:"mt-2"})]}),t.jsxs("div",{children:[t.jsx("div",{className:ue,children:m("botSettings.simple.beforeActs",{name:e.name})}),t.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{mode:"ask",title:m("botSettings.simple.ask"),hint:m("botSettings.simple.askHint"),offered:!0},{mode:"auto",title:m("botSettings.simple.decide"),hint:m("botSettings.simple.decideHint"),offered:C}].map(x=>{const L=w===x.mode;return t.jsxs("button",{type:"button","data-approval-choice":x.mode,"aria-pressed":L,disabled:!!e.busy||!x.offered,onClick:()=>$(x.mode),className:k("flex min-w-0 flex-col items-start gap-0.5 rounded-xl border px-3 py-3 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-50",L?"border-accent-border bg-raised-hover":"border-hairline/40 bg-inset enabled:hover:bg-raised"),children:[t.jsx("span",{className:"text-[14px] font-medium text-ink",children:x.title}),t.jsx("span",{className:"text-[12px] text-ink-secondary",children:x.hint})]},x.mode)})}),P&&t.jsx("div",{className:"mt-2 text-[12px] text-ink-secondary","data-approval-custom":!0,children:m("botSettings.simple.customMode")})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-3",children:[t.jsx("span",{className:"text-[12px] text-ink-secondary",children:m("botSettings.simple.skills")}),t.jsx("button",{type:"button","data-simple-add-skill":!0,onClick:r,className:"rounded-md px-1.5 py-0.5 text-[12px] font-medium text-accent-text hover:bg-raised",children:m("botSettings.simple.addSkill")})]}),!p.loading&&p.skills.length===0?t.jsx("div",{className:"text-[12.5px] text-ink-tertiary",children:m("botSettings.simple.noSkills")}):t.jsx("div",{className:"flex flex-col gap-2",children:p.skills.map(x=>t.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-hairline/40 bg-inset px-3 py-2.5",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"truncate text-[13.5px] font-medium text-ink",children:x.name}),t.jsx("div",{className:"truncate text-[12px] text-ink-secondary",children:x.description||x.source})]}),t.jsx(Me,{checked:x.enabled,"aria-label":m("botSettings.simple.skillToggle",{name:x.name}),disabled:!!p.working,onClick:()=>{p.toggle(x)}})]},x.name))}),p.error&&!p.reviewing&&t.jsx("div",{role:"alert",className:"mt-2 text-[12px] text-danger",children:p.error})]}),t.jsxs("button",{type:"button","data-simple-all-settings":!0,onClick:l,className:"flex items-center gap-2 rounded-xl border border-dashed border-hairline px-4 py-3 text-left text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:[t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"font-semibold text-ink",children:m("botSettings.simple.allSettings")})," — ",m("botSettings.simple.allSettingsHint")]}),t.jsx(nt,{size:15,className:"shrink-0"})]})]}):t.jsx("div",{role:"tabpanel",className:"mt-5",children:A.length===0?t.jsx("div",{className:"px-4 py-12 text-center text-[13px] leading-relaxed text-ink-secondary",children:m("botSettings.simple.libraryEmpty",{name:e.name})}):t.jsx("div",{className:"flex flex-col gap-1.5",children:A.map(x=>{const L=x.kind==="image"?at:Re;return t.jsxs("button",{type:"button","data-library-item":x.messageId,title:m("botSettings.simple.libraryOpen",{name:x.name}),onClick:()=>o({type:"focusMessage",threadId:e.threadId,messageId:x.messageId}),className:"flex items-center gap-3 rounded-xl border border-hairline/40 bg-inset px-3 py-2.5 text-left hover:bg-raised",children:[t.jsx(L,{size:16,className:"shrink-0 text-ink-secondary"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[13.5px] text-ink",children:x.name}),t.jsx("span",{className:"shrink-0 text-[12px] text-ink-tertiary",children:new Date(x.at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]},x.key)})})})]}),p.reviewing&&t.jsx(bt,{skill:p.reviewing.skill,text:p.reviewing.text,error:p.error,working:p.working===p.reviewing.skill.name,onCancel:()=>p.setReviewing(null),onEnable:()=>{p.enableReviewed()}}),t.jsx(it,{open:f!==null,onCancel:()=>h(null),onConfirm:()=>{const x=f;h(null),x&&o({type:"updateBot",botId:x,patch:{approvalMode:"auto",acknowledgeLocalAuto:!0}})}})]})}const Te=e=>e.labelKey?m(e.labelKey):e.label,hs=new Set(["overview","identity","soul"]);function we(e,s){return s?[e.label,Te(e),...e.keywords].some(i=>i.toLowerCase().includes(s)):!0}function Ss({bot:e,overlay:s=!1}){const{state:i,dispatch:a,flushBotPatches:l}=le(),r=i.botSettingsSection,o=ct(e),y=u.useRef(null),{padClass:c}=dt(),[f,h]=u.useState(""),p=!i.botSettingsExpandAccordion,j=f.trim().toLowerCase(),N=xt(),R=!p&&!hs.has(r),[v,w]=u.useState(R);u.useEffect(()=>{R&&w(!0)},[R,r]);const C=!N&&!v,$=qt(e.id),P=mt(),A=Pt.filter(g=>g.id!=="slack"||$!==null).filter(g=>g.id!=="visibility"||!window.ogb&&P===!0),U=A.filter(g=>we(g,j)),[x,L]=u.useState(null),[Q,z]=u.useState(!1),[oe,X]=u.useState(null),[q,V]=u.useState(!1),[W,Z]=u.useState(null),[ee,K]=u.useState(!1),[J,te]=u.useState(null),S=u.useRef(0),[Y,se]=u.useState(!1),[H,F]=u.useState(null),ce=u.useMemo(()=>JSON.stringify([e.name,e.title,e.description,e.soul,e.computer,e.cloudBackend,e.cwd,e.autoApprove,e.approvePeerComms,e.peers,e.section,e.composio,e.browser,e.mcpServers,e.chiefOfStaff,e.managedSections,e.modelSelection]),[e.name,e.title,e.description,e.soul,e.computer,e.cloudBackend,e.cwd,e.autoApprove,e.approvePeerComms,e.peers,e.section,e.composio,e.browser,e.mcpServers,e.chiefOfStaff,e.managedSections,e.modelSelection]);u.useEffect(()=>{if(r!=="overview"||C)return;let g=!1;return(async()=>(await l(e.id),!g&&(b(`/api/bots/${e.id}/overview`).then(d=>{g||(L(d),z(!1))}).catch(()=>{g||z(!0)}),b(`/api/bots/${e.id}/system-prompt`).then(d=>{g||(X(d),V(!1))}).catch(()=>{g||V(!0)}))))(),()=>{g=!0}},[e.id,r,C,ce,i.routines,i.webhooks,l]);const _=u.useCallback(()=>{const g=++S.current;return K(!1),l(e.id).then(()=>b(`/api/bots/${e.id}/history?limit=100`)).then(n=>{g===S.current&&(Z(n.rows),te(n.revision))}).catch(()=>{g===S.current&&K(!0)})},[e.id,l]);u.useEffect(()=>{if(r==="history")return _(),()=>{S.current++}},[r,_]);const de=async g=>{if(!Y){F(null),se(!0);try{await l(e.id),await b(`/api/bots/${e.id}/history/rollback`,{method:"POST",body:JSON.stringify(g)})}catch(n){a({type:"error",message:n instanceof Error?n.message:"Couldn't undo that change."})}finally{await _(),se(!1)}}};u.useEffect(()=>{if(!p){if(j){h("");return}y.current?.querySelector(`[data-bot-settings-section="${r}"]`)?.scrollIntoView({block:"nearest"})}},[p,r,j]),u.useEffect(()=>{const g=document.activeElement instanceof HTMLElement?document.activeElement:null,n=y.current;n?.focus();const d=M=>{const B=n?.querySelector('[role="dialog"], [role="alertdialog"]');B&&B.getClientRects().length>0||n&&M.target instanceof Node&&!n.contains(M.target)||M.key==="Escape"&&(M.preventDefault(),a({type:"toggleSettings",open:!1}))};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d),g?.focus()}},[a]);const ne=g=>{switch(g){case"overview":return x===null&&Q?t.jsx("div",{className:"rounded-xl bg-card p-4 text-[13px] text-ink-secondary",children:"Couldn’t load the overview."}):t.jsx(Ht,{overview:x,refreshError:x!==null&&Q,prompt:oe,promptError:q,onOpen:n=>a({type:"toggleSettings",open:!0,section:n}),onSetup:o.canCoordinate&&!e.busy?()=>{a({type:"toggleSettings",open:!1}),a({type:"send",botId:e.id,text:"/setup",threadId:e.threadId})}:void 0});case"identity":return t.jsx(Rt,{bot:e,patch:o.patch,activeState:o.activeState,mascotMotion:o.mascotMotion});case"soul":return t.jsx(Mt,{bot:e,patch:o.patch});case"slack":return $?t.jsx(Ft,{managementUrl:$}):null;case"skills":return t.jsx($t,{bot:e});case"memory":return t.jsx(is,{bot:e,active:!p&&r==="memory",onToggle:n=>o.patch({memoryEnabled:n})});case"routines":return t.jsx(Lt,{bot:e,routines:o.botRoutines,runs:i.routineRuns});case"access":return t.jsx(Ct,{bot:e,derived:o});case"model":return t.jsx(St,{bot:e});case"permissions":return t.jsx(wt,{bot:e,derived:o});case"voice":return t.jsx(Nt,{bot:e,derived:o});case"visibility":return t.jsx(jt,{bot:e});case"history":return W===null&&ee?t.jsx("div",{className:"rounded-xl bg-card p-4 text-[13px] text-ink-secondary",children:"Couldn’t load history."}):t.jsx(xs,{bot:e,rows:W,refreshError:W!==null&&ee,onRollback:n=>{J&&F({id:n,expectedRevision:J})},rollingBack:Y||!J});case"usage":return t.jsx(ms,{bot:e});default:return null}};return t.jsxs(t.Fragment,{children:[t.jsx("aside",{ref:y,role:"dialog","aria-labelledby":"bot-settings-title",tabIndex:-1,className:k("animate-panel-in absolute inset-0 z-40 flex h-full min-w-0 flex-col border-l border-hairline/40 bg-panel outline-none focus-visible:outline-none",s?"md:inset-auto md:right-0 md:top-0 md:bottom-0 md:w-[min(420px,42vw)] md:shadow-2xl":"md:static md:z-auto md:w-[min(420px,42vw)] md:shrink-0"),children:C?t.jsx(ps,{bot:e,derived:o,headerClassName:c,onClose:()=>a({type:"toggleSettings",open:!1}),onAllSettings:()=>w(!0),onAddSkill:()=>{w(!0),a({type:"toggleSettings",open:!0,section:"skills"})}}):t.jsxs(t.Fragment,{children:[!N&&t.jsxs("button",{type:"button","data-bot-settings-back":!0,onClick:()=>w(!1),className:k("flex shrink-0 items-center gap-1 self-start px-3 pt-3 text-[13px] text-ink-secondary hover:text-ink",c),children:[t.jsx(ut,{size:15,className:"pointer-events-none"}),m("botSettings.simple.back")]}),t.jsxs("div",{className:k("flex shrink-0 items-center justify-between px-4 py-3",N?c:void 0),children:[t.jsx("span",{id:"bot-settings-title",className:"truncate text-[15px] font-semibold text-ink",children:e.name}),t.jsx("button",{type:"button",onClick:()=>a({type:"toggleSettings",open:!1}),"aria-label":"Close settings",className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",children:t.jsx(Le,{size:18,className:"pointer-events-none"})})]}),t.jsxs("div",{className:"mx-4 mb-2 flex shrink-0 items-center gap-2 rounded-lg border border-transparent bg-control/70 px-2.5 py-2 focus-within:border-focus",children:[t.jsx(pt,{size:14,className:"shrink-0 text-ink-secondary"}),t.jsx("input",{value:f,onChange:g=>{h(g.target.value),a({type:"toggleSettings",open:!0})},onKeyDown:g=>{g.key==="Escape"&&(g.stopPropagation(),f?h(""):a({type:"toggleSettings",open:!1}))},placeholder:"Search","aria-label":"Search settings",className:"w-full bg-transparent text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",children:[U.length===0&&t.jsxs("div",{className:"px-4 py-4 text-[12.5px] leading-relaxed text-ink-secondary",children:["Nothing matches “",f.trim(),"”"]}),A.map(g=>{const{id:n,icon:d}=g,M=Te(g),B=we(g,j);if(!B&&n!=="memory")return null;const E=!p&&r===n;return t.jsxs("div",{"data-bot-settings-section":n,className:"border-b border-hairline/30",hidden:!B,children:[t.jsxs("button",{type:"button",onClick:()=>{if(r===n&&!p){a({type:"toggleSettings",open:!0});return}a({type:"toggleSettings",open:!0,section:n})},"aria-expanded":E,className:k("flex w-full shrink-0 items-center gap-2.5 px-4 py-2.5 text-left text-[14px]",E?"bg-control/60 text-ink":"text-ink-secondary hover:bg-control/40 hover:text-ink"),children:[t.jsx(d,{size:15,className:"shrink-0"}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:M}),t.jsx(Ce,{size:16,className:k("shrink-0 text-ink-secondary transition-transform",E&&"rotate-180")})]}),n==="memory"?t.jsx("div",{hidden:!E,className:"px-4 pb-4 pt-1",children:ne("memory")}):E&&t.jsx("div",{className:"px-4 pb-4 pt-1",children:ne(n)})]},n)})]})]})}),t.jsx(ht,{open:H!==null,title:"Restore previous instructions?",body:"Replaces current SOUL with the version before this change. Current version stays in History.",confirmLabel:"Restore instructions",tone:"neutral",returnFocusRef:y,onCancel:()=>F(null),onConfirm:()=>{H&&de(H)}})]})}export{Ss as BotSettingsDialog};
@@ -1,5 +0,0 @@
1
- import{a0 as V,r as l,j as o,t as u,o as X,x as J,a1 as W,a2 as Q,d as ee,a3 as te,c as $,a4 as ne,u as se,a as re,a5 as ae,l as ie,a6 as oe,X as ce,R as le,a7 as de,a8 as ue}from"./index-C3NqfdVU.js";const pe=/^«redacted \d+ chars»$/,y=e=>pe.test(e)?e:`«redacted ${e.length} chars»`,me=[/\bom[dg]_[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/g,/\bsk-(?:ant-|proj-|live-|test-)?[A-Za-z0-9_-]{16,}/g,/\bxai-[A-Za-z0-9_-]{20,}/g,/\bgsk_[A-Za-z0-9]{40,}/g,/\bcsk-[A-Za-z0-9]{32,}/g,/\bhf_[A-Za-z0-9]{30,}/g,/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g,/\bgithub_pat_[A-Za-z0-9_]{20,}/g,/\bxox[abposr]-[A-Za-z0-9-]{20,}/g,/\bAKIA[0-9A-Z]{16}\b/g,/\bAIza[0-9A-Za-z_-]{30,}/g,/\bnpm_[A-Za-z0-9]{20,}/g,/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g],fe=/(\bBearer\s+)([A-Za-z0-9._~+/=-]{12,})/g,xe=/(-----BEGIN [A-Z ]*PRIVATE KEY-----)([\s\S]*?)(-----END [A-Z ]*PRIVATE KEY-----)/g,ge=/\b((?:[A-Za-z0-9_-]*_)?(?:api[_-]?key|apikey|secret|token|password|passwd|authorization|auth[_-]?token|access[_-]?key|private[_-]?key)s?)(["']?\s*[=:]\s*)(["']?)([A-Za-z0-9._~+/=-]{8,})\3/gi,he=/\b([A-Za-z][A-Za-z0-9_-]*[_-]key)s?(=)(["']?)([A-Za-z0-9._~+/=-]+)\3/gi,ye=/(--(?:token|password|passwd|api-key|apikey|secret|access-key|auth-token)(?:=|\s+))(["']?)(?!-)([A-Za-z0-9._~+/=-]+)\2/gi,be=/(\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@'"]+:)([^\s/@'"«»]+)(@)/gi;function T(e){if(!e||e.length<8)return e;let t=e;t=t.replace(xe,(i,n,s,r)=>`${n}
2
- ${y(s.trim())}
3
- ${r}`);for(const i of me)t=t.replace(i,n=>y(n));return t=t.replace(fe,(i,n,s)=>`${n}${y(s)}`),t=t.replace(ge,(i,n,s,r,f)=>`${n}${s}${r}${y(f)}${r}`),t=t.replace(he,(i,n,s,r,f)=>`${n}${s}${r}${y(f)}${r}`),t=t.replace(ye,(i,n,s,r)=>`${n}${s}${y(r)}${s}`),t=t.replace(be,(i,n,s,r)=>`${n}${y(s)}${r}`),t}const b=(e,t=120)=>e.length>t?`${e.slice(0,t-1)}…`:e,k=e=>e.replace(/\s+/g," ").trim(),D=119;function O(e,t){const i=e?{...e}:{text:"",pendingSpace:!1,overflow:!1};if(i.overflow)return i;for(const n of t){if(/\s/.test(n)){i.text&&(i.pendingSpace=!0);continue}if(i.pendingSpace){if(i.text.length>=D){i.overflow=!0;break}i.text+=" ",i.pendingSpace=!1}if(i.text.length>=D){i.overflow=!0;break}i.text+=n}return i}const P=e=>`${e.text}${e.overflow?"…":""}`;function ke(e){switch(e.type){case"session.started":return{summary:`session ${e.sessionId??"(none)"}${e.model?` · ${e.model}`:""}`,tone:"plain"};case"session.exited":return{summary:`session exited${e.reason?` · ${e.reason}`:""}`,tone:"plain"};case"turn.started":return{summary:`turn started${e.turnId?` · ${e.turnId.slice(0,8)}`:""}`,tone:"boundary"};case"turn.retrying":return{summary:`retrying (${e.reason}) · attempt ${e.attempt} · ${Math.round(e.delayMs/1e3)}s`,tone:"plain"};case"turn.completed":{const t=[e.ok?"turn ok":"turn failed"];return e.stopReason&&t.push(e.stopReason),typeof e.cost=="number"&&t.push(`$${e.cost.toFixed(4)}`),e.denials?.length&&t.push(`${e.denials.length} denied`),{summary:t.join(" · "),tone:e.ok?"boundary":"error"}}case"turn.wait_started":return{summary:`waiting for computer — ${e.holder?`${e.holder.name}${e.holder.task?` (${e.holder.task})`:""}`:"holder unknown"}`,tone:"plain"};case"turn.wait_ended":{const t=Math.round(e.waitedMs/1e3),i=e.waitedMs<1e3?"under a second":`${t}s`;return e.outcome==="acquired"?{summary:`computer acquired after ${i}`,tone:"boundary"}:e.outcome==="parked"?{summary:`computer wait parked after ${i}`,tone:"plain"}:e.outcome==="gave_up"?{summary:`computer wait gave up after ${i}`,tone:"error"}:{summary:`computer wait stopped after ${i}`,tone:"plain"}}case"item.started":return{summary:`${e.itemType}${e.title?`: ${b(k(e.title))}`:" started"}`,tone:"plain"};case"item.updated":return{summary:`${e.itemType} updated${typeof e.tokens=="number"?` · ${e.tokens} tok`:""}`,tone:"plain"};case"item.completed":return e.itemType==="assistant_text"?{summary:`assistant: ${b(k(e.text))}`,tone:"plain"}:e.itemType==="assistant_image"?{summary:"assistant image generated",tone:"plain"}:{summary:`tool ${e.ok?"ok":"failed"}`,tone:e.ok?"plain":"error"};case"content.delta":return{summary:`${e.streamKind}: ${b(k(e.delta))}`,tone:"plain"};case"request.opened":return{summary:`${e.requestType}${e.origin==="output"?" (agent-composed)":""}: ${e.tool} — ${b(k(e.summary))}`,tone:"plain"};case"request.resolved":return{summary:`resolved ${e.behavior} · ${e.source}`,tone:"plain"};case"thread.token-usage.updated":return{summary:`tokens in ${e.input} · out ${e.output}`,tone:"plain"};case"runtime.error":return{summary:`${e.setup?"setup: ":""}${b(k(e.message))}`,tone:"error"};case"runtime.notice":return{summary:`notice: ${b(k(e.message))}`,tone:"plain"};default:return{summary:e.type,tone:"plain"}}}function $e(e){const t=e.msg;if(!t||typeof t!="object")return String(e.msg);const i=typeof t.method=="string"?t.method:void 0,n=typeof t.type=="string"?t.type:void 0,s=t.id!==void 0?` #${String(t.id)}`:"";if(i)return`${i}${s}`;if(typeof t.event=="string"){const r=t.result?.status;return typeof r=="string"?`${t.event} · ${r}`:t.event}if(n){const r=t.message,f=typeof r?.role=="string"?` · ${r.role}`:"",d=typeof t.subtype=="string"?` · ${t.subtype}`:"";return`${n}${d}${f}`}return t.result!==void 0?`result${s}`:t.error!==void 0?`error${s}`:b(k(JSON.stringify(t)))}function ve(e){const t=[];for(const[i,n]of e.entries()){if(n.kind==="native"){t.push({key:`n${i}`,kind:"native",at:n.at,tag:n.data.dir==="out"?"→ out":"← in",summary:`${n.data.source} · ${$e(n.data)}`,tone:"plain",data:n.data,count:1});continue}const s=n.data,r=t.at(-1);if(s.type==="content.delta"&&r?.kind==="runtime"&&r.tag==="content.delta"&&r.data[0]?.type==="content.delta"&&r.data[0].streamKind===s.streamKind){const w=r.data;w.push(s),r.count=w.length,r.preview=O(r.preview,s.delta),r.summary=`${s.streamKind}: ${P(r.preview)}`;continue}const{summary:f,tone:d}=ke(s),g=s.type==="content.delta"?O(void 0,s.delta):void 0,v=s.type==="content.delta"?s.streamKind:void 0;t.push({key:s.eventId||`r${i}`,kind:"runtime",at:n.at,tag:s.type,summary:g&&v?`${v}: ${P(g)}`:f,tone:d,data:s.type==="content.delta"?[s]:s,count:1,preview:g})}return t}function we(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"--:--:--";const i=String(t.getHours()).padStart(2,"0"),n=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0"),r=String(t.getMilliseconds()).padStart(3,"0");return`${i}:${n}:${s}.${r}`}function je(e){const t=[];let i=!1;for(const n of e)if(n.kind==="text"&&n.role==="user"&&n.text?.trim())t.push({id:n.id,at:n.at,label:i?"User input":"Task started",state:"observed",kind:"task"}),i=!0;else if(n.kind==="activity"&&n.tool){const s=V(n.tool.name),r=n.tool.ok===!1||s!==null;t.push({id:n.id,at:n.at,label:T(s??n.tool.name),...n.tool.summary?{command:T(n.tool.summary)}:{},state:r?"failed":n.tool.ok===!0?"complete":"running",kind:"tool"})}else n.kind==="screen"?t.push({id:n.id,at:n.at,label:"Screen observed",state:"observed",kind:"screen"}):n.kind==="text"&&n.role==="bot"&&n.text?.trim()&&t.push({id:n.id,at:n.at,label:"Response recorded",state:"complete",kind:"result"});return t}function Ne(e){return T(e.map(t=>`[${new Date(t.at).toISOString()}] ${t.state} · ${t.label}${t.command?`
4
- ${t.command}`:""}`).join(`
5
- `))}const _e={running:"inspector.run.running",complete:"inspector.run.complete",failed:"inspector.run.failed",observed:"inspector.run.observed"};function Se({events:e}){const[t,i]=l.useState("idle"),n=e.slice(-200),s=async()=>{try{await navigator.clipboard.writeText(Ne(n)),i("copied")}catch{i("failed")}};return o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[o.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[o.jsx("p",{className:"min-w-0 flex-1 text-[12px] leading-relaxed text-ink-secondary",children:u("inspector.run.hint")}),n.length>0&&o.jsx("button",{type:"button",onClick:()=>{s()},"aria-label":u("inspector.run.copy"),title:u("inspector.run.copy"),className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",children:t==="copied"?o.jsx(X,{size:14}):o.jsx(J,{size:14})})]}),t!=="idle"&&o.jsx("p",{role:"status",className:"px-4 pb-2 text-[12px] text-ink-secondary",children:u(t==="copied"?"inspector.run.copied":"inspector.run.copyFailed")}),e.length>n.length&&o.jsx("p",{className:"px-4 pb-2 text-[12px] text-ink-secondary",children:u("inspector.run.recent",{count:n.length})}),n.length===0?o.jsx("p",{className:"px-4 py-6 text-[13px] text-ink-secondary",children:u("inspector.run.empty")}):o.jsx("ol",{"aria-label":u("inspector.run.title"),className:"px-4 pb-4",children:n.map(r=>{const f=r.state==="failed"?W:r.state==="complete"?Q:r.state==="running"?ee:te,d=r.kind==="task"?u("inspector.run.userInput"):r.kind==="screen"?u("inspector.run.screen"):r.kind==="result"?u("inspector.run.response"):r.label;return o.jsxs("li",{className:"border-t border-hairline/30 py-3",children:[o.jsxs("div",{className:"flex items-start gap-2 text-[12px]",children:[o.jsx(f,{size:14,"aria-hidden":"true",className:$("mt-0.5 shrink-0",r.state==="failed"?"text-danger":r.state==="running"?"animate-spin text-accent":"text-ink-secondary")}),o.jsx("span",{className:"min-w-0 flex-1 break-words font-medium text-ink",children:d}),o.jsx("time",{dateTime:new Date(r.at).toISOString(),className:"shrink-0 tabular-nums text-ink-secondary",children:ne(r.at)})]}),r.command&&o.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-all rounded-lg bg-inset p-2 font-mono text-[11.5px] leading-relaxed text-ink",children:r.command}),r.kind==="tool"&&o.jsx("p",{className:$("mt-1 pl-[22px] text-[11px]",r.state==="failed"?"text-danger":"text-ink-secondary"),children:u(_e[r.state])})]},r.id)})})]})}function Re({bot:e}){const{dispatch:t}=se(),{padClass:i}=re(),n=e.threadId,[s,r]=l.useState("run"),f=l.useMemo(()=>je(ae(e)),[e]),[d,g]=l.useState(null),[v,w]=l.useState(null),[U,C]=l.useState(()=>new Set),A=l.useRef(null),z=l.useRef(!0),j=l.useRef(null),N=l.useRef(()=>{}),_=l.useCallback(async()=>{j.current?.abort();const a=new AbortController;j.current=a;try{const c=await fetch(`/api/threads/${n}/events?limit=400`,{signal:a.signal});if(!c.ok)throw new Error(`${c.status}`);const p=await c.json();if(a.signal.aborted)return;g(p),w(null)}catch(c){if(a.signal.aborted)return;w(c instanceof Error?c.message:String(c))}finally{j.current===a&&(j.current=null)}},[n]);l.useEffect(()=>(g(null),C(new Set),z.current=!0,_(),()=>j.current?.abort()),[_]),l.useEffect(()=>{let a=!0,c=null,p=0,h=!1;const K=[],M=x=>{g(m=>{if(m?.entries.some(F=>F.kind==="runtime"&&F.data.eventId===x.eventId))return m;const L={kind:"runtime",at:x.createdAt,data:x};return m?{entries:[...m.entries,L],total:{...m.total,runtime:m.total.runtime+1}}:{entries:[L],total:{runtime:1,native:0}}})},Y=()=>{for(const x of K.splice(0))M(x)},q=async()=>{const x=++p;h=!0,await _(),!(!a||x!==p)&&(h=!1,Y())},S=()=>{q()};N.current=S;const G=ie({onMissedFrames:S,onFrame:x=>{if(x.kind!=="runtime")return;const m=x.event;m.threadId===n&&(h?K.push(m):M(m),(m.type==="turn.completed"||m.type==="runtime.error")&&(c&&clearTimeout(c),c=setTimeout(S,400)))}});return()=>{a=!1,N.current===S&&(N.current=()=>{}),G(),c&&clearTimeout(c)}},[n,_]);const R=l.useMemo(()=>d?d.entries.filter(a=>s==="raw"?a.kind==="native":a.kind==="runtime"):[],[d,s]),E=l.useMemo(()=>ve(R),[R]);l.useEffect(()=>{const a=A.current;a&&z.current&&(a.scrollTop=a.scrollHeight)},[d?.entries.length,E.length,s]);const B=()=>{const a=A.current;a&&(z.current=a.scrollHeight-a.scrollTop-a.clientHeight<40)},H=a=>C(c=>{const p=new Set(c);return p.has(a)?p.delete(a):p.add(a),p}),I=R.length,Z=s==="raw"?d?.total.native??0:d?.total.runtime??0;return o.jsxs("aside",{"aria-label":"Inspector",className:"animate-panel-in absolute inset-0 z-40 flex h-full min-w-0 flex-col border-l border-hairline/40 bg-panel md:static md:z-auto md:w-[min(460px,45vw)] md:shrink-0",children:[o.jsxs("div",{className:$("flex items-center justify-between px-4 py-3",i),children:[o.jsxs("span",{className:"flex items-center gap-2 text-[15px] font-semibold text-ink",children:[o.jsx(oe,{size:16,className:"text-ink-secondary"})," Inspector"]}),o.jsx("button",{onClick:()=>t({type:"toggleInspector",open:!1}),"aria-label":"Close the Inspector",title:"Close the Inspector",className:"rounded-md p-1 text-ink-secondary hover:bg-raised hover:text-ink",children:o.jsx(ce,{size:18})})]}),o.jsxs("div",{className:"flex items-center gap-2 border-b border-hairline/40 px-4 pb-3",children:[o.jsx("div",{role:"tablist","aria-label":u("inspector.views"),className:"flex rounded-lg bg-inset p-0.5",onKeyDown:a=>{const c=Array.from(a.currentTarget.querySelectorAll('[role="tab"]')),p=c.indexOf(document.activeElement),h=a.key==="ArrowRight"?(p+1)%c.length:a.key==="ArrowLeft"?(p+c.length-1)%c.length:a.key==="Home"?0:a.key==="End"?c.length-1:-1;h<0||(a.preventDefault(),c[h].focus(),c[h].click())},children:["run","events","raw"].map(a=>o.jsx("button",{type:"button",role:"tab",id:`inspector-tab-${a}`,"aria-selected":s===a,"aria-controls":`inspector-panel-${a}`,tabIndex:s===a?0:-1,onClick:()=>r(a),className:$("rounded-md px-2.5 py-1 text-[12px] font-medium capitalize",s===a?"bg-raised text-ink":"text-ink-secondary hover:text-ink"),children:a==="run"?u("inspector.run.title"):a},a))}),s!=="run"&&o.jsx("span",{className:"ml-auto text-[11px] text-ink-secondary",children:d?I<Z?`last ${I} of ${Z}`:`${I} entries`:"loading…"}),s!=="run"&&o.jsx("button",{onClick:()=>N.current(),className:"rounded-md p-1 text-ink-secondary hover:bg-raised hover:text-ink",title:"Reload from disk",children:o.jsx(le,{size:14})})]}),o.jsx("div",{role:"tabpanel",id:`inspector-panel-${s}`,"aria-labelledby":`inspector-tab-${s}`,tabIndex:0,className:"flex min-h-0 flex-1 flex-col outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60",children:s==="run"?o.jsx(Se,{events:f},n):o.jsxs("div",{ref:A,onScroll:B,className:"min-h-0 flex-1 overflow-y-auto font-mono text-[11.5px]",children:[v&&o.jsxs("div",{className:"px-4 py-3 text-danger",children:["couldn't load: ",v]}),d&&E.length===0&&!v&&o.jsx("div",{className:"px-4 py-6 text-ink-secondary",children:s==="raw"?"No native protocol messages recorded for this thread yet.":"No runtime events for this thread yet."}),E.map(a=>o.jsx(Ae,{row:a,open:U.has(a.key),onToggle:()=>H(a.key)},a.key))]})})]})}function Ae({row:e,open:t,onToggle:i}){return o.jsxs("div",{className:$("border-b border-hairline/20",e.tone==="boundary"&&"bg-raised/40",e.tone==="error"&&"bg-danger/10"),children:[o.jsxs("button",{onClick:i,className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-raised/60",children:[o.jsx("span",{className:"mt-[1px] shrink-0 text-ink-secondary",children:t?o.jsx(de,{size:12}):o.jsx(ue,{size:12})}),o.jsx("span",{className:"shrink-0 tabular-nums text-ink-secondary",children:we(e.at)}),o.jsxs("span",{className:$("shrink-0 rounded px-1 text-[10.5px]",e.kind==="native"?"bg-accent/15 text-accent":e.tone==="error"?"bg-danger/20 text-danger":"bg-inset text-ink-secondary"),children:[e.tag,e.count>1?` ×${e.count}`:""]}),o.jsx("span",{className:$("min-w-0 flex-1 truncate",e.tone==="error"?"text-danger":"text-ink"),children:e.summary})]}),t&&o.jsx("pre",{className:"max-h-[50vh] overflow-auto whitespace-pre-wrap break-all border-t border-hairline/20 bg-app px-3 py-2 text-[11px] leading-relaxed text-ink",children:JSON.stringify(e.data,null,2)})]})}export{Re as InspectorPanel};
@@ -1,2 +0,0 @@
1
- import{g as T,a9 as ne,Y as oe,$ as ie,t as i,r as p,aa as re,ab as le,ac as ce,j as e,X as te,o as de,d as z,ad as pe,ae as ue,af as me,ag as he,u as W,ah as xe,c as J,ai as fe,aj as be,ak as ge,al as ye,am as X,P as ve,T as se,an as we}from"./index-C3NqfdVU.js";import{I as ke,i as I,S as je,a as Se,A as Ne,M as Ee,P as Ce,V as Pe,v as Ae}from"./VisibilitySection-DT0FqPvu.js";import{B as Oe,a as Te}from"./RoutinesPage-BM2D4qGi.js";import"./image-plus-BbVjGHin.js";import"./CloudBackendPicker-iezpJFpF.js";import"./WebhooksPanel--YQyCjKO.js";const Be={profile:{},memory:{},skills:[],routines:[]},Re=t=>({name:t.name,prompt:t.prompt,schedule:t.schedule,enabled:t.enabled,runOn:t.runOn,durationMinutes:t.durationMinutes,timeoutMinutes:t.timeoutMinutes,overlap:t.overlap,attachments:t.attachments});class Z{constructor(s,a,n=T){this.changed=a,this.network=n,this.template=structuredClone(s),this.routines=s.routines.map(r=>this.routine({...r,botId:this.id}))}changed;network;id=`draft-${crypto.randomUUID()}`;template;consent={};routines;preset;avatarFile;avatarObjectUrl;get bot(){const{computer:s,cwd:a,peers:n,toolScope:r,...o}=this.template.profile;return{id:this.id,threadId:this.id,name:"",title:"",description:"",soul:"",color:"green",notifications:!0,unread:!1,messages:[],modelSelection:{instanceId:"",model:""},...o,computer:s??void 0,cwd:a??void 0,peers:n??void 0,toolScope:r??void 0}}patch(s){const{confirmFullAccess:a,acknowledgeLocalAuto:n,acknowledgePeerScope:r,applyToAllThreads:o,autoApprove:c,...l}=s;a!==void 0&&(this.consent.confirmFullAccess=a),n!==void 0&&(this.consent.acknowledgeLocalAuto=n),r!==void 0&&(this.consent.acknowledgePeerScope=r),c!==void 0&&l.approvalMode===void 0&&(l.approvalMode=c?"auto":"ask"),this.template.profile={...this.template.profile,...l},this.changed()}setModel(s){this.patch({modelSelection:s})}choosePreset(s){this.preset=s,this.changed()}setMemory(s,a){a===null?delete this.template.memory[s]:this.template.memory[s]=a,this.changed()}setRoutineEnabled(s,a){this.routines=this.routines.map(n=>n.id===s?{...n,enabled:a}:n),this.changed()}removeRoutine(s){this.routines=this.routines.filter(a=>a.id!==s),this.changed()}export(){return structuredClone({...this.template,routines:this.routines.map(Re)})}uploadAvatar=async s=>{if(!["image/png","image/jpeg","image/gif","image/webp"].includes(s.type))throw new Error("Choose a PNG, JPEG, GIF, or WebP image");if(s.size>10*1024*1024)throw new Error("Choose an image smaller than 10 MiB");return this.avatarObjectUrl&&URL.revokeObjectURL(this.avatarObjectUrl),this.avatarFile=s,this.avatarObjectUrl=URL.createObjectURL(s),this.avatarObjectUrl};dispose(){this.avatarObjectUrl&&URL.revokeObjectURL(this.avatarObjectUrl)}routine(s,a){const{groupId:n,resultsThreadId:r,schedule:o,...c}=s,l=o.type==="interval"?{...o,weekdays:o.weekdays??void 0,window:o.window??void 0,endsAt:o.endsAt??void 0}:o;return{id:a?.id??`draft-${crypto.randomUUID()}`,createdAt:a?.createdAt??Date.now(),updatedAt:Date.now(),nextRunAt:null,runOn:"maus",...a,...c,enabled:s.enabled??a?.enabled??!0,target:"bot",botId:this.id,timeoutMinutes:s.timeoutMinutes??void 0,durationMinutes:s.durationMinutes??a?.durationMinutes??30,schedule:l}}request=async(s,a)=>{const n=a?.method??"GET",r=typeof a?.body=="string"?JSON.parse(a.body):{},o=`/api/bots/${this.id}`;let c;if(s===o&&n==="PATCH")this.patch(r),c={bot:this.bot};else if(s===`${o}/soul`&&n==="GET")c={soul:this.bot.soul,revision:"draft",bytes:new TextEncoder().encode(this.bot.soul).length,limit:24e3,file:"",drift:!1};else if(s===`${o}/skills`&&n==="GET")c={skills:this.template.skills,staged:[]};else if(s===`${o}/skills`&&n==="POST"){const l=await this.network("/api/bot-defaults/skills/preview",{method:"POST",body:JSON.stringify(r)}),y=new Set(this.template.skills.map(m=>m.name));if(l.skills.some(m=>y.has(m.name)))throw new Error("A skill with this name is already in the draft");this.template.skills.push(...l.skills),this.changed(),c={installed:l.skills}}else if(s.startsWith(`${o}/skills/`)){const l=decodeURIComponent(s.slice(`${o}/skills/`.length)),y=this.template.skills.find(m=>m.name===l);if(!y)throw new Error("No such draft skill");if(n==="GET")c={text:y.text};else if(n==="PATCH"&&typeof r.enabled=="boolean")y.enabled=r.enabled,this.changed(),c={ok:!0};else if(n==="DELETE")this.template.skills=this.template.skills.filter(m=>m!==y),this.changed(),c={ok:!0};else throw new Error("Unsupported draft skill operation")}else if(s===`${o}/avatar/generate`&&n==="POST"){const{name:l,title:y,description:m}=this.bot,{dataUrl:E}=await this.network("/api/bot-defaults/avatar",{method:"POST",body:JSON.stringify({profile:{name:l,title:y,description:m},prompt:r.prompt})}),P=await(await fetch(E)).blob(),b=await this.uploadAvatar(new File([P],"avatar.png",{type:P.type}));c={avatarUrl:b,bot:{...this.bot,avatarUrl:b,avatarCrop:"circle"}}}else if(s==="/api/routines"&&n==="POST"||s.startsWith("/api/routines/draft-")&&n==="PATCH"){if(r.target&&r.target!=="bot")throw new Error("A new bot's routine must target that bot");if(r.botId!==this.id)throw new Error("Routine belongs to another bot");const l=this.routines.find(m=>s===`/api/routines/${m.id}`);if(n==="PATCH"&&!l)throw new Error("No such draft routine");const y=this.routine(r,l);this.routines=[...this.routines.filter(m=>m.id!==y.id),y],this.changed(),c={routine:y}}else throw new Error("This operation requires a created bot");return c}}async function ae(t){const s=t.export();if(s.profile.avatarUrl?.startsWith("blob:")){if(!t.avatarFile)throw new Error("Choose the avatar image again");const a=await oe(t.avatarFile),n=a&&ie(a.path);if(!n)throw new Error("Could not store the avatar image");s.profile.avatarUrl=n}return s}async function Me(t,s=T,a=ne,n=typeof window>"u"?void 0:window.ogb?.approvals,r){const o=await ae(t),{chiefOfStaff:c,managedSections:l,toolScope:y,...m}=o.profile;if(!m.name?.trim())throw new Error("Give the bot a name");const E=t.preset;let b=(await s("/api/bots",{method:"POST",body:JSON.stringify({name:m.name,title:m.title,description:m.description,modelSelection:m.modelSelection,section:m.section,requireAvailableModel:!0,useDefaults:!1,...r!==void 0?{visibility:r}:{},...Object.hasOwn(o.profile,"toolScope")?{settings:{toolScope:y}}:{},...E?{preset:E.id}:{}})})).bot;const x=[],f=[];try{const g=await a(b.id,{...m,modelSelection:b.modelSelection,...t.consent},new AbortController().signal,s,n,b);if(b={...b,...g},m.approvalMode==="full"||m.approvalMode==="custom"){if(g.approvalMode!==m.approvalMode||!n)throw new Error("The bot's requested approval level was not granted");if((await n.setMode(b.id,m.approvalMode,{threadId:b.threadId,threadOnly:!0,acknowledgeLocalAuto:t.consent.acknowledgeLocalAuto===!0})).approvalMode!==m.approvalMode)throw new Error("The initial thread's requested approval level was not granted")}for(const[u,k]of Object.entries(o.memory))E?.notes.includes(u)||await s(`/api/bots/${b.id}/memory/file`,{method:"PUT",body:JSON.stringify({path:u,text:k})});for(const u of o.skills)E?.skills.includes(u.name)||await s(`/api/bots/${b.id}/skill-template`,{method:"POST",body:JSON.stringify(u)});for(const u of o.routines){const k=await s("/api/routines",{method:"POST",body:JSON.stringify({...u,botId:b.id,enabled:!1})});x.push({id:k.routine.id,enabled:u.enabled!==!1})}}catch(g){const u=[];for(const v of x)try{await s(`/api/routines/${v.id}`,{method:"DELETE"})}catch{u.push(`routine ${v.id}`)}try{await s(`/api/bots/${b.id}`,{method:"DELETE"})}catch{u.push(`bot ${b.name} (${b.id})`)}const k=g instanceof Error?g.message:String(g);throw new Error(u.length?`${k}. Cleanup failed for ${u.join(", ")}; remove them before retrying.`:k)}if(c)try{const g=await s(`/api/bots/${b.id}`,{method:"PATCH",body:JSON.stringify({chiefOfStaff:c,managedSections:l,acknowledgePeerScope:!0})});b={...b,...g.bot}}catch(g){f.push(`Review this bot's Chief of Staff setting: ${g instanceof Error?g.message:String(g)}`)}for(const g of x.filter(u=>u.enabled))try{await s(`/api/routines/${g.id}`,{method:"PATCH",body:JSON.stringify({enabled:!0})})}catch(u){f.push(`Could not activate a routine: ${u instanceof Error?u.message:String(u)}`)}return{bot:b,warnings:f}}function De(t){const s=[];for(const a of t){const n=a.source==="org"?i("newBot.presetsFromOrganization",{name:a.publisherName??a.packageName}):i("newBot.presetsImported"),r=s.find(o=>o.label===n);r?r.presets.push(a):s.push({label:n,presets:[a]})}return s}function $e(t){const s={name:t.bot.name??t.name,title:t.bot.title??"",description:t.bot.description??"",soul:t.bot.soul??""},a=t.bot.appearance;return a&&(s.color=a.color,s.mascotExpression=a.mascotExpression??null,a.mascotBody&&(s.mascotBody=a.mascotBody)),s}function Ue(t){const s=t.bot.appearance?.avatar;if(!s)return null;let a;try{a=atob(s.data)}catch{return null}const n=new Uint8Array(a.length);for(let r=0;r<a.length;r+=1)n[r]=a.charCodeAt(r);return new File([n],`preset.${s.mime.slice(6)}`,{type:s.mime})}function Le(t){const s=[t.source==="org"&&t.publisherName?i("newBot.presetFromOrg",{package:t.packageName,release:t.release,publisher:t.publisherName}):i("newBot.presetFrom",{package:t.packageName,release:t.release})];t.description&&s.push(t.description);const a=t.skills.map(n=>n.name).join(", ");return a&&s.push(i(t.skillsEnabled?"newBot.presetSkillsOn":"newBot.presetSkillsOff",{names:a})),t.notes.length&&s.push(i("newBot.presetNotes",{names:t.notes.join(", ")})),t.playbooks.length&&s.push(i("newBot.presetPlaybooks",{names:t.playbooks.join(", ")})),s.push(i("newBot.presetKeeps")),s}function Ie(t){return{id:t.id,skills:t.skills.map(s=>s.name),notes:[...t.notes]}}function Q(t){const s=a=>a?.trim()?a.trim():void 0;return{format:"package",version:2,kind:"library",name:s(t.name),presetName:s(t.name),presetDescription:s(t.description),release:s(t.release),notes:s(t.notes),includeMemory:t.includeNotes,...t.picture?{presetAvatar:t.picture}:{},...t.dryRun?{dryRun:!0}:{}}}function ee({preview:t,localSkips:s}){const a=t.document.package.presets?.[0],n=Object.keys(a?.seed?.memory??{}).length,r=[[i("teamShare.part.skills"),a?.skills?.length?`${a.skills.length} · ${a.skills.join(", ")}`:"0"],[i("teamShare.part.notes"),n?String(n):i("teamShare.none")],[i("teamShare.part.pictures"),a?.bot.appearance?.avatar?i("teamShare.yes"):i("teamShare.none")]],o=[...s,...t.skipped.map(c=>pe(c,t.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:i("teamShare.included")}),e.jsx("dl",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1.5 rounded-xl bg-raised/45 px-4 py-3 text-[12.5px]",children:r.map(([c,l])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:c}),e.jsx("dd",{className:"max-w-[300px] truncate text-right text-ink",title:l,children:l})]},c))}),e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[12.5px] leading-relaxed text-ink-secondary",children:[e.jsx(ue,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:i("presetShare.never")})]}),t.redacted.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[12.5px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:i("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:t.redacted.map(c=>e.jsx("li",{children:me(c,t.document)},c))})]}),o.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[12.5px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:i("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:o.map((c,l)=>e.jsx("li",{children:c},`${c}-${l}`))})]})]})}function Fe({onClose:t}){const s=p.useRef(null),[a,n]=p.useState(""),[r,o]=p.useState(""),[c,l]=p.useState(""),[y,m]=p.useState(""),[E,P]=p.useState(!0),[b,x]=p.useState(!0),[f,g]=p.useState(null),[u,k]=p.useState(null),[v,R]=p.useState(!1),[M,B]=p.useState(null),[D,$]=p.useState(""),U=p.useRef(0);p.useEffect(()=>{let d=!1;return T("/api/bot-defaults").then(async({defaults:S})=>{!d&&S.profile.name?.trim()&&n(A=>A||S.profile.name.trim());const j=await re([{id:"defaults",avatarUrl:S.profile.avatarUrl,avatarCrop:S.profile.avatarCrop}]);d||g({dataUrl:j.avatars.defaults,skipped:j.skipped.map(A=>`${i("teamShare.field.picture")} — ${le(`teamShare.skip.${A.reason}`,A.reason)}`)})}).catch(()=>{d||g({skipped:[]})}),()=>{d=!0}},[]);const F=d=>({name:a,description:r,release:c,notes:y,includeNotes:E,dryRun:d,...b&&f?.dataUrl?{picture:f.dataUrl}:{}});p.useEffect(()=>{if(!f)return;const d=++U.current,S=window.setTimeout(()=>{T("/api/teams/export",{method:"POST",body:JSON.stringify(Q({...F(!0),release:void 0}))}).then(j=>{d===U.current&&(k(j),$(""),l(A=>A||j.document.package.release))}).catch(j=>{d===U.current&&(k(null),$(j instanceof Error?j.message:String(j)))})},250);return()=>window.clearTimeout(S)},[f,E,b]);const H=async()=>{if(!v){R(!0),$("");try{const d=await T("/api/teams/export",{method:"POST",body:JSON.stringify(Q(F(!1)))});he(d.filename,d.document),B(d)}catch(d){$(d instanceof Error?d.message:String(d))}finally{R(!1)}}};p.useEffect(()=>{const d=document.activeElement instanceof HTMLElement?document.activeElement:null;return s.current?.focus(),()=>{d?.isConnected&&d.focus()}},[]);const L=b?f?.skipped??[]:[],O="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[13.5px] text-ink disabled:opacity-60";return ce.createPortal(e.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/55 p-4",onMouseDown:d=>{d.target===d.currentTarget&&!v&&t()},children:e.jsxs("div",{ref:s,role:"dialog","aria-modal":"true","aria-labelledby":"share-preset-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:d=>{if(d.key==="Escape"&&!v&&(d.stopPropagation(),t()),d.key==="Tab"){const S=s.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!S?.length)return;const j=S[0],A=S[S.length-1];d.shiftKey&&document.activeElement===j?(d.preventDefault(),A.focus()):!d.shiftKey&&document.activeElement===A&&(d.preventDefault(),j.focus())}},children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-6 pb-2 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"share-preset-title",className:"text-[17px] font-semibold",children:i("presetShare.title")}),e.jsx("p",{className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:i("presetShare.intro")})]}),e.jsx("button",{"aria-label":i("presetShare.close"),disabled:v,onClick:t,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(te,{size:18})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:M?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"flex items-center gap-2 text-[13.5px] font-medium text-ink",children:[e.jsx(de,{size:16,className:"text-success"}),i("teamShare.saved",{filename:M.filename})]}),e.jsx("p",{className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:i("presetShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(ee,{preview:M,localSkips:L})})]}):e.jsxs(e.Fragment,{children:[u?e.jsx(ee,{preview:u,localSkips:L}):!D&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(z,{size:15,className:"animate-spin"}),i("presetShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:v,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:b,onChange:d=>x(d.target.checked)}),i("presetShare.includePicture")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:E,onChange:d=>P(d.target.checked)}),i("presetShare.includeNotes")]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-[12.5px] text-ink-secondary",children:[i("presetShare.name"),e.jsx("input",{value:a,maxLength:100,disabled:v,onChange:d=>n(d.target.value),className:O})]}),e.jsxs("label",{className:"block text-[12.5px] text-ink-secondary",children:[i("teamShare.release"),e.jsx("input",{value:c,maxLength:20,disabled:v,placeholder:"1.0.0",onChange:d=>l(d.target.value),className:O})]})]}),e.jsxs("label",{className:"mt-3 block text-[12.5px] text-ink-secondary",children:[i("presetShare.description"),e.jsx("input",{value:r,maxLength:300,disabled:v,onChange:d=>o(d.target.value),className:O})]}),e.jsxs("label",{className:"mt-3 block text-[12.5px] text-ink-secondary",children:[i("teamShare.notes"),e.jsx("textarea",{value:y,maxLength:4e3,rows:2,disabled:v,onChange:d=>m(d.target.value),className:O})]})]})}),D&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[12.5px] text-danger",children:D}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:M?e.jsx("button",{onClick:t,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:i("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:v,onClick:t,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:i("common.cancel")}),e.jsxs("button",{disabled:v||!u,onClick:()=>{H()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[v&&e.jsx(z,{size:14,className:"animate-spin"}),v?i("teamShare.saving"):i("teamShare.save")]})]})})]})}),document.body)}const ze=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"];function Je(){const{state:t,dispatch:s}=W(),a=p.useRef(null),n=()=>s({type:"toggleNewBot",open:!1});return p.useEffect(()=>{const r=document.activeElement instanceof HTMLElement?document.activeElement:null;return a.current?.focus(),()=>{r?.isConnected&&r.focus()}},[]),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:e.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":i("newBot.create"),tabIndex:-1,className:"w-full max-w-sm rounded-2xl border border-hairline/50 bg-panel p-5 text-ink shadow-2xl",onKeyDown:r=>{if(r.key==="Escape"&&(r.stopPropagation(),n()),r.key==="Tab"){const o=r.currentTarget,c=[...o.querySelectorAll("button:not([disabled])")];r.shiftKey&&(document.activeElement===o||document.activeElement===c[0])?(r.preventDefault(),c.at(-1)?.focus()):!r.shiftKey&&document.activeElement===c.at(-1)&&(r.preventDefault(),c[0]?.focus())}},children:[e.jsx("h2",{className:"mb-4 text-[17px] font-semibold",children:i("newBot.create")}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:n,className:"rounded-lg px-3 py-2",children:i("common.cancel")}),e.jsx("button",{type:"button",disabled:t.botCreationPending,onClick:()=>s({type:"newBot",onCreated:n}),className:"rounded-lg bg-accent px-4 py-2 text-white disabled:opacity-40",children:i("newBot.create")})]})]})})}function He(t={}){return typeof window<"u"&&window.ogb?.remoteClient?.active?e.jsx(Je,{}):e.jsx(Ge,{...t})}function Ge({defaultsMode:t=!1,onClose:s,section:a,onCreated:n,preserveSelection:r=!1}={}){const o=W(),[,c]=p.useState(0),[l,y]=p.useState(()=>new Z(Be,()=>c(h=>h+1))),[m,E]=p.useState("Identity"),[P,b]=p.useState(!1),[x,f]=p.useState(!1),g=x||o.state.botCreationPending,u=p.useRef(!1),k=p.useRef(!0),[v,R]=p.useState(""),[M,B]=p.useState(null),[D,$]=p.useState("everyone"),[U,F]=p.useState(""),H=xe(),L=!t&&typeof window<"u"&&!window.ogb&&H===!0,O=p.useRef(null),d=p.useRef(()=>{});d.current=()=>{s?s():o.dispatch({type:"toggleNewBot",open:!1})},p.useEffect(()=>{let h=!1;return T("/api/bot-defaults").then(N=>{if(h)return;const w=structuredClone(N.defaults);w.profile.modelSelection??=N.modelSelection,t||(w.profile.name=w.profile.name?.trim()||N.suggestedName),a!==void 0&&(w.profile.section=a),y(new Z(w,()=>c(C=>C+1))),b(!0)}).catch(N=>{h||R(String(N))}),()=>{h=!0}},[t,a]),p.useEffect(()=>(k.current=!0,()=>{k.current=!1}),[]),p.useEffect(()=>()=>l.dispose(),[l]),p.useEffect(()=>{g&&O.current?.focus()},[g]),p.useEffect(()=>{const h=document.activeElement instanceof HTMLElement?document.activeElement:null;O.current?.focus();const N=w=>{const C=O.current;if(!C||w.target instanceof Node&&!C.contains(w.target))return;const Y=C.querySelector('[role="dialog"], [role="alertdialog"]');if(Y&&Y.getClientRects().length||(w.key==="Escape"&&(w.preventDefault(),d.current()),w.key!=="Tab"))return;const q=[...C.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(V=>V.getClientRects().length&&!V.closest("[hidden],fieldset:disabled")),G=q[0],K=q.at(-1);if(!G||!K){w.preventDefault(),C.focus();return}w.shiftKey&&(document.activeElement===G||document.activeElement===C)?(w.preventDefault(),K.focus()):!w.shiftKey&&(document.activeElement===K||document.activeElement===C)&&(w.preventDefault(),G.focus())};return window.addEventListener("keydown",N),()=>{window.removeEventListener("keydown",N),h?.isConnected&&h.focus()}},[]);const S=async()=>{if(!P||u.current||o.state.botCreationPending)return;if(!t&&l.bot.approvalMode==="full"&&!l.consent.confirmFullAccess){B("full");return}if(!t&&l.bot.approvalMode==="auto"&&l.bot.computer==="local"&&!l.consent.acknowledgeLocalAuto){B("local");return}const h=L?Ae(D,U):null;if(h&&!h.ok){R(i("botSettings.visibility.needPeople"));return}u.current=!0,f(!0),R(""),o.dispatch({type:"botCreationPending",on:!0});try{if(t)await T("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await ae(l)})});else{const{bot:N,warnings:w}=await Me(l,void 0,void 0,void 0,h?.ok?h.visibility:void 0);o.dispatch({type:"botAdded",bot:N,preserveSelection:r}),w.length&&o.dispatch({type:"error",message:w.join(`
2
- `)});try{await n?.(N)}catch(C){o.dispatch({type:"error",message:C instanceof Error?C.message:String(C)})}}u.current=!1,k.current&&d.current()}catch(N){k.current&&R(N instanceof Error?N.message:String(N))}finally{u.current=!1,o.dispatch({type:"botCreationPending",on:!1}),k.current&&f(!1)}},j=l.bot,A={...o,state:{...o.state,bots:[j,...o.state.bots],routines:l.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>j,dispatch:h=>{h.type==="updateBot"&&h.botId===l.id?l.patch(h.patch):h.type==="setModel"&&h.botId===l.id?(l.setModel(h.selection),h.resetApprovalToAsk&&l.patch({approvalMode:"ask"})):h.type==="routinePatched"||h.type==="toggleSettings"||o.dispatch(h)}},_=t?i("newBot.defaults"):i("sidebar.newBot");return e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60 p-3 sm:p-5",children:e.jsxs("div",{ref:O,role:"dialog","aria-modal":"true","aria-label":_,"aria-busy":g,tabIndex:-1,className:"flex h-[min(760px,94dvh)] w-full max-w-[900px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:_}),e.jsx("button",{type:"button",onClick:()=>d.current(),"aria-label":i("common.close"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",children:e.jsx(te,{size:18,className:"pointer-events-none"})})]}),L&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 pt-3 text-[13px] text-ink-secondary","data-new-bot-visibility":!0,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[i("botSettings.visibility.title"),e.jsxs("select",{value:D,disabled:g,onChange:h=>$(h.target.value),className:"rounded-lg border border-hairline/40 bg-inset px-2 py-1.5 text-[13px] text-ink focus:outline-none",children:[e.jsx("option",{value:"everyone",children:i("botSettings.visibility.everyone")}),e.jsx("option",{value:"admins",children:i("botSettings.visibility.admins")}),e.jsx("option",{value:"people",children:i("botSettings.visibility.people")})]})]}),D==="people"&&e.jsx("input",{value:U,disabled:g,onChange:h=>F(h.target.value),placeholder:i("botSettings.visibility.peoplePlaceholder"),"aria-label":i("botSettings.visibility.peopleLabel"),className:"min-w-[16rem] flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[e.jsx("nav",{"aria-label":i("newBot.sections"),className:"flex shrink-0 gap-1 overflow-x-auto border-b border-hairline/40 p-2 sm:w-40 sm:flex-col sm:border-b-0 sm:border-r",children:ze.map(h=>e.jsx("button",{type:"button",onClick:()=>E(h),"aria-current":m===h?"page":void 0,className:J("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",m===h?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:h},h))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!P&&!v&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(z,{size:16,className:"animate-spin"}),i("newBot.loading")]}),P&&e.jsx("fieldset",{disabled:g,className:"min-w-0",children:e.jsx(fe,{value:A,children:e.jsx(Oe.Provider,{value:{request:l.request,draft:!0,uploadAvatar:l.uploadAvatar},children:e.jsx(Ke,{active:m,draft:l,defaultsMode:t})})})})]})]}),v&&e.jsx("p",{role:"alert",className:"max-h-24 overflow-y-auto border-t border-hairline/40 px-5 py-3 text-[13px] text-danger",children:v}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:()=>d.current(),className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-control",children:i("common.cancel")}),e.jsxs("button",{type:"button",disabled:!P||g||!t&&!j.name.trim(),onClick:()=>{S()},className:"flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[g&&e.jsx(z,{size:15,className:"animate-spin"}),i(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(be,{open:M==="full",onCancel:()=>B(null),onConfirm:()=>{l.consent.confirmFullAccess=!0,B(null),S()}}),e.jsx(ge,{open:M==="local",onCancel:()=>B(null),onConfirm:()=>{l.consent.acknowledgeLocalAuto=!0,B(null),S()}})]})})}function Ke({active:t,draft:s,defaultsMode:a}){const n=s.bot,{state:r}=W(),o=ye(n);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(We,{draft:s,defaultsMode:a}),e.jsx(ke,{bot:n,patch:o.patch,activeState:o.activeState,mascotMotion:null,namePlaceholder:a?i("newBot.randomName"):void 0}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:["Team",e.jsxs("select",{className:J(I,"mt-1.5"),value:n.section??"",onChange:c=>s.patch({section:c.target.value}),children:[e.jsx("option",{value:"",children:"General"}),[...new Set([...r.sections??[],...r.bots.map(c=>c.section??"")])].filter(Boolean).map(c=>e.jsx("option",{children:c},c))]})]})]}):t==="Soul"?e.jsx(je,{bot:n,patch:o.patch}):t==="Skills"?e.jsx(Se,{bot:n}):t==="Memory"?e.jsx(_e,{draft:s}):t==="Routines"?e.jsx(Ye,{draft:s}):t==="Access"?e.jsx(Ne,{bot:n,derived:o}):t==="Model"?e.jsx(Ee,{bot:n}):t==="Permissions"?e.jsx(Ce,{bot:n,derived:o}):e.jsx(Pe,{bot:n,derived:o})}function We({draft:t,defaultsMode:s}){const[a,n]=p.useState([]),[r,o]=p.useState(0),[c,l]=p.useState(""),y=p.useRef(!1);p.useEffect(()=>{if(s)return;let x=!1;return T("/api/bot-presets").then(f=>{x||n(f.presets)}).catch(()=>{x||n([])}),()=>{x=!0}},[s,r]);const m=t.preset?a.find(x=>x.id===t.preset.id):void 0,E=async x=>{l("");const f=x.startsWith("preset:")?a.find(u=>u.id===x.slice(7)):void 0;if(!f){t.choosePreset(void 0);const u=X.find(k=>k.id===x);u&&t.patch(we(u));return}t.patch($e(f)),t.choosePreset(Ie(f));const g=Ue(f);try{g?(t.patch({avatarUrl:await t.uploadAvatar(g),avatarCrop:f.bot.appearance.avatar.crop}),y.current=!0):y.current&&(t.patch({avatarUrl:""}),y.current=!1)}catch(u){l(u instanceof Error?u.message:String(u))}},P=async x=>{l("");try{await T(`/api/bot-presets/${encodeURIComponent(x.id)}`,{method:"DELETE"}),t.preset?.id===x.id&&t.choosePreset(void 0),o(f=>f+1)}catch(f){l(f instanceof Error?f.message:String(f))}},b=X.map(x=>e.jsx("option",{value:x.id,children:x.title},x.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[i("newBot.startingRole"),e.jsxs("select",{className:J(I,"mt-1.5"),value:t.preset?`preset:${t.preset.id}`:"",onChange:x=>{E(x.target.value)},children:[e.jsx("option",{value:"",children:i("newBot.customSettings")}),De(a).map(x=>e.jsx("optgroup",{label:x.label,children:x.presets.map(f=>e.jsx("option",{value:`preset:${f.id}`,children:f.name},f.id))},x.label)),a.length?e.jsx("optgroup",{label:i("newBot.builtInRoles"),children:b}):b]})]}),m&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-lg bg-card px-3 py-2.5 text-[12.5px] text-ink-secondary","data-new-bot-preset":!0,children:[Le(m).map((x,f)=>e.jsx("p",{className:"break-words",children:x},f)),m.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{P(m)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:i("newBot.presetRemove")})]}),c&&e.jsx("p",{role:"alert",className:"mt-2 text-[12.5px] text-danger",children:c})]})}function _e({draft:t}){const[s,a]=p.useState("MEMORY.md"),[n,r]=p.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx("select",{className:I,"aria-label":"Memory file",value:s,onChange:o=>a(o.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(o=>e.jsx("option",{children:o},o))}),e.jsx("textarea",{className:J(I,"min-h-72 font-mono"),"aria-label":"Memory contents",value:t.template.memory[s]??"",onChange:o=>t.setMemory(s,o.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:I,"aria-label":"New memory topic",placeholder:"Topic name",value:n,onChange:o=>r(o.target.value)}),e.jsx("button",{type:"button","aria-label":"Add memory topic",disabled:!/^[a-zA-Z0-9_-]+$/.test(n),className:"rounded-lg bg-control px-3 disabled:opacity-40",onClick:()=>{const o=`memory/${n}.md`;o in t.template.memory||t.setMemory(o,""),a(o),r("")},children:e.jsx(ve,{size:16})}),s!=="MEMORY.md"&&e.jsx("button",{type:"button","aria-label":"Remove memory topic",className:"rounded-lg bg-control px-3",onClick:()=>{t.setMemory(s,null),a("MEMORY.md")},children:e.jsx(se,{size:16})})]})]})}function Ye({draft:t}){const[s,a]=p.useState(null);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-2 text-[13px] text-white",onClick:()=>a("new"),children:i("computer.routines.create")}),t.routines.map(n=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-card p-3",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left text-[13px]",onClick:()=>a(n),children:n.name}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:n.enabled,onChange:r=>t.setRoutineEnabled(n.id,r.target.checked)}),"Enabled"]}),e.jsx("button",{type:"button","aria-label":`Remove ${n.name}`,onClick:()=>t.removeRoutine(n.id),className:"rounded p-1.5 hover:bg-control",children:e.jsx(se,{size:15})})]},n.id)),s&&e.jsx(Te,{routine:s==="new"?void 0:s,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function tt(){const[t,s]=p.useState(!1),[a,n]=p.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[e.jsx("span",{className:"text-[13px] text-ink",children:i("newBot.defaults")}),e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>n(!0),className:"rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink",children:i("newBot.sharePreset")}),e.jsx("button",{type:"button",onClick:()=>s(!0),className:"rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:i("newBot.edit")})]})]}),t&&e.jsx(He,{defaultsMode:!0,onClose:()=>s(!1)}),a&&e.jsx(Fe,{onClose:()=>n(!1)})]})}export{Je as CompanionNewBotDialog,tt as DefaultBotSettings,Ge as LocalNewBotDialog,He as NewBotDialog};
@@ -1 +0,0 @@
1
- import{k as w,u as C,a as z,r as i,j as e,Q as S,X as P,c as y,B as T,d as A,T as E,U as m,V as L,q as I,Y as R,$ as B,g as U}from"./index-C3NqfdVU.js";import{I as F}from"./image-plus-BbVjGHin.js";const V=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],_=w("bell",V);function M({bot:t,overlay:b=!1}){const{dispatch:p}=C(),{padClass:k}=z(),[x,f]=i.useState(!1),[g,r]=i.useState(""),[h,v]=i.useState(!1),o=i.useRef(null),l=i.useRef(null),c=i.useRef(null),j=()=>p({type:"toggleSettings",open:!1}),n=a=>{if(l.current={...l.current,...a},c.current)return c.current;f(!0),r("");const s=async()=>{for(;l.current;){const d=l.current;l.current=null,r("");try{const u=await U(`/api/bots/${t.id}/profile`,{method:"PATCH",body:JSON.stringify(d)});p({type:"botPatched",bot:u.bot})}catch(u){r(u instanceof Error?u.message:"Could not update this agent.")}}};return c.current=s().finally(()=>{c.current=null,f(!1)}),c.current},N=async a=>{if(a){v(!0),r("");try{const s=await R(a),d=s?B(s.path):null;if(!d)throw new Error("Choose a PNG, JPEG, GIF, or WebP image.");await n({avatarUrl:d,avatarCrop:t.avatarCrop==="square"?"square":"circle"})}catch(s){r(s instanceof Error?s.message:String(s))}finally{v(!1),o.current&&(o.current.value="")}}};return e.jsxs("aside",{className:y("animate-panel-in absolute inset-0 z-40 flex h-full min-w-0 flex-col border-l border-hairline/40 bg-panel",b?"md:left-auto md:w-[400px] md:shadow-2xl":"md:relative md:z-20 md:w-[400px] md:shrink-0"),children:[e.jsxs("div",{className:y("flex items-center justify-between px-4 py-3",k),children:[e.jsx("button",{onClick:j,"aria-label":"Collapse remote agent settings",className:"flex size-10 items-center justify-center rounded-md text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(S,{size:18})}),e.jsx("span",{className:"text-[15px] font-semibold text-ink",children:"Remote agent settings"}),e.jsx("button",{onClick:j,"aria-label":"Close remote agent settings",className:"flex size-10 items-center justify-center rounded-md text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(P,{size:18})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-5 pb-5",children:e.jsxs("div",{className:"flex flex-col gap-4 pt-4",children:[e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx(T,{bot:t,state:"idle",size:64,motion:"none",motionKey:0,animated:!1}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:o,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"sr-only",onChange:a=>{N(a.target.files?.[0])}}),e.jsxs("button",{type:"button",disabled:h||x,onClick:()=>o.current?.click(),className:"flex items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[h?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(F,{size:14})," Avatar"]}),t.avatarUrl&&e.jsx("button",{type:"button",disabled:x,onClick:()=>{n({avatarUrl:null,avatarCrop:"mascot"})},"aria-label":"Remove custom avatar",className:"flex size-9 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-danger",children:e.jsx(E,{size:14})})]})]}),e.jsxs("label",{className:"block text-[12px] font-medium text-ink-secondary",children:["Name",e.jsx("input",{defaultValue:t.name,maxLength:m.name,onBlur:a=>{const s=a.currentTarget.value.trim();s&&s!==t.name&&n({name:s})},className:"mt-1 w-full rounded-lg bg-inset px-3 py-2 text-[14px] text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]}),e.jsxs("label",{className:"mt-3 block text-[12px] font-medium text-ink-secondary",children:["Title",e.jsx("input",{defaultValue:t.title??"",maxLength:m.title,onBlur:a=>{a.currentTarget.value!==(t.title??"")&&n({title:a.currentTarget.value})},className:"mt-1 w-full rounded-lg bg-inset px-3 py-2 text-[14px] text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]}),e.jsxs("label",{className:"mt-3 block text-[12px] font-medium text-ink-secondary",children:["Description",e.jsx("textarea",{defaultValue:t.description??"",maxLength:m.description,rows:4,onBlur:a=>{a.currentTarget.value!==(t.description??"")&&n({description:a.currentTarget.value})},className:"mt-1 w-full resize-y rounded-lg bg-inset px-3 py-2 text-[13px] leading-relaxed text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]})]}),e.jsx(L,{bot:t,workspaceConfigurationLocked:!0,onPatch:a=>{n(a)}}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx(_,{size:16,className:"mt-0.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:"Notifications"}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:"Enable completion and attention notifications for this agent on the host and paired clients."})]})]}),e.jsx(I,{checked:t.notifications,disabled:x,"aria-label":"Agent notifications",onClick:()=>{n({notifications:!t.notifications})}})]}),g?e.jsx("div",{role:"alert",className:"text-[12px] text-danger",children:g}):null]})})]})}export{M as RemoteAgentSettingsPanel};