@kafca/agentdock 0.1.25 → 0.1.27
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 +1 -0
- package/dist/renderer/assets/{Badge-Bn2h-Qkf.js → Badge-DQ08JYYn.js} +1 -1
- package/dist/renderer/assets/{Chat-Cgo9aneg.js → Chat-BIiYTa43.js} +1 -1
- package/dist/renderer/assets/{ChatMarkdown-CYzHfSiR.js → ChatMarkdown-ZDQtUMi8.js} +1 -1
- package/dist/renderer/assets/{Config-DljB2-eP.js → Config-fKb09gkV.js} +1 -1
- package/dist/renderer/assets/{CronList-DeVbiY9a.js → CronList-CN53SBez.js} +1 -1
- package/dist/renderer/assets/{Dashboard-fSqx5sm8.js → Dashboard-B0Yap4m6.js} +2 -2
- package/dist/renderer/assets/{EmptyState-DgqKDwlq.js → EmptyState-D5ZGA0rk.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-u8s2SmPV.js → KnowledgeDetail-CE5Ajepr.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-BdQw8nbY.js → KnowledgeHome-5a_kCXgU.js} +1 -1
- package/dist/renderer/assets/{Logs-DSbndMpy.js → Logs-uKKWMLFZ.js} +1 -1
- package/dist/renderer/assets/{Modal-0d0EmAuK.js → Modal-Dd9JhtQ0.js} +1 -1
- package/dist/renderer/assets/{Page-CVbOH_Kh.js → Page-BKLPuVQM.js} +1 -1
- package/dist/renderer/assets/{ProjectDetail-C91tF7uA.js → ProjectDetail-C8gFzvH_.js} +1 -1
- package/dist/renderer/assets/{ProjectList-D78Pc-BQ.js → ProjectList-CXk3dMu_.js} +1 -1
- package/dist/renderer/assets/{Select-BbKzAIuO.js → Select-DB5PGz8e.js} +1 -1
- package/dist/renderer/assets/{SessionChat-BERvL5e4.js → SessionChat-DumN9Ty3.js} +1 -1
- package/dist/renderer/assets/{SessionList-Bomz335M.js → SessionList-Cu5kPOxP.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-CLr3amU2.js → ThreadChat-ru807VqH.js} +1 -1
- package/dist/renderer/assets/{Workspace-In91z4W2.js → Workspace-DWcMBl5r.js} +1 -1
- package/dist/renderer/assets/{arrow-left-FBnVKKBl.js → arrow-left-Q025lHNq.js} +1 -1
- package/dist/renderer/assets/{book-open-4_CuP6Sa.js → book-open-mUQUDLh5.js} +1 -1
- package/dist/renderer/assets/{check-vsoVjvac.js → check-ByINMPna.js} +1 -1
- package/dist/renderer/assets/{chevron-down-DFpmFTJW.js → chevron-down-Blmwp-nN.js} +1 -1
- package/dist/renderer/assets/{circle-vRULegER.js → circle-BkvRVWGX.js} +1 -1
- package/dist/renderer/assets/{desktop-ul0Tpzyc.js → desktop-BzWqZMbk.js} +1 -1
- package/dist/renderer/assets/{funnel-Gu0E_hJ_.js → funnel-Cuwc5I2B.js} +1 -1
- package/dist/renderer/assets/{heart-DsdofOHf.js → heart-2tbx0mrd.js} +1 -1
- package/dist/renderer/assets/{index-BD3aCyBa.js → index-BTAl8hYv.js} +2 -2
- package/dist/renderer/assets/{index-pJUFobU7.js → index-DqU6J2AY.js} +1 -1
- package/dist/renderer/assets/{pencil-DbKmV8nD.js → pencil-BWKBGhOm.js} +1 -1
- package/dist/renderer/assets/{play-BDMsRxSm.js → play-OezKUkaH.js} +1 -1
- package/dist/renderer/assets/{plug-t2dMl78-.js → plug-DyNXq963.js} +1 -1
- package/dist/renderer/assets/{plus-BUb6zOAe.js → plus-CvLYqMSE.js} +1 -1
- package/dist/renderer/assets/projects-C4VoB4se.js +1 -0
- package/dist/renderer/assets/{save-C-_5rQdv.js → save-59vRfz-l.js} +1 -1
- package/dist/renderer/assets/{search-R3ekHFPM.js → search-D1h9ECCh.js} +1 -1
- package/dist/renderer/assets/{server-BTuvHf5n.js → server-BXnqzaxz.js} +1 -1
- package/dist/renderer/assets/{session-utils-ClX6VPFG.js → session-utils-BNlJyXg0.js} +1 -1
- package/dist/renderer/assets/{sessions-AFKIC-ub.js → sessions-Ctb3Ta0D.js} +1 -1
- package/dist/renderer/assets/{shield-check-CqMW8CHe.js → shield-check-CRHdsNpf.js} +1 -1
- package/dist/renderer/assets/{trash-2-BNLcHyUw.js → trash-2-BVq2TEtl.js} +1 -1
- package/dist/renderer/assets/{user-BCCN8FYK.js → user-CRRZk-V5.js} +1 -1
- package/dist/renderer/assets/{wifi-off-BsNsx3oX.js → wifi-off-LF_KkdXM.js} +1 -1
- package/dist/renderer/index.html +1 -1
- package/dist-electron/electron/local-core-refactor.test.js +244 -19
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +33 -34
- package/dist-electron/services/local-ai-core/src/channel/lark/runtime-state.js +98 -19
- package/package.json +1 -1
- package/dist/renderer/assets/projects-4F6D_Q8t.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-BD3aCyBa.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-BTAl8hYv.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-BTAl8hYv.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-BTAl8hYv.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,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-BTAl8hYv.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-DFiJR0vv.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="bg-[#f5f5f7] dark:bg-[#151516]">
|
|
@@ -1176,7 +1176,7 @@ const server_routes_js_1 = require("../services/local-ai-core/src/runtime/server
|
|
|
1176
1176
|
(0, node_fs_1.rmSync)(userDataPath, { recursive: true, force: true });
|
|
1177
1177
|
}
|
|
1178
1178
|
});
|
|
1179
|
-
(0, node_test_1.default)('lark bridge
|
|
1179
|
+
(0, node_test_1.default)('lark bridge sends completed thought once before final answer', async () => {
|
|
1180
1180
|
const createdCards = [];
|
|
1181
1181
|
const patchedCards = [];
|
|
1182
1182
|
const storedMessageIds = [];
|
|
@@ -1256,14 +1256,12 @@ const server_routes_js_1 = require("../services/local-ai-core/src/runtime/server
|
|
|
1256
1256
|
content: '最终回答',
|
|
1257
1257
|
});
|
|
1258
1258
|
strict_1.default.equal(createdCards.length, 2);
|
|
1259
|
-
strict_1.default.equal(createdCards[0]?.text, '💭
|
|
1259
|
+
strict_1.default.equal(createdCards[0]?.text, '💭 先理解问题,再检查代码');
|
|
1260
1260
|
strict_1.default.equal(createdCards[1]?.text, '最终回答');
|
|
1261
|
-
strict_1.default.equal(patchedCards.length,
|
|
1262
|
-
strict_1.default.equal(patchedCards[0]?.messageId, 'lark-msg-1');
|
|
1263
|
-
strict_1.default.equal(patchedCards[0]?.text, '💭 先理解问题,再检查代码');
|
|
1261
|
+
strict_1.default.equal(patchedCards.length, 0);
|
|
1264
1262
|
strict_1.default.deepEqual(storedMessageIds, ['lark-msg-2']);
|
|
1265
1263
|
});
|
|
1266
|
-
(0, node_test_1.default)('lark bridge sends final reply as
|
|
1264
|
+
(0, node_test_1.default)('lark bridge sends final reply as its own card instead of streaming draft', async () => {
|
|
1267
1265
|
const createdCards = [];
|
|
1268
1266
|
const patchedCards = [];
|
|
1269
1267
|
const storedMessageIds = [];
|
|
@@ -1334,11 +1332,215 @@ const server_routes_js_1 = require("../services/local-ai-core/src/runtime/server
|
|
|
1334
1332
|
replyCtx: 'run-1',
|
|
1335
1333
|
content: '真正最终回答',
|
|
1336
1334
|
});
|
|
1337
|
-
strict_1.default.deepEqual(createdCards.map((card) => card.text), ['
|
|
1338
|
-
strict_1.default.
|
|
1339
|
-
strict_1.default.deepEqual(storedMessageIds, ['lark-msg-1'
|
|
1335
|
+
strict_1.default.deepEqual(createdCards.map((card) => card.text), ['真正最终回答']);
|
|
1336
|
+
strict_1.default.deepEqual(patchedCards, []);
|
|
1337
|
+
strict_1.default.deepEqual(storedMessageIds, ['lark-msg-1']);
|
|
1338
|
+
});
|
|
1339
|
+
(0, node_test_1.default)('lark bridge sends tool and final as separate cards without patching tool progress', async () => {
|
|
1340
|
+
const createdCards = [];
|
|
1341
|
+
const patchedCards = [];
|
|
1342
|
+
const storedMessageIds = [];
|
|
1343
|
+
const client = {
|
|
1344
|
+
im: {
|
|
1345
|
+
message: {
|
|
1346
|
+
create: async (request) => {
|
|
1347
|
+
const messageId = `lark-msg-${createdCards.length + 1}`;
|
|
1348
|
+
const card = JSON.parse(String(request.data.content || '{}'));
|
|
1349
|
+
createdCards.push({
|
|
1350
|
+
messageId,
|
|
1351
|
+
text: String(card.elements?.[0]?.content || ''),
|
|
1352
|
+
});
|
|
1353
|
+
return { data: { message_id: messageId } };
|
|
1354
|
+
},
|
|
1355
|
+
patch: async (request) => {
|
|
1356
|
+
const card = JSON.parse(String(request.data.content || '{}'));
|
|
1357
|
+
patchedCards.push({
|
|
1358
|
+
messageId: String(request.path.message_id || ''),
|
|
1359
|
+
text: String(card.elements?.[0]?.content || ''),
|
|
1360
|
+
});
|
|
1361
|
+
},
|
|
1362
|
+
},
|
|
1363
|
+
},
|
|
1364
|
+
};
|
|
1365
|
+
const gateway = new local_core_lark_gateway_js_1.LocalCoreLarkGateway({
|
|
1366
|
+
store: {
|
|
1367
|
+
getPlatformThreadBinding: () => ({
|
|
1368
|
+
workspace_id: 'default',
|
|
1369
|
+
platform: 'lark',
|
|
1370
|
+
chat_id: 'chat-1',
|
|
1371
|
+
platform_user_id: 'user-1',
|
|
1372
|
+
thread_id: 'thread-1',
|
|
1373
|
+
last_platform_message_id: null,
|
|
1374
|
+
}),
|
|
1375
|
+
updatePlatformThreadMessageId: (_workspaceId, _chatId, _platformUserId, messageId) => {
|
|
1376
|
+
storedMessageIds.push(messageId);
|
|
1377
|
+
},
|
|
1378
|
+
},
|
|
1379
|
+
readConfig: async () => null,
|
|
1380
|
+
getWorkspaceRouter: () => ({}),
|
|
1381
|
+
eventBus: { emit: () => { }, on: () => () => { } },
|
|
1382
|
+
});
|
|
1383
|
+
const internals = gateway;
|
|
1384
|
+
internals.runtime.set('default', {
|
|
1385
|
+
workspaceId: 'default',
|
|
1386
|
+
enabled: true,
|
|
1387
|
+
status: 'running',
|
|
1388
|
+
connected: true,
|
|
1389
|
+
appId: 'app-1',
|
|
1390
|
+
client,
|
|
1391
|
+
});
|
|
1392
|
+
internals.threadRouting.set('session:thread-1', {
|
|
1393
|
+
workspaceId: 'default',
|
|
1394
|
+
platformUserId: 'user-1',
|
|
1395
|
+
chatId: 'chat-1',
|
|
1396
|
+
threadId: 'thread-1',
|
|
1397
|
+
});
|
|
1398
|
+
await gateway.onBridgeEvent({
|
|
1399
|
+
type: 'update_message',
|
|
1400
|
+
sessionKey: 'session:thread-1',
|
|
1401
|
+
replyCtx: 'run-1',
|
|
1402
|
+
content: '好的,文件存在,现在发送给你:已',
|
|
1403
|
+
});
|
|
1404
|
+
await gateway.onBridgeEvent({
|
|
1405
|
+
type: 'reply',
|
|
1406
|
+
sessionKey: 'session:thread-1',
|
|
1407
|
+
replyCtx: 'run-1',
|
|
1408
|
+
messageId: 'tool-1',
|
|
1409
|
+
content: '🔧 bash: completed - Sent file CLAUDE.md to chat-1: msg-file-1',
|
|
1410
|
+
});
|
|
1411
|
+
await gateway.onBridgeEvent({
|
|
1412
|
+
type: 'reply',
|
|
1413
|
+
sessionKey: 'session:thread-1',
|
|
1414
|
+
replyCtx: 'run-1',
|
|
1415
|
+
content: '好的,文件存在,现在发送给你:已发送!`CLAUDE.md` 文件已经发出去了,请查收',
|
|
1416
|
+
});
|
|
1417
|
+
strict_1.default.deepEqual(createdCards.map((card) => card.text), [
|
|
1418
|
+
'🔧 bash',
|
|
1419
|
+
'好的,文件存在,现在发送给你:已发送!`CLAUDE.md` 文件已经发出去了,请查收',
|
|
1420
|
+
]);
|
|
1421
|
+
strict_1.default.deepEqual(patchedCards, []);
|
|
1422
|
+
strict_1.default.deepEqual(storedMessageIds, ['lark-msg-2']);
|
|
1423
|
+
});
|
|
1424
|
+
(0, node_test_1.default)('lark bridge flushes interleaved thought segments before tools and final', async () => {
|
|
1425
|
+
const createdCards = [];
|
|
1426
|
+
const patchedCards = [];
|
|
1427
|
+
const storedMessageIds = [];
|
|
1428
|
+
const client = {
|
|
1429
|
+
im: {
|
|
1430
|
+
message: {
|
|
1431
|
+
create: async (request) => {
|
|
1432
|
+
const messageId = `lark-msg-${createdCards.length + 1}`;
|
|
1433
|
+
const card = JSON.parse(String(request.data.content || '{}'));
|
|
1434
|
+
createdCards.push({
|
|
1435
|
+
messageId,
|
|
1436
|
+
text: String(card.elements?.[0]?.content || ''),
|
|
1437
|
+
});
|
|
1438
|
+
return { data: { message_id: messageId } };
|
|
1439
|
+
},
|
|
1440
|
+
patch: async (request) => {
|
|
1441
|
+
const card = JSON.parse(String(request.data.content || '{}'));
|
|
1442
|
+
patchedCards.push({
|
|
1443
|
+
messageId: String(request.path.message_id || ''),
|
|
1444
|
+
text: String(card.elements?.[0]?.content || ''),
|
|
1445
|
+
});
|
|
1446
|
+
},
|
|
1447
|
+
},
|
|
1448
|
+
},
|
|
1449
|
+
};
|
|
1450
|
+
const gateway = new local_core_lark_gateway_js_1.LocalCoreLarkGateway({
|
|
1451
|
+
store: {
|
|
1452
|
+
getPlatformThreadBinding: () => ({
|
|
1453
|
+
workspace_id: 'default',
|
|
1454
|
+
platform: 'lark',
|
|
1455
|
+
chat_id: 'chat-1',
|
|
1456
|
+
platform_user_id: 'user-1',
|
|
1457
|
+
thread_id: 'thread-1',
|
|
1458
|
+
last_platform_message_id: 'old-message',
|
|
1459
|
+
}),
|
|
1460
|
+
updatePlatformThreadMessageId: (_workspaceId, _chatId, _platformUserId, messageId) => {
|
|
1461
|
+
storedMessageIds.push(messageId);
|
|
1462
|
+
},
|
|
1463
|
+
},
|
|
1464
|
+
readConfig: async () => null,
|
|
1465
|
+
getWorkspaceRouter: () => ({}),
|
|
1466
|
+
eventBus: { emit: () => { }, on: () => () => { } },
|
|
1467
|
+
});
|
|
1468
|
+
const internals = gateway;
|
|
1469
|
+
internals.runtime.set('default', {
|
|
1470
|
+
workspaceId: 'default',
|
|
1471
|
+
enabled: true,
|
|
1472
|
+
status: 'running',
|
|
1473
|
+
connected: true,
|
|
1474
|
+
appId: 'app-1',
|
|
1475
|
+
client,
|
|
1476
|
+
});
|
|
1477
|
+
internals.threadRouting.set('session:thread-1', {
|
|
1478
|
+
workspaceId: 'default',
|
|
1479
|
+
platformUserId: 'user-1',
|
|
1480
|
+
chatId: 'chat-1',
|
|
1481
|
+
threadId: 'thread-1',
|
|
1482
|
+
});
|
|
1483
|
+
await gateway.onBridgeEvent({
|
|
1484
|
+
type: 'preview_start',
|
|
1485
|
+
sessionKey: 'session:thread-1',
|
|
1486
|
+
replyCtx: 'run-1',
|
|
1487
|
+
previewHandle: 'thought-preview-1',
|
|
1488
|
+
content: '💭 先理解',
|
|
1489
|
+
});
|
|
1490
|
+
await gateway.onBridgeEvent({
|
|
1491
|
+
type: 'update_message',
|
|
1492
|
+
sessionKey: 'session:thread-1',
|
|
1493
|
+
replyCtx: 'run-1',
|
|
1494
|
+
previewHandle: 'thought-preview-1',
|
|
1495
|
+
content: '💭 先理解用户需求',
|
|
1496
|
+
});
|
|
1497
|
+
await gateway.onBridgeEvent({
|
|
1498
|
+
type: 'reply',
|
|
1499
|
+
sessionKey: 'session:thread-1',
|
|
1500
|
+
replyCtx: 'run-1',
|
|
1501
|
+
messageId: 'run-1-tool-1',
|
|
1502
|
+
content: '🔧 Terminal: config - running',
|
|
1503
|
+
toolCall: {
|
|
1504
|
+
id: 'call-1',
|
|
1505
|
+
name: 'Terminal',
|
|
1506
|
+
input: { command: 'uname -a', description: 'Get system info' },
|
|
1507
|
+
},
|
|
1508
|
+
});
|
|
1509
|
+
await gateway.onBridgeEvent({
|
|
1510
|
+
type: 'reply',
|
|
1511
|
+
sessionKey: 'session:thread-1',
|
|
1512
|
+
replyCtx: 'run-1',
|
|
1513
|
+
messageId: 'run-1-tool-1',
|
|
1514
|
+
content: '🔧 Terminal: config - completed - Linux',
|
|
1515
|
+
toolCall: {
|
|
1516
|
+
id: 'call-1',
|
|
1517
|
+
name: 'Terminal',
|
|
1518
|
+
input: { command: 'uname -a', description: 'Get system info' },
|
|
1519
|
+
},
|
|
1520
|
+
});
|
|
1521
|
+
await gateway.onBridgeEvent({
|
|
1522
|
+
type: 'update_message',
|
|
1523
|
+
sessionKey: 'session:thread-1',
|
|
1524
|
+
replyCtx: 'run-1',
|
|
1525
|
+
previewHandle: 'thought-preview-1',
|
|
1526
|
+
content: '💭 看到了 Linux',
|
|
1527
|
+
});
|
|
1528
|
+
await gateway.onBridgeEvent({
|
|
1529
|
+
type: 'reply',
|
|
1530
|
+
sessionKey: 'session:thread-1',
|
|
1531
|
+
replyCtx: 'run-1',
|
|
1532
|
+
content: '最终回答',
|
|
1533
|
+
});
|
|
1534
|
+
strict_1.default.deepEqual(createdCards.map((card) => card.text), [
|
|
1535
|
+
'💭 先理解用户需求',
|
|
1536
|
+
'🔧 Terminal\n\n参数:`{"command":"uname -a","description":"Get system info"}`',
|
|
1537
|
+
'💭 看到了 Linux',
|
|
1538
|
+
'最终回答',
|
|
1539
|
+
]);
|
|
1540
|
+
strict_1.default.deepEqual(patchedCards, []);
|
|
1541
|
+
strict_1.default.deepEqual(storedMessageIds, ['lark-msg-4']);
|
|
1340
1542
|
});
|
|
1341
|
-
(0, node_test_1.default)('lark bridge does not
|
|
1543
|
+
(0, node_test_1.default)('lark bridge does not stream thought updates before completion', async () => {
|
|
1342
1544
|
const createdCards = [];
|
|
1343
1545
|
const patchedCards = [];
|
|
1344
1546
|
const client = {
|
|
@@ -1425,10 +1627,8 @@ const server_routes_js_1 = require("../services/local-ai-core/src/runtime/server
|
|
|
1425
1627
|
sessionKey: 'session:thread-1',
|
|
1426
1628
|
replyCtx: 'run-1',
|
|
1427
1629
|
});
|
|
1428
|
-
strict_1.default.deepEqual(createdCards.map((card) => card.text), ['💭 The user']);
|
|
1429
|
-
strict_1.default.deepEqual(patchedCards.map((card) => card.text), [
|
|
1430
|
-
'💭 The user sent a short casual message.',
|
|
1431
|
-
]);
|
|
1630
|
+
strict_1.default.deepEqual(createdCards.map((card) => card.text), ['💭 The user sent a short casual message. I should reply briefly.']);
|
|
1631
|
+
strict_1.default.deepEqual(patchedCards.map((card) => card.text), []);
|
|
1432
1632
|
strict_1.default.ok(!createdCards.some((card) => /处理中|正在思考/.test(card.text)));
|
|
1433
1633
|
});
|
|
1434
1634
|
(0, node_test_1.default)('lark permission requests render as clickable card buttons', async () => {
|
|
@@ -1627,6 +1827,7 @@ const server_routes_js_1 = require("../services/local-ai-core/src/runtime/server
|
|
|
1627
1827
|
previewText: '',
|
|
1628
1828
|
finalText: '',
|
|
1629
1829
|
thinkingSteps: [],
|
|
1830
|
+
thoughtSegmentSequence: 0,
|
|
1630
1831
|
toolCalls: [],
|
|
1631
1832
|
statusLines: [],
|
|
1632
1833
|
buttonRows: [[{ text: '始终允许', data: 'allow all' }]],
|
|
@@ -1653,7 +1854,7 @@ const server_routes_js_1 = require("../services/local-ai-core/src/runtime/server
|
|
|
1653
1854
|
strict_1.default.equal(createdCards.length, 1);
|
|
1654
1855
|
strict_1.default.match(createdCards[0]?.card?.elements?.[0]?.content || '', /桌面文件列表/);
|
|
1655
1856
|
});
|
|
1656
|
-
(0, node_test_1.default)('lark channel
|
|
1857
|
+
(0, node_test_1.default)('lark channel sends tool name and parameters once without streaming output', async () => {
|
|
1657
1858
|
const createdCards = [];
|
|
1658
1859
|
const patchedCards = [];
|
|
1659
1860
|
const client = {
|
|
@@ -1704,10 +1905,34 @@ const server_routes_js_1 = require("../services/local-ai-core/src/runtime/server
|
|
|
1704
1905
|
sessionKey: 'session:thread-1',
|
|
1705
1906
|
replyCtx: 'run-1',
|
|
1706
1907
|
messageId: 'tool-1',
|
|
1707
|
-
content: '🔧 Terminal
|
|
1908
|
+
content: '🔧 Terminal',
|
|
1909
|
+
toolCall: {
|
|
1910
|
+
id: 'tool-1',
|
|
1911
|
+
name: 'Terminal',
|
|
1912
|
+
status: 'running',
|
|
1913
|
+
input: { command: 'ls ~/Desktop' },
|
|
1914
|
+
output: '',
|
|
1915
|
+
},
|
|
1916
|
+
});
|
|
1917
|
+
await gateway.onBridgeEvent({
|
|
1918
|
+
type: 'reply',
|
|
1919
|
+
sessionKey: 'session:thread-1',
|
|
1920
|
+
replyCtx: 'run-1',
|
|
1921
|
+
messageId: 'tool-1',
|
|
1922
|
+
content: '🔧 Terminal: ls ~/Desktop - completed - secret terminal output',
|
|
1923
|
+
toolCall: {
|
|
1924
|
+
id: 'tool-1',
|
|
1925
|
+
name: 'Terminal',
|
|
1926
|
+
status: 'completed',
|
|
1927
|
+
input: { command: 'ls ~/Desktop' },
|
|
1928
|
+
output: 'secret terminal output',
|
|
1929
|
+
},
|
|
1708
1930
|
});
|
|
1709
|
-
const text = createdCards[0]?.elements?.[0]?.content ||
|
|
1710
|
-
strict_1.default.match(text,
|
|
1931
|
+
const text = createdCards[0]?.elements?.[0]?.content || '';
|
|
1932
|
+
strict_1.default.match(text, /🔧 Terminal/);
|
|
1933
|
+
strict_1.default.match(text, /参数:`\{"command":"ls ~\/Desktop"\}`/);
|
|
1934
|
+
strict_1.default.equal(patchedCards.length, 0);
|
|
1935
|
+
strict_1.default.doesNotMatch(text, /completed/);
|
|
1711
1936
|
strict_1.default.doesNotMatch(text, /secret terminal output/);
|
|
1712
1937
|
});
|
|
1713
1938
|
(0, node_test_1.default)('lark card action message id can be extracted from full callback payload', async () => {
|
|
@@ -2376,7 +2601,7 @@ const server_routes_js_1 = require("../services/local-ai-core/src/runtime/server
|
|
|
2376
2601
|
previewHandle: 'tool-1',
|
|
2377
2602
|
content: '🔧 bash: Tool update - completed - verbose output',
|
|
2378
2603
|
});
|
|
2379
|
-
strict_1.default.equal(completed.text, '🔧 bash: Tool update
|
|
2604
|
+
strict_1.default.equal(completed.text, '🔧 bash: Tool update');
|
|
2380
2605
|
});
|
|
2381
2606
|
(0, node_test_1.default)('ACP skips empty generic running tool updates', () => {
|
|
2382
2607
|
const appended = [];
|
|
@@ -471,34 +471,39 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
471
471
|
return;
|
|
472
472
|
}
|
|
473
473
|
this.consumeBridgeEvent(turn, event);
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
474
|
+
const renderedMessages = (0, runtime_state_js_1.renderLarkBridgeEventMessages)(turn, event);
|
|
475
|
+
for (const renderedMessage of renderedMessages) {
|
|
476
|
+
if (!renderedMessage.text && renderedMessage.buttonRows.length === 0) {
|
|
477
|
+
this.options.log?.(`localcore-lark bridge event produced empty render for sessionKey=${sessionKey} type=${event.type}`);
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
const existingMessageId = (0, runtime_state_js_1.getLarkRenderedMessageId)(turn, renderedMessage);
|
|
481
|
+
const shouldThrottle = event.type === 'update_message' &&
|
|
482
|
+
existingMessageId &&
|
|
483
|
+
Date.now() - (turn.lastPatchedAtByMessageId[existingMessageId] || 0) < (renderedMessage.isFinal ? LARK_FINAL_PATCH_INTERVAL_MS : LARK_PROGRESS_PATCH_INTERVAL_MS);
|
|
484
|
+
this.options.log?.(`localcore-lark bridge event type=${event.type} sessionKey=${sessionKey} hasMessageId=${Boolean(existingMessageId)} throttle=${shouldThrottle}`);
|
|
485
|
+
if (shouldThrottle) {
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
if (existingMessageId && renderedMessage.updatePolicy === 'create-only') {
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
if (!existingMessageId) {
|
|
492
|
+
const createdId = await this.sendTextAsCard(state, route.chatId, renderedMessage.text, renderedMessage.buttonRows, sessionKey, binding.thread_id);
|
|
493
|
+
if (createdId) {
|
|
494
|
+
(0, runtime_state_js_1.setLarkRenderedMessageId)(turn, renderedMessage, createdId);
|
|
495
|
+
if (renderedMessage.isFinal) {
|
|
496
|
+
this.options.store.updatePlatformThreadMessageId(route.workspaceId, route.chatId, route.platformUserId, createdId, routePlatformKey);
|
|
497
|
+
}
|
|
498
|
+
this.options.log?.(`localcore-lark sent new card message ${createdId} for sessionKey=${sessionKey}`);
|
|
493
499
|
}
|
|
494
|
-
|
|
500
|
+
continue;
|
|
495
501
|
}
|
|
496
|
-
|
|
502
|
+
await this.patchTextCard(state, existingMessageId, renderedMessage.text, renderedMessage.buttonRows, sessionKey, binding.thread_id);
|
|
503
|
+
turn.lastPatchedAt = Date.now();
|
|
504
|
+
turn.lastPatchedAtByMessageId[existingMessageId] = turn.lastPatchedAt;
|
|
505
|
+
this.options.log?.(`localcore-lark patched card message ${existingMessageId} for sessionKey=${sessionKey}`);
|
|
497
506
|
}
|
|
498
|
-
await this.patchTextCard(state, existingMessageId, rendered.text, rendered.buttonRows, sessionKey, binding.thread_id);
|
|
499
|
-
turn.lastPatchedAt = Date.now();
|
|
500
|
-
turn.lastPatchedAtByMessageId[existingMessageId] = turn.lastPatchedAt;
|
|
501
|
-
this.options.log?.(`localcore-lark patched card message ${existingMessageId} for sessionKey=${sessionKey}`);
|
|
502
507
|
}
|
|
503
508
|
catch (error) {
|
|
504
509
|
this.options.log?.(`localcore-lark bridge send failed for sessionKey=${sessionKey}: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -1195,18 +1200,12 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
1195
1200
|
getOrCreateTurnState(sessionKey, messageId) {
|
|
1196
1201
|
const existing = this.outboundTurns.get(sessionKey);
|
|
1197
1202
|
if (existing) {
|
|
1198
|
-
if (messageId && !existing.
|
|
1199
|
-
existing.
|
|
1200
|
-
existing.finalMessageId = messageId;
|
|
1203
|
+
if (messageId && !existing.sourceMessageId) {
|
|
1204
|
+
existing.sourceMessageId = messageId;
|
|
1201
1205
|
}
|
|
1202
1206
|
return existing;
|
|
1203
1207
|
}
|
|
1204
|
-
|
|
1205
|
-
if (messageId) {
|
|
1206
|
-
turn.messageId = messageId;
|
|
1207
|
-
turn.finalMessageId = messageId;
|
|
1208
|
-
}
|
|
1209
|
-
return turn;
|
|
1208
|
+
return this.createTurnState(sessionKey, messageId);
|
|
1210
1209
|
}
|
|
1211
1210
|
consumeBridgeEvent(turn, event) {
|
|
1212
1211
|
(0, runtime_state_js_1.consumeLarkBridgeEvent)(turn, event, {
|