@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/README.md
CHANGED
|
@@ -90,10 +90,28 @@ flowchart LR
|
|
|
90
90
|
- [ACP 会话运行时](docs/architecture/acp-protocol.md)
|
|
91
91
|
- [Channel Gateway 通道网关](docs/architecture/channel-gateways.md)
|
|
92
92
|
- [Scheduler 定时投递](docs/architecture/scheduled-delivery.md)
|
|
93
|
+
- [Conditional Automation 条件自动化](docs/architecture/conditional-automation.md)
|
|
93
94
|
- [Knowledge Runtime 知识库运行时](docs/architecture/knowledge-runtime.md)
|
|
94
95
|
|
|
95
96
|
## New
|
|
96
97
|
|
|
98
|
+
### 2026-07-13
|
|
99
|
+
|
|
100
|
+
- 条件自动化现已统一 Scheduler 与 Monitor 的 Activation、Condition、Action 和 Delivery 边界,并提供逐项 macOS/Linux Sandbox 部署诊断、Linux 镜像依赖及 Ubuntu 24.04+ 专用 AppArmor 安全配置指引;Windows 脚本执行保持 fail-closed。
|
|
101
|
+
|
|
102
|
+
### 2026-07-12
|
|
103
|
+
|
|
104
|
+
- Approved automation scripts now use a strict JSON condition protocol with environment-only secret injection, bounded streaming output, and fail-closed approval/interpreter checks.
|
|
105
|
+
- Agents can now author condition-trigger Automations through managed LAC commands and a staged, two-approval sandbox workflow.
|
|
106
|
+
|
|
107
|
+
### 2026-07-08
|
|
108
|
+
|
|
109
|
+
- Automation script packages are staged immutably with manifest-declared permissions, limits, and package-hash validation before approval workflows use them.
|
|
110
|
+
|
|
111
|
+
### 2026-07-10
|
|
112
|
+
|
|
113
|
+
- Approved automation scripts now run through a fail-closed macOS/Linux Sandbox Runtime adapter with Windows capability diagnostics and temp-only filesystem policy.
|
|
114
|
+
|
|
97
115
|
### 2026-06-21
|
|
98
116
|
|
|
99
117
|
- 桌面端统一通过 Core SDK 访问 Local AI Core,移除旧登录、项目、会话和 renderer API 双轨实现。
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{c as I,z as h,D as U,r as l,j as t,B as x,E as L,u as V,s as B,R as D,A as q}from"./index-DRJ5wgw_.js";import{l as G}from"./threads-DOsBQBg_.js";import{C as $}from"./Card-BPJNSZce.js";import{B as R}from"./Badge-Bq2hPVcR.js";import{S as F}from"./Select-RHJBmNER.js";import{E as H}from"./EmptyState-DK496gBq.js";import{P as J}from"./Page-DfC319Ck.js";import{M as T}from"./Modal-BB10hTRc.js";import{I as K}from"./Input-C5C1d0ba.js";import"./index-BlnvlekJ.js";import"./chevron-down-Ca2FQDB7.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 W=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Q=I("eye",W);/**
|
|
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 X=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],Y=I("pause",X);/**
|
|
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 Z=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],P=I("play",Z);function v(e,s){return`${e}${U({workspace_id:s})}`}function ee(e){return h("GET",v("/automations",e))}function te(e,s,a){return h("PATCH",v(`/automations/${encodeURIComponent(e)}`,s),a)}function se(e,s){return h("POST",v(`/automations/${encodeURIComponent(e)}/check`,s))}function ne(e,s){return h("GET",v(`/automations/${encodeURIComponent(e)}/evaluations`,s))}function ae(e,s){return h("GET",v(`/automations/${encodeURIComponent(e)}/runs`,s))}function ie(e){return h("GET",v("/automation-scripts",e))}function z(e,s){return h("GET",v(`/automation-scripts/${encodeURIComponent(e)}/versions`,s))}function re(e,s,a){return h("POST",v(`/automation-scripts/versions/${encodeURIComponent(e)}/test`,s),{actor:a})}function oe(e,s,a){return h("POST",v(`/automation-scripts/versions/${encodeURIComponent(e)}/enable-approval`,s),{actor:a})}function ce(e,s,a,o){return h("POST",v(`/automation-scripts/versions/${encodeURIComponent(e)}/approve`,s),{approvalId:a,actor:o})}function le(e,s,a,o){return h("POST",v(`/automation-scripts/versions/${encodeURIComponent(e)}/reject`,s),{approvalId:a,actor:o})}function de(e,s,a){return h("POST",v(`/automation-scripts/versions/${encodeURIComponent(e)}/revoke`,s),{actor:a})}function pe(e){return e.health==="blocked"?"blocked":e.enabled?"active":"paused"}function ue(e,s={}){var o;const a=((o=s.query)==null?void 0:o.trim().toLocaleLowerCase())||"";return e.filter(g=>{const m=g.originKind||"native";return(!s.origin||s.origin==="all"||m===s.origin)&&(!a||`${g.title} ${g.workspaceId}`.toLocaleLowerCase().includes(a))})}function me(e){switch(e.status){case"pending_test_approval":return e.pendingTestApprovalId?"authorize-test":null;case"test_authorized":return"run-test";case"tested":return"request-enable";case"pending_approval":return e.pendingApprovalId?"approve-enable":null;case"approved":return"revoke";default:return null}}function E(e,s){const a=e.status==="pending_test_approval"?e.pendingTestApprovalId:e.status==="pending_approval"?e.pendingApprovalId:void 0;return a?{approvalId:a,decision:s}:null}function xe(e){return e?e.status==="running"?"Running":e.errorCategory==="sandbox_unavailable"?"Blocked: sandbox unavailable":e.conditionOutcome==="error"?`Error${e.errorCategory?`: ${e.errorCategory}`:""}`:`${e.conditionOutcome||"finished"} · ${e.triggerDecision||"not evaluated"}`:"—"}function he(e){return e?`${e.status}${e.deliveryStatus?` · ${e.deliveryStatus}`:""}`:"—"}function ve(e){const s=e.replace(/^env:\/\//,"").trim();return s.length<7?"***":`${s.slice(0,4)}…${s.slice(-4)}`}function fe(e){return e==="scheduled-job"?"Cron":e==="automation-monitor"?"Monitor":"Native"}function _({open:e,version:s,workspaceId:a,onClose:o,onChanged:g}){const[m,A]=l.useState("desktop-user"),[i,y]=l.useState(!1);if(!s)return null;const j=me(s),k=async c=>{y(!0);try{await c(),await g(),o()}finally{y(!1)}},d=c=>{const p=E(s,c);if(p)return k(async()=>{const w=m.trim();await L(p.approvalId,{status:p.decision,resolvedBy:w,resolution:`Automation script ${p.decision} in desktop UI.`}),p.decision==="approved"?await ce(s.id,a,p.approvalId,w):await le(s.id,a,p.approvalId,w)})},r=!!E(s,"approved");return t.jsx(T,{open:e,onClose:o,title:"Script approval",children:t.jsxs("div",{className:"space-y-4 text-sm",children:[t.jsxs("p",{children:[t.jsx("strong",{children:"Version:"})," ",s.id]}),t.jsxs("p",{children:[t.jsx("strong",{children:"Status:"})," ",s.status]}),t.jsx("p",{className:"text-xs text-gray-500",children:"The server validates the version, pending approval ID, and actor for every action."}),t.jsx(K,{label:"Approver",value:m,onChange:c=>A(c.target.value)}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[j==="authorize-test"&&r&&t.jsx(x,{loading:i,onClick:()=>void d("approved"),children:"Authorize test"}),j==="run-test"&&t.jsx(x,{loading:i,onClick:()=>void k(()=>re(s.id,a,m.trim())),children:"Run sandbox test"}),j==="request-enable"&&t.jsx(x,{loading:i,onClick:()=>void k(()=>oe(s.id,a,m.trim())),children:"Request enable approval"}),j==="approve-enable"&&r&&t.jsx(x,{loading:i,onClick:()=>void d("approved"),children:"Approve & enable"}),j==="revoke"&&t.jsx(x,{variant:"danger",loading:i,onClick:()=>void k(()=>de(s.id,a,m.trim())),children:"Revoke"}),r&&t.jsx(x,{variant:"secondary",loading:i,onClick:()=>void d("rejected"),children:"Reject"})]})]})})}function je({automation:e,onClose:s,onChanged:a}){const[o,g]=l.useState([]),[m,A]=l.useState([]),[i,y]=l.useState(null),[j,k]=l.useState(!1),d=async()=>{if(!e)return;const[r,c]=await Promise.all([ne(e.id,e.workspaceId),ae(e.id,e.workspaceId)]);g(r.evaluations),A(c.runs);const p=e.condition;if(p.kind==="approved-script"){const w=await z(p.scriptId,e.workspaceId);y(w.versions.find(C=>C.id===p.approvedVersionId)||null)}else y(null)};return l.useEffect(()=>{d()},[e==null?void 0:e.id]),e?t.jsxs(t.Fragment,{children:[t.jsx(T,{open:!0,onClose:s,title:e.title,className:"sm:max-w-2xl",children:t.jsxs("div",{className:"space-y-4 text-sm",children:[e.health==="blocked"&&t.jsxs("p",{className:"rounded-md bg-red-50 p-3 text-red-700 dark:bg-red-950/30 dark:text-red-200",children:["Blocked: ",e.blockedReason||"Automation is unavailable."," No fallback will run."]}),t.jsxs("section",{children:[t.jsx("h3",{className:"font-medium",children:"Definition"}),t.jsxs("p",{children:["Activation: ",e.activation.kind," · Condition: ",e.condition.kind," · Workspace: ",e.workspaceId]})]}),i&&t.jsxs("section",{className:"space-y-1",children:[t.jsx("h3",{className:"font-medium",children:"Approved script (read-only)"}),t.jsxs("p",{children:["Hash: ",t.jsx("code",{children:i.packageSha256})]}),t.jsxs("p",{children:["Interpreter: ",i.interpreterPath," (",i.interpreterVersion,")"]}),t.jsxs("p",{children:["Permissions: network ",i.networkMode,"; internal access ",i.internalAccess?"allowed":"denied","; read directories ",i.allowedReadDirs.length]}),t.jsxs("p",{children:["Secrets: ",i.secretRefs.length?i.secretRefs.map(ve).join(", "):"none"]}),i.networkMode==="public"&&t.jsx("p",{className:"text-amber-700 dark:text-amber-200",children:"Public-network access is enabled. Private destinations remain denied."}),t.jsxs("p",{children:["Test plan: ",JSON.stringify(i.testPlan)]}),i.testReport&&t.jsxs("p",{children:["Test report: ",JSON.stringify(i.testReport)]}),t.jsxs("div",{children:[t.jsx(R,{variant:i.status==="approved"?"success":"warning",children:i.status})," ",t.jsx(x,{size:"sm",variant:"secondary",onClick:()=>k(!0),children:"Approval"})]})]}),t.jsxs("section",{children:[t.jsx("h3",{className:"font-medium",children:"Recent evaluations"}),o.length?o.slice(0,5).map(r=>t.jsxs("p",{children:[xe(r)," · ",r.finishedAt||r.startedAt]},r.id)):t.jsx("p",{children:"—"})]}),t.jsxs("section",{children:[t.jsx("h3",{className:"font-medium",children:"Recent runs"}),m.length?m.slice(0,5).map(r=>t.jsxs("p",{children:[he(r)," · ",r.finishedAt||r.createdAt]},r.id)):t.jsx("p",{children:"—"})]})]})}),t.jsx(_,{open:j,version:i,workspaceId:e.workspaceId,onClose:()=>k(!1),onChanged:async()=>{await d(),await a()}})]}):null}function ge(){const e=new URLSearchParams(window.location.search).get("origin");return e==="scheduled-job"||e==="automation-monitor"||e==="native"?e:"all"}function Pe(){const{t:e}=V(),[s,a]=l.useState([]),[o,g]=l.useState(ge),[m,A]=l.useState(!0),[i,y]=l.useState(null),[j,k]=l.useState([]),[d,r]=l.useState(null),c=l.useCallback(async()=>{A(!0);try{const{workspaces:n}=await G(),[u,b]=await Promise.all([Promise.all(n.map(f=>ee(f.id))),Promise.all(n.map(async f=>({workspace:f,scripts:(await ie(f.id)).scripts})))]);a(u.flatMap(f=>f.automations));const O=await Promise.all(b.flatMap(({workspace:f,scripts:N})=>N.map(async S=>({workspaceId:f.id,title:S.title,versions:(await z(S.id,f.id)).versions}))));k(O.flatMap(({workspaceId:f,title:N,versions:S})=>S.map(M=>({workspaceId:f,title:N,version:M}))))}finally{A(!1)}},[]);l.useEffect(()=>(c(),B(u=>{(u.type==="automation.definition.updated"||u.type==="automation.evaluation.updated"||u.type==="automation.run.updated"||u.type==="automation.script-version.updated")&&c()})),[c]);const p=l.useMemo(()=>ue(s,{origin:o}),[s,o]),w=async n=>{await te(n.id,n.workspaceId,{enabled:!n.enabled}),await c()},C=async n=>{await se(n.id,n.workspaceId),await c()};return m&&s.length===0?t.jsx("div",{className:"flex h-64 items-center justify-center text-gray-400 animate-pulse",children:e("common.loading")}):t.jsxs("div",{className:"space-y-4 animate-fade-in",children:[t.jsx(J,{title:e("automations.title"),description:e("automations.description"),actions:t.jsxs(x,{variant:"secondary",onClick:()=>void c(),children:[t.jsx(D,{size:16})," ",e("automations.refresh")]})}),t.jsxs(F,{value:o,onChange:n=>g(n.target.value),children:[t.jsx("option",{value:"all",children:e("automations.all")}),t.jsx("option",{value:"native",children:e("automations.native")}),t.jsx("option",{value:"scheduled-job",children:e("automations.cron")}),t.jsx("option",{value:"automation-monitor",children:e("automations.monitor")})]}),p.length?t.jsx("div",{className:"space-y-3",children:p.map(n=>{const u=pe(n);return t.jsx($,{className:"app-panel",children:t.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"font-medium",children:n.title}),t.jsx(R,{variant:u==="active"?"success":u==="blocked"?"danger":"default",children:e(`automations.${u}`)}),t.jsx(R,{variant:"secondary",children:fe(n.originKind)})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-500",children:[t.jsxs("span",{children:[e("automations.activation"),": ",n.activation.kind]}),t.jsxs("span",{children:[e("automations.condition"),": ",n.condition.kind]}),t.jsxs("span",{children:[e("automations.workspace"),": ",n.workspaceId]}),n.lastEvaluationAt&&t.jsxs("span",{children:[e("automations.lastEvaluation"),": ",n.lastEvaluationAt]}),n.lastTriggeredAt&&t.jsxs("span",{children:[e("automations.lastRun"),": ",n.lastTriggeredAt]})]}),u==="blocked"&&t.jsx("p",{className:"mt-2 text-xs text-red-600",children:n.blockedReason||e("automations.blocked")})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs(x,{size:"sm",variant:"secondary",onClick:()=>void C(n),title:e("automations.check"),children:[t.jsx(P,{size:14})," ",e("automations.check")]}),t.jsx(x,{size:"sm",variant:"secondary",onClick:()=>void w(n),title:n.enabled?e("automations.pause"):e("automations.enable"),children:n.enabled?t.jsx(Y,{size:14}):t.jsx(P,{size:14})}),t.jsxs(x,{size:"sm",variant:"secondary",onClick:()=>y(n),children:[t.jsx(Q,{size:14})," ",e("automations.detail")]})]})]})},n.id)})}):t.jsx(H,{icon:q,message:e("automations.empty")}),j.filter(({version:n})=>n.status!=="approved"&&n.status!=="rejected"&&n.status!=="revoked").length>0&&t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-base font-semibold",children:e("automations.scriptApprovals")}),j.filter(({version:n})=>n.status!=="approved"&&n.status!=="rejected"&&n.status!=="revoked").map(({workspaceId:n,title:u,version:b})=>t.jsx($,{className:"app-panel",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"font-medium",children:u}),t.jsxs("p",{className:"text-xs text-gray-500",children:[b.status," · ",b.interpreterPath," · ",b.packageSha256.slice(0,12),"…"]})]}),t.jsx(x,{size:"sm",variant:"secondary",onClick:()=>r({workspaceId:n,version:b}),children:e("automations.reviewApproval")})]})},b.id))]}),t.jsx(je,{automation:i,onClose:()=>y(null),onChanged:c}),t.jsx(_,{open:!!d,version:(d==null?void 0:d.version)||null,workspaceId:(d==null?void 0:d.workspaceId)||"",onClose:()=>r(null),onChanged:c})]})}export{Pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,g as a}from"./index-
|
|
1
|
+
import{j as t,g as a}from"./index-DRJ5wgw_.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,g as d}from"./index-
|
|
1
|
+
import{j as a,g as d}from"./index-DRJ5wgw_.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as g,u as H,r as n,k as $,
|
|
1
|
+
import{c as g,u as H,r as n,k as $,G as T,H as C,j as e,B as c,R as q,L as V,T as F,I as R,J as G,K as J}from"./index-DRJ5wgw_.js";import{B as x}from"./Badge-Bq2hPVcR.js";import{I as Q}from"./Input-C5C1d0ba.js";import{P as X,S as l,a as I}from"./Page-DfC319Ck.js";import{S as O}from"./shield-check-C2cw_Ip6.js";import{S as W,P as Y}from"./save-Bpoxbzau.js";import"./Card-BPJNSZce.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -18,4 +18,4 @@ 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 a
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
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
|
|
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 G({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 J();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(X,{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(Q,{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,36 @@
|
|
|
1
|
+
import{c as u,u as se,r,a as te,l as ae,b as M,d as re,e as ie,f as ne,o as de,s as le,j as e,A as ce,M as oe,W as me,B as xe,R as ue,L as E,F as he,S as ge,g as pe}from"./index-DRJ5wgw_.js";import{C as f}from"./Card-BPJNSZce.js";import{B as n}from"./Badge-Bq2hPVcR.js";import{E as j}from"./EmptyState-DK496gBq.js";import{P as fe}from"./Page-DfC319Ck.js";import{l as je}from"./threads-DOsBQBg_.js";import{B as ye}from"./book-open-DUcBn7Bb.js";import{S as B}from"./shield-check-C2cw_Ip6.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 ke=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],W=u("arrow-right",ke);/**
|
|
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 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);/**
|
|
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 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);/**
|
|
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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ae=u("circle-check",Re);/**
|
|
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 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"}]],$=u("cpu",Se);/**
|
|
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 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);/**
|
|
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 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(W,{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:pe("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:B})}):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:B})}):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}=se(),[t,l]=r.useState([]),[c,m]=r.useState([]),[d,F]=r.useState([]),[N,U]=r.useState([]),[V,H]=r.useState([]),[w,K]=r.useState([]),[O,Q]=r.useState([]),[G,z]=r.useState(!0),[J,C]=r.useState(!1),[X,g]=r.useState(!1),[_,D]=r.useState(""),[T,p]=r.useState(""),{desktopRuntime:h,desktopWorkspace:qe,knowledgeModule:P,schedulerModule:q,monitorModule:I}=te(),R=c.filter(s=>s.installed),y=[{title:"继续聊天",description:"打开本地对话,继续当前项目里的 agent 线程。",to:"/chat",icon:oe,primary:!0},{title:"工作区",description:"管理项目、平台、模型和本地运行配置。",to:"/workspace",icon:me}];P&&y.push({title:"知识库",description:"上传文档,维护可被检索的项目资料。",to:"/knowledge",icon:ye}),(q||I)&&y.push({title:"自动化",description:"查看和管理计划、监控和条件触发的自动化。",to:"/automations",icon:ve}),(!P||!q&&!I)&&y.push({title:"系统设置",description:"查看配置、日志和桌面应用偏好。",to:"/system",icon:ge});const k=r.useCallback(async()=>{var s;z(!0),D(""),p("");try{if(h){const[i,x]=await Promise.all([je(),ae().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})]),[Z,ee]=await Promise.all([re({status:"pending",limit:6}),ie({limit:6})]);F(o.tasks||[]),U(A.tasks||[]),H(b.tasks||[]),K(Z.approvals||[]),Q(ee.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]),Y=r.useCallback(async()=>{C(!0),g(!0),p("");try{m((await ne()).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=de(()=>{k()}),x=le(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]),G&&t.length===0?e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:e.jsx(ce,{className:"animate-pulse",size:24})}):e.jsxs("div",{className:"animate-fade-in space-y-8",children:[e.jsx(fe,{title:"概览",description:"继续最近的工作,或进入项目、知识和自动化配置。当前版本 v0.1.62"}),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"]}),X?e.jsx(n,{variant:"info",children:"checking"}):null,e.jsxs(xe,{variant:"outline",size:"sm",loading:J,onClick:Y,title:"刷新 runtime 检测",children:[e.jsx(ue,{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:$})}):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($,{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:V,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:O})]}):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:he})}):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(W,{size:16,className:"text-muted-foreground/45 transition-colors group-hover:text-foreground"})]})]},s.name)})})]})]})}export{Ke as default};
|
package/dist/renderer/assets/{HighlightedMarkdown-BUhDlhgW.js → HighlightedMarkdown-Ckre5jNv.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Jn,h as jn,j as fe,r as ei}from"./index-
|
|
1
|
+
import{c as Jn,h as jn,j as fe,r as ei}from"./index-DRJ5wgw_.js";import{C as ti}from"./chevron-down-Ca2FQDB7.js";import{c as ni,v as ii,M as ai,r as ri}from"./ThreadChat-BU1zCdr4.js";import"./channels-DMhDSlf2.js";import"./shield-check-C2cw_Ip6.js";import"./Input-C5C1d0ba.js";import"./Modal-BB10hTRc.js";import"./index-BlnvlekJ.js";import"./search-BVJcpdFX.js";import"./pencil-BhWdv_86.js";import"./trash-2-Bs3rEm3g.js";import"./knowledge-D1-k56eY.js";import"./threads-DOsBQBg_.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,g as i}from"./index-
|
|
1
|
+
import{j as e,g as i}from"./index-DRJ5wgw_.js";function t({label:s,className:o,...r}){return e.jsxs("div",{className:"space-y-1.5",children:[s&&e.jsx("label",{className:"block text-sm font-medium text-foreground",children:s}),e.jsx("input",{className:i("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors","file:border-0 file:bg-transparent file:text-sm file:font-medium","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",o),...r})]})}function l({label:s,className:o,...r}){return e.jsxs("div",{className:"space-y-1.5",children:[s&&e.jsx("label",{className:"block text-sm font-medium text-foreground",children:s}),e.jsx("textarea",{className:i("flex min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors resize-none","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",o),...r})]})}export{t as I,l as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as y,Y as q,r as t,j as e,L as C,B as p,S as H,g as P,
|
|
1
|
+
import{c as y,Y as q,r as t,j as e,L as C,B as p,S as H,g as P,Q as _}from"./index-DRJ5wgw_.js";import{C as x}from"./Card-BPJNSZce.js";import{I as U}from"./Input-C5C1d0ba.js";import{E as F}from"./EmptyState-DK496gBq.js";import{g as E,h as O,a as Q,i as V,j as Z,k as G,s as Y}from"./knowledge-D1-k56eY.js";import{A as J}from"./arrow-left-D2V1eZSD.js";import{S as W}from"./search-BVJcpdFX.js";import{T as X}from"./trash-2-Bs3rEm3g.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,4 +13,4 @@ import{c as y,Y as q,r as t,j as e,L as C,B as p,S as H,g as P,E as _}from"./ind
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const re=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],K=y("upload",re);function B(a){return a==="success"?"border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-900/30 dark:bg-violet-950/20 dark:text-violet-300":a==="warning"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/30 dark:bg-amber-950/20 dark:text-amber-300":"border-red-200 bg-red-50 text-red-700 dark:border-red-900/30 dark:bg-red-950/20 dark:text-red-300"}function ge(){const{knowledgebaseId:a=""}=q(),[f,u]=t.useState(!0),[j,b]=t.useState(!1),[I,k]=t.useState(!1),[m,M]=t.useState(!1),[r,A]=t.useState(null),[N,z]=t.useState([]),[g,D]=t.useState([]),[w,v]=t.useState([]),[n,T]=t.useState(""),[h,c]=t.useState(null),o=t.useCallback(async()=>{if(a){u(!0);try{const[s,d,l,R]=await Promise.all([E(),O(a),
|
|
16
|
+
*/const re=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],K=y("upload",re);function B(a){return a==="success"?"border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-900/30 dark:bg-violet-950/20 dark:text-violet-300":a==="warning"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/30 dark:bg-amber-950/20 dark:text-amber-300":"border-red-200 bg-red-50 text-red-700 dark:border-red-900/30 dark:bg-red-950/20 dark:text-red-300"}function ge(){const{knowledgebaseId:a=""}=q(),[f,u]=t.useState(!0),[j,b]=t.useState(!1),[I,k]=t.useState(!1),[m,M]=t.useState(!1),[r,A]=t.useState(null),[N,z]=t.useState([]),[g,D]=t.useState([]),[w,v]=t.useState([]),[n,T]=t.useState(""),[h,c]=t.useState(null),o=t.useCallback(async()=>{if(a){u(!0);try{const[s,d,l,R]=await Promise.all([E(),O(a),Q(),V(a).catch(()=>({files:[]}))]);M(!!s.baseUrl),A(d),z(l.folders||[]),D(R.files||[])}catch(s){c({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{u(!1)}}},[a]);t.useEffect(()=>{o()},[o]);const i=t.useMemo(()=>N.find(s=>s.id===(r==null?void 0:r.folderId))||null,[r==null?void 0:r.folderId,N]),$=t.useCallback(async s=>{const d=Array.from(s.target.files||[]);if(!(!a||d.length===0)){b(!0);try{const l=await E();await Z(a,{files:d,collection:l.defaultCollection,folder:i==null?void 0:i.path}),c({tone:"success",message:"Files uploaded and indexed."}),await o(),s.target.value=""}catch(l){c({tone:"error",message:l instanceof Error?l.message:String(l)})}finally{b(!1)}}},[i==null?void 0:i.path,a,o]),L=t.useCallback(async s=>{if(!(!a||!window.confirm(`Delete file "${s.fileName}"?`)))try{await G(a,s.fileId),c({tone:"success",message:"File deleted."}),await o()}catch(d){c({tone:"error",message:d instanceof Error?d.message:String(d)})}},[a,o]),S=t.useCallback(async()=>{if(!a||!n.trim()){v([]);return}k(!0);try{const s=await Y(a,{query:n.trim(),limit:8});v(s.results||[])}catch(s){c({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{k(!1)}},[a,n]);return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(C,{to:"/knowledge",children:e.jsxs(p,{variant:"secondary",children:[e.jsx(J,{size:14})," 返回知识库"]})}),r&&e.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:[e.jsx("span",{className:"text-gray-900 dark:text-white",children:r.name}),i?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2",children:"/"}),e.jsx("span",{children:i.path})]}):null]})]}),h&&e.jsx("div",{className:`rounded-xl border px-4 py-3 text-sm ${B(h.tone)}`,children:h.message}),!m&&!f&&e.jsx("div",{className:`rounded-2xl border px-5 py-4 ${B("warning")}`,children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Knowledge retrieval is not configured."}),e.jsx("p",{className:"mt-1 text-sm opacity-90",children:"Add the ai_vector connection in System settings to upload files and search this knowledge base."})]}),e.jsx(C,{to:"/system",children:e.jsxs(p,{variant:"secondary",children:[e.jsx(H,{size:14})," Open System Settings"]})})]})}),f?e.jsx(x,{children:e.jsx("div",{className:"py-16 text-center text-sm text-gray-400",children:"正在加载知识库详情…"})}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]",children:[e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:r.name}),e.jsx("p",{className:"mt-2 text-sm text-gray-500 dark:text-gray-400",children:r.description||"上传文档后,这个知识库会变成你当前项目的专属 RAG 索引。"})]}),e.jsxs("label",{className:P("inline-flex cursor-pointer items-center gap-2 rounded-xl px-4 py-2 text-sm font-medium",m?"bg-accent text-white hover:bg-accent-dim":"bg-gray-200 text-gray-500 dark:bg-white/[0.08] dark:text-gray-500"),children:[e.jsx(K,{size:14}),j?"上传中…":"上传文件",e.jsx("input",{type:"file",multiple:!0,className:"hidden",disabled:!m||j,onChange:s=>void $(s)})]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200/80 px-4 py-4 dark:border-white/[0.08]",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-gray-400",children:"文档数"}),e.jsx("p",{className:"mt-2 text-2xl font-semibold text-gray-900 dark:text-white",children:g.length})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200/80 px-4 py-4 dark:border-white/[0.08]",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-gray-400",children:"字符统计"}),e.jsx("p",{className:"mt-2 text-2xl font-semibold text-gray-900 dark:text-white",children:g.reduce((s,d)=>s+Number(d.wordCount||0),0)})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200/80 px-4 py-4 dark:border-white/[0.08]",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-gray-400",children:"最近更新"}),e.jsx("p",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-white",children:_(r.updatedAt)})]})]})]}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"内容搜索"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"在当前知识库内检索已解析内容,快速确认切块与召回效果。"})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(W,{size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx(U,{value:n,onChange:s=>T(s.target.value),placeholder:"例如:升级流程、性能测试结论",className:"pl-9",onKeyDown:s=>{s.key==="Enter"&&S()}})]}),e.jsxs(p,{onClick:()=>void S(),disabled:!m||!n.trim(),loading:I,children:[e.jsx(se,{size:14})," 搜索"]})]}),w.length===0?e.jsx("div",{className:"rounded-2xl border border-dashed border-gray-200/80 px-4 py-8 text-center text-sm text-gray-400 dark:border-white/[0.08]",children:n?"还没有搜索结果。":"输入关键词后可以查看召回片段。"}):e.jsx("div",{className:"space-y-3",children:w.map(s=>e.jsxs("div",{className:"rounded-2xl border border-gray-200/80 px-4 py-4 dark:border-white/[0.08]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:s.title}),e.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["chunk #",s.chunkOffset," · score ",s.score.toFixed(4)]})]}),e.jsx("span",{className:"rounded-full bg-gray-100 px-2.5 py-1 text-xs text-gray-500 dark:bg-white/[0.06] dark:text-gray-400",children:s.fileName})]}),e.jsx("p",{className:"mt-3 whitespace-pre-wrap text-sm leading-7 text-gray-600 dark:text-gray-300",children:s.snippet})]},s.id))})]})]}),e.jsxs(x,{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"文件列表"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"当前知识库内已完成解析并入库的文件。"})]})}),g.length===0?e.jsx(F,{message:"还没有文件,上传文档后会出现在这里。",icon:K}):e.jsxs("div",{className:"overflow-hidden rounded-2xl border border-gray-200/80 dark:border-white/[0.08]",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1.8fr)_120px_120px_160px_60px] gap-3 border-b border-gray-200/80 bg-gray-50/80 px-4 py-3 text-xs font-medium uppercase tracking-wide text-gray-500 dark:border-white/[0.08] dark:bg-white/[0.03]",children:[e.jsx("span",{children:"文件"}),e.jsx("span",{children:"类型"}),e.jsx("span",{children:"字符数"}),e.jsx("span",{children:"创建时间"}),e.jsx("span",{})]}),g.map(s=>e.jsxs("div",{className:"grid grid-cols-[minmax(0,1.8fr)_120px_120px_160px_60px] gap-3 border-b border-gray-200/70 px-4 py-3 text-sm last:border-b-0 dark:border-white/[0.06]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate font-medium text-gray-900 dark:text-white",children:s.fileName}),e.jsx("p",{className:"mt-1 truncate text-xs text-gray-400",children:s.fileId})]}),e.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:s.fileType}),e.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:s.wordCount||0}),e.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:_(s.createTime)}),e.jsx("button",{type:"button",onClick:()=>void L(s),className:"rounded-lg p-2 text-gray-400 hover:bg-red-500/10 hover:text-red-500","aria-label":`Delete ${s.fileName}`,children:e.jsx(X,{size:15})})]},s.fileId))]})]})]}):e.jsx(x,{children:e.jsx(F,{message:"没有找到这个知识库。",icon:te})})]})}export{ge as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as T,r as t,j as e,L as D,B as d,S as se,g as I,C as ae,
|
|
1
|
+
import{c as T,r as t,j as e,L as D,B as d,S as se,g as I,C as ae,P as te,Q as re}from"./index-DRJ5wgw_.js";import{C as x}from"./Card-BPJNSZce.js";import{M as L}from"./Modal-BB10hTRc.js";import{I as C,T as ne}from"./Input-C5C1d0ba.js";import{E as P}from"./EmptyState-DK496gBq.js";import{g as ie,a as le,l as oe,c as de,b as ce,u as me,d as xe,e as ge,f as pe}from"./knowledge-D1-k56eY.js";import{P as R}from"./pencil-BhWdv_86.js";import{T as O}from"./trash-2-Bs3rEm3g.js";import{S as he}from"./search-BVJcpdFX.js";import{P as ue}from"./plus-BacLMlK3.js";import{B as fe}from"./book-open-DUcBn7Bb.js";import"./index-BlnvlekJ.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,4 +8,4 @@ import{c as T,r as t,j as e,L as D,B as d,S as se,g as I,C as ae,Q as te,E as re
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const be=[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]],S=T("folders",be);function _(o){return o==="success"?"border-primary/20 bg-primary/10 text-primary dark:border-primary/25 dark:bg-primary/10 dark:text-blue-200":o==="warning"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/30 dark:bg-amber-950/20 dark:text-amber-300":"border-red-200 bg-red-50 text-red-700 dark:border-red-900/30 dark:bg-red-950/20 dark:text-red-300"}function ve(o){switch(o){case"file":return"bg-blue-500";case"spark":return"bg-amber-500";case"screen":return"bg-fuchsia-500";default:return"bg-indigo-500"}}function we(o){return o.split("/").length-1}function Ie(){const[o,F]=t.useState(!0),[m,q]=t.useState([]),[j,A]=t.useState([]),[l,b]=t.useState(null),[g,H]=t.useState(""),[U,Q]=t.useState(!1),[V,p]=t.useState(!1),[Z,h]=t.useState(!1),[u,B]=t.useState(""),[f,K]=t.useState(""),[v,E]=t.useState(""),[w,r]=t.useState(null),[z,y]=t.useState(null),n=t.useCallback(async()=>{F(!0);try{const[s,a,i]=await Promise.all([ie(),le(),oe()]);Q(!!s.baseUrl),q(a.folders||[]),A(i.bases||[])}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{F(!1)}},[]);t.useEffect(()=>{n()},[n]);const N=t.useMemo(()=>{if(!l)return null;const s=m.find(i=>i.id===l);if(!s)return null;const a=new Set([s.id]);return m.forEach(i=>{i.path.startsWith(`${s.path}/`)&&a.add(i.id)}),a},[m,l]),M=t.useMemo(()=>{const s=g.trim().toLowerCase();return j.filter(a=>(N?N.has(a.folderId||""):!0)?s?[a.name,a.description,a.creatorName].join(" ").toLowerCase().includes(s):!0:!1)},[j,N,g]),G=t.useCallback(async()=>{if(!u.trim()){r({tone:"warning",message:"Folder name is required."});return}y("folder");try{await de({name:u.trim(),parentId:l}),B(""),p(!1),r({tone:"success",message:"Folder created."}),await n()}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{y(null)}},[u,n,l]),W=t.useCallback(async()=>{if(!f.trim()){r({tone:"warning",message:"Knowledge base name is required."});return}y("base");try{await ce({name:f.trim(),description:v.trim(),folderId:l}),K(""),E(""),h(!1),r({tone:"success",message:"Knowledge base created."}),await n()}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{y(null)}},[v,f,n,l]),J=t.useCallback(async s=>{var i;const a=(i=window.prompt("Rename folder",s.name))==null?void 0:i.trim();if(!(!a||a===s.name))try{await me(s.id,{name:a}),r({tone:"success",message:"Folder updated."}),await n()}catch(c){r({tone:"error",message:c instanceof Error?c.message:String(c)})}},[n]),X=t.useCallback(async s=>{if(window.confirm(`Delete folder "${s.name}"?`))try{await xe(s.id),l===s.id&&b(null),r({tone:"success",message:"Folder deleted."}),await n()}catch(a){r({tone:"error",message:a instanceof Error?a.message:String(a)})}},[n,l]),Y=t.useCallback(async s=>{var c,$;const a=(c=window.prompt("Knowledge base name",s.name))==null?void 0:c.trim();if(!a)return;const i=(($=window.prompt("Description",s.description))==null?void 0:$.trim())??s.description;try{await ge(s.id,{name:a,description:i}),r({tone:"success",message:"Knowledge base updated."}),await n()}catch(k){r({tone:"error",message:k instanceof Error?k.message:String(k)})}},[n]),ee=t.useCallback(async s=>{if(window.confirm(`Delete knowledge base "${s.name}"?`))try{await pe(s.id),r({tone:"success",message:"Knowledge base deleted."}),await n()}catch(a){r({tone:"error",message:a instanceof Error?a.message:String(a)})}},[n]);return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[w&&e.jsx("div",{className:`rounded-xl border px-4 py-3 text-sm ${_(w.tone)}`,children:w.message}),!U&&!o&&e.jsx("div",{className:`rounded-2xl border px-5 py-4 ${_("warning")}`,children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Knowledge search is not configured yet."}),e.jsx("p",{className:"mt-1 text-sm opacity-90",children:"Add the ai_vector base URL in System settings before uploading files or running retrieval."})]}),e.jsx(D,{to:"/system",children:e.jsxs(d,{variant:"secondary",children:[e.jsx(se,{size:14})," Open System Settings"]})})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[300px_minmax(0,1fr)]",children:[e.jsxs(x,{className:"app-panel p-0 overflow-hidden",children:[e.jsx("div",{className:"border-b border-gray-200/80 px-5 py-4 dark:border-white/[0.08]",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"知识库"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"创建目录并管理知识库分类。"})]}),e.jsxs(d,{size:"sm",variant:"secondary",onClick:()=>p(!0),children:[e.jsx(je,{size:14})," 文件夹"]})]})}),e.jsx("div",{className:"px-5 py-4",children:e.jsxs("button",{type:"button",onClick:()=>b(null),className:I("flex w-full items-center justify-between rounded-[16px] px-3 py-2.5 text-left text-sm transition-colors",l?"hover:bg-gray-100/80 text-gray-600 dark:text-gray-300 dark:hover:bg-white/[0.06]":"bg-primary/10 text-gray-900 ring-1 ring-primary/25 dark:text-white"),children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(S,{size:16}),"全部知识库"]}),e.jsx("span",{className:"text-xs opacity-70",children:j.length})]})}),e.jsx("div",{className:"max-h-[70vh] overflow-y-auto px-3 pb-4",children:m.length===0?e.jsx(R,{message:"还没有目录,先创建一个文件夹吧。",icon:S}):e.jsx("div",{className:"space-y-1",children:m.map(s=>{const a=s.id===l;return e.jsx("div",{className:I("group rounded-[16px] px-2 py-1",a?"bg-primary/10 ring-1 ring-primary/25":"hover:bg-gray-100/80 dark:hover:bg-white/[0.04]"),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>b(s.id),className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg px-2 py-2 text-left",style:{paddingLeft:`${8+we(s.path)*18}px`},children:[e.jsx(ae,{size:14,className:"text-gray-400"}),e.jsx(S,{size:15,className:"text-amber-500"}),e.jsx("span",{className:"truncate text-sm text-gray-800 dark:text-gray-100",children:s.name})]}),e.jsx("button",{type:"button",onClick:()=>void J(s),className:"rounded-md p-1 text-gray-400 transition hover:bg-gray-200/70 hover:text-gray-700 dark:hover:bg-white/[0.08] dark:hover:text-white","aria-label":`Rename ${s.name}`,children:e.jsx(P,{size:14})}),e.jsx("button",{type:"button",onClick:()=>void X(s),className:"rounded-md p-1 text-gray-400 transition hover:bg-red-500/10 hover:text-red-500","aria-label":`Delete ${s.name}`,children:e.jsx(O,{size:14})})]})},s.id)})})})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(x,{className:"app-toolbar",children:e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"知识库列表"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"目录筛选、本地搜索,以及知识库卡片概览都在这里。"})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"relative min-w-[260px]",children:[e.jsx(he,{size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx(C,{value:g,onChange:s=>H(s.target.value),placeholder:"搜索名称、描述或创建者","aria-label":"搜索名称、描述或创建者",className:"pl-9"})]}),e.jsxs(d,{variant:"secondary",onClick:()=>h(!0),children:[e.jsx(ue,{size:14})," 创建知识库"]})]})]})}),o?e.jsx(x,{className:"app-panel",children:e.jsx("div",{className:"py-16 text-center text-sm text-gray-400",children:"正在加载知识库…"})}):M.length===0?e.jsx(x,{className:"app-panel",children:e.jsx(R,{message:g?"没有匹配的知识库。":"还没有知识库,先创建一个开始上传文档。",icon:te})}):e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 2xl:grid-cols-3",children:M.map(s=>e.jsxs(x,{className:"group app-panel relative overflow-hidden p-5 hover:border-primary/25",children:[e.jsxs("div",{className:"absolute right-4 top-4 flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void Y(s),"aria-label":`编辑 ${s.name}`,className:"rounded-lg p-2 text-gray-400 hover:bg-gray-100/90 hover:text-gray-700 dark:hover:bg-white/[0.08] dark:hover:text-white",children:e.jsx(P,{size:15})}),e.jsx("button",{type:"button",onClick:()=>void ee(s),"aria-label":`删除 ${s.name}`,className:"rounded-lg p-2 text-gray-400 hover:bg-red-500/10 hover:text-red-500",children:e.jsx(O,{size:15})})]}),e.jsxs(D,{to:`/knowledge/${encodeURIComponent(s.id)}`,className:"block space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:`mt-1 flex h-11 w-11 items-center justify-center rounded-full text-white ${ve(s.icon)}`,children:e.jsx(fe,{size:22})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate pr-8 text-xl font-semibold text-gray-900 dark:text-white",children:s.name}),e.jsxs("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:["创建者: ",s.creatorName||"系统管理员"]})]})]}),e.jsx("div",{className:"min-h-[60px] text-sm leading-6 text-gray-600 dark:text-gray-300",children:s.description||"这个知识库还没有描述,点击进入后可以上传文件并开始检索。"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 rounded-[16px] bg-black/[0.035] px-3 py-2 text-sm font-medium text-gray-700 dark:bg-white/[0.05] dark:text-gray-200",children:[e.jsxs("span",{children:[s.fileCount," 文档数"]}),e.jsxs("span",{children:[(s.wordCount/1e3).toFixed(s.wordCount>0?1:0),"k 字符"]})]}),e.jsxs("div",{className:"text-xs text-gray-400 dark:text-gray-500",children:["更新于 ",re(s.updatedAt)]})]})]},s.id))})]})]}),e.jsx(L,{open:V,onClose:()=>p(!1),title:"创建文件夹",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(C,{label:"文件夹名称",value:u,onChange:s=>B(s.target.value),placeholder:"例如:产品文档"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"secondary",onClick:()=>p(!1),children:"取消"}),e.jsx(d,{onClick:()=>void G(),loading:z==="folder",children:"创建"})]})]})}),e.jsx(L,{open:Z,onClose:()=>h(!1),title:"创建知识库",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(C,{label:"名称",value:f,onChange:s=>K(s.target.value),placeholder:"例如:运营文档库"}),e.jsx(ne,{label:"描述",rows:4,value:v,onChange:s=>E(s.target.value),placeholder:"一句话说明这个知识库主要收录什么内容"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"secondary",onClick:()=>h(!1),children:"取消"}),e.jsx(d,{onClick:()=>void W(),loading:z==="base",children:"创建"})]})]})})]})}export{Ie as default};
|
|
11
|
+
*/const be=[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]],S=T("folders",be);function _(o){return o==="success"?"border-primary/20 bg-primary/10 text-primary dark:border-primary/25 dark:bg-primary/10 dark:text-blue-200":o==="warning"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/30 dark:bg-amber-950/20 dark:text-amber-300":"border-red-200 bg-red-50 text-red-700 dark:border-red-900/30 dark:bg-red-950/20 dark:text-red-300"}function ve(o){switch(o){case"file":return"bg-blue-500";case"spark":return"bg-amber-500";case"screen":return"bg-fuchsia-500";default:return"bg-indigo-500"}}function we(o){return o.split("/").length-1}function Ie(){const[o,F]=t.useState(!0),[m,q]=t.useState([]),[j,A]=t.useState([]),[l,b]=t.useState(null),[g,H]=t.useState(""),[U,Q]=t.useState(!1),[V,p]=t.useState(!1),[Z,h]=t.useState(!1),[u,B]=t.useState(""),[f,K]=t.useState(""),[v,E]=t.useState(""),[w,r]=t.useState(null),[z,y]=t.useState(null),n=t.useCallback(async()=>{F(!0);try{const[s,a,i]=await Promise.all([ie(),le(),oe()]);Q(!!s.baseUrl),q(a.folders||[]),A(i.bases||[])}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{F(!1)}},[]);t.useEffect(()=>{n()},[n]);const N=t.useMemo(()=>{if(!l)return null;const s=m.find(i=>i.id===l);if(!s)return null;const a=new Set([s.id]);return m.forEach(i=>{i.path.startsWith(`${s.path}/`)&&a.add(i.id)}),a},[m,l]),M=t.useMemo(()=>{const s=g.trim().toLowerCase();return j.filter(a=>(N?N.has(a.folderId||""):!0)?s?[a.name,a.description,a.creatorName].join(" ").toLowerCase().includes(s):!0:!1)},[j,N,g]),G=t.useCallback(async()=>{if(!u.trim()){r({tone:"warning",message:"Folder name is required."});return}y("folder");try{await de({name:u.trim(),parentId:l}),B(""),p(!1),r({tone:"success",message:"Folder created."}),await n()}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{y(null)}},[u,n,l]),W=t.useCallback(async()=>{if(!f.trim()){r({tone:"warning",message:"Knowledge base name is required."});return}y("base");try{await ce({name:f.trim(),description:v.trim(),folderId:l}),K(""),E(""),h(!1),r({tone:"success",message:"Knowledge base created."}),await n()}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{y(null)}},[v,f,n,l]),J=t.useCallback(async s=>{var i;const a=(i=window.prompt("Rename folder",s.name))==null?void 0:i.trim();if(!(!a||a===s.name))try{await me(s.id,{name:a}),r({tone:"success",message:"Folder updated."}),await n()}catch(c){r({tone:"error",message:c instanceof Error?c.message:String(c)})}},[n]),X=t.useCallback(async s=>{if(window.confirm(`Delete folder "${s.name}"?`))try{await xe(s.id),l===s.id&&b(null),r({tone:"success",message:"Folder deleted."}),await n()}catch(a){r({tone:"error",message:a instanceof Error?a.message:String(a)})}},[n,l]),Y=t.useCallback(async s=>{var c,$;const a=(c=window.prompt("Knowledge base name",s.name))==null?void 0:c.trim();if(!a)return;const i=(($=window.prompt("Description",s.description))==null?void 0:$.trim())??s.description;try{await ge(s.id,{name:a,description:i}),r({tone:"success",message:"Knowledge base updated."}),await n()}catch(k){r({tone:"error",message:k instanceof Error?k.message:String(k)})}},[n]),ee=t.useCallback(async s=>{if(window.confirm(`Delete knowledge base "${s.name}"?`))try{await pe(s.id),r({tone:"success",message:"Knowledge base deleted."}),await n()}catch(a){r({tone:"error",message:a instanceof Error?a.message:String(a)})}},[n]);return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[w&&e.jsx("div",{className:`rounded-xl border px-4 py-3 text-sm ${_(w.tone)}`,children:w.message}),!U&&!o&&e.jsx("div",{className:`rounded-2xl border px-5 py-4 ${_("warning")}`,children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Knowledge search is not configured yet."}),e.jsx("p",{className:"mt-1 text-sm opacity-90",children:"Add the ai_vector base URL in System settings before uploading files or running retrieval."})]}),e.jsx(D,{to:"/system",children:e.jsxs(d,{variant:"secondary",children:[e.jsx(se,{size:14})," Open System Settings"]})})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[300px_minmax(0,1fr)]",children:[e.jsxs(x,{className:"app-panel p-0 overflow-hidden",children:[e.jsx("div",{className:"border-b border-gray-200/80 px-5 py-4 dark:border-white/[0.08]",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"知识库"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"创建目录并管理知识库分类。"})]}),e.jsxs(d,{size:"sm",variant:"secondary",onClick:()=>p(!0),children:[e.jsx(je,{size:14})," 文件夹"]})]})}),e.jsx("div",{className:"px-5 py-4",children:e.jsxs("button",{type:"button",onClick:()=>b(null),className:I("flex w-full items-center justify-between rounded-[16px] px-3 py-2.5 text-left text-sm transition-colors",l?"hover:bg-gray-100/80 text-gray-600 dark:text-gray-300 dark:hover:bg-white/[0.06]":"bg-primary/10 text-gray-900 ring-1 ring-primary/25 dark:text-white"),children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(S,{size:16}),"全部知识库"]}),e.jsx("span",{className:"text-xs opacity-70",children:j.length})]})}),e.jsx("div",{className:"max-h-[70vh] overflow-y-auto px-3 pb-4",children:m.length===0?e.jsx(P,{message:"还没有目录,先创建一个文件夹吧。",icon:S}):e.jsx("div",{className:"space-y-1",children:m.map(s=>{const a=s.id===l;return e.jsx("div",{className:I("group rounded-[16px] px-2 py-1",a?"bg-primary/10 ring-1 ring-primary/25":"hover:bg-gray-100/80 dark:hover:bg-white/[0.04]"),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>b(s.id),className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg px-2 py-2 text-left",style:{paddingLeft:`${8+we(s.path)*18}px`},children:[e.jsx(ae,{size:14,className:"text-gray-400"}),e.jsx(S,{size:15,className:"text-amber-500"}),e.jsx("span",{className:"truncate text-sm text-gray-800 dark:text-gray-100",children:s.name})]}),e.jsx("button",{type:"button",onClick:()=>void J(s),className:"rounded-md p-1 text-gray-400 transition hover:bg-gray-200/70 hover:text-gray-700 dark:hover:bg-white/[0.08] dark:hover:text-white","aria-label":`Rename ${s.name}`,children:e.jsx(R,{size:14})}),e.jsx("button",{type:"button",onClick:()=>void X(s),className:"rounded-md p-1 text-gray-400 transition hover:bg-red-500/10 hover:text-red-500","aria-label":`Delete ${s.name}`,children:e.jsx(O,{size:14})})]})},s.id)})})})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(x,{className:"app-toolbar",children:e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"知识库列表"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"目录筛选、本地搜索,以及知识库卡片概览都在这里。"})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"relative min-w-[260px]",children:[e.jsx(he,{size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx(C,{value:g,onChange:s=>H(s.target.value),placeholder:"搜索名称、描述或创建者","aria-label":"搜索名称、描述或创建者",className:"pl-9"})]}),e.jsxs(d,{variant:"secondary",onClick:()=>h(!0),children:[e.jsx(ue,{size:14})," 创建知识库"]})]})]})}),o?e.jsx(x,{className:"app-panel",children:e.jsx("div",{className:"py-16 text-center text-sm text-gray-400",children:"正在加载知识库…"})}):M.length===0?e.jsx(x,{className:"app-panel",children:e.jsx(P,{message:g?"没有匹配的知识库。":"还没有知识库,先创建一个开始上传文档。",icon:te})}):e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 2xl:grid-cols-3",children:M.map(s=>e.jsxs(x,{className:"group app-panel relative overflow-hidden p-5 hover:border-primary/25",children:[e.jsxs("div",{className:"absolute right-4 top-4 flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void Y(s),"aria-label":`编辑 ${s.name}`,className:"rounded-lg p-2 text-gray-400 hover:bg-gray-100/90 hover:text-gray-700 dark:hover:bg-white/[0.08] dark:hover:text-white",children:e.jsx(R,{size:15})}),e.jsx("button",{type:"button",onClick:()=>void ee(s),"aria-label":`删除 ${s.name}`,className:"rounded-lg p-2 text-gray-400 hover:bg-red-500/10 hover:text-red-500",children:e.jsx(O,{size:15})})]}),e.jsxs(D,{to:`/knowledge/${encodeURIComponent(s.id)}`,className:"block space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:`mt-1 flex h-11 w-11 items-center justify-center rounded-full text-white ${ve(s.icon)}`,children:e.jsx(fe,{size:22})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate pr-8 text-xl font-semibold text-gray-900 dark:text-white",children:s.name}),e.jsxs("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:["创建者: ",s.creatorName||"系统管理员"]})]})]}),e.jsx("div",{className:"min-h-[60px] text-sm leading-6 text-gray-600 dark:text-gray-300",children:s.description||"这个知识库还没有描述,点击进入后可以上传文件并开始检索。"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 rounded-[16px] bg-black/[0.035] px-3 py-2 text-sm font-medium text-gray-700 dark:bg-white/[0.05] dark:text-gray-200",children:[e.jsxs("span",{children:[s.fileCount," 文档数"]}),e.jsxs("span",{children:[(s.wordCount/1e3).toFixed(s.wordCount>0?1:0),"k 字符"]})]}),e.jsxs("div",{className:"text-xs text-gray-400 dark:text-gray-500",children:["更新于 ",re(s.updatedAt)]})]})]},s.id))})]})]}),e.jsx(L,{open:V,onClose:()=>p(!1),title:"创建文件夹",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(C,{label:"文件夹名称",value:u,onChange:s=>B(s.target.value),placeholder:"例如:产品文档"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"secondary",onClick:()=>p(!1),children:"取消"}),e.jsx(d,{onClick:()=>void G(),loading:z==="folder",children:"创建"})]})]})}),e.jsx(L,{open:Z,onClose:()=>h(!1),title:"创建知识库",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(C,{label:"名称",value:f,onChange:s=>K(s.target.value),placeholder:"例如:运营文档库"}),e.jsx(ne,{label:"描述",rows:4,value:v,onChange:s=>E(s.target.value),placeholder:"一句话说明这个知识库主要收录什么内容"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"secondary",onClick:()=>h(!1),children:"取消"}),e.jsx(d,{onClick:()=>void W(),loading:z==="base",children:"创建"})]})]})})]})}export{Ie as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as N,u as b,r as t,N as L,j as e,L as S,B as m}from"./index-DRJ5wgw_.js";import{C}from"./Card-BPJNSZce.js";import{B as E}from"./Badge-Bq2hPVcR.js";import{I as k}from"./Input-C5C1d0ba.js";import{S as f}from"./Select-RHJBmNER.js";import{P as z}from"./Page-DfC319Ck.js";import{A}from"./arrow-left-D2V1eZSD.js";import{S as I}from"./search-BVJcpdFX.js";import"./index-BlnvlekJ.js";import"./chevron-down-Ca2FQDB7.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const B=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],_=
|
|
6
|
+
*/const B=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],_=N("funnel",B),R={sys:"text-gray-300",debug:"text-gray-400",info:"text-blue-400",warn:"text-amber-400",error:"text-red-400"},q={sys:"default",debug:"default",info:"info",warn:"warning",error:"danger"};function J(){const{t:o}=b(),[n,h]=t.useState([]),[l,v]=t.useState("sys"),[i,g]=t.useState("100"),[c,j]=t.useState(""),[d,w]=t.useState(!1),[y,u]=t.useState(!0),a=t.useCallback(async()=>{u(!0);try{const s=await L(l,Number(i));h(s.entries||[])}finally{u(!1)}},[l,i]);t.useEffect(()=>{a()},[a]),t.useEffect(()=>{if(!d)return;const s=window.setInterval(()=>{a()},3e3);return()=>window.clearInterval(s)},[d,a]);const x=t.useMemo(()=>{const s=c.trim().toLowerCase();return s?n.filter(r=>[r.level,r.time,r.message].join(" ").toLowerCase().includes(s)):n},[n,c]);return e.jsxs("div",{className:"space-y-4 animate-fade-in",children:[e.jsx(z,{title:o("system.logs"),description:"Filtered runtime logs for troubleshooting.",actions:e.jsx(S,{to:"/system",children:e.jsxs(m,{variant:"secondary",size:"sm",children:[e.jsx(A,{size:14})," ",o("nav.system")]})})}),e.jsxs("div",{className:"app-toolbar flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{size:14,className:"text-muted-foreground"}),e.jsxs(f,{value:l,onChange:s=>v(s.target.value),className:"w-auto",children:[e.jsx("option",{value:"sys",children:"Sys"}),e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"error",children:"Error"})]})]}),e.jsxs(f,{value:i,onChange:s=>g(s.target.value),className:"w-auto",children:[e.jsx("option",{value:"50",children:"50"}),e.jsx("option",{value:"100",children:"100"}),e.jsx("option",{value:"500",children:"500"}),e.jsx("option",{value:"1000",children:"1000"})]}),e.jsx(m,{size:"sm",variant:"secondary",onClick:a,children:o("common.refresh")}),e.jsx(m,{size:"sm",variant:d?"primary":"secondary",onClick:()=>w(s=>!s),children:"Auto"}),e.jsxs("div",{className:"relative min-w-[16rem] flex-1",children:[e.jsx(I,{size:15,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.jsx(k,{value:c,onChange:s=>j(s.target.value),placeholder:"Search logs","aria-label":"Search logs",className:"pl-9"})]})]}),e.jsx(C,{className:"app-panel",children:y?e.jsx("div",{className:"text-muted-foreground animate-pulse text-sm",children:"Loading..."}):x.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:o("common.noData")}):e.jsx("div",{className:"max-h-[65vh] overflow-auto font-mono text-xs [scrollbar-gutter:stable]",children:x.map((s,r)=>{var p;return e.jsxs("div",{className:"grid min-w-[760px] grid-cols-[9rem_5rem_minmax(0,1fr)] items-start gap-3 border-b py-2 last:border-0",children:[e.jsx("span",{className:"text-muted-foreground shrink-0 w-36",children:(p=s.time)==null?void 0:p.slice(0,19)}),e.jsx(E,{variant:q[s.level]||"default",children:s.level}),e.jsx("span",{className:`${R[s.level]||"text-gray-500"} whitespace-pre-wrap break-words`,children:s.message})]},r)})})})]})}export{J as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{c as K,r as s,
|
|
1
|
+
import{c as K,r as s,O as C,j as i,g as P}from"./index-DRJ5wgw_.js";import{u as I,d as X,e as O,g as Y,P as x,f as N,R as Z,h as J,c as Q,a as ee,i as te,F as ne,D as oe,j as re}from"./index-BlnvlekJ.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ae=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ie=K("x",ae);function se(e,t){return s.useReducer((o,n)=>t[o][n]??o,e)}var y=e=>{const{present:t,children:o}=e,n=ce(t),r=typeof o=="function"?o({present:n.isPresent}):s.Children.only(o),a=C(n.ref,le(r));return typeof o=="function"||n.isPresent?s.cloneElement(r,{ref:a}):null};y.displayName="Presence";function ce(e){const[t,o]=s.useState(),n=s.useRef(null),r=s.useRef(e),a=s.useRef("none"),c=e?"mounted":"unmounted",[u,d]=se(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{const l=h(n.current);a.current=u==="mounted"?l:"none"},[u]),I(()=>{const l=n.current,g=r.current;if(g!==e){const D=a.current,p=h(l);e?d("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?d("UNMOUNT"):d(g&&D!==p?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,d]),I(()=>{if(t){let l;const g=t.ownerDocument.defaultView??window,m=p=>{const H=h(n.current).includes(CSS.escape(p.animationName));if(p.target===t&&H&&(d("ANIMATION_END"),!r.current)){const q=t.style.animationFillMode;t.style.animationFillMode="forwards",l=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=q)})}},D=p=>{p.target===t&&(a.current=h(n.current))};return t.addEventListener("animationstart",D),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{g.clearTimeout(l),t.removeEventListener("animationstart",D),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:s.useCallback(l=>{n.current=l?getComputedStyle(l):null,o(l)},[])}}function h(e){return(e==null?void 0:e.animationName)||"none"}function le(e){var n,r;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var E="Dialog",[T]=Q(E),[ue,f]=T(E),b=e=>{const{__scopeDialog:t,children:o,open:n,defaultOpen:r,onOpenChange:a,modal:c=!0}=e,u=s.useRef(null),d=s.useRef(null),[l,g]=X({prop:n,defaultProp:r??!1,onChange:a,caller:E});return i.jsx(ue,{scope:t,triggerRef:u,contentRef:d,contentId:O(),titleId:O(),descriptionId:O(),open:l,onOpenChange:g,onOpenToggle:s.useCallback(()=>g(m=>!m),[g]),modal:c,children:o})};b.displayName=E;var j="DialogTrigger",de=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(j,o),a=C(t,r.triggerRef);return i.jsx(x.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":
|
|
6
|
+
*/const ae=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ie=K("x",ae);function se(e,t){return s.useReducer((o,n)=>t[o][n]??o,e)}var y=e=>{const{present:t,children:o}=e,n=ce(t),r=typeof o=="function"?o({present:n.isPresent}):s.Children.only(o),a=C(n.ref,le(r));return typeof o=="function"||n.isPresent?s.cloneElement(r,{ref:a}):null};y.displayName="Presence";function ce(e){const[t,o]=s.useState(),n=s.useRef(null),r=s.useRef(e),a=s.useRef("none"),c=e?"mounted":"unmounted",[u,d]=se(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{const l=h(n.current);a.current=u==="mounted"?l:"none"},[u]),I(()=>{const l=n.current,g=r.current;if(g!==e){const D=a.current,p=h(l);e?d("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?d("UNMOUNT"):d(g&&D!==p?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,d]),I(()=>{if(t){let l;const g=t.ownerDocument.defaultView??window,m=p=>{const H=h(n.current).includes(CSS.escape(p.animationName));if(p.target===t&&H&&(d("ANIMATION_END"),!r.current)){const q=t.style.animationFillMode;t.style.animationFillMode="forwards",l=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=q)})}},D=p=>{p.target===t&&(a.current=h(n.current))};return t.addEventListener("animationstart",D),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{g.clearTimeout(l),t.removeEventListener("animationstart",D),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:s.useCallback(l=>{n.current=l?getComputedStyle(l):null,o(l)},[])}}function h(e){return(e==null?void 0:e.animationName)||"none"}function le(e){var n,r;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var E="Dialog",[T]=Q(E),[ue,f]=T(E),b=e=>{const{__scopeDialog:t,children:o,open:n,defaultOpen:r,onOpenChange:a,modal:c=!0}=e,u=s.useRef(null),d=s.useRef(null),[l,g]=X({prop:n,defaultProp:r??!1,onChange:a,caller:E});return i.jsx(ue,{scope:t,triggerRef:u,contentRef:d,contentId:O(),titleId:O(),descriptionId:O(),open:l,onOpenChange:g,onOpenToggle:s.useCallback(()=>g(m=>!m),[g]),modal:c,children:o})};b.displayName=E;var j="DialogTrigger",de=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(j,o),a=C(t,r.triggerRef);return i.jsx(x.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":M(r.open),...n,ref:a,onClick:N(e.onClick,r.onOpenToggle)})});de.displayName=j;var A="DialogPortal",[fe,w]=T(A,{forceMount:void 0}),S=e=>{const{__scopeDialog:t,forceMount:o,children:n,container:r}=e,a=f(A,t);return i.jsx(fe,{scope:t,forceMount:o,children:s.Children.map(n,c=>i.jsx(y,{present:o||a.open,children:i.jsx(Y,{asChild:!0,container:r,children:c})}))})};S.displayName=A;var R="DialogOverlay",F=s.forwardRef((e,t)=>{const o=w(R,e.__scopeDialog),{forceMount:n=o.forceMount,...r}=e,a=f(R,e.__scopeDialog);return a.modal?i.jsx(y,{present:n||a.open,children:i.jsx(me,{...r,ref:t})}):null});F.displayName=R;var ge=ee("DialogOverlay.RemoveScroll"),me=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(R,o);return i.jsx(Z,{as:ge,allowPinchZoom:!0,shards:[r.contentRef],children:i.jsx(x.div,{"data-state":M(r.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),v="DialogContent",W=s.forwardRef((e,t)=>{const o=w(v,e.__scopeDialog),{forceMount:n=o.forceMount,...r}=e,a=f(v,e.__scopeDialog);return i.jsx(y,{present:n||a.open,children:a.modal?i.jsx(pe,{...r,ref:t}):i.jsx(ve,{...r,ref:t})})});W.displayName=v;var pe=s.forwardRef((e,t)=>{const o=f(v,e.__scopeDialog),n=s.useRef(null),r=C(t,o.contentRef,n);return s.useEffect(()=>{const a=n.current;if(a)return J(a)},[]),i.jsx(L,{...e,ref:r,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:N(e.onCloseAutoFocus,a=>{var c;a.preventDefault(),(c=o.triggerRef.current)==null||c.focus()}),onPointerDownOutside:N(e.onPointerDownOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&a.preventDefault()}),onFocusOutside:N(e.onFocusOutside,a=>a.preventDefault())})}),ve=s.forwardRef((e,t)=>{const o=f(v,e.__scopeDialog),n=s.useRef(!1),r=s.useRef(!1);return i.jsx(L,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var c,u;(c=e.onCloseAutoFocus)==null||c.call(e,a),a.defaultPrevented||(n.current||(u=o.triggerRef.current)==null||u.focus(),a.preventDefault()),n.current=!1,r.current=!1},onInteractOutside:a=>{var d,l;(d=e.onInteractOutside)==null||d.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const c=a.target;((l=o.triggerRef.current)==null?void 0:l.contains(c))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&r.current&&a.preventDefault()}})}),L=s.forwardRef((e,t)=>{const{__scopeDialog:o,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:a,...c}=e,u=f(v,o),d=s.useRef(null),l=C(t,d);return te(),i.jsxs(i.Fragment,{children:[i.jsx(ne,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:r,onUnmountAutoFocus:a,children:i.jsx(oe,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":M(u.open),...c,ref:l,onDismiss:()=>u.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(xe,{titleId:u.titleId}),i.jsx(he,{contentRef:d,descriptionId:u.descriptionId})]})]})}),_="DialogTitle",k=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(_,o);return i.jsx(x.h2,{id:r.titleId,...n,ref:t})});k.displayName=_;var U="DialogDescription",Ne=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(U,o);return i.jsx(x.p,{id:r.descriptionId,...n,ref:t})});Ne.displayName=U;var G="DialogClose",$=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(G,o);return i.jsx(x.button,{type:"button",...n,ref:t,onClick:N(e.onClick,()=>r.onOpenChange(!1))})});$.displayName=G;function M(e){return e?"open":"closed"}var z="DialogTitleWarning",[Pe,B]=re(z,{contentName:v,titleName:_,docsSlug:"dialog"}),xe=({titleId:e})=>{const t=B(z),o=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
7
7
|
|
|
8
8
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
9
9
|
|
|
10
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return s.useEffect(()=>{e&&(document.getElementById(e)||console.error(o))},[o,e]),null},De="DialogDescriptionWarning",he=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${B(De).contentName}}.`;return s.useEffect(()=>{var a;const r=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Re=b,Ce=S,ye=F,Ee=W,Oe=k,Ae=$;function Ie({open:e,onClose:t,title:o,children:n,className:r}){return i.jsx(Re,{open:e,onOpenChange:a=>{a||t()},children:i.jsxs(Ce,{children:[i.jsx(ye,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-fade-in"}),i.jsxs(Ee,{className:
|
|
10
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return s.useEffect(()=>{e&&(document.getElementById(e)||console.error(o))},[o,e]),null},De="DialogDescriptionWarning",he=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${B(De).contentName}}.`;return s.useEffect(()=>{var a;const r=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Re=b,Ce=S,ye=F,Ee=W,Oe=k,Ae=$;function Ie({open:e,onClose:t,title:o,children:n,className:r}){return i.jsx(Re,{open:e,onOpenChange:a=>{a||t()},children:i.jsxs(Ce,{children:[i.jsx(ye,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-fade-in"}),i.jsxs(Ee,{className:P("fixed inset-x-4 top-1/2 z-50 grid max-h-[calc(100dvh-2rem)] max-w-lg -translate-y-1/2 gap-4 overflow-y-auto","rounded-lg border bg-popover p-5 text-popover-foreground shadow-lg outline-none sm:left-1/2 sm:right-auto sm:w-[calc(100%-2rem)] sm:-translate-x-1/2 sm:p-6",r),children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(Oe,{className:"text-lg font-semibold leading-none tracking-tight",children:o}),i.jsx(Ae,{className:P("rounded-sm p-1 opacity-70 transition-opacity hover:opacity-100","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"),"aria-label":"Close",children:i.jsx(ie,{size:18})})]}),n]})]})})}export{Ie as M,ie as X};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,g as a}from"./index-
|
|
1
|
+
import{j as e,g as a}from"./index-DRJ5wgw_.js";import{C as n}from"./Card-BPJNSZce.js";function o({title:s,description:r,actions:t}){return e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:s}),r?e.jsx("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-muted-foreground",children:r}):null]}),t?e.jsx("div",{className:"flex shrink-0 flex-wrap gap-2",children:t}):null]})}function b({title:s,description:r,actions:t,children:l,className:d,bodyClassName:m}){return e.jsxs(n,{className:a("p-0",d),children:[(s||r||t)&&e.jsxs("div",{className:"flex flex-col gap-3 border-b px-5 py-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[s?e.jsx("h2",{className:"text-sm font-semibold text-foreground",children:s}):null,r?e.jsx("p",{className:"mt-1 text-sm leading-5 text-muted-foreground",children:r}):null]}),t?e.jsx("div",{className:"flex shrink-0 flex-wrap gap-2",children:t}):null]}),e.jsx("div",{className:a("p-5",m),children:l})]})}const x={neutral:"border-border bg-muted text-muted-foreground",success:"border-primary/20 bg-primary/10 text-primary",warning:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-200",danger:"border-destructive/20 bg-destructive/10 text-destructive dark:text-red-200",info:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-400/20 dark:bg-blue-500/10 dark:text-blue-200"};function c({children:s,tone:r="neutral"}){return e.jsx("span",{className:a("inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-medium",x[r]),children:s})}export{o as P,b as S,c as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as jn,n as he,
|
|
1
|
+
import{c as jn,n as he,O as Y,j as S,r as p,g as vt}from"./index-DRJ5wgw_.js";import{c as ct,a as Je,r as lt,P as z,u as J,b as kt,d as yt,e as at,f as $,g as kn,h as Hn,i as Vn,R as Bn,F as Wn,D as Fn}from"./index-BlnvlekJ.js";import{a as St,C as $n}from"./chevron-down-Ca2FQDB7.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|