cli-link 0.0.6 → 0.0.8

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 (57) hide show
  1. package/README.md +56 -14
  2. package/dist/client/assets/History-D2xDopni.js +4 -0
  3. package/dist/client/assets/ImageViewer-DuegU_fC.js +1 -0
  4. package/dist/client/assets/MarkdownRenderer-CsyizEL3.js +1 -0
  5. package/dist/client/assets/{PageTopBar-C8j-5s_3.js → PageTopBar-CQwjO6Af.js} +1 -1
  6. package/dist/client/assets/Session-B0s5zBGg.js +7 -0
  7. package/dist/client/assets/Settings-CfHFmJdV.js +1 -0
  8. package/dist/client/assets/Workspace-Cfl0mbNE.js +4 -0
  9. package/dist/client/assets/WorkspaceLinkedText-DCVYd9x-.js +2 -0
  10. package/dist/client/assets/c-BIGW1oBm.js +1 -0
  11. package/dist/client/assets/cpp-DIPi6g--.js +1 -0
  12. package/dist/client/assets/csharp-DSvCPggb.js +1 -0
  13. package/dist/client/assets/dart-bE4Kk8sk.js +1 -0
  14. package/dist/client/assets/dotenv-Da5cRb03.js +1 -0
  15. package/dist/client/assets/go-C27-OAKa.js +1 -0
  16. package/dist/client/assets/graphql-pNE0_Gx8.js +1 -0
  17. package/dist/client/assets/groovy-gcz8RCvz.js +1 -0
  18. package/dist/client/assets/index-BCg3ymV3.css +1 -0
  19. package/dist/client/assets/index-CrJqHlc8.js +2 -0
  20. package/dist/client/assets/java-VnEXKtx_.js +148 -0
  21. package/dist/client/assets/jsx-g9-lgVsj.js +1 -0
  22. package/dist/client/assets/kotlin-BdnUsdx6.js +1 -0
  23. package/dist/client/assets/less-B1dDrJ26.js +1 -0
  24. package/dist/client/assets/lua-BaeVxFsk.js +1 -0
  25. package/dist/client/assets/makefile-CHLpvVh8.js +1 -0
  26. package/dist/client/assets/php-BcCyJq-p.js +1 -0
  27. package/dist/client/assets/properties-DTPjHERo.js +1 -0
  28. package/dist/client/assets/ruby-BwImf3Ka.js +1 -0
  29. package/dist/client/assets/rust-B1yitclQ.js +1 -0
  30. package/dist/client/assets/scss-lMagJa-5.js +1 -0
  31. package/dist/client/assets/sql-CRqJ_cUM.js +1 -0
  32. package/dist/client/assets/svelte-B4a9v_or.js +1 -0
  33. package/dist/client/assets/swift-D82vCrfD.js +1 -0
  34. package/dist/client/assets/toml-vGWfd6FD.js +1 -0
  35. package/dist/client/assets/{vendor-icons-CNN4EKVi.js → vendor-icons-CMXJHDEv.js} +125 -65
  36. package/dist/client/assets/vendor-markdown--d-T3AbU.js +37 -0
  37. package/dist/client/assets/{vendor-motion-n6Lx6G4a.js → vendor-motion-D0ZmPdi9.js} +1 -1
  38. package/dist/client/assets/{vendor-react-DSV5aFEg.js → vendor-react-CcDXZHn_.js} +1 -1
  39. package/dist/client/assets/{vendor-virtual-CcftJrIC.js → vendor-virtual-DJI7OicV.js} +1 -1
  40. package/dist/client/assets/vue-DBXACu8K.js +1 -0
  41. package/dist/client/assets/workspace-return-FrQUv7g3.js +1 -0
  42. package/dist/client/index.html +4 -4
  43. package/dist/server/cli-manager.js +151 -26
  44. package/dist/server/codex-history.js +119 -17
  45. package/dist/server/index.js +906 -57
  46. package/dist/server/store.js +369 -27
  47. package/package.json +3 -3
  48. package/dist/client/assets/History-BxJVDFpN.js +0 -3
  49. package/dist/client/assets/MarkdownRenderer-BO-KS_L1.js +0 -1
  50. package/dist/client/assets/Session-CQFXA2Sr.js +0 -11
  51. package/dist/client/assets/Settings-DYmjRmoN.js +0 -1
  52. package/dist/client/assets/Workspace-D8kv9euM.js +0 -8
  53. package/dist/client/assets/WorkspaceLinkedText-DQyPLk-X.js +0 -2
  54. package/dist/client/assets/code-highlight-CEcsuMpw.js +0 -1
  55. package/dist/client/assets/index-BXT2BylN.css +0 -1
  56. package/dist/client/assets/index-DOgH1Kf3.js +0 -2
  57. package/dist/client/assets/vendor-markdown-BDwu-Ux6.js +0 -35
