limixbot 0.3.1 → 0.3.2
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.
- package/dist/assets/{ActivityPanel-O6Su2c-u.js → ActivityPanel-BDwrkDBX.js} +1 -1
- package/dist/assets/{App-Bcey1qup.js → App-Cb2UOJS6.js} +101 -101
- package/dist/assets/{AppEventEditor-BlJGPJ3Z.js → AppEventEditor-B383TR3m.js} +1 -1
- package/dist/assets/BotSettingsDialog-CbbZerHF.js +16 -0
- package/dist/assets/{BrowserPanel-BWcb5CXi.js → BrowserPanel-DY-yCZ9T.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-dKHyQotG.js → BrowserProfilesManager-BmOMzdgM.js} +1 -1
- package/dist/assets/{CloudAddDialog-D1ZSbkxV.js → CloudAddDialog-DP5-ha1H.js} +1 -1
- package/dist/assets/{ComputerFilesPane-wgtikCgi.js → ComputerFilesPane-CB2u6MXN.js} +1 -1
- package/dist/assets/{ComputerPanel-Cyj53a7W.js → ComputerPanel-DI10c-7Z.js} +2 -2
- package/dist/assets/{DataPanel-BlBidswi.js → DataPanel-fAjB6GSn.js} +1 -1
- package/dist/assets/{DesktopViewer-D7JeLJbi.js → DesktopViewer-mWGetNwB.js} +1 -1
- package/dist/assets/{FilesView-CNkEKeZB.js → FilesView-CLR6NiY2.js} +1 -1
- package/dist/assets/{GrokMoveDialog-fyBulzXL.js → GrokMoveDialog-lZOa5ZKz.js} +1 -1
- package/dist/assets/{InspectorPanel-Cut2OqiB.js → InspectorPanel-lOPEUSb8.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-DnxUB4cd.js → KeyboardShortcutsModal-BGRMc9wJ.js} +1 -1
- package/dist/assets/{LiveDesktop-CnbyXW61.js → LiveDesktop-LRjYEzUz.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-D9xFPGF0.js → LocalVmWorkspace-Bwq-s97O.js} +1 -1
- package/dist/assets/{MacLocalControl-CpswtfCI.js → MacLocalControl-DuTxY3A3.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-V-y-0ksi.js → MarkdownFilePreview-B69UWgiO.js} +1 -1
- package/dist/assets/{MenuMotion-VeZ_fZ8M.js → MenuMotion-DKMkKESs.js} +1 -1
- package/dist/assets/{NewBotDialog-rBjsSV0e.js → NewBotDialog-Bpi6-xSj.js} +1 -1
- package/dist/assets/{PhoneAppDialog-DAW1N-hM.js → PhoneAppDialog-V46SXKel.js} +1 -1
- package/dist/assets/{PlacesRail-C_3Mh4C8.js → PlacesRail-4ErVypbT.js} +1 -1
- package/dist/assets/{PluginsPanel-CMsgWSNg.js → PluginsPanel-Cw8XeQBF.js} +1 -1
- package/dist/assets/{ProIntroduction-6ByF2_US.js → ProIntroduction-DPYk--IK.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-D4X4rHMQ.js → RemoteAgentSettingsPanel-qxzESq_H.js} +1 -1
- package/dist/assets/{RoomPanel-mg6M04wy.js → RoomPanel-DaoRmKS_.js} +1 -1
- package/dist/assets/{RoutinesPage-DomuZMUT.js → RoutinesPage-CD1DvtyW.js} +1 -1
- package/dist/assets/{SettingsModal-Dd9l0b2C.js → SettingsModal-C359HBUM.js} +1 -1
- package/dist/assets/{ShareTeamDialog-B_0Gr8Mq.js → ShareTeamDialog-rc1xx02E.js} +1 -1
- package/dist/assets/{SignedInSites-C-eqeBxT.js → SignedInSites-CPp5ofCJ.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-DpXOFOQr.js → TeamLibraryPanel-D-iDVZPU.js} +1 -1
- package/dist/assets/{TeamMapPage-CIQPYaxL.js → TeamMapPage-od4f3NJr.js} +1 -1
- package/dist/assets/{TriggersPage-D7RDjrjV.js → TriggersPage-D2ovyRGM.js} +1 -1
- package/dist/assets/{VisibilitySection-Bimhk6c5.js → VisibilitySection-oSi2vtmx.js} +1 -1
- package/dist/assets/{WebhookTrigger-D5c2bPJu.js → WebhookTrigger-CyP8At0y.js} +1 -1
- package/dist/assets/{WorksOnGrid-PZ-caKHg.js → WorksOnGrid-DbfBPgPv.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-D7az-C1J.js → abnfDiagram-YUKMZFIV-C7wn2CLu.js} +1 -1
- package/dist/assets/{activity-W_ia4q-Y.js → activity-Cru8B1z7.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-B2IC9169.js → architectureDiagram-47P4ROYG-DgFc7YIC.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-FnweBzU4.js → blockDiagram-E7TT5TSB-qR-t8DMo.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-rxgwSaAP.js → c4Diagram-CRA5TL53-DdmUjVbB.js} +1 -1
- package/dist/assets/{calendar-days-wM1DS-Cu.js → calendar-days-CN7x0QvP.js} +1 -1
- package/dist/assets/channel-BIffrG1w.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-B7yhqEe8.js → chunk-2Q5K7J3B-D09jrdDt.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-Sw6phnaf.js → chunk-5VM5RSS4-DJXT-XDN.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-CheglUSd.js → chunk-7TKQ45FW-CaULsRlr.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-CswkqPkf.js → chunk-AW2ZBBNX-BcEB179w.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-DeN53o4S.js → chunk-FVRAUYC3-DMhPq4_N.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-CCZ_Udf0.js → chunk-HTAEGDNF-DcoWRcH-.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-nG1rfC9P.js → chunk-JWPE2WC7-CpN6DEZO.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-Bh_TxL0e.js → chunk-KQW6MTUR-BxIldIqB.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CLIJBS-V.js → chunk-XXDRQBXY--M4TxaOR.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-B04FntQx.js → classDiagram-v2-K4WV4PDN-DQUUn5pg.js} +1 -1
- package/dist/assets/{coins-81htcDNx.js → coins-DxQLVJqa.js} +1 -1
- package/dist/assets/{core-BLAzrox0.js → core-CjjU--NA.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-D9PAieWF.js → cose-bilkent-JH36ORCC-DCCMLnpT.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-BAC2DRg5.js → cynefin-EF2NZ3EQ-iK--S4gB.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-Cc3k_C-5.js → cynefinDiagram-3GCD6N5R-DiwEQVzk.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-CpbzxBGo.js → dagre-W4DXFKR2-Bb-WXIrp.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-d22NGVzG.js → diagram-2UJZ2QOL-CU1G-LPy.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-BFTJTNpN.js → diagram-OVF4WLC6-KUL_hQtY.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-CA_YgAo3.js → diagram-PFPMY2P6-Du0EMvGo.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-CCsuWndY.js → diagram-UMYRVEAY-BUNv47Vc.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-Bcwhmpgl.js → diagram-YEKJPTXX-DyWO406P.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-Bs1iIjhq.js → diagram-ZIFT7M5P-DGps1w58.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-CFr96fLM.js → ebnfDiagram-VR2GEFS7-BxaaJRK8.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-DSdTG_hW.js → elk-IJKZMXRS-BuVZZmTr.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-BGdMdwi1.js → erDiagram-O2IAPWRE-qhhsO6Fp.js} +1 -1
- package/dist/assets/{file-up-DvGMRF5I.js → file-up-BiK20g0M.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-DL25A20O.js → flowDiagram-OXPTDLAJ-BsRrcKnA.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-DQaNIRGv.js → ganttDiagram-R7TSEDQI-jVqCmREp.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-B6ypA1ZF.js → gitGraphDiagram-XJZIOB7I-COi9bChD.js} +1 -1
- package/dist/assets/{import-name-Cdh9ZlkK.js → import-name-CrWA8Hw3.js} +1 -1
- package/dist/assets/{index-CxcnLo81.js → index-BIC6c7Sg.js} +1 -1
- package/dist/assets/{index-oVds-_Vz.js → index-Bhz3ZrDI.js} +2 -2
- package/dist/assets/{index-BaW02tJl.js → index-Dy5VWChH.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-8YbtI4S4.js → infoDiagram-5W2HQ5XZ-CUfzOgVW.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-DYpDWk2K.js → ishikawaDiagram-K3B6WC7H-DMR_Ey1I.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-BUd8Vnbq.js → journeyDiagram-COXZFDF6-UiPc_2sp.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-AywqsEBB.js → kanban-definition-P3RFRI5V-VvQXCMxr.js} +1 -1
- package/dist/assets/{mcp-servers-Bu5RuYBT.js → mcp-servers-CBCpG62C.js} +1 -1
- package/dist/assets/{mermaid.core-B5yiNmEY.js → mermaid.core-BZKmLobY.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-DRALSCg6.js → mindmap-definition-LZFPQGKD-BJi3q0s6.js} +1 -1
- package/dist/assets/{minimize-CWsi9mRL.js → minimize-B78LHbd3.js} +1 -1
- package/dist/assets/{monitor-c1mf38zt.js → monitor-UBjV7Qf5.js} +1 -1
- package/dist/assets/{new-bot-mp2gi3ed.js → new-bot-D0DDXTKe.js} +1 -1
- package/dist/assets/{org-library-Bi3EieNo.js → org-library-BdlqWown.js} +1 -1
- package/dist/assets/{package-format-CaPiTXn3.js → package-format-EwGfXp1v.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-Drj_UJz5.js → pegDiagram-BGZESJAR-C6W87HN9.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-CL7MryRt.js → pieDiagram-CAPJLFHJ-B1E_Ycub.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-BvWxqPJn.js → quadrantDiagram-GDMTTRAM-BasGTzC_.js} +1 -1
- package/dist/assets/{rail-DApFzTxo.js → rail-BFRrwJ6b.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-CGfR0UsO.js → railroadDiagram-SM67HX2B-BZVzOUlx.js} +1 -1
- package/dist/assets/{remote-desktop-panel-B4uIIoh3.js → remote-desktop-panel--ikzFjV8.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-CJq96anP.js → requirementDiagram-X7JNWC4A-C8s2XakO.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-BdZSA65i.js → sankeyDiagram-UM26HJRW-CCCP1mnQ.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-B5W6udgn.js → sequenceDiagram-ZO4K6R2Y-BvwC79vw.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-CuKCNVLn.js → sizeCapture-INFHLROL-DzRVDjCL.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-C7mAgpvB.js → stateDiagram-v2-TBUQTH76-CKVmZfLe.js} +1 -1
- package/dist/assets/{styles-C_rlkDrt.js → styles-Bo7bYxUt.js} +5 -5
- package/dist/assets/{swimlanes-N4OXWK64-D-mimAU7.js → swimlanes-N4OXWK64-BaSkTx2s.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-D67LlSLv.js +8 -0
- package/dist/assets/{team-share-wuAG66b7.js → team-share-BgI5VFVf.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-C5prnOXi.js → timeline-definition-YOQAKGHF-Np9aXu8d.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-BC-9KKSF.js → usecaseDiagram-VIAY4XPW-CaHpESyo.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-LCNTQN9e.js → vennDiagram-BLWOH2XV-BpnM9QrV.js} +1 -1
- package/dist/assets/vi-B8BbvT0G.js +15 -0
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-CtWGEzVU.js → wardleyDiagram-YMQ3BMBF-Cb0psm8G.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-DadPRdBp.js → xychartDiagram-TAQBALBS-Bi_SjN1M.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/index.js +426 -421
- package/dist-server/openmausbot.js +22 -22
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +22 -22
- package/dist-server/server/index.js +1 -1
- package/dist-server/server/limix-skill-folder.js +72 -0
- package/dist-server/server/routes/bot-skills.js +2 -1
- package/package.json +1 -1
- package/dist/assets/BotSettingsDialog-PiCk9us7.js +0 -16
- package/dist/assets/channel-BQyC_QMX.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-Dn31PG7h.js +0 -8
- package/dist/assets/vi-NX09tr5q.js +0 -15
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{c as Ce,t as s,b as ee,aA as Os,j as e,i as Ae,ae as pe,a as O,r as x,S as Lt,ah as Mt,o as Es,X as Tt}from"./styles-C_rlkDrt.js";import{fb as Rs,fc as Is,_ as Ve,bu as As,de as Bt,w as Ls,fd as Ms,fe as Ts,E as Dt,ff as Bs,N as Ft,ep as Ds,x as Fs,fg as st,bp as at,fh as $t,n as se,u as B,fi as $s,ad as Ge,F as zt,A as Ht,S as nt,a9 as Pe,T as _t,R as zs,fj as Hs,fk as _s,fl as Us,fm as Ks,fn as qs,fo as rt,fp as Ws,fq as Vs,fr as Gs,fs as Ys,b5 as Js,ft as Qs,fu as Xs,fv as Zs,I as ea,fw as ke,bL as Ye,fx as ta,aE as L,aK as X,e9 as sa,dG as aa,fy as na,aF as He,cl as ra,dV as ia,dW as la,fz as oa,fA as Ut,fB as Kt,fC as ca,fD as da,fE as ua,fF as ma,dJ as _e,an as it,fG as Le,fH as pa,fI as je,ar as xa,fJ as qt,fK as lt,ag as Ue,fL as ha,fM as fa,fN as ga,fO as Wt,fP as ya,fQ as va,fR as ba,fS as ka,fT as Q,aT as te,aV as J,fU as ja,fV as wa,fW as Na,d1 as Sa,d as Ca,G as Pa,c$ as Vt,af as Oa,fX as W,aS as ce,fY as fe,fZ as Ea,dk as Ra,f_ as Oe,aU as re,f$ as Ia,g0 as Aa,g1 as La,ec as Ma,g2 as ot,g3 as Ta,g4 as Ba,g5 as Da,g6 as Fa,g7 as $a,g8 as za,ay as Ha,g9 as Gt,ga as _a,gb as Ua,gc as Ka,gd as qa,ge as Wa,gf as Va,gg as Ga,gh as Ya,gi as Ja,gj as Qa,gk as Xa,gl as Za,gm as Je,k as en,B as Ke,gn as tn,go as sn,gp as an,gq as nn,bU as rn,gr as Yt,eT as ln,gs as ct,gt as on,gu as cn,cI as dt,bs as dn,c_ as un,gv as mn,gw as Jt,gx as ve,gy as ut,gz as pn,aI as Me,dX as xn,gA as hn,aN as fn,C as gn,cm as yn,gB as vn,gC as bn,gD as kn,aP as jn}from"./App-Bcey1qup.js";import{y as Qt,d as ge,a0 as we,a1 as wn,a2 as Nn,a3 as mt,a4 as Te,a5 as Sn,a6 as Cn,a7 as Pn,a8 as On,a9 as En,aa as pt,ab as Rn,ac as In,L as An,K as Ln,B as qe,P as Ee,r as Mn,ad as Tn,$ as Bn,u as Xt}from"./PlacesRail-C_3Mh4C8.js";import{C as Dn}from"./coins-81htcDNx.js";import{C as he,a as Fn}from"./MenuMotion-VeZ_fZ8M.js";import{b as Z,m as Zt,i as We,f as Qe,c as me,d as xt,e as Ne,o as $n,g as zn,h as oe,n as Be,t as es,s as Xe,j as ts,k as Hn,l as _n,p as Un,r as ss,q as Kn,u as qn,w as Wn,x as as,y as ns,z as ht,B as Vn,C as rs,R as ft,D as Gn,E as Yn,F as Jn,G as Qn,H as Xn,J as Zn,O as er,K as tr,L as is,N as sr,V as ar,P as nr,M as rr,A as ir,a as lr,S as or,I as cr}from"./VisibilitySection-Bimhk6c5.js";import{s as dr,r as ur,a as mr,R as pr}from"./ComputerFilesPane-wgtikCgi.js";import{M as gt}from"./monitor-c1mf38zt.js";import{a as ls,m as os,b as xr,c as hr}from"./mcp-servers-Bu5RuYBT.js";import{R as fr}from"./RoutinesPage-DomuZMUT.js";import{S as gr}from"./SignedInSites-C-eqeBxT.js";import"./index-oVds-_Vz.js";import"./org-library-Bi3EieNo.js";import"./package-format-CaPiTXn3.js";import"./WorksOnGrid-PZ-caKHg.js";import"./ProIntroduction-6ByF2_US.js";import"./remote-desktop-DDRRx8uY.js";const yr=[["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"}]],vr=Ce("calendar-plus",yr);const br=[["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"}]],kr=Ce("library",br);const jr=[["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"}]],cs=Ce("slack",jr);const wr=[["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"}]],Nr=Ce("tag",wr),Sr=[{id:"overview",label:"Overview",labelKey:"botSettings.sections.overview",icon:Rs,keywords:["summary","status","what it does","won't","prompt","what the model sees"]},{id:"identity",label:"Identity",labelKey:"botSettings.sections.identity",icon:Is,keywords:["name","title","avatar","blurb","instructions"]},{id:"slack",label:"Slack",icon:cs,keywords:["slack","slack app","admin","message","direct messages","mentions"]},{id:"soul",label:"Soul",labelKey:"botSettings.sections.soul",icon:Ve,keywords:["standing instructions","instructions","persona","rules","soul.md"]},{id:"skills",label:"Skills",labelKey:"botSettings.sections.skills",icon:As,keywords:["skills","learned","procedures","teach"]},{id:"memory",label:"Memory",labelKey:"botSettings.sections.memory",icon:Bt,keywords:["memory","notes","remember","topics"]},{id:"library",label:"Library",labelKey:"botPanel.tab.library",icon:kr,keywords:["library","made","pages","apps","files","published"]},{id:"routines",label:"Routines",labelKey:"botSettings.sections.routines",icon:Ls,keywords:["schedule","routines","cron","tasks"]},{id:"access",label:"Access",labelKey:"botSettings.sections.access",icon:Ms,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:Ts,keywords:["engine","model","provider","cli","effort"]},{id:"permissions",label:"Permissions",labelKey:"botSettings.sections.permissions",icon:Dt,keywords:["auto mode","approve","auto approve","review","routine approvals","coordination","chief of staff","section"]},{id:"voice",label:"Voice & alerts",labelKey:"botSettings.sections.voice",icon:Bs,keywords:["voice","alerts","notifications","speak"]},{id:"visibility",label:"Who can see it",labelKey:"botSettings.visibility.title",icon:Ft,keywords:["visibility","who can see","private","people","admins","members","access","hide"]},{id:"history",label:"History",labelKey:"botSettings.sections.history",icon:Ds,keywords:["history","changes","undo","rollback","log"]},{id:"usage",label:"Usage",labelKey:"botSettings.sections.usage",icon:Dn,keywords:["tokens","cost","billing"]}],yt={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 Cr(t,a=ee()){if(!t||a==="en")return null;if(t.paused)return s("botOverview.routine.paused",{name:t.name});const n=t.lastRun;if(n&&!Object.hasOwn(yt,n.status))return null;try{return[s("botOverview.routine.line",{schedule:Fs(t.schedule),name:t.name}),...t.nextRunAt!=null?[s("botOverview.routine.next",{time:st(t.nextRunAt)})]:[],...n?[s(yt[n.status],{time:st(n.at)})]:[]].join(" ")}catch{return null}}const vt={"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"},bt={"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 kt(t,a){return!a||a.map(n=>n||"General").join(", ")!==t?t:a.map(n=>n||s("botAccess.teams.general")).join(", ")}const jt=t=>Object.hasOwn(bt,t)?s(bt[t]):t,wt=(t,a,n)=>Number(t)===1?a:n,Pr=[{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],a)=>({departments:kt(t,a)})},{line:/^Can talk to (\d+) other bots? in its (?:section|department)\.$/,key:([,t])=>wt(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])=>wt(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],a)=>({teams:kt(t,a)})}],Or=t=>ee()!=="en"&&Object.hasOwn(Os[ee()]??{},t);function Er(t,a){for(const n of Pr){const l=n.line.exec(t);if(!l)continue;const r=n.key(l);return Or(r)?s(r,n.params(l,a)):t}return null}function De(t,a){if(Object.hasOwn(vt,t))return s(vt[t]);const n=Er(t,a);if(n!==null)return n;const l=/^Can use (\d+) connected apps?: (.+)\.$/.exec(t);if(l)return s(l[1]==="1"?"botOverview.line.appsOne":"botOverview.line.appsMany",{count:Number(l[1]),apps:l[2]});const r=ee()==="en"?null:/^Computer preference: (.+), which isn't available on My Cloud\.$/.exec(t);if(r)return s("botOverview.line.computerNotOnCloud",{preference:jt(r[1])});const i=/^Computer preference: (.+)\.$/.exec(t);if(i)return s("botOverview.line.computer",{preference:jt(i[1])});const c=/^Works in (.+)\.$/.exec(t);if(c)return s("botOverview.line.folder",{folder:c[1]});const d=/^Knows how to (.+)\.$/.exec(t);if(d)return s("botOverview.line.skill",{skill:d[1]});const o=/^Listens for “(.+)” webhooks\.$/.exec(t);return o?s("botOverview.line.webhook",{name:o[1]}):t}const Nt={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 Rr(t,a=ee()){const n=/^(\w+): /.exec(t)?.[1];return a==="en"||!n||!Object.hasOwn(Nt,n)?t:`${s(Nt[n])}: ${t.slice(n.length+2)}`}function Ir({data:t,error:a,open:n,onToggle:l}){return e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("button",{type:"button",onClick:l,"aria-expanded":n,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(Ae()),tokens:t.approxTokens.toLocaleString(Ae())}):s("botOverview.promptPreview")}),e.jsx(pe,{size:16,className:O("shrink-0 text-ink-secondary transition-transform",n&&"rotate-180")})]}),n&&!t&&a&&e.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:s("botOverview.promptError")}),n&&!t&&!a&&e.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:s("botOverview.loading")}),n&&t&&e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[t.sections.map(r=>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:r.label}),e.jsx("span",{className:"shrink-0 tabular-nums text-ink-secondary",children:s("botOverview.bytes",{count:r.bytes.toLocaleString(Ae())})})]}),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:r.text})]},r.id)),t.note&&e.jsx("div",{className:"text-[11px] text-ink-secondary",children:t.note})]})]})}function Ar({overview:t,refreshError:a,prompt:n,promptError:l,onOpen:r,onSetup:i}){const[c,d]=x.useState(!1);if(!t)return e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("botOverview.loading")});const u=(t.setup??[]).filter(h=>!h.done),p=(h,k)=>s(`botOverview.setup.${h}`)||k;return e.jsxs("div",{className:"flex flex-col gap-4",children:[a&&e.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[13px] text-ink-secondary",children:s("botOverview.refreshError")}),u.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:u.map(h=>e.jsx("li",{children:h.section?e.jsxs("button",{type:"button",onClick:()=>r(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:[e.jsx(at,{"aria-hidden":"true",size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("span",{className:"flex-1",children:p(h.id,h.label)}),e.jsx(he,{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(at,{"aria-hidden":"true",size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("span",{children:p(h.id,h.label)})]})},h.id))}),i&&e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsxs("button",{type:"button",onClick:i,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(Ve,{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:()=>r("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((h,k)=>e.jsx("li",{children:Cr(t.doesRoutines?.[k])??De(h)},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((h,k)=>e.jsx("li",{children:De(h,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((h,k)=>e.jsx("li",{children:De(h,t.managedSections)},k))})]}),e.jsx(Ir,{data:n,error:l,open:c,onToggle:()=>d(h=>!h)}),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:()=>r("history"),className:"shrink-0 text-[12px] text-ink-secondary hover:text-ink",children:[s("botOverview.viewAll")," ",e.jsx(he,{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((h,k)=>e.jsxs("li",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"min-w-0 truncate",children:Rr(h.summary)}),e.jsxs("span",{className:"shrink-0 text-[12px] text-ink-secondary",children:["· ",$t(h.at)]})]},k))})]})]})}function Lr({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(Qt,{size:14,"aria-hidden":"true"})]})]})}function Mr(t){if(!t||typeof t!="object")return null;const{available:a,managementUrl:n}=t;if(a!==!0||typeof n!="string")return null;try{return new URL(n).protocol==="https:"?n:null}catch{return null}}function ds(t){const[a,n]=x.useState(null);return x.useEffect(()=>{const l=new AbortController;return se(`/api/bots/${encodeURIComponent(t)}/slack-management`,{signal:l.signal,timeoutMs:1e4}).then(r=>{l.signal.aborted||n({botId:t,url:Mr(r)})}).catch(()=>{l.signal.aborted||n({botId:t,url:null})}),()=>l.abort()},[t]),a?.botId===t?a.url:null}const ne="rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",Fe="rounded-md px-2 py-1 text-[13px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50",ae=t=>t instanceof Error?t.message:String(t);function us(t){const a=[],n=(r,i,c)=>{r&&a.push(s(r===1?i:c,{count:r}))};n(t.expired,"memory.upkeep.summary.archived.one","memory.upkeep.summary.archived.many"),n(t.duplicates,"memory.upkeep.summary.merged.one","memory.upkeep.summary.merged.many"),n(t.superseded,"memory.upkeep.summary.crossed.one","memory.upkeep.summary.crossed.many"),n(t.organized,"memory.upkeep.summary.filed.one","memory.upkeep.summary.filed.many");const l=a.length?a.join(", "):s("memory.upkeep.summary.none");return l.charAt(0).toUpperCase()+l.slice(1)}function Tr(t,a){const n=t.via==="team-setup"?s("memory.journal.actor.teamSetup"):t.actor==="bot"?a:t.actor==="import"?s("memory.journal.actor.import"):t.actor==="upkeep"?s("memory.journal.actor.upkeep"):s("memory.journal.actor.you"),l=Kn(t.path),r=t.path===Z?l:t.path===qn?s("memory.journal.instructions"):t.path.startsWith("memory/log/")?s("memory.journal.log",{file:l}):s("memory.journal.topic",{file:l}),i=c=>s(c===1?"memory.journal.line.one":"memory.journal.line.many",{count:c});return t.kind==="created"?s("memory.journal.created",{who:n,topic:r,detail:t.added?s("memory.journal.withLines",{lines:i(t.added)}):""}):t.kind==="deleted"?s("memory.journal.deleted",{who:n,topic:r}):t.added&&!t.removed?s("memory.journal.added",{who:n,lines:i(t.added),topic:r}):t.removed&&!t.added?s("memory.journal.removed",{who:n,lines:i(t.removed),topic:r}):s("memory.journal.rewrote",{who:n,lines:i(Math.max(t.added,t.removed)),topic:r})}function ms({changed:t,stale:a,busy:n,onReviewed:l}){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(a?"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(r=>e.jsx("li",{className:"break-all font-mono text-[12px] text-ink",children:r},r))})]}),e.jsx("button",{type:"button",className:O(ne,"mt-3"),disabled:n,onClick:l,children:s("memory.lendingReviewed")})]})}function Br({bot:t,active:a=!0,onToggle:n}){const{capabilities:l}=ge(),[r,i]=x.useState(null),[c,d]=x.useState(null),[o,u]=x.useState(null),[p,h]=x.useState(null),[k,f]=x.useState(null),[b,y]=x.useState(null),[C,v]=x.useState(null),[w,N]=x.useState(!1),[E,M]=x.useState(null),[F,T]=x.useState(""),[I,z]=x.useState(null),[A,m]=x.useState(!1),[R,D]=x.useState(null),[H,_]=x.useState(!1),[Y,G]=x.useState(!1),{state:U,dispatch:g}=B(),$=$s(U.config),[ie,de]=x.useState(!1),[xe,S]=x.useState(""),K=async j=>{const[P,Re,Ps]=await Promise.all([Qe(t.id),me(t.id),xt(t.id).catch(()=>null)]);if(i(P),D(P.lendingReview??null),d(Re),z(Ps),j){const Ie=await Ne(t.id,j);u({path:Ie.path,text:Ie.text,hash:Ie.hash,dirty:!1,readOnly:j.startsWith("memory/log/")})}};x.useEffect(()=>{if(!a)return;let j=!1;y(null);const P=o?.dirty===!0;return K(P?void 0:o?.path??Z).catch(Re=>{j||y(ae(Re))}),()=>{j=!0}},[a,t.id]);const V=async j=>{y(null),h(null);try{const P=await Ne(t.id,j);u({path:P.path,text:P.text,hash:P.hash,dirty:!1,readOnly:j.startsWith("memory/log/")})}catch(P){y(ae(P))}},q=async j=>{if(o){N(!0),y(null);try{const P=await Xe(t.id,o.path,o.text,j);if(!P.ok){h({path:o.path,current:P.current,currentHash:P.currentHash});return}h(null),f(null),u({...o,text:P.doc.text,hash:P.doc.hash,dirty:!1}),i(P.overview),d(await me(t.id))}catch(P){y(ae(P))}finally{N(!1)}}},le=()=>{!p||!o||(f(o.text),u({...o,text:p.current,hash:p.currentHash,dirty:!1}),h(null))},ye=async j=>{if(window.confirm(s("memory.confirmDelete",{name:j.name}))){y(null);try{const{overview:P}=await ts(t.id,j.path);i(P),d(await me(t.id)),o?.path===j.path&&u(null)}catch(P){y(ae(P))}}},et=async()=>{const j=Hn(F);if(!j){y(s("memory.topicNameError"));return}T(""),await V(`memory/${j}`),u(P=>P&&{...P,dirty:!0,text:P.text||Dr(j)})},js=async j=>{M(j.id),y(null);try{const P=await ss(t.id,j.id);i(P.overview),d(await me(t.id)),o?.path===j.path&&!o.dirty&&u({...o,text:P.text,hash:P.hash}),v(s("memory.restored",{path:j.path}))}catch(P){y(ae(P))}finally{M(null)}},tt=async j=>{y(null),v(null);try{await $n(t.id,j)}catch(P){y(ae(P))}},ws=()=>{const j=t.memoryUpkeep===!1;g({type:"updateBot",botId:t.id,patch:{memoryUpkeep:j}}),z(P=>P&&{...P,enabled:j})},Ns=async()=>{if(!ie){de(!0),S("");try{const j=await se("/api/config",{method:"PATCH",body:JSON.stringify({features:{roomMemoryCapture:!$}})});g({type:"configStatus",config:j})}catch(j){S(j instanceof Error?j.message:s("memory.learnFromRooms.error"))}finally{de(!1)}}},Ss=async()=>{m(!0),y(null),v(null);try{const{report:j,overview:P}=await es(t.id);i(P),d(await me(t.id)),z(await xt(t.id)),o&&!o.dirty&&await V(o.path),v(`${us(j)}.${j.note?` ${j.note}`:""}`)}catch(j){y(ae(j))}finally{m(!1)}},Cs=l.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:j=>n(j.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")}),r&&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:r.workspacePath,children:Ge(r.workspacePath,Cs)}),e.jsx("button",{type:"button",className:ne,onClick:()=>{tt("obsidian")},children:s("memory.openObsidian")}),e.jsxs("button",{type:"button",className:O(ne,"inline-flex items-center gap-1.5"),onClick:()=>{tt("folder")},children:[e.jsx(zt,{size:14}),s("memory.showFileManager")]})]})]}),R&&e.jsx(ms,{changed:R.changed,stale:H,busy:Y,onReviewed:()=>{G(!0),Zt(t.id,R.token).then(()=>{D(null),_(!1)}).catch(j=>{if(j instanceof Ht&&j.status===409)return _(!0),K();y(ae(j))}).finally(()=>G(!1))}}),r&&e.jsx($r,{index:r.index}),t.memoryEnabled!==!1&&e.jsx(Fr,{enabled:t.memoryUpkeep!==!1,status:I,tidying:A,onToggle:ws,onTidy:()=>{Ss()},rooms:{enabled:$,saving:ie,error:xe,onToggle:()=>{Ns()}}}),o&&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:o.path}),o.path!==Z&&e.jsx("button",{type:"button",className:Fe,onClick:()=>{V(Z)},children:s("memory.backToIndex")})]}),p&&e.jsx(ps,{botName:t.name,busy:w,onReload:le,onOverwrite:()=>{q(p.currentHash)}}),e.jsx("textarea",{className:O(We,"mt-2 min-h-[200px] resize-y font-mono text-[13px] leading-relaxed"),value:o.text,readOnly:o.readOnly,placeholder:o.path===Z?s("memory.indexPlaceholder"):s("memory.notePlaceholder"),"aria-label":o.path===Z?s("memory.botMemory"):s("memory.fileLabel",{path:o.path}),onChange:j=>u({...o,text:j.target.value,dirty:!0})}),o.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:()=>{q(o.hash)},disabled:w||!o.dirty,className:ne,children:w?s("memory.saving"):s("memory.save")}),o.dirty&&e.jsx("button",{type:"button",className:Fe,disabled:w,onClick:()=>{V(o.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(Fe,"mt-1"),onClick:()=>f(null),children:s("memory.dismissDraft")})]})]}),r&&e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx(Ct,{title:s("memory.topicFiles"),hint:s("memory.topicFilesHint"),files:r.topics,selected:o?.path,onOpen:j=>{V(j.path)},onDelete:j=>{ye(j)}}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx("input",{className:O(We,"py-1.5 text-[13px]"),value:F,placeholder:s("memory.newTopicPlaceholder"),"aria-label":s("memory.newTopicLabel"),onChange:j=>T(j.target.value),onKeyDown:j=>{j.key==="Enter"&&et()}}),e.jsx("button",{type:"button",className:ne,disabled:!F.trim(),onClick:()=>{et()},children:s("memory.newTopic")})]}),r.logs.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(Ct,{title:s("memory.dailyLogs"),hint:s("memory.dailyLogsHint"),files:r.logs,selected:o?.path,onOpen:j=>{V(j.path)},onDelete:j=>{ye(j)}})})]}),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(Ze,{rows:c,botName:t.name,reverting:E,onRevert:j=>{js(j)}})})]}),C&&e.jsx("div",{className:"text-[13px] text-ink-secondary",children:C}),b&&e.jsx("div",{className:"text-[13px] text-danger",children:b})]})}function Dr(t){return`---
|
|
2
|
-
title: ${t.replace(/\.md$/,"")}
|
|
3
|
-
description:
|
|
4
|
-
aliases: []
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
`}function Fr({enabled:t,status:a,tidying:n,onToggle:l,onTidy:r,rooms:i}){return e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("memory.upkeep.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.upkeep.help")})]}),e.jsx(nt,{checked:t,"aria-label":s("memory.upkeep.title"),onClick:l})]}),t&&i&&e.jsxs("div",{className:"mt-3 flex items-start justify-between gap-3 border-t border-hairline/40 pt-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:s("memory.learnFromRooms.title")}),e.jsx("p",{className:"mt-0.5 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.learnFromRooms.subtitle")}),a&&!a.modelSteps&&e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.learnFromRooms.noModelSteps")}),i.error&&e.jsx("p",{role:"alert",className:"mt-1 text-[13px] text-danger",children:i.error})]}),e.jsx(nt,{checked:i.enabled,"aria-label":s("memory.learnFromRooms.title"),disabled:i.saving,onClick:i.onToggle,className:"disabled:cursor-wait disabled:opacity-50"})]}),t&&a&&!a.modelSteps&&e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("memory.upkeep.noModelSteps")}),t&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3",children:[e.jsx("button",{type:"button",className:ne,disabled:n,onClick:r,children:n?s("memory.upkeep.tidying"):s("memory.upkeep.tidyNow")}),e.jsxs("span",{className:"text-[13px] text-ink-secondary",children:[a?.lastTidy?s("memory.upkeep.lastTidy",{time:we(a.lastTidy.at,ee()),summary:us(a.lastTidy).toLowerCase()}):s("memory.upkeep.notTidied"),a?.lastCapture&&Be(a.lastCapture)?` ${s(Be(a.lastCapture)===1?"memory.upkeep.lastNoticed.one":"memory.upkeep.lastNoticed.many",{count:Be(a.lastCapture),time:we(a.lastCapture.at,ee())})}`:""]})]})]})}function $r({index:t}){const a=zn(t),n=a.level==="over"?"bg-danger":a.level==="near"?"bg-warning":"bg-accent";return e.jsxs("div",{className:O("rounded-xl p-4",a.level==="over"?"border border-danger/30 bg-danger/10":"bg-card"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-[13px]",children:[e.jsx("span",{className:"font-medium text-ink",children:s("memory.capacity.title")}),e.jsx("span",{className:O("text-[12px]",a.level==="over"?"text-danger":"text-ink-secondary"),children:s("memory.capacity.summary",{lines:t.lines,maxLines:t.maxLines,bytes:oe(t.bytes),maxBytes:oe(t.maxBytes)})})]}),e.jsx(St,{label:s("memory.capacity.lines"),share:a.lineShare,fill:n}),e.jsx(St,{label:s("memory.capacity.size"),share:a.byteShare,fill:n}),e.jsx("p",{className:O("mt-2 text-[13px] leading-relaxed",a.level==="over"?"text-danger":"text-ink-secondary"),children:a.warning??s("memory.capacity.sentence",{lines:t.lines,maxLines:t.maxLines,bytes:oe(t.bytes),maxBytes:oe(t.maxBytes),maxLoaded:t.maxLines})}),a.warning&&e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:s("memory.capacity.sentence",{lines:t.lines,maxLines:t.maxLines,bytes:oe(t.bytes),maxBytes:oe(t.maxBytes),maxLoaded:t.maxLines})})]})}function St({label:t,share:a,fill:n}){const l=`${Math.min(100,Math.round(a*100))}%`;return e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[12px] text-ink-secondary",children:[e.jsx("span",{className:"w-10 shrink-0",children:t}),e.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-inset",role:"meter","aria-label":s("memory.capacity.used",{label:t}),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.min(100,Math.round(a*100)),children:e.jsx("div",{className:O("h-full rounded-full",n),style:{width:l}})})]})}function ps({botName:t,busy:a,onReload:n,onOverwrite:l}){return e.jsxs("div",{className:"mt-2 rounded-lg border border-warning/25 bg-warning/10 p-3 text-[13px] leading-relaxed text-ink",children:[e.jsx("div",{className:"font-medium",children:s("memory.conflict.title",{name:t})}),e.jsx("div",{className:"mt-0.5 text-ink-secondary",children:s("memory.conflict.help",{name:t})}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx("button",{type:"button",className:ne,disabled:a,onClick:n,children:s("memory.reload")}),e.jsx("button",{type:"button",className:ne,disabled:a,onClick:l,children:s("memory.overwrite")})]})]})}function Ct({title:t,hint:a,files:n,selected:l,onOpen:r,onDelete:i}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:t}),e.jsx("div",{className:"mt-0.5 text-[12px] text-ink-secondary",children:a}),n.length===0?e.jsx("div",{className:"mt-2 text-[13px] text-ink-secondary",children:s("memory.noneYet")}):e.jsx("div",{className:"mt-2 overflow-hidden rounded-lg border border-hairline/40",children:n.map(c=>e.jsxs("div",{className:O("flex items-center gap-2 border-b border-hairline/40 px-3 py-2 last:border-b-0",l===c.path?"bg-control/60":"hover:bg-control/40"),children:[e.jsxs("button",{type:"button",onClick:()=>r(c),className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[e.jsx(Pe,{size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("span",{className:"truncate font-mono text-[13px] text-ink",children:c.name}),e.jsxs("span",{className:"shrink-0 text-[12px] text-ink-secondary",children:[oe(c.bytes)," · ",we(c.modifiedAt,ee())]})]}),e.jsx("button",{type:"button",onClick:()=>i(c),"aria-label":s("memory.deleteFile",{name:c.name}),title:s("memory.delete"),className:"shrink-0 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-danger",children:e.jsx(_t,{size:14})})]},c.path))})]})}function Ze({rows:t,botName:a,reverting:n,onRevert:l,now:r=Date.now()}){return t?t.length===0?e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("memory.noChanges")}):e.jsx("div",{className:"flex flex-col gap-2",children:t.map(i=>{const c=_n(i),d=Un(i);return e.jsxs("div",{className:"rounded-lg bg-inset px-3 py-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1 text-[13px] leading-relaxed text-ink",children:[e.jsx("span",{children:Tr(i,a)})," · ",e.jsx("span",{className:"text-ink-secondary",children:we(i.at,ee(),r)}),c&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{className:"text-ink-secondary",children:d?s(d,i.threadTitle?{title:i.threadTitle}:void 0):c})]})]}),i.canRevert?e.jsxs("button",{type:"button",disabled:n!==null,onClick:()=>l(i),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:[e.jsx(zs,{size:12}),n===i.id?s("memory.undoing"):s("memory.undo")]}):e.jsx("span",{className:"shrink-0 text-[12px] text-ink-secondary",title:i.revertUnavailableReason,children:s("memory.cantUndo")})]}),i.diff&&e.jsxs("details",{className:"mt-1",children:[e.jsxs("summary",{className:"cursor-pointer text-[12px] text-ink-secondary",children:["+",i.added," −",i.removed," · ",s("memory.showChanged")]}),e.jsx("pre",{className:"mt-1 max-h-[240px] overflow-auto whitespace-pre-wrap rounded-md bg-card p-2 font-mono text-[12px] leading-relaxed text-ink",children:i.diff})]})]},i.id)})}):e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("memory.loading")})}function zr({bot:t,rows:a,refreshError:n,onRollback:l,rollingBack:r}){if(!a)return e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("history.loading")});if(a.length===0)return e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("history.empty")});const i=[...a].sort((c,d)=>d.at-c.at);return e.jsxs("div",{className:"flex flex-col gap-2",children:[n&&e.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[13px] text-ink-secondary",children:s("history.refreshError")}),i.map(c=>e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1 text-[13px] leading-relaxed text-ink",children:[e.jsx("span",{className:"text-ink-secondary",children:$t(c.at)})," · ",e.jsxs("span",{children:[c.actor," via ",c.via]})," · ",e.jsx("span",{children:c.summary})]}),c.field==="soul"&&c.canRestore===!0&&e.jsx("button",{type:"button",disabled:r,onClick:()=>l(c.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:s("history.undo")})]}),c.field==="soul"&&c.canRestore!==!0&&e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:c.restoreUnavailableReason??s("history.restoreUnavailable")})]},`${t.id}-${c.id}`))]})}function Hr({bot:t,bare:a=!1}){const{state:n,dispatch:l}=B(),r=Hs(t),i=n.instances.find(c=>c.instanceId===t.modelSelection.instanceId);return r.turns===0?e.jsx("div",{className:O(a?"":"rounded-xl bg-card p-4","text-[13px] text-ink-secondary"),children:s("usage.bot.empty")}):e.jsxs("div",{className:a?void 0:"rounded-xl bg-card p-4",children:[!a&&e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("usage.title")}),e.jsxs("button",{onClick:()=>l({type:"toggleAppSettings",open:!0,section:"usage"}),className:"text-[12px] text-ink-secondary hover:text-ink",children:[s("usage.allBots")," ",e.jsx(he,{size:14,"aria-hidden":"true",className:"inline align-[-2px] rtl:-scale-x-100"})]})]}),e.jsxs("div",{className:O("grid grid-cols-3 gap-3 text-[13px]",!a&&"mt-3"),children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] uppercase tracking-wide text-ink-secondary",children:s("usage.colTurns")}),e.jsx("div",{className:"mt-0.5 tabular-nums text-ink",children:r.turns})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] uppercase tracking-wide text-ink-secondary",children:_s(r)}),e.jsx("div",{className:"mt-0.5 tabular-nums text-ink",title:qs(r),children:Us(Ks(r))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] uppercase tracking-wide text-ink-secondary",children:s("usage.colCost")}),e.jsx("div",{className:"mt-0.5 tabular-nums text-ink",children:rt(r.costUsd)?Ws(r.costUsd):"—"})]})]}),e.jsx("div",{className:"mt-2 text-[12px] text-ink-secondary",children:rt(r.costUsd)?s("usage.costLine",{caption:Vs(i?.snapshot.billing)}):s("usage.bot.unpriced")})]})}const _r=[["bot","botPanel.avatar.tabBot"],["generate","botPanel.avatar.tabGenerate"],["upload","botPanel.avatar.tabUpload"]],Ur=["circle","rounded","square"],Kr={circle:"botPanel.avatar.circle",rounded:"botPanel.avatar.rounded",square:"botPanel.avatar.square"},qr={idle:"botPanel.face.idle",happy:"botPanel.face.happy",curious:"botPanel.face.curious",drowsy:"botPanel.face.drowsy",working:"botPanel.face.working",thinking:"botPanel.face.thinking",listening:"botPanel.face.listening",sleeping:"botPanel.face.sleeping",suspicious:"botPanel.face.suspicious",proud:"botPanel.face.proud"},Wr=t=>{const a=qr[t];return a?s(a):t};function Vr({bot:t,activeState:a,onPatch:n,onClose:l}){const r=Gs(t,n),{fileRef:i,crop:c,uploading:d,generating:o,busy:u,error:p,upload:h,removeImage:k,generate:f}=r,b=c!=="mascot"&&!!t.avatarUrl,[y,C]=x.useState(b?"upload":"bot"),v=x.useRef(null);x.useEffect(()=>{v.current?.querySelector('[aria-selected="true"]')?.focus()},[]);const w=m=>n(c==="mascot"?m:{...m,avatarCrop:"mascot"}),N=t.mascotBody??"cursor",E=wn(),M=Nn(t.mascotBody,t.color,E),[F,T]=x.useState(()=>!!E||mt(N)||!!(t.mascotExpression&&t.mascotExpression!=="idle")),I=E&&M!==N&&mt(M)?Te(M):null,z=(m,R)=>e.jsx("button",{type:"button",disabled:u,"aria-pressed":!b&&N===m,"aria-label":s("mascot.useBody",{name:R}),title:R,onClick:()=>w({mascotBody:m}),className:O("flex h-[58px] items-center justify-center rounded-xl disabled:opacity-50",!b&&N===m?"bg-ink/[0.08] ring-[1.5px] ring-inset ring-ink/25":"hover:bg-ink/[0.05]"),children:e.jsx(Ln,{color:t.color,faceColor:t.mascotFaceColor,bodyId:m,size:40,animated:!1,trackPointer:!1})},m),A=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),l())};return e.jsxs("div",{role:"dialog","aria-label":s("botPanel.avatar.edit"),"data-panel-avatar-editor":!0,onKeyDown:A,className:"popover-surface absolute inset-x-[-5px] top-[80px] z-30 overflow-hidden rounded-2xl border border-ink/[0.08] bg-menu text-left shadow-2xl shadow-black/50",children:[e.jsxs("div",{ref:v,className:"flex items-center gap-0.5 border-b border-ink/[0.06] p-2",children:[_r.map(([m,R])=>e.jsx("button",{type:"button",role:"tab","aria-selected":y===m,"data-avatar-tab":m,onClick:()=>C(m),className:O("rounded-lg px-[11px] py-[5px] text-[13px]",y===m?"bg-ink/[0.08] font-medium text-ink":"text-ink-secondary hover:text-ink"),children:s(R)},m)),e.jsx("button",{type:"button","data-avatar-reset":!0,disabled:u,onClick:()=>n(Ys),className:"ml-auto rounded-lg px-[11px] py-[5px] text-[13px] text-ink-secondary hover:text-ink disabled:opacity-50",children:s("botPanel.avatar.reset")})]}),e.jsxs("div",{className:"p-3",children:[y==="bot"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:Sn.map(m=>z(m,Te(m)))}),e.jsx("div",{className:"flex flex-wrap justify-center gap-2 px-1 pb-1 pt-3.5",children:Js.map(m=>e.jsx("button",{type:"button",disabled:u,"aria-pressed":t.color===m,"aria-label":s("mascot.useColor",{color:On(m)}),title:s(Pn[m]),onClick:()=>w({color:m}),className:O("size-6 rounded-full disabled:opacity-50",t.color===m&&"ring-2 ring-ink/80 ring-offset-2 ring-offset-menu"),style:{background:Cn(m)}},m))}),e.jsx(Wn,{bot:t,disabled:u,onPatch:w}),e.jsxs("button",{type:"button","data-avatar-more":!0,"aria-expanded":F,onClick:()=>T(m=>!m),className:"mx-auto mt-2.5 flex items-center gap-1 rounded-full px-2.5 py-1 text-[12px] text-ink-secondary hover:bg-ink/[0.04] hover:text-ink",children:[s("botPanel.avatar.more"),e.jsx(pe,{size:13,"aria-hidden":"true",className:O("transition-transform",F&&"rotate-180")})]}),F&&e.jsxs("div",{"data-avatar-more-looks":!0,children:[En.map(m=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 px-1 pb-1.5 pt-2 text-[12px] text-ink-tertiary",children:[e.jsx("span",{children:pt(m)}),m===E&&I&&e.jsx("span",{"data-avatar-costume":!0,children:s("botPanel.avatar.costume",{name:I,skin:pt(m)})})]}),e.jsx("div",{className:"grid grid-cols-5 gap-1.5","data-festival-bodies":m,children:Rn[m].bodies.map(R=>z(R,Te(R)))})]},m)),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-1.5 pt-2.5",role:"group","aria-label":s("botPanel.avatar.face"),children:[e.jsx("span",{className:"mr-0.5 text-[12px] text-ink-tertiary",children:s("botPanel.avatar.face")}),In.map(m=>e.jsx("button",{type:"button",disabled:u,"data-avatar-face":m,"aria-pressed":a===m,onClick:()=>w({mascotExpression:m}),className:O("rounded-full px-2.5 py-1 text-[12px] disabled:opacity-50",a===m?"bg-ink/[0.15] text-ink":"bg-ink/[0.04] text-ink-secondary hover:text-ink"),children:Wr(m)},m))]})]})]}),y==="generate"&&e.jsx("div",{className:"[&>div:first-child]:mt-0 [&>div:first-child]:border-0 [&>div:first-child]:pt-0",children:e.jsx(Qs,{botLabel:t.title||t.name,disabled:d,generating:o,onGenerate:f})}),y==="upload"&&e.jsxs(e.Fragment,{children:[e.jsx(Xs,{busy:u,onUpload:m=>{h(m)}}),b&&e.jsx(Zs,{bot:t,disabled:u,onPatch:n}),e.jsx("input",{ref:i,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"sr-only",onChange:m=>{h(m.target.files?.[0])}}),e.jsxs("button",{type:"button","data-avatar-drop":!0,disabled:u,onClick:()=>i.current?.click(),onDragOver:m=>m.preventDefault(),onDrop:m=>{m.preventDefault(),h(m.dataTransfer.files?.[0])},className:"flex w-full flex-col items-center gap-1.5 rounded-xl border-[1.5px] border-dashed border-ink/15 px-3 py-6 text-center text-[13px] text-ink-secondary hover:border-ink/25 hover:text-ink disabled:opacity-50",children:[d?e.jsx(An,{size:22,className:"animate-spin"}):e.jsx(ea,{size:22}),e.jsx("span",{children:s("botPanel.avatar.drop")}),e.jsx("span",{className:"text-[12px] text-ink-tertiary",children:s("botPanel.avatar.types")})]}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-2.5",children:[e.jsx("span",{className:"shrink-0 text-[12px] text-ink-secondary",children:s("botPanel.avatar.shape")}),e.jsx(ke,{attr:"data-avatar-crop",label:s("botPanel.avatar.shape"),value:b?c:null,onChange:m=>n({avatarCrop:m}),options:Ur.map(m=>({value:m,label:s(Kr[m]),disabled:u||!t.avatarUrl}))}),t.avatarUrl&&e.jsx("button",{type:"button",onClick:k,disabled:u,"aria-label":s("botIdentity.removeAvatar"),title:s("botPanel.avatar.remove"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-danger disabled:opacity-50",children:e.jsx(_t,{size:14})})]}),!b&&e.jsx("p",{className:"mt-2 text-[12px] text-ink-tertiary",children:s("botPanel.avatar.uploadHint")})]}),p&&e.jsx("div",{role:"alert",className:"mt-3 text-[12px] text-danger",children:p})]})]})}const Gr=()=>s("place.off");function xs(t){const{dispatch:a}=B();return(n="computer")=>{aa(t.id,n),a({type:"toggleSettings",open:!1}),a({type:"toggleComputer",open:!0})}}function Yr(t,a){const[n,l]=x.useState(null);return x.useEffect(()=>{if(!a)return;let r=!1;return se(`/api/browser-sites?bot=${encodeURIComponent(t.id)}`).then(i=>{r||l({botId:t.id,count:i.sites?.length??0})}).catch(()=>{}),()=>{r=!0}},[t.id,a]),n?.botId===t.id?n.count:null}function hs(t){const{state:a}=B(),{capabilities:n}=ge(),l=n.host?.platform??"other",r=na(t),i=t.computer??"auto",c=a.config?.browserEngine?.myChrome===!0&&(a.config?.browserProfiles??[]).some(f=>f.id===t.browserProfile&&f.browser==="chrome"),d=f=>f==="browser"&&c?s("settings.profiles.myChrome"):la(f,l),o=f=>{const{view:b,reachable:y}=r[f];return{value:f,label:d(f),disabled:!y,hint:!y||ia(b)?b.line:void 0}},u=[{value:"auto",label:s("computer.simple.dest.letItChoose")},...r.local.policy?[o("local")]:[],...r.browser.policy||i==="browser"?[o("browser")]:[],...r.cloud.policy?[o("cloud")]:[],...r.vm.policy||i==="vm"?[o("vm")]:[],...i==="off"?[{value:i,label:Gr(),disabled:!0}]:[]],p=t.tasks?.find(f=>f.threadId===t.threadId)?.surface,h=p&&p!==i?d(p):null,k=u.find(f=>f.value===i)?.label??(i==="auto"||i==="off"?void 0:d(i));return{options:u,current:i,currentLabel:k,usingNow:h}}function Jr({bot:t,derived:a}){const{dispatch:n}=B(),{options:l,current:r,usingNow:i}=hs(t),[c,d]=x.useState(null),{patch:o,approvalMode:u}=a,p=h=>{if(!(h===r||h==="off")){if(h==="local"&&u==="auto"){d({botId:t.id,patch:{computer:"local",acknowledgeLocalAuto:!0}});return}o(h==="browser"?{computer:"browser",browser:!0}:{computer:h==="auto"?null:h})}};return e.jsxs(e.Fragment,{children:[e.jsx(L,{children:e.jsx("div",{role:"radiogroup","aria-label":s("computer.simple.whereWorks",{name:t.name}),className:"flex flex-col divide-y divide-ink/[0.05]",children:l.map(h=>e.jsx(He,{"data-panel-choice":h.value,title:h.label,hint:h.hint,checked:r===h.value,disabled:h.disabled,onClick:()=>p(h.value)},h.value))})}),i&&e.jsx("p",{"data-panel-using-now":!0,className:"mx-1 text-[13px] text-ink-secondary",children:s("computer.simple.usingNow",{place:i})}),e.jsx(ra,{open:c!==null,onCancel:()=>d(null),onConfirm:()=>{const h=c;d(null),h&&n({type:"updateBot",botId:h.botId,patch:h.patch})}})]})}function Qr({bot:t,derived:a,onOpen:n}){const l=xs(t),r=Ye(),{browserEnabled:i}=a,c=Yr(t,i&&t.computer!=="off"&&r!==!1),{currentLabel:d,usingNow:o}=hs(t),u=s("computer.screenOf",{name:t.name}),p=[...t.messages].reverse().find(k=>k.kind==="screen"&&(k.hasImage||k.png)),h=p?ta({threadId:t.threadId,messageId:p.id},p.mime).src:null;return e.jsxs("div",{"data-panel-tabpanel":"computer",children:[e.jsxs("button",{type:"button","data-panel-action":"open-computer","aria-label":`${s("place.action.watch")}: ${u}`,onClick:()=>l(),className:"group relative mt-2.5 flex aspect-[16/10] w-full flex-col items-center justify-center gap-2 overflow-hidden rounded-xl bg-composer ring-1 ring-inset ring-ink/[0.06] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-border",children:[h?e.jsx("img",{src:h,alt:"",className:"absolute inset-0 size-full object-cover"}):t.busy?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"opacity-55",children:e.jsx(qe,{bot:t,size:52,animated:!1})}),e.jsx("span",{className:"max-w-[80%] text-center text-[13px] text-ink-secondary",children:s("botPanel.screen.working")})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"opacity-60",children:e.jsx(qe,{bot:t,size:44,state:"sleeping",animated:!1})}),e.jsx("span",{className:"max-w-[80%] text-center text-[13px] font-medium text-ink",children:s("botPanel.screen.resting")})]}),e.jsxs("span",{"aria-hidden":"true",className:"absolute bottom-2.5 right-2.5 flex h-7 items-center gap-1.5 rounded-full border border-ink/10 bg-panel/80 px-2.5 text-[12px] text-ink opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 touch:opacity-100",children:[e.jsx(gt,{size:13,"aria-hidden":"true"}),s("place.action.watch")]})]}),e.jsx("div",{className:"mt-3 text-center text-[13px] text-ink-tertiary",children:u}),e.jsxs(L,{anchor:"where",children:[e.jsx(X,{"data-panel-page":"where",icon:gt,title:s("computer.simple.whereWorks",{name:t.name}),hint:o?s("computer.simple.usingNow",{place:o}):void 0,value:d,onClick:()=>n("where")}),e.jsx(X,{"data-panel-page":"browser",icon:sa,title:s("settings.sites.title"),value:c??void 0,onClick:()=>n("browser")})]})]})}const Xr=3,Pt="[&_.font-semibold]:font-medium [&_time]:text-[12px] [&_time]:text-ink-tertiary [&_span.bg-accent]:size-2",Zr=8,ei=200,ue=new Map,$e=new Set,Ot=t=>`${t.threadId}@${Wt(t)}`;function ti(t,a){const[,n]=x.useState(0),r=a.filter(d=>d.threadId!==t.threadId).map(Ot).filter(d=>!ue.has(d)&&!$e.has(d)).join(",");x.useEffect(()=>{if(r)for(const d of r.split(",")){$e.add(d);const o=d.slice(0,d.lastIndexOf("@"));se(`/api/threads/${encodeURIComponent(o)}/messages?limit=${Zr}`,{background:!0}).then(u=>{ue.set(d,Ue({messages:u.messages??[],activeLeafId:u.activeLeafId??void 0})),ue.size>ei&&ue.delete(ue.keys().next().value),n(p=>p+1)}).catch(()=>{}).finally(()=>$e.delete(d))}},[r]);const i=Ue(t),c=new Map(a.map(d=>[d.threadId,Ot(d)]));return d=>d===t.threadId?i:ue.get(c.get(d)??"")}function si({bot:t}){const{state:a,dispatch:n}=B(),l=oa(),r=!Ut(Kt,!0),[i,c]=x.useState(""),[d,o]=x.useState(!1),[u,p]=x.useState(!1),[h,k]=x.useState(!1),f=ca(a.config),b=x.useMemo(()=>{const{onRename:g,onRegenerateTitle:$,onDelete:ie,onMove:de,onPin:xe,onArchive:S}=da(t.id,n,f);return{onRename:g,onRegenerateTitle:$,onDelete:ie,onMove:de,onPin:xe,onArchive:S}},[t.id,n,f]),y=ua(t),C=t.tasks??[{threadId:t.threadId,title:s("task.newShort"),createdAt:0}],v=(y?ma({...t,tasks:C},y):C).filter(g=>!g.routineRunId).map(g=>{const $=_e(t,g.threadId);return{...g,busy:$.busy,activity:$.activity,waitingForTeammates:$.waitingForTeammates,turnStartedAt:$.turnStartedAt??void 0,queued:!!a.pendingQueued[g.threadId]?.length}}),w=it(v.filter(g=>!Le(g)||g.threadId===t.threadId)),N=it(v.filter(g=>Le(g)&&g.threadId!==t.threadId)),E=i.trim(),M=w.filter((g,$)=>$<Xr||g.threadId===t.threadId),F=ti(t,[...E||u?w:M,...h?N:[]]),T=g=>{const $=F(g);return $?ha(_e(t,g),$,a.instances,!1):void 0},I=pa(w,E),z=E?[...I,...w.filter(g=>!I.includes(g)&&T(g.threadId)?.toLowerCase().includes(E.toLowerCase()))]:w,A=E?z:u?w:M,m=w.length-M.length,R=t.projects?.find(g=>g.id===t.tasks?.find($=>$.threadId===t.threadId)?.projectId),D=()=>{r&&n({type:"toggleSettings",open:!1})},H=g=>{g.threadId!==t.threadId&&ya(n,t,g.threadId,!1),D()},_=()=>{n({type:"newTask",botId:t.id,...R?{projectId:R.id}:{}}),D()},Y=()=>{c(""),o(!1)},G=w.length>=2||d||w.some(g=>g.threadId===t.threadId&&Le(g)),U=g=>e.jsx("div",{role:"listitem","data-conversation":g.threadId,children:e.jsx(fa,{panel:!0,preview:T(g.threadId),task:g,ownerId:t.id,current:g.threadId===t.threadId,folders:t.projects,now:ga(Wt(g),l),locale:ee(),onSelect:H,...b})},g.threadId);return e.jsxs("section",{"data-panel-card":"conversations","aria-label":s("botPanel.conversations.title"),children:[e.jsx(je,{action:G&&e.jsx("button",{type:"button","data-conversations-search":!0,"aria-label":s("botPanel.conversations.search"),title:s("botPanel.conversations.search"),"aria-pressed":d,onClick:()=>d?Y():o(!0),className:O("-me-1 flex size-6 shrink-0 items-center justify-center rounded-[6px] text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink",d&&"bg-ink/[0.06] text-ink"),children:e.jsx(Lt,{size:14,"aria-hidden":"true"})}),children:s("botPanel.conversations.title")}),e.jsx("div",{className:O("flex items-center gap-2",G&&"mb-2"),children:t.yourAccess!=="view"&&y!=="team"&&e.jsxs("button",{type:"button","data-conversations-new":!0,"aria-label":s("botPanel.conversations.new"),onClick:_,className:O(qt,"flex-1"),children:[e.jsx(xa,{size:15,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),e.jsx("span",{className:"truncate",children:s("botPanel.conversations.new")})]})}),G&&d&&e.jsx("input",{autoFocus:!0,type:"search","data-conversations-query":!0,value:i,onChange:g=>c(g.target.value),onKeyDown:g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),Y())},placeholder:s("botPanel.conversations.searchPlaceholder",{name:t.name}),"aria-label":s("botPanel.conversations.searchPlaceholder",{name:t.name}),className:"mb-1.5 w-full rounded-[8px] border border-hairline/60 bg-inset px-3 py-1.5 text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-focus"}),G&&e.jsx("div",{role:"list","aria-label":s("botPanel.conversations.title"),className:O("flex flex-col gap-px",Pt),children:A.map(U)}),G&&E&&A.length===0&&e.jsx("p",{className:"px-3 py-3 text-[13px] text-ink-secondary",children:s("task.noMatch",{query:E})}),G&&!E&&m>0&&e.jsxs("button",{type:"button","data-conversations-more":!0,"aria-expanded":u,onClick:()=>p(g=>!g),className:"mt-0.5 flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-ink/[0.04] hover:text-ink",children:[u?e.jsx(lt,{size:14,"aria-hidden":"true"}):e.jsx(pe,{size:14,"aria-hidden":"true"}),u?s("botPanel.conversations.showFewer"):s("botPanel.conversations.showMore",{count:m})]}),!E&&N.length>0&&e.jsxs("button",{type:"button","data-conversations-archived":!0,"aria-expanded":h,onClick:()=>k(g=>!g),className:"mt-0.5 flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-ink/[0.04] hover:text-ink",children:[h?e.jsx(lt,{size:14,"aria-hidden":"true"}):e.jsx(pe,{size:14,"aria-hidden":"true"}),s("task.archivedList",{count:N.length})]}),!E&&h&&N.length>0&&e.jsx("div",{role:"list","aria-label":s("task.archivedList",{count:N.length}),className:O("flex flex-col gap-px",Pt),children:N.map(U)})]})}function ai({bot:t}){const{dispatch:a}=B();return Mt()||!t.defaultBot?null:e.jsx(L,{label:s("botPanel.tryAsking"),anchor:"try-asking",children:va.map(l=>e.jsx("button",{type:"button","data-panel-ask":l,onClick:()=>a({type:"send",botId:t.id,text:s(l),threadId:t.threadId}),className:"flex h-9 w-full items-center px-3.5 text-left text-[14px] text-ink transition-colors hover:bg-ink/[0.03]",children:e.jsx("span",{className:"truncate",children:s(l)})},l))})}const ni=["find","start-fresh","usage","activity","inspector"];function ri({item:t}){const a=t.key==="usage";return e.jsxs("button",{type:"button","data-panel-item":t.key,disabled:t.disabled,title:t.title,"aria-pressed":t.active||void 0,onClick:t.onSelect,className:O(J,"w-full rounded-[8px] text-left enabled:hover:bg-ink/[0.04] disabled:cursor-default disabled:opacity-45"),children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center text-ink-secondary [&_svg]:size-4","aria-hidden":"true",children:t.icon}),e.jsx("span",{className:O("min-w-0 truncate text-[14px] font-medium",!a&&"flex-1",t.active?"text-accent-text":"text-ink"),children:t.label}),t.trailing&&e.jsx("span",{className:O("flex items-center",a?"min-w-0 flex-1 justify-end text-right":"shrink-0"),children:t.trailing}),t.key!=="find"&&t.key!=="start-fresh"&&e.jsx(he,{size:15,"aria-hidden":"true",className:"shrink-0 text-ink-tertiary rtl:-scale-x-100"})]})}function ii({bot:t,derived:a,onOpen:n}){const{items:l}=ba(t),{dispatch:r}=B(),i=a.botRoutines.filter(d=>d.enabled).length,c=ni.flatMap(d=>l.filter(o=>o.key===d));return e.jsxs("div",{"data-panel-tabpanel":"details",children:[e.jsx("section",{"data-panel-card":"model",className:"pt-2",children:e.jsx("div",{"data-panel-row":"model",className:O(J,"rounded-[8px]"),children:e.jsx(ka,{bot:t,contained:!0,threadId:t.threadId,label:e.jsxs("span",{className:"flex shrink-0 items-center gap-2.5",children:[e.jsx(Q,{icon:Ve}),e.jsx(te,{title:s("model.simple.model")})]})})})}),e.jsx(si,{bot:t}),e.jsx(ai,{bot:t}),c.length>0&&e.jsxs("section",{"data-panel-card":"conversation",children:[e.jsx(je,{children:s("botPanel.section.conversation")}),c.map(d=>e.jsx(ri,{item:d},d.key))]}),a.botRoutines.length===0?e.jsxs("section",{"data-panel-empty":"routines",children:[e.jsx(je,{action:e.jsx(ja,{"data-panel-automations":"",onClick:()=>r({type:"showRoutines",view:"list"}),children:s("sidebar.nav.automations")}),children:s("botSettings.simple.routines")}),e.jsxs("button",{type:"button","data-panel-page":"routines",title:s("botPanel.routines.emptyHint"),onClick:()=>n("routines"),className:O(qt,"w-full"),children:[e.jsx(vr,{size:15,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),e.jsx("span",{className:"truncate",children:s("botPanel.routines.add")})]})]}):e.jsx(L,{label:s("botSettings.simple.routines"),anchor:"routines",children:e.jsx(X,{"data-panel-page":"routines",icon:wa,title:s("botSettings.simple.routines"),value:i>0?s("botPanel.routinesOn",{count:i}):s("botPanel.none"),onClick:()=>n("routines")})})]})}const fs=/^\s*[-*]\s+(.+?)\s*$/;function li(t){return t.split(`
|
|
8
|
-
`).flatMap((a,n)=>{const l=fs.exec(a)?.[1];return l?[{line:n,text:l}]:[]})}function oi(t,a){const n=t.split(`
|
|
9
|
-
`);return fs.test(n[a]??"")?(n.splice(a,1),n.join(`
|
|
10
|
-
`)):t}function ci(t,a){const n=t.replace(/\s+$/,""),l=`- ${a.trim().replace(/\s*\n\s*/g," ")}`;return n?`${n}
|
|
11
|
-
${l}
|
|
12
|
-
`:`${l}
|
|
13
|
-
`}function gs(t){return t.flatMap(a=>{const n=li(a.text).map(r=>({path:a.path,...r}));if(n.length||a.path===Z)return n;const l=a.text.split(`
|
|
14
|
-
`).map(r=>r.replace(/^#+\s*/,"").trim()).filter(Boolean).join(" ");return l?[{path:a.path,line:null,text:l}]:[]})}async function di(t,a){if(!a)return[await Ne(t,Z)];const n=await Qe(t,!0);return Promise.all([Z,...n.topics.map(l=>l.path)].map(l=>Ne(t,l,!0)))}function ys(t){const a=!!B().state.config?.team,[n,l]=x.useState({botId:t.id,docs:null,error:!1}),r=t.memoryEnabled!==!1,i=async(o,u)=>{try{const p=await di(o,a);u?.()||l({botId:o,docs:p,error:!1})}catch{u?.()||l({botId:o,docs:null,error:!0})}},c=!!t.busy;x.useEffect(()=>{if(!r)return;let o=!1;return i(t.id,()=>o),()=>{o=!0}},[t.id,r,c,a]);const d=n.botId===t.id;return{docs:d?n.docs:null,error:d&&n.error,mine:a,setDoc:o=>l(u=>({botId:t.id,docs:(u.botId===t.id?u.docs??[]:[]).map(p=>p.path===o.path?o:p),error:!1})),reload:()=>i(t.id)}}function ui(t,a=Ue(t)){const n=[],l=[],r=new Set;for(const u of[...a].reverse()){const p=u.publishedPage;p?.state==="live"&&p.url&&!r.has(p.url)&&(r.add(p.url),n.push({messageId:u.id,title:p.title||p.url,url:p.url})),u.kind==="app"&&u.app?.doc&&l.push({messageId:u.id,title:u.app.title})}const i=dr(t),c=[],d=new Set;for(const u of i.values())d.has(u.file.path)||(d.add(u.file.path),c.push(u));const o=ur(t).filter(u=>!i.has(u));return{pages:n,apps:l,shared:c,unshared:o}}const mi=t=>t.slice(Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"))+1);function vs({bot:t,onOpen:a}){const{dispatch:n}=B(),{capabilities:l}=ge(),r=Na(),i=!Ut(Kt,!0),c=as(t),d=ys(t),{pages:o,apps:u,shared:p,unshared:h}=x.useMemo(()=>ui(t),[t]),k=v=>{n({type:"focusMessage",threadId:t.threadId,messageId:v}),i&&n({type:"toggleSettings",open:!1})},f=c.skills.filter(ns).length,b=d.docs?gs(d.docs).length:null,y=t.memoryEnabled===!1?s("botPanel.memory.off"):b===null?d.error?s("botPanel.memory.nothingYet"):void 0:b===0?s("botPanel.memory.nothingYet"):b===1?s("botPanel.memory.note"):s("botPanel.memory.notes",{count:b}),C=e.jsxs(L,{anchor:"keeps",children:[e.jsx(X,{"data-panel-page":"memory",icon:Bt,title:s("botPanel.memoryRow"),value:y,onClick:()=>a("memory")}),e.jsx(X,{"data-panel-page":"skills",icon:Sa,title:s("botSettings.simple.skills"),value:c.loading?void 0:f>0?f:s("botPanel.none"),onClick:()=>a("skills")}),e.jsx(X,{"data-panel-page":"folder",icon:Ca,title:s("computer.files.folder"),value:t.cwd?Ge(t.cwd,l.host?.homeDir):s("botPanel.folder.private"),onClick:()=>a("folder")})]});return o.length+u.length+p.length+h.length===0?e.jsxs("div",{"data-panel-tabpanel":"library",children:[e.jsx("p",{"data-panel-empty":"library",className:"px-3 py-7 text-center text-[13px] leading-[18px] text-ink-tertiary",children:s("botPanel.library.empty")}),C]}):e.jsxs("div",{"data-panel-tabpanel":"library",children:[o.length>0&&e.jsx(L,{label:s("botPanel.library.pages"),anchor:"pages",children:o.map(v=>e.jsx(X,{"data-panel-row":"page",icon:Pa,title:e.jsx("span",{className:"block truncate",children:v.title}),hint:e.jsx("span",{className:"block truncate",children:v.url}),onClick:()=>r(v.url)},v.url))}),u.length>0&&e.jsx(L,{label:s("botPanel.library.apps"),anchor:"apps",children:u.map(v=>e.jsx(X,{"data-panel-row":"app",icon:Vt,title:e.jsx("span",{className:"block truncate",children:v.title}),onClick:()=>k(v.messageId)},v.messageId))}),p.length+h.length>0&&e.jsxs("section",{"data-panel-card":"files",children:[e.jsx(je,{children:s("botPanel.library.files")}),e.jsxs("ul",{className:"flex flex-col gap-1.5",children:[p.map(v=>e.jsx("li",{className:"min-w-0",children:e.jsx(Oa,{file:v.file,message:v.message,linked:v.file.linked,className:"w-full max-w-none"})},`${v.message.messageId}:${v.file.path}`)),h.map(v=>e.jsxs("li",{title:s("computer.files.notSharedHint"),className:"flex min-w-0 items-center gap-2 rounded-lg border border-hairline/40 px-2.5 py-2",children:[e.jsx(Pe,{size:14,className:"shrink-0 text-ink-secondary","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",children:mi(v)}),e.jsx("span",{className:"shrink-0 text-[11px] text-ink-tertiary",children:s("computer.files.notShared")})]},v))]})]}),e.jsx("p",{className:"mt-3 text-center text-[12px] text-ink-tertiary",children:s("botPanel.library.scope")}),C]})}function pi({bot:t,browserEnabled:a,onOpenBrowser:n}){const{state:l}=B(),r=Ye(),i=t.browserProfile??"",c=(l.config?.browserProfiles??[]).find(p=>p.id===i),d=i==="guest",o=c?.browser==="chrome"&&l.config?.browserEngine?.myChrome===!0,u=i&&!d?l.bots.filter(p=>p.browserProfile===i).map(p=>p.name):[t.name];return e.jsx(L,{anchor:"logins",children:a?d?e.jsx(W,{children:s("settings.profiles.temporaryHint")}):o?e.jsx(W,{children:s("settings.profiles.myChromeHint")}):e.jsxs(e.Fragment,{children:[r!==!1&&(i===""||c)&&e.jsx(ce,{children:e.jsx(gr,{bare:!0,target:{bot:t.id},sharedBy:u,disabled:!!t.busy},`${t.id}:${i}`)}),e.jsx(W,{children:s("botSettings.simple.loginsHint",{name:t.name})}),e.jsx(fe,{"data-panel-action":"add-login",icon:Ee,onClick:n,children:s("botSettings.simple.addLogin")})]}):e.jsx(W,{children:s("botSettings.simple.loginsOff",{name:t.name})})})}const xi=5,hi={instanceId:"",model:""},bs=(t,a)=>`${t}\0${a}`,fi=new Set;function Et({bot:t,current:a,exclude:n,onPick:l,label:r,title:i,buttonRef:c,className:d,children:o,...u}){const{state:p,dispatch:h,refreshInstances:k,refreshModels:f}=B(),[b,y]=x.useState(!1),[C,v]=x.useState(""),[w,N]=x.useState(()=>new Set),[E,M]=x.useState(!1),[F,T]=x.useState(null),[I,z]=x.useState(null),A=x.useRef(null),m=c??A,R=x.useRef(null),D=x.useRef(null),H=x.useRef(!1),_=x.useId(),Y=Fn(b),G=x.useRef({contains:S=>[m.current,R.current].some(K=>K?.contains(S))});Ma(b,G,()=>y(!1)),x.useLayoutEffect(()=>{if(!b)return;const S=K=>{if(K?.type==="scroll"&&K.target instanceof Node&&R.current?.contains(K.target))return;const V=m.current?.getBoundingClientRect(),q=R.current;!V||!q||z(le=>Da(V,{width:ot,height:q.offsetHeight},{width:window.innerWidth,height:window.innerHeight},le??void 0))};return S(),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[b,m]),x.useEffect(()=>{if(!b||!I||!H.current)return;H.current=!1;const S=R.current;(S?.querySelector("[data-menu-search]")??S?.querySelector("[data-current-model]")??S?.querySelector("[data-menu-row]:not(:disabled)")??S)?.focus({preventScroll:!0})},[b,I]);const U=S=>{y(!1),S&&m.current?.focus({preventScroll:!0})},g=()=>{v(""),N(new Set),z(null),H.current=!0,y(!0),M(!0),k().catch(()=>{}).finally(()=>M(!1))},$=S=>{F||(T(S.instanceId),f(S.instanceId).catch(()=>{}).finally(()=>T(null)))},ie=()=>{U(!1),h({type:"toggleAppSettings",open:!0,section:"engines"})},de=()=>{const S=$a(p.instances,a?.instanceId).flatMap(q=>{const le=q.models.options.filter(ye=>!n.has(bs(q.instanceId,ye.id)));return le.length===q.models.options.length?[q]:le.length?[{...q,models:{...q.models,options:le}}]:[]}),K=za({instances:p.instances,listed:S,selection:a??hi,bot:{name:t.name,selection:t.modelSelection},query:C,expanded:w,probing:fi,loading:E,refreshing:F}),V=K.groups.map(q=>q.instance.instanceId===t.modelSelection.instanceId?{...q,note:s("botPanel.backups.sameAccount")}:q);return{...K,groups:V,...a?{}:{current:null}}},xe=S=>{if(!(S.nativeEvent.isComposing||S.defaultPrevented)){if(S.key!=="Escape")return Fa(S,{query:C,typed:D,close:()=>U(!0)});S.preventDefault(),S.stopPropagation(),C?v(""):U(!0)}};return e.jsxs(e.Fragment,{children:[e.jsx("button",{ref:m,type:"button",...u,"aria-label":r,title:i,"aria-haspopup":"dialog","aria-expanded":b,"aria-controls":b?_:void 0,onClick:()=>b?U(!1):g(),onKeyDown:S=>{S.key==="Escape"&&b?(S.preventDefault(),S.stopPropagation(),U(!1)):(S.key==="ArrowDown"||S.key==="ArrowUp")&&!b&&(S.preventDefault(),g())},className:d,children:o}),Y.shown&&Mn.createPortal(e.jsx("div",{ref:R,id:_,"data-backup-menu":!0,role:"dialog","aria-label":s("botPanel.backups.choose"),"aria-modal":"false",tabIndex:-1,...Y.exitProps,onKeyDown:xe,onPointerMove:Ta,style:{position:"fixed",left:I?.left??0,top:I?.top,bottom:I?.bottom,width:I?.width??ot,maxHeight:I?.maxHeight,transformOrigin:I?.origin,visibility:I?void 0:"hidden"},className:O("menu-surface z-[80] flex flex-col overflow-hidden",Y.className),children:e.jsx(Ba,{menu:de(),query:C,bot:t,botModel:{label:"",title:""},idPrefix:_,onQuery:v,onPick:(S,K)=>{S.policy||(l({instanceId:S.instanceId,model:K}),U(!0))},onPickCurrent:()=>U(!0),onFollowBot:()=>U(!0),onToggle:S=>N(K=>{const V=new Set(K);return V.delete(S.instanceId)||V.add(S.instanceId),V}),onSetUp:ie,onCheckAgain:$,onManage:ie})}),document.body)]})}function gi({bot:t,onChange:a}){const{state:n}=B(),l=t.fallback??[],r=x.useRef(null),i=d=>new Set([t.modelSelection,...l.filter((o,u)=>u!==d)].map(o=>bs(o.instanceId,o.model))),c=d=>{const o=n.instances.find(h=>h.instanceId===d.instanceId),u=o?.models.options.find(h=>h.id===d.model),p=Ia(o,d.model);return{instance:o,name:p,short:o&&u?Aa(u.label,La(o)):p}};return e.jsx(L,{anchor:"backups",children:e.jsxs(ce,{"data-panel-row":"backups",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Q,{icon:Ea}),e.jsx(te,{title:s("botPanel.backups.title")})]}),e.jsx("p",{className:"-mt-1 pl-[38px] text-[13px] leading-[1.35] text-ink-secondary",children:s("botPanel.backups.hint",{name:t.name})}),l.length>0&&e.jsx("ol",{"aria-label":s("botPanel.backups.title"),className:"flex flex-col gap-1 pl-[38px]",children:l.map((d,o)=>{const{instance:u,name:p,short:h}=c(d);return e.jsxs("li",{"data-backup":d.instanceId,className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"w-3 shrink-0 text-[12px] tabular-nums text-ink-tertiary","aria-hidden":"true",children:o+1}),e.jsxs(Et,{bot:t,current:d,exclude:i(o),onPick:k=>a(l.map((f,b)=>b===o?k:f)),label:s("botPanel.backups.row",{position:o+1,model:p}),title:u?`${u.displayName} · ${p}`:p,"data-panel-action":"backup-change",className:"group flex h-8 min-w-0 flex-1 items-center gap-2 rounded-[8px] bg-ink/[0.04] pl-2.5 pr-2 text-left text-[13px] text-ink hover:bg-ink/[0.07] aria-expanded:bg-ink/[0.08]",children:[u?e.jsx(Ra,{instance:u,size:14,subtle:!0}):e.jsx("span",{className:"size-3.5 shrink-0 rounded-full bg-ink/[0.08]","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:h}),!u&&e.jsx("span",{className:"shrink-0 text-[12px] text-warning",children:s("model.simple.unavailable")}),e.jsx(pe,{size:12,strokeWidth:2,"aria-hidden":"true",className:"shrink-0 text-ink-tertiary group-hover:text-ink-secondary"})]}),e.jsx(Oe,{"data-panel-action":"backup-remove",label:s("botPanel.backups.remove",{model:p}),onClick:()=>{a(l.filter((k,f)=>f!==o)),r.current?.focus({preventScroll:!0})}})]},o)})}),l.length<xi&&e.jsx("div",{className:"pl-[38px]",children:e.jsxs(Et,{bot:t,current:null,exclude:i(null),onPick:d=>a([...l,d]),label:s("model.fallback.add"),buttonRef:r,"data-panel-action":"backup-add",className:O(re,"aria-expanded:bg-raised-hover"),children:[e.jsx(Ee,{size:14,"aria-hidden":"true"}),s("model.fallback.add")]})})]})})}function yi({bot:t}){const{dispatch:a}=B(),[n,l]=x.useState(!1),[r,i]=x.useState(!1),[c,d]=x.useState(0),o=t.memoryEnabled!==!1&&t.memoryUpkeep!==!1;if(x.useEffect(()=>{if(!o)return;let p=!0;return se(`/api/bots/${t.id}/system-prompt`).then(h=>{p&&l(h.heavy===!0)},()=>{}),()=>{p=!1}},[t.id,o,c]),!o||!n)return null;const u=async()=>{i(!0);try{await es(t.id)}catch(p){a({type:"error",message:p instanceof Error&&p.message?p.message:s("common.tryAgain")})}finally{i(!1),d(p=>p+1)}};return e.jsx(L,{anchor:"heavy",children:e.jsxs("div",{"data-panel-row":"heavy",className:J,children:[e.jsx(Q,{icon:Ha}),e.jsx(te,{title:s("botPanel.heavy")}),e.jsx("button",{type:"button","data-panel-action":"tidy-memory",disabled:r,onClick:()=>{u()},className:re,children:r?s("memory.upkeep.tidying"):s("botPanel.tidyMemory")})]})})}const vi=5;function bi({bot:t}){const{dispatch:a,flushBotPatches:n}=B(),[l,r]=x.useState([]),[i,c]=x.useState(null),d=x.useCallback(()=>ht(t.id).then(u=>r(u.rows.slice(0,vi)),()=>{}),[t.id]);if(x.useEffect(()=>{d()},[d,t.soul]),!l.length)return null;const o=async u=>{if(!i){c(u.id);try{await n(t.id);const{revision:p}=await ht(t.id);await Vn(t.id,u.id,p)}catch(p){a({type:"error",message:p instanceof Error&&p.message?p.message:s("botOverview.undoFailed")})}finally{c(null),await d()}}};return e.jsxs("div",{"data-panel-row":"soul-changes",className:"flex flex-col gap-1.5",children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:s("memory.changes")}),e.jsx(Ze,{rows:l,botName:t.name,reverting:i,onRevert:u=>{o(u)}})]})}const ze={ask:()=>s("botSettings.simple.ask"),full:()=>s("botSettings.simple.justDoIt"),auto:()=>s("botSettings.simple.decide"),edits:()=>s("approvalMode.edits.label"),custom:()=>s("botPanel.acts.custom")};function ki({bot:t,derived:a,onOpen:n,editingInstructions:l=!1,onEditInstructions:r}){const{state:i,dispatch:c,flushBotPatches:d}=B(),{capabilities:o,ready:u}=ge(),p=Gt(t),{servers:h}=ls(),k=_a(_e(t)),f=Ua(),b=ds(t.id),y=rs(),[C,v]=x.useState(null),{patch:w,approvalMode:N,engine:E}=a,M=t.name,F=()=>{C!==null&&C.trim()!==t.title.trim()&&w({title:C.trim()}),v(null)},T=E?.driverKind==="antigravityAgent"&&N==="auto"?"ask":N,I=[{value:"ask",label:ze.ask(),tooltip:s("botSettings.simple.askHint")},{value:"full",label:ze.full(),tooltip:s("botSettings.simple.fullHint")},...T==="ask"||T==="full"?[]:[{value:T,label:ze[T](),disabled:!0,tooltip:T==="custom"?s("botPanel.acts.customHint"):void 0}]],z=g=>{g===N||g!=="ask"&&g!=="full"||c({type:"updateBot",botId:t.id,patch:{approvalMode:g,applyToAllThreads:!0}})},A=!u||Ka(o,i.config),m=sn(f,{turnsHere:A,canLive:!0}),R=A?null:qa(o,!!Va()?.speechStart,Wa(i.config)),D=Ga.map(g=>({value:g.id,label:s(g.label),disabled:g.id==="turns"&&R!==null,tooltip:g.id==="turns"&&R?`${R.label}. ${R.reason}`:g.id==="live"?s("call.mode.liveHint"):Ya("turns")})),H=Ja.map(g=>({value:g,label:s(ft[g][0]),tooltip:s(ft[g][1])})),_=()=>{const g=!t.notifications;g&&an(),w({notifications:g})},Y=t.alwaysAllow??[],G=l||!!t.soulDrift,U=[...p.apps.filter(g=>g.scope!==null).map(g=>g.label),...h?os(h,t.mcpServers,t.id).map(g=>g.name):[]];return e.jsxs("div",{"data-panel-settings":!0,children:[e.jsx(Gn,{bot:t}),e.jsx(L,{anchor:"instructions",children:G?e.jsxs(ce,{"data-panel-row":"soul",children:[e.jsx(Yn,{bot:t,onPatch:w,simple:{label:s("botSettings.simple.instructions"),placeholder:s("botSettings.simple.instructionsPlaceholder",{name:M})}}),e.jsx(bi,{bot:t}),l&&e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button","data-panel-done":"soul",onClick:()=>{d(t.id),r?.(!1)},className:re,children:s("botSettings.simple.done")})})]}):e.jsxs("button",{type:"button","data-panel-edit":"soul","aria-label":`${s("botSettings.simple.edit")}: ${s("botSettings.simple.instructions")}`,onClick:()=>r?.(!0),className:O(J,"w-full text-left hover:bg-ink/[0.03]"),children:[e.jsx(Q,{icon:Pe}),e.jsx(te,{title:s("botSettings.simple.instructions"),hint:e.jsx("span",{className:"line-clamp-1",children:Jn(t.soul??"")||s("botPanel.instructionsHint",{name:M})})}),e.jsx(he,{size:15,className:"shrink-0 text-ink-tertiary","aria-hidden":"true"})]})}),e.jsx(yi,{bot:t}),e.jsx(L,{anchor:"approval",children:e.jsxs(ce,{"data-panel-row":"approval",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Q,{icon:Dt}),e.jsx(te,{title:s("botSettings.simple.beforeActs",{name:M}),hint:t.busy?s("approvalMode.whileWorking"):void 0})]}),e.jsx("div",{className:"pl-[38px]",children:e.jsx(ke,{attr:"data-approval-choice",label:s("botSettings.simple.beforeActs",{name:M}),value:T,onChange:z,options:I})}),k.choice&&e.jsxs("div",{"data-panel-row":"thread-approval",className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 pl-[38px]",children:[e.jsx("span",{className:"text-[13px] text-ink-secondary",children:s("botPanel.thisConversation")}),e.jsx("span",{className:"ms-auto flex",children:e.jsx(Qa,{choice:k.choice})})]}),Y.length>0&&e.jsxs("div",{"data-panel-row":"always-allow",className:"flex min-w-0 flex-col gap-1 pl-[38px]",children:[e.jsx("span",{className:"text-[13px] text-ink-secondary",children:s("botAccess.always.title")}),Y.map(g=>e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink",children:g}),e.jsx(Oe,{"data-panel-action":`always-allow:${g}`,label:s("botAccess.always.remove",{entry:g}),onClick:()=>w({alwaysAllow:Y.filter($=>$!==g)})})]},g))]})]})}),e.jsx(gi,{bot:t,onChange:g=>w({fallback:g})}),e.jsx(L,{anchor:"call",children:e.jsxs(ce,{"data-panel-row":"call-mode",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Q,{icon:Tn}),e.jsx(te,{title:s("call.mode.menu")})]}),e.jsx("div",{className:"pl-[38px]",children:e.jsx(ke,{attr:"data-call-mode",label:s("call.mode.menu"),value:m,onChange:Xa,options:D})})]})}),e.jsxs(L,{anchor:"replies",children:[e.jsxs(ce,{"data-panel-row":"reply-style",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Q,{icon:Za}),e.jsx(te,{title:s("botSettings.replyStyle.title")})]}),e.jsx("div",{className:"pl-[38px]",children:e.jsx(ke,{attr:"data-reply-style",label:s("botSettings.replyStyle.title"),value:t.replyStyle??"default",onChange:g=>w({replyStyle:g}),options:H})})]}),e.jsx(Je,{"data-panel-row":"notifications",icon:en,title:s("voice.notifications.title"),color:t.color,checked:t.notifications,onChange:_})]}),e.jsxs(L,{anchor:"uses",children:[e.jsx(X,{"data-panel-page":"apps",icon:Vt,title:s("botPanel.appsRow"),value:U.length>0?U.join(", "):s("botPanel.appsNoneYet"),onClick:()=>n?.("apps")}),e.jsxs("label",{"data-panel-row":"job",className:O(J,"cursor-text"),children:[e.jsx(Q,{icon:Nr}),e.jsx("span",{className:"shrink-0 text-[14px] font-medium text-ink",children:s("botSettings.simple.job")}),e.jsx("input",{"data-panel-job":!0,value:C??t.title,placeholder:s("botSettings.simple.jobPlaceholder"),"aria-label":s("botSettings.simple.job"),maxLength:Ke.title,onChange:g=>v(g.target.value),onBlur:F,onKeyDown:g=>{g.key==="Enter"?(g.preventDefault(),g.currentTarget.blur()):g.key==="Escape"&&C!==null&&(g.preventDefault(),g.stopPropagation(),v(null))},className:"min-w-0 flex-1 bg-transparent text-right text-[13px] text-ink-secondary outline-none placeholder:text-ink-tertiary focus:text-ink"})]}),b&&e.jsxs("a",{"data-panel-row":"slack",href:b,target:"_blank",rel:"noopener noreferrer",className:O(J,"hover:bg-ink/[0.03]"),children:[e.jsx(Q,{icon:cs}),e.jsx(te,{title:s("botPanel.page.slack"),hint:s("botSlack.manage")}),e.jsx(Qt,{size:14,className:"shrink-0 text-ink-tertiary","aria-hidden":"true"})]}),y&&e.jsx(X,{"data-panel-page":"visibility",icon:Ft,title:s("botSettings.visibility.title"),value:Qn(t.visibility),onClick:()=>n?.("visibility")})]}),e.jsx(Xn,{bot:t,webhooksLink:!0,className:"mt-3.5"}),e.jsx(tn,{bot:t}),k.dialogs]})}const ji=5;function wi({bot:t,onChanged:a}){const{dispatch:n}=B(),[l,r]=x.useState([]),[i,c]=x.useState(null),[d,o]=x.useState(null),u=x.useCallback(async()=>{const[f,b]=await Promise.all([Qe(t.id),me(t.id)]);c(y=>f.lendingReview?{value:f.lendingReview,stale:y?.stale??!1}:null),r(b.slice(0,ji))},[t.id]);x.useEffect(()=>{u().catch(()=>{})},[u,t.busy]);const p=f=>n({type:"error",message:f instanceof Error&&f.message?f.message:s("common.tryAgain")}),h=async f=>{o(f.id);try{await ss(t.id,f.id),await a()}catch(b){p(b)}finally{o(null),await u().catch(()=>{})}},k=async f=>{o("review");try{await Zt(t.id,f.value.token),c(null)}catch(b){b instanceof Ht&&b.status===409?(c({...f,stale:!0}),await u().catch(()=>{})):p(b)}finally{o(null)}};return e.jsxs(e.Fragment,{children:[i&&e.jsx(ms,{changed:i.value.changed,stale:i.stale,busy:d!==null,onReviewed:()=>{k(i)}}),e.jsx(L,{children:e.jsx(Je,{"data-panel-row":"memory-upkeep",title:s("memory.upkeep.title"),checked:t.memoryUpkeep!==!1,color:t.color,onChange:()=>n({type:"updateBot",botId:t.id,patch:{memoryUpkeep:t.memoryUpkeep===!1}})})}),l.length>0&&e.jsx(L,{label:s("memory.changes"),children:e.jsx("div",{"data-panel-row":"memory-changes",className:"px-3.5 py-3",children:e.jsx(Ze,{rows:l,botName:t.name,reverting:d,onRevert:f=>{h(f)}})})})]})}const Ni="flex flex-col gap-3",Si="https://skills.sh";function Se(t,a){return t instanceof Error&&t.message?t.message:a}function Ci({bot:t,derived:a}){const{dispatch:n}=B(),l=Gt(t),{servers:r,error:i}=ls(),{patch:c,canUseConnectedApps:d}=a,o=r?xr(r,t.id):[],u=new Set(os(o,t.mcpServers,t.id).map(f=>f.name)),p=f=>{const b=cn(t,l.connectedSlugs,f.slug,f.scope===null);Object.keys(b).length>0&&c(b)},h=f=>{t.busy||i||c({mcpServers:hr(o,t.mcpServers,f)})},k=d?l.phase==="loading"?s("common.checking"):l.phase==="unknown"?s("botSettings.simple.appsUnknown"):l.apps.length===0?s("botSettings.simple.appsNone"):null:s("botSettings.simple.appsCannot",{name:t.name});return e.jsxs(e.Fragment,{children:[e.jsxs(L,{children:[k&&e.jsx(W,{children:k}),d&&l.apps.map(f=>e.jsxs("div",{"data-simple-app":f.slug,className:J,children:[e.jsx(ln,{card:f.card,className:"size-7 shrink-0"},`${f.card.logo}:${f.card.domain}`),e.jsx("div",{className:"min-w-0 flex-1 truncate text-[14px] font-medium text-ink",children:f.label}),e.jsx(ct,{color:t.color,checked:f.scope!==null,"aria-label":s("botSettings.simple.appToggle",{name:t.name,app:f.label}),disabled:!!t.busy,onClick:()=>p(f),className:"disabled:cursor-not-allowed"})]},f.slug))]}),(o.length>0||i)&&e.jsxs(L,{label:s("connectors.tab.mcp"),children:[i&&e.jsx(W,{children:s("botAccess.mcpRefreshError")}),o.map(f=>e.jsxs("div",{"data-simple-mcp":f.name,className:J,children:[e.jsx(Q,{icon:Bn}),e.jsx(te,{title:e.jsx("span",{className:"block truncate",children:f.name}),hint:f.enabled?f.offFor?.includes(t.id)?s("mcp.offFor",{bots:t.name}):void 0:s("botAccess.mcpDisabled")}),e.jsx(ct,{color:t.color,checked:u.has(f.name),"aria-label":s("botSettings.simple.appToggle",{name:t.name,app:f.name}),disabled:!f.enabled||!!t.busy||i,onClick:()=>h(f.name),className:"disabled:cursor-not-allowed"})]},f.name))]}),e.jsx(L,{children:e.jsx(fe,{"data-panel-link":"add-app",icon:Ee,onClick:()=>on(n,t.id),children:s("botPanel.apps.connectAnother")})})]})}function Pi({bot:t,derived:a}){const{state:n,dispatch:l}=B(),[r,i]=x.useState(()=>a.botRoutines.length===0?"new":null);return e.jsxs(e.Fragment,{children:[e.jsx(mr,{routines:a.botRoutines,runs:n.routineRuns,pausedBots:n.config?.pausedBots,loading:n.routinesLoadState==="loading"&&a.botRoutines.length===0,error:n.routinesLoadState==="error",onOpen:i,onLogs:c=>l({type:"showRoutines",section:"logs",botId:t.id,routineId:c.id}),onToggle:c=>l({type:"updateRoutine",routineId:c.id,patch:{enabled:!c.enabled}})}),e.jsx(L,{children:e.jsx(fe,{"data-panel-action":"new-routine",icon:Ee,onClick:()=>i("new"),children:s("botPanel.routines.add")})}),e.jsx("p",{className:"mx-1 text-[13px] leading-normal text-ink-secondary",children:s("botPanel.routines.ask",{name:t.name})}),r&&e.jsx(fr,{routine:r==="new"?void 0:r,bots:[t],lockedBotId:t.id,onClose:()=>i(null)},t.id)]})}function Oi({bot:t}){const a=ys(t),[n,l]=x.useState(""),[r,i]=x.useState(null),[c,d]=x.useState(!1),[o,u]=x.useState(null),p=t.memoryEnabled!==!1,h=a.docs?gs(a.docs):null,k=a.docs?.find(v=>v.path===Z)??null;x.useEffect(()=>i(null),[t.id,p]);const f=async v=>{if(c)return!1;d(!0),u(null);try{return await v()}catch(w){return u(Se(w,s("botPanel.library.memoryError"))),!1}finally{d(!1)}},b=(v,w)=>f(async()=>{const N=await Xe(t.id,v.path,w,v.exists?v.hash:void 0,a.mine);return N.ok?(a.setDoc(N.doc),!0):(await a.reload(),u(s("memory.conflict.title",{name:t.name})),!1)}),y=v=>{const w=a.docs?.find(N=>N.path===v.path);w&&(v.line!==null?b(w,oi(w.text,v.line)):f(async()=>(await ts(t.id,w.path,a.mine),await a.reload(),!0)))},C=async()=>{!k||!n.trim()||await b(k,ci(k.text,n))&&l("")};return p&&r?.botId===t.id?e.jsx(Ei,{bot:t,doc:r.doc,mine:a.mine,onDone:v=>{v&&a.setDoc(v),i(null),u(null)}}):e.jsxs(e.Fragment,{children:[e.jsxs(L,{children:[p?a.error?e.jsx(W,{tone:"warn",children:s("botPanel.library.memoryError")}):h===null?e.jsx(W,{children:s("common.checking")}):h.length===0?e.jsx(W,{children:s("botPanel.memory.empty")}):h.map(v=>e.jsxs("div",{"data-memory-note":v.line??v.path,className:J,children:[e.jsx("div",{className:"min-w-0 flex-1 text-[13px] leading-[1.45] text-ink",children:v.text}),e.jsx(Oe,{label:s("botPanel.memory.forget"),disabled:c,onClick:()=>y(v)})]},`${v.path}:${v.line}:${v.text}`)):e.jsx(W,{children:s("botPanel.library.memoryOff",{name:t.name})}),o&&e.jsx(W,{tone:"warn",children:o})]}),p&&e.jsxs(L,{children:[e.jsx(Yt,{"data-panel-form":"memory-add",value:n,placeholder:s("botPanel.memory.addPlaceholder",{name:t.name}),label:s("botPanel.memory.addPlaceholder",{name:t.name}),action:s("common.add"),disabled:c||k===null,onChange:l,onSubmit:()=>{C()}}),k&&e.jsx(fe,{"data-panel-link":"memory-text",icon:Pe,onClick:()=>i({botId:t.id,doc:k}),children:s("botPanel.memory.editText")})]}),p&&!a.mine&&e.jsx(wi,{bot:t,onChanged:a.reload})]})}function Ei({bot:t,doc:a,mine:n,onDone:l}){const[r,i]=x.useState({text:a.text,hash:a.hash}),[c,d]=x.useState(a.text),[o,u]=x.useState(null),[p,h]=x.useState(null),[k,f]=x.useState(!1),[b,y]=x.useState(null),C=x.useRef(!0);x.useEffect(()=>(C.current=!0,()=>{C.current=!1}),[]);const v=async N=>{f(!0),y(null);try{const E=await Xe(t.id,a.path,c,N,n);if(!C.current)return;E.ok?l(E.doc):u({current:E.current,currentHash:E.currentHash})}catch(E){y(Se(E,s("botPanel.library.memoryError")))}finally{f(!1)}},w=()=>{o&&(h(N=>N===null||N===c?c:`${N}
|
|
15
|
-
|
|
16
|
-
${c}`),i({text:o.current,hash:o.currentHash}),d(o.current),u(null))};return e.jsx(L,{children:e.jsxs(ce,{"data-panel-row":"memory-text",children:[o&&e.jsx(ps,{botName:t.name,busy:k,onReload:w,onOverwrite:()=>{v(o.currentHash)}}),e.jsx("textarea",{"data-memory-text":"",className:O(We,"min-h-[280px] resize-y font-mono text-[13px] leading-relaxed"),value:c,placeholder:s("memory.indexPlaceholder"),"aria-label":s("memory.botMemory"),readOnly:k,onChange:N=>d(N.target.value)}),b&&e.jsx("div",{className:"text-[13px] text-warning",children:b}),p!==null&&e.jsxs("div",{"data-memory-draft":"",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:p}),e.jsx("button",{type:"button",className:O(re,"mt-1"),onClick:()=>h(null),children:s("memory.dismissDraft")})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",className:re,disabled:k,onClick:()=>l(null),children:s("common.cancel")}),e.jsx("button",{type:"button","data-panel-done":"memory-text",className:re,disabled:k||c===r.text,onClick:()=>{v(r.hash)},children:k?s("memory.saving"):s("memory.save")})]})]})})}function Ri({bot:t}){const{request:a}=nn(),{state:n,dispatch:l}=B(),r=as(t),[i,c]=x.useState(""),[d,o]=x.useState(!1),[u,p]=x.useState([]),h=rn(n.config),k=async y=>{if(!r.working&&window.confirm(s(y.origin==="library"?"skills.unassignConfirm":"botPanel.skills.removeConfirm",{name:y.name}))){r.setWorking(y.name),r.setError("");try{await a(`/api/bots/${t.id}/skills/${encodeURIComponent(y.name)}`,{method:"DELETE"}),await r.refresh()}catch(C){r.setError(Se(C,s("botPanel.skills.removeFailed")))}finally{r.setWorking("")}}},f=async()=>{const y=i.trim();if(!(!y||d)){o(!0),r.setError(""),p([]);try{const C=await a(`/api/bots/${t.id}/skills`,{method:"POST",body:JSON.stringify({source:y})});p(sr(C.imported??[])),c(""),await r.refresh()}catch(C){r.setError(Se(C,s("botPanel.skills.importFailed")))}finally{o(!1)}}},b=()=>{if(h){l({type:"toggleSettings",open:!1}),l({type:"toggleAppSettings",open:!0,section:"skills"});return}Es(Si)};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{children:[r.loading?e.jsx(W,{children:s("skills.loading")}):r.skills.length===0?e.jsx(W,{children:s("botSettings.simple.noSkills")}):r.skills.map(y=>e.jsx(Je,{"data-panel-row":`skill:${y.name}`,title:y.name,hint:y.description||y.source,label:s("botSettings.simple.skillToggle",{name:y.name}),color:t.color,checked:ns(y),disabled:!!r.working,onChange:()=>{r.toggle(y)},extra:y.origin==="imported"||y.origin==="native"?void 0:e.jsx(Oe,{"data-panel-action":`remove-skill:${y.name}`,label:s("botPanel.skills.remove",{name:y.name}),disabled:!!r.working,onClick:()=>{k(y)}})},y.name)),r.error&&!r.reviewing&&e.jsx(W,{tone:"warn",children:r.error})]}),e.jsx(er,{bot:t,onAdded:()=>{r.refresh()}}),e.jsxs(L,{children:[e.jsx(Yt,{"data-panel-form":"skill-import",value:i,placeholder:s("botPanel.skills.importPlaceholder"),label:s("skills.import.label"),action:d?s("skills.import.importing"):s("common.add"),disabled:d,onChange:c,onSubmit:()=>{f()}}),u.map(y=>e.jsx(W,{children:y},y)),e.jsx(fe,{"data-panel-link":"browse-skills",onClick:b,children:s("botPanel.skills.browse")})]}),r.reviewing&&e.jsx(tr,{skill:r.reviewing.skill,text:r.reviewing.text,error:r.error,working:r.working===r.reviewing.skill.name,onCancel:()=>r.setReviewing(null),onEnable:()=>{r.enableReviewed()}})]})}function Ii({bot:t}){const{capabilities:a}=ge(),n=a.host?.homeDir,{draft:l,setDraft:r,error:i,saving:c,canPick:d,save:o,pick:u}=Zn(t),[p,h]=x.useState(!1),k=!!t.cwd||p,f=()=>{if(d){u();return}h(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{children:[e.jsx(He,{"data-panel-choice":"private",title:s("botPanel.folder.own"),hint:s("botPanel.folder.ownHint"),checked:!k,disabled:c,onClick:()=>{h(!1),t.cwd&&o(null)}}),e.jsx(He,{"data-panel-choice":"pick",title:s("botPanel.folder.pick"),hint:s("botPanel.folder.pickHint"),checked:k,disabled:c,onClick:()=>{t.cwd||f()}})]}),k&&e.jsxs(L,{children:[d?e.jsxs("div",{className:J,children:[e.jsx("div",{className:"min-w-0 flex-1 truncate rounded-lg border border-hairline/40 bg-inset px-3 py-2 font-mono text-[13px] text-ink",title:t.cwd,children:t.cwd?Ge(t.cwd,n):e.jsx("span",{className:"text-ink-secondary",children:s("botAccess.folder.private")})}),e.jsxs("button",{type:"button","data-panel-action":"pick-folder",disabled:c,onClick:()=>{u()},className:re,children:[e.jsx(zt,{size:14,"aria-hidden":"true"}),s("botAccess.folder.choose")]})]}):e.jsxs("form",{"data-panel-form":"folder-path",className:J,onSubmit:b=>{b.preventDefault();const y=(l??t.cwd??"").trim();y&&o(y)},children:[e.jsx("input",{value:l??t.cwd??"",placeholder:s("botAccess.folder.placeholder"),"aria-label":s("botAccess.folder.title"),onChange:b=>r(b.target.value),className:"h-8 min-w-0 flex-1 rounded-lg border border-hairline bg-inset px-2.5 font-mono text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent-border"}),e.jsx("button",{type:"submit",disabled:c||l===null,className:re,children:s("botAccess.folder.save")})]}),i&&e.jsx(W,{tone:"warn",children:i})]})]})}function Ai({bot:t,derived:a}){const n=xs(t);return e.jsx(pi,{bot:t,browserEnabled:a.browserEnabled,onOpenBrowser:()=>n("browser")})}function Li({bot:t}){return rs()?e.jsx(is,{bot:t}):null}function Mi({page:t,onOpen:a,editingInstructions:n,onEditInstructions:l,...r}){switch(t){case"settings":return e.jsx(ki,{...r,onOpen:a,editingInstructions:n,onEditInstructions:l});case"where":return e.jsx(Jr,{...r});case"apps":return e.jsx(Ci,{...r});case"routines":return e.jsx(Pi,{...r});case"visibility":return e.jsx(Li,{...r});case"memory":return e.jsx(Oi,{...r});case"skills":return e.jsx(Ri,{...r});case"folder":return e.jsx(Ii,{...r});case"browser":return e.jsx(Ai,{...r})}}const Rt="rounded-lg border border-accent-border bg-inset px-2 py-[3px] text-center text-ink outline-none placeholder:text-ink-tertiary";function It(t){const[a,n]=x.useState(null),l=x.useRef(!1),r=x.useRef(!1),i=x.useRef(null);x.useEffect(()=>{a!==null||!r.current||(r.current=!1,i.current?.focus())},[a]);const c=p=>{l.current=!1,n(p)},d=()=>{a!==null&&t(a),n(null)};return{draft:a,setDraft:n,start:c,onKeyDown:p=>{if(un(p.nativeEvent)){p.stopPropagation();return}p.key==="Enter"?(p.preventDefault(),l.current=!0,r.current=!0,d()):p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),l.current=!0,r.current=!0,n(null))},onBlur:()=>{l.current||d()},buttonRef:i}}function Ti({bot:t,activeState:a,patch:n,editorOpen:l,onToggleEditor:r}){const i=It(o=>{const u=o.trim();u&&u!==t.name&&n({name:u})}),c=It(o=>{const u=o.trim();u!==t.title.trim()&&n({title:u})}),d=t.title.trim();return e.jsxs("div",{className:"group/hero flex flex-col items-center text-center",children:[e.jsxs("button",{type:"button","data-panel-avatar":!0,"aria-label":s("botPanel.avatar.edit"),"aria-expanded":l,onClick:r,className:"group relative rounded-[18px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-border",children:[e.jsx(qe,{bot:t,size:64,state:a}),e.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 flex items-center justify-center rounded-[18px] bg-black/0 text-white opacity-0 transition-[opacity,background-color] group-hover:bg-black/40 group-hover:opacity-100 group-focus-visible:bg-black/40 group-focus-visible:opacity-100 group-focus-within:opacity-100 touch:opacity-100 motion-reduce:transition-none",children:e.jsx(dt,{size:20})}),t.chiefOfStaff&&e.jsxs("span",{"data-panel-chief":!0,title:s("chat.chiefOfStaff"),className:"absolute -bottom-0.5 -right-0.5 flex size-[22px] items-center justify-center rounded-full bg-accent text-accent-ink ring-[3px] ring-app",children:[e.jsx(dn,{size:12,"aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:s("chat.chiefOfStaff")})]}),e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute left-1/2 top-[calc(100%+4px)] z-10 -translate-x-1/2 whitespace-nowrap rounded-md border border-hairline bg-menu px-[7px] py-0.5 text-[12px] text-ink opacity-0 transition-opacity group-hover:opacity-100",children:s("botPanel.avatar.edit")})]}),e.jsx("div",{"data-panel-name-row":!0,className:"mt-2 flex max-w-full items-center justify-center",children:e.jsx("h2",{id:"bot-settings-title",className:"flex min-w-0 justify-center",children:i.draft!==null?e.jsx("input",{autoFocus:!0,"data-panel-rename-input":!0,"aria-label":s("botSettings.simple.name"),maxLength:Ke.name,value:i.draft,onChange:o=>i.setDraft(o.target.value),onKeyDown:i.onKeyDown,onBlur:i.onBlur,className:O(Rt,"w-[220px] max-w-full text-[17px] font-medium leading-6")}):e.jsxs("button",{ref:i.buttonRef,type:"button","data-panel-rename":!0,title:s("botPanel.rename"),onClick:()=>i.start(t.name),className:"group/name relative inline-flex max-w-full items-center rounded-[8px] px-1.5 text-[17px] font-medium leading-6 text-ink hover:bg-ink/[0.04]",children:[e.jsx("span",{className:"min-w-0 truncate",children:t.name}),e.jsx(dt,{size:13,"aria-hidden":"true",className:"absolute -right-4 shrink-0 text-ink-tertiary opacity-0 transition-opacity group-hover/name:opacity-100 group-focus-visible/name:opacity-100 group-focus-within/name:opacity-100 touch:opacity-100"})]})})}),c.draft!==null?e.jsx("input",{autoFocus:!0,"data-panel-label-input":!0,"aria-label":s("botSettings.simple.job"),placeholder:s("botSettings.simple.jobPlaceholder"),maxLength:Ke.title,value:c.draft,onChange:o=>c.setDraft(o.target.value),onKeyDown:c.onKeyDown,onBlur:c.onBlur,className:O(Rt,"mt-[3px] w-[200px] max-w-full text-[13px]")}):d&&e.jsx("button",{ref:c.buttonRef,type:"button","data-panel-label":!0,onClick:()=>c.start(t.title),className:"mt-px max-w-full truncate rounded-md px-1.5 py-px text-[13px] text-ink-secondary hover:bg-ink/[0.04]",children:d})]})}function be(t,a){return t?Jt(t,a):{tab:"details"}}function Bi({bot:t,derived:a,linkedSection:n,onClose:l}){const{dragProps:r}=Xt(),i=mn(),[c,d]=x.useState(()=>be(n,i).tab),[o,u]=x.useState(()=>{const m=be(n,i).page;return m?[m]:[]}),[p,h]=x.useState(()=>be(n,i).anchor??null),[k,f]=x.useState(!1),[b,y]=x.useState(()=>!!be(n,i).editInstructions),C=x.useRef(null),v=x.useRef(null),w=o.at(-1)??null,N=()=>C.current?.scrollTo({top:0}),E=m=>{d(m.tab),u(m.page?[m.page]:[]),h(m.anchor??null),f(!1),y(!!m.editInstructions),N()},M=m=>E({tab:m}),F=m=>{u(R=>[...R,m]),f(!1),N()},T=()=>{f(!1),v.current?.querySelector("[data-panel-avatar]")?.focus()},I=()=>{u(m=>m.slice(0,-1)),N()};x.useEffect(()=>{n&&E(Jt(n,i))},[n,i]),x.useEffect(()=>{p&&(C.current?.querySelector(`[data-panel-card="${p}"]`)?.scrollIntoView({block:"start"}),h(null))},[p,w,c]);const z=m=>{if(m.key!=="Escape"||m.defaultPrevented)return;const R=m.target,D=typeof R?.closest=="function"?R.closest('[role="dialog"], [role="alertdialog"]'):null;if(!(D&&!D.contains(m.currentTarget)&&D!==v.current&&!v.current?.contains(D))){if(k)T();else if(o.length>0)I();else return;m.preventDefault(),m.stopPropagation()}},A=o.length>1?s(ve[o[o.length-2]].title,{name:t.name}):s(ut[c]);return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",onKeyDown:z,children:[e.jsxs("div",{...r,className:"flex h-[50px] shrink-0 items-start justify-end gap-2.5 px-[13px] pt-[13px]",children:[e.jsx(pn,{bot:t,className:Me}),e.jsx("button",{type:"button","data-panel-gear":!0,"aria-label":s("botPanel.page.settings"),title:s("botPanel.page.settings"),"aria-current":w==="settings"?"page":void 0,onClick:()=>E({tab:"details",page:"settings"}),className:Me,children:e.jsx(xn,{size:16,className:"pointer-events-none"})}),e.jsx("button",{type:"button",onClick:l,"aria-label":s("botSettings.simple.close"),className:Me,children:e.jsx(Tt,{size:16,className:"pointer-events-none"})})]}),e.jsx("div",{ref:C,className:"@container relative min-h-0 flex-1 overflow-y-auto px-4 pb-7",children:w===null?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mt-3.5",ref:v,children:[e.jsx(Ti,{bot:t,activeState:a.activeState,patch:a.patch,editorOpen:k,onToggleEditor:()=>f(m=>!m)}),k&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-20","aria-hidden":"true","data-panel-scrim":!0,onClick:T}),e.jsx(Vr,{bot:t,activeState:a.activeState,onPatch:a.patch,onClose:T})]})]}),e.jsx("div",{role:"tablist","aria-label":s("botSettings.simple.tabs"),className:"sticky top-0 z-[1] -mx-4 mt-[15px] flex justify-center bg-app px-4 pb-2.5 pt-1 after:pointer-events-none after:absolute after:inset-x-0 after:top-full after:h-3 after:bg-linear-to-b after:from-app after:to-transparent",children:e.jsx("div",{className:"flex min-w-0 gap-0.5 rounded-full bg-ink/[0.05] p-[3px]",children:hn.map(m=>e.jsx("button",{type:"button",role:"tab","aria-selected":c===m,"data-panel-tab":m,onClick:()=>M(m),className:O("h-[26px] min-w-0 shrink truncate rounded-full px-3 text-[13px] leading-[18px] transition-colors",c===m?"bg-ink/[0.1] font-medium text-ink":"text-ink-secondary hover:text-ink"),children:s(ut[m])},m))})}),e.jsxs("div",{role:"tabpanel",children:[c==="details"&&e.jsx(ii,{bot:t,derived:a,onOpen:F}),c==="library"&&e.jsx(vs,{bot:t,onOpen:F}),c==="computer"&&e.jsx(Qr,{bot:t,derived:a,onOpen:F})]})]}):e.jsxs("div",{"data-panel-page-view":w,children:[e.jsx("span",{id:"bot-settings-title",className:"sr-only",children:t.name}),e.jsx(fn,{back:A,title:s(ve[w].title,{name:t.name}),intro:ve[w].intro?s(ve[w].intro,{name:t.name}):void 0,onBack:I}),e.jsx("div",{className:O("mt-4",Ni),children:e.jsx(Mi,{page:w,bot:t,derived:a,onOpen:F,editingInstructions:b,onEditInstructions:y})})]})})]})}function Di(t,a){const{state:n,flushBotPatches:l}=B(),[r,i]=x.useState(null),[c,d]=x.useState(!1),[o,u]=x.useState(null),[p,h]=x.useState(!1),k=x.useMemo(()=>JSON.stringify([t.name,t.title,t.description,t.soul,t.computer,t.cloudBackend,t.cwd,t.autoApprove,t.section,t.composio,t.browser,t.mcpServers,t.chiefOfStaff,t.managedSections,t.modelSelection]),[t.name,t.title,t.description,t.soul,t.computer,t.cloudBackend,t.cwd,t.autoApprove,t.section,t.composio,t.browser,t.mcpServers,t.chiefOfStaff,t.managedSections,t.modelSelection]),f=a.followEdits??!0,b=f?k:null,y=f?n.routines:null,C=f?n.webhooks:null;return x.useEffect(()=>{if(!a.overview&&!a.prompt)return;let v=!1;return(async()=>(await l(t.id),!v&&(a.overview&&se(`/api/bots/${t.id}/overview`).then(N=>{v||(i(N),d(!1))}).catch(()=>{v||d(!0)}),a.prompt&&se(`/api/bots/${t.id}/system-prompt`).then(N=>{v||(u(N),h(!1))}).catch(()=>{v||h(!0)}))))(),()=>{v=!0}},[t.id,a.overview,a.prompt,b,y,C,l]),{overview:r,overviewError:c,prompt:o,promptError:p}}function Fi(t,a){const{dispatch:n,flushBotPatches:l}=B(),[r,i]=x.useState(null),[c,d]=x.useState(!1),[o,u]=x.useState(null),p=x.useRef(0),[h,k]=x.useState(!1),[f,b]=x.useState(null),y=x.useCallback(()=>{const w=++p.current;return d(!1),l(t.id).then(()=>se(`/api/bots/${t.id}/history?limit=100`)).then(N=>{w===p.current&&(i(N.rows),u(N.revision))}).catch(()=>{w===p.current&&d(!0)})},[t.id,l]);return x.useEffect(()=>{if(a)return y(),()=>{p.current++}},[a,y]),{rows:r,error:c,revision:o,rollingBack:h,rollbackTarget:f,setRollbackTarget:b,rollback:async w=>{if(!h){b(null),k(!0);try{await l(t.id),await se(`/api/bots/${t.id}/history/rollback`,{method:"POST",body:JSON.stringify(w)})}catch(N){n({type:"error",message:N instanceof Error?N.message:s("botOverview.undoFailed")})}finally{await y(),k(!1)}}},requestRollback:w=>{o&&b({id:w,expectedRevision:o})}}}function $i({history:t,returnFocusRef:a}){const{rollbackTarget:n,setRollbackTarget:l,rollback:r}=t;return e.jsx(gn,{open:n!==null,title:s("botOverview.restoreSoul.title"),body:s("botOverview.restoreSoul.body"),confirmLabel:s("botOverview.restoreSoul.confirm"),tone:"neutral",returnFocusRef:a,onCancel:()=>l(null),onConfirm:()=>{n&&r(n)}})}const zi={memory:"memory",skills:"skills",folder:"access"},ks=t=>t.labelKey?s(t.labelKey):t.label;function At(t,a){return a?[t.label,ks(t),...t.keywords].some(n=>n.toLowerCase().includes(a)):!0}function nl({bot:t,overlay:a=!1}){const{state:n,dispatch:l}=B(),r=n.botSettingsSection,i=yn(t),c=x.useRef(null),{dragProps:d}=Xt(),[o,u]=x.useState(""),p=!n.botSettingsExpandAccordion,h=o.trim().toLowerCase(),f=!Mt(),b=!p&&!n.botSettingsExpandRemembered?r:null,y=ds(t.id),C=Ye(),v=vn(),w=Sr.filter(A=>A.id!=="slack"||y!==null).filter(A=>A.id!=="visibility"||!window.ogb&&C===!0&&!v),N=w.filter(A=>At(A,h)),{overview:E,overviewError:M,prompt:F,promptError:T}=Di(t,{overview:r==="overview"&&!f,prompt:r==="overview"&&!f}),I=Fi(t,r==="history"&&!f);x.useEffect(()=>{if(!p){if(h){u("");return}c.current?.querySelector(`[data-bot-settings-section="${r}"]`)?.scrollIntoView({block:"nearest"})}},[p,r,h]),x.useEffect(()=>{const A=document.activeElement instanceof HTMLElement?document.activeElement:null,m=c.current;m?.focus();const R=D=>{const H=m?.querySelector('[role="dialog"], [role="alertdialog"]');H&&H.getClientRects().length>0||m&&D.target instanceof Node&&!m.contains(D.target)||D.key==="Escape"&&!D.defaultPrevented&&(D.preventDefault(),l({type:"toggleSettings",open:!1}))};return window.addEventListener("keydown",R),()=>{window.removeEventListener("keydown",R),A?.focus()}},[l]);const z=A=>{switch(A){case"overview":return E===null&&M?e.jsx("div",{className:"rounded-xl bg-card p-4 text-[13px] text-ink-secondary",children:s("botSettings.overviewFailed")}):e.jsx(Ar,{overview:E,refreshError:E!==null&&M,prompt:F,promptError:T,onOpen:m=>l({type:"toggleSettings",open:!0,section:m}),onSetup:i.canCoordinate&&!t.busy?()=>{l({type:"toggleSettings",open:!1}),l({type:"send",botId:t.id,text:"/setup",threadId:t.threadId})}:void 0});case"identity":return e.jsx(cr,{bot:t,patch:i.patch,activeState:i.activeState,mascotMotion:i.mascotMotion});case"soul":return e.jsx(or,{bot:t,patch:i.patch});case"slack":return y?e.jsx(Lr,{managementUrl:y}):null;case"skills":return e.jsx(lr,{bot:t});case"memory":return e.jsx(Br,{bot:t,active:!p&&r==="memory",onToggle:m=>i.patch({memoryEnabled:m})});case"library":return e.jsx(vs,{bot:t,onOpen:m=>l({type:"toggleSettings",open:!0,section:zi[m]??"overview"})});case"routines":return e.jsx(pr,{bot:t,routines:i.botRoutines,runs:n.routineRuns});case"access":return e.jsx(ir,{bot:t,derived:i});case"model":return e.jsx(rr,{bot:t});case"permissions":return e.jsx(nr,{bot:t,derived:i});case"voice":return e.jsx(ar,{bot:t,derived:i});case"visibility":return e.jsx(is,{bot:t});case"history":return I.rows===null&&I.error?e.jsx("div",{className:"rounded-xl bg-card p-4 text-[13px] text-ink-secondary",children:s("botSettings.historyFailed")}):e.jsx(zr,{bot:t,rows:I.rows,refreshError:I.rows!==null&&I.error,onRollback:I.requestRollback,rollingBack:I.rollingBack||!I.revision});case"usage":return e.jsx(Hr,{bot:t});default:return null}};return e.jsxs(e.Fragment,{children:[e.jsx("aside",{ref:c,id:f?bn:void 0,role:"dialog","aria-labelledby":"bot-settings-title",tabIndex:-1,className:jn(a,f),children:f?e.jsx(Bi,{bot:t,derived:i,linkedSection:b,onClose:()=>l({type:"toggleSettings",open:!1})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{...d,className:"flex shrink-0 items-center justify-between px-4 py-3",children:[e.jsx("span",{id:"bot-settings-title",className:"truncate text-[15px] font-semibold text-ink",children:t.name}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(kn,{bot:t,className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink"}),e.jsx("button",{type:"button",onClick:()=>l({type:"toggleSettings",open:!1}),"aria-label":s("botSettings.simple.close"),className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(Tt,{size:18,className:"pointer-events-none"})})]})]}),e.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:[e.jsx(Lt,{size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{value:o,onChange:A=>{u(A.target.value),l({type:"toggleSettings",open:!0})},onKeyDown:A=>{A.key==="Escape"&&(A.stopPropagation(),o?u(""):l({type:"toggleSettings",open:!1}))},placeholder:s("botSettings.search"),"aria-label":s("botSettings.searchAria"),className:"w-full bg-transparent text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",children:[N.length===0&&e.jsx("div",{className:"px-4 py-4 text-[13px] leading-relaxed text-ink-secondary",children:s("botSettings.searchNone",{query:o.trim()})}),w.map(A=>{const{id:m,icon:R}=A,D=ks(A),H=At(A,h);if(!H&&m!=="memory")return null;const _=!p&&r===m;return e.jsxs("div",{"data-bot-settings-section":m,className:"border-b border-hairline/30",hidden:!H,children:[e.jsxs("button",{type:"button",onClick:()=>{if(r===m&&!p){l({type:"toggleSettings",open:!0});return}l({type:"toggleSettings",open:!0,section:m})},"aria-expanded":_,className:O("flex w-full shrink-0 items-center gap-2.5 px-4 py-2.5 text-left text-[14px]",_?"bg-control/60 text-ink":"text-ink-secondary hover:bg-control/40 hover:text-ink"),children:[e.jsx(R,{size:15,className:"shrink-0"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:D}),e.jsx(pe,{size:16,className:O("shrink-0 text-ink-secondary transition-transform",_&&"rotate-180")})]}),m==="memory"?e.jsx("div",{hidden:!_,className:"px-4 pb-4 pt-1",children:z("memory")}):_&&e.jsx("div",{className:"px-4 pb-4 pt-1",children:z(m)})]},m)})]})]})}),e.jsx($i,{history:I,returnFocusRef:c})]})}export{nl as BotSettingsDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-B5yiNmEY.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{c as r,s as e}from"./flowDiagram-OXPTDLAJ-DL25A20O.js";import{_ as o}from"./mermaid.core-B5yiNmEY.js";import"./chunk-5VM5RSS4-Sw6phnaf.js";import"./chunk-XXDRQBXY-CLIJBS-V.js";import"./chunk-KQW6MTUR-Bh_TxL0e.js";import"./chunk-7TKQ45FW-CheglUSd.js";import"./channel-BQyC_QMX.js";import"./styles-C_rlkDrt.js";import"./step-CkmJJ7wq.js";var a=o(t=>`${e(t)}
|
|
2
|
-
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
-
stroke: ${t.clusterBorder} !important;
|
|
4
|
-
}
|
|
5
|
-
[data-look="neo"].cluster rect {
|
|
6
|
-
filter: none;
|
|
7
|
-
}
|
|
8
|
-
`,"getStyles"),m=a,y=r({styles:m});export{y as diagram};
|