@kafca/agentdock 0.1.44 → 0.1.45

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 (113) hide show
  1. package/README.md +71 -11
  2. package/bin/agentdock.mjs +5 -5
  3. package/dist/renderer/assets/{Badge-Qk9qHovH.js → Badge-BIojwD6s.js} +1 -1
  4. package/dist/renderer/assets/{Chat-BK-fm0Xr.js → Chat-wjBR3XEX.js} +1 -1
  5. package/dist/renderer/assets/{ChatMarkdown-BKdW8OON.js → ChatMarkdown-DqszsPB_.js} +1 -1
  6. package/dist/renderer/assets/Config-BDCHs5A2.js +21 -0
  7. package/dist/renderer/assets/{CronList-Z3TvSRKP.js → CronList-CEWQYTov.js} +1 -1
  8. package/dist/renderer/assets/Dashboard-DrWftfk3.js +26 -0
  9. package/dist/renderer/assets/{EmptyState-kD9yAwtw.js → EmptyState-BqCx1oWr.js} +1 -1
  10. package/dist/renderer/assets/{KnowledgeDetail-BAMCLrjz.js → KnowledgeDetail-BwK8Gpfa.js} +2 -2
  11. package/dist/renderer/assets/{KnowledgeHome-ChvjOfrc.js → KnowledgeHome-hhDTZMDO.js} +3 -3
  12. package/dist/renderer/assets/{Logs-Cv0nth3j.js → Logs-C9xPEhFT.js} +1 -1
  13. package/dist/renderer/assets/{Modal-DwY4lecS.js → Modal-D2U4r2V0.js} +1 -1
  14. package/dist/renderer/assets/{MonitorList-JEvMoWUm.js → MonitorList-CayKbfwJ.js} +1 -1
  15. package/dist/renderer/assets/{Page-CnB9ePsb.js → Page-urf5GcT_.js} +1 -1
  16. package/dist/renderer/assets/ProjectDetail-B1GyAr7a.js +11 -0
  17. package/dist/renderer/assets/{ProjectList-D6CXumR_.js → ProjectList-BoipQypE.js} +1 -1
  18. package/dist/renderer/assets/{Select-zfoksLGB.js → Select-CAscWpy5.js} +1 -1
  19. package/dist/renderer/assets/{SessionChat-DUTh4WoM.js → SessionChat-BAVy5221.js} +1 -1
  20. package/dist/renderer/assets/{SessionList-D9o-lUst.js → SessionList-BZpuMvh0.js} +1 -1
  21. package/dist/renderer/assets/{ThreadChat-BYXlT-Kc.js → ThreadChat-JX7m9biG.js} +1 -1
  22. package/dist/renderer/assets/Workspace-CFW8otjU.js +14 -0
  23. package/dist/renderer/assets/{arrow-left-CNEAuElg.js → arrow-left-7HrNuS-V.js} +1 -1
  24. package/dist/renderer/assets/{book-open-BNJMhNI-.js → book-open-BDoAu82s.js} +1 -1
  25. package/dist/renderer/assets/{check-BnclClRU.js → check-DGlyq4xX.js} +1 -1
  26. package/dist/renderer/assets/{chevron-down-Bh53e0O-.js → chevron-down-Bb_3EHq9.js} +1 -1
  27. package/dist/renderer/assets/{circle-ClZTWCWO.js → circle-DIpqZnYw.js} +1 -1
  28. package/dist/renderer/assets/desktop-Ci1fnRDR.js +1 -0
  29. package/dist/renderer/assets/{desktop-C6q6wBae.js → desktop-Do_UrC-o.js} +5 -5
  30. package/dist/renderer/assets/en-CmAr_0e6.js +1 -0
  31. package/dist/renderer/assets/es-Cs9x52ca.js +1 -0
  32. package/dist/renderer/assets/{funnel-_5hsz0xI.js → funnel-Bbf0ERLP.js} +1 -1
  33. package/dist/renderer/assets/{heart-u4Q1aOqj.js → heart-CGqU-qfw.js} +1 -1
  34. package/dist/renderer/assets/{index-BNFx4uYv.js → index-Df-Trovt.js} +2 -2
  35. package/dist/renderer/assets/{index-B36eowj-.js → index-DwhTjLA1.js} +36 -36
  36. package/dist/renderer/assets/index-RaTga2BC.css +11 -0
  37. package/dist/renderer/assets/ja-DtvtBRTW.js +1 -0
  38. package/dist/renderer/assets/{pencil-DLh9QNmT.js → pencil-CHiy1MvK.js} +1 -1
  39. package/dist/renderer/assets/{play-BDTk9Scm.js → play-CGYnmC4Q.js} +1 -1
  40. package/dist/renderer/assets/{plug-BG0JHW6B.js → plug-Mexu4gyV.js} +1 -1
  41. package/dist/renderer/assets/{plus-BSc8POsz.js → plus-B_Q5-Oj7.js} +1 -1
  42. package/dist/renderer/assets/projects-C6bbkC-O.js +1 -0
  43. package/dist/renderer/assets/{save-D5AO_G6a.js → save-CJ_QFPw0.js} +1 -1
  44. package/dist/renderer/assets/{search-CniPk7Ey.js → search-D8Dkhsyq.js} +1 -1
  45. package/dist/renderer/assets/{server-GsXyQAZm.js → server-Cd96R7WL.js} +1 -1
  46. package/dist/renderer/assets/{session-utils-BDxzgTBC.js → session-utils-BNUbQBfF.js} +1 -1
  47. package/dist/renderer/assets/{sessions-CLcKA1Tt.js → sessions-BACfV8s1.js} +1 -1
  48. package/dist/renderer/assets/{shield-check-4i0E3hmf.js → shield-check-Cnn-yQUA.js} +1 -1
  49. package/dist/renderer/assets/{trash-2-DhtOCsO5.js → trash-2-oWCxwQ9D.js} +1 -1
  50. package/dist/renderer/assets/{user-BtC_pVXV.js → user-BzE9BwsY.js} +1 -1
  51. package/dist/renderer/assets/{wifi-off-BHPzPY_B.js → wifi-off-DHxnNkdY.js} +1 -1
  52. package/dist/renderer/assets/zh-CcJ9vBZj.js +1 -0
  53. package/dist/renderer/assets/zh-TW-elI72AC1.js +1 -0
  54. package/dist/renderer/index.html +2 -2
  55. package/dist-electron/electron/main.js +26 -1
  56. package/dist-electron/packages/core-sdk/src/index.js +28 -0
  57. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +111 -62
  58. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-session-coordinator.js +80 -7
  59. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-transport.js +78 -5
  60. package/dist-electron/services/local-ai-core/src/acp/store/external-store.js +98 -0
  61. package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +33 -0
  62. package/dist-electron/services/local-ai-core/src/acp/store/model-provider-store.js +88 -0
  63. package/dist-electron/services/local-ai-core/src/acp/store/schema.js +43 -0
  64. package/dist-electron/services/local-ai-core/src/agents/pi/launch.js +2 -119
  65. package/dist-electron/services/local-ai-core/src/agents/pi/provider-materializer.js +148 -0
  66. package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +65 -10
  67. package/dist-electron/services/local-ai-core/src/channel/shared/session-command-runtime.js +4 -2
  68. package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +139 -29
  69. package/dist-electron/services/local-ai-core/src/execution/agent-execution-backend.js +56 -0
  70. package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +18 -57
  71. package/dist-electron/services/local-ai-core/src/kernel/local-core-errors.js +255 -0
  72. package/dist-electron/services/local-ai-core/src/plugins/builtin/catalog.js +78 -0
  73. package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +3 -1
  74. package/dist-electron/services/local-ai-core/src/router/workspace-router.js +64 -9
  75. package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +5 -2
  76. package/dist-electron/services/local-ai-core/src/runtime/config-migration.js +152 -0
  77. package/dist-electron/services/local-ai-core/src/runtime/deployment-diagnostics.js +175 -0
  78. package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +330 -3
  79. package/dist-electron/services/local-ai-core/src/runtime/local-core-runtime-state.js +11 -2
  80. package/dist-electron/services/local-ai-core/src/runtime/provider-config-migration.js +32 -0
  81. package/dist-electron/services/local-ai-core/src/runtime/runtime-detection-service.js +76 -8
  82. package/dist-electron/services/local-ai-core/src/runtime/server-routes.js +62 -0
  83. package/dist-electron/services/local-ai-core/src/runtime/server.js +708 -4
  84. package/dist-electron/services/local-ai-core/src/runtime/standalone.js +13 -3
  85. package/dist-electron/services/local-ai-core/src/sandbox/opensandbox-client.js +113 -0
  86. package/dist-electron/services/local-ai-core/src/sandbox/sandbox-config.js +273 -0
  87. package/dist-electron/services/local-ai-core/src/sandbox/sandbox-manager.js +215 -0
  88. package/dist-electron/services/local-ai-core/src/sandbox/sandbox-stdio-proxy.js +188 -0
  89. package/dist-electron/services/local-ai-core/src/thread/slash-command-registry.js +3 -0
  90. package/dist-electron/services/local-ai-core/src/thread/thread-command-service.js +32 -0
  91. package/dist-electron/services/local-ai-core/src/thread/thread-slash-command-dispatcher.js +71 -0
  92. package/dist-electron/shared/desktop.js +85 -1
  93. package/dist-electron/tests/contracts/architecture-docs.test.js +83 -0
  94. package/dist-electron/tests/electron/plugin-kernel.test.js +225 -18
  95. package/dist-electron/tests/electron/runtime-detection-service.test.js +57 -5
  96. package/dist-electron/tests/electron/sandbox-config.test.js +541 -0
  97. package/dist-electron/tests/electron/workspace-task-store.test.js +257 -0
  98. package/dist-electron/tests/integration/lark-gateway.test.js +59 -0
  99. package/dist-electron/tests/integration/local-core-refactor.test.js +183 -20
  100. package/dist-electron/tests/integration/local-core-routes.test.js +34 -0
  101. package/package.json +2 -3
  102. package/dist/renderer/assets/Config-B93CQGvY.js +0 -16
  103. package/dist/renderer/assets/Dashboard-Ch3QkWwf.js +0 -26
  104. package/dist/renderer/assets/ProjectDetail-DJa3sMmU.js +0 -11
  105. package/dist/renderer/assets/Workspace-BrhSwRQ-.js +0 -14
  106. package/dist/renderer/assets/desktop-C5vBT0yM.js +0 -1
  107. package/dist/renderer/assets/en-D2SkCrhG.js +0 -1
  108. package/dist/renderer/assets/es-C8UBPhxM.js +0 -1
  109. package/dist/renderer/assets/index-CaQZSRbg.css +0 -11
  110. package/dist/renderer/assets/ja-ChF4vbBL.js +0 -1
  111. package/dist/renderer/assets/projects-DwfZwxDW.js +0 -1
  112. package/dist/renderer/assets/zh-DIcdHycM.js +0 -1
  113. package/dist/renderer/assets/zh-TW-BtRwreY_.js +0 -1
