@shawnstack/quickforge 1.7.5 → 1.7.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/dist/assets/AgentProfilesPage-Dl5Peqov.js +1 -0
- package/dist/assets/ChatPanelHost-D3987TUJ.js +307 -0
- package/dist/assets/CloudAccountSettingsPage-BG5Nn3bq.js +1 -0
- package/dist/assets/PluginsPage-BDKYfLna.js +1 -0
- package/dist/assets/ScheduledTasksPage--GAki3lB.js +2 -0
- package/dist/assets/SettingsWorkspacePage-DSy66Tuw.js +1696 -0
- package/dist/assets/ShareLinksSettingsPage-BQQMsvJo.js +1 -0
- package/dist/assets/SharedConversationPage-B9BUVCri.js +1 -0
- package/dist/assets/TerminalDock-CT1nYo7P.js +2 -0
- package/dist/assets/{WorkspaceInspector-D9kdnLDd.js → WorkspaceInspector-BnfDLf9a.js} +5 -5
- package/dist/assets/{dist-DLKC_odd.js → dist-yDHbi5ux.js} +1 -1
- package/dist/assets/{esm-Df4edDpj.js → esm-sdsK6gaB.js} +2 -2
- package/dist/assets/{icons-CXPP1fFT.js → icons-2D18YbSI.js} +1 -1
- package/dist/assets/index-1ei6nhs-.css +3 -0
- package/dist/assets/index-BivLuZvX.js +65 -0
- package/dist/assets/{mcp-servers-dialog-BUSPvaqI.js → mcp-servers-dialog-BEV4_TXC.js} +2 -2
- package/dist/assets/{logger-8REuLPGK.js → model-display-label-C6-0eDxF.js} +1 -1
- package/dist/assets/{monaco-D6OhXgjg.js → monaco-DvXErxp2.js} +1 -1
- package/dist/assets/{react-vendor-1KC5PyRx.js → react-vendor-3UaA-C9W.js} +1 -1
- package/dist/assets/{skills-dialog-BThnIUBs.js → skills-dialog-BTJ7mzk_.js} +3 -3
- package/dist/assets/{web-DoV8MSMn.js → web-B5qgZJRv.js} +1 -1
- package/dist/index.html +8 -8
- package/dist/sw.js +17 -0
- package/package.json +2 -1
- package/runtime-assets/agent/darwin-arm64/qf-agent +0 -0
- package/runtime-assets/agent/darwin-x64/qf-agent +0 -0
- package/runtime-assets/agent/linux-arm64/qf-agent +0 -0
- package/runtime-assets/agent/linux-x64/qf-agent +0 -0
- package/runtime-assets/agent/win32-x64/qf-agent.exe +0 -0
- package/server/access-policy.mjs +11 -0
- package/server/agent-manager.mjs +349 -48
- package/server/agent-profiles.mjs +27 -8
- package/server/auto-compaction.mjs +35 -8
- package/server/cloud/client.mjs +4 -7
- package/server/cloud/config.mjs +6 -5
- package/server/cloud/credential-store.mjs +10 -3
- package/server/cloud/identity.mjs +17 -60
- package/server/cloud/models.mjs +1 -1
- package/server/cloud/qf-agent-process.mjs +571 -0
- package/server/cloud/runtime.mjs +11 -5
- package/server/cloud/service-config.mjs +8 -4
- package/server/index.mjs +96 -37
- package/server/mcp/registry.mjs +8 -7
- package/server/message-converters.mjs +40 -19
- package/server/model-catalog.mjs +11 -4
- package/server/opencode-acp-agent.mjs +1151 -0
- package/server/public-api.mjs +11 -5
- package/server/routes/agent-profiles.mjs +6 -3
- package/server/routes/agent.mjs +43 -3
- package/server/routes/backup.mjs +5 -4
- package/server/routes/cloud.mjs +54 -35
- package/server/routes/shares.mjs +7 -8
- package/server/routes/storage.mjs +9 -24
- package/server/routes/system.mjs +7 -4
- package/server/utils/process-tree.mjs +78 -0
- package/dist/assets/AgentProfilesPage-XNjuqJs7.js +0 -1
- package/dist/assets/ChatPanelHost-CuF-PZpc.js +0 -292
- package/dist/assets/CloudAccountSettingsPage-GJSoi6sO.js +0 -1
- package/dist/assets/PluginsPage-BQgp0qN-.js +0 -1
- package/dist/assets/ScheduledTasksPage-DdekATzq.js +0 -2
- package/dist/assets/SettingsWorkspacePage-Cb54Ic91.js +0 -1639
- package/dist/assets/ShareLinksSettingsPage-C75WJpaF.js +0 -1
- package/dist/assets/SharedConversationPage-CjMtSQTW.js +0 -1
- package/dist/assets/TerminalDock-D4zJBJc4.js +0 -2
- package/dist/assets/index-_ZhK6bvp.js +0 -65
- package/dist/assets/index-iVV2bP_f.css +0 -3
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{C as t,J as n,S as r,U as i,W as a,Wt as o,_ as ee,b as te,gt as ne,i as s,mt as re,p as ie,s as ae,u as c,ut as oe,vt as se}from"./icons-CXPP1fFT.js";import{n as l}from"./react-vendor-1KC5PyRx.js";import{At as ce,Bt as le,Ft as ue,Ht as de,I as fe,It as pe,L as u,Lt as me,Mt as he,Nt as ge,Pt as _e,Rt as ve,Ut as d,Vt as ye,dn as f,jt as be,kt as p,on as m,ot as h,sn as g,un as _,zt as xe}from"./index-_ZhK6bvp.js";var v=e(o(),1),y={usage:void 0,installations:[],models:[],errors:{},loading:!1};function Se(e,t){return t.type===`replace`?t.state:{...y,loading:t.type===`begin`}}async function Ce(e,t){let[n,r,i]=await Promise.allSettled([e.usage(),e.installations(),e.models()]);return{usage:n.status===`fulfilled`?n.value:void 0,installations:r.status===`fulfilled`?r.value:[],models:i.status===`fulfilled`?i.value:[],errors:{...n.status===`rejected`?{usage:t(`usage`,n.reason)}:{},...r.status===`rejected`?{installations:t(`installations`,r.reason)}:{},...i.status===`rejected`?{models:t(`models`,i.reason)}:{}},loading:!1}}function we({loading:e,loadError:t,status:n,details:r}){if(e&&!n)return`loading`;if(t)return`load-error`;if(!n?.configured)return`unconfigured`;if(n.sessionServiceMismatch)return`session-mismatch`;if(n.pendingDeviceFlow)return n.hasSession?`connected`:`no-session`;if(!n.hasSession)return`no-session`;let i=Object.values(r.errors);return n.cloudAvailable===!1||i.length===3&&i.every(e=>e?.unavailable)?`cloud-unavailable`:i.length>0?`partial-details`:`connected`}function Te(e){let t=e?.configured===!0,n=t&&e.hasSession===!0,r=n&&e.sessionServiceMismatch!==!0;return{showDeviceFlow:t&&!!e.pendingDeviceFlow,showDisconnectedActions:t&&!e.pendingDeviceFlow&&!n,showGuestUpgrade:r&&!e.pendingDeviceFlow&&e.mode===`guest`,showDetails:r}}function Ee(e,t){return!!(e?.hasSession&&(t||e.sessionServiceMismatch))}async function De(e,t){await t.reset(),t.onIdentityReset?.();try{return{status:`success`,config:await t.save(e)}}catch(e){return{status:`url-save-failed`,error:e}}}var b=l();function x(e){if(!e)return f(`cloudNotAvailable`);let t=new Date(e);return Number.isNaN(t.getTime())?f(`cloudNotAvailable`):t.toLocaleString(_())}function S(e){let t=e.id||e.installationId;return typeof t==`string`?t:``}function C(e){let t=e.name||e.installationName;return typeof t==`string`&&t?t:f(`cloudUnnamedDevice`)}function Oe(e){return typeof e==`number`&&Number.isFinite(e)?e.toLocaleString(_()):f(`cloudNotAvailable`)}function ke(e){return f(e===`saved`?`cloudConfigSourceSaved`:e===`env`?`cloudConfigSourceEnv`:`cloudConfigSourceDefault`)}function w(e){if(!e||typeof e!=`object`)return f(`cloudConnectionUnknown`);let t=e;return t.ok===!0||t.status===`ok`||t.ready===!0?f(`cloudConnectionOk`):f(`cloudConnectionError`)}function T(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.ok===!0||t.status===`ok`||t.ready===!0}function E(e,t){let n=w(t);return(0,b.jsxs)(`span`,{className:g(`quickforge-settings-badge`,n===f(`cloudConnectionUnknown`)?`quickforge-settings-badge-muted`:T(t)?`quickforge-settings-badge-success`:`quickforge-settings-badge-danger`),children:[e,`: `,n]})}function Ae(e){let t=e.quickforgeCapabilities;return[t?.tools?f(`cloudCapabilityTools`):void 0,t?.vision?f(`cloudCapabilityVision`):void 0,t?.reasoning?f(`cloudCapabilityReasoning`):void 0].filter(Boolean).join(` · `)||f(`cloudCapabilityText`)}function je(e,t){let n=e===`usage`?`cloudUsageLoadFailed`:e===`installations`?`cloudDevicesLoadFailed`:`cloudModelsLoadFailed`,r=p(t);return{message:r===f(`cloudRequestFailed`)?f(n):r,unavailable:!(`code`in Object(t))||[`cloud_request_failed`,`cloud_unavailable`].includes(String(t?.code||``))}}function D({error:e,onRetry:n,disabled:r}){return(0,b.jsxs)(`div`,{className:`p-4 text-sm`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-error`,children:e.message}),(0,b.jsxs)(m,{type:`button`,variant:`outline`,size:`sm`,className:`mt-3`,onClick:n,disabled:r,children:[(0,b.jsx)(t,{className:`mr-2 size-4`}),f(`retry`)]})]})}function O(){let[e,o]=(0,v.useState)(),[l,g]=(0,v.useState)(``),[_,w]=(0,v.useState)(),[T,O]=(0,v.useState)(),[k,A]=(0,v.useReducer)(Se,y),[j,M]=(0,v.useState)(!0),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(``),[L,R]=(0,v.useState)(``),[z,B]=(0,v.useState)(``),[Me,Ne]=(0,v.useState)(0),V=(0,v.useRef)(0),H=T?.pendingDeviceFlow,U=H?Math.max(0,Math.ceil((H.expiresAt-Me)/1e3)):0,W=(0,v.useCallback)(()=>A({type:`clear`}),[]),G=(0,v.useCallback)(async(e=!0,t=!1)=>{let n=++V.current;e&&M(!0),R(``),A({type:`begin`});try{let[e,r]=await Promise.all([be(),_e()]);if(n!==V.current)return;if(o(e),t||g(e.cloudUrl),O(r),!r.configured||!r.hasSession||r.sessionServiceMismatch){W();return}let i=await Ce({usage:ue,installations:he,models:ge},je);if(n!==V.current)return;A({type:`replace`,state:i})}catch(e){if(n!==V.current)return;o(void 0),O(void 0),W(),R(p(e,`cloudLoadFailed`))}finally{n===V.current&&M(!1)}},[W]);(0,v.useEffect)(()=>{let e=window.setTimeout(()=>{G()},0);return()=>{window.clearTimeout(e),V.current+=1}},[G]),(0,v.useEffect)(()=>{if(!T?.pendingDeviceFlow)return;let e=()=>Ne(Date.now()),t=window.setTimeout(e,0),n=window.setInterval(e,1e3);return()=>{window.clearTimeout(t),window.clearInterval(n)}},[T?.pendingDeviceFlow]),(0,v.useEffect)(()=>{if(!T?.pendingDeviceFlow||U>0)return;let e=window.setTimeout(()=>{G(!1)},0);return()=>window.clearTimeout(e)},[U,G,T?.pendingDeviceFlow]),(0,v.useEffect)(()=>{let e=T?.pendingDeviceFlow;if(!e||N===`device-start`||N===`device-cancel`)return;let t=Math.max(1,Number(e.interval)||5)*1e3,n=window.setTimeout(async()=>{try{let e=await me();O(e),e.deviceFlowResult===`success`?(window.dispatchEvent(new Event(u)),R(``),I(f(`cloudDeviceFlowSucceeded`)),await G(!1)):e.deviceFlowResult===`denied`?R(f(`cloudDeviceFlowDenied`)):e.deviceFlowResult===`expired`?R(f(`cloudDeviceFlowExpired`)):e.deviceFlowResult===`network`&&R(f(`cloudDeviceFlowNetwork`))}catch(e){R(p(e))}},t);return()=>window.clearTimeout(n)},[N,G,T?.pendingDeviceFlow]);let K=()=>window.dispatchEvent(new Event(u)),Pe=async()=>{if(!N){P(`test`),I(``),R(``),w(void 0);try{let e=await de(l);g(e.cloudUrl),w(e),I(f(`cloudConnectionTestSucceeded`))}catch(e){R(p(e,`cloudConnectionFailed`))}finally{P(``)}}},Fe=async()=>{if(!N){P(`save`),I(``),R(``);try{let e=await d(l);o(e),g(e.cloudUrl),w(void 0),B(``),K(),I(f(`cloudConnectionSaved`)),await G(!1)}catch(e){R(p(e))}finally{P(``)}}},Ie=async()=>{let t=l.trim()||e?.cloudUrl||``;if(!(!await h({title:f(`cloudForceSwitchTitle`),description:f(`cloudForceSwitchDescription`),confirmLabel:f(`cloudForceSwitchConfirm`),cancelLabel:f(`cancel`),variant:`destructive`})||N||!t)){P(`force-switch`),I(``),R(``),B(``);try{let e=await De(t,{reset:ve,save:d,onIdentityReset:()=>{V.current+=1,O(e=>e&&{...e,mode:`local`,hasSession:!1,sessionServiceMismatch:!1}),W(),K()}});if(e.status===`url-save-failed`){let t=p(e.error);B(f(`cloudIdentityRebuiltUrlSaveFailed`)),await G(!1,!0),R(t);return}o(e.config),g(e.config.cloudUrl),w(void 0),K(),I(f(`cloudForceSwitchSucceeded`)),await G(!1)}catch(e){R(p(e))}finally{P(``)}}},Le=async()=>{if(!(!await h({title:f(`cloudStartGuestTitle`),description:f(`cloudDataConsentDescription`),confirmLabel:f(`cloudAgreeAndStart`),cancelLabel:f(`cancel`)})||N)){P(`start`),I(``),R(``),B(``);try{await ye(),K(),I(f(`cloudGuestStarted`)),await G(!1)}catch(e){R(p(e))}finally{P(``)}}},Re=async()=>{if(!N){P(`device-start`),I(``),R(``),B(``);try{O(await le()),K()}catch(e){R(p(e))}finally{P(``)}}},ze=async()=>{if(!N){P(`device-cancel`),I(``),R(``);try{O(await ce()),I(f(`cloudDeviceFlowCancelled`))}catch(e){R(p(e))}finally{P(``)}}},Be=async()=>{let e=T?.pendingDeviceFlow?.userCode;if(e)try{await navigator.clipboard.writeText(e),I(f(`cloudDeviceCodeCopied`))}catch{R(f(`copyFailed`))}},Ve=async()=>{if(!(!await h({title:f(`cloudLogoutTitle`),description:f(`cloudLogoutDescription`),confirmLabel:f(`cloudLogout`),cancelLabel:f(`cancel`),variant:`destructive`})||N)){P(`logout`),I(``),R(``),B(``);try{await pe(),V.current+=1,W(),O(e=>e&&{...e,mode:`local`,hasSession:!1,sessionServiceMismatch:!1}),K(),I(f(`cloudLoggedOut`)),await G(!1)}catch(e){R(p(e))}finally{P(``)}}},He=async e=>{let t=S(e);if(!(!t||t===T?.installationId||N)&&await h({description:f(`cloudRevokeDeviceConfirm`,{name:C(e)}),confirmLabel:f(`cloudRevokeDevice`),cancelLabel:f(`cancel`),variant:`destructive`})){P(t),I(``),R(``);try{await xe(t),A({type:`replace`,state:{...k,installations:k.installations.filter(e=>S(e)!==t)}}),I(f(`cloudDeviceRevoked`))}catch(e){R(p(e))}finally{P(``)}}},Ue=!!(T?.configured&&T.hasSession),q=T?.sessionServiceMismatch===!0,J=Ue&&!q,Y=!!(e?.cloudUrl&&l.trim()&&e.cloudUrl!==l.trim()),We=we({loading:j,loadError:L,status:T,details:k}),X=Te(T),Z=We===`cloud-unavailable`,Ge=q?f(`cloudSessionMismatchLabel`):T?.mode===`account`?f(`cloudFormalAccount`):T?.mode===`guest`?f(`cloudGuestAccount`):f(`cloudNotConnected`),Ke=T?.configured?f(q?`cloudSessionServiceMismatch`:J?Z?`cloudUnavailableDescription`:`cloudConnectedDescription`:`cloudLocalOnlyDescription`):f(`cloudNotConfiguredDescription`),Q=()=>{G()},$=j||k.loading;return(0,b.jsxs)(`div`,{className:`quickforge-settings-stack`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-heading`,children:[(0,b.jsx)(`div`,{children:(0,b.jsxs)(`h2`,{className:`quickforge-settings-title`,children:[(0,b.jsx)(se,{className:`size-5`}),f(`cloudAccount`)]})}),(0,b.jsxs)(m,{variant:`outline`,size:`sm`,onClick:()=>void G(),disabled:j||!!N,className:`quickforge-settings-heading-action`,children:[(0,b.jsx)(t,{className:`mr-2 size-4 ${j?`animate-spin`:``}`}),f(`refresh`)]})]}),F?(0,b.jsx)(`div`,{className:`quickforge-settings-message`,children:F}):null,z?(0,b.jsx)(`div`,{className:`quickforge-settings-warning`,children:z}):null,L?(0,b.jsx)(`div`,{className:`quickforge-settings-error`,children:L}):null,(0,b.jsxs)(`div`,{className:`quickforge-settings-section`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-list-header`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,b.jsx)(ee,{className:`size-4`}),f(`cloudServiceConnection`)]}),(0,b.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-info shrink-0`,children:`QuickForge Cloud`})]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row items-start`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,b.jsx)(`label`,{className:`quickforge-settings-row-title`,htmlFor:`quickforge-cloud-url`,children:f(`cloudUrl`)}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:f(`cloudUrlDescription`)})]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row-control w-full max-w-xl flex-col items-stretch gap-2`,children:[(0,b.jsx)(fe,{id:`quickforge-cloud-url`,value:l,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l.trim()&&Y&&!N&&(e.preventDefault(),Fe())},placeholder:f(`cloudUrlPlaceholder`),inputMode:`url`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,disabled:!!N}),(0,b.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[f(`cloudConfigSource`),`: `,ke(e?.source)]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-cloud-actions flex flex-wrap justify-end gap-2`,children:[(0,b.jsxs)(m,{variant:`outline`,size:`sm`,onClick:()=>void Pe(),disabled:!l.trim()||!!N,children:[N===`test`?(0,b.jsx)(t,{className:`mr-2 size-4 animate-spin`}):(0,b.jsx)(ae,{className:`mr-2 size-4`}),f(`cloudTestConnection`)]}),(0,b.jsxs)(m,{size:`sm`,onClick:()=>void Fe(),disabled:!l.trim()||!Y||!!N,children:[N===`save`?(0,b.jsx)(t,{className:`mr-2 size-4 animate-spin`}):(0,b.jsx)(te,{className:`mr-2 size-4`}),f(`saveChanges`)]})]}),Ee(T,Y)?(0,b.jsx)(`div`,{className:`quickforge-settings-cloud-force-switch flex justify-end`,children:(0,b.jsxs)(m,{variant:`destructive`,size:`sm`,onClick:()=>void Ie(),disabled:!!N,title:f(`cloudForceSwitchDescription`),children:[(0,b.jsx)(r,{className:`mr-2 size-4`}),f(`cloudForceSwitch`)]})}):null]})]}),e?.configurationError?(0,b.jsx)(`div`,{className:`quickforge-settings-error m-3`,children:f(`cloudConfigurationError`)}):null,_?(0,b.jsxs)(`div`,{className:`quickforge-settings-row`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-row-title`,children:f(`cloudConnectionTestResult`)}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-description break-all`,children:_.cloudUrl})]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row-control flex-wrap justify-end gap-1.5`,children:[E(f(`cloudHealth`),_.health),E(f(`cloudReady`),_.ready)]})]}):null]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-section`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,b.jsx)(ie,{className:`size-4`}),f(`cloudIdentityStatus`)]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:Ke})]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-control`,children:(0,b.jsx)(`span`,{className:`quickforge-settings-badge ${J&&!Z?`quickforge-settings-badge-success`:q||Z?`quickforge-settings-badge-warning`:`quickforge-settings-badge-muted`}`,children:Ge})})]}),Z?(0,b.jsx)(`div`,{className:`quickforge-settings-warning quickforge-settings-warning-attached`,children:f(`cloudUnavailableDescription`)}):null,q?(0,b.jsx)(`div`,{className:`quickforge-settings-warning quickforge-settings-warning-attached`,children:f(`cloudSessionServiceMismatch`)}):null,J?(0,b.jsxs)(b.Fragment,{children:[T?.mode===`account`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-row-main`,children:(0,b.jsx)(`div`,{className:`quickforge-settings-row-title`,children:f(`cloudAccountEmail`)})}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-control text-sm font-medium`,children:T.account?.email||f(`cloudNotAvailable`)})]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-row-main`,children:(0,b.jsx)(`div`,{className:`quickforge-settings-row-title`,children:f(`cloudAccountPlan`)})}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-control text-sm font-medium`,children:T.account?.plan||f(`cloudNotAvailable`)})]})]}):null,k.errors.usage?(0,b.jsx)(D,{error:k.errors.usage,onRetry:Q,disabled:$||!!N}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-row-main`,children:(0,b.jsx)(`div`,{className:`quickforge-settings-row-title`,children:f(`cloudRemainingQuota`)})}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-control text-sm font-medium`,children:Oe(k.usage?.remaining)})]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-row-main`,children:(0,b.jsx)(`div`,{className:`quickforge-settings-row-title`,children:f(`cloudQuotaExpiresAt`)})}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-control text-sm text-muted-foreground`,children:x(k.usage?.resetsAt||k.usage?.expiresAt)})]})]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-row-title`,children:f(`cloudLogout`)}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:f(`cloudLogoutRowDescription`)})]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-control`,children:(0,b.jsxs)(m,{variant:`destructive`,className:`quickforge-settings-cloud-logout`,onClick:()=>void Ve(),disabled:!!N,children:[(0,b.jsx)(i,{className:`mr-2 size-4`}),f(`cloudLogout`)]})})]})]}):null]}),T?.configured?X.showDeviceFlow&&H?(0,b.jsxs)(`div`,{className:`quickforge-settings-section`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-list-header`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,b.jsx)(s,{className:`size-4`}),f(`cloudDeviceFlowTitle`)]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:f(`cloudDeviceFlowDescription`)})]}),(0,b.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-info`,children:f(`cloudDeviceFlowCountdown`,{seconds:U})})]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row items-start`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:f(`cloudDeviceCode`)}),(0,b.jsx)(`div`,{className:`mt-1 font-mono text-2xl font-semibold tracking-[0.18em] text-foreground`,children:H.userCode})]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row-control flex-wrap gap-2`,children:[(0,b.jsxs)(m,{variant:`outline`,size:`sm`,onClick:()=>void Be(),children:[(0,b.jsx)(ne,{className:`mr-2 size-4`}),f(`copy`)]}),(0,b.jsxs)(m,{size:`sm`,onClick:()=>window.open(H.verificationUriComplete||H.verificationUri,`_blank`,`noopener,noreferrer`),children:[(0,b.jsx)(oe,{className:`mr-2 size-4`}),f(`cloudOpenVerificationPage`)]}),(0,b.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>void ze(),disabled:!!N,children:f(`cancel`)})]})]}),T.deviceFlowResult===`slow_down`?(0,b.jsx)(`div`,{className:`quickforge-settings-warning quickforge-settings-warning-attached`,children:f(`cloudDeviceFlowSlowDown`)}):null]}):X.showDisconnectedActions?(0,b.jsxs)(`div`,{className:`quickforge-settings-section`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,b.jsx)(s,{className:`size-4`}),f(`cloudLoginOrRegister`)]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:f(`cloudLoginOrRegisterDescription`)})]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-control`,children:(0,b.jsxs)(m,{onClick:()=>void Re(),disabled:j||!!N,children:[(0,b.jsx)(a,{className:`mr-2 size-4`}),f(`cloudLoginOrRegister`)]})})]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-row-main`,children:(0,b.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,b.jsx)(c,{className:`size-4`}),f(`cloudTryModels`)]})}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-control`,children:(0,b.jsxs)(m,{variant:`outline`,onClick:()=>void Le(),disabled:j||!!N,children:[(0,b.jsx)(c,{className:`mr-2 size-4`}),f(`cloudStartGuest`)]})})]})]}):X.showDetails?(0,b.jsxs)(b.Fragment,{children:[X.showGuestUpgrade?(0,b.jsx)(`div`,{className:`quickforge-settings-section`,children:(0,b.jsxs)(`div`,{className:`quickforge-settings-row`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,b.jsx)(s,{className:`size-4`}),f(`cloudUpgradeAccount`)]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:f(`cloudUpgradeAccountDescription`)})]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-control`,children:(0,b.jsxs)(m,{onClick:()=>void Re(),disabled:j||!!N,children:[(0,b.jsx)(a,{className:`mr-2 size-4`}),f(`cloudUpgradeAccount`)]})})]})}):null,(0,b.jsxs)(`div`,{className:`quickforge-settings-section`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-list-header`,children:(0,b.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,b.jsx)(re,{className:`size-4`}),f(`cloudModels`)]})}),k.errors.models?(0,b.jsx)(D,{error:k.errors.models,onRetry:Q,disabled:$||!!N}):k.models.length===0?(0,b.jsx)(`div`,{className:`p-6 text-center text-sm text-muted-foreground`,children:f($?`loading`:`cloudNoModels`)}):k.models.map(e=>(0,b.jsx)(`div`,{className:`quickforge-settings-list-item`,children:(0,b.jsxs)(`div`,{className:`quickforge-settings-list-item-main`,children:[(0,b.jsx)(`div`,{className:`text-sm font-medium`,children:e.name||e.id}),(0,b.jsxs)(`div`,{className:`quickforge-settings-row-description`,children:[e.id,` · `,Ae(e)]})]})},`${e.provider}:${e.id}`))]}),(0,b.jsxs)(`div`,{className:`quickforge-settings-section`,children:[(0,b.jsx)(`div`,{className:`quickforge-settings-list-header`,children:(0,b.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,b.jsx)(n,{className:`size-4`}),f(`cloudDevices`)]})}),k.errors.installations?(0,b.jsx)(D,{error:k.errors.installations,onRetry:Q,disabled:$||!!N}):k.installations.length===0?(0,b.jsx)(`div`,{className:`p-6 text-center text-sm text-muted-foreground`,children:f($?`loading`:`cloudNoDevices`)}):k.installations.map(e=>{let t=S(e),n=e.current===!0||t===T?.installationId;return(0,b.jsxs)(`div`,{className:`quickforge-settings-list-item`,children:[(0,b.jsxs)(`div`,{className:`quickforge-settings-list-item-main`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,b.jsx)(`div`,{className:`truncate text-sm font-medium`,children:C(e)}),n?(0,b.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-info`,children:f(`cloudCurrentDevice`)}):null]}),(0,b.jsx)(`div`,{className:`quickforge-settings-row-description`,children:[e.platform,e.clientVersion,e.lastSeenAt?x(e.lastSeenAt):void 0].filter(Boolean).join(` · `)||f(`cloudNotAvailable`)})]}),(0,b.jsx)(`div`,{className:`quickforge-settings-list-item-actions`,children:(0,b.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>void He(e),disabled:n||!!N,children:f(`cloudRevokeDevice`)})})]},t||C(e))})]})]}):null:null]})}export{O as CloudAccountSettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t,C as n,G as r,Wt as i,a,f as o,r as s,w as c}from"./icons-CXPP1fFT.js";import{n as l}from"./react-vendor-1KC5PyRx.js";import{dn as u,sn as d}from"./index-_ZhK6bvp.js";import{n as f,r as p,t as m}from"./plugin-api-Uu2xAB4d.js";var h=e(i(),1),g=l();function _(e){return e===`loaded`?`quickforge-settings-badge-success`:e===`error`?`quickforge-settings-badge-danger`:`quickforge-settings-badge-muted`}function v(e){return e===`loaded`?u(`pluginStatusLoaded`):e===`disabled`?u(`pluginStatusDisabled`):e===`error`?u(`pluginStatusError`):e}function y(e){switch(e){case`documents`:return{label:u(`pluginDocumentsName`),description:u(`pluginDocumentsDescription`)};case`spreadsheets`:return{label:u(`pluginSpreadsheetsName`),description:u(`pluginSpreadsheetsDescription`)};case`presentations`:return{label:u(`pluginPresentationsName`),description:u(`pluginPresentationsDescription`)};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[i,l]=(0,h.useState)(null),[y,C]=(0,h.useState)(!0),[w,T]=(0,h.useState)(null),[E,D]=(0,h.useState)(()=>new Set),[O,k]=(0,h.useState)(null),A=(0,h.useCallback)(async(t=`load`)=>{k(null),C(!0);try{l(t===`reload`?await f():await m()),t===`reload`&&e?.()}catch(e){k(e instanceof Error?e.message: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=i?.plugins||[];return{total:e.length,enabled:e.filter(e=>e.enabled).length,tools:e.reduce((e,t)=>e+t.tools.length,0)}},[i]),M=(0,h.useMemo)(()=>i?.plugins||[],[i]),N=(0,h.useCallback)(e=>{D(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),P=async(t,n)=>{T(t),k(null);try{l(await p(t,n)),e?.()}catch(e){k(e instanceof Error?e.message: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)(r,{className:`mr-2 size-4 animate-spin`}):(0,g.jsx)(n,{className:`mr-2 size-4`}),u(`pluginsReload`)]})]}),O?(0,g.jsx)(`div`,{className:`quickforge-settings-alert quickforge-settings-warning-attached`,children:O}):null,i?.errors?.length?(0,g.jsxs)(`div`,{className:`quickforge-settings-warning quickforge-settings-warning-attached`,children:[(0,g.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-2 font-medium`,children:[(0,g.jsx)(a,{className:`size-4`}),u(`pluginDiscoveryErrors`)]}),i.errors.map((e,t)=>(0,g.jsxs)(`div`,{className:`break-all text-sm`,children:[(0,g.jsx)(`code`,{className:`quickforge-settings-command-name`,children:e.dir}),`: `,e.error]},`${e.dir}-${t}`))]}):null,y&&!i?(0,g.jsxs)(`div`,{className:`quickforge-settings-empty-row inline-flex items-center gap-2`,children:[(0,g.jsx)(r,{className:`size-4 animate-spin`}),u(`loadingPlugins`)]}):null,!y&&i&&i.plugins.length===0?(0,g.jsxs)(`div`,{className:`quickforge-settings-empty-row`,children:[(0,g.jsx)(`div`,{className:`quickforge-settings-row-title`,children:u(`noPlugins`)}),(0,g.jsx)(`div`,{className:`quickforge-settings-row-description`,children:u(`noPluginsDescription`)}),(0,g.jsx)(`div`,{className:`quickforge-settings-meta`,children:(i.searchPaths||[]).map(e=>(0,g.jsx)(`code`,{className:`quickforge-settings-command-name`,children:e},e))})]}):null,M.map(e=>{let n=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":n,children:[(0,g.jsx)(t,{className:d(`quickforge-settings-expand-chevron size-4`,n&&`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)(s,{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)(o,{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`})]})})]}),n?(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)(s,{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)(o,{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 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Ft as n,Pt as r,St as ee,Vt as i,Wt as a,dt as te,lt as ne,nt as re,o as ie,t as ae,u as oe,wt as se,y as ce}from"./icons-CXPP1fFT.js";import{n as o}from"./react-vendor-1KC5PyRx.js";import{n as le,r as ue,t as de}from"./model-reference-o41fJ6jQ.js";import{B as fe,Gt as s,Jt as pe,Kt as me,Yt as he,dn as c,in as ge,on as l,ot as _e,sn as u,tn as d}from"./index-_ZhK6bvp.js";import{i as f,n as p,t as ve}from"./model-identity-CgA6_Pbm.js";var m=e(a(),1),h=o(),ye=[{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 be(e,t){return f(e,t)}function g(e){return String(e).padStart(2,`0`)}function _(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?`-`:`${t.getFullYear()}-${g(t.getMonth()+1)}-${g(t.getDate())} ${g(t.getHours())}:${g(t.getMinutes())}`}function xe(e,t=20){let n=String(e||``).trim();return n.length>t?`${n.slice(0,t)}...`:n}function Se(){return{scheduleText:``,title:``,instruction:``,cronExpression:``,scheduleRule:``,nextRunAt:``,enabled:!0,agentId:``,executionMode:`serial`}}function v(){return{taskId:``,status:``,trigger:``,keyword:``,startedFrom:``,startedTo:``,page:1,pageSize:10}}function Ce(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 we(e,t){return{...t,title:e.title,instruction:e.instruction,cronExpression:e.cronExpression??``,scheduleRule:e.scheduleRule,nextRunAt:e.nextRunAt,enabled:t.enabled}}function Te(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 y(e){return!!(e.currentRunId||e.currentRunIds?.length)}function Ee(e){return(e.executionMode??`serial`)===`parallel`||!y(e)}function De(e){return c(e===`parallel`?`taskExecutionModeParallel`:`taskExecutionModeSerial`)}function Oe(e){return!!(e.title.trim()&&e.instruction.trim()&&e.cronExpression.trim())}function ke(e){return c(e===`enabled`?`taskEnabled`:e===`running`?`taskRunning`:e===`paused`?`taskPaused`:e===`completed`?`taskFinished`:e===`success`?`executionSuccess`:`taskFailed`)}function Ae(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 b(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 x({onOpenSession:e}){let[a,o]=(0,m.useState)([]),[f,g]=(0,m.useState)(`tasks`),[x,S]=(0,m.useState)(()=>Se()),[C,je]=(0,m.useState)(null),[w,T]=(0,m.useState)(null),[E,D]=(0,m.useState)(null),[O,k]=(0,m.useState)(!1),[A,j]=(0,m.useState)(null),[Me,M]=(0,m.useState)(``),[N,P]=(0,m.useState)(!1),[F,I]=(0,m.useState)(``),[L,Ne]=(0,m.useState)([]),[R,z]=(0,m.useState)(),[Pe,B]=(0,m.useState)(`off`),[V,Fe]=(0,m.useState)([]),[Ie,Le]=(0,m.useState)(``),[H,U]=(0,m.useState)(()=>v()),[W,G]=(0,m.useState)(()=>v()),[K,Re]=(0,m.useState)({runs:[],total:0,page:1,pageSize:10}),[ze,Be]=(0,m.useState)(!1),[Ve,He]=(0,m.useState)(null),[Ue,We]=(0,m.useState)([]),Ge=V[0]?.id??``;(0,m.useEffect)(()=>{if(!E)return;let e=()=>D(null);return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e)}},[E]);async function Ke(){o((await b(`/api/scheduled-tasks`)).tasks)}async function q(e=W){Be(!0),I(``);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),Re(await b(`/api/scheduled-tasks/runs?${t.toString()}`))}catch(e){I(e instanceof Error?e.message:c(`requestFailed`))}finally{Be(!1)}}(0,m.useEffect)(()=>{let e=!1;async function t(){try{let t=await b(`/api/project`);if(e)return;Fe(t.projects??[])}catch{}}return t(),()=>{e=!0}},[]),(0,m.useEffect)(()=>{let e=!1;async function t(){try{let t=await pe(),[n,r]=await Promise.all([me(t),de().catch(()=>[])]),ee=r.length?r:n,i=ee.filter(d),a=await he(t),te=(a.model&&d(a.model)?i.find(e=>be(e,a.model))||(ue(a.model)?i.find(e=>e.quickforgeCatalogId===a.model.quickforgeCatalogId):void 0):void 0)??i[0];if(e)return;Ne(ee),z(te),B(a.thinkingLevel??s(te))}catch(t){e||I(t instanceof Error?t.message:c(`requestFailed`))}}return t(),()=>{e=!0}},[]),(0,m.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await b(`/api/scheduled-tasks`);e||o(t.tasks)}catch(t){e||I(t instanceof Error?t.message:c(`requestFailed`))}};t();let n=window.setInterval(t,10*1e3);return()=>{e=!0,window.clearInterval(n)}},[]),(0,m.useEffect)(()=>{let e=!1;async function t(){try{let t=await b(`/api/agent-profiles`);if(e)return;We(t.agents)}catch(t){e||I(t instanceof Error?t.message:c(`requestFailed`))}}return t(),()=>{e=!0}},[]);let qe=(0,m.useMemo)(()=>a.find(e=>e.id===C),[C,a]),Je=(0,m.useMemo)(()=>L.filter(d),[L]),Ye=(0,m.useMemo)(()=>ve(Je,R),[Je,R]),J=(0,m.useMemo)(()=>a.find(e=>e.id===w)??null,[w,a]),Xe=(0,m.useMemo)(()=>a.filter(e=>e.status===`enabled`).length,[a]),Ze=Math.max(1,Math.ceil(K.total/K.pageSize));function Y(e){return e?Ue.find(t=>t.id===e||t.name===e)?.label??e:c(`defaultAgent`)}function X(e,t){S(n=>({...n,[e]:t}))}function Z(e,t){U(n=>({...n,[e]:t}))}function Qe(){let e=L.find(d);je(null),Le(Ge),z(e),B(s(e)),S(Se()),j(null),M(``),I(``)}function $e(){Qe(),k(!0)}function Q(){N||(k(!1),Qe())}function et(){let e={...H,page:1};U(e),G(e),q(e)}function tt(){let e=v();U(e),G(e),q(e)}function nt(e){let t=Math.min(Math.max(1,e),Ze),n={...W,page:t};U(n),G(n),q(n)}function rt(e){let t={...W,page:1,pageSize:e};U(t),G(t),q(t)}async function it(){let e=x.scheduleText.trim();if(e){P(!0),I(``);try{let t=await b(`/api/scheduled-tasks/parse`,{method:`POST`,body:JSON.stringify({instruction:e,modelRef:R?le(R):void 0,model:R,thinkingLevel:Pe})});if(t.needMoreInfo||!t.task){M(t.question||`请补充任务信息。`),j(null);return}let n=t.task;M(``),j(n),S(e=>we(n,e))}catch(e){I(e instanceof Error?e.message:c(`requestFailed`))}finally{P(!1)}}}async function at(){if(Oe(x)){P(!0),I(``);try{let e=V.find(e=>e.id===Ie),t={task:Te(x),modelRef:R?le(R):void 0,model:R,thinkingLevel:Pe,projectId:e?.id,projectName:e?.name};C?await b(`/api/scheduled-tasks/${encodeURIComponent(C)}`,{method:`PUT`,body:JSON.stringify(t)}):await b(`/api/scheduled-tasks`,{method:`POST`,body:JSON.stringify(t)}),Q(),await Ke(),f===`history`&&await q(W)}catch(e){I(e instanceof Error?e.message:c(`requestFailed`))}finally{P(!1)}}}function ot(e){D(null),je(e.id),S(Ce(e)),j(null),M(``),I(``),Le(e.projectId??``),e.model&&z(e.model),e.thinkingLevel&&B(e.thinkingLevel),k(!0)}async function $(e,t){if(I(``),D(null),!(t===`delete`&&!await _e({description:c(`confirmDeleteTask`),confirmLabel:c(`confirmDelete`),cancelLabel:c(`cancel`),variant:`destructive`})))try{t===`delete`?(await b(`/api/scheduled-tasks/${encodeURIComponent(e)}`,{method:`DELETE`}),C===e&&Q(),w===e&&T(null)):await b(`/api/scheduled-tasks/${encodeURIComponent(e)}/${t}`,{method:`POST`}),await Ke(),f===`history`&&await q(W)}catch(e){I(e instanceof Error?e.message:c(`requestFailed`))}}function st(t){return(0,h.jsxs)(`div`,{className:`mt-2 space-y-2 text-xs text-muted-foreground`,children:[t.sessionId?(0,h.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>e?.(t.sessionId),children:c(`viewConversation`)}):null,(0,h.jsxs)(`div`,{children:[c(`executionAgent`),t.agentLabel||Y(t.agentId)]}),t.warning?(0,h.jsx)(`div`,{className:`text-amber-600`,children:t.warning}):null,t.inputContent?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`div`,{className:`font-medium text-foreground`,children:c(`runInputContent`)}),(0,h.jsx)(`pre`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap`,children:t.inputContent})]}):null,t.aiResult||t.result?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`div`,{className:`font-medium text-foreground`,children:c(`runAiResult`)}),(0,h.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap`,children:t.aiResult||t.result})]}):null,t.errorMessage?(0,h.jsx)(`div`,{className:`text-destructive`,children:t.errorMessage}):null,t.durationMs?(0,h.jsxs)(`div`,{children:[c(`runDuration`),t.durationMs,`ms`]}):null]})}return(0,h.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,h.jsxs)(`div`,{className:`border-b border-border px-6 py-5`,children:[(0,h.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:O||J?(0,h.jsxs)(l,{variant:`outline`,onClick:()=>{O?Q():T(null)},children:[(0,h.jsx)(i,{className:`mr-1 size-4`}),c(`back`)]}):(0,h.jsx)(l,{onClick:$e,children:c(`createTask`)})}),!O&&!J?(0,h.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,h.jsxs)(`button`,{type:`button`,className:u(`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:()=>g(`tasks`),children:[c(`taskListTab`),` `,(0,h.jsx)(`span`,{className:`opacity-80`,children:a.length})]}),(0,h.jsx)(`button`,{type:`button`,className:u(`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:()=>{g(`history`),q(W)},children:c(`executionHistoryTab`)})]}):null]}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,h.jsx)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:O?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-5 space-y-4`,children:[(0,h.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5 text-base font-semibold text-foreground`,children:[c(qe?`editTask`:`createTask`),(0,h.jsx)(ge,{label:c(`quickAiParseTask`)})]}),(0,h.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[c(`taskScheduleDescriptionLabel`),(0,h.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:x.scheduleText,onChange:e=>X(`scheduleText`,e.target.value),placeholder:c(`taskScheduleDescriptionPlaceholder`)})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(l,{onClick:it,disabled:N||!R||!x.scheduleText.trim(),children:[(0,h.jsx)(oe,{className:`mr-1 size-3.5`}),c(`aiParseTask`)]}),Me?(0,h.jsx)(`span`,{className:`text-sm text-amber-600`,children:Me}):null]}),(0,h.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,h.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[c(`taskTitleLabel`),(0,h.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:x.title,onChange:e=>X(`title`,e.target.value),placeholder:c(`taskTitlePlaceholder`)})]}),(0,h.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[c(`executionRule`),(0,h.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:x.scheduleRule||`-`})]}),(0,h.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[`cron`,(0,h.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:x.cronExpression||`-`})]}),(0,h.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[c(`nextExecutionTime`),(0,h.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:_(x.nextRunAt)})]}),(0,h.jsxs)(`label`,{className:`block text-sm font-medium text-foreground sm:col-span-2`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[c(`taskExecutionMode`),(0,h.jsx)(ge,{label:c(`taskExecutionModeHelp`)})]}),(0,h.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:x.executionMode,onChange:e=>X(`executionMode`,e.target.value),children:[(0,h.jsx)(`option`,{value:`serial`,children:c(`taskExecutionModeSerial`)}),(0,h.jsx)(`option`,{value:`parallel`,children:c(`taskExecutionModeParallel`)})]})]}),(0,h.jsxs)(`label`,{className:`block text-sm font-medium text-foreground sm:col-span-2`,children:[c(`promptContentLabel`),(0,h.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:x.instruction,onChange:e=>X(`instruction`,e.target.value),placeholder:c(`promptContentPlaceholder`)})]})]}),(0,h.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:x.enabled,onChange:e=>X(`enabled`,e.target.checked)}),c(`taskEnabledSwitch`)]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-border bg-muted/20 px-2 py-2`,children:[(0,h.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,h.jsx)(oe,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,h.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:R?p(R):``,onChange:e=>{let t=Ye.find(t=>p(t)===e.target.value);z(t),B(s(t))},title:c(`taskModel`),children:[Ye.length===0?(0,h.jsx)(`option`,{value:``,children:c(`noModelAvailable`)}):null,Ye.map(e=>(0,h.jsxs)(`option`,{value:p(e),children:[fe(e),be(e,R)?` ✓`:``]},p(e)))]})]}),(0,h.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,h.jsx)(r,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,h.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:Pe,onChange:e=>B(e.target.value),title:c(`taskThinking`),children:ye.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label()},e.value))})]}),(0,h.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,h.jsx)(re,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,h.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:Ie,onChange:e=>Le(e.target.value),title:c(`taskProjectLabel`),children:[(0,h.jsx)(`option`,{value:``,children:c(`noProjectBound`)}),V.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,h.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,h.jsx)(n,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,h.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:x.agentId,onChange:e=>X(`agentId`,e.target.value),title:c(`executionAgent`),children:[(0,h.jsx)(`option`,{value:``,children:c(`defaultAgent`)}),Ue.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]})]}),A?(0,h.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/30 p-3 text-sm`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium text-foreground`,children:[(0,h.jsx)(se,{className:`size-4 text-emerald-600`}),c(`aiParsed`)]}),(0,h.jsxs)(`div`,{className:`grid gap-2 text-muted-foreground sm:grid-cols-2`,children:[(0,h.jsxs)(`div`,{children:[c(`taskName`),(0,h.jsx)(`span`,{className:`text-foreground`,children:A.title})]}),(0,h.jsxs)(`div`,{children:[c(`executionRule`),(0,h.jsx)(`span`,{className:`text-foreground`,children:A.scheduleRule})]}),(0,h.jsxs)(`div`,{children:[`cron:`,(0,h.jsx)(`span`,{className:`font-mono text-foreground`,children:A.cronExpression??`-`})]}),(0,h.jsxs)(`div`,{children:[c(`nextExecutionTime`),(0,h.jsx)(`span`,{className:`text-foreground`,children:_(A.nextRunAt)})]}),(0,h.jsxs)(`div`,{className:`sm:col-span-2`,children:[c(`aiInstruction`),(0,h.jsx)(`span`,{className:`text-foreground`,children:A.instruction})]})]})]}):null,F?(0,h.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:F}):null]}),(0,h.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,h.jsx)(l,{variant:`outline`,onClick:Q,disabled:N,children:c(`cancel`)}),(0,h.jsx)(l,{onClick:at,disabled:N||!R||!Oe(x),children:c(qe?`saveTask`:`confirmCreate`)})]})]}):J?(0,h.jsxs)(`div`,{className:`rounded-xl border border-border bg-card`,children:[(0,h.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-border px-5 py-4`,children:(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:J.title}),(0,h.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:J.scheduleRule})]})}),(0,h.jsx)(`div`,{className:`px-5 py-4`,children:(0,h.jsxs)(`div`,{className:`space-y-4 text-sm`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`div`,{className:`mb-1 font-medium text-foreground`,children:c(`taskContent`)}),(0,h.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap rounded-xl border border-border bg-muted/20 p-3 text-muted-foreground`,children:J.instruction})]}),(0,h.jsxs)(`div`,{className:`grid gap-3 text-muted-foreground sm:grid-cols-2`,children:[(0,h.jsxs)(`div`,{children:[c(`executionRule`),(0,h.jsx)(`span`,{className:`text-foreground`,children:J.scheduleRule})]}),(0,h.jsxs)(`div`,{children:[c(`taskExecutionMode`),`:`,(0,h.jsx)(`span`,{className:`text-foreground`,children:De(J.executionMode)})]}),(0,h.jsxs)(`div`,{children:[`cron:`,(0,h.jsx)(`span`,{className:`font-mono text-foreground`,children:J.cronExpression??`-`})]}),(0,h.jsxs)(`div`,{children:[c(`lastExecution`),(0,h.jsx)(`span`,{className:`text-foreground`,children:_(J.lastRunAt)})]}),(0,h.jsxs)(`div`,{children:[c(`nextExecution`),(0,h.jsx)(`span`,{className:`text-foreground`,children:_(J.nextRunAt)})]}),(0,h.jsxs)(`div`,{children:[c(`executionAgent`),(0,h.jsx)(`span`,{className:`text-foreground`,children:Y(J.agentId)})]}),J.projectName?(0,h.jsxs)(`div`,{children:[c(`taskProject`),(0,h.jsx)(`span`,{className:`text-foreground`,children:J.projectName})]}):null,J.model?(0,h.jsxs)(`div`,{children:[c(`taskModel`),`:`,(0,h.jsx)(`span`,{className:`text-foreground`,children:fe(J.model)})]}):null,J.thinkingLevel?(0,h.jsxs)(`div`,{children:[c(`taskThinkingLevel`),(0,h.jsx)(`span`,{className:`text-foreground`,children:ye.find(e=>e.value===J.thinkingLevel)?.label()??J.thinkingLevel})]}):null,(0,h.jsxs)(`div`,{children:[c(`createdAt`),`:`,(0,h.jsx)(`span`,{className:`text-foreground`,children:_(J.createdAt)})]})]}),J.runs?.length>0?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`div`,{className:`mb-2 font-medium text-foreground`,children:c(`recentExecutions`)}),(0,h.jsx)(`div`,{className:`space-y-2`,children:J.runs.slice(0,5).map(e=>(0,h.jsxs)(`details`,{className:`rounded-lg border border-border bg-muted/20 p-2 text-xs text-muted-foreground`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer text-foreground`,children:[_(e.startedAt),` · `,e.trigger===`manual`?c(`manualRun`):c(`autoRun`),` · `,ke(e.status)]}),st(e)]},e.id))})]}):null]})}),(0,h.jsx)(`div`,{className:`border-t border-border px-5 py-4`,children:(0,h.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[J.lastSessionId?(0,h.jsx)(l,{variant:`outline`,onClick:()=>e?.(J.lastSessionId),children:c(`viewConversation`)}):null,(0,h.jsxs)(l,{variant:`outline`,disabled:!Ee(J),onClick:()=>void $(J.id,`run`),children:[(0,h.jsx)(ae,{className:`mr-1 size-3.5`}),c(`executeNow`)]}),(0,h.jsxs)(l,{variant:`outline`,disabled:y(J),onClick:()=>ot(J),children:[(0,h.jsx)(t,{className:`mr-1 size-3.5`}),c(`editTask`)]}),(0,h.jsxs)(l,{variant:`destructive`,disabled:y(J),onClick:()=>void $(J.id,`delete`),children:[(0,h.jsx)(ie,{className:`mr-1 size-3.5`}),c(`deleteTask`)]})]})})]}):(0,h.jsxs)(h.Fragment,{children:[F?(0,h.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:F}):null,f===`tasks`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:(0,h.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:c(`taskList`)}),(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(`tasksCount`,{total:a.length,enabled:Xe})})]})})}),(0,h.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:a.length===0?(0,h.jsx)(`div`,{className:`rounded-lg px-3 py-3 text-center text-xs text-muted-foreground/55 md:col-span-2`,children:c(`noScheduledTasks`)}):a.map(e=>{let r=e.status===`enabled`,i=e.status===`completed`,a=y(e);return(0,h.jsxs)(`div`,{className:`relative cursor-pointer rounded-xl border border-border bg-card p-4 transition-colors hover:bg-muted/15`,onClick:()=>T(e.id),children:[(0,h.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,h.jsx)(`h3`,{className:`truncate text-sm font-medium text-foreground/90`,children:e.title})}),(0,h.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:xe(e.instruction,20)})]}),(0,h.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,h.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":r,disabled:i,className:u(`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,h.jsx)(`span`,{className:u(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,r?`translate-x-5`:`translate-x-0`)})}),(0,h.jsxs)(`div`,{className:`relative`,children:[(0,h.jsx)(l,{variant:`ghost`,size:`icon`,onClick:()=>D(E===e.id?null:e.id),title:c(`moreActions`),children:(0,h.jsx)(te,{className:`size-4`})}),E===e.id?(0,h.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,h.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:!Ee(e),onClick:()=>void $(e.id,`run`),children:[(0,h.jsx)(ae,{className:`size-3.5`}),c(`executeNow`)]}),(0,h.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:()=>ot(e),children:[(0,h.jsx)(t,{className:`size-3.5`}),c(`editTask`)]}),(0,h.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted`,onClick:()=>{D(null),T(e.id)},children:[(0,h.jsx)(ne,{className:`size-3.5`}),c(`viewDetails`)]}),(0,h.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,h.jsx)(ie,{className:`size-3.5`}),c(`deleteTask`)]})]}):null]})]})]}),(0,h.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(ee,{className:`size-3`}),e.scheduleRule]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(n,{className:`size-3`}),Y(e.agentId)]}),(0,h.jsxs)(`span`,{children:[c(`taskExecutionMode`),`:`,De(e.executionMode)]}),e.projectName?(0,h.jsxs)(`span`,{children:[c(`taskProject`),e.projectName]}):null]}),(0,h.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,h.jsxs)(`span`,{children:[c(`lastExecution`),_(e.lastRunAt)]}),(0,h.jsxs)(`span`,{children:[c(`nextExecution`),_(e.nextRunAt)]})]})]},e.id)})})]}):(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,h.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,h.jsx)(ce,{className:`size-4`}),c(`historyFilters`)]}),(0,h.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,h.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`taskName`),(0,h.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.taskId,onChange:e=>Z(`taskId`,e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:c(`allTasks`)}),a.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,h.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`status`),(0,h.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.status,onChange:e=>Z(`status`,e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:c(`allStatuses`)}),(0,h.jsx)(`option`,{value:`running`,children:c(`executionRunning`)}),(0,h.jsx)(`option`,{value:`success`,children:c(`executionSuccess`)}),(0,h.jsx)(`option`,{value:`failed`,children:c(`taskFailed`)})]})]}),(0,h.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`triggerType`),(0,h.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.trigger,onChange:e=>Z(`trigger`,e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:c(`allTriggers`)}),(0,h.jsx)(`option`,{value:`schedule`,children:c(`autoRun`)}),(0,h.jsx)(`option`,{value:`manual`,children:c(`manualRun`)})]})]}),(0,h.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`startTime`),(0,h.jsx)(`input`,{type:`datetime-local`,className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.startedFrom,onChange:e=>Z(`startedFrom`,e.target.value)})]}),(0,h.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`endTime`),(0,h.jsx)(`input`,{type:`datetime-local`,className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.startedTo,onChange:e=>Z(`startedTo`,e.target.value)})]}),(0,h.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[c(`keyword`),(0,h.jsx)(`input`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:H.keyword,onChange:e=>Z(`keyword`,e.target.value),placeholder:c(`keywordPlaceholder`)})]})]}),(0,h.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,h.jsx)(l,{variant:`outline`,onClick:tt,children:c(`reset`)}),(0,h.jsx)(l,{onClick:et,children:c(`query`)})]})]}),(0,h.jsxs)(`div`,{className:`overflow-x-auto rounded-xl border border-border bg-card`,children:[(0,h.jsxs)(`div`,{className:`grid min-w-[600px] 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,h.jsx)(`span`,{children:c(`taskName`)}),(0,h.jsx)(`span`,{children:c(`status`)}),(0,h.jsx)(`span`,{children:c(`triggerType`)}),(0,h.jsx)(`span`,{children:c(`startTime`)}),(0,h.jsx)(`span`,{children:c(`runDuration`)})]}),ze?(0,h.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:c(`loading`)}):K.runs.length===0?(0,h.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:c(`noExecutionHistory`)}):K.runs.map(e=>(0,h.jsxs)(`div`,{className:`border-b border-border last:border-b-0`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`grid w-full min-w-[600px] 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:()=>He(Ve===e.id?null:e.id),children:[(0,h.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:e.taskTitle}),(0,h.jsx)(`span`,{children:(0,h.jsx)(`span`,{className:u(`rounded-full px-2 py-0.5 text-xs`,Ae(e.status)),children:ke(e.status)})}),(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:e.trigger===`manual`?c(`manualRun`):c(`autoRun`)}),(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:_(e.startedAt)}),(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:e.durationMs?`${e.durationMs}ms`:`-`})]}),Ve===e.id?(0,h.jsx)(`div`,{className:`border-t border-border bg-muted/20 px-4 py-3`,children:st(e)}):null]},`${e.taskId}:${e.id}`)),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3 text-sm text-muted-foreground`,children:[(0,h.jsx)(`span`,{children:c(`paginationSummary`,{page:K.page,pages:Ze,total:K.total})}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`select`,{className:`h-8 rounded-md border border-input bg-background px-2 text-sm`,value:K.pageSize,onChange:e=>rt(Number(e.target.value)),children:[10,20,50,100].map(e=>(0,h.jsx)(`option`,{value:e,children:c(`pageSize`,{size:e})},e))}),(0,h.jsx)(l,{variant:`outline`,size:`sm`,disabled:K.page<=1,onClick:()=>nt(K.page-1),children:c(`previousPage`)}),(0,h.jsx)(l,{variant:`outline`,size:`sm`,disabled:K.page>=Ze,onClick:()=>nt(K.page+1),children:c(`nextPage`)})]})]})]})]})]})})})]})}export{x as ScheduledTasksPage};
|