openmausbot 0.1.97 → 0.1.98
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-H6D3SD39.js +1 -0
- package/dist/assets/BotSettingsDialog-Dqz_AiBZ.js +7 -0
- package/dist/assets/CloudBackendPicker-iezpJFpF.js +1 -0
- package/dist/assets/ComputerPanel-DZPj-IWu.js +1 -0
- package/dist/assets/DesktopViewer-utONms1p.js +5 -0
- package/dist/assets/InspectorPanel-OVaBVrzC.js +5 -0
- package/dist/assets/KeyboardShortcutsModal-gk9mvHj_.js +1 -0
- package/dist/assets/LocalVmWorkspace-DLIvd2kC.js +1 -0
- package/dist/assets/MacLocalControl-bJv8yiPB.js +1 -0
- package/dist/assets/NewBotDialog-1qGOAdUM.js +2 -0
- package/dist/assets/RemoteAgentSettingsPanel-DqKr0HkO.js +1 -0
- package/dist/assets/RoutinesPage-BM2D4qGi.js +1 -0
- package/dist/assets/RoutinesSection-Dny9ra-c.js +1 -0
- package/dist/assets/SettingsModal-gC6XJJmt.js +11 -0
- package/dist/assets/TeamMapPage-B6fuu4r_.js +8 -0
- package/dist/assets/TriggersPanel-j0qTP2CO.js +1 -0
- package/dist/assets/VisibilitySection-DT0FqPvu.js +12 -0
- package/dist/assets/WebhooksPanel--YQyCjKO.js +3 -0
- package/dist/assets/{abnfDiagram-O67JEVCF-k1UCNXb7.js → abnfDiagram-O67JEVCF-BsjcFX0-.js} +1 -1
- package/dist/assets/activity-BxOkayvD.js +1 -0
- package/dist/assets/{arc-BUWGa9UU.js → arc-CJNA94c6.js} +1 -1
- package/dist/assets/architectureDiagram-NJMV4G6O-dz2ud7lP.js +36 -0
- package/dist/assets/{blockDiagram-BEXU5L5S-Ag9nLW4H.js → blockDiagram-BEXU5L5S-ChBEALoR.js} +1 -1
- package/dist/assets/brain-CFZ7PEXc.js +1 -0
- package/dist/assets/{c4Diagram-YGBWAQC7-Bh0sjgUa.js → c4Diagram-YGBWAQC7-KZNRKDQe.js} +1 -1
- package/dist/assets/channel-WhFyujhZ.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-BFBcIIqu.js → chunk-2Q5K7J3B-BLLwmCET.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-Dvfpex-f.js → chunk-3FUC2YCW-CQxyreBZ.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-CMjP2YZW.js → chunk-5VM5RSS4-D6sFMW0u.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-BryoeTc7.js → chunk-GTNCS2PH-BaZ1YgLF.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-BhfvcchO.js → chunk-GWA4HPMP-CcalphmC.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-bcCVp8rp.js → chunk-JWPE2WC7-CSk8R3ve.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-yKIjIlkQ.js → chunk-NETBCI7D-CTmLjA57.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-D3Zqbmup.js → chunk-WEXAMYUT-CM9Z77Ne.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CjVoIMG6.js → chunk-XXDRQBXY-B1fxpMS2.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-mUCWdVyH.js → classDiagram-v2-NBCMYWYE-DCCyoLpj.js} +1 -1
- package/dist/assets/computer-control-NLov352p.js +1 -0
- package/dist/assets/cose-bilkent-JH36ORCC-KyImBKvE.js +1 -0
- package/dist/assets/{cynefin-OW5HDTMX-BpRrxoO4.js → cynefin-OW5HDTMX-fsZc6MGa.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-D3VBWCPK.js → cynefinDiagram-VND7K2PF-CGmHsShB.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-DxEIACOO.js → dagre-6A5THRUB-Dah1h-CH.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-BANgZEOS.js → diagram-22UHCM2B-BIu71OyV.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-Cnq7nJir.js → diagram-3UASUU5V-gxhUB_Mu.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-4TBDIWnz.js → diagram-ATOU4E4O-CBhusUBn.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-CD_B39D4.js → diagram-CDSNMT55-BdPrc86x.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-CzvnFhEC.js → diagram-MLGK6HIB-Clp110R_.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-C4w2SNml.js → diagram-MPIPVDR6-DJKfbugw.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-gkUEBm2s.js → ebnfDiagram-ZINNZB2B-DnsltoBu.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-B_56X6mw.js → elk-276RUBZZ-jWdq6gqH.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-C_oByoDS.js → erDiagram-OPXOYQCR-DArPVf8u.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-CR9xXJkC.js → flowDiagram-KWPJA3E3-D2HZ-2f7.js} +1 -1
- package/dist/assets/ganttDiagram-FUAMR5RP--o0KIxEo.js +292 -0
- package/dist/assets/{gitGraphDiagram-X574FWY7-VJ6-Tp_p.js → gitGraphDiagram-X574FWY7-CsoXr2D7.js} +1 -1
- package/dist/assets/image-plus-BbVjGHin.js +1 -0
- package/dist/assets/index-BrPW5HDO.css +1 -0
- package/dist/assets/index-C3NqfdVU.js +585 -0
- package/dist/assets/{index-Cp4S4NOL.js → index-CJTp9JEp.js} +1 -1
- package/dist/assets/{infoDiagram-VRGFBTTK-2Lu9te4D.js → infoDiagram-VRGFBTTK-g-6lNp7r.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-DR49XY-e.js → ishikawaDiagram-OU5B5YK6-B1d6qVTV.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-ZoR0M305.js → journeyDiagram-ZHPQQLJL-BTPuiU6T.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-DLKHxrO-.js → kanban-definition-PNTS6WVX-bDDuRJvP.js} +1 -1
- package/dist/assets/{linear-BASsfWly.js → linear-BVVKbEMy.js} +1 -1
- package/dist/assets/{mermaid.core-BVidiPkk.js → mermaid.core-JJdoKyKB.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-g_Qx0U5C.js → mindmap-definition-NLK3R4M7-B4aE3T0q.js} +1 -1
- package/dist/assets/module-DCUsy2BQ.js +3 -0
- package/dist/assets/page-visible-BBo_Zm8g.js +1 -0
- package/dist/assets/{pegDiagram-GJSIUBJH-DI9Cjs8w.js → pegDiagram-GJSIUBJH-DFKQWpR7.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-sRI0Uhr5.js → pieDiagram-5QR66LMP-Iv7OKVJi.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-CamKTby3.js → quadrantDiagram-O4NWA36T-U2YnfwBk.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-DOLlkbf3.js → railroadDiagram-XR7U4H2S-CuPy6RqM.js} +1 -1
- package/dist/assets/remote-desktop-panel-BNEj7tUx.js +1 -0
- package/dist/assets/{requirementDiagram-PLB6GJNP-DrRQ5r97.js → requirementDiagram-PLB6GJNP-bMI5AK7T.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-DGS_lXcX.js → sankeyDiagram-IPEJSGJF-BKcFE2WQ.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-CkjWqwtf.js → sequenceDiagram-PO4LG4MO-Bn9q88kl.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-CepRgful.js → sizeCapture-INFHLROL-Cvmdq9HD.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-hykr-9RS.js → stateDiagram-v2-GCMORJYK-JJQYw3eQ.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-CKOHEZbI.js → swimlanes-2SLR337P-BkSCBEwp.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-CmTirbVT.js +8 -0
- package/dist/assets/table-file.worker-KkMx-SNx.js +10 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-CB8pJ6AC.js → timeline-definition-EJHVYXUP-DsaM4GHr.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-DrclJHdl.js → usecaseDiagram-POWQR4AR-3FOwLq7B.js} +1 -1
- package/dist/assets/user-DcZBnAuv.js +1 -0
- package/dist/assets/{vennDiagram-UO4OBE2U-zS23qjv8.js → vennDiagram-UO4OBE2U-DyNjJsKt.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-52jgeKxz.js → wardleyDiagram-VNRHLVJA-Y4ZMcnBC.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-DSdl9rQ8.js → xychartDiagram-PMCCYNJV-BXZpg955.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-server/cloud-home-start.js +19 -8
- package/dist-server/container-mcp.js +8 -0
- package/dist-server/desktop-entry.mjs +54 -0
- package/dist-server/drivers/agents-proxy.js +21 -4
- package/dist-server/index.js +1412 -821
- package/dist-server/openmausbot.js +837 -571
- package/dist-server/pair-cli.js +837 -571
- package/dist-server/permission-proxy.js +2 -0
- package/dist-server/server/atomic.js +70 -2
- package/dist-server/server/cloud-home-start.js +3 -3
- package/dist-server/server/config.js +22 -1
- package/dist-server/server/connector-card-text.js +15 -0
- package/dist-server/server/default-model-selection.js +7 -4
- package/dist-server/server/drivers/acp/core.js +10 -0
- package/dist-server/server/drivers/acp/grok.js +47 -5
- package/dist-server/server/drivers/agents-catalog.js +24 -4
- package/dist-server/server/drivers/agents-proxy.js +1 -0
- package/dist-server/server/drivers/chat-mcp-tools.js +5 -3
- package/dist-server/server/drivers/claude-login-auth.js +1 -1
- package/dist-server/server/drivers/claude.js +35 -11
- package/dist-server/server/drivers/codex-device-auth.js +27 -319
- package/dist-server/server/drivers/device-auth.js +342 -0
- package/dist-server/server/drivers/openai-chat.js +12 -4
- package/dist-server/server/fleet-agent.js +18 -5
- package/dist-server/server/harness/http.js +5 -2
- package/dist-server/server/harness/registry.js +19 -0
- package/dist-server/server/harness-capabilities.js +7 -4
- package/dist-server/server/hosted-models.js +3 -1
- package/dist-server/server/index.js +268 -54
- package/dist-server/server/key-rejections.js +57 -0
- package/dist-server/server/message-file.js +7 -4
- package/dist-server/server/permission-proxy.js +4 -0
- package/dist-server/server/provider-key-check.js +5 -1
- package/dist-server/server/request-auth.js +1 -1
- package/dist-server/server/room-turn-timeout.js +28 -0
- package/dist-server/server/routes/thread-models.js +36 -0
- package/dist-server/server/routines.js +2 -2
- package/dist-server/server/skills.js +3 -2
- package/dist-server/server/store.js +148 -60
- package/dist-server/server/team-backup.js +19 -4
- package/dist-server/server/thread-model.js +25 -0
- package/dist-server/server/turn-continuation.js +8 -2
- package/dist-server/server/webhook-ingress.js +8 -3
- package/dist-server/server/webhooks.js +40 -5
- package/dist-server/shared/device-sign-in.js +57 -0
- package/dist-server/shared/team-backup.js +2 -0
- package/dist-server/shared/thread-model.js +13 -0
- package/dist-server/vps-container-mcp.js +8 -0
- package/dist-server/workspace-backup.worker.js +41 -22
- package/package.json +1 -1
- package/dist/assets/DesktopViewer-CPidMCtt.js +0 -5
- package/dist/assets/architectureDiagram-NJMV4G6O-DiPor3UT.js +0 -36
- package/dist/assets/channel-DR8eD6QW.js +0 -1
- package/dist/assets/cose-bilkent-JH36ORCC-BBmR1bbX.js +0 -1
- package/dist/assets/ganttDiagram-FUAMR5RP-gtYBTu0B.js +0 -292
- package/dist/assets/index-CpaIXRLp.js +0 -614
- package/dist/assets/index-Z81SMsgR.css +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-D-8vqZ4-.js +0 -8
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{k as ze,t as p,u as ye,r as a,g as X,j as e,M as be,aC as qe,c as Z,aD as Oe,aE as Pe,y as He,T as $e,m as Le,B as Ke,aF as Ye,P as Ne,aG as Je,aH as _e,aI as We,ac as Te,X as Ce,d as we,o as Xe,R as Fe,aJ as Ie,E as Ge,aK as Ee,aL as Ve,aM as Qe,aN as Ze,a4 as et}from"./index-C3NqfdVU.js";import{B as Ue}from"./brain-CFZ7PEXc.js";const tt=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],nt=ze("message-circle",tt);const st=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],at=ze("save",st),rt={collaborations:[],queued:[],running:[]};function it(s,u=[]){const m=new Map;for(const x of s){if(x.hidden)continue;const d=x.section?.trim()||"";m.set(d,[...m.get(d)??[],x])}for(const x of u){const d=x.trim();d&&!m.has(d)&&m.set(d,[])}return[...m].map(([x,d])=>({key:x,name:x||"General",chiefs:d.filter(c=>c.chiefOfStaff),members:d.filter(c=>!c.chiefOfStaff)}))}function ot(s,u){const m=new Set(s.filter(c=>!c.hidden).map(c=>c.id)),x=new Map,d=(c,k)=>[c,k].sort().join(":");for(const c of u.collaborations){const[k,N]=c.botIds;!m.has(k)||!m.has(N)||x.set(d(k,N),{sourceBotId:k,targetBotId:N,state:"connected",groupId:c.groupId,lastAt:c.lastAt})}for(const c of u.queued)!m.has(c.sourceBotId)||!m.has(c.targetBotId)||x.set(d(c.sourceBotId,c.targetBotId),{sourceBotId:c.sourceBotId,targetBotId:c.targetBotId,state:"queued",reason:c.reason});for(const c of u.running)!m.has(c.sourceBotId)||!m.has(c.targetBotId)||x.set(d(c.sourceBotId,c.targetBotId),{sourceBotId:c.sourceBotId,targetBotId:c.targetBotId,state:"running",groupId:c.groupId});return[...x.values()].sort((c,k)=>{const N={running:0,queued:1,connected:2};return N[c.state]-N[k.state]||(k.lastAt??0)-(c.lastAt??0)})}function lt(s){return s.activity==="waiting-on-you"?{label:"Waiting for you",tone:"warning"}:s.activity==="dead"||s.activity==="no-signal"?{label:"No signal",tone:"danger"}:s.busy||s.activity==="working"?{label:"Working",tone:"success"}:{label:"Ready",tone:"idle"}}function ct(s){return s===1?p("canvas.botCountOne"):p("canvas.botCount",{count:s})}const dt=236,ut=126,Ae=16,Me=20,mt=64,Se="application/x-omb-computer";function fe(s,u=[]){const m=new Map(u.map((x,d)=>[x,d]));return[...s].sort((x,d)=>(m.get(x.id)??1/0)-(m.get(d.id)??1/0))}function xt(s,u,m){const x=s.map(c=>c.id);if(!x.includes(u))return x;const d=x.filter(c=>c!==u);return d.splice(Math.max(0,Math.min(d.length,m)),0,u),d}function pt(s){try{const u=JSON.parse(s??"null");return u===null||typeof u!="object"||Array.isArray(u)?{}:Object.fromEntries(Object.entries(u).flatMap(([m,x])=>Array.isArray(x)?[[m,[...new Set(x.filter(d=>typeof d=="string"&&d.length>0))]]]:[]))}catch{return{}}}function ft(s){const u=s.chiefs.length>0&&s.members.length>0,m=u?Math.max(s.chiefs.length,s.members.length):Math.max(1,s.chiefs.length+s.members.length);return{width:dt*(u?2:1)+Me*2+(u?40:0),height:mt+Me+m*(ut+Ae)-Ae}}function ht(s,u){const m=s.map(ft),x=Math.max(0,...m.filter((c,k)=>k%2===0).map(c=>c.width));let d=40;return s.map((c,k)=>{k>0&&k%2===0&&(d+=Math.max(m[k-2].height,m[k-1].height)+56);const N=Object.hasOwn(u,c.key)?u[c.key]:void 0;return{key:c.key,x:N?.x??(k%2===0?40:40+x+56),y:N?.y??d,...m[k]}})}function gt(s,u,m){if(!s.length)return{x:0,y:0,scale:1};const x=Math.min(...s.map(b=>b.x)),d=Math.min(...s.map(b=>b.y)),c=Math.max(...s.map(b=>b.x+b.width))-x,k=Math.max(...s.map(b=>b.y+b.height))-d,N=Math.max(.3,Math.min(1,(u-80)/c,(m-80)/k));return{x:(u-c*N)/2-x*N,y:(m-k*N)/2-d*N,scale:N}}function Re(s,u,m){const x=u/s.scale;return{x:m.x-(m.x-s.x)*x,y:m.y-(m.y-s.y)*x,scale:u}}function bt(s){try{const u=JSON.parse(s??"null");return u===null||typeof u!="object"||Array.isArray(u)?{}:Object.fromEntries(Object.entries(u).flatMap(([m,x])=>{if(x===null||typeof x!="object"||Array.isArray(x))return[];const{x:d,y:c}=x;return typeof d=="number"&&Number.isFinite(d)&&Math.abs(d)<1e5&&typeof c=="number"&&Number.isFinite(c)&&Math.abs(c)<1e5?[[m,{x:d,y:c}]]:[]}))}catch{return{}}}const ge="flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",he="flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-left text-[12px] text-ink-secondary hover:bg-control hover:text-ink";function yt({bot:s,selected:u,moving:m,connected:x,onComputer:d,onArrange:c}){const{state:k,dispatch:N}=ye(),b=lt(s),K=k.instances.find(I=>I.instanceId===s.modelSelection.instanceId),H=K?.models.options.find(I=>I.id===s.modelSelection.model)?.label??s.modelSelection.model;return e.jsxs("article",{className:Z("relative h-[126px] w-[236px] shrink-0 rounded-xl border bg-card shadow-sm transition-colors",u?"border-accent/60 ring-1 ring-accent/15":x?"border-accent/40":"border-hairline/50 hover:border-ink-secondary/40",m&&"opacity-35"),children:[e.jsxs("button",{"data-bot-id":s.id,"aria-label":p("canvas.editBot",{name:s.name}),onClick:()=>N({type:"toggleSettings",botId:s.id,section:"identity",open:!0}),title:c?p("canvas.reorderHint"):void 0,onKeyDown:I=>{!c||!I.altKey||I.key!=="ArrowUp"&&I.key!=="ArrowDown"||(I.preventDefault(),I.stopPropagation(),c(s,I.key==="ArrowUp"?-1:1))},className:"flex h-[82px] w-full cursor-grab items-center gap-3 rounded-t-xl px-4 text-left active:cursor-grabbing focus-visible:outline-2 focus-visible:outline-accent",children:[e.jsx(Ke,{bot:s,size:38,motion:"none",motionKey:0,animated:!1}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-[14px] font-semibold",children:s.name}),s.chiefOfStaff&&e.jsx(Je,{size:12,className:"shrink-0 text-warning","aria-label":p("chat.chiefOfStaff")})]}),e.jsx("span",{className:"mt-1 block truncate text-[11px] text-ink-secondary",children:s.title||(s.chiefOfStaff?p("chat.chiefOfStaff"):p("canvas.bot"))})]})]}),e.jsxs("div",{className:"flex h-[43px] items-center gap-1 border-t border-hairline/30 px-2",children:[e.jsx("button",{className:Z(ge,"size-8"),"aria-label":p("canvas.openBotChat",{name:s.name}),title:p("canvas.openChat"),onClick:()=>N({type:"select",id:s.id}),children:e.jsx(nt,{size:13})}),b.tone!=="idle"&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-ink-secondary",title:b.label,children:[e.jsx("span",{className:Z("size-1.5 rounded-full",b.tone==="success"?"bg-success":b.tone==="warning"?"bg-warning":b.tone==="danger"?"bg-danger":"bg-ink-secondary/35")}),b.label]}),u&&d&&e.jsx("button",{className:Z(ge,"size-8"),"aria-label":p("canvas.botComputer",{name:s.name}),title:p("computer.tab.computer"),onClick:()=>d(s),children:e.jsx(be,{size:13})}),e.jsxs("button",{"aria-label":p("canvas.changeModel",{name:s.name}),title:`${p("canvas.defaultModel")}: ${H}`,onClick:()=>N({type:"toggleSettings",botId:s.id,section:"model",open:!0}),className:"ml-auto flex h-8 min-w-0 max-w-[130px] items-center gap-1.5 rounded-md px-2 text-[10px] text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",children:[e.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:K?e.jsx(_e,{instance:K,size:13}):e.jsx(We,{driverKind:"",size:13})}),e.jsx("span",{className:"truncate",children:H||p("canvas.defaultModel")})]})]})]})}function kt({sections:s,canManage:u,onMove:m,onInstructions:x,onMemory:d,onEditTeam:c,onDeleteTeam:k,onComputer:N,onComputerDrop:b,onTeamComputer:K,teamComputers:H={},connectedBotIds:I=[]}){const{state:U}=ye(),A=a.useRef(null),C=a.useRef(null),$=a.useRef(!1),E=a.useRef(!1),q=a.useRef(null),[R,Y]=a.useState({}),[_,F]=a.useState({}),[S,B]=a.useState({x:40,y:40,scale:1}),[l,D]=a.useState(null),[f,w]=a.useState(null),[j,z]=a.useState(null),[L,G]=a.useState(null),[ee,le]=a.useState(null),[de,ae]=a.useState(""),[o,T]=a.useState(!1),[O,W]=a.useState(null),te=a.useMemo(()=>ht(s,R),[s,R]),ne=a.useRef({view:S,positions:R,tiles:te,selectedId:U.selectedId,settingsOpen:U.settingsOpen});ne.current={view:S,positions:R,tiles:te,selectedId:U.selectedId,settingsOpen:U.settingsOpen},a.useEffect(()=>{let t=!0;return X("/.well-known/openmausbot/environment",{signal:AbortSignal.timeout(5e3)}).then(i=>{if(!(!t||typeof i.environmentId!="string")){q.current=`omb-team-canvas:${i.environmentId}`;try{const n=bt(localStorage.getItem(q.current));Y(h=>({...n,...h})),F(pt(localStorage.getItem(`${q.current}:bot-order`)))}catch{}}}).catch(()=>{}).finally(()=>{t&&T(!0)}),()=>{t=!1}},[]);const pe=t=>{if(Y(t),!!q.current)try{localStorage.setItem(q.current,JSON.stringify(Object.fromEntries(s.filter(i=>Object.hasOwn(t,i.key)).map(i=>[i.key,t[i.key]]))))}catch{}},Q=t=>Object.hasOwn(_,t)?_[t]:[],ue=(t,i,n,h)=>{const g={..._,[t.key]:[...xt(i,n.id,h),...fe(n.chiefOfStaff?t.members:t.chiefs,Q(t.key)).map(M=>M.id)]};if(F(g),q.current)try{localStorage.setItem(`${q.current}:bot-order`,JSON.stringify(g))}catch{}ae(p("canvas.arrangedBot",{name:n.name,team:t.name}))},ke=(t,i)=>{const n=s.find(g=>g.key===(t.section?.trim()??""));if(!n)return;const h=fe(t.chiefOfStaff?n.chiefs:n.members,Q(n.key));ue(n,h,t,h.findIndex(g=>g.id===t.id)+i)},ce=a.useCallback(()=>{const t=A.current?.getBoundingClientRect();t&&B(gt(ne.current.tiles,t.width,t.height))},[]);a.useEffect(()=>{const t=A.current;if(!t)return;let i=null;const n=new ResizeObserver(()=>{const h=t.getBoundingClientRect();if(!i)ce();else{const g=ne.current.settingsOpen?[...t.querySelectorAll("[data-bot-id]")].find(v=>v.dataset.botId===ne.current.selectedId)?.getBoundingClientRect():void 0,M=g?h.width/2-(g.left-h.left+g.width/2):(h.width-i.width)/2,V=g?h.height/2-(g.top-h.top+g.height/2):(h.height-i.height)/2;B(v=>({...v,x:v.x+M,y:v.y+V}))}i={width:h.width,height:h.height}});return n.observe(t),()=>n.disconnect()},[ce]);const ve=JSON.stringify(te.map(({key:t,width:i,height:n})=>[t,i,n]));a.useEffect(()=>{ce()},[ce,ve,o]),a.useEffect(()=>{const t=A.current?.querySelector("details[open]"),i=A.current?.getBoundingClientRect();t&&i&&W(t.getBoundingClientRect().bottom>i.bottom-210*S.scale?t.closest("[data-team-key]")?.dataset.teamKey??null:null)},[S,ve]),a.useEffect(()=>{const t=A.current;if(!t)return;const i=n=>{if(n.target.closest("details[open]")||(n.preventDefault(),C.current))return;const h=ne.current.view,g=t.getBoundingClientRect();if(n.ctrlKey||n.metaKey){const M=Math.min(1.5,Math.max(.3,h.scale*Math.exp(-n.deltaY*.006)));B(Re(h,M,{x:n.clientX-g.left,y:n.clientY-g.top}))}else{const M=n.deltaMode===1?16:n.deltaMode===2?g.height:1;B({...h,x:h.x-n.deltaX*M,y:h.y-n.deltaY*M})}};return t.addEventListener("wheel",i,{passive:!1}),()=>t.removeEventListener("wheel",i)},[]);const re=t=>{if(t.button!==0||!t.isPrimary||C.current)return;const i=t.target,n=i.closest("[data-bot-id]")?.dataset.botId,h=i.closest("[data-arrange-team]")?.dataset.arrangeTeam,g=n?s.flatMap(v=>[...v.chiefs,...v.members]).find(v=>v.id===n):void 0;if(!g&&h===void 0&&i.closest("button, details, a, input, [data-team-key]")||g&&(ee||!o)||h!==void 0&&!o)return;const M={id:t.pointerId,start:{x:t.clientX,y:t.clientY},view:S,positions:R,moved:!1},V=h===void 0?void 0:te.find(v=>v.key===h);C.current=g?{...M,kind:"bot",bot:g}:V?{...M,kind:"team",key:V.key,origin:V}:{...M,kind:"pan"},$.current=!1},ie=(t,i)=>{const n=document.elementFromPoint(t,i)?.closest("[data-team-key]");return n&&A.current?.contains(n)?n.dataset.teamKey??null:null},je=(t,i)=>{const n=s.find(v=>v.key===(t.section?.trim()??""));if(!n)return null;const h=fe(t.chiefOfStaff?n.chiefs:n.members,Q(n.key)),g=h.filter(v=>v.id!==t.id),M=[...A.current?.querySelectorAll("[data-bot-id]")??[]],V=g.findIndex(v=>{const J=M.find(xe=>xe.dataset.botId===v.id)?.closest("article")?.getBoundingClientRect();return J?i<J.top+J.height/2:!1});return{section:n,lane:h,remaining:g,index:V<0?g.length:V}},me=t=>{const i=C.current;if(!i||i.id!==t.pointerId)return;if(t.buttons===0){oe(t,!0);return}const n=t.clientX-i.start.x,h=t.clientY-i.start.y;if(!(!i.moved&&Math.hypot(n,h)<5)&&(i.moved=!0,t.currentTarget.setPointerCapture(t.pointerId),i.kind==="pan"&&B({...i.view,x:i.view.x+n,y:i.view.y+h}),i.kind==="team"&&Y({...i.positions,[i.key]:{x:i.origin.x+n/S.scale,y:i.origin.y+h/S.scale}}),i.kind==="bot")){const g=t.currentTarget.getBoundingClientRect();D({bot:i.bot,point:{x:t.clientX-g.left,y:t.clientY-g.top}});const M=ie(t.clientX,t.clientY),V=M===(i.bot.section?.trim()??"");w(V||u?M:null);const v=V?je(i.bot,t.clientY):null,J=v?.remaining[v.index]??v?.remaining.at(-1);G(v&&J?{botId:J.id,after:v.index===v.remaining.length}:null)}},oe=(t,i=!1)=>{const n=C.current;if(!(!n||t&&n.id!==t.pointerId)){if(C.current=null,$.current=n.moved,window.setTimeout(()=>{$.current=!1},0),D(null),w(null),G(null),A.current?.hasPointerCapture(n.id)&&A.current.releasePointerCapture(n.id),i){Y(n.positions),B(n.view);return}if(n.moved&&(n.kind==="team"&&t&&pe({...n.positions,[n.key]:{x:n.origin.x+(t.clientX-n.start.x)/n.view.scale,y:n.origin.y+(t.clientY-n.start.y)/n.view.scale}}),n.kind==="bot"&&t)){const h=ie(t.clientX,t.clientY);if(h===null)return;if(h===(n.bot.section?.trim()??"")){const g=je(n.bot,t.clientY);g&&ue(g.section,g.lane,n.bot,g.index);return}if(!u)return;le(n.bot.id),ae(p("canvas.reviewMove",{name:n.bot.name,team:h||p("settings.section.general")})),m(n.bot,h).then(g=>{ae(g===!1?p("canvas.moveCancelled"):p("canvas.moved",{name:n.bot.name,team:h||p("settings.section.general")}))}).catch(g=>{ae(g instanceof Error?g.message:String(g))}).finally(()=>le(null))}}},r=t=>{const i=A.current?.getBoundingClientRect();i&&B(Re(S,Math.max(.3,Math.min(1.5,S.scale*t)),{x:i.width/2,y:i.height/2}))},y=s.find(t=>t.key===f),P=j!==null?p("canvas.assignComputer",{team:s.find(t=>t.key===j)?.name??j}):l&&y?(l.bot.section?.trim()??"")===y.key?p("canvas.arrangeBot",{name:l.bot.name,team:y.name}):p("canvas.moveBot",{name:l.bot.name,team:y.name}):null;return e.jsxs("div",{ref:A,role:"region","aria-label":p("canvas.region"),tabIndex:0,"data-team-canvas":!0,className:"relative min-h-0 flex-1 touch-none overflow-clip outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40",style:{backgroundImage:"radial-gradient(circle, color-mix(in srgb, var(--color-ink-secondary) 18%, transparent) 1px, transparent 1px)",backgroundSize:`${24*S.scale}px ${24*S.scale}px`,backgroundPosition:`${S.x}px ${S.y}px`},onPointerDown:re,onPointerMove:me,onPointerUp:t=>oe(t),onPointerCancel:t=>oe(t,!0),onDragOver:t=>{if(!u||!b||!t.dataTransfer.types.includes(Se))return;const i=t.target.closest("[data-team-key]"),n=i&&t.currentTarget.contains(i)?i.dataset.teamKey??null:null;z(n),n!==null&&(t.preventDefault(),t.dataTransfer.dropEffect="link")},onDragLeave:t=>{(!(t.relatedTarget instanceof Node)||!t.currentTarget.contains(t.relatedTarget))&&z(null)},onDrop:t=>{if(z(null),!u||!b||!t.dataTransfer.types.includes(Se))return;const i=t.target.closest("[data-team-key]"),n=i&&t.currentTarget.contains(i)?i.dataset.teamKey:void 0,h=t.dataTransfer.getData(Se);n===void 0||!s.some(g=>g.key===n)||!h||(t.preventDefault(),b(h,n))},onDragEnd:()=>z(null),onPointerDownCapture:t=>{E.current=!1,t.target.closest("details")||t.currentTarget.querySelectorAll("details[open]").forEach(i=>i.removeAttribute("open"))},onKeyDownCapture:t=>{t.key==="Tab"&&(E.current=!0)},onPointerLeave:()=>{C.current&&!C.current.moved&&oe(void 0,!0)},onLostPointerCapture:()=>{C.current&&oe(void 0,!0)},onFocusCapture:t=>{if(!E.current||!(t.target instanceof HTMLElement)||!t.target.closest("[data-canvas-world]"))return;const i=t.currentTarget.getBoundingClientRect(),n=t.target.getBoundingClientRect(),h=n.left<i.left+16?i.left+16-n.left:n.right>i.right-16?i.right-16-n.right:0,g=n.top<i.top+16?i.top+16-n.top:n.bottom>i.bottom-70?i.bottom-70-n.bottom:0;(h||g)&&B(M=>({...M,x:M.x+h,y:M.y+g}))},onClickCapture:t=>{$.current&&($.current=!1,t.preventDefault(),t.stopPropagation())},onKeyDown:t=>{if(t.key==="Escape"&&(oe(void 0,!0),t.currentTarget.querySelectorAll("details[open]").forEach(h=>{h.querySelector("summary")?.focus({preventScroll:!0}),h.removeAttribute("open")})),t.target!==t.currentTarget)return;const n={ArrowLeft:{x:60,y:0},ArrowRight:{x:-60,y:0},ArrowUp:{x:0,y:60},ArrowDown:{x:0,y:-60}}[t.key];n&&(t.preventDefault(),B({...S,x:S.x+n.x,y:S.y+n.y})),(t.key==="+"||t.key==="=")&&(t.preventDefault(),r(1.2)),t.key==="-"&&(t.preventDefault(),r(1/1.2)),t.key==="0"&&(t.preventDefault(),ce())},children:[e.jsx("div",{"data-canvas-world":!0,className:"absolute left-0 top-0 origin-top-left",style:{transform:`translate(${S.x}px, ${S.y}px) scale(${S.scale})`},children:s.map((t,i)=>{const n=te[i],h=t.chiefs.length>0&&t.members.length>0,g=j===t.key||l&&f===t.key&&(l.bot.section?.trim()??"")!==t.key,M=Object.hasOwn(H,t.key)?H[t.key]:void 0,V=v=>e.jsxs("div",{className:"relative",children:[L?.botId===v.id&&e.jsx("div",{className:Z("pointer-events-none absolute inset-x-1 h-0.5 rounded bg-accent",L.after?"-bottom-[9px]":"-top-[9px]")}),e.jsx(yt,{bot:v,selected:U.selectedId===v.id&&U.settingsOpen,moving:l?.bot.id===v.id||ee===v.id,connected:I.includes(v.id),onComputer:N,onArrange:o?ke:void 0})]},v.id);return e.jsxs("section",{"data-team-key":t.key,"aria-label":p("canvas.teamRegion",{name:t.name}),className:Z("absolute rounded-2xl border bg-panel/90 shadow-sm has-[details[open]]:z-20 data-[computer-dropping=true]:border-accent data-[computer-dropping=true]:ring-2 data-[computer-dropping=true]:ring-accent/25",g?"border-accent ring-2 ring-accent/25":"border-hairline/50"),style:{left:n.x,top:n.y,width:n.width,height:n.height},children:[e.jsxs("header",{className:"flex h-16 items-center gap-2 px-5",children:[e.jsx("button",{"data-arrange-team":t.key,disabled:!o,"aria-label":p("canvas.arrange",{name:t.name}),title:p("canvas.arrangeHint"),className:"min-w-0 flex-1 cursor-grab rounded-md py-2 text-left active:cursor-grabbing focus-visible:outline-2 focus-visible:outline-accent",onKeyDown:v=>{const J={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[v.key];if(!J)return;v.preventDefault(),v.stopPropagation();const xe=v.shiftKey?40:10;pe({...R,[t.key]:{x:n.x+J[0]*xe,y:n.y+J[1]*xe}})},children:e.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t.name})}),M&&e.jsxs("button",{"aria-label":p("canvas.teamComputer",{team:t.name,name:M.name}),title:`${M.name}${M.state?` · ${M.state}`:""}`,disabled:!K,onClick:()=>K?.(t.key),className:"flex min-w-0 max-w-[120px] shrink items-center gap-1.5 rounded-md px-1.5 py-2 text-[10px] text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent disabled:pointer-events-none",children:[e.jsx(be,{size:12,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:M.name})]}),e.jsx("span",{className:"text-[11px] tabular-nums text-ink-secondary",children:t.chiefs.length+t.members.length}),u&&e.jsxs("details",{className:"relative",onToggle:v=>{if(v.currentTarget.open){const J=A.current?.getBoundingClientRect();W(J&&v.currentTarget.getBoundingClientRect().bottom>J.bottom-210*S.scale?t.key:null),A.current?.querySelectorAll("details[open]").forEach(xe=>{xe!==v.currentTarget&&xe.removeAttribute("open")})}},children:[e.jsx("summary",{"aria-label":p("canvas.manageTeam",{name:t.name}),className:Z(ge,"cursor-pointer list-none [&::-webkit-details-marker]:hidden"),children:e.jsx(qe,{size:17})}),e.jsxs("div",{className:Z("absolute right-0 z-30 w-[220px] animate-pop-in rounded-xl border border-hairline bg-panel p-1.5 shadow-xl",O===t.key?"bottom-10":"top-10"),onClick:v=>{const J=v.currentTarget.closest("details");J?.querySelector("summary")?.focus(),J?.removeAttribute("open")},children:[e.jsxs("button",{className:he,onClick:()=>c(t.key),"aria-label":p("team.moveTo",{name:t.name}),children:[e.jsx(Oe,{size:14}),p("team.moveTo",{name:t.name})]}),e.jsxs("button",{className:he,onClick:()=>x(t.key,t.name),"aria-label":p("team.instructionsEdit",{name:t.name}),children:[e.jsx(Pe,{size:14}),p("team.instructions")]}),d&&e.jsxs("button",{className:he,onClick:()=>d(t.key,t.name),"aria-label":`${t.name} team memory`,children:[e.jsx(Ue,{size:14}),"Team memory"]}),t.key&&e.jsxs("button",{className:he,onClick:()=>c(t.key,!0),"aria-label":p("team.renameAria",{name:t.name}),children:[e.jsx(He,{size:14}),p("team.rename")]}),t.key&&e.jsxs("button",{className:Z(he,"hover:text-danger"),onClick:()=>k(t.key),"aria-label":p("team.deleteAria",{name:t.name}),children:[e.jsx($e,{size:14}),p("team.delete")]})]})]})]}),g&&e.jsx("div",{className:"pointer-events-none absolute -top-7 left-2 z-30 max-w-[calc(100%-16px)] truncate rounded-md bg-accent px-2 py-1 text-[10px] text-white shadow-sm",children:P}),e.jsxs("div",{className:"flex items-center px-5 pb-5",children:[t.chiefs.length>0&&e.jsx("div",{className:"flex flex-col gap-4",children:fe(t.chiefs,Q(t.key)).map(V)}),h&&e.jsx("div",{className:"flex w-10 shrink-0 justify-center text-ink-secondary/35","aria-hidden":"true",children:e.jsx(Le,{size:22,strokeWidth:1})}),t.members.length>0&&e.jsx("div",{className:"flex flex-col gap-4",children:fe(t.members,Q(t.key)).map(V)}),t.chiefs.length+t.members.length===0&&e.jsx("p",{className:"flex h-[126px] w-[236px] items-center justify-center rounded-xl border border-dashed border-hairline/70 px-6 text-center text-[12px] leading-relaxed text-ink-secondary",children:p("canvas.dropHere")})]})]},t.key)})}),l&&e.jsxs("div",{className:"pointer-events-none absolute z-40 rounded-xl border border-accent/40 bg-card px-4 py-3 text-[13px] shadow-lg",style:{left:l.point.x+16,top:l.point.y+16},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Ke,{bot:l.bot,size:24,animated:!1}),l.bot.name]}),P&&e.jsx("p",{className:"mt-1 text-[10px] text-ink-secondary",children:P})]}),e.jsxs("div",{className:"pointer-events-none absolute inset-x-5 bottom-5 flex items-end justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 rounded-lg bg-app/90 px-2 py-1.5 text-[11px] text-ink-secondary",children:[e.jsx("p",{className:"max-sm:hidden",children:p("canvas.hint")}),e.jsx("p",{role:"status","aria-live":"polite",className:"max-w-[440px]",children:P??de})]}),e.jsxs("div",{className:"pointer-events-auto flex shrink-0 items-center gap-0.5 rounded-xl border border-hairline/60 bg-panel p-1 shadow-sm",children:[e.jsx("button",{className:ge,"aria-label":p("canvas.zoomOut"),onClick:()=>r(1/1.2),children:e.jsx(Ye,{size:15})}),e.jsxs("button",{className:"min-w-12 rounded-md px-1 py-2 text-[11px] tabular-nums text-ink-secondary hover:bg-control","aria-label":p("canvas.fit"),title:p("canvas.fitHint"),onClick:ce,children:[Math.round(S.scale*100),"%"]}),e.jsx("button",{className:ge,"aria-label":p("canvas.zoomIn"),onClick:()=>r(1.2),children:e.jsx(Ne,{size:15})})]})]})]})}const De=[{kind:"person",title:"People",hint:"Who someone is and the names they go by"},{kind:"place",title:"Places",hint:"Where a document or a thing lives"},{kind:"decision",title:"Decisions",hint:"What was decided, and where"},{kind:"term",title:"Terms",hint:"What an abbreviation or a nickname means"}];function vt({section:s,label:u,onClose:m}){const x=a.useRef(null),[d,c]=a.useState(null),[k,N]=a.useState(null),[b,K]=a.useState(null),H=a.useRef(!1),I=a.useRef(0),[U,A]=a.useState(!1),[C,$]=a.useState({kind:"term",name:"",detail:""}),E=`section=${encodeURIComponent(s)}`,q=a.useCallback(async()=>{const l=++I.current;try{const D=await X(`/api/team-memory?${E}`);if(I.current!==l)return;c(D.entries),N(null)}catch(D){if(I.current!==l)return;N(D instanceof Error?D.message:String(D))}},[E]);a.useEffect(()=>(c(null),N(null),q(),()=>{I.current+=1}),[q]),a.useEffect(()=>{const l=document.activeElement instanceof HTMLElement?document.activeElement:null;x.current?.focus();const D=f=>{if(f.key==="Escape"&&(f.preventDefault(),m()),f.key==="Tab"){const w=x.current?.querySelectorAll("button:enabled, input:enabled, select:enabled");if(!w?.length)return;const j=w[0],z=w[w.length-1];f.shiftKey&&document.activeElement===j?(f.preventDefault(),z.focus()):!f.shiftKey&&document.activeElement===z&&(f.preventDefault(),j.focus())}};return window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D),l?.focus()}},[m]);const R=async(l,D)=>{if(H.current)return!1;H.current=!0;const f=++I.current;K(l??"new"),N(null);try{const w=await D();return I.current!==f?!1:(c(w.entries),!0)}catch(w){return I.current===f&&N(w instanceof Error?w.message:String(w)),!1}finally{H.current=!1,I.current===f&&K(null)}},Y=l=>R(l.id,()=>X(`/api/team-memory/${l.id}?${E}`,{method:"PATCH",body:JSON.stringify({accept:!0})})),_=l=>R(l.id,()=>X(`/api/team-memory/${l.id}?${E}`,{method:"DELETE"})),F=(l,D)=>{D.trim()!==l.detail&&R(l.id,()=>X(`/api/team-memory/${l.id}?${E}`,{method:"PATCH",body:JSON.stringify({detail:D})}))},S=()=>{!C.name.trim()||!C.detail.trim()||R(null,()=>X(`/api/team-memory?${E}`,{method:"POST",body:JSON.stringify(C)})).then(l=>{l&&($({kind:C.kind,name:"",detail:""}),A(!1))})},B=(d??[]).filter(l=>l.status==="proposed");return Te.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 backdrop-blur-[2px] sm:p-6",onMouseDown:l=>l.target===l.currentTarget&&m(),children:e.jsxs("div",{ref:x,role:"dialog","aria-modal":"true","aria-labelledby":"team-memory-title",tabIndex:-1,className:"animate-pop-in flex max-h-[min(720px,calc(100dvh-2rem))] w-full max-w-[720px] flex-col overflow-hidden rounded-[24px] border border-hairline/50 bg-panel shadow-2xl shadow-black/50 outline-none",children:[e.jsxs("header",{className:"flex items-start justify-between gap-4 border-b border-hairline/40 px-6 pb-4 pt-6 sm:px-8 sm:pt-7",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ue,{size:19,className:"text-accent"}),e.jsxs("h2",{id:"team-memory-title",className:"text-[20px] font-semibold tracking-[-0.01em] text-ink",children:[u," team memory"]})]}),e.jsx("p",{className:"mt-1.5 max-w-[560px] text-[12.5px] leading-relaxed text-ink-secondary",children:"People, places, decisions and terms every bot in this section shares. Every bot proposal waits for an admin's review before it is shared. Your own additions are shared immediately. Edit or remove anything."})]}),e.jsx("button",{onClick:m,"aria-label":"Close team memory",className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(Ce,{size:19})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-5 sm:px-8",children:[d===null&&!k&&e.jsx("div",{className:"flex min-h-[200px] items-center justify-center text-ink-secondary",children:e.jsx(we,{size:20,className:"animate-spin","aria-label":"Loading team memory"})}),k&&e.jsx("div",{className:"mb-3 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:k}),B.length>0&&e.jsxs("section",{className:"mb-5 rounded-xl border border-accent/30 bg-accent/5 p-3",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-accent",children:"Waiting for you"}),e.jsx("ul",{className:"mt-2 space-y-2",children:B.map(l=>e.jsxs("li",{className:"flex items-start gap-3 text-[13px]",children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"text-ink-secondary",children:[l.kind,": "]}),e.jsx("span",{className:"font-medium text-ink",children:l.name}),l.aliases.length>0&&e.jsxs("span",{className:"text-ink-secondary",children:[" (also ",l.aliases.join(", "),")"]}),e.jsxs("span",{className:"text-ink",children:[" — ",l.detail]}),e.jsxs("span",{className:"block text-[11px] text-ink-secondary",children:["from ",l.source.botName]})]}),e.jsxs("button",{onClick:()=>{Y(l)},disabled:b!==null,className:"flex shrink-0 items-center gap-1 rounded-md bg-accent px-2.5 py-1 text-[12px] font-medium text-white disabled:opacity-50",children:[e.jsx(Xe,{size:12})," Remember"]}),e.jsx("button",{onClick:()=>{_(l)},disabled:b!==null,className:"shrink-0 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:text-ink disabled:opacity-50",children:"Skip"})]},l.id))})]}),d!==null&&d.filter(l=>l.status==="accepted").length===0&&B.length===0&&e.jsx("div",{className:"rounded-xl bg-inset px-4 py-6 text-center text-[13px] text-ink-secondary",children:"Nothing shared yet. Review what bots propose as they learn who is who and where things live, or add one yourself below."}),De.map(({kind:l,title:D,hint:f})=>{const w=(d??[]).filter(j=>j.status==="accepted"&&j.kind===l);return w.length===0?null:e.jsxs("section",{className:"mb-5",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-ink-secondary",title:f,children:D}),e.jsx("ul",{className:"mt-2 divide-y divide-hairline/20 rounded-xl bg-inset",children:w.map(j=>e.jsxs("li",{className:"flex items-start gap-3 px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"font-medium text-ink",children:j.name}),j.aliases.length>0&&e.jsxs("span",{className:"text-ink-secondary",children:[" (also ",j.aliases.join(", "),")"]}),e.jsx("input",{defaultValue:j.detail,disabled:b!==null,onBlur:z=>F(j,z.target.value),onKeyDown:z=>{z.key==="Enter"&&z.target.blur()},"aria-label":`${j.name} detail`,className:"mt-0.5 block w-full rounded bg-transparent px-1 py-0.5 text-[12.5px] text-ink outline-none hover:bg-card focus:bg-card"},j.updatedAt),e.jsxs("span",{className:"block px-1 text-[11px] text-ink-secondary",children:[j.source.botName||"you"," · ",new Date(j.updatedAt).toLocaleDateString()]})]}),e.jsx("button",{onClick:()=>{_(j)},disabled:b!==null,"aria-label":`Remove ${j.name}`,className:"shrink-0 rounded-md p-1 text-ink-secondary hover:text-danger disabled:opacity-50",children:e.jsx($e,{size:13})})]},j.id))})]},l)}),U?e.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("select",{value:C.kind,onChange:l=>$({...C,kind:l.target.value}),"aria-label":"Kind",className:"rounded-lg border border-hairline/40 bg-inset px-2 py-1 text-[13px] text-ink",children:De.map(({kind:l,title:D})=>e.jsx("option",{value:l,children:D.replace(/s$/,"")},l))}),e.jsx("input",{value:C.name,onChange:l=>$({...C,name:l.target.value}),placeholder:"Name","aria-label":"Name",className:"min-w-[140px] flex-1 rounded-lg border border-hairline/40 bg-inset px-2 py-1 text-[13px] text-ink outline-none focus:border-accent"})]}),e.jsx("input",{value:C.detail,onChange:l=>$({...C,detail:l.target.value}),onKeyDown:l=>{l.key==="Enter"&&S()},placeholder:"What every bot should know about it","aria-label":"Detail",className:"mt-2 w-full rounded-lg border border-hairline/40 bg-inset px-2 py-1 text-[13px] text-ink outline-none focus:border-accent"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("button",{onClick:S,disabled:b!==null||!C.name.trim()||!C.detail.trim(),className:"rounded-lg bg-accent px-3 py-1 text-[12.5px] font-medium text-white disabled:opacity-50",children:b==="new"?"Adding…":"Add"}),e.jsx("button",{onClick:()=>A(!1),className:"text-[12.5px] text-ink-secondary hover:text-ink",children:"Cancel"})]})]}):e.jsxs("button",{onClick:()=>A(!0),className:Z("flex items-center gap-1.5 text-[12.5px] text-ink-secondary hover:text-ink",d===null&&"hidden"),children:[e.jsx(Ne,{size:13})," Add an entry"]})]})]})}),document.body)}const se="rounded-lg px-3 py-2 text-[12px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",Be="w-full rounded-lg border border-hairline/60 bg-inset px-3 py-2 text-[12px] text-ink outline-none focus:border-accent";function jt({open:s,createRequest:u,drop:m,sections:x,onClose:d,onDropHandled:c,onChange:k}){const{dispatch:N}=ye(),[b,K]=a.useState(null),[H,I]=a.useState(!1),[U,A]=a.useState(""),[C,$]=a.useState(""),[E,q]=a.useState(null),[R,Y]=a.useState(!1),[_,F]=a.useState(""),S=a.useRef(crypto.randomUUID()),B=a.useRef(null),l=a.useRef(null),D=a.useRef(null),f=a.useRef(!1),w=a.useRef(!0),j=a.useRef(null),z=a.useRef(k);z.current=k;const[L,G]=a.useState(null),[ee,le]=a.useState(null),[de,ae]=a.useState(null),o=a.useRef(crypto.randomUUID()),T=a.useRef(null),O=a.useRef(null),W=a.useRef(null),te=a.useRef(null),[ne,pe]=a.useState(null),Q=a.useCallback(()=>{const r=W.current;W.current=null,te.current?.removeAttribute("data-computer-dropping"),te.current=null,r?.handle.hasPointerCapture(r.id)&&r.handle.releasePointerCapture(r.id),pe(null)},[]);a.useEffect(()=>(s||Q(),()=>{te.current?.removeAttribute("data-computer-dropping")}),[s,Q]),a.useEffect(()=>{T.current=de},[de]),a.useEffect(()=>()=>{const r=T.current;r&&fetch(`/api/team-computers/${encodeURIComponent(r)}/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:o.current}),keepalive:!0}).catch(()=>{})},[]);const ue=a.useCallback((r,y)=>{if(!(f.current||r.section===y)){if(r.section!==null&&y!==null){A(`Unassign ${r.name} from ${r.section||"General"} before moving it to another team. Its files and signed-in accounts stay on the computer.`);return}A(""),G({computer:r,section:y})}},[]),ke=(r,y)=>{const P=O.current?.parentElement?.querySelector("[data-team-canvas]"),t=document.elementFromPoint(r,y)?.closest("[data-team-key]");return t&&P?.contains(t)&&x.some(i=>i.key===t.dataset.teamKey)?t:null},ce=r=>{const y=W.current;if(!y||r.pointerId!==y.id)return;if(r.buttons===0){Q();return}if(!y.moved&&Math.hypot(r.clientX-y.x,r.clientY-y.y)<5)return;y.moved=!0,r.currentTarget.setPointerCapture(r.pointerId);const P=ke(r.clientX,r.clientY);te.current!==P&&(te.current?.removeAttribute("data-computer-dropping"),P?.setAttribute("data-computer-dropping","true"),te.current=P);const t=P?x.find(i=>i.key===P.dataset.teamKey):null;pe({name:y.computer.name,x:r.clientX,y:r.clientY,hint:t?y.computer.section!==null&&y.computer.section!==t.key?"Unassign before moving to another team":`Assign to ${t.name}`:"Drop onto a team"})},ve=r=>{const y=W.current;if(!y||y.id!==r.pointerId)return;const P=y.moved?ke(r.clientX,r.clientY)?.dataset.teamKey:void 0;Q(),P!==void 0&&ue(y.computer,P)},re=a.useCallback(async()=>{j.current?.abort();const r=new AbortController;j.current=r,I(!0);try{const y=await X("/api/team-computers",{signal:AbortSignal.any([r.signal,AbortSignal.timeout(3e4)])});if(r.signal.aborted||!w.current)return;K(y),$(""),z.current(y.computers)}catch(y){!r.signal.aborted&&w.current&&$(y instanceof Error?y.message:String(y))}finally{!r.signal.aborted&&w.current&&I(!1)}},[]);a.useEffect(()=>(w.current=!0,re(),()=>{w.current=!1,j.current?.abort()}),[re]),a.useEffect(()=>{if(!s)return;re();const r=window.setInterval(()=>{!f.current&&document.visibilityState==="visible"&&re()},2e4);return()=>window.clearInterval(r)},[s,re]),a.useEffect(()=>{u>0&&Y(!0)},[u]),a.useEffect(()=>{if(!s)return;const r=document.activeElement instanceof HTMLElement?document.activeElement:null;return D.current?.focus(),()=>{r?.isConnected&&r.focus()}},[s]),a.useEffect(()=>{s&&R&&l.current?.focus()},[s,R]),a.useEffect(()=>{if(!m)return;const r=b?.computers.find(y=>y.id===m.id);r&&ue(r,m.section),c()},[m,b,c,ue]);const ie=async(r,y,P,t)=>{if(!f.current){f.current=!0,q(r),A(""),j.current?.abort();try{const i=await y();w.current&&P?.(i)}catch(i){w.current&&(A(i instanceof Error?i.message:String(i)),t?.())}finally{f.current=!1,w.current&&(q(null),await re())}}},je=a.useCallback(()=>G(null),[]),me=(r,y,P={})=>X(`/api/team-computers/${encodeURIComponent(r)}/${y}`,{method:"POST",body:JSON.stringify(P)}),oe=()=>{d(),N({type:"toggleAppSettings",open:!0,section:"computer"})};return e.jsxs(e.Fragment,{children:[s&&e.jsxs("aside",{ref:O,"aria-label":"Team computers",onKeyDown:r=>{r.key==="Escape"&&!L&&(r.stopPropagation(),W.current?Q():d())},className:"flex w-[300px] max-w-[90vw] shrink-0 flex-col border-l border-hairline/50 bg-panel max-sm:absolute max-sm:inset-y-0 max-sm:right-0 max-sm:z-30 max-sm:shadow-xl",children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-hairline/40 px-4 py-3",children:[e.jsx(be,{size:16,className:"text-ink-secondary"}),e.jsx("h2",{className:"flex-1 text-[13px] font-semibold",children:"Computers"}),e.jsx("button",{"aria-label":"Refresh computers",className:se,disabled:H||E!==null,onClick:()=>{A(""),re()},children:e.jsx(Fe,{size:14,className:H?"animate-spin":""})}),e.jsx("button",{ref:D,"aria-label":"Close computers",className:se,onClick:d,children:e.jsx(Ce,{size:15})})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto p-4",children:[e.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:"Drag a computer onto a team, or choose its team below. Bots on Auto will use it."}),(U||C||b?.problem)&&e.jsx("p",{role:"alert",className:"rounded-lg bg-danger/10 p-3 text-[12px] text-danger",children:U||C||b?.problem}),b&&!b.configured&&e.jsxs("div",{className:"rounded-xl border border-hairline/50 p-3 text-[12px]",children:[e.jsx("p",{className:"text-ink-secondary",children:"Connect your Boat account before creating a cloud computer."}),e.jsx("button",{className:`${se} mt-2 border border-hairline/50`,onClick:oe,children:"Connect Boat"})]}),R?e.jsxs("form",{className:"space-y-3 rounded-xl border border-hairline/60 bg-card p-3",onSubmit:r=>{r.preventDefault();const y=B.current??_.trim();!y||!b?.configured||(B.current=y,ie("create",()=>X("/api/team-computers",{method:"POST",body:JSON.stringify({name:y,requestId:S.current,acknowledgeCost:!0})}),()=>{F(""),Y(!1),S.current=crypto.randomUUID(),B.current=null},()=>{B.current=null}))},children:[e.jsx("label",{className:"block text-[12px] font-medium",htmlFor:"canvas-computer-name",children:"New cloud computer"}),e.jsx("input",{ref:l,id:"canvas-computer-name",className:Be,value:_,maxLength:60,placeholder:"e.g. Engineering desktop",disabled:E!==null||B.current!==null,onChange:r=>F(r.target.value)}),e.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:"Creates a cloud computer in your connected boat.dev account. Your Boat plan and usage charges apply. It stays unassigned until you choose a team."}),e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx("button",{type:"button",className:se,disabled:E!==null,onClick:()=>Y(!1),children:"Cancel"}),e.jsxs("button",{type:"submit",className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-[12px] font-medium text-white disabled:opacity-40",disabled:!b?.configured||!_.trim()||E!==null,children:[E==="create"&&e.jsx(we,{size:13,className:"animate-spin"}),"Create cloud computer"]})]})]}):e.jsxs("button",{className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-hairline/60 px-3 py-3 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",disabled:E!==null,onClick:()=>Y(!0),children:[e.jsx(Ne,{size:14})," New cloud computer"]}),b?.computers.map(r=>{const y=["idle","ready","running"].includes(r.state),P=["init","provisioning","provisioned","cloning","starting"].includes(r.state),t=de===r.id,i=r.held||t;return e.jsxs("article",{"data-computer-id":r.id,className:"rounded-xl border border-hairline/60 bg-card p-3",children:[e.jsxs("div",{"data-computer-drag-id":r.id,role:"group",tabIndex:-1,"aria-label":`Drag ${r.name} to a team`,onPointerDown:n=>{f.current||W.current||n.button!==0||!n.isPrimary||(n.currentTarget.focus({preventScroll:!0}),W.current={id:n.pointerId,x:n.clientX,y:n.clientY,moved:!1,computer:r,handle:n.currentTarget},n.currentTarget.setPointerCapture(n.pointerId))},onPointerMove:ce,onPointerUp:ve,onPointerCancel:Q,onLostPointerCapture:()=>{W.current&&Q()},className:"flex touch-none select-none cursor-grab items-center gap-2.5 rounded-lg py-1 outline-none active:cursor-grabbing",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-control text-ink-secondary",children:e.jsx(Ie,{size:18})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-[13px] font-medium",children:r.name}),e.jsxs("span",{className:"block text-[11px] text-ink-secondary",children:["Cloud computer · ",E===r.id?"Updating…":r.state]})]})]}),r.problem&&e.jsx("p",{className:"mt-2 text-[11px] text-danger",children:r.problem}),e.jsxs("label",{className:"sr-only",htmlFor:`computer-team-${r.id}`,children:["Team for ",r.name]}),e.jsxs("select",{id:`computer-team-${r.id}`,className:`${Be} mt-3`,disabled:E!==null,value:r.section===null?"unassigned":`team:${r.section}`,onChange:n=>ue(r,n.target.value==="unassigned"?null:n.target.value.slice(5)),children:[e.jsx("option",{value:"unassigned",children:"Not assigned"}),x.filter(n=>r.section===null||n.key===r.section).map(n=>e.jsx("option",{value:`team:${n.key}`,children:n.name},n.key))]}),r.section!==null&&e.jsx("p",{className:"mt-1.5 text-[10px] text-ink-secondary",children:"Unassign to move to another team."}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[!y&&!P&&e.jsx("button",{className:se,title:"Starts this cloud computer; your provider's usage charges apply",disabled:E!==null||i,onClick:()=>{ie(r.id,()=>me(r.id,"provision",{acknowledgeCost:!0}))},children:"Start / retry"}),y&&!i&&e.jsx("button",{className:se,disabled:E!==null,onClick:()=>{ie(r.id,()=>me(r.id,"sleep"))},children:"Sleep"}),y&&e.jsxs("button",{className:`${se} flex items-center gap-1.5`,title:"Pauses bot control while you use the desktop",disabled:E!==null,onClick:()=>{ie(r.id,async()=>(await me(r.id,"control",{action:"take",controlLeaseId:o.current}),ae(r.id),me(r.id,"join")),n=>{typeof n.joinUrl=="string"&&n.joinUrl.startsWith("https://")&&le({id:r.id,url:n.joinUrl})})},children:["Open desktop ",e.jsx(Ge,{size:11})]}),t&&e.jsx("button",{className:`${se} text-accent`,disabled:E!==null,onClick:()=>{ie(r.id,()=>me(r.id,"control",{action:"release",controlLeaseId:o.current}),()=>{ae(null),le(null)})},children:"Return to bots"}),r.held&&!t&&e.jsx("button",{className:se,disabled:!0,title:"Another viewer has paused bot control on this desktop",children:"In use"})]}),ee?.id===r.id&&e.jsx("a",{href:ee.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 block rounded-lg px-3 py-2 text-[12px] text-accent hover:bg-control",children:"Open secure desktop ↗"})]},r.id)})]}),e.jsx("footer",{className:"border-t border-hairline/40 p-3",children:e.jsx("button",{className:`${se} w-full text-left`,onClick:oe,children:"Local VM and other computers…"})})]}),ne&&Te.createPortal(e.jsxs("div",{role:"status",className:"pointer-events-none fixed z-[70] rounded-xl border border-accent/40 bg-card px-4 py-3 text-[12px] text-ink shadow-xl",style:{left:ne.x+14,top:ne.y+14},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Ie,{size:15}),ne.name]}),e.jsx("p",{className:"mt-1 text-[10px] text-ink-secondary",children:ne.hint})]}),document.body),e.jsx(Ee,{open:L!==null,tone:"neutral",title:L?.section===null?`Unassign ${L?.computer.name??"computer"}?`:`Assign ${L?.computer.name??"computer"} to ${L?.section||"General"}?`,body:L?.section===null?"This removes the team default. It does not stop or delete the machine, its files, or its logins. Review the bots' Auto routing before their next task.":"Bots on Auto in this team will share this computer's files and signed-in accounts. Explicit bot computer settings stay unchanged. Only one bot can use the desktop at a time. This does not move the OpenMausBot server or enable 24/7 hosting.",confirmLabel:L?.section===null?"Unassign computer":"Assign computer",onCancel:je,onConfirm:()=>{const r=L;r&&(G(null),le(null),ie(r.computer.id,()=>X(`/api/team-computers/${encodeURIComponent(r.computer.id)}`,{method:"PATCH",body:JSON.stringify({section:r.section,acknowledgeSharedAccess:!0})})))}})]})}function wt({edge:s,bots:u}){const{dispatch:m}=ye(),x=u.find(k=>k.id===s.sourceBotId),d=u.find(k=>k.id===s.targetBotId);if(!x||!d)return null;const c=s.state!=="connected";return e.jsxs("button",{onClick:()=>m({type:"select",id:s.groupId??d.id}),className:"flex w-full items-center gap-3 rounded-xl border border-hairline/40 bg-card px-3 py-2.5 text-left transition hover:bg-raised/50",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13px] font-medium text-ink",children:x.name}),e.jsx(Le,{size:13,className:Z("shrink-0",c?"text-accent":"text-ink-secondary")}),e.jsx("span",{className:"truncate text-[13px] font-medium text-ink",children:d.name})]}),s.reason&&e.jsx("span",{className:"max-w-[220px] truncate text-[11.5px] text-ink-secondary",children:s.reason}),e.jsx("span",{className:Z("rounded-full px-2 py-0.5 text-[10.5px] font-medium",s.state==="running"?"bg-success/15 text-success":s.state==="queued"?"bg-warning/15 text-warning":"bg-control text-ink-secondary"),children:s.state==="running"?"Running":s.state==="queued"?"Queued":s.lastAt?et(s.lastAt):"Connected"})]})}function Nt({section:s,label:u,onClose:m}){const x=a.useRef(null),d=a.useRef(null),c=a.useRef(m),k=a.useRef(!1),N=a.useRef(!1),[b,K]=a.useState(""),[H,I]=a.useState(""),[U,A]=a.useState(24e3),[C,$]=a.useState(null),[E,q]=a.useState(!0),[R,Y]=a.useState(!1),[_,F]=a.useState(null),S=b!==H,B=a.useMemo(()=>new TextEncoder().encode(b).byteLength,[b]);c.current=m,k.current=R,N.current=S;const l=a.useCallback(()=>{k.current||N.current&&!window.confirm(p("team.instructionsDiscard"))||c.current()},[]);a.useEffect(()=>{const f=document.activeElement instanceof HTMLElement?document.activeElement:null;x.current?.focus();const w=j=>{if(j.key==="Escape"&&!k.current){j.preventDefault(),l();return}if(j.key!=="Tab")return;const z=x.current;if(!z)return;const L=[...z.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')];if(L.length===0){j.preventDefault(),z.focus();return}const G=L[0],ee=L[L.length-1];j.shiftKey&&document.activeElement===G?(j.preventDefault(),ee.focus()):!j.shiftKey&&document.activeElement===ee&&(j.preventDefault(),G.focus())};return window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w),f?.focus()}},[l]),a.useEffect(()=>{let f=!1;return q(!0),F(null),X(`/api/section-context?section=${encodeURIComponent(s)}`).then(w=>{f||(K(w.text),I(w.text),$(w.updatedAt),A(w.maxBytes),window.setTimeout(()=>d.current?.focus(),0))}).catch(w=>{f||F(w instanceof Error?w.message:String(w))}).finally(()=>{f||q(!1)}),()=>{f=!0}},[s]);const D=async()=>{if(!(B>U)){Y(!0),F(null);try{const f=await X(`/api/section-context?section=${encodeURIComponent(s)}`,{method:"PUT",body:JSON.stringify({text:b})});I(f.text),K(f.text),$(f.updatedAt),A(f.maxBytes)}catch(f){F(f instanceof Error?f.message:String(f))}finally{Y(!1)}}};return Te.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 backdrop-blur-[2px] sm:p-6",onMouseDown:f=>f.target===f.currentTarget&&l(),children:e.jsxs("div",{ref:x,role:"dialog","aria-modal":"true","aria-labelledby":"section-context-title",tabIndex:-1,className:"animate-pop-in flex max-h-[min(680px,calc(100dvh-2rem))] w-full max-w-[680px] flex-col overflow-hidden rounded-[24px] border border-hairline/50 bg-panel shadow-2xl shadow-black/50 outline-none",children:[e.jsxs("header",{className:"flex items-start justify-between gap-4 border-b border-hairline/40 px-6 pb-4 pt-6 sm:px-8 sm:pt-7",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{size:19,className:"text-accent"}),e.jsx("h2",{id:"section-context-title",className:"text-[20px] font-semibold tracking-[-0.01em] text-ink",children:p("team.instructionsTitle",{name:u})})]}),e.jsx("p",{className:"mt-1.5 max-w-[520px] text-[12.5px] leading-relaxed text-ink-secondary",children:p("team.instructionsHint")})]}),e.jsx("button",{onClick:l,disabled:R,"aria-label":p("team.instructionsClose"),className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:e.jsx(Ce,{size:19})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-5 sm:px-8",children:[E?e.jsx("div",{className:"flex min-h-[260px] items-center justify-center text-ink-secondary",children:e.jsx(we,{size:20,className:"animate-spin","aria-label":p("team.instructionsLoading")})}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{ref:d,value:b,onChange:f=>K(f.target.value),placeholder:`Goals
|
|
2
|
+
- Ship the Windows onboarding refresh
|
|
3
|
+
|
|
4
|
+
Decisions
|
|
5
|
+
- Keep customer data local
|
|
6
|
+
|
|
7
|
+
Preferences
|
|
8
|
+
- Use concise weekly updates`,"aria-label":p("team.instructionsTitle",{name:u}),className:"min-h-[280px] w-full resize-y rounded-xl border border-hairline/60 bg-inset px-4 py-3 font-mono text-[12.5px] leading-relaxed text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/50"}),e.jsxs("div",{className:"mt-2 flex items-start justify-between gap-4 text-[11.5px] text-ink-secondary",children:[e.jsxs("span",{children:["Keep durable team facts here. Private notes stay in each bot's own Memory.",C?` Last saved ${new Date(C).toLocaleString()}.`:""]}),e.jsxs("span",{className:Z("shrink-0 tabular-nums",B>U&&"text-danger"),children:[B.toLocaleString()," / ",U.toLocaleString()," bytes"]})]})]}),_&&e.jsx("div",{className:"mt-3 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:_})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-hairline/40 px-6 py-4 sm:px-8",children:[e.jsx("button",{onClick:l,disabled:R,className:"rounded-lg px-3.5 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:"Cancel"}),e.jsxs("button",{onClick:()=>{D()},disabled:E||R||!S||B>U,className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[R?e.jsx(we,{size:14,className:"animate-spin"}):e.jsx(at,{size:14}),p("team.instructionsSave")]})]})]})}),document.body)}function It(){const{state:s,dispatch:u}=ye(),m=window.ogb?.remoteClient?.active===!0,[x,d]=a.useState(rt),[c,k]=a.useState(null),[N,b]=a.useState(null),[K,H]=a.useState(null),[I,U]=a.useState(null),[A,C]=a.useState(null),[$,E]=a.useState(null),[q,R]=a.useState(!1),[Y,_]=a.useState(0),[F,S]=a.useState([]),[B,l]=a.useState(null),D=a.useCallback(()=>l(null),[]),[f,w]=a.useState(null),j=a.useRef(f);j.current=f,a.useEffect(()=>()=>j.current?.resolve(!1),[]);const z=a.useMemo(()=>s.bots.filter(o=>!o.hidden),[s.bots]),L=a.useMemo(()=>{const o=[...new Set([...s.sections??[],...s.groups.flatMap(O=>O.section?[O.section]:[])])],T=O=>O===""?-1:o.includes(O)?o.indexOf(O):o.length;return it(z,o).sort((O,W)=>T(O.key)-T(W.key))},[z,s.sections,s.groups]),G=a.useMemo(()=>ot(z,x),[z,x]),ee=a.useCallback(async()=>{try{d(await X("/api/team-map")),b(null)}catch(o){b(o instanceof Error?o.message:String(o))}},[]);a.useEffect(()=>{ee();const o=window.setInterval(()=>{document.visibilityState==="visible"&&ee()},3e3);return()=>window.clearInterval(o)},[ee]);const le=async(o,T)=>{k(null);try{const O=await X("/api/sidebar-sections",{method:"POST",body:JSON.stringify({name:T,botIds:[o.id]})});u({type:"sections",sections:O.sections});for(const W of O.bots)u({type:"botPatched",bot:W})}catch(O){throw k(O instanceof Error?O.message:String(O)),O}},de=(o,T)=>new Promise(O=>{j.current?.resolve(!1),w({bot:o,destination:T,resolve:O})}),ae=a.useCallback(()=>{j.current?.resolve(!1),w(null)},[]);return e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden bg-app text-ink",children:[e.jsxs("header",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-b border-hairline/40 px-6 py-4 max-md:pl-12",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Ve,{size:18,className:"text-ink-secondary"}),e.jsx("h1",{className:"text-[17px] font-semibold",children:"Team map"}),e.jsx("span",{className:"ml-1 text-[11px] text-ink-secondary",children:ct(z.length)})]}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:p("canvas.description")})]}),!m&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>R(o=>!o),"aria-label":"Computers","aria-expanded":q,className:"rounded-lg p-2 text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(be,{size:17})}),e.jsxs("details",{className:"relative",onBlur:o=>{o.currentTarget.contains(o.relatedTarget)||o.currentTarget.removeAttribute("open")},onKeyDown:o=>{o.key==="Escape"&&(o.currentTarget.removeAttribute("open"),o.currentTarget.querySelector("summary")?.focus())},children:[e.jsxs("summary",{"aria-label":"Add to team map",className:"flex cursor-pointer list-none items-center gap-1.5 rounded-lg border border-hairline/60 bg-panel px-3 py-2 text-[12px] font-medium hover:bg-control [&::-webkit-details-marker]:hidden",children:[e.jsx(Ne,{size:14})," Add"]}),e.jsxs("div",{className:"absolute right-0 top-full z-40 mt-2 w-52 rounded-xl border border-hairline/60 bg-panel p-1.5 shadow-xl",onClick:o=>{const T=o.currentTarget.closest("details");T?.querySelector("summary")?.focus(),T?.removeAttribute("open")},children:[e.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-left text-[12px] hover:bg-control",onClick:()=>C({}),children:[e.jsx(Oe,{size:14}),p("team.create")]}),e.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-left text-[12px] hover:bg-control",onClick:()=>{R(!0),_(o=>o+1)},children:[e.jsx(Ie,{size:14}),"Cloud computer"]}),Qe("vm",s.config)&&e.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-left text-[12px] hover:bg-control",onClick:()=>u({type:"toggleAppSettings",section:"computer",open:!0}),children:[e.jsx(be,{size:14}),"Local VM…"]})]})]})]})]}),(c||N)&&e.jsxs("div",{role:"alert",className:"flex shrink-0 items-center justify-between gap-3 border-b border-danger/20 bg-danger/10 px-6 py-2 text-[12px] text-danger",children:[c||N,e.jsx("button",{"aria-label":p("common.close"),className:"rounded p-1 hover:bg-danger/10",onClick:()=>{k(null),b(null)},children:e.jsx(Ce,{size:14})})]}),e.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[e.jsx(kt,{sections:L,canManage:!m,onMove:de,connectedBotIds:s.settingsOpen?G.flatMap(o=>o.sourceBotId===s.selectedId?[o.targetBotId]:o.targetBotId===s.selectedId?[o.sourceBotId]:[]):[],onComputer:o=>u({type:"toggleSettings",botId:o.id,section:"access",open:!0}),teamComputers:Object.fromEntries(F.filter(o=>o.section!==null).map(o=>[o.section,{name:o.name,state:o.state}])),onTeamComputer:()=>R(!0),onComputerDrop:(o,T)=>{m||(R(!0),l({id:o,section:T}))},onInstructions:(o,T)=>H({section:o,label:T}),onMemory:(o,T)=>U({section:o,label:T}),onEditTeam:(o,T)=>C({section:o,rename:T}),onDeleteTeam:E,isEmpty:o=>![...s.bots,...s.groups].some(T=>T.section?.trim()===o)}),!m&&e.jsx(jt,{open:q,createRequest:Y,drop:B,sections:L,onClose:()=>R(!1),onDropHandled:D,onChange:S})]}),G.length>0&&e.jsxs("details",{className:"shrink-0 border-t border-hairline/40 bg-panel px-6 py-3",children:[e.jsxs("summary",{className:"cursor-pointer text-[12px] text-ink-secondary",children:[p("canvas.handoffs")," · ",G.length]}),e.jsx("div",{className:"mt-3 max-h-48 space-y-2 overflow-y-auto",children:G.slice(0,12).map(o=>e.jsx(wt,{edge:o,bots:z},`${o.sourceBotId}:${o.targetBotId}`))})]}),K&&e.jsx(Nt,{section:K.section,label:K.label,onClose:()=>H(null)}),A&&e.jsx(Ze,{...A,onClose:()=>C(null)}),I&&e.jsx(vt,{...I,onClose:()=>U(null)},I.section),e.jsx(Ee,{open:f!==null,tone:"neutral",title:`Move ${f?.bot.name??"bot"} to ${f?.destination||"General"}?`,body:"This changes the bot's home team and shared instructions, not just its position. Its conversations and model stay with it. To arrange visually, drag within the same team.",confirmLabel:"Move bot",onCancel:ae,onConfirm:()=>{const o=j.current;o&&(w(null),le(o.bot,o.destination).then(()=>o.resolve(!0),()=>o.resolve(!1)))}}),e.jsx(Ee,{open:$!==null,title:p("team.deleteTitle",{name:$??""}),body:p("team.deleteKeepBotsDescription"),confirmLabel:p("team.delete"),onCancel:()=>E(null),onConfirm:()=>{const o=$;E(null),o&&X(`/api/sidebar-sections?section=${encodeURIComponent(o)}`,{method:"DELETE"}).then(({sections:T})=>u({type:"sections",sections:T})).catch(T=>k(T instanceof Error?T.message:String(T)))}})]})}export{It as TeamMapPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as G,r as c,j as e,t,X as V,Z as Q,m as H,d as M,n as Y,g as ee,B as se,W as te,c as W,o as F,p as re,q as ae,v as ne,w as ie,x as le,y as de,T as ce,E as oe}from"./index-C3NqfdVU.js";import{u as xe,t as me,W as ue,s as pe,w as ge,a as U,c as he,R as fe,o as be,d as je,e as ye,f as ve}from"./WebhooksPanel--YQyCjKO.js";const Z=[{id:"link",labelKey:"triggers.source.linkRequest"},{id:"typeform",label:"Typeform"},{id:"zapier",label:"Zapier"},{id:"github",label:"GitHub"},{id:"stripe",label:"Stripe"},{id:"custom",labelKey:"triggers.source.custom"}];function J(r){const a=Z.find(n=>n.id===r);return a?a.labelKey?t(a.labelKey):a.label??"":""}function Ne(r,a){const n=r.prompt.trim();return{name:(r.source==="custom"?r.customName.trim():J(r.source))||ve(n,a.find(m=>m.id===r.botId)),prompt:n,botId:r.botId,runOn:"maus",...ye(),eventTypes:[],maxPendingRuns:null}}const _="min-h-9 max-w-full rounded-xl border border-hairline/40 bg-control/70 px-3 py-1.5 text-[13.5px] font-medium text-ink focus:border-focus";function Ee(){const{state:r,dispatch:a}=G(),n=r.bots.filter(s=>!s.hidden),f=c.useRef(null),m=xe(),{credentials:o,working:b,copiedId:w,copiedKind:E,error:u,setError:v,invoke:N,createAndCopyCommand:p,rememberCredential:g}=m,[h,x]=c.useState("link"),[j,k]=c.useState(""),[i,X]=c.useState(n[0]?.id??""),[A,P]=c.useState(""),[T,D]=c.useState(!1),[S,L]=c.useState(null),O=c.useRef(!1);O.current=S!==null;const z=()=>a({type:"toggleTriggers",open:!1}),y=r.webhookIngress,C=n.some(s=>s.id===i)?i:n[0]?.id??"";c.useEffect(()=>{const s=document.activeElement instanceof HTMLElement?document.activeElement:null,l=f.current,R=()=>Array.from(l?.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])')??[]).filter(d=>d.getClientRects().length>0);(l?.querySelector("select")??l)?.focus();const B=d=>{if(d.defaultPrevented||O.current)return;if(d.key==="Escape"){d.preventDefault(),a({type:"toggleTriggers",open:!1});return}if(d.key!=="Tab"||!l)return;const I=R();if(I.length===0){d.preventDefault(),l.focus();return}const K=I[0],q=I.at(-1);d.shiftKey&&(document.activeElement===K||!l.contains(document.activeElement))?(d.preventDefault(),q.focus()):!d.shiftKey&&document.activeElement===q&&(d.preventDefault(),K.focus())};return window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B),s?.focus()}},[a]);const $=async()=>{if(!(!C||T)){D(!0),v("");try{const s=await ee("/api/webhooks",{method:"POST",body:JSON.stringify(Ne({source:h,customName:j,botId:C,prompt:A},n))});a({type:"webhookPatched",webhook:s.webhook}),s.credential&&g(s.webhook.id,s.credential),P(""),k("")}catch(s){v(s instanceof Error?s.message:String(s))}finally{D(!1)}}};return e.jsxs("div",{className:"glass-popup-frame",style:Y(),onMouseDown:s=>s.target===s.currentTarget&&z(),children:[e.jsx("div",{"aria-hidden":"true",className:"glass-scrim pointer-events-none absolute inset-0"}),e.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":"triggers-title",tabIndex:-1,className:"glass-surface glass-popup animate-pop-in relative flex flex-col overflow-hidden rounded-[24px] outline-none",children:[e.jsxs("header",{className:"flex items-start justify-between gap-4 px-6 pb-4 pt-6 sm:px-8 sm:pt-7",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{id:"triggers-title",className:"text-[22px] font-semibold tracking-[-0.01em] text-ink",children:t("triggers.title")}),e.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:t("triggers.subtitle")})]}),e.jsx("button",{onClick:z,"aria-label":t("triggers.close"),className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(V,{size:21})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-7 sm:px-8",children:[e.jsxs("form",{"data-trigger-builder":!0,className:"glass-card rounded-2xl p-4 sm:p-5",onSubmit:s=>{s.preventDefault(),$()},children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[14px] text-ink",children:[e.jsx(Q,{size:16,className:"shrink-0 text-accent-text","aria-hidden":"true"}),e.jsx("span",{className:"font-medium",children:t("triggers.when")}),e.jsx("select",{"aria-label":t("triggers.sourceAria"),value:h,onChange:s=>x(s.target.value),className:_,children:Z.map(s=>e.jsx("option",{value:s.id,children:J(s.id)},s.id))}),h==="custom"&&e.jsx("input",{value:j,onChange:s=>k(s.target.value),"aria-label":t("triggers.source.customAria"),placeholder:t("triggers.source.customPlaceholder"),maxLength:80,className:"min-h-9 min-w-[200px] flex-1 rounded-xl border border-hairline/40 bg-inset px-3 py-1.5 text-[13.5px] text-ink placeholder:text-ink-tertiary"}),e.jsx(H,{size:15,className:"shrink-0 text-ink-tertiary","aria-hidden":"true"}),e.jsx("select",{"aria-label":t("triggers.botAria"),value:C,disabled:n.length===0,onChange:s=>X(s.target.value),className:_,children:n.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))}),e.jsx("span",{className:"font-medium",children:t("triggers.should")})]}),e.jsx("textarea",{value:A,onChange:s=>P(s.target.value),rows:3,"aria-label":t("triggers.instructionsAria"),placeholder:t("triggers.instructionsPlaceholder"),className:"mt-3 w-full resize-y rounded-xl border border-hairline/40 bg-inset px-3.5 py-3 text-[13.5px] leading-relaxed text-ink placeholder:text-ink-tertiary"}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-3",children:[n.length===0?e.jsx("p",{className:"text-[12px] text-warning",children:t("triggers.noBots")}):e.jsx("span",{}),e.jsxs("button",{type:"submit",disabled:T||!C,className:"flex items-center gap-2 rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110 disabled:opacity-40",children:[T&&e.jsx(M,{size:14,className:"animate-spin"}),t("triggers.create")]})]})]}),u&&e.jsx("div",{role:"alert",className:"mt-3 rounded-xl border border-danger/30 bg-danger/10 px-3.5 py-3 text-[12px] text-danger",children:u}),y&&!y.available&&e.jsxs("div",{role:"status",className:"mt-3 flex items-center gap-2 rounded-xl border border-danger/25 bg-danger/10 px-3.5 py-3 text-[12px] text-danger",children:[e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-danger"}),t("triggers.receiverUnavailable"),y.error?` ${y.error}`:""]}),e.jsxs("section",{"aria-labelledby":"triggers-yours",className:"mt-7",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("h3",{id:"triggers-yours",className:"text-[12px] font-medium uppercase tracking-[0.08em] text-ink-tertiary",children:t("triggers.yours")}),e.jsx("span",{className:"text-[11px] tabular-nums text-ink-tertiary",children:r.webhooks.length})]}),r.webhooks.length===0?e.jsx("div",{className:"glass-card rounded-2xl px-5 py-8 text-center text-[12.5px] text-ink-secondary",children:t("triggers.empty")}):e.jsx("ul",{className:"space-y-2",children:r.webhooks.map(s=>e.jsx(ke,{webhook:s,bot:r.bots.find(l=>l.id===s.botId),hasCredential:!!o[s.id],command:o[s.id]?me(o[s.id]):"",working:b,copied:w===s.id?E:null,ingressAvailable:y?.available!==!1,onToggle:()=>{N(s,"toggle")},onDelete:()=>{N(s,"delete")},onCopy:(l,R)=>{p(s,R,l)},onEdit:()=>L(s),onOpenChat:l=>{z(),a({type:"select",id:s.botId}),a({type:"switchTask",botId:s.botId,threadId:l})}},s.id))})]})]})]}),S&&e.jsx(ue,{webhook:S,bots:n,onClose:()=>L(null),onCredential:(s,l)=>g(l,s)})]})}function ke({webhook:r,bot:a,hasCredential:n,command:f,working:m,copied:o,ingressAvailable:b,onToggle:w,onDelete:E,onCopy:u,onEdit:v,onOpenChat:N}){const{state:p}=G(),g=pe(r),h=c.useMemo(()=>ge(r,p.webhookAttempts,p.routineRuns),[r,p.webhookAttempts,p.routineRuns]),x=m!==null,j=!!(r.verificationPending&&!r.enabled),k=a?.name??t("triggers.deletedBot");return e.jsxs("li",{"data-trigger-row":r.id,className:"glass-card rounded-2xl",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-4 py-3.5",children:[a?e.jsx(se,{bot:a,state:r.enabled?"idle":"sleeping",size:34,animated:!1,label:a.name}):e.jsx("div",{className:"flex size-[34px] shrink-0 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:e.jsx(te,{size:16})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-[13.5px] font-medium text-ink",children:[e.jsx("span",{className:"truncate",children:r.name}),e.jsx(H,{size:13,className:"shrink-0 text-ink-tertiary","aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:k})]}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1.5 text-[11.5px] text-ink-secondary",children:[e.jsx("span",{className:W("size-1.5 rounded-full",g.dot)}),e.jsx("span",{className:g.tone,children:g.label}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{children:r.lastReceivedAt?t("triggers.received",{count:r.deliveryCount,when:U(r.lastReceivedAt)}):t("triggers.neverReceived")})]})]}),e.jsxs("button",{type:"button",disabled:x||!n&&!b,onClick:()=>u("link",!1),className:"flex items-center gap-1.5 rounded-lg bg-control/70 px-2.5 py-1.5 text-[12px] font-medium text-ink hover:bg-raised-hover disabled:opacity-40",children:[o==="link"?e.jsx(F,{size:13,className:"text-success"}):m===`${r.id}:command`?e.jsx(M,{size:13,className:"animate-spin"}):e.jsx(re,{size:13}),o==="link"?t("triggers.copied"):t("triggers.copyLink")]}),e.jsx(ae,{checked:r.enabled,disabled:x||j,title:j?t("triggers.waitingTest"):void 0,"aria-label":t("triggers.toggleAria",{name:r.name}),onClick:w})]}),e.jsxs("details",{className:"group border-t border-hairline/25 px-4 py-2.5",children:[e.jsx("summary",{className:"cursor-pointer text-[12px] font-medium text-ink-secondary hover:text-ink",children:t("triggers.advanced")}),e.jsxs("div",{className:"mt-3 space-y-3 pb-2 text-[11.5px] leading-relaxed text-ink-secondary",children:[e.jsxs("div",{className:"rounded-xl border border-accent-border/30 bg-inset/60 px-3 py-2.5",children:[t("triggers.requestTask")," ",e.jsx("code",{className:"text-ink",children:JSON.stringify({task:t("triggers.sampleTask")})}),". ",t("triggers.keepsSetup")]}),r.prompt?e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-ink",children:t("triggers.defaultInstruction")})," ",r.prompt]}):e.jsx("p",{children:t("triggers.requestInstruction")}),r.eventTypes?.length?e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-ink",children:t("triggers.acceptedEvents")})," ",r.eventTypes.join(", ")]}):e.jsx("p",{children:t("triggers.allEvents")}),e.jsxs("p",{className:"flex items-center gap-1.5",children:[r.runOn==="cloud"?e.jsx(ne,{size:12}):e.jsx(ie,{size:12}),e.jsxs("span",{className:"font-medium text-ink",children:[t("routines.drawer.runsOn"),":"]})," ",t(r.runOn==="cloud"?"triggers.cloudVm":"routines.runsOn.local")]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-ink",children:t("triggers.pendingTasks")})," ",t("triggers.pendingTasksHelp",{count:r.maxPendingRuns??he})]}),n&&e.jsx("pre",{className:"overflow-x-auto rounded-xl bg-inset p-3 font-mono text-[10.5px] whitespace-pre-wrap break-all text-ink-secondary",children:f}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",disabled:x||!n&&!b,onClick:()=>u("command",!1),className:"flex items-center gap-1.5 rounded-lg border border-hairline/50 px-3 py-1.5 text-[11.5px] font-medium text-ink hover:bg-raised disabled:opacity-40",children:[o==="command"?e.jsx(F,{size:12,className:"text-success"}):e.jsx(le,{size:12}),t(o==="command"?"triggers.copied":"engineSetup.copyCommand")]}),e.jsxs("button",{type:"button",disabled:x||!b,onClick:()=>u("link",!0),className:"flex items-center gap-1.5 rounded-lg border border-hairline/50 px-3 py-1.5 text-[11.5px] font-medium text-ink hover:bg-raised disabled:opacity-40",children:[e.jsx(fe,{size:12}),t("triggers.rotateUrl")]}),e.jsxs("button",{type:"button",disabled:x,onClick:v,className:"flex items-center gap-1.5 rounded-lg border border-hairline/50 px-3 py-1.5 text-[11.5px] font-medium text-ink hover:bg-raised disabled:opacity-40",children:[e.jsx(de,{size:12}),t("triggers.editSettings")]}),e.jsxs("button",{type:"button",disabled:x,onClick:E,className:"flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[11.5px] font-medium text-danger hover:bg-danger/10 disabled:opacity-40",children:[e.jsx(ce,{size:12}),t("common.delete")]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 font-medium text-ink",children:t("triggers.recentDeliveries")}),h.length===0?e.jsx("p",{children:t("triggers.noRequests")}):e.jsx("ul",{className:"divide-y divide-hairline/25",children:h.slice(0,8).map(i=>e.jsxs("li",{className:"flex items-center gap-2 py-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate font-medium text-ink",children:i.eventName}),e.jsxs("span",{className:"shrink-0",children:["· ",U(i.at)]})]}),e.jsx("div",{className:"truncate font-mono text-[10px] text-ink-tertiary",children:i.reason||i.preview||t("triggers.emptyPayload")})]}),e.jsx("span",{className:W("shrink-0 text-[10.5px] font-medium",je(i.outcome,i.run)),children:be(i.outcome,i.run)}),i.run?.threadId&&a&&e.jsxs("button",{type:"button",onClick:()=>N(i.run.threadId),className:"flex shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-[10.5px] hover:bg-raised hover:text-ink",children:[e.jsx(oe,{size:11}),t("canvas.openChat")]})]},i.id))})]})]})]})]})}export{Z as TRIGGER_SOURCES,Ee as TriggersPanel,Ne as triggerInput,J as triggerSourceLabel};
|