@@ -1,4 +1,4 @@
1
- import{r as E,a as F}from"./vendor-react-DSV5aFEg.js";function b(o,r,e){let t=e.initialDeps??[],s,n=!0;function l(){var i,a,u;let c;e.key&&((i=e.debug)!=null&&i.call(e))&&(c=Date.now());const f=o();if(!(f.length!==t.length||f.some((v,d)=>t[d]!==v)))return s;t=f;let g;if(e.key&&((a=e.debug)!=null&&a.call(e))&&(g=Date.now()),s=r(...f),e.key&&((u=e.debug)!=null&&u.call(e))){const v=Math.round((Date.now()-c)*100)/100,d=Math.round((Date.now()-g)*100)/100,S=d/16,x=(m,M)=>{for(m=String(m);m.length<M;)m=" "+m;return m};console.info(`%c⏱ ${x(d,5)} /${x(v,5)} ms`,`
1
+ import{r as E,a as F}from"./vendor-react-CcDXZHn_.js";function b(o,r,e){let t=e.initialDeps??[],s,n=!0;function l(){var i,a,u;let c;e.key&&((i=e.debug)!=null&&i.call(e))&&(c=Date.now());const f=o();if(!(f.length!==t.length||f.some((v,d)=>t[d]!==v)))return s;t=f;let g;if(e.key&&((a=e.debug)!=null&&a.call(e))&&(g=Date.now()),s=r(...f),e.key&&((u=e.debug)!=null&&u.call(e))){const v=Math.round((Date.now()-c)*100)/100,d=Math.round((Date.now()-g)*100)/100,S=d/16,x=(m,M)=>{for(m=String(m);m.length<M;)m=" "+m;return m};console.info(`%c⏱ ${x(d,5)} /${x(v,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,e==null?void 0:e.key)}return e!=null&&e.onChange&&!(n&&e.skipInitialOnChange)&&e.onChange(s),n=!1,s}return l.updateDeps=i=>{t=i},l}function w(o,r){if(o===void 0)throw new Error("Unexpected undefined");return o}const R=(o,r)=>Math.abs(o-r)<1.01,_=(o,r,e)=>{let t;return function(...s){o.clearTimeout(t),t=o.setTimeout(()=>r.apply(this,s),e)}},I=o=>{const{offsetWidth:r,offsetHeight:e}=o;return{width:r,height:e}},T=o=>o,W=o=>{const r=Math.max(o.startIndex-o.overscan,0),e=Math.min(o.endIndex+o.overscan,o.count-1),t=[];for(let s=r;s<=e;s++)t.push(s);return t},k=(o,r)=>{const e=o.scrollElement;if(!e)return;const t=o.targetWindow;if(!t)return;const s=l=>{const{width:i,height:a}=l;r({width:Math.round(i),height:Math.round(a)})};if(s(I(e)),!t.ResizeObserver)return()=>{};const n=new t.ResizeObserver(l=>{const i=()=>{const a=l[0];if(a!=null&&a.borderBoxSize){const u=a.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(I(e))};o.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return n.observe(e,{box:"border-box"}),()=>{n.unobserve(e)}},C={passive:!0},z=typeof window>"u"?!0:"onscrollend"in window,L=(o,r)=>{const e=o.scrollElement;if(!e)return;const t=o.targetWindow;if(!t)return;let s=0;const n=o.options.useScrollendEvent&&z?()=>{}:_(t,()=>{r(s,!1)},o.options.isScrollingResetDelay),l=c=>()=>{const{horizontal:f,isRtl:h}=o.options;s=f?e.scrollLeft*(h&&-1||1):e.scrollTop,n(),r(s,c)},i=l(!0),a=l(!1);e.addEventListener("scroll",i,C);const u=o.options.useScrollendEvent&&z;return u&&e.addEventListener("scrollend",a,C),()=>{e.removeEventListener("scroll",i),u&&e.removeEventListener("scrollend",a)}},D=(o,r,e)=>{if(r!=null&&r.borderBoxSize){const t=r.borderBoxSize[0];if(t)return Math.round(t[e.options.horizontal?"inlineSize":"blockSize"])}return o[e.options.horizontal?"offsetWidth":"offsetHeight"]},j=(o,{adjustments:r=0,behavior:e},t)=>{var s,n;const l=o+r;(n=(s=t.scrollElement)==null?void 0:s.scrollTo)==null||n.call(s,{[t.options.horizontal?"left":"top"]:l,behavior:e})};class P{constructor(r){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,t,s;return((s=(t=(e=this.targetWindow)==null?void 0:e.performance)==null?void 0:t.now)==null?void 0:s.call(t))??Date.now()},this.observer=(()=>{let e=null;const t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(s=>{s.forEach(n=>{const l=()=>{const i=n.target,a=this.indexFromElement(i);if(!i.isConnected){this.observer.unobserve(i);return}this.shouldMeasureDuringScroll(a)&&this.resizeItem(a,this.options.measureElement(i,n,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var s;(s=t())==null||s.disconnect(),e=null},observe:s=>{var n;return(n=t())==null?void 0:n.observe(s,{box:"border-box"})},unobserve:s=>{var n;return(n=t())==null?void 0:n.unobserve(s)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,s])=>{typeof s>"u"&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:T,rangeExtractor:W,onChange:()=>{},measureElement:D,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var t,s;(s=(t=this.options).onChange)==null||s.call(t,this,e)},this.maybeNotify=b(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t){this.maybeNotify();return}this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,n)=>{this.scrollAdjustments=0,this.scrollDirection=n?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=n,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{const s=new Map,n=new Map;for(let l=t-1;l>=0;l--){const i=e[l];if(s.has(i.lane))continue;const a=n.get(i.lane);if(a==null||i.end>a.end?n.set(i.lane,i):i.end<a.end&&s.set(i.lane,!0),s.size===this.options.lanes)break}return n.size===this.options.lanes?Array.from(n.values()).sort((l,i)=>l.end===i.end?l.index-i.index:l.end-i.end)[0]:void 0},this.getMeasurementOptions=b(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,t,s,n,l,i)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:s,getItemKey:n,enabled:l,lanes:i}),{key:!1}),this.getMeasurements=b(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:s,getItemKey:n,enabled:l,lanes:i},a)=>{if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const h of this.laneAssignments.keys())h>=e&&this.laneAssignments.delete(h);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const c=this.measurementsCache.slice(0,u),f=new Array(i).fill(void 0);for(let h=0;h<u;h++){const g=c[h];g&&(f[g.lane]=h)}for(let h=u;h<e;h++){const g=n(h),v=this.laneAssignments.get(h);let d,S;if(v!==void 0&&this.options.lanes>1){d=v;const p=f[d],O=p!==void 0?c[p]:void 0;S=O?O.end+this.options.gap:t+s}else{const p=this.options.lanes===1?c[h-1]:this.getFurthestMeasurement(c,h);S=p?p.end+this.options.gap:t+s,d=p?p.lane:h%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(h,d)}const x=a.get(g),m=typeof x=="number"?x:this.options.estimateSize(h),M=S+m;c[h]={index:h,start:S,size:m,end:M,key:g,lane:d},f[d]=h}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=b(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,s,n)=>this.range=e.length>0&&t>0?B({measurements:e,outerSize:t,scrollOffset:s,lanes:n}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=b(()=>{let e=null,t=null;const s=this.calculateRange();return s&&(e=s.startIndex,t=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,s,n,l)=>n===null||l===null?[]:e({startIndex:n,endIndex:l,overscan:t,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,s=e.getAttribute(t);return s?parseInt(s,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:t.index);if(s!==void 0&&this.range){const n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,s-n),i=Math.min(this.options.count-1,s+n);return e>=l&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((l,i)=>{l.isConnected||(this.observer.unobserve(l),this.elementsCache.delete(i))});return}const t=this.indexFromElement(e),s=this.options.getItemKey(t),n=this.elementsCache.get(s);n!==e&&(n&&this.observer.unobserve(n),this.observer.observe(e),this.elementsCache.set(s,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var s;const n=this.measurementsCache[e];if(!n)return;const l=this.itemSizeCache.get(n.key)??n.size,i=t-l;i!==0&&(((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,i,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))},this.getVirtualItems=b(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{const s=[];for(let n=0,l=e.length;n<l;n++){const i=e[n],a=t[i];s.push(a)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(t.length!==0)return w(t[A(0,t.length-1,s=>w(t[s]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,s=0)=>{if(!this.scrollElement)return 0;const n=this.getSize(),l=this.getScrollOffset();t==="auto"&&(t=e>=l+n?"end":"start"),t==="center"?e+=(s-n)/2:t==="end"&&(e-=n);const i=this.getMaxScrollOffset();return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const s=this.getSize(),n=this.getScrollOffset(),l=this.measurementsCache[e];if(!l)return;if(t==="auto")if(l.end>=n+s-this.options.scrollPaddingEnd)t="end";else if(l.start<=n+this.options.scrollPaddingStart)t="start";else return[n,t];if(t==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];const i=t==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,l.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:s="auto"}={})=>{const n=this.getOffsetForAlignment(e,t),l=this.now();this.scrollState={index:null,align:t,behavior:s,startedAt:l,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t="auto",behavior:s="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.getOffsetForIndex(e,t);if(!n)return;const[l,i]=n,a=this.now();this.scrollState={index:e,align:i,behavior:s,startedAt:a,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t="auto"}={})=>{const s=this.getScrollOffset()+e,n=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:n,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;const t=this.getMeasurements();let s;if(t.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((e=t[t.length-1])==null?void 0:e.end)??0;else{const n=Array(this.options.lanes).fill(null);let l=t.length-1;for(;l>=0&&n.some(i=>i===null);){const i=t[l];n[i.lane]===null&&(n[i.lane]=i.end),l--}s=Math.max(...n.filter(i=>i!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:s})=>{this.options.scrollToFn(e,{behavior:s,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(r)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const t=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=t?t[0]:this.scrollState.lastTargetOffset,n=1,l=s!==this.scrollState.lastTargetOffset;if(!l&&R(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.scrollState=null;return}}else this.scrollState.stableFrames=0,l&&(this.scrollState.lastTargetOffset=s,this.scrollState.behavior="auto",this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const A=(o,r,e,t)=>{for(;o<=r;){const s=(o+r)/2|0,n=e(s);if(n<t)o=s+1;else if(n>t)r=s-1;else return s}return o>0?o-1:0};function B({measurements:o,outerSize:r,scrollOffset:e,lanes:t}){const s=o.length-1,n=a=>o[a].start;if(o.length<=t)return{startIndex:0,endIndex:s};let l=A(0,s,n,e),i=l;if(t===1)for(;i<s&&o[i].end<e+r;)i++;else if(t>1){const a=Array(t).fill(0);for(;i<s&&a.some(c=>c<e+r);){const c=o[i];a[c.lane]=c.end,i++}const u=Array(t).fill(e+r);for(;l>=0&&u.some(c=>c>=e);){const c=o[l];u[c.lane]=c.start,l--}l=Math.max(0,l-l%t),i=Math.min(s,i+(t-1-i%t))}return{startIndex:l,endIndex:i}}const y=typeof document<"u"?E.useLayoutEffect:E.useEffect;function N({useFlushSync:o=!0,...r}){const e=E.useReducer(()=>({}),{})[1],t={...r,onChange:(n,l)=>{var i;o&&l?F.flushSync(e):e(),(i=r.onChange)==null||i.call(r,n,l)}},[s]=E.useState(()=>new P(t));return s.setOptions(t),y(()=>s._didMount(),[]),y(()=>s._willUpdate()),s}function H(o){return N({observeElementRect:k,observeElementOffset:L,scrollToFn:j,...o})}export{H as u};
@@ -0,0 +1 @@
1
+ import{h as e,j as t,e as n,t as a,d as s}from"./java-VnEXKtx_.js";import"./vendor-react-CcDXZHn_.js";import"./index-CrJqHlc8.js";import"./vendor-icons-CMXJHDEv.js";import"./vendor-markdown--d-T3AbU.js";const i=Object.freeze(JSON.parse('{"displayName":"HTML (Derivative)","injections":{"R:text.html - (comment.block, text.html meta.embedded, meta.tag.*.*.html, meta.tag.*.*.*.html, meta.tag.*.*.*.*.html)":{"patterns":[{"match":"<","name":"invalid.illegal.bad-angle-bracket.html"}]}},"name":"html-derivative","patterns":[{"include":"text.html.basic#core-minus-invalid"},{"begin":"(</?)(\\\\w[^<>\\\\s]*)(?<!/)","beginCaptures":{"1":{"name":"punctuation.definition.tag.begin.html"},"2":{"name":"entity.name.tag.html"}},"end":"((?: ?/)?>)","endCaptures":{"1":{"name":"punctuation.definition.tag.end.html"}},"name":"meta.tag.other.unrecognized.html.derivative","patterns":[{"include":"text.html.basic#attribute"}]}],"scopeName":"text.html.derivative","embeddedLangs":["html"]}')),u=[...e,i],m=Object.freeze(JSON.parse('{"fileTypes":[],"injectTo":["text.html.markdown"],"injectionSelector":"L:text.html.markdown","name":"markdown-vue","patterns":[{"include":"#vue-code-block"}],"repository":{"vue-code-block":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(vue)((\\\\s+|[,:?{])[^`~]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown","patterns":[]}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"include":"text.html.vue"}]}},"scopeName":"markdown.vue.codeblock"}')),r=[m],c=Object.freeze(JSON.parse('{"fileTypes":[],"injectTo":["source.vue","text.html.markdown","text.html.derivative","text.pug"],"injectionSelector":"L:meta.tag -meta.attribute -meta.ng-binding -entity.name.tag.pug -attribute_value -source.tsx -source.js.jsx, L:meta.element -meta.attribute","name":"vue-directives","patterns":[{"include":"text.html.vue#vue-directives"}],"scopeName":"vue.directives"}')),l=[c],o=Object.freeze(JSON.parse('{"fileTypes":[],"injectTo":["source.vue","text.html.markdown","text.html.derivative","text.pug"],"injectionSelector":"L:text.pug -comment -string.comment, L:text.html.derivative -comment.block, L:text.html.markdown -comment.block","name":"vue-interpolations","patterns":[{"include":"text.html.vue#vue-interpolations"}],"scopeName":"vue.interpolations"}')),d=[o],g=Object.freeze(JSON.parse(`{"fileTypes":[],"injectTo":["source.vue"],"injectionSelector":"L:source.css -comment, L:source.postcss -comment, L:source.sass -comment, L:source.stylus -comment","name":"vue-sfc-style-variable-injection","patterns":[{"include":"#vue-sfc-style-variable-injection"}],"repository":{"vue-sfc-style-variable-injection":{"begin":"\\\\b(v-bind)\\\\s*\\\\(","beginCaptures":{"1":{"name":"entity.name.function"}},"end":"\\\\)","name":"vue.sfc.style.variable.injection.v-bind","patterns":[{"begin":"([\\"'])","beginCaptures":{"1":{"name":"punctuation.definition.tag.begin.html"}},"end":"(\\\\1)","endCaptures":{"1":{"name":"punctuation.definition.tag.end.html"}},"name":"source.ts.embedded.html.vue","patterns":[{"include":"source.js"}]},{"include":"source.js"}]}},"scopeName":"vue.sfc.style.variable.injection","embeddedLangs":["javascript"]}`)),p=[...t,g],b=Object.freeze(JSON.parse(`{"displayName":"Vue","name":"vue","patterns":[{"include":"#vue-comments"},{"include":"#self-closing-tag"},{"begin":"(<)","beginCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"}},"end":"(>)","endCaptures":{"1":{"name":"punctuation.definition.tag.end.html.vue"}},"patterns":[{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)md\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"text.html.markdown","patterns":[{"include":"text.html.markdown"}]}]},{"begin":"(?!template(?![-0-:A-Za-z]))([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)html\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"contentName":"text.html.derivative","end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"include":"#html-stuff"}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)pug\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"text.pug","patterns":[{"include":"text.pug"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)stylus\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.stylus","patterns":[{"include":"source.stylus"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)postcss\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.postcss","patterns":[{"include":"source.postcss"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)sass\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.sass","patterns":[{"include":"source.sass"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)css\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.css","patterns":[{"include":"source.css"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)scss\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.css.scss","patterns":[{"include":"source.css.scss"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)less\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.css.less","patterns":[{"include":"source.css.less"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)js\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.js","patterns":[{"include":"source.js"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)ts\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)(?=[^\\\\n]*<\/script[>\\\\s])","end":"(?=<\/script[>\\\\s])","name":"source.ts","patterns":[{"include":"source.ts"}]},{"begin":"(?<=>)","name":"source.ts","patterns":[{"include":"source.ts"}],"while":"^(?!\\\\s*<\/script[>\\\\s])"}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)jsx\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.js.jsx","patterns":[{"include":"source.js.jsx"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)tsx\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)(?=[^\\\\n]*<\/script[>\\\\s])","end":"(?=<\/script[>\\\\s])","name":"source.tsx","patterns":[{"include":"source.tsx"}]},{"begin":"(?<=>)","name":"source.tsx","patterns":[{"include":"source.tsx"}],"while":"^(?!\\\\s*<\/script[>\\\\s])"}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)coffee\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.coffee","patterns":[{"include":"source.coffee"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)json\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.json","patterns":[{"include":"source.json"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)jsonc\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.json.comments","patterns":[{"include":"source.json.comments"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)json5\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.json5","patterns":[{"include":"source.json5"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)yaml\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.yaml","patterns":[{"include":"source.yaml"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)toml\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.toml","patterns":[{"include":"source.toml"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)(g(?:ql|raphql))\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"source.graphql","patterns":[{"include":"source.graphql"}]}]},{"begin":"([-0-:A-Za-z]+)\\\\b(?=[^>]*\\\\blang\\\\s*=\\\\s*([\\"']?)vue\\\\b\\\\2)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"text.html.vue","patterns":[{"include":"text.html.vue"}]}]},{"begin":"(template)(?=\\\\s|/?>)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</template[>\\\\s])","name":"text.html.derivative","patterns":[{"include":"#html-stuff"}]}]},{"begin":"(script)(?=\\\\s|/?>)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#multi-line-script-tag-stuff"}]},{"begin":"(style)(?=\\\\s|/?>)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#multi-line-style-tag-stuff"}]},{"begin":"([-0-:A-Za-z]+)","beginCaptures":{"1":{"name":"entity.name.tag.$1.html.vue"}},"end":"(</)(\\\\1)\\\\s*(?=>)","endCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</)","name":"text"}]}]}],"repository":{"html-stuff":{"patterns":[{"include":"#template-tag"},{"include":"text.html.derivative"},{"include":"text.html.basic"}]},"multi-line-script-tag-stuff":{"begin":"\\\\G","end":"(?=<\/script[>\\\\s])","patterns":[{"begin":"\\\\G(?!\\\\blang\\\\s*=\\\\s*[\\"']?(?:tsx??|jsx|coffee)\\\\b)","end":"(?=\\\\blang\\\\s*=\\\\s*[\\"']?(?:tsx??|jsx|coffee)\\\\b)|(>)","endCaptures":{"1":{"name":"punctuation.definition.tag.end.html.vue"}},"name":"meta.tag-stuff","patterns":[{"include":"#vue-directives"},{"include":"text.html.basic#attribute"}]},{"begin":"(?=\\\\blang\\\\s*=\\\\s*[\\"']?ts\\\\b)","end":"(?=<\/script[>\\\\s])","patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)(?=[^\\\\n]*<\/script[>\\\\s])","end":"(?=<\/script[>\\\\s])","name":"source.ts","patterns":[{"include":"source.ts"}]},{"begin":"(?<=>)","name":"source.ts","patterns":[{"include":"source.ts"}],"while":"^(?!\\\\s*<\/script[>\\\\s])"}]},{"begin":"(?=\\\\blang\\\\s*=\\\\s*[\\"']?tsx\\\\b)","end":"(?=<\/script[>\\\\s])","patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)(?=[^\\\\n]*<\/script[>\\\\s])","end":"(?=<\/script[>\\\\s])","name":"source.tsx","patterns":[{"include":"source.tsx"}]},{"begin":"(?<=>)","name":"source.tsx","patterns":[{"include":"source.tsx"}],"while":"^(?!\\\\s*<\/script[>\\\\s])"}]},{"begin":"(?=\\\\blang\\\\s*=\\\\s*[\\"']?jsx\\\\b)","end":"(?=<\/script[>\\\\s])","patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=<\/script[>\\\\s])","name":"source.js.jsx","patterns":[{"include":"source.js.jsx"}]}]},{"begin":"(?=\\\\blang\\\\s*=\\\\s*[\\"']?coffee\\\\b)","end":"(?=<\/script[>\\\\s])","patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=<\/script[>\\\\s])","name":"source.coffee","patterns":[{"include":"source.coffee"}]}]},{"begin":"(?<=>)","end":"(?=<\/script[>\\\\s])","name":"source.js","patterns":[{"include":"source.js"}]}]},"multi-line-style-tag-stuff":{"begin":"\\\\G","end":"(?=</style[>\\\\s])","patterns":[{"begin":"\\\\G(?!\\\\blang\\\\s*=\\\\s*[\\"']?(?:scss|stylus|less|postcss)\\\\b)","end":"(?=\\\\blang\\\\s*=\\\\s*[\\"']?(?:scss|stylus|less|postcss)\\\\b)|(>)","endCaptures":{"1":{"name":"punctuation.definition.tag.end.html.vue"}},"name":"meta.tag-stuff","patterns":[{"include":"#vue-directives"},{"include":"text.html.basic#attribute"}]},{"begin":"(?=\\\\blang\\\\s*=\\\\s*[\\"']?scss\\\\b)","end":"(?=</style[>\\\\s])","patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</style[>\\\\s])","name":"source.css.scss","patterns":[{"include":"source.css.scss"}]}]},{"begin":"(?=\\\\blang\\\\s*=\\\\s*[\\"']?stylus\\\\b)","end":"(?=</style[>\\\\s])","patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</style[>\\\\s])","name":"source.stylus","patterns":[{"include":"source.stylus"}]}]},{"begin":"(?=\\\\blang\\\\s*=\\\\s*[\\"']?less\\\\b)","end":"(?=</style[>\\\\s])","patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</style[>\\\\s])","name":"source.css.less","patterns":[{"include":"source.css.less"}]}]},{"begin":"(?=\\\\blang\\\\s*=\\\\s*[\\"']?postcss\\\\b)","end":"(?=</style[>\\\\s])","patterns":[{"include":"#tag-stuff"},{"begin":"(?<=>)","end":"(?=</style[>\\\\s])","name":"source.postcss","patterns":[{"include":"source.postcss"}]}]},{"begin":"(?<=>)","end":"(?=</style[>\\\\s])","name":"source.css","patterns":[{"include":"source.css"}]}]},"self-closing-tag":{"begin":"(<)([-0-:A-Za-z]+)(?=([^>]+/>))","beginCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"end":"(/>)","endCaptures":{"1":{"name":"punctuation.definition.tag.end.html.vue"}},"name":"self-closing-tag","patterns":[{"include":"#tag-stuff"}]},"tag-stuff":{"begin":"\\\\G","end":"(?=/>)|(>)","endCaptures":{"1":{"name":"punctuation.definition.tag.end.html.vue"}},"name":"meta.tag-stuff","patterns":[{"include":"#vue-directives"},{"include":"text.html.basic#attribute"}]},"template-tag":{"patterns":[{"include":"#template-tag-1"},{"include":"#template-tag-2"}]},"template-tag-1":{"begin":"(<)(template)\\\\b(>)","beginCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"},"3":{"name":"punctuation.definition.tag.end.html.vue"}},"end":"(/?>)","endCaptures":{"1":{"name":"punctuation.definition.tag.end.html.vue"}},"name":"meta.template-tag.start","patterns":[{"begin":"\\\\G","end":"(?=/>)|((</)(template)(?=[>\\\\s]))","endCaptures":{"2":{"name":"punctuation.definition.tag.begin.html.vue"},"3":{"name":"entity.name.tag.$3.html.vue"}},"name":"meta.template-tag.end","patterns":[{"include":"#html-stuff"}]}]},"template-tag-2":{"begin":"(<)(template)(?=\\\\s|/?>)","beginCaptures":{"1":{"name":"punctuation.definition.tag.begin.html.vue"},"2":{"name":"entity.name.tag.$2.html.vue"}},"end":"(/?>)","endCaptures":{"1":{"name":"punctuation.definition.tag.end.html.vue"}},"name":"meta.template-tag.start","patterns":[{"begin":"\\\\G","end":"(?=/>)|((</)(template)(?=[>\\\\s]))","endCaptures":{"2":{"name":"punctuation.definition.tag.begin.html.vue"},"3":{"name":"entity.name.tag.$3.html.vue"}},"name":"meta.template-tag.end","patterns":[{"include":"#tag-stuff"},{"include":"#html-stuff"}]}]},"vue-comments":{"patterns":[{"include":"#vue-comments-key-value"},{"begin":"<!--","captures":{"0":{"name":"punctuation.definition.comment.vue"}},"end":"-->","name":"comment.block.vue"}]},"vue-comments-key-value":{"begin":"(<!--)\\\\s*(@)([$\\\\w]+)(?=\\\\s)","beginCaptures":{"1":{"name":"punctuation.definition.comment.vue"},"2":{"name":"punctuation.definition.block.tag.comment.vue"},"3":{"name":"storage.type.class.comment.vue"}},"end":"(-->)","endCaptures":{"1":{"name":"punctuation.definition.comment.vue"}},"name":"comment.block.vue","patterns":[{"include":"source.json#value"}]},"vue-directives":{"patterns":[{"include":"#vue-directives-control"},{"include":"#vue-directives-generic-attr"},{"include":"#vue-directives-style-attr"},{"include":"#vue-directives-original"}]},"vue-directives-control":{"begin":"(?:(v-for)|(v-(?:if|else-if|else)))(?=[)/=>\\\\s])","beginCaptures":{"1":{"name":"keyword.control.loop.vue"},"2":{"name":"keyword.control.conditional.vue"}},"end":"(?=\\\\s*[^=\\\\s])","name":"meta.attribute.directive.control.vue","patterns":[{"include":"#vue-directives-expression"}]},"vue-directives-expression":{"patterns":[{"begin":"(=)\\\\s*([\\"'\`])","beginCaptures":{"1":{"name":"punctuation.separator.key-value.html.vue"},"2":{"name":"punctuation.definition.string.begin.html.vue"}},"end":"(\\\\2)","endCaptures":{"1":{"name":"punctuation.definition.string.end.html.vue"}},"patterns":[{"begin":"(?<=([\\"'\`]))","end":"(?=\\\\1)","name":"source.ts.embedded.html.vue","patterns":[{"include":"source.ts#expression"}]}]},{"begin":"(=)\\\\s*(?=[^\\"'\`])","beginCaptures":{"1":{"name":"punctuation.separator.key-value.html.vue"}},"end":"(?=([>\\\\s]|/>))","patterns":[{"begin":"(?=[^\\"'\`])","end":"(?=([>\\\\s]|/>))","name":"source.ts.embedded.html.vue","patterns":[{"include":"source.ts#expression"}]}]}]},"vue-directives-generic-attr":{"begin":"\\\\b(generic)\\\\s*(=)","beginCaptures":{"1":{"name":"entity.other.attribute-name.html.vue"},"2":{"name":"punctuation.separator.key-value.html.vue"}},"end":"(?<=[\\"'])","name":"meta.attribute.generic.vue","patterns":[{"begin":"([\\"'])","beginCaptures":{"1":{"name":"punctuation.definition.string.begin.html.vue"}},"end":"(\\\\1)","endCaptures":{"1":{"name":"punctuation.definition.string.end.html.vue"}},"name":"meta.type.parameters.vue","patterns":[{"include":"source.ts#comment"},{"match":"(?<![$_[:alnum:]])(?:(?<=\\\\.\\\\.\\\\.)|(?<!\\\\.))(extends|in|out)(?![$_[:alnum:]])(?:(?=\\\\.\\\\.\\\\.)|(?!\\\\.))","name":"storage.modifier.ts"},{"include":"source.ts#type"},{"include":"source.ts#punctuation-comma"},{"match":"(=)(?!>)","name":"keyword.operator.assignment.ts"}]}]},"vue-directives-original":{"begin":"(?:(v-[-\\\\w]+)(:)?|([.:])|(@)|(#))(?:(\\\\[)([^]]*)(])|([-\\\\w]+))?","beginCaptures":{"1":{"name":"entity.other.attribute-name.html.vue"},"2":{"name":"punctuation.separator.key-value.html.vue"},"3":{"name":"punctuation.attribute-shorthand.bind.html.vue"},"4":{"name":"punctuation.attribute-shorthand.event.html.vue"},"5":{"name":"punctuation.attribute-shorthand.slot.html.vue"},"6":{"name":"punctuation.separator.key-value.html.vue"},"7":{"name":"source.ts.embedded.html.vue","patterns":[{"include":"source.ts#expression"}]},"8":{"name":"punctuation.separator.key-value.html.vue"},"9":{"name":"entity.other.attribute-name.html.vue"}},"end":"(?=\\\\s*[^=\\\\s])","name":"meta.attribute.directive.vue","patterns":[{"1":{"name":"punctuation.separator.key-value.html.vue"},"2":{"name":"entity.other.attribute-name.html.vue"},"match":"(\\\\.)([-\\\\w]*)"},{"include":"#vue-directives-expression"}]},"vue-directives-style-attr":{"begin":"\\\\b(style)\\\\s*(=)","beginCaptures":{"1":{"name":"entity.other.attribute-name.html.vue"},"2":{"name":"punctuation.separator.key-value.html.vue"}},"end":"(?<=[\\"'])","name":"meta.attribute.style.vue","patterns":[{"begin":"([\\"'])","beginCaptures":{"1":{"name":"punctuation.definition.string.begin.html.vue"}},"end":"(\\\\1)","endCaptures":{"1":{"name":"punctuation.definition.string.end.html.vue"}},"name":"source.css.embedded.html.vue","patterns":[{"include":"source.css#comment-block"},{"include":"source.css#escapes"},{"include":"source.css#font-features"},{"match":"(?<![-\\\\w])--[-A-Z_a-z[^\\\\x00-\\\\x7F]](?:[-0-9A-Z_a-z[^\\\\x00-\\\\x7F]]|\\\\\\\\(?:\\\\h{1,6}|.))*","name":"variable.css"},{"begin":"(?<![-A-Za-z])(?=[-A-Za-z])","end":"$|(?![-A-Za-z])","name":"meta.property-name.css","patterns":[{"include":"source.css#property-names"}]},{"begin":"(:)\\\\s*","beginCaptures":{"1":{"name":"punctuation.separator.key-value.css"}},"contentName":"meta.property-value.css","end":"\\\\s*(;)|\\\\s*(?=[\\"'])","endCaptures":{"1":{"name":"punctuation.terminator.rule.css"}},"patterns":[{"include":"source.css#comment-block"},{"include":"source.css#property-values"}]},{"match":";","name":"punctuation.terminator.rule.css"}]}]},"vue-interpolations":{"patterns":[{"begin":"(\\\\{\\\\{)","beginCaptures":{"1":{"name":"punctuation.definition.interpolation.begin.html.vue"}},"end":"(}})","endCaptures":{"1":{"name":"punctuation.definition.interpolation.end.html.vue"}},"name":"expression.embedded.vue","patterns":[{"begin":"\\\\G","end":"(?=}})","name":"source.ts.embedded.html.vue","patterns":[{"include":"source.ts#expression"}]}]}]}},"scopeName":"text.html.vue","embeddedLangs":["css","javascript","typescript","json","html","html-derivative","markdown-vue","vue-directives","vue-interpolations","vue-sfc-style-variable-injection"],"embeddedLangsLazy":["markdown","pug","stylus","sass","scss","less","jsx","tsx","coffee","jsonc","json5","yaml","toml","graphql"]}`)),x=[...n,...t,...a,...s,...e,...u,...r,...l,...d,...p,b];export{x as default};
@@ -0,0 +1 @@
1
+ const t="agentpilot.workspaceReturnAnchor";function o(){return typeof window<"u"&&typeof window.sessionStorage<"u"}function n(r){return typeof r=="number"&&Number.isFinite(r)}function i(r){if(!r||typeof r!="object")return!1;const e=r;return typeof e.sourceRoute!="string"||!e.sourceRoute.startsWith("/session")||typeof e.sourceKey!="string"||!e.sourceKey||!n(e.createdAt)||e.messageId!==void 0&&typeof e.messageId!="string"||e.scrollTop!==void 0&&!n(e.scrollTop)||e.messageTop!==void 0&&!n(e.messageTop)||e.expandedIds!==void 0&&(!Array.isArray(e.expandedIds)||e.expandedIds.some(s=>typeof s!="string"))?!1:Date.now()-e.createdAt<=6e5}function a(r){if(o())try{window.sessionStorage.setItem(t,JSON.stringify(r))}catch{}}function c(){if(!o())return null;try{const r=window.sessionStorage.getItem(t);if(!r)return null;const e=JSON.parse(r);if(i(e))return e;window.sessionStorage.removeItem(t)}catch{window.sessionStorage.removeItem(t)}return null}function u(){if(o())try{window.sessionStorage.removeItem(t)}catch{}}export{u as c,c as r,a as s};
@@ -37,10 +37,10 @@
37
37
  }
38
38
  })();
39
39
  </script>
40
- <script type="module" crossorigin src="/assets/index-DOgH1Kf3.js"></script>
41
- <link rel="modulepreload" crossorigin href="/assets/vendor-react-DSV5aFEg.js">
42
- <link rel="modulepreload" crossorigin href="/assets/vendor-icons-CNN4EKVi.js">
43
- <link rel="stylesheet" crossorigin href="/assets/index-BXT2BylN.css">
40
+ <script type="module" crossorigin src="/assets/index-CrJqHlc8.js"></script>
41
+ <link rel="modulepreload" crossorigin href="/assets/vendor-react-CcDXZHn_.js">
42
+ <link rel="modulepreload" crossorigin href="/assets/vendor-icons-CMXJHDEv.js">
43
+ <link rel="stylesheet" crossorigin href="/assets/index-BCg3ymV3.css">
44
44
  </head>
45
45
  <body>
46
46
  <div id="root"></div>
@@ -8,6 +8,8 @@ const DEFAULT_CODEX_CLI_ARGS = [
8
8
  'gpt-5.5',
9
9
  '-c',
10
10
  'model_reasoning_effort="xhigh"',
11
+ '-c',
12
+ 'service_tier="priority"',
11
13
  ];
12
14
  const CONFIRM_PATTERNS = [
13
15
  /\?\s*\[[yY]\/[nN]\]/,
@@ -66,6 +68,7 @@ export class CLIManager {
66
68
  stderrBuffer = '';
67
69
  pendingOutput = '';
68
70
  hasStreamedText = false;
71
+ hasStreamedThinking = false;
69
72
  sessionId = null;
70
73
  allowedTools = new Set();
71
74
  pendingDenials = [];
@@ -74,6 +77,7 @@ export class CLIManager {
74
77
  pendingQuestionToolUseId = null;
75
78
  pendingQuestionNeedsPermissionApproval = false;
76
79
  answeredQuestionToolUseIds = new Set();
80
+ pendingCodexAssistantMessages = [];
77
81
  get status() {
78
82
  return this._status;
79
83
  }
@@ -104,7 +108,7 @@ export class CLIManager {
104
108
  this.onEvent?.(event);
105
109
  }
106
110
  now() {
107
- return new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
111
+ return new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' });
108
112
  }
109
113
  getCLIType() {
110
114
  return this.config.cliType || inferCLIType(this.config.cliCommand);
@@ -132,6 +136,8 @@ export class CLIManager {
132
136
  this.pendingQuestionToolUseId = null;
133
137
  this.pendingQuestionNeedsPermissionApproval = false;
134
138
  this.answeredQuestionToolUseIds.clear();
139
+ this.hasStreamedThinking = false;
140
+ this.pendingCodexAssistantMessages = [];
135
141
  if (this.config.runMode === 'interactive') {
136
142
  this.spawnInteractive();
137
143
  }
@@ -198,9 +204,33 @@ export class CLIManager {
198
204
  this.process = null;
199
205
  });
200
206
  }
201
- buildPrintArgs(input) {
207
+ normalizeCLIInput(input) {
208
+ if (typeof input === 'string')
209
+ return { content: input, attachments: [] };
210
+ return {
211
+ content: typeof input.content === 'string' ? input.content : '',
212
+ attachments: Array.isArray(input.attachments)
213
+ ? input.attachments.filter((attachment) => attachment?.type === 'image' && typeof attachment.path === 'string' && attachment.path.trim())
214
+ : [],
215
+ };
216
+ }
217
+ renderPromptText(input) {
218
+ const content = input.content.trim();
219
+ const attachments = input.attachments || [];
220
+ if (attachments.length === 0)
221
+ return input.content;
222
+ const list = attachments
223
+ .map((attachment, index) => {
224
+ const name = attachment.name ? `${attachment.name}: ` : '';
225
+ return `${index + 1}. ${name}${attachment.path}`;
226
+ })
227
+ .join('\n');
228
+ const prefix = content || '请根据附件图片继续处理。';
229
+ return `${prefix}\n\n[AgentPilot 附件图片]\n${list}`;
230
+ }
231
+ buildPrintArgs(input, attachments = []) {
202
232
  if (this.getCLIType() === 'codex') {
203
- return this.buildCodexPrintArgs(input);
233
+ return this.buildCodexPrintArgs(input, attachments);
204
234
  }
205
235
  return this.buildClaudePrintArgs(input);
206
236
  }
@@ -219,17 +249,28 @@ export class CLIManager {
219
249
  }
220
250
  return args;
221
251
  }
222
- buildCodexPrintArgs(_input) {
252
+ appendCodexImageArgs(args, attachments) {
253
+ for (const attachment of attachments) {
254
+ if (attachment.type === 'image' && attachment.path) {
255
+ args.push('-i', attachment.path);
256
+ }
257
+ }
258
+ }
259
+ buildCodexPrintArgs(_input, attachments = []) {
223
260
  const args = [...(this.config.cliArgs || [])];
224
261
  if (!hasArg(args, '-C', '--cd')) {
225
262
  args.push('-C', this.config.workDir);
226
263
  }
227
264
  args.push('exec');
228
265
  if (this.sessionId) {
229
- args.push('resume', '--json', this.sessionId, '-');
266
+ args.push('resume', '--json');
267
+ this.appendCodexImageArgs(args, attachments);
268
+ args.push(this.sessionId, '-');
230
269
  }
231
270
  else {
232
- args.push('--json', '-');
271
+ args.push('--json');
272
+ this.appendCodexImageArgs(args, attachments);
273
+ args.push('-');
233
274
  }
234
275
  return args;
235
276
  }
@@ -383,16 +424,18 @@ export class CLIManager {
383
424
  return;
384
425
  proc.stdin?.end(input);
385
426
  }
386
- runPrintCommand(input, isRetry = false) {
427
+ runPrintCommand(input, isRetry = false, attachments = []) {
387
428
  this._status = 'running';
388
429
  this.pendingDenials = [];
389
430
  this.hasStreamedText = false;
431
+ this.hasStreamedThinking = false;
432
+ this.pendingCodexAssistantMessages = [];
390
433
  this.isRetrying = isRetry;
391
434
  if (!isRetry) {
392
435
  this.lastInput = input;
393
436
  }
394
437
  this.emit({ type: 'status', status: 'running' });
395
- const args = this.buildPrintArgs(input);
438
+ const args = this.buildPrintArgs(input, attachments);
396
439
  console.log(`[CLI] runPrintCommand: sessionId=${this.sessionId?.slice(0, 8) || 'null'}, resume=${!!this.sessionId}, args=${args.join(' ')}`);
397
440
  let localBuf = '';
398
441
  let stderrBuf = '';
@@ -477,6 +520,8 @@ export class CLIManager {
477
520
  this._status = 'running';
478
521
  this.pendingDenials = [];
479
522
  this.hasStreamedText = false;
523
+ this.hasStreamedThinking = false;
524
+ this.pendingCodexAssistantMessages = [];
480
525
  this.isRetrying = true;
481
526
  this.emit({ type: 'status', status: 'running' });
482
527
  this.emit({ type: 'system', content: `正在恢复会话并重试 (已授权: ${Array.from(this.allowedTools).join(', ')})...`, time: this.now() });
@@ -600,7 +645,7 @@ export class CLIManager {
600
645
  if (this._status === 'idle' || this._status === 'running') {
601
646
  this._status = 'running';
602
647
  this.emit({ type: 'status', status: 'running' });
603
- this.emit({ type: 'ai_message', content: text, time: this.now() });
648
+ this.emitAssistantText(text, 'candidate');
604
649
  }
605
650
  }
606
651
  tryParseJSON(val) {
@@ -628,10 +673,14 @@ export class CLIManager {
628
673
  return block;
629
674
  if (block?.type === 'text' && typeof block.text === 'string')
630
675
  return block.text;
676
+ if (block?.type === 'summary_text' && typeof block.text === 'string')
677
+ return block.text;
631
678
  if (typeof block?.text === 'string')
632
679
  return block.text;
633
680
  if (typeof block?.content === 'string')
634
681
  return block.content;
682
+ if (Array.isArray(block?.summary))
683
+ return this.extractText(block.summary);
635
684
  return '';
636
685
  })
637
686
  .filter(Boolean)
@@ -641,6 +690,9 @@ export class CLIManager {
641
690
  if (Array.isArray(val.content)) {
642
691
  return this.extractText(val.content);
643
692
  }
693
+ if (Array.isArray(val.summary)) {
694
+ return this.extractText(val.summary);
695
+ }
644
696
  if (typeof val.text === 'string')
645
697
  return val.text;
646
698
  if (typeof val.message === 'string')
@@ -651,6 +703,49 @@ export class CLIManager {
651
703
  }
652
704
  return String(val);
653
705
  }
706
+ extractThinkingText(val) {
707
+ if (!val || typeof val !== 'object')
708
+ return this.extractText(val);
709
+ return this.extractText(val.summary || val.thinking || val.text || val.content || val.message || val);
710
+ }
711
+ emitThinking(content) {
712
+ if (!content.trim())
713
+ return;
714
+ this.hasStreamedThinking = true;
715
+ this.emit({ type: 'thinking_message', content, time: this.now() });
716
+ }
717
+ emitAssistantText(content, phase = 'candidate', time = this.now()) {
718
+ if (!content.trim())
719
+ return;
720
+ this.hasStreamedText = true;
721
+ this.emit({
722
+ type: 'ai_message',
723
+ content,
724
+ time,
725
+ details: { assistantPhase: phase },
726
+ });
727
+ }
728
+ queueCodexAssistantText(content) {
729
+ if (!content.trim())
730
+ return;
731
+ this.pendingCodexAssistantMessages.push({ content, time: this.now() });
732
+ }
733
+ flushCodexAssistantMessages(lastPhase) {
734
+ if (this.pendingCodexAssistantMessages.length === 0)
735
+ return;
736
+ const messages = this.pendingCodexAssistantMessages;
737
+ this.pendingCodexAssistantMessages = [];
738
+ messages.forEach((message, index) => {
739
+ const isLast = index === messages.length - 1;
740
+ this.emitAssistantText(message.content, isLast ? lastPhase : 'progress', message.time);
741
+ });
742
+ }
743
+ buildCodexReasoningFallback(tokens) {
744
+ return [
745
+ `本轮产生了 ${tokens.toLocaleString()} 个 reasoning token。`,
746
+ 'Codex CLI 没有提供可展示的思考摘要,因此这里只能显示推理活动状态,不能还原内部推理文本。',
747
+ ].join('\n');
748
+ }
654
749
  normalizeQuestionOptions(options) {
655
750
  if (!Array.isArray(options))
656
751
  return [];
@@ -746,6 +841,10 @@ export class CLIManager {
746
841
  resultDetails.reasoningOutputTokens = usage.reasoning_output_tokens;
747
842
  if (this.sessionId)
748
843
  resultDetails.session_id = this.sessionId;
844
+ const reasoningTokens = Number(usage.reasoning_output_tokens || 0);
845
+ if (reasoningTokens > 0 && !this.hasStreamedThinking) {
846
+ this.emitThinking(this.buildCodexReasoningFallback(reasoningTokens));
847
+ }
749
848
  if (Object.keys(resultDetails).length > 1) {
750
849
  this.emit({ type: 'system', content: '执行完成', time: this.now(), details: resultDetails });
751
850
  }
@@ -768,19 +867,24 @@ export class CLIManager {
768
867
  }
769
868
  if (type === 'turn.started') {
770
869
  this._status = 'running';
870
+ this.hasStreamedThinking = false;
871
+ this.pendingCodexAssistantMessages = [];
771
872
  this.emit({ type: 'status', status: 'running' });
772
873
  return true;
773
874
  }
774
875
  if (type === 'turn.completed') {
876
+ this.flushCodexAssistantMessages('final');
775
877
  this.emitCodexUsage(msg.usage);
776
878
  if (this._status !== 'confirm' && this._status !== 'question') {
777
879
  this._status = 'idle';
778
880
  this.emit({ type: 'status', status: 'idle' });
779
881
  }
780
882
  this.hasStreamedText = false;
883
+ this.hasStreamedThinking = false;
781
884
  return true;
782
885
  }
783
886
  if (type === 'turn.failed' || type === 'error') {
887
+ this.flushCodexAssistantMessages('progress');
784
888
  const errorText = this.extractText(msg.error || msg.message || msg.content) || 'Codex CLI 执行失败';
785
889
  this.emit({ type: 'error', content: errorText, time: this.now() });
786
890
  if (this._status !== 'confirm' && this._status !== 'question') {
@@ -795,6 +899,7 @@ export class CLIManager {
795
899
  const itemId = item.id || undefined;
796
900
  const isCompleted = type === 'item.completed';
797
901
  if (itemType === 'command_execution') {
902
+ this.flushCodexAssistantMessages('progress');
798
903
  const command = item.command || 'command';
799
904
  const output = item.aggregated_output || '';
800
905
  const exitCode = item.exit_code;
@@ -821,20 +926,29 @@ export class CLIManager {
821
926
  if (isCompleted && isAgentMessage) {
822
927
  const text = this.extractText(item.text || item.content || item.message || item);
823
928
  if (text) {
824
- this.hasStreamedText = true;
825
- this.emit({ type: 'ai_message', content: text, time: this.now() });
929
+ this.queueCodexAssistantText(text);
826
930
  }
827
931
  return true;
828
932
  }
829
933
  if (isCompleted && (itemType === 'reasoning' || itemType === 'thinking')) {
830
- const text = this.extractText(item.text || item.content || item.message);
934
+ const text = this.extractThinkingText(item);
831
935
  if (text) {
832
- this.emit({ type: 'thinking_message', content: text, time: this.now() });
936
+ this.emitThinking(text);
833
937
  }
834
938
  return true;
835
939
  }
836
940
  return true;
837
941
  }
942
+ if (type === 'response_item') {
943
+ const item = msg.payload || msg.item || msg;
944
+ if (item?.type === 'reasoning' || item?.type === 'thinking') {
945
+ const text = this.extractThinkingText(item);
946
+ if (text) {
947
+ this.emitThinking(text);
948
+ }
949
+ return true;
950
+ }
951
+ }
838
952
  return typeof type === 'string' && type.includes('.');
839
953
  }
840
954
  handleJSONMessage(msg) {
@@ -937,13 +1051,12 @@ export class CLIManager {
937
1051
  this.emit({ type: 'status', status: 'running' });
938
1052
  if (type === 'content_block_delta' && msg.delta) {
939
1053
  if (msg.delta.type === 'thinking_delta' && msg.delta.thinking) {
940
- this.emit({ type: 'thinking_message', content: msg.delta.thinking, time: this.now() });
1054
+ this.emitThinking(msg.delta.thinking);
941
1055
  }
942
1056
  else {
943
1057
  const text = this.extractText(msg.delta);
944
1058
  if (text) {
945
- this.hasStreamedText = true;
946
- this.emit({ type: 'ai_message', content: text, time: this.now() });
1059
+ this.emitAssistantText(text, 'candidate');
947
1060
  }
948
1061
  }
949
1062
  }
@@ -951,7 +1064,8 @@ export class CLIManager {
951
1064
  const message = msg.message || msg;
952
1065
  const contentArr = Array.isArray(message.content) ? message.content : null;
953
1066
  if (contentArr) {
954
- for (const block of contentArr) {
1067
+ for (let blockIndex = 0; blockIndex < contentArr.length; blockIndex += 1) {
1068
+ const block = contentArr[blockIndex];
955
1069
  if (block.type === 'tool_use') {
956
1070
  this.emit({
957
1071
  type: 'tool_call',
@@ -970,13 +1084,15 @@ export class CLIManager {
970
1084
  }
971
1085
  else if (block.type === 'text') {
972
1086
  if (block.text) {
973
- this.hasStreamedText = true;
974
- this.emit({ type: 'ai_message', content: block.text, time: this.now() });
1087
+ const hasLaterToolUse = contentArr
1088
+ .slice(blockIndex + 1)
1089
+ .some((nextBlock) => nextBlock?.type === 'tool_use');
1090
+ this.emitAssistantText(block.text, hasLaterToolUse ? 'progress' : 'candidate');
975
1091
  }
976
1092
  }
977
1093
  else if (block.type === 'thinking') {
978
1094
  if (block.thinking) {
979
- this.emit({ type: 'thinking_message', content: block.thinking, time: this.now() });
1095
+ this.emitThinking(block.thinking);
980
1096
  }
981
1097
  }
982
1098
  }
@@ -984,8 +1100,7 @@ export class CLIManager {
984
1100
  else {
985
1101
  const text = this.extractText(msg.content || msg.message || msg.text);
986
1102
  if (text) {
987
- this.hasStreamedText = true;
988
- this.emit({ type: 'ai_message', content: text, time: this.now() });
1103
+ this.emitAssistantText(text, 'candidate');
989
1104
  }
990
1105
  }
991
1106
  }
@@ -1186,7 +1301,7 @@ export class CLIManager {
1186
1301
  }
1187
1302
  const text = this.extractText(msg.content || msg.message || msg.result);
1188
1303
  if (text && !this.hasStreamedText) {
1189
- this.emit({ type: 'ai_message', content: text, time: this.now() });
1304
+ this.emitAssistantText(text, 'final');
1190
1305
  }
1191
1306
  this.hasStreamedText = false;
1192
1307
  // Emit result statistics as a system message
@@ -1232,7 +1347,7 @@ export class CLIManager {
1232
1347
  if (text) {
1233
1348
  this._status = 'running';
1234
1349
  this.emit({ type: 'status', status: 'running' });
1235
- this.emit({ type: 'ai_message', content: text, time: this.now() });
1350
+ this.emitAssistantText(text, 'candidate');
1236
1351
  }
1237
1352
  }
1238
1353
  }
@@ -1394,13 +1509,15 @@ export class CLIManager {
1394
1509
  }
1395
1510
  return false;
1396
1511
  }
1397
- sendInput(text) {
1512
+ sendInput(input) {
1513
+ const normalized = this.normalizeCLIInput(input);
1514
+ const text = this.renderPromptText(normalized);
1398
1515
  if (this._status === 'question') {
1399
1516
  this.questionResponse(text);
1400
1517
  return;
1401
1518
  }
1402
1519
  if (this.config.runMode === 'print' && this._status !== 'confirm') {
1403
- this.runPrintCommand(text);
1520
+ this.runPrintCommand(text, false, normalized.attachments || []);
1404
1521
  return;
1405
1522
  }
1406
1523
  const target = this.printProcess || this.process;
@@ -1491,6 +1608,14 @@ export class CLIManager {
1491
1608
  this.pendingQuestionNeedsPermissionApproval = false;
1492
1609
  this.answeredQuestionToolUseIds.clear();
1493
1610
  }
1611
+ restoreReady() {
1612
+ if (this.config.runMode === 'interactive') {
1613
+ this.spawnInteractive();
1614
+ return;
1615
+ }
1616
+ this._status = 'idle';
1617
+ this.emit({ type: 'status', status: 'idle' });
1618
+ }
1494
1619
  restoreWorkDir(workDir) {
1495
1620
  if (workDir && typeof workDir === 'string') {
1496
1621
  const resolved = workDir.startsWith('~') ? workDir.replace('~', os.homedir()) : workDir;