limixbot 0.3.145 → 0.3.147

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 (150) hide show
  1. package/dist/assets/{ActivityPanel-CqObZQbN.js → ActivityPanel-ha5UB6JF.js} +1 -1
  2. package/dist/assets/{App-DcG1JmK6.js → App-OHzELG1X.js} +104 -104
  3. package/dist/assets/{AppEventEditor-DR01sHAK.js → AppEventEditor-obfXqLac.js} +1 -1
  4. package/dist/assets/{BotSettingsDialog-BHgSIU9E.js → BotSettingsDialog-B4xJoXAR.js} +1 -1
  5. package/dist/assets/{BrowserPanel-g96rlnqQ.js → BrowserPanel-BA3MHxLE.js} +1 -1
  6. package/dist/assets/{BrowserProfilesManager-UJJC6OPf.js → BrowserProfilesManager-C69B2qW7.js} +1 -1
  7. package/dist/assets/{CloudAddDialog-BjPYPhnk.js → CloudAddDialog-Cl1kfUfv.js} +1 -1
  8. package/dist/assets/{ComputerFilesPane-DA7MBSD0.js → ComputerFilesPane-CIE18AsH.js} +1 -1
  9. package/dist/assets/{ComputerPanel--rY7_KCN.js → ComputerPanel-DUlHlmJs.js} +2 -2
  10. package/dist/assets/{DataPanel-CEhe1WKo.js → DataPanel-BhAdUpy-.js} +1 -1
  11. package/dist/assets/{DesktopViewer-RNuariIo.js → DesktopViewer-uyCSG2he.js} +1 -1
  12. package/dist/assets/{GrokMoveDialog-DoUN6m5b.js → GrokMoveDialog-Cj9CtyFz.js} +1 -1
  13. package/dist/assets/{InspectorPanel-CdCXUouJ.js → InspectorPanel-CTOKraf7.js} +1 -1
  14. package/dist/assets/{KeyboardShortcutsModal-CZ-BQqzV.js → KeyboardShortcutsModal-B8s_z7Bf.js} +1 -1
  15. package/dist/assets/KnowledgePanel-DWDBULkL.js +1 -0
  16. package/dist/assets/{LimixResizeHandles-BUe_6hSJ.js → LimixResizeHandles-C2c3aYPm.js} +1 -1
  17. package/dist/assets/{LiveDesktop-BnaxuTzU.js → LiveDesktop-BnagL5Xd.js} +1 -1
  18. package/dist/assets/{LocalVmWorkspace-X1ev9Wov.js → LocalVmWorkspace-C_6HF5Be.js} +1 -1
  19. package/dist/assets/{MacLocalControl-RXW-1ET9.js → MacLocalControl-DfNRhU6Z.js} +1 -1
  20. package/dist/assets/{MarkdownFilePreview-CIYTKbNj.js → MarkdownFilePreview-D8j47umK.js} +1 -1
  21. package/dist/assets/{MenuMotion-C-qcisoG.js → MenuMotion-B0aZnuh_.js} +1 -1
  22. package/dist/assets/{NewBotDialog-D_22AmDd.js → NewBotDialog-CxY9p3uW.js} +1 -1
  23. package/dist/assets/{PhoneAppDialog-WOhzSF82.js → PhoneAppDialog-BB0rq01m.js} +1 -1
  24. package/dist/assets/{PlacesRail-DoUGQSpd.js → PlacesRail-tZyNm-l3.js} +1 -1
  25. package/dist/assets/{PluginsPanel-DxM_qWtC.js → PluginsPanel-Cod2cJ3m.js} +6 -6
  26. package/dist/assets/{ProIntroduction-CQFDxYxi.js → ProIntroduction-BYeJLd6v.js} +1 -1
  27. package/dist/assets/{RemoteAgentSettingsPanel-CdQmz7Qu.js → RemoteAgentSettingsPanel-DrDaWqZQ.js} +1 -1
  28. package/dist/assets/{RoomPanel-DVsYTCX7.js → RoomPanel-BldqgGbT.js} +1 -1
  29. package/dist/assets/{RoutinesPage-DG30sQw7.js → RoutinesPage-Dt5n6TUd.js} +3 -3
  30. package/dist/assets/{SettingsModal-BFeWJ1OS.js → SettingsModal-5DXP6Iyh.js} +1 -1
  31. package/dist/assets/{ShareTeamDialog-BLddRjax.js → ShareTeamDialog-Bzte6WGL.js} +1 -1
  32. package/dist/assets/{SignedInSites-BREmZ6gH.js → SignedInSites-f8T3aw_5.js} +1 -1
  33. package/dist/assets/{TeamLibraryPanel-Sg1D_gYP.js → TeamLibraryPanel-PS2c5SeX.js} +1 -1
  34. package/dist/assets/{TeamMapPage-CP7ug7dF.js → TeamMapPage-DlOu0vvo.js} +1 -1
  35. package/dist/assets/{TriggersPage-DmY-ibGg.js → TriggersPage-t4c2-ZAC.js} +1 -1
  36. package/dist/assets/{VisibilitySection-BqQTMT_O.js → VisibilitySection-X3MwlVCH.js} +5 -5
  37. package/dist/assets/{WebhookTrigger-Bk2khhKt.js → WebhookTrigger-DlLdx-JP.js} +1 -1
  38. package/dist/assets/{WorksOnGrid-BhZTjLmG.js → WorksOnGrid-C-i85Bh5.js} +1 -1
  39. package/dist/assets/{abnfDiagram-YUKMZFIV-4h66COg4.js → abnfDiagram-YUKMZFIV-DDXPrZzl.js} +1 -1
  40. package/dist/assets/{activity-JVyqvn--.js → activity-BlL5ycb5.js} +1 -1
  41. package/dist/assets/{architectureDiagram-47P4ROYG-XVFtgz_w.js → architectureDiagram-47P4ROYG-BiqBgMDV.js} +1 -1
  42. package/dist/assets/{blockDiagram-E7TT5TSB-Bzpnrunu.js → blockDiagram-E7TT5TSB-vc1neoFp.js} +1 -1
  43. package/dist/assets/{c4Diagram-CRA5TL53-Baf7lWcX.js → c4Diagram-CRA5TL53-CQbtBKOv.js} +1 -1
  44. package/dist/assets/{calendar-days-DJ8Sk4Wo.js → calendar-days-_dtxyR4U.js} +1 -1
  45. package/dist/assets/channel-BzyEyDo_.js +1 -0
  46. package/dist/assets/{chunk-2Q5K7J3B-C01NJDuW.js → chunk-2Q5K7J3B-Dq_aCCIt.js} +1 -1
  47. package/dist/assets/{chunk-5VM5RSS4-zCxCK82Z.js → chunk-5VM5RSS4-EcX_ZXzF.js} +1 -1
  48. package/dist/assets/{chunk-7TKQ45FW-Dn3xzwzp.js → chunk-7TKQ45FW-BA7CgKU2.js} +1 -1
  49. package/dist/assets/{chunk-AW2ZBBNX-D5v1LEvi.js → chunk-AW2ZBBNX-DkvVwaph.js} +1 -1
  50. package/dist/assets/{chunk-FVRAUYC3-B_j2BQfP.js → chunk-FVRAUYC3-CdyGRg6v.js} +2 -2
  51. package/dist/assets/{chunk-HTAEGDNF-CYEfb4lj.js → chunk-HTAEGDNF-CS-veEVV.js} +1 -1
  52. package/dist/assets/{chunk-JWPE2WC7-DYxCqsdI.js → chunk-JWPE2WC7-BiUYpinX.js} +1 -1
  53. package/dist/assets/{chunk-KQW6MTUR-BVs1owNv.js → chunk-KQW6MTUR-DDPkIuwB.js} +1 -1
  54. package/dist/assets/{chunk-XXDRQBXY-oNREPc9w.js → chunk-XXDRQBXY-C4YyKEem.js} +1 -1
  55. package/dist/assets/{classDiagram-v2-K4WV4PDN-B8JOWdQM.js → classDiagram-v2-K4WV4PDN-BjmVbVHi.js} +1 -1
  56. package/dist/assets/{coins-D-zVxeJ6.js → coins-Cu3qn-3t.js} +1 -1
  57. package/dist/assets/{core-DGyt94O8.js → core-DpqVMT4r.js} +1 -1
  58. package/dist/assets/{cose-bilkent-JH36ORCC-Cvvvdg2x.js → cose-bilkent-JH36ORCC-Bra0B-5z.js} +1 -1
  59. package/dist/assets/{cynefin-EF2NZ3EQ-BlyJPVpP.js → cynefin-EF2NZ3EQ-BRMKNbnx.js} +1 -1
  60. package/dist/assets/{cynefinDiagram-3GCD6N5R-aXWhkS0N.js → cynefinDiagram-3GCD6N5R-DMhNix9A.js} +1 -1
  61. package/dist/assets/{dagre-W4DXFKR2-CK9mZlxS.js → dagre-W4DXFKR2-BWwdFKCx.js} +1 -1
  62. package/dist/assets/{diagram-2UJZ2QOL-ciDDPAUW.js → diagram-2UJZ2QOL-D_4J-D-V.js} +1 -1
  63. package/dist/assets/{diagram-OVF4WLC6-ZC2XGXAQ.js → diagram-OVF4WLC6-CQ4l30Dm.js} +1 -1
  64. package/dist/assets/{diagram-PFPMY2P6-B_UNW8Y1.js → diagram-PFPMY2P6-D3W2IEHX.js} +1 -1
  65. package/dist/assets/{diagram-UMYRVEAY-BzqwG15l.js → diagram-UMYRVEAY-C9cpNhET.js} +1 -1
  66. package/dist/assets/{diagram-YEKJPTXX-f7zBrJwE.js → diagram-YEKJPTXX-DIyquCXt.js} +1 -1
  67. package/dist/assets/{diagram-ZIFT7M5P-QClomp2E.js → diagram-ZIFT7M5P-CO6216kK.js} +1 -1
  68. package/dist/assets/{ebnfDiagram-VR2GEFS7-BwcmIXBL.js → ebnfDiagram-VR2GEFS7-BeHXJPN4.js} +1 -1
  69. package/dist/assets/{elk-IJKZMXRS-DPv8qzg-.js → elk-IJKZMXRS-BdT_tK3j.js} +1 -1
  70. package/dist/assets/{erDiagram-O2IAPWRE-BHknllso.js → erDiagram-O2IAPWRE-Cz_TiHab.js} +1 -1
  71. package/dist/assets/{file-up-B5lQ3tIu.js → file-up-flw1aUka.js} +1 -1
  72. package/dist/assets/{flowDiagram-OXPTDLAJ-LwDo9oFR.js → flowDiagram-OXPTDLAJ-BXLr0anm.js} +1 -1
  73. package/dist/assets/{ganttDiagram-R7TSEDQI-DDXQuF2p.js → ganttDiagram-R7TSEDQI-C37QIpaR.js} +1 -1
  74. package/dist/assets/{gitGraphDiagram-XJZIOB7I-DxAL8MxK.js → gitGraphDiagram-XJZIOB7I-Cs8fTfJZ.js} +1 -1
  75. package/dist/assets/{import-name-fUZKEQiu.js → import-name-B6edwqYP.js} +1 -1
  76. package/dist/assets/{index-C_1rKgRm.js → index-BruSVBU0.js} +3 -3
  77. package/dist/assets/{index-Bb6OwohQ.js → index-DDwC7qII.js} +2 -2
  78. package/dist/assets/{infoDiagram-5W2HQ5XZ-BxZNIlp6.js → infoDiagram-5W2HQ5XZ-BpliNVPR.js} +1 -1
  79. package/dist/assets/{ishikawaDiagram-K3B6WC7H-C6c1u1w2.js → ishikawaDiagram-K3B6WC7H-Dov7w4qz.js} +1 -1
  80. package/dist/assets/{journeyDiagram-COXZFDF6-BrngL-3X.js → journeyDiagram-COXZFDF6-DoihiGaK.js} +1 -1
  81. package/dist/assets/{kanban-definition-P3RFRI5V-BhTOtF-B.js → kanban-definition-P3RFRI5V-D_gNx8dG.js} +1 -1
  82. package/dist/assets/{mermaid.core-Cy9_uq1T.js → mermaid.core-BYPxVPn-.js} +4 -4
  83. package/dist/assets/{mindmap-definition-LZFPQGKD-Dr3QB9wA.js → mindmap-definition-LZFPQGKD-wH2aKxFy.js} +1 -1
  84. package/dist/assets/{minimize-Ct6C2khA.js → minimize-sGQL0Xsy.js} +1 -1
  85. package/dist/assets/{monitor-BZrhga_j.js → monitor-zecPzfR5.js} +1 -1
  86. package/dist/assets/{new-bot-DCA0S24E.js → new-bot-DehPHgMa.js} +1 -1
  87. package/dist/assets/{org-library-DgVAGwBY.js → org-library-CA4y9Ru8.js} +1 -1
  88. package/dist/assets/{package-format-BvWgfqGs.js → package-format-CpbqH_LB.js} +1 -1
  89. package/dist/assets/{pegDiagram-BGZESJAR-D0bSaHqd.js → pegDiagram-BGZESJAR-B7RTZksQ.js} +1 -1
  90. package/dist/assets/{pieDiagram-CAPJLFHJ-B8i7ox8l.js → pieDiagram-CAPJLFHJ-B5mPB7O-.js} +1 -1
  91. package/dist/assets/{quadrantDiagram-GDMTTRAM-BcJTpsdR.js → quadrantDiagram-GDMTTRAM-CZqo7j7U.js} +1 -1
  92. package/dist/assets/{rail-Bzq4BbCt.js → rail-Ok0cs7cA.js} +1 -1
  93. package/dist/assets/{railroadDiagram-SM67HX2B-DSO-XOKW.js → railroadDiagram-SM67HX2B-MFpfIts_.js} +1 -1
  94. package/dist/assets/{remote-desktop-panel-BVRS7AXc.js → remote-desktop-panel-BIXUp23K.js} +1 -1
  95. package/dist/assets/{requirementDiagram-X7JNWC4A-B5gEynme.js → requirementDiagram-X7JNWC4A-CJ49gC_q.js} +1 -1
  96. package/dist/assets/{sankeyDiagram-UM26HJRW-CK2T6Pgm.js → sankeyDiagram-UM26HJRW-DxpTSw3D.js} +1 -1
  97. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-Dx9DVGEG.js → sequenceDiagram-ZO4K6R2Y-XEyCx2Ue.js} +1 -1
  98. package/dist/assets/{sizeCapture-INFHLROL-BbirmlCW.js → sizeCapture-INFHLROL-1Fx1tcNn.js} +1 -1
  99. package/dist/assets/{stateDiagram-v2-TBUQTH76-CuJOlmiS.js → stateDiagram-v2-TBUQTH76-CwxyNDK4.js} +1 -1
  100. package/dist/assets/styles-CMOouTIW.css +1 -0
  101. package/dist/assets/{styles-CLQR3ehf.js → styles-DO3EUxm2.js} +1 -1
  102. package/dist/assets/{swimlanes-N4OXWK64-BWFqBYF_.js → swimlanes-N4OXWK64-BuwwuENy.js} +1 -1
  103. package/dist/assets/swimlanesDiagram-K3J5GTZL-CcmXEgRh.js +8 -0
  104. package/dist/assets/{team-share-1e1FK9fo.js → team-share-CL18_anr.js} +1 -1
  105. package/dist/assets/{timeline-definition-YOQAKGHF-CzxPBKDi.js → timeline-definition-YOQAKGHF-CauwqKMA.js} +1 -1
  106. package/dist/assets/{usecaseDiagram-VIAY4XPW-B5-pXbU3.js → usecaseDiagram-VIAY4XPW-YZ3Cf2do.js} +1 -1
  107. package/dist/assets/{vennDiagram-BLWOH2XV-BccL1p-U.js → vennDiagram-BLWOH2XV-CDX8i7ID.js} +1 -1
  108. package/dist/assets/{vi-DyvsTHbT.js → vi-CiY3ddy3.js} +1 -1
  109. package/dist/assets/{wardleyDiagram-YMQ3BMBF-DdJ9Pves.js → wardleyDiagram-YMQ3BMBF-CCdRrEMh.js} +1 -1
  110. package/dist/assets/{xychartDiagram-TAQBALBS-BAg7I3YQ.js → xychartDiagram-TAQBALBS-Vz4NaN0U.js} +1 -1
  111. package/dist/index.html +3 -3
  112. package/dist/rail.html +5 -5
  113. package/dist-server/drivers/agents-proxy.js +412 -400
  114. package/dist-server/index.js +6845 -6649
  115. package/dist-server/knowledge-collection.worker.js +4737 -0
  116. package/dist-server/licenses/knowledge.txt +688 -0
  117. package/dist-server/limixbot.js +1560 -1542
  118. package/dist-server/package.json +1 -1
  119. package/dist-server/pair-cli.js +1560 -1542
  120. package/dist-server/server/agents-turn.js +1 -0
  121. package/dist-server/server/bot-moves.js +16 -13
  122. package/dist-server/server/cloud-send-arrived.js +21 -3
  123. package/dist-server/server/drivers/agents-call.js +8 -0
  124. package/dist-server/server/drivers/agents-catalog-profile.js +1 -0
  125. package/dist-server/server/drivers/agents-catalog.js +4 -1
  126. package/dist-server/server/host/bot-access-gate.js +3 -0
  127. package/dist-server/server/index.js +52 -3
  128. package/dist-server/server/knowledge/core.bench.js +35 -0
  129. package/dist-server/server/knowledge/core.js +338 -0
  130. package/dist-server/server/knowledge/database.js +153 -0
  131. package/dist-server/server/knowledge/documents.js +169 -0
  132. package/dist-server/server/knowledge/files.js +64 -0
  133. package/dist-server/server/knowledge/host.js +158 -0
  134. package/dist-server/server/knowledge/memory.js +51 -0
  135. package/dist-server/server/knowledge/plugin.js +17 -0
  136. package/dist-server/server/knowledge/retrieval.js +90 -0
  137. package/dist-server/server/knowledge/schema.js +39 -0
  138. package/dist-server/server/knowledge/semantic.js +135 -0
  139. package/dist-server/server/knowledge/tools.js +58 -0
  140. package/dist-server/server/knowledge-collection-fetch.js +101 -0
  141. package/dist-server/server/knowledge-collection.js +300 -0
  142. package/dist-server/server/knowledge-collection.worker.js +142 -0
  143. package/dist-server/server/move-freeze.js +1 -16
  144. package/dist-server/server/plugin-hub.js +17 -0
  145. package/dist-server/server/routes/knowledge.js +48 -0
  146. package/dist-server/server/routes/move-freeze.js +2 -6
  147. package/package.json +1 -1
  148. package/dist/assets/channel-DJthUr0W.js +0 -1
  149. package/dist/assets/styles-CE5PtWhb.css +0 -1
  150. package/dist/assets/swimlanesDiagram-K3J5GTZL-BjpCZGc-.js +0 -8