@@ -1 +1 @@
1
- import{Q as q,l as D,U as W,V as B,X as F,Y as L,u as R,r as i,j as s,s as $,B as u,_ as O,C as U,E as V,I as x,T as H}from"./index-B36eowj-.js";import{B as h}from"./Badge-Qk9qHovH.js";import{M as Q}from"./Modal-DwY4lecS.js";import{S as b}from"./Select-zfoksLGB.js";import{E as X}from"./EmptyState-kD9yAwtw.js";import{P as Y}from"./Page-CnB9ePsb.js";import{P as Z}from"./plus-BSc8POsz.js";import{P as G}from"./play-BDTk9Scm.js";import{P as J}from"./pencil-DLh9QNmT.js";import{T as K}from"./trash-2-DhtOCsO5.js";import"./index-BNFx4uYv.js";import"./chevron-down-Bh53e0O-.js";import"./check-BnclClRU.js";const ee=t=>q(),te=t=>B(t),se=(t,n)=>W(t,n),ae=t=>F(t),ne=t=>L(t),oe=()=>D().then(t=>t.workspaces),g={workspaceId:"",title:"",sourceType:"stock.quote",symbol:"",condition:"abs_change_percent >= 3",promptTemplate:"",cooldownMinutes:"15",executionMode:"side-thread",enabled:!0};function k(t){const n=t.trim();if(n.includes("&&")||n.includes("||"))return{metric:"expression",operator:"==",value:!0,expression:n};const c=n.match(/^([a-zA-Z0-9_.-]+)\s*(>=|<=|==|!=|>|<)\s*(.+)$/);if(!c)return null;const l=String(c[3]||"").trim(),m=Number(l);return{metric:String(c[1]||"").trim(),operator:c[2],value:Number.isFinite(m)&&l!==""?m:l}}function C(t){return t.condition.expression?t.condition.expression:`${t.condition.metric} ${t.condition.operator} ${t.condition.value}`}function ie(t){return t?{workspaceId:t.workspaceId,title:t.title,sourceType:"stock.quote",symbol:String(t.sourceConfig.symbol||""),condition:C(t),promptTemplate:t.promptTemplate,cooldownMinutes:String(Math.round(t.cooldownMs/6e4)),executionMode:t.executionMode,enabled:t.enabled}:g}function re(t){const n=k(t.condition);if(!n)throw new Error("Invalid condition");return{workspaceId:t.workspaceId,title:t.title,sourceType:t.sourceType,sourceConfig:v[t.sourceType].buildConfig(t),condition:n,promptTemplate:t.promptTemplate,executionMode:t.executionMode,cooldownMs:Math.max(0,Number(t.cooldownMinutes||"0")*6e4),enabled:t.enabled}}const v={"stock.quote":{label:"Stock quote",buildConfig:t=>({symbol:t.symbol.toUpperCase()}),renderSummary:t=>String(t.sourceConfig.symbol||"")}};function ve(){const{t}=R(),[n,c]=i.useState([]),[l,m]=i.useState([]),[T,w]=i.useState(!0),[S,p]=i.useState(!1),[N,M]=i.useState(!1),[j,f]=i.useState(null),[a,o]=i.useState(g),I=i.useMemo(()=>l.map(e=>s.jsx("option",{value:e.id,children:e.name},e.id)),[l]),d=i.useCallback(async()=>{w(!0);try{const[e,r]=await Promise.all([ee(),oe()]);c(e.monitors||[]),m(r),o(y=>y.workspaceId||r.length===0?y:{...y,workspaceId:r[0].id})}finally{w(!1)}},[]);i.useEffect(()=>{d();const e=$(r=>{(r.type==="automation.monitor.updated"||r.type==="automation.monitor.run.updated")&&d()});return()=>e()},[d]);const E=()=>{var e;f(null),o({...g,workspaceId:((e=l[0])==null?void 0:e.id)||""}),p(!0)},A=e=>{f(e),o(ie(e)),p(!0)},P=async()=>{if(!(!a.workspaceId||!a.title.trim()||!a.symbol.trim()||!a.promptTemplate.trim()||!k(a.condition))){M(!0);try{const e=re(a);j?await se(j.id,e):await te(e),p(!1),f(null),o(g),await d()}finally{M(!1)}}},z=async e=>{confirm(t("common.confirmDelete"))&&(await ae(e),await d())},_=async e=>{await ne(e),await d()};return T&&n.length===0?s.jsx("div",{className:"flex h-64 items-center justify-center text-gray-400 animate-pulse",children:t("common.loading")}):s.jsxs("div",{className:"space-y-4 animate-fade-in",children:[s.jsx(Y,{title:t("monitors.title"),description:"Create event monitors that trigger agent analysis and stream results back to channels.",actions:s.jsxs(u,{onClick:E,children:[s.jsx(Z,{size:16})," ",t("monitors.add")]})}),n.length===0?s.jsx(X,{message:t("monitors.noMonitors"),icon:O}):s.jsx("div",{className:"space-y-3",children:n.map(e=>s.jsx(U,{children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.title}),s.jsx(h,{variant:e.enabled?"success":"default",children:e.enabled?t("monitors.enabled"):"disabled"}),s.jsx(h,{variant:"default",children:e.sourceType}),s.jsx(h,{variant:"default",children:e.platform}),e.lastStatus&&s.jsx(h,{variant:e.lastStatus==="failed"?"danger":"default",children:e.lastStatus})]}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-500 dark:text-gray-400",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"Workspace:"})," ",e.workspaceId]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Subject:"})," ",v["stock.quote"].renderSummary(e)]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Condition:"})," ",C(e)]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Execution:"})," ",e.executionMode]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Cooldown:"})," ",Math.round(e.cooldownMs/6e4),"m"]}),e.lastTriggeredAt&&s.jsxs("span",{children:[s.jsxs("strong",{children:[t("monitors.lastRun"),":"]})," ",V(e.lastTriggeredAt)]})]}),s.jsx("p",{className:"mt-2 whitespace-pre-wrap text-sm text-gray-700 dark:text-gray-300",children:e.promptTemplate}),e.lastError&&s.jsx("p",{className:"mt-2 text-xs text-red-500",children:e.lastError})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(u,{variant:"secondary",size:"sm",onClick:()=>_(e.id),title:t("monitors.run"),children:s.jsx(G,{size:14})}),s.jsx(u,{variant:"secondary",size:"sm",onClick:()=>A(e),title:t("common.save"),children:s.jsx(J,{size:14})}),s.jsx(u,{variant:"danger",size:"sm",onClick:()=>z(e.id),title:t("common.delete"),children:s.jsx(K,{size:14})})]})]})},e.id))}),s.jsx(Q,{open:S,title:t(j?"monitors.edit":"monitors.add"),onClose:()=>p(!1),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(b,{label:"Workspace",value:a.workspaceId,onChange:e=>o({...a,workspaceId:e.target.value}),children:I}),s.jsx(x,{label:t("monitors.monitorTitle"),value:a.title,onChange:e=>o({...a,title:e.target.value})}),s.jsx(b,{label:"Source",value:a.sourceType,onChange:e=>o({...a,sourceType:e.target.value}),children:Object.entries(v).map(([e,r])=>s.jsx("option",{value:e,children:r.label},e))}),a.sourceType==="stock.quote"&&s.jsx(x,{label:"Symbol",value:a.symbol,onChange:e=>o({...a,symbol:e.target.value}),placeholder:"AAPL"}),s.jsx(x,{label:t("monitors.condition"),value:a.condition,onChange:e=>o({...a,condition:e.target.value}),placeholder:"abs_change_percent >= 3"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(x,{label:t("monitors.cooldown"),value:a.cooldownMinutes,onChange:e=>o({...a,cooldownMinutes:e.target.value})}),s.jsxs(b,{label:"Execution",value:a.executionMode,onChange:e=>o({...a,executionMode:e.target.value}),children:[s.jsx("option",{value:"side-thread",children:"side-thread"}),s.jsx("option",{value:"same-thread",children:"same-thread"})]})]}),s.jsx(H,{label:t("monitors.prompt"),rows:6,value:a.promptTemplate,onChange:e=>o({...a,promptTemplate:e.target.value})}),s.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[s.jsx("input",{type:"checkbox",checked:a.enabled,onChange:e=>o({...a,enabled:e.target.checked})}),t("monitors.enabled")]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(u,{variant:"secondary",onClick:()=>p(!1),children:t("common.cancel")}),s.jsx(u,{onClick:P,disabled:N,children:t("common.save")})]})]})})]})}export{ve as default};
1
+ import{Q as q,l as D,U as W,V as B,X as F,Y as L,u as R,r as i,j as s,s as $,B as u,_ as O,C as U,E as V,I as x,T as H}from"./index-DwhTjLA1.js";import{B as h}from"./Badge-BIojwD6s.js";import{M as Q}from"./Modal-D2U4r2V0.js";import{S as b}from"./Select-CAscWpy5.js";import{E as X}from"./EmptyState-BqCx1oWr.js";import{P as Y}from"./Page-urf5GcT_.js";import{P as Z}from"./plus-B_Q5-Oj7.js";import{P as G}from"./play-CGYnmC4Q.js";import{P as J}from"./pencil-CHiy1MvK.js";import{T as K}from"./trash-2-oWCxwQ9D.js";import"./index-Df-Trovt.js";import"./chevron-down-Bb_3EHq9.js";import"./check-DGlyq4xX.js";const ee=t=>q(),te=t=>B(t),se=(t,n)=>W(t,n),ae=t=>F(t),ne=t=>L(t),oe=()=>D().then(t=>t.workspaces),g={workspaceId:"",title:"",sourceType:"stock.quote",symbol:"",condition:"abs_change_percent >= 3",promptTemplate:"",cooldownMinutes:"15",executionMode:"side-thread",enabled:!0};function k(t){const n=t.trim();if(n.includes("&&")||n.includes("||"))return{metric:"expression",operator:"==",value:!0,expression:n};const c=n.match(/^([a-zA-Z0-9_.-]+)\s*(>=|<=|==|!=|>|<)\s*(.+)$/);if(!c)return null;const l=String(c[3]||"").trim(),m=Number(l);return{metric:String(c[1]||"").trim(),operator:c[2],value:Number.isFinite(m)&&l!==""?m:l}}function C(t){return t.condition.expression?t.condition.expression:`${t.condition.metric} ${t.condition.operator} ${t.condition.value}`}function ie(t){return t?{workspaceId:t.workspaceId,title:t.title,sourceType:"stock.quote",symbol:String(t.sourceConfig.symbol||""),condition:C(t),promptTemplate:t.promptTemplate,cooldownMinutes:String(Math.round(t.cooldownMs/6e4)),executionMode:t.executionMode,enabled:t.enabled}:g}function re(t){const n=k(t.condition);if(!n)throw new Error("Invalid condition");return{workspaceId:t.workspaceId,title:t.title,sourceType:t.sourceType,sourceConfig:v[t.sourceType].buildConfig(t),condition:n,promptTemplate:t.promptTemplate,executionMode:t.executionMode,cooldownMs:Math.max(0,Number(t.cooldownMinutes||"0")*6e4),enabled:t.enabled}}const v={"stock.quote":{label:"Stock quote",buildConfig:t=>({symbol:t.symbol.toUpperCase()}),renderSummary:t=>String(t.sourceConfig.symbol||"")}};function ve(){const{t}=R(),[n,c]=i.useState([]),[l,m]=i.useState([]),[T,w]=i.useState(!0),[S,p]=i.useState(!1),[N,M]=i.useState(!1),[j,f]=i.useState(null),[a,o]=i.useState(g),I=i.useMemo(()=>l.map(e=>s.jsx("option",{value:e.id,children:e.name},e.id)),[l]),d=i.useCallback(async()=>{w(!0);try{const[e,r]=await Promise.all([ee(),oe()]);c(e.monitors||[]),m(r),o(y=>y.workspaceId||r.length===0?y:{...y,workspaceId:r[0].id})}finally{w(!1)}},[]);i.useEffect(()=>{d();const e=$(r=>{(r.type==="automation.monitor.updated"||r.type==="automation.monitor.run.updated")&&d()});return()=>e()},[d]);const E=()=>{var e;f(null),o({...g,workspaceId:((e=l[0])==null?void 0:e.id)||""}),p(!0)},A=e=>{f(e),o(ie(e)),p(!0)},P=async()=>{if(!(!a.workspaceId||!a.title.trim()||!a.symbol.trim()||!a.promptTemplate.trim()||!k(a.condition))){M(!0);try{const e=re(a);j?await se(j.id,e):await te(e),p(!1),f(null),o(g),await d()}finally{M(!1)}}},z=async e=>{confirm(t("common.confirmDelete"))&&(await ae(e),await d())},_=async e=>{await ne(e),await d()};return T&&n.length===0?s.jsx("div",{className:"flex h-64 items-center justify-center text-gray-400 animate-pulse",children:t("common.loading")}):s.jsxs("div",{className:"space-y-4 animate-fade-in",children:[s.jsx(Y,{title:t("monitors.title"),description:"Create event monitors that trigger agent analysis and stream results back to channels.",actions:s.jsxs(u,{onClick:E,children:[s.jsx(Z,{size:16})," ",t("monitors.add")]})}),n.length===0?s.jsx(X,{message:t("monitors.noMonitors"),icon:O}):s.jsx("div",{className:"space-y-3",children:n.map(e=>s.jsx(U,{children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.title}),s.jsx(h,{variant:e.enabled?"success":"default",children:e.enabled?t("monitors.enabled"):"disabled"}),s.jsx(h,{variant:"default",children:e.sourceType}),s.jsx(h,{variant:"default",children:e.platform}),e.lastStatus&&s.jsx(h,{variant:e.lastStatus==="failed"?"danger":"default",children:e.lastStatus})]}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-500 dark:text-gray-400",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"Workspace:"})," ",e.workspaceId]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Subject:"})," ",v["stock.quote"].renderSummary(e)]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Condition:"})," ",C(e)]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Execution:"})," ",e.executionMode]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Cooldown:"})," ",Math.round(e.cooldownMs/6e4),"m"]}),e.lastTriggeredAt&&s.jsxs("span",{children:[s.jsxs("strong",{children:[t("monitors.lastRun"),":"]})," ",V(e.lastTriggeredAt)]})]}),s.jsx("p",{className:"mt-2 whitespace-pre-wrap text-sm text-gray-700 dark:text-gray-300",children:e.promptTemplate}),e.lastError&&s.jsx("p",{className:"mt-2 text-xs text-red-500",children:e.lastError})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(u,{variant:"secondary",size:"sm",onClick:()=>_(e.id),title:t("monitors.run"),children:s.jsx(G,{size:14})}),s.jsx(u,{variant:"secondary",size:"sm",onClick:()=>A(e),title:t("common.save"),children:s.jsx(J,{size:14})}),s.jsx(u,{variant:"danger",size:"sm",onClick:()=>z(e.id),title:t("common.delete"),children:s.jsx(K,{size:14})})]})]})},e.id))}),s.jsx(Q,{open:S,title:t(j?"monitors.edit":"monitors.add"),onClose:()=>p(!1),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(b,{label:"Workspace",value:a.workspaceId,onChange:e=>o({...a,workspaceId:e.target.value}),children:I}),s.jsx(x,{label:t("monitors.monitorTitle"),value:a.title,onChange:e=>o({...a,title:e.target.value})}),s.jsx(b,{label:"Source",value:a.sourceType,onChange:e=>o({...a,sourceType:e.target.value}),children:Object.entries(v).map(([e,r])=>s.jsx("option",{value:e,children:r.label},e))}),a.sourceType==="stock.quote"&&s.jsx(x,{label:"Symbol",value:a.symbol,onChange:e=>o({...a,symbol:e.target.value}),placeholder:"AAPL"}),s.jsx(x,{label:t("monitors.condition"),value:a.condition,onChange:e=>o({...a,condition:e.target.value}),placeholder:"abs_change_percent >= 3"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(x,{label:t("monitors.cooldown"),value:a.cooldownMinutes,onChange:e=>o({...a,cooldownMinutes:e.target.value})}),s.jsxs(b,{label:"Execution",value:a.executionMode,onChange:e=>o({...a,executionMode:e.target.value}),children:[s.jsx("option",{value:"side-thread",children:"side-thread"}),s.jsx("option",{value:"same-thread",children:"same-thread"})]})]}),s.jsx(H,{label:t("monitors.prompt"),rows:6,value:a.promptTemplate,onChange:e=>o({...a,promptTemplate:e.target.value})}),s.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[s.jsx("input",{type:"checkbox",checked:a.enabled,onChange:e=>o({...a,enabled:e.target.checked})}),t("monitors.enabled")]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(u,{variant:"secondary",onClick:()=>p(!1),children:t("common.cancel")}),s.jsx(u,{onClick:P,disabled:N,children:t("common.save")})]})]})})]})}export{ve as default};
@@ -1 +1 @@
1
- import{j as e,C as m,g as a}from"./index-B36eowj-.js";function u({title:s,description:r,actions:t}){return e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:s}),r?e.jsx("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-muted-foreground",children:r}):null]}),t?e.jsx("div",{className:"flex shrink-0 flex-wrap gap-2",children:t}):null]})}function o({title:s,description:r,actions:t,children:l,className:d,bodyClassName:n}){return e.jsxs(m,{className:a("p-0",d),children:[(s||r||t)&&e.jsxs("div",{className:"flex flex-col gap-3 border-b px-5 py-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[s?e.jsx("h2",{className:"text-sm font-semibold text-foreground",children:s}):null,r?e.jsx("p",{className:"mt-1 text-sm leading-5 text-muted-foreground",children:r}):null]}),t?e.jsx("div",{className:"flex shrink-0 flex-wrap gap-2",children:t}):null]}),e.jsx("div",{className:a("p-5",n),children:l})]})}const x={neutral:"border-border bg-muted text-muted-foreground",success:"border-primary/20 bg-primary/10 text-primary",warning:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-200",danger:"border-destructive/20 bg-destructive/10 text-destructive dark:text-red-200",info:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-400/20 dark:bg-blue-500/10 dark:text-blue-200"};function b({children:s,tone:r="neutral"}){return e.jsx("span",{className:a("inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-medium",x[r]),children:s})}export{u as P,o as S,b as a};
1
+ import{j as e,C as m,g as a}from"./index-DwhTjLA1.js";function u({title:s,description:r,actions:t}){return e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:s}),r?e.jsx("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-muted-foreground",children:r}):null]}),t?e.jsx("div",{className:"flex shrink-0 flex-wrap gap-2",children:t}):null]})}function o({title:s,description:r,actions:t,children:l,className:d,bodyClassName:n}){return e.jsxs(m,{className:a("p-0",d),children:[(s||r||t)&&e.jsxs("div",{className:"flex flex-col gap-3 border-b px-5 py-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[s?e.jsx("h2",{className:"text-sm font-semibold text-foreground",children:s}):null,r?e.jsx("p",{className:"mt-1 text-sm leading-5 text-muted-foreground",children:r}):null]}),t?e.jsx("div",{className:"flex shrink-0 flex-wrap gap-2",children:t}):null]}),e.jsx("div",{className:a("p-5",n),children:l})]})}const x={neutral:"border-border bg-muted text-muted-foreground",success:"border-primary/20 bg-primary/10 text-primary",warning:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-200",danger:"border-destructive/20 bg-destructive/10 text-destructive dark:text-red-200",info:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-400/20 dark:bg-blue-500/10 dark:text-blue-200"};function b({children:s,tone:r="neutral"}){return e.jsx("span",{className:a("inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-medium",x[r]),children:s})}export{u as P,o as S,b as a};
@@ -0,0 +1,11 @@
1
+ import{c as Z,A as c,u as xe,D as he,r as n,j as e,L as ve,B as l,Z as pe,g as F,C as f,I as h,E as ue,G as ge}from"./index-DwhTjLA1.js";import{B as C}from"./Badge-BIojwD6s.js";import{M as U}from"./Modal-D2U4r2V0.js";import{S as O}from"./Select-CAscWpy5.js";import{E as q}from"./EmptyState-BqCx1oWr.js";import{P as fe,S as I}from"./Page-urf5GcT_.js";import{g as je}from"./projects-C6bbkC-O.js";import{c as G,f as be}from"./desktop-Ci1fnRDR.js";import{h as A,c as _e}from"./desktop-Do_UrC-o.js";import{A as ye}from"./arrow-left-7HrNuS-V.js";import{S as Ne}from"./shield-check-Cnn-yQUA.js";import{H as K}from"./heart-CGqU-qfw.js";import{P as we}from"./plug-Mexu4gyV.js";import{P as Se}from"./plus-B_Q5-Oj7.js";import{C as Ce}from"./check-DGlyq4xX.js";import{T as ke}from"./trash-2-oWCxwQ9D.js";import{S as Pe}from"./save-CJ_QFPw0.js";import{P as ze}from"./play-CGYnmC4Q.js";import"./index-Df-Trovt.js";import"./chevron-down-Bb_3EHq9.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 Ie=[["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"}]],Ae=Z("layers",Ie);/**
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 $e=[["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"}]],Le=Z("pause",$e),Me=s=>c.get(`/projects/${s}/providers`),Ee=(s,t)=>c.post(`/projects/${s}/providers`,t),He=(s,t)=>c.delete(`/projects/${s}/providers/${t}`),Be=(s,t)=>c.post(`/projects/${s}/providers/${t}/activate`),De=s=>c.get(`/projects/${s}/models`),Re=(s,t)=>c.post(`/projects/${s}/model`,{model:t}),Te=s=>c.get(`/projects/${s}/heartbeat`),Fe=s=>c.post(`/projects/${s}/heartbeat/pause`),Ue=s=>c.post(`/projects/${s}/heartbeat/resume`),Oe=s=>c.post(`/projects/${s}/heartbeat/run`),qe=(s,t)=>c.post(`/projects/${s}/heartbeat/interval`,{minutes:t}),o={enabled:!1,provider_id:A,runtime_image_id:_e("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 vs(){var D,R;const{t:s}=xe(),{name:t}=he(),[_,V]=n.useState("overview"),[p,W]=n.useState(null),[$,X]=n.useState([]),[Ze,J]=n.useState(""),[i,Q]=n.useState(null),[L,Y]=n.useState([]),[ee,se]=n.useState(""),[ae,M]=n.useState(!0),[m,v]=n.useState(o),[te,E]=n.useState(!1),[H,k]=n.useState(""),[re,N]=n.useState(!1),[x,y]=n.useState({name:"",api_key:"",base_url:"",model:""}),[oe,w]=n.useState(!1),[B,ne]=n.useState("30"),d=n.useCallback(async()=>{var a,r,j,u;if(t)try{M(!0);const[b,g,S,P,T]=await Promise.allSettled([je(t),Me(t),Te(t),De(t),G()]);if(b.status==="fulfilled"&&W(b.value),g.status==="fulfilled"&&(X(g.value.providers||[]),J(g.value.active_provider||"")),S.status==="fulfilled"&&Q(S.value),P.status==="fulfilled"&&(Y(P.value.models||[]),se(P.value.current||"")),T.status==="fulfilled"){const z=(r=(a=T.value.parsed)==null?void 0:a.projects)==null?void 0:r.find(me=>me.name===t);v(Ge((u=(j=z==null?void 0:z.agent)==null?void 0:j.options)==null?void 0:u.sandbox))}}finally{M(!1)}},[t]);n.useEffect(()=>{d();const a=()=>d();return window.addEventListener("cc:refresh",a),()=>window.removeEventListener("cc:refresh",a)},[d]);const le=async()=>{!t||!x.name||(await Ee(t,x),N(!1),y({name:"",api_key:"",base_url:"",model:""}),d())},de=async()=>{t&&(await qe(t,parseInt(B)),w(!1),d())},ce=[{key:"overview",icon:Ae},{key:"providers",icon:pe},{key:"sandbox",icon:Ne},{key:"heartbeat",icon:K}],ie=async()=>{var a;if(t){E(!0),k("");try{const j=(await G()).parsed||{},u=Array.isArray(j.projects)?[...j.projects]:[],b=u.findIndex(S=>S.name===t);if(b<0)throw new Error(`Project not found in config: ${t}`);const g=u[b];u[b]={...g,agent:{...g.agent,options:{...((a=g.agent)==null?void 0:a.options)||{},sandbox:Ke(m)}}},await be({...j,projects:u}),k("Sandbox settings saved."),await d()}catch(r){k((r==null?void 0:r.message)||String(r))}finally{E(!1)}}};return ae&&!p?e.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground animate-pulse",children:"Loading..."}):e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsx(fe,{title:t,description:"Project overview, providers, and heartbeat status. Low-frequency settings are no longer editable in the daily UI.",actions:e.jsx(ve,{to:"/projects",children:e.jsxs(l,{variant:"secondary",size:"sm",children:[e.jsx(ye,{size:14})," Back"]})})}),p&&e.jsx(C,{variant:"info",children:p.agent_type}),H?e.jsx("div",{role:"status",className:"rounded-lg border border-primary/20 bg-primary/10 px-4 py-3 text-sm text-primary",children:H}):null,e.jsx("div",{className:"flex gap-2",children:ce.map(({key:a,icon:r})=>e.jsxs("button",{onClick:()=>V(a),className:F("flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all",_===a?"bg-primary text-primary-foreground shadow-md":"bg-secondary text-secondary-foreground hover:bg-secondary/80"),children:[e.jsx(r,{size:16}),s(`projects.tabs.${a}`)]},a))}),_==="overview"&&p&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(I,{title:s("projects.platforms"),children:e.jsx("div",{className:"flex flex-wrap gap-2",children:(D=p.platforms)==null?void 0:D.map(a=>e.jsxs(C,{variant:a.connected?"success":"danger",children:[e.jsx(we,{size:12,className:"mr-1"})," ",a.type," ",a.connected?"✓":"✗"]},a.type))})}),e.jsxs(I,{title:s("sessions.title"),children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[p.sessions_count," ",s("nav.sessions").toLowerCase()]}),((R=p.active_session_keys)==null?void 0:R.length)>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:p.active_session_keys.map(a=>e.jsx(C,{variant:"default",children:a},a))})]})]}),_==="providers"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:s("providers.title")}),e.jsxs(l,{size:"sm",onClick:()=>N(!0),children:[e.jsx(Se,{size:14})," ",s("providers.add")]})]}),$.length===0?e.jsx(q,{message:s("common.noData")}):e.jsx("div",{className:"space-y-2",children:$.map(a=>e.jsx(f,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-foreground",children:a.name}),a.active&&e.jsx(C,{variant:"success",children:s("providers.active")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[a.model," ",a.base_url?`· ${a.base_url}`:""]})]}),e.jsxs("div",{className:"flex gap-2",children:[!a.active&&e.jsxs(l,{size:"sm",variant:"secondary",onClick:()=>{Be(t,a.name).then(d)},children:[e.jsx(Ce,{size:14})," ",s("providers.activate")]}),!a.active&&e.jsx(l,{size:"sm",variant:"danger",onClick:()=>{He(t,a.name).then(d)},children:e.jsx(ke,{size:14})})]})]})},a.name))}),L.length>0&&e.jsxs(f,{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:s("providers.models")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:L.map(a=>e.jsx("button",{onClick:()=>{Re(t,a).then(d)},className:F("px-3 py-1.5 rounded-lg text-xs font-medium transition-all",a===ee?"bg-primary/15 text-primary border border-primary/30":"bg-secondary text-secondary-foreground hover:bg-secondary/80"),children:a},a))})]}),e.jsx(U,{open:re,onClose:()=>N(!1),title:s("providers.add"),children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(h,{label:s("providers.name"),value:x.name,onChange:a=>y({...x,name:a.target.value})}),e.jsx(h,{label:"API Key",type:"password",value:x.api_key,onChange:a=>y({...x,api_key:a.target.value})}),e.jsx(h,{label:s("providers.baseUrl"),value:x.base_url,onChange:a=>y({...x,base_url:a.target.value}),placeholder:"https://api.example.com"}),e.jsx(h,{label:s("providers.model"),value:x.model,onChange:a=>y({...x,model:a.target.value})}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(l,{variant:"secondary",onClick:()=>N(!1),children:s("common.cancel")}),e.jsx(l,{onClick:le,children:s("providers.add")})]})]})})]}),_==="sandbox"&&e.jsx(I,{title:"Sandbox",description:"Run this project agent inside an OpenSandbox container.",actions:e.jsxs(l,{size:"sm",onClick:()=>void ie(),loading:te,children:[e.jsx(Pe,{size:14})," Save"]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:"flex items-center gap-3 text-sm font-medium text-foreground",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-border",checked:m.enabled,onChange:a=>v(r=>({...r,enabled:a.target.checked}))}),"Enable sandbox mode"]}),m.enabled?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[e.jsxs(O,{label:"State scope",value:m.state_scope,onChange:a=>v(r=>({...r,state_scope:a.target.value})),children:[e.jsx("option",{value:"user",children:"User"}),e.jsx("option",{value:"project",children:"Project"}),e.jsx("option",{value:"thread",children:"Thread"}),e.jsx("option",{value:"run",children:"Run"})]}),e.jsx(h,{label:"Timeout seconds",type:"number",value:m.timeout_seconds,onChange:a=>v(r=>({...r,timeout_seconds:a.target.value}))}),e.jsxs(O,{label:"Sandbox lifecycle",value:m.sandbox_lifecycle,onChange:a=>v(r=>({...r,sandbox_lifecycle:a.target.value})),children:[e.jsx("option",{value:"per_thread",children:"Keep warm per thread"}),e.jsx("option",{value:"per_run",children:"Close after each run"})]}),e.jsx(h,{label:"Idle seconds",type:"number",value:m.idle_seconds,onChange:a=>v(r=>({...r,idle_seconds:a.target.value}))}),e.jsx(h,{label:"Warm pool",type:"number",value:m.warm_pool_size,onChange:a=>v(r=>({...r,warm_pool_size:a.target.value}))}),e.jsx(h,{label:"CPU",value:m.cpu,onChange:a=>v(r=>({...r,cpu:a.target.value}))}),e.jsx(h,{label:"Memory",value:m.memory,onChange:a=>v(r=>({...r,memory:a.target.value}))})]}),e.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."})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Local bundled runtime execution is active for this project."})]})}),_==="heartbeat"&&e.jsxs("div",{className:"space-y-4",children:[i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs(f,{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s("heartbeat.status")}),e.jsx("p",{className:"text-lg font-bold text-foreground mt-1",children:i.paused?s("heartbeat.paused"):s("heartbeat.running")})]}),e.jsxs(f,{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s("heartbeat.interval")}),e.jsxs("p",{className:"text-lg font-bold text-foreground mt-1",children:[i.interval_mins,"m"]})]}),e.jsxs(f,{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s("heartbeat.runCount")}),e.jsx("p",{className:"text-lg font-bold text-foreground mt-1",children:i.run_count})]}),e.jsxs(f,{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s("heartbeat.errorCount")}),e.jsx("p",{className:"text-lg font-bold text-foreground mt-1",children:i.error_count})]})]}),e.jsx(f,{children:e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("p",{className:"text-muted-foreground",children:[s("heartbeat.lastRun"),": ",e.jsx("span",{className:"text-foreground",children:ue(i.last_run)})]}),e.jsxs("p",{className:"text-muted-foreground",children:[s("heartbeat.skippedBusy"),": ",e.jsx("span",{className:"text-foreground",children:i.skipped_busy})]}),i.last_error&&e.jsx("p",{className:"text-destructive",children:i.last_error})]})}),e.jsxs("div",{className:"flex gap-2",children:[i.paused?e.jsxs(l,{onClick:()=>{Ue(t).then(d)},children:[e.jsx(ze,{size:14})," ",s("heartbeat.resume")]}):e.jsxs(l,{variant:"secondary",onClick:()=>{Fe(t).then(d)},children:[e.jsx(Le,{size:14})," ",s("heartbeat.pause")]}),e.jsxs(l,{variant:"secondary",onClick:()=>{Oe(t).then(d)},children:[e.jsx(K,{size:14})," ",s("heartbeat.trigger")]}),e.jsxs(l,{variant:"secondary",onClick:()=>w(!0),children:[e.jsx(ge,{size:14})," ",s("heartbeat.setInterval")]})]})]}):e.jsx(q,{message:s("common.noData")}),e.jsx(U,{open:oe,onClose:()=>w(!1),title:s("heartbeat.setInterval"),children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(h,{label:`${s("heartbeat.interval")} (min)`,type:"number",value:B,onChange:a=>ne(a.target.value)}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(l,{variant:"secondary",onClick:()=>w(!1),children:s("common.cancel")}),e.jsx(l,{onClick:de,children:s("common.save")})]})]})})]})]})}function Ge(s){return{enabled:!!(s!=null&&s.enabled),provider_id:(s==null?void 0:s.provider_id)||A,runtime_image_id:(s==null?void 0:s.runtime_image_id)||o.runtime_image_id,server_url:(s==null?void 0:s.server_url)||o.server_url,image:(s==null?void 0:s.image)||o.image,acp_port:String((s==null?void 0:s.acp_port)||o.acp_port),state_scope:(s==null?void 0:s.state_scope)||o.state_scope,timeout_seconds:String((s==null?void 0:s.timeout_seconds)||o.timeout_seconds),sandbox_lifecycle:(s==null?void 0:s.sandbox_lifecycle)||o.sandbox_lifecycle,idle_seconds:String((s==null?void 0:s.idle_seconds)||o.idle_seconds),warm_pool_size:String((s==null?void 0:s.warm_pool_size)??o.warm_pool_size),cpu:(s==null?void 0:s.cpu)||o.cpu,memory:(s==null?void 0:s.memory)||o.memory,workspace_mount_path:(s==null?void 0:s.workspace_mount_path)||o.workspace_mount_path,state_mount_path:(s==null?void 0:s.state_mount_path)||o.state_mount_path}}function Ke(s){return{enabled:s.enabled,provider_id:s.provider_id.trim()||A,runtime_image_id:s.runtime_image_id.trim()||o.runtime_image_id,state_scope:s.state_scope,timeout_seconds:Number(s.timeout_seconds)||Number(o.timeout_seconds),sandbox_lifecycle:s.sandbox_lifecycle,idle_seconds:Number(s.idle_seconds)||Number(o.idle_seconds),warm_pool_size:Math.max(0,Number(s.warm_pool_size)||0),cpu:s.cpu.trim()||o.cpu,memory:s.memory.trim()||o.memory}}export{vs as default};
@@ -1 +1 @@
1
- import{u as x,r,j as e,F as f,L as j,C as u}from"./index-B36eowj-.js";import{B as l}from"./Badge-Qk9qHovH.js";import{E as h}from"./EmptyState-kD9yAwtw.js";import{P as p}from"./Page-CnB9ePsb.js";import{l as g}from"./projects-DwfZwxDW.js";import{S as v,A as N}from"./server-GsXyQAZm.js";import{H as w}from"./heart-u4Q1aOqj.js";function z(){const{t}=x(),[a,m]=r.useState([]),[d,n]=r.useState(!0),i=r.useCallback(async()=>{try{n(!0);const s=await g();m(s.projects||[])}finally{n(!1)}},[]);return r.useEffect(()=>{i();const s=()=>i();return window.addEventListener("cc:refresh",s),()=>window.removeEventListener("cc:refresh",s)},[i]),d&&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(h,{message:t("projects.noProjects"),icon:f}):e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsx(p,{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(u,{hover:!0,className:"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(v,{size:18,className:"text-primary"}),e.jsx("h3",{className:"font-semibold text-foreground",children:s.name})]}),e.jsx(N,{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:"flex items-center justify-between text-xs text-muted-foreground",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(w,{size:12})," ",t("heartbeat.title")]})]})]})},s.name)})})]})}export{z as default};
1
+ import{u as x,r,j as e,F as f,L as j,C as u}from"./index-DwhTjLA1.js";import{B as l}from"./Badge-BIojwD6s.js";import{E as h}from"./EmptyState-BqCx1oWr.js";import{P as p}from"./Page-urf5GcT_.js";import{l as g}from"./projects-C6bbkC-O.js";import{S as v,A as N}from"./server-Cd96R7WL.js";import{H as w}from"./heart-CGqU-qfw.js";function z(){const{t}=x(),[a,m]=r.useState([]),[d,n]=r.useState(!0),i=r.useCallback(async()=>{try{n(!0);const s=await g();m(s.projects||[])}finally{n(!1)}},[]);return r.useEffect(()=>{i();const s=()=>i();return window.addEventListener("cc:refresh",s),()=>window.removeEventListener("cc:refresh",s)},[i]),d&&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(h,{message:t("projects.noProjects"),icon:f}):e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsx(p,{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(u,{hover:!0,className:"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(v,{size:18,className:"text-primary"}),e.jsx("h3",{className:"font-semibold text-foreground",children:s.name})]}),e.jsx(N,{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:"flex items-center justify-between text-xs text-muted-foreground",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(w,{size:12})," ",t("heartbeat.title")]})]})]})},s.name)})})]})}export{z as default};
@@ -1,4 +1,4 @@
1
- import{c as jn,z as he,aG as Y,j as S,r as p,g as vt}from"./index-B36eowj-.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-BNFx4uYv.js";import{C as St}from"./chevron-down-Bh53e0O-.js";import{C as $n}from"./check-BnclClRU.js";/**
1
+ import{c as jn,z as he,aO as Y,j as S,r as p,g as vt}from"./index-DwhTjLA1.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-Df-Trovt.js";import{C as St}from"./chevron-down-Bb_3EHq9.js";import{C as $n}from"./check-DGlyq4xX.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,D as z,r as a,j as e,L as S,B as g,g as j,T as B}from"./index-B36eowj-.js";import{B as b}from"./Badge-Qk9qHovH.js";import{g as E,a as L}from"./sessions-CLcKA1Tt.js";import{C as _,A}from"./ChatMarkdown-BKdW8OON.js";import{A as D}from"./arrow-left-CNEAuElg.js";import{C as I}from"./circle-ClZTWCWO.js";import{W as y,R as M}from"./wifi-off-BHPzPY_B.js";import{B as R,U as T}from"./user-BtC_pVXV.js";import"./check-BnclClRU.js";function G(){var p;const{t:r}=C(),{project:i,id:l}=z(),[s,v]=a.useState(null),[d,m]=a.useState(""),[c,x]=a.useState(!1),[w,u]=a.useState(!0),f=a.useRef(null),o=a.useCallback(async()=>{if(!(!i||!l))try{u(!0);const t=await E(i,l,200);v(t)}finally{u(!1)}},[i,l]);a.useEffect(()=>{o()},[o]),a.useEffect(()=>{var t;(t=f.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 pb-4 border-b",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(D,{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-lg 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 text-[10px] text-primary bg-primary/10 px-1.5 py-0.5 rounded-full",children:[e.jsx(I,{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})," ",r("sessions.offline")]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx(b,{children:i}),(s==null?void 0:s.platform)&&e.jsx(b,{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(M,{size:14})," ",r("common.refresh")]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-6 space-y-5",children:[(!(s!=null&&s.history)||s.history.length===0)&&e.jsx("p",{className:"text-center text-sm text-muted-foreground py-12",children:r("sessions.noMessages")}),(p=s==null?void 0:s.history)==null?void 0:p.map((t,k)=>{const n=t.role==="user";return e.jsxs("div",{className:j("flex gap-3",n?"justify-end":"justify-start"),children:[!n&&e.jsx("div",{className:"w-8 h-8 rounded-md bg-primary/10 flex items-center justify-center shrink-0 mt-1",children:e.jsx(R,{size:16,className:"text-primary"})}),e.jsx("div",{className:j("rounded-lg px-5 py-3.5 text-sm",n?"max-w-[70%] bg-primary text-primary-foreground rounded-br-md":"max-w-[85%] bg-card border text-card-foreground rounded-bl-md shadow-sm"),children:e.jsx(_,{content:t.content,isUser:n})}),n&&e.jsx("div",{className:"w-8 h-8 rounded-md bg-muted flex items-center justify-center shrink-0 mt-1",children:e.jsx(T,{size:16,className:"text-muted-foreground"})})]},k)}),e.jsx("div",{ref:f})]}),e.jsx("div",{className:"border-t pt-4",children:s!=null&&s.live?e.jsxs("div",{className:"relative",children:[e.jsx(B,{value:d,onChange:t=>m(t.target.value),onKeyDown:N,placeholder:r("sessions.messageInput"),rows:2,className:"min-h-[88px] rounded-[24px] border-gray-200 bg-white px-4 pb-14 pt-3 text-[15px] leading-6 shadow-[0_12px_34px_rgba(15,23,42,0.08)] dark:border-white/[0.08] dark:bg-[rgba(0,0,0,0.42)] 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":r("sessions.messageInput"),className:"absolute bottom-3 right-3 h-10 w-10 rounded-full bg-slate-900 px-0 text-white shadow-none hover:bg-slate-800 disabled:bg-slate-300 disabled:text-white disabled:opacity-100 dark:bg-slate-100 dark:text-slate-950 dark:hover:bg-white 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(A,{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:r("sessions.notLiveHint")})]})})]})}export{G as default};
1
+ import{u as C,D as z,r as a,j as e,L as S,B as g,g as j,T as B}from"./index-DwhTjLA1.js";import{B as b}from"./Badge-BIojwD6s.js";import{g as E,a as L}from"./sessions-BACfV8s1.js";import{C as _,A}from"./ChatMarkdown-DqszsPB_.js";import{A as D}from"./arrow-left-7HrNuS-V.js";import{C as I}from"./circle-DIpqZnYw.js";import{W as y,R as M}from"./wifi-off-DHxnNkdY.js";import{B as R,U as T}from"./user-BzE9BwsY.js";import"./check-DGlyq4xX.js";function G(){var p;const{t:r}=C(),{project:i,id:l}=z(),[s,v]=a.useState(null),[d,m]=a.useState(""),[c,x]=a.useState(!1),[w,u]=a.useState(!0),f=a.useRef(null),o=a.useCallback(async()=>{if(!(!i||!l))try{u(!0);const t=await E(i,l,200);v(t)}finally{u(!1)}},[i,l]);a.useEffect(()=>{o()},[o]),a.useEffect(()=>{var t;(t=f.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 pb-4 border-b",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(D,{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-lg 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 text-[10px] text-primary bg-primary/10 px-1.5 py-0.5 rounded-full",children:[e.jsx(I,{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})," ",r("sessions.offline")]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx(b,{children:i}),(s==null?void 0:s.platform)&&e.jsx(b,{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(M,{size:14})," ",r("common.refresh")]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-6 space-y-5",children:[(!(s!=null&&s.history)||s.history.length===0)&&e.jsx("p",{className:"text-center text-sm text-muted-foreground py-12",children:r("sessions.noMessages")}),(p=s==null?void 0:s.history)==null?void 0:p.map((t,k)=>{const n=t.role==="user";return e.jsxs("div",{className:j("flex gap-3",n?"justify-end":"justify-start"),children:[!n&&e.jsx("div",{className:"w-8 h-8 rounded-md bg-primary/10 flex items-center justify-center shrink-0 mt-1",children:e.jsx(R,{size:16,className:"text-primary"})}),e.jsx("div",{className:j("rounded-lg px-5 py-3.5 text-sm",n?"max-w-[70%] bg-primary text-primary-foreground rounded-br-md":"max-w-[85%] bg-card border text-card-foreground rounded-bl-md shadow-sm"),children:e.jsx(_,{content:t.content,isUser:n})}),n&&e.jsx("div",{className:"w-8 h-8 rounded-md bg-muted flex items-center justify-center shrink-0 mt-1",children:e.jsx(T,{size:16,className:"text-muted-foreground"})})]},k)}),e.jsx("div",{ref:f})]}),e.jsx("div",{className:"border-t pt-4",children:s!=null&&s.live?e.jsxs("div",{className:"relative",children:[e.jsx(B,{value:d,onChange:t=>m(t.target.value),onKeyDown:N,placeholder:r("sessions.messageInput"),rows:2,className:"min-h-[88px] rounded-[24px] border-gray-200 bg-white px-4 pb-14 pt-3 text-[15px] leading-6 shadow-[0_12px_34px_rgba(15,23,42,0.08)] dark:border-white/[0.08] dark:bg-[rgba(0,0,0,0.42)] 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":r("sessions.messageInput"),className:"absolute bottom-3 right-3 h-10 w-10 rounded-full bg-slate-900 px-0 text-white shadow-none hover:bg-slate-800 disabled:bg-slate-300 disabled:text-white disabled:opacity-100 dark:bg-slate-100 dark:text-slate-950 dark:hover:bg-white 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(A,{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:r("sessions.notLiveHint")})]})})]})}export{G as default};
@@ -1 +1 @@
1
- import{u as N,r as n,j as s,M as x,L as v,C as y}from"./index-B36eowj-.js";import{B as f}from"./Badge-Qk9qHovH.js";import{S as w}from"./Select-zfoksLGB.js";import{E as _}from"./EmptyState-kD9yAwtw.js";import{l as S}from"./projects-DwfZwxDW.js";import{l as C}from"./sessions-CLcKA1Tt.js";import{F as L}from"./funnel-_5hsz0xI.js";import{C as M}from"./circle-ClZTWCWO.js";import{U as E,B as $}from"./user-BtC_pVXV.js";import"./index-BNFx4uYv.js";import"./chevron-down-Bh53e0O-.js";import"./check-BnclClRU.js";function k(a,o){if(!a)return"";const m=Date.now()-new Date(a).getTime(),i=Math.floor(m/6e4);if(i<1)return o("sessions.justNow");if(i<60)return`${i}m`;const l=Math.floor(i/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}function G(){const{t:a}=N(),[o,m]=n.useState([]),[i,l]=n.useState([]),[c,j]=n.useState(""),[h,p]=n.useState(!0),d=n.useCallback(async()=>{p(!0);try{const{projects:e}=await S();l(e||[]);const t=await Promise.all((e||[]).map(async r=>{try{const{sessions:g}=await C(r.name);return{project:r.name,sessions:g||[]}}catch{return{project:r.name,sessions:[]}}}));m(t)}finally{p(!1)}},[]);n.useEffect(()=>{d();const e=()=>d();return window.addEventListener("cc:refresh",e),()=>window.removeEventListener("cc:refresh",e)},[d]);const u=n.useMemo(()=>(c?o.filter(t=>t.project===c):o).flatMap(t=>t.sessions.map(r=>({...r,_project:t.project}))).sort((t,r)=>(r.updated_at||r.created_at||"").localeCompare(t.updated_at||t.created_at||"")),[o,c]);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.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(L,{size:16,className:"text-muted-foreground"}),s.jsxs(w,{value:c,onChange:e=>j(e.target.value),className:"w-auto min-w-48",children:[s.jsx("option",{value:"",children:a("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:[u.length," ",a("nav.sessions").toLowerCase()]})]}),u.length===0?s.jsx(_,{message:a("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:u.map(e=>s.jsx(v,{to:`/sessions/${encodeURIComponent(e._project)}/${encodeURIComponent(e.id)}`,children:s.jsxs(y,{hover:!0,className:"group 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:k(e.updated_at||e.created_at,a)})]}),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(E,{size:10,className:"inline mr-1 -mt-0.5 opacity-60"}):s.jsx($,{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:a("sessions.noMessages")})}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",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{G as default};
1
+ import{u as N,r as n,j as s,M as x,L as v,C as y}from"./index-DwhTjLA1.js";import{B as f}from"./Badge-BIojwD6s.js";import{S as w}from"./Select-CAscWpy5.js";import{E as _}from"./EmptyState-BqCx1oWr.js";import{l as S}from"./projects-C6bbkC-O.js";import{l as C}from"./sessions-BACfV8s1.js";import{F as L}from"./funnel-Bbf0ERLP.js";import{C as M}from"./circle-DIpqZnYw.js";import{U as E,B as $}from"./user-BzE9BwsY.js";import"./index-Df-Trovt.js";import"./chevron-down-Bb_3EHq9.js";import"./check-DGlyq4xX.js";function k(a,o){if(!a)return"";const m=Date.now()-new Date(a).getTime(),i=Math.floor(m/6e4);if(i<1)return o("sessions.justNow");if(i<60)return`${i}m`;const l=Math.floor(i/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}function G(){const{t:a}=N(),[o,m]=n.useState([]),[i,l]=n.useState([]),[c,j]=n.useState(""),[h,p]=n.useState(!0),d=n.useCallback(async()=>{p(!0);try{const{projects:e}=await S();l(e||[]);const t=await Promise.all((e||[]).map(async r=>{try{const{sessions:g}=await C(r.name);return{project:r.name,sessions:g||[]}}catch{return{project:r.name,sessions:[]}}}));m(t)}finally{p(!1)}},[]);n.useEffect(()=>{d();const e=()=>d();return window.addEventListener("cc:refresh",e),()=>window.removeEventListener("cc:refresh",e)},[d]);const u=n.useMemo(()=>(c?o.filter(t=>t.project===c):o).flatMap(t=>t.sessions.map(r=>({...r,_project:t.project}))).sort((t,r)=>(r.updated_at||r.created_at||"").localeCompare(t.updated_at||t.created_at||"")),[o,c]);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.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(L,{size:16,className:"text-muted-foreground"}),s.jsxs(w,{value:c,onChange:e=>j(e.target.value),className:"w-auto min-w-48",children:[s.jsx("option",{value:"",children:a("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:[u.length," ",a("nav.sessions").toLowerCase()]})]}),u.length===0?s.jsx(_,{message:a("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:u.map(e=>s.jsx(v,{to:`/sessions/${encodeURIComponent(e._project)}/${encodeURIComponent(e.id)}`,children:s.jsxs(y,{hover:!0,className:"group 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:k(e.updated_at||e.created_at,a)})]}),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(E,{size:10,className:"inline mr-1 -mt-0.5 opacity-60"}):s.jsx($,{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:a("sessions.noMessages")})}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",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{G as default};
@@ -1,4 +1,4 @@
1
- import{c as Ne,j as t,g as Z,B as Q,r as o,W as ht,h as $e,i as Ve,k as bt,m as ft,l as gt,s as wt,n as Je,o as Ie,p as Xe,q as kt,t as yt,v as jt,w as vt,x as Nt,y as Ct,I as Le,T as St}from"./index-B36eowj-.js";import{X as Re,M as Ue}from"./Modal-DwY4lecS.js";import{g as _t,o as Kt,b as Lt,u as Mt,s as At}from"./desktop-C5vBT0yM.js";import{t as It,L as Oe}from"./session-utils-BDxzgTBC.js";import{n as zt,i as Pt,a as Ee,b as Tt,s as Bt,w as Me}from"./desktop-C6q6wBae.js";import{C as Dt,A as $t}from"./ChatMarkdown-BKdW8OON.js";import{C as Ye}from"./check-BnclClRU.js";import{C as ve}from"./circle-ClZTWCWO.js";import{B as Rt,U as Ut}from"./user-BtC_pVXV.js";import{S as Ot}from"./shield-check-4i0E3hmf.js";import{C as Et}from"./chevron-down-Bh53e0O-.js";import{R as Ft,W as Ht}from"./wifi-off-BHPzPY_B.js";import{S as Wt}from"./search-CniPk7Ey.js";import{P as Vt}from"./pencil-DLh9QNmT.js";import{T as Jt}from"./trash-2-DhtOCsO5.js";import"./index-BNFx4uYv.js";/**
1
+ import{c as Ne,j as t,g as Z,B as Q,r as o,W as ht,h as $e,i as Ve,k as bt,m as ft,l as gt,s as wt,n as Je,o as Ie,p as Xe,q as kt,t as yt,v as jt,w as vt,x as Nt,y as Ct,I as Le,T as St}from"./index-DwhTjLA1.js";import{X as Re,M as Ue}from"./Modal-D2U4r2V0.js";import{g as _t,o as Kt,b as Lt,u as Mt,s as At}from"./desktop-Ci1fnRDR.js";import{t as It,L as Oe}from"./session-utils-BNUbQBfF.js";import{n as zt,i as Pt,a as Ee,b as Tt,s as Bt,w as Me}from"./desktop-Do_UrC-o.js";import{C as Dt,A as $t}from"./ChatMarkdown-DqszsPB_.js";import{C as Ye}from"./check-DGlyq4xX.js";import{C as ve}from"./circle-DIpqZnYw.js";import{B as Rt,U as Ut}from"./user-BzE9BwsY.js";import{S as Ot}from"./shield-check-Cnn-yQUA.js";import{C as Et}from"./chevron-down-Bb_3EHq9.js";import{R as Ft,W as Ht}from"./wifi-off-DHxnNkdY.js";import{S as Wt}from"./search-D8Dkhsyq.js";import{P as Vt}from"./pencil-CHiy1MvK.js";import{T as Jt}from"./trash-2-oWCxwQ9D.js";import"./index-Df-Trovt.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,14 @@
1
+ import{c as ss,z as T,x as as,r as N,j as s,B as F,I as L,S as rs}from"./index-DwhTjLA1.js";import{M as yt}from"./Modal-D2U4r2V0.js";import{S as se}from"./Select-CAscWpy5.js";import{E as Pe}from"./EmptyState-BqCx1oWr.js";import{P as ns,S as _t,a as Me}from"./Page-urf5GcT_.js";import{c as os,d as is,e as ls,t as ds,f as Ae,h as cs,i as us,j as ms,k as hs,m as fs,n as gs,p as kt}from"./desktop-Ci1fnRDR.js";import{g as Ct,d as Et,c as ze,D as Re,e as Mt,f as Ie,h as $e,j as ps,k as xs,l as bs}from"./desktop-Do_UrC-o.js";import{T as Le}from"./trash-2-oWCxwQ9D.js";import{P as ke}from"./plus-B_Q5-Oj7.js";import{S as Oe}from"./save-CJ_QFPw0.js";import"./index-Df-Trovt.js";import"./chevron-down-Bb_3EHq9.js";import"./check-DGlyq4xX.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 vs=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Nt=ss("qr-code",vs);var ws=Object.defineProperty,Ne=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,St=(a,d,l)=>d in a?ws(a,d,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[d]=l,Fe=(a,d)=>{for(var l in d||(d={}))At.call(d,l)&&St(a,l,d[l]);if(Ne)for(var l of Ne(d))Rt.call(d,l)&&St(a,l,d[l]);return a},Be=(a,d)=>{var l={};for(var m in a)At.call(a,m)&&d.indexOf(m)<0&&(l[m]=a[m]);if(a!=null&&Ne)for(var m of Ne(a))d.indexOf(m)<0&&Rt.call(a,m)&&(l[m]=a[m]);return l};/**
7
+ * @license QR Code generator library (TypeScript)
8
+ * Copyright (c) Project Nayuki.
9
+ * SPDX-License-Identifier: MIT
10
+ */var de;(a=>{const d=class C{constructor(t,o,n,i){if(this.version=t,this.errorCorrectionLevel=o,this.modules=[],this.isFunction=[],t<C.MIN_VERSION||t>C.MAX_VERSION)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=t*4+17;let c=[];for(let h=0;h<this.size;h++)c.push(!1);for(let h=0;h<this.size;h++)this.modules.push(c.slice()),this.isFunction.push(c.slice());this.drawFunctionPatterns();const x=this.addEccAndInterleave(n);if(this.drawCodewords(x),i==-1){let h=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const y=this.getPenaltyScore();y<h&&(i=v,h=y),this.applyMask(v)}}w(0<=i&&i<=7),this.mask=i,this.applyMask(i),this.drawFormatBits(i),this.isFunction=[]}static encodeText(t,o){const n=a.QrSegment.makeSegments(t);return C.encodeSegments(n,o)}static encodeBinary(t,o){const n=a.QrSegment.makeBytes(t);return C.encodeSegments([n],o)}static encodeSegments(t,o,n=1,i=40,c=-1,x=!0){if(!(C.MIN_VERSION<=n&&n<=i&&i<=C.MAX_VERSION)||c<-1||c>7)throw new RangeError("Invalid value");let h,v;for(h=n;;h++){const b=C.getNumDataCodewords(h,o)*8,M=R.getTotalBits(t,h);if(M<=b){v=M;break}if(h>=i)throw new RangeError("Data too long")}for(const b of[C.Ecc.MEDIUM,C.Ecc.QUARTILE,C.Ecc.HIGH])x&&v<=C.getNumDataCodewords(h,b)*8&&(o=b);let y=[];for(const b of t){l(b.mode.modeBits,4,y),l(b.numChars,b.mode.numCharCountBits(h),y);for(const M of b.getData())y.push(M)}w(y.length==v);const f=C.getNumDataCodewords(h,o)*8;w(y.length<=f),l(0,Math.min(4,f-y.length),y),l(0,(8-y.length%8)%8,y),w(y.length%8==0);for(let b=236;y.length<f;b^=253)l(b,8,y);let j=[];for(;j.length*8<y.length;)j.push(0);return y.forEach((b,M)=>j[M>>>3]|=b<<7-(M&7)),new C(h,o,j,c)}getModule(t,o){return 0<=t&&t<this.size&&0<=o&&o<this.size&&this.modules[o][t]}getModules(){return this.modules}drawFunctionPatterns(){for(let n=0;n<this.size;n++)this.setFunctionModule(6,n,n%2==0),this.setFunctionModule(n,6,n%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const t=this.getAlignmentPatternPositions(),o=t.length;for(let n=0;n<o;n++)for(let i=0;i<o;i++)n==0&&i==0||n==0&&i==o-1||n==o-1&&i==0||this.drawAlignmentPattern(t[n],t[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){const o=this.errorCorrectionLevel.formatBits<<3|t;let n=o;for(let c=0;c<10;c++)n=n<<1^(n>>>9)*1335;const i=(o<<10|n)^21522;w(i>>>15==0);for(let c=0;c<=5;c++)this.setFunctionModule(8,c,m(i,c));this.setFunctionModule(8,7,m(i,6)),this.setFunctionModule(8,8,m(i,7)),this.setFunctionModule(7,8,m(i,8));for(let c=9;c<15;c++)this.setFunctionModule(14-c,8,m(i,c));for(let c=0;c<8;c++)this.setFunctionModule(this.size-1-c,8,m(i,c));for(let c=8;c<15;c++)this.setFunctionModule(8,this.size-15+c,m(i,c));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let n=0;n<12;n++)t=t<<1^(t>>>11)*7973;const o=this.version<<12|t;w(o>>>18==0);for(let n=0;n<18;n++){const i=m(o,n),c=this.size-11+n%3,x=Math.floor(n/3);this.setFunctionModule(c,x,i),this.setFunctionModule(x,c,i)}}drawFinderPattern(t,o){for(let n=-4;n<=4;n++)for(let i=-4;i<=4;i++){const c=Math.max(Math.abs(i),Math.abs(n)),x=t+i,h=o+n;0<=x&&x<this.size&&0<=h&&h<this.size&&this.setFunctionModule(x,h,c!=2&&c!=4)}}drawAlignmentPattern(t,o){for(let n=-2;n<=2;n++)for(let i=-2;i<=2;i++)this.setFunctionModule(t+i,o+n,Math.max(Math.abs(i),Math.abs(n))!=1)}setFunctionModule(t,o,n){this.modules[o][t]=n,this.isFunction[o][t]=!0}addEccAndInterleave(t){const o=this.version,n=this.errorCorrectionLevel;if(t.length!=C.getNumDataCodewords(o,n))throw new RangeError("Invalid argument");const i=C.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][o],c=C.ECC_CODEWORDS_PER_BLOCK[n.ordinal][o],x=Math.floor(C.getNumRawDataModules(o)/8),h=i-x%i,v=Math.floor(x/i);let y=[];const f=C.reedSolomonComputeDivisor(c);for(let b=0,M=0;b<i;b++){let Q=t.slice(M,M+v-c+(b<h?0:1));M+=Q.length;const q=C.reedSolomonComputeRemainder(Q,f);b<h&&Q.push(0),y.push(Q.concat(q))}let j=[];for(let b=0;b<y[0].length;b++)y.forEach((M,Q)=>{(b!=v-c||Q>=h)&&j.push(M[b])});return w(j.length==x),j}drawCodewords(t){if(t.length!=Math.floor(C.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let o=0;for(let n=this.size-1;n>=1;n-=2){n==6&&(n=5);for(let i=0;i<this.size;i++)for(let c=0;c<2;c++){const x=n-c,v=(n+1&2)==0?this.size-1-i:i;!this.isFunction[v][x]&&o<t.length*8&&(this.modules[v][x]=m(t[o>>>3],7-(o&7)),o++)}}w(o==t.length*8)}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let o=0;o<this.size;o++)for(let n=0;n<this.size;n++){let i;switch(t){case 0:i=(n+o)%2==0;break;case 1:i=o%2==0;break;case 2:i=n%3==0;break;case 3:i=(n+o)%3==0;break;case 4:i=(Math.floor(n/3)+Math.floor(o/2))%2==0;break;case 5:i=n*o%2+n*o%3==0;break;case 6:i=(n*o%2+n*o%3)%2==0;break;case 7:i=((n+o)%2+n*o%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[o][n]&&i&&(this.modules[o][n]=!this.modules[o][n])}}getPenaltyScore(){let t=0;for(let c=0;c<this.size;c++){let x=!1,h=0,v=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[c][y]==x?(h++,h==5?t+=C.PENALTY_N1:h>5&&t++):(this.finderPenaltyAddHistory(h,v),x||(t+=this.finderPenaltyCountPatterns(v)*C.PENALTY_N3),x=this.modules[c][y],h=1);t+=this.finderPenaltyTerminateAndCount(x,h,v)*C.PENALTY_N3}for(let c=0;c<this.size;c++){let x=!1,h=0,v=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[y][c]==x?(h++,h==5?t+=C.PENALTY_N1:h>5&&t++):(this.finderPenaltyAddHistory(h,v),x||(t+=this.finderPenaltyCountPatterns(v)*C.PENALTY_N3),x=this.modules[y][c],h=1);t+=this.finderPenaltyTerminateAndCount(x,h,v)*C.PENALTY_N3}for(let c=0;c<this.size-1;c++)for(let x=0;x<this.size-1;x++){const h=this.modules[c][x];h==this.modules[c][x+1]&&h==this.modules[c+1][x]&&h==this.modules[c+1][x+1]&&(t+=C.PENALTY_N2)}let o=0;for(const c of this.modules)o=c.reduce((x,h)=>x+(h?1:0),o);const n=this.size*this.size,i=Math.ceil(Math.abs(o*20-n*10)/n)-1;return w(0<=i&&i<=9),t+=i*C.PENALTY_N4,w(0<=t&&t<=2568888),t}getAlignmentPatternPositions(){if(this.version==1)return[];{const t=Math.floor(this.version/7)+2,o=this.version==32?26:Math.ceil((this.version*4+4)/(t*2-2))*2;let n=[6];for(let i=this.size-7;n.length<t;i-=o)n.splice(1,0,i);return n}}static getNumRawDataModules(t){if(t<C.MIN_VERSION||t>C.MAX_VERSION)throw new RangeError("Version number out of range");let o=(16*t+128)*t+64;if(t>=2){const n=Math.floor(t/7)+2;o-=(25*n-10)*n-55,t>=7&&(o-=36)}return w(208<=o&&o<=29648),o}static getNumDataCodewords(t,o){return Math.floor(C.getNumRawDataModules(t)/8)-C.ECC_CODEWORDS_PER_BLOCK[o.ordinal][t]*C.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][t]}static reedSolomonComputeDivisor(t){if(t<1||t>255)throw new RangeError("Degree out of range");let o=[];for(let i=0;i<t-1;i++)o.push(0);o.push(1);let n=1;for(let i=0;i<t;i++){for(let c=0;c<o.length;c++)o[c]=C.reedSolomonMultiply(o[c],n),c+1<o.length&&(o[c]^=o[c+1]);n=C.reedSolomonMultiply(n,2)}return o}static reedSolomonComputeRemainder(t,o){let n=o.map(i=>0);for(const i of t){const c=i^n.shift();n.push(0),o.forEach((x,h)=>n[h]^=C.reedSolomonMultiply(x,c))}return n}static reedSolomonMultiply(t,o){if(t>>>8||o>>>8)throw new RangeError("Byte out of range");let n=0;for(let i=7;i>=0;i--)n=n<<1^(n>>>7)*285,n^=(o>>>i&1)*t;return w(n>>>8==0),n}finderPenaltyCountPatterns(t){const o=t[1];w(o<=this.size*3);const n=o>0&&t[2]==o&&t[3]==o*3&&t[4]==o&&t[5]==o;return(n&&t[0]>=o*4&&t[6]>=o?1:0)+(n&&t[6]>=o*4&&t[0]>=o?1:0)}finderPenaltyTerminateAndCount(t,o,n){return t&&(this.finderPenaltyAddHistory(o,n),o=0),o+=this.size,this.finderPenaltyAddHistory(o,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(t,o){o[0]==0&&(t+=this.size),o.pop(),o.unshift(t)}};d.MIN_VERSION=1,d.MAX_VERSION=40,d.PENALTY_N1=3,d.PENALTY_N2=3,d.PENALTY_N3=40,d.PENALTY_N4=10,d.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],d.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],a.QrCode=d;function l(S,t,o){if(t<0||t>31||S>>>t)throw new RangeError("Value out of range");for(let n=t-1;n>=0;n--)o.push(S>>>n&1)}function m(S,t){return(S>>>t&1)!=0}function w(S){if(!S)throw new Error("Assertion error")}const _=class I{constructor(t,o,n){if(this.mode=t,this.numChars=o,this.bitData=n,o<0)throw new RangeError("Invalid argument");this.bitData=n.slice()}static makeBytes(t){let o=[];for(const n of t)l(n,8,o);return new I(I.Mode.BYTE,t.length,o)}static makeNumeric(t){if(!I.isNumeric(t))throw new RangeError("String contains non-numeric characters");let o=[];for(let n=0;n<t.length;){const i=Math.min(t.length-n,3);l(parseInt(t.substring(n,n+i),10),i*3+1,o),n+=i}return new I(I.Mode.NUMERIC,t.length,o)}static makeAlphanumeric(t){if(!I.isAlphanumeric(t))throw new RangeError("String contains unencodable characters in alphanumeric mode");let o=[],n;for(n=0;n+2<=t.length;n+=2){let i=I.ALPHANUMERIC_CHARSET.indexOf(t.charAt(n))*45;i+=I.ALPHANUMERIC_CHARSET.indexOf(t.charAt(n+1)),l(i,11,o)}return n<t.length&&l(I.ALPHANUMERIC_CHARSET.indexOf(t.charAt(n)),6,o),new I(I.Mode.ALPHANUMERIC,t.length,o)}static makeSegments(t){return t==""?[]:I.isNumeric(t)?[I.makeNumeric(t)]:I.isAlphanumeric(t)?[I.makeAlphanumeric(t)]:[I.makeBytes(I.toUtf8ByteArray(t))]}static makeEci(t){let o=[];if(t<0)throw new RangeError("ECI assignment value out of range");if(t<128)l(t,8,o);else if(t<16384)l(2,2,o),l(t,14,o);else if(t<1e6)l(6,3,o),l(t,21,o);else throw new RangeError("ECI assignment value out of range");return new I(I.Mode.ECI,0,o)}static isNumeric(t){return I.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return I.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(t,o){let n=0;for(const i of t){const c=i.mode.numCharCountBits(o);if(i.numChars>=1<<c)return 1/0;n+=4+c+i.bitData.length}return n}static toUtf8ByteArray(t){t=encodeURI(t);let o=[];for(let n=0;n<t.length;n++)t.charAt(n)!="%"?o.push(t.charCodeAt(n)):(o.push(parseInt(t.substring(n+1,n+3),16)),n+=2);return o}};_.NUMERIC_REGEX=/^[0-9]*$/,_.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,_.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let R=_;a.QrSegment=_})(de||(de={}));(a=>{(d=>{const l=class{constructor(w,_){this.ordinal=w,this.formatBits=_}};l.LOW=new l(0,1),l.MEDIUM=new l(1,0),l.QUARTILE=new l(2,3),l.HIGH=new l(3,2),d.Ecc=l})(a.QrCode||(a.QrCode={}))})(de||(de={}));(a=>{(d=>{const l=class{constructor(w,_){this.modeBits=w,this.numBitsCharCount=_}numCharCountBits(w){return this.numBitsCharCount[Math.floor((w+7)/17)]}};l.NUMERIC=new l(1,[10,12,14]),l.ALPHANUMERIC=new l(2,[9,11,13]),l.BYTE=new l(4,[8,16,16]),l.KANJI=new l(8,[8,10,12]),l.ECI=new l(7,[0,0,0]),d.Mode=l})(a.QrSegment||(a.QrSegment={}))})(de||(de={}));var me=de;/**
11
+ * @license qrcode.react
12
+ * Copyright (c) Paul O'Shannessy
13
+ * SPDX-License-Identifier: ISC
14
+ */var ys={L:me.QrCode.Ecc.LOW,M:me.QrCode.Ecc.MEDIUM,Q:me.QrCode.Ecc.QUARTILE,H:me.QrCode.Ecc.HIGH},It=128,Lt="L",Ot="#FFFFFF",Dt="#000000",Tt=!1,zt=1,_s=4,ks=0,Cs=.1;function Ft(a,d=0){const l=[];return a.forEach(function(m,w){let _=null;m.forEach(function(R,S){if(!R&&_!==null){l.push(`M${_+d} ${w+d}h${S-_}v1H${_+d}z`),_=null;return}if(S===m.length-1){if(!R)return;_===null?l.push(`M${S+d},${w+d} h1v1H${S+d}z`):l.push(`M${_+d},${w+d} h${S+1-_}v1H${_+d}z`);return}R&&_===null&&(_=S)})}),l.join("")}function Bt(a,d){return a.slice().map((l,m)=>m<d.y||m>=d.y+d.h?l:l.map((w,_)=>_<d.x||_>=d.x+d.w?w:!1))}function Es(a,d,l,m){if(m==null)return null;const w=a.length+l*2,_=Math.floor(d*Cs),R=w/d,S=(m.width||_)*R,t=(m.height||_)*R,o=m.x==null?a.length/2-S/2:m.x*R,n=m.y==null?a.length/2-t/2:m.y*R,i=m.opacity==null?1:m.opacity;let c=null;if(m.excavate){let h=Math.floor(o),v=Math.floor(n),y=Math.ceil(S+o-h),f=Math.ceil(t+n-v);c={x:h,y:v,w:y,h:f}}const x=m.crossOrigin;return{x:o,y:n,h:t,w:S,excavation:c,opacity:i,crossOrigin:x}}function Ns(a,d){return d!=null?Math.max(Math.floor(d),0):a?_s:ks}function Ut({value:a,level:d,minVersion:l,includeMargin:m,marginSize:w,imageSettings:_,size:R,boostLevel:S}){let t=T.useMemo(()=>{const h=(Array.isArray(a)?a:[a]).reduce((v,y)=>(v.push(...me.QrSegment.makeSegments(y)),v),[]);return me.QrCode.encodeSegments(h,ys[d],l,void 0,void 0,S)},[a,d,l,S]);const{cells:o,margin:n,numCells:i,calculatedImageSettings:c}=T.useMemo(()=>{let x=t.getModules();const h=Ns(m,w),v=x.length+h*2,y=Es(x,R,h,_);return{cells:x,margin:h,numCells:v,calculatedImageSettings:y}},[t,R,_,m,w]);return{qrcode:t,margin:n,cells:o,numCells:i,calculatedImageSettings:c}}var Ss=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),js=T.forwardRef(function(d,l){const m=d,{value:w,size:_=It,level:R=Lt,bgColor:S=Ot,fgColor:t=Dt,includeMargin:o=Tt,minVersion:n=zt,boostLevel:i,marginSize:c,imageSettings:x}=m,v=Be(m,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:y}=v,f=Be(v,["style"]),j=x==null?void 0:x.src,b=T.useRef(null),M=T.useRef(null),Q=T.useCallback(W=>{b.current=W,typeof l=="function"?l(W):l&&(l.current=W)},[l]),[q,k]=T.useState(!1),{margin:G,cells:ce,numCells:Z,calculatedImageSettings:H}=Ut({value:w,level:R,minVersion:n,boostLevel:i,includeMargin:o,marginSize:c,imageSettings:x,size:_});T.useEffect(()=>{if(b.current!=null){const W=b.current,Y=W.getContext("2d");if(!Y)return;let P=ce;const ee=M.current,re=H!=null&&ee!==null&&ee.complete&&ee.naturalHeight!==0&&ee.naturalWidth!==0;re&&H.excavation!=null&&(P=Bt(ce,H.excavation));const fe=window.devicePixelRatio||1;W.height=W.width=_*fe;const ge=_/Z*fe;Y.scale(ge,ge),Y.fillStyle=S,Y.fillRect(0,0,Z,Z),Y.fillStyle=t,Ss?Y.fill(new Path2D(Ft(P,G))):ce.forEach(function(ne,K){ne.forEach(function(p,B){p&&Y.fillRect(B+G,K+G,1,1)})}),H&&(Y.globalAlpha=H.opacity),re&&Y.drawImage(ee,H.x+G,H.y+G,H.w,H.h)}}),T.useEffect(()=>{k(!1)},[j]);const be=Fe({height:_,width:_},y);let he=null;return j!=null&&(he=T.createElement("img",{src:j,key:j,style:{display:"none"},onLoad:()=>{k(!0)},ref:M,crossOrigin:H==null?void 0:H.crossOrigin})),T.createElement(T.Fragment,null,T.createElement("canvas",Fe({style:be,height:_,width:_,ref:Q,role:"img"},f)),he)});js.displayName="QRCodeCanvas";var Ue=T.forwardRef(function(d,l){const m=d,{value:w,size:_=It,level:R=Lt,bgColor:S=Ot,fgColor:t=Dt,includeMargin:o=Tt,minVersion:n=zt,boostLevel:i,title:c,marginSize:x,imageSettings:h}=m,v=Be(m,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:y,cells:f,numCells:j,calculatedImageSettings:b}=Ut({value:w,level:R,minVersion:n,boostLevel:i,includeMargin:o,marginSize:x,imageSettings:h,size:_});let M=f,Q=null;h!=null&&b!=null&&(b.excavation!=null&&(M=Bt(f,b.excavation)),Q=T.createElement("image",{href:h.src,height:b.h,width:b.w,x:b.x+y,y:b.y+y,preserveAspectRatio:"none",opacity:b.opacity,crossOrigin:b.crossOrigin}));const q=Ft(M,y);return T.createElement("svg",Fe({height:_,width:_,viewBox:`0 0 ${j} ${j}`,ref:l,role:"img"},v),!!c&&T.createElement("title",null,c),T.createElement("path",{fill:S,d:`M0,0 h${j}v${j}H0z`,shapeRendering:"crispEdges"}),T.createElement("path",{fill:t,d:q,shapeRendering:"crispEdges"}),Q)});Ue.displayName="QRCodeSVG";const ae="__custom__",De=["weixin","lark"],Qe=[{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"}],D={runtime_image_id:ze("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 $(a){return JSON.parse(JSON.stringify(a))}function ue(a){return Array.isArray(a.projects)||(a.projects=[]),a.projects}function Ps(a){const d=new Set(a.map(m=>m.name).filter(Boolean));let l=a.length+1;for(;d.has(`project-${l}`);)l+=1;return{name:`project-${l}`,agentType:bs,workDir:"",model:""}}function xe(a){var d,l,m,w;return{...a,agent:{...a.agent,options:{...((d=a.agent)==null?void 0:d.options)||{},model:Mt((l=a.agent)==null?void 0:l.type,String(((w=(m=a.agent)==null?void 0:m.options)==null?void 0:w.model)||""))}},platforms:a.platforms||[]}}function Ce(a){return{id:a.id,name:a.name,api_key:a.api_key||"",base_url:a.base_url||"",model:a.model||"",models:a.models||[],thinking:a.thinking||"",env:a.env||{}}}function jt(a,d){return d.includes(a)?a:ae}function Ms(a){var d;return((d=Qe.find(l=>a.name===l.name||l.base_url&&a.base_url===l.base_url||l.model&&a.model===l.model&&a.name===l.name))==null?void 0:d.id)||ae}function As(a,d){const l=Qe.find(m=>m.id===d);return l?{...a,name:l.name,base_url:l.base_url,model:l.model}:a}function Te(a="weixin"){var d;return{type:a,options:{instance_id:`${a}-${((d=crypto.randomUUID)==null?void 0:d.call(crypto))||Date.now().toString(36)}`}}}function le(a){var d;return String(((d=a==null?void 0:a.options)==null?void 0:d.instance_id)||"").trim()||"default"}function Ee(a){const d=a.type==="feishu"?"lark":a.type,l=a.options&&typeof a.options=="object"?{...a.options}:{};return d==="weixin"?{type:d,options:{...l,instance_id:String(l.instance_id||"").trim()}}:d==="lark"?{type:d,options:{...l,instance_id:String(l.instance_id||"").trim(),app_id:String(l.app_id||"").trim(),app_secret:String(l.app_secret||"").trim(),card_actions:l.card_actions===!0}}:{type:d,options:l}}function Rs(a){var d;if(a.type==="weixin")return"WeChat QR login";if(a.type==="lark"){const l=String(((d=a.options)==null?void 0:d.app_id)||"").trim();return l?`App ID ${l}`:"App ID and secret required"}return"Custom platform"}function Is(a){var m,w;const d=String(((w=(m=a.agent)==null?void 0:m.options)==null?void 0:w.work_dir)||"").trim();return d?d.replace(/\/+$/,"").split("/").filter(Boolean).pop()||d:"No work directory"}function Ls(a){return a==="success"?"border-primary/20 bg-primary/10 text-primary dark:border-primary/25 dark:bg-primary/10 dark:text-blue-200":a==="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 Pt(a){return{enabled:!!(a!=null&&a.enabled),provider_id:(a==null?void 0:a.provider_id)||$e,runtime_image_id:(a==null?void 0:a.runtime_image_id)||D.runtime_image_id,server_url:(a==null?void 0:a.server_url)||D.server_url,image:(a==null?void 0:a.image)||D.image,api_key_env:(a==null?void 0:a.api_key_env)||D.api_key_env,acp_port:String((a==null?void 0:a.acp_port)||D.acp_port),state_scope:(a==null?void 0:a.state_scope)||D.state_scope,timeout_seconds:String((a==null?void 0:a.timeout_seconds)||D.timeout_seconds),sandbox_lifecycle:(a==null?void 0:a.sandbox_lifecycle)||D.sandbox_lifecycle,idle_seconds:String((a==null?void 0:a.idle_seconds)||D.idle_seconds),warm_pool_size:String((a==null?void 0:a.warm_pool_size)??D.warm_pool_size),cpu:(a==null?void 0:a.cpu)||D.cpu,memory:(a==null?void 0:a.memory)||D.memory,workspace_mount_path:(a==null?void 0:a.workspace_mount_path)||D.workspace_mount_path,state_mount_path:(a==null?void 0:a.state_mount_path)||D.state_mount_path}}function Os(a){return{enabled:a.enabled,provider_id:a.provider_id.trim()||$e,runtime_image_id:a.runtime_image_id.trim()||D.runtime_image_id,state_scope:a.state_scope,timeout_seconds:Number(a.timeout_seconds)||Number(D.timeout_seconds),sandbox_lifecycle:a.sandbox_lifecycle,idle_seconds:Number(a.idle_seconds)||Number(D.idle_seconds),warm_pool_size:Math.max(0,Number(a.warm_pool_size)||0),cpu:a.cpu.trim()||D.cpu,memory:a.memory.trim()||D.memory}}function qs(){var Ke,Xe,qe,Je,Ze,et,tt,st,at,rt,nt,ot,it,lt,dt,ct,ut,mt,ht,ft,gt,pt;const[a,d]=as(),l=a.get("project")||"",[m,w]=N.useState(null),[_,R]=N.useState(null),[S,t]=N.useState([]),[o,n]=N.useState({}),[i,c]=N.useState(0),[x,h]=N.useState("basic"),[v,y]=N.useState(null),[f,j]=N.useState(null),[b,M]=N.useState(null),[Q,q]=N.useState(!1),[k,G]=N.useState(null),[ce,Z]=N.useState(!1),[H,be]=N.useState(!0),[he,W]=N.useState(""),[Y,P]=N.useState(null),ee=N.useRef(null),re=N.useRef(null),fe=N.useRef(i),ge=N.useRef(""),ne=N.useCallback(async(e="")=>{be(!0);try{const[r,u]=await Promise.all([os(),is()]),g=$(r.parsed||{});if(g.projects=ue(g).map(E=>xe(E)),w(g),R($(g)),t(u.providers||[]),n(Object.fromEntries((u.providers||[]).map(E=>[E.id,Ce(E)]))),e){const E=(g.projects||[]).findIndex(O=>O.name===e);c(E>=0?E:0)}}catch(r){P({tone:"error",message:r instanceof Error?r.message:String(r)})}finally{be(!1)}},[]);N.useEffect(()=>{ne(l)},[ne]);const K=(m==null?void 0:m.projects)||[],p=K[i]||null,B=Pt((Xe=(Ke=p==null?void 0:p.agent)==null?void 0:Ke.options)==null?void 0:Xe.sandbox),ve=Ct(String((m==null?void 0:m.deployment_profile)||"").trim()),Ge=((m==null?void 0:m.sandbox_providers)||[]).find(e=>e.id===B.provider_id)||Et(ve.id),we=((m==null?void 0:m.sandbox_runtime_images)||[]).find(e=>e.id===B.runtime_image_id)||ze(((qe=p==null?void 0:p.agent)==null?void 0:qe.type)||"pi"),He=JSON.stringify(m||{})!==JSON.stringify(_||{});N.useEffect(()=>{ee.current=m},[m]),N.useEffect(()=>{re.current=f},[f]),N.useEffect(()=>{fe.current=i,ge.current=(p==null?void 0:p.name)||""},[i,p==null?void 0:p.name]),N.useEffect(()=>{if(!m||!l)return;const e=K.findIndex(r=>r.name===l);e>=0&&e!==i&&c(e)},[m,K,l,i]);const X=N.useCallback(e=>{w(r=>{if(!r)return r;const u=$(r),g=ue(u),E=g[i];return E?(g[i]=xe(e(E)),u):r})},[i]),te=N.useCallback(e=>{X(r=>{var u;return{...r,agent:{...r.agent,options:{...r.agent.options||{},sandbox:Os(e(Pt((u=r.agent.options)==null?void 0:u.sandbox)))}}}})},[X]),$t=N.useCallback(e=>{const r=Ct(e);w(u=>{if(!u)return u;const g=$(u);g.deployment_profile=r.id;const E=Et(r.id),O=Array.isArray(g.sandbox_providers)?[...g.sandbox_providers]:[],U=O.findIndex(z=>z.id===E.id);return U>=0?O[U]={...O[U],server_url:E.server_url}:O.push(E),g.sandbox_providers=O,g})},[]),Qt=()=>{y(Ps(K))},pe=N.useCallback((e,r)=>{n(u=>{const g=u[e];return g?{...u,[e]:r(g)}:u})},[]),Gt=async()=>{try{const e=await cs({name:`provider-${S.length+1}`});t(r=>[...r,e].sort((u,g)=>u.name.localeCompare(g.name))),n(r=>({...r,[e.id]:Ce(e)})),P({tone:"success",message:"Provider created."})}catch(e){P({tone:"error",message:e instanceof Error?e.message:String(e)})}},Ht=async e=>{const r=o[e];if(r)try{const u=await us(e,r);t(g=>g.map(E=>E.id===u.id?u:E).sort((E,O)=>E.name.localeCompare(O.name))),n(g=>({...g,[u.id]:Ce(u)})),P({tone:"success",message:"Provider saved."})}catch(u){P({tone:"error",message:u instanceof Error?u.message:String(u)})}},Yt=async e=>{try{await ms(e),t(r=>r.filter(u=>u.id!==e)),n(r=>{const u={...r};return delete u[e],u}),P({tone:"success",message:"Provider removed."})}catch(r){P({tone:"error",message:r instanceof Error?r.message:String(r)})}},ye=e=>{y(r=>r&&{...r,...e})},Vt=()=>{if(!v)return;const e=v.name.trim(),r=v.agentType.trim(),u=v.workDir.trim(),g=v.model.trim();if(!e||!r||!u){P({tone:"warning",message:"Project name, agent type, and work directory are required."});return}if(K.some(U=>U.name===e)){P({tone:"warning",message:`Project "${e}" already exists.`});return}const E=xe({name:e,agent:{type:r,options:{model:g||Ie(r),work_dir:u},providers:[]},platforms:[],admin_from:"",disabled_commands:[]}),O=K.length;w(U=>{const z=$(U||{});return ue(z).push(E),z}),c(O),d({project:e}),y(null),P(null)},Wt=e=>{w(r=>{if(!r)return r;const u=$(r),g=ue(u);return g.splice(e,1),c(Math.max(0,Math.min(e,g.length-1))),u})},Ye=e=>{var u;if(M(null),G(null),e===null){j({index:e,draft:Te()});return}const r=(u=p==null?void 0:p.platforms)==null?void 0:u[e];r&&j({index:e,draft:$(r)})},oe=e=>{j(r=>r&&{...r,draft:e(r.draft)})},Kt=()=>{if(!f)return;const e=Ee(f.draft);X(r=>{const u=[...r.platforms||[]];return f.index===null?u.push(e):u[f.index]=e,{...r,platforms:u}}),j(null),M(null),G(null)},Ve=async()=>{if(!f||!m)return f==null?void 0:f.draft;const e=$(m),r=ue(e),u=r[i];if(!u)return f.draft;const g=[...u.platforms||[]],E=Ee(f.draft);f.index===null?g.push(E):g[f.index]=E,r[i]=xe({...u,platforms:g});const O=await Ae(e),U=$(O.parsed||e);return R(U),w($(U)),j(z=>z&&{index:z.index??g.length-1,draft:E}),E},Xt=async()=>{if(!(!(p!=null&&p.name)||!m)){q(!0);try{await Ve();const e=await hs(p.name,le(f==null?void 0:f.draft));M({...e,status:"wait",createdAt:Date.now()}),P(null)}catch(e){P({tone:"error",message:e instanceof Error?e.message:String(e)})}finally{q(!1)}}},qt=async()=>{if(!(!(p!=null&&p.name)||!m)){Z(!0);try{await Ve();const e=await fs(p.name,le(f==null?void 0:f.draft));G({...e,status:"wait",createdAt:Date.now()}),P(null)}catch(e){P({tone:"error",message:e instanceof Error?e.message:String(e)})}finally{Z(!1)}}},Jt=async()=>{if(!(!(p!=null&&p.name)||!(b!=null&&b.ticket))){q(!0);try{const e=await gs(p.name,b.ticket,le(f==null?void 0:f.draft));M(r=>r&&{...r,status:e.status}),e.status==="confirmed"&&P({tone:"success",message:"WeChat QR code confirmed."})}catch(e){P({tone:"error",message:e instanceof Error?e.message:String(e)})}finally{q(!1)}}},We=N.useCallback(async(e,r)=>{const u=await ls(e,r);if(u.status!=="running"||u.connected!==!0)throw new Error(u.lastError||"Lark bot credentials were saved, but the gateway is not connected yet.");const g=await ds(e,r);if(!g.success)throw new Error(g.error||"Lark bot credentials were saved, but the connection test failed.")},[]),Se=N.useCallback(async e=>{var bt,vt,wt;const r=ge.current,u=le((bt=re.current)==null?void 0:bt.draft),g=ee.current;if(!g)return;const E=$(g),O=ue(E),U=fe.current,z=O[U];if(!z)return;const A=[...z.platforms||[]],V=re.current,J=(V==null?void 0:V.index)??A.findIndex(ie=>Ee(ie).type==="lark"&&le(ie)===u),_e=J>=0?A[J]:(V==null?void 0:V.draft)||Te("lark"),je=Ee({..._e,type:"lark",options:{..._e.options||{},instance_id:u,app_id:e.appId,app_secret:e.appSecret,verification_token:e.verificationToken||((vt=_e.options)==null?void 0:vt.verification_token)||"",encrypt_key:e.encryptKey||((wt=_e.options)==null?void 0:wt.encrypt_key)||"",card_actions:!0,subscribed_events:"im.message.receive_v1 card.action.trigger",subscribed_callbacks:"card.action.trigger"}});J>=0?A[J]=je:A.push(je),O[U]=xe({...z,platforms:A});const ts=await Ae(E),xt=$(ts.parsed||E);R(xt),w($(xt)),j(ie=>ie&&{...ie,index:ie.index??(J>=0?J:A.length-1),draft:je}),await We(r,u),P({tone:"success",message:"Lark bot bound, saved, and ready to send messages."}),await ne(r)},[We,ne]),Zt=async()=>{if(!(!(p!=null&&p.name)||!(k!=null&&k.ticket)||!m)){Z(!0);try{const e=await kt(p.name,k.ticket,le(f==null?void 0:f.draft));G(r=>{var u;return r&&{...r,status:e.status,botName:(u=e.credentials)==null?void 0:u.botName}}),e.status==="confirmed"&&e.credentials?await Se(e.credentials):e.status==="expired"&&P({tone:"warning",message:"Lark QR code expired. Generate a new QR code and scan again."})}catch(e){P({tone:"error",message:e instanceof Error?e.message:String(e)})}finally{Z(!1)}}};N.useEffect(()=>{if(!(p!=null&&p.name)||!(k!=null&&k.ticket)||(f==null?void 0:f.draft.type)!=="lark"||k.status&&!["wait","signed"].includes(k.status))return;let e=!1,r;const g=(k.createdAt||Date.now())+Math.max(k.expiresIn||0,1)*1e3,E=Math.max(3,Math.min(Number(k.interval||5)||5,15))*1e3,O=z=>{r=window.setTimeout(()=>{U()},z)},U=async()=>{var z;if(!e){if(Date.now()>=g){G(A=>(A==null?void 0:A.ticket)===k.ticket?{...A,status:"expired"}:A),P({tone:"warning",message:"Lark QR code expired. Generate a new QR code and scan again."});return}try{const A=await kt(p.name,k.ticket,le((z=re.current)==null?void 0:z.draft));if(e)return;if(G(V=>{var J;return(V==null?void 0:V.ticket)===k.ticket?{...V,status:A.status,botName:(J=A.credentials)==null?void 0:J.botName}:V}),A.status==="confirmed"&&A.credentials){await Se(A.credentials);return}if(A.status==="expired"){P({tone:"warning",message:"Lark QR code expired. Generate a new QR code and scan again."});return}O(E)}catch(A){if(e)return;P({tone:"error",message:A instanceof Error?A.message:String(A)})}}};return O(Math.min(2e3,E)),()=>{e=!0,r&&window.clearTimeout(r)}},[k==null?void 0:k.createdAt,k==null?void 0:k.expiresIn,k==null?void 0:k.interval,k==null?void 0:k.status,k==null?void 0:k.ticket,f==null?void 0:f.draft.type,Se,p==null?void 0:p.name]);const es=async()=>{if(m){W("config");try{const e=await Ae(m);R($(e.parsed||m)),w($(e.parsed||m)),P({tone:"success",message:"Project changes saved."}),await ne()}catch(e){P({tone:"error",message:e instanceof Error?e.message:String(e)})}finally{W("")}}};return H&&!m?s.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-slate-400 animate-pulse",children:"Loading workspace..."}):s.jsxs("div",{className:"space-y-6 animate-fade-in",children:[s.jsx(ns,{title:"工作区",description:"创建项目,配置 Agent、工作目录、Provider 和平台接入。"}),Y?s.jsx("div",{role:"status",className:`rounded-xl border px-4 py-3 text-sm ${Ls(Y.tone)}`,children:Y.message}):null,He?s.jsx("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-200",children:"You have unsaved project changes."}):null,s.jsxs("div",{className:"grid min-w-0 grid-cols-1 gap-4 lg:grid-cols-[340px_minmax(0,1fr)]",children:[s.jsx(_t,{title:"项目",actions:s.jsxs(F,{size:"sm",onClick:Qt,children:[s.jsx(ke,{size:14})," 新建项目"]}),className:"lg:self-start",children:K.length===0?s.jsx(Pe,{message:"还没有项目。"}):s.jsx("div",{className:"space-y-2",children:K.map((e,r)=>{var u,g;return s.jsxs("div",{className:`flex items-center justify-between gap-2 rounded-xl border px-3 py-2 transition-colors ${r===i?"border-accent/30 bg-accent/10":"border-black/10 hover:bg-black/[0.04] dark:border-white/[0.08] dark:hover:bg-white/[0.06]"}`,children:[s.jsxs("button",{type:"button",onClick:()=>{c(r),d(e.name?{project:e.name}:{})},className:"min-w-0 flex-1 text-left",children:[s.jsx("p",{className:"truncate text-sm font-medium text-slate-950 dark:text-white",children:e.name||`Project ${r+1}`}),s.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[((u=e.agent)==null?void 0:u.type)||"unknown"," · ",Is(e)," · ",((g=e.platforms)==null?void 0:g.length)||0," platforms"]})]}),s.jsx(F,{variant:"ghost",size:"sm",onClick:()=>Wt(r),"aria-label":`Remove ${e.name}`,children:s.jsx(Le,{size:14})})]},`${e.name}-${r}`)})})}),s.jsx(_t,{title:(p==null?void 0:p.name)||"Project details",description:p?s.jsxs("span",{className:"break-all",children:[((Je=p.agent)==null?void 0:Je.type)||"unknown"," · ",String(((et=(Ze=p.agent)==null?void 0:Ze.options)==null?void 0:et.work_dir)||"No work directory")]}):void 0,children:p?s.jsxs("div",{className:"space-y-6",children:[s.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(([e,r])=>s.jsx("button",{type:"button",onClick:()=>h(e),className:`shrink-0 rounded-lg px-3 py-1.5 text-sm font-medium transition-colors ${x===e?"bg-accent text-white":"bg-black/[0.04] text-muted-foreground hover:bg-black/[0.07] hover:text-foreground dark:bg-white/[0.05] dark:hover:bg-white/[0.08]"}`,children:r},e))}),x==="basic"?s.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[s.jsx(L,{label:"Project name",value:p.name,onChange:e=>X(r=>({...r,name:e.target.value}))}),s.jsxs(se,{label:"Agent type",value:jt(((tt=p.agent)==null?void 0:tt.type)||"",Re),onChange:e=>X(r=>{var g;const u=e.target.value===ae?r.agent.type:e.target.value;return{...r,agent:{...r.agent,type:u,options:{...r.agent.options||{},model:Mt(u,String(((g=r.agent.options)==null?void 0:g.model)||""))}}}}),children:[Re.map(e=>s.jsx("option",{value:e,children:e},e)),s.jsx("option",{value:ae,children:"custom"})]}),s.jsx(L,{label:"Host workspace path",value:String(((at=(st=p.agent)==null?void 0:st.options)==null?void 0:at.work_dir)||""),onChange:e=>X(r=>({...r,agent:{...r.agent,options:{...r.agent.options||{},work_dir:e.target.value}}}))}),s.jsx(L,{label:"Default model",value:String(((nt=(rt=p.agent)==null?void 0:rt.options)==null?void 0:nt.model)||""),onChange:e=>X(r=>({...r,agent:{...r.agent,options:{...r.agent.options||{},model:e.target.value}}})),placeholder:Ie((ot=p.agent)==null?void 0:ot.type)||"Use agent default model"})]}):null,x==="providers"?s.jsxs("section",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[s.jsxs(se,{label:"Project provider",value:String(((lt=(it=p.agent)==null?void 0:it.options)==null?void 0:lt.provider_id)||""),onChange:e=>X(r=>({...r,agent:{...r.agent,options:{...r.agent.options||{},provider_id:e.target.value}}})),children:[s.jsx("option",{value:"",children:"No provider"}),S.map(e=>s.jsx("option",{value:e.id,children:e.name},e.id))]}),s.jsx(L,{label:"Model override",value:String(((ct=(dt=p.agent)==null?void 0:dt.options)==null?void 0:ct.model)||""),onChange:e=>X(r=>({...r,agent:{...r.agent,options:{...r.agent.options||{},model:e.target.value}}})),placeholder:"Use provider default model"})]}),s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-slate-950 dark:text-white",children:"Shared providers"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Providers are shared and selected by projects."})]}),s.jsxs(F,{size:"sm",variant:"secondary",onClick:()=>void Gt(),children:[s.jsx(ke,{size:14})," Add provider"]})]}),S.length===0?s.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."}):s.jsx("div",{className:"space-y-3",children:S.map(e=>{const r=o[e.id]||Ce(e);return s.jsx("div",{className:"rounded-xl border border-black/10 p-4 dark:border-white/[0.08]",children:s.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[s.jsxs(se,{label:"Preset",value:Ms(r),onChange:u=>{u.target.value!==ae&&pe(e.id,g=>As(g,u.target.value))},children:[Qe.map(u=>s.jsx("option",{value:u.id,children:u.label},u.id)),s.jsx("option",{value:ae,children:"custom"})]}),s.jsx(L,{label:"Name",value:r.name||"",onChange:u=>pe(e.id,g=>({...g,name:u.target.value}))}),s.jsx(L,{label:"API key",type:"password",value:r.api_key||"",onChange:u=>pe(e.id,g=>({...g,api_key:u.target.value}))}),s.jsx(L,{label:"Base URL",value:r.base_url||"",onChange:u=>pe(e.id,g=>({...g,base_url:u.target.value}))}),s.jsx(L,{label:"Default model",value:r.model||"",onChange:u=>pe(e.id,g=>({...g,model:u.target.value}))}),s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs(F,{variant:"secondary",size:"sm",onClick:()=>void Ht(e.id),children:[s.jsx(Oe,{size:14})," Save"]}),s.jsxs(F,{variant:"danger",size:"sm",onClick:()=>void Yt(e.id),children:[s.jsx(Le,{size:14})," Remove"]})]})]})},e.id)})})]}):null,x==="platforms"?s.jsxs("section",{className:"space-y-3",children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-slate-950 dark:text-white",children:"Platforms"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Configure each platform with its own required connection fields."})]}),s.jsxs(F,{size:"sm",variant:"secondary",onClick:()=>Ye(null),children:[s.jsx(ke,{size:14})," Platform"]})]}),(p.platforms||[]).length===0?s.jsx(Pe,{message:"No platforms configured."}):s.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:(p.platforms||[]).map((e,r)=>s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-black/10 p-3 dark:border-white/[0.08]",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"truncate text-sm font-medium text-slate-950 dark:text-white",children:e.type}),s.jsx("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:Rs(e)})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsx(F,{variant:"secondary",size:"sm",onClick:()=>Ye(r),"aria-label":`Configure ${e.type}`,children:s.jsx(rs,{size:14})}),s.jsx(F,{variant:"danger",size:"sm",onClick:()=>X(u=>{const g=[...u.platforms||[]];return g.splice(r,1),{...u,platforms:g}}),children:s.jsx(Le,{size:14})})]})]},`${e.type}-${r}`))})]}):null,x==="sandbox"?s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-slate-950 dark:text-white",children:"云端模式"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"通过 OpenSandbox 为 Agent 运行启动独立容器。"})]}),s.jsx(Me,{tone:B.enabled?"success":"neutral",children:B.enabled?"Enabled":"Local"})]}),s.jsxs("label",{className:"flex items-center gap-3 rounded-xl border border-black/10 px-4 py-3 text-sm font-medium text-slate-950 dark:border-white/[0.08] dark:text-white",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-black/20 dark:border-white/20",checked:B.enabled,onChange:e=>te(r=>{var u;return{...r,enabled:e.target.checked,provider_id:r.provider_id||$e,runtime_image_id:r.runtime_image_id||ze(((u=p==null?void 0:p.agent)==null?void 0:u.type)||"pi").id}})}),"启用云端模式(Sandbox)"]}),B.enabled?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[s.jsx(se,{label:"Deployment",value:ve.id,onChange:e=>$t(e.target.value),children:ps.map(e=>s.jsx("option",{value:e.id,children:e.label},e.id))}),s.jsxs(se,{label:"State scope",value:B.state_scope,onChange:e=>te(r=>({...r,state_scope:e.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(L,{label:"CPU",value:B.cpu,onChange:e=>te(r=>({...r,cpu:e.target.value}))}),s.jsx(L,{label:"Memory",value:B.memory,onChange:e=>te(r=>({...r,memory:e.target.value}))}),s.jsx(L,{label:"Timeout seconds",type:"number",value:B.timeout_seconds,onChange:e=>te(r=>({...r,timeout_seconds:e.target.value}))}),s.jsxs(se,{label:"Sandbox lifecycle",value:B.sandbox_lifecycle,onChange:e=>te(r=>({...r,sandbox_lifecycle:e.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(L,{label:"Idle seconds",type:"number",value:B.idle_seconds,onChange:e=>te(r=>({...r,idle_seconds:e.target.value}))}),s.jsx(L,{label:"Warm pool",type:"number",value:B.warm_pool_size,onChange:e=>te(r=>({...r,warm_pool_size:e.target.value}))})]}),s.jsxs("div",{className:"rounded-xl border border-black/10 px-4 py-3 text-sm text-muted-foreground dark:border-white/[0.08]",children:[s.jsx("div",{className:"font-medium text-slate-950 dark:text-white",children:"当前运行配置"}),s.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 md:grid-cols-2",children:[s.jsxs("div",{children:["OpenSandbox: ",Ge.server_url||"not configured"]}),s.jsxs("div",{children:["Image: ",we.image]}),s.jsxs("div",{children:["ACP port: ",we.acp_port]}),s.jsxs("div",{children:["Sandbox workspace path: ",we.workspace_mount_path||ve.workspaceMountPath]}),s.jsxs("div",{children:["State mount: ",we.state_mount_path||ve.stateMountPath]}),s.jsxs("div",{children:["API key env: ",Ge.api_key_env||"OPEN_SANDBOX_API_KEY"]})]})]}),s.jsxs("details",{className:"rounded-xl border border-black/10 px-4 py-3 text-sm dark:border-white/[0.08]",children:[s.jsx("summary",{className:"cursor-pointer font-medium text-slate-950 dark:text-white",children:"Advanced"}),s.jsx("div",{className:"mt-3 text-muted-foreground",children:"Host workspace path 是 OpenSandbox 挂载源;Sandbox workspace path 是 Agent 容器内的工作目录。Core 只启动代理进程,不直接使用 host workspace path 作为代理工作目录。"})]})]}):s.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。"})]}):null,s.jsx("div",{className:"flex flex-wrap gap-2 border-t border-black/10 pt-5 dark:border-white/[0.08]",children:s.jsxs(F,{className:"w-full sm:w-auto",onClick:()=>void es(),loading:he==="config",disabled:!He&&he!=="config",children:[s.jsx(Oe,{size:14})," 保存更改"]})})]}):s.jsx(Pe,{message:"选择或新建项目后开始配置。"})})]}),s.jsx(yt,{open:!!v,onClose:()=>y(null),title:"新建项目",children:v?s.jsxs("div",{className:"space-y-4",children:[s.jsx(L,{label:"Project name",value:v.name,onChange:e=>ye({name:e.target.value}),autoFocus:!0}),s.jsx(se,{label:"Agent type",value:v.agentType,onChange:e=>{const r=e.target.value;ye({agentType:r})},children:Re.map(e=>s.jsx("option",{value:e,children:e},e))}),s.jsx(L,{label:"Host workspace path",value:v.workDir,onChange:e=>ye({workDir:e.target.value}),placeholder:"/Users/yinyin/code/my-project"}),s.jsx(L,{label:"Default model",value:v.model,onChange:e=>ye({model:e.target.value}),placeholder:Ie(v.agentType)||"Use agent default model"}),s.jsxs("div",{className:"flex flex-col-reverse gap-2 pt-2 sm:flex-row sm:justify-end",children:[s.jsx(F,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>y(null),children:"Cancel"}),s.jsxs(F,{className:"w-full sm:w-auto",onClick:Vt,children:[s.jsx(ke,{size:14})," 新建项目"]})]})]}):null}),s.jsx(yt,{open:!!f,onClose:()=>{j(null),M(null),G(null)},title:(f==null?void 0:f.index)===null?"Add platform":"Configure platform",children:f?s.jsxs("div",{className:"space-y-4",children:[s.jsxs(se,{label:"Platform",value:jt(f.draft.type,[...De]),onChange:e=>{const r=e.target.value===ae?f.draft.type:e.target.value;oe(()=>Te(r)),M(null),G(null)},children:[De.map(e=>s.jsx("option",{value:e,children:e},e)),xs.filter(e=>!De.includes(e)).map(e=>s.jsx("option",{value:e,children:e},e)),s.jsx("option",{value:ae,children:"custom"})]}),f.draft.type==="lark"?s.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[k!=null&&k.qrCodeUrl?s.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-black/10 p-4 dark:border-white/[0.08]",children:[s.jsx("div",{className:"rounded-lg border border-black/10 bg-white p-3",children:s.jsx(Ue,{value:k.qrCodeUrl,size:176,includeMargin:!0})}),s.jsx(Me,{tone:k.status==="confirmed"?"success":k.status==="expired"?"danger":"warning",children:k.botName||k.status||"wait"})]}):null,s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap",children:[s.jsxs(F,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void qt(),loading:ce,children:[s.jsx(Nt,{size:14})," Generate QR"]}),s.jsx(F,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Zt(),loading:ce,disabled:!(k!=null&&k.ticket),children:"Check status"})]}),s.jsx(L,{label:"App ID",value:String(((ut=f.draft.options)==null?void 0:ut.app_id)||""),onChange:e=>oe(r=>({...r,options:{...r.options||{},app_id:e.target.value}})),placeholder:"cli_xxx"}),s.jsx(L,{label:"App Secret",type:"password",value:String(((mt=f.draft.options)==null?void 0:mt.app_secret)||""),onChange:e=>oe(r=>({...r,options:{...r.options||{},app_secret:e.target.value}}))}),s.jsx(L,{label:"Verification token",value:String(((ht=f.draft.options)==null?void 0:ht.verification_token)||""),onChange:e=>oe(r=>({...r,options:{...r.options||{},verification_token:e.target.value}}))}),s.jsx(L,{label:"Encrypt key",value:String(((ft=f.draft.options)==null?void 0:ft.encrypt_key)||""),onChange:e=>oe(r=>({...r,options:{...r.options||{},encrypt_key:e.target.value}}))}),s.jsxs("label",{className:"flex items-center gap-3 text-sm text-foreground",children:[s.jsx("input",{type:"checkbox",checked:((gt=f.draft.options)==null?void 0:gt.auto_approve)===!0,onChange:e=>oe(r=>({...r,options:{...r.options||{},auto_approve:e.target.checked}}))}),"Auto-approve Lark users"]}),s.jsxs("label",{className:"flex items-center gap-3 text-sm text-foreground",children:[s.jsx("input",{type:"checkbox",checked:((pt=f.draft.options)==null?void 0:pt.card_actions)===!0,onChange:e=>oe(r=>({...r,options:{...r.options||{},card_actions:e.target.checked}}))}),"Enable Lark card action buttons"]})]}):null,f.draft.type==="weixin"?s.jsxs("div",{className:"space-y-3",children:[s.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."}),b!=null&&b.qrCodeUrl?s.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-black/10 p-4 dark:border-white/[0.08]",children:[s.jsx("div",{className:"rounded-lg border border-black/10 bg-white p-3",children:s.jsx(Ue,{value:b.qrCodeUrl,size:176,includeMargin:!0})}),s.jsx(Me,{tone:b.status==="confirmed"?"success":b.status==="expired"?"danger":"warning",children:b.status||"wait"})]}):null,s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap",children:[s.jsxs(F,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Xt(),loading:Q,children:[s.jsx(Nt,{size:14})," Generate QR"]}),s.jsx(F,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>void Jt(),loading:Q,disabled:!(b!=null&&b.ticket),children:"Check status"})]})]}):null,f.draft.type!=="lark"&&f.draft.type!=="weixin"?s.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,s.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:[s.jsx(F,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>j(null),children:"Cancel"}),s.jsxs(F,{className:"w-full sm:w-auto",onClick:Kt,children:[s.jsx(Oe,{size:14})," Apply"]})]})]}):null})]})}export{qs as default};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-B36eowj-.js";/**
1
+ import{c as o}from"./index-DwhTjLA1.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-B36eowj-.js";/**
1
+ import{c as o}from"./index-DwhTjLA1.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-B36eowj-.js";/**
1
+ import{c}from"./index-DwhTjLA1.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-B36eowj-.js";/**
1
+ import{c as o}from"./index-DwhTjLA1.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-B36eowj-.js";/**
1
+ import{c}from"./index-DwhTjLA1.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{a2 as l,s as g,a3 as c,a4 as u,a5 as h,a6 as C,a7 as v,a8 as k,a9 as p,aa as w,ab as S,ac as P,ad as m,ae as L,af as y,ag as D,ah as R,ai as f,aj as b,ak as G,al as Q,am as E,an as M,ao as B,ap as A,aq as F,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 H,aD as J,aE as N,o as i,m as O,aF as V,aG as X,aH as Y,aI as Z,aJ as ee,aK as te,aL as ae,aM as se,i as ne}from"./index-DwhTjLA1.js";function n(){if(!window.desktop)throw new Error("Desktop APIs are unavailable in the browser build");return window.desktop}const re={getRuntimeStatus:()=>n().getRuntimeStatus(),startService:()=>n().startService(),stopService:()=>n().stopService(),restartService:()=>n().restartService(),getLogs:e=>n().getLogs(e),listInstalledAgentRuntimes:()=>_().then(e=>e.runtimes),refreshInstalledAgentRuntimes:()=>q().then(e=>e.runtimes),readConfigFile:()=>n().readConfigFile(),saveRawConfigFile:e=>n().saveRawConfigFile(e),saveStructuredConfigFile:e=>n().saveStructuredConfigFile(e),listModelProviders:()=>z(),createModelProvider:e=>U(e),updateModelProvider:(e,t)=>j(e,t),deleteModelProvider:e=>$(e),getThreadKnowledgeBases:(e,t)=>n().getThreadKnowledgeBases(e,t),updateThreadKnowledgeBases:(e,t,a)=>n().updateThreadKnowledgeBases(e,t,a),deleteThreadKnowledgeBases:(e,t)=>n().deleteThreadKnowledgeBases(e,t),saveSettings:e=>n().saveSettings(e),getCapabilitySnapshot:()=>T(),getPluginDiagnostics:()=>x(),listDiagnosticErrors:()=>K().then(e=>e.errors),runDiagnosticsDoctor:()=>W(),runDeploymentDiagnostics:()=>I(),listChannelGateways:e=>F(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)=>b(e,t),listChannelAuthorizedUsers:(e,t)=>f(e,t).then(a=>a.users),getChannelQrCode:(e,t,a)=>R(e,t,a),checkChannelQrCodeStatus:(e,t,a,r)=>D(e,t,a,r),getWeixinQrCode:(e,t)=>y(e,t),checkWeixinQrCodeStatus:(e,t,a)=>L(e,t,a),getLarkQrCode:(e,t)=>m(e,t),checkLarkQrCodeStatus:(e,t,a)=>P(e,t,a),listLarkGateways:()=>S().then(e=>e.gateways),getLarkGatewayStatus:(e,t)=>w(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=>n().probeWorkspaceStreaming(e),onRuntimeEvent:e=>n().onRuntimeEvent(e),onRuntimeDetectionEvent:e=>g(t=>{(t.type.startsWith("runtime.detect.")||t.type==="runtime.status.changed")&&e(t)}),onBridgeEvent:e=>l(e)},o={getRuntimeStatus:()=>se(),startService:()=>ae(),stopService:()=>te(),restartService:()=>ee(),getLogs:e=>Z(e),listInstalledAgentRuntimes:()=>_().then(e=>e.runtimes),refreshInstalledAgentRuntimes:()=>q().then(e=>e.runtimes),readConfigFile:()=>Y(),saveRawConfigFile:e=>X(e),saveStructuredConfigFile:e=>V(e),listModelProviders:()=>z(),createModelProvider:e=>U(e),updateModelProvider:(e,t)=>j(e,t),deleteModelProvider:e=>$(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:()=>T(),getPluginDiagnostics:()=>x(),listDiagnosticErrors:()=>K().then(e=>e.errors),runDiagnosticsDoctor:()=>W(),runDeploymentDiagnostics:()=>I(),listChannelGateways:e=>F(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)=>b(e,t),listChannelAuthorizedUsers:(e,t)=>f(e,t).then(a=>a.users),getChannelQrCode:(e,t,a)=>R(e,t,a),checkChannelQrCodeStatus:(e,t,a,r)=>D(e,t,a,r),getWeixinQrCode:(e,t)=>y(e,t),checkWeixinQrCodeStatus:(e,t,a)=>L(e,t,a),getLarkQrCode:(e,t)=>m(e,t),checkLarkQrCodeStatus:(e,t,a)=>P(e,t,a),listLarkGateways:()=>S().then(e=>e.gateways),getLarkGatewayStatus:(e,t)=>w(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 ie(e){return e==="electron"&&window.desktop?re:o}function s(){const e=d||ie(ne());if(!e)throw new Error("Managed desktop APIs are unavailable in this build");return d=e,e}const de=()=>s().getRuntimeStatus(),le=()=>s().startService(),ge=()=>s().listInstalledAgentRuntimes(),ce=()=>s().refreshInstalledAgentRuntimes(),ue=()=>s().readConfigFile(),he=e=>s().saveStructuredConfigFile(e),Ce=()=>s().listModelProviders(),ve=e=>s().createModelProvider(e),ke=(e,t)=>s().updateModelProvider(e,t),pe=e=>s().deleteModelProvider(e),we=(e,t,a)=>s().updateThreadKnowledgeBases(e,t,a),Se=e=>s().saveSettings(e),Pe=()=>s().getPluginDiagnostics(),me=()=>s().listDiagnosticErrors(),Le=()=>s().runDiagnosticsDoctor(),ye=(e,t)=>s().getWeixinQrCode(e,t),De=(e,t,a)=>s().checkWeixinQrCodeStatus(e,t,a),Re=(e,t)=>s().getLarkQrCode(e,t),fe=(e,t,a)=>s().checkLarkQrCodeStatus(e,t,a),be=(e,t)=>s().testLarkConnection(e,t),Ge=(e,t)=>s().enableLarkGateway(e,t),Qe=e=>s().onRuntimeEvent(e),Ee=e=>s().onRuntimeDetectionEvent(e),Me=e=>s().onBridgeEvent(e);export{Ee as a,Me as b,ue as c,Ce as d,Ge as e,he as f,de as g,ve as h,ke as i,pe as j,ye as k,ge as l,Re as m,De as n,Qe as o,fe as p,Pe as q,ce as r,le as s,be as t,we as u,me as v,Se as w,Le as x};
@@ -1,5 +1,5 @@
1
- const m="pi",n="opencode/minimax-m2.5-free";const _=["pi","opencode","codex","claudecode","cursor","gemini","qoder","iflow","hermes","localcore-acp"],w=["telegram","feishu","lark","discord","slack","dingtalk","wecom","weixin","qq","qqbot","line"],s=["pi","opencode","codex","claudecode","hermes","acp","localcore-acp"],i="localcore-acp",c=["[Scheduler Tools]","If the user asks to create, view, edit, delete, or manually run a scheduled task for this conversation, use the Bash tool to run the local scheduler CLI.","Use these commands:",'lac scheduler add --cron "<5-field cron>" --message "<exact message to send>" --desc "<short label>" [--execution-mode same-thread|side-thread]',"lac scheduler list","lac scheduler list --thread","lac scheduler info <short-job-id>",'lac scheduler edit <short-job-id> [--cron "<5-field cron>"] [--message "<exact message>"] [--desc "<short label>"] [--enabled true|false] [--execution-mode same-thread|side-thread]',"lac scheduler del <short-job-id>","lac scheduler run <short-job-id>","Environment variables LOCAL_AI_WORKSPACE_ID, LOCAL_AI_THREAD_ID, LOCAL_AI_PLATFORM, LOCAL_AI_CHAT_ID, and LOCAL_AI_PLATFORM_USER_ID are already set when available.","Prefer relying on those variables instead of inventing your own route or creating session-only cron jobs.","By default, `lac scheduler list` shows all scheduled tasks in the current workspace. Use `lac scheduler list --thread` to show only the current conversation thread.","Use the short job id shown by `lac scheduler list`; do not add a `job:` prefix or expand it to a full UUID.","Use `--execution-mode same-thread` to reuse the current thread, or `--execution-mode side-thread` to run in a dedicated scheduled thread.","Only use the scheduler CLI when the user explicitly asks for scheduled automation.","[/Scheduler Tools]"].join(`
2
- `),d=["[Monitor Tools]","If the user asks to create, view, edit, delete, or manually run an event monitor for this conversation, use the Bash tool to run the local monitor CLI.","Use these commands:",'lac monitor add --title "<short title>" --source stock.quote --symbol "<ticker>" --condition "<metric operator value>" --message "<exact analysis prompt>" [--cooldown 15m] [--execution-mode same-thread|side-thread]',"lac monitor list","lac monitor list --thread","lac monitor info <short-monitor-id>",'lac monitor edit <short-monitor-id> [--title "<title>"] [--condition "<expr>"] [--message "<exact prompt>"] [--enabled true|false] [--cooldown 15m] [--execution-mode same-thread|side-thread]',"lac monitor del <short-monitor-id>","lac monitor run <short-monitor-id>",'Supported stock metrics include latestPrice, change_percent, changePercent, and abs_change_percent. Example condition: "abs_change_percent >= 3".',"Environment variables LOCAL_AI_WORKSPACE_ID, LOCAL_AI_THREAD_ID, LOCAL_AI_PLATFORM, LOCAL_AI_CHAT_ID, and LOCAL_AI_PLATFORM_USER_ID are already set when available.","Prefer relying on those variables instead of inventing your own route.","Use --execution-mode side-thread by default so monitor analysis does not interrupt the current conversation.","Only use the monitor CLI when the user explicitly asks for event monitoring automation.","[/Monitor Tools]"].join(`
3
- `),u=["[Channel Tools]","If the user asks you to send a local file back through the current channel conversation, use the Bash tool to run the local channel CLI.","Use this command:",'lac channel send-file --path "<absolute-or-workdir-relative-file-path>" [--target "<channel-chat-or-user-id>"]',"By default, the file is sent to the current platform conversation from LOCAL_AI_CHAT_ID.","Use --target only when the user explicitly names a different channel chat or user id.","The CLI accepts absolute paths. Check that the file exists before sending when practical.","Only use the channel CLI when the user explicitly asks to send a file through the channel.","[/Channel Tools]"].join(`
4
- `),h={allow:"allow",deny:"deny","allow all":"allow all",allowall:"allow all",allow_all:"allow all",allow_always:"allow all",always:"allow all",always_allow:"allow all","always allow":"allow all","allow always":"allow all",始终允许:"allow all",永久允许:"allow all","perm:allow":"allow","perm:deny":"deny","perm:allow_all":"allow all","perm:allow_always":"allow all","perm:always":"allow all"};function f(t,e=[]){return[c,"",d,"",u,...e.flatMap(o=>o?["",o]:[]),"","[User Message]",t,"[/User Message]"].join(`
5
- `)}function p(t){switch(String(t||"").trim().toLowerCase()){case"opencode":return n;case"claudecode":return"";default:return""}}function O(t,e){const o=String(t||"").trim().toLowerCase(),a=String(e||"").trim();return o?o==="opencode"?a||n:o==="claudecode"&&a.startsWith("opencode/")?"":a:a}function r(t){if(!t)return null;const e=String(t).trim().toLowerCase(),o=h[e];return o||(e.includes("allow_all")||e.includes("allow-always")||e.includes("allow_always")||e.includes("allow always")||e.includes("always allow")||e.includes("allow all")||e.includes("始终允许")||e.includes("永久允许")?"allow all":e.startsWith("reject")||e.startsWith("deny")?"deny":e.startsWith("allow")?"allow":null)}function L(t){return!!r(t==null?void 0:t.data)}function T(t){if(!t||typeof t!="object")return null;const e=t,o=typeof e.text=="string"?e.text:typeof e.Text=="string"?e.Text:"",a=typeof e.data=="string"?e.data:typeof e.Data=="string"?e.Data:"";if(!o||!a)return null;const l=r(a);return l?{text:l,data:l}:{text:o,data:a}}function A(t){return t?s.includes(String(t).trim().toLowerCase()):!1}function y(t){const e=String(t||"").trim().toLowerCase();return e==="acp"||e==="pi"||e==="opencode"||e==="codex"||e==="claudecode"||e==="hermes"||e===i}export{_ as D,r as a,y as b,O as c,w as d,m as e,p as g,L as i,T as n,A as s,f as w};
1
+ const T="pi",c="opencode/minimax-m2.5-free";const g=["pi","opencode","codex","claudecode","cursor","gemini","qoder","iflow","hermes","localcore-acp"],E=["telegram","feishu","lark","discord","slack","dingtalk","wecom","weixin","qq","qqbot","line"],u=["pi","opencode","codex","claudecode","hermes","acp","localcore-acp"],h="localcore-acp",p=["[Scheduler Tools]","If the user asks to create, view, edit, delete, or manually run a scheduled task for this conversation, use the Bash tool to run the local scheduler CLI.","Use these commands:",'lac scheduler add --cron "<5-field cron>" --message "<exact message to send>" --desc "<short label>" [--execution-mode same-thread|side-thread]',"lac scheduler list","lac scheduler list --thread","lac scheduler info <short-job-id>",'lac scheduler edit <short-job-id> [--cron "<5-field cron>"] [--message "<exact message>"] [--desc "<short label>"] [--enabled true|false] [--execution-mode same-thread|side-thread]',"lac scheduler del <short-job-id>","lac scheduler run <short-job-id>","Environment variables LOCAL_AI_WORKSPACE_ID, LOCAL_AI_THREAD_ID, LOCAL_AI_PLATFORM, LOCAL_AI_CHAT_ID, and LOCAL_AI_PLATFORM_USER_ID are already set when available.","Prefer relying on those variables instead of inventing your own route or creating session-only cron jobs.","By default, `lac scheduler list` shows all scheduled tasks in the current workspace. Use `lac scheduler list --thread` to show only the current conversation thread.","Use the short job id shown by `lac scheduler list`; do not add a `job:` prefix or expand it to a full UUID.","Use `--execution-mode same-thread` to reuse the current thread, or `--execution-mode side-thread` to run in a dedicated scheduled thread.","Only use the scheduler CLI when the user explicitly asks for scheduled automation.","[/Scheduler Tools]"].join(`
2
+ `),_=["[Monitor Tools]","If the user asks to create, view, edit, delete, or manually run an event monitor for this conversation, use the Bash tool to run the local monitor CLI.","Use these commands:",'lac monitor add --title "<short title>" --source stock.quote --symbol "<ticker>" --condition "<metric operator value>" --message "<exact analysis prompt>" [--cooldown 15m] [--execution-mode same-thread|side-thread]',"lac monitor list","lac monitor list --thread","lac monitor info <short-monitor-id>",'lac monitor edit <short-monitor-id> [--title "<title>"] [--condition "<expr>"] [--message "<exact prompt>"] [--enabled true|false] [--cooldown 15m] [--execution-mode same-thread|side-thread]',"lac monitor del <short-monitor-id>","lac monitor run <short-monitor-id>",'Supported stock metrics include latestPrice, change_percent, changePercent, and abs_change_percent. Example condition: "abs_change_percent >= 3".',"Environment variables LOCAL_AI_WORKSPACE_ID, LOCAL_AI_THREAD_ID, LOCAL_AI_PLATFORM, LOCAL_AI_CHAT_ID, and LOCAL_AI_PLATFORM_USER_ID are already set when available.","Prefer relying on those variables instead of inventing your own route.","Use --execution-mode side-thread by default so monitor analysis does not interrupt the current conversation.","Only use the monitor CLI when the user explicitly asks for event monitoring automation.","[/Monitor Tools]"].join(`
3
+ `),m=["[Channel Tools]","If the user asks you to send a local file back through the current channel conversation, use the Bash tool to run the local channel CLI.","Use this command:",'lac channel send-file --path "<absolute-or-workdir-relative-file-path>" [--target "<channel-chat-or-user-id>"]',"By default, the file is sent to the current platform conversation from LOCAL_AI_CHAT_ID.","Use --target only when the user explicitly names a different channel chat or user id.","The CLI accepts absolute paths. Check that the file exists before sending when practical.","Only use the channel CLI when the user explicitly asks to send a file through the channel.","[/Channel Tools]"].join(`
4
+ `),f={allow:"allow",deny:"deny","allow all":"allow all",allowall:"allow all",allow_all:"allow all",allow_always:"allow all",always:"allow all",always_allow:"allow all","always allow":"allow all","allow always":"allow all",始终允许:"allow all",永久允许:"allow all","perm:allow":"allow","perm:deny":"deny","perm:allow_all":"allow all","perm:allow_always":"allow all","perm:always":"allow all"};function P(o,e=[]){return[p,"",_,"",m,...e.flatMap(t=>t?["",t]:[]),"","[User Message]",o,"[/User Message]"].join(`
5
+ `)}function I(o){switch(String(o||"").trim().toLowerCase()){case"opencode":return c;case"claudecode":return"";default:return""}}function L(o,e){const t=String(o||"").trim().toLowerCase(),a=String(e||"").trim();return t?t==="opencode"?a||c:t==="claudecode"&&a.startsWith("opencode/")?"":a:a}function d(o){if(!o)return null;const e=String(o).trim().toLowerCase(),t=f[e];return t||(e.includes("allow_all")||e.includes("allow-always")||e.includes("allow_always")||e.includes("allow always")||e.includes("always allow")||e.includes("allow all")||e.includes("始终允许")||e.includes("永久允许")?"allow all":e.startsWith("reject")||e.startsWith("deny")?"deny":e.startsWith("allow")?"allow":null)}function S(o){return!!d(o==null?void 0:o.data)}function D(o){if(!o||typeof o!="object")return null;const e=o,t=typeof e.text=="string"?e.text:typeof e.Text=="string"?e.Text:"",a=typeof e.data=="string"?e.data:typeof e.Data=="string"?e.Data:"";if(!t||!a)return null;const l=d(a);return l?{text:l,data:l}:{text:t,data:a}}function y(o){return o?u.includes(String(o).trim().toLowerCase()):!1}function b(o){const e=String(o||"").trim().toLowerCase();return e==="acp"||e==="pi"||e==="opencode"||e==="codex"||e==="claudecode"||e==="hermes"||e===h}const s="opensandbox-default",w="pi-acp-local",n="/workspace",r="/agent-state",i=[{id:"local-desktop",label:"Local Desktop",corePublicOrigin:"http://127.0.0.1:9831",coreBindHost:"127.0.0.1",openSandboxServerUrl:"http://127.0.0.1:8080",defaultWorkspaceRoot:"",sandboxImagePrefix:"agentdock",workspaceMountPath:n,stateMountPath:r,defaultSandboxProviderId:s},{id:"docker-compose",label:"Docker Compose",corePublicOrigin:"http://127.0.0.1:9831",coreBindHost:"0.0.0.0",openSandboxServerUrl:"http://opensandbox-server:8080",defaultWorkspaceRoot:"/workspace",sandboxImagePrefix:"agentdock",workspaceMountPath:n,stateMountPath:r,defaultSandboxProviderId:s},{id:"remote-cloud",label:"Remote Cloud",corePublicOrigin:"",coreBindHost:"0.0.0.0",openSandboxServerUrl:"",defaultWorkspaceRoot:"/workspace",sandboxImagePrefix:"agentdock",workspaceMountPath:n,stateMountPath:r,defaultSandboxProviderId:s}],O=[{id:w,agent_type:"pi",image:"agentdock/pi-acp:local",transport:"http-ndjson",acp_port:8080,entrypoint:["node","/opt/agentdock/acp-bridge.mjs"],workspace_mount_path:n,state_mount_path:r}];function A(o){const e=String(o||"").trim();return i.find(t=>t.id===e)||i[0]}function x(o){const e=A(o);return{id:e.defaultSandboxProviderId,type:"opensandbox",name:"OpenSandbox",server_url:e.openSandboxServerUrl,api_key_env:"OPEN_SANDBOX_API_KEY"}}function C(o){const e=String(o||"").trim().toLowerCase()||"pi";return O.find(t=>t.agent_type===e)||{id:`${e}-acp-local`,agent_type:e,image:`agentdock/${e}-acp:local`,transport:"http-ndjson",acp_port:8080,entrypoint:["node","/opt/agentdock/acp-bridge.mjs"],workspace_mount_path:n,state_mount_path:r}}export{g as D,d as a,b,C as c,x as d,L as e,I as f,A as g,s as h,S as i,i as j,E as k,T as l,D as n,y as s,P as w};
@@ -0,0 +1 @@
1
+ const e={dashboard:"Dashboard",chat:"Chat",chatDesktop:"Desktop Chat",chatWeb:"Chat",workspace:"Workspace",knowledge:"Knowledge",projects:"Projects",sessions:"Sessions",cron:"Cron",monitors:"Monitors",bridge:"Bridge",system:"System"},t={title:"Dashboard",version:"Version",uptime:"Uptime",platforms:"Platforms",projects:"Projects",bridgeAdapters:"Bridge adapters",noData:"No data available"},o={title:"Projects",name:"Name",agent:"Agent",platforms:"Platforms",sessions:"Sessions",heartbeat:"Heartbeat",settings:"Settings",quiet:"Quiet mode",language:"Language",adminFrom:"Admin from",disabledCommands:"Disabled commands",save:"Save",detail:"Details",noProjects:"No projects configured",tabs:{overview:"Overview",providers:"Providers",sandbox:"Sandbox",heartbeat:"Heartbeat",settings:"Settings"}},s={title:"Sessions",id:"ID",sessionKey:"Session key",name:"Name",platform:"Platform",active:"Active",createdAt:"Created at",history:"History",send:"Send",messageInput:"Message",delete:"Delete",noSessions:"No sessions",noMessages:"No messages yet",notLiveHint:"This chat target is offline right now, so replies are temporarily unavailable. When new activity arrives, sending will become available again.",offline:"offline",justNow:"just now",allProjects:"All projects",chat:"Chat",enterSession:"Open session",newChat:"New chat",selectProject:"Select a project",projectRequired:"Choose a project before starting a chat.",noAvailableChatTarget:"There is no conversation ready to chat in this project yet. Open an available session from the sessions view first.",noReadyChats:"There are no chat-ready sessions right now. Use the Sessions page to review history.",emptyProject:"This project does not have any sessions yet.",emptySelection:"Pick a project and start a new chat to begin.",activeChat:"Active chat",sendHint:"Messages will be sent to the selected project.",waitingForReply:"Waiting for the assistant reply…",preparingChat:"Preparing the chat…",pollTimeout:"The assistant did not finish responding before the refresh timeout.",createFailed:"Failed to create a new chat session.",loadFailed:"Failed to load the selected session.",sendFailed:"Failed to send the message.",sessionUnavailable:"This chat target is offline right now, so replies are temporarily unavailable. Try again after new activity arrives.",deleteConfirmTitle:"Delete session",deleteConfirmBody:"This removes the saved conversation history for the selected session.",renameTitle:"Rename session",renamePlaceholder:"Session name",loadSession:"Open",historyTitle:"Conversation history",availableNow:"Ready to chat",waitingActivation:"Waiting to become available"},a={title:"Providers",name:"Name",model:"Model",baseUrl:"Base URL",active:"Active",add:"Add provider",remove:"Remove",activate:"Activate",setModel:"Set model",models:"Models"},i={title:"Scheduled jobs",expression:"Cron expression",prompt:"Prompt",exec:"Execute",description:"Description",enabled:"Enabled",silent:"Silent",lastRun:"Last run",lastError:"Last error",add:"Add job",delete:"Delete",noJobs:"No scheduled jobs",workDir:"Working directory",sessionKey:"Session key",project:"Project"},n={title:"Monitors",prompt:"Prompt",condition:"Condition",cooldown:"Cooldown (minutes)",enabled:"Enabled",lastRun:"Last trigger",add:"Add monitor",edit:"Edit monitor",run:"Run now",noMonitors:"No monitors",monitorTitle:"Title"},r={title:"Heartbeat",status:"Status",interval:"Interval",paused:"Paused",running:"Running",pause:"Pause",resume:"Resume",trigger:"Run now",setInterval:"Set interval",runCount:"Run count",errorCount:"Error count",skippedBusy:"Skipped (busy)",lastRun:"Last run"},l={title:"Bridge",platform:"Platform",capabilities:"Capabilities",connectedAt:"Connected at",noAdapters:"No bridge adapters"},d={title:"System",config:"Configuration",logs:"Logs",restart:"Restart",reload:"Reload config",restartConfirm:"Restart the service? Active sessions may be interrupted.",reloadConfirm:"Reload configuration from disk?",level:"Log level",limit:"Line limit"},c={title:"AgentDock",subtitle:"Connect to your AgentDock instance",token:"API token",serverUrl:"Server URL",connect:"Connect",invalidToken:"Invalid or expired token",logout:"Log out"},m={loading:"Loading…",error:"Error",success:"Success",confirm:"Confirm",cancel:"Cancel",save:"Save",delete:"Delete",back:"Back",refresh:"Refresh",search:"Search",noData:"No data",actions:"Actions",viewAll:"View all",optional:"optional",confirmDelete:"Are you sure you want to delete this?"},h={light:"Light",dark:"Dark",system:"System"},p={nav:e,dashboard:t,projects:o,sessions:s,providers:a,cron:i,monitors:n,heartbeat:r,bridge:l,system:d,login:c,common:m,theme:h};export{l as bridge,m as common,i as cron,t as dashboard,p as default,r as heartbeat,c as login,n as monitors,e as nav,o as projects,a as providers,s as sessions,d as system,h as theme};
@@ -0,0 +1 @@
1
+ const e={dashboard:"Panel",chat:"Chat",chatDesktop:"Chat de escritorio",chatWeb:"Chat",workspace:"Espacio de trabajo",knowledge:"Conocimiento",projects:"Proyectos",sessions:"Sesiones",cron:"Cron",bridge:"Puente",system:"Sistema"},a={title:"Panel",version:"Versión",uptime:"Tiempo activo",platforms:"Plataformas",projects:"Proyectos",bridgeAdapters:"Adaptadores de puente",noData:"No hay datos disponibles"},o={title:"Proyectos",name:"Nombre",agent:"Agente",platforms:"Plataformas",sessions:"Sesiones",heartbeat:"Latido",settings:"Ajustes",quiet:"Modo silencioso",language:"Idioma",adminFrom:"Administración desde",disabledCommands:"Comandos deshabilitados",save:"Guardar",detail:"Detalles",noProjects:"No hay proyectos configurados",tabs:{overview:"Resumen",providers:"Proveedores",sandbox:"Sandbox",heartbeat:"Latido",settings:"Ajustes"}},s={title:"Sesiones",id:"ID",sessionKey:"Clave de sesión",name:"Nombre",platform:"Plataforma",active:"Activa",createdAt:"Creada el",history:"Historial",send:"Enviar",messageInput:"Mensaje",delete:"Eliminar",noSessions:"No hay sesiones",noMessages:"Sin mensajes aún",notLiveHint:"Este destino de chat está desconectado en este momento, por lo que las respuestas están temporalmente deshabilitadas. Cuando llegue nueva actividad, el envío volverá a estar disponible.",offline:"sin conexión",justNow:"ahora",allProjects:"Todos los proyectos",chat:"Chat",enterSession:"Abrir sesión",newChat:"Nuevo chat",selectProject:"Seleccionar proyecto",projectRequired:"Elija un proyecto antes de iniciar un chat.",noAvailableChatTarget:"Este proyecto todavía no tiene una conversación lista para chatear. Abra primero una sesión disponible desde la vista de sesiones.",noReadyChats:"No hay sesiones listas para chatear en este momento. Use la página de sesiones para revisar el historial.",emptyProject:"Este proyecto todavía no tiene sesiones.",emptySelection:"Seleccione un proyecto y empiece un chat nuevo.",activeChat:"Chat activo",sendHint:"Los mensajes se enviarán al proyecto seleccionado.",waitingForReply:"Esperando la respuesta del asistente…",preparingChat:"Preparando el chat…",pollTimeout:"El asistente no terminó de responder antes del tiempo límite.",createFailed:"No se pudo crear una nueva sesión de chat.",loadFailed:"No se pudo cargar la sesión seleccionada.",sendFailed:"No se pudo enviar el mensaje.",sessionUnavailable:"Este destino de chat está desconectado en este momento, por lo que las respuestas están temporalmente deshabilitadas. Inténtelo de nuevo cuando llegue nueva actividad.",deleteConfirmTitle:"Eliminar sesión",deleteConfirmBody:"Esto elimina el historial guardado de la conversación de la sesión seleccionada.",renameTitle:"Renombrar sesión",renamePlaceholder:"Nombre de la sesión",loadSession:"Abrir",historyTitle:"Historial de conversación",availableNow:"Disponible para chatear",waitingActivation:"Esperando disponibilidad"},t={title:"Proveedores",name:"Nombre",model:"Modelo",baseUrl:"URL base",active:"Activo",add:"Añadir proveedor",remove:"Quitar",activate:"Activar",setModel:"Establecer modelo",models:"Modelos disponibles"},i={title:"Tareas programadas",expression:"Expresión cron",prompt:"Indicación",exec:"Ejecutar",description:"Descripción",enabled:"Habilitada",silent:"Silenciosa",lastRun:"Última ejecución",lastError:"Último error",add:"Añadir tarea",delete:"Eliminar",noJobs:"No hay tareas programadas",workDir:"Directorio de trabajo",sessionKey:"Clave de sesión",project:"Proyecto"},n={title:"Latido",status:"Estado",interval:"Intervalo",paused:"En pausa",running:"En ejecución",pause:"Pausar",resume:"Reanudar",trigger:"Ejecutar ahora",setInterval:"Establecer intervalo",runCount:"Ejecuciones",errorCount:"Errores",skippedBusy:"Omitida (ocupado)",lastRun:"Última ejecución"},r={title:"Puente",platform:"Plataforma",capabilities:"Capacidades",connectedAt:"Conectada el",noAdapters:"No hay adaptadores de puente"},d={title:"Sistema",config:"Configuración",logs:"Registros",restart:"Reiniciar",reload:"Recargar configuración",restartConfirm:"¿Reiniciar el servicio? Las sesiones activas pueden interrumpirse.",reloadConfirm:"¿Recargar la configuración desde el disco?",level:"Nivel de registro",limit:"Límite de líneas"},l={title:"AgentDock",subtitle:"Conéctese a su instancia de AgentDock",token:"Token de API",serverUrl:"URL del servidor",connect:"Conectar",invalidToken:"Token no válido o caducado",logout:"Cerrar sesión"},c={loading:"Cargando…",error:"Error",success:"Correcto",confirm:"Confirmar",cancel:"Cancelar",save:"Guardar",delete:"Eliminar",back:"Volver",refresh:"Actualizar",search:"Buscar",noData:"Sin datos",actions:"Acciones",viewAll:"Ver todo",optional:"opcional",confirmDelete:"¿Seguro que desea eliminar esto?"},m={light:"Claro",dark:"Oscuro",system:"Sistema"},p={nav:e,dashboard:a,projects:o,sessions:s,providers:t,cron:i,heartbeat:n,bridge:r,system:d,login:l,common:c,theme:m};export{r as bridge,c as common,i as cron,a as dashboard,p as default,n as heartbeat,l as login,e as nav,o as projects,t as providers,s as sessions,d as system,m as theme};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-B36eowj-.js";/**
1
+ import{c}from"./index-DwhTjLA1.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-B36eowj-.js";/**
1
+ import{c}from"./index-DwhTjLA1.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.