@shawnstack/quickforge 1.5.6 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +19 -17
  2. package/dist/assets/AgentProfilesPage-BTWTENpJ.js +1 -0
  3. package/dist/assets/{ChatPanelHost-CBoFtBvB.js → ChatPanelHost-DBCQpcp1.js} +2 -2
  4. package/dist/assets/PluginsPage-DRbQLXc6.js +1 -0
  5. package/dist/assets/ScheduledTasksPage-_Te96TTL.js +2 -0
  6. package/dist/assets/SettingsWorkspacePage-B3KByRv9.js +1412 -0
  7. package/dist/assets/{SharedConversationPage-7I9MiMcj.js → SharedConversationPage-CJr-rzR4.js} +1 -1
  8. package/dist/assets/TerminalDock-DSsVoL0f.js +2 -0
  9. package/dist/assets/WorkspaceInspector-HuIqe-Y6.js +3 -0
  10. package/dist/assets/{WorkspaceReaderDialog-Dli8GgAq.js → WorkspaceReaderDialog-au2UL_Ti.js} +1 -1
  11. package/dist/assets/{diff-line-counts-Dvz3MNk2.js → diff-line-counts-CnZu37tM.js} +1 -1
  12. package/dist/assets/{icons-DXrzz0RO.js → icons-B0ihJZtt.js} +1 -1
  13. package/dist/assets/index-CTo6RkZO.js +63 -0
  14. package/dist/assets/index-hb3vYF5_.css +3 -0
  15. package/dist/assets/mcp-servers-dialog-1Y9X80tB.js +5 -0
  16. package/dist/assets/{monaco-k8av2MY0.js → monaco-BKEc9mhB.js} +1 -1
  17. package/dist/assets/{react-vendor-xMa3TUTb.js → react-vendor-EwqQ8x7m.js} +1 -1
  18. package/dist/assets/skills-dialog-vMwLkH49.js +1 -0
  19. package/dist/assets/{useAppTheme-BzB8Q6AC.js → useAppTheme-CG1_MfzA.js} +1 -1
  20. package/dist/index.html +6 -6
  21. package/package.json +4 -1
  22. package/server/agent-manager.mjs +3 -1
  23. package/server/index.mjs +4 -3
  24. package/server/routes/backup.mjs +80 -6
  25. package/server/routes/system.mjs +5 -0
  26. package/server/storage.mjs +6 -5
  27. package/server/utils/package-update.mjs +46 -0
  28. package/dist/assets/AgentProfilesPage-DFUA4KiP.js +0 -1
  29. package/dist/assets/PluginsPage-CKOP-P02.js +0 -1
  30. package/dist/assets/ScheduledTasksPage-CRPvyfmE.js +0 -2
  31. package/dist/assets/SettingsWorkspacePage-Csr6xu0M.js +0 -1320
  32. package/dist/assets/TerminalDock-DWZAOy7v.js +0 -2
  33. package/dist/assets/WorkspaceInspector-D4k8zQ4s.js +0 -3
  34. package/dist/assets/index-BDNDRaPf.css +0 -3
  35. package/dist/assets/index-BIslkXQt.js +0 -69
  36. package/dist/assets/mcp-servers-dialog-DXR3fnZY.js +0 -20
  37. package/dist/assets/skills-dialog-Dax-_Ze5.js +0 -1
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t}from"./icons-DXrzz0RO.js";var n=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,ee=5,w=-1;function T(){return g?!0:!(e.unstable_now()-w<ee)}function E(){if(g=!1,S){var t=e.unstable_now();w=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,k=O.port2;O.port1.onmessage=E,D=function(){k.postMessage(null)}}else D=function(){_(E,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),r=e(((e,t)=>{t.exports=n()})),i=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),a=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=i()})),o=e((e=>{var n=r(),i=t(),o=a();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},I=[],L=-1;function re(e){return{current:e}}function R(e){0>L||(e.current=I[L],I[L]=null,L--)}function z(e,t){L++,I[L]=e.current,e.current=t}var B=re(null),ie=re(null),ae=re(null),oe=re(null);function se(e,t){switch(z(ae,t),z(ie,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function ce(){R(B),R(ie),R(ae)}function V(e){e.memoizedState!==null&&z(oe,e);var t=B.current,n=Hd(t,e.type);t!==n&&(z(ie,e),z(B,n))}function le(e){ie.current===e&&(R(B),R(ie)),oe.current===e&&(R(oe),Qf._currentValue=ne)}var H,ue;function de(e){if(H===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||``,ue=-1<e.stack.indexOf(`
1
+ import{t as e}from"./rolldown-runtime-DWdDZTNf.js";import{jt as t}from"./icons-B0ihJZtt.js";var n=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,ee=5,w=-1;function T(){return g?!0:!(e.unstable_now()-w<ee)}function E(){if(g=!1,S){var t=e.unstable_now();w=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,k=O.port2;O.port1.onmessage=E,D=function(){k.postMessage(null)}}else D=function(){_(E,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),r=e(((e,t)=>{t.exports=n()})),i=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),a=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=i()})),o=e((e=>{var n=r(),i=t(),o=a();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},I=[],L=-1;function re(e){return{current:e}}function R(e){0>L||(e.current=I[L],I[L]=null,L--)}function z(e,t){L++,I[L]=e.current,e.current=t}var B=re(null),ie=re(null),ae=re(null),oe=re(null);function se(e,t){switch(z(ae,t),z(ie,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function ce(){R(B),R(ie),R(ae)}function V(e){e.memoizedState!==null&&z(oe,e);var t=B.current,n=Hd(t,e.type);t!==n&&(z(ie,e),z(B,n))}function le(e){ie.current===e&&(R(B),R(ie)),oe.current===e&&(R(oe),Qf._currentValue=ne)}var H,ue;function de(e){if(H===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||``,ue=-1<e.stack.indexOf(`
2
2
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
3
  `+H+e+ue}var fe=!1;function pe(e,t){if(!e||fe)return``;fe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
4
  `),l=s.split(`
@@ -0,0 +1 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-DWdDZTNf.js";import{Dt as n,L as r,Ot as i,g as a,jt as o,n as s}from"./icons-B0ihJZtt.js";import{n as c}from"./react-vendor-EwqQ8x7m.js";import{Q as l,et as u,it as d}from"./index-CTo6RkZO.js";var f=t({SkillsDialog:()=>_,SkillsManagerPanel:()=>g}),p=e(o(),1),m=c();async function h(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`HTTP ${e.status}`);return t}function g({active:e=!0,scope:t,project:o,embedded:c=!1,onClose:f,onSaved:g}){let[_,v]=(0,p.useState)([]),[y,b]=(0,p.useState)(()=>new Set),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)([]),[T,E]=(0,p.useState)(!1),[D,O]=(0,p.useState)(!1),[k,A]=(0,p.useState)(``),j=t===`project`,[M,N]=(0,p.useState)(null),[P,F]=(0,p.useState)(null),[I,L]=(0,p.useState)(!1),[R,z]=(0,p.useState)(``),B=(0,p.useCallback)(()=>{N(null),F(null),z(``)},[]),V=(0,p.useCallback)(()=>{B(),f?.()},[f,B]);(0,p.useEffect)(()=>{if(!e||j&&!o)return;let t=!1;return(async()=>{E(!0),A(``);try{let e=j?`/api/skills?projectId=${encodeURIComponent(o.id)}`:`/api/skills?scope=global`,n=await h(await fetch(e));if(t)return;v(Array.isArray(n.skills)?n.skills:[]),b(new Set(Array.isArray(n.selectedSkills)?n.selectedSkills:[])),w(Array.isArray(n.searchPaths)?n.searchPaths:[])}catch(e){t||A(e instanceof Error?e.message:d(`failedToLoadSkills`))}finally{t||E(!1)}})(),()=>{t=!0}},[e,o,j]),(0,p.useEffect)(()=>{if(!e||c)return;let t=e=>{e.key===`Escape`&&(M?B():D||V())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,V,c,D,M,B]);let H=(0,p.useMemo)(()=>{let e=x.trim().toLowerCase();return e?_.filter(t=>[t.name,t.displayName,t.description,t.source,t.compatibility,t.allowedTools,...t.tags??[],...t.triggers??[]].filter(Boolean).join(` `).toLowerCase().includes(e)):_},[x,_]),U=async e=>{N(e),F(null),z(``),L(!0);try{let t=new URLSearchParams({name:e});j&&o?(t.set(`scope`,`project`),t.set(`projectId`,o.id)):t.set(`scope`,`global`),F(await h(await fetch(`/api/skills/content?${t}`)))}catch(e){z(e instanceof Error?e.message:d(`failedToReadSkill`))}finally{L(!1)}};if(!e||j&&!o)return null;let W=e=>{if(D)return;let t=new Set(y);t.has(e)?t.delete(e):t.add(e),b(t),G(t)},G=async e=>{O(!0),A(``);try{let n=await h(await fetch(j?`/api/skills/project`:`/api/skills/global`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(j?{projectId:o.id,selectedSkills:[...e]}:{selectedSkills:[...e]})}));g({scope:t,project:j?n.projects?.find(e=>e.id===o.id)??{...o,skills:n.selectedSkills}:void 0,projects:n.projects,selectedSkills:n.selectedSkills})}catch(e){b(y),A(e instanceof Error?e.message:d(`failedToSaveSkills`))}finally{O(!1)}},K=d(j?`projectSkills`:`globalSkills`),q=j?d(`projectSkillsDescription`,{project:o.name}):d(`globalSkillsDescription`),J=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`quickforge-settings-divider p-3`,children:(0,m.jsxs)(`div`,{className:`quickforge-settings-inline-field`,children:[(0,m.jsx)(a,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground/60`}),(0,m.jsx)(`input`,{value:x,onChange:e=>S(e.target.value),placeholder:d(`searchSkills`),className:`quickforge-settings-input`,disabled:T||D})]})}),k?(0,m.jsx)(`div`,{className:`quickforge-settings-alert quickforge-settings-warning-attached`,children:k}):null,(0,m.jsxs)(`div`,{className:`quickforge-settings-toolbar`,children:[(0,m.jsx)(`span`,{className:`quickforge-settings-row-title`,children:d(`availableSkills`)}),(0,m.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-info`,children:d(`selectedSkillsCount`,{count:y.size})})]}),(0,m.jsx)(`div`,{className:c?``:`max-h-[46vh] overflow-y-auto`,children:T?(0,m.jsxs)(`div`,{className:`quickforge-settings-empty-row inline-flex items-center gap-2`,children:[(0,m.jsx)(r,{className:`size-4 animate-spin`}),d(`loading`)]}):H.length===0?(0,m.jsx)(`div`,{className:`quickforge-settings-empty-row`,children:d(`noMatchingSkills`)}):H.map(e=>{let t=y.has(e.name);return(0,m.jsxs)(`div`,{className:u(`quickforge-settings-list-item`,t&&`bg-muted/12`),children:[(0,m.jsxs)(`div`,{className:`quickforge-settings-list-item-main`,children:[(0,m.jsx)(`div`,{className:`quickforge-settings-row-title`,children:e.displayName||e.name}),e.description?(0,m.jsx)(`div`,{className:`quickforge-settings-row-description`,children:e.description}):null,(0,m.jsxs)(`div`,{className:`quickforge-settings-meta`,children:[e.source?(0,m.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:e.source}):null,e.compatibility?(0,m.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:e.compatibility}):null,e.allowedTools?(0,m.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:e.allowedTools}):null,e.tags?.slice(0,5).map(e=>(0,m.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:e},e))]})]}),(0,m.jsxs)(`div`,{className:`quickforge-settings-list-item-actions`,onClick:e=>e.stopPropagation(),children:[(0,m.jsxs)(`label`,{className:`quickforge-settings-switch`,"aria-disabled":D?`true`:`false`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:t,disabled:D,onChange:()=>W(e.name),"aria-label":t?`Disable ${e.name}`:`Enable ${e.name}`}),(0,m.jsx)(`span`,{"aria-hidden":`true`})]}),(0,m.jsx)(`button`,{type:`button`,className:`quickforge-settings-icon-action`,onClick:()=>void U(e.name),disabled:D||I,title:d(`readSkill`),"aria-label":`${d(`readSkill`)}: ${e.displayName||e.name}`,children:(0,m.jsx)(n,{className:`size-4`})})]})]},e.name)})})]}),Y=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`quickforge-settings-toolbar`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`quickforge-settings-button quickforge-settings-button-secondary`,onClick:B,disabled:I,children:[(0,m.jsx)(i,{className:`mr-2 size-4`}),d(`backToSkillList`)]}),(0,m.jsx)(`div`,{className:`quickforge-settings-row-main min-w-0`,children:(0,m.jsx)(`div`,{className:`quickforge-settings-row-title truncate`,children:P?.displayName||P?.name||M})})]}),(0,m.jsx)(`div`,{className:`p-4`,children:I?(0,m.jsxs)(`div`,{className:`quickforge-settings-empty-row inline-flex items-center gap-2`,children:[(0,m.jsx)(r,{className:`size-4 animate-spin`}),d(`loading`)]}):R?(0,m.jsx)(`div`,{className:`quickforge-settings-alert quickforge-settings-warning-attached`,children:R}):P?(0,m.jsxs)(m.Fragment,{children:[P.description?(0,m.jsx)(`div`,{className:`quickforge-settings-row-description mb-3`,children:P.description}):null,(0,m.jsxs)(`div`,{className:`quickforge-settings-meta mb-3`,children:[P.version?(0,m.jsxs)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:[`v`,P.version]}):null,P.source?(0,m.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:P.source}):null,P.compatibility?(0,m.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:P.compatibility}):null,P.allowedTools?(0,m.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:P.allowedTools}):null,P.license?(0,m.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:P.license}):null,P.tags?.map(e=>(0,m.jsx)(`span`,{className:`quickforge-settings-badge quickforge-settings-badge-muted`,children:e},e))]}),P.triggers?.length?(0,m.jsxs)(`div`,{className:`quickforge-settings-row-description mb-3`,children:[`Triggers: `,P.triggers.join(`, `)]}):null,P.instructions?(0,m.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded-md border border-border bg-muted/30 px-4 py-3 font-mono text-sm leading-6 text-foreground/80`,children:P.instructions}):(0,m.jsx)(`div`,{className:`quickforge-settings-empty-row`,children:d(`noSkillContent`)})]}):null})]});return c?(0,m.jsx)(`div`,{className:`quickforge-settings-stack`,children:(0,m.jsx)(`section`,{className:`quickforge-settings-section`,"aria-label":K,children:M?Y:(0,m.jsxs)(m.Fragment,{children:[C.length?(0,m.jsx)(`div`,{className:`px-5 pt-4`,children:(0,m.jsxs)(`span`,{className:`quickforge-settings-row-description break-all`,children:[d(`skillSearchPaths`),`: `,C.join(` · `)]})}):null,J]})})}):(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onClick:e=>{e.target===e.currentTarget&&!D&&V()},children:(0,m.jsxs)(`div`,{className:`flex max-h-[85vh] w-full max-w-2xl flex-col rounded-lg border border-border bg-background shadow-quickforge`,children:[(0,m.jsxs)(`div`,{className:`quickforge-settings-toolbar`,children:[(0,m.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,m.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[K,(0,m.jsx)(l,{label:q})]}),(0,m.jsx)(`div`,{className:`quickforge-settings-row-description`,children:q}),C.length?(0,m.jsxs)(`div`,{className:`quickforge-settings-row-description break-all`,children:[d(`skillSearchPaths`),`: `,C.join(` · `)]}):null]}),(0,m.jsx)(`button`,{type:`button`,className:`quickforge-settings-icon-action`,onClick:V,disabled:D,"aria-label":d(`close`),children:(0,m.jsx)(s,{className:`size-4`})})]}),(0,m.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:M?Y:J})]})})}function _({open:e,scope:t,project:n,onOpenChange:r,onSaved:i}){return(0,m.jsx)(g,{active:e,scope:t,project:n,onClose:()=>r(!1),onSaved:i})}export{f as n,_ as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t}from"./icons-DXrzz0RO.js";import{y as n}from"./index-BIslkXQt.js";var r=e(t(),1);function i(){let[e,t]=(0,r.useState)(()=>n());return(0,r.useEffect)(()=>{if(typeof document>`u`)return;let e=document.documentElement,r=()=>t(n());r();let i=new MutationObserver(r);return i.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>i.disconnect()},[]),e}export{i as t};
1
+ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{jt as t}from"./icons-B0ihJZtt.js";import{y as n}from"./index-CTo6RkZO.js";var r=e(t(),1);function i(){let[e,t]=(0,r.useState)(()=>n());return(0,r.useEffect)(()=>{if(typeof document>`u`)return;let e=document.documentElement,r=()=>t(n());r();let i=new MutationObserver(r);return i.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>i.disconnect()},[]),e}export{i as t};
package/dist/index.html CHANGED
@@ -11,18 +11,18 @@
11
11
  <meta name="apple-mobile-web-app-title" content="QuickForge" />
