@kafca/agentdock 0.1.56 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/renderer/assets/{Badge-DjcoXx2J.js → Badge-CDTbmw1h.js} +1 -1
- package/dist/renderer/assets/Card-DayUo35w.js +1 -0
- package/dist/renderer/assets/Config-ByGMQuzR.js +21 -0
- package/dist/renderer/assets/CronList-XqHdVlgu.js +1 -0
- package/dist/renderer/assets/Dashboard-CZj-oANw.js +41 -0
- package/dist/renderer/assets/{EmptyState-DIZLiccW.js → EmptyState-EFMkOjZO.js} +1 -1
- package/dist/renderer/assets/HighlightedMarkdown-DyvF3DHK.js +12 -0
- package/dist/renderer/assets/Input-DxoWVc9d.js +1 -0
- package/dist/renderer/assets/{KnowledgeDetail-CJ9IYOsa.js → KnowledgeDetail-CbUb2tG7.js} +2 -2
- package/dist/renderer/assets/{KnowledgeHome-BLGPwnBO.js → KnowledgeHome-BWV1gz4f.js} +3 -3
- package/dist/renderer/assets/Logs-DqnanQTc.js +6 -0
- package/dist/renderer/assets/{Modal-CQiUpfl4.js → Modal-yY7TzR0x.js} +3 -3
- package/dist/renderer/assets/MonitorList-CIjGQkFs.js +1 -0
- package/dist/renderer/assets/Page-vwHNUdoj.js +1 -0
- package/dist/renderer/assets/{Select-D6z65IT3.js → Select-CmbK36pN.js} +2 -2
- package/dist/renderer/assets/ThreadChat-4OceMgM4.js +86 -0
- package/dist/renderer/assets/Workspace-DplPJOjJ.js +19 -0
- package/dist/renderer/assets/{arrow-left-CV5cL3f4.js → arrow-left-C8HfBt2K.js} +1 -1
- package/dist/renderer/assets/{book-open-DThvB7pj.js → book-open-BCdZWncQ.js} +1 -1
- package/dist/renderer/assets/channels-hgO3cAIx.js +6 -0
- package/dist/renderer/assets/chevron-down-BPk77tqY.js +11 -0
- package/dist/renderer/assets/index-BIKL3fTP.css +11 -0
- package/dist/renderer/assets/index-BlA4xPdd.js +41 -0
- package/dist/renderer/assets/index-wYpjqVqC.js +167 -0
- package/dist/renderer/assets/knowledge-7pl06KuH.js +1 -0
- package/dist/renderer/assets/{pencil-Dv5WxhdC.js → pencil-CB1SWZ9A.js} +1 -1
- package/dist/renderer/assets/{play-DnCnft83.js → play-BvsoXUrM.js} +1 -1
- package/dist/renderer/assets/{plus-DsxIagzS.js → plus-CokBDnaL.js} +1 -1
- package/dist/renderer/assets/{save-CST01lIc.js → save-D-w4kATO.js} +1 -1
- package/dist/renderer/assets/{search-B_bqy6Wd.js → search-Cnsn6i4Q.js} +1 -1
- package/dist/renderer/assets/{shield-check-D6lG5Aoc.js → shield-check-Cjja2Gh6.js} +1 -1
- package/dist/renderer/assets/threads-BCm6j4eI.js +1 -0
- package/dist/renderer/assets/{trash-2-Cefngb6Q.js → trash-2-CIxz9qYY.js} +1 -1
- package/dist/renderer/index.html +2 -2
- package/dist-electron/packages/contracts/src/automation.js +2 -0
- package/dist-electron/packages/contracts/src/channels.js +2 -0
- package/dist-electron/packages/contracts/src/knowledge.js +2 -0
- package/dist-electron/packages/contracts/src/local-core.js +15 -0
- package/dist-electron/packages/contracts/src/runtime.js +2 -0
- package/dist-electron/packages/contracts/src/scheduler.js +2 -0
- package/dist-electron/packages/contracts/src/threads.js +2 -0
- package/dist-electron/packages/core-sdk/src/automation.js +32 -0
- package/dist-electron/packages/core-sdk/src/channels.js +121 -0
- package/dist-electron/packages/core-sdk/src/client.js +455 -0
- package/dist-electron/packages/core-sdk/src/index.js +43 -607
- package/dist-electron/packages/core-sdk/src/knowledge.js +85 -0
- package/dist-electron/packages/core-sdk/src/request.js +22 -0
- package/dist-electron/packages/core-sdk/src/runtime.js +214 -0
- package/dist-electron/packages/core-sdk/src/scheduler.js +32 -0
- package/dist-electron/packages/core-sdk/src/threads.js +67 -0
- package/dist-electron/packages/plugin-sdk/src/agents.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/automation.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/channels.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/index.js +21 -0
- package/dist-electron/packages/plugin-sdk/src/knowledge.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/runtime.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/scheduler.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/threads.js +2 -0
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +5 -8
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-content.js +2 -2
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-turn-coordinator.js +3 -3
- package/dist-electron/services/local-ai-core/src/acp/store/agent-task-store.js +5 -5
- package/dist-electron/services/local-ai-core/src/acp/store/automation-monitor-store.js +12 -12
- package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +2 -2
- package/dist-electron/services/local-ai-core/src/acp/store/scheduler-store.js +11 -11
- package/dist-electron/services/local-ai-core/src/acp/store/security-store.js +3 -3
- package/dist-electron/services/local-ai-core/src/acp/store/thread-store.js +7 -7
- package/dist-electron/services/local-ai-core/src/acp/workspace-acp-permissions.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/claudecode/definition.js +3 -3
- package/dist-electron/services/local-ai-core/src/agents/codex/definition.js +3 -3
- package/dist-electron/services/local-ai-core/src/agents/localcore-acp/definition.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/localcore-acp/index.js +4 -4
- package/dist-electron/services/local-ai-core/src/agents/opencode/launch.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/pi/definition.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/pi/launch.js +3 -3
- package/dist-electron/services/local-ai-core/src/agents/pi/provider-materializer.js +1 -1
- package/dist-electron/services/local-ai-core/src/agents/shared/agent-plugin.js +4 -4
- package/dist-electron/services/local-ai-core/src/channel/lark/cards.js +33 -18
- package/dist-electron/services/local-ai-core/src/channel/lark/config.js +2 -2
- package/dist-electron/services/local-ai-core/src/channel/lark/gateway-utils.js +91 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/inbound-handler.js +180 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +52 -486
- package/dist-electron/services/local-ai-core/src/channel/lark/outbound-transport.js +124 -0
- package/dist-electron/services/local-ai-core/src/channel/shared/inbound-authorization.js +54 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/config.js +2 -2
- package/dist-electron/services/local-ai-core/src/channel/weixin/inbound-media.js +21 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/inbound-poller.js +167 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +50 -469
- package/dist-electron/services/local-ai-core/src/channel/weixin/runtime-state.js +156 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/text-utils.js +100 -0
- package/dist-electron/services/local-ai-core/src/cli/lac.js +6 -6
- package/dist-electron/services/local-ai-core/src/cli/monitor-cli-parsers.js +2 -2
- package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +28 -70
- package/dist-electron/services/local-ai-core/src/plugins/builtin/knowledge-ai-vector-plugin.js +2 -2
- package/dist-electron/services/local-ai-core/src/plugins/builtin/knowledge-noop-plugin.js +2 -2
- package/dist-electron/services/local-ai-core/src/router/workspace-bridge-event-stream.js +29 -0
- package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +5 -5
- package/dist-electron/services/local-ai-core/src/router/workspace-router.js +47 -60
- package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +5 -5
- package/dist-electron/services/local-ai-core/src/runtime/config-migration.js +6 -6
- package/dist-electron/services/local-ai-core/src/runtime/deployment-diagnostics.js +3 -3
- package/dist-electron/services/local-ai-core/src/runtime/external-service.js +3 -1
- package/dist-electron/services/local-ai-core/src/runtime/handlers/automation-handler.js +11 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/channel-handler.js +12 -6
- package/dist-electron/services/local-ai-core/src/runtime/handlers/external-handler.js +10 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/knowledge-handler.js +18 -6
- package/dist-electron/services/local-ai-core/src/runtime/handlers/provider-handler.js +7 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/runtime-handler.js +28 -3
- package/dist-electron/services/local-ai-core/src/runtime/handlers/scheduler-handler.js +10 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/security-handler.js +18 -5
- package/dist-electron/services/local-ai-core/src/runtime/handlers/task-handler.js +14 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/thread-handler.js +18 -15
- package/dist-electron/services/local-ai-core/src/runtime/handlers/workspace-handler.js +13 -2
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +35 -8
- package/dist-electron/services/local-ai-core/src/runtime/request-validation.js +79 -0
- package/dist-electron/services/local-ai-core/src/runtime/runtime-detection-service.js +9 -9
- package/dist-electron/services/local-ai-core/src/runtime/server-helpers.js +10 -1
- package/dist-electron/services/local-ai-core/src/runtime/server.js +2 -1
- package/dist-electron/services/local-ai-core/src/runtime/workspace-project-registry.js +76 -0
- package/dist-electron/services/local-ai-core/src/sandbox/sandbox-config.js +8 -8
- package/dist-electron/services/local-ai-core/src/thread/agent-message-policy.js +75 -0
- package/dist-electron/shared/desktop.js +1 -64
- package/dist-electron/src/components/chat/chat-controller-state.js +60 -0
- package/dist-electron/src/components/chat/chat-event-gate.js +146 -0
- package/dist-electron/src/components/chat/markdown-code-block.js +8 -0
- package/dist-electron/src/pages/Desktop/workspace-model.js +212 -0
- package/dist-electron/src/pages/Threads/thread-chat-model.js +50 -51
- package/dist-electron/tests/contracts/agent-message-policy.test.js +21 -0
- package/dist-electron/tests/contracts/architecture-docs.test.js +56 -33
- package/dist-electron/tests/contracts/chat-event-gate.test.js +114 -0
- package/dist-electron/tests/contracts/chat-markdown.test.js +16 -0
- package/dist-electron/tests/contracts/thread-task-state.test.js +32 -0
- package/dist-electron/tests/contracts/workspace-identity.test.js +23 -0
- package/dist-electron/tests/electron/core-client.test.js +284 -0
- package/dist-electron/tests/electron/plugin-kernel.test.js +54 -0
- package/dist-electron/tests/electron/renderer-packaging.test.js +9 -0
- package/dist-electron/tests/electron/workspace-task-store.test.js +31 -0
- package/dist-electron/tests/integration/channel-inbound-authorization.test.js +80 -0
- package/dist-electron/tests/integration/lark-gateway-utils.test.js +13 -0
- package/dist-electron/tests/integration/lark-gateway.test.js +4 -4
- package/dist-electron/tests/integration/weixin-runtime-state.test.js +32 -0
- package/dist-electron/tests/integration/weixin-text-utils.test.js +15 -0
- package/package.json +9 -4
- package/dist/renderer/assets/Chat-C5Bkm9-M.js +0 -2
- package/dist/renderer/assets/ChatMarkdown-uc36EzyD.js +0 -45
- package/dist/renderer/assets/Config-DHtQuuLy.js +0 -21
- package/dist/renderer/assets/CronList-BYUnhzSC.js +0 -1
- package/dist/renderer/assets/Dashboard-BPnGMDg3.js +0 -26
- package/dist/renderer/assets/Logs-Dyd2Uwlt.js +0 -1
- package/dist/renderer/assets/MonitorList-Byg3E3Gt.js +0 -1
- package/dist/renderer/assets/Page-7DxXvTMm.js +0 -1
- package/dist/renderer/assets/ProjectDetail-Dfr5s0Ja.js +0 -11
- package/dist/renderer/assets/ProjectList-CDDQjAQ_.js +0 -1
- package/dist/renderer/assets/SessionChat-s7CAaCPL.js +0 -1
- package/dist/renderer/assets/SessionList-D-OycKKS.js +0 -1
- package/dist/renderer/assets/ThreadChat-CLdFynB5.js +0 -28
- package/dist/renderer/assets/Workspace-xfT5z4j_.js +0 -19
- package/dist/renderer/assets/bot-CWQ5-ovl.js +0 -6
- package/dist/renderer/assets/check-DKM7zfWG.js +0 -6
- package/dist/renderer/assets/chevron-down-Dfw2KU87.js +0 -6
- package/dist/renderer/assets/circle-CoP4RA4s.js +0 -6
- package/dist/renderer/assets/desktop-CsDYrOOU.js +0 -1
- package/dist/renderer/assets/desktop-JQkhNOF4.js +0 -5
- package/dist/renderer/assets/funnel-DpVLlG3g.js +0 -6
- package/dist/renderer/assets/heart-BMD36ejP.js +0 -6
- package/dist/renderer/assets/index-COxSYBjE.js +0 -182
- package/dist/renderer/assets/index-CTGTI-cm.js +0 -41
- package/dist/renderer/assets/index-CjCuR6DI.css +0 -11
- package/dist/renderer/assets/projects-DgjHcNgt.js +0 -1
- package/dist/renderer/assets/server-ecH4GNwa.js +0 -11
- package/dist/renderer/assets/session-utils-Dd_WKMYW.js +0 -6
- package/dist/renderer/assets/sessions-BQ33Mv4k.js +0 -1
- package/dist/renderer/assets/user-D_8RSH-T.js +0 -6
- package/dist/renderer/assets/wifi-off-DB9D-pOu.js +0 -11
- package/dist-electron/src/api/client.js +0 -73
- package/dist-electron/src/api/sessions.js +0 -21
- package/dist-electron/src/lib/session-utils.js +0 -51
- package/dist-electron/src/pages/Projects/project-provider-config.js +0 -75
- package/dist-electron/tests/electron/project-provider-config.test.js +0 -71
package/README.md
CHANGED
|
@@ -94,6 +94,13 @@ flowchart LR
|
|
|
94
94
|
|
|
95
95
|
## New
|
|
96
96
|
|
|
97
|
+
### 2026-06-21
|
|
98
|
+
|
|
99
|
+
- 桌面端统一通过 Core SDK 访问 Local AI Core,移除旧登录、项目、会话和 renderer API 双轨实现。
|
|
100
|
+
- Workspace Registry 成为项目配置权威数据源,并使用不随显示名称变化的稳定 workspace ID。
|
|
101
|
+
- Local AI Core HTTP API 增加统一请求校验与 400 错误语义;Agent 工具策略和知识库上下文统一由 Core 注入。
|
|
102
|
+
- 简化插件 capability/runtime 装配,拆分 bridge event stream 与知识库 domain contracts,并将类型检查纳入测试门禁。
|
|
103
|
+
|
|
97
104
|
### 2026-06-20
|
|
98
105
|
|
|
99
106
|
- 发布 AgentDock 0.1.56。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,g as a}from"./index-
|
|
1
|
+
import{j as t,g as a}from"./index-wYpjqVqC.js";const n={default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",success:"border-transparent bg-primary/10 text-primary dark:bg-primary/15 dark:text-primary",warning:"border-transparent bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-200",danger:"border-transparent bg-destructive/10 text-destructive dark:bg-destructive/20 dark:text-red-200",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",info:"border-transparent bg-blue-100 text-blue-700 dark:bg-blue-500/15 dark:text-blue-200"};function s({children:r,variant:e="default"}){return t.jsx("span",{className:a("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",n[e]),children:r})}export{s as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as a,g as d}from"./index-wYpjqVqC.js";function n({children:r,className:o,hover:e}){return a.jsx("div",{className:d("rounded-lg p-5 text-card-foreground transition-colors duration-200 animate-float-in","border border-black/[0.08] bg-white/62 shadow-[0_1px_1px_rgba(0,0,0,0.04)] backdrop-blur-2xl","dark:border-white/[0.07] dark:bg-white/[0.06] dark:shadow-none",e&&"cursor-pointer hover:border-black/[0.12] hover:bg-white/76 hover:shadow-[0_10px_26px_rgba(0,0,0,0.07)] dark:hover:border-white/[0.10] dark:hover:bg-white/[0.09] dark:hover:shadow-none",o),children:r})}export{n as C};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{c as g,u as H,r as n,k as $,H as T,I as C,j as e,B as c,R as q,L as V,T as F,J as R,K as J,N as Q}from"./index-wYpjqVqC.js";import{B as x}from"./Badge-CDTbmw1h.js";import{I as X}from"./Input-DxoWVc9d.js";import{P as G,S as l,a as I}from"./Page-vwHNUdoj.js";import{S as O}from"./shield-check-Cjja2Gh6.js";import{S as W,P as Y}from"./save-D-w4kATO.js";import"./Card-DayUo35w.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 Z=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],ee=g("file-code",Z);/**
|
|
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 se=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],te=g("rotate-ccw",se);/**
|
|
12
|
+
* @license lucide-react v0.487.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const ae=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],ne=g("scroll-text",ae);/**
|
|
17
|
+
* @license lucide-react v0.487.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const re=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],ie=g("stethoscope",re);function le(a){return a==="api_ready"?"success":a==="error"?"danger":a==="starting"?"warning":"neutral"}function he(){const{t:a}=H(),[t,h]=n.useState(null),[o,M]=n.useState(null),[p,f]=n.useState([]),[d,D]=n.useState(null),[u,j]=n.useState(""),[P,v]=n.useState(""),[z,y]=n.useState(!0),[N,w]=n.useState(!1),[A,k]=n.useState(!1),[b,i]=n.useState(""),m=n.useCallback(async()=>{y(!0);try{const[s,r,S]=await Promise.allSettled([$(),T(),C().then(E=>E.errors)]);s.status==="fulfilled"&&(h(s.value),j(s.value.settings.knowledge.baseUrl||""),v(s.value.settings.knowledge.baseUrl||"")),r.status==="fulfilled"&&M(r.value),S.status==="fulfilled"&&f(S.value)}finally{y(!1)}},[]);n.useEffect(()=>{m()},[m]);const L=async()=>{if(confirm(a("system.restartConfirm")))try{await R(),i(a("common.success")),await m()}catch(s){i(s.message)}},U=async()=>{if(confirm(a("system.reloadConfirm")))try{await R(),i(a("common.success")),await m()}catch(s){i(s.message)}},K=async()=>{w(!0);try{const s=await J({knowledge:{baseUrl:u,authMode:(t==null?void 0:t.settings.knowledge.authMode)||"none",token:(t==null?void 0:t.settings.knowledge.token)||"",headerName:(t==null?void 0:t.settings.knowledge.headerName)||"X-API-Key",defaultCollection:(t==null?void 0:t.settings.knowledge.defaultCollection)||"personal_knowledge"}});h(r=>r&&{...r,settings:s}),v(s.knowledge.baseUrl||""),i(a("common.success"))}catch(s){i(s.message)}finally{w(!1)}},_=async()=>{k(!0);try{const s=await Q();D(s),f((await C()).errors),i(`Diagnostics completed with ${s.status} status.`)}catch(s){i(s.message)}finally{k(!1)}},B=u!==P;return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsx(G,{title:a("nav.system"),description:"Runtime health, logs, and plugin diagnostics. Advanced config is available read-only from the diagnostics drawer.",actions:e.jsxs(e.Fragment,{children:[e.jsxs(c,{variant:"secondary",onClick:U,children:[e.jsx(q,{size:16})," ",a("system.reload")]}),e.jsxs(c,{variant:"danger",onClick:L,children:[e.jsx(te,{size:16})," ",a("system.restart")]}),e.jsx(V,{to:"/system/logs",children:e.jsxs(c,{variant:"secondary",children:[e.jsx(ne,{size:16})," ",a("system.logs")]})})]})}),b?e.jsx("div",{role:"status",className:"rounded-lg border border-primary/20 bg-primary/10 px-4 py-3 text-sm text-primary",children:b}):null,e.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[e.jsxs(l,{className:"app-panel",title:"Runtime",description:z?"Loading...":"Local service status.",children:[e.jsx(I,{tone:le(t==null?void 0:t.phase),children:(t==null?void 0:t.phase)||"unknown"}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:t!=null&&t.pendingRestart?"Restart required to apply saved changes.":"No pending restart."})]}),e.jsx(l,{className:"app-panel",title:"Runtime Config",description:"Active SQLite storage location.",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ee,{size:18,className:"mt-0.5 text-primary"}),e.jsx("p",{className:"break-all font-mono text-xs leading-5 text-muted-foreground",children:(t==null?void 0:t.runtimeConfig.databasePath)||"-"})]})}),e.jsxs(l,{className:"app-panel",title:"Plugins",description:"Health summary only.",children:[e.jsx("p",{className:"text-2xl font-semibold text-foreground",children:o?`${o.enabledPluginCount}/${o.pluginCount}`:"-"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"enabled plugins"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 xl:grid-cols-2",children:[e.jsx(l,{className:"app-panel",title:"Diagnostics",description:"Structured runtime and channel health checks.",actions:e.jsxs(c,{size:"sm",variant:"secondary",onClick:()=>void _(),loading:A,children:[e.jsx(ie,{size:14})," Run doctor"]}),children:d?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{tone:d.status==="pass"?"success":d.status==="warn"?"warning":"danger",children:d.status}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Checked ",new Date(d.checkedAt).toLocaleString()]})]}),e.jsx("div",{className:"space-y-2",children:d.checks.map(s=>{var r;return e.jsx("div",{className:"app-list-row",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:s.label}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:s.summary}),(r=s.errorInfo)!=null&&r.suggestedAction?e.jsx("p",{className:"mt-1 text-xs leading-5 text-amber-700 dark:text-amber-200",children:s.errorInfo.suggestedAction}):null]}),e.jsx(x,{variant:s.status==="pass"?"success":s.status==="warn"?"warning":"danger",children:s.status})]})},s.id)})})]}):e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(O,{size:16,className:"mt-0.5 shrink-0"}),e.jsx("p",{children:"Run doctor to validate config, runtime readiness, channel health, and log access."})]})}),e.jsx(l,{className:"app-panel",title:"Recent Errors",description:"Aggregated runtime and channel failures from the current window.",children:p.length===0?e.jsx("div",{className:"py-8 text-sm text-muted-foreground",children:"No aggregated errors in the current diagnostics window."}):e.jsx("div",{className:"space-y-3",children:p.map(s=>e.jsx("div",{className:"app-list-row",children:e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(F,{size:14,className:"text-amber-500"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:s.errorInfo.userMessage}),e.jsx(x,{variant:s.errorInfo.severity==="error"?"danger":s.errorInfo.severity==="warning"?"warning":"info",children:s.errorInfo.code})]}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:s.errorInfo.message}),s.errorInfo.suggestedAction?e.jsx("p",{className:"mt-1 text-xs leading-5 text-amber-700 dark:text-amber-200",children:s.errorInfo.suggestedAction}):null,e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:[s.count," occurrence(s), last seen ",new Date(s.lastSeenAt).toLocaleString()]})]})})},s.key))})})]}),e.jsx(l,{className:"app-panel",title:"Knowledge",description:"System-wide knowledge API connection.",actions:e.jsxs(c,{size:"sm",onClick:()=>void K(),loading:N,disabled:!B&&!N,children:[e.jsx(W,{size:14})," Save"]}),children:e.jsx(X,{label:"Knowledge base URL",value:u,onChange:s=>j(s.target.value),placeholder:"http://127.0.0.1:16007"})}),e.jsx(l,{className:"app-panel",title:a("system.plugins"),description:"Plugin state is read-only in the daily UI. Use backend config for advanced changes.",children:o?o.plugins.length===0?e.jsx("div",{className:"py-8 text-sm text-muted-foreground",children:"No plugins registered."}):e.jsx("div",{className:"divide-y divide-border",children:o.plugins.map(s=>e.jsxs("div",{className:"flex items-start justify-between gap-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{size:15,className:"text-muted-foreground"}),e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:s.pluginId})]}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s.health.summary||s.manifest.provides.join(", ")||"No declared capabilities"})]}),e.jsx(x,{variant:s.health.status==="healthy"?"success":s.health.status==="failed"?"danger":"warning",children:s.health.status})]},s.pluginId))}):e.jsx("div",{className:"py-8 text-sm text-muted-foreground",children:"Loading..."})})]})}export{he as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as D,z as u,u as J,r as n,j as t,s as z,B as o,D as O,E as w}from"./index-wYpjqVqC.js";import{l as U}from"./threads-BCm6j4eI.js";import{C as W}from"./Card-DayUo35w.js";import{B as x}from"./Badge-CDTbmw1h.js";import{M as $}from"./Modal-yY7TzR0x.js";import{I as y,T as B}from"./Input-DxoWVc9d.js";import{S as I}from"./Select-CmbK36pN.js";import{E as F}from"./EmptyState-EFMkOjZO.js";import{P as L}from"./Page-vwHNUdoj.js";import{P as H}from"./plus-CokBDnaL.js";import{P as _}from"./play-BvsoXUrM.js";import{P as q}from"./pencil-CB1SWZ9A.js";import{T as G}from"./trash-2-CIxz9qYY.js";import"./index-BlA4xPdd.js";import"./chevron-down-BPk77tqY.js";function Q(a){const i=D({workspace_id:a});return u("GET",`/scheduler/jobs${i}`)}function K(a){return u("POST","/scheduler/jobs",a)}function V(a,i){return u("PATCH",`/scheduler/jobs/${encodeURIComponent(a)}`,i)}function X(a){return u("DELETE",`/scheduler/jobs/${encodeURIComponent(a)}`)}function Y(a){return u("POST",`/scheduler/jobs/${encodeURIComponent(a)}/run`)}const h={workspaceId:"",executionMode:"same-thread",triggerType:"cron",cronExpr:"0 9 * * *",runAt:"",promptTemplate:"",description:"",chatId:"",platformUserId:"",threadId:"",enabled:!0};function Z(a){return a?{workspaceId:a.workspaceId,executionMode:a.executionMode,triggerType:a.triggerType,cronExpr:a.cronExpr||"0 9 * * *",runAt:a.runAt?String(a.runAt).slice(0,16):"",promptTemplate:a.promptTemplate,description:a.description,chatId:a.route.channelId,platformUserId:a.route.participantId||"",threadId:a.route.threadId||"",enabled:a.enabled}:h}function ee(a){return{workspaceId:a.workspaceId,platform:"local",route:{type:"local.thread",channelId:a.workspaceId||"local",...a.threadId?{threadId:a.threadId}:{}},executionMode:a.executionMode||"same-thread",triggerType:a.triggerType,...a.triggerType==="cron"?{cronExpr:a.cronExpr,runAt:void 0}:{runAt:new Date(a.runAt).toISOString(),cronExpr:void 0},promptTemplate:a.promptTemplate,description:a.description,enabled:a.enabled}}function ge(){const{t:a}=J(),[i,j]=n.useState([]),[g,T]=n.useState([]),[E,v]=n.useState(!0),[S,d]=n.useState(!1),[C,k]=n.useState(!1),[m,f]=n.useState(null),[s,r]=n.useState(h),b=n.useMemo(()=>g.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id)),[g]),c=n.useCallback(async()=>{v(!0);try{const[e,l]=await Promise.all([Q(),U().then(p=>p.workspaces)]);j(e.jobs||[]),T(l),r(p=>p.workspaceId||l.length===0?p:{...p,workspaceId:l[0].id})}finally{v(!1)}},[]);n.useEffect(()=>{c();const e=z(l=>{(l.type==="scheduler.job.updated"||l.type==="scheduler.run.updated")&&c()});return()=>e()},[c]);const N=()=>{var e;f(null),r({...h,workspaceId:((e=g[0])==null?void 0:e.id)||""}),d(!0)},A=e=>{f(e),r(Z(e)),d(!0)},R=async()=>{if(!(!s.workspaceId||!s.promptTemplate.trim())&&!(s.triggerType==="once"&&!s.runAt)){k(!0);try{const e=ee(s);m?await V(m.id,e):await K(e),d(!1),f(null),r(h),await c()}finally{k(!1)}}},M=async e=>{confirm(a("common.confirmDelete"))&&(await X(e),await c())},P=async e=>{await Y(e),await c()};return E&&i.length===0?t.jsx("div",{className:"flex items-center justify-center h-64 text-gray-400 animate-pulse",children:a("common.loading")}):t.jsxs("div",{className:"space-y-4 animate-fade-in",children:[t.jsx(L,{title:a("cron.title"),description:"Create simple scheduled prompts for a workspace.",actions:t.jsxs(o,{onClick:N,children:[t.jsx(H,{size:16})," ",a("cron.add")]})}),i.length===0?t.jsx(F,{message:a("cron.noJobs"),icon:O}):t.jsx("div",{className:"space-y-3",children:i.map(e=>t.jsx(W,{className:"app-panel",children:t.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[t.jsx("span",{className:"font-medium text-gray-900 dark:text-white text-sm",children:e.description||e.id}),t.jsx(x,{variant:e.enabled?"success":"default",children:e.enabled?a("cron.enabled"):"disabled"}),t.jsx(x,{variant:"default",children:e.triggerType}),t.jsx(x,{variant:"default",children:e.platform}),e.lastStatus&&t.jsx(x,{variant:e.lastStatus==="failed"?"danger":"default",children:e.lastStatus})]}),t.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-500 dark:text-gray-400 mt-2",children:[t.jsxs("span",{children:[t.jsx("strong",{children:"Workspace:"})," ",e.workspaceId]}),t.jsxs("span",{children:[t.jsx("strong",{children:"Execution:"})," ",e.executionMode]}),t.jsxs("span",{children:[t.jsx("strong",{children:"Route:"})," ",e.route.channelId," / ",e.route.participantId]}),t.jsxs("span",{children:[t.jsxs("strong",{children:[e.triggerType==="cron"?a("cron.expression"):"Run at",":"]})," ",e.triggerType==="cron"?e.cronExpr:w(e.runAt||"")]}),e.route.threadId&&t.jsxs("span",{children:[t.jsx("strong",{children:"Thread:"})," ",e.route.threadId]}),e.lastRunAt&&t.jsxs("span",{children:[t.jsxs("strong",{children:[a("cron.lastRun"),":"]})," ",w(e.lastRunAt)]})]}),t.jsx("p",{className:"mt-3 line-clamp-3 rounded-[16px] bg-black/[0.035] px-3 py-2 text-sm leading-6 text-gray-700 dark:bg-white/[0.05] dark:text-gray-300",children:e.promptTemplate}),e.lastError&&t.jsx("p",{className:"text-xs text-red-500 mt-2",children:e.lastError})]}),t.jsxs("div",{className:"flex shrink-0 gap-2 lg:pt-0",children:[t.jsx(o,{size:"sm",variant:"secondary",className:"app-icon-button",onClick:()=>void P(e.id),"aria-label":"Run now",children:t.jsx(_,{size:14})}),t.jsx(o,{size:"sm",variant:"secondary",className:"app-icon-button",onClick:()=>A(e),"aria-label":"Edit job",children:t.jsx(q,{size:14})}),t.jsx(o,{size:"sm",variant:"danger",className:"app-icon-button",onClick:()=>void M(e.id),"aria-label":"Delete job",children:t.jsx(G,{size:14})})]})]})},e.id))}),t.jsx($,{open:S,onClose:()=>d(!1),title:m?"Edit scheduler job":a("cron.add"),children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs(I,{label:"Workspace",value:s.workspaceId,onChange:e=>r({...s,workspaceId:e.target.value}),children:[t.jsx("option",{value:"",children:"Select workspace"}),b]}),t.jsxs(I,{label:"Schedule type",value:s.triggerType,onChange:e=>r({...s,triggerType:e.target.value}),children:[t.jsx("option",{value:"cron",children:"Repeating"}),t.jsx("option",{value:"once",children:"One time"})]}),s.triggerType==="cron"?t.jsxs("div",{className:"space-y-2",children:[t.jsx(y,{label:a("cron.expression"),value:s.cronExpr,onChange:e=>r({...s,cronExpr:e.target.value}),placeholder:"0 9 * * *"}),t.jsx("div",{className:"flex flex-wrap gap-2",children:[["0 9 * * *","Daily 09:00"],["0 9 * * 1","Weekly Mon"],["*/30 * * * *","Every 30m"]].map(([e,l])=>t.jsx("button",{type:"button",onClick:()=>r({...s,cronExpr:e}),className:`app-segment text-xs ${s.cronExpr===e?"app-segment-active":"app-segment-idle"}`,children:l},e))})]}):t.jsx(y,{label:"Run at",type:"datetime-local",value:s.runAt,onChange:e=>r({...s,runAt:e.target.value})}),t.jsx(y,{label:a("cron.description"),value:s.description,onChange:e=>r({...s,description:e.target.value})}),t.jsx(B,{label:a("cron.prompt"),value:s.promptTemplate,onChange:e=>r({...s,promptTemplate:e.target.value}),rows:4,placeholder:"Summarize today's blockers and post a status update."}),t.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:s.enabled,onChange:e=>r({...s,enabled:e.target.checked})}),a("cron.enabled")]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[t.jsx(o,{variant:"secondary",onClick:()=>d(!1),children:a("common.cancel")}),t.jsx(o,{onClick:()=>void R(),disabled:C,children:a(m?"common.save":"cron.add")})]})]})})]})}export{ge as default};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import{c as u,u as ee,r,a as se,l as te,b as M,d as ae,e as re,f as ie,o as ne,s as de,j as e,M as le,W as ce,B as oe,R as me,L as E,F as xe,S as ue,g as he}from"./index-wYpjqVqC.js";import{C as f}from"./Card-DayUo35w.js";import{B as n}from"./Badge-CDTbmw1h.js";import{E as j}from"./EmptyState-EFMkOjZO.js";import{P as ge}from"./Page-vwHNUdoj.js";import{l as pe}from"./threads-BCm6j4eI.js";import{B as fe}from"./book-open-BCdZWncQ.js";import{S as $}from"./shield-check-Cjja2Gh6.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 je=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ye=u("activity",je);/**
|
|
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 ke=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],B=u("arrow-right",ke);/**
|
|
12
|
+
* @license lucide-react v0.487.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const be=[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],ve=u("calendar-clock",be);/**
|
|
17
|
+
* @license lucide-react v0.487.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const Ne=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],we=u("circle-alert",Ne);/**
|
|
22
|
+
* @license lucide-react v0.487.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const Re=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ae=u("circle-check",Re);/**
|
|
27
|
+
* @license lucide-react v0.487.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const Se=[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]],I=u("cpu",Se);/**
|
|
32
|
+
* @license lucide-react v0.487.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const Me=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],Le=u("list-checks",Me);/**
|
|
37
|
+
* @license lucide-react v0.487.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const Ee=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ze=u("server",Ee);function Ce({title:a,description:t,to:l,icon:c,primary:m}){return e.jsxs(E,{to:l,className:["group flex min-h-[112px] flex-col justify-between rounded-[18px] border p-5 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-ring",m?"border-primary/20 bg-primary/5 text-foreground hover:bg-primary/10 dark:bg-primary/10 dark:hover:bg-primary/15":"border-black/[0.08] bg-white text-foreground hover:bg-[#fcfcfd] dark:border-white/[0.07] dark:bg-white/[0.04] dark:hover:bg-white/[0.07]"].join(" "),children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary dark:bg-primary/15",children:e.jsx(c,{size:20})}),e.jsx(B,{size:17,className:"mt-1 text-muted-foreground/45 transition-colors group-hover:text-foreground"})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:a}),e.jsx("p",{className:"mt-2 max-w-sm text-sm leading-5 text-muted-foreground",children:t})]})]})}function v({label:a,value:t,detail:l,tone:c="neutral"}){return e.jsxs("div",{className:"app-surface p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:a}),e.jsx("p",{className:he("mt-2 text-2xl font-semibold",c==="primary"?"text-primary":c==="warning"?"text-amber-600 dark:text-amber-300":"text-foreground"),children:t}),e.jsx("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:l})]})}function _e(a){return a.readiness==="ready"?"success":a.readiness==="failed"?"danger":a.readiness==="degraded"?"warning":a.status==="installed"?"success":a.status==="error"?"danger":"warning"}function De(a){return a.readiness||(a.status==="installed"?"ready":"unknown")}function L({title:a,description:t,tasks:l,empty:c,urgent:m}){return e.jsxs(f,{className:"app-panel overflow-hidden p-0",children:[e.jsx("div",{className:"border-b border-black/[0.08] px-5 py-4 dark:border-white/[0.07]",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:a}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t})]}),e.jsx(n,{variant:m&&l.length>0?"warning":"secondary",children:l.length})]})}),l.length===0?e.jsx("div",{className:"p-5",children:e.jsx(j,{message:c,icon:Le})}):e.jsx("div",{className:"divide-y divide-black/[0.08] dark:divide-white/[0.07]",children:l.map(d=>e.jsxs("div",{className:"px-5 py-4 transition-colors hover:bg-black/[0.025] dark:hover:bg-white/[0.035]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:d.title}),e.jsxs("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:[d.workspaceId," · ",d.runtimeId]})]}),e.jsx(n,{variant:d.status==="failed"?"danger":d.status==="completed"?"success":"info",children:d.status})]}),e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Updated ",new Date(d.updatedAt).toLocaleString()]})]},d.taskId))})]})}function Te({approvals:a}){return e.jsxs(f,{className:"app-panel overflow-hidden p-0",children:[e.jsx("div",{className:"border-b border-black/[0.08] px-5 py-4 dark:border-white/[0.07]",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"待审批"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"高风险操作会在这里等待确认或拒绝。"})]}),e.jsx(n,{variant:a.length>0?"warning":"secondary",children:a.length})]})}),a.length===0?e.jsx("div",{className:"p-5",children:e.jsx(j,{message:"暂无待审批操作",icon:$})}):e.jsx("div",{className:"divide-y divide-black/[0.08] dark:divide-white/[0.07]",children:a.map(t=>e.jsxs("div",{className:"px-5 py-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e.jsxs("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:[t.workspaceId," · ",t.kind]})]}),e.jsx(n,{variant:t.riskLevel==="high"?"danger":"warning",children:t.riskLevel})]}),e.jsx("p",{className:"mt-2 line-clamp-2 text-xs leading-5 text-muted-foreground",children:t.description})]},t.approvalId))})]})}function Pe({events:a}){return e.jsxs(f,{className:"app-panel overflow-hidden p-0",children:[e.jsxs("div",{className:"border-b border-black/[0.08] px-5 py-4 dark:border-white/[0.07]",children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"审计记录"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"最近的任务、审批和权限事件。"})]}),a.length===0?e.jsx("div",{className:"p-5",children:e.jsx(j,{message:"暂无审计记录",icon:$})}):e.jsx("div",{className:"divide-y divide-black/[0.08] dark:divide-white/[0.07]",children:a.map(t=>e.jsxs("div",{className:"px-5 py-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:t.summary}),e.jsxs("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:[t.type," · ",t.actor||"system"]})]}),t.riskLevel?e.jsx(n,{variant:t.riskLevel==="high"?"danger":"secondary",children:t.riskLevel}):null]}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:new Date(t.createdAt).toLocaleString()})]},t.auditId))})]})}function Ke(){const{t:a}=ee(),[t,l]=r.useState([]),[c,m]=r.useState([]),[d,W]=r.useState([]),[N,F]=r.useState([]),[H,U]=r.useState([]),[w,V]=r.useState([]),[K,O]=r.useState([]),[Q,z]=r.useState(!0),[G,C]=r.useState(!1),[J,g]=r.useState(!1),[_,D]=r.useState(""),[T,p]=r.useState(""),{desktopRuntime:h,desktopWorkspace:qe,knowledgeModule:P,schedulerModule:q}=se(),R=c.filter(s=>s.installed),y=[{title:"继续聊天",description:"打开本地对话,继续当前项目里的 agent 线程。",to:"/chat",icon:le,primary:!0},{title:"工作区",description:"管理项目、平台、模型和本地运行配置。",to:"/workspace",icon:ce}];P&&y.push({title:"知识库",description:"上传文档,维护可被检索的项目资料。",to:"/knowledge",icon:fe}),q&&y.push({title:"定时任务",description:"查看和管理自动执行的计划任务。",to:"/cron",icon:ve}),(!P||!q)&&y.push({title:"系统设置",description:"查看配置、日志和桌面应用偏好。",to:"/system",icon:ue});const k=r.useCallback(async()=>{var s;z(!0),D(""),p("");try{if(h){const[i,x]=await Promise.all([pe(),te().then(S=>({status:"fulfilled",runtimes:S.runtimes}),S=>({status:"rejected",error:S}))]),[o,A,b]=await Promise.all([M({status:["created","queued","running"],limit:6}),M({status:"waiting_for_user",limit:6}),M({status:["completed","failed","cancelled"],limit:6})]),[Y,Z]=await Promise.all([ae({status:"pending",limit:6}),re({limit:6})]);W(o.tasks||[]),F(A.tasks||[]),U(b.tasks||[]),V(Y.approvals||[]),O(Z.events||[]),l(i.workspaces||[]),x.status==="fulfilled"?m(x.runtimes):(m([]),p(((s=x.error)==null?void 0:s.message)||String(x.error)));return}}catch(i){D(i.message||String(i))}finally{z(!1)}},[h]),X=r.useCallback(async()=>{C(!0),g(!0),p("");try{m((await ie()).runtimes)}catch(s){p(s.message||String(s))}finally{C(!1),g(!1)}},[]);return r.useEffect(()=>{k();const s=()=>k();window.addEventListener("cc:refresh",s);const i=ne(()=>{k()}),x=de(o=>{if(o.type==="runtime.detect.started"){g(!0);return}if(o.type==="runtime.detect.completed"){g(!1),m(o.runtimes);return}if(o.type==="runtime.detect.failed"){g(!1),p(o.error);return}o.type==="runtime.status.changed"&&m(A=>A.map(b=>b.runtimeId===o.runtime.runtimeId?o.runtime:b))});return()=>{window.removeEventListener("cc:refresh",s),i(),x()}},[h,k]),Q&&t.length===0?e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:e.jsx(ye,{className:"animate-pulse",size:24})}):e.jsxs("div",{className:"animate-fade-in space-y-8",children:[e.jsx(ge,{title:"概览",description:"继续最近的工作,或进入项目、知识和自动化配置。当前版本 v0.1.57"}),e.jsxs("section",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(v,{label:"Projects",value:t.length,detail:"configured workspaces",tone:"primary"}),e.jsx(v,{label:"Running",value:d.length,detail:"active agent tasks"}),e.jsx(v,{label:"Waiting",value:N.length+w.length,detail:"needs attention",tone:N.length+w.length>0?"warning":"neutral"}),e.jsx(v,{label:"Runtimes",value:R.length,detail:"installed locally"})]}),_?e.jsx("div",{role:"alert",className:"rounded-lg 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:_}):null,e.jsxs("section",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-end justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold tracking-tight text-foreground",children:"快速开始"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"常用入口会保留在最前面。"})]})}),e.jsx("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:y.map(s=>e.jsx(Ce,{...s},s.to))})]}),h?e.jsxs(f,{className:"app-panel overflow-hidden p-0",children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-black/[0.08] px-5 py-4 dark:border-white/[0.07] sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"本机 Agent Runtime"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"显示本机 runtime 安装检测状态,不执行安装或登录检查。"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(n,{variant:R.length>0?"success":"default",children:[R.length," installed"]}),J?e.jsx(n,{variant:"info",children:"checking"}):null,e.jsxs(oe,{variant:"outline",size:"sm",loading:G,onClick:X,title:"刷新 runtime 检测",children:[e.jsx(me,{size:15}),"刷新"]})]})]}),T?e.jsxs("div",{className:"px-5 py-4 text-sm text-amber-700 dark:text-amber-200",children:["检测失败:",T]}):c.length===0?e.jsx("div",{className:"p-5",children:e.jsx(j,{message:"还没有 runtime 检测结果",icon:I})}):e.jsx("div",{className:"grid grid-cols-1 gap-3 p-5 md:grid-cols-2 xl:grid-cols-3",children:c.map(s=>{var i,x;return e.jsxs("div",{className:"app-list-row",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:["flex h-10 w-10 shrink-0 items-center justify-center rounded-xl",s.status==="installed"?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-300":s.status==="error"?"bg-red-500/10 text-red-600 dark:text-red-200":"bg-amber-500/10 text-amber-700 dark:text-amber-200"].join(" "),children:e.jsx(I,{size:19})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold text-foreground",children:s.displayName}),e.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:s.agentType})]})]}),s.status==="installed"?e.jsx(Ae,{size:18,className:"mt-0.5 shrink-0 text-emerald-500"}):e.jsx(we,{size:18,className:"mt-0.5 shrink-0 text-amber-500"})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsx(n,{variant:s.status==="installed"?"success":s.status==="error"?"danger":"warning",children:s.status}),e.jsx(n,{variant:_e(s),children:De(s)}),e.jsx(n,{children:s.source}),s.version?e.jsxs(n,{variant:"secondary",children:["v",s.version]}):null]}),e.jsx("p",{className:"mt-3 text-sm leading-5 text-muted-foreground",children:s.summary}),s.lastLaunchError?e.jsx("p",{className:"mt-2 text-xs leading-5 text-red-600 dark:text-red-200",children:s.lastLaunchError.userMessage}):s.issues[0]?e.jsx("p",{className:"mt-2 text-xs leading-5 text-amber-700 dark:text-amber-200",children:s.issues[0].message}):null,(i=s.lastLaunchError)!=null&&i.suggestedAction?e.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:s.lastLaunchError.suggestedAction}):null,s.binaryPath||s.command?e.jsx("p",{className:"mt-3 truncate rounded-lg bg-black/[0.045] px-2.5 py-2 font-mono text-xs text-muted-foreground dark:bg-white/[0.06]",children:s.binaryPath||s.command}):null,s.recommendedActions[0]&&!((x=s.lastLaunchError)!=null&&x.suggestedAction)?e.jsx("p",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:s.recommendedActions[0].description}):null,e.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:["Last checked ",new Date(s.lastCheckedAt||s.detectedAt).toLocaleString()]})]},s.agentType)})})]}):null,h?e.jsxs("section",{className:"grid grid-cols-1 gap-4 xl:grid-cols-3",children:[e.jsx(L,{title:"运行中任务",description:"正在排队或执行的 agent 工作。",tasks:d,empty:"暂无运行中的任务"}),e.jsx(L,{title:"等待处理",description:"需要用户输入或审批的任务。",tasks:N,empty:"暂无等待处理的任务",urgent:!0}),e.jsx(L,{title:"最近完成",description:"最近结束、失败或取消的任务。",tasks:H,empty:"暂无最近任务"})]}):null,h?e.jsxs("section",{className:"grid grid-cols-1 gap-4 xl:grid-cols-2",children:[e.jsx(Te,{approvals:w}),e.jsx(Pe,{events:K})]}):null,e.jsxs(f,{className:"app-panel p-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-black/[0.08] px-5 py-4 dark:border-white/[0.07]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:a("nav.projects")}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"最近配置和会话概览。"})]}),e.jsx(E,{to:"/workspace",className:"text-sm font-medium text-primary transition-colors hover:text-primary/80",children:a("common.viewAll")})]}),t.length===0?e.jsx("div",{className:"p-5",children:e.jsx(j,{message:a("projects.noProjects"),icon:xe})}):e.jsx("div",{className:"divide-y divide-black/[0.08] dark:divide-white/[0.07]",children:t.slice(0,6).map(s=>{var i;return e.jsxs(E,{to:`/workspace?project=${encodeURIComponent(s.name)}`,className:"group flex items-center justify-between gap-3 px-5 py-4 transition-colors duration-200 hover:bg-black/[0.04] dark:hover:bg-white/[0.06]",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary",children:e.jsx(ze,{size:17})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:s.name}),e.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[s.agentType," · ",((i=s.platforms)==null?void 0:i.join(", "))||"no platform"," · ",s.sessionsCount," sessions"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.heartbeatEnabled?e.jsx(n,{variant:"success",children:"heartbeat"}):null,e.jsx(B,{size:16,className:"text-muted-foreground/45 transition-colors group-hover:text-foreground"})]})]},s.name)})})]})]})}export{Ke as default};
|