@kafca/agentdock 0.1.43 → 0.1.44
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 +6 -0
- package/dist/renderer/assets/{Badge-CbG6yRSm.js → Badge-Qk9qHovH.js} +1 -1
- package/dist/renderer/assets/{Chat-BvNNWGGX.js → Chat-BK-fm0Xr.js} +1 -1
- package/dist/renderer/assets/{ChatMarkdown-Ct-PvJB8.js → ChatMarkdown-BKdW8OON.js} +1 -1
- package/dist/renderer/assets/{Config-lQX2qVVV.js → Config-B93CQGvY.js} +1 -1
- package/dist/renderer/assets/{CronList-Dj_3muVG.js → CronList-Z3TvSRKP.js} +1 -1
- package/dist/renderer/assets/{Dashboard-eh_RhGYb.js → Dashboard-Ch3QkWwf.js} +2 -2
- package/dist/renderer/assets/{EmptyState-Bn2Qh14U.js → EmptyState-kD9yAwtw.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-Bsz6Ou41.js → KnowledgeDetail-BAMCLrjz.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-Cgj4XFXn.js → KnowledgeHome-ChvjOfrc.js} +1 -1
- package/dist/renderer/assets/{Logs-Dp-NF6GN.js → Logs-Cv0nth3j.js} +1 -1
- package/dist/renderer/assets/{Modal-B6YPPBN6.js → Modal-DwY4lecS.js} +1 -1
- package/dist/renderer/assets/{MonitorList-xEZWg460.js → MonitorList-JEvMoWUm.js} +1 -1
- package/dist/renderer/assets/{Page-Bn7RjGOS.js → Page-CnB9ePsb.js} +1 -1
- package/dist/renderer/assets/{ProjectDetail-Cv_jIE61.js → ProjectDetail-DJa3sMmU.js} +1 -1
- package/dist/renderer/assets/{ProjectList-BDk5_gqY.js → ProjectList-D6CXumR_.js} +1 -1
- package/dist/renderer/assets/{Select-xshfMIEQ.js → Select-zfoksLGB.js} +1 -1
- package/dist/renderer/assets/{SessionChat-BkHy90z3.js → SessionChat-DUTh4WoM.js} +1 -1
- package/dist/renderer/assets/{SessionList-BZyXT92L.js → SessionList-D9o-lUst.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-DUOIyXrS.js → ThreadChat-BYXlT-Kc.js} +1 -1
- package/dist/renderer/assets/{Workspace-Dl80fNEC.js → Workspace-BrhSwRQ-.js} +1 -1
- package/dist/renderer/assets/{arrow-left-C54ZI-AS.js → arrow-left-CNEAuElg.js} +1 -1
- package/dist/renderer/assets/{book-open-Dl7GO0zn.js → book-open-BNJMhNI-.js} +1 -1
- package/dist/renderer/assets/{check-CiqgtrOL.js → check-BnclClRU.js} +1 -1
- package/dist/renderer/assets/{chevron-down-DTL2OuVh.js → chevron-down-Bh53e0O-.js} +1 -1
- package/dist/renderer/assets/{circle-DaVKfa3P.js → circle-ClZTWCWO.js} +1 -1
- package/dist/renderer/assets/{desktop-jaAiayNB.js → desktop-C5vBT0yM.js} +1 -1
- package/dist/renderer/assets/{funnel-CrmnLMJI.js → funnel-_5hsz0xI.js} +1 -1
- package/dist/renderer/assets/{heart-BMfQI7y_.js → heart-u4Q1aOqj.js} +1 -1
- package/dist/renderer/assets/{index-HPNb1zfx.js → index-B36eowj-.js} +2 -2
- package/dist/renderer/assets/{index-nreiKY1f.js → index-BNFx4uYv.js} +1 -1
- package/dist/renderer/assets/{pencil-wTQ4l465.js → pencil-DLh9QNmT.js} +1 -1
- package/dist/renderer/assets/{play-BK--MXmw.js → play-BDTk9Scm.js} +1 -1
- package/dist/renderer/assets/{plug-BIx9fjip.js → plug-BG0JHW6B.js} +1 -1
- package/dist/renderer/assets/{plus-Dn7JFWQ8.js → plus-BSc8POsz.js} +1 -1
- package/dist/renderer/assets/projects-DwfZwxDW.js +1 -0
- package/dist/renderer/assets/{save-CC3zOSWb.js → save-D5AO_G6a.js} +1 -1
- package/dist/renderer/assets/{search-CDTy9Czu.js → search-CniPk7Ey.js} +1 -1
- package/dist/renderer/assets/{server-DtQk3t2a.js → server-GsXyQAZm.js} +1 -1
- package/dist/renderer/assets/{session-utils-4ep5D66T.js → session-utils-BDxzgTBC.js} +1 -1
- package/dist/renderer/assets/{sessions-Dor1LteH.js → sessions-CLcKA1Tt.js} +1 -1
- package/dist/renderer/assets/{shield-check-Cz2LpU6r.js → shield-check-4i0E3hmf.js} +1 -1
- package/dist/renderer/assets/{trash-2-C2EmWFZV.js → trash-2-DhtOCsO5.js} +1 -1
- package/dist/renderer/assets/{user-I8B-cs5A.js → user-BtC_pVXV.js} +1 -1
- package/dist/renderer/assets/{wifi-off-CPevTQJn.js → wifi-off-BHPzPY_B.js} +1 -1
- package/dist/renderer/index.html +1 -1
- package/dist-electron/services/local-ai-core/src/channel/lark/config.js +2 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/inbound.js +114 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +52 -65
- package/dist-electron/services/local-ai-core/src/channel/shared/thread-routing.js +34 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +12 -18
- package/dist-electron/tests/integration/channel-gateways.test.js +32 -0
- package/dist-electron/tests/integration/lark-gateway.test.js +1918 -0
- package/dist-electron/tests/integration/local-core-acp-progress.test.js +1772 -0
- package/dist-electron/tests/integration/local-core-refactor.test.js +0 -4544
- package/dist-electron/tests/integration/local-core-routes.test.js +204 -0
- package/dist-electron/tests/integration/weixin-gateway.test.js +927 -0
- package/package.json +1 -1
- package/dist/renderer/assets/projects-brJZgwEJ.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{H as Le,aQ as Ne,r as c,j as x,aR as pe,aS as Ae,aG as te}from"./index-HPNb1zfx.js";var ye=Ne();const De=Le(ye);function H(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Jt(e,t){const n=c.createContext(t),r=i=>{const{children:s,...a}=i,h=c.useMemo(()=>a,Object.values(a));return x.jsx(n.Provider,{value:h,children:s})};r.displayName=e+"Provider";function o(i){const s=c.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function en(e,t=[]){let n=[];function r(i,s){const a=c.createContext(s),h=n.length;n=[...n,s];const l=d=>{var p;const{scope:v,children:y,...w}=d,u=((p=v==null?void 0:v[e])==null?void 0:p[h])||a,m=c.useMemo(()=>w,Object.values(w));return x.jsx(u.Provider,{value:m,children:y})};l.displayName=i+"Provider";function f(d,v){var u;const y=((u=v==null?void 0:v[e])==null?void 0:u[h])||a,w=c.useContext(y);if(w)return w;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,f]}const o=()=>{const i=n.map(s=>c.createContext(s));return function(a){const h=(a==null?void 0:a[e])||i;return c.useMemo(()=>({[`__scope${e}`]:{...a,[e]:h}}),[a,h])}};return o.scopeName=e,[r,ke(o,...t)]}function ke(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:h,scopeName:l})=>{const d=h(i)[`__scope${l}`];return{...a,...d}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ne=globalThis!=null&&globalThis.document?c.useLayoutEffect:()=>{},Fe=pe[" useId ".trim().toString()]||(()=>{}),Me=0;function tn(e){const[t,n]=c.useState(Fe());return ne(()=>{n(r=>r??String(Me++))},[e]),e||(t?`radix-${t}`:"")}var Ie=pe[" useInsertionEffect ".trim().toString()]||ne;function nn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=We({defaultProp:t,onChange:n}),a=e!==void 0,h=a?e:o;{const f=c.useRef(e!==void 0);c.useEffect(()=>{const d=f.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const l=c.useCallback(f=>{var d;if(a){const v=Be(f)?f(e):f;v!==e&&((d=s.current)==null||d.call(s,v))}else i(f)},[a,e,i,s]);return[h,l]}function We({defaultProp:e,onChange:t}){const[n,r]=c.useState(e),o=c.useRef(n),i=c.useRef(t);return Ie(()=>{i.current=t},[t]),c.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function Be(e){return typeof e=="function"}function _e(e){const t=je(e),n=c.forwardRef((r,o)=>{const{children:i,...s}=r,a=c.Children.toArray(i),h=a.find($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?Ae(r,s):s),c.cloneElement(o,a)}return c.Children.count(o)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ue=Symbol("radix.slottable");function $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 He=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=He.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 Xe(e,t){e&&ye.flushSync(()=>e.dispatchEvent(t))}function M(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Ye(e,t=globalThis==null?void 0:globalThis.document){const n=M(e);c.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ze="DismissableLayer",J="dismissableLayer.update",Ge="dismissableLayer.pointerDownOutside",Ze="dismissableLayer.focusOutside",oe,Ee=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qe=c.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...h}=e,l=c.useContext(Ee),[f,d]=c.useState(null),v=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=c.useState({}),w=te(t,E=>d(E)),u=Array.from(l.layers),[m]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),p=u.indexOf(m),g=f?u.indexOf(f):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,S=g>=p,C=et(E=>{const T=E.target,L=[...l.branches].some(F=>F.contains(T));!S||L||(o==null||o(E),s==null||s(E),E.defaultPrevented||a==null||a())},v),P=tt(E=>{const T=E.target;[...l.branches].some(F=>F.contains(T))||(i==null||i(E),s==null||s(E),E.defaultPrevented||a==null||a())},v);return Ye(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:H(e.onFocusCapture,P.onFocusCapture),onBlurCapture:H(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:H(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=M(e),r=c.useRef(!1),o=c.useRef(()=>{});return c.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let h=function(){ge(Ge,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=h,t.addEventListener("click",o.current,{once:!0})):h()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tt(e,t=globalThis==null?void 0:globalThis.document){const n=M(e),r=c.useRef(!1);return c.useEffect(()=>{const o=i=>{i.target&&!r.current&&ge(Ze,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ae(){const e=new CustomEvent(J);document.dispatchEvent(e)}function ge(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Xe(o,i):o.dispatchEvent(i)}var X="focusScope.autoFocusOnMount",Y="focusScope.autoFocusOnUnmount",ce={bubbles:!1,cancelable:!0},nt="FocusScope",rt=c.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,h]=c.useState(null),l=M(o),f=M(i),d=c.useRef(null),v=te(t,u=>h(u)),y=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let u=function(b){if(y.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:O(d.current,{select:!0})},m=function(b){if(y.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||O(d.current,{select:!0}))},p=function(b){if(document.activeElement===document.body)for(const C of b)C.removedNodes.length>0&&O(a)};document.addEventListener("focusin",u),document.addEventListener("focusout",m);const g=new MutationObserver(p);return a&&g.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",m),g.disconnect()}}},[r,a,y.paused]),c.useEffect(()=>{if(a){se.add(y);const u=document.activeElement;if(!a.contains(u)){const p=new CustomEvent(X,ce);a.addEventListener(X,l),a.dispatchEvent(p),p.defaultPrevented||(ot(ut(be(a)),{select:!0}),document.activeElement===u&&O(a))}return()=>{a.removeEventListener(X,l),setTimeout(()=>{const p=new CustomEvent(Y,ce);a.addEventListener(Y,f),a.dispatchEvent(p),p.defaultPrevented||O(u??document.body,{select:!0}),a.removeEventListener(Y,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},Tt={left:0,top:0,right:0,gap:0},q=function(e){return parseInt(e||"",10)||0},Lt=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[q(n),q(r),q(o)]},Nt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Tt;var t=Lt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},At=Pe(),k="data-scroll-locked",Dt=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
1
|
+
import{H as Le,aQ as Ne,r as c,j as x,aR as pe,aS as Ae,aG as te}from"./index-B36eowj-.js";var ye=Ne();const De=Le(ye);function H(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Jt(e,t){const n=c.createContext(t),r=i=>{const{children:s,...a}=i,h=c.useMemo(()=>a,Object.values(a));return x.jsx(n.Provider,{value:h,children:s})};r.displayName=e+"Provider";function o(i){const s=c.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function en(e,t=[]){let n=[];function r(i,s){const a=c.createContext(s),h=n.length;n=[...n,s];const l=d=>{var p;const{scope:v,children:y,...w}=d,u=((p=v==null?void 0:v[e])==null?void 0:p[h])||a,m=c.useMemo(()=>w,Object.values(w));return x.jsx(u.Provider,{value:m,children:y})};l.displayName=i+"Provider";function f(d,v){var u;const y=((u=v==null?void 0:v[e])==null?void 0:u[h])||a,w=c.useContext(y);if(w)return w;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,f]}const o=()=>{const i=n.map(s=>c.createContext(s));return function(a){const h=(a==null?void 0:a[e])||i;return c.useMemo(()=>({[`__scope${e}`]:{...a,[e]:h}}),[a,h])}};return o.scopeName=e,[r,ke(o,...t)]}function ke(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:h,scopeName:l})=>{const d=h(i)[`__scope${l}`];return{...a,...d}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ne=globalThis!=null&&globalThis.document?c.useLayoutEffect:()=>{},Fe=pe[" useId ".trim().toString()]||(()=>{}),Me=0;function tn(e){const[t,n]=c.useState(Fe());return ne(()=>{n(r=>r??String(Me++))},[e]),e||(t?`radix-${t}`:"")}var Ie=pe[" useInsertionEffect ".trim().toString()]||ne;function nn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=We({defaultProp:t,onChange:n}),a=e!==void 0,h=a?e:o;{const f=c.useRef(e!==void 0);c.useEffect(()=>{const d=f.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const l=c.useCallback(f=>{var d;if(a){const v=Be(f)?f(e):f;v!==e&&((d=s.current)==null||d.call(s,v))}else i(f)},[a,e,i,s]);return[h,l]}function We({defaultProp:e,onChange:t}){const[n,r]=c.useState(e),o=c.useRef(n),i=c.useRef(t);return Ie(()=>{i.current=t},[t]),c.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function Be(e){return typeof e=="function"}function _e(e){const t=je(e),n=c.forwardRef((r,o)=>{const{children:i,...s}=r,a=c.Children.toArray(i),h=a.find($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?Ae(r,s):s),c.cloneElement(o,a)}return c.Children.count(o)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ue=Symbol("radix.slottable");function $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 He=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=He.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 Xe(e,t){e&&ye.flushSync(()=>e.dispatchEvent(t))}function M(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Ye(e,t=globalThis==null?void 0:globalThis.document){const n=M(e);c.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ze="DismissableLayer",J="dismissableLayer.update",Ge="dismissableLayer.pointerDownOutside",Ze="dismissableLayer.focusOutside",oe,Ee=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qe=c.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...h}=e,l=c.useContext(Ee),[f,d]=c.useState(null),v=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=c.useState({}),w=te(t,E=>d(E)),u=Array.from(l.layers),[m]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),p=u.indexOf(m),g=f?u.indexOf(f):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,S=g>=p,C=et(E=>{const T=E.target,L=[...l.branches].some(F=>F.contains(T));!S||L||(o==null||o(E),s==null||s(E),E.defaultPrevented||a==null||a())},v),P=tt(E=>{const T=E.target;[...l.branches].some(F=>F.contains(T))||(i==null||i(E),s==null||s(E),E.defaultPrevented||a==null||a())},v);return Ye(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:H(e.onFocusCapture,P.onFocusCapture),onBlurCapture:H(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:H(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=M(e),r=c.useRef(!1),o=c.useRef(()=>{});return c.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let h=function(){ge(Ge,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=h,t.addEventListener("click",o.current,{once:!0})):h()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tt(e,t=globalThis==null?void 0:globalThis.document){const n=M(e),r=c.useRef(!1);return c.useEffect(()=>{const o=i=>{i.target&&!r.current&&ge(Ze,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ae(){const e=new CustomEvent(J);document.dispatchEvent(e)}function ge(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Xe(o,i):o.dispatchEvent(i)}var X="focusScope.autoFocusOnMount",Y="focusScope.autoFocusOnUnmount",ce={bubbles:!1,cancelable:!0},nt="FocusScope",rt=c.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,h]=c.useState(null),l=M(o),f=M(i),d=c.useRef(null),v=te(t,u=>h(u)),y=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let u=function(b){if(y.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:O(d.current,{select:!0})},m=function(b){if(y.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||O(d.current,{select:!0}))},p=function(b){if(document.activeElement===document.body)for(const C of b)C.removedNodes.length>0&&O(a)};document.addEventListener("focusin",u),document.addEventListener("focusout",m);const g=new MutationObserver(p);return a&&g.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",m),g.disconnect()}}},[r,a,y.paused]),c.useEffect(()=>{if(a){se.add(y);const u=document.activeElement;if(!a.contains(u)){const p=new CustomEvent(X,ce);a.addEventListener(X,l),a.dispatchEvent(p),p.defaultPrevented||(ot(ut(be(a)),{select:!0}),document.activeElement===u&&O(a))}return()=>{a.removeEventListener(X,l),setTimeout(()=>{const p=new CustomEvent(Y,ce);a.addEventListener(Y,f),a.dispatchEvent(p),p.defaultPrevented||O(u??document.body,{select:!0}),a.removeEventListener(Y,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},Tt={left:0,top:0,right:0,gap:0},q=function(e){return parseInt(e||"",10)||0},Lt=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[q(n),q(r),q(o)]},Nt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Tt;var t=Lt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},At=Pe(),k="data-scroll-locked",Dt=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
2
|
.`.concat(vt,` {
|
|
3
3
|
overflow: hidden `).concat(r,`;
|
|
4
4
|
padding-right: `).concat(a,"px ").concat(r,`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as t}from"./index-B36eowj-.js";const e=()=>t.get("/projects"),r=o=>t.get(`/projects/${o}`);export{r as g,e as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as o}from"./index-
|
|
1
|
+
import{A as o}from"./index-B36eowj-.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-B36eowj-.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-CaQZSRbg.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="bg-[#f5f5f7] dark:bg-[#151516]">
|
|
@@ -45,6 +45,8 @@ function collectLarkWorkspaceBindings(config, options) {
|
|
|
45
45
|
|| platform.options.card_actions === true
|
|
46
46
|
|| platform.options.enable_card_actions === true
|
|
47
47
|
|| options.defaultCardActionsEnabled,
|
|
48
|
+
groupReplyAll: String(platform.options.group_reply_all || '').trim().toLowerCase() === 'true'
|
|
49
|
+
|| platform.options.group_reply_all === true,
|
|
48
50
|
brand: String(platform.options.brand || platform.options.lark_brand || '').trim().toLowerCase() === 'lark' ? 'lark' : 'feishu',
|
|
49
51
|
enabled: Boolean(String(platform.options.app_id || '').trim() && String(platform.options.app_secret || '').trim()),
|
|
50
52
|
project,
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeLarkInboundMessageEvent = normalizeLarkInboundMessageEvent;
|
|
4
|
+
exports.isLarkBotMentioned = isLarkBotMentioned;
|
|
5
|
+
exports.stripLarkMentions = stripLarkMentions;
|
|
6
|
+
exports.summarizeLarkInboundPayload = summarizeLarkInboundPayload;
|
|
7
|
+
const node_crypto_1 = require("node:crypto");
|
|
8
|
+
function normalizeLarkInboundMessageEvent(data, options = {}) {
|
|
9
|
+
const payload = (data?.event && typeof data.event === 'object')
|
|
10
|
+
? data.event
|
|
11
|
+
: data;
|
|
12
|
+
const message = payload?.message;
|
|
13
|
+
const sender = payload?.sender;
|
|
14
|
+
if (!message || !sender) {
|
|
15
|
+
return { ok: false, reason: 'missing-message-or-sender', detail: JSON.stringify(Object.keys(data || {})) };
|
|
16
|
+
}
|
|
17
|
+
let parsedContent = {};
|
|
18
|
+
try {
|
|
19
|
+
parsedContent = JSON.parse(String(message.content || '{}'));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
parsedContent = {};
|
|
23
|
+
}
|
|
24
|
+
const messageType = String(message.message_type || '').trim().toLowerCase();
|
|
25
|
+
const chatType = String(message.chat_type || '').trim().toLowerCase();
|
|
26
|
+
const mentions = Array.isArray(message.mentions) ? message.mentions : [];
|
|
27
|
+
const botOpenId = String(options.botOpenId || '').trim();
|
|
28
|
+
if (chatType === 'group' && !options.groupReplyAll && botOpenId && !isLarkBotMentioned(mentions, botOpenId)) {
|
|
29
|
+
return {
|
|
30
|
+
ok: false,
|
|
31
|
+
reason: 'group-message-without-bot-mention',
|
|
32
|
+
detail: `chat=${String(message.chat_id || '')} message=${String(message.message_id || '')}`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const text = stripLarkMentions(String(parsedContent.text || '').trim(), mentions, botOpenId);
|
|
36
|
+
const platformUserId = String(sender.sender_id?.user_id || sender.sender_id?.open_id || '').trim();
|
|
37
|
+
const chatId = String(message.chat_id || platformUserId).trim();
|
|
38
|
+
if (!platformUserId || !chatId) {
|
|
39
|
+
return {
|
|
40
|
+
ok: false,
|
|
41
|
+
reason: 'missing-sender-or-chat',
|
|
42
|
+
detail: `senderKeys=${JSON.stringify(Object.keys(sender?.sender_id || {}))} chat=${String(message.chat_id || '')}`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
ok: true,
|
|
47
|
+
message: {
|
|
48
|
+
payload,
|
|
49
|
+
message,
|
|
50
|
+
sender,
|
|
51
|
+
parsedContent,
|
|
52
|
+
messageType,
|
|
53
|
+
chatType,
|
|
54
|
+
mentions,
|
|
55
|
+
text,
|
|
56
|
+
platformUserId,
|
|
57
|
+
chatId,
|
|
58
|
+
displayName: String(sender.sender_id?.user_id ||
|
|
59
|
+
sender.sender_id?.open_id ||
|
|
60
|
+
`Lark ${platformUserId.slice(-6)}`),
|
|
61
|
+
messageId: String(message.message_id || (0, node_crypto_1.randomUUID)()),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function isLarkBotMentioned(mentions, botOpenId) {
|
|
66
|
+
if (!botOpenId) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return mentions.some((mention) => {
|
|
70
|
+
const item = mention && typeof mention === 'object' ? mention : {};
|
|
71
|
+
return getMentionOpenId(item) === botOpenId;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function stripLarkMentions(text, mentions, botOpenId) {
|
|
75
|
+
let next = String(text || '');
|
|
76
|
+
for (const mention of mentions) {
|
|
77
|
+
const item = mention && typeof mention === 'object' ? mention : {};
|
|
78
|
+
const key = String(item.key || '').trim();
|
|
79
|
+
if (!key) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const openId = getMentionOpenId(item);
|
|
83
|
+
const name = String(item.name || item.display_name || item.displayName || '').trim();
|
|
84
|
+
if (botOpenId && openId === botOpenId) {
|
|
85
|
+
next = next.split(key).join('');
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
next = next.split(key).join(name ? `@${name}` : '');
|
|
89
|
+
}
|
|
90
|
+
return next.trim();
|
|
91
|
+
}
|
|
92
|
+
function summarizeLarkInboundPayload(payload) {
|
|
93
|
+
const eventPayload = (payload?.event && typeof payload.event === 'object')
|
|
94
|
+
? payload.event
|
|
95
|
+
: payload;
|
|
96
|
+
const message = eventPayload?.message || {};
|
|
97
|
+
const sender = eventPayload?.sender || {};
|
|
98
|
+
const senderId = sender?.sender_id || {};
|
|
99
|
+
const content = typeof message.content === 'string' ? message.content : '';
|
|
100
|
+
return [
|
|
101
|
+
`message=${String(message.message_id || '') || 'missing'}`,
|
|
102
|
+
`type=${String(message.message_type || '') || 'missing'}`,
|
|
103
|
+
`chat=${String(message.chat_id || '') || 'missing'}`,
|
|
104
|
+
`chatType=${String(message.chat_type || '') || 'missing'}`,
|
|
105
|
+
`sender=${String(senderId.user_id || senderId.open_id || '') || 'missing'}`,
|
|
106
|
+
`mentions=${Array.isArray(message.mentions) ? message.mentions.length : 0}`,
|
|
107
|
+
`contentBytes=${Buffer.byteLength(content, 'utf8')}`,
|
|
108
|
+
`keys=${JSON.stringify(Object.keys(eventPayload || {}))}`,
|
|
109
|
+
].join(' ');
|
|
110
|
+
}
|
|
111
|
+
function getMentionOpenId(item) {
|
|
112
|
+
const id = item.id || item.user_id || item.userId || {};
|
|
113
|
+
return String(id.open_id || id.openId || item.open_id || item.openId || '').trim();
|
|
114
|
+
}
|
|
@@ -42,10 +42,12 @@ const desktop_js_1 = require("../../../../../shared/desktop.js");
|
|
|
42
42
|
const content_js_1 = require("../shared/content.js");
|
|
43
43
|
const file_utils_js_1 = require("../shared/file-utils.js");
|
|
44
44
|
const session_command_runtime_js_1 = require("../shared/session-command-runtime.js");
|
|
45
|
+
const thread_routing_js_1 = require("../shared/thread-routing.js");
|
|
45
46
|
const cards_js_1 = require("./cards.js");
|
|
46
47
|
const config_js_1 = require("./config.js");
|
|
47
48
|
const registration_js_1 = require("./registration.js");
|
|
48
49
|
const messages_js_1 = require("./rendering/messages.js");
|
|
50
|
+
const inbound_js_1 = require("./inbound.js");
|
|
49
51
|
const runtime_state_js_1 = require("./runtime-state.js");
|
|
50
52
|
const session_command_service_js_1 = require("../../thread/session-command-service.js");
|
|
51
53
|
const PAIRING_EXPIRY_MS = 10 * 60 * 1000;
|
|
@@ -124,6 +126,8 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
124
126
|
appId: binding.appId,
|
|
125
127
|
autoApprove: binding.autoApprove,
|
|
126
128
|
cardActionsEnabled: binding.cardActionsEnabled,
|
|
129
|
+
groupReplyAll: binding.groupReplyAll,
|
|
130
|
+
botOpenId: binding.botOpenId,
|
|
127
131
|
});
|
|
128
132
|
}
|
|
129
133
|
continue;
|
|
@@ -659,25 +663,17 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
659
663
|
return { paired: false };
|
|
660
664
|
}
|
|
661
665
|
const router = this.options.getWorkspaceRouter();
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
platform_user_id: input.platformUserId,
|
|
674
|
-
thread_id: threadId,
|
|
675
|
-
last_platform_message_id: null,
|
|
676
|
-
created_at: now,
|
|
677
|
-
updated_at: now,
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
const sessionKey = this.options.getWorkspaceRouter().getThreadSessionKey(threadId);
|
|
666
|
+
let { threadId } = await (0, thread_routing_js_1.resolveChannelThreadRoute)({
|
|
667
|
+
store: this.options.store,
|
|
668
|
+
router,
|
|
669
|
+
workspaceId: input.workspaceId,
|
|
670
|
+
platformKey,
|
|
671
|
+
chatId: input.chatId,
|
|
672
|
+
platformUserId: input.platformUserId,
|
|
673
|
+
displayName: input.displayName,
|
|
674
|
+
fallbackTitlePrefix: 'Lark',
|
|
675
|
+
authorized,
|
|
676
|
+
});
|
|
681
677
|
const normalizedText = String(input.text || '').trim().toLowerCase();
|
|
682
678
|
const permissionThreadId = (normalizedText === 'allow' || normalizedText === 'allow all' || normalizedText === 'deny')
|
|
683
679
|
? this.findAwaitingPermissionThreadId(input.workspaceId, input.chatId, input.platformUserId)
|
|
@@ -789,6 +785,8 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
789
785
|
appId: binding.appId,
|
|
790
786
|
autoApprove: binding.autoApprove,
|
|
791
787
|
cardActionsEnabled: binding.cardActionsEnabled,
|
|
788
|
+
groupReplyAll: binding.groupReplyAll,
|
|
789
|
+
botOpenId: binding.botOpenId,
|
|
792
790
|
};
|
|
793
791
|
this.runtime.set(key, status);
|
|
794
792
|
this.notifyRuntimeStateChanged();
|
|
@@ -801,6 +799,14 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
801
799
|
appType: mod.AppType.SelfBuild,
|
|
802
800
|
domain: mod.Domain.Feishu,
|
|
803
801
|
});
|
|
802
|
+
try {
|
|
803
|
+
status.botOpenId = await this.fetchBotOpenId(status);
|
|
804
|
+
binding.botOpenId = status.botOpenId;
|
|
805
|
+
this.options.log?.(`localcore-lark bot identified for ${binding.workspaceId}/${binding.instanceId}: ${status.botOpenId}`);
|
|
806
|
+
}
|
|
807
|
+
catch (error) {
|
|
808
|
+
this.options.log?.(`localcore-lark bot identity lookup failed for ${binding.workspaceId}/${binding.instanceId}; group mention filtering may be limited: ${error instanceof Error ? error.message : String(error)}`);
|
|
809
|
+
}
|
|
804
810
|
status.eventDispatcher = new mod.EventDispatcher({
|
|
805
811
|
encryptKey: binding.encryptKey || '',
|
|
806
812
|
verificationToken: binding.verificationToken || '',
|
|
@@ -875,6 +881,8 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
875
881
|
appId: state.appId,
|
|
876
882
|
autoApprove: state.autoApprove,
|
|
877
883
|
cardActionsEnabled: state.cardActionsEnabled,
|
|
884
|
+
groupReplyAll: state.groupReplyAll,
|
|
885
|
+
botOpenId: state.botOpenId,
|
|
878
886
|
});
|
|
879
887
|
this.notifyRuntimeStateChanged();
|
|
880
888
|
}
|
|
@@ -891,25 +899,17 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
891
899
|
const instanceId = legacyCall ? 'default' : instanceIdOrData;
|
|
892
900
|
const platformKey = legacyCall ? 'lark' : String(platformKeyOrData || (0, config_js_1.channelPlatformKey)('lark', instanceId));
|
|
893
901
|
const data = (legacyCall ? instanceIdOrData : maybeData) || {};
|
|
894
|
-
const
|
|
895
|
-
|
|
896
|
-
:
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
this.options.log?.(`localcore-lark handling message event for ${workspaceId}: ${
|
|
900
|
-
if (!
|
|
901
|
-
this.options.log?.(`localcore-lark ignored event
|
|
902
|
+
const runtimeState = this.resolveRuntimeState(workspaceId, instanceId).state;
|
|
903
|
+
const normalized = (0, inbound_js_1.normalizeLarkInboundMessageEvent)(data, {
|
|
904
|
+
botOpenId: runtimeState?.botOpenId,
|
|
905
|
+
groupReplyAll: runtimeState?.groupReplyAll,
|
|
906
|
+
});
|
|
907
|
+
this.options.log?.(`localcore-lark handling message event for ${workspaceId}: ${(0, inbound_js_1.summarizeLarkInboundPayload)(data)}`);
|
|
908
|
+
if (!normalized.ok) {
|
|
909
|
+
this.options.log?.(`localcore-lark ignored message event for ${workspaceId}: reason=${normalized.reason}${normalized.detail ? ` ${normalized.detail}` : ''}`);
|
|
902
910
|
return;
|
|
903
911
|
}
|
|
904
|
-
|
|
905
|
-
try {
|
|
906
|
-
parsedContent = JSON.parse(String(message.content || '{}'));
|
|
907
|
-
}
|
|
908
|
-
catch {
|
|
909
|
-
parsedContent = {};
|
|
910
|
-
}
|
|
911
|
-
const messageType = String(message.message_type || '').trim().toLowerCase();
|
|
912
|
-
const text = String(parsedContent.text || '').trim();
|
|
912
|
+
const { message, parsedContent, messageType, chatType, mentions, text, platformUserId, chatId, displayName, messageId, } = normalized.message;
|
|
913
913
|
const contentParts = [];
|
|
914
914
|
if (text) {
|
|
915
915
|
contentParts.push({ type: 'text', text });
|
|
@@ -945,24 +945,16 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
945
945
|
return;
|
|
946
946
|
}
|
|
947
947
|
const displayText = text || this.summarizeInboundContentParts(contentParts);
|
|
948
|
-
|
|
949
|
-
const chatId = String(message.chat_id || platformUserId).trim();
|
|
950
|
-
if (!platformUserId || !chatId) {
|
|
951
|
-
this.options.log?.(`localcore-lark ignored message without sender/chat for ${workspaceId}: senderKeys=${JSON.stringify(Object.keys(sender?.sender_id || {}))} chat=${String(message.chat_id || '')}`);
|
|
952
|
-
return;
|
|
953
|
-
}
|
|
954
|
-
this.options.log?.(`localcore-lark inbound message for ${workspaceId}: chat=${chatId} user=${platformUserId} type=${messageType || 'unknown'} text=${JSON.stringify(displayText.slice(0, 120))}`);
|
|
948
|
+
this.options.log?.(`localcore-lark inbound message for ${workspaceId}: chat=${chatId} user=${platformUserId} chatType=${chatType || 'unknown'} mentions=${mentions.length} type=${messageType || 'unknown'} text=${JSON.stringify(displayText.slice(0, 120))}`);
|
|
955
949
|
await this.handleInboundMessage({
|
|
956
950
|
workspaceId,
|
|
957
951
|
instanceId,
|
|
958
952
|
platformKey,
|
|
959
953
|
platformUserId,
|
|
960
954
|
chatId,
|
|
961
|
-
displayName
|
|
962
|
-
payload?.sender?.sender_id?.open_id ||
|
|
963
|
-
`Lark ${platformUserId.slice(-6)}`),
|
|
955
|
+
displayName,
|
|
964
956
|
text: displayText,
|
|
965
|
-
messageId
|
|
957
|
+
messageId,
|
|
966
958
|
contentParts,
|
|
967
959
|
});
|
|
968
960
|
}
|
|
@@ -1109,24 +1101,19 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
1109
1101
|
}
|
|
1110
1102
|
}
|
|
1111
1103
|
summarizeLarkEvent(data) {
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
const
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
`chat=${String(message.chat_id || '') || 'missing'}`,
|
|
1126
|
-
`sender=${String(senderId.user_id || senderId.open_id || '') || 'missing'}`,
|
|
1127
|
-
`contentBytes=${Buffer.byteLength(content, 'utf8')}`,
|
|
1128
|
-
`keys=${JSON.stringify(Object.keys(payload || {}))}`,
|
|
1129
|
-
].join(' ');
|
|
1104
|
+
return (0, inbound_js_1.summarizeLarkInboundPayload)(data);
|
|
1105
|
+
}
|
|
1106
|
+
async fetchBotOpenId(state) {
|
|
1107
|
+
const response = await state.client.request({
|
|
1108
|
+
url: '/open-apis/bot/v3/info',
|
|
1109
|
+
method: 'GET',
|
|
1110
|
+
});
|
|
1111
|
+
const bot = response?.bot || response?.data?.bot;
|
|
1112
|
+
const openId = String(bot?.open_id || bot?.openId || '').trim();
|
|
1113
|
+
if (!openId) {
|
|
1114
|
+
throw new Error('Lark bot info response did not include bot.open_id');
|
|
1115
|
+
}
|
|
1116
|
+
return openId;
|
|
1130
1117
|
}
|
|
1131
1118
|
summarizeWsArgs(args) {
|
|
1132
1119
|
if (args.length === 0) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveChannelThreadRoute = resolveChannelThreadRoute;
|
|
4
|
+
async function resolveChannelThreadRoute(input) {
|
|
5
|
+
const threadBinding = input.store.getPlatformThreadBinding(input.workspaceId, input.chatId, input.platformUserId, input.platformKey);
|
|
6
|
+
let threadId = threadBinding?.thread_id || (input.authorized.chat_id === input.chatId ? input.authorized.thread_id : '') || '';
|
|
7
|
+
let createdThread = false;
|
|
8
|
+
if (!threadId) {
|
|
9
|
+
const thread = await input.router.createThread(input.workspaceId, input.displayName || `${input.fallbackTitlePrefix} ${input.chatId}`);
|
|
10
|
+
threadId = thread.id;
|
|
11
|
+
createdThread = true;
|
|
12
|
+
input.store.updateAuthorizedUserThread(input.workspaceId, input.platformUserId, threadId, input.platformKey);
|
|
13
|
+
}
|
|
14
|
+
let createdBinding = false;
|
|
15
|
+
if (!threadBinding) {
|
|
16
|
+
const now = new Date().toISOString();
|
|
17
|
+
input.store.upsertPlatformThreadBinding({
|
|
18
|
+
workspace_id: input.workspaceId,
|
|
19
|
+
platform: input.platformKey,
|
|
20
|
+
chat_id: input.chatId,
|
|
21
|
+
platform_user_id: input.platformUserId,
|
|
22
|
+
thread_id: threadId,
|
|
23
|
+
last_platform_message_id: null,
|
|
24
|
+
created_at: now,
|
|
25
|
+
updated_at: now,
|
|
26
|
+
});
|
|
27
|
+
createdBinding = true;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
threadId,
|
|
31
|
+
createdThread,
|
|
32
|
+
createdBinding,
|
|
33
|
+
};
|
|
34
|
+
}
|
package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js
CHANGED
|
@@ -14,6 +14,7 @@ const desktop_js_1 = require("../../../../../shared/desktop.js");
|
|
|
14
14
|
const content_js_1 = require("../shared/content.js");
|
|
15
15
|
const file_utils_js_1 = require("../shared/file-utils.js");
|
|
16
16
|
const session_command_runtime_js_1 = require("../shared/session-command-runtime.js");
|
|
17
|
+
const thread_routing_js_1 = require("../shared/thread-routing.js");
|
|
17
18
|
const session_command_service_js_1 = require("../../thread/session-command-service.js");
|
|
18
19
|
const config_js_1 = require("./config.js");
|
|
19
20
|
const transport_js_1 = require("./transport.js");
|
|
@@ -657,24 +658,17 @@ class LocalCoreWeixinGateway extends node_events_1.EventEmitter {
|
|
|
657
658
|
return { paired: false };
|
|
658
659
|
}
|
|
659
660
|
const router = this.options.getWorkspaceRouter();
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
platform_user_id: input.platformUserId,
|
|
672
|
-
thread_id: threadId,
|
|
673
|
-
last_platform_message_id: null,
|
|
674
|
-
created_at: now,
|
|
675
|
-
updated_at: now,
|
|
676
|
-
});
|
|
677
|
-
}
|
|
661
|
+
let { threadId } = await (0, thread_routing_js_1.resolveChannelThreadRoute)({
|
|
662
|
+
store: this.options.store,
|
|
663
|
+
router,
|
|
664
|
+
workspaceId: input.workspaceId,
|
|
665
|
+
platformKey,
|
|
666
|
+
chatId: input.chatId,
|
|
667
|
+
platformUserId: input.platformUserId,
|
|
668
|
+
displayName: input.displayName,
|
|
669
|
+
fallbackTitlePrefix: 'WeChat',
|
|
670
|
+
authorized,
|
|
671
|
+
});
|
|
678
672
|
const normalizedText = String(input.text || '').trim().toLowerCase();
|
|
679
673
|
const permissionThreadId = (normalizedText === 'allow' || normalizedText === 'allow all' || normalizedText === 'deny') ? this.findAwaitingPermissionThreadId(input.workspaceId, input.chatId, input.platformUserId, input.platformKey) : '';
|
|
680
674
|
if (permissionThreadId && permissionThreadId !== threadId) {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
7
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
8
|
+
const local_core_weixin_gateway_js_1 = require("../../services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js");
|
|
9
|
+
const local_core_lark_gateway_js_1 = require("../../services/local-ai-core/src/channel/lark/local-core-lark-gateway.js");
|
|
10
|
+
(0, node_test_1.default)('channel gateways ignore unowned bridge events without route miss log noise', async () => {
|
|
11
|
+
const logs = [];
|
|
12
|
+
const commonOptions = {
|
|
13
|
+
store: {},
|
|
14
|
+
readConfig: async () => null,
|
|
15
|
+
getWorkspaceRouter: () => ({}),
|
|
16
|
+
eventBus: { emit: () => { }, on: () => () => { } },
|
|
17
|
+
log: (line) => logs.push(line),
|
|
18
|
+
};
|
|
19
|
+
const larkGateway = new local_core_lark_gateway_js_1.LocalCoreLarkGateway(commonOptions);
|
|
20
|
+
const weixinGateway = new local_core_weixin_gateway_js_1.LocalCoreWeixinGateway(commonOptions);
|
|
21
|
+
await larkGateway.onBridgeEvent({
|
|
22
|
+
type: 'update_message',
|
|
23
|
+
sessionKey: 'localcore-acp:project-1:thread-1',
|
|
24
|
+
content: 'stream chunk',
|
|
25
|
+
});
|
|
26
|
+
await weixinGateway.onBridgeEvent({
|
|
27
|
+
type: 'update_message',
|
|
28
|
+
sessionKey: 'localcore-acp:project-1:thread-1',
|
|
29
|
+
content: 'stream chunk',
|
|
30
|
+
});
|
|
31
|
+
strict_1.default.deepEqual(logs, []);
|
|
32
|
+
});
|