@@ -1 +1 @@
1
- import{r as l,t as s,j as t,X as $,a as X}from"./styles-CLQR3ehf.js";import{c as ee,B as te,L as G}from"./PlacesRail-DoUGQSpd.js";import{u as ae,v as F,w as L}from"./App-DcG1JmK6.js";import{suggestedName as H}from"./WebhookTrigger-Bk2khhKt.js";import"./monitor-BZrhga_j.js";import"./index-C_1rKgRm.js";import"./MenuMotion-C-qcisoG.js";import"./remote-desktop-DDRRx8uY.js";const N="w-full rounded-xl border border-hairline/60 bg-panel px-3.5 py-2.5 text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/70",m="mb-1.5 block text-[12px] font-medium text-ink-secondary";function de({trigger:a,bots:x,initialBotId:y,onClose:h,onSaved:J}){const{dispatch:K}=ae(),[i,Q]=l.useState(a?.botId??(y&&x.some(e=>e.id===y)?y:x[0]?.id)??""),[r,O]=l.useState(null),[v,B]=l.useState(a?.app??""),[b,k]=l.useState(a?.event??""),[g,U]=l.useState(a?.accountId??""),[I,V]=l.useState(a?.filter??{}),[f,E]=l.useState({}),[u,W]=l.useState(a?.prompt??""),[w,Y]=l.useState(a?.name??""),[P,D]=l.useState(!1),[S,C]=l.useState(""),R=l.useRef(null);ee(R,h),l.useEffect(()=>{if(a||!i)return;let e=!0;return O(null),F.events(i).then(n=>{if(!e)return;O(n);const o=n.apps.find(d=>d.events.length);B(d=>n.apps.some(z=>z.app===d)?d:o?.app??"")}).catch(n=>{e&&C(n instanceof Error?n.message:String(n))}),()=>{e=!1}},[i,a]);const p=r?.apps.find(e=>e.app===v),A=p?.events??[],c=A.find(e=>e.event===b)??(a?void 0:A[0]);l.useEffect(()=>{!a&&c&&c.event!==b&&k(c.event)},[c,b,a]);const q=(c?.configFields??[]).filter(e=>e.required),Z=v==="gmail",M=a?.delivery??c?.delivery,_=async()=>{const e=x.find(o=>o.id===i),n=Object.fromEntries(Object.entries(I).filter(([,o])=>typeof o=="string"&&o.trim()));D(!0),C("");try{const o=a?await F.update(a.id,{name:w.trim()||a.name,prompt:u.trim(),filter:Object.keys(n).length?n:null}):await F.create({botId:i,app:v,event:c?.event??b,prompt:u.trim(),name:w.trim()||H(u,e),...g?{account:g}:{},...Object.keys(n).length?{filter:n}:{},...Object.keys(f).length?{config:f}:{}});J?.(o),h()}catch(o){C(o instanceof Error?o.message:String(o))}finally{D(!1)}},j=(e,n,o)=>t.jsxs("label",{className:"block",children:[t.jsx("span",{className:m,children:n}),t.jsx("input",{value:I[e]??"",onChange:d=>V(z=>({...z,[e]:d.target.value})),placeholder:o,className:N})]},e),T=a?s("automations.editor.app.editTitle"):s("automations.editor.appEvent.title");return t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-5",onMouseDown:e=>e.stopPropagation(),children:t.jsxs("div",{ref:R,role:"dialog","aria-modal":"true","aria-label":T,tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/60 bg-panel shadow-2xl",children:[t.jsxs("div",{className:"flex items-start justify-between border-b border-hairline/40 px-5 py-4",children:[t.jsx("div",{className:"text-[17px] font-semibold text-ink",children:T}),t.jsx("button",{type:"button",onClick:h,"aria-label":s("automations.newBox.cancel"),className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:t.jsx($,{size:18})})]}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-5",children:[!a&&t.jsxs("div",{children:[t.jsx("div",{className:"mb-2 text-[13px] font-medium text-ink",children:s("automations.editor.app.who")}),t.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:x.map(e=>t.jsxs("button",{type:"button",onClick:()=>Q(e.id),className:X("flex min-w-0 items-center gap-2 rounded-xl border px-3 py-2 text-left",i===e.id?"border-accent/70 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised/60"),children:[t.jsx(te,{bot:e,state:i===e.id?"happy":"idle",size:32,animated:!1}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-ink",children:e.name})]},e.id))})]}),!a&&!r&&!S&&t.jsxs("p",{className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[t.jsx(G,{size:14,className:"animate-spin"}),s("automations.editor.appEvent.loading")]}),!a&&r&&(r.unavailable||!r.apps.some(e=>e.events.length))&&t.jsxs("div",{className:"rounded-xl border border-hairline/45 bg-inset/50 p-3.5 text-[13px] text-ink-secondary",children:[t.jsx("p",{children:r.unavailable??s("automations.editor.appEvent.noApps")}),!r.unavailable&&t.jsx("button",{type:"button",onClick:()=>K({type:"togglePlugins",open:!0,surface:"apps"}),className:"mt-2.5 rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-accent-ink hover:brightness-110",children:s("automations.editor.appEvent.connect")})]}),!a&&r&&p&&t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.jsxs("label",{className:"block",children:[t.jsx("span",{className:m,children:s("automations.editor.appEvent.app")}),t.jsx(L,{value:v,onChange:e=>{B(e.target.value),k(""),E({})},"aria-label":s("automations.editor.appEvent.app"),className:"w-full",children:r.apps.filter(e=>e.events.length).map(e=>t.jsx("option",{value:e.app,children:e.name},e.app))})]}),t.jsxs("label",{className:"block",children:[t.jsx("span",{className:m,children:s("automations.editor.appEvent.event")}),t.jsx(L,{value:c?.event??"",onChange:e=>{k(e.target.value),E({})},"aria-label":s("automations.editor.appEvent.event"),className:"w-full",children:A.map(e=>t.jsx("option",{value:e.event,children:e.name},e.event))})]}),p.accounts.length>1&&t.jsxs("label",{className:"block sm:col-span-2",children:[t.jsx("span",{className:m,children:s("automations.editor.appEvent.account")}),t.jsxs(L,{value:g,onChange:e=>U(e.target.value),"aria-label":s("automations.editor.appEvent.account"),className:"w-full",children:[t.jsx("option",{value:""}),p.accounts.map(e=>t.jsx("option",{value:e.id,children:e.alias??e.id},e.id))]})]}),q.map(e=>t.jsxs("label",{className:"block sm:col-span-2",children:[t.jsx("span",{className:m,children:e.name}),t.jsx("input",{value:f[e.name]??"",onChange:n=>E(o=>({...o,[e.name]:n.target.value})),placeholder:e.description,className:N})]},e.name))]}),(a||p)&&t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[Z?[j("from",s("automations.editor.appEvent.from"),"acme.com"),j("subject",s("automations.editor.appEvent.subject"),"order"),j("label",s("automations.editor.appEvent.label"),"Customers")]:j("text",s("automations.editor.appEvent.text"),"urgent"),M&&t.jsx("p",{className:"self-end text-[12px] text-ink-secondary sm:col-span-2",children:M==="poll"?s("automations.editor.appEvent.checks"):s("automations.editor.appEvent.instant")})]}),(a||p)&&t.jsxs("label",{className:"block",children:[t.jsx("span",{className:"mb-2 block text-[13px] font-medium text-ink",children:s("automations.editor.app.what")}),t.jsx("textarea",{value:u,onChange:e=>W(e.target.value),rows:3,placeholder:s("automations.editor.appEvent.whatPlaceholder"),className:X(N,"resize-y py-3 leading-relaxed")})]}),(a||p)&&t.jsxs("details",{className:"rounded-xl border border-hairline/45 bg-inset/45 px-4 py-3",children:[t.jsx("summary",{className:"cursor-pointer text-[13px] font-medium text-ink",children:s("automations.more")}),t.jsxs("label",{className:"mt-4 block",children:[t.jsx("span",{className:m,children:s("automations.editor.app.name")}),t.jsx("input",{value:w,onChange:e=>Y(e.target.value),placeholder:H(u,x.find(e=>e.id===i)),className:N})]})]}),S&&t.jsx("div",{role:"alert",className:"rounded-xl border border-danger/30 bg-danger/10 px-3.5 py-3 text-[12px] text-danger",children:S})]}),t.jsxs("div",{className:"flex justify-end gap-2 border-t border-hairline/40 px-5 py-4",children:[t.jsx("button",{type:"button",onClick:h,className:"rounded-xl px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:s("automations.newBox.cancel")}),t.jsxs("button",{type:"button",disabled:P||!i||!a&&!c||q.some(e=>!f[e.name]?.trim()),onClick:()=>{_()},className:"flex items-center gap-2 rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110 disabled:opacity-40",children:[P&&t.jsx(G,{size:14,className:"animate-spin"}),a?s("automations.editor.app.save"):s("automations.editor.app.create")]})]})]})})}export{de as AppEventEditor};
1
+ import{r as l,t as s,j as t,X as $,a as X}from"./styles-DO3EUxm2.js";import{c as ee,B as te,L as G}from"./PlacesRail-tZyNm-l3.js";import{u as ae,v as F,w as L}from"./App-OHzELG1X.js";import{suggestedName as H}from"./WebhookTrigger-DlLdx-JP.js";import"./monitor-zecPzfR5.js";import"./index-BruSVBU0.js";import"./MenuMotion-B0aZnuh_.js";import"./remote-desktop-DDRRx8uY.js";const N="w-full rounded-xl border border-hairline/60 bg-panel px-3.5 py-2.5 text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/70",m="mb-1.5 block text-[12px] font-medium text-ink-secondary";function de({trigger:a,bots:x,initialBotId:y,onClose:h,onSaved:J}){const{dispatch:K}=ae(),[i,Q]=l.useState(a?.botId??(y&&x.some(e=>e.id===y)?y:x[0]?.id)??""),[r,O]=l.useState(null),[v,B]=l.useState(a?.app??""),[b,k]=l.useState(a?.event??""),[g,U]=l.useState(a?.accountId??""),[I,V]=l.useState(a?.filter??{}),[f,E]=l.useState({}),[u,W]=l.useState(a?.prompt??""),[w,Y]=l.useState(a?.name??""),[P,D]=l.useState(!1),[S,C]=l.useState(""),R=l.useRef(null);ee(R,h),l.useEffect(()=>{if(a||!i)return;let e=!0;return O(null),F.events(i).then(n=>{if(!e)return;O(n);const o=n.apps.find(d=>d.events.length);B(d=>n.apps.some(z=>z.app===d)?d:o?.app??"")}).catch(n=>{e&&C(n instanceof Error?n.message:String(n))}),()=>{e=!1}},[i,a]);const p=r?.apps.find(e=>e.app===v),A=p?.events??[],c=A.find(e=>e.event===b)??(a?void 0:A[0]);l.useEffect(()=>{!a&&c&&c.event!==b&&k(c.event)},[c,b,a]);const q=(c?.configFields??[]).filter(e=>e.required),Z=v==="gmail",M=a?.delivery??c?.delivery,_=async()=>{const e=x.find(o=>o.id===i),n=Object.fromEntries(Object.entries(I).filter(([,o])=>typeof o=="string"&&o.trim()));D(!0),C("");try{const o=a?await F.update(a.id,{name:w.trim()||a.name,prompt:u.trim(),filter:Object.keys(n).length?n:null}):await F.create({botId:i,app:v,event:c?.event??b,prompt:u.trim(),name:w.trim()||H(u,e),...g?{account:g}:{},...Object.keys(n).length?{filter:n}:{},...Object.keys(f).length?{config:f}:{}});J?.(o),h()}catch(o){C(o instanceof Error?o.message:String(o))}finally{D(!1)}},j=(e,n,o)=>t.jsxs("label",{className:"block",children:[t.jsx("span",{className:m,children:n}),t.jsx("input",{value:I[e]??"",onChange:d=>V(z=>({...z,[e]:d.target.value})),placeholder:o,className:N})]},e),T=a?s("automations.editor.app.editTitle"):s("automations.editor.appEvent.title");return t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-5",onMouseDown:e=>e.stopPropagation(),children:t.jsxs("div",{ref:R,role:"dialog","aria-modal":"true","aria-label":T,tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/60 bg-panel shadow-2xl",children:[t.jsxs("div",{className:"flex items-start justify-between border-b border-hairline/40 px-5 py-4",children:[t.jsx("div",{className:"text-[17px] font-semibold text-ink",children:T}),t.jsx("button",{type:"button",onClick:h,"aria-label":s("automations.newBox.cancel"),className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:t.jsx($,{size:18})})]}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-5",children:[!a&&t.jsxs("div",{children:[t.jsx("div",{className:"mb-2 text-[13px] font-medium text-ink",children:s("automations.editor.app.who")}),t.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:x.map(e=>t.jsxs("button",{type:"button",onClick:()=>Q(e.id),className:X("flex min-w-0 items-center gap-2 rounded-xl border px-3 py-2 text-left",i===e.id?"border-accent/70 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised/60"),children:[t.jsx(te,{bot:e,state:i===e.id?"happy":"idle",size:32,animated:!1}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-ink",children:e.name})]},e.id))})]}),!a&&!r&&!S&&t.jsxs("p",{className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[t.jsx(G,{size:14,className:"animate-spin"}),s("automations.editor.appEvent.loading")]}),!a&&r&&(r.unavailable||!r.apps.some(e=>e.events.length))&&t.jsxs("div",{className:"rounded-xl border border-hairline/45 bg-inset/50 p-3.5 text-[13px] text-ink-secondary",children:[t.jsx("p",{children:r.unavailable??s("automations.editor.appEvent.noApps")}),!r.unavailable&&t.jsx("button",{type:"button",onClick:()=>K({type:"togglePlugins",open:!0,surface:"apps"}),className:"mt-2.5 rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-accent-ink hover:brightness-110",children:s("automations.editor.appEvent.connect")})]}),!a&&r&&p&&t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.jsxs("label",{className:"block",children:[t.jsx("span",{className:m,children:s("automations.editor.appEvent.app")}),t.jsx(L,{value:v,onChange:e=>{B(e.target.value),k(""),E({})},"aria-label":s("automations.editor.appEvent.app"),className:"w-full",children:r.apps.filter(e=>e.events.length).map(e=>t.jsx("option",{value:e.app,children:e.name},e.app))})]}),t.jsxs("label",{className:"block",children:[t.jsx("span",{className:m,children:s("automations.editor.appEvent.event")}),t.jsx(L,{value:c?.event??"",onChange:e=>{k(e.target.value),E({})},"aria-label":s("automations.editor.appEvent.event"),className:"w-full",children:A.map(e=>t.jsx("option",{value:e.event,children:e.name},e.event))})]}),p.accounts.length>1&&t.jsxs("label",{className:"block sm:col-span-2",children:[t.jsx("span",{className:m,children:s("automations.editor.appEvent.account")}),t.jsxs(L,{value:g,onChange:e=>U(e.target.value),"aria-label":s("automations.editor.appEvent.account"),className:"w-full",children:[t.jsx("option",{value:""}),p.accounts.map(e=>t.jsx("option",{value:e.id,children:e.alias??e.id},e.id))]})]}),q.map(e=>t.jsxs("label",{className:"block sm:col-span-2",children:[t.jsx("span",{className:m,children:e.name}),t.jsx("input",{value:f[e.name]??"",onChange:n=>E(o=>({...o,[e.name]:n.target.value})),placeholder:e.description,className:N})]},e.name))]}),(a||p)&&t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[Z?[j("from",s("automations.editor.appEvent.from"),"acme.com"),j("subject",s("automations.editor.appEvent.subject"),"order"),j("label",s("automations.editor.appEvent.label"),"Customers")]:j("text",s("automations.editor.appEvent.text"),"urgent"),M&&t.jsx("p",{className:"self-end text-[12px] text-ink-secondary sm:col-span-2",children:M==="poll"?s("automations.editor.appEvent.checks"):s("automations.editor.appEvent.instant")})]}),(a||p)&&t.jsxs("label",{className:"block",children:[t.jsx("span",{className:"mb-2 block text-[13px] font-medium text-ink",children:s("automations.editor.app.what")}),t.jsx("textarea",{value:u,onChange:e=>W(e.target.value),rows:3,placeholder:s("automations.editor.appEvent.whatPlaceholder"),className:X(N,"resize-y py-3 leading-relaxed")})]}),(a||p)&&t.jsxs("details",{className:"rounded-xl border border-hairline/45 bg-inset/45 px-4 py-3",children:[t.jsx("summary",{className:"cursor-pointer text-[13px] font-medium text-ink",children:s("automations.more")}),t.jsxs("label",{className:"mt-4 block",children:[t.jsx("span",{className:m,children:s("automations.editor.app.name")}),t.jsx("input",{value:w,onChange:e=>Y(e.target.value),placeholder:H(u,x.find(e=>e.id===i)),className:N})]})]}),S&&t.jsx("div",{role:"alert",className:"rounded-xl border border-danger/30 bg-danger/10 px-3.5 py-3 text-[12px] text-danger",children:S})]}),t.jsxs("div",{className:"flex justify-end gap-2 border-t border-hairline/40 px-5 py-4",children:[t.jsx("button",{type:"button",onClick:h,className:"rounded-xl px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:s("automations.newBox.cancel")}),t.jsxs("button",{type:"button",disabled:P||!i||!a&&!c||q.some(e=>!f[e.name]?.trim()),onClick:()=>{_()},className:"flex items-center gap-2 rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110 disabled:opacity-40",children:[P&&t.jsx(G,{size:14,className:"animate-spin"}),a?s("automations.editor.app.save"):s("automations.editor.app.create")]})]})]})})}export{de as AppEventEditor};
@@ -1,4 +1,4 @@
1
- import{c as Ae,t as s,l as ee,aF as Vs,j as e,i as De,ae as fe,a as O,r as x,S as tt,ah as Jt,X as st,d as pt}from"./styles-CLQR3ehf.js";import{fs as Zs,ft as Gs,_ as nt,f5 as Qt,bE as Ys,ds as Xt,C as Js,fu as Qs,fv as Xs,E as es,fw as en,M as ts,eC as tn,p as sn,fx as mt,bu as ut,fy as ss,j as Z,u as B,fz as xt,fA as ht,f6 as ie,fB as nn,fC as an,fD as rn,fE as on,ag as at,af as ns,A as as,S as be,ab as Me,T as is,R as ln,fF as cn,fG as dn,fH as pn,fI as mn,fJ as un,fK as gt,fL as xn,fM as hn,fN as gn,fO as fn,a$ as yn,fP as bn,fQ as vn,fR as kn,I as jn,fS as Oe,bY as Le,fT as wn,aH as M,aN as Q,em as Nn,dU as Sn,fU as Cn,aI as Ge,cy as Pn,e7 as On,e8 as En,fV as Rn,fW as rs,fX as os,fY as Tn,fZ as In,f_ as An,f$ as Mn,dX as Ye,aq as ft,g0 as ze,g1 as Ln,g2 as Re,au as Bn,g3 as ls,g4 as yt,aj as Je,g5 as $n,g6 as Fn,g7 as Dn,g8 as cs,g9 as zn,ga as bt,gb as Hn,gc as _n,gd as Kn,ge as te,aX as ae,aZ as X,gf as Un,gg as qn,gh as Wn,de as Vn,aP as Zn,G as Gn,dc as ds,ai as Yn,gi as V,aW as me,gj as ue,x as S,gk as Jn,dy as Qn,gl as Be,aY as le,gm as Xn,gn as ea,go as ta,eq as sa,gp as vt,gq as na,gr as aa,gs as ia,gt as ra,gu as oa,gv as la,az as ca,gw as ps,gx as ms,gy as da,gz as pa,gA as ma,gB as ua,gC as xa,gD as ha,gE as ga,gF as fa,gG as ya,gH as us,gI as ba,gJ as va,gK as ka,gL as it,g as ja,B as Qe,gM as wa,gN as Na,gO as Sa,gP as Ca,gQ as Pa,gR as Oa,c5 as Ea,gS as xs,D as kt,gT as Ra,f8 as Ta,gU as jt,gV as Ia,gW as Aa,gX as Ma,cV as wt,bC as La,db as Ba,gY as $a,gZ as hs,g_ as Ce,g$ as Nt,h0 as Fa,aL as He,e9 as Da,h1 as za,aR as Ha,dC as _a,cz as Ka,h2 as Ua,h3 as qa,h4 as Wa,aT as Va}from"./App-DcG1JmK6.js";import{v as gs,d as we,a0 as Te,a1 as Za,a2 as Ga,a3 as St,a4 as _e,a5 as Ya,a6 as Ja,a7 as Qa,a8 as Xa,a9 as ei,aa as Ct,ab as ti,ac as si,L as Ee,M as ni,B as Xe,P as Ne,r as fs,ad as ai,$ as ii,u as ys}from"./PlacesRail-DoUGQSpd.js";import{C as ri}from"./coins-D-zVxeJ6.js";import{C as je,a as oi}from"./MenuMotion-C-qcisoG.js";import{b as se,m as bs,i as et,f as rt,c as ge,d as Pt,e as Ie,o as li,g as ci,h as pe,n as Ke,t as vs,s as ot,j as ks,k as di,l as pi,p as mi,r as js,q as ui,u as xi,w as hi,x as ws,y as Ns,z as Ot,B as gi,C as Ss,R as Et,D as fi,E as yi,F as bi,G as vi,H as ki,J as ji,O as wi,K as Ni,L as Cs,N as Rt,V as Si,P as Ci,M as Pi,A as Oi,a as Ei,S as Ri,I as Ti}from"./VisibilitySection-BqQTMT_O.js";import{s as Ii,r as Ai,a as Mi,R as Li}from"./ComputerFilesPane-DA7MBSD0.js";import{M as Tt}from"./monitor-BZrhga_j.js";import{R as Bi}from"./RoutinesPage-DG30sQw7.js";import{S as $i}from"./SignedInSites-BREmZ6gH.js";import"./index-C_1rKgRm.js";import"./org-library-DgVAGwBY.js";import"./package-format-BvWgfqGs.js";import"./WorksOnGrid-BhZTjLmG.js";import"./ProIntroduction-CQFDxYxi.js";import"./remote-desktop-DDRRx8uY.js";const Fi=[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1glfrc"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]],Di=Ae("calendar-plus",Fi);const zi=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],Hi=Ae("library",zi);const _i=[["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"}]],Ps=Ae("slack",_i);const Ki=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Ui=Ae("tag",Ki),qi=[{id:"overview",label:"Overview",labelKey:"botSettings.sections.overview",icon:Zs,keywords:["summary","status","what it does","won't","prompt","what the model sees"]},{id:"identity",label:"Identity",labelKey:"botSettings.sections.identity",icon:Gs,keywords:["name","title","avatar","blurb","instructions"]},{id:"slack",label:"Slack",icon:Ps,keywords:["slack","slack app","admin","message","direct messages","mentions"]},{id:"soul",label:"Soul",labelKey:"botSettings.sections.soul",icon:nt,keywords:["standing instructions","instructions","persona","rules","soul.md"]},{id:"plugins",label:"Plugins",labelKey:"plugins.botMenu",icon:Qt,keywords:["plugin","attach","gắn"]},{id:"skills",label:"Skills",labelKey:"botSettings.sections.skills",icon:Ys,keywords:["skills","learned","procedures","teach"]},{id:"memory",label:"Memory",labelKey:"botSettings.sections.memory",icon:Xt,keywords:["memory","notes","remember","topics"]},{id:"library",label:"Library",labelKey:"botPanel.tab.library",icon:Hi,keywords:["library","made","pages","apps","files","published"]},{id:"routines",label:"Routines",labelKey:"botSettings.sections.routines",icon:Js,keywords:["schedule","routines","cron","tasks"]},{id:"access",label:"Access",labelKey:"botSettings.sections.access",icon:Qs,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",labelKey:"botSettings.sections.model",icon:Xs,keywords:["engine","model","provider","cli","effort"]},{id:"permissions",label:"Permissions",labelKey:"botSettings.sections.permissions",icon:es,keywords:["auto mode","approve","auto approve","review","routine approvals","coordination","chief of staff","section"]},{id:"voice",label:"Voice & alerts",labelKey:"botSettings.sections.voice",icon:en,keywords:["voice","alerts","notifications","speak"]},{id:"visibility",label:"Who can see it",labelKey:"botSettings.visibility.title",icon:ts,keywords:["visibility","who can see","private","people","admins","members","access","hide"]},{id:"history",label:"History",labelKey:"botSettings.sections.history",icon:tn,keywords:["history","changes","undo","rollback","log"]},{id:"usage",label:"Usage",labelKey:"botSettings.sections.usage",icon:ri,keywords:["tokens","cost","billing"]}],It={completed:"botOverview.routine.last.completed",failed:"botOverview.routine.last.failed",missed:"botOverview.routine.last.missed",cancelled:"botOverview.routine.last.cancelled",running:"botOverview.routine.last.running",queued:"botOverview.routine.last.queued",waiting:"botOverview.routine.last.waiting"};function Wi(t,n=ee()){if(!t||n==="en")return null;if(t.paused)return s("botOverview.routine.paused",{name:t.name});const a=t.lastRun;if(a&&!Object.hasOwn(It,a.status))return null;try{return[s("botOverview.routine.line",{schedule:sn(t.schedule),name:t.name}),...t.nextRunAt!=null?[s("botOverview.routine.next",{time:mt(t.nextRunAt)})]:[],...a?[s(It[a.status],{time:mt(a.at)})]:[]].join(" ")}catch{return null}}const At={"Works in its private workspace.":"botOverview.line.privateWorkspace","Has the built-in browser.":"botOverview.line.browser","Has no connected apps.":"botOverview.line.noApps","Won't act on a schedule.":"botOverview.line.noSchedule","Can talk to the other bot.":"botOverview.line.talksToOne","Talks only to the bots chosen for it.":"botOverview.line.talksToChosen","Cannot initiate contact with other bots.":"botOverview.line.noPeerContact","Command approvals use Ask mode; saved permissions and provider rules still apply.":"botOverview.line.askMode","Command approvals follow the provider's custom configuration.":"botOverview.line.customApprovals","Asks before contacting other bots.":"botOverview.line.asksPeers","Can't use a computer.":"botOverview.line.noComputer","Profile proposal cards require your approval.":"botOverview.line.profileApproval","Connected apps could not be checked.":"botOverview.line.appsUnchecked"},Mt={"Auto; availability is checked when a task starts":"botOverview.preference.auto","cloud computer":"botOverview.preference.cloud","Local VM":"botOverview.preference.vm","this computer":"botOverview.preference.local","browser only":"botOverview.preference.browser"};function Lt(t,n){return!n||n.map(a=>a||"General").join(", ")!==t?t:n.map(a=>a||s("botAccess.teams.general")).join(", ")}const Bt=t=>Object.hasOwn(Mt,t)?s(Mt[t]):t,$t=(t,n,a)=>Number(t)===1?n:a,Vi=[{line:/^Can talk to all (\d+) other bots, in any department\.$/,key:()=>"botOverview.line.talksToAll",params:([,t])=>({count:Number(t)})},{line:/^Also in charge of these departments: (.+)\.$/,key:()=>"botOverview.line.alsoInCharge",params:([,t],n)=>({departments:Lt(t,n)})},{line:/^Can talk to (\d+) other bots? in its (?:section|department)\.$/,key:([,t])=>$t(t,"botOverview.line.peersSectionOne","botOverview.line.peersSectionMany"),params:([,t])=>({count:Number(t)})},{line:/^Can talk to (\d+) other bots? in its allowed (?:teams|departments)\.$/,key:([,t])=>$t(t,"botOverview.line.peersTeamsOne","botOverview.line.peersTeamsMany"),params:([,t])=>({count:Number(t)})},{line:/^Coordinates its (?:section|department) as Chief of Staff\.$/,key:()=>"botOverview.line.chief",params:()=>({role:s("sidebar.bot.chiefOfStaff")})},{line:/^May also coordinate these (?:teams|departments): (.+)\.$/,key:()=>"botOverview.line.alsoTeams",params:([,t],n)=>({teams:Lt(t,n)})}],Zi=t=>ee()!=="en"&&Object.hasOwn(Vs[ee()]??{},t);function Gi(t,n){for(const a of Vi){const o=a.line.exec(t);if(!o)continue;const i=a.key(o);return Zi(i)?s(i,a.params(o,n)):t}return null}function Ue(t,n){if(Object.hasOwn(At,t))return s(At[t]);const a=Gi(t,n);if(a!==null)return a;const o=/^Can use (\d+) connected apps?: (.+)\.$/.exec(t);if(o)return s(o[1]==="1"?"botOverview.line.appsOne":"botOverview.line.appsMany",{count:Number(o[1]),apps:o[2]});const i=ee()==="en"?null:/^Computer preference: (.+), which isn't available on My Cloud\.$/.exec(t);if(i)return s("botOverview.line.computerNotOnCloud",{preference:Bt(i[1])});const l=/^Computer preference: (.+)\.$/.exec(t);if(l)return s("botOverview.line.computer",{preference:Bt(l[1])});const d=/^Works in (.+)\.$/.exec(t);if(d)return s("botOverview.line.folder",{folder:d[1]});const m=/^Knows how to (.+)\.$/.exec(t);if(m)return s("botOverview.line.skill",{skill:m[1]});const r=/^Listens for “(.+)” webhooks\.$/.exec(t);return r?s("botOverview.line.webhook",{name:r[1]}):t}const Ft={name:"approval.applied.field.name",title:"approval.applied.field.title",description:"approval.applied.field.description",soul:"approval.applied.field.soul",cwd:"approval.applied.field.cwd",notifications:"approval.applied.field.notifications",speakReplies:"approval.applied.field.speakReplies"};function Yi(t,n=ee()){const a=/^(\w+): /.exec(t)?.[1];return n==="en"||!a||!Object.hasOwn(Ft,a)?t:`${s(Ft[a])}: ${t.slice(a.length+2)}`}function Ji({data:t,error:n,open:a,onToggle:o}){return e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("button",{type:"button",onClick:o,"aria-expanded":a,className:"flex w-full items-center justify-between gap-3 text-left",children:[e.jsx("span",{className:"text-[15px] font-medium text-ink",children:t?s("botOverview.promptPreviewCount",{bytes:t.totalBytes.toLocaleString(De()),tokens:t.approxTokens.toLocaleString(De())}):s("botOverview.promptPreview")}),e.jsx(fe,{size:16,className:O("shrink-0 text-ink-secondary transition-transform",a&&"rotate-180")})]}),a&&!t&&n&&e.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:s("botOverview.promptError")}),a&&!t&&!n&&e.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:s("botOverview.loading")}),a&&t&&e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[t.sections.map(i=>e.jsxs("details",{className:"rounded-lg border border-hairline/40 bg-inset px-3 py-2",children:[e.jsxs("summary",{className:"flex cursor-pointer items-center justify-between gap-3 text-[13px] text-ink",children:[e.jsx("span",{children:i.label}),e.jsx("span",{className:"shrink-0 tabular-nums text-ink-secondary",children:s("botOverview.bytes",{count:i.bytes.toLocaleString(De())})})]}),e.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed text-ink",children:i.text})]},i.id)),t.note&&e.jsx("div",{className:"text-[11px] text-ink-secondary",children:t.note})]})]})}function Qi({overview:t,refreshError:n,prompt:a,promptError:o,onOpen:i,onSetup:l}){const[d,m]=x.useState(!1);if(!t)return e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("botOverview.loading")});const c=(t.setup??[]).filter(u=>!u.done),p=(u,k)=>s(`botOverview.setup.${u}`)||k;return e.jsxs("div",{className:"flex flex-col gap-4",children:[n&&e.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[13px] text-ink-secondary",children:s("botOverview.refreshError")}),c.length>0&&e.jsxs("div",{className:"rounded-xl border border-accent/30 bg-accent/[0.06] p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botSetup.ideas")}),e.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:s("botSetup.optional")}),e.jsx("ul",{className:"mt-2 flex flex-col gap-1",children:c.map(u=>e.jsx("li",{children:u.section?e.jsxs("button",{type:"button",onClick:()=>i(u.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:[e.jsx(ut,{"aria-hidden":"true",size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("span",{className:"flex-1",children:p(u.id,u.label)}),e.jsx(je,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-secondary rtl:-scale-x-100"})]}):e.jsxs("div",{className:"flex items-center gap-2.5 px-1 py-1 text-[13px] text-ink",children:[e.jsx(ut,{"aria-hidden":"true",size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("span",{children:p(u.id,u.label)})]})},u.id))}),l&&e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsxs("button",{type:"button",onClick:l,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110",children:[e.jsx(nt,{size:14})," ",s("botSetup.withBot")]}),e.jsx("span",{className:"text-[12px] text-ink-secondary",children:s("botSetup.help")})]})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:t.who.name}),t.who.title&&e.jsx("div",{className:"mt-0.5 text-[13px] text-ink-secondary",children:t.who.title}),t.who.blurb&&e.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink",children:t.who.blurb}),t.who.soulLead&&e.jsxs("div",{className:"mt-3 rounded-lg bg-inset px-3 py-2.5",children:[e.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:t.who.soulLead}),e.jsx("button",{type:"button",onClick:()=>i("soul"),className:"mt-1.5 rounded-md text-[12px] font-medium text-accent-text hover:underline",children:s("botOverview.readAll")})]})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.does")}),t.does.length===0?e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("botOverview.doesEmpty")}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:t.does.map((u,k)=>e.jsx("li",{children:Wi(t.doesRoutines?.[k])??Ue(u)},k))})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.canReach")}),t.reaches.length===0?e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("botOverview.reachEmpty")}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:t.reaches.map((u,k)=>e.jsx("li",{children:Ue(u,t.managedSections)},k))})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.wont")}),e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:t.wont.map((u,k)=>e.jsx("li",{children:Ue(u,t.managedSections)},k))})]}),e.jsx(Ji,{data:a,error:o,open:d,onToggle:()=>m(u=>!u)}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.recentChanges")}),e.jsxs("button",{type:"button",onClick:()=>i("history"),className:"shrink-0 text-[12px] text-ink-secondary hover:text-ink",children:[s("botOverview.viewAll")," ",e.jsx(je,{size:14,"aria-hidden":"true",className:"inline align-[-2px] rtl:-scale-x-100"})]})]}),t.recent.length===0?e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("botOverview.recentEmpty")}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] text-ink",children:t.recent.map((u,k)=>e.jsxs("li",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"min-w-0 truncate",children:Yi(u.summary)}),e.jsxs("span",{className:"shrink-0 text-[12px] text-ink-secondary",children:["· ",ss(u.at)]})]},k))})]})]})}function Xi({managementUrl:t}){return e.jsxs("div",{className:"flex flex-col gap-3 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx("p",{children:s("botSlack.body")}),e.jsxs("a",{href:t,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:[s("botSlack.manage")," ",e.jsx(gs,{size:14,"aria-hidden":"true"})]})]})}function er(t){if(!t||typeof t!="object")return null;const{available:n,managementUrl:a}=t;if(n!==!0||typeof a!="string")return null;try{return new URL(a).protocol==="https:"?a:null}catch{return null}}function Os(t){const[n,a]=x.useState(null);return x.useEffect(()=>{const o=new AbortController;return Z(`/api/bots/${encodeURIComponent(t)}/slack-management`,{signal:o.signal,timeoutMs:1e4}).then(i=>{o.signal.aborted||a({botId:t,url:er(i)})}).catch(()=>{o.signal.aborted||a({botId:t,url:null})}),()=>o.abort()},[t]),n?.botId===t?n.url:null}const Dt="/api/limix/plugins";function Es({bot:t}){const{state:n,dispatch:a}=B(),[o,i]=x.useState(),[l,d]=x.useState(""),[m,r]=x.useState(!1),c=ee().startsWith("vi")?"vi":"en";x.useEffect(()=>{if(n.pluginsOpen)return;const u=new AbortController;return Z(Dt,{signal:u.signal}).then(i).catch(k=>{u.signal.aborted||d(xt(k.message))}),()=>u.abort()},[n.pluginsOpen]);async function p(u,k,f){r(!0),d("");try{i(await Z(Dt,{method:"POST",body:JSON.stringify({action:"assign",target:"bot",key:t.id,id:u,sha256:k,enabled:f})}))}catch(v){d(xt(v instanceof Error?v.message:String(v)))}finally{r(!1)}}return e.jsxs("section",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:ht,onClick:()=>a({type:"togglePlugins",open:!0,surface:"library"}),children:s("plugins.openLibrary")}),l&&e.jsx("p",{role:"alert",className:"text-sm text-danger",children:l}),!o&&!l&&e.jsx("p",{role:"status",className:"text-sm text-ink-secondary",children:ie("Đang tải plugin…","Loading plugins…")}),o?.installed.length===0&&e.jsx("p",{className:"text-sm text-ink-secondary",children:ie("Chưa có plugin sẵn sàng để gắn.","No plugins are ready to attach.")}),o?.installed.map(u=>{const f=!Object.hasOwn(u.bots,t.id)?"inherit":String(u.bots[t.id]),v=nn(u,t,o.installed),j=u.manifest?.source&&!u.allowHostExecution;return e.jsxs("article",{className:"flex flex-wrap items-center gap-3 rounded-xl border border-hairline p-3",children:[e.jsx(an,{icon:u.manifest?.icon??rn(u.id,u.name.en,u.name.vi,...u.requiresMcp),compact:!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("h3",{className:"break-words text-sm font-semibold",children:[u.name[c]," ",e.jsxs("small",{className:"text-ink-secondary",children:["v",u.version]})]}),e.jsx("p",{className:"text-xs text-ink-secondary",children:j?ie("Cần duyệt quyền dùng Skill từ xa trong kho","Remote Skill execution consent required in the library"):v?ie("Đang gắn","Attached"):ie("Chưa gắn","Detached")})]}),e.jsxs("select",{className:ht,value:f,disabled:m,"aria-label":u.name[c]+" v"+u.version,onChange:N=>{p(u.id,u.sha256,N.target.value==="inherit"?null:N.target.value==="true")},children:[e.jsx("option",{value:"inherit",children:ie("Theo nhóm","Inherit from team")}),e.jsx("option",{value:"true",disabled:!!j,children:ie("Gắn plugin","Attach plugin")}),e.jsx("option",{value:"false",children:ie("Tắt trên bot","Disable for this bot")})]})]},u.sha256)})]})}const oe="rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",qe="rounded-md px-2 py-1 text-[13px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50",re=t=>t instanceof Error?t.message:String(t);function Rs(t){const n=[],a=(i,l,d)=>{i&&n.push(s(i===1?l:d,{count:i}))};a(t.expired,"memory.upkeep.summary.archived.one","memory.upkeep.summary.archived.many"),a(t.duplicates,"memory.upkeep.summary.merged.one","memory.upkeep.summary.merged.many"),a(t.superseded,"memory.upkeep.summary.crossed.one","memory.upkeep.summary.crossed.many"),a(t.organized,"memory.upkeep.summary.filed.one","memory.upkeep.summary.filed.many");const o=n.length?n.join(", "):s("memory.upkeep.summary.none");return o.charAt(0).toUpperCase()+o.slice(1)}function tr(t,n){const a=t.via==="team-setup"?s("memory.journal.actor.teamSetup"):t.actor==="bot"?n:t.actor==="import"?s("memory.journal.actor.import"):t.actor==="upkeep"?s("memory.journal.actor.upkeep"):s("memory.journal.actor.you"),o=ui(t.path),i=t.path===se?o:t.path===xi?s("memory.journal.instructions"):t.path.startsWith("memory/log/")?s("memory.journal.log",{file:o}):s("memory.journal.topic",{file:o}),l=d=>s(d===1?"memory.journal.line.one":"memory.journal.line.many",{count:d});return t.kind==="created"?s("memory.journal.created",{who:a,topic:i,detail:t.added?s("memory.journal.withLines",{lines:l(t.added)}):""}):t.kind==="deleted"?s("memory.journal.deleted",{who:a,topic:i}):t.added&&!t.removed?s("memory.journal.added",{who:a,lines:l(t.added),topic:i}):t.removed&&!t.added?s("memory.journal.removed",{who:a,lines:l(t.removed),topic:i}):s("memory.journal.rewrote",{who:a,lines:l(Math.max(t.added,t.removed)),topic:i})}function Ts({changed:t,stale:n,busy:a,onReviewed:o}){return e.jsxs("div",{role:"status",className:"rounded-xl border border-danger/40 bg-card p-4",children:[e.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:s(n?"memory.lendingReviewStale":"memory.lendingReview")}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:s("memory.lendingReviewChanged")}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:t.map(i=>e.jsx("li",{className:"break-all font-mono text-[12px] text-ink",children:i},i))})]}),e.jsx("button",{type:"button",className:O(oe,"mt-3"),disabled:a,onClick:o,children:s("memory.lendingReviewed")})]})}function sr({bot:t,active:n=!0,onToggle:a}){const{capabilities:o}=we(),[i,l]=x.useState(null),[d,m]=x.useState(null),[r,c]=x.useState(null),[p,u]=x.useState(null),[k,f]=x.useState(null),[v,j]=x.useState(null),[N,w]=x.useState(null),[b,h]=x.useState(!1),[P,L]=x.useState(null),[D,$]=x.useState(""),[A,H]=x.useState(null),[I,g]=x.useState(!1),[T,F]=x.useState(null),[_,K]=x.useState(!1),[J,Y]=x.useState(!1),{state:U,dispatch:y}=B(),z=on(U.config),[ce,xe]=x.useState(!1),[ye,E]=x.useState(""),q=async C=>{const[R,$e,Ws]=await Promise.all([rt(t.id),ge(t.id),Pt(t.id).catch(()=>null)]);if(l(R),F(R.lendingReview??null),m($e),H(Ws),C){const Fe=await Ie(t.id,C);c({path:Fe.path,text:Fe.text,hash:Fe.hash,dirty:!1,readOnly:C.startsWith("memory/log/")})}};x.useEffect(()=>{if(!n)return;let C=!1;j(null);const R=r?.dirty===!0;return q(R?void 0:r?.path??se).catch($e=>{C||j(re($e))}),()=>{C=!0}},[n,t.id]);const G=async C=>{j(null),u(null);try{const R=await Ie(t.id,C);c({path:R.path,text:R.text,hash:R.hash,dirty:!1,readOnly:C.startsWith("memory/log/")})}catch(R){j(re(R))}},W=async C=>{if(r){h(!0),j(null);try{const R=await ot(t.id,r.path,r.text,C);if(!R.ok){u({path:r.path,current:R.current,currentHash:R.currentHash});return}u(null),f(null),c({...r,text:R.doc.text,hash:R.doc.hash,dirty:!1}),l(R.overview),m(await ge(t.id))}catch(R){j(re(R))}finally{h(!1)}}},de=()=>{!p||!r||(f(r.text),c({...r,text:p.current,hash:p.currentHash,dirty:!1}),u(null))},Se=async C=>{if(window.confirm(s("memory.confirmDelete",{name:C.name}))){j(null);try{const{overview:R}=await ks(t.id,C.path);l(R),m(await ge(t.id)),r?.path===C.path&&c(null)}catch(R){j(re(R))}}},ct=async()=>{const C=di(D);if(!C){j(s("memory.topicNameError"));return}$(""),await G(`memory/${C}`),c(R=>R&&{...R,dirty:!0,text:R.text||nr(C)})},Hs=async C=>{L(C.id),j(null);try{const R=await js(t.id,C.id);l(R.overview),m(await ge(t.id)),r?.path===C.path&&!r.dirty&&c({...r,text:R.text,hash:R.hash}),w(s("memory.restored",{path:C.path}))}catch(R){j(re(R))}finally{L(null)}},dt=async C=>{j(null),w(null);try{await li(t.id,C)}catch(R){j(re(R))}},_s=()=>{const C=t.memoryUpkeep===!1;y({type:"updateBot",botId:t.id,patch:{memoryUpkeep:C}}),H(R=>R&&{...R,enabled:C})},Ks=async()=>{if(!ce){xe(!0),E("");try{const C=await Z("/api/config",{method:"PATCH",body:JSON.stringify({features:{roomMemoryCapture:!z}})});y({type:"configStatus",config:C})}catch(C){E(C instanceof Error?C.message:s("memory.learnFromRooms.error"))}finally{xe(!1)}}},Us=async()=>{g(!0),j(null),w(null);try{const{report:C,overview:R}=await vs(t.id);l(R),m(await ge(t.id)),H(await Pt(t.id)),r&&!r.dirty&&await G(r.path),w(`${Rs(C)}.${C.note?` ${C.note}`:""}`)}catch(C){j(re(C))}finally{g(!1)}},qs=o.host.homeDir;return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("memory.title")}),e.jsxs("label",{className:"mt-3 flex items-center gap-2 text-[13px] text-ink",children:[e.jsx("input",{type:"checkbox",checked:t.memoryEnabled!==!1,disabled:t.busy,onChange:C=>a(C.target.checked)}),s("memory.enable")]}),e.jsxs("p",{className:"mt-1 text-[13px] text-ink-secondary",children:[s("memory.enableHelp"),t.busy?` ${s("memory.busyHelp")}`:""]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.notesHelp")}),i&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink-secondary",title:i.workspacePath,children:at(i.workspacePath,qs)}),e.jsx("button",{type:"button",className:oe,onClick:()=>{dt("obsidian")},children:s("memory.openObsidian")}),e.jsxs("button",{type:"button",className:O(oe,"inline-flex items-center gap-1.5"),onClick:()=>{dt("folder")},children:[e.jsx(ns,{size:14}),s("memory.showFileManager")]})]})]}),T&&e.jsx(Ts,{changed:T.changed,stale:_,busy:J,onReviewed:()=>{Y(!0),bs(t.id,T.token).then(()=>{F(null),K(!1)}).catch(C=>{if(C instanceof as&&C.status===409)return K(!0),q();j(re(C))}).finally(()=>Y(!1))}}),i&&e.jsx(ir,{index:i.index}),t.memoryEnabled!==!1&&e.jsx(ar,{enabled:t.memoryUpkeep!==!1,status:A,tidying:I,onToggle:_s,onTidy:()=>{Us()},rooms:{enabled:z,saving:ce,error:ye,onToggle:()=>{Ks()}}}),r&&e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate font-mono text-[13px] text-ink",children:r.path}),r.path!==se&&e.jsx("button",{type:"button",className:qe,onClick:()=>{G(se)},children:s("memory.backToIndex")})]}),p&&e.jsx(Is,{botName:t.name,busy:b,onReload:de,onOverwrite:()=>{W(p.currentHash)}}),e.jsx("textarea",{className:O(et,"mt-2 min-h-[200px] resize-y font-mono text-[13px] leading-relaxed"),value:r.text,readOnly:r.readOnly,placeholder:r.path===se?s("memory.indexPlaceholder"):s("memory.notePlaceholder"),"aria-label":r.path===se?s("memory.botMemory"):s("memory.fileLabel",{path:r.path}),onChange:C=>c({...r,text:C.target.value,dirty:!0})}),r.readOnly?e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:s("memory.logsReadOnly")}):e.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{W(r.hash)},disabled:b||!r.dirty,className:oe,children:b?s("memory.saving"):s("memory.save")}),r.dirty&&e.jsx("button",{type:"button",className:qe,disabled:b,onClick:()=>{G(r.path)},children:s("memory.discard")})]}),k!==null&&e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"mb-1 text-[12px] text-ink-secondary",children:s("memory.unsavedDraft")}),e.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:k}),e.jsx("button",{type:"button",className:O(qe,"mt-1"),onClick:()=>f(null),children:s("memory.dismissDraft")})]})]}),i&&e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx(Ht,{title:s("memory.topicFiles"),hint:s("memory.topicFilesHint"),files:i.topics,selected:r?.path,onOpen:C=>{G(C.path)},onDelete:C=>{Se(C)}}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx("input",{className:O(et,"py-1.5 text-[13px]"),value:D,placeholder:s("memory.newTopicPlaceholder"),"aria-label":s("memory.newTopicLabel"),onChange:C=>$(C.target.value),onKeyDown:C=>{C.key==="Enter"&&ct()}}),e.jsx("button",{type:"button",className:oe,disabled:!D.trim(),onClick:()=>{ct()},children:s("memory.newTopic")})]}),i.logs.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(Ht,{title:s("memory.dailyLogs"),hint:s("memory.dailyLogsHint"),files:i.logs,selected:r?.path,onOpen:C=>{G(C.path)},onDelete:C=>{Se(C)}})})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("memory.changes")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.changesHelp")}),e.jsx("div",{className:"mt-3",children:e.jsx(lt,{rows:d,botName:t.name,reverting:P,onRevert:C=>{Hs(C)}})})]}),N&&e.jsx("div",{className:"text-[13px] text-ink-secondary",children:N}),v&&e.jsx("div",{className:"text-[13px] text-danger",children:v})]})}function nr(t){return`---
1
+ import{c as Ae,t as s,l as ee,aF as Vs,j as e,i as De,ae as fe,a as O,r as x,S as tt,ah as Jt,X as st,d as pt}from"./styles-DO3EUxm2.js";import{fv as Zs,fw as Gs,_ as nt,f7 as Qt,bE as Ys,dv as Xt,C as Js,bW as Qs,fx as Xs,E as es,fy as en,M as ts,eE as tn,p as sn,fz as mt,bu as ut,fA as ss,j as Z,u as B,fB as xt,fC as ht,f8 as ie,fD as nn,fE as an,fF as rn,fG as on,ag as at,af as ns,A as as,S as be,ab as Me,T as is,R as ln,fH as cn,fI as dn,fJ as pn,fK as mn,fL as un,fM as gt,fN as xn,fO as hn,fP as gn,fQ as fn,a$ as yn,fR as bn,fS as vn,fT as kn,I as jn,fU as Oe,b$ as Le,fV as wn,aH as M,aN as Q,eo as Nn,dW as Sn,fW as Cn,aI as Ge,cB as Pn,e9 as On,ea as En,fX as Rn,fY as rs,fZ as os,f_ as Tn,f$ as In,g0 as An,g1 as Mn,dZ as Ye,aq as ft,g2 as ze,g3 as Ln,g4 as Re,au as Bn,g5 as ls,g6 as yt,aj as Je,g7 as $n,g8 as Fn,g9 as Dn,ga as cs,gb as zn,gc as bt,gd as Hn,ge as _n,gf as Kn,gg as te,aX as ae,aZ as X,gh as Un,gi as qn,gj as Wn,dh as Vn,aP as Zn,G as Gn,df as ds,ai as Yn,gk as V,aW as me,gl as ue,x as S,gm as Jn,dA as Qn,gn as Be,aY as le,go as Xn,gp as ea,gq as ta,es as sa,gr as vt,gs as na,gt as aa,gu as ia,gv as ra,gw as oa,gx as la,az as ca,gy as ps,gz as ms,gA as da,gB as pa,gC as ma,gD as ua,gE as xa,gF as ha,gG as ga,gH as fa,gI as ya,gJ as us,gK as ba,gL as va,gM as ka,gN as it,g as ja,B as Qe,gO as wa,gP as Na,gQ as Sa,gR as Ca,gS as Pa,gT as Oa,c8 as Ea,gU as xs,D as kt,gV as Ra,fb as Ta,gW as jt,gX as Ia,gY as Aa,gZ as Ma,cY as wt,bC as La,de as Ba,g_ as $a,g$ as hs,h0 as Ce,h1 as Nt,h2 as Fa,aL as He,eb as Da,h3 as za,aR as Ha,dE as _a,cC as Ka,h4 as Ua,h5 as qa,h6 as Wa,aT as Va}from"./App-OHzELG1X.js";import{v as gs,d as we,a0 as Te,a1 as Za,a2 as Ga,a3 as St,a4 as _e,a5 as Ya,a6 as Ja,a7 as Qa,a8 as Xa,a9 as ei,aa as Ct,ab as ti,ac as si,L as Ee,M as ni,B as Xe,P as Ne,r as fs,ad as ai,$ as ii,u as ys}from"./PlacesRail-tZyNm-l3.js";import{C as ri}from"./coins-Cu3qn-3t.js";import{C as je,a as oi}from"./MenuMotion-B0aZnuh_.js";import{b as se,m as bs,i as et,f as rt,c as ge,d as Pt,e as Ie,o as li,g as ci,h as pe,n as Ke,t as vs,s as ot,j as ks,k as di,l as pi,p as mi,r as js,q as ui,u as xi,w as hi,x as ws,y as Ns,z as Ot,B as gi,C as Ss,R as Et,D as fi,E as yi,F as bi,G as vi,H as ki,J as ji,O as wi,K as Ni,L as Cs,N as Rt,V as Si,P as Ci,M as Pi,A as Oi,a as Ei,S as Ri,I as Ti}from"./VisibilitySection-X3MwlVCH.js";import{s as Ii,r as Ai,a as Mi,R as Li}from"./ComputerFilesPane-CIE18AsH.js";import{M as Tt}from"./monitor-zecPzfR5.js";import{R as Bi}from"./RoutinesPage-Dt5n6TUd.js";import{S as $i}from"./SignedInSites-f8T3aw_5.js";import"./index-BruSVBU0.js";import"./org-library-CA4y9Ru8.js";import"./package-format-CpbqH_LB.js";import"./WorksOnGrid-C-i85Bh5.js";import"./ProIntroduction-BYeJLd6v.js";import"./remote-desktop-DDRRx8uY.js";const Fi=[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1glfrc"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]],Di=Ae("calendar-plus",Fi);const zi=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],Hi=Ae("library",zi);const _i=[["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"}]],Ps=Ae("slack",_i);const Ki=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Ui=Ae("tag",Ki),qi=[{id:"overview",label:"Overview",labelKey:"botSettings.sections.overview",icon:Zs,keywords:["summary","status","what it does","won't","prompt","what the model sees"]},{id:"identity",label:"Identity",labelKey:"botSettings.sections.identity",icon:Gs,keywords:["name","title","avatar","blurb","instructions"]},{id:"slack",label:"Slack",icon:Ps,keywords:["slack","slack app","admin","message","direct messages","mentions"]},{id:"soul",label:"Soul",labelKey:"botSettings.sections.soul",icon:nt,keywords:["standing instructions","instructions","persona","rules","soul.md"]},{id:"plugins",label:"Plugins",labelKey:"plugins.botMenu",icon:Qt,keywords:["plugin","attach","gắn"]},{id:"skills",label:"Skills",labelKey:"botSettings.sections.skills",icon:Ys,keywords:["skills","learned","procedures","teach"]},{id:"memory",label:"Memory",labelKey:"botSettings.sections.memory",icon:Xt,keywords:["memory","notes","remember","topics"]},{id:"library",label:"Library",labelKey:"botPanel.tab.library",icon:Hi,keywords:["library","made","pages","apps","files","published"]},{id:"routines",label:"Routines",labelKey:"botSettings.sections.routines",icon:Js,keywords:["schedule","routines","cron","tasks"]},{id:"access",label:"Access",labelKey:"botSettings.sections.access",icon:Qs,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",labelKey:"botSettings.sections.model",icon:Xs,keywords:["engine","model","provider","cli","effort"]},{id:"permissions",label:"Permissions",labelKey:"botSettings.sections.permissions",icon:es,keywords:["auto mode","approve","auto approve","review","routine approvals","coordination","chief of staff","section"]},{id:"voice",label:"Voice & alerts",labelKey:"botSettings.sections.voice",icon:en,keywords:["voice","alerts","notifications","speak"]},{id:"visibility",label:"Who can see it",labelKey:"botSettings.visibility.title",icon:ts,keywords:["visibility","who can see","private","people","admins","members","access","hide"]},{id:"history",label:"History",labelKey:"botSettings.sections.history",icon:tn,keywords:["history","changes","undo","rollback","log"]},{id:"usage",label:"Usage",labelKey:"botSettings.sections.usage",icon:ri,keywords:["tokens","cost","billing"]}],It={completed:"botOverview.routine.last.completed",failed:"botOverview.routine.last.failed",missed:"botOverview.routine.last.missed",cancelled:"botOverview.routine.last.cancelled",running:"botOverview.routine.last.running",queued:"botOverview.routine.last.queued",waiting:"botOverview.routine.last.waiting"};function Wi(t,n=ee()){if(!t||n==="en")return null;if(t.paused)return s("botOverview.routine.paused",{name:t.name});const a=t.lastRun;if(a&&!Object.hasOwn(It,a.status))return null;try{return[s("botOverview.routine.line",{schedule:sn(t.schedule),name:t.name}),...t.nextRunAt!=null?[s("botOverview.routine.next",{time:mt(t.nextRunAt)})]:[],...a?[s(It[a.status],{time:mt(a.at)})]:[]].join(" ")}catch{return null}}const At={"Works in its private workspace.":"botOverview.line.privateWorkspace","Has the built-in browser.":"botOverview.line.browser","Has no connected apps.":"botOverview.line.noApps","Won't act on a schedule.":"botOverview.line.noSchedule","Can talk to the other bot.":"botOverview.line.talksToOne","Talks only to the bots chosen for it.":"botOverview.line.talksToChosen","Cannot initiate contact with other bots.":"botOverview.line.noPeerContact","Command approvals use Ask mode; saved permissions and provider rules still apply.":"botOverview.line.askMode","Command approvals follow the provider's custom configuration.":"botOverview.line.customApprovals","Asks before contacting other bots.":"botOverview.line.asksPeers","Can't use a computer.":"botOverview.line.noComputer","Profile proposal cards require your approval.":"botOverview.line.profileApproval","Connected apps could not be checked.":"botOverview.line.appsUnchecked"},Mt={"Auto; availability is checked when a task starts":"botOverview.preference.auto","cloud computer":"botOverview.preference.cloud","Local VM":"botOverview.preference.vm","this computer":"botOverview.preference.local","browser only":"botOverview.preference.browser"};function Lt(t,n){return!n||n.map(a=>a||"General").join(", ")!==t?t:n.map(a=>a||s("botAccess.teams.general")).join(", ")}const Bt=t=>Object.hasOwn(Mt,t)?s(Mt[t]):t,$t=(t,n,a)=>Number(t)===1?n:a,Vi=[{line:/^Can talk to all (\d+) other bots, in any department\.$/,key:()=>"botOverview.line.talksToAll",params:([,t])=>({count:Number(t)})},{line:/^Also in charge of these departments: (.+)\.$/,key:()=>"botOverview.line.alsoInCharge",params:([,t],n)=>({departments:Lt(t,n)})},{line:/^Can talk to (\d+) other bots? in its (?:section|department)\.$/,key:([,t])=>$t(t,"botOverview.line.peersSectionOne","botOverview.line.peersSectionMany"),params:([,t])=>({count:Number(t)})},{line:/^Can talk to (\d+) other bots? in its allowed (?:teams|departments)\.$/,key:([,t])=>$t(t,"botOverview.line.peersTeamsOne","botOverview.line.peersTeamsMany"),params:([,t])=>({count:Number(t)})},{line:/^Coordinates its (?:section|department) as Chief of Staff\.$/,key:()=>"botOverview.line.chief",params:()=>({role:s("sidebar.bot.chiefOfStaff")})},{line:/^May also coordinate these (?:teams|departments): (.+)\.$/,key:()=>"botOverview.line.alsoTeams",params:([,t],n)=>({teams:Lt(t,n)})}],Zi=t=>ee()!=="en"&&Object.hasOwn(Vs[ee()]??{},t);function Gi(t,n){for(const a of Vi){const o=a.line.exec(t);if(!o)continue;const i=a.key(o);return Zi(i)?s(i,a.params(o,n)):t}return null}function Ue(t,n){if(Object.hasOwn(At,t))return s(At[t]);const a=Gi(t,n);if(a!==null)return a;const o=/^Can use (\d+) connected apps?: (.+)\.$/.exec(t);if(o)return s(o[1]==="1"?"botOverview.line.appsOne":"botOverview.line.appsMany",{count:Number(o[1]),apps:o[2]});const i=ee()==="en"?null:/^Computer preference: (.+), which isn't available on My Cloud\.$/.exec(t);if(i)return s("botOverview.line.computerNotOnCloud",{preference:Bt(i[1])});const l=/^Computer preference: (.+)\.$/.exec(t);if(l)return s("botOverview.line.computer",{preference:Bt(l[1])});const d=/^Works in (.+)\.$/.exec(t);if(d)return s("botOverview.line.folder",{folder:d[1]});const m=/^Knows how to (.+)\.$/.exec(t);if(m)return s("botOverview.line.skill",{skill:m[1]});const r=/^Listens for “(.+)” webhooks\.$/.exec(t);return r?s("botOverview.line.webhook",{name:r[1]}):t}const Ft={name:"approval.applied.field.name",title:"approval.applied.field.title",description:"approval.applied.field.description",soul:"approval.applied.field.soul",cwd:"approval.applied.field.cwd",notifications:"approval.applied.field.notifications",speakReplies:"approval.applied.field.speakReplies"};function Yi(t,n=ee()){const a=/^(\w+): /.exec(t)?.[1];return n==="en"||!a||!Object.hasOwn(Ft,a)?t:`${s(Ft[a])}: ${t.slice(a.length+2)}`}function Ji({data:t,error:n,open:a,onToggle:o}){return e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("button",{type:"button",onClick:o,"aria-expanded":a,className:"flex w-full items-center justify-between gap-3 text-left",children:[e.jsx("span",{className:"text-[15px] font-medium text-ink",children:t?s("botOverview.promptPreviewCount",{bytes:t.totalBytes.toLocaleString(De()),tokens:t.approxTokens.toLocaleString(De())}):s("botOverview.promptPreview")}),e.jsx(fe,{size:16,className:O("shrink-0 text-ink-secondary transition-transform",a&&"rotate-180")})]}),a&&!t&&n&&e.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:s("botOverview.promptError")}),a&&!t&&!n&&e.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:s("botOverview.loading")}),a&&t&&e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[t.sections.map(i=>e.jsxs("details",{className:"rounded-lg border border-hairline/40 bg-inset px-3 py-2",children:[e.jsxs("summary",{className:"flex cursor-pointer items-center justify-between gap-3 text-[13px] text-ink",children:[e.jsx("span",{children:i.label}),e.jsx("span",{className:"shrink-0 tabular-nums text-ink-secondary",children:s("botOverview.bytes",{count:i.bytes.toLocaleString(De())})})]}),e.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed text-ink",children:i.text})]},i.id)),t.note&&e.jsx("div",{className:"text-[11px] text-ink-secondary",children:t.note})]})]})}function Qi({overview:t,refreshError:n,prompt:a,promptError:o,onOpen:i,onSetup:l}){const[d,m]=x.useState(!1);if(!t)return e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("botOverview.loading")});const c=(t.setup??[]).filter(u=>!u.done),p=(u,k)=>s(`botOverview.setup.${u}`)||k;return e.jsxs("div",{className:"flex flex-col gap-4",children:[n&&e.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[13px] text-ink-secondary",children:s("botOverview.refreshError")}),c.length>0&&e.jsxs("div",{className:"rounded-xl border border-accent/30 bg-accent/[0.06] p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botSetup.ideas")}),e.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:s("botSetup.optional")}),e.jsx("ul",{className:"mt-2 flex flex-col gap-1",children:c.map(u=>e.jsx("li",{children:u.section?e.jsxs("button",{type:"button",onClick:()=>i(u.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:[e.jsx(ut,{"aria-hidden":"true",size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("span",{className:"flex-1",children:p(u.id,u.label)}),e.jsx(je,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-secondary rtl:-scale-x-100"})]}):e.jsxs("div",{className:"flex items-center gap-2.5 px-1 py-1 text-[13px] text-ink",children:[e.jsx(ut,{"aria-hidden":"true",size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("span",{children:p(u.id,u.label)})]})},u.id))}),l&&e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsxs("button",{type:"button",onClick:l,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110",children:[e.jsx(nt,{size:14})," ",s("botSetup.withBot")]}),e.jsx("span",{className:"text-[12px] text-ink-secondary",children:s("botSetup.help")})]})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:t.who.name}),t.who.title&&e.jsx("div",{className:"mt-0.5 text-[13px] text-ink-secondary",children:t.who.title}),t.who.blurb&&e.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink",children:t.who.blurb}),t.who.soulLead&&e.jsxs("div",{className:"mt-3 rounded-lg bg-inset px-3 py-2.5",children:[e.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:t.who.soulLead}),e.jsx("button",{type:"button",onClick:()=>i("soul"),className:"mt-1.5 rounded-md text-[12px] font-medium text-accent-text hover:underline",children:s("botOverview.readAll")})]})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.does")}),t.does.length===0?e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("botOverview.doesEmpty")}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:t.does.map((u,k)=>e.jsx("li",{children:Wi(t.doesRoutines?.[k])??Ue(u)},k))})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.canReach")}),t.reaches.length===0?e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("botOverview.reachEmpty")}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:t.reaches.map((u,k)=>e.jsx("li",{children:Ue(u,t.managedSections)},k))})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.wont")}),e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:t.wont.map((u,k)=>e.jsx("li",{children:Ue(u,t.managedSections)},k))})]}),e.jsx(Ji,{data:a,error:o,open:d,onToggle:()=>m(u=>!u)}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.recentChanges")}),e.jsxs("button",{type:"button",onClick:()=>i("history"),className:"shrink-0 text-[12px] text-ink-secondary hover:text-ink",children:[s("botOverview.viewAll")," ",e.jsx(je,{size:14,"aria-hidden":"true",className:"inline align-[-2px] rtl:-scale-x-100"})]})]}),t.recent.length===0?e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("botOverview.recentEmpty")}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] text-ink",children:t.recent.map((u,k)=>e.jsxs("li",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"min-w-0 truncate",children:Yi(u.summary)}),e.jsxs("span",{className:"shrink-0 text-[12px] text-ink-secondary",children:["· ",ss(u.at)]})]},k))})]})]})}function Xi({managementUrl:t}){return e.jsxs("div",{className:"flex flex-col gap-3 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx("p",{children:s("botSlack.body")}),e.jsxs("a",{href:t,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:[s("botSlack.manage")," ",e.jsx(gs,{size:14,"aria-hidden":"true"})]})]})}function er(t){if(!t||typeof t!="object")return null;const{available:n,managementUrl:a}=t;if(n!==!0||typeof a!="string")return null;try{return new URL(a).protocol==="https:"?a:null}catch{return null}}function Os(t){const[n,a]=x.useState(null);return x.useEffect(()=>{const o=new AbortController;return Z(`/api/bots/${encodeURIComponent(t)}/slack-management`,{signal:o.signal,timeoutMs:1e4}).then(i=>{o.signal.aborted||a({botId:t,url:er(i)})}).catch(()=>{o.signal.aborted||a({botId:t,url:null})}),()=>o.abort()},[t]),n?.botId===t?n.url:null}const Dt="/api/limix/plugins";function Es({bot:t}){const{state:n,dispatch:a}=B(),[o,i]=x.useState(),[l,d]=x.useState(""),[m,r]=x.useState(!1),c=ee().startsWith("vi")?"vi":"en";x.useEffect(()=>{if(n.pluginsOpen)return;const u=new AbortController;return Z(Dt,{signal:u.signal}).then(i).catch(k=>{u.signal.aborted||d(xt(k.message))}),()=>u.abort()},[n.pluginsOpen]);async function p(u,k,f){r(!0),d("");try{i(await Z(Dt,{method:"POST",body:JSON.stringify({action:"assign",target:"bot",key:t.id,id:u,sha256:k,enabled:f})}))}catch(v){d(xt(v instanceof Error?v.message:String(v)))}finally{r(!1)}}return e.jsxs("section",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:ht,onClick:()=>a({type:"togglePlugins",open:!0,surface:"library"}),children:s("plugins.openLibrary")}),l&&e.jsx("p",{role:"alert",className:"text-sm text-danger",children:l}),!o&&!l&&e.jsx("p",{role:"status",className:"text-sm text-ink-secondary",children:ie("Đang tải plugin…","Loading plugins…")}),o?.installed.length===0&&e.jsx("p",{className:"text-sm text-ink-secondary",children:ie("Chưa có plugin sẵn sàng để gắn.","No plugins are ready to attach.")}),o?.installed.map(u=>{const f=!Object.hasOwn(u.bots,t.id)?"inherit":String(u.bots[t.id]),v=nn(u,t,o.installed),j=u.manifest?.source&&!u.allowHostExecution;return e.jsxs("article",{className:"flex flex-wrap items-center gap-3 rounded-xl border border-hairline p-3",children:[e.jsx(an,{icon:u.manifest?.icon??rn(u.id,u.name.en,u.name.vi,...u.requiresMcp),compact:!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("h3",{className:"break-words text-sm font-semibold",children:[u.name[c]," ",e.jsxs("small",{className:"text-ink-secondary",children:["v",u.version]})]}),e.jsx("p",{className:"text-xs text-ink-secondary",children:j?ie("Cần duyệt quyền dùng Skill từ xa trong kho","Remote Skill execution consent required in the library"):v?ie("Đang gắn","Attached"):ie("Chưa gắn","Detached")})]}),e.jsxs("select",{className:ht,value:f,disabled:m,"aria-label":u.name[c]+" v"+u.version,onChange:N=>{p(u.id,u.sha256,N.target.value==="inherit"?null:N.target.value==="true")},children:[e.jsx("option",{value:"inherit",children:ie("Theo nhóm","Inherit from team")}),e.jsx("option",{value:"true",disabled:!!j,children:ie("Gắn plugin","Attach plugin")}),e.jsx("option",{value:"false",children:ie("Tắt trên bot","Disable for this bot")})]})]},u.sha256)})]})}const oe="rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",qe="rounded-md px-2 py-1 text-[13px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50",re=t=>t instanceof Error?t.message:String(t);function Rs(t){const n=[],a=(i,l,d)=>{i&&n.push(s(i===1?l:d,{count:i}))};a(t.expired,"memory.upkeep.summary.archived.one","memory.upkeep.summary.archived.many"),a(t.duplicates,"memory.upkeep.summary.merged.one","memory.upkeep.summary.merged.many"),a(t.superseded,"memory.upkeep.summary.crossed.one","memory.upkeep.summary.crossed.many"),a(t.organized,"memory.upkeep.summary.filed.one","memory.upkeep.summary.filed.many");const o=n.length?n.join(", "):s("memory.upkeep.summary.none");return o.charAt(0).toUpperCase()+o.slice(1)}function tr(t,n){const a=t.via==="team-setup"?s("memory.journal.actor.teamSetup"):t.actor==="bot"?n:t.actor==="import"?s("memory.journal.actor.import"):t.actor==="upkeep"?s("memory.journal.actor.upkeep"):s("memory.journal.actor.you"),o=ui(t.path),i=t.path===se?o:t.path===xi?s("memory.journal.instructions"):t.path.startsWith("memory/log/")?s("memory.journal.log",{file:o}):s("memory.journal.topic",{file:o}),l=d=>s(d===1?"memory.journal.line.one":"memory.journal.line.many",{count:d});return t.kind==="created"?s("memory.journal.created",{who:a,topic:i,detail:t.added?s("memory.journal.withLines",{lines:l(t.added)}):""}):t.kind==="deleted"?s("memory.journal.deleted",{who:a,topic:i}):t.added&&!t.removed?s("memory.journal.added",{who:a,lines:l(t.added),topic:i}):t.removed&&!t.added?s("memory.journal.removed",{who:a,lines:l(t.removed),topic:i}):s("memory.journal.rewrote",{who:a,lines:l(Math.max(t.added,t.removed)),topic:i})}function Ts({changed:t,stale:n,busy:a,onReviewed:o}){return e.jsxs("div",{role:"status",className:"rounded-xl border border-danger/40 bg-card p-4",children:[e.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:s(n?"memory.lendingReviewStale":"memory.lendingReview")}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:s("memory.lendingReviewChanged")}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:t.map(i=>e.jsx("li",{className:"break-all font-mono text-[12px] text-ink",children:i},i))})]}),e.jsx("button",{type:"button",className:O(oe,"mt-3"),disabled:a,onClick:o,children:s("memory.lendingReviewed")})]})}function sr({bot:t,active:n=!0,onToggle:a}){const{capabilities:o}=we(),[i,l]=x.useState(null),[d,m]=x.useState(null),[r,c]=x.useState(null),[p,u]=x.useState(null),[k,f]=x.useState(null),[v,j]=x.useState(null),[N,w]=x.useState(null),[b,h]=x.useState(!1),[P,L]=x.useState(null),[D,$]=x.useState(""),[A,H]=x.useState(null),[I,g]=x.useState(!1),[T,F]=x.useState(null),[_,K]=x.useState(!1),[J,Y]=x.useState(!1),{state:U,dispatch:y}=B(),z=on(U.config),[ce,xe]=x.useState(!1),[ye,E]=x.useState(""),q=async C=>{const[R,$e,Ws]=await Promise.all([rt(t.id),ge(t.id),Pt(t.id).catch(()=>null)]);if(l(R),F(R.lendingReview??null),m($e),H(Ws),C){const Fe=await Ie(t.id,C);c({path:Fe.path,text:Fe.text,hash:Fe.hash,dirty:!1,readOnly:C.startsWith("memory/log/")})}};x.useEffect(()=>{if(!n)return;let C=!1;j(null);const R=r?.dirty===!0;return q(R?void 0:r?.path??se).catch($e=>{C||j(re($e))}),()=>{C=!0}},[n,t.id]);const G=async C=>{j(null),u(null);try{const R=await Ie(t.id,C);c({path:R.path,text:R.text,hash:R.hash,dirty:!1,readOnly:C.startsWith("memory/log/")})}catch(R){j(re(R))}},W=async C=>{if(r){h(!0),j(null);try{const R=await ot(t.id,r.path,r.text,C);if(!R.ok){u({path:r.path,current:R.current,currentHash:R.currentHash});return}u(null),f(null),c({...r,text:R.doc.text,hash:R.doc.hash,dirty:!1}),l(R.overview),m(await ge(t.id))}catch(R){j(re(R))}finally{h(!1)}}},de=()=>{!p||!r||(f(r.text),c({...r,text:p.current,hash:p.currentHash,dirty:!1}),u(null))},Se=async C=>{if(window.confirm(s("memory.confirmDelete",{name:C.name}))){j(null);try{const{overview:R}=await ks(t.id,C.path);l(R),m(await ge(t.id)),r?.path===C.path&&c(null)}catch(R){j(re(R))}}},ct=async()=>{const C=di(D);if(!C){j(s("memory.topicNameError"));return}$(""),await G(`memory/${C}`),c(R=>R&&{...R,dirty:!0,text:R.text||nr(C)})},Hs=async C=>{L(C.id),j(null);try{const R=await js(t.id,C.id);l(R.overview),m(await ge(t.id)),r?.path===C.path&&!r.dirty&&c({...r,text:R.text,hash:R.hash}),w(s("memory.restored",{path:C.path}))}catch(R){j(re(R))}finally{L(null)}},dt=async C=>{j(null),w(null);try{await li(t.id,C)}catch(R){j(re(R))}},_s=()=>{const C=t.memoryUpkeep===!1;y({type:"updateBot",botId:t.id,patch:{memoryUpkeep:C}}),H(R=>R&&{...R,enabled:C})},Ks=async()=>{if(!ce){xe(!0),E("");try{const C=await Z("/api/config",{method:"PATCH",body:JSON.stringify({features:{roomMemoryCapture:!z}})});y({type:"configStatus",config:C})}catch(C){E(C instanceof Error?C.message:s("memory.learnFromRooms.error"))}finally{xe(!1)}}},Us=async()=>{g(!0),j(null),w(null);try{const{report:C,overview:R}=await vs(t.id);l(R),m(await ge(t.id)),H(await Pt(t.id)),r&&!r.dirty&&await G(r.path),w(`${Rs(C)}.${C.note?` ${C.note}`:""}`)}catch(C){j(re(C))}finally{g(!1)}},qs=o.host.homeDir;return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("memory.title")}),e.jsxs("label",{className:"mt-3 flex items-center gap-2 text-[13px] text-ink",children:[e.jsx("input",{type:"checkbox",checked:t.memoryEnabled!==!1,disabled:t.busy,onChange:C=>a(C.target.checked)}),s("memory.enable")]}),e.jsxs("p",{className:"mt-1 text-[13px] text-ink-secondary",children:[s("memory.enableHelp"),t.busy?` ${s("memory.busyHelp")}`:""]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.notesHelp")}),i&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink-secondary",title:i.workspacePath,children:at(i.workspacePath,qs)}),e.jsx("button",{type:"button",className:oe,onClick:()=>{dt("obsidian")},children:s("memory.openObsidian")}),e.jsxs("button",{type:"button",className:O(oe,"inline-flex items-center gap-1.5"),onClick:()=>{dt("folder")},children:[e.jsx(ns,{size:14}),s("memory.showFileManager")]})]})]}),T&&e.jsx(Ts,{changed:T.changed,stale:_,busy:J,onReviewed:()=>{Y(!0),bs(t.id,T.token).then(()=>{F(null),K(!1)}).catch(C=>{if(C instanceof as&&C.status===409)return K(!0),q();j(re(C))}).finally(()=>Y(!1))}}),i&&e.jsx(ir,{index:i.index}),t.memoryEnabled!==!1&&e.jsx(ar,{enabled:t.memoryUpkeep!==!1,status:A,tidying:I,onToggle:_s,onTidy:()=>{Us()},rooms:{enabled:z,saving:ce,error:ye,onToggle:()=>{Ks()}}}),r&&e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate font-mono text-[13px] text-ink",children:r.path}),r.path!==se&&e.jsx("button",{type:"button",className:qe,onClick:()=>{G(se)},children:s("memory.backToIndex")})]}),p&&e.jsx(Is,{botName:t.name,busy:b,onReload:de,onOverwrite:()=>{W(p.currentHash)}}),e.jsx("textarea",{className:O(et,"mt-2 min-h-[200px] resize-y font-mono text-[13px] leading-relaxed"),value:r.text,readOnly:r.readOnly,placeholder:r.path===se?s("memory.indexPlaceholder"):s("memory.notePlaceholder"),"aria-label":r.path===se?s("memory.botMemory"):s("memory.fileLabel",{path:r.path}),onChange:C=>c({...r,text:C.target.value,dirty:!0})}),r.readOnly?e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:s("memory.logsReadOnly")}):e.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{W(r.hash)},disabled:b||!r.dirty,className:oe,children:b?s("memory.saving"):s("memory.save")}),r.dirty&&e.jsx("button",{type:"button",className:qe,disabled:b,onClick:()=>{G(r.path)},children:s("memory.discard")})]}),k!==null&&e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"mb-1 text-[12px] text-ink-secondary",children:s("memory.unsavedDraft")}),e.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:k}),e.jsx("button",{type:"button",className:O(qe,"mt-1"),onClick:()=>f(null),children:s("memory.dismissDraft")})]})]}),i&&e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx(Ht,{title:s("memory.topicFiles"),hint:s("memory.topicFilesHint"),files:i.topics,selected:r?.path,onOpen:C=>{G(C.path)},onDelete:C=>{Se(C)}}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx("input",{className:O(et,"py-1.5 text-[13px]"),value:D,placeholder:s("memory.newTopicPlaceholder"),"aria-label":s("memory.newTopicLabel"),onChange:C=>$(C.target.value),onKeyDown:C=>{C.key==="Enter"&&ct()}}),e.jsx("button",{type:"button",className:oe,disabled:!D.trim(),onClick:()=>{ct()},children:s("memory.newTopic")})]}),i.logs.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(Ht,{title:s("memory.dailyLogs"),hint:s("memory.dailyLogsHint"),files:i.logs,selected:r?.path,onOpen:C=>{G(C.path)},onDelete:C=>{Se(C)}})})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("memory.changes")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.changesHelp")}),e.jsx("div",{className:"mt-3",children:e.jsx(lt,{rows:d,botName:t.name,reverting:P,onRevert:C=>{Hs(C)}})})]}),N&&e.jsx("div",{className:"text-[13px] text-ink-secondary",children:N}),v&&e.jsx("div",{className:"text-[13px] text-danger",children:v})]})}function nr(t){return`---
2
2
  title: ${t.replace(/\.md$/,"")}
3
3
  description:
4
4
  aliases: []