@kafca/agentdock 0.1.51 → 0.1.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +4 -0
  2. package/dist/renderer/assets/{Badge-DpYXv6XT.js → Badge-H0XWc7vp.js} +1 -1
  3. package/dist/renderer/assets/{Chat-C_aNxLPf.js → Chat-bR-LSg9D.js} +1 -1
  4. package/dist/renderer/assets/{ChatMarkdown-DZgHg5zH.js → ChatMarkdown-ZnK1NWdh.js} +1 -1
  5. package/dist/renderer/assets/Config-DdhdELsW.js +21 -0
  6. package/dist/renderer/assets/{CronList-BuvMxOmF.js → CronList-gyQuGhGg.js} +1 -1
  7. package/dist/renderer/assets/{Dashboard-3nbUcH91.js → Dashboard-DaLRkrf-.js} +2 -2
  8. package/dist/renderer/assets/{EmptyState-LMG_D0FN.js → EmptyState-Ci2bjyET.js} +1 -1
  9. package/dist/renderer/assets/{KnowledgeDetail-DPuV1KoJ.js → KnowledgeDetail-D5dqZC5f.js} +2 -2
  10. package/dist/renderer/assets/{KnowledgeHome-VFIxwTp4.js → KnowledgeHome-DIhbMvM8.js} +2 -2
  11. package/dist/renderer/assets/{Logs-BymclbsW.js → Logs-DIF8ymaI.js} +1 -1
  12. package/dist/renderer/assets/{Modal-Dn_4NhR5.js → Modal-O77lsvJu.js} +3 -3
  13. package/dist/renderer/assets/{MonitorList-B1rSH7zN.js → MonitorList-CJBrqytq.js} +1 -1
  14. package/dist/renderer/assets/{Page-6cEj45pt.js → Page-CodHoUwH.js} +1 -1
  15. package/dist/renderer/assets/ProjectDetail-Bt4Dj60f.js +11 -0
  16. package/dist/renderer/assets/{ProjectList-CZbAGDMS.js → ProjectList-CZTkHOyM.js} +1 -1
  17. package/dist/renderer/assets/{Select-DE1pzt5p.js → Select-DGCo_gYI.js} +1 -1
  18. package/dist/renderer/assets/{SessionChat-DyBDEXW9.js → SessionChat-CHm7HyvI.js} +1 -1
  19. package/dist/renderer/assets/{SessionList-C8sTJnX6.js → SessionList-Df2wQinW.js} +1 -1
  20. package/dist/renderer/assets/{ThreadChat-CpAia9qR.js → ThreadChat-Iomr0Qx9.js} +1 -1
  21. package/dist/renderer/assets/{Workspace-CKpVbGne.js → Workspace-r8lHxaBj.js} +2 -2
  22. package/dist/renderer/assets/{arrow-left-455KUtQh.js → arrow-left-r950YY17.js} +1 -1
  23. package/dist/renderer/assets/{book-open-C_s_nHj6.js → book-open-BslYrNTy.js} +1 -1
  24. package/dist/renderer/assets/{bot-D0cidv6D.js → bot-BVfQh_eb.js} +1 -1
  25. package/dist/renderer/assets/{check-DS7qvqek.js → check-BSAurnOI.js} +1 -1
  26. package/dist/renderer/assets/{chevron-down-C43oRpZM.js → chevron-down-B9G43XLT.js} +1 -1
  27. package/dist/renderer/assets/{circle-aYyg1o0e.js → circle-CBHOs0lN.js} +1 -1
  28. package/dist/renderer/assets/desktop-CXcNupTW.js +1 -0
  29. package/dist/renderer/assets/{funnel-COrEnKiW.js → funnel-UDX21Ev4.js} +1 -1
  30. package/dist/renderer/assets/{heart-BO4CV3kx.js → heart-CzmLZP5g.js} +1 -1
  31. package/dist/renderer/assets/{index-C4ZGOKQv.js → index-C581X81v.js} +9 -9
  32. package/dist/renderer/assets/{index-CbvYBkud.js → index-DeTNhSbD.js} +2 -2
  33. package/dist/renderer/assets/{pencil-DR14wZjZ.js → pencil-BFLsShcu.js} +1 -1
  34. package/dist/renderer/assets/{play-CRTtErO_.js → play-YFpAnQ9r.js} +1 -1
  35. package/dist/renderer/assets/{plus-Bswb_LiK.js → plus-D8uIIQB9.js} +1 -1
  36. package/dist/renderer/assets/projects-D2hAJzY0.js +1 -0
  37. package/dist/renderer/assets/{save-CKgtUije.js → save-Cgx9qe4w.js} +1 -1
  38. package/dist/renderer/assets/{search-RCAjElg9.js → search-CxscB_CP.js} +1 -1
  39. package/dist/renderer/assets/{server-DlKngwyt.js → server-KW8nGvbV.js} +1 -1
  40. package/dist/renderer/assets/{session-utils-CZHYpZpR.js → session-utils-oB-uPAPg.js} +1 -1
  41. package/dist/renderer/assets/{sessions-ChGwwlqi.js → sessions-CefxFisH.js} +1 -1
  42. package/dist/renderer/assets/{shield-check-BRY90_8q.js → shield-check-Bl-k8F5V.js} +1 -1
  43. package/dist/renderer/assets/{trash-2-CwTS-NZu.js → trash-2-DvmnFiu7.js} +1 -1
  44. package/dist/renderer/assets/{user-mhOSrZ1d.js → user-ZZO21GY4.js} +1 -1
  45. package/dist/renderer/assets/{wifi-off-5-ojceU3.js → wifi-off-1dHHA2Em.js} +1 -1
  46. package/dist/renderer/index.html +1 -1
  47. package/dist-electron/packages/core-sdk/src/index.js +6 -10
  48. package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +29 -0
  49. package/dist-electron/services/local-ai-core/src/acp/store/runtime-config-store.js +164 -0
  50. package/dist-electron/services/local-ai-core/src/acp/store/schema.js +8 -0
  51. package/dist-electron/services/local-ai-core/src/agents/shared/launch-utils.js +1 -2
  52. package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +2 -2
  53. package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +1 -1
  54. package/dist-electron/services/local-ai-core/src/router/workspace-router.js +8 -7
  55. package/dist-electron/services/local-ai-core/src/runtime/external-service.js +6 -9
  56. package/dist-electron/services/local-ai-core/src/runtime/handlers/runtime-handler.js +4 -8
  57. package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +32 -35
  58. package/dist-electron/services/local-ai-core/src/runtime/local-core-runtime-state.js +0 -89
  59. package/dist-electron/services/local-ai-core/src/runtime/server-routes.js +4 -7
  60. package/dist-electron/services/local-ai-core/src/sandbox/sandbox-config.js +4 -4
  61. package/dist-electron/tests/electron/plugin-kernel.test.js +72 -34
  62. package/dist-electron/tests/electron/runtime-config-store.test.js +176 -0
  63. package/dist-electron/tests/electron/sandbox-config.test.js +5 -5
  64. package/dist-electron/tests/electron/workspace-task-store.test.js +5 -5
  65. package/package.json +1 -1
  66. package/dist/renderer/assets/Config-DQAgYmCU.js +0 -21
  67. package/dist/renderer/assets/ProjectDetail-BcoxhPqE.js +0 -11
  68. package/dist/renderer/assets/desktop-CqHMtdOi.js +0 -1
  69. package/dist/renderer/assets/projects-BSilkED5.js +0 -1
