blade-code 0.10.73 → 0.10.75

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 (104) hide show
  1. package/dist/blade.js +2 -2
  2. package/dist/{chunk-4ehgjdm0.js → chunk-03947xkg.js} +1 -1
  3. package/dist/{chunk-yvnm25nb.js → chunk-0cbpjhq7.js} +1 -1
  4. package/dist/chunk-0jmvv2vb.js +1 -0
  5. package/dist/{chunk-tvv3syt3.js → chunk-1zkwxaa0.js} +1 -1
  6. package/dist/{chunk-p0qjjyex.js → chunk-1zwq624e.js} +2 -2
  7. package/dist/{chunk-ah12xhh6.js → chunk-22aaybx2.js} +1 -1
  8. package/dist/chunk-22s3r2xy.js +2 -0
  9. package/dist/{chunk-cvvtrvk6.js → chunk-22sw5bv4.js} +2 -2
  10. package/dist/{chunk-vhadycw2.js → chunk-2faga011.js} +2 -2
  11. package/dist/{chunk-3r0x2p7z.js → chunk-2m4mgw58.js} +2 -2
  12. package/dist/{chunk-tzytnhbp.js → chunk-2qqmmxqf.js} +2 -2
  13. package/dist/{chunk-a37mn58w.js → chunk-2v10cw32.js} +1 -1
  14. package/dist/{chunk-traa01dd.js → chunk-44zkyzrj.js} +1 -1
  15. package/dist/chunk-4mgjj8zg.js +1 -0
  16. package/dist/{chunk-vw0gg08s.js → chunk-4ppgfhqd.js} +2 -2
  17. package/dist/{chunk-2wdxpdz3.js → chunk-57jj40er.js} +2 -2
  18. package/dist/chunk-5a132j64.js +1 -0
  19. package/dist/chunk-5dz30k5z.js +6 -0
  20. package/dist/{chunk-jeazjp08.js → chunk-5tat9wy9.js} +3 -3
  21. package/dist/{chunk-r5bpvfym.js → chunk-6bka1j4q.js} +1 -1
  22. package/dist/chunk-7yppfbgr.js +1 -0
  23. package/dist/{chunk-0hrj06t7.js → chunk-99nevk7k.js} +1 -1
  24. package/dist/chunk-a6kbpq05.js +1 -0
  25. package/dist/{chunk-8fm3xamc.js → chunk-agxs6rwh.js} +1 -1
  26. package/dist/{chunk-ne7vres8.js → chunk-bj5msq36.js} +1 -1
  27. package/dist/{chunk-k82ff14t.js → chunk-c03xn5s3.js} +1 -1
  28. package/dist/{chunk-xjc0bthz.js → chunk-c74e0jx1.js} +2 -2
  29. package/dist/{chunk-yx82ang3.js → chunk-d2eahefk.js} +2 -2
  30. package/dist/{chunk-67ddp3ns.js → chunk-egp0crrc.js} +3 -3
  31. package/dist/{chunk-r8wbvxn7.js → chunk-fbgzeb3m.js} +1 -1
  32. package/dist/chunk-fefz145r.js +1 -0
  33. package/dist/chunk-ffkdx471.js +1 -0
  34. package/dist/{chunk-ax610gqh.js → chunk-fj297dmj.js} +1 -1
  35. package/dist/chunk-fpkq3ch3.js +1 -0
  36. package/dist/{chunk-b28zsp1t.js → chunk-g3fbgp1k.js} +3 -3
  37. package/dist/{chunk-948efzyp.js → chunk-gbrwzpyg.js} +2 -2
  38. package/dist/{chunk-a5e4sy4q.js → chunk-gz2fx7th.js} +2 -2
  39. package/dist/{chunk-b3413dtc.js → chunk-h4d37zt2.js} +1 -1
  40. package/dist/{chunk-sxjs66h6.js → chunk-hzy5jzkp.js} +1 -1
  41. package/dist/{chunk-4khtsmrf.js → chunk-kaf6m50a.js} +1 -1
  42. package/dist/{chunk-3hv57n95.js → chunk-kb5xaar0.js} +311 -289
  43. package/dist/{chunk-77hn7hf6.js → chunk-m6yfwyva.js} +1 -1
  44. package/dist/{chunk-9e6dcbqq.js → chunk-m88zk362.js} +2 -2
  45. package/dist/{chunk-q6ak67n8.js → chunk-n0x5z56v.js} +2 -2
  46. package/dist/{chunk-tmvg7taj.js → chunk-nfyxb2q5.js} +1 -1
  47. package/dist/{chunk-mefb27ch.js → chunk-p7ww2tcn.js} +1 -1
  48. package/dist/{chunk-meee1cbq.js → chunk-pdansrbx.js} +1 -1
  49. package/dist/{chunk-p7y79y6c.js → chunk-qp8mejbn.js} +1 -1
  50. package/dist/{chunk-kka51s0k.js → chunk-qtt17d5s.js} +1 -1
  51. package/dist/{chunk-zxn7f308.js → chunk-qw5j84ny.js} +2 -2
  52. package/dist/chunk-qxjsfp2c.js +1 -0
  53. package/dist/{chunk-skw3b17a.js → chunk-qyxbee3w.js} +1 -1
  54. package/dist/{chunk-wp0794r2.js → chunk-r297pq3s.js} +2 -2
  55. package/dist/{chunk-jkh9s1ht.js → chunk-rc7jnds2.js} +1 -1
  56. package/dist/{chunk-5d1gbm41.js → chunk-rdtgv0n8.js} +2 -2
  57. package/dist/{chunk-y36rdy4v.js → chunk-rjgfy07e.js} +2 -2
  58. package/dist/{chunk-n1w40gq2.js → chunk-s7gf2ds9.js} +2 -2
  59. package/dist/chunk-ssfvcnat.js +1 -0
  60. package/dist/chunk-swvp6j18.js +1 -0
  61. package/dist/{chunk-xv92c582.js → chunk-tnjq10zs.js} +1 -1
  62. package/dist/chunk-v0znd20r.js +1 -0
  63. package/dist/{chunk-a0ns74mh.js → chunk-v4ek6q8t.js} +1 -1
  64. package/dist/chunk-vbxtqh24.js +1 -0
  65. package/dist/chunk-vkpddj6a.js +1 -0
  66. package/dist/chunk-w1m7wz1y.js +10 -0
  67. package/dist/{chunk-js4vqnds.js → chunk-xbj18hxh.js} +1 -1
  68. package/dist/{chunk-c9e0fbyh.js → chunk-xkz9ecdx.js} +1 -1
  69. package/dist/{chunk-bhhdvqe7.js → chunk-xts31qj4.js} +2 -2
  70. package/dist/chunk-yjbq4jeg.js +2 -0
  71. package/dist/{chunk-9cgsheg0.js → chunk-yk8s8kjt.js} +2 -2
  72. package/dist/{chunk-1ava19kd.js → chunk-yz80dp1a.js} +2 -2
  73. package/dist/{chunk-4cpgcm7q.js → chunk-zph2jekm.js} +2 -2
  74. package/dist/web/assets/ChatView-Bjl8VJFM.js +18 -0
  75. package/dist/web/assets/{CodeBlockHighlighter-XaY8h0vd.js → CodeBlockHighlighter-i8Yc4Qe4.js} +1 -1
  76. package/dist/web/assets/{FilePreview-CVHV6oga.js → FilePreview-DbU1IMtz.js} +1 -1
  77. package/dist/web/assets/{KanbanBoard-D1_61uZi.js → KanbanBoard-Fe4qkgpi.js} +1 -1
  78. package/dist/web/assets/{MarkdownRenderer-DUPwAzs4.js → MarkdownRenderer-CdeC66uL.js} +3 -3
  79. package/dist/web/assets/{SettingsModal-DHnU7uMN.js → SettingsModal-mbG701yW.js} +1 -1
  80. package/dist/web/assets/{TaskSwitcher-CpXhLtO5.js → TaskSwitcher-DF-q_rMi.js} +1 -1
  81. package/dist/web/assets/{TerminalPanel-eYsA-A62.js → TerminalPanel-BxAmwOXK.js} +1 -1
  82. package/dist/web/assets/{index-gjBOFzd1.js → index-BTj86SSJ.js} +3 -3
  83. package/dist/web/assets/{teamService-Bb2kW8Hh.js → teamService-Cnno2N5h.js} +1 -1
  84. package/dist/web/index.html +1 -1
  85. package/package.json +1 -1
  86. package/dist/chunk-0qqzd0hq.js +0 -1
  87. package/dist/chunk-1cyy8wqj.js +0 -10
  88. package/dist/chunk-3fzy7q6x.js +0 -1
  89. package/dist/chunk-64jq6jcr.js +0 -2
  90. package/dist/chunk-8h35w91f.js +0 -1
  91. package/dist/chunk-fdmcef2p.js +0 -2
  92. package/dist/chunk-fgh6mjdp.js +0 -6
  93. package/dist/chunk-hswyrd88.js +0 -1
  94. package/dist/chunk-jsg7vmxp.js +0 -1
  95. package/dist/chunk-vxd30mnx.js +0 -1
  96. package/dist/chunk-wbzvy99s.js +0 -1
  97. package/dist/chunk-wg3z2epq.js +0 -1
  98. package/dist/chunk-xkc6v9nb.js +0 -1
  99. package/dist/chunk-yg6c4xrs.js +0 -1
  100. package/dist/chunk-z8a5ebep.js +0 -1
  101. package/dist/chunk-z95pw8nb.js +0 -1
  102. package/dist/chunk-zh2x0tcm.js +0 -1
  103. package/dist/chunk-zr1mg5kq.js +0 -1
  104. package/dist/web/assets/ChatView-Dm-DMbOV.js +0 -18
