@kafca/agentdock 0.1.36 → 0.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +11 -0
  2. package/dist/renderer/assets/{Badge-DUa4J-09.js → Badge-PKJavQmQ.js} +1 -1
  3. package/dist/renderer/assets/{Chat-B1FWuTWV.js → Chat-DWm4h9aa.js} +1 -1
  4. package/dist/renderer/assets/{ChatMarkdown-DqOgFSgI.js → ChatMarkdown-DKxW2GbO.js} +1 -1
  5. package/dist/renderer/assets/{Config-CM5bqUrV.js → Config-Bqn3cy0z.js} +1 -1
  6. package/dist/renderer/assets/{CronList-CfXE7S0M.js → CronList-CPI_C7FW.js} +1 -1
  7. package/dist/renderer/assets/{Dashboard-D5Dwbotu.js → Dashboard-0e9JS5t7.js} +2 -2
  8. package/dist/renderer/assets/{EmptyState-Bs_6ISc0.js → EmptyState-CuA0koT7.js} +1 -1
  9. package/dist/renderer/assets/{KnowledgeDetail-0kdWnKyy.js → KnowledgeDetail-B1YSDbFa.js} +1 -1
  10. package/dist/renderer/assets/{KnowledgeHome-Bg8xbRe2.js → KnowledgeHome-KHYwWGDu.js} +1 -1
  11. package/dist/renderer/assets/{Logs-BfgvW7qZ.js → Logs-X4LJw-00.js} +1 -1
  12. package/dist/renderer/assets/{Modal-BkuKCDDx.js → Modal-BzEv4CK6.js} +1 -1
  13. package/dist/renderer/assets/{Page-ddaAS_jP.js → Page-BrZMoKtK.js} +1 -1
  14. package/dist/renderer/assets/{ProjectDetail-C9x-Ib5p.js → ProjectDetail-DpO00Ozx.js} +1 -1
  15. package/dist/renderer/assets/{ProjectList-XIIikxrj.js → ProjectList-DFtJHTic.js} +1 -1
  16. package/dist/renderer/assets/{Select-BBL_5aa5.js → Select-DMrwDcus.js} +1 -1
  17. package/dist/renderer/assets/{SessionChat-BFsTM0c7.js → SessionChat-Bh9AfkK5.js} +1 -1
  18. package/dist/renderer/assets/{SessionList-DWh6n10K.js → SessionList-Y3gWAe96.js} +1 -1
  19. package/dist/renderer/assets/{ThreadChat-CzPiDA92.js → ThreadChat-Cq0ZRNOh.js} +1 -1
  20. package/dist/renderer/assets/{Workspace-BW8v3Nia.js → Workspace-DMSPypFO.js} +1 -1
  21. package/dist/renderer/assets/{arrow-left-CcoHvwbx.js → arrow-left-CgYQZlK9.js} +1 -1
  22. package/dist/renderer/assets/{book-open-RweyWxPq.js → book-open-cAfg0BWS.js} +1 -1
  23. package/dist/renderer/assets/{check-B5YOrBNT.js → check-BNRlfwZx.js} +1 -1
  24. package/dist/renderer/assets/{chevron-down-HjaPrxdd.js → chevron-down-B9vVz3wf.js} +1 -1
  25. package/dist/renderer/assets/{circle-C-aaO7LR.js → circle-TBXQ38et.js} +1 -1
  26. package/dist/renderer/assets/{desktop-DUWkNnbA.js → desktop-DfkCIN1l.js} +1 -1
  27. package/dist/renderer/assets/{funnel-IWZmi-_V.js → funnel-BdZjZcqK.js} +1 -1
  28. package/dist/renderer/assets/{heart-DM5_F2nX.js → heart-CBPXb4dq.js} +1 -1
  29. package/dist/renderer/assets/{index-Bin2xyBS.js → index-CXrYAFUE.js} +2 -2
  30. package/dist/renderer/assets/{index-DvIUdsAm.js → index-C_Yr2rQ1.js} +1 -1
  31. package/dist/renderer/assets/{pencil-DcxwCYPi.js → pencil-BlLIWP1h.js} +1 -1
  32. package/dist/renderer/assets/{play-DUdnnxLC.js → play-F-oO0VwG.js} +1 -1
  33. package/dist/renderer/assets/{plug-B-rDbk24.js → plug-B5BduKTi.js} +1 -1
  34. package/dist/renderer/assets/{plus-DslMGvrO.js → plus-Bbe6vc8z.js} +1 -1
  35. package/dist/renderer/assets/projects-CGLECySt.js +1 -0
  36. package/dist/renderer/assets/{save-DlkR3jLs.js → save-CbX1ymi_.js} +1 -1
  37. package/dist/renderer/assets/{search-ULTp3p_0.js → search-KyB8P1Ie.js} +1 -1
  38. package/dist/renderer/assets/{server-DBdiKfv9.js → server-D2EQ0I-I.js} +1 -1
  39. package/dist/renderer/assets/{session-utils-BPyVVONo.js → session-utils-C4Eq8h8o.js} +1 -1
  40. package/dist/renderer/assets/{sessions-B0NecMYO.js → sessions-CchD99QT.js} +1 -1
  41. package/dist/renderer/assets/{shield-check-BNSk8nza.js → shield-check-BTTXqP3n.js} +1 -1
  42. package/dist/renderer/assets/{trash-2-CGydl763.js → trash-2-CDOrVaia.js} +1 -1
  43. package/dist/renderer/assets/{user-D1xkQo35.js → user-BR0zEuV_.js} +1 -1
  44. package/dist/renderer/assets/{wifi-off-Iy1XPeZ3.js → wifi-off-W_cPAMcl.js} +1 -1
  45. package/dist/renderer/index.html +1 -1
  46. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-store.js +22 -7
  47. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-turn-coordinator.js +2 -1
  48. package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +59 -9
  49. package/dist-electron/services/local-ai-core/src/channel/lark/runtime-state.js +9 -6
  50. package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +31 -1
  51. package/dist-electron/services/local-ai-core/src/scheduler/channel-execution-policy.js +79 -0
  52. package/dist-electron/services/local-ai-core/src/scheduler/lark-execution-policies.js +7 -61
  53. package/dist-electron/services/local-ai-core/src/scheduler/lark-schedule-adapter.js +3 -12
  54. package/dist-electron/services/local-ai-core/src/scheduler/local-schedule-adapter.js +23 -30
  55. package/dist-electron/services/local-ai-core/src/scheduler/scheduled-bridge-session.js +55 -0
  56. package/dist-electron/services/local-ai-core/src/scheduler/scheduler-run-lifecycle.js +13 -1
  57. package/dist-electron/services/local-ai-core/src/scheduler/scheduler-service.js +1 -1
  58. package/dist-electron/services/local-ai-core/src/scheduler/weixin-execution-policies.js +7 -61
  59. package/dist-electron/services/local-ai-core/src/scheduler/weixin-schedule-adapter.js +3 -12
  60. package/dist-electron/tests/electron/workspace-task-store.test.js +188 -28
  61. package/dist-electron/tests/integration/local-core-refactor.test.js +140 -50
  62. package/package.json +1 -1
  63. package/dist/renderer/assets/projects-JFuOB4DM.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-Bin2xyBS.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-CXrYAFUE.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,`;
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-Bin2xyBS.js";/**
1
+ import{c as a}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-Bin2xyBS.js";/**
1
+ import{c as o}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-Bin2xyBS.js";/**
1
+ import{c as o}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-Bin2xyBS.js";/**
1
+ import{c as e}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{z as t}from"./index-CXrYAFUE.js";const e=()=>t.get("/projects"),r=o=>t.get(`/projects/${o}`);export{r as g,e as l};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-Bin2xyBS.js";/**
1
+ import{c as a}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-Bin2xyBS.js";/**
1
+ import{c}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-Bin2xyBS.js";/**
1
+ import{c as e}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-Bin2xyBS.js";/**
1
+ import{c as o}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{z as o}from"./index-Bin2xyBS.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};
1
+ import{z as o}from"./index-CXrYAFUE.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};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-Bin2xyBS.js";/**
1
+ import{c}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-Bin2xyBS.js";/**
1
+ import{c as e}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-Bin2xyBS.js";/**
1
+ import{c as e}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-Bin2xyBS.js";/**
1
+ import{c as a}from"./index-CXrYAFUE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -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-Bin2xyBS.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-CXrYAFUE.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]">
@@ -127,6 +127,11 @@ class LocalCoreAcpStore {
127
127
  thread_id TEXT,
128
128
  run_id TEXT,
129
129
  platform_message_id TEXT,
130
+ platform_message_ids_json TEXT,
131
+ delivery_mode TEXT,
132
+ delivery_status TEXT,
133
+ delivery_error TEXT,
134
+ last_bridge_event_at TEXT,
130
135
  FOREIGN KEY (job_id) REFERENCES scheduled_jobs(id) ON DELETE CASCADE
131
136
  );
132
137
  CREATE INDEX IF NOT EXISTS idx_scheduled_job_runs_job_triggered ON scheduled_job_runs (job_id, triggered_at DESC);
@@ -227,6 +232,11 @@ class LocalCoreAcpStore {
227
232
  this.ensureColumn('messages', 'bridge_kind', 'TEXT');
228
233
  this.ensureColumn('messages', 'bridge_status', 'TEXT');
229
234
  this.ensureColumn('scheduled_jobs', 'execution_mode', "TEXT NOT NULL DEFAULT 'same-thread'");
235
+ this.ensureColumn('scheduled_job_runs', 'platform_message_ids_json', 'TEXT');
236
+ this.ensureColumn('scheduled_job_runs', 'delivery_mode', 'TEXT');
237
+ this.ensureColumn('scheduled_job_runs', 'delivery_status', 'TEXT');
238
+ this.ensureColumn('scheduled_job_runs', 'delivery_error', 'TEXT');
239
+ this.ensureColumn('scheduled_job_runs', 'last_bridge_event_at', 'TEXT');
230
240
  this.ensureColumn('threads', 'agent_mode', "TEXT NOT NULL DEFAULT 'default'");
231
241
  }
232
242
  close() {
@@ -889,7 +899,7 @@ class LocalCoreAcpStore {
889
899
  }
890
900
  listScheduledJobRuns(jobId) {
891
901
  const rows = this.db.prepare(`
