@kafca/agentdock 0.1.20 → 0.1.21
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 +7 -0
- package/dist/renderer/assets/{Badge-C1f8JpRb.js → Badge-BRmQIqbd.js} +1 -1
- package/dist/renderer/assets/{Chat-S50iFg3I.js → Chat-D94ODABB.js} +1 -1
- package/dist/renderer/assets/{ChatMarkdown-VWL9Vnpz.js → ChatMarkdown-DqW7OUvV.js} +1 -1
- package/dist/renderer/assets/{Config-Yc9ExUI6.js → Config-9lgzpTCp.js} +1 -1
- package/dist/renderer/assets/{CronList-DTboWazi.js → CronList-BYZ-x_bp.js} +1 -1
- package/dist/renderer/assets/{Dashboard-CzXCvZVR.js → Dashboard-COISXbQy.js} +2 -2
- package/dist/renderer/assets/{EmptyState-9FbY2o6z.js → EmptyState-w5-I9zg7.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-D_BDc4Zt.js → KnowledgeDetail-DVxwrTLw.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-DsUA_BCR.js → KnowledgeHome-BKkubcwi.js} +1 -1
- package/dist/renderer/assets/{Logs-DDAmR67f.js → Logs-D7HxZ8Nb.js} +1 -1
- package/dist/renderer/assets/{Modal-Bt5VBC6S.js → Modal-Ceu_MP2e.js} +1 -1
- package/dist/renderer/assets/{Page-Da_Kc6Qm.js → Page-CpSczAz8.js} +1 -1
- package/dist/renderer/assets/{ProjectDetail-B4Ps80yv.js → ProjectDetail-FJ_bNXLF.js} +1 -1
- package/dist/renderer/assets/{ProjectList-BWTP9npz.js → ProjectList-DZKL4K9C.js} +1 -1
- package/dist/renderer/assets/{Select-DWs3hVUh.js → Select-BHQk6qCU.js} +1 -1
- package/dist/renderer/assets/{SessionChat-DOhUnOfH.js → SessionChat-DpgSXF3m.js} +1 -1
- package/dist/renderer/assets/{SessionList-ChZYFXuo.js → SessionList-CU6drQ4N.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-nhnikHnk.js → ThreadChat-D3s4GXGh.js} +1 -1
- package/dist/renderer/assets/{Workspace-pq_JYdTN.js → Workspace-B7looTVo.js} +1 -1
- package/dist/renderer/assets/{arrow-left-CR39hNvq.js → arrow-left-Dtal-eOi.js} +1 -1
- package/dist/renderer/assets/{book-open-Bot2WKl8.js → book-open-q814R_Ov.js} +1 -1
- package/dist/renderer/assets/{check-Drbl2nU3.js → check-DjfCdLvw.js} +1 -1
- package/dist/renderer/assets/{circle-BXFfAwnA.js → circle-vfhmyE8v.js} +1 -1
- package/dist/renderer/assets/{desktop-5k3W66fH.js → desktop-BPIxWbkM.js} +1 -1
- package/dist/renderer/assets/desktop-DZHC4PDB.js +3 -0
- package/dist/renderer/assets/{funnel-BNKYan_N.js → funnel-CUQibo1I.js} +1 -1
- package/dist/renderer/assets/{heart-wUOSwQE-.js → heart-DG9_b8P1.js} +1 -1
- package/dist/renderer/assets/{index-DT5la73R.js → index-Bn8ane6_.js} +2 -2
- package/dist/renderer/assets/{index-CmOphqrf.js → index-Ds0IN5rP.js} +1 -1
- package/dist/renderer/assets/{pencil-D7-8ggue.js → pencil-Dij0LlRY.js} +1 -1
- package/dist/renderer/assets/{play-BCYOAfet.js → play-CPFGjIyJ.js} +1 -1
- package/dist/renderer/assets/{plug-Dsik74Yl.js → plug-DH3RKQyn.js} +1 -1
- package/dist/renderer/assets/{plus-CKrU26_l.js → plus-afkK9_Y8.js} +1 -1
- package/dist/renderer/assets/projects-DTDS9SnT.js +1 -0
- package/dist/renderer/assets/{save-q7M2_eAl.js → save-B-cKgWcy.js} +1 -1
- package/dist/renderer/assets/{search-BptY4_MT.js → search-DR6PeYkt.js} +1 -1
- package/dist/renderer/assets/{server-DSSEF0D8.js → server-BM6KOB5a.js} +1 -1
- package/dist/renderer/assets/{session-utils-BFuqPZ5x.js → session-utils-BDuThM0a.js} +1 -1
- package/dist/renderer/assets/{sessions-CrWo3g3u.js → sessions-C1yKps4T.js} +1 -1
- package/dist/renderer/assets/{shield-check-CCU722RQ.js → shield-check-BFjMG-r2.js} +1 -1
- package/dist/renderer/assets/{trash-2-DaeeiV8x.js → trash-2-CW1heMCf.js} +1 -1
- package/dist/renderer/assets/{user-Bkz8J7Yw.js → user-r_2sHG7m.js} +1 -1
- package/dist/renderer/assets/{wifi-off-P8xdIOHU.js → wifi-off-VMUokMpE.js} +1 -1
- package/dist/renderer/index.html +1 -1
- package/dist-electron/electron/agent-runtime-detector.test.js +11 -0
- package/dist-electron/electron/local-core-refactor.test.js +96 -0
- package/dist-electron/electron/plugin-kernel.test.js +43 -9
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +9 -9
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-content.js +60 -0
- package/dist-electron/services/local-ai-core/src/gateway/local-core-lark-gateway.js +122 -5
- package/dist-electron/services/local-ai-core/src/gateway/local-core-weixin-gateway.js +50 -2
- package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +2 -1
- package/dist-electron/services/local-ai-core/src/plugins/builtin/agent-localcore-acp-plugin.js +9 -0
- package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +19 -8
- package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +23 -12
- package/dist-electron/shared/desktop.js +4 -2
- package/package.json +2 -1
- package/dist/renderer/assets/desktop-D4Z7M9RM.js +0 -3
- package/dist/renderer/assets/projects-CGDtNb0M.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as Le,aG as Ne,r as c,j as x,aH as pe,aI as Ae,av as te}from"./index-DT5la73R.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{E as Le,aG as Ne,r as c,j as x,aH as pe,aI as Ae,av as te}from"./index-Bn8ane6_.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{y as t}from"./index-Bn8ane6_.js";const e=()=>t.get("/projects"),r=o=>t.get(`/projects/${o}`);export{r as g,e as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as o}from"./index-
|
|
1
|
+
import{y as o}from"./index-Bn8ane6_.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-Bn8ane6_.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-3CzgyQYB.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="bg-[#f5f5f7] dark:bg-[#151516]">
|
|
@@ -14,9 +14,11 @@ const agent_runtime_detector_js_1 = require("../services/local-ai-core/src/runti
|
|
|
14
14
|
try {
|
|
15
15
|
const opencode = (0, node_path_1.join)(dir, 'opencode');
|
|
16
16
|
(0, node_fs_1.writeFileSync)(opencode, '#!/bin/sh\nexit 0\n', 'utf8');
|
|
17
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, 'package.json'), '{}\n', 'utf8');
|
|
17
18
|
(0, node_fs_1.chmodSync)(opencode, 0o755);
|
|
18
19
|
const runtimes = (0, agent_runtime_detector_js_1.detectInstalledAgentRuntimes)({
|
|
19
20
|
env: { PATH: dir },
|
|
21
|
+
requireFrom: (0, node_path_1.join)(dir, 'package.json'),
|
|
20
22
|
});
|
|
21
23
|
const byType = new Map(runtimes.map((runtime) => [runtime.agentType, runtime]));
|
|
22
24
|
strict_1.default.equal(byType.get('opencode')?.installed, true);
|
|
@@ -34,6 +36,15 @@ const agent_runtime_detector_js_1 = require("../services/local-ai-core/src/runti
|
|
|
34
36
|
(0, node_fs_1.rmSync)(dir, { recursive: true, force: true });
|
|
35
37
|
}
|
|
36
38
|
});
|
|
39
|
+
(0, node_test_1.default)('agent runtime detector reports bundled codex ACP when available', () => {
|
|
40
|
+
const codex = (0, agent_runtime_detector_js_1.detectInstalledAgentRuntimes)({
|
|
41
|
+
env: { PATH: '' },
|
|
42
|
+
}).find((runtime) => runtime.agentType === 'codex');
|
|
43
|
+
strict_1.default.equal(codex?.installed, true);
|
|
44
|
+
strict_1.default.equal(codex?.status, 'installed');
|
|
45
|
+
strict_1.default.equal(codex?.source, 'bundled');
|
|
46
|
+
strict_1.default.match(codex?.command || '', /@zed-industries[/\\]codex-acp[/\\]bin[/\\]codex-acp\.js$/);
|
|
47
|
+
});
|
|
37
48
|
(0, node_test_1.default)('agent runtime detector honors configured project commands', () => {
|
|
38
49
|
const dir = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'agent-runtime-config-'));
|
|
39
50
|
try {
|
|
@@ -8,6 +8,7 @@ const strict_1 = __importDefault(require("node:assert/strict"));
|
|
|
8
8
|
const node_fs_1 = require("node:fs");
|
|
9
9
|
const node_os_1 = require("node:os");
|
|
10
10
|
const node_path_1 = require("node:path");
|
|
11
|
+
const node_stream_1 = require("node:stream");
|
|
11
12
|
const local_core_acp_response_processor_js_1 = require("../services/local-ai-core/src/acp/local-core-acp-response-processor.js");
|
|
12
13
|
const scheduled_conversation_executor_js_1 = require("../services/local-ai-core/src/scheduler/scheduled-conversation-executor.js");
|
|
13
14
|
const scheduler_run_lifecycle_js_1 = require("../services/local-ai-core/src/scheduler/scheduler-run-lifecycle.js");
|
|
@@ -821,6 +822,101 @@ const local_core_acp_store_js_1 = require("../services/local-ai-core/src/acp/loc
|
|
|
821
822
|
strict_1.default.match(createdCards[0]?.elements?.[0]?.content || '', /请直接回复/);
|
|
822
823
|
strict_1.default.equal(createdCards[0]?.elements?.some((element) => element.tag === 'action'), false);
|
|
823
824
|
});
|
|
825
|
+
(0, node_test_1.default)('lark image messages are downloaded and forwarded as generic channel image parts', async () => {
|
|
826
|
+
const sentMessages = [];
|
|
827
|
+
const pngBytes = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
828
|
+
const client = {
|
|
829
|
+
im: {
|
|
830
|
+
messageResource: {
|
|
831
|
+
get: async (request) => {
|
|
832
|
+
strict_1.default.equal(request.path.message_id, 'msg-image-1');
|
|
833
|
+
strict_1.default.equal(request.path.file_key, 'img-key-1');
|
|
834
|
+
strict_1.default.equal(request.params.type, 'image');
|
|
835
|
+
return {
|
|
836
|
+
headers: { 'content-type': 'image/png' },
|
|
837
|
+
getReadableStream: () => node_stream_1.Readable.from([pngBytes]),
|
|
838
|
+
};
|
|
839
|
+
},
|
|
840
|
+
},
|
|
841
|
+
messageReaction: {
|
|
842
|
+
create: async () => ({ data: { reaction_id: 'reaction-1' } }),
|
|
843
|
+
},
|
|
844
|
+
},
|
|
845
|
+
};
|
|
846
|
+
const gateway = new local_core_lark_gateway_js_1.LocalCoreLarkGateway({
|
|
847
|
+
store: {
|
|
848
|
+
expirePendingPairings: () => { },
|
|
849
|
+
getAuthorizedUser: () => ({
|
|
850
|
+
id: 'auth-1',
|
|
851
|
+
workspace_id: 'default',
|
|
852
|
+
platform: 'lark',
|
|
853
|
+
platform_user_id: 'user-1',
|
|
854
|
+
chat_id: 'chat-1',
|
|
855
|
+
display_name: 'User',
|
|
856
|
+
thread_id: 'thread-1',
|
|
857
|
+
}),
|
|
858
|
+
getPlatformThreadBinding: () => ({
|
|
859
|
+
workspace_id: 'default',
|
|
860
|
+
platform: 'lark',
|
|
861
|
+
chat_id: 'chat-1',
|
|
862
|
+
platform_user_id: 'user-1',
|
|
863
|
+
thread_id: 'thread-1',
|
|
864
|
+
last_platform_message_id: null,
|
|
865
|
+
}),
|
|
866
|
+
getLatestRunForThread: () => null,
|
|
867
|
+
clearPlatformThreadMessageId: () => { },
|
|
868
|
+
},
|
|
869
|
+
readConfig: async () => ({
|
|
870
|
+
projects: [{
|
|
871
|
+
name: 'default',
|
|
872
|
+
root: '/tmp/project',
|
|
873
|
+
platforms: [{
|
|
874
|
+
type: 'lark',
|
|
875
|
+
options: {
|
|
876
|
+
app_id: 'app-1',
|
|
877
|
+
app_secret: 'secret-1',
|
|
878
|
+
},
|
|
879
|
+
}],
|
|
880
|
+
}],
|
|
881
|
+
}),
|
|
882
|
+
getWorkspaceRouter: () => ({
|
|
883
|
+
getThreadSessionKey: (threadId) => `session:${threadId}`,
|
|
884
|
+
sendThreadMessage: async (threadId, content) => {
|
|
885
|
+
sentMessages.push({ threadId, content });
|
|
886
|
+
return { runId: 'run-1' };
|
|
887
|
+
},
|
|
888
|
+
}),
|
|
889
|
+
eventBus: { emit: () => { }, on: () => () => { } },
|
|
890
|
+
});
|
|
891
|
+
const internals = gateway;
|
|
892
|
+
internals.runtime.set('default', {
|
|
893
|
+
workspaceId: 'default',
|
|
894
|
+
enabled: true,
|
|
895
|
+
status: 'running',
|
|
896
|
+
connected: true,
|
|
897
|
+
appId: 'app-1',
|
|
898
|
+
client,
|
|
899
|
+
});
|
|
900
|
+
await internals.handleMessageEvent('default', {
|
|
901
|
+
event: {
|
|
902
|
+
sender: {
|
|
903
|
+
sender_id: { user_id: 'user-1' },
|
|
904
|
+
},
|
|
905
|
+
message: {
|
|
906
|
+
message_id: 'msg-image-1',
|
|
907
|
+
message_type: 'image',
|
|
908
|
+
chat_id: 'chat-1',
|
|
909
|
+
content: JSON.stringify({ image_key: 'img-key-1' }),
|
|
910
|
+
},
|
|
911
|
+
},
|
|
912
|
+
});
|
|
913
|
+
strict_1.default.equal(sentMessages.length, 1);
|
|
914
|
+
strict_1.default.equal(sentMessages[0]?.threadId, 'thread-1');
|
|
915
|
+
strict_1.default.match(sentMessages[0]?.content?.displayText, /\[User Message\]\n\[Image\]\n\[\/User Message\]/);
|
|
916
|
+
strict_1.default.deepEqual(sentMessages[0]?.content?.contentParts?.map((part) => part.type), ['text', 'image']);
|
|
917
|
+
strict_1.default.equal(sentMessages[0]?.content?.contentParts?.[1]?.mimeType, 'image/png');
|
|
918
|
+
strict_1.default.equal(sentMessages[0]?.content?.contentParts?.[1]?.data, pngBytes.toString('base64'));
|
|
919
|
+
});
|
|
824
920
|
(0, node_test_1.default)('lark message callbacks acknowledge before long thread runs finish', async () => {
|
|
825
921
|
let registeredHandlers = {};
|
|
826
922
|
let sentMessages = 0;
|
|
@@ -31,7 +31,7 @@ function plugin(id, dependsOn = []) {
|
|
|
31
31
|
strict_1.default.deepEqual(kernel.getCapabilitySnapshot(), {
|
|
32
32
|
adapters: {
|
|
33
33
|
channels: ['localcore-acp'],
|
|
34
|
-
agents: ['
|
|
34
|
+
agents: ['cursor', 'gemini', 'qoder', 'iflow', 'localcore-acp'],
|
|
35
35
|
knowledge: false,
|
|
36
36
|
knowledgeProviders: [],
|
|
37
37
|
},
|
|
@@ -43,7 +43,6 @@ function plugin(id, dependsOn = []) {
|
|
|
43
43
|
},
|
|
44
44
|
snapshot: {
|
|
45
45
|
agents: [
|
|
46
|
-
{ id: 'agent.codex', agentType: 'codex', displayName: 'codex' },
|
|
47
46
|
{ id: 'agent.cursor', agentType: 'cursor', displayName: 'cursor' },
|
|
48
47
|
{ id: 'agent.gemini', agentType: 'gemini', displayName: 'gemini' },
|
|
49
48
|
{ id: 'agent.qoder', agentType: 'qoder', displayName: 'qoder' },
|
|
@@ -115,10 +114,9 @@ function plugin(id, dependsOn = []) {
|
|
|
115
114
|
const kernel = (0, bootstrap_js_1.bootstrapLocalCoreKernel)();
|
|
116
115
|
await kernel.lifecycle.initAll();
|
|
117
116
|
const diagnostics = await kernel.diagnostics.snapshot();
|
|
118
|
-
strict_1.default.equal(diagnostics.pluginCount,
|
|
119
|
-
strict_1.default.equal(diagnostics.enabledPluginCount,
|
|
117
|
+
strict_1.default.equal(diagnostics.pluginCount, 6);
|
|
118
|
+
strict_1.default.equal(diagnostics.enabledPluginCount, 6);
|
|
120
119
|
strict_1.default.deepEqual(diagnostics.plugins.map((plugin) => plugin.pluginId).sort(), [
|
|
121
|
-
'builtin.agent-codex',
|
|
122
120
|
'builtin.agent-cursor',
|
|
123
121
|
'builtin.agent-gemini',
|
|
124
122
|
'builtin.agent-iflow',
|
|
@@ -131,7 +129,6 @@ function plugin(id, dependsOn = []) {
|
|
|
131
129
|
enabled: plugin.enabled,
|
|
132
130
|
health: plugin.health,
|
|
133
131
|
})), [
|
|
134
|
-
'builtin.agent-codex',
|
|
135
132
|
'builtin.agent-cursor',
|
|
136
133
|
'builtin.agent-gemini',
|
|
137
134
|
'builtin.agent-qoder',
|
|
@@ -151,13 +148,13 @@ function plugin(id, dependsOn = []) {
|
|
|
151
148
|
userDataPath,
|
|
152
149
|
});
|
|
153
150
|
strict_1.default.deepEqual(runtime.kernel.getCapabilitySnapshot().adapters.agents, [
|
|
154
|
-
'codex',
|
|
155
151
|
'cursor',
|
|
156
152
|
'gemini',
|
|
157
153
|
'qoder',
|
|
158
154
|
'iflow',
|
|
159
155
|
'localcore-acp',
|
|
160
156
|
'opencode',
|
|
157
|
+
'codex',
|
|
161
158
|
'claudecode',
|
|
162
159
|
]);
|
|
163
160
|
strict_1.default.deepEqual(runtime.kernel.getCapabilitySnapshot().adapters.channels, ['localcore-acp', 'lark', 'weixin']);
|
|
@@ -184,13 +181,13 @@ function plugin(id, dependsOn = []) {
|
|
|
184
181
|
enableKnowledge: false,
|
|
185
182
|
});
|
|
186
183
|
strict_1.default.deepEqual(runtime.kernel.getCapabilitySnapshot().adapters.agents, [
|
|
187
|
-
'codex',
|
|
188
184
|
'cursor',
|
|
189
185
|
'gemini',
|
|
190
186
|
'qoder',
|
|
191
187
|
'iflow',
|
|
192
188
|
'localcore-acp',
|
|
193
189
|
'opencode',
|
|
190
|
+
'codex',
|
|
194
191
|
'claudecode',
|
|
195
192
|
]);
|
|
196
193
|
strict_1.default.deepEqual(runtime.kernel.getCapabilitySnapshot().adapters.channels, ['localcore-acp', 'lark', 'weixin']);
|
|
@@ -207,6 +204,43 @@ function plugin(id, dependsOn = []) {
|
|
|
207
204
|
(0, node_fs_1.rmSync)(userDataPath, { recursive: true, force: true });
|
|
208
205
|
}
|
|
209
206
|
});
|
|
207
|
+
(0, node_test_1.default)('codex agent runtime routes projects through the bundled ACP adapter', async () => {
|
|
208
|
+
const userDataPath = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'agentdock-kernel-'));
|
|
209
|
+
try {
|
|
210
|
+
const runtime = (0, bootstrap_js_2.bootstrapLocalCoreRuntime)({
|
|
211
|
+
userDataPath,
|
|
212
|
+
enableKnowledge: false,
|
|
213
|
+
});
|
|
214
|
+
await runtime.state.saveRawConfigFile(`
|
|
215
|
+
[[projects]]
|
|
216
|
+
name = "codex-workspace"
|
|
217
|
+
|
|
218
|
+
[projects.agent]
|
|
219
|
+
type = "codex"
|
|
220
|
+
`);
|
|
221
|
+
const configState = await runtime.state.readConfigFile();
|
|
222
|
+
const project = configState.parsed?.projects?.find((entry) => entry.name === 'codex-workspace');
|
|
223
|
+
const codexRuntime = runtime.agentRuntimes.find((entry) => entry.agentType === 'codex');
|
|
224
|
+
const route = project ? codexRuntime?.createRoute(configState, project) : null;
|
|
225
|
+
strict_1.default.equal(route?.agentType, 'codex');
|
|
226
|
+
strict_1.default.equal(route?.config.command, process.execPath);
|
|
227
|
+
strict_1.default.match(route?.config.args[0] || '', /@zed-industries[/\\]codex-acp[/\\]bin[/\\]codex-acp\.js$/);
|
|
228
|
+
strict_1.default.deepEqual(await runtime.workspaceRouter.listWorkspaces(), [
|
|
229
|
+
{
|
|
230
|
+
id: 'codex-workspace',
|
|
231
|
+
name: 'codex-workspace',
|
|
232
|
+
agentType: 'codex',
|
|
233
|
+
platforms: [],
|
|
234
|
+
sessionsCount: 0,
|
|
235
|
+
heartbeatEnabled: false,
|
|
236
|
+
},
|
|
237
|
+
]);
|
|
238
|
+
await runtime.stop();
|
|
239
|
+
}
|
|
240
|
+
finally {
|
|
241
|
+
(0, node_fs_1.rmSync)(userDataPath, { recursive: true, force: true });
|
|
242
|
+
}
|
|
243
|
+
});
|
|
210
244
|
(0, node_test_1.default)('runtime bootstrap knowledge capabilities come from the selected provider plugin', () => {
|
|
211
245
|
const enabledUserDataPath = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'agentdock-kernel-'));
|
|
212
246
|
const disabledUserDataPath = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'agentdock-kernel-'));
|
|
@@ -538,7 +572,7 @@ name = "claude-workspace"
|
|
|
538
572
|
[projects.agent]
|
|
539
573
|
type = "claudecode"
|
|
540
574
|
`);
|
|
541
|
-
strict_1.default.deepEqual(runtime.agentRuntimes.map((entry) => entry.agentType), ['localcore-acp', 'opencode']);
|
|
575
|
+
strict_1.default.deepEqual(runtime.agentRuntimes.map((entry) => entry.agentType), ['localcore-acp', 'opencode', 'codex']);
|
|
542
576
|
strict_1.default.equal(runtime.kernel.getCapabilitySnapshot().snapshot.agents.some((capability) => capability.agentType === 'claudecode'), false);
|
|
543
577
|
strict_1.default.deepEqual(await runtime.workspaceRouter.listWorkspaces(), []);
|
|
544
578
|
await strict_1.default.rejects(() => runtime.workspaceRouter.listThreads('claude-workspace'), /Workspace "claude-workspace" is not configured as a Local AI Core ACP workspace/);
|
|
@@ -7,6 +7,7 @@ const local_core_acp_transport_js_1 = require("./local-core-acp-transport.js");
|
|
|
7
7
|
const local_core_acp_turn_coordinator_js_1 = require("./local-core-acp-turn-coordinator.js");
|
|
8
8
|
const local_core_acp_session_coordinator_js_1 = require("./local-core-acp-session-coordinator.js");
|
|
9
9
|
const local_core_acp_response_processor_js_1 = require("./local-core-acp-response-processor.js");
|
|
10
|
+
const local_core_acp_content_js_1 = require("./local-core-acp-content.js");
|
|
10
11
|
const command_risk_js_1 = require("../security/command-risk.js");
|
|
11
12
|
const ACP_PROMPT_TIMEOUT_MS = 15 * 60 * 1000;
|
|
12
13
|
class LocalCoreAcpBackend {
|
|
@@ -126,7 +127,7 @@ class LocalCoreAcpBackend {
|
|
|
126
127
|
this.options.store.deleteThread(threadId);
|
|
127
128
|
return { deleted: true };
|
|
128
129
|
}
|
|
129
|
-
async sendThreadMessage(threadId,
|
|
130
|
+
async sendThreadMessage(threadId, input, config) {
|
|
130
131
|
if (!config) {
|
|
131
132
|
throw new Error('localcore-acp message send requires a workspace config.');
|
|
132
133
|
}
|
|
@@ -134,6 +135,8 @@ class LocalCoreAcpBackend {
|
|
|
134
135
|
if (!row) {
|
|
135
136
|
throw new Error(`Thread not found: ${threadId}`);
|
|
136
137
|
}
|
|
138
|
+
const message = (0, local_core_acp_content_js_1.normalizeThreadMessageInput)(input);
|
|
139
|
+
const content = message.displayText;
|
|
137
140
|
this.options.store.appendMessage(threadId, 'user', content, 'final');
|
|
138
141
|
this.options.eventBus.emit({
|
|
139
142
|
type: 'thread.message.accepted',
|
|
@@ -169,7 +172,7 @@ class LocalCoreAcpBackend {
|
|
|
169
172
|
sessionKey: row.bridge_session_key,
|
|
170
173
|
},
|
|
171
174
|
});
|
|
172
|
-
void this.runPrompt(threadId, runId, row.bridge_session_key, config,
|
|
175
|
+
void this.runPrompt(threadId, runId, row.bridge_session_key, config, message).catch((error) => {
|
|
173
176
|
this.options.log?.(`localcore-acp prompt failed for ${threadId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
174
177
|
});
|
|
175
178
|
return { runId };
|
|
@@ -219,7 +222,7 @@ class LocalCoreAcpBackend {
|
|
|
219
222
|
async interruptRun(runId) {
|
|
220
223
|
return this.sessionCoordinator.interruptRun(runId);
|
|
221
224
|
}
|
|
222
|
-
async runPrompt(threadId, runId, bridgeSessionKey, config,
|
|
225
|
+
async runPrompt(threadId, runId, bridgeSessionKey, config, input) {
|
|
223
226
|
const row = this.options.store.getThreadRow(threadId);
|
|
224
227
|
if (!row) {
|
|
225
228
|
throw new Error(`Thread not found: ${threadId}`);
|
|
@@ -229,6 +232,8 @@ class LocalCoreAcpBackend {
|
|
|
229
232
|
sessionKey: bridgeSessionKey,
|
|
230
233
|
replyCtx: runId,
|
|
231
234
|
});
|
|
235
|
+
const message = (0, local_core_acp_content_js_1.normalizeThreadMessageInput)(input);
|
|
236
|
+
const content = message.displayText;
|
|
232
237
|
let session = null;
|
|
233
238
|
try {
|
|
234
239
|
session = await this.sessionCoordinator.ensureSession(threadId, bridgeSessionKey, config);
|
|
@@ -256,12 +261,7 @@ class LocalCoreAcpBackend {
|
|
|
256
261
|
const promptPromise = this.transport.request(session, 'session/prompt', {
|
|
257
262
|
sessionId: session.sessionId,
|
|
258
263
|
messageId: (0, node_crypto_1.randomUUID)(),
|
|
259
|
-
prompt:
|
|
260
|
-
{
|
|
261
|
-
type: 'text',
|
|
262
|
-
text: content,
|
|
263
|
-
},
|
|
264
|
-
],
|
|
264
|
+
prompt: message.contentParts,
|
|
265
265
|
}, ACP_PROMPT_TIMEOUT_MS);
|
|
266
266
|
session.promptPromise = promptPromise;
|
|
267
267
|
const result = await promptPromise;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeThreadMessageInput = normalizeThreadMessageInput;
|
|
4
|
+
exports.createTextMessageInput = createTextMessageInput;
|
|
5
|
+
function normalizeThreadMessageInput(input) {
|
|
6
|
+
if (typeof input === 'string') {
|
|
7
|
+
return {
|
|
8
|
+
displayText: input,
|
|
9
|
+
contentParts: [{ type: 'text', text: input }],
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
const displayText = String(input.displayText || '').trim();
|
|
13
|
+
const contentParts = Array.isArray(input.contentParts)
|
|
14
|
+
? input.contentParts.filter(isSupportedContentPart)
|
|
15
|
+
: [];
|
|
16
|
+
if (contentParts.length > 0) {
|
|
17
|
+
return {
|
|
18
|
+
displayText: displayText || summarizeContentParts(contentParts),
|
|
19
|
+
contentParts,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const fallbackText = displayText || '';
|
|
23
|
+
return {
|
|
24
|
+
displayText: fallbackText,
|
|
25
|
+
contentParts: [{ type: 'text', text: fallbackText }],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function createTextMessageInput(text) {
|
|
29
|
+
return normalizeThreadMessageInput(text);
|
|
30
|
+
}
|
|
31
|
+
function isSupportedContentPart(part) {
|
|
32
|
+
if (!part || typeof part !== 'object') {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const type = String(part.type || '');
|
|
36
|
+
if (type === 'text') {
|
|
37
|
+
return Boolean(String(part.text || ''));
|
|
38
|
+
}
|
|
39
|
+
if (type === 'image') {
|
|
40
|
+
const image = part;
|
|
41
|
+
return Boolean(String(image.data || image.uri || ''));
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
function summarizeContentParts(parts) {
|
|
46
|
+
const text = parts
|
|
47
|
+
.filter((part) => part.type === 'text')
|
|
48
|
+
.map((part) => part.text.trim())
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.join('\n\n')
|
|
51
|
+
.trim();
|
|
52
|
+
if (text) {
|
|
53
|
+
return text;
|
|
54
|
+
}
|
|
55
|
+
const imageCount = parts.filter((part) => part.type === 'image').length;
|
|
56
|
+
if (imageCount > 0) {
|
|
57
|
+
return imageCount === 1 ? '[Image]' : `[${imageCount} images]`;
|
|
58
|
+
}
|
|
59
|
+
return '';
|
|
60
|
+
}
|