12
12
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
13
13
  <title>速构 QuickForge</title>
14
- <script type="module" crossorigin src="/assets/index-BIslkXQt.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-CTo6RkZO.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-DWdDZTNf.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/pi-ai-Cx633yhb.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/lit-vendor-Dr3cpBGF.js">
18
18
  <link rel="modulepreload" crossorigin href="/assets/pi-web-ui-DFNE2m5b.js">
19
19
  <link rel="modulepreload" crossorigin href="/assets/css-utils-rkE68RDy.js">
20
- <link rel="modulepreload" crossorigin href="/assets/icons-DXrzz0RO.js">
21
- <link rel="modulepreload" crossorigin href="/assets/react-vendor-xMa3TUTb.js">
20
+ <link rel="modulepreload" crossorigin href="/assets/icons-B0ihJZtt.js">
21
+ <link rel="modulepreload" crossorigin href="/assets/react-vendor-EwqQ8x7m.js">
22
22
  <link rel="modulepreload" crossorigin href="/assets/logger-B65Akg8A.js">
23
- <link rel="modulepreload" crossorigin href="/assets/index-BIslkXQt.js">
24
- <link rel="modulepreload" crossorigin href="/assets/skills-dialog-Dax-_Ze5.js">
25
- <link rel="stylesheet" crossorigin href="/assets/index-BDNDRaPf.css">
23
+ <link rel="modulepreload" crossorigin href="/assets/index-CTo6RkZO.js">
24
+ <link rel="modulepreload" crossorigin href="/assets/skills-dialog-vMwLkH49.js">
25
+ <link rel="stylesheet" crossorigin href="/assets/index-hb3vYF5_.css">
26
26
  </head>