@@ -1 +1 @@
1
- import{a as o}from"./chunk-xv92c582.js";import"./chunk-xjc0bthz.js";import"./chunk-0hrj06t7.js";import{execSync as r}from"child_process";var l={command:"update",describe:"Check for updates and install if available",handler:async()=>{console.log("Checking for updates...");try{let e=await o(!0);if(console.log(`Current version: ${e.currentVersion}`),e.error){console.log(`Warning: ${e.error}`);return}if(e.latestVersion)console.log(`Latest version: ${e.latestVersion}`);if(e.hasUpdate&&e.latestVersion){console.log(""),console.log(`\x1B[33mUpdate available: ${e.currentVersion} -> ${e.latestVersion}\x1B[0m`),console.log(""),console.log("Updating...");try{r("npm install -g blade-code@latest --registry https://registry.npmjs.org",{stdio:"inherit"}),console.log(""),console.log("Update complete!")}catch(t){console.error("Error: Update failed. Please run manually:"),console.error(" npm install -g blade-code@latest"),process.exit(1)}}else console.log("You are running the latest version of Blade")}catch(e){console.error(`Error: Failed to check for updates: ${e instanceof Error?e.message:"未知错误"}`),process.exit(1)}}};export{l as updateCommands};
1
+ import{a as o}from"./chunk-tnjq10zs.js";import"./chunk-c74e0jx1.js";import"./chunk-99nevk7k.js";import{execSync as r}from"child_process";var l={command:"update",describe:"Check for updates and install if available",handler:async()=>{console.log("Checking for updates...");try{let e=await o(!0);if(console.log(`Current version: ${e.currentVersion}`),e.error){console.log(`Warning: ${e.error}`);return}if(e.latestVersion)console.log(`Latest version: ${e.latestVersion}`);if(e.hasUpdate&&e.latestVersion){console.log(""),console.log(`\x1B[33mUpdate available: ${e.currentVersion} -> ${e.latestVersion}\x1B[0m`),console.log(""),console.log("Updating...");try{r("npm install -g blade-code@latest --registry https://registry.npmjs.org",{stdio:"inherit"}),console.log(""),console.log("Update complete!")}catch(t){console.error("Error: Update failed. Please run manually:"),console.error(" npm install -g blade-code@latest"),process.exit(1)}}else console.log("You are running the latest version of Blade")}catch(e){console.error(`Error: Failed to check for updates: ${e instanceof Error?e.message:"未知错误"}`),process.exit(1)}}};export{l as updateCommands};
@@ -1,4 +1,4 @@
1
- import{b as RY,c as MY,d as TY}from"./chunk-xv92c582.js";import{j as DJ,k as VJ}from"./chunk-tvv3syt3.js";import{u as s2}from"./chunk-8fm3xamc.js";import{B as c6,D as gY,F as OQ,G as XQ,H as v6,L as A6,M as P6,Q as j1,S as e4,T as $6,W as y6,Y as z2,Z as nJ,_ as tJ,ba as sJ,ca as eJ,ga as L4,ha as $9,ja as t6,ka as s6,la as mY,ma as O6,oa as z6,qa as x6}from"./chunk-3hv57n95.js";import{ua as qJ,va as OJ,wa as zJ,za as EY}from"./chunk-9cgsheg0.js";import{Ba as b6}from"./chunk-fdmcef2p.js";import{Eb as QQ,ib as L6,jb as B6,vb as w6}from"./chunk-b28zsp1t.js";import{Pb as W2}from"./chunk-r8wbvxn7.js";import{Gc as Y6,Hc as $Q,Ic as Z6,Kc as d2,Sc as O2,Vc as C0,gc as _6,uc as t4,zc as s4}from"./chunk-2wdxpdz3.js";import"./chunk-skw3b17a.js";import"./chunk-wp0794r2.js";import{wd as PY}from"./chunk-vw0gg08s.js";import{Ad as C1,xd as H2,yd as e2}from"./chunk-n1w40gq2.js";import"./chunk-3r0x2p7z.js";import{Ed as k$,Fd as a0,Gd as Q$,Hd as jQ,Id as g$,Jd as r2,Kd as v9,Ld as Q4,Md as MJ,Nd as D9,Od as V$,Pd as l0,Qd as jY,Rd as o0,Sd as AY,Td as D8,Ud as N2,Xd as U6,ce as p0}from"./chunk-bhhdvqe7.js";import"./chunk-v508x7cg.js";import"./chunk-c9e0fbyh.js";import"./chunk-y36rdy4v.js";import{pe as J4}from"./chunk-vhadycw2.js";import"./chunk-js4vqnds.js";import"./chunk-cvvtrvk6.js";import{Ae as Q8,De as _Y,Ie as iJ,Re as hY}from"./chunk-5d1gbm41.js";import"./chunk-4khtsmrf.js";import"./chunk-yvnm25nb.js";import"./chunk-jkh9s1ht.js";import{ff as gQ,hf as q1}from"./chunk-67ddp3ns.js";import"./chunk-4ehgjdm0.js";import{jg as DY,og as oJ,pg as VY}from"./chunk-4cpgcm7q.js";import"./chunk-p7y79y6c.js";import"./chunk-k82ff14t.js";import{Ag as mQ,yg as m$,zg as a2}from"./chunk-64jq6jcr.js";import{Eg as d0}from"./chunk-ah12xhh6.js";import"./chunk-kka51s0k.js";import{bh as vY,eh as t1}from"./chunk-tzytnhbp.js";import{gh as kJ,hh as SJ,kh as h1}from"./chunk-948efzyp.js";import"./chunk-ne7vres8.js";import{wh as bJ}from"./chunk-xjc0bthz.js";import{zh as F4}from"./chunk-1ava19kd.js";import"./chunk-mefb27ch.js";import{Kh as e8}from"./chunk-zxn7f308.js";import{Mh as EQ}from"./chunk-0hrj06t7.js";import{useMemoizedFn as u8}from"ahooks";import{useEffect as S7,useState as l8}from"react";import{useMemoizedFn as s0}from"ahooks";import{Box as z$}from"ink";import{useEffect as _$,useMemo as R7,useRef as p8}from"react";import{useShallow as uY}from"zustand/react/shallow";import{useStore as xY}from"zustand";function t($){return xY(V$,$)}var lY=[],j$=()=>t(($)=>$.session.sessionId),T1=()=>t(($)=>$.session.workspaceRoot),B4=()=>t(($)=>$.session.messages),w4=()=>t(($)=>$.session.clearCount),b4=()=>t(($)=>$.session.isCompacting),A4=()=>t(($)=>$.session.tokenUsage.estimatedCostUsd),P4=()=>t(($)=>{let{totalInputTokens:Q,cacheReadTokens:Y,cacheWriteTokens:J}=$.session.tokenUsage;return L4({totalInputTokens:Q,cacheReadTokens:Y,cacheWriteTokens:J}).hitRate}),y4=()=>t(($)=>$.session.providerCircuit),R4=()=>t(($)=>$.session.providerAdmission),M4=()=>t(($)=>$.session.providerRetry),T4=()=>t(($)=>$.session.providerStall),C4=()=>t(($)=>$.session.actionStationarity),i1=()=>t(($)=>$.session.actions),I4=()=>t(($)=>{let{inputTokens:Q,maxContextTokens:Y}=$.session.tokenUsage;if(Y<=0)return 100;let J=Math.max(0,100-Q/Y*100);return Math.round(J)}),f4=()=>t(($)=>$.app.initializationStatus),k4=()=>t(($)=>$.app.initializationError),D2=()=>t(($)=>$.app.activeModal),S4=()=>t(($)=>$.app.tasks),v4=()=>t(($)=>$.app.modelEditorTarget),D4=()=>t(($)=>$.app.sessionSelectorData),V4=()=>t(($)=>$.app.awaitingSecondCtrlC),n1=()=>t(($)=>$.app.actions),V2=()=>t(($)=>$.app.sideConversation),j4=()=>t(($)=>$.app.teams),j2=()=>t(($)=>$.app.initializationStatus==="ready"),h4=()=>t(($)=>$.app.tasks.length>0),h$=()=>t(($)=>$.config.config?.permissionMode||"default"),E4=()=>t(($)=>$.config.config?.models??lY),h2=()=>t(($)=>{let Q=$.config.config;if(!Q)return;let Y=Q.currentModelId;return Q.models.find((Z)=>Z.id===Y)??Q.models[0]}),E2=()=>t(($)=>$.config.config?.currentModelId),g4=()=>t(($)=>$.config.config?.agentTeamsEnabled===!0),b0=()=>t(($)=>{return a0.getTheme()}),m4=()=>t(($)=>$.config.config?.codeTheme??"default"),e0=()=>t(($)=>$.focus.currentFocus),p4=()=>t(($)=>$.focus.actions),E$=()=>t(($)=>$.command.isProcessing),c4=()=>t(($)=>$.command.actions),g2=()=>t(($)=>$.command.pendingCommands),x4=()=>t(($)=>$.command.recoveredSteeringCount),m2=()=>t(($)=>$.app.reasoningEffort!=="off"),p2=()=>t(($)=>$.app.reasoningEffort),c2=()=>t(($)=>$.app.serviceTier),x2=()=>t(($)=>$.app.responseVerbosity),u2=()=>t(($)=>$.app.communicationStyle),u4=()=>t(($)=>$.session.currentThinkingContent),l4=()=>t(($)=>$.session.thinkingExpanded),d4=()=>t(($)=>$.session.currentStreamingMessageId),r4=()=>t(uY(($)=>({lines:$.session.currentStreamingLines,tail:$.session.currentStreamingTail,lineCount:$.session.currentStreamingLineCount,version:$.session.currentStreamingVersion}))),a4=()=>t(($)=>$.session.finalizingStreamingMessageId),o4=()=>t(($)=>$.session.historyExpanded),i4=()=>t(($)=>$.session.expandedMessageCount);import{useMemoizedFn as s1}from"ahooks";import{useEffect as c$,useRef as s8}from"react";function dY($){if(!($ instanceof Error))return"未知错误";let J=$.lastError??$;if(J.responseBody)try{let K=JSON.parse(J.responseBody)?.error?.message;if(K){let U=J.statusCode?` (HTTP ${J.statusCode})`:"";return`${K}${U}`}}catch{}let Z=$.message.match(/Last error:\s*(.+)$/);if(Z)return Z[1];return $.message}function rY($){if(!($ instanceof Error))return!1;return $.name==="AbortError"||$.message.includes("aborted")}function aY($){if(!($ instanceof Error))return!1;let Q=$.message;return Q.includes("can only concatenate str")||Q.includes("image_url")||Q.includes("multimodal")||Q.includes("vision")||Q.includes("does not support images")}function l2($){let Q=rY($),Y=aY($),J;if(Y)J="当前模型不支持图片理解功能。请切换到支持视觉能力的模型(如 Claude 4.5、GPT-5.2、Gemini 3 Pro、Qwen3-VL-Plus 等)后重试。";else J=dY($);return{displayMessage:J,isAbort:Q,isVisionNotSupported:Y}}import{appendFileSync as oY,mkdirSync as iY,writeFileSync as nY}from"node:fs";import tY from"node:os";import a8 from"node:path";var n4=null;function sY(){let $=process.env.BLADE_STORAGE_ROOT||a8.join(tY.homedir(),".blade");return a8.join($,"logs","stream-debug.log")}function eY($){if(n4===$)return;let Q=a8.dirname($);iY(Q,{recursive:!0,mode:493}),nY($,`=== Stream Debug Log Started: ${new Date().toISOString()} ===
1
+ import{b as RY,c as MY,d as TY}from"./chunk-tnjq10zs.js";import{j as DJ,k as VJ}from"./chunk-1zkwxaa0.js";import{u as s2}from"./chunk-agxs6rwh.js";import{$ as tJ,C as c6,E as gY,G as OQ,H as XQ,I as v6,M as A6,N as P6,R as j1,T as e4,U as $6,X as y6,Z as z2,_ as nJ,ca as sJ,da as eJ,ha as L4,ia as $9,ka as t6,la as s6,ma as mY,na as O6,pa as z6,ra as x6}from"./chunk-kb5xaar0.js";import{Aa as EY,va as qJ,wa as OJ,xa as zJ}from"./chunk-yk8s8kjt.js";import{Ca as b6}from"./chunk-22s3r2xy.js";import{Fb as QQ,jb as L6,kb as B6,wb as w6}from"./chunk-g3fbgp1k.js";import{Qb as W2}from"./chunk-fbgzeb3m.js";import{Ac as s4,Hc as Y6,Ic as $Q,Jc as Z6,Lc as d2,Tc as O2,Wc as C0,hc as _6,vc as t4}from"./chunk-57jj40er.js";import"./chunk-qyxbee3w.js";import"./chunk-r297pq3s.js";import{xd as PY}from"./chunk-4ppgfhqd.js";import{Bd as C1,yd as H2,zd as e2}from"./chunk-s7gf2ds9.js";import"./chunk-2m4mgw58.js";import{Fd as k$,Gd as a0,Hd as Q$,Id as jQ,Jd as g$,Kd as r2,Ld as v9,Md as Q4,Nd as MJ,Od as D9,Pd as V$,Qd as l0,Rd as jY,Sd as o0,Td as AY,Ud as D8,Vd as N2,Yd as U6,de as p0}from"./chunk-xts31qj4.js";import"./chunk-v508x7cg.js";import"./chunk-xkz9ecdx.js";import"./chunk-rjgfy07e.js";import{qe as J4}from"./chunk-2faga011.js";import"./chunk-xbj18hxh.js";import"./chunk-22sw5bv4.js";import{Be as Q8,Ee as _Y,Je as iJ,Se as hY}from"./chunk-rdtgv0n8.js";import"./chunk-kaf6m50a.js";import"./chunk-0cbpjhq7.js";import"./chunk-rc7jnds2.js";import{gf as gQ,if as q1}from"./chunk-egp0crrc.js";import"./chunk-03947xkg.js";import{kg as DY,pg as oJ,qg as VY}from"./chunk-zph2jekm.js";import"./chunk-qp8mejbn.js";import"./chunk-c03xn5s3.js";import{Ag as a2,Bg as mQ,zg as m$}from"./chunk-yjbq4jeg.js";import{Fg as d0}from"./chunk-22aaybx2.js";import"./chunk-qtt17d5s.js";import{ch as vY,fh as t1}from"./chunk-2qqmmxqf.js";import{hh as kJ,ih as SJ,lh as h1}from"./chunk-gbrwzpyg.js";import"./chunk-bj5msq36.js";import{xh as bJ}from"./chunk-c74e0jx1.js";import{Ah as F4}from"./chunk-yz80dp1a.js";import"./chunk-p7ww2tcn.js";import{Lh as e8}from"./chunk-qw5j84ny.js";import{Nh as EQ}from"./chunk-99nevk7k.js";import{useMemoizedFn as u8}from"ahooks";import{useEffect as S7,useState as l8}from"react";import{useMemoizedFn as s0}from"ahooks";import{Box as z$}from"ink";import{useEffect as _$,useMemo as R7,useRef as p8}from"react";import{useShallow as uY}from"zustand/react/shallow";import{useStore as xY}from"zustand";function t($){return xY(V$,$)}var lY=[],j$=()=>t(($)=>$.session.sessionId),T1=()=>t(($)=>$.session.workspaceRoot),B4=()=>t(($)=>$.session.messages),w4=()=>t(($)=>$.session.clearCount),b4=()=>t(($)=>$.session.isCompacting),A4=()=>t(($)=>$.session.tokenUsage.estimatedCostUsd),P4=()=>t(($)=>{let{totalInputTokens:Q,cacheReadTokens:Y,cacheWriteTokens:J}=$.session.tokenUsage;return L4({totalInputTokens:Q,cacheReadTokens:Y,cacheWriteTokens:J}).hitRate}),y4=()=>t(($)=>$.session.providerCircuit),R4=()=>t(($)=>$.session.providerAdmission),M4=()=>t(($)=>$.session.providerRetry),T4=()=>t(($)=>$.session.providerStall),C4=()=>t(($)=>$.session.actionStationarity),i1=()=>t(($)=>$.session.actions),I4=()=>t(($)=>{let{inputTokens:Q,maxContextTokens:Y}=$.session.tokenUsage;if(Y<=0)return 100;let J=Math.max(0,100-Q/Y*100);return Math.round(J)}),f4=()=>t(($)=>$.app.initializationStatus),k4=()=>t(($)=>$.app.initializationError),D2=()=>t(($)=>$.app.activeModal),S4=()=>t(($)=>$.app.tasks),v4=()=>t(($)=>$.app.modelEditorTarget),D4=()=>t(($)=>$.app.sessionSelectorData),V4=()=>t(($)=>$.app.awaitingSecondCtrlC),n1=()=>t(($)=>$.app.actions),V2=()=>t(($)=>$.app.sideConversation),j4=()=>t(($)=>$.app.teams),j2=()=>t(($)=>$.app.initializationStatus==="ready"),h4=()=>t(($)=>$.app.tasks.length>0),h$=()=>t(($)=>$.config.config?.permissionMode||"default"),E4=()=>t(($)=>$.config.config?.models??lY),h2=()=>t(($)=>{let Q=$.config.config;if(!Q)return;let Y=Q.currentModelId;return Q.models.find((Z)=>Z.id===Y)??Q.models[0]}),E2=()=>t(($)=>$.config.config?.currentModelId),g4=()=>t(($)=>$.config.config?.agentTeamsEnabled===!0),b0=()=>t(($)=>{return a0.getTheme()}),m4=()=>t(($)=>$.config.config?.codeTheme??"default"),e0=()=>t(($)=>$.focus.currentFocus),p4=()=>t(($)=>$.focus.actions),E$=()=>t(($)=>$.command.isProcessing),c4=()=>t(($)=>$.command.actions),g2=()=>t(($)=>$.command.pendingCommands),x4=()=>t(($)=>$.command.recoveredSteeringCount),m2=()=>t(($)=>$.app.reasoningEffort!=="off"),p2=()=>t(($)=>$.app.reasoningEffort),c2=()=>t(($)=>$.app.serviceTier),x2=()=>t(($)=>$.app.responseVerbosity),u2=()=>t(($)=>$.app.communicationStyle),u4=()=>t(($)=>$.session.currentThinkingContent),l4=()=>t(($)=>$.session.thinkingExpanded),d4=()=>t(($)=>$.session.currentStreamingMessageId),r4=()=>t(uY(($)=>({lines:$.session.currentStreamingLines,tail:$.session.currentStreamingTail,lineCount:$.session.currentStreamingLineCount,version:$.session.currentStreamingVersion}))),a4=()=>t(($)=>$.session.finalizingStreamingMessageId),o4=()=>t(($)=>$.session.historyExpanded),i4=()=>t(($)=>$.session.expandedMessageCount);import{useMemoizedFn as s1}from"ahooks";import{useEffect as c$,useRef as s8}from"react";function dY($){if(!($ instanceof Error))return"未知错误";let J=$.lastError??$;if(J.responseBody)try{let K=JSON.parse(J.responseBody)?.error?.message;if(K){let U=J.statusCode?` (HTTP ${J.statusCode})`:"";return`${K}${U}`}}catch{}let Z=$.message.match(/Last error:\s*(.+)$/);if(Z)return Z[1];return $.message}function rY($){if(!($ instanceof Error))return!1;return $.name==="AbortError"||$.message.includes("aborted")}function aY($){if(!($ instanceof Error))return!1;let Q=$.message;return Q.includes("can only concatenate str")||Q.includes("image_url")||Q.includes("multimodal")||Q.includes("vision")||Q.includes("does not support images")}function l2($){let Q=rY($),Y=aY($),J;if(Y)J="当前模型不支持图片理解功能。请切换到支持视觉能力的模型(如 Claude 4.5、GPT-5.2、Gemini 3 Pro、Qwen3-VL-Plus 等)后重试。";else J=dY($);return{displayMessage:J,isAbort:Q,isVisionNotSupported:Y}}import{appendFileSync as oY,mkdirSync as iY,writeFileSync as nY}from"node:fs";import tY from"node:os";import a8 from"node:path";var n4=null;function sY(){let $=process.env.BLADE_STORAGE_ROOT||a8.join(tY.homedir(),".blade");return a8.join($,"logs","stream-debug.log")}function eY($){if(n4===$)return;let Q=a8.dirname($);iY(Q,{recursive:!0,mode:493}),nY($,`=== Stream Debug Log Started: ${new Date().toISOString()} ===
2
2
  `),n4=$}function o8($,Q,Y){try{let J=sY();eY(J);let Z=new Date().toISOString(),X=Y?` | ${JSON.stringify(Y)}`:"",K=`[${Z}] [${$}] ${Q}${X}
3
3
  `;oY(J,K)}catch{}}var q2=t1("UI");function Q6($,Q){let Y=!1;return(J)=>{switch(J.kind){case"content_delta":if(Y||$.signal.aborted)break;Q.contentDeltaCount++,Q.contentDeltaTotalLen+=J.delta.length,o8("loopEventHandler","onContentDelta",{callCount:Q.contentDeltaCount,deltaLen:J.delta.length,totalLen:Q.contentDeltaTotalLen}),$.streamingBuffer.batchAppendContent(J.delta);break;case"thinking_delta":if(Y||$.signal.aborted)break;if($.thinkingModeEnabled)$.streamingBuffer.batchAppendThinking(J.delta);break;case"stream_end":{if($.sessionActions.setProviderCircuit(null),$.sessionActions.setProviderRetry(null),$.sessionActions.setProviderStall(null),q2.debug("[loopEventHandler] stream_end",{contentDeltaCount:Q.contentDeltaCount,contentDeltaTotalLen:Q.contentDeltaTotalLen,streamFinalized:Y,signalAborted:$.signal.aborted}),o8("loopEventHandler","onStreamEnd",{contentDeltaCallCount:Q.contentDeltaCount,contentDeltaTotalLen:Q.contentDeltaTotalLen,streamFinalized:Y,signalAborted:$.signal.aborted}),Y||$.signal.aborted){Y=!0;break}let{extraContent:Z,extraThinking:X}=$.streamingBuffer.drainPendingBuffers(),K=$.getStreamingMessageId();if(K){if(Z)g$(K,Z);r2(K)}$.sessionActions.finalizeStreamingMessage(Z,X),Y=!0;break}case"model_fallback":Y=!0,$.sessionActions.setProviderAdmission(null),$.sessionActions.setProviderCircuit(null),$.sessionActions.setProviderRetry(null),$.sessionActions.setProviderStall(null),$.streamingBuffer.resetStreamingBuffers(),$.sessionActions.discardStreamingMessage(),$.sessionActions.setCurrentThinkingContent(null);break;case"provider_admission":{let{kind:Z,...X}=J;$.sessionActions.setProviderAdmission(J.phase==="queued"?X:null);break}case"provider_circuit":{let{kind:Z,...X}=J;$.sessionActions.setProviderCircuit(J.phase==="closed"?null:X);break}case"provider_retry":{let{kind:Z,...X}=J;$.sessionActions.setProviderRetry(J.phase==="recovered"?null:X);break}case"provider_stall":{let{kind:Z,...X}=J;$.sessionActions.setProviderStall(J.phase==="detected"?X:null);break}case"action_stationarity":{let{kind:Z,...X}=J;$.sessionActions.setActionStationarity(J.phase==="recovered"?null:X);break}case"tool_start":{let Z=J.toolCall;if(!("function"in Z))break;if(Z.function.name===d2)break;if(q2.debug("[loopEventHandler] tool_start",{toolName:Z.function.name,toolKind:J.toolKind}),["TaskCreate","TaskUpdate","TaskList"].includes(Z.function.name))break;try{let X=JSON.parse(Z.function.arguments),K=e4(Z.function.name,X);$.sessionActions.addToolMessage(K,{toolCallId:Z.id,toolName:Z.function.name,phase:"start",summary:K,params:X})}catch(X){q2.error("[loopEventHandler] onToolStart error:",X)}break}case"tool_progress":{let Z=J.toolCall;if(!("function"in Z))break;if(Z.function.name===d2)break;let X=J.update.total!==void 0?` ${Math.max(0,Math.min(100,Math.round((J.update.progress??0)/J.update.total*100)))}%`:"",K=`${Z.function.name}${X}: ${J.update.message}`;$.sessionActions.addToolMessage(K,{toolCallId:Z.id,toolName:Z.function.name,phase:"progress",summary:K,...J.update.admission?{admission:J.update.admission}:{}});break}case"tool_result":{let Z=J.toolCall;if(!("function"in Z))break;if(Z.function.name===d2)break;q2.debug("[loopEventHandler] tool_result",{toolName:Z.function.name,success:J.result.success});let X=s4($6(Z.function.name,J.result),t4);$.sessionActions.addToolMessage(X.summary,{toolCallId:Z.id,toolName:Z.function.name,phase:"complete",summary:X.summary,detail:X.detail});break}case"structured_output":$.sessionActions.replaceLastAssistantMessage(JSON.stringify(J.output,null,2));break;case"token_usage":$.sessionActions.updateTokenUsage(J.usage);break;case"compaction":if($.sessionActions.setCompacting(J.phase==="start"),J.phase==="end"){if($.sessionActions.resetContextUsage(),J.outcome!=="failed")Q.compactionCount=(Q.compactionCount??0)+1}break;case"turn_start":q2.debug("[loopEventHandler] turn_start",{turn:J.turn,maxTurns:J.maxTurns}),$.sessionActions.updateTokenUsage({turnCount:J.turn}),$.sessionActions.setProviderCircuit(null),$.sessionActions.setProviderRetry(null),$.sessionActions.setProviderStall(null),Y=!1;break;case"task_update":$.appActions.setTasks(J.tasks);break;case"mcp_catalog_changed":{let Z=`MCP catalog r${J.revision}: +${J.added.length} -${J.removed.length} ~${J.updated.length}`;$.sessionActions.addToolMessage(Z,{toolName:"MCP Catalog",phase:"complete",summary:Z,detail:[J.added.length>0?`Added: ${J.added.join(", ")}`:"",J.removed.length>0?`Removed: ${J.removed.join(", ")}`:"",J.updated.length>0?`Updated: ${J.updated.join(", ")}`:""].filter(Boolean).join(`
4
4
  `)});break}case"mcp_content_changed":{let Z=`MCP ${J.contentKind} r${J.revision}: +${J.added.length} -${J.removed.length} ~${J.updated.length}`;$.sessionActions.addToolMessage(Z,{toolName:"MCP Content",phase:"complete",summary:Z,detail:[J.added.length>0?`Added: ${J.added.join(", ")}`:"",J.removed.length>0?`Removed: ${J.removed.join(", ")}`:"",J.updated.length>0?`Updated: ${J.updated.join(", ")}`:""].filter(Boolean).join(`
@@ -115,7 +115,7 @@ ${V0}`}]}}let $0=n8(V),B0=await R($0);if(!B0.accepted){let V0=B0.reason==="queue
115
115
 
116
116
  **重要**:请直接返回 JSON,不要添加任何额外的解释或文字。`,U)).trim(),H=R.match(/```(?:json)?\s*\n([\s\S]*?)\n```/);if(H)R=H[1];let k=JSON.parse(R);if(!k.name||!k.description||!k.systemPrompt)throw Error("Missing required fields: name, description, or systemPrompt");if(!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(k.name))throw Error("Invalid name format. Must be kebab-case (lowercase, numbers, hyphens only)");K({name:k.name,description:k.description,tools:Array.isArray(k.tools)?k.tools:[],color:k.color||"blue",location:"project",systemPrompt:k.systemPrompt}),Z("confirm")}catch(B){W(B instanceof Error?B.message:String(B))}finally{L(!1)}});r6(()=>{if(J==="aiGenerating"&&!q&&!O)P()},[J,q,O,P]);let w=U8(async()=>{try{let B=X.location==="project"?GQ.join(d0(),".blade","agents"):GQ.join(D3.homedir(),".blade","agents");await d6.promises.mkdir(B,{recursive:!0});let y=["---",`name: ${X.name}`,`description: ${X.description}`];if(X.tools.length>0&&!X.tools.includes("all")){y.push("tools:");for(let H of X.tools)y.push(` - ${H}`)}if(X.color)y.push(`color: ${X.color}`);y.push("---");let I=[y.join(`
117
117
  `),"",`# ${X.name} Subagent`,"",X.systemPrompt||"你是一个专门的代理,负责执行特定任务。",""].join(`
118
- `),R=GQ.join(B,`${X.name}.md`);await d6.promises.writeFile(R,I,"utf-8"),$()}catch(B){console.error("保存配置失败:",B)}}),C=S0(!1,Q);if(a6((B,y)=>{if(y.escape)f();else if(y.ctrl&&B==="c"||y.meta&&B==="c")C()},{isActive:J!=="tools"}),J==="mode")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"选择创建方式"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"你可以手动配置每个细节,或让 AI 根据你的描述自动生成配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(q8,{items:[{label:"AI 智能生成 - 根据描述自动生成完整配置",value:"ai"},{label:"手动配置 - 逐步配置每个选项",value:"manual"}],onSelect:(B)=>{if(B.value==="ai")b("ai"),Z("aiPrompt");else b("manual"),Z("name")}},void 0,!1,void 0,this),j(G0,{marginTop:1,children:j(J0,{dimColor:!0,children:"使用方向键选择 | Enter 确认 | ESC 取消"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="aiPrompt")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"AI 智能生成"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:'描述你想要创建的 Agent(例如:"一个专门用于代码审查的 agent,能够分析代码质量和潜在bug")'},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:[j(J0,{color:"green",children:"描述: "},void 0,!1,void 0,this),j(L2,{value:U,onChange:G,onSubmit:(B)=>{if(!B.trim())return;Z("aiGenerating")}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(G0,{children:j(J0,{dimColor:!0,children:"按 Enter 开始生成 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="aiGenerating"){if(O)return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"red",children:"AI 生成失败"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{color:"red",children:O},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"按 ESC 返回修改描述"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"yellow",children:[j(E3,{type:"dots"},void 0,!1,void 0,this)," AI 正在生成配置..."]},void 0,!0,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:['根据你的描述:"',U,'"']},void 0,!0,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{color:"gray",children:"正在调用 LLM 生成 agent 配置,请稍候..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}if(J==="name"){let B=z==="edit";return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:["Step 1/7: ",B?"Agent 名称(不可修改)":"输入 Agent 名称"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:B?"编辑模式下名称不可修改(修改名称相当于创建新 Agent)":"名称只能包含小写字母、数字和连字符(例如:code-reviewer)"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:[j(J0,{color:"green",children:"名称: "},void 0,!1,void 0,this),B?j(J0,{children:X.name},void 0,!1,void 0,this):j(L2,{value:X.name,onChange:(y)=>K({...X,name:y}),onSubmit:(y)=>{if(p3(y))return;_()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(G0,{children:j(J0,{dimColor:!0,children:B?"按 Enter 继续 | ESC 返回":"按 Enter 继续 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this),B&&j(L2,{value:"",onChange:()=>{},onSubmit:_,showCursor:!1},"edit-mode-dummy-input",!1,void 0,this)]},void 0,!0,void 0,this)}if(J==="description")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 2/7: 输入描述信息"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"简短描述这个 Agent 的用途和使用场景(这将帮助主 Agent 决定何时使用它)"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:[j(J0,{color:"green",children:"描述: "},void 0,!1,void 0,this),j(L2,{value:X.description,onChange:(B)=>K({...X,description:B}),onSubmit:(B)=>{if(!B.trim())return;_()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(G0,{children:j(J0,{dimColor:!0,children:"按 Enter 继续 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="tools")return j(c3,{config:X,setConfig:K,onNext:_,onPrev:f},void 0,!1,void 0,this);if(J==="color")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 4/7: 选择背景颜色"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"为 Agent 选择一个颜色标识(用于在 UI 中区分不同的 Agents)"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(q8,{items:m3,onSelect:(B)=>{let y=B.value==="none"?void 0:B.value;K({...X,color:y}),_()}},void 0,!1,void 0,this),j(G0,{marginTop:1,children:j(J0,{dimColor:!0,children:"使用方向键选择 | Enter 确认 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="location")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 5/7: 选择保存位置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"项目级配置仅在当前项目生效,用户级配置全局可用"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(q8,{items:[{label:"项目级 (.blade/agents/) - 仅当前项目",value:"project"},{label:"用户级 (~/.blade/agents/) - 全局可用",value:"user"}],onSelect:(B)=>{K({...X,location:B.value}),_()}},void 0,!1,void 0,this),j(G0,{marginTop:1,children:j(J0,{dimColor:!0,children:"使用方向键选择 | Enter 确认 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="systemPrompt")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 6/7: 输入系统提示词"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"定义 Agent 的行为和职责(可选,留空将使用默认提示)"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:[j(J0,{color:"green",children:"提示词: "},void 0,!1,void 0,this),j(L2,{value:X.systemPrompt,onChange:(B)=>K({...X,systemPrompt:B}),onSubmit:()=>_()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(G0,{children:j(J0,{dimColor:!0,children:"按 Enter 继续 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="confirm")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 7/7: 确认配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{flexDirection:"column",paddingLeft:2,marginBottom:1,children:[j(J0,{children:[j(J0,{bold:!0,color:"green",children:["名称:"," "]},void 0,!0,void 0,this),j(J0,{children:X.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(J0,{children:[j(J0,{bold:!0,color:"green",children:["描述:"," "]},void 0,!0,void 0,this),j(J0,{children:X.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(J0,{children:[j(J0,{bold:!0,color:"green",children:["工具:"," "]},void 0,!0,void 0,this),j(J0,{children:X.tools.includes("all")?"所有工具":X.tools.join(", ")||"所有工具"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(J0,{children:[j(J0,{bold:!0,color:"green",children:["颜色:"," "]},void 0,!0,void 0,this),j(J0,{children:X.color||"默认"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(J0,{children:[j(J0,{bold:!0,color:"green",children:["位置:"," "]},void 0,!0,void 0,this),j(J0,{children:X.location==="project"?"项目级":"用户级"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(J0,{children:[j(J0,{bold:!0,color:"green",children:["提示词:"," "]},void 0,!0,void 0,this),j(J0,{children:X.systemPrompt||"(使用默认)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),j(q8,{items:[{label:"确认并保存",value:"save"},{label:"返回上一步",value:"back"},{label:"取消",value:"cancel"}],onSelect:(B)=>{if(B.value==="save")w();else if(B.value==="back")f();else Q()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return null}function c3({config:$,setConfig:Q,onNext:Y,onPrev:J}){let{isFocused:Z}=j3({id:"step-tools"});a6((K,U)=>{if(U.escape)J()},{isActive:Z});let X=(K)=>{if(K.includes("all"))Q({...$,tools:["all"]});else Q({...$,tools:K});Y()};return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 3/7: 选择可用工具"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"方向键导航,空格切换勾选,Enter 确认进入下一步 | ESC 返回上一步"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(V3,{options:g3,defaultValue:$.tools,onSubmit:X},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import x3 from"node:fs";import{useMemoizedFn as w$}from"ahooks";import{Box as I0,Text as v0,useInput as u3}from"ink";import UQ from"ink-select-input";import{useEffect as l3,useMemo as o6,useState as O8}from"react";import{jsxDEV as i}from"react/jsx-dev-runtime";var qQ=10;function i6({workspaceRoot:$,initialMode:Q="menu",onComplete:Y,onCancel:J}){let Z=Q8($),[X,K]=O8(Q),[U,G]=O8(null),[q,L]=O8(0),[O,W]=O8(0),z=w$(()=>{Z.clear(),Z.loadFromStandardLocations(),L((R)=>R+1)}),b=o6(()=>{return Z.getAllSubagents()},[q]),N=Math.ceil(b.length/qQ)||1,A=o6(()=>{let R=O*qQ;return b.slice(R,R+qQ)},[b,O]);l3(()=>{let R=Math.max(0,N-1);if(O>R)W(R)},[N,O]);let T=w$(()=>{if(O<N-1)W((R)=>R+1)}),_=w$(()=>{if(O>0)W((R)=>R-1)}),f=[{key:"list",label:"查看所有 Agents",value:"list"},{key:"create",label:"创建新 Agent",value:"create"},{key:"edit",label:"编辑 Agent",value:"edit"},{key:"delete",label:"删除 Agent",value:"delete"},{key:"cancel",label:"取消",value:"cancel"}],P=w$((R)=>{if(R.value==="cancel"){J?.();return}K(R.value)}),w=w$((R)=>{if(G(R.value),X==="edit")K("editWizard");else if(X==="delete")K("deleteConfirm")}),C=w$(async()=>{if(!U?.configPath)return;try{await x3.promises.unlink(U.configPath),z(),B()}catch(R){console.error("删除失败:",R)}}),B=w$(()=>{K("menu"),G(null)}),y=S0(!1,J);if(u3((R,H)=>{if(H.escape){if(X==="menu")J?.();else if(X==="list"||X==="edit"||X==="delete")W(0),B();else if(X==="deleteConfirm")B()}else if(H.ctrl&&R==="c"||H.meta&&R==="c")y();else if(X==="list"){if(H.leftArrow||R==="h")_();else if(H.rightArrow||R==="l")T()}},{isActive:X!=="create"&&X!=="editWizard"}),X==="menu")return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:i(v0,{bold:!0,color:"cyan",children:"Agents 管理"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(UQ,{items:f,onSelect:P},void 0,!1,void 0,this),i(I0,{marginTop:1,children:i(v0,{dimColor:!0,children:"使用方向键选择 | Enter 确认 | ESC 退出"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(X==="list"){if(b.length===0)return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:i(v0,{bold:!0,color:"cyan",children:"所有 Agents"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{paddingLeft:2,children:i(v0,{color:"gray",children:"没有找到任何 agent 配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{marginTop:1,paddingLeft:2,children:i(v0,{color:"gray",children:"配置文件位置: .blade/agents/ 或 ~/.blade/agents/"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{marginTop:1,paddingLeft:2,children:i(v0,{dimColor:!0,children:"按 ESC 返回菜单"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:[i(v0,{bold:!0,color:"cyan",children:"所有 Agents"},void 0,!1,void 0,this),i(v0,{color:"gray",children:[" (共 ",b.length," 个)"]},void 0,!0,void 0,this),N>1&&i(v0,{color:"yellow",children:[" ","第 ",O+1,"/",N," 页"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),A.map((R)=>i(I0,{flexDirection:"column",paddingLeft:2,children:[i(I0,{children:i(v0,{children:[i(v0,{bold:!0,color:R.color||"white",children:["• ",R.name]},void 0,!0,void 0,this),i(v0,{color:"gray",children:[" - ",R.description]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),R.tools&&R.tools.length>0&&i(I0,{paddingLeft:2,children:i(v0,{color:"gray",children:["工具: ",R.tools.join(", ")]},void 0,!0,void 0,this)},void 0,!1,void 0,this),R.configPath&&i(I0,{paddingLeft:2,children:i(v0,{color:"gray",dimColor:!0,children:R.configPath},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},R.name,!0,void 0,this)),i(I0,{marginTop:1,paddingLeft:2,children:N>1?i(v0,{dimColor:!0,children:"Left/Right to page | ESC 返回菜单"},void 0,!1,void 0,this):i(v0,{dimColor:!0,children:"按 ESC 返回菜单"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}let I=(R)=>{if(b.length===0)return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:i(v0,{bold:!0,color:"cyan",children:R},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{paddingLeft:2,children:i(v0,{color:"gray",children:"没有找到任何 agent 配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{marginTop:1,paddingLeft:2,children:i(v0,{dimColor:!0,children:"按 ESC 返回菜单"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let H=b.map((k)=>({key:k.name,label:`${k.name} - ${k.description}`,value:k}));return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:i(v0,{bold:!0,color:"cyan",children:R},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(UQ,{items:H,onSelect:w},void 0,!1,void 0,this),i(I0,{marginTop:1,children:i(v0,{dimColor:!0,children:"使用方向键选择 | Enter 确认 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};if(X==="create")return i(B2,{onComplete:()=>{z(),B()},onCancel:B},void 0,!1,void 0,this);if(X==="edit")return I("编辑 Agent");if(X==="editWizard"&&U){let R={name:U.name,description:U.description,tools:U.tools||[],color:U.color,location:U.configPath?.includes(".blade/agents")?"project":"user",systemPrompt:U.systemPrompt||""};return i(B2,{initialConfig:R,onComplete:()=>{z(),B()},onCancel:B},void 0,!1,void 0,this)}if(X==="delete")return I("删除 Agent");if(X==="deleteConfirm"&&U)return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:i(v0,{bold:!0,color:"red",children:"确认删除"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{marginBottom:1,paddingLeft:2,children:i(v0,{children:["你确定要删除 Agent"," ",i(v0,{bold:!0,color:"yellow",children:U.name},void 0,!1,void 0,this)," ","吗?"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),i(I0,{marginBottom:1,paddingLeft:2,children:i(v0,{dimColor:!0,children:["文件路径: ",U.configPath]},void 0,!0,void 0,this)},void 0,!1,void 0,this),i(I0,{marginBottom:1,paddingLeft:2,children:i(v0,{color:"red",children:"此操作无法撤销!"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(UQ,{items:[{label:"确认删除",value:"confirm"},{label:"取消",value:"cancel"}],onSelect:(R)=>{if(R.value==="confirm")C();else B()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return null}import{Box as l$,Text as O0}from"ink";import r3,{useEffect as a3,useState as o3}from"react";import{useEffect as d3,useState as n6}from"react";function e6($=d0(),Q=5000){let[Y,J]=n6(null),[Z,X]=n6(!0);return d3(()=>{let K=!0,U=async()=>{try{let q=await t6($);if(!K)return;if(!q){J(null),X(!1);return}let L=await s6($);if(!K)return;J(L)}catch{if(K)J(null)}finally{if(K)X(!1)}};U();let G=null;if(Q>0)G=setInterval(U,Q);return()=>{if(K=!1,G)clearInterval(G)}},[$,Q]),{branch:Y,loading:Z}}import{jsxDEV as s,Fragment as B1}from"react/jsx-dev-runtime";var Q9=r3.memo(()=>{let $=j2(),Q=h$(),J=D2()==="shortcuts",Z=V4(),X=T1(),{branch:K}=e6(X),U=h2(),G=I4(),q=b4(),L=m2(),O=p2(),W=c2(),z=x2(),b=u2(),N=A4(),A=P4(),T=g2(),_=x4(),f=j$(),[P,w]=o3(null);a3(()=>{let H=!1;new OQ(X,f).get().then((n)=>{if(!H)w(n)}).catch(()=>{if(!H)w(null)});let E=OQ.subscribe((n)=>{if(!H&&n.sessionId===f&&n.workspaceRoot===X)w(n.goal)});return()=>{H=!0,E()}},[f,X]);let C=U?K8(U):!1,y=(()=>{if(Q==="default")return null;if(Q==="autoEdit")return s(O0,{color:"magenta",children:[">> ","auto edit on ",s(O0,{color:"gray",children:"(shift+tab to cycle)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(Q==="plan")return s(O0,{color:"cyan",children:["‖ plan mode on ",s(O0,{color:"gray",children:"(shift+tab to cycle)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(Q==="yolo")return s(O0,{color:"red",children:["yolo mode on ",s(O0,{color:"gray",children:"(all tools auto-approved)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return null})(),I=y!==null,R=[["Enter:发送","Shift+Enter:换行","Esc:中止"],["Shift+Tab:切换模式","Up/Down:历史","Tab:补全"],["Ctrl+A:行首","Ctrl+E:行尾","Ctrl+K:删到尾"],["Ctrl+U:删到首","Ctrl+W:删单词","Ctrl+C:退出"]];return s(l$,{flexDirection:"row",justifyContent:"space-between",paddingX:2,paddingY:0,children:[J?s(l$,{flexDirection:"column",gap:0,children:R.map((H,k)=>s(l$,{flexDirection:"row",children:[H.map((E,n)=>{let[d,a]=E.split(":");return s(l$,{flexDirection:"row",width:20,children:[s(O0,{color:"yellow",children:d},void 0,!1,void 0,this),s(O0,{color:"gray",children:":"},void 0,!1,void 0,this),s(O0,{color:"white",children:a},void 0,!1,void 0,this)]},n,!0,void 0,this)}),k===R.length-1&&s(O0,{color:"cyan",children:" ? 关闭"},void 0,!1,void 0,this)]},k,!0,void 0,this))},void 0,!1,void 0,this):s(l$,{flexDirection:"row",gap:1,children:[K&&s(B1,{children:[s(O0,{color:"gray",children:[" ",K]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y,I&&s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),P&&s(B1,{children:[s(O0,{color:P.status==="active"?"green":P.status==="verifying"?"cyan":P.status==="blocked"||P.status==="budget_limited"?"yellow":"gray",children:["goal:",P.status," ",P.objective.slice(0,32)]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"? for shortcuts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s(l$,{flexDirection:"row",gap:1,children:!$?s(O0,{color:"red",children:"[WARN] API 密钥未配置"},void 0,!1,void 0,this):s(B1,{children:[C&&s(B1,{children:[L?s(O0,{color:"cyan",children:["Effort ",O]},void 0,!0,void 0,this):s(O0,{color:"gray",children:"Tab:Effort"},void 0,!1,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W!=="auto"&&s(B1,{children:[s(O0,{color:W==="fast"?"yellow":"gray",children:["Speed ",W]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z!=="auto"&&s(B1,{children:[s(O0,{color:"gray",children:["Output ",z]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b!=="auto"&&s(B1,{children:[s(O0,{color:"gray",children:["Style ",b]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&s(O0,{color:"gray",children:U.model},void 0,!1,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),q?s(O0,{color:"yellow",children:"压缩中..."},void 0,!1,void 0,this):s(O0,{color:G<20?"red":G<50?"yellow":"gray",children:[G,"%"]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),s(O0,{color:A===void 0?"gray":"cyan",children:["Cache ",$9(A)]},void 0,!0,void 0,this),N>0.001&&s(B1,{children:[s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),s(O0,{color:"green",children:["$",N<0.01?N.toFixed(4):N.toFixed(3)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.length>0&&s(B1,{children:[s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),s(O0,{color:"yellow",children:["已排队 ",T.length]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_>0&&s(B1,{children:[s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),s(O0,{color:"cyan",children:["已恢复 ",_," 条指令"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z&&s(B1,{children:[s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),s(O0,{color:"yellow",children:"再按一次 Ctrl+C 退出"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});import{Box as zQ,Text as _Q}from"ink";import i3 from"react";import{jsxDEV as d$}from"react/jsx-dev-runtime";var J9=i3.memo(({suggestions:$,selectedIndex:Q,visible:Y,maxDisplay:J=8})=>{if(!Y||$.length===0)return null;let Z=0,X=Math.min(J,$.length),K=Q>=$.length;if(Q>=J&&!K)Z=Q-J+1,X=Q+1;let U=$.slice(Z,X),G=$.length>J;return d$(zQ,{flexDirection:"column",paddingX:2,paddingY:0,children:[U.map((q,L)=>{let W=Z+L===Q;return d$(zQ,{flexDirection:"row",paddingX:1,gap:2,children:[d$(_Q,{color:W?"cyan":"white",bold:W,children:q.command},void 0,!1,void 0,this),d$(_Q,{color:W?"cyan":"gray",dimColor:!W,children:["- ",q.description]},void 0,!0,void 0,this)]},q.command,!0,void 0,this)}),G&&d$(zQ,{paddingX:1,children:d$(_Q,{color:K?"cyan":"gray",bold:K,dimColor:!K,children:["... and ",$.length-J," more"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});import{Box as F1,Text as f1,useInput as iZ,useStdout as nZ}from"ink";import tZ from"ink-select-input";import hQ,{useMemo as V9}from"react";import{Box as z0,Text as M0}from"ink";import A$,{useEffect as VQ,useMemo as b$,useRef as S9}from"react";import{Box as RQ,Text as F9}from"ink";import qZ from"react";import{Text as w1}from"ink";import KZ from"react";import z9 from"string-width";import w2 from"string-width";function NQ({onlyFirst:$=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",$?void 0:"g")}var n3=NQ();function FQ($){if(typeof $!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);if(!$.includes("\x1B")&&!$.includes("›"))return $;return $.replace(n3,"")}var Y9=($=0)=>(Q)=>`\x1B[${Q+$}m`,Z9=($=0)=>(Q)=>`\x1B[${38+$};5;${Q}m`,X9=($=0)=>(Q,Y,J)=>`\x1B[${38+$};2;${Q};${Y};${J}m`,h0={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},xU=Object.keys(h0.modifier),t3=Object.keys(h0.color),s3=Object.keys(h0.bgColor),uU=[...t3,...s3];function e3(){let $=new Map;for(let[Q,Y]of Object.entries(h0)){for(let[J,Z]of Object.entries(Y))h0[J]={open:`\x1B[${Z[0]}m`,close:`\x1B[${Z[1]}m`},Y[J]=h0[J],$.set(Z[0],Z[1]);Object.defineProperty(h0,Q,{value:Y,enumerable:!1})}return Object.defineProperty(h0,"codes",{value:$,enumerable:!1}),h0.color.close="\x1B[39m",h0.bgColor.close="\x1B[49m",h0.color.ansi=Y9(),h0.color.ansi256=Z9(),h0.color.ansi16m=X9(),h0.bgColor.ansi=Y9(10),h0.bgColor.ansi256=Z9(10),h0.bgColor.ansi16m=X9(10),Object.defineProperties(h0,{rgbToAnsi256:{value(Q,Y,J){if(Q===Y&&Y===J){if(Q<8)return 16;if(Q>248)return 231;return Math.round((Q-8)/247*24)+232}return 16+36*Math.round(Q/255*5)+6*Math.round(Y/255*5)+Math.round(J/255*5)},enumerable:!1},hexToRgb:{value(Q){let Y=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Q.toString(16));if(!Y)return[0,0,0];let[J]=Y;if(J.length===3)J=[...J].map((X)=>X+X).join("");let Z=Number.parseInt(J,16);return[Z>>16&255,Z>>8&255,Z&255]},enumerable:!1},hexToAnsi256:{value:(Q)=>h0.rgbToAnsi256(...h0.hexToRgb(Q)),enumerable:!1},ansi256ToAnsi:{value(Q){if(Q<8)return 30+Q;if(Q<16)return 90+(Q-8);let Y,J,Z;if(Q>=232)Y=((Q-232)*10+8)/255,J=Y,Z=Y;else{Q-=16;let U=Q%36;Y=Math.floor(Q/36)/5,J=Math.floor(U/6)/5,Z=U%6/5}let X=Math.max(Y,J,Z)*2;if(X===0)return 30;let K=30+(Math.round(Z)<<2|Math.round(J)<<1|Math.round(Y));if(X===2)K+=60;return K},enumerable:!1},rgbToAnsi:{value:(Q,Y,J)=>h0.ansi256ToAnsi(h0.rgbToAnsi256(Q,Y,J)),enumerable:!1},hexToAnsi:{value:(Q)=>h0.ansi256ToAnsi(h0.hexToAnsi256(Q)),enumerable:!1}}),h0}var $Z=e3(),K9=$Z;var _8=new Set(["\x1B","›"]),QZ=39,HQ="\x07",q9="[",JZ="]",O9="m",z8=`${JZ}8;;`,G9=($)=>`${_8.values().next().value}${q9}${$}${O9}`,U9=($)=>`${_8.values().next().value}${z8}${$}${HQ}`,YZ=($)=>$.split(" ").map((Q)=>w2(Q)),WQ=($,Q,Y)=>{let J=[...Q],Z=!1,X=!1,K=w2(FQ($.at(-1)));for(let[U,G]of J.entries()){let q=w2(G);if(K+q<=Y)$[$.length-1]+=G;else $.push(G),K=0;if(_8.has(G))Z=!0,X=J.slice(U+1,U+1+z8.length).join("")===z8;if(Z){if(X){if(G===HQ)Z=!1,X=!1}else if(G===O9)Z=!1;continue}if(K+=q,K===Y&&U<J.length-1)$.push(""),K=0}if(!K&&$.at(-1).length>0&&$.length>1)$[$.length-2]+=$.pop()},ZZ=($)=>{let Q=$.split(" "),Y=Q.length;while(Y>0){if(w2(Q[Y-1])>0)break;Y--}if(Y===Q.length)return $;return Q.slice(0,Y).join(" ")+Q.slice(Y).join("")},XZ=($,Q,Y={})=>{if(Y.trim!==!1&&$.trim()==="")return"";let J="",Z,X,K=YZ($),U=[""];for(let[O,W]of $.split(" ").entries()){if(Y.trim!==!1)U[U.length-1]=U.at(-1).trimStart();let z=w2(U.at(-1));if(O!==0){if(z>=Q&&(Y.wordWrap===!1||Y.trim===!1))U.push(""),z=0;if(z>0||Y.trim===!1)U[U.length-1]+=" ",z++}if(Y.hard&&K[O]>Q){let b=Q-z,N=1+Math.floor((K[O]-b-1)/Q);if(Math.floor((K[O]-1)/Q)<N)U.push("");WQ(U,W,Q);continue}if(z+K[O]>Q&&z>0&&K[O]>0){if(Y.wordWrap===!1&&z<Q){WQ(U,W,Q);continue}U.push("")}if(z+K[O]>Q&&Y.wordWrap===!1){WQ(U,W,Q);continue}U[U.length-1]+=W}if(Y.trim!==!1)U=U.map((O)=>ZZ(O));let G=U.join(`
118
+ `),R=GQ.join(B,`${X.name}.md`);await d6.promises.writeFile(R,I,"utf-8"),$()}catch(B){console.error("保存配置失败:",B)}}),C=S0(!1,Q);if(a6((B,y)=>{if(y.escape)f();else if(y.ctrl&&B==="c"||y.meta&&B==="c")C()},{isActive:J!=="tools"}),J==="mode")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"选择创建方式"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"你可以手动配置每个细节,或让 AI 根据你的描述自动生成配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(q8,{items:[{label:"AI 智能生成 - 根据描述自动生成完整配置",value:"ai"},{label:"手动配置 - 逐步配置每个选项",value:"manual"}],onSelect:(B)=>{if(B.value==="ai")b("ai"),Z("aiPrompt");else b("manual"),Z("name")}},void 0,!1,void 0,this),j(G0,{marginTop:1,children:j(J0,{dimColor:!0,children:"使用方向键选择 | Enter 确认 | ESC 取消"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="aiPrompt")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"AI 智能生成"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:'描述你想要创建的 Agent(例如:"一个专门用于代码审查的 agent,能够分析代码质量和潜在bug")'},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:[j(J0,{color:"green",children:"描述: "},void 0,!1,void 0,this),j(L2,{value:U,onChange:G,onSubmit:(B)=>{if(!B.trim())return;Z("aiGenerating")}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(G0,{children:j(J0,{dimColor:!0,children:"按 Enter 开始生成 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="aiGenerating"){if(O)return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"red",children:"AI 生成失败"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{color:"red",children:O},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"按 ESC 返回修改描述"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"yellow",children:[j(E3,{type:"dots"},void 0,!1,void 0,this)," AI 正在生成配置..."]},void 0,!0,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:['根据你的描述:"',U,'"']},void 0,!0,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{color:"gray",children:"正在调用 LLM 生成 agent 配置,请稍候..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}if(J==="name"){let B=z==="edit";return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:["Step 1/7: ",B?"Agent 名称(不可修改)":"输入 Agent 名称"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:B?"编辑模式下名称不可修改(修改名称相当于创建新 Agent)":"名称只能包含小写字母、数字和连字符(例如:code-reviewer)"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:[j(J0,{color:"green",children:"名称: "},void 0,!1,void 0,this),B?j(J0,{children:X.name},void 0,!1,void 0,this):j(L2,{value:X.name,onChange:(y)=>K({...X,name:y}),onSubmit:(y)=>{if(p3(y))return;_()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(G0,{children:j(J0,{dimColor:!0,children:B?"按 Enter 继续 | ESC 返回":"按 Enter 继续 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this),B&&j(L2,{value:"",onChange:()=>{},onSubmit:_,showCursor:!1},"edit-mode-dummy-input",!1,void 0,this)]},void 0,!0,void 0,this)}if(J==="description")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 2/7: 输入描述信息"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"简短描述这个 Agent 的用途和使用场景(这将帮助主 Agent 决定何时使用它)"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:[j(J0,{color:"green",children:"描述: "},void 0,!1,void 0,this),j(L2,{value:X.description,onChange:(B)=>K({...X,description:B}),onSubmit:(B)=>{if(!B.trim())return;_()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(G0,{children:j(J0,{dimColor:!0,children:"按 Enter 继续 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="tools")return j(c3,{config:X,setConfig:K,onNext:_,onPrev:f},void 0,!1,void 0,this);if(J==="color")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 4/7: 选择背景颜色"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"为 Agent 选择一个颜色标识(用于在 UI 中区分不同的 Agents)"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(q8,{items:m3,onSelect:(B)=>{let y=B.value==="none"?void 0:B.value;K({...X,color:y}),_()}},void 0,!1,void 0,this),j(G0,{marginTop:1,children:j(J0,{dimColor:!0,children:"使用方向键选择 | Enter 确认 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="location")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 5/7: 选择保存位置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"项目级配置仅在当前项目生效,用户级配置全局可用"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(q8,{items:[{label:"项目级 (.blade/agents/) - 仅当前项目",value:"project"},{label:"用户级 (~/.blade/agents/) - 全局可用",value:"user"}],onSelect:(B)=>{K({...X,location:B.value}),_()}},void 0,!1,void 0,this),j(G0,{marginTop:1,children:j(J0,{dimColor:!0,children:"使用方向键选择 | Enter 确认 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="systemPrompt")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 6/7: 输入系统提示词"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"定义 Agent 的行为和职责(可选,留空将使用默认提示)"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:[j(J0,{color:"green",children:"提示词: "},void 0,!1,void 0,this),j(L2,{value:X.systemPrompt,onChange:(B)=>K({...X,systemPrompt:B}),onSubmit:()=>_()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(G0,{children:j(J0,{dimColor:!0,children:"按 Enter 继续 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(J==="confirm")return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 7/7: 确认配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{flexDirection:"column",paddingLeft:2,marginBottom:1,children:[j(J0,{children:[j(J0,{bold:!0,color:"green",children:["名称:"," "]},void 0,!0,void 0,this),j(J0,{children:X.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(J0,{children:[j(J0,{bold:!0,color:"green",children:["描述:"," "]},void 0,!0,void 0,this),j(J0,{children:X.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(J0,{children:[j(J0,{bold:!0,color:"green",children:["工具:"," "]},void 0,!0,void 0,this),j(J0,{children:X.tools.includes("all")?"所有工具":X.tools.join(", ")||"所有工具"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(J0,{children:[j(J0,{bold:!0,color:"green",children:["颜色:"," "]},void 0,!0,void 0,this),j(J0,{children:X.color||"默认"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(J0,{children:[j(J0,{bold:!0,color:"green",children:["位置:"," "]},void 0,!0,void 0,this),j(J0,{children:X.location==="project"?"项目级":"用户级"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j(J0,{children:[j(J0,{bold:!0,color:"green",children:["提示词:"," "]},void 0,!0,void 0,this),j(J0,{children:X.systemPrompt||"(使用默认)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),j(q8,{items:[{label:"确认并保存",value:"save"},{label:"返回上一步",value:"back"},{label:"取消",value:"cancel"}],onSelect:(B)=>{if(B.value==="save")w();else if(B.value==="back")f();else Q()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return null}function c3({config:$,setConfig:Q,onNext:Y,onPrev:J}){let{isFocused:Z}=j3({id:"step-tools"});a6((K,U)=>{if(U.escape)J()},{isActive:Z});let X=(K)=>{if(K.includes("all"))Q({...$,tools:["all"]});else Q({...$,tools:K});Y()};return j(G0,{flexDirection:"column",paddingY:1,children:[j(G0,{marginBottom:1,children:j(J0,{bold:!0,color:"cyan",children:"Step 3/7: 选择可用工具"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(G0,{marginBottom:1,children:j(J0,{dimColor:!0,children:"方向键导航,空格切换勾选,Enter 确认进入下一步 | ESC 返回上一步"},void 0,!1,void 0,this)},void 0,!1,void 0,this),j(V3,{options:g3,defaultValue:$.tools,onSubmit:X},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import x3 from"node:fs";import{useMemoizedFn as w$}from"ahooks";import{Box as I0,Text as v0,useInput as u3}from"ink";import UQ from"ink-select-input";import{useEffect as l3,useMemo as o6,useState as O8}from"react";import{jsxDEV as i}from"react/jsx-dev-runtime";var qQ=10;function i6({workspaceRoot:$,initialMode:Q="menu",onComplete:Y,onCancel:J}){let Z=Q8($),[X,K]=O8(Q),[U,G]=O8(null),[q,L]=O8(0),[O,W]=O8(0),z=w$(()=>{Z.clear(),Z.loadFromStandardLocations(),L((R)=>R+1)}),b=o6(()=>{return Z.getAllSubagents()},[q]),N=Math.ceil(b.length/qQ)||1,A=o6(()=>{let R=O*qQ;return b.slice(R,R+qQ)},[b,O]);l3(()=>{let R=Math.max(0,N-1);if(O>R)W(R)},[N,O]);let T=w$(()=>{if(O<N-1)W((R)=>R+1)}),_=w$(()=>{if(O>0)W((R)=>R-1)}),f=[{key:"list",label:"查看所有 Agents",value:"list"},{key:"create",label:"创建新 Agent",value:"create"},{key:"edit",label:"编辑 Agent",value:"edit"},{key:"delete",label:"删除 Agent",value:"delete"},{key:"cancel",label:"取消",value:"cancel"}],P=w$((R)=>{if(R.value==="cancel"){J?.();return}K(R.value)}),w=w$((R)=>{if(G(R.value),X==="edit")K("editWizard");else if(X==="delete")K("deleteConfirm")}),C=w$(async()=>{if(!U?.configPath)return;try{await x3.promises.unlink(U.configPath),z(),B()}catch(R){console.error("删除失败:",R)}}),B=w$(()=>{K("menu"),G(null)}),y=S0(!1,J);if(u3((R,H)=>{if(H.escape){if(X==="menu")J?.();else if(X==="list"||X==="edit"||X==="delete")W(0),B();else if(X==="deleteConfirm")B()}else if(H.ctrl&&R==="c"||H.meta&&R==="c")y();else if(X==="list"){if(H.leftArrow||R==="h")_();else if(H.rightArrow||R==="l")T()}},{isActive:X!=="create"&&X!=="editWizard"}),X==="menu")return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:i(v0,{bold:!0,color:"cyan",children:"Agents 管理"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(UQ,{items:f,onSelect:P},void 0,!1,void 0,this),i(I0,{marginTop:1,children:i(v0,{dimColor:!0,children:"使用方向键选择 | Enter 确认 | ESC 退出"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(X==="list"){if(b.length===0)return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:i(v0,{bold:!0,color:"cyan",children:"所有 Agents"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{paddingLeft:2,children:i(v0,{color:"gray",children:"没有找到任何 agent 配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{marginTop:1,paddingLeft:2,children:i(v0,{color:"gray",children:"配置文件位置: .blade/agents/ 或 ~/.blade/agents/"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{marginTop:1,paddingLeft:2,children:i(v0,{dimColor:!0,children:"按 ESC 返回菜单"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:[i(v0,{bold:!0,color:"cyan",children:"所有 Agents"},void 0,!1,void 0,this),i(v0,{color:"gray",children:[" (共 ",b.length," 个)"]},void 0,!0,void 0,this),N>1&&i(v0,{color:"yellow",children:[" ","第 ",O+1,"/",N," 页"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),A.map((R)=>i(I0,{flexDirection:"column",paddingLeft:2,children:[i(I0,{children:i(v0,{children:[i(v0,{bold:!0,color:R.color||"white",children:["• ",R.name]},void 0,!0,void 0,this),i(v0,{color:"gray",children:[" - ",R.description]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),R.tools&&R.tools.length>0&&i(I0,{paddingLeft:2,children:i(v0,{color:"gray",children:["工具: ",R.tools.join(", ")]},void 0,!0,void 0,this)},void 0,!1,void 0,this),R.configPath&&i(I0,{paddingLeft:2,children:i(v0,{color:"gray",dimColor:!0,children:R.configPath},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},R.name,!0,void 0,this)),i(I0,{marginTop:1,paddingLeft:2,children:N>1?i(v0,{dimColor:!0,children:"Left/Right to page | ESC 返回菜单"},void 0,!1,void 0,this):i(v0,{dimColor:!0,children:"按 ESC 返回菜单"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}let I=(R)=>{if(b.length===0)return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:i(v0,{bold:!0,color:"cyan",children:R},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{paddingLeft:2,children:i(v0,{color:"gray",children:"没有找到任何 agent 配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{marginTop:1,paddingLeft:2,children:i(v0,{dimColor:!0,children:"按 ESC 返回菜单"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let H=b.map((k)=>({key:k.name,label:`${k.name} - ${k.description}`,value:k}));return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:i(v0,{bold:!0,color:"cyan",children:R},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(UQ,{items:H,onSelect:w},void 0,!1,void 0,this),i(I0,{marginTop:1,children:i(v0,{dimColor:!0,children:"使用方向键选择 | Enter 确认 | ESC 返回"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};if(X==="create")return i(B2,{onComplete:()=>{z(),B()},onCancel:B},void 0,!1,void 0,this);if(X==="edit")return I("编辑 Agent");if(X==="editWizard"&&U){let R={name:U.name,description:U.description,tools:U.tools||[],color:U.color,location:U.configPath?.includes(".blade/agents")?"project":"user",systemPrompt:U.systemPrompt||""};return i(B2,{initialConfig:R,onComplete:()=>{z(),B()},onCancel:B},void 0,!1,void 0,this)}if(X==="delete")return I("删除 Agent");if(X==="deleteConfirm"&&U)return i(I0,{flexDirection:"column",paddingY:1,children:[i(I0,{marginBottom:1,children:i(v0,{bold:!0,color:"red",children:"确认删除"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(I0,{marginBottom:1,paddingLeft:2,children:i(v0,{children:["你确定要删除 Agent"," ",i(v0,{bold:!0,color:"yellow",children:U.name},void 0,!1,void 0,this)," ","吗?"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),i(I0,{marginBottom:1,paddingLeft:2,children:i(v0,{dimColor:!0,children:["文件路径: ",U.configPath]},void 0,!0,void 0,this)},void 0,!1,void 0,this),i(I0,{marginBottom:1,paddingLeft:2,children:i(v0,{color:"red",children:"此操作无法撤销!"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i(UQ,{items:[{label:"确认删除",value:"confirm"},{label:"取消",value:"cancel"}],onSelect:(R)=>{if(R.value==="confirm")C();else B()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return null}import{Box as l$,Text as O0}from"ink";import r3,{useEffect as a3,useState as o3}from"react";import{useEffect as d3,useState as n6}from"react";function e6($=d0(),Q=5000){let[Y,J]=n6(null),[Z,X]=n6(!0);return d3(()=>{let K=!0,U=async()=>{try{let q=await t6($);if(!K)return;if(!q){J(null),X(!1);return}let L=await s6($);if(!K)return;J(L)}catch{if(K)J(null)}finally{if(K)X(!1)}};U();let G=null;if(Q>0)G=setInterval(U,Q);return()=>{if(K=!1,G)clearInterval(G)}},[$,Q]),{branch:Y,loading:Z}}import{jsxDEV as s,Fragment as B1}from"react/jsx-dev-runtime";var Q9=r3.memo(()=>{let $=j2(),Q=h$(),J=D2()==="shortcuts",Z=V4(),X=T1(),{branch:K}=e6(X),U=h2(),G=I4(),q=b4(),L=m2(),O=p2(),W=c2(),z=x2(),b=u2(),N=A4(),A=P4(),T=g2(),_=x4(),f=j$(),[P,w]=o3(null);a3(()=>{let H=!1;new OQ(X,f).get().then((n)=>{if(!H)w(n)}).catch(()=>{if(!H)w(null)});let E=OQ.subscribe((n)=>{if(!H&&n.sessionId===f&&n.workspaceRoot===X)w(n.goal)});return()=>{H=!0,E()}},[f,X]);let C=U?K8(U):!1,y=(()=>{if(Q==="default")return null;if(Q==="autoEdit")return s(O0,{color:"magenta",children:[">> ","auto edit on ",s(O0,{color:"gray",children:"(shift+tab to cycle)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(Q==="plan")return s(O0,{color:"cyan",children:["‖ plan mode on ",s(O0,{color:"gray",children:"(shift+tab to cycle)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(Q==="yolo")return s(O0,{color:"red",children:["yolo mode on ",s(O0,{color:"gray",children:"(all tools auto-approved)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return null})(),I=y!==null,R=[["Enter:发送","Shift+Enter:换行","Esc:中止"],["Shift+Tab:切换模式","Up/Down:历史","Tab:补全"],["Ctrl+A:行首","Ctrl+E:行尾","Ctrl+K:删到尾"],["Ctrl+U:删到首","Ctrl+W:删单词","Ctrl+C:退出"]];return s(l$,{flexDirection:"row",justifyContent:"space-between",paddingX:2,paddingY:0,children:[J?s(l$,{flexDirection:"column",gap:0,children:R.map((H,k)=>s(l$,{flexDirection:"row",children:[H.map((E,n)=>{let[d,a]=E.split(":");return s(l$,{flexDirection:"row",width:20,children:[s(O0,{color:"yellow",children:d},void 0,!1,void 0,this),s(O0,{color:"gray",children:":"},void 0,!1,void 0,this),s(O0,{color:"white",children:a},void 0,!1,void 0,this)]},n,!0,void 0,this)}),k===R.length-1&&s(O0,{color:"cyan",children:" ? 关闭"},void 0,!1,void 0,this)]},k,!0,void 0,this))},void 0,!1,void 0,this):s(l$,{flexDirection:"row",gap:1,children:[K&&s(B1,{children:[s(O0,{color:"gray",children:[" ",K]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y,I&&s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),P&&s(B1,{children:[s(O0,{color:P.status==="active"?"green":P.status==="verifying"?"cyan":P.status==="blocked"||P.status==="budget_limited"?"yellow":"gray",children:["goal:",P.status," ",P.objective.slice(0,32),P.prematureStop?` recovery:${P.prematureStop.consecutiveCount}`:""]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"? for shortcuts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s(l$,{flexDirection:"row",gap:1,children:!$?s(O0,{color:"red",children:"[WARN] API 密钥未配置"},void 0,!1,void 0,this):s(B1,{children:[C&&s(B1,{children:[L?s(O0,{color:"cyan",children:["Effort ",O]},void 0,!0,void 0,this):s(O0,{color:"gray",children:"Tab:Effort"},void 0,!1,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W!=="auto"&&s(B1,{children:[s(O0,{color:W==="fast"?"yellow":"gray",children:["Speed ",W]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z!=="auto"&&s(B1,{children:[s(O0,{color:"gray",children:["Output ",z]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b!=="auto"&&s(B1,{children:[s(O0,{color:"gray",children:["Style ",b]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&s(O0,{color:"gray",children:U.model},void 0,!1,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),q?s(O0,{color:"yellow",children:"压缩中..."},void 0,!1,void 0,this):s(O0,{color:G<20?"red":G<50?"yellow":"gray",children:[G,"%"]},void 0,!0,void 0,this),s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),s(O0,{color:A===void 0?"gray":"cyan",children:["Cache ",$9(A)]},void 0,!0,void 0,this),N>0.001&&s(B1,{children:[s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),s(O0,{color:"green",children:["$",N<0.01?N.toFixed(4):N.toFixed(3)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.length>0&&s(B1,{children:[s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),s(O0,{color:"yellow",children:["已排队 ",T.length]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_>0&&s(B1,{children:[s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),s(O0,{color:"cyan",children:["已恢复 ",_," 条指令"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z&&s(B1,{children:[s(O0,{color:"gray",children:"·"},void 0,!1,void 0,this),s(O0,{color:"yellow",children:"再按一次 Ctrl+C 退出"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});import{Box as zQ,Text as _Q}from"ink";import i3 from"react";import{jsxDEV as d$}from"react/jsx-dev-runtime";var J9=i3.memo(({suggestions:$,selectedIndex:Q,visible:Y,maxDisplay:J=8})=>{if(!Y||$.length===0)return null;let Z=0,X=Math.min(J,$.length),K=Q>=$.length;if(Q>=J&&!K)Z=Q-J+1,X=Q+1;let U=$.slice(Z,X),G=$.length>J;return d$(zQ,{flexDirection:"column",paddingX:2,paddingY:0,children:[U.map((q,L)=>{let W=Z+L===Q;return d$(zQ,{flexDirection:"row",paddingX:1,gap:2,children:[d$(_Q,{color:W?"cyan":"white",bold:W,children:q.command},void 0,!1,void 0,this),d$(_Q,{color:W?"cyan":"gray",dimColor:!W,children:["- ",q.description]},void 0,!0,void 0,this)]},q.command,!0,void 0,this)}),G&&d$(zQ,{paddingX:1,children:d$(_Q,{color:K?"cyan":"gray",bold:K,dimColor:!K,children:["... and ",$.length-J," more"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});import{Box as F1,Text as f1,useInput as iZ,useStdout as nZ}from"ink";import tZ from"ink-select-input";import hQ,{useMemo as V9}from"react";import{Box as z0,Text as M0}from"ink";import A$,{useEffect as VQ,useMemo as b$,useRef as S9}from"react";import{Box as RQ,Text as F9}from"ink";import qZ from"react";import{Text as w1}from"ink";import KZ from"react";import z9 from"string-width";import w2 from"string-width";function NQ({onlyFirst:$=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",$?void 0:"g")}var n3=NQ();function FQ($){if(typeof $!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);if(!$.includes("\x1B")&&!$.includes("›"))return $;return $.replace(n3,"")}var Y9=($=0)=>(Q)=>`\x1B[${Q+$}m`,Z9=($=0)=>(Q)=>`\x1B[${38+$};5;${Q}m`,X9=($=0)=>(Q,Y,J)=>`\x1B[${38+$};2;${Q};${Y};${J}m`,h0={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},xU=Object.keys(h0.modifier),t3=Object.keys(h0.color),s3=Object.keys(h0.bgColor),uU=[...t3,...s3];function e3(){let $=new Map;for(let[Q,Y]of Object.entries(h0)){for(let[J,Z]of Object.entries(Y))h0[J]={open:`\x1B[${Z[0]}m`,close:`\x1B[${Z[1]}m`},Y[J]=h0[J],$.set(Z[0],Z[1]);Object.defineProperty(h0,Q,{value:Y,enumerable:!1})}return Object.defineProperty(h0,"codes",{value:$,enumerable:!1}),h0.color.close="\x1B[39m",h0.bgColor.close="\x1B[49m",h0.color.ansi=Y9(),h0.color.ansi256=Z9(),h0.color.ansi16m=X9(),h0.bgColor.ansi=Y9(10),h0.bgColor.ansi256=Z9(10),h0.bgColor.ansi16m=X9(10),Object.defineProperties(h0,{rgbToAnsi256:{value(Q,Y,J){if(Q===Y&&Y===J){if(Q<8)return 16;if(Q>248)return 231;return Math.round((Q-8)/247*24)+232}return 16+36*Math.round(Q/255*5)+6*Math.round(Y/255*5)+Math.round(J/255*5)},enumerable:!1},hexToRgb:{value(Q){let Y=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Q.toString(16));if(!Y)return[0,0,0];let[J]=Y;if(J.length===3)J=[...J].map((X)=>X+X).join("");let Z=Number.parseInt(J,16);return[Z>>16&255,Z>>8&255,Z&255]},enumerable:!1},hexToAnsi256:{value:(Q)=>h0.rgbToAnsi256(...h0.hexToRgb(Q)),enumerable:!1},ansi256ToAnsi:{value(Q){if(Q<8)return 30+Q;if(Q<16)return 90+(Q-8);let Y,J,Z;if(Q>=232)Y=((Q-232)*10+8)/255,J=Y,Z=Y;else{Q-=16;let U=Q%36;Y=Math.floor(Q/36)/5,J=Math.floor(U/6)/5,Z=U%6/5}let X=Math.max(Y,J,Z)*2;if(X===0)return 30;let K=30+(Math.round(Z)<<2|Math.round(J)<<1|Math.round(Y));if(X===2)K+=60;return K},enumerable:!1},rgbToAnsi:{value:(Q,Y,J)=>h0.ansi256ToAnsi(h0.rgbToAnsi256(Q,Y,J)),enumerable:!1},hexToAnsi:{value:(Q)=>h0.ansi256ToAnsi(h0.hexToAnsi256(Q)),enumerable:!1}}),h0}var $Z=e3(),K9=$Z;var _8=new Set(["\x1B","›"]),QZ=39,HQ="\x07",q9="[",JZ="]",O9="m",z8=`${JZ}8;;`,G9=($)=>`${_8.values().next().value}${q9}${$}${O9}`,U9=($)=>`${_8.values().next().value}${z8}${$}${HQ}`,YZ=($)=>$.split(" ").map((Q)=>w2(Q)),WQ=($,Q,Y)=>{let J=[...Q],Z=!1,X=!1,K=w2(FQ($.at(-1)));for(let[U,G]of J.entries()){let q=w2(G);if(K+q<=Y)$[$.length-1]+=G;else $.push(G),K=0;if(_8.has(G))Z=!0,X=J.slice(U+1,U+1+z8.length).join("")===z8;if(Z){if(X){if(G===HQ)Z=!1,X=!1}else if(G===O9)Z=!1;continue}if(K+=q,K===Y&&U<J.length-1)$.push(""),K=0}if(!K&&$.at(-1).length>0&&$.length>1)$[$.length-2]+=$.pop()},ZZ=($)=>{let Q=$.split(" "),Y=Q.length;while(Y>0){if(w2(Q[Y-1])>0)break;Y--}if(Y===Q.length)return $;return Q.slice(0,Y).join(" ")+Q.slice(Y).join("")},XZ=($,Q,Y={})=>{if(Y.trim!==!1&&$.trim()==="")return"";let J="",Z,X,K=YZ($),U=[""];for(let[O,W]of $.split(" ").entries()){if(Y.trim!==!1)U[U.length-1]=U.at(-1).trimStart();let z=w2(U.at(-1));if(O!==0){if(z>=Q&&(Y.wordWrap===!1||Y.trim===!1))U.push(""),z=0;if(z>0||Y.trim===!1)U[U.length-1]+=" ",z++}if(Y.hard&&K[O]>Q){let b=Q-z,N=1+Math.floor((K[O]-b-1)/Q);if(Math.floor((K[O]-1)/Q)<N)U.push("");WQ(U,W,Q);continue}if(z+K[O]>Q&&z>0&&K[O]>0){if(Y.wordWrap===!1&&z<Q){WQ(U,W,Q);continue}U.push("")}if(z+K[O]>Q&&Y.wordWrap===!1){WQ(U,W,Q);continue}U[U.length-1]+=W}if(Y.trim!==!1)U=U.map((O)=>ZZ(O));let G=U.join(`
119
119
  `),q=[...G],L=0;for(let[O,W]of q.entries()){if(J+=W,_8.has(W)){let{groups:b}=new RegExp(`(?:\\${q9}(?<code>\\d+)m|\\${z8}(?<uri>.*)${HQ})`).exec(G.slice(L))||{groups:{}};if(b.code!==void 0){let N=Number.parseFloat(b.code);Z=N===QZ?void 0:N}else if(b.uri!==void 0)X=b.uri.length===0?void 0:b.uri}let z=K9.codes.get(Number(Z));if(q[O+1]===`
120
120
  `){if(X)J+=U9("");if(Z&&z)J+=G9(z)}else if(W===`
121
121
  `){if(Z&&z)J+=G9(Z);if(X)J+=U9(X)}L+=W.length}return J};function LQ($,Q,Y){return String($).normalize().replaceAll(`\r
@@ -1,4 +1,4 @@
1
- import"./chunk-v508x7cg.js";import{og as Q}from"./chunk-4cpgcm7q.js";import"./chunk-p7y79y6c.js";import"./chunk-k82ff14t.js";import"./chunk-64jq6jcr.js";import{Eg as L}from"./chunk-ah12xhh6.js";import"./chunk-kka51s0k.js";import"./chunk-tzytnhbp.js";import"./chunk-948efzyp.js";import"./chunk-ne7vres8.js";import"./chunk-xjc0bthz.js";import"./chunk-1ava19kd.js";import"./chunk-mefb27ch.js";import"./chunk-zxn7f308.js";import{Mh as F}from"./chunk-0hrj06t7.js";var K=[22,19,0];function T(G){let A=/^v?(\d+)\.(\d+)\.(\d+)/.exec(G);if(!A)return!1;let H=A.slice(1).map(Number);for(let z=0;z<K.length;z++){let B=H[z]??0,J=K[z];if(B!==J)return B>J}return!0}var X={command:"doctor",describe:"Check the health of your Blade installation",builder:(G)=>G.option("rebuild-index",{type:"boolean",default:!1,describe:"Rebuild the SQLite session index from JSONL transcripts"}),handler:async(G)=>{if(G.rebuildIndex){console.log(`Rebuilding session index from JSONL transcripts...
2
- `);try{let{rebuildProjectionIndex:z}=await import("./chunk-z8a5ebep.js"),{SessionService:B}=await import("./chunk-zh2x0tcm.js"),J=await z(B.projectionDeriverForSearch());if(J===null)console.log("[WARN] Session index unavailable (SQLite driver missing); reads fall back to JSONL scan.");else console.log(`[OK] Session index rebuilt: ${J} session(s) indexed.`)}catch(z){console.log("[FAIL] Session index rebuild failed"),console.log(` Error: ${z instanceof Error?z.message:"未知错误"}`),process.exit(1)}return}console.log(`Running Blade health check...
1
+ import"./chunk-v508x7cg.js";import{pg as Q}from"./chunk-zph2jekm.js";import"./chunk-qp8mejbn.js";import"./chunk-c03xn5s3.js";import"./chunk-yjbq4jeg.js";import{Fg as L}from"./chunk-22aaybx2.js";import"./chunk-qtt17d5s.js";import"./chunk-2qqmmxqf.js";import"./chunk-gbrwzpyg.js";import"./chunk-bj5msq36.js";import"./chunk-c74e0jx1.js";import"./chunk-yz80dp1a.js";import"./chunk-p7ww2tcn.js";import"./chunk-qw5j84ny.js";import{Nh as F}from"./chunk-99nevk7k.js";var K=[22,19,0];function T(G){let A=/^v?(\d+)\.(\d+)\.(\d+)/.exec(G);if(!A)return!1;let H=A.slice(1).map(Number);for(let z=0;z<K.length;z++){let B=H[z]??0,J=K[z];if(B!==J)return B>J}return!0}var X={command:"doctor",describe:"Check the health of your Blade installation",builder:(G)=>G.option("rebuild-index",{type:"boolean",default:!1,describe:"Rebuild the SQLite session index from JSONL transcripts"}),handler:async(G)=>{if(G.rebuildIndex){console.log(`Rebuilding session index from JSONL transcripts...
2
+ `);try{let{rebuildProjectionIndex:z}=await import("./chunk-4mgjj8zg.js"),{SessionService:B}=await import("./chunk-fpkq3ch3.js"),J=await z(B.projectionDeriverForSearch());if(J===null)console.log("[WARN] Session index unavailable (SQLite driver missing); reads fall back to JSONL scan.");else console.log(`[OK] Session index rebuilt: ${J} session(s) indexed.`)}catch(z){console.log("[FAIL] Session index rebuild failed"),console.log(` Error: ${z instanceof Error?z.message:"未知错误"}`),process.exit(1)}return}console.log(`Running Blade health check...
3
3
  `);let A=0;try{await Q.getInstance().initialize(),console.log("[OK] Configuration: OK")}catch(z){console.log("[FAIL] Configuration: FAILED"),console.log(` Error: ${z instanceof Error?z.message:"未知错误"}`),A++}let H=process.version;if(T(H))console.log(`[OK] Node.js version: ${H}`);else console.log(`[WARN] Node.js version: ${H} (required: >=22.19.0)`),A++;try{let z=await import("fs/promises"),B=L();await z.access(B,(await import("fs")).constants.R_OK|(await import("fs")).constants.W_OK),console.log("[OK] File system permissions: OK")}catch(z){console.log("[FAIL] File system permissions: FAILED"),console.log(" Error: Cannot read/write in current directory"),A++}try{await import("ink"),console.log("[OK] Dependencies: OK")}catch(z){console.log("[FAIL] Dependencies: FAILED"),console.log(" Error: Missing required dependencies"),A++}if(console.log(`
4
4
  Health Check Summary:`),A===0)console.log("All checks passed! Blade is ready to use.");else console.log(`Warning: Found ${A} issue(s). Please resolve them for optimal performance.`),process.exit(1)}};export{T as isSupportedNodeVersion,X as doctorCommands};
@@ -1,2 +1,2 @@
1
- import{Zf as H,_f as I}from"./chunk-4cpgcm7q.js";import{Mutex as J}from"async-mutex";class B extends Error{limit;resource="resident_runtimes";retryable=!0;constructor(b){super("Session runtime capacity is full");this.limit=b;this.name="SessionRuntimeCapacityError"}}class D extends Error{constructor(){super("Session runtime residency is closed");this.name="SessionRuntimeResidencyClosedError"}}class A extends Error{constructor(b){super(`Session runtime residency already owns key: ${b}`);this.name="SessionRuntimeResidencyConflictError"}}class K{maxResident;idleMs;now;residents=new Map;reservations=new Map;operations=new J;nextGeneration=1;closed=!1;constructor(b){if(!H(b.maxResident))throw Error("Invalid max resident Session Runtime limit");if(!I(b.idleMs))throw Error("Invalid Session Runtime idle timeout");this.maxResident=b.maxResident,this.idleMs=b.idleMs,this.now=b.now??Date.now}acquire(b){let j=this.residents.get(b);if(!j||j.poisoned)return;return j.pins++,j.lastUsedAt=this.now(),this.createLease(j)}owns(b,j){let q=this.residents.get(b);return Boolean(q&&(j===void 0||q.value===j))}async reserve(b,j){if(!b.trim())throw Error("Session runtime residency key must not be blank");return this.operations.runExclusive(async()=>{if(this.closed)throw new D;if(this.residents.has(b)||this.reservations.has(b))throw new A(b);while(this.retainedCount()>=this.maxResident){if(!j.allowEviction)throw new B(this.maxResident);let z=this.oldestEvictableWebResident();if(!z)throw new B(this.maxResident);await this.disposeResident(z,!0)}let q={generation:this.allocateGeneration(),surface:j.surface};return this.reservations.set(b,q),this.createReservation(b,q)})}async remove(b,j){return this.operations.runExclusive(async()=>{let q=this.residents.get(b);if(!q||j!==void 0&&q.value!==j)return!1;if(q.pins>0)return!1;return await this.disposeResident(q,!0),!0})}async forget(b,j){return this.operations.runExclusive(async()=>{let q=this.residents.get(b);if(!q||j!==void 0&&q.value!==j||q.pins>0)return!1;return this.residents.delete(b),!0})}async sweepIdle(){return this.operations.runExclusive(async()=>{if(this.closed)return 0;let b=0;while(!0){let j=this.oldestIdleWebResident();if(!j)return b;await this.disposeResident(j,!0),b++}})}async disposeAll(){await this.operations.runExclusive(async()=>{this.closed=!0,this.reservations.clear();let b;for(let j of[...this.residents.values()])try{await this.disposeResident(j,!1)}catch(q){b??=q}if(this.residents.clear(),b!==void 0)throw b})}getStats(){let b=0;for(let j of this.residents.values())if(j.pins>0)b++;return{resident:this.residents.size,reserved:this.reservations.size,pinned:b,maxResident:this.maxResident}}retainedCount(){return this.residents.size+this.reservations.size}allocateGeneration(){let b=this.nextGeneration;return this.nextGeneration=this.nextGeneration===Number.MAX_SAFE_INTEGER?1:this.nextGeneration+1,b}createReservation(b,j){let q=!1;return{commit:(z)=>{if(q)throw new A(b);if(z.key!==b||z.surface!==j.surface||this.reservations.get(b)!==j||this.closed)throw this.reservations.delete(b),q=!0,this.closed?new D:new A(b);this.reservations.delete(b);let G={...z,generation:j.generation,pins:1,lastUsedAt:this.now(),poisoned:!1};return this.residents.set(b,G),q=!0,this.createLease(G)},cancel:()=>{if(q)return;if(this.reservations.get(b)===j)this.reservations.delete(b);q=!0}}}createLease(b){let j=!1;return{value:b.value,release:()=>{if(j)return;j=!0;let q=this.residents.get(b.key);if(q!==b||q.generation!==b.generation)return;q.pins=Math.max(0,q.pins-1),q.lastUsedAt=this.now()}}}oldestEvictableWebResident(){return this.sortedWebResidents().find((b)=>this.canEvict(b))}oldestIdleWebResident(){let b=this.now();return this.sortedWebResidents().find((j)=>b-j.lastUsedAt>=this.idleMs&&this.canEvict(j))}sortedWebResidents(){return[...this.residents.values()].filter((b)=>b.surface==="web").sort((b,j)=>b.lastUsedAt-j.lastUsedAt||b.generation-j.generation)}canEvict(b){if(b.pins>0||b.poisoned)return!1;try{return b.canEvict()}catch{return!1}}async disposeResident(b,j){if(this.residents.get(b.key)!==b)return;this.residents.delete(b.key);try{await b.dispose()}catch(q){if(j&&!this.closed&&!this.residents.has(b.key))b.lastUsedAt=this.now(),b.poisoned=!0,this.residents.set(b.key,b);throw q}}}
1
+ import{$f as I,_f as H}from"./chunk-zph2jekm.js";import{Mutex as J}from"async-mutex";class B extends Error{limit;resource="resident_runtimes";retryable=!0;constructor(b){super("Session runtime capacity is full");this.limit=b;this.name="SessionRuntimeCapacityError"}}class D extends Error{constructor(){super("Session runtime residency is closed");this.name="SessionRuntimeResidencyClosedError"}}class A extends Error{constructor(b){super(`Session runtime residency already owns key: ${b}`);this.name="SessionRuntimeResidencyConflictError"}}class K{maxResident;idleMs;now;residents=new Map;reservations=new Map;operations=new J;nextGeneration=1;closed=!1;constructor(b){if(!H(b.maxResident))throw Error("Invalid max resident Session Runtime limit");if(!I(b.idleMs))throw Error("Invalid Session Runtime idle timeout");this.maxResident=b.maxResident,this.idleMs=b.idleMs,this.now=b.now??Date.now}acquire(b){let j=this.residents.get(b);if(!j||j.poisoned)return;return j.pins++,j.lastUsedAt=this.now(),this.createLease(j)}owns(b,j){let q=this.residents.get(b);return Boolean(q&&(j===void 0||q.value===j))}async reserve(b,j){if(!b.trim())throw Error("Session runtime residency key must not be blank");return this.operations.runExclusive(async()=>{if(this.closed)throw new D;if(this.residents.has(b)||this.reservations.has(b))throw new A(b);while(this.retainedCount()>=this.maxResident){if(!j.allowEviction)throw new B(this.maxResident);let z=this.oldestEvictableWebResident();if(!z)throw new B(this.maxResident);await this.disposeResident(z,!0)}let q={generation:this.allocateGeneration(),surface:j.surface};return this.reservations.set(b,q),this.createReservation(b,q)})}async remove(b,j){return this.operations.runExclusive(async()=>{let q=this.residents.get(b);if(!q||j!==void 0&&q.value!==j)return!1;if(q.pins>0)return!1;return await this.disposeResident(q,!0),!0})}async forget(b,j){return this.operations.runExclusive(async()=>{let q=this.residents.get(b);if(!q||j!==void 0&&q.value!==j||q.pins>0)return!1;return this.residents.delete(b),!0})}async sweepIdle(){return this.operations.runExclusive(async()=>{if(this.closed)return 0;let b=0;while(!0){let j=this.oldestIdleWebResident();if(!j)return b;await this.disposeResident(j,!0),b++}})}async disposeAll(){await this.operations.runExclusive(async()=>{this.closed=!0,this.reservations.clear();let b;for(let j of[...this.residents.values()])try{await this.disposeResident(j,!1)}catch(q){b??=q}if(this.residents.clear(),b!==void 0)throw b})}getStats(){let b=0;for(let j of this.residents.values())if(j.pins>0)b++;return{resident:this.residents.size,reserved:this.reservations.size,pinned:b,maxResident:this.maxResident}}retainedCount(){return this.residents.size+this.reservations.size}allocateGeneration(){let b=this.nextGeneration;return this.nextGeneration=this.nextGeneration===Number.MAX_SAFE_INTEGER?1:this.nextGeneration+1,b}createReservation(b,j){let q=!1;return{commit:(z)=>{if(q)throw new A(b);if(z.key!==b||z.surface!==j.surface||this.reservations.get(b)!==j||this.closed)throw this.reservations.delete(b),q=!0,this.closed?new D:new A(b);this.reservations.delete(b);let G={...z,generation:j.generation,pins:1,lastUsedAt:this.now(),poisoned:!1};return this.residents.set(b,G),q=!0,this.createLease(G)},cancel:()=>{if(q)return;if(this.reservations.get(b)===j)this.reservations.delete(b);q=!0}}}createLease(b){let j=!1;return{value:b.value,release:()=>{if(j)return;j=!0;let q=this.residents.get(b.key);if(q!==b||q.generation!==b.generation)return;q.pins=Math.max(0,q.pins-1),q.lastUsedAt=this.now()}}}oldestEvictableWebResident(){return this.sortedWebResidents().find((b)=>this.canEvict(b))}oldestIdleWebResident(){let b=this.now();return this.sortedWebResidents().find((j)=>b-j.lastUsedAt>=this.idleMs&&this.canEvict(j))}sortedWebResidents(){return[...this.residents.values()].filter((b)=>b.surface==="web").sort((b,j)=>b.lastUsedAt-j.lastUsedAt||b.generation-j.generation)}canEvict(b){if(b.pins>0||b.poisoned)return!1;try{return b.canEvict()}catch{return!1}}async disposeResident(b,j){if(this.residents.get(b.key)!==b)return;this.residents.delete(b.key);try{await b.dispose()}catch(q){if(j&&!this.closed&&!this.residents.has(b.key))b.lastUsedAt=this.now(),b.poisoned=!0,this.residents.set(b.key,b);throw q}}}
2
2
  export{B as s,K as t};
@@ -1,2 +1,2 @@
1
1
  import{promises as B}from"node:fs";import q from"node:path";import{LRUCache as H}from"lru-cache";var K=512,Z=new H({max:K});async function L(x){let b=x;while(!0){try{return await B.lstat(q.join(b,".git")),b}catch(V){if(V.code!=="ENOENT")return}let F=q.dirname(b);if(F===b)return;b=F}}async function M(x){let b=q.join(x,".git"),F=await B.lstat(b);if(F.isDirectory())return x;if(!F.isFile())return;let V=await B.readFile(b,"utf8"),J=/^gitdir:\s*(.+)\s*$/im.exec(V);if(!J)return;let Q=await B.realpath(q.isAbsolute(J[1])?J[1]:q.resolve(x,J[1])),Y=Q;try{let z=(await B.readFile(q.join(Q,"commondir"),"utf8")).trim();if(z)Y=await B.realpath(q.resolve(Q,z))}catch(z){if(z.code!=="ENOENT")throw z}return q.basename(Y)===".git"?B.realpath(q.dirname(Y)):void 0}async function N(x){if(!q.isAbsolute(x))throw Error("Workspace path must be absolute");let b=await B.realpath(x),F=Z.get(b);if(F)return F;let V=b;try{let Q=await L(b);if(Q){let Y=await M(Q),z=q.relative(Q,b);if(Y&&(z===""||!z.startsWith(`..${q.sep}`)&&z!==".."&&!q.isAbsolute(z))){let $=q.resolve(Y,z);V=await B.realpath($).catch(()=>$)}}}catch{}let J={projectPath:b,trustRoot:V};return Z.set(b,J),J}async function S(x){if(!q.isAbsolute(x))throw Error("Workspace path must be absolute");let b=await B.realpath(x);Z.delete(b)}
2
- export{N as Ah,S as Bh};
2
+ export{N as Bh,S as Ch};
@@ -1,4 +1,4 @@
1
- import{m as R,n as c,o as g,p as d,q as m,r as l}from"./chunk-a0ns74mh.js";import{Q as M,Y as y}from"./chunk-3hv57n95.js";import"./chunk-9cgsheg0.js";import"./chunk-fdmcef2p.js";import{Eb as A,vb as h}from"./chunk-b28zsp1t.js";import"./chunk-r8wbvxn7.js";import{Hc as w,Vc as U}from"./chunk-2wdxpdz3.js";import"./chunk-skw3b17a.js";import"./chunk-wp0794r2.js";import{rd as C}from"./chunk-a5e4sy4q.js";import{td as I,ud as S,vd as v}from"./chunk-yx82ang3.js";import{wd as O}from"./chunk-vw0gg08s.js";import"./chunk-3r0x2p7z.js";import{Td as P}from"./chunk-bhhdvqe7.js";import"./chunk-v508x7cg.js";import"./chunk-c9e0fbyh.js";import"./chunk-y36rdy4v.js";import"./chunk-vhadycw2.js";import"./chunk-js4vqnds.js";import"./chunk-cvvtrvk6.js";import"./chunk-5d1gbm41.js";import"./chunk-4khtsmrf.js";import"./chunk-yvnm25nb.js";import"./chunk-jkh9s1ht.js";import"./chunk-67ddp3ns.js";import"./chunk-4ehgjdm0.js";import"./chunk-4cpgcm7q.js";import{qg as F}from"./chunk-p7y79y6c.js";import"./chunk-k82ff14t.js";import"./chunk-64jq6jcr.js";import{Eg as z}from"./chunk-ah12xhh6.js";import"./chunk-kka51s0k.js";import"./chunk-tzytnhbp.js";import"./chunk-948efzyp.js";import"./chunk-ne7vres8.js";import"./chunk-xjc0bthz.js";import"./chunk-1ava19kd.js";import"./chunk-mefb27ch.js";import"./chunk-zxn7f308.js";import"./chunk-0hrj06t7.js";import p from"yargs";import{hideBin as e}from"yargs/helpers";var s=new Set(Object.values(F));function t(j){if(j&&s.has(j))return j;return}function x(j){if(j.options.outputFormat==="json")j.io.stdout.write(`${JSON.stringify({response:j.response,...j.structuredOutput?{structured_output:j.structuredOutput,output_schema_digest:j.structuredOutputSchemaDigest}:{},input:j.requestInput,model:j.options.model,timestamp:new Date().toISOString()},null,2)}
1
+ import{m as R,n as c,o as g,p as d,q as m,r as l}from"./chunk-v4ek6q8t.js";import{R as M,Z as y}from"./chunk-kb5xaar0.js";import"./chunk-yk8s8kjt.js";import"./chunk-22s3r2xy.js";import{Fb as A,wb as h}from"./chunk-g3fbgp1k.js";import"./chunk-fbgzeb3m.js";import{Ic as w,Wc as U}from"./chunk-57jj40er.js";import"./chunk-qyxbee3w.js";import"./chunk-r297pq3s.js";import{sd as C}from"./chunk-gz2fx7th.js";import{ud as I,vd as S,wd as v}from"./chunk-d2eahefk.js";import{xd as O}from"./chunk-4ppgfhqd.js";import"./chunk-2m4mgw58.js";import{Ud as P}from"./chunk-xts31qj4.js";import"./chunk-v508x7cg.js";import"./chunk-xkz9ecdx.js";import"./chunk-rjgfy07e.js";import"./chunk-2faga011.js";import"./chunk-xbj18hxh.js";import"./chunk-22sw5bv4.js";import"./chunk-rdtgv0n8.js";import"./chunk-kaf6m50a.js";import"./chunk-0cbpjhq7.js";import"./chunk-rc7jnds2.js";import"./chunk-egp0crrc.js";import"./chunk-03947xkg.js";import"./chunk-zph2jekm.js";import{rg as F}from"./chunk-qp8mejbn.js";import"./chunk-c03xn5s3.js";import"./chunk-yjbq4jeg.js";import{Fg as z}from"./chunk-22aaybx2.js";import"./chunk-qtt17d5s.js";import"./chunk-2qqmmxqf.js";import"./chunk-gbrwzpyg.js";import"./chunk-bj5msq36.js";import"./chunk-c74e0jx1.js";import"./chunk-yz80dp1a.js";import"./chunk-p7ww2tcn.js";import"./chunk-qw5j84ny.js";import"./chunk-99nevk7k.js";import p from"yargs";import{hideBin as e}from"yargs/helpers";var s=new Set(Object.values(F));function t(j){if(j&&s.has(j))return j;return}function x(j){if(j.options.outputFormat==="json")j.io.stdout.write(`${JSON.stringify({response:j.response,...j.structuredOutput?{structured_output:j.structuredOutput,output_schema_digest:j.structuredOutputSchemaDigest}:{},input:j.requestInput,model:j.options.model,timestamp:new Date().toISOString()},null,2)}
2
2
  `);else if(j.options.outputFormat==="stream-json")j.io.stdout.write(`${JSON.stringify(j.structuredOutput?{type:"structured_output",output:j.structuredOutput,schema_digest:j.structuredOutputSchemaDigest}:{type:"response",content:j.response})}
3
3
  `);else j.io.stdout.write(`${j.response}
4
4
  `)}function i(j){return j.command("* [message]","Print response and exit (useful for pipes)",(B)=>B.positional("message",{describe:"Message to process",type:"string"}).option("p",{alias:"print",describe:"Print response and exit (useful for pipes)",type:"boolean"}).option("output-format",{describe:'Output format: "text", "json", "stream-json"',type:"string",default:"text"}).option("include-partial-messages",{describe:"Include partial message chunks as they arrive",type:"boolean"}).option("input-format",{describe:'Input format: "text", "stream-json"',type:"string",default:"text"}).option("json-schema",{alias:["jsonSchema"],describe:"Inline JSON Schema for the structured final response",type:"string"}).option("output-schema",{alias:["outputSchema"],describe:"Path to a JSON Schema file for the structured final response",type:"string"}).option("model",{describe:"Model for the current session",type:"string"}).option("append-system-prompt",{describe:"Append a system prompt to the default system prompt",type:"string"}).option("system-prompt",{describe:"Replace the default system prompt",type:"string"}).option("max-turns",{alias:["maxTurns"],describe:"Maximum conversation turns (-1: unlimited, N>0: limit to N turns)",type:"number"}),async(B)=>{if(!B.p)return;let q=await n(B);process.exit(q)})}async function n(j,B=process){let q;try{await R();let _=j.forkSession!==!0&&(j.continue===!0||typeof j.resume==="string"&&j.resume.length>0)?await g({message:j.message,_:j._}):await c({message:j.message,_:j._,defaultMessage:"Hello"}),J=_===void 0,T=J?{mode:"agent",content:""}:await d(_);if(T.mode==="output"){if(T.content)B.stdout.write(`${T.content}
@@ -1,2 +1,2 @@
1
1
  var F;((D)=>{D.DEFAULT="default";D.AUTO_EDIT="autoEdit";D.YOLO="yolo";D.PLAN="plan"})(F||={});import{Mutex as G}from"async-mutex";class H{entries=new Map;async runExclusive(C,E){let B=this.entries.get(C);if(!B)B={mutex:new G,operations:0},this.entries.set(C,B);B.operations++;try{return await B.mutex.runExclusive(E)}finally{if(B.operations--,B.operations===0&&this.entries.get(C)===B)this.entries.delete(C)}}getStats(){let C=0;for(let E of this.entries.values())C+=E.operations;return{keys:this.entries.size,operations:C}}}
2
- export{F as qg,H as rg};
2
+ export{F as rg,H as sg};
@@ -1,2 +1,2 @@
1
1
  var I=600000,r=30000,t=3600000,o=12,O=15000,P=60000;function R(_){return _===0||typeof _==="number"&&Number.isSafeInteger(_)&&_>=30000&&_<=3600000}var C=1e4,M=1000,p=300000;function E(_){return _===0||typeof _==="number"&&Number.isSafeInteger(_)&&_>=1000&&_<=300000}var T=1,s=16,n=Number.MAX_SAFE_INTEGER,D=180000,m=1000,x=600000,S=134217728,U=65536,V=134217728;function A(_){return typeof _==="number"&&Number.isSafeInteger(_)&&_>=1&&_<=16}function w(_){return typeof _==="number"&&Number.isSafeInteger(_)&&_>=1&&_<=n}function z(_){return _===0||typeof _==="number"&&Number.isSafeInteger(_)&&_>=1000&&_<=600000}function F(_){return typeof _==="number"&&Number.isSafeInteger(_)&&_>=65536&&_<=134217728}
2
- export{I as Fg,r as Gg,t as Hg,o as Ig,O as Jg,P as Kg,R as Lg,C as Mg,M as Ng,p as Og,E as Pg,T as Qg,s as Rg,n as Sg,D as Tg,m as Ug,x as Vg,S as Wg,U as Xg,V as Yg,A as Zg,w as _g,z as $g,F as ah};
2
+ export{I as Gg,r as Hg,t as Ig,o as Jg,O as Kg,P as Lg,R as Mg,C as Ng,M as Og,p as Pg,E as Qg,T as Rg,s as Sg,n as Tg,D as Ug,m as Vg,x as Wg,S as Xg,U as Yg,V as Zg,A as _g,w as $g,z as ah,F as bh};
@@ -1,2 +1,2 @@
1
- import{Mh as F}from"./chunk-0hrj06t7.js";import{execSync as G}from"node:child_process";import*as C from"node:os";import*as v from"node:path";function H(k){return v.resolve(k).replace(/[/\\]/g,"-").replace(/:/g,"_")}function M(k){let q=k.replace(/_/g,":");if(q.startsWith("-"))q="/"+q.slice(1);return q.replace(/-/g,"/")}function z(k){let q=H(k);return v.join(E(),"projects",q)}function J(k){return typeof k==="string"&&k!=="."&&k!==".."&&/^[A-Za-z0-9_-][A-Za-z0-9._-]{0,199}$/.test(k)}function A(k){if(!J(k))throw Error(`Invalid session ID: ${k}`)}function N(k,q){return A(q),v.join(z(k),`${q}.jsonl`)}function O(k,q){return A(q),v.join(z(k),`${q}.inbox.json`)}function Q(k,q){return A(q),v.join(z(k),`${q}.goal.json`)}function T(k){try{return G("git rev-parse --abbrev-ref HEAD",{cwd:k,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{return}}function E(){return process.env.BLADE_STORAGE_ROOT||v.join(C.homedir(),".blade")}async function U(){let{readdir:k}=await import("node:fs/promises");try{let q=v.join(E(),"projects");return(await k(q,{withFileTypes:!0})).filter((w)=>w.isDirectory()).map((w)=>w.name)}catch{return[]}}
2
- export{M as Ch,z as Dh,J as Eh,A as Fh,N as Gh,O as Hh,Q as Ih,T as Jh,E as Kh,U as Lh};
1
+ import{Nh as F}from"./chunk-99nevk7k.js";import{execSync as G}from"node:child_process";import*as C from"node:os";import*as v from"node:path";function H(k){return v.resolve(k).replace(/[/\\]/g,"-").replace(/:/g,"_")}function M(k){let q=k.replace(/_/g,":");if(q.startsWith("-"))q="/"+q.slice(1);return q.replace(/-/g,"/")}function z(k){let q=H(k);return v.join(E(),"projects",q)}function J(k){return typeof k==="string"&&k!=="."&&k!==".."&&/^[A-Za-z0-9_-][A-Za-z0-9._-]{0,199}$/.test(k)}function A(k){if(!J(k))throw Error(`Invalid session ID: ${k}`)}function N(k,q){return A(q),v.join(z(k),`${q}.jsonl`)}function O(k,q){return A(q),v.join(z(k),`${q}.inbox.json`)}function Q(k,q){return A(q),v.join(z(k),`${q}.goal.json`)}function T(k){try{return G("git rev-parse --abbrev-ref HEAD",{cwd:k,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{return}}function E(){return process.env.BLADE_STORAGE_ROOT||v.join(C.homedir(),".blade")}async function U(){let{readdir:k}=await import("node:fs/promises");try{let q=v.join(E(),"projects");return(await k(q,{withFileTypes:!0})).filter((w)=>w.isDirectory()).map((w)=>w.name)}catch{return[]}}
2
+ export{M as Dh,z as Eh,J as Fh,A as Gh,N as Hh,O as Ih,Q as Jh,T as Kh,E as Lh,U as Mh};
@@ -0,0 +1 @@
1
+ import{Ah as c,yh as a,zh as b}from"./chunk-yz80dp1a.js";import"./chunk-p7ww2tcn.js";import"./chunk-qw5j84ny.js";import"./chunk-99nevk7k.js";export{b as isWorkspaceTrusted,c as WorkspaceTrustService,a as MAX_RESIDENT_WORKSPACE_TRUST_STATUSES};
@@ -1,2 +1,2 @@
1
1
  var f;((c)=>{c.ReadOnly="readonly";c.Write="write";c.Execute="execute"})(f||={});function g(b){return b!==void 0&&typeof b.pattern==="string"&&typeof b.search_path==="string"}function h(b){return b!==void 0&&b.kind==="edit"&&typeof b.matches_found==="number"}function j(b){return b==="readonly"}
2
- export{f as Wc,g as Xc,h as Yc,j as Zc};
2
+ export{f as Xc,g as Yc,h as Zc,j as _c};
@@ -1,4 +1,4 @@
1
- import{eh as r}from"./chunk-tzytnhbp.js";import{Ch as d,Eh as x,Gh as j,Kh as u,Lh as i}from"./chunk-zxn7f308.js";import{Mh as y}from"./chunk-0hrj06t7.js";import{stat as a}from"node:fs/promises";import k from"node:path";import*as U from"node:path";var e=50,__=100,E_=new Set(["queued","running","completed","failed","cancelled","interrupted"]),R_=new Set(["high","medium","low"]),W_=/^[A-Za-z0-9_-]+$/,$_=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function H_(_){return typeof _==="string"&&$_.test(_)&&Number.isFinite(Date.parse(_))}function v(_){return typeof _==="string"&&U.isAbsolute(_)}function M_(_){return Buffer.from(JSON.stringify(_),"utf8").toString("base64url")}function Q_(_){try{if(!W_.test(_))throw Error("invalid");let E=Buffer.from(_,"base64url").toString("utf8");if(Buffer.from(E,"utf8").toString("base64url")!==_)throw Error("invalid");let R=JSON.parse(E);if(R.version!==1||typeof R.includeSubagents!=="boolean"||R.archived!==void 0&&typeof R.archived!=="boolean"||!(R.cwd===null||v(R.cwd))||!H_(R.lastMessageTime)||!v(R.projectPath)||!x(R.sessionId))throw Error("invalid");return{version:1,cwd:R.cwd===null?null:U.resolve(R.cwd),includeSubagents:R.includeSubagents,archived:R.archived??!1,lastMessageTime:R.lastMessageTime,projectPath:U.resolve(R.projectPath),sessionId:R.sessionId}}catch{throw Error("Invalid session cursor")}}function J(_){let E="";for(let R=0;R<_.length;R+=1)E+=_.charCodeAt(R).toString(16).padStart(4,"0");return E}function V_(_){if(!_.cursor)return;let E=Q_(_.cursor);if(E.cwd!==_.cwd||E.includeSubagents!==_.includeSubagents||(E.archived??!1)!==_.archived)throw Error("Session cursor scope does not match this query");return E}function O_(_={}){let{cwd:E,cursor:R,limit:W,includeSubagents:$=!1,archived:H=!1}=_;if(E!==void 0&&!U.isAbsolute(E))throw Error("Session catalog cwd must be absolute");let M=W===void 0?e:W;if(!Number.isInteger(M)||M<1||M>__)throw Error("Session catalog limit must be an integer from 1 to 100");return{cwd:E===void 0?null:U.resolve(E),cursor:R??void 0,limit:M,includeSubagents:$,archived:H}}function N_(_={}){let E=c(_.taskStatus,E_,"task status"),R=c(_.taskPriority,R_,"task priority"),W=S(_.taskDueAfter,"taskDueAfter"),$=S(_.taskDueBefore,"taskDueBefore");return X_(W,$),{...E?{taskStatuses:E}:{},...R?{taskPriorities:R}:{},...W?{taskDueAfter:W}:{},...$?{taskDueBefore:$}:{}}}function c(_,E,R){if(_===void 0)return;let W=Array.isArray(_)?_:[_];if(W.length===0)return;let $=new Set;for(let H of W){if(typeof H!=="string"||!E.has(H))throw Error(`Invalid session ${R} filter`);$.add(H)}return[...$].sort()}function S(_,E){if(_===void 0)return;if(typeof _!=="string"||!Number.isFinite(Date.parse(_)))throw Error(`Invalid session ${E} filter`);return new Date(_).toISOString()}function X_(_,E){if(_!==void 0&&E!==void 0&&_>E)throw Error("Session task due range is inverted")}function Y_(_,E){if(_.lastMessageTime>E.lastMessageTime)return-1;if(_.lastMessageTime<E.lastMessageTime)return 1;if(_.projectPath<E.projectPath)return-1;if(_.projectPath>E.projectPath)return 1;if(_.sessionId<E.sessionId)return-1;if(_.sessionId>E.sessionId)return 1;return 0}function f_(_,E){let R=[..._],W=V_(E);if(W)R=R.filter((M)=>Y_(M,{sessionId:W.sessionId,projectPath:W.projectPath,lastMessageTime:W.lastMessageTime})>0);let $=R.slice(0,E.limit);if($.length===0||R.length<=$.length)return{sessions:$};let H=$[$.length-1];return{sessions:$,nextCursor:M_({version:1,cwd:E.cwd,includeSubagents:E.includeSubagents,archived:E.archived,lastMessageTime:H.lastMessageTime,projectPath:H.projectPath,sessionId:H.sessionId})}}function G_(_){return _.type==="message_created"||_.type==="token_budget_handoff_recorded"||_.type==="part_created"||_.type==="part_updated"||_.type==="turn_started"||_.type==="turn_completed"||_.type==="turn_aborted"||_.type==="interaction_requested"||_.type==="interaction_responded"||_.type==="interaction_recovered"||_.type==="review_started"||_.type==="review_completed"}function O(_){return _.type==="message_created"&&_.data.role==="user"&&(_.data.inboxMessageId!==void 0||_.data.parentMessageId===void 0)}function N(_,E){let R=_.find((W)=>O(W)&&W.data.messageId===E);if(!R)throw Error(`Rewind checkpoint not found: ${E}`);return{messageId:E,preview:m(_,E),createdAt:R.data.createdAt}}function m(_,E){let R=_.flatMap((W)=>{if(W.type!=="part_created"||W.data.messageId!==E)return[];if(W.data.partType==="text"){let $=W.data.payload;return typeof $.text==="string"?[$.text]:[]}if(W.data.partType==="image")return["[Image]"];return[]}).join("").trim();if(R.length<=160)return R;return`${R.slice(0,160)}...`}function h(_,E){N(_,E);let R=_.findIndex((M)=>M.type==="message_created"&&M.data.messageId===E),W=_[R],$=W?.type==="message_created"?W.data.inboxMessageId:void 0,H=new Set(_.flatMap((M)=>M.type==="turn_started"&&$&&M.data.inputMessageIds?.includes($)?[M.data.turnId]:[]));return _.filter((M,Q)=>{if((M.type==="turn_started"||M.type==="turn_completed"||M.type==="turn_aborted")&&H.has(M.data.turnId))return!1;return Q<R||!G_(M)})}function D(_){let E=[];for(let R of _){if(R.type!=="session_rewound"){E.push(R);continue}if(N(E,R.data.targetMessageId),R.data.mode!=="code")E=h(E,R.data.targetMessageId)}return E}function j_(_){let E=D(_);return E.filter(O).map((R)=>({messageId:R.data.messageId,preview:m(E,R.data.messageId),createdAt:R.data.createdAt})).reverse()}function u_(_,E){let R=D(_),W=N(R,E),$=R.findIndex((M)=>M.type==="message_created"&&M.data.messageId===E),H=R.slice($);return{checkpoint:W,projectedEntries:h(R,E),removedTurns:H.filter(O).length,snapshotMessageIds:H.flatMap((M)=>M.type==="part_created"&&M.data.partType==="tool_call"?[M.data.partId]:[])}}import*as I from"node:fs";import{createReadStream as T_}from"node:fs";import*as X from"node:fs/promises";import*as f from"node:path";import{createInterface as Z_}from"node:readline";var b=65536;function w(_){let E=_.data;if(E===null||typeof E!=="object"||Array.isArray(E))throw Error("Session event data must be a JSON object");return JSON.stringify(_)}function g_(_,E,R){let W=_.trim();if(!W)return;try{return JSON.parse(W)}catch($){throw Error(`Invalid session JSONL in ${R} at line ${E}`,{cause:$})}}function z(_,E="session transcript"){let R=_.split(`
1
+ import{fh as r}from"./chunk-2qqmmxqf.js";import{Dh as d,Fh as x,Hh as j,Lh as u,Mh as i}from"./chunk-qw5j84ny.js";import{Nh as y}from"./chunk-99nevk7k.js";import{stat as a}from"node:fs/promises";import k from"node:path";import*as U from"node:path";var e=50,__=100,E_=new Set(["queued","running","completed","failed","cancelled","interrupted"]),R_=new Set(["high","medium","low"]),W_=/^[A-Za-z0-9_-]+$/,$_=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function H_(_){return typeof _==="string"&&$_.test(_)&&Number.isFinite(Date.parse(_))}function v(_){return typeof _==="string"&&U.isAbsolute(_)}function M_(_){return Buffer.from(JSON.stringify(_),"utf8").toString("base64url")}function Q_(_){try{if(!W_.test(_))throw Error("invalid");let E=Buffer.from(_,"base64url").toString("utf8");if(Buffer.from(E,"utf8").toString("base64url")!==_)throw Error("invalid");let R=JSON.parse(E);if(R.version!==1||typeof R.includeSubagents!=="boolean"||R.archived!==void 0&&typeof R.archived!=="boolean"||!(R.cwd===null||v(R.cwd))||!H_(R.lastMessageTime)||!v(R.projectPath)||!x(R.sessionId))throw Error("invalid");return{version:1,cwd:R.cwd===null?null:U.resolve(R.cwd),includeSubagents:R.includeSubagents,archived:R.archived??!1,lastMessageTime:R.lastMessageTime,projectPath:U.resolve(R.projectPath),sessionId:R.sessionId}}catch{throw Error("Invalid session cursor")}}function J(_){let E="";for(let R=0;R<_.length;R+=1)E+=_.charCodeAt(R).toString(16).padStart(4,"0");return E}function V_(_){if(!_.cursor)return;let E=Q_(_.cursor);if(E.cwd!==_.cwd||E.includeSubagents!==_.includeSubagents||(E.archived??!1)!==_.archived)throw Error("Session cursor scope does not match this query");return E}function O_(_={}){let{cwd:E,cursor:R,limit:W,includeSubagents:$=!1,archived:H=!1}=_;if(E!==void 0&&!U.isAbsolute(E))throw Error("Session catalog cwd must be absolute");let M=W===void 0?e:W;if(!Number.isInteger(M)||M<1||M>__)throw Error("Session catalog limit must be an integer from 1 to 100");return{cwd:E===void 0?null:U.resolve(E),cursor:R??void 0,limit:M,includeSubagents:$,archived:H}}function N_(_={}){let E=c(_.taskStatus,E_,"task status"),R=c(_.taskPriority,R_,"task priority"),W=S(_.taskDueAfter,"taskDueAfter"),$=S(_.taskDueBefore,"taskDueBefore");return X_(W,$),{...E?{taskStatuses:E}:{},...R?{taskPriorities:R}:{},...W?{taskDueAfter:W}:{},...$?{taskDueBefore:$}:{}}}function c(_,E,R){if(_===void 0)return;let W=Array.isArray(_)?_:[_];if(W.length===0)return;let $=new Set;for(let H of W){if(typeof H!=="string"||!E.has(H))throw Error(`Invalid session ${R} filter`);$.add(H)}return[...$].sort()}function S(_,E){if(_===void 0)return;if(typeof _!=="string"||!Number.isFinite(Date.parse(_)))throw Error(`Invalid session ${E} filter`);return new Date(_).toISOString()}function X_(_,E){if(_!==void 0&&E!==void 0&&_>E)throw Error("Session task due range is inverted")}function Y_(_,E){if(_.lastMessageTime>E.lastMessageTime)return-1;if(_.lastMessageTime<E.lastMessageTime)return 1;if(_.projectPath<E.projectPath)return-1;if(_.projectPath>E.projectPath)return 1;if(_.sessionId<E.sessionId)return-1;if(_.sessionId>E.sessionId)return 1;return 0}function f_(_,E){let R=[..._],W=V_(E);if(W)R=R.filter((M)=>Y_(M,{sessionId:W.sessionId,projectPath:W.projectPath,lastMessageTime:W.lastMessageTime})>0);let $=R.slice(0,E.limit);if($.length===0||R.length<=$.length)return{sessions:$};let H=$[$.length-1];return{sessions:$,nextCursor:M_({version:1,cwd:E.cwd,includeSubagents:E.includeSubagents,archived:E.archived,lastMessageTime:H.lastMessageTime,projectPath:H.projectPath,sessionId:H.sessionId})}}function G_(_){return _.type==="message_created"||_.type==="token_budget_handoff_recorded"||_.type==="part_created"||_.type==="part_updated"||_.type==="turn_started"||_.type==="turn_completed"||_.type==="turn_aborted"||_.type==="interaction_requested"||_.type==="interaction_responded"||_.type==="interaction_recovered"||_.type==="review_started"||_.type==="review_completed"}function O(_){return _.type==="message_created"&&_.data.role==="user"&&(_.data.inboxMessageId!==void 0||_.data.parentMessageId===void 0)}function N(_,E){let R=_.find((W)=>O(W)&&W.data.messageId===E);if(!R)throw Error(`Rewind checkpoint not found: ${E}`);return{messageId:E,preview:m(_,E),createdAt:R.data.createdAt}}function m(_,E){let R=_.flatMap((W)=>{if(W.type!=="part_created"||W.data.messageId!==E)return[];if(W.data.partType==="text"){let $=W.data.payload;return typeof $.text==="string"?[$.text]:[]}if(W.data.partType==="image")return["[Image]"];return[]}).join("").trim();if(R.length<=160)return R;return`${R.slice(0,160)}...`}function h(_,E){N(_,E);let R=_.findIndex((M)=>M.type==="message_created"&&M.data.messageId===E),W=_[R],$=W?.type==="message_created"?W.data.inboxMessageId:void 0,H=new Set(_.flatMap((M)=>M.type==="turn_started"&&$&&M.data.inputMessageIds?.includes($)?[M.data.turnId]:[]));return _.filter((M,Q)=>{if((M.type==="turn_started"||M.type==="turn_completed"||M.type==="turn_aborted")&&H.has(M.data.turnId))return!1;return Q<R||!G_(M)})}function D(_){let E=[];for(let R of _){if(R.type!=="session_rewound"){E.push(R);continue}if(N(E,R.data.targetMessageId),R.data.mode!=="code")E=h(E,R.data.targetMessageId)}return E}function j_(_){let E=D(_);return E.filter(O).map((R)=>({messageId:R.data.messageId,preview:m(E,R.data.messageId),createdAt:R.data.createdAt})).reverse()}function u_(_,E){let R=D(_),W=N(R,E),$=R.findIndex((M)=>M.type==="message_created"&&M.data.messageId===E),H=R.slice($);return{checkpoint:W,projectedEntries:h(R,E),removedTurns:H.filter(O).length,snapshotMessageIds:H.flatMap((M)=>M.type==="part_created"&&M.data.partType==="tool_call"?[M.data.partId]:[])}}import*as I from"node:fs";import{createReadStream as T_}from"node:fs";import*as X from"node:fs/promises";import*as f from"node:path";import{createInterface as Z_}from"node:readline";var b=65536;function w(_){let E=_.data;if(E===null||typeof E!=="object"||Array.isArray(E))throw Error("Session event data must be a JSON object");return JSON.stringify(_)}function g_(_,E,R){let W=_.trim();if(!W)return;try{return JSON.parse(W)}catch($){throw Error(`Invalid session JSONL in ${R} at line ${E}`,{cause:$})}}function z(_,E="session transcript"){let R=_.split(`
2
2
  `),W=!_.endsWith(`
3
3
  `),$=[];for(let[H,M]of R.entries())try{let Q=g_(M,H+1,E);if(Q){if(typeof Q.seq!=="number")Q.seq=$.length+1;$.push(Q)}}catch(Q){if(W&&H===R.length-1)break;throw Q}return $}class G{static appendQueues=new Map;filePath;constructor(_){this.filePath=_}static maxSeq(_){let E=0;for(let R of _)if(typeof R.seq==="number"&&R.seq>E)E=R.seq;return E}static stampSeqFrom(_,E){let R=E;return _.map((W)=>{if(typeof W.seq==="number"){if(W.seq>R)R=W.seq;return W}return R+=1,{...W,seq:R}})}static stampSeq(_,E){return G.stampSeqFrom(_,G.maxSeq(E))}async append(_){try{let[E]=await this.appendEntries([_]);return E}catch(E){throw console.error(`[JSONLStore] 追加写入失败: ${this.filePath}`,E),E}}async appendBatch(_){try{return await this.appendEntries(_)}catch(E){throw console.error(`[JSONLStore] 批量追加写入失败: ${this.filePath}`,E),E}}async appendEntries(_){if(_.length===0)return[];return this.enqueue(async()=>{await X.mkdir(f.dirname(this.filePath),{recursive:!0,mode:493});let E=await X.open(this.filePath,"a+",384);try{let R=await this.repairIncompleteTail(E),W=await this.readTailSeq(E),$=G.stampSeqFrom(_,W),H=`${$.map(w).join(`
4
4
  `)}
@@ -137,4 +137,4 @@ CREATE VIRTUAL TABLE IF NOT EXISTS parts_fts USING fts5(
137
137
  ORDER BY timestamp DESC LIMIT ?`:`SELECT session_id, role, timestamp, text FROM parts_fts
138
138
  WHERE parts_fts MATCH ?
139
139
  ORDER BY timestamp DESC LIMIT ?`,Q=_.prepare(M);return R?Q.all(H,R,W):Q.all(H,W)}
140
- export{D as _c,j_ as $c,u_ as ad,z as bd,G as cd,J as dd,V_ as ed,O_ as fd,N_ as gd,Y_ as hd,f_ as id,s as jd,k_ as kd,A_ as ld,z_ as md,I_ as nd,t_ as od,e_ as pd,_E as qd};
140
+ export{D as $c,j_ as ad,u_ as bd,z as cd,G as dd,J as ed,V_ as fd,O_ as gd,N_ as hd,Y_ as id,f_ as jd,s as kd,k_ as ld,A_ as md,z_ as nd,I_ as od,t_ as pd,e_ as qd,_E as rd};
@@ -1,2 +1,2 @@
1
1
  function v(b){switch(b){case"default":case"ignore":case void 0:return"default";case"acceptEdits":return"autoEdit";case"dontAsk":case"bypassPermissions":return"yolo";case"plan":return"plan";default:return"default"}}
2
- export{v as ef};
2
+ export{v as ff};
@@ -1,4 +1,4 @@
1
- import{We as j1,Xe as L0,Ye as F1}from"./chunk-4khtsmrf.js";import{af as WO,bf as IO}from"./chunk-yvnm25nb.js";import{ef as B1}from"./chunk-jkh9s1ht.js";import{ff as b0,hf as J0}from"./chunk-67ddp3ns.js";import{jg as z0,kg as $O,og as I0}from"./chunk-4cpgcm7q.js";import{sg as u,ug as L,xg as P1}from"./chunk-k82ff14t.js";import{Eg as M}from"./chunk-ah12xhh6.js";import{eh as k,fh as z}from"./chunk-tzytnhbp.js";import{sh as g0}from"./chunk-xjc0bthz.js";import{zh as N}from"./chunk-1ava19kd.js";import Y1 from"node:path";import QO from"node:path";import R0 from"node:fs";import X0 from"node:os";import R from"node:path";import EO from"yaml";var Q4={type:"object",properties:{verdict:{type:"string",enum:["pass","fail","partial"]},summary:{type:"string",minLength:1,maxLength:2000},findings:{type:"array",maxItems:50,items:{type:"string",minLength:1,maxLength:1000}}},required:["verdict","summary","findings"],additionalProperties:!1};function Z4(O){if(!O||typeof O!=="object"||Array.isArray(O))return;let $=O.verdict;return $==="pass"||$==="fail"||$==="partial"?$:void 0}var NO=`# Goal Completion Verifier
1
+ import{Xe as j1,Ye as L0,Ze as F1}from"./chunk-kaf6m50a.js";import{bf as WO,cf as IO}from"./chunk-0cbpjhq7.js";import{ff as B1}from"./chunk-rc7jnds2.js";import{gf as b0,if as J0}from"./chunk-egp0crrc.js";import{kg as z0,lg as $O,pg as I0}from"./chunk-zph2jekm.js";import{tg as u,vg as L,yg as P1}from"./chunk-c03xn5s3.js";import{Fg as M}from"./chunk-22aaybx2.js";import{fh as k,gh as z}from"./chunk-2qqmmxqf.js";import{th as g0}from"./chunk-c74e0jx1.js";import{Ah as N}from"./chunk-yz80dp1a.js";import Y1 from"node:path";import QO from"node:path";import R0 from"node:fs";import X0 from"node:os";import R from"node:path";import EO from"yaml";var Q4={type:"object",properties:{verdict:{type:"string",enum:["pass","fail","partial"]},summary:{type:"string",minLength:1,maxLength:2000},findings:{type:"array",maxItems:50,items:{type:"string",minLength:1,maxLength:1000}}},required:["verdict","summary","findings"],additionalProperties:!1};function Z4(O){if(!O||typeof O!=="object"||Array.isArray(O))return;let $=O.verdict;return $==="pass"||$==="fail"||$==="partial"?$:void 0}var NO=`# Goal Completion Verifier
2
2
 
3
3
  You are a fresh, independent, adversarial verifier. The parent Agent has claimed
4
4
  that a persisted goal is complete. Your job is to refute that claim unless the
@@ -716,4 +716,4 @@ ${Z.join(`
716
716
  </${Q}>`:"";return{content:q,files:[...O],references:O.map(n$),triggerPaths:[...$],contentBytes:Buffer.byteLength(q,"utf8"),provenanceSha256:w0(O.map((K)=>`${K.id}:${K.contentSha256}`).join(`
717
717
  `))}}function BO(O,$){let Q=$,Z=[];for(let J=O.length-1;J>=0;J-=1){let q=O[J];if(!q)continue;let K=Buffer.byteLength(q.content,"utf8");if(K>Q)continue;Z.push(q),Q-=K}return Z.reverse()}class d{projectRoot;catalogSha256;definitions;byId;constructor(O,$=[]){this.projectRoot=O;this.projectRoot=K1(O),this.definitions=Object.freeze([...$].sort(G1).map((Q)=>Object.freeze({...Q}))),this.byId=new Map(this.definitions.map((Q)=>[Q.id,Q])),this.catalogSha256=w0(this.definitions.map((Q)=>`${Q.id}:${Q.contentSha256}`).join(`
718
718
  `))}static empty(O){return new d(O)}list(){return this.definitions.map((O)=>({id:O.id,relativePath:O.relativePath,source:O.source,kind:O.kind,conditional:O.conditional,contentSha256:O.contentSha256}))}snapshot(){return new d(this.projectRoot,this.definitions.map((O)=>({...O,patterns:O.patterns?[...O.patterns]:void 0})))}staticRules(O,$=k$){if(this.definitions.length===0)return K0([],[],"project-instructions");let Q=this.relativeSourcePath(O),Z=this.definitions.filter((J)=>!J.conditional&&q1(J.scopeDirectory,Q));return K0(BO(Z,$),[],"project-instructions")}contextualRules(O,$,Q,Z=P$){if(this.definitions.length===0)return K0([],[],"contextual-project-instructions");let J=this.relativeSourcePath(O),q=[...new Set($.map((G)=>L1(S.relative(this.projectRoot,K1(G)))).filter(X1))].sort(),K=new Map;for(let G of q)for(let W of this.definitions){if(Q.has(W.id))continue;if(!q1(W.scopeDirectory,G))continue;if(W.conditional){let Y=S.posix.relative(W.scopeDirectory||".",G);if(!W.patterns?.some((V)=>zO(V,{dot:!0})(Y)))continue}else if(q1(W.scopeDirectory,J))continue;K.set(W.id,W)}let X=BO([...K.values()].sort(G1),Z);return K0(X,q,"contextual-project-instructions")}hydrate(O){let $=O.map((Q)=>{let Z=this.byId.get(Q.id);if(!Z||Z.contentSha256!==Q.contentSha256||Z.relativePath!==Q.relativePath||Z.source!==Q.source)throw Error(`Project rule provenance mismatch: ${Q.relativePath}`);return Z});return K0([...new Map($.map((Q)=>[Q.id,Q])).values()].sort(G1),[],"contextual-project-instructions")}relativeSourcePath(O){let $=L1(S.relative(this.projectRoot,K1(O)));if($&&!X1($))throw Error("Project instruction source is outside the catalog root");return $}}async function i$(O,$){let Q=await m.lstat($);if(!Q.isFile()||Q.isSymbolicLink())throw Error("Project rule must be a regular file");if(Q.size>FO)throw Error(`Project rule exceeds ${FO} bytes`);let Z=await m.realpath($),J=L1(S.relative(O,Z));if(!X1(J))throw Error("Project rule escapes its repository root");let q=await m.readFile(Z,"utf8");if(SO(q))throw Error("Project rule contains hidden control characters");let K=h$(q),X=K.content.trim();if(!X)throw Error("Project rule content must not be empty");let G=l$(K.data.paths),W=s$(J),Y=w0(JSON.stringify({relativePath:J,patterns:G??[],content:X}));return{id:`${W.source}:${w0(J).slice(0,20)}`,relativePath:J,source:W.source,kind:W.kind,scopeDirectory:W.scopeDirectory,priority:W.priority,conditional:Boolean(G),...G?{patterns:G}:{},content:X,contentSha256:Y}}async function MO(O,$){let Q=c$(O);if(!$.projectTrusted)return d.empty(Q);let Z=await m.realpath(Q),J=f$.stream([...g$],{cwd:Z,absolute:!0,dot:!0,deep:d$,onlyFiles:!0,followSymbolicLinks:!1,unique:!0,ignore:[...u$]}),q=[];for await(let W of J)if(q.push(W.toString()),q.length>HO)throw Error(`Project rule catalog exceeds ${HO} files`);q.sort();let K=new Set(q.filter((W)=>S.basename(W)==="AGENTS.override.md").map((W)=>S.dirname(W))),X=[],G=0;for(let W of q){if(S.basename(W)==="AGENTS.md"&&K.has(S.dirname(W)))continue;try{let Y=await i$(Z,W);if(G+=Buffer.byteLength(Y.content,"utf8"),G>VO)throw Error(`Project rule catalog exceeds ${VO} bytes`);X.push(Y)}catch(Y){p$.warn(`[ProjectRules] Ignoring rule: ${Y instanceof Error?Y.message:String(Y)}`)}}return new d(Z,X)}var bO=32,D0=64;class AO extends Error{capacity=D0;constructor(){super(`Workspace agent resource capacity is full (${D0})`);this.name="WorkspaceAgentResourceCapacityError"}}var x=new Map,W1=0,xO=[];async function o$(O){let $=await N.getInstance().getStatus(O.workspaceRoot);O.communicationStyles=await J1(O.workspaceRoot,{projectTrusted:$.state==="trusted",plugins:O.plugins.getActive()})}function a$(O){let $={...O};for(let Q of Object.values(b0))$[Q]=(O[Q]??[]).map((Z)=>({...Z,matcher:Z.matcher?{...Z.matcher}:void 0,hooks:Z.hooks.map((J)=>({...J}))}));return $}function o2(O){xO=[...new Set(O.map(($)=>Y1.resolve($)))]}function _O(O,$){JO(O,$.plugins),C.releaseInstance(O,$.subagents),P.releaseInstance({cwd:O},$.skills),_.releaseInstance(O,$.commands),D.releaseInstance(O,$.plugins)}function TO(O){_O(O.workspaceRoot,O)}function q0(){while(x.size>bO){let O=!1;for(let[$,Q]of x){if(!Q.resources||Q.users>0)continue;if(x.get($)!==Q)continue;x.delete($),TO(Q.resources),O=!0;break}if(!O)return}}function t$(O){setImmediate(()=>{O.users=Math.max(0,O.users-1),q0()}).unref?.()}async function r$(O,$){let Q=await N.getInstance().getStatus(O),Z=o(O),J=g({cwd:O}),q=_.getInstance(O),K=Q0(O);try{if(Z.getAllNames().length===0)Z.loadFromStandardLocations(Q.state==="trusted");await Promise.all([J.initialize(),q.isInitialized()?void 0:q.initialize(O),K.isInitialized()?void 0:K.initialize(O,[...$.cliPluginDirs??xO])]),A0(O),await Q1(O);let X=await J1(O,{projectTrusted:Q.state==="trusted",plugins:K.getActive()}),G=await MO(O,{projectTrusted:Q.state==="trusted"});return{workspaceRoot:O,subagents:Z,skills:J,commands:q,plugins:K,communicationStyles:X,projectRules:G}}catch(X){throw _O(O,{subagents:Z,skills:J,commands:q,plugins:K}),X}}function e$(O,$){let Q={generation:W1,users:0};return Q.promise=r$(O,$).then((Z)=>{if(Q.generation!==W1||x.get(O)!==Q)return TO(Z),Z;return Q.resources=Z,q0(),Z},(Z)=>{if(x.get(O)===Q)x.delete(O);throw Z}),x.set(O,Q),Q}async function wO(O,$){let Q=Y1.resolve(O),Z=x.get(Q);if(!Z){if(q0(),x.size>=D0)throw new AO;Z=e$(Q,$)}else x.delete(Q),x.set(Q,Z);Z.users++;let J;try{J=await Z.promise}catch(q){throw Z.users=Math.max(0,Z.users-1),q0(),q}return{entry:Z,resources:J}}async function DO(O,$){if(!$)return;A0(O.workspaceRoot),await Q1(O.workspaceRoot),await o$(O)}async function a2(O,$={}){let Q=await wO(O,$);try{return await DO(Q.resources,$.reconcilePlugins),Q.resources}finally{t$(Q.entry)}}async function t2(O,$,Q={}){let Z=await wO(O,Q);try{return await DO(Z.resources,Q.reconcilePlugins),await $(Z.resources)}finally{Z.entry.users=Math.max(0,Z.entry.users-1),q0()}}function r2(){let O=0,$=0;for(let Q of x.values()){if(Q.resources)O++;$+=Q.users}return{capacity:bO,activeCapacity:D0,entries:x.size,initialized:O,inFlight:x.size-O,activeUsers:$}}function e2(O){let $="projectRoot"in O?O.projectRoot:O.workspaceRoot;return{projectRoot:Y1.resolve($),subagents:O.subagents.snapshot(),skills:O.skills.snapshot(),commands:O.commands.snapshot(),communicationStyles:O.communicationStyles?.snapshot()??IO.snapshot(),projectRules:O.projectRules?.snapshot()??d.empty($),hooks:a$("hooks"in O&&O.hooks?O.hooks:J0.getInstance().getConfig($))}}function O5(){W1++;for(let[O,$]of x)if($.resources)A0(O);x.clear(),C.resetInstances(),P.resetInstance(),_.resetInstance(),D.resetInstance()}
719
- export{Q4 as ve,Z4 as we,V1 as xe,L4 as ye,X4 as ze,o as Ae,_4 as Be,I1 as Ce,g as De,_ as Ee,t0 as Fe,M0 as Ge,D as He,Q0 as Ie,Q1 as Je,A0 as Ke,d as Le,bO as Me,D0 as Ne,AO as Oe,o$ as Pe,o2 as Qe,a2 as Re,t2 as Se,r2 as Te,e2 as Ue,O5 as Ve};
719
+ export{Q4 as we,Z4 as xe,V1 as ye,L4 as ze,X4 as Ae,o as Be,_4 as Ce,I1 as De,g as Ee,_ as Fe,t0 as Ge,M0 as He,D as Ie,Q0 as Je,Q1 as Ke,A0 as Le,d as Me,bO as Ne,D0 as Oe,AO as Pe,o$ as Qe,o2 as Re,a2 as Se,t2 as Te,r2 as Ue,e2 as Ve,O5 as We};