@kafca/agentdock 0.1.62 → 0.1.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/renderer/assets/{AutomationList-BgJgAdVO.js → AutomationList-uiR0seMA.js} +1 -1
- package/dist/renderer/assets/{Badge-Bq2hPVcR.js → Badge-BZwdECxe.js} +1 -1
- package/dist/renderer/assets/{Card-BPJNSZce.js → Card-JMY-xmLX.js} +1 -1
- package/dist/renderer/assets/{Config-aSFqlI88.js → Config-BMcWRfWu.js} +1 -1
- package/dist/renderer/assets/{Dashboard-D3ezFmb7.js → Dashboard-CSk6wUMx.js} +2 -2
- package/dist/renderer/assets/{EmptyState-DK496gBq.js → EmptyState-3J94zJRa.js} +1 -1
- package/dist/renderer/assets/{HighlightedMarkdown-Ckre5jNv.js → HighlightedMarkdown-DKL7rO-G.js} +1 -1
- package/dist/renderer/assets/{Input-C5C1d0ba.js → Input-BGK524F9.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-N8Ey1ikc.js → KnowledgeDetail-XZ9sxTBY.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-9aF8nJEf.js → KnowledgeHome-CJlGiu7a.js} +1 -1
- package/dist/renderer/assets/{Logs-sgAdwEeS.js → Logs-B5Y0yspB.js} +1 -1
- package/dist/renderer/assets/{Modal-BB10hTRc.js → Modal-DlIfXQ8_.js} +1 -1
- package/dist/renderer/assets/{Page-DfC319Ck.js → Page-B1i9DSW-.js} +1 -1
- package/dist/renderer/assets/{Select-RHJBmNER.js → Select-DDpZ4sBt.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-BU1zCdr4.js → ThreadChat-D63t_k2d.js} +3 -3
- package/dist/renderer/assets/{Workspace-BoZCz7S8.js → Workspace-BPkGxjuF.js} +1 -1
- package/dist/renderer/assets/{arrow-left-D2V1eZSD.js → arrow-left-C6VSgxEk.js} +1 -1
- package/dist/renderer/assets/{book-open-DUcBn7Bb.js → book-open-DWJZSr5x.js} +1 -1
- package/dist/renderer/assets/{channels-DMhDSlf2.js → channels-Dkik3Wxt.js} +1 -1
- package/dist/renderer/assets/{chevron-down-Ca2FQDB7.js → chevron-down-BHtOK5fW.js} +1 -1
- package/dist/renderer/assets/{index-DRJ5wgw_.js → index-DV9qeL9P.js} +2 -2
- package/dist/renderer/assets/{index-BlnvlekJ.js → index-TTj4JT0d.js} +1 -1
- package/dist/renderer/assets/{knowledge-D1-k56eY.js → knowledge-C9mJpMmJ.js} +1 -1
- package/dist/renderer/assets/{pencil-BhWdv_86.js → pencil-B7bBxE-w.js} +1 -1
- package/dist/renderer/assets/{plus-BacLMlK3.js → plus-DPOTxoL2.js} +1 -1
- package/dist/renderer/assets/{save-Bpoxbzau.js → save-Drzhy5En.js} +1 -1
- package/dist/renderer/assets/{search-BVJcpdFX.js → search-m-2mVuF6.js} +1 -1
- package/dist/renderer/assets/{shield-check-C2cw_Ip6.js → shield-check-C8NOMoui.js} +1 -1
- package/dist/renderer/assets/{threads-DOsBQBg_.js → threads-BG4F9grx.js} +1 -1
- package/dist/renderer/assets/{trash-2-Bs3rEm3g.js → trash-2-Bh0nSQUA.js} +1 -1
- package/dist/renderer/index.html +1 -1
- package/dist-electron/services/local-ai-core/src/acp/store/automation-store.js +69 -3
- package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +14 -2
- package/dist-electron/services/local-ai-core/src/automation/automation-monitor-service.js +5 -3
- package/dist-electron/services/local-ai-core/src/automation/automation-service.js +13 -4
- package/dist-electron/services/local-ai-core/src/automation/automation-trigger-engine.js +19 -18
- package/dist-electron/services/local-ai-core/src/automation/legacy-automation-mappers.js +25 -1
- package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +15 -0
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +13 -3
- package/dist-electron/services/local-ai-core/src/scheduler/cron.js +197 -0
- package/dist-electron/services/local-ai-core/src/scheduler/scheduled-job-application-service.js +4 -3
- package/dist-electron/services/local-ai-core/src/scheduler/scheduler-service.js +3 -3
- package/dist-electron/tests/electron/automation-compatibility.test.js +6 -1
- package/dist-electron/tests/electron/automation-engine.test.js +67 -3
- package/dist-electron/tests/electron/automation-sandbox-runner.test.js +20 -9
- package/dist-electron/tests/electron/automation-store.test.js +189 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as Le,U as Ne,r as c,j as x,V as pe,X as Ae,O as te}from"./index-DRJ5wgw_.js";var ye=Ne();const De=Le(ye);function X(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Jt(e,t){const n=c.createContext(t),r=i=>{const{children:s,...a}=i,h=c.useMemo(()=>a,Object.values(a));return x.jsx(n.Provider,{value:h,children:s})};r.displayName=e+"Provider";function o(i){const s=c.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function en(e,t=[]){let n=[];function r(i,s){const a=c.createContext(s),h=n.length;n=[...n,s];const l=d=>{var p;const{scope:v,children:y,...w}=d,u=((p=v==null?void 0:v[e])==null?void 0:p[h])||a,m=c.useMemo(()=>w,Object.values(w));return x.jsx(u.Provider,{value:m,children:y})};l.displayName=i+"Provider";function f(d,v){var u;const y=((u=v==null?void 0:v[e])==null?void 0:u[h])||a,w=c.useContext(y);if(w)return w;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,f]}const o=()=>{const i=n.map(s=>c.createContext(s));return function(a){const h=(a==null?void 0:a[e])||i;return c.useMemo(()=>({[`__scope${e}`]:{...a,[e]:h}}),[a,h])}};return o.scopeName=e,[r,ke(o,...t)]}function ke(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:h,scopeName:l})=>{const d=h(i)[`__scope${l}`];return{...a,...d}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ne=globalThis!=null&&globalThis.document?c.useLayoutEffect:()=>{},Fe=pe[" useId ".trim().toString()]||(()=>{}),Me=0;function tn(e){const[t,n]=c.useState(Fe());return ne(()=>{n(r=>r??String(Me++))},[e]),e||(t?`radix-${t}`:"")}var Ie=pe[" useInsertionEffect ".trim().toString()]||ne;function nn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=We({defaultProp:t,onChange:n}),a=e!==void 0,h=a?e:o;{const f=c.useRef(e!==void 0);c.useEffect(()=>{const d=f.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const l=c.useCallback(f=>{var d;if(a){const v=Be(f)?f(e):f;v!==e&&((d=s.current)==null||d.call(s,v))}else i(f)},[a,e,i,s]);return[h,l]}function We({defaultProp:e,onChange:t}){const[n,r]=c.useState(e),o=c.useRef(n),i=c.useRef(t);return Ie(()=>{i.current=t},[t]),c.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function Be(e){return typeof e=="function"}function _e(e){const t=je(e),n=c.forwardRef((r,o)=>{const{children:i,...s}=r,a=c.Children.toArray(i),h=a.find(Ve);if(h){const l=h.props.children,f=a.map(d=>d===h?c.Children.count(l)>1?c.Children.only(null):c.isValidElement(l)?l.props.children:null:d);return x.jsx(t,{...s,ref:o,children:c.isValidElement(l)?c.cloneElement(l,void 0,f):null})}return x.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function je(e){const t=c.forwardRef((n,r)=>{const{children:o,...i}=n;if(c.isValidElement(o)){const s=Ke(o),a=$e(i,o.props);return o.type!==c.Fragment&&(a.ref=r?Ae(r,s):s),c.cloneElement(o,a)}return c.Children.count(o)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ue=Symbol("radix.slottable");function Ve(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ue}function $e(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const h=i(...a);return o(...a),h}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Ke(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$=Xe.reduce((e,t)=>{const n=_e(`Primitive.${t}`),r=c.forwardRef((o,i)=>{const{asChild:s,...a}=o,h=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(h,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ye(e,t){e&&ye.flushSync(()=>e.dispatchEvent(t))}function M(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function He(e,t=globalThis==null?void 0:globalThis.document){const n=M(e);c.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ze="DismissableLayer",J="dismissableLayer.update",Ge="dismissableLayer.pointerDownOutside",Ze="dismissableLayer.focusOutside",oe,Ee=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qe=c.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...h}=e,l=c.useContext(Ee),[f,d]=c.useState(null),v=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=c.useState({}),w=te(t,E=>d(E)),u=Array.from(l.layers),[m]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),p=u.indexOf(m),g=f?u.indexOf(f):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,S=g>=p,C=et(E=>{const T=E.target,L=[...l.branches].some(F=>F.contains(T));!S||L||(o==null||o(E),s==null||s(E),E.defaultPrevented||a==null||a())},v),P=tt(E=>{const T=E.target;[...l.branches].some(F=>F.contains(T))||(i==null||i(E),s==null||s(E),E.defaultPrevented||a==null||a())},v);return He(E=>{g===l.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},v),c.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(oe=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),ae(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=oe)}},[f,v,n,l]),c.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),ae())},[f,l]),c.useEffect(()=>{const E=()=>y({});return document.addEventListener(J,E),()=>document.removeEventListener(J,E)},[]),x.jsx($.div,{...h,ref:w,style:{pointerEvents:b?S?"auto":"none":void 0,...e.style},onFocusCapture:X(e.onFocusCapture,P.onFocusCapture),onBlurCapture:X(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:X(e.onPointerDownCapture,C.onPointerDownCapture)})});qe.displayName=ze;var Qe="DismissableLayerBranch",Je=c.forwardRef((e,t)=>{const n=c.useContext(Ee),r=c.useRef(null),o=te(t,r);return c.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),x.jsx($.div,{...e,ref:o})});Je.displayName=Qe;function et(e,t=globalThis==null?void 0:globalThis.document){const n=M(e),r=c.useRef(!1),o=c.useRef(()=>{});return c.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let h=function(){ge(Ge,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=h,t.addEventListener("click",o.current,{once:!0})):h()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tt(e,t=globalThis==null?void 0:globalThis.document){const n=M(e),r=c.useRef(!1);return c.useEffect(()=>{const o=i=>{i.target&&!r.current&&ge(Ze,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ae(){const e=new CustomEvent(J);document.dispatchEvent(e)}function ge(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Ye(o,i):o.dispatchEvent(i)}var Y="focusScope.autoFocusOnMount",H="focusScope.autoFocusOnUnmount",ce={bubbles:!1,cancelable:!0},nt="FocusScope",rt=c.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,h]=c.useState(null),l=M(o),f=M(i),d=c.useRef(null),v=te(t,u=>h(u)),y=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let u=function(b){if(y.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:O(d.current,{select:!0})},m=function(b){if(y.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||O(d.current,{select:!0}))},p=function(b){if(document.activeElement===document.body)for(const C of b)C.removedNodes.length>0&&O(a)};document.addEventListener("focusin",u),document.addEventListener("focusout",m);const g=new MutationObserver(p);return a&&g.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",m),g.disconnect()}}},[r,a,y.paused]),c.useEffect(()=>{if(a){se.add(y);const u=document.activeElement;if(!a.contains(u)){const p=new CustomEvent(Y,ce);a.addEventListener(Y,l),a.dispatchEvent(p),p.defaultPrevented||(ot(ut(be(a)),{select:!0}),document.activeElement===u&&O(a))}return()=>{a.removeEventListener(Y,l),setTimeout(()=>{const p=new CustomEvent(H,ce);a.addEventListener(H,f),a.dispatchEvent(p),p.defaultPrevented||O(u??document.body,{select:!0}),a.removeEventListener(H,f),se.remove(y)},0)}}},[a,l,f,y]);const w=c.useCallback(u=>{if(!n&&!r||y.paused)return;const m=u.key==="Tab"&&!u.altKey&&!u.ctrlKey&&!u.metaKey,p=document.activeElement;if(m&&p){const g=u.currentTarget,[b,S]=at(g);b&&S?!u.shiftKey&&p===S?(u.preventDefault(),n&&O(b,{select:!0})):u.shiftKey&&p===b&&(u.preventDefault(),n&&O(S,{select:!0})):p===g&&u.preventDefault()}},[n,r,y.paused]);return x.jsx($.div,{tabIndex:-1,...s,ref:v,onKeyDown:w})});rt.displayName=nt;function ot(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(O(r,{select:t}),document.activeElement!==n)return}function at(e){const t=be(e),n=ie(t,e),r=ie(t.reverse(),e);return[n,r]}function be(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ie(e,t){for(const n of e)if(!ct(n,{upTo:t}))return n}function ct(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function it(e){return e instanceof HTMLInputElement&&"select"in e}function O(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&it(e)&&t&&e.select()}}var se=st();function st(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ue(e,t),e.unshift(t)},remove(t){var n;e=ue(e,t),(n=e[0])==null||n.resume()}}}function ue(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ut(e){return e.filter(t=>t.tagName!=="A")}var lt="Portal",ft=c.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=c.useState(!1);ne(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?De.createPortal(x.jsx($.div,{...r,ref:t}),s):null});ft.displayName=lt;var z=0;function rn(){c.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??le()),document.body.insertAdjacentElement("beforeend",e[1]??le()),z++,()=>{z===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),z--}},[])}function le(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var R=function(){return R=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},R.apply(this,arguments)};function Se(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function dt(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var U="right-scroll-bar-position",V="width-before-scroll-bar",vt="with-scroll-bars-hidden",ht="--removed-body-scroll-bar-size";function G(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function mt(e,t){var n=c.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var pt=typeof window<"u"?c.useLayoutEffect:c.useEffect,fe=new WeakMap;function yt(e,t){var n=mt(null,function(r){return e.forEach(function(o){return G(o,r)})});return pt(function(){var r=fe.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||G(a,null)}),i.forEach(function(a){o.has(a)||G(a,s)})}fe.set(n,e)},[e]),n}function Et(e){return e}function gt(e,t){t===void 0&&(t=Et);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n}var h=function(){var f=s;s=[],f.forEach(i)},l=function(){return Promise.resolve().then(h)};l(),n={push:function(f){s.push(f),l()},filter:function(f){return s=s.filter(f),n}}}};return o}function bt(e){e===void 0&&(e={});var t=gt(null);return t.options=R({async:!0,ssr:!1},e),t}var we=function(e){var t=e.sideCar,n=Se(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return c.createElement(r,R({},n))};we.isSideCarExport=!0;function St(e,t){return e.useMedium(t),we}var Ce=bt(),Z=function(){},K=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:Z,onWheelCapture:Z,onTouchMoveCapture:Z}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,h=e.className,l=e.removeScrollBar,f=e.enabled,d=e.shards,v=e.sideCar,y=e.noRelative,w=e.noIsolation,u=e.inert,m=e.allowPinchZoom,p=e.as,g=p===void 0?"div":p,b=e.gapMode,S=Se(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=v,P=yt([n,t]),E=R(R({},S),o);return c.createElement(c.Fragment,null,f&&c.createElement(C,{sideCar:Ce,removeScrollBar:l,shards:d,noRelative:y,noIsolation:w,inert:u,setCallbacks:i,allowPinchZoom:!!m,lockRef:n,gapMode:b}),s?c.cloneElement(c.Children.only(a),R(R({},E),{ref:P})):c.createElement(g,R({},E,{className:h,ref:P}),a))});K.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};K.classNames={fullWidth:V,zeroRight:U};var wt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ct(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wt();return t&&e.setAttribute("nonce",t),e}function Pt(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Rt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var xt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ct())&&(Pt(t,n),Rt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ot=function(){var e=xt();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Pe=function(){var e=Ot(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Tt={left:0,top:0,right:0,gap:0},q=function(e){return parseInt(e||"",10)||0},Lt=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[q(n),q(r),q(o)]},Nt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Tt;var t=Lt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},At=Pe(),k="data-scroll-locked",Dt=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
1
|
+
import{h as Le,U as Ne,r as c,j as x,V as pe,X as Ae,O as te}from"./index-DV9qeL9P.js";var ye=Ne();const De=Le(ye);function X(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Jt(e,t){const n=c.createContext(t),r=i=>{const{children:s,...a}=i,h=c.useMemo(()=>a,Object.values(a));return x.jsx(n.Provider,{value:h,children:s})};r.displayName=e+"Provider";function o(i){const s=c.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function en(e,t=[]){let n=[];function r(i,s){const a=c.createContext(s),h=n.length;n=[...n,s];const l=d=>{var p;const{scope:v,children:y,...w}=d,u=((p=v==null?void 0:v[e])==null?void 0:p[h])||a,m=c.useMemo(()=>w,Object.values(w));return x.jsx(u.Provider,{value:m,children:y})};l.displayName=i+"Provider";function f(d,v){var u;const y=((u=v==null?void 0:v[e])==null?void 0:u[h])||a,w=c.useContext(y);if(w)return w;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,f]}const o=()=>{const i=n.map(s=>c.createContext(s));return function(a){const h=(a==null?void 0:a[e])||i;return c.useMemo(()=>({[`__scope${e}`]:{...a,[e]:h}}),[a,h])}};return o.scopeName=e,[r,ke(o,...t)]}function ke(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:h,scopeName:l})=>{const d=h(i)[`__scope${l}`];return{...a,...d}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ne=globalThis!=null&&globalThis.document?c.useLayoutEffect:()=>{},Fe=pe[" useId ".trim().toString()]||(()=>{}),Me=0;function tn(e){const[t,n]=c.useState(Fe());return ne(()=>{n(r=>r??String(Me++))},[e]),e||(t?`radix-${t}`:"")}var Ie=pe[" useInsertionEffect ".trim().toString()]||ne;function nn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=We({defaultProp:t,onChange:n}),a=e!==void 0,h=a?e:o;{const f=c.useRef(e!==void 0);c.useEffect(()=>{const d=f.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const l=c.useCallback(f=>{var d;if(a){const v=Be(f)?f(e):f;v!==e&&((d=s.current)==null||d.call(s,v))}else i(f)},[a,e,i,s]);return[h,l]}function We({defaultProp:e,onChange:t}){const[n,r]=c.useState(e),o=c.useRef(n),i=c.useRef(t);return Ie(()=>{i.current=t},[t]),c.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function Be(e){return typeof e=="function"}function _e(e){const t=je(e),n=c.forwardRef((r,o)=>{const{children:i,...s}=r,a=c.Children.toArray(i),h=a.find(Ve);if(h){const l=h.props.children,f=a.map(d=>d===h?c.Children.count(l)>1?c.Children.only(null):c.isValidElement(l)?l.props.children:null:d);return x.jsx(t,{...s,ref:o,children:c.isValidElement(l)?c.cloneElement(l,void 0,f):null})}return x.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function je(e){const t=c.forwardRef((n,r)=>{const{children:o,...i}=n;if(c.isValidElement(o)){const s=Ke(o),a=$e(i,o.props);return o.type!==c.Fragment&&(a.ref=r?Ae(r,s):s),c.cloneElement(o,a)}return c.Children.count(o)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ue=Symbol("radix.slottable");function Ve(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ue}function $e(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const h=i(...a);return o(...a),h}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Ke(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$=Xe.reduce((e,t)=>{const n=_e(`Primitive.${t}`),r=c.forwardRef((o,i)=>{const{asChild:s,...a}=o,h=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(h,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ye(e,t){e&&ye.flushSync(()=>e.dispatchEvent(t))}function M(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function He(e,t=globalThis==null?void 0:globalThis.document){const n=M(e);c.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ze="DismissableLayer",J="dismissableLayer.update",Ge="dismissableLayer.pointerDownOutside",Ze="dismissableLayer.focusOutside",oe,Ee=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qe=c.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...h}=e,l=c.useContext(Ee),[f,d]=c.useState(null),v=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=c.useState({}),w=te(t,E=>d(E)),u=Array.from(l.layers),[m]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),p=u.indexOf(m),g=f?u.indexOf(f):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,S=g>=p,C=et(E=>{const T=E.target,L=[...l.branches].some(F=>F.contains(T));!S||L||(o==null||o(E),s==null||s(E),E.defaultPrevented||a==null||a())},v),P=tt(E=>{const T=E.target;[...l.branches].some(F=>F.contains(T))||(i==null||i(E),s==null||s(E),E.defaultPrevented||a==null||a())},v);return He(E=>{g===l.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},v),c.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(oe=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),ae(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=oe)}},[f,v,n,l]),c.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),ae())},[f,l]),c.useEffect(()=>{const E=()=>y({});return document.addEventListener(J,E),()=>document.removeEventListener(J,E)},[]),x.jsx($.div,{...h,ref:w,style:{pointerEvents:b?S?"auto":"none":void 0,...e.style},onFocusCapture:X(e.onFocusCapture,P.onFocusCapture),onBlurCapture:X(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:X(e.onPointerDownCapture,C.onPointerDownCapture)})});qe.displayName=ze;var Qe="DismissableLayerBranch",Je=c.forwardRef((e,t)=>{const n=c.useContext(Ee),r=c.useRef(null),o=te(t,r);return c.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),x.jsx($.div,{...e,ref:o})});Je.displayName=Qe;function et(e,t=globalThis==null?void 0:globalThis.document){const n=M(e),r=c.useRef(!1),o=c.useRef(()=>{});return c.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let h=function(){ge(Ge,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=h,t.addEventListener("click",o.current,{once:!0})):h()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tt(e,t=globalThis==null?void 0:globalThis.document){const n=M(e),r=c.useRef(!1);return c.useEffect(()=>{const o=i=>{i.target&&!r.current&&ge(Ze,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ae(){const e=new CustomEvent(J);document.dispatchEvent(e)}function ge(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Ye(o,i):o.dispatchEvent(i)}var Y="focusScope.autoFocusOnMount",H="focusScope.autoFocusOnUnmount",ce={bubbles:!1,cancelable:!0},nt="FocusScope",rt=c.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,h]=c.useState(null),l=M(o),f=M(i),d=c.useRef(null),v=te(t,u=>h(u)),y=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let u=function(b){if(y.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:O(d.current,{select:!0})},m=function(b){if(y.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||O(d.current,{select:!0}))},p=function(b){if(document.activeElement===document.body)for(const C of b)C.removedNodes.length>0&&O(a)};document.addEventListener("focusin",u),document.addEventListener("focusout",m);const g=new MutationObserver(p);return a&&g.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",m),g.disconnect()}}},[r,a,y.paused]),c.useEffect(()=>{if(a){se.add(y);const u=document.activeElement;if(!a.contains(u)){const p=new CustomEvent(Y,ce);a.addEventListener(Y,l),a.dispatchEvent(p),p.defaultPrevented||(ot(ut(be(a)),{select:!0}),document.activeElement===u&&O(a))}return()=>{a.removeEventListener(Y,l),setTimeout(()=>{const p=new CustomEvent(H,ce);a.addEventListener(H,f),a.dispatchEvent(p),p.defaultPrevented||O(u??document.body,{select:!0}),a.removeEventListener(H,f),se.remove(y)},0)}}},[a,l,f,y]);const w=c.useCallback(u=>{if(!n&&!r||y.paused)return;const m=u.key==="Tab"&&!u.altKey&&!u.ctrlKey&&!u.metaKey,p=document.activeElement;if(m&&p){const g=u.currentTarget,[b,S]=at(g);b&&S?!u.shiftKey&&p===S?(u.preventDefault(),n&&O(b,{select:!0})):u.shiftKey&&p===b&&(u.preventDefault(),n&&O(S,{select:!0})):p===g&&u.preventDefault()}},[n,r,y.paused]);return x.jsx($.div,{tabIndex:-1,...s,ref:v,onKeyDown:w})});rt.displayName=nt;function ot(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(O(r,{select:t}),document.activeElement!==n)return}function at(e){const t=be(e),n=ie(t,e),r=ie(t.reverse(),e);return[n,r]}function be(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ie(e,t){for(const n of e)if(!ct(n,{upTo:t}))return n}function ct(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function it(e){return e instanceof HTMLInputElement&&"select"in e}function O(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&it(e)&&t&&e.select()}}var se=st();function st(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ue(e,t),e.unshift(t)},remove(t){var n;e=ue(e,t),(n=e[0])==null||n.resume()}}}function ue(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ut(e){return e.filter(t=>t.tagName!=="A")}var lt="Portal",ft=c.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=c.useState(!1);ne(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?De.createPortal(x.jsx($.div,{...r,ref:t}),s):null});ft.displayName=lt;var z=0;function rn(){c.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??le()),document.body.insertAdjacentElement("beforeend",e[1]??le()),z++,()=>{z===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),z--}},[])}function le(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var R=function(){return R=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},R.apply(this,arguments)};function Se(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function dt(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var U="right-scroll-bar-position",V="width-before-scroll-bar",vt="with-scroll-bars-hidden",ht="--removed-body-scroll-bar-size";function G(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function mt(e,t){var n=c.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var pt=typeof window<"u"?c.useLayoutEffect:c.useEffect,fe=new WeakMap;function yt(e,t){var n=mt(null,function(r){return e.forEach(function(o){return G(o,r)})});return pt(function(){var r=fe.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||G(a,null)}),i.forEach(function(a){o.has(a)||G(a,s)})}fe.set(n,e)},[e]),n}function Et(e){return e}function gt(e,t){t===void 0&&(t=Et);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n}var h=function(){var f=s;s=[],f.forEach(i)},l=function(){return Promise.resolve().then(h)};l(),n={push:function(f){s.push(f),l()},filter:function(f){return s=s.filter(f),n}}}};return o}function bt(e){e===void 0&&(e={});var t=gt(null);return t.options=R({async:!0,ssr:!1},e),t}var we=function(e){var t=e.sideCar,n=Se(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return c.createElement(r,R({},n))};we.isSideCarExport=!0;function St(e,t){return e.useMedium(t),we}var Ce=bt(),Z=function(){},K=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:Z,onWheelCapture:Z,onTouchMoveCapture:Z}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,h=e.className,l=e.removeScrollBar,f=e.enabled,d=e.shards,v=e.sideCar,y=e.noRelative,w=e.noIsolation,u=e.inert,m=e.allowPinchZoom,p=e.as,g=p===void 0?"div":p,b=e.gapMode,S=Se(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=v,P=yt([n,t]),E=R(R({},S),o);return c.createElement(c.Fragment,null,f&&c.createElement(C,{sideCar:Ce,removeScrollBar:l,shards:d,noRelative:y,noIsolation:w,inert:u,setCallbacks:i,allowPinchZoom:!!m,lockRef:n,gapMode:b}),s?c.cloneElement(c.Children.only(a),R(R({},E),{ref:P})):c.createElement(g,R({},E,{className:h,ref:P}),a))});K.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};K.classNames={fullWidth:V,zeroRight:U};var wt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ct(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wt();return t&&e.setAttribute("nonce",t),e}function Pt(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Rt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var xt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ct())&&(Pt(t,n),Rt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ot=function(){var e=xt();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Pe=function(){var e=Ot(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Tt={left:0,top:0,right:0,gap:0},q=function(e){return parseInt(e||"",10)||0},Lt=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[q(n),q(r),q(o)]},Nt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Tt;var t=Lt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},At=Pe(),k="data-scroll-locked",Dt=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
2
|
.`.concat(vt,` {
|
|
3
3
|
overflow: hidden `).concat(r,`;
|
|
4
4
|
padding-right: `).concat(a,"px ").concat(r,`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as n,Z as l}from"./index-
|
|
1
|
+
import{z as n,Z as l}from"./index-DV9qeL9P.js";function c(){return n("GET","/knowledge/config")}function f(){return n("GET","/knowledge/folders")}function g(e){return n("POST","/knowledge/folders",e)}function i(e,o){return n("PATCH",`/knowledge/folders/${encodeURIComponent(e)}`,o)}function w(e){return n("DELETE",`/knowledge/folders/${encodeURIComponent(e)}`)}function u(){return n("GET","/knowledge/bases")}function p(e){return n("POST","/knowledge/bases",e)}function E(e){return n("GET",`/knowledge/bases/${encodeURIComponent(e)}`)}function k(e,o){return n("PATCH",`/knowledge/bases/${encodeURIComponent(e)}`,o)}function m(e){return n("DELETE",`/knowledge/bases/${encodeURIComponent(e)}`)}function C(e){return n("GET",`/knowledge/bases/${encodeURIComponent(e)}/files`)}async function K(e,o){const s=new FormData;s.append("collection",o.collection),s.append("knowledgebase_id",e),o.folder&&s.append("folder",o.folder),o.files.forEach(a=>{s.append("files",a,a.name)});const d=await fetch(`${l}/knowledge/bases/${encodeURIComponent(e)}/files`,{method:"POST",body:s}),t=await d.json();if(!d.ok||!t.ok)throw new Error(t.error||`Local AI Core upload failed: ${d.status}`);return t.data}function T(e,o){return n("DELETE",`/knowledge/bases/${encodeURIComponent(e)}/files/${encodeURIComponent(o)}`)}function b(e,o){return n("POST",`/knowledge/bases/${encodeURIComponent(e)}/search`,o)}export{f as a,p as b,g as c,w as d,k as e,m as f,c as g,E as h,C as i,K as j,T as k,u as l,b as s,i as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as t,D as r}from"./index-
|
|
1
|
+
import{z as t,D as r}from"./index-DV9qeL9P.js";function s(){return t("GET","/workspaces")}function a(e){return t("GET",`/threads${r({workspace_id:e})}`)}function d(e,n){return t("POST","/threads",{workspaceId:e,title:n})}function u(e){return t("GET",`/threads/${encodeURIComponent(e)}`)}function c(e,n){return t("PATCH",`/threads/${encodeURIComponent(e)}`,{title:n})}function i(e,n){return t("PATCH",`/threads/${encodeURIComponent(e)}/knowledge-bases`,{knowledgeBaseIds:n})}function T(e,n){return t("PATCH",`/threads/${encodeURIComponent(e)}/mode`,{mode:n})}function p(e){return t("DELETE",`/threads/${encodeURIComponent(e)}`)}function h(e,n){return t("POST",`/threads/${encodeURIComponent(e)}/messages`,{content:n})}function m(e,n){return t("POST",`/threads/${encodeURIComponent(e)}/actions`,{content:n})}function f(e){return t("POST",`/runs/${encodeURIComponent(e)}/interrupt`)}export{a,i as b,d as c,h as d,p as e,u as g,f as i,s as l,c as r,m as s,T as u};
|
package/dist/renderer/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>AgentDock</title>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-DV9qeL9P.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-B6WcpkJF.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="bg-[#f5f5f7] dark:bg-[#151516]">
|
|
@@ -17,13 +17,23 @@ class LocalAutomationStore {
|
|
|
17
17
|
constructor(db) {
|
|
18
18
|
this.db = db;
|
|
19
19
|
}
|
|
20
|
-
list(workspaceId) {
|
|
20
|
+
list(workspaceId, originKind) {
|
|
21
|
+
const conditions = [];
|
|
22
|
+
const params = [];
|
|
23
|
+
if (workspaceId) {
|
|
24
|
+
conditions.push('workspace_id = ?');
|
|
25
|
+
params.push(workspaceId);
|
|
26
|
+
}
|
|
27
|
+
if (originKind) {
|
|
28
|
+
conditions.push('origin_kind = ?');
|
|
29
|
+
params.push(originKind);
|
|
30
|
+
}
|
|
21
31
|
const rows = this.db.prepare(`
|
|
22
32
|
SELECT ${AUTOMATION_COLUMNS}
|
|
23
33
|
FROM automations
|
|
24
|
-
${
|
|
34
|
+
${conditions.length ? `WHERE ${conditions.join(' AND ')}` : ''}
|
|
25
35
|
ORDER BY updated_at DESC
|
|
26
|
-
`).all(...
|
|
36
|
+
`).all(...params);
|
|
27
37
|
return rows.map((row) => this.toDefinition(row));
|
|
28
38
|
}
|
|
29
39
|
get(id) {
|
|
@@ -232,6 +242,57 @@ class LocalAutomationStore {
|
|
|
232
242
|
`).all(automationId);
|
|
233
243
|
return rows.map((row) => this.toRun(row));
|
|
234
244
|
}
|
|
245
|
+
listLatestFinishedEvaluationByOrigin(originKind, workspaceId) {
|
|
246
|
+
return this.listLatestEvaluationByOrigin(originKind, workspaceId, '');
|
|
247
|
+
}
|
|
248
|
+
listLatestEvaluationWithStateByOrigin(originKind, workspaceId) {
|
|
249
|
+
return this.listLatestEvaluationByOrigin(originKind, workspaceId, "AND json_type(e.evaluation_json, '$.nextState') = 'object'");
|
|
250
|
+
}
|
|
251
|
+
listLatestEvaluationByOrigin(originKind, workspaceId, extraPredicate) {
|
|
252
|
+
const rows = this.db.prepare(`
|
|
253
|
+
WITH ranked AS (
|
|
254
|
+
SELECT
|
|
255
|
+
e.id, e.automation_id, e.status, e.activation_kind, e.script_version_id,
|
|
256
|
+
e.started_at, e.finished_at, e.evaluation_json,
|
|
257
|
+
ROW_NUMBER() OVER (PARTITION BY e.automation_id ORDER BY e.started_at DESC, e.id DESC) AS position
|
|
258
|
+
FROM automation_evaluations e
|
|
259
|
+
JOIN automations a ON a.id = e.automation_id
|
|
260
|
+
WHERE e.status = 'finished'
|
|
261
|
+
${extraPredicate}
|
|
262
|
+
AND a.origin_kind = ?${workspaceId ? ' AND a.workspace_id = ?' : ''}
|
|
263
|
+
)
|
|
264
|
+
SELECT ${EVALUATION_COLUMNS}
|
|
265
|
+
FROM ranked
|
|
266
|
+
WHERE position = 1
|
|
267
|
+
`).all(...(workspaceId ? [originKind, workspaceId] : [originKind]));
|
|
268
|
+
const result = new Map();
|
|
269
|
+
for (const row of rows) {
|
|
270
|
+
const evaluation = this.toEvaluation(row);
|
|
271
|
+
result.set(evaluation.automationId, evaluation);
|
|
272
|
+
}
|
|
273
|
+
return result;
|
|
274
|
+
}
|
|
275
|
+
listLatestRunByOrigin(originKind, workspaceId) {
|
|
276
|
+
const rows = this.db.prepare(`
|
|
277
|
+
WITH ranked AS (
|
|
278
|
+
SELECT
|
|
279
|
+
r.id, r.automation_id, r.evaluation_id, r.status, r.created_at, r.run_json,
|
|
280
|
+
ROW_NUMBER() OVER (PARTITION BY r.automation_id ORDER BY r.created_at DESC, r.id DESC) AS position
|
|
281
|
+
FROM automation_runs r
|
|
282
|
+
JOIN automations a ON a.id = r.automation_id
|
|
283
|
+
WHERE a.origin_kind = ?${workspaceId ? ' AND a.workspace_id = ?' : ''}
|
|
284
|
+
)
|
|
285
|
+
SELECT ${RUN_COLUMNS}
|
|
286
|
+
FROM ranked
|
|
287
|
+
WHERE position = 1
|
|
288
|
+
`).all(...(workspaceId ? [originKind, workspaceId] : [originKind]));
|
|
289
|
+
const result = new Map();
|
|
290
|
+
for (const row of rows) {
|
|
291
|
+
const run = this.toRun(row);
|
|
292
|
+
result.set(run.automationId, run);
|
|
293
|
+
}
|
|
294
|
+
return result;
|
|
295
|
+
}
|
|
235
296
|
reconcileInterruptedRuns(reason, finishedAt) {
|
|
236
297
|
const interruptedAt = assertIsoTimestamp(finishedAt, 'Automation interrupted run finishedAt');
|
|
237
298
|
const rows = this.db.prepare(`
|
|
@@ -415,6 +476,11 @@ class LocalAutomationStore {
|
|
|
415
476
|
const row = this.db.prepare('SELECT next_check_at FROM automations WHERE id = ?').get(id);
|
|
416
477
|
return row?.next_check_at ?? null;
|
|
417
478
|
}
|
|
479
|
+
listDueAutomationIds(now) {
|
|
480
|
+
const rows = this.db.prepare(`SELECT id FROM automations
|
|
481
|
+
WHERE enabled = 1 AND health = 'healthy' AND next_check_at IS NOT NULL AND next_check_at <= ?`).all(now.toISOString());
|
|
482
|
+
return new Set(rows.map((row) => row.id));
|
|
483
|
+
}
|
|
418
484
|
toDefinition(row) {
|
|
419
485
|
try {
|
|
420
486
|
return normalizeDefinition({
|
|
@@ -246,8 +246,8 @@ class LocalCoreAcpStore {
|
|
|
246
246
|
updateAutomationMonitorRun(runId, input) {
|
|
247
247
|
return this.automationMonitors.updateRun(runId, input);
|
|
248
248
|
}
|
|
249
|
-
listAutomations(workspaceId) {
|
|
250
|
-
return this.automations.list(workspaceId);
|
|
249
|
+
listAutomations(workspaceId, originKind) {
|
|
250
|
+
return this.automations.list(workspaceId, originKind);
|
|
251
251
|
}
|
|
252
252
|
getAutomation(automationId) {
|
|
253
253
|
return this.automations.get(automationId);
|
|
@@ -255,6 +255,9 @@ class LocalCoreAcpStore {
|
|
|
255
255
|
getAutomationNextCheckAt(automationId) {
|
|
256
256
|
return this.automations.getNextCheckAt(automationId);
|
|
257
257
|
}
|
|
258
|
+
listDueAutomationIds(now) {
|
|
259
|
+
return this.automations.listDueAutomationIds(now);
|
|
260
|
+
}
|
|
258
261
|
createAutomation(input) {
|
|
259
262
|
return this.automations.create(input);
|
|
260
263
|
}
|
|
@@ -365,6 +368,15 @@ class LocalCoreAcpStore {
|
|
|
365
368
|
getLatestAutomationEvaluationWithState(automationId) {
|
|
366
369
|
return this.automations.getLatestEvaluationWithState(automationId);
|
|
367
370
|
}
|
|
371
|
+
listLatestFinishedAutomationEvaluationByOrigin(originKind, workspaceId) {
|
|
372
|
+
return this.automations.listLatestFinishedEvaluationByOrigin(originKind, workspaceId);
|
|
373
|
+
}
|
|
374
|
+
listLatestAutomationEvaluationWithStateByOrigin(originKind, workspaceId) {
|
|
375
|
+
return this.automations.listLatestEvaluationWithStateByOrigin(originKind, workspaceId);
|
|
376
|
+
}
|
|
377
|
+
listLatestAutomationRunByOrigin(originKind, workspaceId) {
|
|
378
|
+
return this.automations.listLatestRunByOrigin(originKind, workspaceId);
|
|
379
|
+
}
|
|
368
380
|
createAutomationRun(automationId, evaluationId, input = {}) {
|
|
369
381
|
return this.automations.createRun(automationId, evaluationId, input);
|
|
370
382
|
}
|
|
@@ -131,9 +131,11 @@ class AutomationMonitorService {
|
|
|
131
131
|
await this.settleInFlight();
|
|
132
132
|
}
|
|
133
133
|
listMonitors(workspaceId) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
const automations = this.options.automations.list(workspaceId, 'automation-monitor');
|
|
135
|
+
const latestEvaluationById = this.options.automations.listLatestFinishedEvaluationByOrigin('automation-monitor', workspaceId);
|
|
136
|
+
const latestRunById = this.options.automations.listLatestRunByOrigin('automation-monitor', workspaceId);
|
|
137
|
+
const latestEvaluationWithStateById = this.options.automations.listLatestEvaluationWithStateByOrigin('automation-monitor', workspaceId);
|
|
138
|
+
return automations.map((automation) => (0, legacy_automation_mappers_js_1.automationToMonitor)(automation, latestEvaluationById.get(automation.id), latestRunById.get(automation.id), latestEvaluationWithStateById.get(automation.id)));
|
|
137
139
|
}
|
|
138
140
|
getMonitor(monitorId) {
|
|
139
141
|
const resolved = this.resolveMonitorId(monitorId);
|
|
@@ -41,8 +41,8 @@ class AutomationService {
|
|
|
41
41
|
}
|
|
42
42
|
this.scriptProtocolRunner = options.scriptProtocolRunner;
|
|
43
43
|
}
|
|
44
|
-
list(workspaceId) {
|
|
45
|
-
return this.options.store.listAutomations(workspaceId);
|
|
44
|
+
list(workspaceId, originKind) {
|
|
45
|
+
return this.options.store.listAutomations(workspaceId, originKind);
|
|
46
46
|
}
|
|
47
47
|
get(automationId) {
|
|
48
48
|
return this.options.store.getAutomation(automationId);
|
|
@@ -105,6 +105,15 @@ class AutomationService {
|
|
|
105
105
|
listRuns(automationId) {
|
|
106
106
|
return this.options.store.listAutomationRuns(automationId);
|
|
107
107
|
}
|
|
108
|
+
listLatestFinishedEvaluationByOrigin(originKind, workspaceId) {
|
|
109
|
+
return this.options.store.listLatestFinishedAutomationEvaluationByOrigin(originKind, workspaceId);
|
|
110
|
+
}
|
|
111
|
+
listLatestEvaluationWithStateByOrigin(originKind, workspaceId) {
|
|
112
|
+
return this.options.store.listLatestAutomationEvaluationWithStateByOrigin(originKind, workspaceId);
|
|
113
|
+
}
|
|
114
|
+
listLatestRunByOrigin(originKind, workspaceId) {
|
|
115
|
+
return this.options.store.listLatestAutomationRunByOrigin(originKind, workspaceId);
|
|
116
|
+
}
|
|
108
117
|
getRuntimeStatus() {
|
|
109
118
|
return this.runtimeStatus;
|
|
110
119
|
}
|
|
@@ -300,11 +309,11 @@ class AutomationService {
|
|
|
300
309
|
async runTick(generation) {
|
|
301
310
|
const now = this.now();
|
|
302
311
|
const due = [];
|
|
312
|
+
const dueIds = this.options.store.listDueAutomationIds(now);
|
|
303
313
|
for (const automation of this.list()) {
|
|
304
314
|
if (!this.shouldPoll(automation))
|
|
305
315
|
continue;
|
|
306
|
-
|
|
307
|
-
if (nextCheckAt !== null && Date.parse(nextCheckAt) <= now.getTime()) {
|
|
316
|
+
if (dueIds.has(automation.id)) {
|
|
308
317
|
due.push(automation);
|
|
309
318
|
}
|
|
310
319
|
}
|
|
@@ -20,10 +20,13 @@ function nextActivationAt(activation, after) {
|
|
|
20
20
|
return validResultDate(nextMs);
|
|
21
21
|
}
|
|
22
22
|
case 'cron': {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const compiled = requireCompiledCron(compiledCron);
|
|
24
|
+
const search = isUtcTimezone(activation.timezone)
|
|
25
|
+
? (0, cron_js_1.findNextCronMatchUtc)(compiled, after)
|
|
26
|
+
: (0, cron_js_1.findNextCronMatchInTimezone)(compiled, after, activation.timezone);
|
|
27
|
+
if (search.date)
|
|
28
|
+
return search.date;
|
|
29
|
+
throw new Error(`No cron activation exists for expression: ${activation.expression} (${activation.timezone})`);
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
}
|
|
@@ -40,14 +43,11 @@ function isActivationDue(activation, now, nextCheckAt) {
|
|
|
40
43
|
return parseIsoTimestamp(activation.runAt, 'once runAt').getTime() <= nowMs;
|
|
41
44
|
case 'interval':
|
|
42
45
|
return nowMs % activation.intervalMs === 0;
|
|
43
|
-
case 'cron':
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
month: now.getUTCMonth() + 1,
|
|
49
|
-
dayOfWeek: now.getUTCDay(),
|
|
50
|
-
});
|
|
46
|
+
case 'cron': {
|
|
47
|
+
if (nowMs !== floorUtcMinute(nowMs))
|
|
48
|
+
return false;
|
|
49
|
+
return (0, cron_js_1.cronMatchesFields)(requireCompiledCron(compiledCron), (0, cron_js_1.extractFieldsInTimezone)(now, activation.timezone));
|
|
50
|
+
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
function missedActivationAt(activation, lastCheckedAt, now) {
|
|
@@ -68,7 +68,10 @@ function missedActivationAt(activation, lastCheckedAt, now) {
|
|
|
68
68
|
return latestMs > lastCheckedMs ? validResultDate(latestMs) : null;
|
|
69
69
|
}
|
|
70
70
|
case 'cron': {
|
|
71
|
-
|
|
71
|
+
const compiled = requireCompiledCron(compiledCron);
|
|
72
|
+
return (isUtcTimezone(activation.timezone)
|
|
73
|
+
? (0, cron_js_1.findPreviousCronMatchUtc)(compiled, now, new Date(lastCheckedMs))
|
|
74
|
+
: (0, cron_js_1.findPreviousCronMatchInTimezone)(compiled, now, activation.timezone, new Date(lastCheckedMs))).date;
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
}
|
|
@@ -83,14 +86,12 @@ function validateActivation(activation) {
|
|
|
83
86
|
assertInterval(activation.intervalMs);
|
|
84
87
|
return undefined;
|
|
85
88
|
case 'cron':
|
|
86
|
-
|
|
89
|
+
(0, cron_js_1.assertSupportedTimezone)(activation.timezone);
|
|
87
90
|
return (0, cron_js_1.compileCronExpression)(activation.expression);
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
|
-
function
|
|
91
|
-
|
|
92
|
-
throw new Error(`Automation scheduling currently supports only UTC cron timezones; received: ${timezone}`);
|
|
93
|
-
}
|
|
93
|
+
function isUtcTimezone(timezone) {
|
|
94
|
+
return timezone === 'UTC' || timezone === 'Etc/UTC' || timezone === 'Z';
|
|
94
95
|
}
|
|
95
96
|
function assertInterval(intervalMs) {
|
|
96
97
|
if (!Number.isSafeInteger(intervalMs) || intervalMs <= 0) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setDefaultTimezone = setDefaultTimezone;
|
|
3
4
|
exports.scheduledJobToAutomationInput = scheduledJobToAutomationInput;
|
|
4
5
|
exports.automationToScheduledJob = automationToScheduledJob;
|
|
5
6
|
exports.monitorToAutomationInput = monitorToAutomationInput;
|
|
@@ -9,13 +10,36 @@ exports.automationToMonitorRun = automationToMonitorRun;
|
|
|
9
10
|
exports.latestFinishedEvaluation = latestFinishedEvaluation;
|
|
10
11
|
exports.latestAutomationRun = latestAutomationRun;
|
|
11
12
|
const superai_contracts_1 = require("../../../../packages/contracts/src/index.js");
|
|
13
|
+
const cron_js_1 = require("../scheduler/cron.js");
|
|
12
14
|
const condition_evaluator_js_1 = require("./condition-evaluator.js");
|
|
15
|
+
// The timezone used for cron expressions created through the legacy scheduler facade.
|
|
16
|
+
// The old SchedulerService interpreted cron in the server's local wall clock, so we
|
|
17
|
+
// default to the host's IANA timezone (falling back to UTC) to preserve that behavior.
|
|
18
|
+
// Resolves lazily so environments without full IANA data still boot.
|
|
19
|
+
let defaultTimezone;
|
|
20
|
+
function resolveDefaultTimezone() {
|
|
21
|
+
if (defaultTimezone)
|
|
22
|
+
return defaultTimezone;
|
|
23
|
+
try {
|
|
24
|
+
const detected = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
25
|
+
defaultTimezone = detected && (0, cron_js_1.isValidTimezone)(detected) ? detected : 'UTC';
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
defaultTimezone = 'UTC';
|
|
29
|
+
}
|
|
30
|
+
return defaultTimezone;
|
|
31
|
+
}
|
|
32
|
+
/** Override the default timezone used for legacy cron jobs (e.g. from runtime config). */
|
|
33
|
+
function setDefaultTimezone(timezone) {
|
|
34
|
+
(0, cron_js_1.assertSupportedTimezone)(timezone);
|
|
35
|
+
defaultTimezone = timezone;
|
|
36
|
+
}
|
|
13
37
|
function scheduledJobToAutomationInput(input) {
|
|
14
38
|
const triggerType = (0, superai_contracts_1.normalizeScheduledJobTriggerType)(input.triggerType);
|
|
15
39
|
const activation = triggerType === 'once'
|
|
16
40
|
? { kind: 'once', runAt: requireText(input.runAt, 'Scheduled job runAt') }
|
|
17
41
|
: triggerType === 'cron'
|
|
18
|
-
? { kind: 'cron', expression: requireText(input.cronExpr, 'Scheduled job cronExpr'), timezone:
|
|
42
|
+
? { kind: 'cron', expression: requireText(input.cronExpr, 'Scheduled job cronExpr'), timezone: resolveDefaultTimezone() }
|
|
19
43
|
: fail(`Unsupported scheduled job trigger type: ${triggerType}`);
|
|
20
44
|
return {
|
|
21
45
|
workspaceId: requireText(input.workspaceId, 'Scheduled job workspaceId'),
|
|
@@ -16,6 +16,7 @@ const scheduler_service_js_1 = require("../scheduler/scheduler-service.js");
|
|
|
16
16
|
const automation_monitor_service_js_1 = require("../automation/automation-monitor-service.js");
|
|
17
17
|
const automation_action_executor_js_1 = require("../automation/automation-action-executor.js");
|
|
18
18
|
const automation_service_js_1 = require("../automation/automation-service.js");
|
|
19
|
+
const legacy_automation_mappers_js_1 = require("../automation/legacy-automation-mappers.js");
|
|
19
20
|
function bootstrapLocalCoreKernel(options) {
|
|
20
21
|
const capabilities = new capability_registry_js_1.LocalCoreCapabilityRegistry();
|
|
21
22
|
const plugins = new plugin_registry_js_1.LocalCorePluginRegistry(options?.disabledPluginIds);
|
|
@@ -213,6 +214,10 @@ function bootstrapLocalCoreRuntime(options) {
|
|
|
213
214
|
getWorkspaceRouter: () => workspaceRouter,
|
|
214
215
|
getChannelRuntime: (platform) => channelRuntimes.find((runtime) => runtime.platform === platform || platform.startsWith(`${runtime.platform}:`)),
|
|
215
216
|
});
|
|
217
|
+
// Default legacy cron jobs to the host's local timezone so they fire at the wall
|
|
218
|
+
// clock the user wrote (e.g. a job written as "0 1 * * *" runs at 1 AM server time).
|
|
219
|
+
// Matches the behavior of the old SchedulerService, which matched in local time.
|
|
220
|
+
(0, legacy_automation_mappers_js_1.setDefaultTimezone)(resolveHostTimezone());
|
|
216
221
|
const automations = new automation_service_js_1.AutomationService({
|
|
217
222
|
store,
|
|
218
223
|
actionExecutor: automationActionExecutor,
|
|
@@ -280,3 +285,13 @@ function bootstrapLocalCoreRuntime(options) {
|
|
|
280
285
|
},
|
|
281
286
|
};
|
|
282
287
|
}
|
|
288
|
+
// The host machine's IANA timezone. Falls back to UTC if the runtime cannot determine it.
|
|
289
|
+
function resolveHostTimezone() {
|
|
290
|
+
try {
|
|
291
|
+
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
292
|
+
return tz && tz.length > 0 ? tz : 'UTC';
|
|
293
|
+
}
|
|
294
|
+
catch {
|
|
295
|
+
return 'UTC';
|
|
296
|
+
}
|
|
297
|
+
}
|
|
@@ -320,9 +320,19 @@ class LocalCoreController extends node_events_1.EventEmitter {
|
|
|
320
320
|
const legacyProjects = migrated.config.projects || [];
|
|
321
321
|
let warnings = [...(current.warnings || []), ...migrated.warnings];
|
|
322
322
|
if (legacyProjects.length > 0) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
// Persist a copy of the projects into the workspace registry as a
|
|
324
|
+
// crash-recovery backup, but do NOT strip them from runtime_config:
|
|
325
|
+
// channel bindings still read runtime_config directly, so removing
|
|
326
|
+
// projects here would silently disable every channel until the next
|
|
327
|
+
// explicit save.
|
|
328
|
+
const registryNames = (this.store.listWorkspaceRegistry?.() ?? [])
|
|
329
|
+
.filter((e) => e.metadata?.source === 'runtime-project')
|
|
330
|
+
.map((e) => e.displayName);
|
|
331
|
+
const alreadyBackedUp = legacyProjects.every((p) => registryNames.includes(p.name));
|
|
332
|
+
if (!alreadyBackedUp) {
|
|
333
|
+
(0, workspace_project_registry_js_1.persistProjectsInRegistry)(this.store, legacyProjects, { preserveLegacyIds: true });
|
|
334
|
+
warnings = [...warnings, 'Backed up runtime projects into the workspace registry.'];
|
|
335
|
+
}
|
|
326
336
|
}
|
|
327
337
|
return {
|
|
328
338
|
...this.store.readRuntimeConfig(),
|