@shawnstack/quickforge 1.5.6 → 1.6.3
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 +19 -17
- package/dist/assets/AgentProfilesPage-BTWTENpJ.js +1 -0
- package/dist/assets/{ChatPanelHost-CBoFtBvB.js → ChatPanelHost-DBCQpcp1.js} +2 -2
- package/dist/assets/PluginsPage-DRbQLXc6.js +1 -0
- package/dist/assets/ScheduledTasksPage-_Te96TTL.js +2 -0
- package/dist/assets/SettingsWorkspacePage-B3KByRv9.js +1412 -0
- package/dist/assets/{SharedConversationPage-7I9MiMcj.js → SharedConversationPage-CJr-rzR4.js} +1 -1
- package/dist/assets/TerminalDock-DSsVoL0f.js +2 -0
- package/dist/assets/WorkspaceInspector-HuIqe-Y6.js +3 -0
- package/dist/assets/{WorkspaceReaderDialog-Dli8GgAq.js → WorkspaceReaderDialog-au2UL_Ti.js} +1 -1
- package/dist/assets/{diff-line-counts-Dvz3MNk2.js → diff-line-counts-CnZu37tM.js} +1 -1
- package/dist/assets/{icons-DXrzz0RO.js → icons-B0ihJZtt.js} +1 -1
- package/dist/assets/index-CTo6RkZO.js +63 -0
- package/dist/assets/index-hb3vYF5_.css +3 -0
- package/dist/assets/mcp-servers-dialog-1Y9X80tB.js +5 -0
- package/dist/assets/{monaco-k8av2MY0.js → monaco-BKEc9mhB.js} +1 -1
- package/dist/assets/{react-vendor-xMa3TUTb.js → react-vendor-EwqQ8x7m.js} +1 -1
- package/dist/assets/skills-dialog-vMwLkH49.js +1 -0
- package/dist/assets/{useAppTheme-BzB8Q6AC.js → useAppTheme-CG1_MfzA.js} +1 -1
- package/dist/index.html +6 -6
- package/package.json +4 -1
- package/server/agent-manager.mjs +3 -1
- package/server/index.mjs +4 -3
- package/server/routes/backup.mjs +80 -6
- package/server/routes/system.mjs +5 -0
- package/server/storage.mjs +6 -5
- package/server/utils/package-update.mjs +46 -0
- package/dist/assets/AgentProfilesPage-DFUA4KiP.js +0 -1
- package/dist/assets/PluginsPage-CKOP-P02.js +0 -1
- package/dist/assets/ScheduledTasksPage-CRPvyfmE.js +0 -2
- package/dist/assets/SettingsWorkspacePage-Csr6xu0M.js +0 -1320
- package/dist/assets/TerminalDock-DWZAOy7v.js +0 -2
- package/dist/assets/WorkspaceInspector-D4k8zQ4s.js +0 -3
- package/dist/assets/index-BDNDRaPf.css +0 -3
- package/dist/assets/index-BIslkXQt.js +0 -69
- package/dist/assets/mcp-servers-dialog-DXR3fnZY.js +0 -20
- package/dist/assets/skills-dialog-Dax-_Ze5.js +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# 速构 QuickForge
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img alt="Version" src="https://img.shields.io/badge/version-1.
|
|
4
|
+
<img alt="Version" src="https://img.shields.io/badge/version-1.6.3-blue" />
|
|
5
5
|
<img alt="License" src="https://img.shields.io/badge/license-MIT-green" />
|
|
6
|
-
<img alt="Node" src="https://img.shields.io/badge/node-%3E%
|
|
6
|
+
<img alt="Node" src="https://img.shields.io/badge/node-%3E%3D22.19-brightgreen" />
|
|
7
7
|
<img alt="React" src="https://img.shields.io/badge/react-19-61DAFB?logo=react" />
|
|
8
8
|
<img alt="Vite" src="https://img.shields.io/badge/vite-8-646CFF?logo=vite" />
|
|
9
9
|
</p>
|
|
@@ -73,7 +73,7 @@ QuickForge 的工具能力很直接,因此也需要谨慎使用:
|
|
|
73
73
|
#### 从 npm 安装
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
npm install -g @shawnstack/quickforge@1.
|
|
76
|
+
npm install -g @shawnstack/quickforge@1.6.3
|
|
77
77
|
qf
|
|
78
78
|
|
|
79
79
|
# CLI 工具
|
|
@@ -104,17 +104,17 @@ console.log(app.url)
|
|
|
104
104
|
当前版本的离线包:
|
|
105
105
|
|
|
106
106
|
```text
|
|
107
|
-
package-offline/shawnstack-quickforge-1.
|
|
107
|
+
package-offline/shawnstack-quickforge-1.6.3.tgz
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
在安装了 Node.js
|
|
110
|
+
在安装了 Node.js 22.19+ 和 npm 的机器上执行:
|
|
111
111
|
|
|
112
112
|
```bash
|
|
113
|
-
npm install -g ./package-offline/shawnstack-quickforge-1.
|
|
113
|
+
npm install -g ./package-offline/shawnstack-quickforge-1.6.3.tgz
|
|
114
114
|
qf
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
该包由 `v1.
|
|
117
|
+
该包由 `v1.6.3` 标签生成,包含 QuickForge 运行时资源,依赖由 npm 安装。
|
|
118
118
|
|
|
119
119
|
### 本地开发
|
|
120
120
|
|
|
@@ -161,7 +161,7 @@ npm run desktop:build:all
|
|
|
161
161
|
|
|
162
162
|
桌面端支持系统托盘:Windows 会显示在右下角系统托盘,macOS 会显示在顶部菜单栏。关闭窗口默认隐藏到托盘,使用托盘菜单中的退出操作才会真正退出并停止桌面端启动的本地服务。托盘菜单文案会优先跟随 QuickForge 设置中的界面语言(中文/英文),读取不到时回退系统语言。
|
|
163
163
|
|
|
164
|
-
GitHub Actions 提供 `Desktop Build` 工作流,可手动触发或在推送 `v*` 标签时按 Windows/macOS/Linux runner 分别构建桌面包,并上传为 workflow artifacts
|
|
164
|
+
GitHub Actions 提供 `Desktop Build` 工作流,可手动触发或在推送 `v*` 标签时按 Windows/macOS/Linux runner 分别构建桌面包,并上传为 workflow artifacts;推送 `v*` 标签触发时,构建成功后会自动创建 GitHub Release 并上传桌面构建产物,但不会发布 npm。
|
|
165
165
|
|
|
166
166
|
### 首次配置模型
|
|
167
167
|
|
|
@@ -186,7 +186,8 @@ API Key: 按你的 LiteLLM 配置填写,可为空
|
|
|
186
186
|
| `QUICKFORGE_DATA_DIR` | `~/.quickforge` | 数据目录 |
|
|
187
187
|
| `QUICKFORGE_WORKSPACE_DIR` | 项目根目录 | YOLO 工具默认工作区 |
|
|
188
188
|
| `QUICKFORGE_HOST` | `127.0.0.1` | 服务绑定地址 |
|
|
189
|
-
| `QUICKFORGE_PORT` | `32176`(dev)/ `5176`(prod) |
|
|
189
|
+
| `QUICKFORGE_PORT` | `32176`(dev)/ `5176`(prod) | 后端服务端口;`qf` / `quickforge` 默认使用生产端口 |
|
|
190
|
+
| `QUICKFORGE_DESKTOP_PORT` | `5177` | 桌面 app 服务端口;未设置时与 `qf` CLI 默认端口分离 |
|
|
190
191
|
| `QUICKFORGE_VITE_PORT` | `5176` | Vite 开发服务器端口 |
|
|
191
192
|
| `QUICKFORGE_MAX_BODY_BYTES` | `52428800` (50MB) | 请求体大小上限 |
|
|
192
193
|
|
|
@@ -285,7 +286,7 @@ QuickForge intentionally exposes powerful local capabilities, so the boundaries
|
|
|
285
286
|
#### npm
|
|
286
287
|
|
|
287
288
|
```bash
|
|
288
|
-
npm install -g @shawnstack/quickforge@1.
|
|
289
|
+
npm install -g @shawnstack/quickforge@1.6.3
|
|
289
290
|
qf
|
|
290
291
|
|
|
291
292
|
# CLI utilities
|
|
@@ -313,20 +314,20 @@ This entry is exposed through the `main` field in `package.json` and does not ch
|
|
|
313
314
|
|
|
314
315
|
#### Offline tarball
|
|
315
316
|
|
|
316
|
-
The offline release package for `v1.
|
|
317
|
+
The offline release package for `v1.6.3` is:
|
|
317
318
|
|
|
318
319
|
```text
|
|
319
|
-
package-offline/shawnstack-quickforge-1.
|
|
320
|
+
package-offline/shawnstack-quickforge-1.6.3.tgz
|
|
320
321
|
```
|
|
321
322
|
|
|
322
|
-
Install it on a machine with Node.js
|
|
323
|
+
Install it on a machine with Node.js 22.19+ and npm:
|
|
323
324
|
|
|
324
325
|
```bash
|
|
325
|
-
npm install -g ./package-offline/shawnstack-quickforge-1.
|
|
326
|
+
npm install -g ./package-offline/shawnstack-quickforge-1.6.3.tgz
|
|
326
327
|
qf
|
|
327
328
|
```
|
|
328
329
|
|
|
329
|
-
The package was generated from tag `v1.
|
|
330
|
+
The package was generated from tag `v1.6.3` and includes QuickForge runtime assets and installs dependencies with npm.
|
|
330
331
|
|
|
331
332
|
### Local development
|
|
332
333
|
|
|
@@ -373,7 +374,7 @@ Desktop artifacts are written to `desktop-dist/`. This directory and Electron de
|
|
|
373
374
|
|
|
374
375
|
The desktop app supports a system tray: Windows uses the bottom-right system tray and macOS uses the top menu bar. Closing the window hides it to the tray; use the quit action from the tray menu to fully exit and stop the local service started by the desktop app. Tray menu labels follow the QuickForge display language setting when available, and fall back to the system language.
|
|
375
376
|
|
|
376
|
-
GitHub Actions provides a `Desktop Build` workflow. It can be run manually or by pushing a `v*` tag, builds on Windows/macOS/Linux runners, and uploads workflow artifacts.
|
|
377
|
+
GitHub Actions provides a `Desktop Build` workflow. It can be run manually or by pushing a `v*` tag, builds on Windows/macOS/Linux runners, and uploads workflow artifacts. When triggered by a `v*` tag push, a successful build also creates a GitHub Release and uploads the desktop build assets, but it does not publish npm automatically.
|
|
377
378
|
|
|
378
379
|
### First model setup
|
|
379
380
|
|
|
@@ -398,7 +399,8 @@ You can also configure OpenRouter, DeepSeek, Ollama, or any other OpenAI-compati
|
|
|
398
399
|
| `QUICKFORGE_DATA_DIR` | `~/.quickforge` | Data directory |
|
|
399
400
|
| `QUICKFORGE_WORKSPACE_DIR` | project root | Default workspace for YOLO tools |
|
|
400
401
|
| `QUICKFORGE_HOST` | `127.0.0.1` | Server bind address |
|
|
401
|
-
| `QUICKFORGE_PORT` | `32176` (dev) / `5176` (prod) | Backend server port |
|
|
402
|
+
| `QUICKFORGE_PORT` | `32176` (dev) / `5176` (prod) | Backend server port; used by `qf` / `quickforge` by default |
|
|
403
|
+
| `QUICKFORGE_DESKTOP_PORT` | `5177` | Desktop app service port; separated from the default `qf` CLI port |
|
|
402
404
|
| `QUICKFORGE_VITE_PORT` | `5176` | Vite dev server port |
|
|
403
405
|
| `QUICKFORGE_MAX_BODY_BYTES` | `52428800` (50MB) | Max request body size |
|
|
404
406
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Et as t,Ot as n,T as r,a as i,c as a,it as o,jt as s}from"./icons-B0ihJZtt.js";import{n as c}from"./react-vendor-EwqQ8x7m.js";import{$ as l,G as u,H as d,K as f,M as p,Q as m,U as h,W as g,et as _,it as v}from"./index-CTo6RkZO.js";var y=e(s(),1),b=c();function x(){return{name:``,label:``,description:``,systemPrompt:``,allowedTools:[`read_file`,`grep_files`],maxRuntimeMs:`1800000`,maxToolCalls:`300`,enabledAsSubagent:!0}}function S(e){return{name:e.name,label:e.label,description:e.description??``,systemPrompt:e.systemPrompt??``,allowedTools:e.allowedTools??[],maxRuntimeMs:String(e.maxRuntimeMs??18e5),maxToolCalls:String(e.maxToolCalls??300),enabledAsSubagent:e.enabledAsSubagent}}function C(e){return{name:e.name.trim().toLowerCase(),label:e.label.trim(),description:e.description.trim(),systemPrompt:e.systemPrompt.trim(),allowedTools:e.allowedTools,maxRuntimeMs:Number(e.maxRuntimeMs||18e5),maxToolCalls:Number(e.maxToolCalls||300),enabledAsSubagent:e.enabledAsSubagent}}function w(e){return!!(e.name.trim()&&e.label.trim()&&e.allowedTools.length>0)}async function T(e,t){let n=await fetch(e,{...t,headers:{"content-type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`请求失败`);return r}function E(){let[e,s]=(0,y.useState)([]),[c,E]=(0,y.useState)([]),[D,O]=(0,y.useState)(!1),[k,A]=(0,y.useState)(null),[j,M]=(0,y.useState)(()=>x()),[N,P]=(0,y.useState)(!1),[F,I]=(0,y.useState)(``),[L,R]=(0,y.useState)(!1),[z,B]=(0,y.useState)(),[V,H]=(0,y.useState)(`off`),[U,W]=(0,y.useState)(``),[G,K]=(0,y.useState)(null);async function q(){let[e,t]=await Promise.all([T(`/api/agent-profiles`),T(`/api/agent-profiles/available-tools`)]);s(e.agents),E(t.tools)}(0,y.useEffect)(()=>{let e=!1;async function t(){try{let[t,n]=await Promise.all([T(`/api/agent-profiles`),T(`/api/agent-profiles/available-tools`)]);if(e)return;s(t.agents),E(n.tools)}catch(t){e||W(t instanceof Error?t.message:v(`requestFailed`))}}return t(),()=>{e=!0}},[]),(0,y.useEffect)(()=>{let e=!1;async function t(){try{let t=await g(),n=await h(t),r=await u(t),i=r.model??await f(t)??n[0];if(e)return;B(i),H(r.thinkingLevel??d(i))}catch{}}return t(),()=>{e=!0}},[]),(0,y.useEffect)(()=>{if(!G)return;let e=()=>K(null);return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e)}},[G]);let J=(0,y.useMemo)(()=>e.find(e=>e.id===k)??null,[e,k]);function Y(e,t){M(n=>({...n,[e]:t}))}function X(e){M(t=>({...t,allowedTools:t.allowedTools.includes(e)?t.allowedTools.filter(t=>t!==e):[...t.allowedTools,e]}))}function Z(){A(null),M(x()),I(``),W(``),O(!0)}function Q(e){A(e.id),M(S(e)),I(``),W(``),O(!0)}function $(){N||L||(O(!1),A(null),M(x()),I(``))}async function ee(){let e=F.trim();if(!e){W(v(`aiFillAgentInputRequired`));return}if(!z){W(v(`aiFillAgentNoModel`));return}R(!0),W(``);try{let t=await T(`/api/agent-profiles/ai-fill`,{method:`POST`,body:JSON.stringify({instruction:e,model:z,thinkingLevel:V})});M(e=>({...e,name:t.agent.name,label:t.agent.label,description:t.agent.description,systemPrompt:t.agent.systemPrompt}))}catch(e){W(e instanceof Error?e.message:v(`aiFillAgentFailed`))}finally{R(!1)}}async function te(){if(w(j)){P(!0),W(``);try{let e=C(j);k?await T(`/api/agent-profiles/${encodeURIComponent(k)}`,{method:`PATCH`,body:JSON.stringify(e)}):await T(`/api/agent-profiles`,{method:`POST`,body:JSON.stringify(e)}),$(),await q()}catch(e){W(e instanceof Error?e.message:v(`requestFailed`))}finally{P(!1)}}}async function ne(e){if(e.builtin||e.readonly)return;let t=!e.enabledAsSubagent,n=e.enabledAsSubagent;s(n=>n.map(n=>n.id===e.id?{...n,enabledAsSubagent:t}:n)),K(null);try{await T(`/api/agent-profiles/${encodeURIComponent(e.id)}`,{method:`PATCH`,body:JSON.stringify({enabledAsSubagent:t})})}catch(t){s(t=>t.map(t=>t.id===e.id?{...t,enabledAsSubagent:n}:t)),W(t instanceof Error?t.message:v(`requestFailed`))}}async function re(e){if(!(e.builtin||e.readonly)&&await p({description:v(`confirmDeleteAgent`),confirmLabel:v(`confirmDelete`),cancelLabel:v(`cancel`),variant:`destructive`})){W(``);try{await T(`/api/agent-profiles/${encodeURIComponent(e.id)}`,{method:`DELETE`}),await q()}catch(e){W(e instanceof Error?e.message:v(`requestFailed`))}}}return D?(0,b.jsxs)(`div`,{className:`quickforge-settings-stack`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-heading`,children:(0,b.jsxs)(`h3`,{className:`quickforge-settings-title`,children:[v(J?`editAgent`:`createAgent`),(0,b.jsx)(m,{label:J?.readonly?v(`builtinAgentReadonly`):v(`agentsDescription`)})]})}),(0,b.jsxs)(`section`,{className:`quickforge-settings-section`,"aria-label":v(J?`editAgent`:`createAgent`),children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-toolbar`,children:[(0,b.jsxs)(`button`,{className:`quickforge-settings-button quickforge-settings-button-secondary`,type:`button`,onClick:$,disabled:N||L,children:[(0,b.jsx)(n,{className:`mr-2 size-4`}),v(`back`)]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-row-title`,children:v(J?`editAgent`:`createAgent`)}),J?.readonly?(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:v(`builtinAgentReadonly`)}):null]})]}),(0,b.jsx)(`div`,{className:`px-5 py-4`,children:(0,b.jsxs)(`div`,{className:`space-y-4`,children:[(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border bg-muted/20 p-3`,children:[(0,b.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,b.jsx)(a,{className:`size-4 text-primary`}),v(`aiFillAgent`),(0,b.jsx)(m,{label:v(`aiFillAgentDescription`)})]}),(0,b.jsx)(`textarea`,{className:`min-h-20 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground/65 focus:border-ring disabled:opacity-60`,value:F,disabled:!!J?.readonly||L,onChange:e=>I(e.target.value),placeholder:v(`aiFillAgentPlaceholder`)}),(0,b.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,b.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>void ee(),disabled:!!J?.readonly||L||!F.trim(),children:[(0,b.jsx)(a,{className:`mr-1 size-3.5`}),v(L?`aiFillAgentLoading`:`aiFillAgent`)]})})]}),(0,b.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,b.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[v(`agentName`),(0,b.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:j.name,disabled:!!J?.readonly,onChange:e=>Y(`name`,e.target.value),placeholder:`reviewer`})]}),(0,b.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[v(`agentLabel`),(0,b.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:j.label,disabled:!!J?.readonly,onChange:e=>Y(`label`,e.target.value),placeholder:v(`agentLabelPlaceholder`)})]})]}),(0,b.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[v(`agentDescription`),(0,b.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:j.description,disabled:!!J?.readonly,onChange:e=>Y(`description`,e.target.value)})]}),(0,b.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[v(`agentSystemPrompt`),(0,b.jsx)(`textarea`,{className:`mt-1 min-h-36 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm outline-none focus:border-ring disabled:opacity-60`,value:j.systemPrompt,disabled:!!J?.readonly,onChange:e=>Y(`systemPrompt`,e.target.value)})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`mb-2 text-sm font-medium text-foreground`,children:v(`allowedTools`)}),(0,b.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:c.map(e=>(0,b.jsxs)(`label`,{className:`flex items-start gap-2 rounded-xl border border-border bg-muted/20 p-3 text-sm disabled:opacity-60`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-1`,disabled:!!J?.readonly,checked:j.allowedTools.includes(e.name),onChange:()=>X(e.name)}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label}),(0,b.jsx)(`span`,{className:`ml-2 font-mono text-xs text-muted-foreground`,children:e.name}),e.riskLevel===`dangerous`?(0,b.jsx)(`span`,{className:`ml-2 rounded-full bg-amber-500/10 px-2 py-0.5 text-xs text-amber-700`,children:v(`highRiskTool`)}):null,(0,b.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:e.description})]})]},e.name))})]}),(0,b.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,b.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[v(`maxRuntimeMs`),(0,b.jsx)(`input`,{type:`number`,className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:j.maxRuntimeMs,disabled:!!J?.readonly,onChange:e=>Y(`maxRuntimeMs`,e.target.value)})]}),(0,b.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[v(`maxToolCalls`),(0,b.jsx)(`input`,{type:`number`,className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:j.maxToolCalls,disabled:!!J?.readonly,onChange:e=>Y(`maxToolCalls`,e.target.value)})]})]}),(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:j.enabledAsSubagent,disabled:!!J?.readonly,onChange:e=>Y(`enabledAsSubagent`,e.target.checked)}),v(`enabledAsSubagent`)]}),U?(0,b.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:U}):null]})}),(0,b.jsxs)(`div`,{className:`quickforge-settings-divider flex justify-end gap-2 px-5 py-4`,children:[(0,b.jsx)(l,{variant:`outline`,onClick:$,disabled:N||L,children:v(`cancel`)}),(0,b.jsx)(l,{onClick:te,disabled:N||L||!!J?.readonly||!w(j),children:v(`save`)})]})]})]}):(0,b.jsx)(`div`,{className:`quickforge-settings-stack`,children:(0,b.jsxs)(`section`,{className:`quickforge-settings-section`,"aria-label":v(`agentsTab`),children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-toolbar`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,b.jsx)(t,{className:`size-4 text-primary`}),v(`agentsTab`)]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:v(`agentsDescription`)})]}),(0,b.jsx)(`button`,{className:`quickforge-settings-button quickforge-settings-button-primary`,type:`button`,onClick:Z,children:v(`createAgent`)})]}),U?(0,b.jsx)(`div`,{className:`quickforge-settings-alert quickforge-settings-warning-attached`,children:U}):null,e.length===0?(0,b.jsx)(`div`,{className:`quickforge-settings-empty-row`,children:v(`loading`)}):e.map(e=>(0,b.jsxs)(`div`,{className:`quickforge-settings-list-item`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-list-item-main`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[e.label,e.builtin?(0,b.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-info`,children:v(`builtinAgent`)}):null,(0,b.jsx)(`span`,{className:_(`quickforge-settings-badge`,e.enabledAsSubagent?`quickforge-settings-badge-success`:`quickforge-settings-badge-muted`),children:e.enabledAsSubagent?v(`enabled`):v(`disabled`)})]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-description quickforge-settings-mono`,children:e.name}),e.source&&!e.builtin?(0,b.jsxs)(`div`,{className:`quickforge-settings-row-description`,children:[e.source,e.relativePath?` · ${e.relativePath}`:``]}):null,(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:e.description||v(`noDescription`)}),(0,b.jsx)(`div`,{className:`quickforge-settings-meta`,children:e.allowedTools.map(e=>(0,b.jsx)(`code`,{className:`quickforge-settings-command-name`,children:e},e))}),(0,b.jsxs)(`div`,{className:`quickforge-settings-meta`,children:[(0,b.jsxs)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:[v(`maxRuntimeMs`),e.maxRuntimeMs??`-`]}),(0,b.jsxs)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:[v(`maxToolCalls`),e.maxToolCalls??`-`]})]})]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-list-item-actions`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`label`,{className:`quickforge-settings-switch`,"aria-disabled":e.builtin||e.readonly?`true`:`false`,title:e.enabledAsSubagent?v(`disableAsSubagent`):v(`enableAsSubagent`),children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:e.enabledAsSubagent,disabled:e.builtin||e.readonly,onChange:()=>void ne(e)}),(0,b.jsx)(`span`,{"aria-hidden":`true`})]}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(`button`,{className:`quickforge-settings-icon-action`,type:`button`,onClick:()=>K(G===e.id?null:e.id),title:v(`moreActions`),children:(0,b.jsx)(o,{className:`size-4`})}),G===e.id?(0,b.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 w-36 overflow-hidden rounded-xl border border-border bg-popover py-1 text-sm shadow-quickforge`,children:[(0,b.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:e.builtin||e.readonly,onClick:()=>{K(null),Q(e)},children:[(0,b.jsx)(r,{className:`size-3.5`}),v(`editTask`)]}),(0,b.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left text-destructive hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:e.builtin||e.readonly,onClick:()=>{K(null),re(e)},children:[(0,b.jsx)(i,{className:`size-3.5`}),v(`delete`)]})]}):null]})]})]},e.id))]})})}export{E as AgentProfilesPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{V as t,jt as n}from"./icons-B0ihJZtt.js";import{n as r,t as i}from"./react-vendor-EwqQ8x7m.js";import{d as a,p as o,t as s}from"./lit-vendor-Dr3cpBGF.js";import{c,o as l,s as u}from"./pi-web-ui-DFNE2m5b.js";import{t as d}from"./logger-B65Akg8A.js";import{F as f,L as p,N as m,O as h,P as g,c as _,it as v,r as y}from"./index-CTo6RkZO.js";import{t as b}from"./plugin-api-UKg_cgSG.js";var x=e(n(),1),S={maxHeight:`28rem`,overflow:`auto`,border:`1px solid color-mix(in oklab, var(--border) 75%, transparent)`,borderRadius:`0.75rem`,background:`color-mix(in oklab, var(--muted) 28%, transparent)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace`,fontSize:`0.78rem`,lineHeight:`1.45`},C={minHeight:`1.35em`,padding:`0 0.75rem`,whiteSpace:`pre`},w={display:`inline-flex`,alignItems:`center`,borderRadius:`999px`,padding:`0.05rem 0.45rem`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace`,fontSize:`0.72rem`,fontWeight:`650`};function T(e){if(e==null)return``;if(typeof e==`string`)try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}try{return JSON.stringify(e,null,2)}catch{return String(e)}}function E(e){return e?.content?.filter(e=>e.type===`text`).map(e=>e.text??``).join(`
|
|
2
2
|
`)??``}function D(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function O(e,t){if(e.running===!0||t)return`Status: running`;let n=[e.timedOut?`timed out`:null,e.aborted?`aborted`:null].filter(Boolean),r=n.length?` (${n.join(`, `)})`:``;return`Exit code: ${e.code??`unknown`}${typeof e.signal==`string`&&e.signal?`, signal: ${e.signal}`:``}${r}`}function k(e,t,n){let r=D(t)?t:void 0,i=typeof r?.command==`string`?r.command:typeof e?.command==`string`?e.command:``;if(!i||!r)return``;let a=typeof r?.stdout_preview==`string`?r.stdout_preview:typeof r?.stdout==`string`?r.stdout:``,o=typeof r?.stderr_preview==`string`?r.stderr_preview:typeof r?.stderr==`string`?r.stderr:``,s=!!(a||o),c=r.running===!0||r.code!==void 0||r.signal!==void 0||r.timedOut===!0||r.aborted===!0;return!s&&!c&&!n?``:[`Command: ${i}`,O(r,n),``,`STDOUT:`,a||`(empty)`,``,`STDERR:`,o||`(empty)`].join(`
|
|
3
3
|
`)}function A(e,t,n,r){return E(n)||(e===`run_command`?k(t,n?.details,r):``)}function j(e,t){return D(e)&&typeof e[t]==`string`?e[t]:``}function M(e,t,n){if(!t&&!n?.details)return``;if(e===`run_command`&&typeof t?.command==`string`)return t.command;if(e===`present_files`){let e=(Array.isArray(t?.files)?t.files:Array.isArray(n?.details&&n.details.files)?(n?.details).files:[]).map(e=>typeof e==`string`?e:D(e)&&typeof e.path==`string`?e.path:``).filter(Boolean);return e.length?e.slice(0,3).join(`, `)+(e.length>3?` +${e.length-3}`:``):``}if(e===`grep_files`){let e=typeof t?.query==`string`&&t.query?t.query:j(n?.details,`query`),r=typeof t?.path==`string`&&t.path?t.path:j(n?.details,`path`)||`.`,i=t?.regex||D(n?.details)&&D(n.details.searchOptions)&&n.details.searchOptions.regex?`regex`:`text`,a=r&&r!==`.`?` in ${r}`:` in current workspace`;return e?`${i}: ${e}${a}`:`searching${a}`}return e===`activate_skill`&&typeof t?.name==`string`?t.name:e===`read_skill_resource`&&typeof t?.path==`string`||t&&`path`in t&&typeof t.path==`string`?t.path:t&&`query`in t&&typeof t.query==`string`?t.query:t&&`search_query`in t&&typeof t.search_query==`string`?t.search_query:``}function ee(e){if(!e||typeof e!=`object`)return;let t=e.diff;if(!t||typeof t!=`object`)return;let n=t;return typeof n.text==`string`?n:void 0}function te(e){if(!e||typeof e!=`object`)return e;let t=e,n=t.diff;if(!n||typeof n!=`object`)return e;let{text:r,...i}=n;return{...t,diff:i}}function N(e){if(!e||typeof e!=`object`)return{};let t=e;return{sessionId:typeof t.sessionId==`string`?t.sessionId:void 0,toolCallId:typeof t.toolCallId==`string`?t.toolCallId:void 0}}async function ne(e,t,n){let r=n.getAttribute(`aria-label`)||v(`terminateCommand`);n.disabled=!0,n.setAttribute(`aria-label`,v(`commandTerminateRequested`)),n.setAttribute(`title`,v(`commandTerminateRequested`));try{let n=await fetch(`/api/agents/${encodeURIComponent(e)}/abort-tool`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({toolCallId:t})});if(!n.ok)throw Error(`HTTP ${n.status}`)}catch{n.disabled=!1,n.setAttribute(`aria-label`,r),n.setAttribute(`title`,v(`terminateCommandTitle`))}}function re(e){return e.startsWith(`+++`)||e.startsWith(`---`)?`quickforge-diff-file`:e.startsWith(`@@`)?`quickforge-diff-hunk`:e.startsWith(`+`)?`quickforge-diff-add`:e.startsWith(`-`)?`quickforge-diff-del`:`quickforge-diff-context`}function P(e){return e.startsWith(`+++`)||e.startsWith(`---`)?{...C,background:`color-mix(in oklab, var(--muted) 48%, transparent)`,color:`color-mix(in oklab, var(--muted-foreground) 88%, transparent)`}:e.startsWith(`@@`)?{...C,background:`color-mix(in oklab, rgb(37 99 235) 10%, transparent)`,color:`rgb(37 99 235)`}:e.startsWith(`+`)?{...C,background:`color-mix(in oklab, rgb(34 197 94) 16%, transparent)`,color:`rgb(22 101 52)`}:e.startsWith(`-`)?{...C,background:`color-mix(in oklab, rgb(239 68 68) 14%, transparent)`,color:`rgb(153 27 27)`}:{...C,color:`var(--foreground)`}}function ie(e,t){if(e!==`write_file`&&e!==`edit_file`||!t)return a;let n=Number(t.addedLines??0),r=Number(t.removedLines??0);return o`
|
|
4
4
|
<span class="shrink-0 inline-flex items-center gap-1" title="+${n} -${r}">
|
|
@@ -163,7 +163,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t,B as n}from"./
|
|
|
163
163
|
<span class="quickforge-capability-suggestion-description"></span>
|
|
164
164
|
</span>
|
|
165
165
|
`,t.querySelector(`.quickforge-capability-suggestion-name`).textContent=e.label,t.querySelector(`.quickforge-capability-suggestion-description`).textContent=e.description??e.pluginName,t.onpointerdown=t=>{t.preventDefault(),t.stopPropagation(),d(e,o)},h.append(t)}l||n.parentElement?.insertBefore(h,n),h.__quickforgeDismissHandler||(h.__quickforgeDismissHandler=e=>{h.contains(e.target)||n.contains(e.target)||u()},document.addEventListener(`pointerdown`,h.__quickforgeDismissHandler,!0))};return{update:p,remove:u,setupTextareaHandler:e=>{let t=e?.querySelector(`textarea`);if(!t)return;let n=t;n.__quickforgeCapabilityCompleteHandler&&n.removeEventListener(`keydown`,n.__quickforgeCapabilityCompleteHandler,!0),n.__quickforgeCapabilityCompleteHandler=t=>{if(t.isComposing||t.key===`Process`)return;if(t.key===`Escape`){u();return}if(t.key!==`Tab`&&t.key!==`Enter`)return;let r=e?.value??n.value??``,i=He(r,n.selectionStart??r.length);if(!i||t.shiftKey)return;let a=l();a&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),d(a,i))},n.addEventListener(`keydown`,n.__quickforgeCapabilityCompleteHandler,!0)},cleanupTextareaHandler:()=>{let t=e.querySelector(`message-editor textarea`);t?.__quickforgeCapabilityCompleteHandler&&t.removeEventListener(`keydown`,t.__quickforgeCapabilityCompleteHandler,!0)},consumeSelectedCapabilities:e=>{let t=Ue(e),n=[...a.values()].filter(e=>t.has(e.mention.toLowerCase())),r=c().filter(e=>t.has(e.insertText.toLowerCase())||t.has(e.label.replace(/\s+/g,``).toLowerCase())),i=new Map;for(let e of[...n,...r])i.set(Ge(e),e);return a=new Map,o(),[...i.values()].slice(0,4)},insertBuiltinPluginMention:f}}function Ge(e){return`${e.type}:${e.pluginName}:${e.name}`}var Ke=i();function qe(e){return`hsl(${Math.round(142-142*Math.min(100,Math.max(0,e))/100)} 72% 45%)`}function Je(e,t){let n=Number(e.inputTokens)||0,r=Math.max(0,Number(e.knownInputTokens??e.providerContextTokens)||0),i=Math.max(0,Number(e.estimatedInputTokens)||0),a=Math.max(0,Number(e.reservedOutputTokens)||0),o=Math.max(0,Number(e.totalTokens)||n+a),s=Number.isFinite(Number(e.percent))?Number(e.percent):0,c=e.inputTokenSource??(r>0?`provider`:`estimated`);return{contextWindow:Math.max(0,Number(e.contextWindow)||t),usedTokens:Math.max(0,Number(e.usedTokens)||n),totalTokens:o,inputTokens:n,estimatedInputTokens:i,knownInputTokens:r,inputTokenSource:c,reservedOutputTokens:a,percent:s,color:e.color||qe(s),isCompacted:e.isCompacted,compactedUpToIndex:e.compactedUpToIndex,originalMessageCount:e.originalMessageCount,effectiveMessageCount:e.effectiveMessageCount,breakdown:e.breakdown}}function Ye(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Xe(e){let t=Math.max(0,Number(e)||0);return t>0?J(t):null}function Ze({usage:e,contextWindow:t,serverCalculated:n,compacted:r}){let i=e.inputTokenSource===`provider`?`provider context`:e.inputTokenSource===`mixed`?`provider/local mixed context`:`estimated context`,a=[`Context used: ${e.percent}% (${J(e.totalTokens)} / ${J(t)} tokens)`,`Input/context: ${J(e.inputTokens)} (${i})`,`Local estimate: ${J(e.estimatedInputTokens)}`],o=e.breakdown;return o&&(a.push(` System prompt: ${Xe(o.systemPromptTokens)??`0`}`,` Tools schema: ${Xe(o.toolsTokens)??`0`}`,` Messages: ${Xe(o.messagesTokens)??`0`}`),(o.providerUsageTokens||o.trailingTokens)&&a.push(` Provider usage baseline: ${Xe(o.providerUsageTokens)??`0`}`,` Trailing messages after usage: ${Xe(o.trailingTokens)??`0`}`)),a.push(`Reserved output: ${J(e.reservedOutputTokens)}`),n&&a.push(`Source: server calculated via pi-agent-core/pi-ai`),a.push(r?`Scope: compacted model context, not full visible chat history`:`Scope: full model context`),r&&e.originalMessageCount!==void 0&&e.effectiveMessageCount!==void 0&&a.push(`Messages: ${e.effectiveMessageCount} effective / ${e.originalMessageCount} visible`),e.knownInputTokens&&e.knownInputTokens>0&&a.push(`Provider context tokens: ${J(e.knownInputTokens)}`),a.join(`
|
|
166
|
-
`)}function Qe(e,t){if(!t){e.removeAttribute(`role`),e.removeAttribute(`tabindex`),e.style.cursor=``;return}e.setAttribute(`role`,`button`),e.tabIndex=0,e.style.cursor=`pointer`,!e.dataset.quickforgeGitBranchBound&&(e.dataset.quickforgeGitBranchBound=`true`,e.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),t()}),e.addEventListener(`keydown`,e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),e.stopPropagation(),t())}))}var $e=(0,Ke.renderToStaticMarkup)((0,x.createElement)(
|
|
166
|
+
`)}function Qe(e,t){if(!t){e.removeAttribute(`role`),e.removeAttribute(`tabindex`),e.style.cursor=``;return}e.setAttribute(`role`,`button`),e.tabIndex=0,e.style.cursor=`pointer`,!e.dataset.quickforgeGitBranchBound&&(e.dataset.quickforgeGitBranchBound=`true`,e.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),t()}),e.addEventListener(`keydown`,e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),e.stopPropagation(),t())}))}var $e=(0,Ke.renderToStaticMarkup)((0,x.createElement)(t,{size:13,strokeWidth:2,"aria-hidden":!0,style:{flex:`0 0 auto`}}));function et({panel:e,getSystemPrompt:t,getMessages:n,getContextWindow:r,getTools:i,getMaxTokens:a,getEffectiveMessages:o,getServerContextUsage:s,getGitBranch:c,onGitBranchClick:l,renderInline:u=!0,onDisplayChange:d}){return{update:()=>{let f=r(),p=n(),m=o?.()??p,h=e.querySelector(`.quickforge-context-usage`),g=e.querySelector(`.quickforge-context-usage-label`),_=e.querySelector(`.quickforge-git-branch-inline`),v=u?e.querySelector(`message-editor`)?.parentElement?.querySelector(`.ml-auto.items-center`):null,y=c?.()?.trim()||void 0,b={gitBranch:y};if(!u)_?.remove(),h?.remove(),g?.remove();else if(y&&v){let e=`${$e}<span style="max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">${Ye(y)}</span>`,t=`Git branch: ${y}`;if(_)_.dataset.quickforgeGitBranch!==y&&(_.innerHTML=e,_.dataset.quickforgeGitBranch=y),_.title=t,_.setAttribute(`aria-label`,t),Qe(_,l);else{let n=document.createElement(`span`);n.className=`quickforge-git-branch-inline`,n.dataset.quickforgeGitBranch=y,n.title=t,n.setAttribute(`aria-label`,t),n.innerHTML=e,n.style.cssText=[`display: inline-flex`,`align-items: center`,`gap: 0.25rem`,`max-width: 10rem`,`color: hsl(var(--muted-foreground))`,`font-size: 12px`,`line-height: 1`,`font-weight: 500`].join(`;`),Qe(n,l),v.prepend(n)}}else _?.remove();if(!f)return u&&(h?.remove(),g?.remove()),d?.(b),b;let x=s?.(),S=m.length>0,C=x?Je(x,f):S?Pe(t(),m,f,i?.()??[],a?.()):{contextWindow:f,usedTokens:0,totalTokens:0,inputTokens:0,estimatedInputTokens:0,inputTokenSource:`estimated`,reservedOutputTokens:0,percent:0,color:`hsl(142 72% 45%)`},w=C.contextWindow||f,T=!!C.isCompacted||m!==p,E=Ze({usage:C,contextWindow:w,serverCalculated:!!x,compacted:T});if(b.context={percent:C.percent,color:C.color,label:`${C.percent}% · ${J(C.totalTokens)} / ${J(w)} tokens`,title:E},d?.(b),!u||!v)return h?.remove(),g?.remove(),b;let D=Math.min(100,Math.max(0,C.percent)),O=`conic-gradient(${C.color} ${D*3.6}deg, rgb(229 231 235) 0deg)`,k=h??document.createElement(`span`);k.className=`quickforge-context-usage`,k.title=E,k.setAttribute(`aria-label`,E),k.style.cssText=[`position: relative`,`display: inline-flex`,`width: 14px`,`height: 14px`,`flex: 0 0 auto`,`border-radius: 9999px`,`background: ${O}`,`vertical-align: middle`,`box-shadow: 0 0 0 1px rgb(0 0 0 / 0.06)`].join(`;`);let A=k.firstElementChild;A||(A=document.createElement(`span`),k.append(A)),A.style.cssText=[`position: absolute`,`inset: 3px`,`border-radius: 9999px`,`background: hsl(var(--background))`].join(`;`);let j=k.nextElementSibling;return j?.classList.contains(`quickforge-context-usage-label`)||(j=document.createElement(`span`),j.className=`quickforge-context-usage-label`,j.style.cssText=`color: hsl(var(--muted-foreground)); font-size: 12px; line-height: 1;`),j.textContent=`${C.percent}%`,j.title=E,j.setAttribute(`aria-label`,E),h?k.nextElementSibling!==j&&k.after(j):(v.prepend(j),v.prepend(k)),b}}}var tt=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,nt=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>`,rt=`<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 0 11H11"/></svg>`,it=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><circle cx="18" cy="6" r="3"/><path d="M18 9v1a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V9"/><path d="M12 12v3"/></svg>`,at=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 2v6h-6"/><path d="M3 12a9 9 0 0 1 15.36-5.64L21 9"/><path d="M3 22v-6h6"/><path d="M21 12a9 9 0 0 1-15.36 5.64L3 15"/></svg>`,ot=`<svg class="quickforge-plan-mode-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6h1"/><path d="M4 12h1"/><path d="M4 18h1"/><path d="M9 6h11"/><path d="M9 12h11"/><path d="M9 18h11"/></svg>`,st=`<svg class="quickforge-plan-remove-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,ct=`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14"/><path d="M5 12h14"/></svg>`,lt=`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,ut=`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7.5 4.5h5a1.5 1.5 0 0 1 1.5 1.5v2h1a2.5 2.5 0 0 1 0 5h-1v2a1.5 1.5 0 0 1-1.5 1.5h-2v1a2.5 2.5 0 0 1-5 0v-1h-2A1.5 1.5 0 0 1 2 15.5v-3h1a2 2 0 1 0 0-4H2v-2A1.5 1.5 0 0 1 3.5 5h2v-1a2.5 2.5 0 0 1 5 0v.5Z"/></svg>`,dt=`<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 2.8h6.1L15.8 7v10.2H5.4z"/><path d="M11.4 2.9V7h4.1"/><path d="M7.6 10.2h5"/><path d="M7.6 13h4.3"/></svg>`,ft=`<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><rect x="3.4" y="4" width="13.2" height="12.2" rx="1.5"/><path d="M3.4 8h13.2"/><path d="M7.8 4v12.2"/><path d="M12.2 4v12.2"/><path d="M3.4 12h13.2"/></svg>`,pt=`<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="M3 4.2h14"/><rect x="4.2" y="4.2" width="11.6" height="8.4" rx="1.2"/><path d="M10 12.6v3.2"/><path d="m7.2 17 2.8-1.2 2.8 1.2"/><path d="M7.1 9.5 9 7.7l1.5 1.3 2.4-2.5"/></svg>`,mt=`<svg class="quickforge-agent-access-trigger-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3 19 6v5c0 4.5-2.8 8.4-7 10-4.2-1.6-7-5.5-7-10V6l7-3Z"/><path d="M9 12h6"/></svg>`,ht=`<svg class="quickforge-agent-access-option-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>`,gt=`<svg class="quickforge-agent-access-check" xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>`,_t=`<svg class="quickforge-agent-access-chevron" xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>`;function vt(e){return v(e===`full-access`?`agentAccessFullLabel`:`agentAccessDefaultLabel`)}function yt(e){let t=document.querySelector(`.quickforge-agent-access-menu`);t?.__quickforgeDismissHandler&&(document.removeEventListener(`pointerdown`,t.__quickforgeDismissHandler,!0),document.removeEventListener(`keydown`,t.__quickforgeDismissHandler,!0),window.removeEventListener(`resize`,t.__quickforgeDismissHandler,!0),window.removeEventListener(`scroll`,t.__quickforgeDismissHandler,!0),t.__quickforgeDismissHandler=void 0),t?.remove(),e.querySelector(`.quickforge-agent-access-inline`)?.setAttribute(`aria-expanded`,`false`)}function bt(e,t,n){let r=e===t,i=document.createElement(`button`);return i.type=`button`,i.className=`quickforge-agent-access-item`,i.setAttribute(`role`,`menuitemradio`),i.setAttribute(`aria-checked`,String(r)),i.dataset.quickforgeAgentAccessMode=e,i.innerHTML=`
|
|
167
167
|
<span class="quickforge-agent-access-check-slot">${r?gt:``}</span>
|
|
168
168
|
<span class="quickforge-agent-access-option-icon-wrap">${e===`full-access`?ht:mt}</span>
|
|
169
169
|
<span class="quickforge-agent-access-item-label"></span>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{L as t,b as n,i as r,jt as i,r as a,u as o,xt as s,y as c}from"./icons-B0ihJZtt.js";import{n as l}from"./react-vendor-EwqQ8x7m.js";import{et as u,it as d}from"./index-CTo6RkZO.js";import{n as f,r as p,t as m}from"./plugin-api-UKg_cgSG.js";var h=e(i(),1),g=l();function _(e){return e===`loaded`?`quickforge-settings-badge-success`:e===`error`?`quickforge-settings-badge-danger`:`quickforge-settings-badge-muted`}function v(e){return e===`loaded`?d(`pluginStatusLoaded`):e===`disabled`?d(`pluginStatusDisabled`):e===`error`?d(`pluginStatusError`):e}function y(e){switch(e){case`openai-documents`:return{label:d(`pluginOpenaiDocumentsName`),description:d(`pluginOpenaiDocumentsDescription`)};case`openai-spreadsheets`:return{label:d(`pluginOpenaiSpreadsheetsName`),description:d(`pluginOpenaiSpreadsheetsDescription`)};case`openai-presentations`:return{label:d(`pluginOpenaiPresentationsName`),description:d(`pluginOpenaiPresentationsDescription`)};default:return null}}function b(e){return y(e.name)?.label||(e.displayName||e.name).replace(/^OpenAI\s+/i,``)}function x(e){return y(e.name)?.description||e.description||d(`noDescription`)}function S(e){return(e.label||e.name||e.quickForgeName).replace(/^OpenAI\s+/i,``)}function C({onChanged:e}){let[i,l]=(0,h.useState)(null),[y,C]=(0,h.useState)(!0),[w,T]=(0,h.useState)(null),[E,D]=(0,h.useState)(()=>new Set),[O,k]=(0,h.useState)(null),A=(0,h.useCallback)(async(t=`load`)=>{k(null),C(!0);try{l(t===`reload`?await f():await m()),t===`reload`&&e?.()}catch(e){k(e instanceof Error?e.message:d(`pluginsLoadFailed`))}finally{C(!1)}},[e]);(0,h.useEffect)(()=>{let e=!1;return m().then(t=>{e||l(t)}).catch(t=>{e||k(t instanceof Error?t.message:d(`pluginsLoadFailed`))}).finally(()=>{e||C(!1)}),()=>{e=!0}},[]);let j=(0,h.useMemo)(()=>{let e=i?.plugins||[];return{total:e.length,enabled:e.filter(e=>e.enabled).length,tools:e.reduce((e,t)=>e+t.tools.length,0)}},[i]),M=(0,h.useMemo)(()=>i?.plugins||[],[i]),N=(0,h.useCallback)(e=>{D(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),P=async(t,n)=>{T(t),k(null);try{l(await p(t,n)),e?.()}catch(e){k(e instanceof Error?e.message:d(`pluginsSaveFailed`))}finally{T(null)}};return(0,g.jsx)(`div`,{className:`quickforge-settings-stack`,children:(0,g.jsxs)(`section`,{className:`quickforge-settings-section`,"aria-label":d(`plugins`),children:[(0,g.jsxs)(`div`,{className:`quickforge-settings-toolbar`,children:[(0,g.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,g.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,g.jsx)(n,{className:`size-4 text-primary`}),d(`plugins`)]}),(0,g.jsx)(`div`,{className:`quickforge-settings-row-description`,children:d(`pluginsDescription`)}),(0,g.jsxs)(`div`,{className:`quickforge-settings-meta`,children:[(0,g.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:d(`pluginsCount`,j)}),(0,g.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-info`,children:d(`pluginToolsCount`,{count:j.tools})})]})]}),(0,g.jsxs)(`button`,{className:`quickforge-settings-button quickforge-settings-button-secondary`,type:`button`,onClick:()=>void A(`reload`),disabled:y,children:[y?(0,g.jsx)(t,{className:`mr-2 size-4 animate-spin`}):(0,g.jsx)(c,{className:`mr-2 size-4`}),d(`pluginsReload`)]})]}),O?(0,g.jsx)(`div`,{className:`quickforge-settings-alert quickforge-settings-warning-attached`,children:O}):null,i?.errors?.length?(0,g.jsxs)(`div`,{className:`quickforge-settings-warning quickforge-settings-warning-attached`,children:[(0,g.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-2 font-medium`,children:[(0,g.jsx)(r,{className:`size-4`}),d(`pluginDiscoveryErrors`)]}),i.errors.map((e,t)=>(0,g.jsxs)(`div`,{className:`break-all text-sm`,children:[(0,g.jsx)(`code`,{className:`quickforge-settings-command-name`,children:e.dir}),`: `,e.error]},`${e.dir}-${t}`))]}):null,y&&!i?(0,g.jsxs)(`div`,{className:`quickforge-settings-empty-row inline-flex items-center gap-2`,children:[(0,g.jsx)(t,{className:`size-4 animate-spin`}),d(`loadingPlugins`)]}):null,!y&&i&&i.plugins.length===0?(0,g.jsxs)(`div`,{className:`quickforge-settings-empty-row`,children:[(0,g.jsx)(`div`,{className:`quickforge-settings-row-title`,children:d(`noPlugins`)}),(0,g.jsx)(`div`,{className:`quickforge-settings-row-description`,children:d(`noPluginsDescription`)}),(0,g.jsx)(`div`,{className:`quickforge-settings-meta`,children:(i.searchPaths||[]).map(e=>(0,g.jsx)(`code`,{className:`quickforge-settings-command-name`,children:e},e))})]}):null,M.map(e=>{let t=E.has(e.name);return(0,g.jsxs)(`article`,{className:`quickforge-settings-list-item quickforge-settings-list-item--column`,children:[(0,g.jsxs)(`div`,{className:`quickforge-settings-list-item-header`,children:[(0,g.jsxs)(`button`,{type:`button`,className:`quickforge-settings-expand-toggle`,onClick:()=>N(e.name),"aria-expanded":t,children:[(0,g.jsx)(s,{className:u(`quickforge-settings-expand-chevron size-4`,t&&`rotate-90`)}),(0,g.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,g.jsxs)(`span`,{className:`quickforge-settings-row-title`,children:[b(e),(0,g.jsxs)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:[`v`,e.version]}),(0,g.jsx)(`span`,{className:u(`quickforge-settings-badge`,_(e.status)),children:v(e.status)})]}),(0,g.jsx)(`span`,{className:`quickforge-settings-row-description`,children:x(e)}),e.error?(0,g.jsx)(`span`,{className:`quickforge-settings-alert mt-3 block`,children:e.error}):null,(0,g.jsxs)(`span`,{className:`quickforge-settings-meta`,children:[(0,g.jsxs)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:[(0,g.jsx)(a,{className:`size-3`}),d(`pluginToolsCount`,{count:e.tools.length})]}),(0,g.jsxs)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:[(0,g.jsx)(o,{className:`size-3`}),d(`pluginPermissionsCount`,{count:e.permissions.length})]}),(0,g.jsx)(`span`,{className:u(`quickforge-settings-badge`,e.enabled?`quickforge-settings-badge-success`:`quickforge-settings-badge-muted`),children:e.enabled?d(`enabled`):d(`disabled`)})]})]})]}),(0,g.jsx)(`div`,{className:`quickforge-settings-list-item-actions`,onClick:e=>e.stopPropagation(),children:(0,g.jsxs)(`label`,{className:`quickforge-settings-switch`,"aria-disabled":w===e.name?`true`:`false`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:e.enabled,disabled:w===e.name,onChange:t=>void P(e.name,t.target.checked)}),(0,g.jsx)(`span`,{"aria-hidden":`true`})]})})]}),t?(0,g.jsxs)(`div`,{className:`border-t border-border/60`,children:[(0,g.jsx)(`div`,{className:`quickforge-settings-row quickforge-settings-row-top`,children:(0,g.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,g.jsx)(a,{className:`size-4 text-muted-foreground`}),d(`pluginTools`)]})}),(0,g.jsx)(`div`,{className:`quickforge-settings-nested-list`,children:e.tools.length?e.tools.map(e=>(0,g.jsx)(`div`,{className:`quickforge-settings-subrow`,children:(0,g.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,g.jsx)(`div`,{className:`quickforge-settings-row-title`,children:S(e)}),e.description?(0,g.jsx)(`div`,{className:`quickforge-settings-row-description`,children:e.description}):null]})},e.quickForgeName)):(0,g.jsx)(`div`,{className:`quickforge-settings-empty-row`,children:d(`pluginNoTools`)})}),(0,g.jsx)(`div`,{className:`quickforge-settings-row quickforge-settings-row-top`,children:(0,g.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,g.jsx)(o,{className:`size-4 text-muted-foreground`}),d(`pluginPermissions`)]})}),(0,g.jsxs)(`div`,{className:`p-4`,children:[e.permissions.length?(0,g.jsx)(`div`,{className:`quickforge-settings-meta`,children:e.permissions.map(e=>(0,g.jsx)(`code`,{className:`quickforge-settings-command-name`,children:e},e))}):(0,g.jsx)(`div`,{className:`quickforge-settings-empty-row`,children:d(`pluginNoPermissions`)}),(0,g.jsx)(`div`,{className:`quickforge-settings-row-description mt-3`,children:d(`pluginTrustedNotice`)})]})]}):null]},e.name)})]})})}export{C as PluginsPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Et as t,Ot as n,T as r,Tt as i,U as a,a as ee,c as te,ft as ne,g as re,it as ie,jt as o,mt as ae,nt as oe,t as se}from"./icons-B0ihJZtt.js";import{n as s}from"./react-vendor-EwqQ8x7m.js";import{$ as c,G as ce,H as le,K as ue,M as de,Q as fe,U as pe,W as me,et as l,it as u}from"./index-CTo6RkZO.js";var d=e(o(),1),f=s(),he=[{value:`off`,label:()=>u(`thinkingOff`)},{value:`low`,label:()=>u(`thinkingLow`)},{value:`medium`,label:()=>u(`thinkingMedium`)},{value:`high`,label:()=>u(`thinkingHigh`)},{value:`xhigh`,label:()=>u(`thinkingXHigh`)}];function ge(e){return`${e.provider} / ${e.id}`}function _e(e,t){return!!(e&&t&&e.api===t.api&&e.provider===t.provider&&e.id===t.id)}function p(e){return String(e).padStart(2,`0`)}function m(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?`-`:`${t.getFullYear()}-${p(t.getMonth()+1)}-${p(t.getDate())} ${p(t.getHours())}:${p(t.getMinutes())}`}function ve(e,t=20){let n=String(e||``).trim();return n.length>t?`${n.slice(0,t)}...`:n}function ye(){return{scheduleText:``,title:``,instruction:``,cronExpression:``,scheduleRule:``,nextRunAt:``,enabled:!0,agentId:``,executionMode:`serial`}}function h(){return{taskId:``,status:``,trigger:``,keyword:``,startedFrom:``,startedTo:``,page:1,pageSize:10}}function be(e){return{scheduleText:[e.scheduleRule,e.instruction].filter(Boolean).join(`
|
|
2
|
+
`),title:e.title,instruction:e.instruction,cronExpression:e.cronExpression??``,scheduleRule:e.scheduleRule,nextRunAt:e.nextRunAt,enabled:e.status!==`paused`,agentId:e.agentId??``,executionMode:e.executionMode??`serial`}}function xe(e,t){return{...t,title:e.title,instruction:e.instruction,cronExpression:e.cronExpression??``,scheduleRule:e.scheduleRule,nextRunAt:e.nextRunAt,enabled:t.enabled}}function Se(e){return{title:e.title.trim(),instruction:e.instruction.trim(),scheduleType:`cron`,scheduleRule:e.scheduleRule.trim()||e.cronExpression.trim(),cronExpression:e.cronExpression.trim(),nextRunAt:e.nextRunAt,enabled:e.enabled,agentId:e.agentId||null,executionMode:e.executionMode}}function g(e){return!!(e.currentRunId||e.currentRunIds?.length)}function Ce(e){return(e.executionMode??`serial`)===`parallel`||!g(e)}function we(e){return u(e===`parallel`?`taskExecutionModeParallel`:`taskExecutionModeSerial`)}function Te(e){return!!(e.title.trim()&&e.instruction.trim()&&e.cronExpression.trim())}function Ee(e){return u(e===`enabled`?`taskEnabled`:e===`running`?`taskRunning`:e===`paused`?`taskPaused`:e===`completed`?`taskFinished`:e===`success`?`executionSuccess`:`taskFailed`)}function De(e){return e===`enabled`||e===`success`?`bg-emerald-500/10 text-emerald-700`:e===`running`?`bg-blue-500/10 text-blue-700`:e===`paused`?`bg-amber-500/10 text-amber-700`:`bg-muted text-muted-foreground`}async function _(e,t){let n=await fetch(e,{...t,headers:{"content-type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`请求失败`);return r}function v({onOpenSession:e}){let[o,s]=(0,d.useState)([]),[p,v]=(0,d.useState)(`tasks`),[y,b]=(0,d.useState)(()=>ye()),[x,Oe]=(0,d.useState)(null),[S,C]=(0,d.useState)(null),[w,T]=(0,d.useState)(null),[E,D]=(0,d.useState)(!1),[O,k]=(0,d.useState)(null),[ke,A]=(0,d.useState)(``),[j,M]=(0,d.useState)(!1),[N,P]=(0,d.useState)(``),[F,Ae]=(0,d.useState)([]),[I,L]=(0,d.useState)(),[R,z]=(0,d.useState)(`off`),[B,je]=(0,d.useState)([]),[Me,V]=(0,d.useState)(``),[H,U]=(0,d.useState)(()=>h()),[W,G]=(0,d.useState)(()=>h()),[K,Ne]=(0,d.useState)({runs:[],total:0,page:1,pageSize:10}),[Pe,Fe]=(0,d.useState)(!1),[Ie,Le]=(0,d.useState)(null),[Re,ze]=(0,d.useState)([]),Be=B[0]?.id??``;(0,d.useEffect)(()=>{if(!w)return;let e=()=>T(null);return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e)}},[w]);async function Ve(){s((await _(`/api/scheduled-tasks`)).tasks)}async function q(e=W){Fe(!0),P(``);try{let t=new URLSearchParams;t.set(`page`,String(e.page)),t.set(`pageSize`,String(e.pageSize)),e.taskId&&t.set(`taskId`,e.taskId),e.status&&t.set(`status`,e.status),e.trigger&&t.set(`trigger`,e.trigger),e.keyword.trim()&&t.set(`keyword`,e.keyword.trim()),e.startedFrom&&t.set(`startedFrom`,e.startedFrom),e.startedTo&&t.set(`startedTo`,e.startedTo),Ne(await _(`/api/scheduled-tasks/runs?${t.toString()}`))}catch(e){P(e instanceof Error?e.message:u(`requestFailed`))}finally{Fe(!1)}}(0,d.useEffect)(()=>{let e=!1;async function t(){try{let t=await _(`/api/project`);if(e)return;je(t.projects??[])}catch{}}return t(),()=>{e=!0}},[]),(0,d.useEffect)(()=>{let e=!1;async function t(){try{let t=await me(),n=await pe(t),r=await ce(t),i=r.model??await ue(t)??n[0];if(e)return;Ae(n),L(i),z(r.thinkingLevel??le(i))}catch(t){e||P(t instanceof Error?t.message:u(`requestFailed`))}}return t(),()=>{e=!0}},[]),(0,d.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await _(`/api/scheduled-tasks`);e||s(t.tasks)}catch(t){e||P(t instanceof Error?t.message:u(`requestFailed`))}};t();let n=window.setInterval(t,10*1e3);return()=>{e=!0,window.clearInterval(n)}},[]),(0,d.useEffect)(()=>{let e=!1;async function t(){try{let t=await _(`/api/agent-profiles`);if(e)return;ze(t.agents)}catch(t){e||P(t instanceof Error?t.message:u(`requestFailed`))}}return t(),()=>{e=!0}},[]);let He=(0,d.useMemo)(()=>o.find(e=>e.id===x),[x,o]),J=(0,d.useMemo)(()=>o.find(e=>e.id===S)??null,[S,o]),Ue=(0,d.useMemo)(()=>o.filter(e=>e.status===`enabled`).length,[o]),Y=Math.max(1,Math.ceil(K.total/K.pageSize));function We(e){return e?Re.find(t=>t.id===e||t.name===e)?.label??e:u(`defaultAgent`)}function X(e,t){b(n=>({...n,[e]:t}))}function Z(e,t){U(n=>({...n,[e]:t}))}function Ge(){Oe(null),V(Be),b(ye()),k(null),A(``),P(``)}function Ke(){Ge(),D(!0)}function Q(){j||(D(!1),Ge())}function qe(){let e={...H,page:1};U(e),G(e),q(e)}function Je(){let e=h();U(e),G(e),q(e)}function Ye(e){let t=Math.min(Math.max(1,e),Y),n={...W,page:t};U(n),G(n),q(n)}function Xe(e){let t={...W,page:1,pageSize:e};U(t),G(t),q(t)}async function Ze(){let e=y.scheduleText.trim();if(e){M(!0),P(``);try{let t=await _(`/api/scheduled-tasks/parse`,{method:`POST`,body:JSON.stringify({instruction:e,model:I,thinkingLevel:R})});if(t.needMoreInfo||!t.task){A(t.question||`请补充任务信息。`),k(null);return}let n=t.task;A(``),k(n),b(e=>xe(n,e))}catch(e){P(e instanceof Error?e.message:u(`requestFailed`))}finally{M(!1)}}}async function Qe(){if(Te(y)){M(!0),P(``);try{let e=B.find(e=>e.id===Me),t={task:Se(y),model:I,thinkingLevel:R,projectId:e?.id,projectName:e?.name};x?await _(`/api/scheduled-tasks/${encodeURIComponent(x)}`,{method:`PUT`,body:JSON.stringify(t)}):await _(`/api/scheduled-tasks`,{method:`POST`,body:JSON.stringify(t)}),Q(),await Ve(),p===`history`&&await q(W)}catch(e){P(e instanceof Error?e.message:u(`requestFailed`))}finally{M(!1)}}}function $e(e){T(null),Oe(e.id),b(be(e)),k(null),A(``),P(``),V(e.projectId??``),e.model&&L(e.model),e.thinkingLevel&&z(e.thinkingLevel),D(!0)}async function $(e,t){if(P(``),T(null),!(t===`delete`&&!await de({description:u(`confirmDeleteTask`),confirmLabel:u(`confirmDelete`),cancelLabel:u(`cancel`),variant:`destructive`})))try{t===`delete`?(await _(`/api/scheduled-tasks/${encodeURIComponent(e)}`,{method:`DELETE`}),x===e&&Q(),S===e&&C(null)):await _(`/api/scheduled-tasks/${encodeURIComponent(e)}/${t}`,{method:`POST`}),await Ve(),p===`history`&&await q(W)}catch(e){P(e instanceof Error?e.message:u(`requestFailed`))}}function et(t){return(0,f.jsxs)(`div`,{className:`mt-2 space-y-2 text-xs text-muted-foreground`,children:[t.sessionId?(0,f.jsx)(c,{variant:`outline`,size:`sm`,onClick:()=>e?.(t.sessionId),children:u(`viewConversation`)}):null,(0,f.jsxs)(`div`,{children:[u(`executionAgent`),t.agentLabel||We(t.agentId)]}),t.warning?(0,f.jsx)(`div`,{className:`text-amber-600`,children:t.warning}):null,t.inputContent?(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`font-medium text-foreground`,children:u(`runInputContent`)}),(0,f.jsx)(`pre`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap`,children:t.inputContent})]}):null,t.aiResult||t.result?(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`font-medium text-foreground`,children:u(`runAiResult`)}),(0,f.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap`,children:t.aiResult||t.result})]}):null,t.errorMessage?(0,f.jsx)(`div`,{className:`text-destructive`,children:t.errorMessage}):null,t.durationMs?(0,f.jsxs)(`div`,{children:[u(`runDuration`),t.durationMs,`ms`]}):null]})}return(0,f.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,f.jsxs)(`div`,{className:`border-b border-border px-6 py-5`,children:[(0,f.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:E||J?(0,f.jsxs)(c,{variant:`outline`,onClick:()=>{E?Q():C(null)},children:[(0,f.jsx)(n,{className:`mr-1 size-4`}),u(`back`)]}):(0,f.jsx)(c,{onClick:Ke,children:u(`createTask`)})}),!E&&!J?(0,f.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,f.jsxs)(`button`,{type:`button`,className:l(`rounded-full px-4 py-2 text-sm font-medium transition-colors`,p===`tasks`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:text-foreground`),onClick:()=>v(`tasks`),children:[u(`taskListTab`),` `,(0,f.jsx)(`span`,{className:`opacity-80`,children:o.length})]}),(0,f.jsx)(`button`,{type:`button`,className:l(`rounded-full px-4 py-2 text-sm font-medium transition-colors`,p===`history`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:text-foreground`),onClick:()=>{v(`history`),q(W)},children:u(`executionHistoryTab`)})]}):null]}),(0,f.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,f.jsx)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:E?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-5 space-y-4`,children:[(0,f.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5 text-base font-semibold text-foreground`,children:[u(He?`editTask`:`createTask`),(0,f.jsx)(fe,{label:u(`quickAiParseTask`)})]}),(0,f.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[u(`taskScheduleDescriptionLabel`),(0,f.jsx)(`textarea`,{className:`mt-1 min-h-24 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground/65 focus:border-ring`,value:y.scheduleText,onChange:e=>X(`scheduleText`,e.target.value),placeholder:u(`taskScheduleDescriptionPlaceholder`)})]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsxs)(c,{onClick:Ze,disabled:j||!I||!y.scheduleText.trim(),children:[(0,f.jsx)(te,{className:`mr-1 size-3.5`}),u(`aiParseTask`)]}),ke?(0,f.jsx)(`span`,{className:`text-sm text-amber-600`,children:ke}):null]}),(0,f.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,f.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[u(`taskTitleLabel`),(0,f.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring`,value:y.title,onChange:e=>X(`title`,e.target.value),placeholder:u(`taskTitlePlaceholder`)})]}),(0,f.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[u(`executionRule`),(0,f.jsx)(`div`,{className:`mt-1 flex h-10 items-center rounded-md border border-input bg-muted/20 px-3 text-sm text-muted-foreground`,children:y.scheduleRule||`-`})]}),(0,f.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[`cron`,(0,f.jsx)(`div`,{className:`mt-1 flex h-10 items-center rounded-md border border-input bg-muted/20 px-3 font-mono text-sm text-muted-foreground`,children:y.cronExpression||`-`})]}),(0,f.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[u(`nextExecutionTime`),(0,f.jsx)(`div`,{className:`mt-1 flex h-10 items-center rounded-md border border-input bg-muted/20 px-3 text-sm text-muted-foreground`,children:m(y.nextRunAt)})]}),(0,f.jsxs)(`label`,{className:`block text-sm font-medium text-foreground sm:col-span-2`,children:[(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[u(`taskExecutionMode`),(0,f.jsx)(fe,{label:u(`taskExecutionModeHelp`)})]}),(0,f.jsxs)(`select`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground outline-none focus:border-ring`,value:y.executionMode,onChange:e=>X(`executionMode`,e.target.value),children:[(0,f.jsx)(`option`,{value:`serial`,children:u(`taskExecutionModeSerial`)}),(0,f.jsx)(`option`,{value:`parallel`,children:u(`taskExecutionModeParallel`)})]})]}),(0,f.jsxs)(`label`,{className:`block text-sm font-medium text-foreground sm:col-span-2`,children:[u(`promptContentLabel`),(0,f.jsx)(`textarea`,{className:`mt-1 min-h-28 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm text-foreground outline-none transition-colors placeholder:text-muted-foreground/65 focus:border-ring`,value:y.instruction,onChange:e=>X(`instruction`,e.target.value),placeholder:u(`promptContentPlaceholder`)})]})]}),(0,f.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:y.enabled,onChange:e=>X(`enabled`,e.target.checked)}),u(`taskEnabledSwitch`)]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-border bg-muted/20 px-2 py-2`,children:[(0,f.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,f.jsx)(te,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,f.jsxs)(`select`,{className:`h-8 max-w-[240px] rounded-md border border-transparent bg-transparent pl-7 pr-2 text-xs text-muted-foreground outline-none hover:bg-background focus:border-ring`,value:I?`${I.provider}\u0000${I.id}`:``,onChange:e=>{let t=F.find(t=>`${t.provider}\u0000${t.id}`===e.target.value);L(t),z(le(t))},title:u(`taskModel`),children:[F.length===0?(0,f.jsx)(`option`,{value:``,children:u(`noModelAvailable`)}):null,F.map(e=>(0,f.jsxs)(`option`,{value:`${e.provider}\u0000${e.id}`,children:[ge(e),_e(e,I)?` ✓`:``]},`${e.provider}:${e.id}`))]})]}),(0,f.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,f.jsx)(i,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,f.jsx)(`select`,{className:`h-8 rounded-md border border-transparent bg-transparent pl-7 pr-2 text-xs text-muted-foreground outline-none hover:bg-background focus:border-ring`,value:R,onChange:e=>z(e.target.value),title:u(`taskThinking`),children:he.map(e=>(0,f.jsx)(`option`,{value:e.value,children:e.label()},e.value))})]}),(0,f.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,f.jsx)(a,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,f.jsxs)(`select`,{className:`h-8 max-w-[220px] rounded-md border border-transparent bg-transparent pl-7 pr-2 text-xs text-muted-foreground outline-none hover:bg-background focus:border-ring`,value:Me,onChange:e=>V(e.target.value),title:u(`taskProjectLabel`),children:[(0,f.jsx)(`option`,{value:``,children:u(`noProjectBound`)}),B.map(e=>(0,f.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,f.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,f.jsx)(t,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,f.jsxs)(`select`,{className:`h-8 max-w-[220px] rounded-md border border-transparent bg-transparent pl-7 pr-2 text-xs text-muted-foreground outline-none hover:bg-background focus:border-ring`,value:y.agentId,onChange:e=>X(`agentId`,e.target.value),title:u(`executionAgent`),children:[(0,f.jsx)(`option`,{value:``,children:u(`defaultAgent`)}),Re.map(e=>(0,f.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]})]}),O?(0,f.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/30 p-3 text-sm`,children:[(0,f.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium text-foreground`,children:[(0,f.jsx)(ae,{className:`size-4 text-emerald-600`}),u(`aiParsed`)]}),(0,f.jsxs)(`div`,{className:`grid gap-2 text-muted-foreground sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{children:[u(`taskName`),(0,f.jsx)(`span`,{className:`text-foreground`,children:O.title})]}),(0,f.jsxs)(`div`,{children:[u(`executionRule`),(0,f.jsx)(`span`,{className:`text-foreground`,children:O.scheduleRule})]}),(0,f.jsxs)(`div`,{children:[`cron:`,(0,f.jsx)(`span`,{className:`font-mono text-foreground`,children:O.cronExpression??`-`})]}),(0,f.jsxs)(`div`,{children:[u(`nextExecutionTime`),(0,f.jsx)(`span`,{className:`text-foreground`,children:m(O.nextRunAt)})]}),(0,f.jsxs)(`div`,{className:`sm:col-span-2`,children:[u(`aiInstruction`),(0,f.jsx)(`span`,{className:`text-foreground`,children:O.instruction})]})]})]}):null,N?(0,f.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:N}):null]}),(0,f.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,f.jsx)(c,{variant:`outline`,onClick:Q,disabled:j,children:u(`cancel`)}),(0,f.jsx)(c,{onClick:Qe,disabled:j||!I||!Te(y),children:u(He?`saveTask`:`confirmCreate`)})]})]}):J?(0,f.jsxs)(`div`,{className:`rounded-xl border border-border bg-card`,children:[(0,f.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-border px-5 py-4`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:J.title}),(0,f.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:J.scheduleRule})]})}),(0,f.jsx)(`div`,{className:`px-5 py-4`,children:(0,f.jsxs)(`div`,{className:`space-y-4 text-sm`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`mb-1 font-medium text-foreground`,children:u(`taskContent`)}),(0,f.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap rounded-xl border border-border bg-muted/20 p-3 text-muted-foreground`,children:J.instruction})]}),(0,f.jsxs)(`div`,{className:`grid gap-3 text-muted-foreground sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{children:[u(`executionRule`),(0,f.jsx)(`span`,{className:`text-foreground`,children:J.scheduleRule})]}),(0,f.jsxs)(`div`,{children:[u(`taskExecutionMode`),`:`,(0,f.jsx)(`span`,{className:`text-foreground`,children:we(J.executionMode)})]}),(0,f.jsxs)(`div`,{children:[`cron:`,(0,f.jsx)(`span`,{className:`font-mono text-foreground`,children:J.cronExpression??`-`})]}),(0,f.jsxs)(`div`,{children:[u(`lastExecution`),(0,f.jsx)(`span`,{className:`text-foreground`,children:m(J.lastRunAt)})]}),(0,f.jsxs)(`div`,{children:[u(`nextExecution`),(0,f.jsx)(`span`,{className:`text-foreground`,children:m(J.nextRunAt)})]}),(0,f.jsxs)(`div`,{children:[u(`executionAgent`),(0,f.jsx)(`span`,{className:`text-foreground`,children:We(J.agentId)})]}),J.projectName?(0,f.jsxs)(`div`,{children:[u(`taskProject`),(0,f.jsx)(`span`,{className:`text-foreground`,children:J.projectName})]}):null,J.model?(0,f.jsxs)(`div`,{children:[u(`taskModel`),`:`,(0,f.jsx)(`span`,{className:`text-foreground`,children:ge(J.model)})]}):null,J.thinkingLevel?(0,f.jsxs)(`div`,{children:[u(`taskThinkingLevel`),(0,f.jsx)(`span`,{className:`text-foreground`,children:he.find(e=>e.value===J.thinkingLevel)?.label()??J.thinkingLevel})]}):null,(0,f.jsxs)(`div`,{children:[u(`createdAt`),`:`,(0,f.jsx)(`span`,{className:`text-foreground`,children:m(J.createdAt)})]})]}),J.runs?.length>0?(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`mb-2 font-medium text-foreground`,children:u(`recentExecutions`)}),(0,f.jsx)(`div`,{className:`space-y-2`,children:J.runs.slice(0,5).map(e=>(0,f.jsxs)(`details`,{className:`rounded-lg border border-border bg-muted/20 p-2 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`summary`,{className:`cursor-pointer text-foreground`,children:[m(e.startedAt),` · `,e.trigger===`manual`?u(`manualRun`):u(`autoRun`),` · `,Ee(e.status)]}),et(e)]},e.id))})]}):null]})}),(0,f.jsx)(`div`,{className:`border-t border-border px-5 py-4`,children:(0,f.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[J.lastSessionId?(0,f.jsx)(c,{variant:`outline`,onClick:()=>e?.(J.lastSessionId),children:u(`viewConversation`)}):null,(0,f.jsxs)(c,{variant:`outline`,disabled:!Ce(J),onClick:()=>void $(J.id,`run`),children:[(0,f.jsx)(se,{className:`mr-1 size-3.5`}),u(`executeNow`)]}),(0,f.jsxs)(c,{variant:`outline`,disabled:g(J),onClick:()=>$e(J),children:[(0,f.jsx)(r,{className:`mr-1 size-3.5`}),u(`editTask`)]}),(0,f.jsxs)(c,{variant:`destructive`,disabled:g(J),onClick:()=>void $(J.id,`delete`),children:[(0,f.jsx)(ee,{className:`mr-1 size-3.5`}),u(`deleteTask`)]})]})})]}):(0,f.jsxs)(f.Fragment,{children:[N?(0,f.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:N}):null,p===`tasks`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:(0,f.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:u(`taskList`)}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u(`tasksCount`,{total:o.length,enabled:Ue})})]})})}),(0,f.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:o.length===0?(0,f.jsx)(`div`,{className:`rounded-lg px-3 py-3 text-center text-xs text-muted-foreground/55 md:col-span-2`,children:u(`noScheduledTasks`)}):o.map(e=>{let n=e.status===`enabled`,i=e.status===`completed`,a=g(e);return(0,f.jsxs)(`div`,{className:`relative cursor-pointer rounded-xl border border-border bg-card p-4 transition-colors hover:bg-muted/15`,onClick:()=>C(e.id),children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,f.jsx)(`h3`,{className:`truncate text-sm font-medium text-foreground/90`,children:e.title})}),(0,f.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:ve(e.instruction,20)})]}),(0,f.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,f.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,disabled:i,className:l(`relative h-6 w-11 rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60`,n?`bg-emerald-500`:`bg-muted-foreground/30`),onClick:()=>void $(e.id,e.status===`paused`?`resume`:`pause`),title:e.status===`paused`?u(`enable`):u(`pauseTask`),children:(0,f.jsx)(`span`,{className:l(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,n?`translate-x-5`:`translate-x-0`)})}),(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(c,{variant:`ghost`,size:`icon`,onClick:()=>T(w===e.id?null:e.id),title:u(`moreActions`),children:(0,f.jsx)(ie,{className:`size-4`})}),w===e.id?(0,f.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 w-36 overflow-hidden rounded-xl border border-border bg-popover py-1 text-sm shadow-quickforge`,children:[(0,f.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:!Ce(e),onClick:()=>void $(e.id,`run`),children:[(0,f.jsx)(se,{className:`size-3.5`}),u(`executeNow`)]}),(0,f.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:a,onClick:()=>$e(e),children:[(0,f.jsx)(r,{className:`size-3.5`}),u(`editTask`)]}),(0,f.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted`,onClick:()=>{T(null),C(e.id)},children:[(0,f.jsx)(oe,{className:`size-3.5`}),u(`viewDetails`)]}),(0,f.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left text-destructive hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:a,onClick:()=>void $(e.id,`delete`),children:[(0,f.jsx)(ee,{className:`size-3.5`}),u(`deleteTask`)]})]}):null]})]})]}),(0,f.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,f.jsx)(ne,{className:`size-3`}),e.scheduleRule]}),(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,f.jsx)(t,{className:`size-3`}),We(e.agentId)]}),(0,f.jsxs)(`span`,{children:[u(`taskExecutionMode`),`:`,we(e.executionMode)]}),e.projectName?(0,f.jsxs)(`span`,{children:[u(`taskProject`),e.projectName]}):null]}),(0,f.jsxs)(`div`,{className:`mt-4 grid gap-2 border-t border-border pt-3 text-xs text-muted-foreground sm:grid-cols-2`,children:[(0,f.jsxs)(`span`,{children:[u(`lastExecution`),m(e.lastRunAt)]}),(0,f.jsxs)(`span`,{children:[u(`nextExecution`),m(e.nextRunAt)]})]})]},e.id)})})]}):(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,f.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,f.jsx)(re,{className:`size-4`}),u(`historyFilters`)]}),(0,f.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,f.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[u(`taskName`),(0,f.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.taskId,onChange:e=>Z(`taskId`,e.target.value),children:[(0,f.jsx)(`option`,{value:``,children:u(`allTasks`)}),o.map(e=>(0,f.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,f.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[u(`status`),(0,f.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.status,onChange:e=>Z(`status`,e.target.value),children:[(0,f.jsx)(`option`,{value:``,children:u(`allStatuses`)}),(0,f.jsx)(`option`,{value:`running`,children:u(`executionRunning`)}),(0,f.jsx)(`option`,{value:`success`,children:u(`executionSuccess`)}),(0,f.jsx)(`option`,{value:`failed`,children:u(`taskFailed`)})]})]}),(0,f.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[u(`triggerType`),(0,f.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.trigger,onChange:e=>Z(`trigger`,e.target.value),children:[(0,f.jsx)(`option`,{value:``,children:u(`allTriggers`)}),(0,f.jsx)(`option`,{value:`schedule`,children:u(`autoRun`)}),(0,f.jsx)(`option`,{value:`manual`,children:u(`manualRun`)})]})]}),(0,f.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[u(`startTime`),(0,f.jsx)(`input`,{type:`datetime-local`,className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.startedFrom,onChange:e=>Z(`startedFrom`,e.target.value)})]}),(0,f.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[u(`endTime`),(0,f.jsx)(`input`,{type:`datetime-local`,className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.startedTo,onChange:e=>Z(`startedTo`,e.target.value)})]}),(0,f.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[u(`keyword`),(0,f.jsx)(`input`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.keyword,onChange:e=>Z(`keyword`,e.target.value),placeholder:u(`keywordPlaceholder`)})]})]}),(0,f.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,f.jsx)(c,{variant:`outline`,onClick:Je,children:u(`reset`)}),(0,f.jsx)(c,{onClick:qe,children:u(`query`)})]})]}),(0,f.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-[1.3fr_0.7fr_0.7fr_1fr_0.7fr] gap-3 border-b border-border px-4 py-3 text-xs font-medium text-muted-foreground`,children:[(0,f.jsx)(`span`,{children:u(`taskName`)}),(0,f.jsx)(`span`,{children:u(`status`)}),(0,f.jsx)(`span`,{children:u(`triggerType`)}),(0,f.jsx)(`span`,{children:u(`startTime`)}),(0,f.jsx)(`span`,{children:u(`runDuration`)})]}),Pe?(0,f.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:u(`loading`)}):K.runs.length===0?(0,f.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:u(`noExecutionHistory`)}):K.runs.map(e=>(0,f.jsxs)(`div`,{className:`border-b border-border last:border-b-0`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`grid w-full grid-cols-[1.3fr_0.7fr_0.7fr_1fr_0.7fr] gap-3 px-4 py-3 text-left text-sm hover:bg-muted/40`,onClick:()=>Le(Ie===e.id?null:e.id),children:[(0,f.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:e.taskTitle}),(0,f.jsx)(`span`,{children:(0,f.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-xs`,De(e.status)),children:Ee(e.status)})}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.trigger===`manual`?u(`manualRun`):u(`autoRun`)}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:m(e.startedAt)}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.durationMs?`${e.durationMs}ms`:`-`})]}),Ie===e.id?(0,f.jsx)(`div`,{className:`border-t border-border bg-muted/20 px-4 py-3`,children:et(e)}):null]},`${e.taskId}:${e.id}`)),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3 text-sm text-muted-foreground`,children:[(0,f.jsx)(`span`,{children:u(`paginationSummary`,{page:K.page,pages:Y,total:K.total})}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`select`,{className:`h-8 rounded-md border border-input bg-background px-2 text-sm`,value:K.pageSize,onChange:e=>Xe(Number(e.target.value)),children:[10,20,50,100].map(e=>(0,f.jsx)(`option`,{value:e,children:u(`pageSize`,{size:e})},e))}),(0,f.jsx)(c,{variant:`outline`,size:`sm`,disabled:K.page<=1,onClick:()=>Ye(K.page-1),children:u(`previousPage`)}),(0,f.jsx)(c,{variant:`outline`,size:`sm`,disabled:K.page>=Y,onClick:()=>Ye(K.page+1),children:u(`nextPage`)})]})]})]})]})]})})})]})}export{v as ScheduledTasksPage};
|