27
27
  <body>
28
28
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shawnstack/quickforge",
3
- "version": "1.5.6",
3
+ "version": "1.6.3",
4
4
  "description": "AI chat application with Agent access modes for local workspace tools. React + Vite + Tailwind CSS frontend, local Node.js storage server.",
5
5
  "keywords": [
6
6
  "ai",
@@ -27,6 +27,9 @@
27
27
  "url": "https://github.com/shawnstack/quickforge/issues"
28
28
  },
29
29
  "homepage": "https://github.com/shawnstack/quickforge#readme",
30
+ "engines": {
31
+ "node": ">=22.19.0"
32
+ },
30
33
  "type": "module",
31
34
  "main": "./server/public-api.mjs",
32
35
  "bin": {
@@ -1568,9 +1568,11 @@ async function persistSession(session) {
1568
1568
  await atomicSessionMetadataUpdate(scope, projectId, (data) => {
1569
1569
  const existingMetadata = data[sessionId]
1570
1570
  archivedAt = existingMetadata?.archivedAt
1571
+ // Merge onto the existing record so storage-only fields the in-memory
1572
+ // session does not own (pinnedAt, archivedAt, …) survive the rebuild.
1571
1573
  data[sessionId] = {
1574
+ ...existingMetadata,
1572
1575
  ...metadata,
1573
- pinnedAt: existingMetadata?.pinnedAt,
1574
1576
  ...(archivedAt ? { archivedAt } : {}),
1575
1577
  }
1576
1578
  return data
package/server/index.mjs CHANGED
@@ -31,7 +31,7 @@ import { handleChannelsApi } from './routes/channels.mjs'
31
31
  import { handleModelsApi } from './routes/models.mjs'
32
32
  import { serveStatic } from './routes/static.mjs'
33
33
  import { logger, flushLogger } from './utils/logger.mjs'
34
- import { getPackageInfo, checkForUpdates } from './utils/package-update.mjs'
34
+ import { getPackageInfo, checkForUpdates, checkDesktopRelease } from './utils/package-update.mjs'
35
35
  import { installAiHttpLogger } from './ai-http-logger.mjs'
36
36
  import { isLoopbackAddress, getLanUrls } from './utils/network.mjs'
37
37
  import { parseCookies } from './share-store.mjs'
@@ -398,18 +398,19 @@ async function handleApi(req, res, url) {
398
398
  }
399
399
 
400
400
  // Backup / import-export routes
401
- if (pathname === '/api/backup/export' || pathname === '/api/backup/import' || pathname === '/api/backup/inspect') {
401
+ if (pathname === '/api/backup/export' || pathname === '/api/backup/import' || pathname === '/api/backup/inspect' || pathname === '/api/backup/inspect-file') {
402
402
  await handleBackupApi(req, res, url)
403
403
  return
404
404
  }
405
405
 
406
406
  // System routes
407
- if (pathname === '/api/system/status' || pathname === '/api/system/restart' || pathname === '/api/system/network' || pathname === '/api/system/terminal-shell' || pathname === '/api/system/about' || pathname === '/api/system/update/check' || pathname === '/api/system/update') {
407
+ if (pathname === '/api/system/status' || pathname === '/api/system/restart' || pathname === '/api/system/network' || pathname === '/api/system/terminal-shell' || pathname === '/api/system/about' || pathname === '/api/system/update/check' || pathname === '/api/system/update/desktop' || pathname === '/api/system/update') {
408
408
  await handleSystemApi(req, res, url, {
409
409
  getSystemStatus,
410
410
  requestRestart,
411
411
  getPackageInfo: () => getPackageInfo(projectRoot),
412
412
  checkForUpdates: () => checkForUpdates(projectRoot),
413
+ checkDesktopRelease: () => checkDesktopRelease(projectRoot),
413
414
  updateQuickForge,
414
415
  isLocalRequest: isLoopbackAddress(req.socket.remoteAddress),
415
416
  getTerminalShellSetting: readTerminalShellSetting,
@@ -1,3 +1,4 @@
1
+ import { randomUUID } from 'node:crypto'
1
2
  import { promises as fs } from 'node:fs'
2
3
  import path from 'node:path'
3
4
  import { sendJson, readJsonBody } from '../utils/response.mjs'
@@ -15,6 +16,7 @@ import { getWorkspaceRoot } from '../utils/workspace.mjs'
15
16
 
16
17
  const BACKUP_VERSION = 1
17
18
  const BACKUP_APP = 'quickforge'
19
+ const IMPORT_UPLOAD_MAX_BYTES = Number(process.env.QUICKFORGE_IMPORT_UPLOAD_MAX_BYTES || 1024 * 1024 * 1024)
18
20
  const backupScopes = new Set(['all', 'config', 'sessions'])
19
21
  const restoreSectionIds = new Set(['settings', 'mcp', 'providerKeys', 'customProviders', 'projects', 'scheduledTasks', 'conversations'])
20
22
  const restoreModes = new Set(['replace', 'merge'])
@@ -25,8 +27,8 @@ function normalizeMode(value) {
25
27
  }
26
28
 
27
29
  function normalizeScope(value) {
28
- const scope = String(value || 'all')
29
- return backupScopes.has(scope) ? scope : 'all'
30
+ const scope = String(value || 'config')
31
+ return backupScopes.has(scope) ? scope : 'config'
30
32
  }
31
33
 
32
34
  function parseBoolean(value) {
@@ -34,6 +36,67 @@ function parseBoolean(value) {
34
36
  return text === '1' || text === 'true' || text === 'yes'
35
37
  }
36
38
 
39
+ function extractCoreBackupFromText(text) {
40
+ const backup = JSON.parse(text, (key, value) => (
41
+ key === 'sessions' || key === 'sessionsMetadata' || key === 'sessions-metadata'
42
+ ? undefined
43
+ : value
44
+ ))
45
+ if (backup && typeof backup === 'object' && !Array.isArray(backup)) {
46
+ if (backup.data && typeof backup.data === 'object' && !Array.isArray(backup.data)) {
47
+ backup.scope = 'config'
48
+ return backup
49
+ }
50
+ return {
51
+ app: backup.app ?? BACKUP_APP,
52
+ version: backup.version ?? BACKUP_VERSION,
53
+ exportedAt: backup.exportedAt ?? null,
54
+ scope: 'config',
55
+ includeSecrets: backup.includeSecrets === true,
56
+ data: backup,
57
+ }
58
+ }
59
+ const error = new Error('Invalid backup file')
60
+ error.statusCode = 400
61
+ throw error
62
+ }
63
+
64
+ async function readTextBody(req, maxBodyBytes = IMPORT_UPLOAD_MAX_BYTES) {
65
+ const chunks = []
66
+ let size = 0
67
+ for await (const chunk of req) {
68
+ size += chunk.length
69
+ if (size > maxBodyBytes) {
70
+ const error = new Error('Backup file is too large')
71
+ error.statusCode = 413
72
+ throw error
73
+ }
74
+ chunks.push(chunk)
75
+ }
76
+ return Buffer.concat(chunks).toString('utf8')
77
+ }
78
+
79
+ async function writePendingImportBackup(backup) {
80
+ const dir = path.join(storageDir, 'pending-imports')
81
+ await fs.mkdir(dir, { recursive: true })
82
+ const token = randomUUID()
83
+ const file = path.join(dir, `${token}.json`)
84
+ await fs.writeFile(file, `${JSON.stringify(backup)}\n`, 'utf8')
85
+ return token
86
+ }
87
+
88
+ async function readPendingImportBackup(token) {
89
+ if (!/^[0-9a-f-]{36}$/i.test(String(token || ''))) {
90
+ const error = new Error('Invalid import token')
91
+ error.statusCode = 400
92
+ throw error
93
+ }
94
+ const file = path.join(storageDir, 'pending-imports', `${token}.json`)
95
+ const backup = JSON.parse(await fs.readFile(file, 'utf8'))
96
+ await fs.rm(file, { force: true })
97
+ return backup
98
+ }
99
+
37
100
  function backupTimestamp(date = new Date()) {
38
101
  return date.toISOString().replace(/[:.]/g, '-')
39
102
  }
@@ -333,8 +396,8 @@ function inspectBackup(payload) {
333
396
  }
334
397
  }
335
398
 
336
- async function writeSafetyBackup() {
337
- const backup = await buildBackup('all', { includeSecrets: true })
399
+ async function writeSafetyBackup(scope = 'config') {
400
+ const backup = await buildBackup(scope, { includeSecrets: true })
338
401
  const dir = path.join(storageDir, 'backups')
339
402
  await fs.mkdir(dir, { recursive: true })
340
403
  const file = path.join(dir, `quickforge-before-restore-${backupTimestamp()}.json`)
@@ -443,11 +506,22 @@ export async function handleBackupApi(req, res, url) {
443
506
  return
444
507
  }
445
508
 
509
+ if (req.method === 'POST' && url.pathname === '/api/backup/inspect-file') {
510
+ await ensureStorage()
511
+ const text = await readTextBody(req)
512
+ const backup = extractCoreBackupFromText(text)
513
+ const inspect = inspectBackup(backup)
514
+ const token = await writePendingImportBackup(backup)
515
+ sendJson(res, 200, { ...inspect, importToken: token })
516
+ return
517
+ }
518
+
446
519
  if (req.method === 'POST' && url.pathname === '/api/backup/import') {
447
520
  await ensureStorage()
448
521
  const body = await readJsonBody(req)
449
- const { backup, mode } = parseImportPayload(body)
450
- const safetyBackupPath = await writeSafetyBackup()
522
+ const importBody = body?.importToken ? { ...body, backup: await readPendingImportBackup(body.importToken) } : body
523
+ const { backup, mode } = parseImportPayload(importBody)
524
+ const safetyBackupPath = await writeSafetyBackup(backup.sections.sessions !== undefined || backup.sections.sessionsMetadata !== undefined ? 'all' : 'config')
451
525
  const summary = await restoreValidatedBackup(backup, mode)
452
526
  sendJson(res, 200, { ok: true, safetyBackupPath, summary })
453
527
  return
@@ -12,6 +12,11 @@ export async function handleSystemApi(req, res, url, context) {
12
12
  return
13
13
  }
14
14
 
15
+ if (req.method === 'GET' && url.pathname === '/api/system/update/desktop') {
16
+ sendJson(res, 200, await context.checkDesktopRelease())
17
+ return
18
+ }
19
+
15
20
  if (req.method === 'POST' && url.pathname === '/api/system/update') {
16
21
  if (!context.isLocalRequest) {
17
22
  const error = new Error('Update is only allowed from this computer')
@@ -469,10 +469,6 @@ async function readAllSessionValues() {
469
469
  return result
470
470
  }
471
471
 
472
- function sessionMetadataQueueName(bucket) {
473
- return bucket.scope === 'project' ? `sessions-metadata:${bucket.projectId}` : 'sessions-metadata:global'
474
- }
475
-
476
472
  function sameSessionBucket(left, right) {
477
473
  if (!left || !right) return false
478
474
  return left.scope === right.scope && (left.projectId || undefined) === (right.projectId || undefined)
@@ -852,7 +848,12 @@ export async function atomicUpdate(storeName, updateFn) {
852
848
  export async function atomicSessionMetadataUpdate(scope, projectId, updateFn) {
853
849
  const bucket = scope === 'project' ? { scope: 'project', projectId } : { scope: 'global' }
854
850
  const file = sessionStoreFile('sessions-metadata', bucket)
855
- return enqueueWrite(sessionMetadataQueueName(bucket), async () => {
851
+ // Scoped session-metadata writes MUST share the single 'sessions-metadata'
852
+ // write queue used by atomicUpdate('sessions-metadata'). Both paths
853
+ // read-modify-write the same physical files; separate queues let them run
854
+ // concurrently and clobber each other — e.g. persistSession (which rebuilds
855
+ // metadata without pinnedAt) racing with a pin update and dropping pinnedAt.
856
+ return enqueueWrite('sessions-metadata', async () => {
856
857
  await ensureStorage()
857
858
  const data = await readJsonFile(file, {})
858
859
  const previousData = { ...data }
@@ -2,6 +2,9 @@ import { spawn } from 'node:child_process'
2
2
  import { promises as fs } from 'node:fs'
3
3
  import path from 'node:path'
4
4
 
5
+ const QUICKFORGE_RELEASES_URL = 'https://github.com/shawnstack/quickforge/releases/latest'
6
+ const QUICKFORGE_LATEST_RELEASE_API_URL = 'https://api.github.com/repos/shawnstack/quickforge/releases/latest'
7
+
5
8
  function normalizeRepositoryUrl(value) {
6
9
  if (!value || typeof value !== 'string') return ''
7
10
  return value
@@ -122,11 +125,54 @@ export async function checkForUpdates(projectRoot) {
122
125
  const comparison = compareVersions(pkg.version, latestVersion)
123
126
  return {
124
127
  ...pkg,
128
+ channel: 'npm-runtime',
129
+ distribution: 'npm',
125
130
  currentVersion: pkg.version,
126
131
  latestVersion,
127
132
  updateAvailable: comparison < 0,
128
133
  localVersionIsNewer: comparison > 0,
129
134
  installCommand: `npm install -g ${pkg.name}@latest`,
135
+ releaseUrl: QUICKFORGE_RELEASES_URL,
136
+ }
137
+ }
138
+
139
+ export async function checkDesktopRelease(projectRoot) {
140
+ const pkg = await getPackageInfo(projectRoot)
141
+ const controller = new AbortController()
142
+ const timeout = setTimeout(() => controller.abort(), 5000)
143
+
144
+ try {
145
+ const response = await fetch(QUICKFORGE_LATEST_RELEASE_API_URL, {
146
+ headers: {
147
+ accept: 'application/vnd.github+json',
148
+ 'user-agent': `${pkg.name || 'quickforge'}-desktop-update-check`,
149
+ },
150
+ signal: controller.signal,
151
+ })
152
+
153
+ if (!response.ok) throw new Error(`GitHub releases returned HTTP ${response.status}`)
154
+
155
+ const release = await response.json()
156
+ const latestVersion = release?.tag_name || release?.name
157
+ if (!latestVersion || typeof latestVersion !== 'string') throw new Error('latest release version not found in GitHub response')
158
+
159
+ const comparison = compareVersions(pkg.version, latestVersion)
160
+ return {
161
+ ...pkg,
162
+ channel: 'desktop-app',
163
+ distribution: 'github-releases',
164
+ currentVersion: pkg.version,
165
+ latestVersion,
166
+ updateAvailable: comparison < 0,
167
+ localVersionIsNewer: comparison > 0,
168
+ releaseUrl: release?.html_url || QUICKFORGE_RELEASES_URL,
169
+ installable: false,
170
+ }
171
+ } catch (error) {
172
+ if (error.name === 'AbortError') throw new Error('request timeout', { cause: error })
173
+ throw error
174
+ } finally {
175
+ clearTimeout(timeout)
130
176
  }
131
177
  }
132
178
 
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t,T as n,Tt as r,a as i,c as a,rt as o}from"./icons-DXrzz0RO.js";import{n as s}from"./react-vendor-xMa3TUTb.js";import{$ as c,G as l,H as u,K as d,M as f,Q as p,U as m,W as h,et as g,it as _}from"./index-BIslkXQt.js";var v=e(t(),1),y=s();function b(){return{name:``,label:``,description:``,systemPrompt:``,allowedTools:[`read_file`,`grep_files`],maxRuntimeMs:`1800000`,maxToolCalls:`300`,enabledAsSubagent:!0}}function x(e){return{name:e.name,label:e.label,description:e.description??``,systemPrompt:e.systemPrompt??``,allowedTools:e.allowedTools??[],maxRuntimeMs:String(e.maxRuntimeMs??18e5),maxToolCalls:String(e.maxToolCalls??300),enabledAsSubagent:e.enabledAsSubagent}}function S(e){return{name:e.name.trim().toLowerCase(),label:e.label.trim(),description:e.description.trim(),systemPrompt:e.systemPrompt.trim(),allowedTools:e.allowedTools,maxRuntimeMs:Number(e.maxRuntimeMs||18e5),maxToolCalls:Number(e.maxToolCalls||300),enabledAsSubagent:e.enabledAsSubagent}}function C(e){return!!(e.name.trim()&&e.label.trim()&&e.allowedTools.length>0)}async function w(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 T(){let[e,t]=(0,v.useState)([]),[s,T]=(0,v.useState)([]),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(()=>b()),[M,N]=(0,v.useState)(!1),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)(!1),[R,z]=(0,v.useState)(),[B,V]=(0,v.useState)(`off`),[H,U]=(0,v.useState)(``),[W,G]=(0,v.useState)(null);async function K(){let[e,n]=await Promise.all([w(`/api/agent-profiles`),w(`/api/agent-profiles/available-tools`)]);t(e.agents),T(n.tools)}(0,v.useEffect)(()=>{let e=!1;async function n(){try{let[n,r]=await Promise.all([w(`/api/agent-profiles`),w(`/api/agent-profiles/available-tools`)]);if(e)return;t(n.agents),T(r.tools)}catch(t){e||U(t instanceof Error?t.message:_(`requestFailed`))}}return n(),()=>{e=!0}},[]),(0,v.useEffect)(()=>{let e=!1;async function t(){try{let t=await h(),n=await m(t),r=await l(t),i=r.model??await d(t)??n[0];if(e)return;z(i),V(r.thinkingLevel??u(i))}catch{}}return t(),()=>{e=!0}},[]),(0,v.useEffect)(()=>{if(!W)return;let e=()=>G(null);return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e)}},[W]);let q=(0,v.useMemo)(()=>e.find(e=>e.id===O)??null,[e,O]);function J(e,t){j(n=>({...n,[e]:t}))}function Y(e){j(t=>({...t,allowedTools:t.allowedTools.includes(e)?t.allowedTools.filter(t=>t!==e):[...t.allowedTools,e]}))}function X(){k(null),j(b()),F(``),U(``),D(!0)}function Z(e){k(e.id),j(x(e)),F(``),U(``),D(!0)}function Q(){M||I||(D(!1),k(null),j(b()),F(``))}async function $(){let e=P.trim();if(!e){U(_(`aiFillAgentInputRequired`));return}if(!R){U(_(`aiFillAgentNoModel`));return}L(!0),U(``);try{let t=await w(`/api/agent-profiles/ai-fill`,{method:`POST`,body:JSON.stringify({instruction:e,model:R,thinkingLevel:B})});j(e=>({...e,name:t.agent.name,label:t.agent.label,description:t.agent.description,systemPrompt:t.agent.systemPrompt}))}catch(e){U(e instanceof Error?e.message:_(`aiFillAgentFailed`))}finally{L(!1)}}async function ee(){if(C(A)){N(!0),U(``);try{let e=S(A);O?await w(`/api/agent-profiles/${encodeURIComponent(O)}`,{method:`PATCH`,body:JSON.stringify(e)}):await w(`/api/agent-profiles`,{method:`POST`,body:JSON.stringify(e)}),Q(),await K()}catch(e){U(e instanceof Error?e.message:_(`requestFailed`))}finally{N(!1)}}}async function te(e){if(e.builtin||e.readonly)return;let n=!e.enabledAsSubagent,r=e.enabledAsSubagent;t(t=>t.map(t=>t.id===e.id?{...t,enabledAsSubagent:n}:t)),G(null);try{await w(`/api/agent-profiles/${encodeURIComponent(e.id)}`,{method:`PATCH`,body:JSON.stringify({enabledAsSubagent:n})})}catch(n){t(t=>t.map(t=>t.id===e.id?{...t,enabledAsSubagent:r}:t)),U(n instanceof Error?n.message:_(`requestFailed`))}}async function ne(e){if(!(e.builtin||e.readonly)&&await f({description:_(`confirmDeleteAgent`),confirmLabel:_(`confirmDelete`),cancelLabel:_(`cancel`),variant:`destructive`})){U(``);try{await w(`/api/agent-profiles/${encodeURIComponent(e.id)}`,{method:`DELETE`}),await K()}catch(e){U(e instanceof Error?e.message:_(`requestFailed`))}}}return(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,y.jsx)(`div`,{className:`border-b border-border px-6 py-5`,children:(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-2xl bg-primary/10 text-primary`,children:(0,y.jsx)(r,{className:`size-5`})}),(0,y.jsx)(`div`,{children:(0,y.jsxs)(`h1`,{className:`inline-flex items-center gap-1.5 text-lg font-semibold text-foreground`,children:[_(`agentsTab`),(0,y.jsx)(p,{label:_(`agentsDescription`)})]})})]}),(0,y.jsx)(c,{onClick:X,children:_(`createAgent`)})]})}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,y.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:[H&&!E?(0,y.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:H}):null,(0,y.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:e.map(e=>(0,y.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`h3`,{className:g(`truncate text-sm font-medium`,e.enabledAsSubagent?`text-foreground/90`:`text-muted-foreground`),children:e.label}),e.builtin?(0,y.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs text-primary`,children:_(`builtinAgent`)}):null]}),(0,y.jsx)(`p`,{className:`mt-1 font-mono text-xs text-muted-foreground`,children:e.name}),e.source&&!e.builtin?(0,y.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.source,e.relativePath?` · ${e.relativePath}`:``]}):null,(0,y.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.description||_(`noDescription`)})]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabledAsSubagent,disabled:e.builtin||e.readonly,className:g(`relative h-6 w-11 rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60`,e.enabledAsSubagent?`bg-emerald-500`:`bg-muted-foreground/30`),onClick:()=>void te(e),title:e.enabledAsSubagent?_(`disableAsSubagent`):_(`enableAsSubagent`),children:(0,y.jsx)(`span`,{className:g(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,e.enabledAsSubagent?`translate-x-5`:`translate-x-0`)})}),(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(c,{variant:`ghost`,size:`icon`,onClick:()=>G(W===e.id?null:e.id),title:_(`moreActions`),children:(0,y.jsx)(o,{className:`size-4`})}),W===e.id?(0,y.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,y.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:e.builtin||e.readonly,onClick:()=>{G(null),Z(e)},children:[(0,y.jsx)(n,{className:`size-3.5`}),_(`editTask`)]}),(0,y.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left text-destructive hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:e.builtin||e.readonly,onClick:()=>{G(null),ne(e)},children:[(0,y.jsx)(i,{className:`size-3.5`}),_(`delete`)]})]}):null]})]})]}),(0,y.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1`,children:e.allowedTools.map(e=>(0,y.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground`,children:e},e))}),(0,y.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,y.jsxs)(`span`,{children:[_(`maxRuntimeMs`),e.maxRuntimeMs??`-`]}),(0,y.jsxs)(`span`,{children:[_(`maxToolCalls`),e.maxToolCalls??`-`]})]})]},e.id))})]})}),E?(0,y.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,y.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,y.jsxs)(`div`,{className:`shrink-0 border-b border-border px-5 py-4`,children:[(0,y.jsx)(`h2`,{className:`text-base font-medium text-foreground`,children:_(q?`editAgent`:`createAgent`)}),q?.readonly?(0,y.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:_(`builtinAgentReadonly`)}):null]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(`div`,{className:`rounded-2xl border border-border bg-muted/20 p-3`,children:[(0,y.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,y.jsx)(a,{className:`size-4 text-primary`}),_(`aiFillAgent`),(0,y.jsx)(p,{label:_(`aiFillAgentDescription`)})]}),(0,y.jsx)(`textarea`,{className:`min-h-20 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground/65 focus:border-ring disabled:opacity-60`,value:P,disabled:!!q?.readonly||I,onChange:e=>F(e.target.value),placeholder:_(`aiFillAgentPlaceholder`)}),(0,y.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,y.jsxs)(c,{variant:`outline`,size:`sm`,onClick:()=>void $(),disabled:!!q?.readonly||I||!P.trim(),children:[(0,y.jsx)(a,{className:`mr-1 size-3.5`}),_(I?`aiFillAgentLoading`:`aiFillAgent`)]})})]}),(0,y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[_(`agentName`),(0,y.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.name,disabled:!!q?.readonly,onChange:e=>J(`name`,e.target.value),placeholder:`reviewer`})]}),(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[_(`agentLabel`),(0,y.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.label,disabled:!!q?.readonly,onChange:e=>J(`label`,e.target.value),placeholder:_(`agentLabelPlaceholder`)})]})]}),(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[_(`agentDescription`),(0,y.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.description,disabled:!!q?.readonly,onChange:e=>J(`description`,e.target.value)})]}),(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[_(`agentSystemPrompt`),(0,y.jsx)(`textarea`,{className:`mt-1 min-h-36 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.systemPrompt,disabled:!!q?.readonly,onChange:e=>J(`systemPrompt`,e.target.value)})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-2 text-sm font-medium text-foreground`,children:_(`allowedTools`)}),(0,y.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:s.map(e=>(0,y.jsxs)(`label`,{className:`flex items-start gap-2 rounded-xl border border-border bg-muted/20 p-3 text-sm disabled:opacity-60`,children:[(0,y.jsx)(`input`,{type:`checkbox`,className:`mt-1`,disabled:!!q?.readonly,checked:A.allowedTools.includes(e.name),onChange:()=>Y(e.name)}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label}),(0,y.jsx)(`span`,{className:`ml-2 font-mono text-xs text-muted-foreground`,children:e.name}),e.riskLevel===`dangerous`?(0,y.jsx)(`span`,{className:`ml-2 rounded-full bg-amber-500/10 px-2 py-0.5 text-xs text-amber-700`,children:_(`highRiskTool`)}):null,(0,y.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:e.description})]})]},e.name))})]}),(0,y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[_(`maxRuntimeMs`),(0,y.jsx)(`input`,{type:`number`,className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.maxRuntimeMs,disabled:!!q?.readonly,onChange:e=>J(`maxRuntimeMs`,e.target.value)})]}),(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[_(`maxToolCalls`),(0,y.jsx)(`input`,{type:`number`,className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.maxToolCalls,disabled:!!q?.readonly,onChange:e=>J(`maxToolCalls`,e.target.value)})]})]}),(0,y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:A.enabledAsSubagent,disabled:!!q?.readonly,onChange:e=>J(`enabledAsSubagent`,e.target.checked)}),_(`enabledAsSubagent`)]}),H?(0,y.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:H}):null]})}),(0,y.jsx)(`div`,{className:`shrink-0 border-t border-border px-5 py-4`,children:(0,y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,y.jsx)(c,{variant:`outline`,onClick:Q,disabled:M||I,children:_(`cancel`)}),(0,y.jsx)(c,{onClick:ee,disabled:M||I||!!q?.readonly||!C(A),children:_(`save`)})]})})]})}):null]})}export{T as AgentProfilesPage};
@@ -1 +0,0 @@
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};
@@ -1,2 +0,0 @@
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};