@shawnstack/quickforge 1.7.2 → 1.7.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 +1 -0
- package/bin/quickforge.mjs +2 -0
- package/dist/assets/{AgentProfilesPage-BFgyFa5e.js → AgentProfilesPage-D7pbg8nm.js} +1 -1
- package/dist/assets/{ChatPanelHost-Cld9HcVz.js → ChatPanelHost-wfGCaCzD.js} +62 -62
- package/dist/assets/{PluginsPage-DEMqwhOA.js → PluginsPage-NAGroBm3.js} +1 -1
- package/dist/assets/{ScheduledTasksPage-DTP_gedp.js → ScheduledTasksPage-Bp0MNfQD.js} +2 -2
- package/dist/assets/{SettingsWorkspacePage-Dr9zT5Bs.js → SettingsWorkspacePage-BtJZMIsZ.js} +350 -269
- package/dist/assets/{SharedConversationPage-op3DRwcw.js → SharedConversationPage-Ce3KoVZt.js} +1 -1
- package/dist/assets/{TerminalDock-BL_UovwU.js → TerminalDock-4eUuXP7X.js} +2 -2
- package/dist/assets/WorkspaceInspector-kM3BRPjY.js +13 -0
- package/dist/assets/{index-yV1wtqTr.js → index-C6k5taeb.js} +8 -8
- package/dist/assets/index-CzN8NSKC.css +3 -0
- package/dist/assets/{mcp-servers-dialog-Bp6kbIup.js → mcp-servers-dialog-BQbFywVL.js} +2 -2
- package/dist/assets/{skills-dialog-DiJAUfvW.js → skills-dialog-REBeTFSH.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +4 -1
- package/server/ai-http-logger.mjs +6 -6
- package/server/ai-provider-options.mjs +8 -0
- package/server/index.mjs +7 -2
- package/server/network-proxy.mjs +384 -0
- package/server/public-api.mjs +4 -0
- package/server/routes/agent-profiles.mjs +2 -0
- package/server/routes/models.mjs +1 -0
- package/server/routes/scheduled-tasks.mjs +2 -0
- package/server/routes/system.mjs +26 -0
- package/server/routes/workspace.mjs +2 -0
- package/server/session-utils.mjs +2 -0
- package/dist/assets/WorkspaceInspector-73dhAime.js +0 -13
- package/dist/assets/index-Cu2bBHLv.css +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{B as t,Pt as n,St as r,b as i,i as a,r as o,u as s,x as c}from"./icons-BP8YOS-Z.js";import{n as l}from"./react-vendor-Dr5xvL-e.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{B as t,Pt as n,St as r,b as i,i as a,r as o,u as s,x as c}from"./icons-BP8YOS-Z.js";import{n as l}from"./react-vendor-Dr5xvL-e.js";import{Ot as u,wt as d}from"./index-C6k5taeb.js";import{n as f,r as p,t as m}from"./plugin-api-BbUkYm3Y.js";var h=e(n(),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`?u(`pluginStatusLoaded`):e===`disabled`?u(`pluginStatusDisabled`):e===`error`?u(`pluginStatusError`):e}function y(e){switch(e){case`openai-documents`:return{label:u(`pluginOpenaiDocumentsName`),description:u(`pluginOpenaiDocumentsDescription`)};case`openai-spreadsheets`:return{label:u(`pluginOpenaiSpreadsheetsName`),description:u(`pluginOpenaiSpreadsheetsDescription`)};case`openai-presentations`:return{label:u(`pluginOpenaiPresentationsName`),description:u(`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||u(`noDescription`)}function S(e){return(e.label||e.name||e.quickForgeName).replace(/^OpenAI\s+/i,``)}function C({onChanged:e}){let[n,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:u(`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:u(`pluginsLoadFailed`))}).finally(()=>{e||C(!1)}),()=>{e=!0}},[]);let j=(0,h.useMemo)(()=>{let e=n?.plugins||[];return{total:e.length,enabled:e.filter(e=>e.enabled).length,tools:e.reduce((e,t)=>e+t.tools.length,0)}},[n]),M=(0,h.useMemo)(()=>n?.plugins||[],[n]),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:u(`pluginsSaveFailed`))}finally{T(null)}};return(0,g.jsx)(`div`,{className:`quickforge-settings-stack`,children:(0,g.jsxs)(`section`,{className:`quickforge-settings-section`,"aria-label":u(`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)(c,{className:`size-4 text-primary`}),u(`plugins`)]}),(0,g.jsx)(`div`,{className:`quickforge-settings-row-description`,children:u(`pluginsDescription`)}),(0,g.jsxs)(`div`,{className:`quickforge-settings-meta`,children:[(0,g.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:u(`pluginsCount`,j)}),(0,g.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-info`,children:u(`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)(i,{className:`mr-2 size-4`}),u(`pluginsReload`)]})]}),O?(0,g.jsx)(`div`,{className:`quickforge-settings-alert quickforge-settings-warning-attached`,children:O}):null,n?.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)(a,{className:`size-4`}),u(`pluginDiscoveryErrors`)]}),n.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&&!n?(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`}),u(`loadingPlugins`)]}):null,!y&&n&&n.plugins.length===0?(0,g.jsxs)(`div`,{className:`quickforge-settings-empty-row`,children:[(0,g.jsx)(`div`,{className:`quickforge-settings-row-title`,children:u(`noPlugins`)}),(0,g.jsx)(`div`,{className:`quickforge-settings-row-description`,children:u(`noPluginsDescription`)}),(0,g.jsx)(`div`,{className:`quickforge-settings-meta`,children:(n.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)(r,{className:d(`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:d(`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)(o,{className:`size-3`}),u(`pluginToolsCount`,{count:e.tools.length})]}),(0,g.jsxs)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:[(0,g.jsx)(s,{className:`size-3`}),u(`pluginPermissionsCount`,{count:e.permissions.length})]}),(0,g.jsx)(`span`,{className:d(`quickforge-settings-badge`,e.enabled?`quickforge-settings-badge-success`:`quickforge-settings-badge-muted`),children:e.enabled?u(`enabled`):u(`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)(o,{className:`size-4 text-muted-foreground`}),u(`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:u(`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)(s,{className:`size-4 text-muted-foreground`}),u(`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:u(`pluginNoPermissions`)}),(0,g.jsx)(`div`,{className:`quickforge-settings-row-description mt-3`,children:u(`pluginTrustedNotice`)})]})]}):null]},e.name)})]})})}export{C as PluginsPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Dt as t,E as n,Et as r,Pt as i,Y as a,_ as ee,a as te,c as ne,gt as re,it as ie,jt as ae,mt as oe,nt as se,t as ce}from"./icons-BP8YOS-Z.js";import{n as o}from"./react-vendor-Dr5xvL-e.js";import{V as le,
|
|
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 Se(e,t){return{...t,title:e.title,instruction:e.instruction,cronExpression:e.cronExpression??``,scheduleRule:e.scheduleRule,nextRunAt:e.nextRunAt,enabled:t.enabled}}function Ce(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 h(e){return!!(e.currentRunId||e.currentRunIds?.length)}function we(e){return(e.executionMode??`serial`)===`parallel`||!h(e)}function Te(e){return l(e===`parallel`?`taskExecutionModeParallel`:`taskExecutionModeSerial`)}function Ee(e){return!!(e.title.trim()&&e.instruction.trim()&&e.cronExpression.trim())}function De(e){return l(e===`enabled`?`taskEnabled`:e===`running`?`taskRunning`:e===`paused`?`taskPaused`:e===`completed`?`taskFinished`:e===`success`?`executionSuccess`:`taskFailed`)}function Oe(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 g(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 _({onOpenSession:e}){let[i,o]=(0,u.useState)([]),[f,_]=(0,u.useState)(`tasks`),[v,y]=(0,u.useState)(()=>be()),[b,ke]=(0,u.useState)(null),[x,S]=(0,u.useState)(null),[C,w]=(0,u.useState)(null),[T,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(null),[Ae,k]=(0,u.useState)(``),[A,j]=(0,u.useState)(!1),[M,N]=(0,u.useState)(``),[P,je]=(0,u.useState)([]),[F,I]=(0,u.useState)(),[L,R]=(0,u.useState)(`off`),[z,Me]=(0,u.useState)([]),[Ne,B]=(0,u.useState)(``),[V,H]=(0,u.useState)(()=>m()),[U,W]=(0,u.useState)(()=>m()),[G,Pe]=(0,u.useState)({runs:[],total:0,page:1,pageSize:10}),[Fe,Ie]=(0,u.useState)(!1),[Le,Re]=(0,u.useState)(null),[ze,Be]=(0,u.useState)([]),Ve=z[0]?.id??``;(0,u.useEffect)(()=>{if(!C)return;let e=()=>w(null);return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e)}},[C]);async function He(){o((await g(`/api/scheduled-tasks`)).tasks)}async function K(e=U){Ie(!0),N(``);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),Pe(await g(`/api/scheduled-tasks/runs?${t.toString()}`))}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}finally{Ie(!1)}}(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await g(`/api/project`);if(e)return;Me(t.projects??[])}catch{}}return t(),()=>{e=!0}},[]),(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await fe(),n=await he(t),r=await ue(t),i=r.model??await me(t)??n[0];if(e)return;je(n),I(i),R(r.thinkingLevel??pe(i))}catch(t){e||N(t instanceof Error?t.message:l(`requestFailed`))}}return t(),()=>{e=!0}},[]),(0,u.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await g(`/api/scheduled-tasks`);e||o(t.tasks)}catch(t){e||N(t instanceof Error?t.message:l(`requestFailed`))}};t();let n=window.setInterval(t,10*1e3);return()=>{e=!0,window.clearInterval(n)}},[]),(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await g(`/api/agent-profiles`);if(e)return;Be(t.agents)}catch(t){e||N(t instanceof Error?t.message:l(`requestFailed`))}}return t(),()=>{e=!0}},[]);let Ue=(0,u.useMemo)(()=>i.find(e=>e.id===b),[b,i]),q=(0,u.useMemo)(()=>i.find(e=>e.id===x)??null,[x,i]),We=(0,u.useMemo)(()=>i.filter(e=>e.status===`enabled`).length,[i]),J=Math.max(1,Math.ceil(G.total/G.pageSize));function Y(e){return e?ze.find(t=>t.id===e||t.name===e)?.label??e:l(`defaultAgent`)}function X(e,t){y(n=>({...n,[e]:t}))}function Z(e,t){H(n=>({...n,[e]:t}))}function Ge(){ke(null),B(Ve),y(be()),O(null),k(``),N(``)}function Ke(){Ge(),E(!0)}function Q(){A||(E(!1),Ge())}function qe(){let e={...V,page:1};H(e),W(e),K(e)}function Je(){let e=m();H(e),W(e),K(e)}function Ye(e){let t=Math.min(Math.max(1,e),J),n={...U,page:t};H(n),W(n),K(n)}function Xe(e){let t={...U,page:1,pageSize:e};H(t),W(t),K(t)}async function Ze(){let e=v.scheduleText.trim();if(e){j(!0),N(``);try{let t=await g(`/api/scheduled-tasks/parse`,{method:`POST`,body:JSON.stringify({instruction:e,model:F,thinkingLevel:L})});if(t.needMoreInfo||!t.task){k(t.question||`请补充任务信息。`),O(null);return}let n=t.task;k(``),O(n),y(e=>Se(n,e))}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}finally{j(!1)}}}async function Qe(){if(Ee(v)){j(!0),N(``);try{let e=z.find(e=>e.id===Ne),t={task:Ce(v),model:F,thinkingLevel:L,projectId:e?.id,projectName:e?.name};b?await g(`/api/scheduled-tasks/${encodeURIComponent(b)}`,{method:`PUT`,body:JSON.stringify(t)}):await g(`/api/scheduled-tasks`,{method:`POST`,body:JSON.stringify(t)}),Q(),await He(),f===`history`&&await K(U)}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}finally{j(!1)}}}function $e(e){w(null),ke(e.id),y(xe(e)),O(null),k(``),N(``),B(e.projectId??``),e.model&&I(e.model),e.thinkingLevel&&R(e.thinkingLevel),E(!0)}async function $(e,t){if(N(``),w(null),!(t===`delete`&&!await le({description:l(`confirmDeleteTask`),confirmLabel:l(`confirmDelete`),cancelLabel:l(`cancel`),variant:`destructive`})))try{t===`delete`?(await g(`/api/scheduled-tasks/${encodeURIComponent(e)}`,{method:`DELETE`}),b===e&&Q(),x===e&&S(null)):await g(`/api/scheduled-tasks/${encodeURIComponent(e)}/${t}`,{method:`POST`}),await He(),f===`history`&&await K(U)}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}}function et(t){return(0,d.jsxs)(`div`,{className:`mt-2 space-y-2 text-xs text-muted-foreground`,children:[t.sessionId?(0,d.jsx)(c,{variant:`outline`,size:`sm`,onClick:()=>e?.(t.sessionId),children:l(`viewConversation`)}):null,(0,d.jsxs)(`div`,{children:[l(`executionAgent`),t.agentLabel||Y(t.agentId)]}),t.warning?(0,d.jsx)(`div`,{className:`text-amber-600`,children:t.warning}):null,t.inputContent?(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`font-medium text-foreground`,children:l(`runInputContent`)}),(0,d.jsx)(`pre`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap`,children:t.inputContent})]}):null,t.aiResult||t.result?(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`font-medium text-foreground`,children:l(`runAiResult`)}),(0,d.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap`,children:t.aiResult||t.result})]}):null,t.errorMessage?(0,d.jsx)(`div`,{className:`text-destructive`,children:t.errorMessage}):null,t.durationMs?(0,d.jsxs)(`div`,{children:[l(`runDuration`),t.durationMs,`ms`]}):null]})}return(0,d.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,d.jsxs)(`div`,{className:`border-b border-border px-6 py-5`,children:[(0,d.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:T||q?(0,d.jsxs)(c,{variant:`outline`,onClick:()=>{T?Q():S(null)},children:[(0,d.jsx)(ae,{className:`mr-1 size-4`}),l(`back`)]}):(0,d.jsx)(c,{onClick:Ke,children:l(`createTask`)})}),!T&&!q?(0,d.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,d.jsxs)(`button`,{type:`button`,className:s(`rounded-full px-4 py-2 text-sm font-medium transition-colors`,f===`tasks`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:text-foreground`),onClick:()=>_(`tasks`),children:[l(`taskListTab`),` `,(0,d.jsx)(`span`,{className:`opacity-80`,children:i.length})]}),(0,d.jsx)(`button`,{type:`button`,className:s(`rounded-full px-4 py-2 text-sm font-medium transition-colors`,f===`history`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:text-foreground`),onClick:()=>{_(`history`),K(U)},children:l(`executionHistoryTab`)})]}):null]}),(0,d.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,d.jsx)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:T?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-5 space-y-4`,children:[(0,d.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5 text-base font-semibold text-foreground`,children:[l(Ue?`editTask`:`createTask`),(0,d.jsx)(de,{label:l(`quickAiParseTask`)})]}),(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[l(`taskScheduleDescriptionLabel`),(0,d.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:v.scheduleText,onChange:e=>X(`scheduleText`,e.target.value),placeholder:l(`taskScheduleDescriptionPlaceholder`)})]}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,d.jsxs)(c,{onClick:Ze,disabled:A||!F||!v.scheduleText.trim(),children:[(0,d.jsx)(ne,{className:`mr-1 size-3.5`}),l(`aiParseTask`)]}),Ae?(0,d.jsx)(`span`,{className:`text-sm text-amber-600`,children:Ae}):null]}),(0,d.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[l(`taskTitleLabel`),(0,d.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:v.title,onChange:e=>X(`title`,e.target.value),placeholder:l(`taskTitlePlaceholder`)})]}),(0,d.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[l(`executionRule`),(0,d.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:v.scheduleRule||`-`})]}),(0,d.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[`cron`,(0,d.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:v.cronExpression||`-`})]}),(0,d.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[l(`nextExecutionTime`),(0,d.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:p(v.nextRunAt)})]}),(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground sm:col-span-2`,children:[(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[l(`taskExecutionMode`),(0,d.jsx)(de,{label:l(`taskExecutionModeHelp`)})]}),(0,d.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:v.executionMode,onChange:e=>X(`executionMode`,e.target.value),children:[(0,d.jsx)(`option`,{value:`serial`,children:l(`taskExecutionModeSerial`)}),(0,d.jsx)(`option`,{value:`parallel`,children:l(`taskExecutionModeParallel`)})]})]}),(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground sm:col-span-2`,children:[l(`promptContentLabel`),(0,d.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:v.instruction,onChange:e=>X(`instruction`,e.target.value),placeholder:l(`promptContentPlaceholder`)})]})]}),(0,d.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:v.enabled,onChange:e=>X(`enabled`,e.target.checked)}),l(`taskEnabledSwitch`)]}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-border bg-muted/20 px-2 py-2`,children:[(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(ne,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.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:F?`${F.provider}\u0000${F.id}`:``,onChange:e=>{let t=P.find(t=>`${t.provider}\u0000${t.id}`===e.target.value);I(t),R(pe(t))},title:l(`taskModel`),children:[P.length===0?(0,d.jsx)(`option`,{value:``,children:l(`noModelAvailable`)}):null,P.map(e=>(0,d.jsxs)(`option`,{value:`${e.provider}\u0000${e.id}`,children:[_e(e),ve(e,F)?` ✓`:``]},`${e.provider}:${e.id}`))]})]}),(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(r,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.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:L,onChange:e=>R(e.target.value),title:l(`taskThinking`),children:ge.map(e=>(0,d.jsx)(`option`,{value:e.value,children:e.label()},e.value))})]}),(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(a,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.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:Ne,onChange:e=>B(e.target.value),title:l(`taskProjectLabel`),children:[(0,d.jsx)(`option`,{value:``,children:l(`noProjectBound`)}),z.map(e=>(0,d.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(t,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.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:v.agentId,onChange:e=>X(`agentId`,e.target.value),title:l(`executionAgent`),children:[(0,d.jsx)(`option`,{value:``,children:l(`defaultAgent`)}),ze.map(e=>(0,d.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]})]}),D?(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/30 p-3 text-sm`,children:[(0,d.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium text-foreground`,children:[(0,d.jsx)(re,{className:`size-4 text-emerald-600`}),l(`aiParsed`)]}),(0,d.jsxs)(`div`,{className:`grid gap-2 text-muted-foreground sm:grid-cols-2`,children:[(0,d.jsxs)(`div`,{children:[l(`taskName`),(0,d.jsx)(`span`,{className:`text-foreground`,children:D.title})]}),(0,d.jsxs)(`div`,{children:[l(`executionRule`),(0,d.jsx)(`span`,{className:`text-foreground`,children:D.scheduleRule})]}),(0,d.jsxs)(`div`,{children:[`cron:`,(0,d.jsx)(`span`,{className:`font-mono text-foreground`,children:D.cronExpression??`-`})]}),(0,d.jsxs)(`div`,{children:[l(`nextExecutionTime`),(0,d.jsx)(`span`,{className:`text-foreground`,children:p(D.nextRunAt)})]}),(0,d.jsxs)(`div`,{className:`sm:col-span-2`,children:[l(`aiInstruction`),(0,d.jsx)(`span`,{className:`text-foreground`,children:D.instruction})]})]})]}):null,M?(0,d.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:M}):null]}),(0,d.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,d.jsx)(c,{variant:`outline`,onClick:Q,disabled:A,children:l(`cancel`)}),(0,d.jsx)(c,{onClick:Qe,disabled:A||!F||!Ee(v),children:l(Ue?`saveTask`:`confirmCreate`)})]})]}):q?(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-card`,children:[(0,d.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-border px-5 py-4`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:q.title}),(0,d.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:q.scheduleRule})]})}),(0,d.jsx)(`div`,{className:`px-5 py-4`,children:(0,d.jsxs)(`div`,{className:`space-y-4 text-sm`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`mb-1 font-medium text-foreground`,children:l(`taskContent`)}),(0,d.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:q.instruction})]}),(0,d.jsxs)(`div`,{className:`grid gap-3 text-muted-foreground sm:grid-cols-2`,children:[(0,d.jsxs)(`div`,{children:[l(`executionRule`),(0,d.jsx)(`span`,{className:`text-foreground`,children:q.scheduleRule})]}),(0,d.jsxs)(`div`,{children:[l(`taskExecutionMode`),`:`,(0,d.jsx)(`span`,{className:`text-foreground`,children:Te(q.executionMode)})]}),(0,d.jsxs)(`div`,{children:[`cron:`,(0,d.jsx)(`span`,{className:`font-mono text-foreground`,children:q.cronExpression??`-`})]}),(0,d.jsxs)(`div`,{children:[l(`lastExecution`),(0,d.jsx)(`span`,{className:`text-foreground`,children:p(q.lastRunAt)})]}),(0,d.jsxs)(`div`,{children:[l(`nextExecution`),(0,d.jsx)(`span`,{className:`text-foreground`,children:p(q.nextRunAt)})]}),(0,d.jsxs)(`div`,{children:[l(`executionAgent`),(0,d.jsx)(`span`,{className:`text-foreground`,children:Y(q.agentId)})]}),q.projectName?(0,d.jsxs)(`div`,{children:[l(`taskProject`),(0,d.jsx)(`span`,{className:`text-foreground`,children:q.projectName})]}):null,q.model?(0,d.jsxs)(`div`,{children:[l(`taskModel`),`:`,(0,d.jsx)(`span`,{className:`text-foreground`,children:_e(q.model)})]}):null,q.thinkingLevel?(0,d.jsxs)(`div`,{children:[l(`taskThinkingLevel`),(0,d.jsx)(`span`,{className:`text-foreground`,children:ge.find(e=>e.value===q.thinkingLevel)?.label()??q.thinkingLevel})]}):null,(0,d.jsxs)(`div`,{children:[l(`createdAt`),`:`,(0,d.jsx)(`span`,{className:`text-foreground`,children:p(q.createdAt)})]})]}),q.runs?.length>0?(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`mb-2 font-medium text-foreground`,children:l(`recentExecutions`)}),(0,d.jsx)(`div`,{className:`space-y-2`,children:q.runs.slice(0,5).map(e=>(0,d.jsxs)(`details`,{className:`rounded-lg border border-border bg-muted/20 p-2 text-xs text-muted-foreground`,children:[(0,d.jsxs)(`summary`,{className:`cursor-pointer text-foreground`,children:[p(e.startedAt),` · `,e.trigger===`manual`?l(`manualRun`):l(`autoRun`),` · `,De(e.status)]}),et(e)]},e.id))})]}):null]})}),(0,d.jsx)(`div`,{className:`border-t border-border px-5 py-4`,children:(0,d.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[q.lastSessionId?(0,d.jsx)(c,{variant:`outline`,onClick:()=>e?.(q.lastSessionId),children:l(`viewConversation`)}):null,(0,d.jsxs)(c,{variant:`outline`,disabled:!we(q),onClick:()=>void $(q.id,`run`),children:[(0,d.jsx)(ce,{className:`mr-1 size-3.5`}),l(`executeNow`)]}),(0,d.jsxs)(c,{variant:`outline`,disabled:h(q),onClick:()=>$e(q),children:[(0,d.jsx)(n,{className:`mr-1 size-3.5`}),l(`editTask`)]}),(0,d.jsxs)(c,{variant:`destructive`,disabled:h(q),onClick:()=>void $(q.id,`delete`),children:[(0,d.jsx)(te,{className:`mr-1 size-3.5`}),l(`deleteTask`)]})]})})]}):(0,d.jsxs)(d.Fragment,{children:[M?(0,d.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:M}):null,f===`tasks`?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:(0,d.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:l(`taskList`)}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l(`tasksCount`,{total:i.length,enabled:We})})]})})}),(0,d.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:i.length===0?(0,d.jsx)(`div`,{className:`rounded-lg px-3 py-3 text-center text-xs text-muted-foreground/55 md:col-span-2`,children:l(`noScheduledTasks`)}):i.map(e=>{let r=e.status===`enabled`,i=e.status===`completed`,a=h(e);return(0,d.jsxs)(`div`,{className:`relative cursor-pointer rounded-xl border border-border bg-card p-4 transition-colors hover:bg-muted/15`,onClick:()=>S(e.id),children:[(0,d.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,d.jsxs)(`div`,{className:`min-w-0`,children:[(0,d.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,d.jsx)(`h3`,{className:`truncate text-sm font-medium text-foreground/90`,children:e.title})}),(0,d.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:ye(e.instruction,20)})]}),(0,d.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,d.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":r,disabled:i,className:s(`relative h-6 w-11 rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60`,r?`bg-emerald-500`:`bg-muted-foreground/30`),onClick:()=>void $(e.id,e.status===`paused`?`resume`:`pause`),title:e.status===`paused`?l(`enable`):l(`pauseTask`),children:(0,d.jsx)(`span`,{className:s(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,r?`translate-x-5`:`translate-x-0`)})}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(c,{variant:`ghost`,size:`icon`,onClick:()=>w(C===e.id?null:e.id),title:l(`moreActions`),children:(0,d.jsx)(ie,{className:`size-4`})}),C===e.id?(0,d.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,d.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:!we(e),onClick:()=>void $(e.id,`run`),children:[(0,d.jsx)(ce,{className:`size-3.5`}),l(`executeNow`)]}),(0,d.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,d.jsx)(n,{className:`size-3.5`}),l(`editTask`)]}),(0,d.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted`,onClick:()=>{w(null),S(e.id)},children:[(0,d.jsx)(se,{className:`size-3.5`}),l(`viewDetails`)]}),(0,d.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,d.jsx)(te,{className:`size-3.5`}),l(`deleteTask`)]})]}):null]})]})]}),(0,d.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,d.jsx)(oe,{className:`size-3`}),e.scheduleRule]}),(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,d.jsx)(t,{className:`size-3`}),Y(e.agentId)]}),(0,d.jsxs)(`span`,{children:[l(`taskExecutionMode`),`:`,Te(e.executionMode)]}),e.projectName?(0,d.jsxs)(`span`,{children:[l(`taskProject`),e.projectName]}):null]}),(0,d.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,d.jsxs)(`span`,{children:[l(`lastExecution`),p(e.lastRunAt)]}),(0,d.jsxs)(`span`,{children:[l(`nextExecution`),p(e.nextRunAt)]})]})]},e.id)})})]}):(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,d.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,d.jsx)(ee,{className:`size-4`}),l(`historyFilters`)]}),(0,d.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`taskName`),(0,d.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.taskId,onChange:e=>Z(`taskId`,e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:l(`allTasks`)}),i.map(e=>(0,d.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`status`),(0,d.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.status,onChange:e=>Z(`status`,e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:l(`allStatuses`)}),(0,d.jsx)(`option`,{value:`running`,children:l(`executionRunning`)}),(0,d.jsx)(`option`,{value:`success`,children:l(`executionSuccess`)}),(0,d.jsx)(`option`,{value:`failed`,children:l(`taskFailed`)})]})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`triggerType`),(0,d.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.trigger,onChange:e=>Z(`trigger`,e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:l(`allTriggers`)}),(0,d.jsx)(`option`,{value:`schedule`,children:l(`autoRun`)}),(0,d.jsx)(`option`,{value:`manual`,children:l(`manualRun`)})]})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`startTime`),(0,d.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:V.startedFrom,onChange:e=>Z(`startedFrom`,e.target.value)})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`endTime`),(0,d.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:V.startedTo,onChange:e=>Z(`startedTo`,e.target.value)})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`keyword`),(0,d.jsx)(`input`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.keyword,onChange:e=>Z(`keyword`,e.target.value),placeholder:l(`keywordPlaceholder`)})]})]}),(0,d.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,d.jsx)(c,{variant:`outline`,onClick:Je,children:l(`reset`)}),(0,d.jsx)(c,{onClick:qe,children:l(`query`)})]})]}),(0,d.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,d.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,d.jsx)(`span`,{children:l(`taskName`)}),(0,d.jsx)(`span`,{children:l(`status`)}),(0,d.jsx)(`span`,{children:l(`triggerType`)}),(0,d.jsx)(`span`,{children:l(`startTime`)}),(0,d.jsx)(`span`,{children:l(`runDuration`)})]}),Fe?(0,d.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:l(`loading`)}):G.runs.length===0?(0,d.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:l(`noExecutionHistory`)}):G.runs.map(e=>(0,d.jsxs)(`div`,{className:`border-b border-border last:border-b-0`,children:[(0,d.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:()=>Re(Le===e.id?null:e.id),children:[(0,d.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:e.taskTitle}),(0,d.jsx)(`span`,{children:(0,d.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 text-xs`,Oe(e.status)),children:De(e.status)})}),(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:e.trigger===`manual`?l(`manualRun`):l(`autoRun`)}),(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:p(e.startedAt)}),(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:e.durationMs?`${e.durationMs}ms`:`-`})]}),Le===e.id?(0,d.jsx)(`div`,{className:`border-t border-border bg-muted/20 px-4 py-3`,children:et(e)}):null]},`${e.taskId}:${e.id}`)),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3 text-sm text-muted-foreground`,children:[(0,d.jsx)(`span`,{children:l(`paginationSummary`,{page:G.page,pages:J,total:G.total})}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`select`,{className:`h-8 rounded-md border border-input bg-background px-2 text-sm`,value:G.pageSize,onChange:e=>Xe(Number(e.target.value)),children:[10,20,50,100].map(e=>(0,d.jsx)(`option`,{value:e,children:l(`pageSize`,{size:e})},e))}),(0,d.jsx)(c,{variant:`outline`,size:`sm`,disabled:G.page<=1,onClick:()=>Ye(G.page-1),children:l(`previousPage`)}),(0,d.jsx)(c,{variant:`outline`,size:`sm`,disabled:G.page>=J,onClick:()=>Ye(G.page+1),children:l(`nextPage`)})]})]})]})]})]})})})]})}export{_ as ScheduledTasksPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Dt as t,E as n,Et as r,Pt as i,Y as a,_ as ee,a as te,c as ne,gt as re,it as ie,jt as ae,mt as oe,nt as se,t as ce}from"./icons-BP8YOS-Z.js";import{n as o}from"./react-vendor-Dr5xvL-e.js";import{Ct as s,Ot as c,V as le,dt as ue,ft as de,ht as fe,mt as pe,pt as me,wt as l,xt as he}from"./index-C6k5taeb.js";var u=e(i(),1),d=o(),ge=[{value:`off`,label:()=>c(`thinkingOff`)},{value:`low`,label:()=>c(`thinkingLow`)},{value:`medium`,label:()=>c(`thinkingMedium`)},{value:`high`,label:()=>c(`thinkingHigh`)},{value:`xhigh`,label:()=>c(`thinkingXHigh`)}];function _e(e){return`${e.provider} / ${e.id}`}function ve(e,t){return!!(e&&t&&e.api===t.api&&e.provider===t.provider&&e.id===t.id)}function f(e){return String(e).padStart(2,`0`)}function p(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?`-`:`${t.getFullYear()}-${f(t.getMonth()+1)}-${f(t.getDate())} ${f(t.getHours())}:${f(t.getMinutes())}`}function ye(e,t=20){let n=String(e||``).trim();return n.length>t?`${n.slice(0,t)}...`:n}function be(){return{scheduleText:``,title:``,instruction:``,cronExpression:``,scheduleRule:``,nextRunAt:``,enabled:!0,agentId:``,executionMode:`serial`}}function m(){return{taskId:``,status:``,trigger:``,keyword:``,startedFrom:``,startedTo:``,page:1,pageSize:10}}function xe(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 Se(e,t){return{...t,title:e.title,instruction:e.instruction,cronExpression:e.cronExpression??``,scheduleRule:e.scheduleRule,nextRunAt:e.nextRunAt,enabled:t.enabled}}function Ce(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 h(e){return!!(e.currentRunId||e.currentRunIds?.length)}function we(e){return(e.executionMode??`serial`)===`parallel`||!h(e)}function Te(e){return c(e===`parallel`?`taskExecutionModeParallel`:`taskExecutionModeSerial`)}function Ee(e){return!!(e.title.trim()&&e.instruction.trim()&&e.cronExpression.trim())}function De(e){return c(e===`enabled`?`taskEnabled`:e===`running`?`taskRunning`:e===`paused`?`taskPaused`:e===`completed`?`taskFinished`:e===`success`?`executionSuccess`:`taskFailed`)}function Oe(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 g(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 _({onOpenSession:e}){let[i,o]=(0,u.useState)([]),[f,_]=(0,u.useState)(`tasks`),[v,y]=(0,u.useState)(()=>be()),[b,ke]=(0,u.useState)(null),[x,S]=(0,u.useState)(null),[C,w]=(0,u.useState)(null),[T,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(null),[Ae,k]=(0,u.useState)(``),[A,j]=(0,u.useState)(!1),[M,N]=(0,u.useState)(``),[P,je]=(0,u.useState)([]),[F,I]=(0,u.useState)(),[L,R]=(0,u.useState)(`off`),[z,Me]=(0,u.useState)([]),[Ne,B]=(0,u.useState)(``),[V,H]=(0,u.useState)(()=>m()),[U,W]=(0,u.useState)(()=>m()),[G,Pe]=(0,u.useState)({runs:[],total:0,page:1,pageSize:10}),[Fe,Ie]=(0,u.useState)(!1),[Le,Re]=(0,u.useState)(null),[ze,Be]=(0,u.useState)([]),Ve=z[0]?.id??``;(0,u.useEffect)(()=>{if(!C)return;let e=()=>w(null);return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e)}},[C]);async function He(){o((await g(`/api/scheduled-tasks`)).tasks)}async function K(e=U){Ie(!0),N(``);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),Pe(await g(`/api/scheduled-tasks/runs?${t.toString()}`))}catch(e){N(e instanceof Error?e.message:c(`requestFailed`))}finally{Ie(!1)}}(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await g(`/api/project`);if(e)return;Me(t.projects??[])}catch{}}return t(),()=>{e=!0}},[]),(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await me(),n=await de(t),r=await pe(t),i=r.model??await fe(t)??n[0];if(e)return;je(n),I(i),R(r.thinkingLevel??ue(i))}catch(t){e||N(t instanceof Error?t.message:c(`requestFailed`))}}return t(),()=>{e=!0}},[]),(0,u.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await g(`/api/scheduled-tasks`);e||o(t.tasks)}catch(t){e||N(t instanceof Error?t.message:c(`requestFailed`))}};t();let n=window.setInterval(t,10*1e3);return()=>{e=!0,window.clearInterval(n)}},[]),(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await g(`/api/agent-profiles`);if(e)return;Be(t.agents)}catch(t){e||N(t instanceof Error?t.message:c(`requestFailed`))}}return t(),()=>{e=!0}},[]);let Ue=(0,u.useMemo)(()=>i.find(e=>e.id===b),[b,i]),q=(0,u.useMemo)(()=>i.find(e=>e.id===x)??null,[x,i]),We=(0,u.useMemo)(()=>i.filter(e=>e.status===`enabled`).length,[i]),J=Math.max(1,Math.ceil(G.total/G.pageSize));function Y(e){return e?ze.find(t=>t.id===e||t.name===e)?.label??e:c(`defaultAgent`)}function X(e,t){y(n=>({...n,[e]:t}))}function Z(e,t){H(n=>({...n,[e]:t}))}function Ge(){ke(null),B(Ve),y(be()),O(null),k(``),N(``)}function Ke(){Ge(),E(!0)}function Q(){A||(E(!1),Ge())}function qe(){let e={...V,page:1};H(e),W(e),K(e)}function Je(){let e=m();H(e),W(e),K(e)}function Ye(e){let t=Math.min(Math.max(1,e),J),n={...U,page:t};H(n),W(n),K(n)}function Xe(e){let t={...U,page:1,pageSize:e};H(t),W(t),K(t)}async function Ze(){let e=v.scheduleText.trim();if(e){j(!0),N(``);try{let t=await g(`/api/scheduled-tasks/parse`,{method:`POST`,body:JSON.stringify({instruction:e,model:F,thinkingLevel:L})});if(t.needMoreInfo||!t.task){k(t.question||`请补充任务信息。`),O(null);return}let n=t.task;k(``),O(n),y(e=>Se(n,e))}catch(e){N(e instanceof Error?e.message:c(`requestFailed`))}finally{j(!1)}}}async function Qe(){if(Ee(v)){j(!0),N(``);try{let e=z.find(e=>e.id===Ne),t={task:Ce(v),model:F,thinkingLevel:L,projectId:e?.id,projectName:e?.name};b?await g(`/api/scheduled-tasks/${encodeURIComponent(b)}`,{method:`PUT`,body:JSON.stringify(t)}):await g(`/api/scheduled-tasks`,{method:`POST`,body:JSON.stringify(t)}),Q(),await He(),f===`history`&&await K(U)}catch(e){N(e instanceof Error?e.message:c(`requestFailed`))}finally{j(!1)}}}function $e(e){w(null),ke(e.id),y(xe(e)),O(null),k(``),N(``),B(e.projectId??``),e.model&&I(e.model),e.thinkingLevel&&R(e.thinkingLevel),E(!0)}async function $(e,t){if(N(``),w(null),!(t===`delete`&&!await le({description:c(`confirmDeleteTask`),confirmLabel:c(`confirmDelete`),cancelLabel:c(`cancel`),variant:`destructive`})))try{t===`delete`?(await g(`/api/scheduled-tasks/${encodeURIComponent(e)}`,{method:`DELETE`}),b===e&&Q(),x===e&&S(null)):await g(`/api/scheduled-tasks/${encodeURIComponent(e)}/${t}`,{method:`POST`}),await He(),f===`history`&&await K(U)}catch(e){N(e instanceof Error?e.message:c(`requestFailed`))}}function et(t){return(0,d.jsxs)(`div`,{className:`mt-2 space-y-2 text-xs text-muted-foreground`,children:[t.sessionId?(0,d.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>e?.(t.sessionId),children:c(`viewConversation`)}):null,(0,d.jsxs)(`div`,{children:[c(`executionAgent`),t.agentLabel||Y(t.agentId)]}),t.warning?(0,d.jsx)(`div`,{className:`text-amber-600`,children:t.warning}):null,t.inputContent?(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`font-medium text-foreground`,children:c(`runInputContent`)}),(0,d.jsx)(`pre`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap`,children:t.inputContent})]}):null,t.aiResult||t.result?(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`font-medium text-foreground`,children:c(`runAiResult`)}),(0,d.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap`,children:t.aiResult||t.result})]}):null,t.errorMessage?(0,d.jsx)(`div`,{className:`text-destructive`,children:t.errorMessage}):null,t.durationMs?(0,d.jsxs)(`div`,{children:[c(`runDuration`),t.durationMs,`ms`]}):null]})}return(0,d.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,d.jsxs)(`div`,{className:`border-b border-border px-6 py-5`,children:[(0,d.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:T||q?(0,d.jsxs)(s,{variant:`outline`,onClick:()=>{T?Q():S(null)},children:[(0,d.jsx)(ae,{className:`mr-1 size-4`}),c(`back`)]}):(0,d.jsx)(s,{onClick:Ke,children:c(`createTask`)})}),!T&&!q?(0,d.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,d.jsxs)(`button`,{type:`button`,className:l(`rounded-full px-4 py-2 text-sm font-medium transition-colors`,f===`tasks`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:text-foreground`),onClick:()=>_(`tasks`),children:[c(`taskListTab`),` `,(0,d.jsx)(`span`,{className:`opacity-80`,children:i.length})]}),(0,d.jsx)(`button`,{type:`button`,className:l(`rounded-full px-4 py-2 text-sm font-medium transition-colors`,f===`history`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:text-foreground`),onClick:()=>{_(`history`),K(U)},children:c(`executionHistoryTab`)})]}):null]}),(0,d.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,d.jsx)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:T?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-5 space-y-4`,children:[(0,d.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5 text-base font-semibold text-foreground`,children:[c(Ue?`editTask`:`createTask`),(0,d.jsx)(he,{label:c(`quickAiParseTask`)})]}),(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[c(`taskScheduleDescriptionLabel`),(0,d.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:v.scheduleText,onChange:e=>X(`scheduleText`,e.target.value),placeholder:c(`taskScheduleDescriptionPlaceholder`)})]}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,d.jsxs)(s,{onClick:Ze,disabled:A||!F||!v.scheduleText.trim(),children:[(0,d.jsx)(ne,{className:`mr-1 size-3.5`}),c(`aiParseTask`)]}),Ae?(0,d.jsx)(`span`,{className:`text-sm text-amber-600`,children:Ae}):null]}),(0,d.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[c(`taskTitleLabel`),(0,d.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:v.title,onChange:e=>X(`title`,e.target.value),placeholder:c(`taskTitlePlaceholder`)})]}),(0,d.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[c(`executionRule`),(0,d.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:v.scheduleRule||`-`})]}),(0,d.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[`cron`,(0,d.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:v.cronExpression||`-`})]}),(0,d.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[c(`nextExecutionTime`),(0,d.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:p(v.nextRunAt)})]}),(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground sm:col-span-2`,children:[(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[c(`taskExecutionMode`),(0,d.jsx)(he,{label:c(`taskExecutionModeHelp`)})]}),(0,d.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:v.executionMode,onChange:e=>X(`executionMode`,e.target.value),children:[(0,d.jsx)(`option`,{value:`serial`,children:c(`taskExecutionModeSerial`)}),(0,d.jsx)(`option`,{value:`parallel`,children:c(`taskExecutionModeParallel`)})]})]}),(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground sm:col-span-2`,children:[c(`promptContentLabel`),(0,d.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:v.instruction,onChange:e=>X(`instruction`,e.target.value),placeholder:c(`promptContentPlaceholder`)})]})]}),(0,d.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:v.enabled,onChange:e=>X(`enabled`,e.target.checked)}),c(`taskEnabledSwitch`)]}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-border bg-muted/20 px-2 py-2`,children:[(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(ne,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.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:F?`${F.provider}\u0000${F.id}`:``,onChange:e=>{let t=P.find(t=>`${t.provider}\u0000${t.id}`===e.target.value);I(t),R(ue(t))},title:c(`taskModel`),children:[P.length===0?(0,d.jsx)(`option`,{value:``,children:c(`noModelAvailable`)}):null,P.map(e=>(0,d.jsxs)(`option`,{value:`${e.provider}\u0000${e.id}`,children:[_e(e),ve(e,F)?` ✓`:``]},`${e.provider}:${e.id}`))]})]}),(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(r,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.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:L,onChange:e=>R(e.target.value),title:c(`taskThinking`),children:ge.map(e=>(0,d.jsx)(`option`,{value:e.value,children:e.label()},e.value))})]}),(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(a,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.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:Ne,onChange:e=>B(e.target.value),title:c(`taskProjectLabel`),children:[(0,d.jsx)(`option`,{value:``,children:c(`noProjectBound`)}),z.map(e=>(0,d.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(t,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.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:v.agentId,onChange:e=>X(`agentId`,e.target.value),title:c(`executionAgent`),children:[(0,d.jsx)(`option`,{value:``,children:c(`defaultAgent`)}),ze.map(e=>(0,d.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]})]}),D?(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/30 p-3 text-sm`,children:[(0,d.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium text-foreground`,children:[(0,d.jsx)(re,{className:`size-4 text-emerald-600`}),c(`aiParsed`)]}),(0,d.jsxs)(`div`,{className:`grid gap-2 text-muted-foreground sm:grid-cols-2`,children:[(0,d.jsxs)(`div`,{children:[c(`taskName`),(0,d.jsx)(`span`,{className:`text-foreground`,children:D.title})]}),(0,d.jsxs)(`div`,{children:[c(`executionRule`),(0,d.jsx)(`span`,{className:`text-foreground`,children:D.scheduleRule})]}),(0,d.jsxs)(`div`,{children:[`cron:`,(0,d.jsx)(`span`,{className:`font-mono text-foreground`,children:D.cronExpression??`-`})]}),(0,d.jsxs)(`div`,{children:[c(`nextExecutionTime`),(0,d.jsx)(`span`,{className:`text-foreground`,children:p(D.nextRunAt)})]}),(0,d.jsxs)(`div`,{className:`sm:col-span-2`,children:[c(`aiInstruction`),(0,d.jsx)(`span`,{className:`text-foreground`,children:D.instruction})]})]})]}):null,M?(0,d.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:M}):null]}),(0,d.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,d.jsx)(s,{variant:`outline`,onClick:Q,disabled:A,children:c(`cancel`)}),(0,d.jsx)(s,{onClick:Qe,disabled:A||!F||!Ee(v),children:c(Ue?`saveTask`:`confirmCreate`)})]})]}):q?(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-card`,children:[(0,d.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-border px-5 py-4`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:q.title}),(0,d.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:q.scheduleRule})]})}),(0,d.jsx)(`div`,{className:`px-5 py-4`,children:(0,d.jsxs)(`div`,{className:`space-y-4 text-sm`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`mb-1 font-medium text-foreground`,children:c(`taskContent`)}),(0,d.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:q.instruction})]}),(0,d.jsxs)(`div`,{className:`grid gap-3 text-muted-foreground sm:grid-cols-2`,children:[(0,d.jsxs)(`div`,{children:[c(`executionRule`),(0,d.jsx)(`span`,{className:`text-foreground`,children:q.scheduleRule})]}),(0,d.jsxs)(`div`,{children:[c(`taskExecutionMode`),`:`,(0,d.jsx)(`span`,{className:`text-foreground`,children:Te(q.executionMode)})]}),(0,d.jsxs)(`div`,{children:[`cron:`,(0,d.jsx)(`span`,{className:`font-mono text-foreground`,children:q.cronExpression??`-`})]}),(0,d.jsxs)(`div`,{children:[c(`lastExecution`),(0,d.jsx)(`span`,{className:`text-foreground`,children:p(q.lastRunAt)})]}),(0,d.jsxs)(`div`,{children:[c(`nextExecution`),(0,d.jsx)(`span`,{className:`text-foreground`,children:p(q.nextRunAt)})]}),(0,d.jsxs)(`div`,{children:[c(`executionAgent`),(0,d.jsx)(`span`,{className:`text-foreground`,children:Y(q.agentId)})]}),q.projectName?(0,d.jsxs)(`div`,{children:[c(`taskProject`),(0,d.jsx)(`span`,{className:`text-foreground`,children:q.projectName})]}):null,q.model?(0,d.jsxs)(`div`,{children:[c(`taskModel`),`:`,(0,d.jsx)(`span`,{className:`text-foreground`,children:_e(q.model)})]}):null,q.thinkingLevel?(0,d.jsxs)(`div`,{children:[c(`taskThinkingLevel`),(0,d.jsx)(`span`,{className:`text-foreground`,children:ge.find(e=>e.value===q.thinkingLevel)?.label()??q.thinkingLevel})]}):null,(0,d.jsxs)(`div`,{children:[c(`createdAt`),`:`,(0,d.jsx)(`span`,{className:`text-foreground`,children:p(q.createdAt)})]})]}),q.runs?.length>0?(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`mb-2 font-medium text-foreground`,children:c(`recentExecutions`)}),(0,d.jsx)(`div`,{className:`space-y-2`,children:q.runs.slice(0,5).map(e=>(0,d.jsxs)(`details`,{className:`rounded-lg border border-border bg-muted/20 p-2 text-xs text-muted-foreground`,children:[(0,d.jsxs)(`summary`,{className:`cursor-pointer text-foreground`,children:[p(e.startedAt),` · `,e.trigger===`manual`?c(`manualRun`):c(`autoRun`),` · `,De(e.status)]}),et(e)]},e.id))})]}):null]})}),(0,d.jsx)(`div`,{className:`border-t border-border px-5 py-4`,children:(0,d.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[q.lastSessionId?(0,d.jsx)(s,{variant:`outline`,onClick:()=>e?.(q.lastSessionId),children:c(`viewConversation`)}):null,(0,d.jsxs)(s,{variant:`outline`,disabled:!we(q),onClick:()=>void $(q.id,`run`),children:[(0,d.jsx)(ce,{className:`mr-1 size-3.5`}),c(`executeNow`)]}),(0,d.jsxs)(s,{variant:`outline`,disabled:h(q),onClick:()=>$e(q),children:[(0,d.jsx)(n,{className:`mr-1 size-3.5`}),c(`editTask`)]}),(0,d.jsxs)(s,{variant:`destructive`,disabled:h(q),onClick:()=>void $(q.id,`delete`),children:[(0,d.jsx)(te,{className:`mr-1 size-3.5`}),c(`deleteTask`)]})]})})]}):(0,d.jsxs)(d.Fragment,{children:[M?(0,d.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:M}):null,f===`tasks`?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:(0,d.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:c(`taskList`)}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(`tasksCount`,{total:i.length,enabled:We})})]})})}),(0,d.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:i.length===0?(0,d.jsx)(`div`,{className:`rounded-lg px-3 py-3 text-center text-xs text-muted-foreground/55 md:col-span-2`,children:c(`noScheduledTasks`)}):i.map(e=>{let r=e.status===`enabled`,i=e.status===`completed`,a=h(e);return(0,d.jsxs)(`div`,{className:`relative cursor-pointer rounded-xl border border-border bg-card p-4 transition-colors hover:bg-muted/15`,onClick:()=>S(e.id),children:[(0,d.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,d.jsxs)(`div`,{className:`min-w-0`,children:[(0,d.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,d.jsx)(`h3`,{className:`truncate text-sm font-medium text-foreground/90`,children:e.title})}),(0,d.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:ye(e.instruction,20)})]}),(0,d.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,d.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":r,disabled:i,className:l(`relative h-6 w-11 rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60`,r?`bg-emerald-500`:`bg-muted-foreground/30`),onClick:()=>void $(e.id,e.status===`paused`?`resume`:`pause`),title:e.status===`paused`?c(`enable`):c(`pauseTask`),children:(0,d.jsx)(`span`,{className:l(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,r?`translate-x-5`:`translate-x-0`)})}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(s,{variant:`ghost`,size:`icon`,onClick:()=>w(C===e.id?null:e.id),title:c(`moreActions`),children:(0,d.jsx)(ie,{className:`size-4`})}),C===e.id?(0,d.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,d.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:!we(e),onClick:()=>void $(e.id,`run`),children:[(0,d.jsx)(ce,{className:`size-3.5`}),c(`executeNow`)]}),(0,d.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,d.jsx)(n,{className:`size-3.5`}),c(`editTask`)]}),(0,d.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted`,onClick:()=>{w(null),S(e.id)},children:[(0,d.jsx)(se,{className:`size-3.5`}),c(`viewDetails`)]}),(0,d.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,d.jsx)(te,{className:`size-3.5`}),c(`deleteTask`)]})]}):null]})]})]}),(0,d.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,d.jsx)(oe,{className:`size-3`}),e.scheduleRule]}),(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,d.jsx)(t,{className:`size-3`}),Y(e.agentId)]}),(0,d.jsxs)(`span`,{children:[c(`taskExecutionMode`),`:`,Te(e.executionMode)]}),e.projectName?(0,d.jsxs)(`span`,{children:[c(`taskProject`),e.projectName]}):null]}),(0,d.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,d.jsxs)(`span`,{children:[c(`lastExecution`),p(e.lastRunAt)]}),(0,d.jsxs)(`span`,{children:[c(`nextExecution`),p(e.nextRunAt)]})]})]},e.id)})})]}):(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,d.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,d.jsx)(ee,{className:`size-4`}),c(`historyFilters`)]}),(0,d.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`taskName`),(0,d.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.taskId,onChange:e=>Z(`taskId`,e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:c(`allTasks`)}),i.map(e=>(0,d.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`status`),(0,d.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.status,onChange:e=>Z(`status`,e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:c(`allStatuses`)}),(0,d.jsx)(`option`,{value:`running`,children:c(`executionRunning`)}),(0,d.jsx)(`option`,{value:`success`,children:c(`executionSuccess`)}),(0,d.jsx)(`option`,{value:`failed`,children:c(`taskFailed`)})]})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`triggerType`),(0,d.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.trigger,onChange:e=>Z(`trigger`,e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:c(`allTriggers`)}),(0,d.jsx)(`option`,{value:`schedule`,children:c(`autoRun`)}),(0,d.jsx)(`option`,{value:`manual`,children:c(`manualRun`)})]})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`startTime`),(0,d.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:V.startedFrom,onChange:e=>Z(`startedFrom`,e.target.value)})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`endTime`),(0,d.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:V.startedTo,onChange:e=>Z(`startedTo`,e.target.value)})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`keyword`),(0,d.jsx)(`input`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.keyword,onChange:e=>Z(`keyword`,e.target.value),placeholder:c(`keywordPlaceholder`)})]})]}),(0,d.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,d.jsx)(s,{variant:`outline`,onClick:Je,children:c(`reset`)}),(0,d.jsx)(s,{onClick:qe,children:c(`query`)})]})]}),(0,d.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,d.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,d.jsx)(`span`,{children:c(`taskName`)}),(0,d.jsx)(`span`,{children:c(`status`)}),(0,d.jsx)(`span`,{children:c(`triggerType`)}),(0,d.jsx)(`span`,{children:c(`startTime`)}),(0,d.jsx)(`span`,{children:c(`runDuration`)})]}),Fe?(0,d.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:c(`loading`)}):G.runs.length===0?(0,d.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:c(`noExecutionHistory`)}):G.runs.map(e=>(0,d.jsxs)(`div`,{className:`border-b border-border last:border-b-0`,children:[(0,d.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:()=>Re(Le===e.id?null:e.id),children:[(0,d.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:e.taskTitle}),(0,d.jsx)(`span`,{children:(0,d.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-xs`,Oe(e.status)),children:De(e.status)})}),(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:e.trigger===`manual`?c(`manualRun`):c(`autoRun`)}),(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:p(e.startedAt)}),(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:e.durationMs?`${e.durationMs}ms`:`-`})]}),Le===e.id?(0,d.jsx)(`div`,{className:`border-t border-border bg-muted/20 px-4 py-3`,children:et(e)}):null]},`${e.taskId}:${e.id}`)),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3 text-sm text-muted-foreground`,children:[(0,d.jsx)(`span`,{children:c(`paginationSummary`,{page:G.page,pages:J,total:G.total})}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`select`,{className:`h-8 rounded-md border border-input bg-background px-2 text-sm`,value:G.pageSize,onChange:e=>Xe(Number(e.target.value)),children:[10,20,50,100].map(e=>(0,d.jsx)(`option`,{value:e,children:c(`pageSize`,{size:e})},e))}),(0,d.jsx)(s,{variant:`outline`,size:`sm`,disabled:G.page<=1,onClick:()=>Ye(G.page-1),children:c(`previousPage`)}),(0,d.jsx)(s,{variant:`outline`,size:`sm`,disabled:G.page>=J,onClick:()=>Ye(G.page+1),children:c(`nextPage`)})]})]})]})]})]})})})]})}export{_ as ScheduledTasksPage};
|