blade-code 0.10.38 → 0.10.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blade.js +2 -2
- package/dist/{chunk-m0a2zdm8.js → chunk-03bzxkdg.js} +1 -1
- package/dist/chunk-0442z8f4.js +1 -0
- package/dist/{chunk-6aw2ts3m.js → chunk-0s11h8yd.js} +1 -1
- package/dist/{chunk-vxpj2jgx.js → chunk-1hea2ad2.js} +1 -1
- package/dist/chunk-2b4h0nb5.js +1 -0
- package/dist/{chunk-6t2bkj8s.js → chunk-2fgmsnh6.js} +1 -1
- package/dist/{chunk-gh0vdddb.js → chunk-34cexc50.js} +1 -1
- package/dist/{chunk-atdb1pks.js → chunk-3azdwanx.js} +1 -1
- package/dist/chunk-3nj2f0q9.js +2 -0
- package/dist/chunk-3w64mkc3.js +22 -0
- package/dist/{chunk-g7v01gjg.js → chunk-4dq8rbq2.js} +187 -187
- package/dist/{chunk-r863t0fx.js → chunk-4p8sp6p3.js} +1 -1
- package/dist/{chunk-9zfr1ydk.js → chunk-4wk9cc2b.js} +1 -1
- package/dist/{chunk-kzr5n83y.js → chunk-74jd1hcs.js} +57 -57
- package/dist/{chunk-gvx3707k.js → chunk-7qj2tbew.js} +1 -1
- package/dist/{chunk-jtjcg93t.js → chunk-8jexqfqg.js} +1 -1
- package/dist/{chunk-asqah231.js → chunk-8kqnezvc.js} +1 -1
- package/dist/{chunk-m3yb3rek.js → chunk-9dxkfqxg.js} +1 -1
- package/dist/{chunk-9yd3av82.js → chunk-9wxj0gxa.js} +1 -1
- package/dist/chunk-bqpqh6re.js +2 -0
- package/dist/{chunk-5xfef98g.js → chunk-dhcm8958.js} +1 -1
- package/dist/{chunk-0tdc8pg9.js → chunk-dhsdn91x.js} +1 -1
- package/dist/{chunk-tczrjn95.js → chunk-ew5dmar1.js} +2 -2
- package/dist/chunk-fa1gxd12.js +1 -0
- package/dist/{chunk-0dw58ycv.js → chunk-fk8jf873.js} +2 -2
- package/dist/{chunk-e6ttz45s.js → chunk-h188kz0p.js} +1 -1
- package/dist/{chunk-b9zfq3et.js → chunk-h7bat4ws.js} +1 -1
- package/dist/chunk-h9620q2d.js +1 -0
- package/dist/{chunk-rj1z55m8.js → chunk-hpqhk0jf.js} +1 -1
- package/dist/{chunk-y3sb4wda.js → chunk-k2hzhw9f.js} +1 -1
- package/dist/{chunk-a9r3w0t9.js → chunk-keart8yy.js} +2 -2
- package/dist/chunk-kpr5nqh2.js +5 -0
- package/dist/{chunk-aw4r1zhr.js → chunk-mc42kjv9.js} +2 -2
- package/dist/{chunk-ak37gg0n.js → chunk-np8f17zg.js} +1 -1
- package/dist/{chunk-kw543czm.js → chunk-nxc705wc.js} +1 -1
- package/dist/chunk-nzyc8z6k.js +6 -0
- package/dist/{chunk-cm4t4cz6.js → chunk-p504jme7.js} +2 -2
- package/dist/chunk-px491bge.js +1 -0
- package/dist/{chunk-921c6fm5.js → chunk-r01spp7a.js} +1 -1
- package/dist/{chunk-ydy9bvcp.js → chunk-rb1fv7en.js} +1 -1
- package/dist/{chunk-htvt9e1j.js → chunk-rs43m9d9.js} +4 -4
- package/dist/chunk-s3nz9qx8.js +1 -0
- package/dist/{chunk-qc5qwgpt.js → chunk-ts3pgkmz.js} +2 -2
- package/dist/chunk-v53vv0e9.js +6 -0
- package/dist/chunk-v85q852a.js +44 -0
- package/dist/{chunk-a1shhh83.js → chunk-vs7tcyse.js} +1 -1
- package/dist/{chunk-rfec0k27.js → chunk-vtb0m80j.js} +7 -7
- package/dist/chunk-vtdg5cb1.js +1 -0
- package/dist/chunk-vv0vk8bp.js +1 -0
- package/dist/chunk-w69qkark.js +1 -0
- package/dist/{chunk-199as76m.js → chunk-x6c6yqpx.js} +2 -2
- package/dist/chunk-xpmr9bf7.js +1 -0
- package/dist/{chunk-fj6frvhd.js → chunk-xtfy56qh.js} +1 -1
- package/dist/chunk-y10jqqyg.js +1 -0
- package/dist/{chunk-7t97xngf.js → chunk-ydz6bvs1.js} +48 -48
- package/dist/{chunk-e8wpd0s4.js → chunk-zfn7w33a.js} +1 -1
- package/dist/{chunk-jpzrwcm7.js → chunk-zv9jxwdp.js} +1 -1
- package/dist/web/assets/{ChatView-BB4nYdEf.js → ChatView-BP89vdT_.js} +14 -14
- package/dist/web/assets/{CodeBlockHighlighter-CAFugWXU.js → CodeBlockHighlighter-UnjC3KVk.js} +1 -1
- package/dist/web/assets/{FilePreview-O5aDfFS4.js → FilePreview-D0BiZowf.js} +1 -1
- package/dist/web/assets/{MarkdownRenderer-C_qekwq_.js → MarkdownRenderer-CPu_rkPT.js} +3 -3
- package/dist/web/assets/{SettingsModal-FADlD0Da.js → SettingsModal-CM9pcJas.js} +1 -1
- package/dist/web/assets/{TaskSwitcher-D3k3tRpI.js → TaskSwitcher-BOCm7kPO.js} +1 -1
- package/dist/web/assets/{TerminalPanel-DBmKVVbI.js → TerminalPanel-CUZ4slSS.js} +1 -1
- package/dist/web/assets/{index-CMIW4J1Q.js → index-CthLsVgC.js} +7 -7
- package/dist/web/assets/{session-events-Dk20sSDo.js → session-events-109FkhOM.js} +6 -6
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-0b3fnxry.js +0 -22
- package/dist/chunk-13bzyvs2.js +0 -1
- package/dist/chunk-169rpaqn.js +0 -1
- package/dist/chunk-2mkdj63h.js +0 -1
- package/dist/chunk-4mpx8rad.js +0 -1
- package/dist/chunk-572gdsjd.js +0 -1
- package/dist/chunk-8xp6djrk.js +0 -1
- package/dist/chunk-ahkpjvaq.js +0 -2
- package/dist/chunk-fjpqxdct.js +0 -1
- package/dist/chunk-gc7bk6v0.js +0 -1
- package/dist/chunk-h4k801hr.js +0 -6
- package/dist/chunk-hcrfkqc1.js +0 -1
- package/dist/chunk-hkrbsqsw.js +0 -6
- package/dist/chunk-jd764yqg.js +0 -5
- package/dist/chunk-jtv91ez8.js +0 -2
- package/dist/chunk-n5nj8d8f.js +0 -1
- package/dist/chunk-ts8h7mx5.js +0 -44
- package/dist/chunk-vxxhd72z.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{qd as N}from"./chunk-
|
|
1
|
+
import{qd as N}from"./chunk-vtb0m80j.js";import{Ee as $}from"./chunk-keart8yy.js";import{Nf as _}from"./chunk-6360fg4j.js";import{gg as Y,ig as Z}from"./chunk-fk8jf873.js";function X(){if(process.stdin.isTTY&&typeof process.stdin.setRawMode==="function")try{process.stdin.setRawMode(!1)}catch{}process.stdout.write("\x1B[<u"),process.stdout.write("\x1B[>4;0m"),process.stdout.write("\x1B[?2004l"),process.stdout.write("\x1B[?1004l"),process.stdout.write("\x1B[?1l\x1B>"),process.stdout.write("\x1B[?25h"),process.stdout.write("\x1B[0m")}var z=Z("Service");function E(b){switch(b){case"SIGINT":return"ctrl_c";case"esc":return"esc";case"uncaughtException":case"unhandledRejection":return"error";case"SIGTERM":case"normal":default:return"user_exit"}}class B{static instance=null;cleanupHandlers=[];isShuttingDown=!1;initialized=!1;lastSigintTime=0;SIGINT_DOUBLE_CLICK_WINDOW=3000;constructor(){}static getInstance(){if(!B.instance)B.instance=new B;return B.instance}initialize(){if(this.initialized){z.debug("[GracefulShutdown] 已初始化,跳过重复初始化");return}process.on("uncaughtException",(b)=>{this.handleFatalError("uncaughtException",b)}),process.on("unhandledRejection",(b)=>{let q=b instanceof Error?b:Error(String(b));this.handleFatalError("unhandledRejection",q)}),process.on("SIGTERM",()=>{z.info("[GracefulShutdown] 收到 SIGTERM 信号"),this.shutdown("SIGTERM",0)}),process.on("SIGINT",()=>{let b=Date.now();if(b-this.lastSigintTime<this.SIGINT_DOUBLE_CLICK_WINDOW)z.info("[GracefulShutdown] 收到第二次 SIGINT 信号,执行退出"),this.shutdown("SIGINT",0);else z.info("[GracefulShutdown] 收到第一次 SIGINT 信号,再按一次退出"),this.lastSigintTime=b,console.log(`
|
|
2
2
|
再按一次 Ctrl+C 退出
|
|
3
3
|
`)}),this.initialized=!0,z.debug("[GracefulShutdown] 全局错误处理器已初始化")}registerCleanup(b){return this.cleanupHandlers.push(b),z.debug(`[GracefulShutdown] 注册清理函数,当前共 ${this.cleanupHandlers.length} 个`),()=>{let q=this.cleanupHandlers.indexOf(b);if(q!==-1)this.cleanupHandlers.splice(q,1),z.debug(`[GracefulShutdown] 取消注册清理函数,剩余 ${this.cleanupHandlers.length} 个`)}}handleFatalError(b,q){if(this.isShuttingDown){console.error(`[GracefulShutdown] 退出过程中发生额外错误 (${b}):`,q);return}if(console.error(""),console.error("═".repeat(60)),console.error(`Uncaught error (${b})`),console.error("═".repeat(60)),console.error(""),console.error("错误信息:",q.message),console.error(""),q.stack)console.error("堆栈跟踪:"),console.error(q.stack);console.error(""),console.error("═".repeat(60)),console.error(""),this.shutdown(b,1)}async shutdown(b,q=0){if(this.isShuttingDown){z.debug("[GracefulShutdown] 已在退出过程中,跳过重复退出");return}this.isShuttingDown=!0;try{N().command.actions.abort("process-shutdown")}catch(A){z.warn("[GracefulShutdown] Failed to abort the active command",A)}z.info(`[GracefulShutdown] 开始优雅退出 (原因: ${b})`);let Q=setTimeout(()=>{X(),process.exit(q)},5000);Q.unref?.();let U=4000,K;try{await Promise.race([this.runCleanupHandlers(),new Promise((A,J)=>{K=setTimeout(()=>{J(Error(`清理超时 (${U}ms)`))},U),K.unref?.()})])}catch(A){console.error("[GracefulShutdown] 清理过程中发生错误:",A)}finally{if(K)clearTimeout(K)}try{let A=$.getInstance(),J=N(),V=J.session?.sessionId||"unknown",W=J.session?.workspaceRoot||_();if(A.isEnabled(W,V)){let v=J.config?.config?.permissionMode||"default";await A.executeSessionEndHooks(E(b),{projectDir:W,sessionId:V,permissionMode:v})}}catch(A){console.error("[GracefulShutdown] SessionEnd hooks 执行失败:",A)}try{await Y()}catch{}clearTimeout(Q),X(),setTimeout(()=>{process.exit(q)},100)}async runCleanupHandlers(){let b=[...this.cleanupHandlers].reverse();for(let q of b)try{let F=q();if(F instanceof Promise)await F}catch(F){console.error("[GracefulShutdown] 清理函数执行失败:",F)}}isExiting(){return this.isShuttingDown}reset(){this.isShuttingDown=!1,this.cleanupHandlers=[],this.initialized=!1}}var O=()=>{return B.getInstance()},y=(b)=>{return O().registerCleanup(b)},j=()=>{O().initialize()},C=(b=0)=>{O().shutdown("normal",b)};
|
|
4
4
|
export{O as _c,y as $c,j as ad,C as bd};
|
|
@@ -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-
|
|
1
|
+
import{m as R,n as c,o as g,p as d,q as m,r as l}from"./chunk-zv9jxwdp.js";import{L as M,S as y}from"./chunk-4dq8rbq2.js";import"./chunk-9wxj0gxa.js";import"./chunk-34cexc50.js";import{ib as h,rb as A}from"./chunk-74jd1hcs.js";import"./chunk-5cgyevqj.js";import{jc as w,xc as U}from"./chunk-7qj2tbew.js";import"./chunk-qgez5vw6.js";import"./chunk-3azdwanx.js";import{Uc as C}from"./chunk-dhsdn91x.js";import{Wc as I,Xc as S,Yc as v}from"./chunk-nzyc8z6k.js";import{Zc as O}from"./chunk-qggnvzkc.js";import"./chunk-0evyrnx0.js";import{ud as P}from"./chunk-vtb0m80j.js";import"./chunk-v508x7cg.js";import"./chunk-atsw605q.js";import"./chunk-kpr5nqh2.js";import"./chunk-3nj2f0q9.js";import"./chunk-3rjmkaey.js";import"./chunk-0s11h8yd.js";import"./chunk-vs7tcyse.js";import"./chunk-hq18c6r9.js";import"./chunk-zwt7f9ab.js";import"./chunk-ckfc7j7m.js";import"./chunk-keart8yy.js";import"./chunk-v11r4ahz.js";import"./chunk-v85q852a.js";import{Af as F}from"./chunk-a7pvtxvz.js";import"./chunk-93jx06kq.js";import"./chunk-thstqcg3.js";import{Nf as z}from"./chunk-6360fg4j.js";import"./chunk-bqpqh6re.js";import"./chunk-fk8jf873.js";import"./chunk-p504jme7.js";import"./chunk-8kqnezvc.js";import"./chunk-mc42kjv9.js";import"./chunk-ew5dmar1.js";import"./chunk-03bzxkdg.js";import"./chunk-ts3pgkmz.js";import"./chunk-8jexqfqg.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}
|