892
- SELECT id, job_id, status, triggered_at, started_at, finished_at, error, thread_id, run_id, platform_message_id
902
+ SELECT id, job_id, status, triggered_at, started_at, finished_at, error, thread_id, run_id, platform_message_id, platform_message_ids_json, delivery_mode, delivery_status, delivery_error, last_bridge_event_at
893
903
  FROM scheduled_job_runs
894
904
  WHERE job_id = ?
895
905
  ORDER BY triggered_at DESC
@@ -901,9 +911,9 @@ class LocalCoreAcpStore {
901
911
  const triggeredAt = input.triggeredAt || new Date().toISOString();
902
912
  const normalizedStatus = (0, index_js_1.normalizeScheduledJobRunStatus)(status);
903
913
  this.db.prepare(`
904
- INSERT INTO scheduled_job_runs (id, job_id, status, triggered_at, started_at, finished_at, error, thread_id, run_id, platform_message_id)
905
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
906
- `).run(id, jobId, normalizedStatus, triggeredAt, input.startedAt || null, input.finishedAt || null, input.error || null, input.threadId || null, input.runId || null, input.platformMessageId || null);
914
+ INSERT INTO scheduled_job_runs (id, job_id, status, triggered_at, started_at, finished_at, error, thread_id, run_id, platform_message_id, platform_message_ids_json, delivery_mode, delivery_status, delivery_error, last_bridge_event_at)
915
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
916
+ `).run(id, jobId, normalizedStatus, triggeredAt, input.startedAt || null, input.finishedAt || null, input.error || null, input.threadId || null, input.runId || null, input.platformMessageId || null, JSON.stringify(input.platformMessageIds || []), input.deliveryMode || null, input.deliveryStatus || null, input.deliveryError || null, input.lastBridgeEventAt || null);
907
917
  this.updateScheduledJobStatus(jobId, {
908
918
  lastRunAt: triggeredAt,
909
919
  lastStatus: normalizedStatus,
@@ -913,7 +923,7 @@ class LocalCoreAcpStore {
913
923
  }
914
924
  getScheduledJobRun(runId) {
915
925
  const row = this.db.prepare(`
916
- SELECT id, job_id, status, triggered_at, started_at, finished_at, error, thread_id, run_id, platform_message_id
926
+ SELECT id, job_id, status, triggered_at, started_at, finished_at, error, thread_id, run_id, platform_message_id, platform_message_ids_json, delivery_mode, delivery_status, delivery_error, last_bridge_event_at
917
927
  FROM scheduled_job_runs
918
928
  WHERE id = ?
919
929
  `).get(runId);
@@ -931,9 +941,9 @@ class LocalCoreAcpStore {
931
941
  };
932
942
  this.db.prepare(`
933
943
  UPDATE scheduled_job_runs
934
- SET status = ?, triggered_at = ?, started_at = ?, finished_at = ?, error = ?, thread_id = ?, run_id = ?, platform_message_id = ?
944
+ SET status = ?, triggered_at = ?, started_at = ?, finished_at = ?, error = ?, thread_id = ?, run_id = ?, platform_message_id = ?, platform_message_ids_json = ?, delivery_mode = ?, delivery_status = ?, delivery_error = ?, last_bridge_event_at = ?
935
945
  WHERE id = ?
936
- `).run(next.status, next.triggeredAt, next.startedAt || null, next.finishedAt || null, next.error || null, next.threadId || null, next.runId || null, next.platformMessageId || null, runId);
946
+ `).run(next.status, next.triggeredAt, next.startedAt || null, next.finishedAt || null, next.error || null, next.threadId || null, next.runId || null, next.platformMessageId || null, JSON.stringify(next.platformMessageIds || []), next.deliveryMode || null, next.deliveryStatus || null, next.deliveryError || null, next.lastBridgeEventAt || null, runId);
937
947
  if (input.status || Object.prototype.hasOwnProperty.call(input, 'error') || input.finishedAt || input.triggeredAt) {
938
948
  this.updateScheduledJobStatus(existing.jobId, {
939
949
  lastRunAt: next.triggeredAt,
@@ -1179,6 +1189,11 @@ class LocalCoreAcpStore {
1179
1189
  threadId: row.thread_id || undefined,
1180
1190
  runId: row.run_id || undefined,
1181
1191
  platformMessageId: row.platform_message_id || undefined,
1192
+ platformMessageIds: parseJson(row.platform_message_ids_json || '[]', []),
1193
+ deliveryMode: row.delivery_mode || undefined,
1194
+ deliveryStatus: row.delivery_status || undefined,
1195
+ deliveryError: row.delivery_error || undefined,
1196
+ lastBridgeEventAt: row.last_bridge_event_at || undefined,
1182
1197
  };
1183
1198
  }
1184
1199
  toWorkspaceRegistryEntry(row) {
@@ -113,7 +113,8 @@ class LocalCoreAcpTurnCoordinator {
113
113
  }) || parsedOptions;
114
114
  const toolTitle = (0, workspace_acp_permissions_js_1.formatToolCallContent)(payload.params?.toolCall);
115
115
  this.closePendingThoughtSegment(session);
116
- if ((this.options.getThreadAgentMode?.(session.threadId) || local_core_slash_commands_js_1.DEFAULT_AGENT_MODE) === 'bypassPermissions') {
116
+ const effectiveAgentMode = session.launchPermissionMode || this.options.getThreadAgentMode?.(session.threadId) || local_core_slash_commands_js_1.DEFAULT_AGENT_MODE;
117
+ if (effectiveAgentMode === 'bypassPermissions') {
117
118
  const selected = options.find((option) => option.normalizedAction === 'allow all')
118
119
  || options.find((option) => option.normalizedAction === 'allow')
119
120
  || options.find((option) => option.normalizedAction !== 'deny');
@@ -178,6 +178,31 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
178
178
  async sendScheduledMessage(workspaceId, route, text) {
179
179
  return this.sendScheduledCard(workspaceId, route.channelId, text);
180
180
  }
181
+ registerScheduledThreadBridge(input) {
182
+ const instanceId = input.route.instanceId || getLarkInstanceId(input.platform) || 'default';
183
+ const platformKey = (0, config_js_1.channelPlatformKey)('lark', instanceId);
184
+ const route = {
185
+ workspaceId: input.workspaceId,
186
+ instanceId,
187
+ platformKey,
188
+ platformUserId: input.route.participantId || '',
189
+ chatId: input.route.channelId,
190
+ threadId: input.threadId,
191
+ };
192
+ const previousRoute = this.threadRouting.get(input.sessionKey);
193
+ this.threadRouting.set(input.sessionKey, route);
194
+ if (!this.outboundTurns.has(input.sessionKey)) {
195
+ this.createTurnState(input.sessionKey);
196
+ }
197
+ return () => {
198
+ if (previousRoute) {
199
+ this.threadRouting.set(input.sessionKey, previousRoute);
200
+ }
201
+ else {
202
+ this.threadRouting.delete(input.sessionKey);
203
+ }
204
+ };
205
+ }
181
206
  async sendOutboundMessage(workspaceId, input) {
182
207
  const state = this.resolveRuntimeState(workspaceId, input.route?.instanceId).state;
183
208
  if (!state?.client || !state.connected) {
@@ -193,7 +218,7 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
193
218
  if (part.type === 'text') {
194
219
  const text = String(part.text || '').trim();
195
220
  if (text) {
196
- messageIds.push(await this.sendTextAsCard(state, channelId, text));
221
+ messageIds.push(await this.sendTextAsMessage(state, channelId, text));
197
222
  }
198
223
  continue;
199
224
  }
@@ -428,8 +453,9 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
428
453
  this.options.log?.(`localcore-lark bridge binding disappeared for sessionKey=${sessionKey}`);
429
454
  return;
430
455
  }
431
- if (this.mutedThreadBridgeCounts.has(binding.thread_id)) {
432
- this.options.log?.(`localcore-lark bridge muted for thread=${binding.thread_id} type=${event.type}`);
456
+ const bridgeThreadId = route.threadId || binding.thread_id;
457
+ if (this.mutedThreadBridgeCounts.has(bridgeThreadId)) {
458
+ this.options.log?.(`localcore-lark bridge muted for thread=${bridgeThreadId} type=${event.type}`);
433
459
  return;
434
460
  }
435
461
  const turn = this.getOrCreateTurnState(sessionKey, binding.last_platform_message_id || undefined);
@@ -442,7 +468,7 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
442
468
  }
443
469
  if (event.type === 'typing_start' && (turn.permissionMessageId || turn.awaitingPermission)) {
444
470
  if (turn.permissionMessageId) {
445
- await this.patchTextCard(state, turn.permissionMessageId, '**工具确认已处理**\n\n继续生成中...', [], sessionKey, binding.thread_id);
471
+ await this.patchTextCard(state, turn.permissionMessageId, '**工具确认已处理**\n\n继续生成中...', [], sessionKey, bridgeThreadId);
446
472
  }
447
473
  turn.permissionMessageId = undefined;
448
474
  turn.awaitingPermission = false;
@@ -455,14 +481,14 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
455
481
  const permissionCard = (0, cards_js_1.renderPermissionCard)(turn, event, Boolean(state.cardActionsEnabled));
456
482
  if (permissionCard.text || permissionCard.buttonRows.length > 0) {
457
483
  if (!turn.permissionMessageId) {
458
- const createdId = await this.sendTextAsCard(state, route.chatId, permissionCard.text, permissionCard.buttonRows, sessionKey, binding.thread_id);
484
+ const createdId = await this.sendTextAsCard(state, route.chatId, permissionCard.text, permissionCard.buttonRows, sessionKey, bridgeThreadId);
459
485
  if (createdId) {
460
486
  turn.permissionMessageId = createdId;
461
487
  this.options.log?.(`localcore-lark sent permission card ${createdId} for sessionKey=${sessionKey}`);
462
488
  }
463
489
  }
464
490
  else {
465
- await this.patchTextCard(state, turn.permissionMessageId, permissionCard.text, permissionCard.buttonRows, sessionKey, binding.thread_id);
491
+ await this.patchTextCard(state, turn.permissionMessageId, permissionCard.text, permissionCard.buttonRows, sessionKey, bridgeThreadId);
466
492
  this.options.log?.(`localcore-lark patched permission card ${turn.permissionMessageId} for sessionKey=${sessionKey}`);
467
493
  }
468
494
  }
@@ -487,17 +513,22 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
487
513
  continue;
488
514
  }
489
515
  if (!existingMessageId) {
490
- const createdId = await this.sendTextAsCard(state, route.chatId, renderedMessage.text, renderedMessage.buttonRows, sessionKey, binding.thread_id);
516
+ const createdId = renderedMessage.delivery === 'message' && renderedMessage.buttonRows.length === 0
517
+ ? await this.sendTextAsMessage(state, route.chatId, renderedMessage.text)
518
+ : await this.sendTextAsCard(state, route.chatId, renderedMessage.text, renderedMessage.buttonRows, sessionKey, bridgeThreadId);
491
519
  if (createdId) {
492
520
  (0, runtime_state_js_1.setLarkRenderedMessageId)(turn, renderedMessage, createdId);
493
521
  if (renderedMessage.isFinal) {
494
522
  this.options.store.updatePlatformThreadMessageId(route.workspaceId, route.chatId, route.platformUserId, createdId, routePlatformKey);
495
523
  }
496
- this.options.log?.(`localcore-lark sent new card message ${createdId} for sessionKey=${sessionKey}`);
524
+ this.options.log?.(`localcore-lark sent new ${renderedMessage.delivery === 'message' ? 'text' : 'card'} message ${createdId} for sessionKey=${sessionKey}`);
497
525
  }
498
526
  continue;
499
527
  }
500
- await this.patchTextCard(state, existingMessageId, renderedMessage.text, renderedMessage.buttonRows, sessionKey, binding.thread_id);
528
+ if (renderedMessage.delivery === 'message') {
529
+ continue;
530
+ }
531
+ await this.patchTextCard(state, existingMessageId, renderedMessage.text, renderedMessage.buttonRows, sessionKey, bridgeThreadId);
501
532
  turn.lastPatchedAt = Date.now();
502
533
  turn.lastPatchedAtByMessageId[existingMessageId] = turn.lastPatchedAt;
503
534
  this.options.log?.(`localcore-lark patched card message ${existingMessageId} for sessionKey=${sessionKey}`);
@@ -1120,6 +1151,21 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
1120
1151
  this.options.log?.(`localcore-lark card create took ${Date.now() - startedAt}ms textBytes=${Buffer.byteLength(text || '', 'utf8')}`);
1121
1152
  return String(response?.data?.message_id || '').trim();
1122
1153
  }
1154
+ async sendTextAsMessage(state, chatId, text) {
1155
+ const startedAt = Date.now();
1156
+ const response = await state.client.im.message.create({
1157
+ params: {
1158
+ receive_id_type: this.resolveReceiveIdType(chatId),
1159
+ },
1160
+ data: {
1161
+ receive_id: chatId,
1162
+ msg_type: 'text',
1163
+ content: JSON.stringify({ text }),
1164
+ },
1165
+ });
1166
+ this.options.log?.(`localcore-lark text create took ${Date.now() - startedAt}ms textBytes=${Buffer.byteLength(text || '', 'utf8')}`);
1167
+ return String(response?.data?.message_id || '').trim();
1168
+ }
1123
1169
  resolveReceiveIdType(receiveId) {
1124
1170
  return receiveId.startsWith('oc_') ? 'chat_id' : receiveId.startsWith('ou_') ? 'open_id' : 'user_id';
1125
1171
  }
@@ -1294,3 +1340,7 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
1294
1340
  }
1295
1341
  }
1296
1342
  exports.LocalCoreLarkGateway = LocalCoreLarkGateway;
1343
+ function getLarkInstanceId(platform) {
1344
+ const normalized = String(platform || '').trim();
1345
+ return normalized.startsWith('lark:') ? normalized.slice('lark:'.length).trim() : '';
1346
+ }
@@ -38,7 +38,7 @@ function summarizeToolCallForLark(event, content) {
38
38
  if (toolCall) {
39
39
  const name = String(toolCall.name || '').trim() || summarizeToolContentForLark(content);
40
40
  const input = formatToolInputForLark(toolCall.input);
41
- return [`🔧 ${name}`, input ? `参数:${input}` : '']
41
+ return [`🔧 ${name}`, input]
42
42
  .filter(Boolean)
43
43
  .join('\n\n');
44
44
  }
@@ -153,6 +153,7 @@ function renderLarkBridgeEventMessage(turn, event) {
153
153
  text: content,
154
154
  buttonRows: turn.buttonRows,
155
155
  isFinal: true,
156
+ delivery: 'message',
156
157
  finalSource: 'reply',
157
158
  };
158
159
  }
@@ -212,6 +213,7 @@ function renderProgressMessage(key, text) {
212
213
  function renderToolMessage(key, text) {
213
214
  return {
214
215
  ...renderProgressMessage(key, text),
216
+ delivery: 'message',
215
217
  updatePolicy: 'create-only',
216
218
  };
217
219
  }
@@ -245,21 +247,22 @@ function formatToolInputForLark(input) {
245
247
  return '';
246
248
  }
247
249
  if (typeof input === 'string') {
248
- return inlineCode(input);
250
+ return fencedCode(input);
249
251
  }
250
252
  try {
251
- return inlineCode(JSON.stringify(input));
253
+ return fencedCode(JSON.stringify(input, null, 2), 'json');
252
254
  }
253
255
  catch {
254
- return inlineCode(String(input));
256
+ return fencedCode(String(input));
255
257
  }
256
258
  }
257
- function inlineCode(value) {
259
+ function fencedCode(value, language = '') {
258
260
  const normalized = value.trim();
259
261
  if (!normalized) {
260
262
  return '';
261
263
  }
262
- return `\`${normalized.replace(/`/g, '\\`')}\``;
264
+ const fence = normalized.includes('```') ? '````' : '```';
265
+ return `${fence}${language}\n${normalized}\n${fence}`;
263
266
  }
264
267
  function pushUniqueLarkTurnLine(target, value) {
265
268
  const normalized = value.trim();
@@ -399,7 +399,8 @@ class LocalCoreWeixinGateway extends node_events_1.EventEmitter {
399
399
  const binding = this.options.store.getPlatformThreadBinding(route.workspaceId, route.chatId, route.platformUserId, routePlatformKey);
400
400
  if (!binding)
401
401
  return;
402
- if (this.mutedThreadBridgeCounts.has(binding.thread_id))
402
+ const bridgeThreadId = route.threadId || binding.thread_id;
403
+ if (this.mutedThreadBridgeCounts.has(bridgeThreadId))
403
404
  return;
404
405
  const turn = this.getOrCreateTurnState(sessionKey);
405
406
  if (event.replyCtx) {
@@ -466,6 +467,31 @@ class LocalCoreWeixinGateway extends node_events_1.EventEmitter {
466
467
  return '';
467
468
  }
468
469
  }
470
+ registerScheduledThreadBridge(input) {
471
+ const instanceId = input.route.instanceId || getWeixinInstanceId(input.platform) || 'default';
472
+ const platformKey = (0, config_js_1.channelPlatformKey)('weixin', instanceId);
473
+ const route = {
474
+ workspaceId: input.workspaceId,
475
+ instanceId,
476
+ platformKey,
477
+ platformUserId: input.route.participantId || '',
478
+ chatId: input.route.channelId,
479
+ threadId: input.threadId,
480
+ };
481
+ const previousRoute = this.threadRouting.get(input.sessionKey);
482
+ this.threadRouting.set(input.sessionKey, route);
483
+ if (!this.outboundTurns.has(input.sessionKey)) {
484
+ this.createTurnState(input.sessionKey);
485
+ }
486
+ return () => {
487
+ if (previousRoute) {
488
+ this.threadRouting.set(input.sessionKey, previousRoute);
489
+ }
490
+ else {
491
+ this.threadRouting.delete(input.sessionKey);
492
+ }
493
+ };
494
+ }
469
495
  async sendOutboundMessage(workspaceId, input) {
470
496
  const state = this.resolveRuntimeState(workspaceId, input.route?.instanceId).state;
471
497
  if (!state?.connected) {
@@ -1231,3 +1257,7 @@ class LocalCoreWeixinGateway extends node_events_1.EventEmitter {
1231
1257
  }
1232
1258
  }
1233
1259
  exports.LocalCoreWeixinGateway = LocalCoreWeixinGateway;
1260
+ function getWeixinInstanceId(platform) {
1261
+ const normalized = String(platform || '').trim();
1262
+ return normalized.startsWith('weixin:') ? normalized.slice('weixin:'.length).trim() : '';
1263
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createChannelExecutionPolicy = createChannelExecutionPolicy;
4
+ const scheduled_bridge_session_js_1 = require("./scheduled-bridge-session.js");
5
+ function createChannelExecutionPolicy(job, options, config) {
6
+ if (job.executionMode === 'side-thread') {
7
+ return new SideThreadChannelExecutionPolicy(options, config);
8
+ }
9
+ return new SameThreadChannelExecutionPolicy(options, config);
10
+ }
11
+ class SameThreadChannelExecutionPolicy {
12
+ options;
13
+ config;
14
+ bridgeSession;
15
+ constructor(options, config) {
16
+ this.options = options;
17
+ this.config = config;
18
+ }
19
+ async resolveTarget(job) {
20
+ const threadId = await this.config.resolveSameThread(job);
21
+ return {
22
+ kind: `${this.config.platformBase}:same-thread`,
23
+ threadId,
24
+ workspaceId: job.workspaceId,
25
+ platform: job.platform,
26
+ route: job.route,
27
+ };
28
+ }
29
+ async beforeExecute(target, job) {
30
+ this.bridgeSession = await scheduled_bridge_session_js_1.ScheduledBridgeSession.open({
31
+ job,
32
+ threadId: target.threadId,
33
+ workspaceRouter: this.options.workspaceRouter,
34
+ getChannelRuntime: this.options.getChannelRuntime,
35
+ });
36
+ }
37
+ async afterExecute() {
38
+ await this.bridgeSession?.close();
39
+ this.bridgeSession = undefined;
40
+ }
41
+ }
42
+ class SideThreadChannelExecutionPolicy {
43
+ options;
44
+ config;
45
+ bridgeSession;
46
+ constructor(options, config) {
47
+ this.options = options;
48
+ this.config = config;
49
+ }
50
+ async resolveTarget(job) {
51
+ const title = this.config.sideThreadTitle(job);
52
+ const reusableTitles = new Set([
53
+ title,
54
+ ...(this.config.legacySideThreadTitles?.(job) || []),
55
+ ]);
56
+ const existing = (await this.options.workspaceRouter.listThreads(job.workspaceId))
57
+ .find((thread) => reusableTitles.has(thread.title));
58
+ const threadId = existing?.id || (await this.options.workspaceRouter.createThread(job.workspaceId, title)).id;
59
+ return {
60
+ kind: `${this.config.platformBase}:side-thread`,
61
+ threadId,
62
+ workspaceId: job.workspaceId,
63
+ platform: job.platform,
64
+ route: job.route,
65
+ };
66
+ }
67
+ async beforeExecute(target, job) {
68
+ this.bridgeSession = await scheduled_bridge_session_js_1.ScheduledBridgeSession.open({
69
+ job,
70
+ threadId: target.threadId,
71
+ workspaceRouter: this.options.workspaceRouter,
72
+ getChannelRuntime: this.options.getChannelRuntime,
73
+ });
74
+ }
75
+ async afterExecute() {
76
+ await this.bridgeSession?.close();
77
+ this.bridgeSession = undefined;
78
+ }
79
+ }