@kafca/agentdock 0.1.34 → 0.1.35
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 +67 -0
- package/dist/renderer/assets/{Badge-BDxYXRKv.js → Badge-BM4WCcua.js} +1 -1
- package/dist/renderer/assets/{Chat-B-ZXd4Ld.js → Chat-DoyBHOsx.js} +1 -1
- package/dist/renderer/assets/{ChatMarkdown-Dn4XvCke.js → ChatMarkdown-BWj04kgW.js} +1 -1
- package/dist/renderer/assets/{Config-DMOYyKOD.js → Config-A95OuazQ.js} +1 -1
- package/dist/renderer/assets/{CronList-CMBhMs1J.js → CronList-DsPU4zGT.js} +1 -1
- package/dist/renderer/assets/{Dashboard-DApD4wOA.js → Dashboard-D8Vpj97x.js} +2 -2
- package/dist/renderer/assets/{EmptyState-CqcPky2i.js → EmptyState-x1uVoSxZ.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-DMOXK9Nz.js → KnowledgeDetail-C9TbcyNJ.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-Dv4Ttb6N.js → KnowledgeHome-Cg9Fb41Q.js} +1 -1
- package/dist/renderer/assets/Logs-oWaKA60u.js +1 -0
- package/dist/renderer/assets/{Modal-Cj_0qtXr.js → Modal-24hTXXHK.js} +1 -1
- package/dist/renderer/assets/{Page-BlKjqLN4.js → Page-YRtQonKZ.js} +1 -1
- package/dist/renderer/assets/{ProjectDetail-aMl1VGTt.js → ProjectDetail-DScsxJO-.js} +1 -1
- package/dist/renderer/assets/{ProjectList-R2YvsII0.js → ProjectList-8L5GD7PN.js} +1 -1
- package/dist/renderer/assets/{Select-CrqwGrrm.js → Select-BI8Uw_DF.js} +1 -1
- package/dist/renderer/assets/{SessionChat-CGtpyGKR.js → SessionChat-BIoCWdDD.js} +1 -1
- package/dist/renderer/assets/{SessionList-D8gRUc8M.js → SessionList-BsEJeDxI.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-BCGm6bQP.js → ThreadChat-DJi0UBta.js} +1 -1
- package/dist/renderer/assets/{Workspace-DnePK6tn.js → Workspace-tlJxrgC5.js} +1 -1
- package/dist/renderer/assets/{arrow-left-SVmCyBR4.js → arrow-left-pzaBhi9y.js} +1 -1
- package/dist/renderer/assets/{book-open-CZi1avEJ.js → book-open-CNhlVyqh.js} +1 -1
- package/dist/renderer/assets/{check-C76I9BFh.js → check-Cg2LLCdl.js} +1 -1
- package/dist/renderer/assets/{chevron-down-C7YSxzHw.js → chevron-down-Dgqg07wf.js} +1 -1
- package/dist/renderer/assets/{circle-_s8tmsAJ.js → circle-BBd_jIS2.js} +1 -1
- package/dist/renderer/assets/{desktop-66ot_8sB.js → desktop-C0S-Yv8G.js} +1 -1
- package/dist/renderer/assets/{funnel-cDV0Q_Mr.js → funnel-DwSh-SrX.js} +1 -1
- package/dist/renderer/assets/{heart-qMUQm0tf.js → heart-CWVc-KhZ.js} +1 -1
- package/dist/renderer/assets/{index-DFiJR0vv.css → index-CaQZSRbg.css} +1 -1
- package/dist/renderer/assets/{index-BY88QEsS.js → index-DZbeAYVk.js} +2 -2
- package/dist/renderer/assets/{index-Cr6erCLm.js → index-HYmDNQ9k.js} +1 -1
- package/dist/renderer/assets/{pencil-C3MA3apq.js → pencil-tI4tCLz0.js} +1 -1
- package/dist/renderer/assets/{play-VZKHv5dN.js → play-Coi2HA1w.js} +1 -1
- package/dist/renderer/assets/{plug-Cm7l0fVk.js → plug-D4TCyW9b.js} +1 -1
- package/dist/renderer/assets/{plus-DjGK7f-K.js → plus-p62AgpoB.js} +1 -1
- package/dist/renderer/assets/projects-CTDuVxeQ.js +1 -0
- package/dist/renderer/assets/{save-Doi-FwDR.js → save-fpMhkVV0.js} +1 -1
- package/dist/renderer/assets/{search-DHqpbK_c.js → search-BHKIStdA.js} +1 -1
- package/dist/renderer/assets/{server-Bmtxxlph.js → server-0oTWed8U.js} +1 -1
- package/dist/renderer/assets/{session-utils-Z-jLtVLY.js → session-utils-D0Qv0I0-.js} +1 -1
- package/dist/renderer/assets/{sessions-C5TSSo_R.js → sessions-C8ApKQgC.js} +1 -1
- package/dist/renderer/assets/{shield-check-DhZ05nhI.js → shield-check-BAJI9jzC.js} +1 -1
- package/dist/renderer/assets/{trash-2-DiyFflVR.js → trash-2-B-Ygm-x6.js} +1 -1
- package/dist/renderer/assets/{user-CgsIPd7T.js → user-Cv8rzw8l.js} +1 -1
- package/dist/renderer/assets/{wifi-off-CqWbWFzp.js → wifi-off-BImS3nkm.js} +1 -1
- package/dist/renderer/index.html +2 -2
- package/dist-electron/services/local-ai-core/src/kernel/rotating-logger.js +232 -0
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +3 -0
- package/dist-electron/services/local-ai-core/src/runtime/local-core-runtime-state.js +40 -84
- package/dist-electron/services/local-ai-core/src/runtime/server-routes.js +3 -0
- package/dist-electron/services/local-ai-core/src/runtime/server.js +14 -0
- package/dist-electron/src/api/client.js +1 -1
- package/dist-electron/tests/electron/plugin-kernel.test.js +161 -44
- package/dist-electron/tests/integration/local-core-refactor.test.js +1 -0
- package/package.json +1 -1
- package/dist/renderer/assets/Logs-CHrUm25Y.js +0 -1
- package/dist/renderer/assets/projects-Dcki78KB.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{G as Te,aK as Ae,r as c,j as x,aL as pe,aM as Ne,aA as te}from"./index-BY88QEsS.js";var ye=Ae();const De=Te(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:()=>{},Me=pe[" useId ".trim().toString()]||(()=>{}),Fe=0;function tn(e){const[t,n]=c.useState(Me());return ne(()=>{n(r=>r??String(Fe++))},[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($e);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=Ve(i,o.props);return o.type!==c.Fragment&&(a.ref=r?Ne(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 $e(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ue}function Ve(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"],V=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 F(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=F(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 L=E.target,T=[...l.branches].some(M=>M.contains(L));!S||T||(o==null||o(E),s==null||s(E),E.defaultPrevented||a==null||a())},v),P=tt(E=>{const L=E.target;[...l.branches].some(M=>M.contains(L))||(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(V.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(V.div,{...e,ref:o})});Je.displayName=Qe;function et(e,t=globalThis==null?void 0:globalThis.document){const n=F(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=F(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=F(o),f=F(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(V.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(V.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",$="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:$,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},Lt={left:0,top:0,right:0,gap:0},q=function(e){return parseInt(e||"",10)||0},Tt=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)]},At=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Lt;var t=Tt(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])}},Nt=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{G as Te,aK as Ae,r as c,j as x,aL as pe,aM as Ne,aA as te}from"./index-DZbeAYVk.js";var ye=Ae();const De=Te(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:()=>{},Me=pe[" useId ".trim().toString()]||(()=>{}),Fe=0;function tn(e){const[t,n]=c.useState(Me());return ne(()=>{n(r=>r??String(Fe++))},[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($e);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=Ve(i,o.props);return o.type!==c.Fragment&&(a.ref=r?Ne(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 $e(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ue}function Ve(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"],V=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 F(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=F(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 L=E.target,T=[...l.branches].some(M=>M.contains(L));!S||T||(o==null||o(E),s==null||s(E),E.defaultPrevented||a==null||a())},v),P=tt(E=>{const L=E.target;[...l.branches].some(M=>M.contains(L))||(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(V.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(V.div,{...e,ref:o})});Je.displayName=Qe;function et(e,t=globalThis==null?void 0:globalThis.document){const n=F(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=F(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=F(o),f=F(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(V.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(V.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",$="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:$,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},Lt={left:0,top:0,right:0,gap:0},q=function(e){return parseInt(e||"",10)||0},Tt=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)]},At=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Lt;var t=Tt(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])}},Nt=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,`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as t}from"./index-DZbeAYVk.js";const e=()=>t.get("/projects"),r=o=>t.get(`/projects/${o}`);export{r as g,e as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as o}from"./index-
|
|
1
|
+
import{z as o}from"./index-DZbeAYVk.js";const i=s=>o.get(`/projects/${s}/sessions`),c=(s,e,t)=>o.get(`/projects/${s}/sessions/${e}`,{history_limit:String(t)}),r=(s,e,t)=>o.patch(`/projects/${s}/sessions/${e}`,t),a=(s,e)=>o.delete(`/projects/${s}/sessions/${e}`),p=(s,e)=>o.post(`/projects/${s}/sessions/switch`,e),$=(s,e)=>o.post(`/projects/${s}/send`,e);export{$ as a,a as d,c as g,i as l,r,p as s};
|
package/dist/renderer/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
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-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-DZbeAYVk.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CaQZSRbg.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="bg-[#f5f5f7] dark:bg-[#151516]">
|
|
12
12
|
<div id="root"></div>
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentDockRotatingLogger = void 0;
|
|
4
|
+
exports.resolveAgentDockLogDir = resolveAgentDockLogDir;
|
|
5
|
+
exports.inferLogLevel = inferLogLevel;
|
|
6
|
+
exports.normalizeLogLimit = normalizeLogLimit;
|
|
7
|
+
exports.formatLocalLogTimestamp = formatLocalLogTimestamp;
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_os_1 = require("node:os");
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
|
+
const DEFAULT_LOG_MAX_BYTES = 10 * 1024 * 1024;
|
|
12
|
+
const DEFAULT_LOG_MAX_FILES = 5;
|
|
13
|
+
const LOG_TAIL_CHUNK_BYTES = 64 * 1024;
|
|
14
|
+
const LOG_MAX_RETURN_LINES = 5000;
|
|
15
|
+
const LEVEL_FILE_NAMES = {
|
|
16
|
+
sys: 'sys.log',
|
|
17
|
+
debug: 'debug.log',
|
|
18
|
+
info: 'info.log',
|
|
19
|
+
warn: 'warn.log',
|
|
20
|
+
error: 'error.log',
|
|
21
|
+
};
|
|
22
|
+
class AgentDockRotatingLogger {
|
|
23
|
+
logDir;
|
|
24
|
+
sysLogPath;
|
|
25
|
+
maxBytes;
|
|
26
|
+
maxFiles;
|
|
27
|
+
scope;
|
|
28
|
+
constructor(options = {}) {
|
|
29
|
+
this.logDir = options.logDir || resolveAgentDockLogDir();
|
|
30
|
+
this.sysLogPath = (0, node_path_1.join)(this.logDir, LEVEL_FILE_NAMES.sys);
|
|
31
|
+
this.maxBytes = normalizePositiveInteger(options.maxBytes, resolveLogMaxBytes());
|
|
32
|
+
this.maxFiles = normalizePositiveInteger(options.maxFiles, resolveLogMaxFiles());
|
|
33
|
+
this.scope = options.scope || 'local-ai-core';
|
|
34
|
+
(0, node_fs_1.mkdirSync)(this.logDir, { recursive: true });
|
|
35
|
+
this.ensureLogFiles();
|
|
36
|
+
}
|
|
37
|
+
write(level, message, meta) {
|
|
38
|
+
if (!message) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const entry = {
|
|
42
|
+
ts: formatLocalLogTimestamp(new Date()),
|
|
43
|
+
level,
|
|
44
|
+
scope: this.scope,
|
|
45
|
+
message: sanitizeLogMessage(message),
|
|
46
|
+
...(meta && Object.keys(meta).length > 0 ? { meta } : {}),
|
|
47
|
+
};
|
|
48
|
+
const line = `${JSON.stringify(entry)}\n`;
|
|
49
|
+
this.append('sys', line);
|
|
50
|
+
this.append(level, line);
|
|
51
|
+
}
|
|
52
|
+
tailSysLog(limit = 200) {
|
|
53
|
+
return this.tail('sys', limit);
|
|
54
|
+
}
|
|
55
|
+
tail(level, limit = 200) {
|
|
56
|
+
return tailRotatedLogFiles(this.pathFor(level), limit, this.maxFiles);
|
|
57
|
+
}
|
|
58
|
+
pathFor(level) {
|
|
59
|
+
return (0, node_path_1.join)(this.logDir, LEVEL_FILE_NAMES[level]);
|
|
60
|
+
}
|
|
61
|
+
ensureLogFiles() {
|
|
62
|
+
for (const level of Object.keys(LEVEL_FILE_NAMES)) {
|
|
63
|
+
try {
|
|
64
|
+
(0, node_fs_1.closeSync)((0, node_fs_1.openSync)(this.pathFor(level), 'a'));
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// File logging must never break Local AI Core runtime behavior.
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
append(level, line) {
|
|
72
|
+
try {
|
|
73
|
+
const path = this.pathFor(level);
|
|
74
|
+
this.rotateIfNeeded(path, Buffer.byteLength(line, 'utf8'));
|
|
75
|
+
(0, node_fs_1.appendFileSync)(path, line, 'utf8');
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// File logging must never break Local AI Core runtime behavior.
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
rotateIfNeeded(path, incomingBytes) {
|
|
82
|
+
if (!(0, node_fs_1.existsSync)(path)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
let size = 0;
|
|
86
|
+
try {
|
|
87
|
+
size = (0, node_fs_1.statSync)(path).size;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (size + incomingBytes <= this.maxBytes) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
for (let index = this.maxFiles; index >= 1; index -= 1) {
|
|
96
|
+
const current = `${path}.${index}`;
|
|
97
|
+
const next = `${path}.${index + 1}`;
|
|
98
|
+
if (!(0, node_fs_1.existsSync)(current)) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
if (index >= this.maxFiles) {
|
|
103
|
+
(0, node_fs_1.unlinkSync)(current);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
(0, node_fs_1.renameSync)(current, next);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// Rotation is best-effort; the append path still attempts to continue.
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
(0, node_fs_1.renameSync)(path, `${path}.1`);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// Rotation is best-effort; the append path still attempts to continue.
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.AgentDockRotatingLogger = AgentDockRotatingLogger;
|
|
122
|
+
function resolveAgentDockLogDir() {
|
|
123
|
+
const override = process.env.AGENTDOCK_LOG_DIR?.trim();
|
|
124
|
+
if (override) {
|
|
125
|
+
return override;
|
|
126
|
+
}
|
|
127
|
+
return (0, node_path_1.join)((0, node_os_1.homedir)(), '.agentdock', 'logs');
|
|
128
|
+
}
|
|
129
|
+
function inferLogLevel(message) {
|
|
130
|
+
const normalized = message.toLowerCase();
|
|
131
|
+
if (/\b(debug|trace)\b/.test(normalized)) {
|
|
132
|
+
return 'debug';
|
|
133
|
+
}
|
|
134
|
+
if (/\b(warn|warning)\b/.test(normalized)) {
|
|
135
|
+
return 'warn';
|
|
136
|
+
}
|
|
137
|
+
if (/\b(error|failed|failure|fatal|exception)\b/.test(normalized)) {
|
|
138
|
+
return 'error';
|
|
139
|
+
}
|
|
140
|
+
return 'info';
|
|
141
|
+
}
|
|
142
|
+
function normalizeLogLimit(limit) {
|
|
143
|
+
if (!Number.isFinite(limit)) {
|
|
144
|
+
return 200;
|
|
145
|
+
}
|
|
146
|
+
return Math.min(Math.max(Math.floor(limit), 1), LOG_MAX_RETURN_LINES);
|
|
147
|
+
}
|
|
148
|
+
function resolveLogMaxBytes() {
|
|
149
|
+
return normalizePositiveInteger(Number(process.env.AGENTDOCK_LOG_MAX_BYTES), DEFAULT_LOG_MAX_BYTES);
|
|
150
|
+
}
|
|
151
|
+
function resolveLogMaxFiles() {
|
|
152
|
+
return normalizePositiveInteger(Number(process.env.AGENTDOCK_LOG_MAX_FILES), DEFAULT_LOG_MAX_FILES);
|
|
153
|
+
}
|
|
154
|
+
function normalizePositiveInteger(value, fallback) {
|
|
155
|
+
if (!Number.isFinite(value) || !value || value <= 0) {
|
|
156
|
+
return fallback;
|
|
157
|
+
}
|
|
158
|
+
return Math.floor(value);
|
|
159
|
+
}
|
|
160
|
+
function sanitizeLogMessage(message) {
|
|
161
|
+
return String(message).replace(/\r?\n/g, '\\n');
|
|
162
|
+
}
|
|
163
|
+
function formatLocalLogTimestamp(date) {
|
|
164
|
+
return [
|
|
165
|
+
`${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`,
|
|
166
|
+
' ',
|
|
167
|
+
`${pad2(date.getHours())}:${pad2(date.getMinutes())}:${pad2(date.getSeconds())}.${pad3(date.getMilliseconds())}`,
|
|
168
|
+
].join('');
|
|
169
|
+
}
|
|
170
|
+
function pad2(value) {
|
|
171
|
+
return String(value).padStart(2, '0');
|
|
172
|
+
}
|
|
173
|
+
function pad3(value) {
|
|
174
|
+
return String(value).padStart(3, '0');
|
|
175
|
+
}
|
|
176
|
+
function tailRotatedLogFiles(path, limit, maxFiles) {
|
|
177
|
+
const normalizedLimit = normalizeLogLimit(limit);
|
|
178
|
+
const files = Array.from({ length: maxFiles }, (_, index) => `${path}.${maxFiles - index}`)
|
|
179
|
+
.concat(path);
|
|
180
|
+
const lines = [];
|
|
181
|
+
for (const file of files) {
|
|
182
|
+
lines.push(...tailLogFile(file, normalizedLimit));
|
|
183
|
+
}
|
|
184
|
+
return lines.slice(-normalizedLimit);
|
|
185
|
+
}
|
|
186
|
+
function tailLogFile(path, limit) {
|
|
187
|
+
if (limit <= 0 || !(0, node_fs_1.existsSync)(path)) {
|
|
188
|
+
return [];
|
|
189
|
+
}
|
|
190
|
+
let fd = -1;
|
|
191
|
+
try {
|
|
192
|
+
const size = (0, node_fs_1.statSync)(path).size;
|
|
193
|
+
if (size <= 0) {
|
|
194
|
+
return [];
|
|
195
|
+
}
|
|
196
|
+
fd = (0, node_fs_1.openSync)(path, 'r');
|
|
197
|
+
const chunks = [];
|
|
198
|
+
let position = size;
|
|
199
|
+
let newlineCount = 0;
|
|
200
|
+
while (position > 0 && newlineCount <= limit) {
|
|
201
|
+
const bytesToRead = Math.min(LOG_TAIL_CHUNK_BYTES, position);
|
|
202
|
+
position -= bytesToRead;
|
|
203
|
+
const chunk = Buffer.allocUnsafe(bytesToRead);
|
|
204
|
+
const bytesRead = (0, node_fs_1.readSync)(fd, chunk, 0, bytesToRead, position);
|
|
205
|
+
const slice = bytesRead === bytesToRead ? chunk : chunk.subarray(0, bytesRead);
|
|
206
|
+
chunks.unshift(slice);
|
|
207
|
+
for (let index = 0; index < slice.length; index += 1) {
|
|
208
|
+
if (slice[index] === 10) {
|
|
209
|
+
newlineCount += 1;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return Buffer.concat(chunks)
|
|
214
|
+
.toString('utf8')
|
|
215
|
+
.split(/\r?\n/)
|
|
216
|
+
.filter((line) => line.length > 0)
|
|
217
|
+
.slice(-limit);
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return [];
|
|
221
|
+
}
|
|
222
|
+
finally {
|
|
223
|
+
if (fd >= 0) {
|
|
224
|
+
try {
|
|
225
|
+
(0, node_fs_1.closeSync)(fd);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
// Log reads are best-effort; failed closes cannot be surfaced to callers.
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
@@ -105,6 +105,9 @@ class LocalCoreController extends node_events_1.EventEmitter {
|
|
|
105
105
|
getLogs(limit = 200) {
|
|
106
106
|
return this.state.getLogs(limit);
|
|
107
107
|
}
|
|
108
|
+
getLogEntries(level = 'sys', limit = 200) {
|
|
109
|
+
return this.state.getLogEntries(level, limit);
|
|
110
|
+
}
|
|
108
111
|
async readConfigFile() {
|
|
109
112
|
return this.state.readConfigFile();
|
|
110
113
|
}
|
|
@@ -37,13 +37,10 @@ exports.createLocalCoreRuntimeState = createLocalCoreRuntimeState;
|
|
|
37
37
|
const node_fs_1 = require("node:fs");
|
|
38
38
|
const node_path_1 = require("node:path");
|
|
39
39
|
const TOML = __importStar(require("@iarna/toml"));
|
|
40
|
+
const rotating_logger_js_1 = require("../kernel/rotating-logger.js");
|
|
40
41
|
const DEFAULT_CONFIG = `# Managed by Local AI Core
|
|
41
42
|
# Add [[projects]] entries from the workspace page before starting a conversation.
|
|
42
43
|
`;
|
|
43
|
-
const LOG_FILE_NAME = 'local-core.log';
|
|
44
|
-
const LOG_FILE_MAX_BYTES = 2 * 1024 * 1024;
|
|
45
|
-
const LOG_TAIL_CHUNK_BYTES = 64 * 1024;
|
|
46
|
-
const LOG_MAX_RETURN_LINES = 5000;
|
|
47
44
|
class FileBackedLocalCoreRuntimeState {
|
|
48
45
|
userDataPath;
|
|
49
46
|
onLog;
|
|
@@ -53,12 +50,14 @@ class FileBackedLocalCoreRuntimeState {
|
|
|
53
50
|
logPath;
|
|
54
51
|
settings;
|
|
55
52
|
logs = [];
|
|
53
|
+
logger;
|
|
56
54
|
constructor(userDataPath, onLog) {
|
|
57
55
|
this.userDataPath = userDataPath;
|
|
58
56
|
this.onLog = onLog;
|
|
59
57
|
this.runtimeDir = (0, node_path_1.join)(userDataPath, 'runtime');
|
|
60
58
|
this.settingsPath = (0, node_path_1.join)(this.runtimeDir, 'local-core-settings.json');
|
|
61
|
-
this.
|
|
59
|
+
this.logger = new rotating_logger_js_1.AgentDockRotatingLogger({ scope: 'local-ai-core' });
|
|
60
|
+
this.logPath = this.logger.sysLogPath;
|
|
62
61
|
(0, node_fs_1.mkdirSync)(this.runtimeDir, { recursive: true });
|
|
63
62
|
this.cliBinDir = this.ensureCliWrapper();
|
|
64
63
|
this.settings = this.loadSettings();
|
|
@@ -114,43 +113,25 @@ class FileBackedLocalCoreRuntimeState {
|
|
|
114
113
|
return this.settings.knowledge;
|
|
115
114
|
}
|
|
116
115
|
getLogs(limit = 200) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
return this.logger.tailSysLog(limit);
|
|
117
|
+
}
|
|
118
|
+
getLogEntries(level = 'sys', limit = 200) {
|
|
119
|
+
const normalizedLevel = normalizeLogFile(level);
|
|
120
|
+
return this.logger.tail(normalizedLevel, limit)
|
|
121
|
+
.map(parseLogEntry)
|
|
122
|
+
.filter((entry) => Boolean(entry));
|
|
124
123
|
}
|
|
125
124
|
pushLog(message) {
|
|
126
125
|
if (!message) {
|
|
127
126
|
return;
|
|
128
127
|
}
|
|
129
128
|
this.logs.push(message);
|
|
130
|
-
this.
|
|
129
|
+
this.logger.write((0, rotating_logger_js_1.inferLogLevel)(message), message);
|
|
131
130
|
this.onLog?.(message);
|
|
132
131
|
if (this.logs.length > 400) {
|
|
133
132
|
this.logs.splice(0, this.logs.length - 400);
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
|
-
appendLogFile(message) {
|
|
137
|
-
try {
|
|
138
|
-
if ((0, node_fs_1.existsSync)(this.logPath) && (0, node_fs_1.statSync)(this.logPath).size > LOG_FILE_MAX_BYTES) {
|
|
139
|
-
const rotatedPath = `${this.logPath}.1`;
|
|
140
|
-
try {
|
|
141
|
-
(0, node_fs_1.renameSync)(this.logPath, rotatedPath);
|
|
142
|
-
}
|
|
143
|
-
catch {
|
|
144
|
-
// Keep runtime logging best-effort; stdout/UI logs still work.
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
const line = `${new Date().toISOString()} ${message.replace(/\r?\n/g, '\\n')}\n`;
|
|
148
|
-
(0, node_fs_1.appendFileSync)(this.logPath, line, 'utf-8');
|
|
149
|
-
}
|
|
150
|
-
catch {
|
|
151
|
-
// File logging must never break Local AI Core runtime behavior.
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
135
|
async readConfigFile() {
|
|
155
136
|
const path = this.settings.configPath;
|
|
156
137
|
if (!(0, node_fs_1.existsSync)(path)) {
|
|
@@ -262,6 +243,34 @@ class FileBackedLocalCoreRuntimeState {
|
|
|
262
243
|
return binDir;
|
|
263
244
|
}
|
|
264
245
|
}
|
|
246
|
+
function normalizeLogFile(level) {
|
|
247
|
+
if (level === 'debug' || level === 'info' || level === 'warn' || level === 'error') {
|
|
248
|
+
return level;
|
|
249
|
+
}
|
|
250
|
+
return 'sys';
|
|
251
|
+
}
|
|
252
|
+
function parseLogEntry(line) {
|
|
253
|
+
try {
|
|
254
|
+
const parsed = JSON.parse(line);
|
|
255
|
+
if (!parsed || typeof parsed !== 'object') {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
const level = normalizeLogFile(String(parsed.level || 'info'));
|
|
259
|
+
if (level === 'sys') {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
ts: String(parsed.ts || ''),
|
|
264
|
+
level,
|
|
265
|
+
scope: String(parsed.scope || ''),
|
|
266
|
+
message: String(parsed.message || ''),
|
|
267
|
+
...(parsed.meta && typeof parsed.meta === 'object' ? { meta: parsed.meta } : {}),
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
265
274
|
function normalizePluginSettings(input) {
|
|
266
275
|
if (!input || typeof input !== 'object') {
|
|
267
276
|
return {};
|
|
@@ -281,59 +290,6 @@ function normalizePluginSettings(input) {
|
|
|
281
290
|
}
|
|
282
291
|
return output;
|
|
283
292
|
}
|
|
284
|
-
function normalizeLogLimit(limit) {
|
|
285
|
-
if (!Number.isFinite(limit)) {
|
|
286
|
-
return 200;
|
|
287
|
-
}
|
|
288
|
-
return Math.min(Math.max(Math.floor(limit), 1), LOG_MAX_RETURN_LINES);
|
|
289
|
-
}
|
|
290
|
-
function tailLogFile(path, limit) {
|
|
291
|
-
if (limit <= 0 || !(0, node_fs_1.existsSync)(path)) {
|
|
292
|
-
return [];
|
|
293
|
-
}
|
|
294
|
-
let fd = -1;
|
|
295
|
-
try {
|
|
296
|
-
const size = (0, node_fs_1.statSync)(path).size;
|
|
297
|
-
if (size <= 0) {
|
|
298
|
-
return [];
|
|
299
|
-
}
|
|
300
|
-
fd = (0, node_fs_1.openSync)(path, 'r');
|
|
301
|
-
const chunks = [];
|
|
302
|
-
let position = size;
|
|
303
|
-
let newlineCount = 0;
|
|
304
|
-
while (position > 0 && newlineCount <= limit) {
|
|
305
|
-
const bytesToRead = Math.min(LOG_TAIL_CHUNK_BYTES, position);
|
|
306
|
-
position -= bytesToRead;
|
|
307
|
-
const chunk = Buffer.allocUnsafe(bytesToRead);
|
|
308
|
-
const bytesRead = (0, node_fs_1.readSync)(fd, chunk, 0, bytesToRead, position);
|
|
309
|
-
const slice = bytesRead === bytesToRead ? chunk : chunk.subarray(0, bytesRead);
|
|
310
|
-
chunks.unshift(slice);
|
|
311
|
-
for (let index = 0; index < slice.length; index += 1) {
|
|
312
|
-
if (slice[index] === 10) {
|
|
313
|
-
newlineCount += 1;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return Buffer.concat(chunks)
|
|
318
|
-
.toString('utf8')
|
|
319
|
-
.split(/\r?\n/)
|
|
320
|
-
.filter((line) => line.length > 0)
|
|
321
|
-
.slice(-limit);
|
|
322
|
-
}
|
|
323
|
-
catch {
|
|
324
|
-
return [];
|
|
325
|
-
}
|
|
326
|
-
finally {
|
|
327
|
-
if (fd >= 0) {
|
|
328
|
-
try {
|
|
329
|
-
(0, node_fs_1.closeSync)(fd);
|
|
330
|
-
}
|
|
331
|
-
catch {
|
|
332
|
-
// Log reads are best-effort; failed closes cannot be surfaced to callers.
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
293
|
function createLocalCoreRuntimeState(options) {
|
|
338
294
|
return new FileBackedLocalCoreRuntimeState(options.userDataPath, options.onLog);
|
|
339
295
|
}
|
|
@@ -23,6 +23,9 @@ function parseLocalAiCoreRoute(method, path) {
|
|
|
23
23
|
if (normalizedMethod === 'GET' && relativePath === '/runtime/logs') {
|
|
24
24
|
return { name: 'runtime.logs' };
|
|
25
25
|
}
|
|
26
|
+
if (normalizedMethod === 'GET' && relativePath === '/logs') {
|
|
27
|
+
return { name: 'logs.list' };
|
|
28
|
+
}
|
|
26
29
|
if (normalizedMethod === 'GET' && relativePath === '/runtime/agent-runtimes') {
|
|
27
30
|
return { name: 'runtime.agent-runtimes' };
|
|
28
31
|
}
|
|
@@ -143,6 +143,20 @@ class LocalAiCoreServer {
|
|
|
143
143
|
json(res, 200, this.bindings.getLogs(limit));
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
|
+
case 'logs.list': {
|
|
147
|
+
const level = url.searchParams.get('level') || 'sys';
|
|
148
|
+
const limit = Number(url.searchParams.get('limit') || '200');
|
|
149
|
+
json(res, 200, {
|
|
150
|
+
entries: this.bindings.getLogEntries(level, limit).map((entry) => ({
|
|
151
|
+
time: entry.ts,
|
|
152
|
+
level: entry.level,
|
|
153
|
+
scope: entry.scope,
|
|
154
|
+
message: entry.message,
|
|
155
|
+
meta: entry.meta,
|
|
156
|
+
})),
|
|
157
|
+
});
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
146
160
|
case 'runtime.agent-runtimes':
|
|
147
161
|
case 'runtimes.list':
|
|
148
162
|
json(res, 200, await this.runtimeDetectionResponse());
|