@@ -0,0 +1,11 @@
1
+ import{c as oe,D as E,u as we,E as Ne,r as l,j as s,L as Se,B as h,Z as Ce,g as Y,C as w,I as j,G as ke,H as Pe}from"./index-C581X81v.js";import{B as A}from"./Badge-H0XWc7vp.js";import{M as ee}from"./Modal-O77lsvJu.js";import{S as se}from"./Select-DGCo_gYI.js";import{E as ae}from"./EmptyState-Ci2bjyET.js";import{P as ze,S as B}from"./Page-CodHoUwH.js";import{g as Ie}from"./projects-D2hAJzY0.js";import{d as Ae,c as P,h as Me,f as M,j as Ee}from"./desktop-CXcNupTW.js";import{D as T,e as Le}from"./desktop-JQkhNOF4.js";import{A as Re}from"./arrow-left-r950YY17.js";import{S as $e}from"./shield-check-Bl-k8F5V.js";import{H as te}from"./heart-CzmLZP5g.js";import{P as He,S as De}from"./save-Cgx9qe4w.js";import{P as Be}from"./plus-D8uIIQB9.js";import{C as Te}from"./check-BSAurnOI.js";import{T as Oe}from"./trash-2-DvmnFiu7.js";import{P as Ue}from"./play-YFpAnQ9r.js";import"./index-DeTNhSbD.js";import"./chevron-down-B9G43XLT.js";/**
2
+ * @license lucide-react v0.487.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Fe=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],qe=oe("layers",Fe);/**
7
+ * @license lucide-react v0.487.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Ge=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],Je=oe("pause",Ge),Ke=e=>E.get(`/projects/${e}/heartbeat`),Ze=e=>E.post(`/projects/${e}/heartbeat/pause`),Ve=e=>E.post(`/projects/${e}/heartbeat/resume`),We=e=>E.post(`/projects/${e}/heartbeat/run`),Xe=(e,r)=>E.post(`/projects/${e}/heartbeat/interval`,{minutes:r});function O(e){return JSON.parse(JSON.stringify(e||{}))}function Qe(e,r){var c,o,d;const n=(c=e==null?void 0:e.projects)==null?void 0:c.find(m=>m.name===r);return String(((d=(o=n==null?void 0:n.agent)==null?void 0:o.options)==null?void 0:d.provider_id)||"")}function re(e,r,n){var f;const c=O(e),o=Array.isArray(c.projects)?c.projects:[],d=o.findIndex(_=>_.name===r);if(d<0)throw new Error(`Project not found in config: ${r}`);const m=o[d];return o[d]={...m,agent:{...m.agent,options:{...((f=m.agent)==null?void 0:f.options)||{},provider_id:n}}},c.projects=o,c}function Ye(e,r,n){var f;const c=O(e),o=Array.isArray(c.projects)?c.projects:[],d=o.findIndex(_=>_.name===r);if(d<0)throw new Error(`Project not found in config: ${r}`);const m=o[d];return o[d]={...m,agent:{...m.agent,options:{...((f=m.agent)==null?void 0:f.options)||{},model:n}}},c.projects=o,c}function es(e,r){const n=O(e),c=Array.isArray(n.projects)?n.projects:[];return n.projects=c.map(o=>{var d,m,f;return((m=(d=o.agent)==null?void 0:d.options)==null?void 0:m.provider_id)!==r?o:{...o,agent:{...o.agent,options:{...((f=o.agent)==null?void 0:f.options)||{},provider_id:""}}}}),n}const i={enabled:!1,provider_id:T,runtime_image_id:Le("pi").id,server_url:"http://127.0.0.1:8080",image:"agentdock/pi-acp:local",acp_port:"8080",state_scope:"project",timeout_seconds:"7200",sandbox_lifecycle:"per_thread",idle_seconds:"900",warm_pool_size:"0",cpu:"1000m",memory:"2Gi",workspace_mount_path:"/workspace",state_mount_path:"/agent-state"};function ss(e){const r=new Set,n=String((e==null?void 0:e.model)||"").trim();n&&r.add(n);for(const c of(e==null?void 0:e.models)||[]){const o=String((c==null?void 0:c.model)||"").trim();o&&r.add(o)}return[...r]}function ws(){var K,Z;const{t:e}=we(),{name:r}=Ne(),[n,c]=l.useState("overview"),[o,d]=l.useState(null),[m,f]=l.useState([]),[_,ne]=l.useState(""),[p,ce]=l.useState(null),[U,ie]=l.useState([]),[le,de]=l.useState(""),[me,F]=l.useState(!0),[g,b]=l.useState(i),[xe,q]=l.useState(!1),[G,x]=l.useState(""),[he,L]=l.useState(!1),[v,z]=l.useState({name:"",api_key:"",base_url:"",model:""}),[ue,R]=l.useState(!1),[J,fe]=l.useState("30"),u=l.useCallback(async()=>{var a,t,N,y,S;if(r)try{F(!0);const[C,I,V,W]=await Promise.allSettled([Ie(r),Ae(),Ke(r),P()]);C.status==="fulfilled"&&d(C.value);const X=I.status==="fulfilled"?I.value.providers||[]:[];if(I.status==="fulfilled"&&f(X),V.status==="fulfilled"&&ce(V.value),W.status==="fulfilled"){const $=W.value.config,k=(a=$==null?void 0:$.projects)==null?void 0:a.find(D=>D.name===r),Q=Qe($,r),H=X.find(D=>D.id===Q);ne(Q),ie(ss(H)),de(String(((N=(t=k==null?void 0:k.agent)==null?void 0:t.options)==null?void 0:N.model)||(H==null?void 0:H.model)||"")),b(as((S=(y=k==null?void 0:k.agent)==null?void 0:y.options)==null?void 0:S.sandbox))}}finally{F(!1)}},[r]);l.useEffect(()=>{u();const a=()=>u();return window.addEventListener("cc:refresh",a),()=>window.removeEventListener("cc:refresh",a)},[u]);const pe=async()=>{if(!(!r||!v.name)){x("");try{const a=await Me(v),t=await P();await M(re(t.config,r,a.id)),L(!1),z({name:"",api_key:"",base_url:"",model:""}),x("Provider created."),await u()}catch(a){x(a instanceof Error?a.message:String(a))}}},ge=async a=>{if(r){x("");try{const t=await P();await M(re(t.config,r,a)),x("Provider selected."),await u()}catch(t){x(t instanceof Error?t.message:String(t))}}},ve=async a=>{if(r){x("");try{const t=await P();await M(es(t.config,a)),await Ee(a),x("Provider removed."),await u()}catch(t){x(t instanceof Error?t.message:String(t))}}},je=async a=>{if(r){x("");try{const t=await P();await M(Ye(t.config,r,a)),x("Model selected."),await u()}catch(t){x(t instanceof Error?t.message:String(t))}}},be=async()=>{r&&(await Xe(r,parseInt(J)),R(!1),u())},_e=[{key:"overview",icon:qe},{key:"providers",icon:Ce},{key:"sandbox",icon:$e},{key:"heartbeat",icon:te}],ye=async()=>{var a;if(r){q(!0),x("");try{const N=(await P()).config||{},y=Array.isArray(N.projects)?[...N.projects]:[],S=y.findIndex(I=>I.name===r);if(S<0)throw new Error(`Project not found in config: ${r}`);const C=y[S];y[S]={...C,agent:{...C.agent,options:{...((a=C.agent)==null?void 0:a.options)||{},sandbox:ts(g)}}},await M({...N,projects:y}),x("Sandbox settings saved."),await u()}catch(t){x((t==null?void 0:t.message)||String(t))}finally{q(!1)}}};return me&&!o?s.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground animate-pulse",children:"Loading..."}):s.jsxs("div",{className:"space-y-6 animate-fade-in",children:[s.jsx(ze,{title:r,description:"Project overview, providers, and heartbeat status. Low-frequency settings are no longer editable in the daily UI.",actions:s.jsx(Se,{to:"/projects",children:s.jsxs(h,{variant:"secondary",size:"sm",children:[s.jsx(Re,{size:14})," Back"]})})}),o?s.jsxs("div",{className:"app-toolbar flex flex-wrap items-center gap-2",children:[s.jsx(A,{variant:"info",children:o.agent_type}),s.jsx(A,{variant:o.heartbeat_enabled?"success":"secondary",children:o.heartbeat_enabled?"heartbeat on":"heartbeat off"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.sessions_count," sessions"]})]}):null,G?s.jsx("div",{role:"status",className:"rounded-lg border border-primary/20 bg-primary/10 px-4 py-3 text-sm text-primary",children:G}):null,s.jsx("div",{className:"flex gap-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:_e.map(({key:a,icon:t})=>s.jsxs("button",{onClick:()=>c(a),className:Y("app-segment flex items-center gap-2",n===a?"app-segment-active":"app-segment-idle"),children:[s.jsx(t,{size:16}),e(`projects.tabs.${a}`)]},a))}),n==="overview"&&o&&s.jsxs("div",{className:"space-y-4",children:[s.jsx(B,{className:"app-panel",title:e("projects.platforms"),children:s.jsx("div",{className:"flex flex-wrap gap-2",children:(K=o.platforms)==null?void 0:K.map(a=>s.jsxs(A,{variant:a.connected?"success":"danger",children:[s.jsx(He,{size:12,className:"mr-1"})," ",a.type," ",a.connected?"✓":"✗"]},a.type))})}),s.jsxs(B,{className:"app-panel",title:e("sessions.title"),children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.sessions_count," ",e("nav.sessions").toLowerCase()]}),((Z=o.active_session_keys)==null?void 0:Z.length)>0&&s.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:o.active_session_keys.map(a=>s.jsx(A,{variant:"default",children:a},a))})]})]}),n==="providers"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:e("providers.title")}),s.jsxs(h,{size:"sm",onClick:()=>L(!0),children:[s.jsx(Be,{size:14})," ",e("providers.add")]})]}),m.length===0?s.jsx(ae,{message:e("common.noData")}):s.jsx("div",{className:"space-y-2",children:m.map(a=>s.jsx(w,{className:"app-panel",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium text-foreground",children:a.name}),a.id===_&&s.jsx(A,{variant:"success",children:e("providers.active")})]}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[a.model," ",a.base_url?`· ${a.base_url}`:""]})]}),s.jsxs("div",{className:"flex gap-2",children:[a.id!==_&&s.jsxs(h,{size:"sm",variant:"secondary",onClick:()=>{ge(a.id)},children:[s.jsx(Te,{size:14})," ",e("providers.activate")]}),a.id!==_&&s.jsx(h,{size:"sm",variant:"danger",onClick:()=>{ve(a.id)},children:s.jsx(Oe,{size:14})})]})]})},a.id))}),U.length>0&&s.jsxs(w,{children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:e("providers.models")}),s.jsx("div",{className:"flex flex-wrap gap-2",children:U.map(a=>s.jsx("button",{onClick:()=>{je(a)},className:Y("px-3 py-1.5 rounded-lg text-xs font-medium transition-all",a===le?"bg-primary/15 text-primary border border-primary/30":"bg-secondary text-secondary-foreground hover:bg-secondary/80"),children:a},a))})]}),s.jsx(ee,{open:he,onClose:()=>L(!1),title:e("providers.add"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(j,{label:e("providers.name"),value:v.name,onChange:a=>z({...v,name:a.target.value})}),s.jsx(j,{label:"API Key",type:"password",value:v.api_key,onChange:a=>z({...v,api_key:a.target.value})}),s.jsx(j,{label:e("providers.baseUrl"),value:v.base_url,onChange:a=>z({...v,base_url:a.target.value}),placeholder:"https://api.example.com"}),s.jsx(j,{label:e("providers.model"),value:v.model,onChange:a=>z({...v,model:a.target.value})}),s.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[s.jsx(h,{variant:"secondary",onClick:()=>L(!1),children:e("common.cancel")}),s.jsx(h,{onClick:pe,children:e("providers.add")})]})]})})]}),n==="sandbox"&&s.jsx(B,{title:"Sandbox",description:"Run this project agent inside an OpenSandbox container.",actions:s.jsxs(h,{size:"sm",onClick:()=>void ye(),loading:xe,children:[s.jsx(De,{size:14})," Save"]}),children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("label",{className:"flex items-center gap-3 text-sm font-medium text-foreground",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-border",checked:g.enabled,onChange:a=>b(t=>({...t,enabled:a.target.checked}))}),"Enable sandbox mode"]}),g.enabled?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[s.jsxs(se,{label:"State scope",value:g.state_scope,onChange:a=>b(t=>({...t,state_scope:a.target.value})),children:[s.jsx("option",{value:"user",children:"User"}),s.jsx("option",{value:"project",children:"Project"}),s.jsx("option",{value:"thread",children:"Thread"}),s.jsx("option",{value:"run",children:"Run"})]}),s.jsx(j,{label:"Timeout seconds",type:"number",value:g.timeout_seconds,onChange:a=>b(t=>({...t,timeout_seconds:a.target.value}))}),s.jsxs(se,{label:"Sandbox lifecycle",value:g.sandbox_lifecycle,onChange:a=>b(t=>({...t,sandbox_lifecycle:a.target.value})),children:[s.jsx("option",{value:"per_thread",children:"Keep warm per thread"}),s.jsx("option",{value:"per_run",children:"Close after each run"})]}),s.jsx(j,{label:"Idle seconds",type:"number",value:g.idle_seconds,onChange:a=>b(t=>({...t,idle_seconds:a.target.value}))}),s.jsx(j,{label:"Warm pool",type:"number",value:g.warm_pool_size,onChange:a=>b(t=>({...t,warm_pool_size:a.target.value}))}),s.jsx(j,{label:"CPU",value:g.cpu,onChange:a=>b(t=>({...t,cpu:a.target.value}))}),s.jsx(j,{label:"Memory",value:g.memory,onChange:a=>b(t=>({...t,memory:a.target.value}))})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"OpenSandbox URL, API key env, image, ACP port, and sandbox mount paths are resolved from the global sandbox provider and runtime image registry."})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:"Local bundled runtime execution is active for this project."})]})}),n==="heartbeat"&&s.jsxs("div",{className:"space-y-4",children:[p?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[s.jsxs(w,{children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:e("heartbeat.status")}),s.jsx("p",{className:"text-lg font-bold text-foreground mt-1",children:p.paused?e("heartbeat.paused"):e("heartbeat.running")})]}),s.jsxs(w,{children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:e("heartbeat.interval")}),s.jsxs("p",{className:"text-lg font-bold text-foreground mt-1",children:[p.interval_mins,"m"]})]}),s.jsxs(w,{children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:e("heartbeat.runCount")}),s.jsx("p",{className:"text-lg font-bold text-foreground mt-1",children:p.run_count})]}),s.jsxs(w,{children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:e("heartbeat.errorCount")}),s.jsx("p",{className:"text-lg font-bold text-foreground mt-1",children:p.error_count})]})]}),s.jsx(w,{children:s.jsxs("div",{className:"space-y-2 text-sm",children:[s.jsxs("p",{className:"text-muted-foreground",children:[e("heartbeat.lastRun"),": ",s.jsx("span",{className:"text-foreground",children:ke(p.last_run)})]}),s.jsxs("p",{className:"text-muted-foreground",children:[e("heartbeat.skippedBusy"),": ",s.jsx("span",{className:"text-foreground",children:p.skipped_busy})]}),p.last_error&&s.jsx("p",{className:"text-destructive",children:p.last_error})]})}),s.jsxs("div",{className:"flex gap-2",children:[p.paused?s.jsxs(h,{onClick:()=>{Ve(r).then(u)},children:[s.jsx(Ue,{size:14})," ",e("heartbeat.resume")]}):s.jsxs(h,{variant:"secondary",onClick:()=>{Ze(r).then(u)},children:[s.jsx(Je,{size:14})," ",e("heartbeat.pause")]}),s.jsxs(h,{variant:"secondary",onClick:()=>{We(r).then(u)},children:[s.jsx(te,{size:14})," ",e("heartbeat.trigger")]}),s.jsxs(h,{variant:"secondary",onClick:()=>R(!0),children:[s.jsx(Pe,{size:14})," ",e("heartbeat.setInterval")]})]})]}):s.jsx(ae,{message:e("common.noData")}),s.jsx(ee,{open:ue,onClose:()=>R(!1),title:e("heartbeat.setInterval"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(j,{label:`${e("heartbeat.interval")} (min)`,type:"number",value:J,onChange:a=>fe(a.target.value)}),s.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[s.jsx(h,{variant:"secondary",onClick:()=>R(!1),children:e("common.cancel")}),s.jsx(h,{onClick:be,children:e("common.save")})]})]})})]})]})}function as(e){return{enabled:!!(e!=null&&e.enabled),provider_id:(e==null?void 0:e.provider_id)||T,runtime_image_id:(e==null?void 0:e.runtime_image_id)||i.runtime_image_id,server_url:(e==null?void 0:e.server_url)||i.server_url,image:(e==null?void 0:e.image)||i.image,acp_port:String((e==null?void 0:e.acp_port)||i.acp_port),state_scope:(e==null?void 0:e.state_scope)||i.state_scope,timeout_seconds:String((e==null?void 0:e.timeout_seconds)||i.timeout_seconds),sandbox_lifecycle:(e==null?void 0:e.sandbox_lifecycle)||i.sandbox_lifecycle,idle_seconds:String((e==null?void 0:e.idle_seconds)||i.idle_seconds),warm_pool_size:String((e==null?void 0:e.warm_pool_size)??i.warm_pool_size),cpu:(e==null?void 0:e.cpu)||i.cpu,memory:(e==null?void 0:e.memory)||i.memory,workspace_mount_path:(e==null?void 0:e.workspace_mount_path)||i.workspace_mount_path,state_mount_path:(e==null?void 0:e.state_mount_path)||i.state_mount_path}}function ts(e){return{enabled:e.enabled,provider_id:e.provider_id.trim()||T,runtime_image_id:e.runtime_image_id.trim()||i.runtime_image_id,state_scope:e.state_scope,timeout_seconds:Number(e.timeout_seconds)||Number(i.timeout_seconds),sandbox_lifecycle:e.sandbox_lifecycle,idle_seconds:Number(e.idle_seconds)||Number(i.idle_seconds),warm_pool_size:Math.max(0,Number(e.warm_pool_size)||0),cpu:e.cpu.trim()||i.cpu,memory:e.memory.trim()||i.memory}}export{ws as default};
@@ -1 +1 @@
1
- import{u as x,r,j as e,F as f,L as j,C as p}from"./index-C4ZGOKQv.js";import{B as l}from"./Badge-DpYXv6XT.js";import{E as u}from"./EmptyState-LMG_D0FN.js";import{P as h}from"./Page-6cEj45pt.js";import{l as g}from"./projects-BSilkED5.js";import{S as v,A as b}from"./server-DlKngwyt.js";import{H as y}from"./heart-BO4CV3kx.js";function C(){const{t}=x(),[a,d]=r.useState([]),[m,i]=r.useState(!0),n=r.useCallback(async()=>{try{i(!0);const s=await g();d(s.projects||[])}finally{i(!1)}},[]);return r.useEffect(()=>{n();const s=()=>n();return window.addEventListener("cc:refresh",s),()=>window.removeEventListener("cc:refresh",s)},[n]),m&&a.length===0?e.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground animate-pulse",children:"Loading..."}):a.length===0?e.jsx(u,{message:t("projects.noProjects"),icon:f}):e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsx(h,{title:t("nav.projects"),description:"Project summaries with provider, platform, and session status."}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:a.map(s=>{var o;return e.jsx(j,{to:`/projects/${s.name}`,children:e.jsxs(p,{hover:!0,className:"app-panel h-full",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-primary/10 text-primary",children:e.jsx(v,{size:18})}),e.jsx("h3",{className:"font-semibold text-foreground",children:s.name})]}),e.jsx(b,{size:16,className:"text-muted-foreground/45"})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-3",children:[e.jsx(l,{variant:"info",children:s.agent_type}),(o=s.platforms)==null?void 0:o.map(c=>e.jsx(l,{children:c},c))]}),e.jsxs("div",{className:"mt-4 flex items-center justify-between rounded-[16px] bg-black/[0.035] px-3 py-2 text-xs text-muted-foreground dark:bg-white/[0.05]",children:[e.jsxs("span",{children:[s.sessions_count," ",t("nav.sessions").toLowerCase()]}),s.heartbeat_enabled&&e.jsxs("span",{className:"flex items-center gap-1 text-primary",children:[e.jsx(y,{size:12})," ",t("heartbeat.title")]})]})]})},s.name)})})]})}export{C as default};
1
+ import{u as x,r,j as e,F as f,L as j,C as p}from"./index-C581X81v.js";import{B as l}from"./Badge-H0XWc7vp.js";import{E as u}from"./EmptyState-Ci2bjyET.js";import{P as h}from"./Page-CodHoUwH.js";import{l as g}from"./projects-D2hAJzY0.js";import{S as v,A as b}from"./server-KW8nGvbV.js";import{H as y}from"./heart-CzmLZP5g.js";function C(){const{t}=x(),[a,d]=r.useState([]),[m,i]=r.useState(!0),n=r.useCallback(async()=>{try{i(!0);const s=await g();d(s.projects||[])}finally{i(!1)}},[]);return r.useEffect(()=>{n();const s=()=>n();return window.addEventListener("cc:refresh",s),()=>window.removeEventListener("cc:refresh",s)},[n]),m&&a.length===0?e.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground animate-pulse",children:"Loading..."}):a.length===0?e.jsx(u,{message:t("projects.noProjects"),icon:f}):e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsx(h,{title:t("nav.projects"),description:"Project summaries with provider, platform, and session status."}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:a.map(s=>{var o;return e.jsx(j,{to:`/projects/${s.name}`,children:e.jsxs(p,{hover:!0,className:"app-panel h-full",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-primary/10 text-primary",children:e.jsx(v,{size:18})}),e.jsx("h3",{className:"font-semibold text-foreground",children:s.name})]}),e.jsx(b,{size:16,className:"text-muted-foreground/45"})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-3",children:[e.jsx(l,{variant:"info",children:s.agent_type}),(o=s.platforms)==null?void 0:o.map(c=>e.jsx(l,{children:c},c))]}),e.jsxs("div",{className:"mt-4 flex items-center justify-between rounded-[16px] bg-black/[0.035] px-3 py-2 text-xs text-muted-foreground dark:bg-white/[0.05]",children:[e.jsxs("span",{children:[s.sessions_count," ",t("nav.sessions").toLowerCase()]}),s.heartbeat_enabled&&e.jsxs("span",{className:"flex items-center gap-1 text-primary",children:[e.jsx(y,{size:12})," ",t("heartbeat.title")]})]})]})},s.name)})})]})}export{C as default};
@@ -1,4 +1,4 @@
1
- import{c as jn,A as he,aP as Y,j as S,r as p,g as vt}from"./index-C4ZGOKQv.js";import{c as ct,a as Je,r as lt,P as z,u as J,b as kt,d as yt,e as at,f as $,g as kn,h as Hn,i as Vn,R as Bn,F as Wn,D as Fn}from"./index-CbvYBkud.js";import{C as St}from"./chevron-down-C43oRpZM.js";import{C as $n}from"./check-DS7qvqek.js";/**
1
+ import{c as jn,A as he,aO as Y,j as S,r as p,g as vt}from"./index-C581X81v.js";import{c as ct,a as Je,r as lt,P as z,u as J,b as kt,d as yt,e as at,f as $,g as kn,h as Hn,i as Vn,R as Bn,F as Wn,D as Fn}from"./index-DeTNhSbD.js";import{C as St}from"./chevron-down-B9G43XLT.js";import{C as $n}from"./check-BSAurnOI.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{u as C,E as z,r,j as e,L as S,B as g,g as b,T as B}from"./index-C4ZGOKQv.js";import{B as j}from"./Badge-DpYXv6XT.js";import{g as E,a as L}from"./sessions-ChGwwlqi.js";import{C as A,A as I}from"./ChatMarkdown-DZgHg5zH.js";import{A as M}from"./arrow-left-455KUtQh.js";import{C as R}from"./circle-aYyg1o0e.js";import{W as y,R as T}from"./wifi-off-5-ojceU3.js";import{B as U}from"./bot-D0cidv6D.js";import{U as W}from"./user-mhOSrZ1d.js";import"./check-DS7qvqek.js";function J(){var p;const{t:a}=C(),{project:i,id:l}=z(),[s,v]=r.useState(null),[d,m]=r.useState(""),[c,x]=r.useState(!1),[w,f]=r.useState(!0),u=r.useRef(null),o=r.useCallback(async()=>{if(!(!i||!l))try{f(!0);const t=await E(i,l,200);v(t)}finally{f(!1)}},[i,l]);r.useEffect(()=>{o()},[o]),r.useEffect(()=>{var t;(t=u.current)==null||t.scrollIntoView({behavior:"smooth"})},[s==null?void 0:s.history]);const h=async()=>{if(!d.trim()||!i||!s)return;const t=d.trim();m(""),x(!0);try{await L(i,{session_key:s.session_key,message:t}),setTimeout(o,1500)}finally{x(!1)}},N=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),h())};return w&&!s?e.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground animate-pulse",children:"Loading..."}):e.jsxs("div",{className:"flex flex-col h-[calc(100vh-8rem)] animate-fade-in",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-200/80 pb-4 dark:border-white/[0.08]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{to:"/sessions",className:"p-2 rounded-md hover:bg-accent/10 transition-colors",children:e.jsx(M,{size:18,className:"text-muted-foreground"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-[1.4rem] font-semibold text-foreground",children:(s==null?void 0:s.name)||l}),s!=null&&s.live?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] text-primary",children:[e.jsx(R,{size:5,className:"fill-current"})," live"]}):e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded-full",children:[e.jsx(y,{size:9})," ",a("sessions.offline")]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx(j,{children:i}),(s==null?void 0:s.platform)&&e.jsx(j,{variant:"info",children:s.platform}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s==null?void 0:s.session_key})]})]})]}),e.jsxs(g,{size:"sm",variant:"ghost",onClick:o,children:[e.jsx(T,{size:14})," ",a("common.refresh")]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-6",children:[(!(s!=null&&s.history)||s.history.length===0)&&e.jsx("p",{className:"text-center text-sm text-muted-foreground py-12",children:a("sessions.noMessages")}),e.jsx("div",{className:"mx-auto max-w-4xl space-y-5",children:(p=s==null?void 0:s.history)==null?void 0:p.map((t,k)=>{const n=t.role==="user";return e.jsxs("div",{className:b("flex gap-3",n?"justify-end":"justify-start"),children:[!n&&e.jsx("div",{className:"mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 dark:bg-white/[0.06]",children:e.jsx(U,{size:16,className:"text-primary"})}),e.jsx("div",{className:b("rounded-[20px] px-5 py-3.5 text-sm",n?"chat-user-glass max-w-[70%] rounded-br-sm text-slate-950 dark:text-slate-50":"max-w-[78%] rounded-bl-sm border border-slate-200 bg-[#fbfbfd] text-card-foreground dark:border-white/[0.08] dark:bg-white/[0.04]"),children:e.jsx(A,{content:t.content,isUser:n})}),n&&e.jsx("div",{className:"mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted dark:bg-white/[0.08]",children:e.jsx(W,{size:16,className:"text-muted-foreground"})})]},k)})}),e.jsx("div",{ref:u})]}),e.jsx("div",{className:"border-t pt-4",children:s!=null&&s.live?e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsxs("div",{className:"relative",children:[e.jsx(B,{value:d,onChange:t=>m(t.target.value),onKeyDown:N,placeholder:a("sessions.messageInput"),rows:2,className:"min-h-[88px] rounded-[22px] border-gray-200 bg-[#fbfbfd] px-4 pb-14 pt-3 text-[15px] leading-6 dark:border-white/[0.08] dark:bg-[rgba(255,255,255,0.04)] sm:min-h-[96px] sm:px-5 sm:pt-4",disabled:c}),e.jsx(g,{onClick:h,disabled:c||!d.trim(),size:"icon","aria-label":a("sessions.messageInput"),className:"absolute bottom-3 right-3 h-10 w-10 rounded-full bg-primary px-0 text-white shadow-none hover:bg-[#0071e3] disabled:bg-slate-300 disabled:text-white disabled:opacity-100 dark:bg-primary dark:text-white dark:hover:bg-[#2997ff] dark:disabled:bg-white/20 dark:disabled:text-white/55 sm:h-11 sm:w-11",children:c?e.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):e.jsx(I,{size:20,strokeWidth:2.2})})]})}):e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground bg-muted rounded-lg",children:[e.jsx(y,{size:14}),e.jsx("span",{children:a("sessions.notLiveHint")})]})})]})}export{J as default};
1
+ import{u as C,E as z,r,j as e,L as S,B as g,g as b,T as B}from"./index-C581X81v.js";import{B as j}from"./Badge-H0XWc7vp.js";import{g as E,a as L}from"./sessions-CefxFisH.js";import{C as A,A as I}from"./ChatMarkdown-ZnK1NWdh.js";import{A as M}from"./arrow-left-r950YY17.js";import{C as R}from"./circle-CBHOs0lN.js";import{W as y,R as T}from"./wifi-off-1dHHA2Em.js";import{B as U}from"./bot-BVfQh_eb.js";import{U as W}from"./user-ZZO21GY4.js";import"./check-BSAurnOI.js";function J(){var p;const{t:a}=C(),{project:i,id:l}=z(),[s,v]=r.useState(null),[d,m]=r.useState(""),[c,x]=r.useState(!1),[w,f]=r.useState(!0),u=r.useRef(null),o=r.useCallback(async()=>{if(!(!i||!l))try{f(!0);const t=await E(i,l,200);v(t)}finally{f(!1)}},[i,l]);r.useEffect(()=>{o()},[o]),r.useEffect(()=>{var t;(t=u.current)==null||t.scrollIntoView({behavior:"smooth"})},[s==null?void 0:s.history]);const h=async()=>{if(!d.trim()||!i||!s)return;const t=d.trim();m(""),x(!0);try{await L(i,{session_key:s.session_key,message:t}),setTimeout(o,1500)}finally{x(!1)}},N=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),h())};return w&&!s?e.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground animate-pulse",children:"Loading..."}):e.jsxs("div",{className:"flex flex-col h-[calc(100vh-8rem)] animate-fade-in",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-200/80 pb-4 dark:border-white/[0.08]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{to:"/sessions",className:"p-2 rounded-md hover:bg-accent/10 transition-colors",children:e.jsx(M,{size:18,className:"text-muted-foreground"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-[1.4rem] font-semibold text-foreground",children:(s==null?void 0:s.name)||l}),s!=null&&s.live?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] text-primary",children:[e.jsx(R,{size:5,className:"fill-current"})," live"]}):e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded-full",children:[e.jsx(y,{size:9})," ",a("sessions.offline")]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx(j,{children:i}),(s==null?void 0:s.platform)&&e.jsx(j,{variant:"info",children:s.platform}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s==null?void 0:s.session_key})]})]})]}),e.jsxs(g,{size:"sm",variant:"ghost",onClick:o,children:[e.jsx(T,{size:14})," ",a("common.refresh")]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-6",children:[(!(s!=null&&s.history)||s.history.length===0)&&e.jsx("p",{className:"text-center text-sm text-muted-foreground py-12",children:a("sessions.noMessages")}),e.jsx("div",{className:"mx-auto max-w-4xl space-y-5",children:(p=s==null?void 0:s.history)==null?void 0:p.map((t,k)=>{const n=t.role==="user";return e.jsxs("div",{className:b("flex gap-3",n?"justify-end":"justify-start"),children:[!n&&e.jsx("div",{className:"mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 dark:bg-white/[0.06]",children:e.jsx(U,{size:16,className:"text-primary"})}),e.jsx("div",{className:b("rounded-[20px] px-5 py-3.5 text-sm",n?"chat-user-glass max-w-[70%] rounded-br-sm text-slate-950 dark:text-slate-50":"max-w-[78%] rounded-bl-sm border border-slate-200 bg-[#fbfbfd] text-card-foreground dark:border-white/[0.08] dark:bg-white/[0.04]"),children:e.jsx(A,{content:t.content,isUser:n})}),n&&e.jsx("div",{className:"mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted dark:bg-white/[0.08]",children:e.jsx(W,{size:16,className:"text-muted-foreground"})})]},k)})}),e.jsx("div",{ref:u})]}),e.jsx("div",{className:"border-t pt-4",children:s!=null&&s.live?e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsxs("div",{className:"relative",children:[e.jsx(B,{value:d,onChange:t=>m(t.target.value),onKeyDown:N,placeholder:a("sessions.messageInput"),rows:2,className:"min-h-[88px] rounded-[22px] border-gray-200 bg-[#fbfbfd] px-4 pb-14 pt-3 text-[15px] leading-6 dark:border-white/[0.08] dark:bg-[rgba(255,255,255,0.04)] sm:min-h-[96px] sm:px-5 sm:pt-4",disabled:c}),e.jsx(g,{onClick:h,disabled:c||!d.trim(),size:"icon","aria-label":a("sessions.messageInput"),className:"absolute bottom-3 right-3 h-10 w-10 rounded-full bg-primary px-0 text-white shadow-none hover:bg-[#0071e3] disabled:bg-slate-300 disabled:text-white disabled:opacity-100 dark:bg-primary dark:text-white dark:hover:bg-[#2997ff] dark:disabled:bg-white/20 dark:disabled:text-white/55 sm:h-11 sm:w-11",children:c?e.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):e.jsx(I,{size:20,strokeWidth:2.2})})]})}):e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground bg-muted rounded-lg",children:[e.jsx(y,{size:14}),e.jsx("span",{children:a("sessions.notLiveHint")})]})})]})}export{J as default};
@@ -1 +1 @@
1
- import{u as v,r as n,j as s,M as x,L as N,C as w}from"./index-C4ZGOKQv.js";import{B as f}from"./Badge-DpYXv6XT.js";import{S as y}from"./Select-DE1pzt5p.js";import{E as _}from"./EmptyState-LMG_D0FN.js";import{P as S}from"./Page-6cEj45pt.js";import{l as C}from"./projects-BSilkED5.js";import{l as k}from"./sessions-ChGwwlqi.js";import{F as L}from"./funnel-COrEnKiW.js";import{C as M}from"./circle-aYyg1o0e.js";import{U as P}from"./user-mhOSrZ1d.js";import{B as b}from"./bot-D0cidv6D.js";import"./index-CbvYBkud.js";import"./chevron-down-C43oRpZM.js";import"./check-DS7qvqek.js";function E(t,o){if(!t)return"";const m=Date.now()-new Date(t).getTime(),i=Math.floor(m/6e4);if(i<1)return o("sessions.justNow");if(i<60)return`${i}m`;const c=Math.floor(i/60);return c<24?`${c}h`:`${Math.floor(c/24)}d`}function K(){const{t}=v(),[o,m]=n.useState([]),[i,c]=n.useState([]),[l,j]=n.useState(""),[h,u]=n.useState(!0),d=n.useCallback(async()=>{u(!0);try{const{projects:e}=await C();c(e||[]);const a=await Promise.all((e||[]).map(async r=>{try{const{sessions:g}=await k(r.name);return{project:r.name,sessions:g||[]}}catch{return{project:r.name,sessions:[]}}}));m(a)}finally{u(!1)}},[]);n.useEffect(()=>{d();const e=()=>d();return window.addEventListener("cc:refresh",e),()=>window.removeEventListener("cc:refresh",e)},[d]);const p=n.useMemo(()=>(l?o.filter(a=>a.project===l):o).flatMap(a=>a.sessions.map(r=>({...r,_project:a.project}))).sort((a,r)=>(r.updated_at||r.created_at||"").localeCompare(a.updated_at||a.created_at||"")),[o,l]);return h&&o.length===0?s.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground animate-pulse",children:"Loading..."}):s.jsxs("div",{className:"space-y-4 animate-fade-in",children:[s.jsx(S,{title:t("sessions.title"),description:"Browse recent conversations across projects."}),s.jsxs("div",{className:"app-toolbar flex items-center gap-3",children:[s.jsx(L,{size:16,className:"text-muted-foreground"}),s.jsxs(y,{value:l,onChange:e=>j(e.target.value),className:"w-auto min-w-48",children:[s.jsx("option",{value:"",children:t("sessions.allProjects")}),i.map(e=>s.jsx("option",{value:e.name,children:e.name},e.name))]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[p.length," ",t("nav.sessions").toLowerCase()]})]}),p.length===0?s.jsx(_,{message:t("sessions.noSessions"),icon:x}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-3",children:p.map(e=>s.jsx(N,{to:`/sessions/${encodeURIComponent(e._project)}/${encodeURIComponent(e.id)}`,children:s.jsxs(w,{hover:!0,className:"group app-panel relative h-full p-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(x,{size:14,className:e.live?"text-primary shrink-0":"text-muted-foreground shrink-0"}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.name||e.user_name||e.id.slice(0,8)}),e.live&&s.jsx(M,{size:5,className:"fill-primary text-primary shrink-0"})]}),s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 mt-0.5",children:E(e.updated_at||e.created_at,t)})]}),s.jsx("div",{className:"mb-2.5 min-h-[2.5rem]",children:e.last_message?s.jsxs("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:[e.last_message.role==="user"?s.jsx(P,{size:10,className:"inline mr-1 -mt-0.5 opacity-60"}):s.jsx(b,{size:10,className:"inline mr-1 -mt-0.5 opacity-60"}),e.last_message.content.replace(/\n/g," ").slice(0,100)]}):s.jsx("p",{className:"text-xs text-muted-foreground italic",children:t("sessions.noMessages")})}),s.jsxs("div",{className:"mt-3 flex items-center gap-1.5 flex-wrap rounded-[16px] bg-black/[0.035] px-3 py-2 dark:bg-white/[0.05]",children:[s.jsx(f,{children:e._project}),e.platform&&s.jsx(f,{variant:"info",children:e.platform}),s.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[e.history_count," msgs"]})]})]})},`${e._project}-${e.id}`))})]})}export{K as default};
1
+ import{u as v,r as n,j as s,M as x,L as N,C as w}from"./index-C581X81v.js";import{B as f}from"./Badge-H0XWc7vp.js";import{S as y}from"./Select-DGCo_gYI.js";import{E as _}from"./EmptyState-Ci2bjyET.js";import{P as S}from"./Page-CodHoUwH.js";import{l as C}from"./projects-D2hAJzY0.js";import{l as k}from"./sessions-CefxFisH.js";import{F as L}from"./funnel-UDX21Ev4.js";import{C as M}from"./circle-CBHOs0lN.js";import{U as P}from"./user-ZZO21GY4.js";import{B as b}from"./bot-BVfQh_eb.js";import"./index-DeTNhSbD.js";import"./chevron-down-B9G43XLT.js";import"./check-BSAurnOI.js";function E(t,o){if(!t)return"";const m=Date.now()-new Date(t).getTime(),i=Math.floor(m/6e4);if(i<1)return o("sessions.justNow");if(i<60)return`${i}m`;const c=Math.floor(i/60);return c<24?`${c}h`:`${Math.floor(c/24)}d`}function K(){const{t}=v(),[o,m]=n.useState([]),[i,c]=n.useState([]),[l,j]=n.useState(""),[h,u]=n.useState(!0),d=n.useCallback(async()=>{u(!0);try{const{projects:e}=await C();c(e||[]);const a=await Promise.all((e||[]).map(async r=>{try{const{sessions:g}=await k(r.name);return{project:r.name,sessions:g||[]}}catch{return{project:r.name,sessions:[]}}}));m(a)}finally{u(!1)}},[]);n.useEffect(()=>{d();const e=()=>d();return window.addEventListener("cc:refresh",e),()=>window.removeEventListener("cc:refresh",e)},[d]);const p=n.useMemo(()=>(l?o.filter(a=>a.project===l):o).flatMap(a=>a.sessions.map(r=>({...r,_project:a.project}))).sort((a,r)=>(r.updated_at||r.created_at||"").localeCompare(a.updated_at||a.created_at||"")),[o,l]);return h&&o.length===0?s.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground animate-pulse",children:"Loading..."}):s.jsxs("div",{className:"space-y-4 animate-fade-in",children:[s.jsx(S,{title:t("sessions.title"),description:"Browse recent conversations across projects."}),s.jsxs("div",{className:"app-toolbar flex items-center gap-3",children:[s.jsx(L,{size:16,className:"text-muted-foreground"}),s.jsxs(y,{value:l,onChange:e=>j(e.target.value),className:"w-auto min-w-48",children:[s.jsx("option",{value:"",children:t("sessions.allProjects")}),i.map(e=>s.jsx("option",{value:e.name,children:e.name},e.name))]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[p.length," ",t("nav.sessions").toLowerCase()]})]}),p.length===0?s.jsx(_,{message:t("sessions.noSessions"),icon:x}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-3",children:p.map(e=>s.jsx(N,{to:`/sessions/${encodeURIComponent(e._project)}/${encodeURIComponent(e.id)}`,children:s.jsxs(w,{hover:!0,className:"group app-panel relative h-full p-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(x,{size:14,className:e.live?"text-primary shrink-0":"text-muted-foreground shrink-0"}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.name||e.user_name||e.id.slice(0,8)}),e.live&&s.jsx(M,{size:5,className:"fill-primary text-primary shrink-0"})]}),s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 mt-0.5",children:E(e.updated_at||e.created_at,t)})]}),s.jsx("div",{className:"mb-2.5 min-h-[2.5rem]",children:e.last_message?s.jsxs("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:[e.last_message.role==="user"?s.jsx(P,{size:10,className:"inline mr-1 -mt-0.5 opacity-60"}):s.jsx(b,{size:10,className:"inline mr-1 -mt-0.5 opacity-60"}),e.last_message.content.replace(/\n/g," ").slice(0,100)]}):s.jsx("p",{className:"text-xs text-muted-foreground italic",children:t("sessions.noMessages")})}),s.jsxs("div",{className:"mt-3 flex items-center gap-1.5 flex-wrap rounded-[16px] bg-black/[0.035] px-3 py-2 dark:bg-white/[0.05]",children:[s.jsx(f,{children:e._project}),e.platform&&s.jsx(f,{variant:"info",children:e.platform}),s.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[e.history_count," msgs"]})]})]})},`${e._project}-${e.id}`))})]})}export{K as default};
@@ -1,4 +1,4 @@
1
- import{c as fe,j as t,g as Y,B as X,r as o,W as vt,h as Oe,I as _e,T as Nt,i as Ve,k as Ct,m as St,l as Mt,s as Kt,n as Je,o as Ae,p as ze,q as Xe,t as Lt,v as _t,w as At,x as zt,y as It,z as Pt}from"./index-C4ZGOKQv.js";import{n as Tt,i as $t,a as Ee,b as Dt,s as Bt,w as Me}from"./desktop-JQkhNOF4.js";import{C as Ut,A as Ot}from"./ChatMarkdown-DZgHg5zH.js";import{C as Ye}from"./check-DS7qvqek.js";import{C as ve}from"./circle-aYyg1o0e.js";import{B as Et}from"./bot-D0cidv6D.js";import{U as Rt}from"./user-mhOSrZ1d.js";import{C as Ft}from"./chevron-down-C43oRpZM.js";import{S as Ht}from"./shield-check-BRY90_8q.js";import{s as Wt,g as Vt,o as Jt,b as Xt,u as Yt}from"./desktop-CqHMtdOi.js";import{t as Gt,L as Ke}from"./session-utils-CZHYpZpR.js";import{R as Qt,W as Zt}from"./wifi-off-5-ojceU3.js";import{X as Ge,M as Re}from"./Modal-Dn_4NhR5.js";import{S as qt}from"./search-RCAjElg9.js";import{P as er}from"./pencil-DR14wZjZ.js";import{T as tr}from"./trash-2-CwTS-NZu.js";import"./index-CbvYBkud.js";/**
1
+ import{c as fe,j as t,g as Y,B as X,r as o,W as vt,h as Oe,I as _e,T as Nt,i as Ve,k as Ct,m as St,l as Mt,s as Kt,n as Je,o as Ae,p as ze,q as Xe,t as Lt,v as _t,w as At,x as zt,y as It,z as Pt}from"./index-C581X81v.js";import{n as Tt,i as $t,a as Ee,b as Dt,s as Bt,w as Me}from"./desktop-JQkhNOF4.js";import{C as Ut,A as Ot}from"./ChatMarkdown-ZnK1NWdh.js";import{C as Ye}from"./check-BSAurnOI.js";import{C as ve}from"./circle-CBHOs0lN.js";import{B as Et}from"./bot-BVfQh_eb.js";import{U as Rt}from"./user-ZZO21GY4.js";import{C as Ft}from"./chevron-down-B9G43XLT.js";import{S as Ht}from"./shield-check-Bl-k8F5V.js";import{s as Wt,g as Vt,o as Jt,b as Xt,u as Yt}from"./desktop-CXcNupTW.js";import{t as Gt,L as Ke}from"./session-utils-oB-uPAPg.js";import{R as Qt,W as Zt}from"./wifi-off-1dHHA2Em.js";import{X as Ge,M as Re}from"./Modal-O77lsvJu.js";import{S as qt}from"./search-CxscB_CP.js";import{P as er}from"./pencil-BFLsShcu.js";import{T as tr}from"./trash-2-DvmnFiu7.js";import"./index-DeTNhSbD.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as ft,A as D,j as t,B as T,F as Wt,I as L,S as Kt,y as Xt,r as S}from"./index-C4ZGOKQv.js";import{M as it}from"./Modal-Dn_4NhR5.js";import{S as Z}from"./Select-DE1pzt5p.js";import{E as Oe}from"./EmptyState-LMG_D0FN.js";import{S as gt,a as Pe,P as qt}from"./Page-6cEj45pt.js";import{c as Jt,d as Zt,e as es,t as ts,f as Ne,h as ss,i as as,j as ns,k as rs,m as os,n as is,p as lt}from"./desktop-CqHMtdOi.js";import{c as pt,D as ze,d as ls,e as De,f as Me,g as Ae,h as cs,j as ct,k as dt,l as ds}from"./desktop-JQkhNOF4.js";import{T as Te}from"./trash-2-CwTS-NZu.js";import{P as Ce}from"./plus-Bswb_LiK.js";import{B as ms}from"./bot-D0cidv6D.js";import{P as us,S as we}from"./save-CKgtUije.js";import"./index-CbvYBkud.js";import"./chevron-down-C43oRpZM.js";import"./check-DS7qvqek.js";/**
1
+ import{c as ft,A as D,j as t,B as T,F as Wt,I as L,S as Kt,y as Xt,r as S}from"./index-C581X81v.js";import{M as it}from"./Modal-O77lsvJu.js";import{S as Z}from"./Select-DGCo_gYI.js";import{E as Oe}from"./EmptyState-Ci2bjyET.js";import{S as gt,a as Pe,P as qt}from"./Page-CodHoUwH.js";import{c as Jt,d as Zt,e as es,t as ts,f as Ne,h as ss,i as as,j as ns,k as rs,m as os,n as is,p as lt}from"./desktop-CXcNupTW.js";import{c as pt,D as ze,d as ls,e as De,f as Me,g as Ae,h as cs,j as ct,k as dt,l as ds}from"./desktop-JQkhNOF4.js";import{T as Te}from"./trash-2-DvmnFiu7.js";import{P as Ce}from"./plus-D8uIIQB9.js";import{B as ms}from"./bot-BVfQh_eb.js";import{P as us,S as we}from"./save-Cgx9qe4w.js";import"./index-DeTNhSbD.js";import"./chevron-down-B9G43XLT.js";import"./check-BSAurnOI.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -16,4 +16,4 @@ import{c as ft,A as D,j as t,B as T,F as Wt,I as L,S as Kt,y as Xt,r as S}from".
16
16
  * @license qrcode.react
17
17
  * Copyright (c) Paul O'Shannessy
18
18
  * SPDX-License-Identifier: ISC
19
- */var xs={L:ue.QrCode.Ecc.LOW,M:ue.QrCode.Ecc.MEDIUM,Q:ue.QrCode.Ecc.QUARTILE,H:ue.QrCode.Ecc.HIGH},bt=128,wt="L",yt="#FFFFFF",_t="#000000",Ct=!1,kt=1,vs=4,bs=0,ws=.1;function jt(s,l=0){const o=[];return s.forEach(function(m,g){let f=null;m.forEach(function(j,b){if(!j&&f!==null){o.push(`M${f+l} ${g+l}h${b-f}v1H${f+l}z`),f=null;return}if(b===m.length-1){if(!j)return;f===null?o.push(`M${b+l},${g+l} h1v1H${b+l}z`):o.push(`M${f+l},${g+l} h${b+1-f}v1H${f+l}z`);return}j&&f===null&&(f=b)})}),o.join("")}function Nt(s,l){return s.slice().map((o,m)=>m<l.y||m>=l.y+l.h?o:o.map((g,f)=>f<l.x||f>=l.x+l.w?g:!1))}function ys(s,l,o,m){if(m==null)return null;const g=s.length+o*2,f=Math.floor(l*ws),j=g/l,b=(m.width||f)*j,e=(m.height||f)*j,a=m.x==null?s.length/2-b/2:m.x*j,n=m.y==null?s.length/2-e/2:m.y*j,i=m.opacity==null?1:m.opacity;let c=null;if(m.excavate){let u=Math.floor(a),v=Math.floor(n),_=Math.ceil(b+a-u),p=Math.ceil(e+n-v);c={x:u,y:v,w:_,h:p}}const h=m.crossOrigin;return{x:a,y:n,h:e,w:b,excavation:c,opacity:i,crossOrigin:h}}function _s(s,l){return l!=null?Math.max(Math.floor(l),0):s?vs:bs}function Et({value:s,level:l,minVersion:o,includeMargin:m,marginSize:g,imageSettings:f,size:j,boostLevel:b}){let e=D.useMemo(()=>{const u=(Array.isArray(s)?s:[s]).reduce((v,_)=>(v.push(...ue.QrSegment.makeSegments(_)),v),[]);return ue.QrCode.encodeSegments(u,xs[l],o,void 0,void 0,b)},[s,l,o,b]);const{cells:a,margin:n,numCells:i,calculatedImageSettings:c}=D.useMemo(()=>{let h=e.getModules();const u=_s(m,g),v=h.length+u*2,_=ys(h,j,u,f);return{cells:h,margin:u,numCells:v,calculatedImageSettings:_}},[e,j,f,m,g]);return{qrcode:e,margin:n,cells:a,numCells:i,calculatedImageSettings:c}}var Cs=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),ks=D.forwardRef(function(l,o){const m=l,{value:g,size:f=bt,level:j=wt,bgColor:b=yt,fgColor:e=_t,includeMargin:a=Ct,minVersion:n=kt,boostLevel:i,marginSize:c,imageSettings:h}=m,v=Ie(m,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:_}=v,p=Ie(v,["style"]),P=h==null?void 0:h.src,w=D.useRef(null),A=D.useRef(null),$=D.useCallback(V=>{w.current=V,typeof o=="function"?o(V):o&&(o.current=V)},[o]),[W,C]=D.useState(!1),{margin:Q,cells:ie,numCells:q,calculatedImageSettings:G}=Et({value:g,level:j,minVersion:n,boostLevel:i,includeMargin:a,marginSize:c,imageSettings:h,size:f});D.useEffect(()=>{if(w.current!=null){const V=w.current,H=V.getContext("2d");if(!H)return;let M=ie;const J=A.current,te=G!=null&&J!==null&&J.complete&&J.naturalHeight!==0&&J.naturalWidth!==0;te&&G.excavation!=null&&(M=Nt(ie,G.excavation));const he=window.devicePixelRatio||1;V.height=V.width=f*he;const fe=f/q*he;H.scale(fe,fe),H.fillStyle=b,H.fillRect(0,0,q,q),H.fillStyle=e,Cs?H.fill(new Path2D(jt(M,Q))):ie.forEach(function(se,K){se.forEach(function(y,ce){y&&H.fillRect(ce+Q,K+Q,1,1)})}),G&&(H.globalAlpha=G.opacity),te&&H.drawImage(J,G.x+Q,G.y+Q,G.w,G.h)}}),D.useEffect(()=>{C(!1)},[P]);const pe=Re({height:f,width:f},_);let le=null;return P!=null&&(le=D.createElement("img",{src:P,key:P,style:{display:"none"},onLoad:()=>{C(!0)},ref:A,crossOrigin:G==null?void 0:G.crossOrigin})),D.createElement(D.Fragment,null,D.createElement("canvas",Re({style:pe,height:f,width:f,ref:$,role:"img"},p)),le)});ks.displayName="QRCodeCanvas";var Le=D.forwardRef(function(l,o){const m=l,{value:g,size:f=bt,level:j=wt,bgColor:b=yt,fgColor:e=_t,includeMargin:a=Ct,minVersion:n=kt,boostLevel:i,title:c,marginSize:h,imageSettings:u}=m,v=Ie(m,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:_,cells:p,numCells:P,calculatedImageSettings:w}=Et({value:g,level:j,minVersion:n,boostLevel:i,includeMargin:a,marginSize:h,imageSettings:u,size:f});let A=p,$=null;u!=null&&w!=null&&(w.excavation!=null&&(A=Nt(p,w.excavation)),$=D.createElement("image",{href:u.src,height:w.h,width:w.w,x:w.x+_,y:w.y+_,preserveAspectRatio:"none",opacity:w.opacity,crossOrigin:w.crossOrigin}));const W=jt(A,_);return D.createElement("svg",Re({height:f,width:f,viewBox:`0 0 ${P} ${P}`,ref:o,role:"img"},v),!!c&&D.createElement("title",null,c),D.createElement("path",{fill:b,d:`M0,0 h${P}v${P}H0z`,shapeRendering:"crispEdges"}),D.createElement("path",{fill:e,d:W,shapeRendering:"crispEdges"}),$)});Le.displayName="QRCodeSVG";const ee="__custom__",Ee=["weixin","lark"],Fe=[{id:"openai",label:"OpenAI",name:"openai",base_url:"https://api.openai.com/v1",model:"gpt-4.1-mini"},{id:"openrouter",label:"OpenRouter",name:"openrouter",base_url:"https://openrouter.ai/api/v1",model:"openai/gpt-4.1-mini"},{id:"anthropic",label:"Anthropic",name:"anthropic",base_url:"https://api.anthropic.com/v1",model:"claude-3-5-haiku-latest"},{id:"deepseek",label:"DeepSeek",name:"deepseek",base_url:"https://api.deepseek.com",model:"deepseek-v4-flash"},{id:"minimax",label:"Minimax",name:"minimax",base_url:"https://api.minimax.chat/v1",model:"MiniMax-M2.5"},{id:"ollama",label:"Ollama",name:"ollama",base_url:"http://127.0.0.1:11434/v1",model:"qwen2.5-coder:7b"}],z={runtime_image_id:De("pi").id,server_url:"http://127.0.0.1:8080",image:"agentdock/pi-acp:local",api_key_env:"OPEN_SANDBOX_API_KEY",acp_port:"8080",state_scope:"project",timeout_seconds:"7200",sandbox_lifecycle:"per_thread",idle_seconds:"900",warm_pool_size:"0",cpu:"1000m",memory:"2Gi",workspace_mount_path:"/workspace",state_mount_path:"/agent-state"};function U(s){return JSON.parse(JSON.stringify(s))}function me(s){return Array.isArray(s.projects)||(s.projects=[]),s.projects}function js(s){const l=new Set(s.map(m=>m.name).filter(Boolean));let o=s.length+1;for(;l.has(`project-${o}`);)o+=1;return{name:`project-${o}`,agentType:ls,workDir:"",model:""}}function ge(s){var l,o,m,g;return{...s,agent:{...s.agent,options:{...((l=s.agent)==null?void 0:l.options)||{},model:pt((o=s.agent)==null?void 0:o.type,String(((g=(m=s.agent)==null?void 0:m.options)==null?void 0:g.model)||""))}},platforms:s.platforms||[]}}function ye(s){return{id:s.id,name:s.name,api_key:s.api_key||"",base_url:s.base_url||"",model:s.model||"",models:s.models||[],thinking:s.thinking||"",env:s.env||{}}}function St(s,l){return l.includes(s)?s:ee}function Ns(s){var l;return((l=Fe.find(o=>s.name===o.name||o.base_url&&s.base_url===o.base_url||o.model&&s.model===o.model&&s.name===o.name))==null?void 0:l.id)||ee}function Es(s,l){const o=Fe.find(m=>m.id===l);return o?{...s,name:o.name,base_url:o.base_url,model:o.model}:s}function Se(s="weixin"){var l;return{type:s,options:{instance_id:`${s}-${((l=crypto.randomUUID)==null?void 0:l.call(crypto))||Date.now().toString(36)}`}}}function re(s){var l;return String(((l=s==null?void 0:s.options)==null?void 0:l.instance_id)||"").trim()||"default"}function be(s){const l=s.type==="feishu"?"lark":s.type,o=s.options&&typeof s.options=="object"?{...s.options}:{};return l==="weixin"?{type:l,options:{...o,instance_id:String(o.instance_id||"").trim()}}:l==="lark"?{type:l,options:{...o,instance_id:String(o.instance_id||"").trim(),app_id:String(o.app_id||"").trim(),app_secret:String(o.app_secret||"").trim(),card_actions:o.card_actions===!0}}:{type:l,options:o}}function Ss(s){var l;if(s.type==="weixin")return"WeChat QR login";if(s.type==="lark"){const o=String(((l=s.options)==null?void 0:l.app_id)||"").trim();return o?`App ID ${o}`:"App ID and secret required"}return"Custom platform"}function Pt(s){var m,g;const l=String(((g=(m=s.agent)==null?void 0:m.options)==null?void 0:g.work_dir)||"").trim();return l?l.replace(/\/+$/,"").split("/").filter(Boolean).pop()||l:"No work directory"}function Ps(s){return s==="success"?"border-primary/20 bg-primary/10 text-primary dark:border-primary/25 dark:bg-primary/10 dark:text-blue-200":s==="warning"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-200":"border-red-200 bg-red-50 text-red-700 dark:border-red-400/20 dark:bg-red-500/10 dark:text-red-200"}function ht(s){return{enabled:!!(s!=null&&s.enabled),provider_id:(s==null?void 0:s.provider_id)||ze,runtime_image_id:(s==null?void 0:s.runtime_image_id)||z.runtime_image_id,server_url:(s==null?void 0:s.server_url)||z.server_url,image:(s==null?void 0:s.image)||z.image,api_key_env:(s==null?void 0:s.api_key_env)||z.api_key_env,acp_port:String((s==null?void 0:s.acp_port)||z.acp_port),state_scope:(s==null?void 0:s.state_scope)||z.state_scope,timeout_seconds:String((s==null?void 0:s.timeout_seconds)||z.timeout_seconds),sandbox_lifecycle:(s==null?void 0:s.sandbox_lifecycle)||z.sandbox_lifecycle,idle_seconds:String((s==null?void 0:s.idle_seconds)||z.idle_seconds),warm_pool_size:String((s==null?void 0:s.warm_pool_size)??z.warm_pool_size),cpu:(s==null?void 0:s.cpu)||z.cpu,memory:(s==null?void 0:s.memory)||z.memory,workspace_mount_path:(s==null?void 0:s.workspace_mount_path)||z.workspace_mount_path,state_mount_path:(s==null?void 0:s.state_mount_path)||z.state_mount_path}}function Ms(s){return{enabled:s.enabled,provider_id:s.provider_id.trim()||ze,runtime_image_id:s.runtime_image_id.trim()||z.runtime_image_id,state_scope:s.state_scope,timeout_seconds:Number(s.timeout_seconds)||Number(z.timeout_seconds),sandbox_lifecycle:s.sandbox_lifecycle,idle_seconds:Number(s.idle_seconds)||Number(z.idle_seconds),warm_pool_size:Math.max(0,Number(s.warm_pool_size)||0),cpu:s.cpu.trim()||z.cpu,memory:s.memory.trim()||z.memory}}function As({projects:s,selectedIndex:l,onAddProject:o,onSelectProject:m,onRemoveProject:g}){return t.jsx(gt,{title:"项目",actions:t.jsxs(T,{size:"sm",onClick:o,children:[t.jsx(Ce,{size:14})," 新建项目"]}),className:"app-panel lg:self-start",children:s.length===0?t.jsx(Oe,{message:"还没有项目。"}):t.jsx("div",{className:"space-y-2",children:s.map((f,j)=>{var b,e;return t.jsxs("div",{className:`flex items-center justify-between gap-2 ${j===l?"app-list-row app-list-row-active":"app-list-row"}`,children:[t.jsxs("button",{type:"button",onClick:()=>m(j,f),className:"min-w-0 flex-1 text-left",children:[t.jsx("p",{className:"truncate text-sm font-medium text-slate-950 dark:text-white",children:f.name||`Project ${j+1}`}),t.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[((b=f.agent)==null?void 0:b.type)||"unknown"," · ",Pt(f)," · ",((e=f.platforms)==null?void 0:e.length)||0," platforms"]})]}),t.jsx(T,{variant:"ghost",size:"sm",className:"app-icon-button shrink-0",onClick:()=>g(j,f),"aria-label":`Remove ${f.name}`,children:t.jsx(Te,{size:14})})]},`${f.name}-${j}`)})})})}function Rs({project:s,sandbox:l}){var o,m;return t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-4",children:[t.jsxs("div",{className:"app-surface p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(ms,{size:14})," Agent"]}),t.jsx("p",{className:"mt-2 truncate text-sm font-semibold text-foreground",children:((o=s.agent)==null?void 0:o.type)||"unknown"})]}),t.jsxs("div",{className:"app-surface p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(Wt,{size:14})," Workspace"]}),t.jsx("p",{className:"mt-2 truncate text-sm font-semibold text-foreground",children:Pt(s)})]}),t.jsxs("div",{className:"app-surface p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(us,{size:14})," Platforms"]}),t.jsxs("p",{className:"mt-2 truncate text-sm font-semibold text-foreground",children:[((m=s.platforms)==null?void 0:m.length)||0," configured"]})]}),t.jsxs("div",{className:"app-surface p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(fs,{size:14})," Sandbox"]}),t.jsx("p",{className:"mt-2 truncate text-sm font-semibold text-foreground",children:l.enabled?"Cloud enabled":"Local runtime"})]})]})}function Is({project:s,updateProject:l}){var o,m,g,f,j,b;return t.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[t.jsx(L,{label:"Project name",value:s.name,onChange:e=>l(a=>({...a,name:e.target.value}))}),t.jsxs(Z,{label:"Agent type",value:St(((o=s.agent)==null?void 0:o.type)||"",Me),onChange:e=>l(a=>{var i;const n=e.target.value===ee?a.agent.type:e.target.value;return{...a,agent:{...a.agent,type:n,options:{...a.agent.options||{},model:pt(n,String(((i=a.agent.options)==null?void 0:i.model)||""))}}}}),children:[Me.map(e=>t.jsx("option",{value:e,children:e},e)),t.jsx("option",{value:ee,children:"custom"})]}),t.jsx(L,{label:"Host workspace path",value:String(((g=(m=s.agent)==null?void 0:m.options)==null?void 0:g.work_dir)||""),onChange:e=>l(a=>({...a,agent:{...a.agent,options:{...a.agent.options||{},work_dir:e.target.value}}}))}),t.jsx(L,{label:"Default model",value:String(((j=(f=s.agent)==null?void 0:f.options)==null?void 0:j.model)||""),onChange:e=>l(a=>({...a,agent:{...a.agent,options:{...a.agent.options||{},model:e.target.value}}})),placeholder:Ae((b=s.agent)==null?void 0:b.type)||"Use agent default model"})]})}function Ls({project:s,modelProviders:l,providerDrafts:o,updateProject:m,updateProviderDraft:g,onAddProvider:f,onSaveProvider:j,onDeleteProvider:b}){var e,a,n,i;return t.jsxs("section",{className:"space-y-3",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[t.jsxs(Z,{label:"Project provider",value:String(((a=(e=s.agent)==null?void 0:e.options)==null?void 0:a.provider_id)||""),onChange:c=>m(h=>({...h,agent:{...h.agent,options:{...h.agent.options||{},provider_id:c.target.value}}})),children:[t.jsx("option",{value:"",children:"No provider"}),l.map(c=>t.jsx("option",{value:c.id,children:c.name},c.id))]}),t.jsx(L,{label:"Model override",value:String(((i=(n=s.agent)==null?void 0:n.options)==null?void 0:i.model)||""),onChange:c=>m(h=>({...h,agent:{...h.agent,options:{...h.agent.options||{},model:c.target.value}}})),placeholder:"Use provider default model"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-slate-950 dark:text-white",children:"Shared providers"}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Providers are shared and selected by projects."})]}),t.jsxs(T,{size:"sm",variant:"secondary",onClick:f,children:[t.jsx(Ce,{size:14})," Add provider"]})]}),l.length===0?t.jsx("div",{className:"rounded-xl border border-black/10 px-4 py-4 text-sm text-muted-foreground dark:border-white/[0.08]",children:"No shared providers configured."}):t.jsx("div",{className:"space-y-3",children:l.map(c=>{const h=o[c.id]||ye(c);return t.jsx("div",{className:"app-surface p-4",children:t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[t.jsxs(Z,{label:"Preset",value:Ns(h),onChange:u=>{u.target.value!==ee&&g(c.id,v=>Es(v,u.target.value))},children:[Fe.map(u=>t.jsx("option",{value:u.id,children:u.label},u.id)),t.jsx("option",{value:ee,children:"custom"})]}),t.jsx(L,{label:"Name",value:h.name||"",onChange:u=>g(c.id,v=>({...v,name:u.target.value}))}),t.jsx(L,{label:"API key",type:"password",value:h.api_key||"",onChange:u=>g(c.id,v=>({...v,api_key:u.target.value}))}),t.jsx(L,{label:"Base URL",value:h.base_url||"",onChange:u=>g(c.id,v=>({...v,base_url:u.target.value}))}),t.jsx(L,{label:"Default model",value:h.model||"",onChange:u=>g(c.id,v=>({...v,model:u.target.value}))}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsxs(T,{variant:"secondary",size:"sm",onClick:()=>j(c.id),children:[t.jsx(we,{size:14})," Save"]}),t.jsxs(T,{variant:"danger",size:"sm",onClick:()=>b(c.id),children:[t.jsx(Te,{size:14})," Remove"]})]})]})},c.id)})})]})}function Os({project:s,updateProject:l,onOpenPlatformDialog:o}){return t.jsxs("section",{className:"space-y-3",children:[t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-slate-950 dark:text-white",children:"Platforms"}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Configure each platform with its own required connection fields."})]}),t.jsxs(T,{size:"sm",variant:"secondary",onClick:()=>o(null),children:[t.jsx(Ce,{size:14})," Platform"]})]}),(s.platforms||[]).length===0?t.jsx(Oe,{message:"No platforms configured."}):t.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:(s.platforms||[]).map((m,g)=>t.jsxs("div",{className:"app-list-row flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-medium text-slate-950 dark:text-white",children:m.type}),t.jsx("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:Ss(m)})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(T,{variant:"secondary",size:"sm",className:"app-icon-button",onClick:()=>o(g),"aria-label":`Configure ${m.type}`,children:t.jsx(Kt,{size:14})}),t.jsx(T,{variant:"danger",size:"sm",className:"app-icon-button",onClick:()=>l(f=>{const j=[...f.platforms||[]];return j.splice(g,1),{...f,platforms:j}}),children:t.jsx(Te,{size:14})})]})]},`${m.type}-${g}`))})]})}function zs({project:s,sandbox:l,profile:o,sandboxProvider:m,runtimeImage:g,updateSandbox:f,updateDeploymentProfile:j}){return t.jsxs("section",{className:"space-y-4",children:[t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-slate-950 dark:text-white",children:"云端模式"}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"通过 OpenSandbox 为 Agent 运行启动独立容器。"})]}),t.jsx(Pe,{tone:l.enabled?"success":"neutral",children:l.enabled?"Enabled":"Local"})]}),t.jsxs("label",{className:"app-toolbar flex items-center gap-3 text-sm font-medium text-slate-950 dark:text-white",children:[t.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-black/20 dark:border-white/20",checked:l.enabled,onChange:b=>f(e=>{var a;return{...e,enabled:b.target.checked,provider_id:e.provider_id||ze,runtime_image_id:e.runtime_image_id||De(((a=s==null?void 0:s.agent)==null?void 0:a.type)||"pi").id}})}),"启用云端模式(Sandbox)"]}),l.enabled?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[t.jsx(Z,{label:"Deployment",value:o.id,onChange:b=>j(b.target.value),children:cs.map(b=>t.jsx("option",{value:b.id,children:b.label},b.id))}),t.jsxs(Z,{label:"State scope",value:l.state_scope,onChange:b=>f(e=>({...e,state_scope:b.target.value})),children:[t.jsx("option",{value:"user",children:"User"}),t.jsx("option",{value:"project",children:"Project"}),t.jsx("option",{value:"thread",children:"Thread"}),t.jsx("option",{value:"run",children:"Run"})]}),t.jsx(L,{label:"CPU",value:l.cpu,onChange:b=>f(e=>({...e,cpu:b.target.value}))}),t.jsx(L,{label:"Memory",value:l.memory,onChange:b=>f(e=>({...e,memory:b.target.value}))}),t.jsx(L,{label:"Timeout seconds",type:"number",value:l.timeout_seconds,onChange:b=>f(e=>({...e,timeout_seconds:b.target.value}))}),t.jsxs(Z,{label:"Sandbox lifecycle",value:l.sandbox_lifecycle,onChange:b=>f(e=>({...e,sandbox_lifecycle:b.target.value})),children:[t.jsx("option",{value:"per_thread",children:"Keep warm per thread"}),t.jsx("option",{value:"per_run",children:"Close after each run"})]}),t.jsx(L,{label:"Idle seconds",type:"number",value:l.idle_seconds,onChange:b=>f(e=>({...e,idle_seconds:b.target.value}))}),t.jsx(L,{label:"Warm pool",type:"number",value:l.warm_pool_size,onChange:b=>f(e=>({...e,warm_pool_size:b.target.value}))})]}),t.jsxs("div",{className:"rounded-xl border border-black/10 px-4 py-3 text-sm text-muted-foreground dark:border-white/[0.08]",children:[t.jsx("div",{className:"font-medium text-slate-950 dark:text-white",children:"当前运行配置"}),t.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 md:grid-cols-2",children:[t.jsxs("div",{children:["OpenSandbox: ",m.server_url||"not configured"]}),t.jsxs("div",{children:["Image: ",g.image]}),t.jsxs("div",{children:["ACP port: ",g.acp_port]}),t.jsxs("div",{children:["Sandbox workspace path: ",g.workspace_mount_path||o.workspaceMountPath]}),t.jsxs("div",{children:["State mount: ",g.state_mount_path||o.stateMountPath]}),t.jsxs("div",{children:["API key env: ",m.api_key_env||"OPEN_SANDBOX_API_KEY"]})]})]}),t.jsxs("details",{className:"rounded-xl border border-black/10 px-4 py-3 text-sm dark:border-white/[0.08]",children:[t.jsx("summary",{className:"cursor-pointer font-medium text-slate-950 dark:text-white",children:"Advanced"}),t.jsx("div",{className:"mt-3 text-muted-foreground",children:"Host workspace path 是 OpenSandbox 挂载源;Sandbox workspace path 是 Agent 容器内的工作目录。Core 只启动代理进程,不直接使用 host workspace path 作为代理工作目录。"})]})]}):t.jsx("div",{className:"rounded-xl border border-black/10 px-4 py-3 text-sm text-muted-foreground dark:border-white/[0.08]",children:"当前项目会继续使用本地 Agent runtime。"})]})}function Zs(){var He,Ye,Ve,We,Ke,Xe,qe,Je,Ze,et,tt,st;const[s,l]=Xt(),o=s.get("project")||"",[m,g]=S.useState(null),[f,j]=S.useState(null),[b,e]=S.useState([]),[a,n]=S.useState({}),[i,c]=S.useState(0),[h,u]=S.useState("basic"),[v,_]=S.useState(null),[p,P]=S.useState(null),[w,A]=S.useState(null),[$,W]=S.useState(!1),[C,Q]=S.useState(null),[ie,q]=S.useState(!1),[G,pe]=S.useState(!0),[le,V]=S.useState(""),[H,M]=S.useState(null),J=S.useRef(null),te=S.useRef(null),he=S.useRef(i),fe=S.useRef(""),se=S.useCallback(async(r="")=>{pe(!0);try{const[d,x]=await Promise.all([Jt(),Zt()]),k=U(d.parsed||{});if(k.projects=me(k).map(E=>ge(E)),g(k),j(U(k)),e(x.providers||[]),n(Object.fromEntries((x.providers||[]).map(E=>[E.id,ye(E)]))),r){const E=(k.projects||[]).findIndex(O=>O.name===r);c(E>=0?E:0)}}catch(d){M({tone:"error",message:d instanceof Error?d.message:String(d)})}finally{pe(!1)}},[]);S.useEffect(()=>{se(o)},[se]);const K=(m==null?void 0:m.projects)||[],y=K[i]||null,ce=ht((Ye=(He=y==null?void 0:y.agent)==null?void 0:He.options)==null?void 0:Ye.sandbox),Be=ct(String((m==null?void 0:m.deployment_profile)||"").trim()),Mt=((m==null?void 0:m.sandbox_providers)||[]).find(r=>r.id===ce.provider_id)||dt(Be.id),At=((m==null?void 0:m.sandbox_runtime_images)||[]).find(r=>r.id===ce.runtime_image_id)||De(((Ve=y==null?void 0:y.agent)==null?void 0:Ve.type)||"pi"),Ue=JSON.stringify(m||{})!==JSON.stringify(f||{});S.useEffect(()=>{J.current=m},[m]),S.useEffect(()=>{te.current=p},[p]),S.useEffect(()=>{he.current=i,fe.current=(y==null?void 0:y.name)||""},[i,y==null?void 0:y.name]),S.useEffect(()=>{if(!m||!o)return;const r=K.findIndex(d=>d.name===o);r>=0&&r!==i&&c(r)},[m,K,o,i]);const de=S.useCallback(r=>{g(d=>{if(!d)return d;const x=U(d),k=me(x),E=k[i];return E?(k[i]=ge(r(E)),x):d})},[i]),Rt=S.useCallback(r=>{de(d=>{var x;return{...d,agent:{...d.agent,options:{...d.agent.options||{},sandbox:Ms(r(ht((x=d.agent.options)==null?void 0:x.sandbox)))}}}})},[de]),It=S.useCallback(r=>{const d=ct(r);g(x=>{if(!x)return x;const k=U(x);k.deployment_profile=d.id;const E=dt(d.id),O=Array.isArray(k.sandbox_providers)?[...k.sandbox_providers]:[],B=O.findIndex(F=>F.id===E.id);return B>=0?O[B]={...O[B],server_url:E.server_url}:O.push(E),k.sandbox_providers=O,k})},[]),Lt=()=>{_(js(K))},Ot=S.useCallback((r,d)=>{n(x=>{const k=x[r];return k?{...x,[r]:d(k)}:x})},[]),zt=async()=>{try{const r=await ss({name:`provider-${b.length+1}`});e(d=>[...d,r].sort((x,k)=>x.name.localeCompare(k.name))),n(d=>({...d,[r.id]:ye(r)})),M({tone:"success",message:"Provider created."})}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}},Dt=async r=>{const d=a[r];if(d)try{const x=await as(r,d);e(k=>k.map(E=>E.id===x.id?x:E).sort((E,O)=>E.name.localeCompare(O.name))),n(k=>({...k,[x.id]:ye(x)})),M({tone:"success",message:"Provider saved."})}catch(x){M({tone:"error",message:x instanceof Error?x.message:String(x)})}},Tt=async r=>{try{await ns(r),e(d=>d.filter(x=>x.id!==r)),n(d=>{const x={...d};return delete x[r],x}),M({tone:"success",message:"Provider removed."})}catch(d){M({tone:"error",message:d instanceof Error?d.message:String(d)})}},xe=r=>{_(d=>d&&{...d,...r})},Ft=()=>{if(!v)return;const r=v.name.trim(),d=v.agentType.trim(),x=v.workDir.trim(),k=v.model.trim();if(!r||!d||!x){M({tone:"warning",message:"Project name, agent type, and work directory are required."});return}if(K.some(B=>B.name===r)){M({tone:"warning",message:`Project "${r}" already exists.`});return}const E=ge({name:r,agent:{type:d,options:{model:k||Ae(d),work_dir:x},providers:[]},platforms:[],admin_from:"",disabled_commands:[]}),O=K.length;g(B=>{const F=U(B||{});return me(F).push(E),F}),c(O),l({project:r}),_(null),M(null)},Bt=r=>{g(d=>{if(!d)return d;const x=U(d),k=me(x);return k.splice(r,1),c(Math.max(0,Math.min(r,k.length-1))),x})},Ut=r=>{var x;if(A(null),Q(null),r===null){P({index:r,draft:Se()});return}const d=(x=y==null?void 0:y.platforms)==null?void 0:x[r];d&&P({index:r,draft:U(d)})},ae=r=>{P(d=>d&&{...d,draft:r(d.draft)})},$t=()=>{if(!p)return;const r=be(p.draft);de(d=>{const x=[...d.platforms||[]];return p.index===null?x.push(r):x[p.index]=r,{...d,platforms:x}}),P(null),A(null),Q(null)},$e=async()=>{if(!p||!m)return p==null?void 0:p.draft;const r=U(m),d=me(r),x=d[i];if(!x)return p.draft;const k=[...x.platforms||[]],E=be(p.draft);p.index===null?k.push(E):k[p.index]=E,d[i]=ge({...x,platforms:k});const O=await Ne(r),B=U(O.parsed||r);return j(B),g(U(B)),P(F=>F&&{index:F.index??k.length-1,draft:E}),E},Qt=async()=>{if(!(!(y!=null&&y.name)||!m)){W(!0);try{await $e();const r=await rs(y.name,re(p==null?void 0:p.draft));A({...r,status:"wait",createdAt:Date.now()}),M(null)}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{W(!1)}}},Gt=async()=>{if(!(!(y!=null&&y.name)||!m)){q(!0);try{await $e();const r=await os(y.name,re(p==null?void 0:p.draft));Q({...r,status:"wait",createdAt:Date.now()}),M(null)}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{q(!1)}}},Ht=async()=>{if(!(!(y!=null&&y.name)||!(w!=null&&w.ticket))){W(!0);try{const r=await is(y.name,w.ticket,re(p==null?void 0:p.draft));A(d=>d&&{...d,status:r.status}),r.status==="confirmed"&&M({tone:"success",message:"WeChat QR code confirmed."})}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{W(!1)}}},Qe=S.useCallback(async(r,d)=>{const x=await es(r,d);if(x.status!=="running"||x.connected!==!0)throw new Error(x.lastError||"Lark bot credentials were saved, but the gateway is not connected yet.");const k=await ts(r,d);if(!k.success)throw new Error(k.error||"Lark bot credentials were saved, but the connection test failed.")},[]),ke=S.useCallback(async r=>{var nt,rt,ot;const d=fe.current,x=re((nt=te.current)==null?void 0:nt.draft),k=J.current;if(!k)return;const E=U(k),O=me(E),B=he.current,F=O[B];if(!F)return;const R=[...F.platforms||[]],Y=te.current,X=(Y==null?void 0:Y.index)??R.findIndex(ne=>be(ne).type==="lark"&&re(ne)===x),ve=X>=0?R[X]:(Y==null?void 0:Y.draft)||Se("lark"),je=be({...ve,type:"lark",options:{...ve.options||{},instance_id:x,app_id:r.appId,app_secret:r.appSecret,verification_token:r.verificationToken||((rt=ve.options)==null?void 0:rt.verification_token)||"",encrypt_key:r.encryptKey||((ot=ve.options)==null?void 0:ot.encrypt_key)||"",card_actions:!0,subscribed_events:"im.message.receive_v1 card.action.trigger",subscribed_callbacks:"card.action.trigger"}});X>=0?R[X]=je:R.push(je),O[B]=ge({...F,platforms:R});const Vt=await Ne(E),at=U(Vt.parsed||E);j(at),g(U(at)),P(ne=>ne&&{...ne,index:ne.index??(X>=0?X:R.length-1),draft:je}),await Qe(d,x),M({tone:"success",message:"Lark bot bound, saved, and ready to send messages."}),await se(d)},[Qe,se]),Yt=async()=>{if(!(!(y!=null&&y.name)||!(C!=null&&C.ticket)||!m)){q(!0);try{const r=await lt(y.name,C.ticket,re(p==null?void 0:p.draft));Q(d=>{var x;return d&&{...d,status:r.status,botName:(x=r.credentials)==null?void 0:x.botName}}),r.status==="confirmed"&&r.credentials?await ke(r.credentials):r.status==="expired"&&M({tone:"warning",message:"Lark QR code expired. Generate a new QR code and scan again."})}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{q(!1)}}};S.useEffect(()=>{if(!(y!=null&&y.name)||!(C!=null&&C.ticket)||(p==null?void 0:p.draft.type)!=="lark"||C.status&&!["wait","signed"].includes(C.status))return;let r=!1,d;const k=(C.createdAt||Date.now())+Math.max(C.expiresIn||0,1)*1e3,E=Math.max(3,Math.min(Number(C.interval||5)||5,15))*1e3,O=F=>{d=window.setTimeout(()=>{B()},F)},B=async()=>{var F;if(!r){if(Date.now()>=k){Q(R=>(R==null?void 0:R.ticket)===C.ticket?{...R,status:"expired"}:R),M({tone:"warning",message:"Lark QR code expired. Generate a new QR code and scan again."});return}try{const R=await lt(y.name,C.ticket,re((F=te.current)==null?void 0:F.draft));if(r)return;if(Q(Y=>{var X;return(Y==null?void 0:Y.ticket)===C.ticket?{...Y,status:R.status,botName:(X=R.credentials)==null?void 0:X.botName}:Y}),R.status==="confirmed"&&R.credentials){await ke(R.credentials);return}if(R.status==="expired"){M({tone:"warning",message:"Lark QR code expired. Generate a new QR code and scan again."});return}O(E)}catch(R){if(r)return;M({tone:"error",message:R instanceof Error?R.message:String(R)})}}};return O(Math.min(2e3,E)),()=>{r=!0,d&&window.clearTimeout(d)}},[C==null?void 0:C.createdAt,C==null?void 0:C.expiresIn,C==null?void 0:C.interval,C==null?void 0:C.status,C==null?void 0:C.ticket,p==null?void 0:p.draft.type,ke,y==null?void 0:y.name]);const Ge=async()=>{if(m){V("config");try{const r=await Ne(m);j(U(r.parsed||m)),g(U(r.parsed||m)),M({tone:"success",message:"Project changes saved."}),await se()}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{V("")}}};return G&&!m?t.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-slate-400 animate-pulse",children:"Loading workspace..."}):t.jsxs("div",{className:"space-y-6 animate-fade-in",children:[t.jsx(qt,{title:"工作区",description:"创建项目,配置 Agent、工作目录、Provider 和平台接入。"}),H?t.jsx("div",{role:"status",className:`rounded-xl border px-4 py-3 text-sm ${Ps(H.tone)}`,children:H.message}):null,Ue?t.jsxs("div",{className:"app-toolbar flex flex-col gap-3 border-amber-200 bg-amber-50 text-sm text-amber-700 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-200 sm:flex-row sm:items-center sm:justify-between",children:[t.jsx("span",{children:"You have unsaved project changes."}),t.jsxs(T,{size:"sm",onClick:()=>void Ge(),loading:le==="config",children:[t.jsx(we,{size:14})," Save changes"]})]}):null,t.jsxs("div",{className:"grid min-w-0 grid-cols-1 gap-4 lg:grid-cols-[340px_minmax(0,1fr)]",children:[t.jsx(As,{projects:K,selectedIndex:i,onAddProject:Lt,onSelectProject:(r,d)=>{c(r),l(d.name?{project:d.name}:{})},onRemoveProject:r=>Bt(r)}),t.jsx(gt,{title:(y==null?void 0:y.name)||"Project details",description:y?t.jsxs("span",{className:"break-all",children:[((We=y.agent)==null?void 0:We.type)||"unknown"," · ",String(((Xe=(Ke=y.agent)==null?void 0:Ke.options)==null?void 0:Xe.work_dir)||"No work directory")]}):void 0,className:"app-panel",children:y?t.jsxs("div",{className:"space-y-6",children:[t.jsx(Rs,{project:y,sandbox:ce}),t.jsx("div",{className:"flex gap-2 overflow-x-auto border-b border-black/10 pb-4 [scrollbar-width:none] dark:border-white/[0.08] [&::-webkit-scrollbar]:hidden sm:flex-wrap",children:[["basic","基本信息"],["providers","Provider"],["platforms","平台接入"],["sandbox","云端模式"]].map(([r,d])=>t.jsx("button",{type:"button",onClick:()=>u(r),className:`app-segment ${h===r?"app-segment-active":"app-segment-idle"}`,children:d},r))}),h==="basic"?t.jsx(Is,{project:y,updateProject:de}):null,h==="providers"?t.jsx(Ls,{project:y,modelProviders:b,providerDrafts:a,updateProject:de,updateProviderDraft:Ot,onAddProvider:()=>void zt(),onSaveProvider:r=>void Dt(r),onDeleteProvider:r=>void Tt(r)}):null,h==="platforms"?t.jsx(Os,{project:y,updateProject:de,onOpenPlatformDialog:Ut}):null,h==="sandbox"?t.jsx(zs,{project:y,sandbox:ce,profile:Be,sandboxProvider:Mt,runtimeImage:At,updateSandbox:Rt,updateDeploymentProfile:It}):null,t.jsx("div",{className:"flex flex-wrap gap-2 border-t border-black/10 pt-5 dark:border-white/[0.08]",children:t.jsxs(T,{className:"w-full sm:w-auto",onClick:()=>void Ge(),loading:le==="config",disabled:!Ue&&le!=="config",children:[t.jsx(we,{size:14})," 保存更改"]})})]}):t.jsx(Oe,{message:"选择或新建项目后开始配置。"})})]}),t.jsx(it,{open:!!v,onClose:()=>_(null),title:"新建项目",children:v?t.jsxs("div",{className:"space-y-4",children:[t.jsx(L,{label:"Project name",value:v.name,onChange:r=>xe({name:r.target.value}),autoFocus:!0}),t.jsx(Z,{label:"Agent type",value:v.agentType,onChange:r=>{const d=r.target.value;xe({agentType:d})},children:Me.map(r=>t.jsx("option",{value:r,children:r},r))}),t.jsx(L,{label:"Host workspace path",value:v.workDir,onChange:r=>xe({workDir:r.target.value}),placeholder:"/Users/yinyin/code/my-project"}),t.jsx(L,{label:"Default model",value:v.model,onChange:r=>xe({model:r.target.value}),placeholder:Ae(v.agentType)||"Use agent default model"}),t.jsxs("div",{className:"flex flex-col-reverse gap-2 pt-2 sm:flex-row sm:justify-end",children:[t.jsx(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>_(null),children:"Cancel"}),t.jsxs(T,{className:"w-full sm:w-auto",onClick:Ft,children:[t.jsx(Ce,{size:14})," 新建项目"]})]})]}):null}),t.jsx(it,{open:!!p,onClose:()=>{P(null),A(null),Q(null)},title:(p==null?void 0:p.index)===null?"Add platform":"Configure platform",children:p?t.jsxs("div",{className:"space-y-4",children:[t.jsxs(Z,{label:"Platform",value:St(p.draft.type,[...Ee]),onChange:r=>{const d=r.target.value===ee?p.draft.type:r.target.value;ae(()=>Se(d)),A(null),Q(null)},children:[Ee.map(r=>t.jsx("option",{value:r,children:r},r)),ds.filter(r=>!Ee.includes(r)).map(r=>t.jsx("option",{value:r,children:r},r)),t.jsx("option",{value:ee,children:"custom"})]}),p.draft.type==="lark"?t.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[C!=null&&C.qrCodeUrl?t.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-black/10 p-4 dark:border-white/[0.08]",children:[t.jsx("div",{className:"rounded-lg border border-black/10 bg-white p-3",children:t.jsx(Le,{value:C.qrCodeUrl,size:176,includeMargin:!0})}),t.jsx(Pe,{tone:C.status==="confirmed"?"success":C.status==="expired"?"danger":"warning",children:C.botName||C.status||"wait"})]}):null,t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap",children:[t.jsxs(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Gt(),loading:ie,children:[t.jsx(mt,{size:14})," Generate QR"]}),t.jsx(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Yt(),loading:ie,disabled:!(C!=null&&C.ticket),children:"Check status"})]}),t.jsx(L,{label:"App ID",value:String(((qe=p.draft.options)==null?void 0:qe.app_id)||""),onChange:r=>ae(d=>({...d,options:{...d.options||{},app_id:r.target.value}})),placeholder:"cli_xxx"}),t.jsx(L,{label:"App Secret",type:"password",value:String(((Je=p.draft.options)==null?void 0:Je.app_secret)||""),onChange:r=>ae(d=>({...d,options:{...d.options||{},app_secret:r.target.value}}))}),t.jsx(L,{label:"Verification token",value:String(((Ze=p.draft.options)==null?void 0:Ze.verification_token)||""),onChange:r=>ae(d=>({...d,options:{...d.options||{},verification_token:r.target.value}}))}),t.jsx(L,{label:"Encrypt key",value:String(((et=p.draft.options)==null?void 0:et.encrypt_key)||""),onChange:r=>ae(d=>({...d,options:{...d.options||{},encrypt_key:r.target.value}}))}),t.jsxs("label",{className:"flex items-center gap-3 text-sm text-foreground",children:[t.jsx("input",{type:"checkbox",checked:((tt=p.draft.options)==null?void 0:tt.auto_approve)===!0,onChange:r=>ae(d=>({...d,options:{...d.options||{},auto_approve:r.target.checked}}))}),"Auto-approve Lark users"]}),t.jsxs("label",{className:"flex items-center gap-3 text-sm text-foreground",children:[t.jsx("input",{type:"checkbox",checked:((st=p.draft.options)==null?void 0:st.card_actions)===!0,onChange:r=>ae(d=>({...d,options:{...d.options||{},card_actions:r.target.checked}}))}),"Enable Lark card action buttons"]})]}):null,p.draft.type==="weixin"?t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"rounded-lg border border-black/10 bg-black/[0.03] px-3 py-3 text-sm text-muted-foreground dark:border-white/[0.08] dark:bg-white/[0.04]",children:"WeChat does not need an App ID or secret. Save this platform, then generate a QR code and scan it to finish login."}),w!=null&&w.qrCodeUrl?t.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-black/10 p-4 dark:border-white/[0.08]",children:[t.jsx("div",{className:"rounded-lg border border-black/10 bg-white p-3",children:t.jsx(Le,{value:w.qrCodeUrl,size:176,includeMargin:!0})}),t.jsx(Pe,{tone:w.status==="confirmed"?"success":w.status==="expired"?"danger":"warning",children:w.status||"wait"})]}):null,t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap",children:[t.jsxs(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Qt(),loading:$,children:[t.jsx(mt,{size:14})," Generate QR"]}),t.jsx(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Ht(),loading:$,disabled:!(w!=null&&w.ticket),children:"Check status"})]})]}):null,p.draft.type!=="lark"&&p.draft.type!=="weixin"?t.jsx("div",{className:"rounded-lg border border-black/10 bg-black/[0.03] px-3 py-3 text-sm text-muted-foreground dark:border-white/[0.08] dark:bg-white/[0.04]",children:"This platform has no daily UI fields yet. Existing advanced options are preserved in config."}):null,t.jsxs("div",{className:"flex flex-col-reverse gap-2 border-t border-black/10 pt-4 dark:border-white/[0.08] sm:flex-row sm:justify-end",children:[t.jsx(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>P(null),children:"Cancel"}),t.jsxs(T,{className:"w-full sm:w-auto",onClick:$t,children:[t.jsx(we,{size:14})," Apply"]})]})]}):null})]})}export{Zs as default};
19
+ */var xs={L:ue.QrCode.Ecc.LOW,M:ue.QrCode.Ecc.MEDIUM,Q:ue.QrCode.Ecc.QUARTILE,H:ue.QrCode.Ecc.HIGH},bt=128,wt="L",yt="#FFFFFF",_t="#000000",Ct=!1,kt=1,vs=4,bs=0,ws=.1;function jt(s,l=0){const o=[];return s.forEach(function(m,g){let f=null;m.forEach(function(j,b){if(!j&&f!==null){o.push(`M${f+l} ${g+l}h${b-f}v1H${f+l}z`),f=null;return}if(b===m.length-1){if(!j)return;f===null?o.push(`M${b+l},${g+l} h1v1H${b+l}z`):o.push(`M${f+l},${g+l} h${b+1-f}v1H${f+l}z`);return}j&&f===null&&(f=b)})}),o.join("")}function Nt(s,l){return s.slice().map((o,m)=>m<l.y||m>=l.y+l.h?o:o.map((g,f)=>f<l.x||f>=l.x+l.w?g:!1))}function ys(s,l,o,m){if(m==null)return null;const g=s.length+o*2,f=Math.floor(l*ws),j=g/l,b=(m.width||f)*j,e=(m.height||f)*j,a=m.x==null?s.length/2-b/2:m.x*j,n=m.y==null?s.length/2-e/2:m.y*j,i=m.opacity==null?1:m.opacity;let c=null;if(m.excavate){let u=Math.floor(a),v=Math.floor(n),_=Math.ceil(b+a-u),p=Math.ceil(e+n-v);c={x:u,y:v,w:_,h:p}}const h=m.crossOrigin;return{x:a,y:n,h:e,w:b,excavation:c,opacity:i,crossOrigin:h}}function _s(s,l){return l!=null?Math.max(Math.floor(l),0):s?vs:bs}function Et({value:s,level:l,minVersion:o,includeMargin:m,marginSize:g,imageSettings:f,size:j,boostLevel:b}){let e=D.useMemo(()=>{const u=(Array.isArray(s)?s:[s]).reduce((v,_)=>(v.push(...ue.QrSegment.makeSegments(_)),v),[]);return ue.QrCode.encodeSegments(u,xs[l],o,void 0,void 0,b)},[s,l,o,b]);const{cells:a,margin:n,numCells:i,calculatedImageSettings:c}=D.useMemo(()=>{let h=e.getModules();const u=_s(m,g),v=h.length+u*2,_=ys(h,j,u,f);return{cells:h,margin:u,numCells:v,calculatedImageSettings:_}},[e,j,f,m,g]);return{qrcode:e,margin:n,cells:a,numCells:i,calculatedImageSettings:c}}var Cs=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),ks=D.forwardRef(function(l,o){const m=l,{value:g,size:f=bt,level:j=wt,bgColor:b=yt,fgColor:e=_t,includeMargin:a=Ct,minVersion:n=kt,boostLevel:i,marginSize:c,imageSettings:h}=m,v=Ie(m,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:_}=v,p=Ie(v,["style"]),P=h==null?void 0:h.src,w=D.useRef(null),A=D.useRef(null),$=D.useCallback(V=>{w.current=V,typeof o=="function"?o(V):o&&(o.current=V)},[o]),[W,C]=D.useState(!1),{margin:Q,cells:ie,numCells:q,calculatedImageSettings:G}=Et({value:g,level:j,minVersion:n,boostLevel:i,includeMargin:a,marginSize:c,imageSettings:h,size:f});D.useEffect(()=>{if(w.current!=null){const V=w.current,H=V.getContext("2d");if(!H)return;let M=ie;const J=A.current,te=G!=null&&J!==null&&J.complete&&J.naturalHeight!==0&&J.naturalWidth!==0;te&&G.excavation!=null&&(M=Nt(ie,G.excavation));const he=window.devicePixelRatio||1;V.height=V.width=f*he;const fe=f/q*he;H.scale(fe,fe),H.fillStyle=b,H.fillRect(0,0,q,q),H.fillStyle=e,Cs?H.fill(new Path2D(jt(M,Q))):ie.forEach(function(se,K){se.forEach(function(y,ce){y&&H.fillRect(ce+Q,K+Q,1,1)})}),G&&(H.globalAlpha=G.opacity),te&&H.drawImage(J,G.x+Q,G.y+Q,G.w,G.h)}}),D.useEffect(()=>{C(!1)},[P]);const pe=Re({height:f,width:f},_);let le=null;return P!=null&&(le=D.createElement("img",{src:P,key:P,style:{display:"none"},onLoad:()=>{C(!0)},ref:A,crossOrigin:G==null?void 0:G.crossOrigin})),D.createElement(D.Fragment,null,D.createElement("canvas",Re({style:pe,height:f,width:f,ref:$,role:"img"},p)),le)});ks.displayName="QRCodeCanvas";var Le=D.forwardRef(function(l,o){const m=l,{value:g,size:f=bt,level:j=wt,bgColor:b=yt,fgColor:e=_t,includeMargin:a=Ct,minVersion:n=kt,boostLevel:i,title:c,marginSize:h,imageSettings:u}=m,v=Ie(m,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:_,cells:p,numCells:P,calculatedImageSettings:w}=Et({value:g,level:j,minVersion:n,boostLevel:i,includeMargin:a,marginSize:h,imageSettings:u,size:f});let A=p,$=null;u!=null&&w!=null&&(w.excavation!=null&&(A=Nt(p,w.excavation)),$=D.createElement("image",{href:u.src,height:w.h,width:w.w,x:w.x+_,y:w.y+_,preserveAspectRatio:"none",opacity:w.opacity,crossOrigin:w.crossOrigin}));const W=jt(A,_);return D.createElement("svg",Re({height:f,width:f,viewBox:`0 0 ${P} ${P}`,ref:o,role:"img"},v),!!c&&D.createElement("title",null,c),D.createElement("path",{fill:b,d:`M0,0 h${P}v${P}H0z`,shapeRendering:"crispEdges"}),D.createElement("path",{fill:e,d:W,shapeRendering:"crispEdges"}),$)});Le.displayName="QRCodeSVG";const ee="__custom__",Ee=["weixin","lark"],Fe=[{id:"openai",label:"OpenAI",name:"openai",base_url:"https://api.openai.com/v1",model:"gpt-4.1-mini"},{id:"openrouter",label:"OpenRouter",name:"openrouter",base_url:"https://openrouter.ai/api/v1",model:"openai/gpt-4.1-mini"},{id:"anthropic",label:"Anthropic",name:"anthropic",base_url:"https://api.anthropic.com/v1",model:"claude-3-5-haiku-latest"},{id:"deepseek",label:"DeepSeek",name:"deepseek",base_url:"https://api.deepseek.com",model:"deepseek-v4-flash"},{id:"minimax",label:"Minimax",name:"minimax",base_url:"https://api.minimax.chat/v1",model:"MiniMax-M2.5"},{id:"ollama",label:"Ollama",name:"ollama",base_url:"http://127.0.0.1:11434/v1",model:"qwen2.5-coder:7b"}],z={runtime_image_id:De("pi").id,server_url:"http://127.0.0.1:8080",image:"agentdock/pi-acp:local",api_key_env:"OPEN_SANDBOX_API_KEY",acp_port:"8080",state_scope:"project",timeout_seconds:"7200",sandbox_lifecycle:"per_thread",idle_seconds:"900",warm_pool_size:"0",cpu:"1000m",memory:"2Gi",workspace_mount_path:"/workspace",state_mount_path:"/agent-state"};function U(s){return JSON.parse(JSON.stringify(s))}function me(s){return Array.isArray(s.projects)||(s.projects=[]),s.projects}function js(s){const l=new Set(s.map(m=>m.name).filter(Boolean));let o=s.length+1;for(;l.has(`project-${o}`);)o+=1;return{name:`project-${o}`,agentType:ls,workDir:"",model:""}}function ge(s){var l,o,m,g;return{...s,agent:{...s.agent,options:{...((l=s.agent)==null?void 0:l.options)||{},model:pt((o=s.agent)==null?void 0:o.type,String(((g=(m=s.agent)==null?void 0:m.options)==null?void 0:g.model)||""))}},platforms:s.platforms||[]}}function ye(s){return{id:s.id,name:s.name,api_key:s.api_key||"",base_url:s.base_url||"",model:s.model||"",models:s.models||[],thinking:s.thinking||"",env:s.env||{}}}function St(s,l){return l.includes(s)?s:ee}function Ns(s){var l;return((l=Fe.find(o=>s.name===o.name||o.base_url&&s.base_url===o.base_url||o.model&&s.model===o.model&&s.name===o.name))==null?void 0:l.id)||ee}function Es(s,l){const o=Fe.find(m=>m.id===l);return o?{...s,name:o.name,base_url:o.base_url,model:o.model}:s}function Se(s="weixin"){var l;return{type:s,options:{instance_id:`${s}-${((l=crypto.randomUUID)==null?void 0:l.call(crypto))||Date.now().toString(36)}`}}}function re(s){var l;return String(((l=s==null?void 0:s.options)==null?void 0:l.instance_id)||"").trim()||"default"}function be(s){const l=s.type==="feishu"?"lark":s.type,o=s.options&&typeof s.options=="object"?{...s.options}:{};return l==="weixin"?{type:l,options:{...o,instance_id:String(o.instance_id||"").trim()}}:l==="lark"?{type:l,options:{...o,instance_id:String(o.instance_id||"").trim(),app_id:String(o.app_id||"").trim(),app_secret:String(o.app_secret||"").trim(),card_actions:o.card_actions===!0}}:{type:l,options:o}}function Ss(s){var l;if(s.type==="weixin")return"WeChat QR login";if(s.type==="lark"){const o=String(((l=s.options)==null?void 0:l.app_id)||"").trim();return o?`App ID ${o}`:"App ID and secret required"}return"Custom platform"}function Pt(s){var m,g;const l=String(((g=(m=s.agent)==null?void 0:m.options)==null?void 0:g.work_dir)||"").trim();return l?l.replace(/\/+$/,"").split("/").filter(Boolean).pop()||l:"No work directory"}function Ps(s){return s==="success"?"border-primary/20 bg-primary/10 text-primary dark:border-primary/25 dark:bg-primary/10 dark:text-blue-200":s==="warning"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-200":"border-red-200 bg-red-50 text-red-700 dark:border-red-400/20 dark:bg-red-500/10 dark:text-red-200"}function ht(s){return{enabled:!!(s!=null&&s.enabled),provider_id:(s==null?void 0:s.provider_id)||ze,runtime_image_id:(s==null?void 0:s.runtime_image_id)||z.runtime_image_id,server_url:(s==null?void 0:s.server_url)||z.server_url,image:(s==null?void 0:s.image)||z.image,api_key_env:(s==null?void 0:s.api_key_env)||z.api_key_env,acp_port:String((s==null?void 0:s.acp_port)||z.acp_port),state_scope:(s==null?void 0:s.state_scope)||z.state_scope,timeout_seconds:String((s==null?void 0:s.timeout_seconds)||z.timeout_seconds),sandbox_lifecycle:(s==null?void 0:s.sandbox_lifecycle)||z.sandbox_lifecycle,idle_seconds:String((s==null?void 0:s.idle_seconds)||z.idle_seconds),warm_pool_size:String((s==null?void 0:s.warm_pool_size)??z.warm_pool_size),cpu:(s==null?void 0:s.cpu)||z.cpu,memory:(s==null?void 0:s.memory)||z.memory,workspace_mount_path:(s==null?void 0:s.workspace_mount_path)||z.workspace_mount_path,state_mount_path:(s==null?void 0:s.state_mount_path)||z.state_mount_path}}function Ms(s){return{enabled:s.enabled,provider_id:s.provider_id.trim()||ze,runtime_image_id:s.runtime_image_id.trim()||z.runtime_image_id,state_scope:s.state_scope,timeout_seconds:Number(s.timeout_seconds)||Number(z.timeout_seconds),sandbox_lifecycle:s.sandbox_lifecycle,idle_seconds:Number(s.idle_seconds)||Number(z.idle_seconds),warm_pool_size:Math.max(0,Number(s.warm_pool_size)||0),cpu:s.cpu.trim()||z.cpu,memory:s.memory.trim()||z.memory}}function As({projects:s,selectedIndex:l,onAddProject:o,onSelectProject:m,onRemoveProject:g}){return t.jsx(gt,{title:"项目",actions:t.jsxs(T,{size:"sm",onClick:o,children:[t.jsx(Ce,{size:14})," 新建项目"]}),className:"app-panel lg:self-start",children:s.length===0?t.jsx(Oe,{message:"还没有项目。"}):t.jsx("div",{className:"space-y-2",children:s.map((f,j)=>{var b,e;return t.jsxs("div",{className:`flex items-center justify-between gap-2 ${j===l?"app-list-row app-list-row-active":"app-list-row"}`,children:[t.jsxs("button",{type:"button",onClick:()=>m(j,f),className:"min-w-0 flex-1 text-left",children:[t.jsx("p",{className:"truncate text-sm font-medium text-slate-950 dark:text-white",children:f.name||`Project ${j+1}`}),t.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[((b=f.agent)==null?void 0:b.type)||"unknown"," · ",Pt(f)," · ",((e=f.platforms)==null?void 0:e.length)||0," platforms"]})]}),t.jsx(T,{variant:"ghost",size:"sm",className:"app-icon-button shrink-0",onClick:()=>g(j,f),"aria-label":`Remove ${f.name}`,children:t.jsx(Te,{size:14})})]},`${f.name}-${j}`)})})})}function Rs({project:s,sandbox:l}){var o,m;return t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-4",children:[t.jsxs("div",{className:"app-surface p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(ms,{size:14})," Agent"]}),t.jsx("p",{className:"mt-2 truncate text-sm font-semibold text-foreground",children:((o=s.agent)==null?void 0:o.type)||"unknown"})]}),t.jsxs("div",{className:"app-surface p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(Wt,{size:14})," Workspace"]}),t.jsx("p",{className:"mt-2 truncate text-sm font-semibold text-foreground",children:Pt(s)})]}),t.jsxs("div",{className:"app-surface p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(us,{size:14})," Platforms"]}),t.jsxs("p",{className:"mt-2 truncate text-sm font-semibold text-foreground",children:[((m=s.platforms)==null?void 0:m.length)||0," configured"]})]}),t.jsxs("div",{className:"app-surface p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(fs,{size:14})," Sandbox"]}),t.jsx("p",{className:"mt-2 truncate text-sm font-semibold text-foreground",children:l.enabled?"Cloud enabled":"Local runtime"})]})]})}function Is({project:s,updateProject:l}){var o,m,g,f,j,b;return t.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[t.jsx(L,{label:"Project name",value:s.name,onChange:e=>l(a=>({...a,name:e.target.value}))}),t.jsxs(Z,{label:"Agent type",value:St(((o=s.agent)==null?void 0:o.type)||"",Me),onChange:e=>l(a=>{var i;const n=e.target.value===ee?a.agent.type:e.target.value;return{...a,agent:{...a.agent,type:n,options:{...a.agent.options||{},model:pt(n,String(((i=a.agent.options)==null?void 0:i.model)||""))}}}}),children:[Me.map(e=>t.jsx("option",{value:e,children:e},e)),t.jsx("option",{value:ee,children:"custom"})]}),t.jsx(L,{label:"Host workspace path",value:String(((g=(m=s.agent)==null?void 0:m.options)==null?void 0:g.work_dir)||""),onChange:e=>l(a=>({...a,agent:{...a.agent,options:{...a.agent.options||{},work_dir:e.target.value}}}))}),t.jsx(L,{label:"Default model",value:String(((j=(f=s.agent)==null?void 0:f.options)==null?void 0:j.model)||""),onChange:e=>l(a=>({...a,agent:{...a.agent,options:{...a.agent.options||{},model:e.target.value}}})),placeholder:Ae((b=s.agent)==null?void 0:b.type)||"Use agent default model"})]})}function Ls({project:s,modelProviders:l,providerDrafts:o,updateProject:m,updateProviderDraft:g,onAddProvider:f,onSaveProvider:j,onDeleteProvider:b}){var e,a,n,i;return t.jsxs("section",{className:"space-y-3",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[t.jsxs(Z,{label:"Project provider",value:String(((a=(e=s.agent)==null?void 0:e.options)==null?void 0:a.provider_id)||""),onChange:c=>m(h=>({...h,agent:{...h.agent,options:{...h.agent.options||{},provider_id:c.target.value}}})),children:[t.jsx("option",{value:"",children:"No provider"}),l.map(c=>t.jsx("option",{value:c.id,children:c.name},c.id))]}),t.jsx(L,{label:"Model override",value:String(((i=(n=s.agent)==null?void 0:n.options)==null?void 0:i.model)||""),onChange:c=>m(h=>({...h,agent:{...h.agent,options:{...h.agent.options||{},model:c.target.value}}})),placeholder:"Use provider default model"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-slate-950 dark:text-white",children:"Shared providers"}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Providers are shared and selected by projects."})]}),t.jsxs(T,{size:"sm",variant:"secondary",onClick:f,children:[t.jsx(Ce,{size:14})," Add provider"]})]}),l.length===0?t.jsx("div",{className:"rounded-xl border border-black/10 px-4 py-4 text-sm text-muted-foreground dark:border-white/[0.08]",children:"No shared providers configured."}):t.jsx("div",{className:"space-y-3",children:l.map(c=>{const h=o[c.id]||ye(c);return t.jsx("div",{className:"app-surface p-4",children:t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[t.jsxs(Z,{label:"Preset",value:Ns(h),onChange:u=>{u.target.value!==ee&&g(c.id,v=>Es(v,u.target.value))},children:[Fe.map(u=>t.jsx("option",{value:u.id,children:u.label},u.id)),t.jsx("option",{value:ee,children:"custom"})]}),t.jsx(L,{label:"Name",value:h.name||"",onChange:u=>g(c.id,v=>({...v,name:u.target.value}))}),t.jsx(L,{label:"API key",type:"password",value:h.api_key||"",onChange:u=>g(c.id,v=>({...v,api_key:u.target.value}))}),t.jsx(L,{label:"Base URL",value:h.base_url||"",onChange:u=>g(c.id,v=>({...v,base_url:u.target.value}))}),t.jsx(L,{label:"Default model",value:h.model||"",onChange:u=>g(c.id,v=>({...v,model:u.target.value}))}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsxs(T,{variant:"secondary",size:"sm",onClick:()=>j(c.id),children:[t.jsx(we,{size:14})," Save"]}),t.jsxs(T,{variant:"danger",size:"sm",onClick:()=>b(c.id),children:[t.jsx(Te,{size:14})," Remove"]})]})]})},c.id)})})]})}function Os({project:s,updateProject:l,onOpenPlatformDialog:o}){return t.jsxs("section",{className:"space-y-3",children:[t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-slate-950 dark:text-white",children:"Platforms"}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Configure each platform with its own required connection fields."})]}),t.jsxs(T,{size:"sm",variant:"secondary",onClick:()=>o(null),children:[t.jsx(Ce,{size:14})," Platform"]})]}),(s.platforms||[]).length===0?t.jsx(Oe,{message:"No platforms configured."}):t.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:(s.platforms||[]).map((m,g)=>t.jsxs("div",{className:"app-list-row flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-medium text-slate-950 dark:text-white",children:m.type}),t.jsx("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:Ss(m)})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(T,{variant:"secondary",size:"sm",className:"app-icon-button",onClick:()=>o(g),"aria-label":`Configure ${m.type}`,children:t.jsx(Kt,{size:14})}),t.jsx(T,{variant:"danger",size:"sm",className:"app-icon-button",onClick:()=>l(f=>{const j=[...f.platforms||[]];return j.splice(g,1),{...f,platforms:j}}),children:t.jsx(Te,{size:14})})]})]},`${m.type}-${g}`))})]})}function zs({project:s,sandbox:l,profile:o,sandboxProvider:m,runtimeImage:g,updateSandbox:f,updateDeploymentProfile:j}){return t.jsxs("section",{className:"space-y-4",children:[t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-slate-950 dark:text-white",children:"云端模式"}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"通过 OpenSandbox 为 Agent 运行启动独立容器。"})]}),t.jsx(Pe,{tone:l.enabled?"success":"neutral",children:l.enabled?"Enabled":"Local"})]}),t.jsxs("label",{className:"app-toolbar flex items-center gap-3 text-sm font-medium text-slate-950 dark:text-white",children:[t.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-black/20 dark:border-white/20",checked:l.enabled,onChange:b=>f(e=>{var a;return{...e,enabled:b.target.checked,provider_id:e.provider_id||ze,runtime_image_id:e.runtime_image_id||De(((a=s==null?void 0:s.agent)==null?void 0:a.type)||"pi").id}})}),"启用云端模式(Sandbox)"]}),l.enabled?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[t.jsx(Z,{label:"Deployment",value:o.id,onChange:b=>j(b.target.value),children:cs.map(b=>t.jsx("option",{value:b.id,children:b.label},b.id))}),t.jsxs(Z,{label:"State scope",value:l.state_scope,onChange:b=>f(e=>({...e,state_scope:b.target.value})),children:[t.jsx("option",{value:"user",children:"User"}),t.jsx("option",{value:"project",children:"Project"}),t.jsx("option",{value:"thread",children:"Thread"}),t.jsx("option",{value:"run",children:"Run"})]}),t.jsx(L,{label:"CPU",value:l.cpu,onChange:b=>f(e=>({...e,cpu:b.target.value}))}),t.jsx(L,{label:"Memory",value:l.memory,onChange:b=>f(e=>({...e,memory:b.target.value}))}),t.jsx(L,{label:"Timeout seconds",type:"number",value:l.timeout_seconds,onChange:b=>f(e=>({...e,timeout_seconds:b.target.value}))}),t.jsxs(Z,{label:"Sandbox lifecycle",value:l.sandbox_lifecycle,onChange:b=>f(e=>({...e,sandbox_lifecycle:b.target.value})),children:[t.jsx("option",{value:"per_thread",children:"Keep warm per thread"}),t.jsx("option",{value:"per_run",children:"Close after each run"})]}),t.jsx(L,{label:"Idle seconds",type:"number",value:l.idle_seconds,onChange:b=>f(e=>({...e,idle_seconds:b.target.value}))}),t.jsx(L,{label:"Warm pool",type:"number",value:l.warm_pool_size,onChange:b=>f(e=>({...e,warm_pool_size:b.target.value}))})]}),t.jsxs("div",{className:"rounded-xl border border-black/10 px-4 py-3 text-sm text-muted-foreground dark:border-white/[0.08]",children:[t.jsx("div",{className:"font-medium text-slate-950 dark:text-white",children:"当前运行配置"}),t.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 md:grid-cols-2",children:[t.jsxs("div",{children:["OpenSandbox: ",m.server_url||"not configured"]}),t.jsxs("div",{children:["Image: ",g.image]}),t.jsxs("div",{children:["ACP port: ",g.acp_port]}),t.jsxs("div",{children:["Sandbox workspace path: ",g.workspace_mount_path||o.workspaceMountPath]}),t.jsxs("div",{children:["State mount: ",g.state_mount_path||o.stateMountPath]}),t.jsxs("div",{children:["API key env: ",m.api_key_env||"OPEN_SANDBOX_API_KEY"]})]})]}),t.jsxs("details",{className:"rounded-xl border border-black/10 px-4 py-3 text-sm dark:border-white/[0.08]",children:[t.jsx("summary",{className:"cursor-pointer font-medium text-slate-950 dark:text-white",children:"Advanced"}),t.jsx("div",{className:"mt-3 text-muted-foreground",children:"Host workspace path 是 OpenSandbox 挂载源;Sandbox workspace path 是 Agent 容器内的工作目录。Core 只启动代理进程,不直接使用 host workspace path 作为代理工作目录。"})]})]}):t.jsx("div",{className:"rounded-xl border border-black/10 px-4 py-3 text-sm text-muted-foreground dark:border-white/[0.08]",children:"当前项目会继续使用本地 Agent runtime。"})]})}function Zs(){var He,Ye,Ve,We,Ke,Xe,qe,Je,Ze,et,tt,st;const[s,l]=Xt(),o=s.get("project")||"",[m,g]=S.useState(null),[f,j]=S.useState(null),[b,e]=S.useState([]),[a,n]=S.useState({}),[i,c]=S.useState(0),[h,u]=S.useState("basic"),[v,_]=S.useState(null),[p,P]=S.useState(null),[w,A]=S.useState(null),[$,W]=S.useState(!1),[C,Q]=S.useState(null),[ie,q]=S.useState(!1),[G,pe]=S.useState(!0),[le,V]=S.useState(""),[H,M]=S.useState(null),J=S.useRef(null),te=S.useRef(null),he=S.useRef(i),fe=S.useRef(""),se=S.useCallback(async(r="")=>{pe(!0);try{const[d,x]=await Promise.all([Jt(),Zt()]),k=U(d.config||{});if(k.projects=me(k).map(E=>ge(E)),g(k),j(U(k)),e(x.providers||[]),n(Object.fromEntries((x.providers||[]).map(E=>[E.id,ye(E)]))),r){const E=(k.projects||[]).findIndex(O=>O.name===r);c(E>=0?E:0)}}catch(d){M({tone:"error",message:d instanceof Error?d.message:String(d)})}finally{pe(!1)}},[]);S.useEffect(()=>{se(o)},[se]);const K=(m==null?void 0:m.projects)||[],y=K[i]||null,ce=ht((Ye=(He=y==null?void 0:y.agent)==null?void 0:He.options)==null?void 0:Ye.sandbox),Be=ct(String((m==null?void 0:m.deployment_profile)||"").trim()),Mt=((m==null?void 0:m.sandbox_providers)||[]).find(r=>r.id===ce.provider_id)||dt(Be.id),At=((m==null?void 0:m.sandbox_runtime_images)||[]).find(r=>r.id===ce.runtime_image_id)||De(((Ve=y==null?void 0:y.agent)==null?void 0:Ve.type)||"pi"),Ue=JSON.stringify(m||{})!==JSON.stringify(f||{});S.useEffect(()=>{J.current=m},[m]),S.useEffect(()=>{te.current=p},[p]),S.useEffect(()=>{he.current=i,fe.current=(y==null?void 0:y.name)||""},[i,y==null?void 0:y.name]),S.useEffect(()=>{if(!m||!o)return;const r=K.findIndex(d=>d.name===o);r>=0&&r!==i&&c(r)},[m,K,o,i]);const de=S.useCallback(r=>{g(d=>{if(!d)return d;const x=U(d),k=me(x),E=k[i];return E?(k[i]=ge(r(E)),x):d})},[i]),Rt=S.useCallback(r=>{de(d=>{var x;return{...d,agent:{...d.agent,options:{...d.agent.options||{},sandbox:Ms(r(ht((x=d.agent.options)==null?void 0:x.sandbox)))}}}})},[de]),It=S.useCallback(r=>{const d=ct(r);g(x=>{if(!x)return x;const k=U(x);k.deployment_profile=d.id;const E=dt(d.id),O=Array.isArray(k.sandbox_providers)?[...k.sandbox_providers]:[],B=O.findIndex(F=>F.id===E.id);return B>=0?O[B]={...O[B],server_url:E.server_url}:O.push(E),k.sandbox_providers=O,k})},[]),Lt=()=>{_(js(K))},Ot=S.useCallback((r,d)=>{n(x=>{const k=x[r];return k?{...x,[r]:d(k)}:x})},[]),zt=async()=>{try{const r=await ss({name:`provider-${b.length+1}`});e(d=>[...d,r].sort((x,k)=>x.name.localeCompare(k.name))),n(d=>({...d,[r.id]:ye(r)})),M({tone:"success",message:"Provider created."})}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}},Dt=async r=>{const d=a[r];if(d)try{const x=await as(r,d);e(k=>k.map(E=>E.id===x.id?x:E).sort((E,O)=>E.name.localeCompare(O.name))),n(k=>({...k,[x.id]:ye(x)})),M({tone:"success",message:"Provider saved."})}catch(x){M({tone:"error",message:x instanceof Error?x.message:String(x)})}},Tt=async r=>{try{await ns(r),e(d=>d.filter(x=>x.id!==r)),n(d=>{const x={...d};return delete x[r],x}),M({tone:"success",message:"Provider removed."})}catch(d){M({tone:"error",message:d instanceof Error?d.message:String(d)})}},xe=r=>{_(d=>d&&{...d,...r})},Ft=()=>{if(!v)return;const r=v.name.trim(),d=v.agentType.trim(),x=v.workDir.trim(),k=v.model.trim();if(!r||!d||!x){M({tone:"warning",message:"Project name, agent type, and work directory are required."});return}if(K.some(B=>B.name===r)){M({tone:"warning",message:`Project "${r}" already exists.`});return}const E=ge({name:r,agent:{type:d,options:{model:k||Ae(d),work_dir:x},providers:[]},platforms:[],admin_from:"",disabled_commands:[]}),O=K.length;g(B=>{const F=U(B||{});return me(F).push(E),F}),c(O),l({project:r}),_(null),M(null)},Bt=r=>{g(d=>{if(!d)return d;const x=U(d),k=me(x);return k.splice(r,1),c(Math.max(0,Math.min(r,k.length-1))),x})},Ut=r=>{var x;if(A(null),Q(null),r===null){P({index:r,draft:Se()});return}const d=(x=y==null?void 0:y.platforms)==null?void 0:x[r];d&&P({index:r,draft:U(d)})},ae=r=>{P(d=>d&&{...d,draft:r(d.draft)})},$t=()=>{if(!p)return;const r=be(p.draft);de(d=>{const x=[...d.platforms||[]];return p.index===null?x.push(r):x[p.index]=r,{...d,platforms:x}}),P(null),A(null),Q(null)},$e=async()=>{if(!p||!m)return p==null?void 0:p.draft;const r=U(m),d=me(r),x=d[i];if(!x)return p.draft;const k=[...x.platforms||[]],E=be(p.draft);p.index===null?k.push(E):k[p.index]=E,d[i]=ge({...x,platforms:k});const O=await Ne(r),B=U(O.config||r);return j(B),g(U(B)),P(F=>F&&{index:F.index??k.length-1,draft:E}),E},Qt=async()=>{if(!(!(y!=null&&y.name)||!m)){W(!0);try{await $e();const r=await rs(y.name,re(p==null?void 0:p.draft));A({...r,status:"wait",createdAt:Date.now()}),M(null)}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{W(!1)}}},Gt=async()=>{if(!(!(y!=null&&y.name)||!m)){q(!0);try{await $e();const r=await os(y.name,re(p==null?void 0:p.draft));Q({...r,status:"wait",createdAt:Date.now()}),M(null)}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{q(!1)}}},Ht=async()=>{if(!(!(y!=null&&y.name)||!(w!=null&&w.ticket))){W(!0);try{const r=await is(y.name,w.ticket,re(p==null?void 0:p.draft));A(d=>d&&{...d,status:r.status}),r.status==="confirmed"&&M({tone:"success",message:"WeChat QR code confirmed."})}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{W(!1)}}},Qe=S.useCallback(async(r,d)=>{const x=await es(r,d);if(x.status!=="running"||x.connected!==!0)throw new Error(x.lastError||"Lark bot credentials were saved, but the gateway is not connected yet.");const k=await ts(r,d);if(!k.success)throw new Error(k.error||"Lark bot credentials were saved, but the connection test failed.")},[]),ke=S.useCallback(async r=>{var nt,rt,ot;const d=fe.current,x=re((nt=te.current)==null?void 0:nt.draft),k=J.current;if(!k)return;const E=U(k),O=me(E),B=he.current,F=O[B];if(!F)return;const R=[...F.platforms||[]],Y=te.current,X=(Y==null?void 0:Y.index)??R.findIndex(ne=>be(ne).type==="lark"&&re(ne)===x),ve=X>=0?R[X]:(Y==null?void 0:Y.draft)||Se("lark"),je=be({...ve,type:"lark",options:{...ve.options||{},instance_id:x,app_id:r.appId,app_secret:r.appSecret,verification_token:r.verificationToken||((rt=ve.options)==null?void 0:rt.verification_token)||"",encrypt_key:r.encryptKey||((ot=ve.options)==null?void 0:ot.encrypt_key)||"",card_actions:!0,subscribed_events:"im.message.receive_v1 card.action.trigger",subscribed_callbacks:"card.action.trigger"}});X>=0?R[X]=je:R.push(je),O[B]=ge({...F,platforms:R});const Vt=await Ne(E),at=U(Vt.config||E);j(at),g(U(at)),P(ne=>ne&&{...ne,index:ne.index??(X>=0?X:R.length-1),draft:je}),await Qe(d,x),M({tone:"success",message:"Lark bot bound, saved, and ready to send messages."}),await se(d)},[Qe,se]),Yt=async()=>{if(!(!(y!=null&&y.name)||!(C!=null&&C.ticket)||!m)){q(!0);try{const r=await lt(y.name,C.ticket,re(p==null?void 0:p.draft));Q(d=>{var x;return d&&{...d,status:r.status,botName:(x=r.credentials)==null?void 0:x.botName}}),r.status==="confirmed"&&r.credentials?await ke(r.credentials):r.status==="expired"&&M({tone:"warning",message:"Lark QR code expired. Generate a new QR code and scan again."})}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{q(!1)}}};S.useEffect(()=>{if(!(y!=null&&y.name)||!(C!=null&&C.ticket)||(p==null?void 0:p.draft.type)!=="lark"||C.status&&!["wait","signed"].includes(C.status))return;let r=!1,d;const k=(C.createdAt||Date.now())+Math.max(C.expiresIn||0,1)*1e3,E=Math.max(3,Math.min(Number(C.interval||5)||5,15))*1e3,O=F=>{d=window.setTimeout(()=>{B()},F)},B=async()=>{var F;if(!r){if(Date.now()>=k){Q(R=>(R==null?void 0:R.ticket)===C.ticket?{...R,status:"expired"}:R),M({tone:"warning",message:"Lark QR code expired. Generate a new QR code and scan again."});return}try{const R=await lt(y.name,C.ticket,re((F=te.current)==null?void 0:F.draft));if(r)return;if(Q(Y=>{var X;return(Y==null?void 0:Y.ticket)===C.ticket?{...Y,status:R.status,botName:(X=R.credentials)==null?void 0:X.botName}:Y}),R.status==="confirmed"&&R.credentials){await ke(R.credentials);return}if(R.status==="expired"){M({tone:"warning",message:"Lark QR code expired. Generate a new QR code and scan again."});return}O(E)}catch(R){if(r)return;M({tone:"error",message:R instanceof Error?R.message:String(R)})}}};return O(Math.min(2e3,E)),()=>{r=!0,d&&window.clearTimeout(d)}},[C==null?void 0:C.createdAt,C==null?void 0:C.expiresIn,C==null?void 0:C.interval,C==null?void 0:C.status,C==null?void 0:C.ticket,p==null?void 0:p.draft.type,ke,y==null?void 0:y.name]);const Ge=async()=>{if(m){V("config");try{const r=await Ne(m);j(U(r.config||m)),g(U(r.config||m)),M({tone:"success",message:"Project changes saved."}),await se()}catch(r){M({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{V("")}}};return G&&!m?t.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-slate-400 animate-pulse",children:"Loading workspace..."}):t.jsxs("div",{className:"space-y-6 animate-fade-in",children:[t.jsx(qt,{title:"工作区",description:"创建项目,配置 Agent、工作目录、Provider 和平台接入。"}),H?t.jsx("div",{role:"status",className:`rounded-xl border px-4 py-3 text-sm ${Ps(H.tone)}`,children:H.message}):null,Ue?t.jsxs("div",{className:"app-toolbar flex flex-col gap-3 border-amber-200 bg-amber-50 text-sm text-amber-700 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-200 sm:flex-row sm:items-center sm:justify-between",children:[t.jsx("span",{children:"You have unsaved project changes."}),t.jsxs(T,{size:"sm",onClick:()=>void Ge(),loading:le==="config",children:[t.jsx(we,{size:14})," Save changes"]})]}):null,t.jsxs("div",{className:"grid min-w-0 grid-cols-1 gap-4 lg:grid-cols-[340px_minmax(0,1fr)]",children:[t.jsx(As,{projects:K,selectedIndex:i,onAddProject:Lt,onSelectProject:(r,d)=>{c(r),l(d.name?{project:d.name}:{})},onRemoveProject:r=>Bt(r)}),t.jsx(gt,{title:(y==null?void 0:y.name)||"Project details",description:y?t.jsxs("span",{className:"break-all",children:[((We=y.agent)==null?void 0:We.type)||"unknown"," · ",String(((Xe=(Ke=y.agent)==null?void 0:Ke.options)==null?void 0:Xe.work_dir)||"No work directory")]}):void 0,className:"app-panel",children:y?t.jsxs("div",{className:"space-y-6",children:[t.jsx(Rs,{project:y,sandbox:ce}),t.jsx("div",{className:"flex gap-2 overflow-x-auto border-b border-black/10 pb-4 [scrollbar-width:none] dark:border-white/[0.08] [&::-webkit-scrollbar]:hidden sm:flex-wrap",children:[["basic","基本信息"],["providers","Provider"],["platforms","平台接入"],["sandbox","云端模式"]].map(([r,d])=>t.jsx("button",{type:"button",onClick:()=>u(r),className:`app-segment ${h===r?"app-segment-active":"app-segment-idle"}`,children:d},r))}),h==="basic"?t.jsx(Is,{project:y,updateProject:de}):null,h==="providers"?t.jsx(Ls,{project:y,modelProviders:b,providerDrafts:a,updateProject:de,updateProviderDraft:Ot,onAddProvider:()=>void zt(),onSaveProvider:r=>void Dt(r),onDeleteProvider:r=>void Tt(r)}):null,h==="platforms"?t.jsx(Os,{project:y,updateProject:de,onOpenPlatformDialog:Ut}):null,h==="sandbox"?t.jsx(zs,{project:y,sandbox:ce,profile:Be,sandboxProvider:Mt,runtimeImage:At,updateSandbox:Rt,updateDeploymentProfile:It}):null,t.jsx("div",{className:"flex flex-wrap gap-2 border-t border-black/10 pt-5 dark:border-white/[0.08]",children:t.jsxs(T,{className:"w-full sm:w-auto",onClick:()=>void Ge(),loading:le==="config",disabled:!Ue&&le!=="config",children:[t.jsx(we,{size:14})," 保存更改"]})})]}):t.jsx(Oe,{message:"选择或新建项目后开始配置。"})})]}),t.jsx(it,{open:!!v,onClose:()=>_(null),title:"新建项目",children:v?t.jsxs("div",{className:"space-y-4",children:[t.jsx(L,{label:"Project name",value:v.name,onChange:r=>xe({name:r.target.value}),autoFocus:!0}),t.jsx(Z,{label:"Agent type",value:v.agentType,onChange:r=>{const d=r.target.value;xe({agentType:d})},children:Me.map(r=>t.jsx("option",{value:r,children:r},r))}),t.jsx(L,{label:"Host workspace path",value:v.workDir,onChange:r=>xe({workDir:r.target.value}),placeholder:"/Users/yinyin/code/my-project"}),t.jsx(L,{label:"Default model",value:v.model,onChange:r=>xe({model:r.target.value}),placeholder:Ae(v.agentType)||"Use agent default model"}),t.jsxs("div",{className:"flex flex-col-reverse gap-2 pt-2 sm:flex-row sm:justify-end",children:[t.jsx(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>_(null),children:"Cancel"}),t.jsxs(T,{className:"w-full sm:w-auto",onClick:Ft,children:[t.jsx(Ce,{size:14})," 新建项目"]})]})]}):null}),t.jsx(it,{open:!!p,onClose:()=>{P(null),A(null),Q(null)},title:(p==null?void 0:p.index)===null?"Add platform":"Configure platform",children:p?t.jsxs("div",{className:"space-y-4",children:[t.jsxs(Z,{label:"Platform",value:St(p.draft.type,[...Ee]),onChange:r=>{const d=r.target.value===ee?p.draft.type:r.target.value;ae(()=>Se(d)),A(null),Q(null)},children:[Ee.map(r=>t.jsx("option",{value:r,children:r},r)),ds.filter(r=>!Ee.includes(r)).map(r=>t.jsx("option",{value:r,children:r},r)),t.jsx("option",{value:ee,children:"custom"})]}),p.draft.type==="lark"?t.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[C!=null&&C.qrCodeUrl?t.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-black/10 p-4 dark:border-white/[0.08]",children:[t.jsx("div",{className:"rounded-lg border border-black/10 bg-white p-3",children:t.jsx(Le,{value:C.qrCodeUrl,size:176,includeMargin:!0})}),t.jsx(Pe,{tone:C.status==="confirmed"?"success":C.status==="expired"?"danger":"warning",children:C.botName||C.status||"wait"})]}):null,t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap",children:[t.jsxs(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Gt(),loading:ie,children:[t.jsx(mt,{size:14})," Generate QR"]}),t.jsx(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Yt(),loading:ie,disabled:!(C!=null&&C.ticket),children:"Check status"})]}),t.jsx(L,{label:"App ID",value:String(((qe=p.draft.options)==null?void 0:qe.app_id)||""),onChange:r=>ae(d=>({...d,options:{...d.options||{},app_id:r.target.value}})),placeholder:"cli_xxx"}),t.jsx(L,{label:"App Secret",type:"password",value:String(((Je=p.draft.options)==null?void 0:Je.app_secret)||""),onChange:r=>ae(d=>({...d,options:{...d.options||{},app_secret:r.target.value}}))}),t.jsx(L,{label:"Verification token",value:String(((Ze=p.draft.options)==null?void 0:Ze.verification_token)||""),onChange:r=>ae(d=>({...d,options:{...d.options||{},verification_token:r.target.value}}))}),t.jsx(L,{label:"Encrypt key",value:String(((et=p.draft.options)==null?void 0:et.encrypt_key)||""),onChange:r=>ae(d=>({...d,options:{...d.options||{},encrypt_key:r.target.value}}))}),t.jsxs("label",{className:"flex items-center gap-3 text-sm text-foreground",children:[t.jsx("input",{type:"checkbox",checked:((tt=p.draft.options)==null?void 0:tt.auto_approve)===!0,onChange:r=>ae(d=>({...d,options:{...d.options||{},auto_approve:r.target.checked}}))}),"Auto-approve Lark users"]}),t.jsxs("label",{className:"flex items-center gap-3 text-sm text-foreground",children:[t.jsx("input",{type:"checkbox",checked:((st=p.draft.options)==null?void 0:st.card_actions)===!0,onChange:r=>ae(d=>({...d,options:{...d.options||{},card_actions:r.target.checked}}))}),"Enable Lark card action buttons"]})]}):null,p.draft.type==="weixin"?t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"rounded-lg border border-black/10 bg-black/[0.03] px-3 py-3 text-sm text-muted-foreground dark:border-white/[0.08] dark:bg-white/[0.04]",children:"WeChat does not need an App ID or secret. Save this platform, then generate a QR code and scan it to finish login."}),w!=null&&w.qrCodeUrl?t.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-black/10 p-4 dark:border-white/[0.08]",children:[t.jsx("div",{className:"rounded-lg border border-black/10 bg-white p-3",children:t.jsx(Le,{value:w.qrCodeUrl,size:176,includeMargin:!0})}),t.jsx(Pe,{tone:w.status==="confirmed"?"success":w.status==="expired"?"danger":"warning",children:w.status||"wait"})]}):null,t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap",children:[t.jsxs(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Qt(),loading:$,children:[t.jsx(mt,{size:14})," Generate QR"]}),t.jsx(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Ht(),loading:$,disabled:!(w!=null&&w.ticket),children:"Check status"})]})]}):null,p.draft.type!=="lark"&&p.draft.type!=="weixin"?t.jsx("div",{className:"rounded-lg border border-black/10 bg-black/[0.03] px-3 py-3 text-sm text-muted-foreground dark:border-white/[0.08] dark:bg-white/[0.04]",children:"This platform has no daily UI fields yet. Existing advanced options are preserved in config."}):null,t.jsxs("div",{className:"flex flex-col-reverse gap-2 border-t border-black/10 pt-4 dark:border-white/[0.08] sm:flex-row sm:justify-end",children:[t.jsx(T,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>P(null),children:"Cancel"}),t.jsxs(T,{className:"w-full sm:w-auto",onClick:$t,children:[t.jsx(we,{size:14})," Apply"]})]})]}):null})]})}export{Zs as default};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-C4ZGOKQv.js";/**
1
+ import{c as o}from"./index-C581X81v.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-C4ZGOKQv.js";/**
1
+ import{c as o}from"./index-C581X81v.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-C4ZGOKQv.js";/**
1
+ import{c as t}from"./index-C581X81v.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-C4ZGOKQv.js";/**
1
+ import{c}from"./index-C581X81v.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-C4ZGOKQv.js";/**
1
+ import{c as o}from"./index-C581X81v.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-C4ZGOKQv.js";/**
1
+ import{c}from"./index-C581X81v.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{a3 as l,s as g,a4 as c,a5 as u,a6 as h,a7 as C,a8 as v,a9 as k,aa as p,ab as m,ac as w,ad as P,ae as S,af as L,ag as R,ah as y,ai as D,aj as b,ak as f,al as G,am as Q,an as E,ao as M,ap as B,aq as A,ar as I,as as W,at as K,au as x,av as T,aw as $,ax as j,ay as U,az as z,aA as q,aB as _,aC as F,aD as H,aE as J,aF as N,p as i,m as O,aG as V,aH as X,aI as Y,aJ as Z,aK as ee,aL as te,aM as ae,i as ne}from"./index-C581X81v.js";function s(){if(!window.desktop)throw new Error("Desktop APIs are unavailable in the browser build");return window.desktop}const se={getRuntimeStatus:()=>s().getRuntimeStatus(),startService:()=>s().startService(),stopService:()=>s().stopService(),restartService:()=>s().restartService(),getLogs:e=>s().getLogs(e),listInstalledAgentRuntimes:()=>F().then(e=>e.runtimes),refreshInstalledAgentRuntimes:()=>_().then(e=>e.runtimes),readRuntimeConfig:()=>s().readRuntimeConfig(),saveRuntimeConfig:e=>s().saveRuntimeConfig(e),listModelProviders:()=>q(),createModelProvider:e=>z(e),updateModelProvider:(e,t)=>U(e,t),deleteModelProvider:e=>j(e),getThreadKnowledgeBases:(e,t)=>s().getThreadKnowledgeBases(e,t),updateThreadKnowledgeBases:(e,t,a)=>s().updateThreadKnowledgeBases(e,t,a),deleteThreadKnowledgeBases:(e,t)=>s().deleteThreadKnowledgeBases(e,t),saveSettings:e=>s().saveSettings(e),getCapabilitySnapshot:()=>$(),getPluginDiagnostics:()=>T(),listDiagnosticErrors:()=>x().then(e=>e.errors),runDiagnosticsDoctor:()=>K(),runDeploymentDiagnostics:()=>W(),listChannelGateways:e=>I(e).then(t=>t.gateways),getChannelGatewayStatus:(e,t,a)=>A(e,t,a),testChannelConnection:(e,t,a)=>B(e,t,a),enableChannelGateway:(e,t,a)=>M(e,t,a),disableChannelGateway:(e,t,a)=>E(e,t,a),listChannelPendingPairings:(e,t)=>Q(e,t).then(a=>a.pairings),approveChannelPairing:(e,t)=>G(e,t),rejectChannelPairing:(e,t)=>f(e,t),listChannelAuthorizedUsers:(e,t)=>b(e,t).then(a=>a.users),getChannelQrCode:(e,t,a)=>D(e,t,a),checkChannelQrCodeStatus:(e,t,a,r)=>y(e,t,a,r),getWeixinQrCode:(e,t)=>R(e,t),checkWeixinQrCodeStatus:(e,t,a)=>L(e,t,a),getLarkQrCode:(e,t)=>S(e,t),checkLarkQrCodeStatus:(e,t,a)=>P(e,t,a),listLarkGateways:()=>w().then(e=>e.gateways),getLarkGatewayStatus:(e,t)=>m(e,t),testLarkConnection:(e,t)=>p(e,t),enableLarkGateway:(e,t)=>k(e,t),disableLarkGateway:(e,t)=>v(e,t),listLarkPendingPairings:e=>C(e).then(t=>t.pairings),approveLarkPairing:e=>h(e),rejectLarkPairing:e=>u(e),listLarkAuthorizedUsers:e=>c(e).then(t=>t.users),probeWorkspaceStreaming:e=>s().probeWorkspaceStreaming(e),onRuntimeEvent:e=>s().onRuntimeEvent(e),onRuntimeDetectionEvent:e=>g(t=>{(t.type.startsWith("runtime.detect.")||t.type==="runtime.status.changed")&&e(t)}),onBridgeEvent:e=>l(e)},o={getRuntimeStatus:()=>ae(),startService:()=>te(),stopService:()=>ee(),restartService:()=>Z(),getLogs:e=>Y(e),listInstalledAgentRuntimes:()=>F().then(e=>e.runtimes),refreshInstalledAgentRuntimes:()=>_().then(e=>e.runtimes),readRuntimeConfig:()=>X(),saveRuntimeConfig:e=>V(e),listModelProviders:()=>q(),createModelProvider:e=>z(e),updateModelProvider:(e,t)=>U(e,t),deleteModelProvider:e=>j(e),getThreadKnowledgeBases:(e,t)=>O(t).then(a=>a.selectedKnowledgeBaseIds||[]),updateThreadKnowledgeBases:(e,t,a)=>i(t,a).then(r=>r.knowledgeBaseIds),deleteThreadKnowledgeBases:(e,t)=>i(t,[]).then(()=>({deleted:!0})),saveSettings:e=>N(e),getCapabilitySnapshot:()=>$(),getPluginDiagnostics:()=>T(),listDiagnosticErrors:()=>x().then(e=>e.errors),runDiagnosticsDoctor:()=>K(),runDeploymentDiagnostics:()=>W(),listChannelGateways:e=>I(e).then(t=>t.gateways),getChannelGatewayStatus:(e,t,a)=>A(e,t,a),testChannelConnection:(e,t,a)=>B(e,t,a),enableChannelGateway:(e,t,a)=>M(e,t,a),disableChannelGateway:(e,t,a)=>E(e,t,a),listChannelPendingPairings:(e,t)=>Q(e,t).then(a=>a.pairings),approveChannelPairing:(e,t)=>G(e,t),rejectChannelPairing:(e,t)=>f(e,t),listChannelAuthorizedUsers:(e,t)=>b(e,t).then(a=>a.users),getChannelQrCode:(e,t,a)=>D(e,t,a),checkChannelQrCodeStatus:(e,t,a,r)=>y(e,t,a,r),getWeixinQrCode:(e,t)=>R(e,t),checkWeixinQrCodeStatus:(e,t,a)=>L(e,t,a),getLarkQrCode:(e,t)=>S(e,t),checkLarkQrCodeStatus:(e,t,a)=>P(e,t,a),listLarkGateways:()=>w().then(e=>e.gateways),getLarkGatewayStatus:(e,t)=>m(e,t),testLarkConnection:(e,t)=>p(e,t),enableLarkGateway:(e,t)=>k(e,t),disableLarkGateway:(e,t)=>v(e,t),listLarkPendingPairings:e=>C(e).then(t=>t.pairings),approveLarkPairing:e=>h(e),rejectLarkPairing:e=>u(e),listLarkAuthorizedUsers:e=>c(e).then(t=>t.users),probeWorkspaceStreaming:e=>J(e),onRuntimeEvent:e=>H(e),onRuntimeDetectionEvent:e=>g(t=>{(t.type.startsWith("runtime.detect.")||t.type==="runtime.status.changed")&&e(t)}),onBridgeEvent:e=>l(e)};let d=null;function re(e){return e==="electron"&&window.desktop?se:o}function n(){const e=d||re(ne());if(!e)throw new Error("Managed desktop APIs are unavailable in this build");return d=e,e}const oe=()=>n().getRuntimeStatus(),de=()=>n().startService(),le=()=>n().listInstalledAgentRuntimes(),ge=()=>n().refreshInstalledAgentRuntimes(),ce=()=>n().readRuntimeConfig(),ue=e=>n().saveRuntimeConfig(e),he=()=>n().listModelProviders(),Ce=e=>n().createModelProvider(e),ve=(e,t)=>n().updateModelProvider(e,t),ke=e=>n().deleteModelProvider(e),pe=(e,t,a)=>n().updateThreadKnowledgeBases(e,t,a),me=e=>n().saveSettings(e),we=()=>n().getPluginDiagnostics(),Pe=()=>n().listDiagnosticErrors(),Se=()=>n().runDiagnosticsDoctor(),Le=(e,t)=>n().getWeixinQrCode(e,t),Re=(e,t,a)=>n().checkWeixinQrCodeStatus(e,t,a),ye=(e,t)=>n().getLarkQrCode(e,t),De=(e,t,a)=>n().checkLarkQrCodeStatus(e,t,a),be=(e,t)=>n().testLarkConnection(e,t),fe=(e,t)=>n().enableLarkGateway(e,t),Ge=e=>n().onRuntimeEvent(e),Qe=e=>n().onRuntimeDetectionEvent(e),Ee=e=>n().onBridgeEvent(e);export{Qe as a,Ee as b,ce as c,he as d,fe as e,ue as f,oe as g,Ce as h,ve as i,ke as j,Le as k,le as l,ye as m,Re as n,Ge as o,De as p,we as q,ge as r,de as s,be as t,pe as u,Pe as v,me as w,Se as x};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-C4ZGOKQv.js";/**
1
+ import{c}from"./index-C581X81v.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-C4ZGOKQv.js";/**
1
+ import{c}from"./index-C581X81v.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.