blade-code 0.10.137 → 0.10.139
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-5dwmhsrx.js → chunk-04t21rey.js} +1 -1
- package/dist/{chunk-w9z34f27.js → chunk-05cv54r8.js} +1 -1
- package/dist/{chunk-h74p51hg.js → chunk-16648v5c.js} +1 -1
- package/dist/{chunk-c2mx5zg0.js → chunk-1bqatrxs.js} +1 -1
- package/dist/{chunk-bx75fd0d.js → chunk-1h3736q2.js} +387 -387
- package/dist/{chunk-bzqbmz6t.js → chunk-25r1v5rn.js} +59 -59
- package/dist/chunk-2agbk8ef.js +1 -0
- package/dist/chunk-2bty4510.js +6 -0
- package/dist/chunk-2f7nr9hh.js +1 -0
- package/dist/{chunk-7ykqvsph.js → chunk-2jq9ed09.js} +1 -1
- package/dist/chunk-2t9vtt75.js +1 -0
- package/dist/chunk-3aaehgva.js +1 -0
- package/dist/{chunk-1evc05gr.js → chunk-3ekz3zms.js} +2 -2
- package/dist/{chunk-wzkh3e6a.js → chunk-3eskgvpy.js} +1 -1
- package/dist/chunk-3t5r41yh.js +1 -0
- package/dist/{chunk-ramana2t.js → chunk-40pd090k.js} +2 -2
- package/dist/{chunk-6e3mh79j.js → chunk-516adpx6.js} +1 -1
- package/dist/{chunk-q0s3gcjm.js → chunk-5j68055h.js} +1 -1
- package/dist/{chunk-ky9br0z8.js → chunk-5qwpdx3n.js} +1 -1
- package/dist/{chunk-e76gej4y.js → chunk-5w8pmsqe.js} +2 -2
- package/dist/chunk-5xgyx25z.js +2 -0
- package/dist/{chunk-wxtj6gqb.js → chunk-65c3vjwm.js} +1 -1
- package/dist/{chunk-69rjav47.js → chunk-6ezffjq1.js} +1 -1
- package/dist/{chunk-5btfnf2r.js → chunk-6j5v5emj.js} +4 -4
- package/dist/{chunk-9frd4fpk.js → chunk-6qhbdcse.js} +2 -2
- package/dist/{chunk-wa71vstt.js → chunk-7j4s1nrc.js} +1 -1
- package/dist/{chunk-affzv7f1.js → chunk-7pg5y3pg.js} +1 -1
- package/dist/{chunk-na4wzne8.js → chunk-8py443a5.js} +1 -1
- package/dist/{chunk-ybc5myz7.js → chunk-8rccn1y2.js} +1 -1
- package/dist/{chunk-0c82q1sz.js → chunk-9m7d3ajv.js} +1 -1
- package/dist/{chunk-p0gbxaqz.js → chunk-a5hkv8er.js} +2 -2
- package/dist/{chunk-xt0ktytp.js → chunk-awheqy52.js} +2 -2
- package/dist/{chunk-69nwa6bn.js → chunk-az08pq83.js} +1 -1
- package/dist/{chunk-y6jee9w7.js → chunk-bgzj85za.js} +1 -1
- package/dist/{chunk-0ccm29qy.js → chunk-bq6d0v5b.js} +2 -2
- package/dist/{chunk-zk9rf1d7.js → chunk-cefmcwyv.js} +2 -2
- package/dist/{chunk-4jqw75ce.js → chunk-d64b7wta.js} +1 -1
- package/dist/{chunk-g799czsy.js → chunk-dv2m2xe5.js} +1 -1
- package/dist/{chunk-h05qhgrb.js → chunk-dw0mewc2.js} +2 -2
- package/dist/{chunk-nxnmqk4s.js → chunk-earhezc8.js} +1 -1
- package/dist/{chunk-chspy9f8.js → chunk-esff371k.js} +7 -7
- package/dist/{chunk-f2b9cyj5.js → chunk-f4cn6v8t.js} +2 -2
- package/dist/{chunk-mzye1ah2.js → chunk-fbrdcveb.js} +1 -1
- package/dist/{chunk-vp6d1fqp.js → chunk-ft1bdqbs.js} +2 -2
- package/dist/{chunk-vg3zwv4g.js → chunk-gc4kj295.js} +1 -1
- package/dist/chunk-gjc1hhhv.js +1 -0
- package/dist/chunk-grx6fv9w.js +5 -0
- package/dist/chunk-gx4seq5c.js +10 -0
- package/dist/chunk-h2gp7smy.js +1 -0
- package/dist/{chunk-74bswv4z.js → chunk-hrcz179j.js} +2 -2
- package/dist/{chunk-xg9fyvw0.js → chunk-jb4hmk56.js} +2 -2
- package/dist/{chunk-wxypv01z.js → chunk-jy7k2dwm.js} +2 -2
- package/dist/chunk-mc2mr1kn.js +2 -0
- package/dist/{chunk-wc9wsyrc.js → chunk-mec8yedz.js} +1 -1
- package/dist/{chunk-gpj7k3er.js → chunk-mh3ne2sf.js} +2 -2
- package/dist/chunk-mkckss82.js +1 -0
- package/dist/{chunk-g9vdmvk2.js → chunk-mtfjwsn2.js} +2 -2
- package/dist/{chunk-6xvrrypm.js → chunk-npc7jt96.js} +1 -1
- package/dist/chunk-ntpwqfy3.js +1 -0
- package/dist/chunk-q82ntq7t.js +1 -0
- package/dist/{chunk-mthf5akx.js → chunk-qrv72yy6.js} +2 -2
- package/dist/{chunk-5sf2rc1z.js → chunk-recafw5r.js} +3 -3
- package/dist/{chunk-karq4wfd.js → chunk-rhwkvx96.js} +1 -1
- package/dist/{chunk-mavranwn.js → chunk-sdhdn0yx.js} +3 -3
- package/dist/{chunk-e8pfbb6c.js → chunk-sj4gz23a.js} +1 -1
- package/dist/chunk-smjfqtws.js +1 -0
- package/dist/{chunk-0k2x2ae6.js → chunk-t88sfhjj.js} +1 -1
- package/dist/{chunk-39de5k03.js → chunk-v2fewxvw.js} +2 -2
- package/dist/chunk-wazhd8bm.js +1 -0
- package/dist/chunk-wf4s1hp2.js +1 -0
- package/dist/{chunk-v5503t2t.js → chunk-x3c718v5.js} +4 -4
- package/dist/{chunk-etf3e9kt.js → chunk-yvmexv2c.js} +1 -1
- package/dist/{chunk-75yy9yre.js → chunk-z9qv0d6k.js} +1 -1
- package/dist/{chunk-z3hpstky.js → chunk-zx78c1an.js} +1 -1
- package/dist/{chunk-rgjr7jsd.js → chunk-zz5n2qxk.js} +1 -1
- package/dist/web/assets/ChatView-CQnuGDqk.js +63 -0
- package/dist/web/assets/{CodeBlockHighlighter-Czp4VZIg.js → CodeBlockHighlighter-CYhxXWvb.js} +1 -1
- package/dist/web/assets/{FilePreview-BJWuYfyF.js → FilePreview-ByTaE1GR.js} +1 -1
- package/dist/web/assets/{KanbanBoard-DrYzt5Kh.js → KanbanBoard-KMmGvNPc.js} +1 -1
- package/dist/web/assets/{MarkdownRenderer-DxkR5r7t.js → MarkdownRenderer-C6lKOJaG.js} +3 -3
- package/dist/web/assets/{ScrollArea-D71pJjgW.js → ScrollArea-Bo6cZ3PH.js} +1 -1
- package/dist/web/assets/{SessionHistorySurface-2y9bnndm.js → SessionHistorySurface-Cymc4xw0.js} +1 -1
- package/dist/web/assets/{SettingsModal-BbaTL5Rk.js → SettingsModal-D36xhHwa.js} +5 -10
- package/dist/web/assets/{Sidebar-COZltpL9.js → Sidebar-DEGQINYb.js} +1 -1
- package/dist/web/assets/{TaskSwitcher-3giB7l1P.js → TaskSwitcher-BEISb7-8.js} +1 -1
- package/dist/web/assets/{TerminalPanel-gvTTiTgX.js → TerminalPanel-B7PXaRGh.js} +1 -1
- package/dist/web/assets/{archive-DndqAA2q.js → archive-Dyn5Oz68.js} +1 -1
- package/dist/web/assets/{arrow-left-XNYfpUAb.js → arrow-left-mWU3P1zb.js} +1 -1
- package/dist/web/assets/{calendar-clock-BQOfNcCK.js → calendar-clock-B6b0Cb3d.js} +1 -1
- package/dist/web/assets/{chevron-right-Cvq3LzHK.js → chevron-right-Cl6g5_0e.js} +1 -1
- package/dist/web/assets/{chevrons-up-down-Dia1U9Sz.js → chevrons-up-down-FKryGzO4.js} +1 -1
- package/dist/web/assets/{clock-3-CnxLS8cv.js → clock-3-CfVjvMmA.js} +1 -1
- package/dist/web/assets/{copy-CWCS3Lql.js → copy-CIYuf7du.js} +1 -1
- package/dist/web/assets/{download-DXdsM18t.js → download-DecDFX8n.js} +1 -1
- package/dist/web/assets/{external-link-1IN2ZfaO.js → external-link-DaSwvjf7.js} +1 -1
- package/dist/web/assets/{folder-Bpq602dI.js → folder-DZtlKvFm.js} +1 -1
- package/dist/web/assets/{index-57UZsfTt.css → index-DC2p1vGD.css} +1 -1
- package/dist/web/assets/index-DQaqO-lw.js +203 -0
- package/dist/web/assets/{pause-BYhoGDZq.js → pause-Bd-STGLc.js} +1 -1
- package/dist/web/assets/{pencil-pRZQVHFU.js → pencil-BoTIqqxX.js} +1 -1
- package/dist/web/assets/{play-DGZdCyPk.js → play-C4ctis0t.js} +1 -1
- package/dist/web/assets/{plus-CAQ3qlUJ.js → plus-D08TlGJu.js} +1 -1
- package/dist/web/assets/session-events-DKjIMNKI.js +29 -0
- package/dist/web/assets/{settings-BPfzj_Vf.js → settings-BGRhMFaU.js} +1 -1
- package/dist/web/assets/team-CPme0l2K.js +6 -0
- package/dist/web/assets/{teamService-BScT9o9A.js → teamService-CVCtTVfY.js} +1 -1
- package/dist/web/assets/{terminal-CldJbdMr.js → terminal-D7GsyYki.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-35668hyn.js +0 -1
- package/dist/chunk-3gmcvd0c.js +0 -1
- package/dist/chunk-5774a669.js +0 -1
- package/dist/chunk-7n035mhg.js +0 -1
- package/dist/chunk-9a7bppj7.js +0 -2
- package/dist/chunk-a26vtcv5.js +0 -5
- package/dist/chunk-b08thknq.js +0 -1
- package/dist/chunk-d6tbr25k.js +0 -1
- package/dist/chunk-dt9n4f4e.js +0 -1
- package/dist/chunk-ermypm1x.js +0 -2
- package/dist/chunk-esp69w6w.js +0 -1
- package/dist/chunk-g1y60ey9.js +0 -1
- package/dist/chunk-gf5v8aff.js +0 -1
- package/dist/chunk-m9kh7djg.js +0 -6
- package/dist/chunk-ntmkzrs8.js +0 -1
- package/dist/chunk-pj15kt5b.js +0 -10
- package/dist/chunk-pv1vwasz.js +0 -1
- package/dist/chunk-vda03kxj.js +0 -1
- package/dist/web/assets/ChatView-DpvPjAh7.js +0 -63
- package/dist/web/assets/index-DEOQizD2.js +0 -203
- package/dist/web/assets/session-events-C5_Q0kZV.js +0 -29
- package/dist/web/assets/team-QZ9byb3E.js +0 -1
package/dist/blade.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{tf as W}from"./chunk-3ekz3zms.js";import{wf as F,xf as M}from"./chunk-6qhbdcse.js";import"./chunk-x3c718v5.js";import"./chunk-v508x7cg.js";import"./chunk-5j68055h.js";import"./chunk-sdhdn0yx.js";import"./chunk-1bqatrxs.js";import"./chunk-40pd090k.js";import"./chunk-npc7jt96.js";import"./chunk-mc2mr1kn.js";import{Ui as N,Vi as B}from"./chunk-dv2m2xe5.js";import"./chunk-fbrdcveb.js";import{uj as T}from"./chunk-ft1bdqbs.js";import"./chunk-jb4hmk56.js";import"./chunk-65c3vjwm.js";import"./chunk-mtfjwsn2.js";import"./chunk-jy7k2dwm.js";import"./chunk-earhezc8.js";import"./chunk-t88sfhjj.js";import{Ek as J}from"./chunk-516adpx6.js";import p from"node:path";var E=process.argv.slice(2),I=c(E),u=I!==null;if(I!==null)T.setGlobalDebug(I);function c(Q){for(let Y=0;Y<Q.length;Y+=1){let U=Q[Y];if(U==="--debug"||U==="-d"){let X=Q[Y+1];return X&&!X.startsWith("-")?X:!0}if(U.startsWith("--debug="))return U.slice(8)||!0}return null}function m(Q){return Q.length===1&&(Q[0]==="--version"||Q[0]==="-V")}function q(Q,...Y){return Q.some((U)=>Y.some((X)=>U===X||U.startsWith(`${X}=`)))}function t(Q,...Y){let U=[];for(let X=0;X<Q.length;X+=1){let G=Q[X],z=Y.find(($)=>G.startsWith(`${$}=`));if(z){let $=G.slice(z.length+1);if($)U.push($);continue}if(Y.includes(G)){let $=Q[X+1];if($&&!$.startsWith("-"))U.push($),X+=1}}return U}async function l(){if(m(E)){let{getVersion:K}=await import("./chunk-2f7nr9hh.js");console.log(K());return}let Q=process.cwd(),Y=F(Q);M(Y),N(B());let U=t(E,"--plugin-dir","--pluginDir");if(U.length>0){let{configureInvocationPluginDirs:K}=await import("./chunk-gjc1hhhv.js");K(U.map((Z)=>p.resolve(Q,Z)))}if(q(E,"--trust-workspace","--trustWorkspace")){let{WorkspaceTrustService:K}=await import("./chunk-3t5r41yh.js");await K.getInstance().trust(B())}if(process.getuid&&process.getuid()===0){let K=!!process.env.SUDO_USER,Z=!!process.env.BLADE_ALLOW_ROOT;if(K&&!Z)console.error(""),console.error("Error: 请不要使用 sudo 运行 blade"),console.error(""),console.error("原因:"),console.error(" 使用 sudo 会创建属于 root 的配置文件,"),console.error(" 导致普通用户无法访问。"),console.error(""),console.error("正确用法:"),console.error(" blade # 直接运行,不要加 sudo"),console.error(""),console.error("如果遇到权限错误,请运行:"),console.error(" sudo chown -R $USER:$USER ~/.blade/"),console.error(""),console.error("如果你确实需要以 root 运行(容器/CI),设置环境变量:"),console.error(" BLADE_ALLOW_ROOT=1 blade"),console.error(""),process.exit(1)}if(q(E,"--headless")){let{handleHeadlessMode:K}=await import("./chunk-2bty4510.js");if(await K())return}if(W(),q(E,"--print","-p")){let{handlePrintMode:K}=await import("./chunk-gc4kj295.js");if(await K())return}if(E.includes("--acp")){let{runAcpIntegration:K}=await import("./chunk-esff371k.js");await K();return}let[{default:X},{hideBin:G},{cliConfig:z,globalOptions:$},{loadConfiguration:_,validateOutput:D,validatePermissions:R},{browserCommands:S},{doctorCommands:k},{installCommands:O},{mcpCommands:y},{projectsCommands:V},{scheduleCommands:b},{serveCommand:P},{updateCommands:x},{webCommand:A}]=await Promise.all([import("yargs"),import("yargs/helpers"),import("./chunk-wf4s1hp2.js"),import("./chunk-wazhd8bm.js"),import("./chunk-6ezffjq1.js"),import("./chunk-qrv72yy6.js"),import("./chunk-8rccn1y2.js"),import("./chunk-7pg5y3pg.js"),import("./chunk-7j4s1nrc.js"),import("./chunk-z9qv0d6k.js"),import("./chunk-mkckss82.js"),import("./chunk-mec8yedz.js"),import("./chunk-gx4seq5c.js")]),h=X(G(process.argv)).scriptName(z.scriptName).usage(z.usage).version(z.version).locale(z.locale).showHelpOnFail(z.showHelpOnFail).demandCommand(0,"").recommendCommands().strict(z.strict).parserConfiguration({"populate--":!0}).options($).middleware([_,R,D]).command(S).command(y).command(V).command(b).command(k).command(x).command(O).command(A).command(P).completion("completion",!1).help("help","Show help").alias("help","h").alias("version","V").fail((K,Z,L)=>{if(Z){if(console.error("An error occurred:"),console.error(Z.message),u&&Z.stack)console.error(`
|
|
3
3
|
Stack trace:`),console.error(Z.stack);else console.error(`
|
|
4
4
|
Run with --debug to show the stack trace.`);process.exit(1)}if(K)console.error("Error: Invalid arguments:"),console.error(K),console.error(`
|
|
5
|
-
Hint: Did you mean:`),L.showHelp(),process.exit(1)}).command("$0",!1,()=>{},async(K)=>{let Z=K._.slice(1),L=Z.length>0?Z.join(" "):void 0,f=import("./chunk-
|
|
5
|
+
Hint: Did you mean:`),L.showHelp(),process.exit(1)}).command("$0",!1,()=>{},async(K)=>{let Z=K._.slice(1),L=Z.length>0?Z.join(" "):void 0,f=import("./chunk-q82ntq7t.js").then(({checkVersionOnStartup:v})=>v()),[{render:w},{createElement:j},{AppWrapper:C}]=await Promise.all([import("ink"),import("react"),import("./chunk-25r1v5rn.js")]),H={...K,initialMessage:L,debug:K.debug,print:Boolean(K.print),versionCheckPromise:f};delete H._,delete H.$0,delete H.message,w(j(C,H),{patchConsole:!0,exitOnCtrlC:!1,alternateBuffer:!1})});try{await h.parse()}catch(K){console.error("Error: Parse error:",K),process.exit(1)}}if(J.main==J.module)l().catch(console.error);export{l as main};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Pj as S}from"./chunk-mtfjwsn2.js";import{Ek as f}from"./chunk-516adpx6.js";import*as $ from"fs/promises";import*as K from"path";import j from"semver";import{ProxyAgent as H,fetch as I}from"undici";function R(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.https_proxy||process.env.http_proxy}function N(){let q=R();if(q)try{return new H(q)}catch(z){console.warn(`[proxyFetch] Invalid proxy URL: ${q}`)}return}async function M(q,z={}){let{timeout:W=30000,signal:Q,...B}=z;if(Q?.aborted)throw new DOMException("The operation was aborted.","AbortError");let J=N(),X=new AbortController,Y=!1,F=setTimeout(()=>{Y=!0,X.abort()},W),b=()=>X.abort();Q?.addEventListener("abort",b);try{let Z={method:B.method,headers:B.headers,body:B.body,signal:X.signal,dispatcher:J};return await I(q.toString(),Z)}catch(Z){if(Z instanceof Error&&Z.name==="AbortError"){if(Y)throw Error(`Request timeout after ${W}ms`);throw Z}throw Z}finally{clearTimeout(F),Q?.removeEventListener("abort",b)}}var w="blade-code",y="https://cdn.jsdelivr.net/npm/blade-code@latest/CHANGELOG.md",G=K.join(process.env.HOME||process.env.USERPROFILE||".",".blade"),O=K.join(G,"version-cache.json"),P=3600000,k=`https://registry.npmjs.org/${w}/latest`;async function L(){try{if(process.env.BLADE_VERSION)return process.env.BLADE_VERSION;return S()}catch{return"unknown"}}async function T(){try{let q=await $.readFile(O,"utf-8"),z=JSON.parse(q);if(Date.now()-z.checkedAt<P)return z;return{...z,checkedAt:0}}catch{return null}}async function D(q){try{await $.mkdir(G,{recursive:!0,mode:493}),await $.writeFile(O,JSON.stringify(q,null,2))}catch{}}async function x(){try{let q=await M(k,{timeout:5000,headers:{Accept:"application/json"}});if(!q.ok)return null;return(await q.json()).version||null}catch{return null}}async function _(q=!1){let z=await L(),W=y;if(z==="unknown")return{currentVersion:z,latestVersion:null,hasUpdate:!1,shouldPrompt:!1,releaseNotesUrl:W,error:"Unable to determine current version"};let Q=await T(),B=Q?.skipUntilVersion,J=null;if(!q&&Q?.latestVersion&&Q.checkedAt>0)J=Q.latestVersion;else if(J=await x(),J)await D({latestVersion:J,checkedAt:Date.now(),skipUntilVersion:B});else if(Q?.latestVersion)await D({checkedAt:0,skipUntilVersion:B});if(!J||!j.valid(J))return{currentVersion:z,latestVersion:null,hasUpdate:!1,shouldPrompt:!1,releaseNotesUrl:W,error:"Unable to check for updates"};if(j.lt(J,z))J=z,await D({latestVersion:J,checkedAt:Date.now(),skipUntilVersion:B});let X=j.gt(J,z),Y=X;if(X&&B)Y=j.gt(J,B);return{currentVersion:z,latestVersion:J,hasUpdate:X,shouldPrompt:Y,releaseNotesUrl:W}}async function u(q){let z=await T();await D({latestVersion:z?.latestVersion??q,checkedAt:z?.checkedAt||Date.now(),skipUntilVersion:q})}function g(){return`npm install -g ${w}@latest --registry https://registry.npmjs.org`}async function C(){let{spawn:q}=await import("child_process");return new Promise((z)=>{let W=g(),Q=q(W,{stdio:"inherit",shell:!0});Q.on("close",(B)=>{if(B===0)z({success:!0,message:"Upgrade successful! Please restart blade."});else z({success:!1,message:`Upgrade failed (exit code: ${B})`})}),Q.on("error",(B)=>{z({success:!1,message:`Upgrade failed: ${B.message}`})})})}async function V(){try{let q=await _();return q.shouldPrompt?q:null}catch{return null}}
|
|
2
2
|
export{_ as k,u as l,g as m,C as n,V as o};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ba as L,za as F}from"./chunk-
|
|
1
|
+
import{Ba as L,za as F}from"./chunk-1h3736q2.js";import{Td as $,Vd as B,be as Q}from"./chunk-cefmcwyv.js";import{Sg as y}from"./chunk-f4cn6v8t.js";import{Vi as V}from"./chunk-dv2m2xe5.js";async function j(){await y(V())}async function I(b){let q=b.message||b._?.[0];if(typeof q==="string"&&q.trim())return q;let z=b.stdin??process.stdin;if(!z.isTTY){let G=[];for await(let K of z)G.push(K);return Buffer.concat(G).toString("utf-8").trim()}if(b.defaultMessage!==void 0)return b.defaultMessage;throw Error("No input provided")}async function M(b){let q=b.message||b._?.[0];if(typeof q==="string"&&q.trim())return q;let z=b.stdin??process.stdin;if(z.isTTY)return;let G=[];for await(let Z of z)G.push(Buffer.isBuffer(Z)?Z:Buffer.from(Z));return Buffer.concat(G).toString("utf-8").trim()||void 0}async function R(b){if(!F(b))return{mode:"agent",content:b};let q=await L(b,{cwd:V(),surface:"headless",workspaceRoot:V()});if(!q.success)return{mode:"output",content:`Error: ${q.error||"未知错误"}`,exitCode:1};let z=q.data;if(z?.action==="invoke_skill"){let{skillName:G,skillArgs:K}=z;return{mode:"agent",content:K?`Please use the "${G}" skill to help me with: ${K}`:`Please use the "${G}" skill.`}}if(z?.action==="invoke_custom_command"||z?.action==="invoke_plugin_command"){let G=z.processedContent;return{mode:"agent",content:`# Custom Command: /${z.commandName}
|
|
2
2
|
|
|
3
3
|
${G}`}}return{mode:"output",content:q.content||q.message||"",exitCode:0}}import{readFile as D,stat as H}from"node:fs/promises";import J from"node:path";function x(b,q){let z;try{z=JSON.parse(b)}catch(G){throw Error(`Invalid JSON output schema from ${q}`,{cause:G})}return B(z).schema}async function _(b){if(b.jsonSchema!==void 0&&b.outputSchema!==void 0)throw Error("--json-schema cannot be combined with --output-schema");if(b.jsonSchema!==void 0)return x(b.jsonSchema,"--json-schema");if(b.outputSchema===void 0)return;let q=J.resolve(b.outputSchema),z=await H(q);if(!z.isFile())throw Error(`Output schema path is not a regular file: ${q}`);if(z.size>$)throw Error(`Output schema exceeds ${$} bytes: ${q}`);return x(await D(q,"utf8"),q)}function N(b){if(!(b instanceof Error))return!1;return b.message.includes("未找到会话")||b.message.includes("ENOENT")||b.message.includes("no such file")}async function W(b){try{return await Q.loadSessionModelContext(b,V())}catch(q){if(N(q))return null;throw q}}async function C(b){if(b.resume===!0||b.resume==="true")throw Error("--resume without a session ID is only supported in interactive UI mode");if(typeof b.resume==="string"&&b.resume.length>0){if(b.forkSession){let G=V(),K=await Q.forkSession(b.resume,{newSessionId:b.sessionId,sourceProjectPath:G,targetProjectPath:G});return{...K,messages:await Q.loadSessionModelContext(K.sessionId,G)}}let[q,z]=await Promise.all([Q.loadSessionModelContext(b.resume),Q.findSessionMetadata(b.resume)]);return{sessionId:b.resume,messages:q,metadata:z}}if(b.continue){let q=b.forkSession?await Q.listSessions({cwd:V()}):await Q.listSessions();if(q.length>0){let z=q[0].sessionId;if(b.forkSession){let G=V(),K=await Q.forkSession(z,{newSessionId:b.sessionId,sourceProjectPath:G,targetProjectPath:G});return{...K,messages:await Q.loadSessionModelContext(K.sessionId,G)}}return{sessionId:z,messages:await Q.loadSessionModelContext(z),metadata:q[0]}}if(b.forkSession)throw Error("Cannot fork: no sessions are available to continue")}if(b.sessionId){let q=await W(b.sessionId);return{sessionId:b.sessionId,messages:q??[],...q?{metadata:await Q.findSessionMetadata(b.sessionId,V())}:{}}}return{sessionId:`${b.fallbackSessionPrefix}-${Date.now()}`,messages:[]}}
|
|
4
4
|
export{j as p,I as q,M as r,R as s,_ as t,C as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ek as K}from"./chunk-516adpx6.js";import{spawn as Y}from"node:child_process";import{constants as j}from"node:fs";import{access as x,readFile as B}from"node:fs/promises";import{createRequire as L}from"node:module";import C from"node:path";var P="blade browser install";var D=["PATH","Path","PATHEXT","HOME","USERPROFILE","LOCALAPPDATA","PROGRAMDATA","TMPDIR","TMP","TEMP","LANG","LC_ALL","LC_CTYPE","TZ","SystemRoot","SYSTEMROOT","WINDIR","COMSPEC","XDG_RUNTIME_DIR","CHROME_DEVEL_SANDBOX"],A=[...D,"PLAYWRIGHT_BROWSERS_PATH","PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT","PLAYWRIGHT_DOWNLOAD_HOST","PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST","HTTP_PROXY","HTTPS_PROXY","NO_PROXY","http_proxy","https_proxy","no_proxy","NODE_EXTRA_CA_CERTS","SSL_CERT_FILE","SSL_CERT_DIR"],J=32768,M=4096;function U(f,F){let $={};for(let Z of F){let q=f[Z];if(q!==void 0&&q.length<=J)$[Z]=q}return $}function V(f=process.env){return U(f,D)}function S(f=process.env){return U(f,A)}function W(){return L(import.meta.url).resolve("playwright/package.json")}function y(f=W){return C.join(C.dirname(f()),"cli.js")}async function T(){return await import("playwright")}async function m(f){let F=JSON.parse(await B(f,"utf8"));if(typeof F.version!=="string"||F.version.length===0)throw Error("Playwright package version is invalid");return F.version}function I(f){return(f instanceof Error?f.message:String(f)).replace(/[\r\n]+/g," ").slice(0,M)}async function R(f={}){let $=(f.resolvePackageJson??W)(),Z=await m($),q=await(f.loadPlaywright??T)(),G=q.chromium.executablePath(),H=f.access??x,z;try{await H(G,j.X_OK),z=await q.chromium.launch({executablePath:G,headless:!0,chromiumSandbox:!0,env:V(f.environment)});let Q=z.version();return await z.close(),z=void 0,{playwrightVersion:Z,executablePath:G,installed:!0,browserVersion:Q}}catch(Q){return{playwrightVersion:Z,executablePath:G,installed:!1,error:I(Q)}}finally{await z?.close().catch(()=>{return})}}async function N(f={}){let F=f.resolvePackageJson??W,$=y(F),Z=f.spawn??((q,G,H)=>Y(q,[...G],H));await new Promise((q,G)=>{let H=Z(f.execPath??process.execPath,[$,"install","chromium"],{env:S(f.environment),shell:!1,stdio:"inherit"}),z=!1;H.once("error",(Q)=>{if(z)return;z=!0,G(Q)}),H.once("close",(Q,X)=>{if(z)return;if(z=!0,Q===0){q();return}G(Error(X?`Playwright browser installer stopped by ${X}`:`Playwright browser installer exited with code ${Q??1}`))})})}
|
|
2
2
|
export{P as Ea,V as Fa,R as Ga,N as Ha};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{spawn as I}from"node:child_process";var X=500;function x(j){return new Promise((q)=>setTimeout(q,j))}function Z(j){return j&&typeof j==="object"&&"code"in j?String(j.code):void 0}function L(j){return j()||j()}function G(j,q=process.platform,y=process.kill.bind(process)){if(q==="win32"||!Number.isInteger(j)||j<=1||j===process.pid)return!1;try{return y(-j,0),!0}catch(z){let B=Z(z);if(B==="ESRCH")return!1;if(B==="EPERM")return!0;throw z}}function N(j,q){return new Promise((y)=>{let z=["/PID",String(j),"/T"];if(q)z.push("/F");let B=I("taskkill",z,{stdio:"ignore",windowsHide:!0}),K=!1,J=(H)=>{if(K)return;K=!0,y(H)};B.once("error",()=>J(!1)),B.once("close",(H)=>J(H===0))})}async function F(j,q={}){if(!Number.isInteger(j)||j<=1||j===process.pid)return{success:!1,alreadyExited:!1,forced:!1};let y=q.platform??process.platform,z=q.gracePeriodMs??X,B=q.killProcess??process.kill.bind(process),K=q.taskkill??N,J=q.wait??x,H=q.validatePidOwnership??(()=>!0);if(!L(H))return{success:!1,alreadyExited:!1,forced:!1};if(y==="win32"){let V=await K(j,!1);if(await J(z),!H())return{success:V,alreadyExited:!1,forced:!1};let Y=await K(j,!0);return{success:V||Y,alreadyExited:!V&&!Y,forced:Y}}let Q=(V,Y)=>{try{return B(V,Y)}catch(D){return Z(D)==="ESRCH"}},W=Q(-j,"SIGTERM")||Q(j,"SIGTERM");if(await J(z),!H())return{success:W,alreadyExited:!1,forced:!1};let $=Q(-j,"SIGKILL")||Q(j,"SIGKILL");return{success:W||$,alreadyExited:!1,forced:$}}async function R(j,q={}){if(!Number.isInteger(j)||j<=1||j===process.pid)return{success:!1,alreadyExited:!1,forced:!1};if((q.platform??process.platform)==="win32")return{success:!1,alreadyExited:!1,forced:!1};let z=q.gracePeriodMs??X,B=q.killProcess??process.kill.bind(process),K=q.wait??x,J=q.validatePidOwnership??(()=>!0);if(!J())return{success:!1,alreadyExited:!1,forced:!1};let H=($)=>{try{return B(-j,$),"sent"}catch(V){return Z(V)==="ESRCH"?"missing":"failed"}},Q=H("SIGTERM");if(Q==="missing")return{success:!0,alreadyExited:!0,forced:!1};if(Q==="failed")return{success:!1,alreadyExited:!1,forced:!1};if(await K(z),!J())return{success:!1,alreadyExited:!1,forced:!1};let W=H("SIGKILL");return{success:W!=="failed",alreadyExited:W==="missing",forced:W==="sent"}}class b{child;state="owned";terminationPromise;terminationResult;platform;gracePeriodMs;killProcess;taskkill;wait;constructor(j,q={}){this.child=j;if(this.platform=q.platform??process.platform,this.gracePeriodMs=q.gracePeriodMs??X,this.killProcess=q.killProcess??process.kill.bind(process),this.taskkill=q.taskkill??N,this.wait=q.wait??x,q.releaseOnExit!==!1){let y=()=>{if(this.state==="owned")this.state="released"};j.once("close",y),j.once("error",y)}}release(){if(this.state==="owned")this.state="released"}terminate(){if(this.terminationPromise)return this.terminationPromise;if(this.terminationResult)return Promise.resolve(this.terminationResult);if(this.state==="released")return this.terminationResult={success:!0,alreadyExited:!0,forced:!1},Promise.resolve(this.terminationResult);return this.state="terminating",this.terminationPromise=this.terminateOwnedTree().then((j)=>{return this.state="released",this.terminationResult=j,j}),this.terminationPromise}async terminateOwnedTree(){let j=this.child.pid;if(!j)return{success:!1,alreadyExited:!0,forced:!1};if(this.platform==="win32"){let z=await this.taskkill(j,!1);await this.wait(this.gracePeriodMs);let B=await this.taskkill(j,!0);if(!z&&!B)return{success:this.signalDirectChild("SIGKILL"),alreadyExited:!1,forced:!0};return{success:!0,alreadyExited:!1,forced:!0}}let q=this.signalPosixTree(j,"SIGTERM");await this.wait(this.gracePeriodMs);let y=this.signalPosixTree(j,"SIGKILL");return{success:q||y,alreadyExited:!1,forced:y}}signalPosixTree(j,q){if(j<=1||j===process.pid)return this.signalDirectChild(q);try{return this.killProcess(-j,q)}catch(y){if(Z(y)==="ESRCH")return!0;return this.signalDirectChild(q)}}signalDirectChild(j){try{return this.child.kill(j)}catch(q){return Z(q)==="ESRCH"}}}function v(j,q,y={},z={}){let B=I(j,q,{...y,detached:process.platform==="win32"?y.detached:!0,windowsHide:y.windowsHide??!0});return{child:B,processTree:new b(B,z)}}
|
|
2
|
-
export{G as
|
|
2
|
+
export{G as sh,F as th,R as uh,v as vh};
|