@kafca/agentdock 0.1.61 → 0.1.62
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 +18 -0
- package/dist/renderer/assets/AutomationList-BgJgAdVO.js +16 -0
- package/dist/renderer/assets/{Badge-BLI4LHse.js → Badge-Bq2hPVcR.js} +1 -1
- package/dist/renderer/assets/{Card-DJeLDdL3.js → Card-BPJNSZce.js} +1 -1
- package/dist/renderer/assets/{Config-D1awc81A.js → Config-aSFqlI88.js} +2 -2
- package/dist/renderer/assets/Dashboard-D3ezFmb7.js +36 -0
- package/dist/renderer/assets/{EmptyState-CkI1RwPX.js → EmptyState-DK496gBq.js} +1 -1
- package/dist/renderer/assets/{HighlightedMarkdown-BUhDlhgW.js → HighlightedMarkdown-Ckre5jNv.js} +1 -1
- package/dist/renderer/assets/{Input-DHYrn-Ne.js → Input-C5C1d0ba.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-Bij-Xo90.js → KnowledgeDetail-N8Ey1ikc.js} +2 -2
- package/dist/renderer/assets/{KnowledgeHome-DmPZ2IlI.js → KnowledgeHome-9aF8nJEf.js} +2 -2
- package/dist/renderer/assets/{Logs-ISY99heA.js → Logs-sgAdwEeS.js} +2 -2
- package/dist/renderer/assets/{Modal-DAQfz0ot.js → Modal-BB10hTRc.js} +3 -3
- package/dist/renderer/assets/{Page-Dw43UYDT.js → Page-DfC319Ck.js} +1 -1
- package/dist/renderer/assets/{Select-DzmN5OGQ.js → Select-RHJBmNER.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-B5CWqqMK.js → ThreadChat-BU1zCdr4.js} +3 -3
- package/dist/renderer/assets/{Workspace-C5g9LBj9.js → Workspace-BoZCz7S8.js} +1 -1
- package/dist/renderer/assets/{arrow-left-BLXh56Ip.js → arrow-left-D2V1eZSD.js} +1 -1
- package/dist/renderer/assets/{book-open-DhPGbc-7.js → book-open-DUcBn7Bb.js} +1 -1
- package/dist/renderer/assets/{channels-DfQrmuYO.js → channels-DMhDSlf2.js} +2 -2
- package/dist/renderer/assets/{chevron-down-CEFtpPDc.js → chevron-down-Ca2FQDB7.js} +1 -1
- package/dist/renderer/assets/en-Bnr4nMzg.js +1 -0
- package/dist/renderer/assets/es-B1GIFh3i.js +1 -0
- package/dist/renderer/assets/{index-BIKL3fTP.css → index-B6WcpkJF.css} +1 -1
- package/dist/renderer/assets/{index-CYhDUAR_.js → index-BlnvlekJ.js} +1 -1
- package/dist/renderer/assets/index-DRJ5wgw_.js +162 -0
- package/dist/renderer/assets/ja-CDWPWqEW.js +1 -0
- package/dist/renderer/assets/{knowledge-uHRQ80sR.js → knowledge-D1-k56eY.js} +1 -1
- package/dist/renderer/assets/{pencil-BD2Y31YC.js → pencil-BhWdv_86.js} +1 -1
- package/dist/renderer/assets/{plus-DDcldp_c.js → plus-BacLMlK3.js} +1 -1
- package/dist/renderer/assets/{save-CMW_cZI9.js → save-Bpoxbzau.js} +1 -1
- package/dist/renderer/assets/{search-BM-0CvJr.js → search-BVJcpdFX.js} +1 -1
- package/dist/renderer/assets/{shield-check-DaMB0FKG.js → shield-check-C2cw_Ip6.js} +1 -1
- package/dist/renderer/assets/{threads-DZgt9tWj.js → threads-DOsBQBg_.js} +1 -1
- package/dist/renderer/assets/{trash-2-DTXVbC5y.js → trash-2-Bs3rEm3g.js} +1 -1
- package/dist/renderer/assets/zh-MSddxMDX.js +1 -0
- package/dist/renderer/assets/zh-TW-C_LNWX0o.js +1 -0
- package/dist/renderer/index.html +2 -2
- package/dist-electron/electron/managed-skills/agent-browser/SKILL.md +41 -0
- package/dist-electron/electron/managed-skills/agent-browser/references/authentication.md +83 -0
- package/dist-electron/electron/managed-skills/agent-browser/references/commands.md +50 -0
- package/dist-electron/electron/managed-skills/agent-browser/references/profiling.md +20 -0
- package/dist-electron/electron/managed-skills/agent-browser/references/proxy-support.md +18 -0
- package/dist-electron/electron/managed-skills/agent-browser/references/session-management.md +17 -0
- package/dist-electron/electron/managed-skills/agent-browser/references/snapshot-refs.md +17 -0
- package/dist-electron/electron/managed-skills/agent-browser/references/video-recording.md +21 -0
- package/dist-electron/electron/managed-skills/agent-browser/templates/authenticated-session.sh +11 -0
- package/dist-electron/electron/managed-skills/agent-browser/templates/capture-workflow.sh +12 -0
- package/dist-electron/electron/managed-skills/agent-browser/templates/form-automation.sh +10 -0
- package/dist-electron/electron/managed-skills/condition-trigger/SKILL.md +21 -0
- package/dist-electron/electron/managed-skills/condition-trigger/scripts/register-condition-trigger.sh +106 -0
- package/dist-electron/electron/managed-skills/knowledge-base/SKILL.md +13 -0
- package/dist-electron/electron/managed-skills/knowledge-base/scripts/search-knowledge.sh +80 -0
- package/dist-electron/packages/contracts/src/automations.js +211 -0
- package/dist-electron/packages/contracts/src/index.js +1 -0
- package/dist-electron/packages/core-sdk/src/automations.js +87 -0
- package/dist-electron/packages/core-sdk/src/client.js +101 -0
- package/dist-electron/packages/core-sdk/src/index.js +2 -1
- package/dist-electron/services/local-ai-core/src/acp/store/automation-script-store.js +415 -0
- package/dist-electron/services/local-ai-core/src/acp/store/automation-store.js +829 -0
- package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +158 -0
- package/dist-electron/services/local-ai-core/src/acp/store/schema.js +81 -0
- package/dist-electron/services/local-ai-core/src/automation/automation-action-executor.js +144 -0
- package/dist-electron/services/local-ai-core/src/automation/automation-condition-engine.js +79 -0
- package/dist-electron/services/local-ai-core/src/automation/automation-conversation-executor.js +39 -73
- package/dist-electron/services/local-ai-core/src/automation/automation-monitor-service.js +695 -260
- package/dist-electron/services/local-ai-core/src/automation/automation-script-service.js +507 -0
- package/dist-electron/services/local-ai-core/src/automation/automation-service.js +1019 -0
- package/dist-electron/services/local-ai-core/src/automation/automation-trigger-engine.js +141 -0
- package/dist-electron/services/local-ai-core/src/automation/condition-evaluator.js +60 -17
- package/dist-electron/services/local-ai-core/src/automation/legacy-automation-mappers.js +286 -0
- package/dist-electron/services/local-ai-core/src/automation/scripts/anthropic-sandbox-runner.js +792 -0
- package/dist-electron/services/local-ai-core/src/automation/scripts/sandbox-runner.js +2 -0
- package/dist-electron/services/local-ai-core/src/automation/scripts/script-package.js +475 -0
- package/dist-electron/services/local-ai-core/src/automation/scripts/script-protocol-runner.js +266 -0
- package/dist-electron/services/local-ai-core/src/automation/scripts/secret-resolver.js +37 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/inbound-poller.js +1 -2
- package/dist-electron/services/local-ai-core/src/channel/weixin/transport.js +9 -8
- package/dist-electron/services/local-ai-core/src/cli/lac.js +229 -0
- package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +21 -0
- package/dist-electron/services/local-ai-core/src/runtime/deployment-diagnostics.js +76 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/automations-handler.js +322 -0
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +20 -0
- package/dist-electron/services/local-ai-core/src/runtime/managed-skill-catalog.js +37 -0
- package/dist-electron/services/local-ai-core/src/runtime/server-helpers.js +14 -4
- package/dist-electron/services/local-ai-core/src/runtime/server-routes.js +75 -0
- package/dist-electron/services/local-ai-core/src/runtime/server.js +21 -0
- package/dist-electron/services/local-ai-core/src/runtime/standalone.js +1 -0
- package/dist-electron/services/local-ai-core/src/scheduler/cron.js +151 -39
- package/dist-electron/services/local-ai-core/src/scheduler/scheduled-conversation-executor.js +2 -4
- package/dist-electron/services/local-ai-core/src/scheduler/scheduled-job-application-service.js +64 -12
- package/dist-electron/services/local-ai-core/src/scheduler/scheduler-service.js +71 -4
- package/dist-electron/services/local-ai-core/src/scheduler/thread-resolution.js +10 -0
- package/dist-electron/services/local-ai-core/src/thread/agent-message-policy.js +16 -1
- package/dist-electron/src/pages/Automation/automation-page-model.js +76 -0
- package/dist-electron/tests/contracts/agent-message-policy.test.js +32 -0
- package/dist-electron/tests/contracts/architecture-docs.test.js +30 -0
- package/dist-electron/tests/contracts/automation-contracts.test.js +154 -0
- package/dist-electron/tests/contracts/automation-renderer-model.test.js +47 -0
- package/dist-electron/tests/electron/automation-action-executor.test.js +75 -0
- package/dist-electron/tests/electron/automation-compatibility.test.js +463 -0
- package/dist-electron/tests/electron/automation-deployment.test.js +66 -0
- package/dist-electron/tests/electron/automation-engine.test.js +264 -0
- package/dist-electron/tests/electron/automation-monitor.test.js +1333 -0
- package/dist-electron/tests/electron/automation-sandbox-runner.test.js +333 -0
- package/dist-electron/tests/electron/automation-script-approval.test.js +553 -0
- package/dist-electron/tests/electron/automation-script-package.test.js +499 -0
- package/dist-electron/tests/electron/automation-script-runner.test.js +120 -0
- package/dist-electron/tests/electron/automation-service.test.js +1078 -0
- package/dist-electron/tests/electron/automation-store.test.js +593 -0
- package/dist-electron/tests/electron/condition-trigger-skill.test.js +93 -0
- package/dist-electron/tests/electron/core-client.test.js +99 -0
- package/dist-electron/tests/electron/lac-cli.test.js +110 -0
- package/dist-electron/tests/electron/workspace-task-store.test.js +25 -0
- package/dist-electron/tests/integration/automation-routes.test.js +186 -0
- package/dist-electron/tests/integration/automation-sandbox-runtime.test.js +92 -0
- package/package.json +4 -3
- package/dist/renderer/assets/CronList-CupZoNwW.js +0 -1
- package/dist/renderer/assets/Dashboard-nLZnOtcs.js +0 -41
- package/dist/renderer/assets/MonitorList-BlX82rXF.js +0 -1
- package/dist/renderer/assets/en-CmAr_0e6.js +0 -1
- package/dist/renderer/assets/es-Cs9x52ca.js +0 -1
- package/dist/renderer/assets/index-Dd00oqgY.js +0 -167
- package/dist/renderer/assets/ja-DtvtBRTW.js +0 -1
- package/dist/renderer/assets/play-DBJ8wsSy.js +0 -6
- package/dist/renderer/assets/zh-CcJ9vBZj.js +0 -1
- package/dist/renderer/assets/zh-TW-elI72AC1.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kafca/agentdock",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.62",
|
|
4
4
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist-electron/electron/main.js",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"dev": "node scripts/dev.mjs",
|
|
28
28
|
"dev:web": "pnpm exec vite --host 127.0.0.1 --port 5173",
|
|
29
29
|
"dev:core": "pnpm build:electron && node scripts/launch-core.mjs",
|
|
30
|
-
"build": "vite build && node scripts/write-electron-package.mjs && tsc -p tsconfig.electron.json && tsc-alias -p tsconfig.electron.json",
|
|
30
|
+
"build": "vite build && node scripts/write-electron-package.mjs && tsc -p tsconfig.electron.json && tsc-alias -p tsconfig.electron.json && node scripts/copy-managed-skills.mjs",
|
|
31
31
|
"build:npm": "VITE_LOCAL_AI_CORE_BASE=/api/local/v1 pnpm build",
|
|
32
32
|
"build:web": "vite build",
|
|
33
33
|
"build:renderer": "vite build",
|
|
34
|
-
"build:electron": "node scripts/write-electron-package.mjs && tsc -p tsconfig.electron.json && tsc-alias -p tsconfig.electron.json",
|
|
34
|
+
"build:electron": "node scripts/write-electron-package.mjs && tsc -p tsconfig.electron.json && tsc-alias -p tsconfig.electron.json && node scripts/copy-managed-skills.mjs",
|
|
35
35
|
"build:core": "pnpm build:electron",
|
|
36
36
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
37
37
|
"test": "pnpm typecheck && pnpm build:renderer && pnpm build:electron && node --test dist-electron/tests/electron/*.test.js dist-electron/tests/contracts/*.test.js dist-electron/tests/integration/*.test.js dist-electron/packages/knowledge-api/test/*.test.js dist-electron/src/pages/Threads/thread-chat-permission.test.js",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@agentclientprotocol/claude-agent-acp": "^0.30.0",
|
|
50
|
+
"@anthropic-ai/sandbox-runtime": "0.0.63",
|
|
50
51
|
"@iarna/toml": "^2.2.5",
|
|
51
52
|
"@larksuiteoapi/node-sdk": "^1.58.0",
|
|
52
53
|
"@mariozechner/pi-coding-agent": "^0.72.1",
|
|
@@ -1 +0,0 @@
|
|
|
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-Dd00oqgY.js";import{l as U}from"./threads-DZgt9tWj.js";import{C as W}from"./Card-DJeLDdL3.js";import{B as x}from"./Badge-BLI4LHse.js";import{M as $}from"./Modal-DAQfz0ot.js";import{I as y,T as B}from"./Input-DHYrn-Ne.js";import{S as I}from"./Select-DzmN5OGQ.js";import{E as F}from"./EmptyState-CkI1RwPX.js";import{P as L}from"./Page-Dw43UYDT.js";import{P as H}from"./plus-DDcldp_c.js";import{P as _}from"./play-DBJ8wsSy.js";import{P as q}from"./pencil-BD2Y31YC.js";import{T as G}from"./trash-2-DTXVbC5y.js";import"./index-CYhDUAR_.js";import"./chevron-down-CEFtpPDc.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};
|
|
@@ -1,41 +0,0 @@
|
|
|
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-Dd00oqgY.js";import{C as f}from"./Card-DJeLDdL3.js";import{B as n}from"./Badge-BLI4LHse.js";import{E as j}from"./EmptyState-CkI1RwPX.js";import{P as ge}from"./Page-Dw43UYDT.js";import{l as pe}from"./threads-DZgt9tWj.js";import{B as fe}from"./book-open-DhPGbc-7.js";import{S as $}from"./shield-check-DaMB0FKG.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.61"}),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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as R,z as x,u as q,r,j as s,s as D,B as u,G as B,E as F}from"./index-Dd00oqgY.js";import{l as L}from"./threads-DZgt9tWj.js";import{C as O}from"./Card-DJeLDdL3.js";import{B as g}from"./Badge-BLI4LHse.js";import{M as U}from"./Modal-DAQfz0ot.js";import{I as f,T as W}from"./Input-DHYrn-Ne.js";import{S as v}from"./Select-DzmN5OGQ.js";import{E as G}from"./EmptyState-CkI1RwPX.js";import{P as H}from"./Page-Dw43UYDT.js";import{P as V}from"./plus-DDcldp_c.js";import{P as Q}from"./play-DBJ8wsSy.js";import{P as Z}from"./pencil-BD2Y31YC.js";import{T as J}from"./trash-2-DTXVbC5y.js";import"./index-CYhDUAR_.js";import"./chevron-down-CEFtpPDc.js";function K(t){const n=R({workspace_id:t});return x("GET",`/automation/monitors${n}`)}function X(t){return x("POST","/automation/monitors",t)}function Y(t,n){return x("PATCH",`/automation/monitors/${encodeURIComponent(t)}`,n)}function ee(t){return x("DELETE",`/automation/monitors/${encodeURIComponent(t)}`)}function te(t){return x("POST",`/automation/monitors/${encodeURIComponent(t)}/run`)}const b={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(),h=Number(l);return{metric:String(c[1]||"").trim(),operator:c[2],value:Number.isFinite(h)&&l!==""?h:l}}function T(t){return t.condition.expression?t.condition.expression:`${t.condition.metric} ${t.condition.operator} ${t.condition.value}`}function se(t){return t?{workspaceId:t.workspaceId,title:t.title,sourceType:"stock.quote",symbol:String(t.sourceConfig.symbol||""),condition:T(t),promptTemplate:t.promptTemplate,cooldownMinutes:String(Math.round(t.cooldownMs/6e4)),executionMode:t.executionMode,enabled:t.enabled}:b}function ae(t){const n=k(t.condition);if(!n)throw new Error("Invalid condition");return{workspaceId:t.workspaceId,title:t.title,sourceType:t.sourceType,sourceConfig:w[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 w={"stock.quote":{label:"Stock quote",buildConfig:t=>({symbol:t.symbol.toUpperCase()}),renderSummary:t=>String(t.sourceConfig.symbol||"")}};function je(){const{t}=q(),[n,c]=r.useState([]),[l,h]=r.useState([]),[S,C]=r.useState(!0),[N,p]=r.useState(!1),[E,M]=r.useState(!1),[j,y]=r.useState(null),[a,o]=r.useState(b),I=r.useMemo(()=>l.map(e=>s.jsx("option",{value:e.id,children:e.name},e.id)),[l]),d=r.useCallback(async()=>{C(!0);try{const[e,i]=await Promise.all([K(),L().then(m=>m.workspaces)]);c(e.monitors||[]),h(i),o(m=>m.workspaceId||i.length===0?m:{...m,workspaceId:i[0].id})}finally{C(!1)}},[]);r.useEffect(()=>{d();const e=D(i=>{(i.type==="automation.monitor.updated"||i.type==="automation.monitor.run.updated")&&d()});return()=>e()},[d]);const P=()=>{var e;y(null),o({...b,workspaceId:((e=l[0])==null?void 0:e.id)||""}),p(!0)},A=e=>{y(e),o(se(e)),p(!0)},_=async()=>{if(!(!a.workspaceId||!a.title.trim()||!a.symbol.trim()||!a.promptTemplate.trim()||!k(a.condition))){M(!0);try{const e=ae(a);j?await Y(j.id,e):await X(e),p(!1),y(null),o(b),await d()}finally{M(!1)}}},z=async e=>{confirm(t("common.confirmDelete"))&&(await ee(e),await d())},$=async e=>{await te(e),await d()};return S&&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(H,{title:t("monitors.title"),description:"Create event monitors that trigger agent analysis and stream results back to channels.",actions:s.jsxs(u,{onClick:P,children:[s.jsx(V,{size:16})," ",t("monitors.add")]})}),n.length===0?s.jsx(G,{message:t("monitors.noMonitors"),icon:B}):s.jsx("div",{className:"space-y-3",children:n.map(e=>s.jsx(O,{className:"app-panel",children:s.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",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(g,{variant:e.enabled?"success":"default",children:e.enabled?t("monitors.enabled"):"disabled"}),s.jsx(g,{variant:"default",children:e.sourceType}),s.jsx(g,{variant:"default",children:e.platform}),e.lastStatus&&s.jsx(g,{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:"})," ",w["stock.quote"].renderSummary(e)]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Condition:"})," ",T(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"),":"]})," ",F(e.lastTriggeredAt)]})]}),s.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&&s.jsx("p",{className:"mt-2 text-xs text-red-500",children:e.lastError})]}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx(u,{variant:"secondary",size:"sm",className:"app-icon-button",onClick:()=>$(e.id),title:t("monitors.run"),"aria-label":t("monitors.run"),children:s.jsx(Q,{size:14})}),s.jsx(u,{variant:"secondary",size:"sm",className:"app-icon-button",onClick:()=>A(e),title:t("common.save"),"aria-label":t("common.save"),children:s.jsx(Z,{size:14})}),s.jsx(u,{variant:"danger",size:"sm",className:"app-icon-button",onClick:()=>z(e.id),title:t("common.delete"),"aria-label":t("common.delete"),children:s.jsx(J,{size:14})})]})]})},e.id))}),s.jsx(U,{open:N,title:t(j?"monitors.edit":"monitors.add"),onClose:()=>p(!1),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(v,{label:"Workspace",value:a.workspaceId,onChange:e=>o({...a,workspaceId:e.target.value}),children:I}),s.jsx(f,{label:t("monitors.monitorTitle"),value:a.title,onChange:e=>o({...a,title:e.target.value})}),s.jsx(v,{label:"Source",value:a.sourceType,onChange:e=>o({...a,sourceType:e.target.value}),children:Object.entries(w).map(([e,i])=>s.jsx("option",{value:e,children:i.label},e))}),a.sourceType==="stock.quote"&&s.jsx(f,{label:"Symbol",value:a.symbol,onChange:e=>o({...a,symbol:e.target.value}),placeholder:"AAPL"}),s.jsx(f,{label:t("monitors.condition"),value:a.condition,onChange:e=>o({...a,condition:e.target.value}),placeholder:"abs_change_percent >= 3"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:[["abs_change_percent >= 3","+/- 3%"],["price >= 500","Price >= 500"],["volume_ratio >= 2","Volume spike"]].map(([e,i])=>s.jsx("button",{type:"button",onClick:()=>o({...a,condition:e}),className:`app-segment text-xs ${a.condition===e?"app-segment-active":"app-segment-idle"}`,children:i},e))}),k(a.condition)?null:s.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-200",children:"Condition should look like metric >= value or a boolean expression."}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(f,{label:t("monitors.cooldown"),value:a.cooldownMinutes,onChange:e=>o({...a,cooldownMinutes:e.target.value})}),s.jsxs(v,{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(W,{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:_,disabled:E,children:t("common.save")})]})]})})]})}export{je as default};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|