@shawnstack/quickforge 1.5.4 → 1.5.6
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 +11 -11
- package/dist/assets/AgentProfilesPage-DFUA4KiP.js +1 -0
- package/dist/assets/{ChatPanelHost-nzOC6Tbg.js → ChatPanelHost-CBoFtBvB.js} +55 -55
- package/dist/assets/PluginsPage-CKOP-P02.js +1 -0
- package/dist/assets/ScheduledTasksPage-CRPvyfmE.js +2 -0
- package/dist/assets/SettingsWorkspacePage-Csr6xu0M.js +1320 -0
- package/dist/assets/SharedConversationPage-7I9MiMcj.js +1 -0
- package/dist/assets/TerminalDock-DWZAOy7v.js +2 -0
- package/dist/assets/WorkspaceInspector-D4k8zQ4s.js +3 -0
- package/dist/assets/WorkspaceReaderDialog-Dli8GgAq.js +1 -0
- package/dist/assets/diff-line-counts-Dvz3MNk2.js +10 -0
- package/dist/assets/icons-DXrzz0RO.js +1 -0
- package/dist/assets/index-BDNDRaPf.css +3 -0
- package/dist/assets/index-BIslkXQt.js +69 -0
- package/dist/assets/mcp-servers-dialog-DXR3fnZY.js +20 -0
- package/dist/assets/{monaco-dMY7_GLO.js → monaco-k8av2MY0.js} +1 -1
- package/dist/assets/{pi-web-ui-CBet4bMl.js → pi-web-ui-DFNE2m5b.js} +1 -1
- package/dist/assets/{react-vendor-DsAeMFcm.js → react-vendor-xMa3TUTb.js} +1 -1
- package/dist/assets/skills-dialog-Dax-_Ze5.js +1 -0
- package/dist/assets/useAppTheme-BzB8Q6AC.js +1 -0
- package/dist/index.html +7 -5
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/agent-manager.mjs +23 -1
- package/server/approval-store.mjs +34 -2
- package/server/index.mjs +3 -0
- package/server/public-api.mjs +45 -0
- package/server/routes/storage.mjs +29 -9
- package/server/storage.mjs +13 -4
- package/dist/assets/AgentProfilesPage-CGm7ZzRM.js +0 -1
- package/dist/assets/PluginsPage-K3o4AB2E.js +0 -1
- package/dist/assets/ScheduledTasksPage-BVjejep8.js +0 -2
- package/dist/assets/SharedConversationPage-BwmUajLr.js +0 -1
- package/dist/assets/TerminalDock-D-GWlS7P.js +0 -2
- package/dist/assets/WorkspaceInspector-CEU6nnM-.js +0 -3
- package/dist/assets/WorkspaceReaderDialog-D9Qy6LUm.js +0 -1
- package/dist/assets/diff-line-counts-DCot_pZu.js +0 -10
- package/dist/assets/icons-DzxBk7tb.js +0 -1
- package/dist/assets/index-CkQWeO9c.css +0 -3
- package/dist/assets/index-DTiIspXQ.js +0 -1482
- /package/dist/assets/{plugin-api-YfYj_Bd7.js → plugin-api-UKg_cgSG.js} +0 -0
- /package/dist/assets/{xterm-5XDrJ343.js → xterm-BtSXYfUR.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t,I as n,b as r,i,r as a,u as o,y as s}from"./icons-DXrzz0RO.js";import{n as c}from"./react-vendor-xMa3TUTb.js";import{$ as l,Q as u,et as d,it as f}from"./index-BIslkXQt.js";import{n as p,r as m,t as h}from"./plugin-api-UKg_cgSG.js";var g=e(t(),1),_=c();function v(e){return e===`loaded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`error`?`bg-destructive/10 text-destructive`:`bg-muted text-muted-foreground`}function y(e){return e===`loaded`?f(`pluginStatusLoaded`):e===`disabled`?f(`pluginStatusDisabled`):e===`error`?f(`pluginStatusError`):e}function b(e){switch(e){case`openai-documents`:return{label:f(`pluginOpenaiDocumentsName`),description:f(`pluginOpenaiDocumentsDescription`)};case`openai-spreadsheets`:return{label:f(`pluginOpenaiSpreadsheetsName`),description:f(`pluginOpenaiSpreadsheetsDescription`)};case`openai-presentations`:return{label:f(`pluginOpenaiPresentationsName`),description:f(`pluginOpenaiPresentationsDescription`)};default:return null}}function x(e){return b(e.name)?.label||(e.displayName||e.name).replace(/^OpenAI\s+/i,``)}function S(e){return b(e.name)?.description||e.description||f(`noDescription`)}function C(e){return(e.label||e.name||e.quickForgeName).replace(/^OpenAI\s+/i,``)}function w({onChanged:e}){let[t,c]=(0,g.useState)(null),[b,w]=(0,g.useState)(!0),[T,E]=(0,g.useState)(null),[D,O]=(0,g.useState)(null),[k,A]=(0,g.useState)(null),j=(0,g.useCallback)(async(t=`load`)=>{A(null),w(!0);try{c(t===`reload`?await p():await h()),t===`reload`&&e?.()}catch(e){A(e instanceof Error?e.message:f(`pluginsLoadFailed`))}finally{w(!1)}},[e]);(0,g.useEffect)(()=>{let e=!1;return h().then(t=>{e||c(t)}).catch(t=>{e||A(t instanceof Error?t.message:f(`pluginsLoadFailed`))}).finally(()=>{e||w(!1)}),()=>{e=!0}},[]);let M=(0,g.useMemo)(()=>{let e=t?.plugins||[];return{total:e.length,enabled:e.filter(e=>e.enabled).length,tools:e.reduce((e,t)=>e+t.tools.length,0)}},[t]),N=(0,g.useMemo)(()=>D&&(t?.plugins||[]).find(e=>e.name===D)||null,[t,D]),P=async(t,n)=>{E(t),A(null);try{c(await m(t,n)),e?.()}catch(e){A(e instanceof Error?e.message:f(`pluginsSaveFailed`))}finally{E(null)}};return(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,_.jsxs)(`div`,{className:`border-b border-border px-6 py-5`,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-2xl bg-primary/10 text-primary`,children:(0,_.jsx)(r,{className:`size-5`})}),(0,_.jsx)(`div`,{children:(0,_.jsxs)(`h1`,{className:`inline-flex items-center gap-1.5 text-lg font-semibold text-foreground`,children:[f(`plugins`),(0,_.jsx)(u,{label:f(`pluginsDescription`)})]})})]}),(0,_.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>void j(`reload`),disabled:b,children:[b?(0,_.jsx)(n,{className:`mr-2 size-4 animate-spin`}):(0,_.jsx)(s,{className:`mr-2 size-4`}),f(`pluginsReload`)]})]}),(0,_.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[(0,_.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5`,children:f(`pluginsCount`,M)}),(0,_.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5`,children:f(`pluginToolsCount`,{count:M.tools})})]})]}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,_.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:[k?(0,_.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:k}):null,t?.errors?.length?(0,_.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-amber-500/30 bg-amber-500/8 p-3 text-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-amber-700 dark:text-amber-300`,children:[(0,_.jsx)(i,{className:`size-4`}),f(`pluginDiscoveryErrors`)]}),t.errors.map((e,t)=>(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[(0,_.jsx)(`span`,{className:`font-mono text-xs`,children:e.dir}),`: `,e.error]},`${e.dir}-${t}`))]}):null,b&&!t?(0,_.jsxs)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:[(0,_.jsx)(n,{className:`mr-2 size-4 animate-spin`}),f(`loadingPlugins`)]}):null,!b&&t&&t.plugins.length===0?(0,_.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/15 p-4 text-xs text-muted-foreground/55`,children:[(0,_.jsx)(`div`,{className:`text-base font-medium text-foreground`,children:f(`noPlugins`)}),(0,_.jsx)(`p`,{className:`mt-2`,children:f(`noPluginsDescription`)}),(0,_.jsx)(`div`,{className:`mt-4 space-y-1`,children:(t.searchPaths||[]).map(e=>(0,_.jsx)(`div`,{className:`font-mono text-xs`,children:e},e))})]}):null,(0,_.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:(t?.plugins||[]).map(e=>(0,_.jsxs)(`article`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,_.jsx)(`h2`,{className:`truncate text-sm font-medium text-foreground/90`,children:x(e)}),(0,_.jsxs)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground`,children:[`v`,e.version]}),(0,_.jsx)(`span`,{className:d(`rounded-full px-2 py-0.5 text-xs`,v(e.status)),children:y(e.status)})]}),(0,_.jsx)(`p`,{className:`mt-2 line-clamp-2 text-sm text-muted-foreground`,children:S(e)})]}),(0,_.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1.5`,children:[(0,_.jsxs)(l,{variant:e.enabled?`outline`:`default`,size:`sm`,disabled:T===e.name,onClick:()=>void P(e.name,!e.enabled),children:[T===e.name?(0,_.jsx)(n,{className:`mr-2 size-4 animate-spin`}):null,e.enabled?f(`disablePlugin`):f(`enablePlugin`)]}),(0,_.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>O(e.name),children:f(`viewDetails`)})]})]}),e.error?(0,_.jsx)(`div`,{className:`mt-3 rounded-lg border border-destructive/30 bg-destructive/8 px-3 py-2 text-sm text-destructive`,children:e.error}):null,(0,_.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 border-t border-border pt-3 text-xs text-muted-foreground`,children:[(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,_.jsx)(a,{className:`size-3`}),f(`pluginToolsCount`,{count:e.tools.length})]}),(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,_.jsx)(o,{className:`size-3`}),f(`pluginPermissionsCount`,{count:e.permissions.length})]}),(0,_.jsx)(`span`,{children:e.enabled?f(`enabled`):f(`disabled`)})]})]},e.name))})]})}),N?(0,_.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onMouseDown:e=>{e.target===e.currentTarget&&O(null)},children:(0,_.jsxs)(`div`,{className:`flex max-h-[90vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-quickforge`,onMouseDown:e=>e.stopPropagation(),children:[(0,_.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-border px-5 py-4`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`h2`,{className:`text-base font-medium text-foreground`,children:f(`pluginDetails`)}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-sm text-muted-foreground`,children:x(N)})]}),(0,_.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>O(null),children:f(`close`)})]}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,_.jsxs)(`div`,{className:`space-y-4`,children:[N.error?(0,_.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/8 px-3 py-2 text-sm text-destructive`,children:N.error}):null,(0,_.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S(N)}),(0,_.jsxs)(`div`,{className:`mt-3 grid gap-2 border-t border-border pt-3 text-xs text-muted-foreground sm:grid-cols-2`,children:[(0,_.jsxs)(`span`,{children:[f(`pluginVersion`),`:`,N.version]}),(0,_.jsxs)(`span`,{children:[f(`status`),`:`,y(N.status)]}),(0,_.jsx)(`span`,{children:f(`pluginToolsCount`,{count:N.tools.length})}),(0,_.jsx)(`span`,{children:N.enabled?f(`enabled`):f(`disabled`)})]})]}),(0,_.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,_.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,_.jsx)(a,{className:`size-4 text-muted-foreground`}),f(`pluginTools`)]}),N.tools.length?(0,_.jsx)(`div`,{className:`space-y-2`,children:N.tools.map(e=>(0,_.jsxs)(`div`,{className:`rounded-xl bg-muted/30 px-3 py-2`,children:[(0,_.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:C(e)}),e.description?(0,_.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.description}):null]},e.quickForgeName))}):(0,_.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:f(`pluginNoTools`)})]}),(0,_.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,_.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,_.jsx)(o,{className:`size-4 text-muted-foreground`}),f(`pluginPermissions`)]}),N.permissions.length?(0,_.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:N.permissions.map(e=>(0,_.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground`,children:e},e))}):(0,_.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:f(`pluginNoPermissions`)}),(0,_.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground/80`,children:f(`pluginTrustedNotice`)})]})]})})]})}):null]})}export{w as PluginsPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t,Ct as n,H as r,T as i,Tt as ee,a as te,c as ne,dt as re,g as ie,n as ae,pt as oe,rt as se,t as ce,tt as le,wt as ue}from"./icons-DXrzz0RO.js";import{n as a}from"./react-vendor-xMa3TUTb.js";import{$ as o,G as de,H as fe,K as pe,M as me,Q as s,U as he,W as ge,et as c,it as l}from"./index-BIslkXQt.js";var u=e(t(),1),d=a(),_e=[{value:`off`,label:()=>l(`thinkingOff`)},{value:`low`,label:()=>l(`thinkingLow`)},{value:`medium`,label:()=>l(`thinkingMedium`)},{value:`high`,label:()=>l(`thinkingHigh`)},{value:`xhigh`,label:()=>l(`thinkingXHigh`)}];function ve(e){return`${e.provider} / ${e.id}`}function ye(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 be(e,t=20){let n=String(e||``).trim();return n.length>t?`${n.slice(0,t)}...`:n}function m(){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 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 g(e){return!!(e.currentRunId||e.currentRunIds?.length)}function we(e){return(e.executionMode??`serial`)===`parallel`||!g(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 _(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[t,a]=(0,u.useState)([]),[f,v]=(0,u.useState)(`tasks`),[y,b]=(0,u.useState)(()=>m()),[x,ke]=(0,u.useState)(null),[S,C]=(0,u.useState)(null),[w,T]=(0,u.useState)(null),[Ae,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(null),[je,k]=(0,u.useState)(``),[A,j]=(0,u.useState)(!1),[M,N]=(0,u.useState)(``),[P,Me]=(0,u.useState)([]),[F,I]=(0,u.useState)(),[L,R]=(0,u.useState)(`off`),[z,Ne]=(0,u.useState)([]),[Pe,B]=(0,u.useState)(``),[V,H]=(0,u.useState)(()=>h()),[U,W]=(0,u.useState)(()=>h()),[G,Fe]=(0,u.useState)({runs:[],total:0,page:1,pageSize:10}),[Ie,Le]=(0,u.useState)(!1),[Re,ze]=(0,u.useState)(null),[Be,Ve]=(0,u.useState)([]),He=z[0]?.id??``;(0,u.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 Ue(){a((await _(`/api/scheduled-tasks`)).tasks)}async function K(e=U){Le(!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),Fe(await _(`/api/scheduled-tasks/runs?${t.toString()}`))}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}finally{Le(!1)}}(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await _(`/api/project`);if(e)return;Ne(t.projects??[])}catch{}}return t(),()=>{e=!0}},[]),(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await ge(),n=await he(t),r=await de(t),i=r.model??await pe(t)??n[0];if(e)return;Me(n),I(i),R(r.thinkingLevel??fe(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 _(`/api/scheduled-tasks`);e||a(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 _(`/api/agent-profiles`);if(e)return;Ve(t.agents)}catch(t){e||N(t instanceof Error?t.message:l(`requestFailed`))}}return t(),()=>{e=!0}},[]);let We=(0,u.useMemo)(()=>t.find(e=>e.id===x),[x,t]),q=(0,u.useMemo)(()=>t.find(e=>e.id===S)??null,[S,t]),Ge=(0,u.useMemo)(()=>t.filter(e=>e.status===`enabled`).length,[t]),J=Math.max(1,Math.ceil(G.total/G.pageSize));function Y(e){return e?Be.find(t=>t.id===e||t.name===e)?.label??e:l(`defaultAgent`)}function X(e,t){b(n=>({...n,[e]:t}))}function Z(e,t){H(n=>({...n,[e]:t}))}function Ke(){ke(null),B(He),b(m()),O(null),k(``),N(``)}function qe(){Ke(),E(!0)}function Q(){A||(E(!1),Ke())}function Je(){let e={...V,page:1};H(e),W(e),K(e)}function Ye(){let e=h();H(e),W(e),K(e)}function Xe(e){let t=Math.min(Math.max(1,e),J),n={...U,page:t};H(n),W(n),K(n)}function Ze(e){let t={...U,page:1,pageSize:e};H(t),W(t),K(t)}async function Qe(){let e=y.scheduleText.trim();if(e){j(!0),N(``);try{let t=await _(`/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),b(e=>Se(n,e))}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}finally{j(!1)}}}async function $e(){if(Ee(y)){j(!0),N(``);try{let e=z.find(e=>e.id===Pe),t={task:Ce(y),model:F,thinkingLevel:L,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 Ue(),f===`history`&&await K(U)}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}finally{j(!1)}}}function et(e){T(null),ke(e.id),b(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(``),T(null),!(t===`delete`&&!await me({description:l(`confirmDeleteTask`),confirmLabel:l(`confirmDelete`),cancelLabel:l(`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 Ue(),f===`history`&&await K(U)}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}}function tt(t){return(0,d.jsxs)(`div`,{className:`mt-2 space-y-2 text-xs text-muted-foreground`,children:[t.sessionId?(0,d.jsx)(o,{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.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-2xl bg-primary/10 text-primary`,children:(0,d.jsx)(n,{className:`size-5`})}),(0,d.jsx)(`div`,{children:(0,d.jsxs)(`h1`,{className:`inline-flex items-center gap-1.5 text-lg font-semibold text-foreground`,children:[l(`scheduledTasks`),(0,d.jsx)(s,{label:l(`scheduledTasksDescription`)})]})})]}),(0,d.jsx)(o,{onClick:qe,children:l(`createTask`)})]}),(0,d.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,d.jsxs)(`button`,{type:`button`,className:c(`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:()=>v(`tasks`),children:[l(`taskListTab`),` `,(0,d.jsx)(`span`,{className:`opacity-80`,children:t.length})]}),(0,d.jsx)(`button`,{type:`button`,className:c(`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:()=>{v(`history`),K(U)},children:l(`executionHistoryTab`)})]})]}),(0,d.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,d.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:[M&&!Ae?(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:t.length,enabled:Ge})})]})})}),(0,d.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:t.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`)}):t.map(e=>{let t=e.status===`enabled`,n=e.status===`completed`,r=g(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:()=>C(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:be(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":t,disabled:n,className:c(`relative h-6 w-11 rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60`,t?`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:c(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,t?`translate-x-5`:`translate-x-0`)})}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(o,{variant:`ghost`,size:`icon`,onClick:()=>T(w===e.id?null:e.id),title:l(`moreActions`),children:(0,d.jsx)(se,{className:`size-4`})}),w===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:r,onClick:()=>et(e),children:[(0,d.jsx)(i,{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:()=>{T(null),C(e.id)},children:[(0,d.jsx)(le,{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:r,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)(re,{className:`size-3`}),e.scheduleRule]}),(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,d.jsx)(ee,{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)(ie,{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`)}),t.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)(o,{variant:`outline`,onClick:Ye,children:l(`reset`)}),(0,d.jsx)(o,{onClick:Je,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`)})]}),Ie?(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:()=>ze(Re===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:c(`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`:`-`})]}),Re===e.id?(0,d.jsx)(`div`,{className:`border-t border-border bg-muted/20 px-4 py-3`,children:tt(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=>Ze(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)(o,{variant:`outline`,size:`sm`,disabled:G.page<=1,onClick:()=>Xe(G.page-1),children:l(`previousPage`)}),(0,d.jsx)(o,{variant:`outline`,size:`sm`,disabled:G.page>=J,onClick:()=>Xe(G.page+1),children:l(`nextPage`)})]})]})]})]})]})}),q?(0,d.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onMouseDown:e=>{e.target===e.currentTarget&&C(null)},children:(0,d.jsxs)(`div`,{className:`flex max-h-[90vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-quickforge`,onMouseDown:e=>e.stopPropagation(),children:[(0,d.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-border px-5 py-4`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,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)(o,{variant:`ghost`,size:`icon`,onClick:()=>C(null),children:(0,d.jsx)(ae,{className:`size-4`})})]}),(0,d.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto 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:ve(q.model)})]}):null,q.thinkingLevel?(0,d.jsxs)(`div`,{children:[l(`taskThinkingLevel`),(0,d.jsx)(`span`,{className:`text-foreground`,children:_e.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)]}),tt(e)]},e.id))})]}):null]})}),(0,d.jsx)(`div`,{className:`shrink-0 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)(o,{variant:`outline`,onClick:()=>e?.(q.lastSessionId),children:l(`viewConversation`)}):null,(0,d.jsxs)(o,{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)(o,{variant:`outline`,disabled:g(q),onClick:()=>et(q),children:[(0,d.jsx)(i,{className:`mr-1 size-3.5`}),l(`editTask`)]}),(0,d.jsxs)(o,{variant:`destructive`,disabled:g(q),onClick:()=>void $(q.id,`delete`),children:[(0,d.jsx)(te,{className:`mr-1 size-3.5`}),l(`deleteTask`)]})]})})]})}):null,Ae?(0,d.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onMouseDown:e=>{e.target===e.currentTarget&&Q()},children:(0,d.jsxs)(`div`,{className:`flex max-h-[90vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-quickforge`,onMouseDown:e=>e.stopPropagation(),children:[(0,d.jsx)(`div`,{className:`shrink-0 border-b border-border px-5 py-4`,children:(0,d.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5 text-base font-semibold text-foreground`,children:[l(We?`editTask`:`createTask`),(0,d.jsx)(s,{label:l(`quickAiParseTask`)})]})}),(0,d.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(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:y.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)(o,{onClick:Qe,disabled:A||!F||!y.scheduleText.trim(),children:[(0,d.jsx)(ne,{className:`mr-1 size-3.5`}),l(`aiParseTask`)]}),je?(0,d.jsx)(`span`,{className:`text-sm text-amber-600`,children:je}):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:y.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:y.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:y.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(y.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)(s,{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:y.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:y.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:y.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(fe(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:[ve(e),ye(e,F)?` ✓`:``]},`${e.provider}:${e.id}`))]})]}),(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(ue,{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:_e.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)(r,{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:Pe,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)(ee,{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:y.agentId,onChange:e=>X(`agentId`,e.target.value),title:l(`executionAgent`),children:[(0,d.jsx)(`option`,{value:``,children:l(`defaultAgent`)}),Be.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)(oe,{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.jsx)(`div`,{className:`shrink-0 border-t border-border px-5 py-4`,children:(0,d.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,d.jsx)(o,{variant:`outline`,onClick:Q,disabled:A,children:l(`cancel`)}),(0,d.jsx)(o,{onClick:$e,disabled:A||!F||!Ee(y),children:l(We?`saveTask`:`confirmCreate`)})]})})]})}):null]})}export{v as ScheduledTasksPage};
|